summaryrefslogtreecommitdiff
path: root/rfddump.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2010-09-26 14:48:51 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2010-09-27 09:31:10 +0300
commite960f7eb17f8d72f00364e9fc9f9a27b5563e318 (patch)
tree9c64699e742b6d220539a8827e29a662d9629fb7 /rfddump.c
parent6edaa0c971aab663cda573ded5013b3b998ee5d4 (diff)
mtd-utils: standardize PROGRAM_NAME
Make sure all the utils define PROGRAM_NAME and do so at the start of the file so that sub-headers may assume it exists. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'rfddump.c')
-rw-r--r--rfddump.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/rfddump.c b/rfddump.c
index 73b0eca..1934d93 100644
--- a/rfddump.c
+++ b/rfddump.c
@@ -9,6 +9,9 @@
* (at your option) any later version.
*/
+#define PROGRAM_NAME "rfddump"
+#define VERSION "$Revision 1.0 $"
+
#define _XOPEN_SOURCE 500 /* For pread */
#include <stdio.h>
@@ -51,27 +54,26 @@ struct rfd {
int verbose;
};
-#define PROGRAM "rfddump"
-#define VERSION "$Revision 1.0 $"
-
void display_help(void)
{
- printf("Usage: " PROGRAM " [OPTIONS] MTD-device filename\n"
+ printf("Usage: %s [OPTIONS] MTD-device filename\n"
"Dumps the contents of a resident flash disk\n"
"\n"
"-h --help display this help and exit\n"
"-V --version output version information and exit\n"
"-v --verbose Be verbose\n"
- "-b size --blocksize Block size (defaults to erase unit)\n");
+ "-b size --blocksize Block size (defaults to erase unit)\n",
+ PROGRAM_NAME);
exit(0);
}
void display_version(void)
{
- printf(PROGRAM " " VERSION "\n"
+ printf("%s " 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");
+ "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
+ PROGRAM_NAME);
exit(0);
}
@@ -248,13 +250,13 @@ int main(int argc, char *argv[])
rfd.header = malloc(rfd.header_size);
if (!rfd.header) {
- perror(PROGRAM);
+ perror(PROGRAM_NAME);
close(fd);
return 2;
}
rfd.sector_map = malloc(rfd.sector_count * sizeof(int));
if (!rfd.sector_map) {
- perror(PROGRAM);
+ perror(PROGRAM_NAME);
close(fd);
free(rfd.sector_map);
return 2;