fix confusing error message when misspelling -mXXX options
authorMatthias Braun <matze@braunis.de>
Mon, 7 Mar 2011 12:07:34 +0000 (13:07 +0100)
committerMatthias Braun <matze@braunis.de>
Wed, 9 Mar 2011 11:19:55 +0000 (12:19 +0100)
main.c

diff --git a/main.c b/main.c
index b51d1ff..7ea2115 100644 (file)
--- a/main.c
+++ b/main.c
@@ -1108,13 +1108,11 @@ int main(int argc, char **argv)
                                        fprintf(stderr, "error: software floatingpoint not supported yet\n");
                                        argument_errors = true;
                                } else {
-                                       char *endptr;
-                                       long int value = strtol(opt, &endptr, 10);
-                                       if (*endptr != '\0') {
+                                       long int value = strtol(opt, NULL, 10);
+                                       if (value == 0) {
                                                fprintf(stderr, "error: wrong option '-m %s'\n",  opt);
                                                argument_errors = true;
-                                       }
-                                       if (value != 16 && value != 32 && value != 64) {
+                                       } else if (value != 16 && value != 32 && value != 64) {
                                                fprintf(stderr, "error: option -m supports only 16, 32 or 64\n");
                                                argument_errors = true;
                                        } else {