summaryrefslogtreecommitdiff
path: root/misc-utils/flash_unlock.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2016-07-19 15:06:58 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2016-11-17 11:36:55 +0100
commit7dd42c510dc8ab10f52dcc2d20dc8af412be0744 (patch)
treefa45022d4754db6a72285d7e9f9284e877ce06c5 /misc-utils/flash_unlock.c
parent8a00021b2ab5529640e5acaca30a27cdaca04178 (diff)
Unify version string printing
When a program does sophisticated enough command line processing (i.e. getopt), make sure it responds to -V and --version. When a program prints a version string, make sure it uses the common_print_version macro to print out its name, that it is part of mtd-utils and the mtd-utils version from the build system in a fashion similar to common program packages like the GNU coreutils. When a program responds to -V/--version or -h/--help, make sure it reports success exit status. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'misc-utils/flash_unlock.c')
-rw-r--r--misc-utils/flash_unlock.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/misc-utils/flash_unlock.c b/misc-utils/flash_unlock.c
index f51870a..94f4761 100644
--- a/misc-utils/flash_unlock.c
+++ b/misc-utils/flash_unlock.c
@@ -46,7 +46,7 @@ static void usage(int status)
"\n"
"Options:\n"
" -h --help Display this help and exit\n"
- " --version Display version information and exit\n"
+ " -V --version Display version information and exit\n"
" -i --islocked Check if flash region is locked\n"
" -l --lock Lock a region of flash\n"
" -u --unlock Unlock a region of flash\n"
@@ -59,13 +59,13 @@ static void usage(int status)
exit(status);
}
-static const char short_opts[] = "hilu";
+static const char short_opts[] = "hiluV";
static const struct option long_opts[] = {
{ "help", no_argument, 0, 'h' },
{ "islocked", no_argument, 0, 'i' },
{ "lock", no_argument, 0, 'l' },
{ "unlock", no_argument, 0, 'u' },
- { "version", no_argument, 0, 'v' },
+ { "version", no_argument, 0, 'V' },
{ NULL, 0, 0, 0 },
};
@@ -101,7 +101,7 @@ static void process_args(int argc, char *argv[])
req = REQUEST_UNLOCK;
req_set++;
break;
- case 'v':
+ case 'V':
common_print_version();
exit(0);
default: