X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/22c2cbc078dc5243041d10f4e6e1e5ce1aca36cf..951366c145107e763a92094462bfed0ae19d9ad1:/src/getargs.c diff --git a/src/getargs.c b/src/getargs.c index 29b349a4..e3ffdb68 100644 --- a/src/getargs.c +++ b/src/getargs.c @@ -24,6 +24,8 @@ #include "files.h" #include "complain.h" #include "getargs.h" +#include "xalloc.h" +#include "options.h" int debug_flag = 0; int defines_flag = 0; @@ -39,37 +41,6 @@ int graph_flag = 0; const char *skeleton = NULL; extern char *program_name; -const char *shortopts = "yvgdhrltknVo:b:p:S:"; -static struct option longopts[] = -{ - /* Operation modes. */ - {"help", no_argument, 0, 'h'}, - {"version", no_argument, 0, 'V'}, - {"yacc", no_argument, 0, 'y'}, - {"fixed-output-files",no_argument, 0, 'y'}, - - /* Parser. */ - {"skeleton", required_argument, 0, 'S'}, - {"debug", no_argument, 0, 'd'}, - {"locations", no_argument, &locations_flag, 1}, - /* was 'a'; apparently unused -wjh */ - {"name-prefix", required_argument, 0, 'p'}, - {"no-lines", no_argument, 0, 'l'}, - {"no-parser", no_argument, 0, 'n'}, - {"raw", no_argument, 0, 'r'}, - {"token-table", no_argument, 0, 'k'}, - - /* Output. */ - {"defines", no_argument, 0, 'd'}, - {"verbose", no_argument, 0, 'v'}, - {"file-prefix", required_argument, 0, 'b'}, - {"output-file", required_argument, 0, 'o'}, - {"graph", no_argument, 0, 'g'}, - - /* Hidden. */ - {"statistics", no_argument, &statistics_flag, 1}, - {0, 0, 0, 0} -}; /*---------------------------. | Display the help message. | @@ -118,7 +89,9 @@ Output:\n\ -d, --defines also produce a header file\n\ -v, --verbose also produce an explanation of the automaton\n\ -b, --file-prefix=PREFIX specify a PREFIX for output files\n\ - -o, --output-file=FILE leave output to FILE\n"), stream); + -o, --output=FILE leave output to FILE\n\ + -g, --graph also produce a VCG description of the automaton\n\ +"), stream); putc ('\n', stream); fputs (_("\ @@ -161,6 +134,7 @@ getargs (int argc, char *argv[]) { int c; + create_long_option_table (); while ((c = getopt_long (argc, argv, shortopts, longopts, NULL)) != EOF) switch (c) { @@ -181,7 +155,9 @@ getargs (int argc, char *argv[]) exit (0); case 'g': + /* Here, the -g and --graph=FILE options are differentiated. */ graph_flag = 1; + spec_graph_file = optarg; break; case 'v': @@ -193,7 +169,9 @@ getargs (int argc, char *argv[]) break; case 'd': + /* Here, the -d and --defines options are differentiated. */ defines_flag = 1; + spec_defines_file = optarg; break; case 'l': @@ -234,6 +212,7 @@ getargs (int argc, char *argv[]) exit (1); } + XFREE (longopts); if (optind == argc) { fprintf (stderr, _("%s: no grammar file given\n"), program_name);