#include "getopt.h"
#include "system.h"
#include "files.h"
+#include "getargs.h"
-int verboseflag;
-int definesflag;
-int debugflag;
-int nolinesflag;
+char *spec_file_prefix; /* for -b. */
+char *spec_name_prefix; /* for -p. */
+
+int debugflag = 0;
+int definesflag = 0;
+int nolinesflag = 0;
int noparserflag = 0;
-int toknumflag = 0;
int rawtoknumflag = 0;
-char *spec_name_prefix; /* for -p. */
-char *spec_file_prefix; /* for -b. */
+int toknumflag = 0;
+int verboseflag = 0;
+
extern int fixed_outfiles;/* for -y */
extern char *program_name;
extern void warns PARAMS((char *, char *)); /* main.c */
+extern void getargs PARAMS((int argc, char *[]));
-struct option longopts[] =
+static struct option longopts[] =
{
{"debug", 0, &debugflag, 1},
{"defines", 0, &definesflag, 1},
/*---------------------------.
| Display the help message. |
`---------------------------*/
-void
+
+static void
usage (FILE *stream)
{
/* Some efforts were made to ease the translators' task, please
continue. */
- fprintf (stream, _("\
-GNU bison generates parsers for LALR(1) grammars.\n"));
+ fputs (_("\
+GNU bison generates parsers for LALR(1) grammars.\n"), stream);
putc ('\n', stream);
fprintf (stream, _("\
stream);
putc ('\n', stream);
- fprintf (stream, _("\
+ fputs (_("\
Operation modes:\n\
-h, --help display this help and exit\n\
-V, --version output version information and exit\n\
- -y, --yacc emulate POSIX yacc\n"));
+ -y, --yacc emulate POSIX yacc\n"), stream);
putc ('\n', stream);
- fprintf (stream, _("\
+ fputs (_("\
Parser:\n\
-t, --debug instrument the parser for debugging\n\
-p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n\
-n, --no-parser generate the tables only\n\
-r, --raw number the tokens from 3\n\
-k, --token-table include a table of token names\n\
-"));
+"), stream);
putc ('\n', stream);
- fprintf (stream, _("\
+ fputs (_("\
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"));
+ -o, --output-file=FILE leave output to FILE\n"), stream);
putc ('\n', stream);
+ fputs (_("\
+Report bugs to <bug-bison@gnu.org>.\n"), stream);
+}
+
+
+/*------------------------------.
+| Display the version message. |
+`------------------------------*/
+
+static void
+version (FILE *stream)
+{
+ /* Some efforts were made to ease the translators' task, please
+ continue. */
fprintf (stream, _("\
-Report bugs to <bug-bison@gnu.org>.\n"),
- program_name);
+bison (GNU Bison) %s"), VERSION);
+ putc ('\n', stream);
+ putc ('\n', stream);
+
+ fputs (_("\
+Copyright (C) 1984, 1986, 1989, 1992, 2000 Free Software Foundation, Inc.\n"),
+ stream);
+
+ fputs (_("\
+This is free software; see the source for copying conditions. There is NO\n\
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
+"),
+ stream);
}
+
+/*----------------------.
+| Process the options. |
+`----------------------*/
+
void
getargs (int argc, char *argv[])
{
exit (0);
case 'V':
- printf ("%s\n", VERSION_STRING);
+ version (stdout);
exit (0);
case 'v':
if (optind == argc)
{
- fprintf(stderr, _("%s: no grammar file given\n"), program_name);
- exit(1);
+ fprintf (stderr, _("%s: no grammar file given\n"), program_name);
+ exit (1);
}
if (optind < argc - 1)
- fprintf(stderr, _("%s: extra arguments ignored after `%s'\n"),
- program_name, argv[optind]);
+ fprintf (stderr, _("%s: extra arguments ignored after `%s'\n"),
+ program_name, argv[optind]);
infile = argv[optind];
}