[PATCH 3/3] flash_eraseall: make -? option the same as --help

Shevchenko Andriy (EXT-Teleca/Helsinki) ext-andriy.shevchenko at nokia.com
Thu Jun 17 04:42:39 EDT 2010


Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko at nokia.com>
---
 flash_eraseall.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/flash_eraseall.c b/flash_eraseall.c
index f6319d1..ebd329b 100644
--- a/flash_eraseall.c
+++ b/flash_eraseall.c
@@ -192,8 +192,6 @@ int main (int argc, char *argv[])
 
 void process_options (int argc, char *argv[])
 {
-	int error = 0;
-
 	static const char *short_options = "jq";
 	static const struct option long_options[] = {
 		{"help", no_argument, 0, 0},
@@ -233,15 +231,13 @@ void process_options (int argc, char *argv[])
 				jffs2 = 1;
 				break;
 			case '?':
-				error = 1;
+				display_help();
 				break;
 		}
 	}
+
 	if (optind == argc) {
 		fprintf(stderr, "%s: no MTD device specified\n", exe_name);
-		error = 1;
-	}
-	if (error) {
 		fprintf(stderr, "Try `%s --help' for more information.\n",
 				exe_name);
 		exit(1);
-- 
1.6.3.3




More information about the linux-mtd mailing list