Message ID | 1276764159-28726-3-git-send-email-ext-andriy.shevchenko@nokia.com |
---|---|
State | New, archived |
Headers | show |
On Thu, Jun 17, 2010 at 04:42, Shevchenko Andriy wrote: > --- 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; > } > } NAK. this isnt "-?", that's the error case of getopt. look at the invocation of getopt here ... ? is not a valid char. also, your patch bombing seems screwed up as linux-mtd was bcc-ed. -mike
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);
Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com> --- flash_eraseall.c | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-)