The tools in question will quit with an exit code 0 if the command
line option was not recognized. By returning an error code a calling
script has the possibility to distinguish between a real success and
an invalid invocation.
Signed-off-by: Daniel Wagner <daniel.wagner@siemens.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
int verbose;
};
-void display_help(void)
+void display_help(int status)
{
printf("Usage: %s [OPTIONS] MTD-device filename\n"
"Dumps the contents of a resident flash disk\n"
"-v --verbose Be verbose\n"
"-b size --blocksize Block size (defaults to erase unit)\n",
PROGRAM_NAME);
- exit(0);
+ exit(status);
}
void display_version(void)
switch (c) {
case 'h':
- display_help();
+ display_help(EXIT_SUCCESS);
break;
case 'V':
display_version();
}
if ((argc - optind) != 2 || error)
- display_help();
+ display_help(EXIT_FAILURE);
rfd->mtd_filename = argv[optind];
rfd->out_filename = argv[optind + 1];
#include "common.h"
-void display_help(void)
+void display_help(int status)
{
printf("Usage: %s [OPTIONS] MTD-device\n"
"Formats NOR flash for resident flash disk\n"
"-h --help display this help and exit\n"
"-V --version output version information and exit\n",
PROGRAM_NAME);
- exit(0);
+ exit(status);
}
void display_version(void)
switch (c) {
case 'h':
- display_help();
+ display_help(EXIT_SUCCESS);
break;
case 'V':
display_version();
}
if ((argc - optind) != 1 || error)
- display_help();
+ display_help(EXIT_FAILURE);
*mtd_filename = argv[optind];
}