From d5a925b3bf62bdab88e171c549e82143d3977a0b Mon Sep 17 00:00:00 2001 From: szaka Date: Fri, 28 Oct 2005 18:00:44 +0000 Subject: [PATCH] ntfsinfo and ntfsls follow the convention how other utilities read the device argument: no -d or --device option is needed --- ChangeLog | 3 +++ ntfsprogs/ntfsinfo.8.in | 2 +- ntfsprogs/ntfsinfo.c | 10 ++++------ ntfsprogs/ntfsls.8.in | 17 +++-------------- ntfsprogs/ntfsls.c | 13 +++++++------ 5 files changed, 18 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index 470b8857..17fc59d5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -52,6 +52,9 @@ xx/xx/2005 - 1.12.2-WIP a dual G5! (Anton) - Match function parameters names between .h and .c files. (Yuval) - Fix comment formats. (Yuval) + - ntfsinfo and ntfsls follow the convention how other utilities read + the device argument: no -d or --device option is needed. (Szaka) + 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/ntfsprogs/ntfsinfo.8.in b/ntfsprogs/ntfsinfo.8.in index a77ed87f..efebca26 100644 --- a/ntfsprogs/ntfsinfo.8.in +++ b/ntfsprogs/ntfsinfo.8.in @@ -7,10 +7,10 @@ ntfsinfo \- dump a file's attributes .SH SYNOPSIS .B ntfsinfo -.I -d device .I -i inode-number .I -F path-filename .I -m +.I device .SH DESCRIPTION .B ntfsinfo will dump the attributes of inode diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index cdf009eb..a911d338 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -121,8 +121,7 @@ static void version(void) */ static void usage(void) { - printf("\nUsage: %s [options] -d dev\n" - " -d dev --device dev The ntfs volume to display information about\n" + printf("\nUsage: %s [options] device\n" " -i num --inode num Display information about this inode\n" " -F file --file file Display information about this file (absolute path)\n" " -m --mft Dump information about the volume\n" @@ -148,9 +147,8 @@ static void usage(void) */ static int parse_options(int argc, char *argv[]) { - static const char *sopt = "-:fhi:F:mqtTvVd:"; + static const char *sopt = "-:fhi:F:mqtTvV"; static const struct option lopt[] = { - { "device", required_argument, NULL, 'd' }, { "force", no_argument, NULL, 'f' }, { "help", no_argument, NULL, 'h' }, { "inode", required_argument, NULL, 'i' }, @@ -178,9 +176,9 @@ static int parse_options(int argc, char *argv[]) ntfs_log_trace("optind=%d; c='%c' optarg=\"%s\".\n", optind, c, optarg); switch (c) { - case 'd': + case 1: if (!opts.device) - opts.device = argv[optind-1]; + opts.device = optarg; else err++; break; diff --git a/ntfsprogs/ntfsls.8.in b/ntfsprogs/ntfsls.8.in index 4910b42f..f4fe8611 100644 --- a/ntfsprogs/ntfsls.8.in +++ b/ntfsprogs/ntfsls.8.in @@ -2,7 +2,7 @@ .\" Copyright (c) 2003 Anton Altaparmakov. All Rights Reserved. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSLS 8 "August 2003" "ntfsprogs version @VERSION@" +.TH NTFSLS 8 "October 2005" "ntfsprogs version @VERSION@" .SH NAME ntfsls \- list directory contents on an NTFS filesystem .SH SYNOPSIS @@ -70,9 +70,6 @@ ntfsls \- list directory contents on an NTFS filesystem | .B \-\-dos ] -.B \-d -| -.B \-\-device .I DEVICE .SH DESCRIPTION .B ntfsls @@ -81,7 +78,8 @@ is used to list information about the files specified by the option (the root directory by default). .I DEVICE is the special file corresponding to the device (e.g -.IR /dev/hdXX ). +.IR /dev/hdXX ) +or an NTFS image file. .SH OPTIONS .TP .B \-a, \-\-all @@ -129,15 +127,6 @@ Display more debug/warning/error messages. .B \-x, \-\-dos Display short file names, i.e. files in the DOS namespace, instead of long file names, i.e. files in the WIN32 namespace. -.TP -.BI "\-d, \-\-device" " DEVICE" -The special file corresponding to the device that contains the NTFS partition -to read. If you want to use an image of an NTFS partition stored on a normal -file, you will also need to specify the -.B \-f -or -.B \-\-force -options. .SH BUGS We are not aware of any bugs. If you find a bug, please report it to . Thank you. diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index fbb0c1ea..08a4d53b 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -156,10 +156,9 @@ static void version(void) */ static void usage(void) { - printf("\nUsage: %s [options] -d /dev/hda1\n" + printf("\nUsage: %s [options] device\n" "\n" " -a --all Display all files\n" - " -d DEVICE --device DEVICE NTFS volume\n" " -F --classify Display classification\n" " -f --force Use less caution\n" " -h -? --help Display this help\n" @@ -191,10 +190,9 @@ static void usage(void) */ static int parse_options(int argc, char *argv[]) { - static const char *sopt = "-ad:Ffh?ilp:qRsVvx"; + static const char *sopt = "-aFfh?ilp:qRsVvx"; static const struct option lopt[] = { { "all", no_argument, NULL, 'a' }, - { "device", required_argument, NULL, 'd' }, { "classify", no_argument, NULL, 'F' }, { "force", no_argument, NULL, 'f' }, { "help", no_argument, NULL, 'h' }, @@ -223,8 +221,11 @@ static int parse_options(int argc, char *argv[]) while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != (char)-1) { switch (c) { - case 'd': - opts.device = optarg; + case 1: + if (!opts.device) + opts.device = optarg; + else + err++; break; case 'p': opts.path = optarg;