summaryrefslogtreecommitdiff
path: root/nor-utils/rfddump.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 /nor-utils/rfddump.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 'nor-utils/rfddump.c')
-rw-r--r--nor-utils/rfddump.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/nor-utils/rfddump.c b/nor-utils/rfddump.c
index 32810f5..048f58c 100644
--- a/nor-utils/rfddump.c
+++ b/nor-utils/rfddump.c
@@ -10,7 +10,6 @@
*/
#define PROGRAM_NAME "rfddump"
-#define PROGRAM_VERSION "$Revision 1.0 $"
#define _XOPEN_SOURCE 500 /* For pread */
@@ -28,6 +27,8 @@
#include <linux/types.h>
#include <mtd_swab.h>
+#include "common.h"
+
/* next is an array of mapping for each corresponding sector */
#define RFD_MAGIC 0x9193
#define HEADER_MAP_OFFSET 3
@@ -69,12 +70,9 @@ void display_help(void)
void display_version(void)
{
- printf("%s " PROGRAM_VERSION "\n"
- "\n"
- "This is free software; see the source for copying conditions. There is NO\n"
- "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
- PROGRAM_NAME);
-
+ common_print_version();
+ printf("This is free software; see the source for copying conditions. There is NO\n"
+ "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
exit(0);
}