Avoid "unrecognized option `help'" error on "-[fprg] help".
authorPeter Johnson <peter@tortall.net>
Wed, 2 Apr 2003 03:27:45 +0000 (03:27 -0000)
committerPeter Johnson <peter@tortall.net>
Wed, 2 Apr 2003 03:27:45 +0000 (03:27 -0000)
svn path=/trunk/yasm/; revision=918

frontends/yasm/yasm.c

index b61b6dfd13295268b598eaa1a864f222708ab89c..c6745c5b81785bf7cc31252d2e7c4c0cb7752fb9 100644 (file)
@@ -95,6 +95,7 @@ static void print_list_keword_desc(const char *name, const char *keyword);
 /* values for special_options */
 #define SPECIAL_SHOW_HELP 0x01
 #define SPECIAL_SHOW_VERSION 0x02
+#define SPECIAL_LISTED 0x04
 
 /* command line options */
 static opt_option options[] =
@@ -237,6 +238,9 @@ main(int argc, char *argv[])
            for (i=0; i<sizeof(version_msg)/sizeof(char *); i++)
                printf("%s", gettext(version_msg[i]));
            return EXIT_SUCCESS;
+       case SPECIAL_LISTED:
+           /* Printed out earlier */
+           return EXIT_SUCCESS;
     }
 
     /* Initialize BitVector (needed for floating point). */
@@ -598,7 +602,8 @@ opt_parser_handler(/*@unused@*/ char *cmd, char *param, /*@unused@*/ int extra)
        if (!strcmp("help", param)) {
            printf(_("Available yasm parsers:\n"));
            list_parsers(print_list_keword_desc);
-           return 1;
+           special_options = SPECIAL_LISTED;
+           return 0;
        }
        print_error(_("unrecognized parser `%s'"), param);
        return 1;
@@ -615,7 +620,8 @@ opt_preproc_handler(/*@unused@*/ char *cmd, char *param, /*@unused@*/ int extra)
        if (!strcmp("help", param)) {
            printf(_("Available yasm preprocessors:\n"));
            list_preprocs(print_list_keword_desc);
-           return 1;
+           special_options = SPECIAL_LISTED;
+           return 0;
        }
        print_error(_("unrecognized preprocessor `%s'"), param);
        return 1;
@@ -632,7 +638,8 @@ opt_objfmt_handler(/*@unused@*/ char *cmd, char *param, /*@unused@*/ int extra)
        if (!strcmp("help", param)) {
            printf(_("Available yasm object formats:\n"));
            list_objfmts(print_list_keword_desc);
-           return 1;
+           special_options = SPECIAL_LISTED;
+           return 0;
        }
        print_error(_("unrecognized object format `%s'"), param);
        return 1;
@@ -649,7 +656,8 @@ opt_dbgfmt_handler(/*@unused@*/ char *cmd, char *param, /*@unused@*/ int extra)
        if (!strcmp("help", param)) {
            printf(_("Available yasm debug formats:\n"));
            list_dbgfmts(print_list_keword_desc);
-           return 1;
+           special_options = SPECIAL_LISTED;
+           return 0;
        }
        print_error(_("unrecognized debugging format `%s'"), param);
        return 1;