diff options
author | bigbiff bigbiff <bigbiff@teamw.in> | 2013-07-03 20:52:12 +0200 |
---|---|---|
committer | bigbiff bigbiff <bigbiff@teamw.in> | 2013-07-03 20:52:12 +0200 |
commit | 004e2df74a3a92d431e573c60626b5dce36cca98 (patch) | |
tree | af8203944e665972cd3c09ec2d5f7c4ca8cdf4f2 /exfat/dump | |
parent | Rewrite TWFunc::Exec_Cmd() to use pipe() instead of popen() (diff) | |
download | android_bootable_recovery-004e2df74a3a92d431e573c60626b5dce36cca98.tar android_bootable_recovery-004e2df74a3a92d431e573c60626b5dce36cca98.tar.gz android_bootable_recovery-004e2df74a3a92d431e573c60626b5dce36cca98.tar.bz2 android_bootable_recovery-004e2df74a3a92d431e573c60626b5dce36cca98.tar.lz android_bootable_recovery-004e2df74a3a92d431e573c60626b5dce36cca98.tar.xz android_bootable_recovery-004e2df74a3a92d431e573c60626b5dce36cca98.tar.zst android_bootable_recovery-004e2df74a3a92d431e573c60626b5dce36cca98.zip |
Diffstat (limited to '')
-rw-r--r-- | exfat/dump/dumpexfat.8 | 4 | ||||
-rw-r--r-- | exfat/dump/main.c | 26 |
2 files changed, 16 insertions, 14 deletions
diff --git a/exfat/dump/dumpexfat.8 b/exfat/dump/dumpexfat.8 index 36fb28ad1..7fea0653c 100644 --- a/exfat/dump/dumpexfat.8 +++ b/exfat/dump/dumpexfat.8 @@ -13,7 +13,7 @@ .B \-u ] [ -.B \-v +.B \-V ] .I device @@ -33,7 +33,7 @@ systems. Dump ranges of used sectors starting from 0 and separated with spaces. May be useful for backup tools. .TP -.BI \-v +.BI \-V Print version and copyright. .SH EXIT CODES diff --git a/exfat/dump/main.c b/exfat/dump/main.c index fa80903b8..8650d5170 100644 --- a/exfat/dump/main.c +++ b/exfat/dump/main.c @@ -140,13 +140,13 @@ static int dump_full(const char* spec, bool used_sectors) static void usage(const char* prog) { - fprintf(stderr, "Usage: %s [-s] [-u] [-v] <device>\n", prog); + fprintf(stderr, "Usage: %s [-s] [-u] [-V] <device>\n", prog); exit(1); } int main(int argc, char* argv[]) { - char** pp; + int opt; const char* spec = NULL; bool sb_only = false; bool used_sectors = false; @@ -154,24 +154,26 @@ int main(int argc, char* argv[]) printf("dumpexfat %u.%u.%u\n", EXFAT_VERSION_MAJOR, EXFAT_VERSION_MINOR, EXFAT_VERSION_PATCH); - for (pp = argv + 1; *pp; pp++) + while ((opt = getopt(argc, argv, "suV")) != -1) { - if (strcmp(*pp, "-s") == 0) + switch (opt) + { + case 's': sb_only = true; - else if (strcmp(*pp, "-u") == 0) + break; + case 'u': used_sectors = true; - else if (strcmp(*pp, "-v") == 0) - { + break; + case 'V': puts("Copyright (C) 2011-2013 Andrew Nayenko"); return 0; - } - else if (spec == NULL) - spec = *pp; - else + default: usage(argv[0]); + } } - if (spec == NULL) + if (argc - optind != 1) usage(argv[0]); + spec = argv[optind]; if (sb_only) return dump_sb(spec); |