X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/4c787a31df24b3bf184a4e109056a41d5712e5a7..be3517b007a833ffec1735691f256f6a37e4a67f:/src/getargs.c?ds=sidebyside diff --git a/src/getargs.c b/src/getargs.c index 01cf8109..226e6de0 100644 --- a/src/getargs.c +++ b/src/getargs.c @@ -40,6 +40,8 @@ # undef HACK_FOR___GNU_LIBRARY___PROTOTYPE #endif +#include + #include "complain.h" #include "files.h" #include "getargs.h" @@ -47,7 +49,7 @@ #include "quote.h" #include "uniqstr.h" -bool debug_flag; +bool debug; bool defines_flag; bool graph_flag; bool xml_flag; @@ -79,8 +81,6 @@ int language_prio = default_prio; struct bison_language const *language = &valid_languages[0]; const char *include = NULL; -char *program_name; - /** Decode an option's set of keys. * @@ -311,10 +311,11 @@ Parser:\n\ -S, --skeleton=FILE specify the skeleton to use\n\ -t, --debug instrument the parser for debugging\n\ --locations enable location support\n\ - -D, --define=NAME[=VALUE] similar to `%define NAME \"VALUE\"'\n\ - -F, --force-define=NAME[=VALUE] override `%define NAME \"VALUE\"'\n\ + -D, --define=NAME[=VALUE] similar to '%define NAME \"VALUE\"'\n\ + -F, --force-define=NAME[=VALUE] override '%define NAME \"VALUE\"'\n\ -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n\ - -l, --no-lines don't generate `#line' directives\n\ + deprecated by '-Dapi.prefix=PREFIX'\n\ + -l, --no-lines don't generate '#line' directives\n\ -k, --token-table include a table of token names\n\ \n\ "), stdout); @@ -342,13 +343,14 @@ Warning categories include:\n\ `yacc' incompatibilities with POSIX Yacc\n\ `conflicts-sr' S/R conflicts (enabled by default)\n\ `conflicts-rr' R/R conflicts (enabled by default)\n\ + `deprecated' obsolete constructs\n\ `other' all other warnings (enabled by default)\n\ `all' all the warnings\n\ `no-CATEGORY' turn off warnings in CATEGORY\n\ `none' turn off all the warnings\n\ `error' treat warnings as errors\n\ -\n\ "), stdout); + putc ('\n', stdout); fputs (_("\ THINGS is a list of comma separated words that can include:\n\ @@ -360,7 +362,25 @@ THINGS is a list of comma separated words that can include:\n\ `none' disable the report\n\ "), stdout); - printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT); + putc ('\n', stdout); + printf (_("Report bugs to <%s>.\n"), PACKAGE_BUGREPORT); + printf (_("%s home page: <%s>.\n"), PACKAGE_NAME, PACKAGE_URL); + fputs (_("General help using GNU software: " + ".\n"), + stdout); + /* Don't output this redundant message for English locales. + Note we still output for 'C' so that it gets included in the + man page. */ + const char *lc_messages = setlocale (LC_MESSAGES, NULL); + if (lc_messages && strcmp (lc_messages, "en_")) + /* TRANSLATORS: Replace LANG_CODE in this URL with your language + code to + form one of the URLs at http://translationproject.org/team/. + Otherwise, replace the entire URL with your translation team's + email address. */ + fputs (_("Report translation bugs to " + ".\n"), stdout); + fputs (_("For complete documentation, run: info bison.\n"), stdout); } exit (status); @@ -606,13 +626,19 @@ getargs (int argc, char *argv[]) /* Here, the -d and --defines options are differentiated. */ defines_flag = true; if (optarg) - spec_defines_file = xstrdup (AS_FILE_NAME (optarg)); + { + free (spec_defines_file); + spec_defines_file = xstrdup (AS_FILE_NAME (optarg)); + } break; case 'g': graph_flag = true; if (optarg) - spec_graph_file = xstrdup (AS_FILE_NAME (optarg)); + { + free (spec_graph_file); + spec_graph_file = xstrdup (AS_FILE_NAME (optarg)); + } break; case 'h': @@ -639,7 +665,7 @@ getargs (int argc, char *argv[]) break; case 't': - debug_flag = true; + debug = true; break; case 'v': @@ -649,7 +675,10 @@ getargs (int argc, char *argv[]) case 'x': xml_flag = true; if (optarg) - spec_xml_file = xstrdup (AS_FILE_NAME (optarg)); + { + free (spec_xml_file); + spec_xml_file = xstrdup (AS_FILE_NAME (optarg)); + } break; case 'y': @@ -669,6 +698,7 @@ getargs (int argc, char *argv[]) exit (EXIT_SUCCESS); case REPORT_FILE_OPTION: + free (spec_verbose_file); spec_verbose_file = xstrdup (AS_FILE_NAME (optarg)); break;