diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2016-07-19 15:06:58 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2016-11-17 11:36:55 +0100 |
commit | 7dd42c510dc8ab10f52dcc2d20dc8af412be0744 (patch) | |
tree | fa45022d4754db6a72285d7e9f9284e877ce06c5 /jffsX-utils/sumtool.c | |
parent | 8a00021b2ab5529640e5acaca30a27cdaca04178 (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 'jffsX-utils/sumtool.c')
-rw-r--r-- | jffsX-utils/sumtool.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/jffsX-utils/sumtool.c b/jffsX-utils/sumtool.c index 886b545..0958615 100644 --- a/jffsX-utils/sumtool.c +++ b/jffsX-utils/sumtool.c @@ -113,8 +113,6 @@ static const char helptext[] = " eraseblock\n\n"; -static const char revtext[] = "$Revision: 1.9 $"; - static unsigned char ffbuf[16] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff @@ -159,14 +157,15 @@ void process_options (int argc, char **argv) break; case 'h': case '?': - errmsg_die("%s", helptext); + puts(helptext); + exit(EXIT_SUCCESS); case 'v': verbose = 1; break; case 'V': - errmsg_die("revision %.*s\n", - (int) strlen(revtext) - 13, revtext + 11); + common_print_version(); + exit(EXIT_SUCCESS); case 'e': { char *next; |