]> git.saurik.com Git - bison.git/blobdiff - src/getargs.c
* src/gram.h (associativity): New enum type which replaces the
[bison.git] / src / getargs.c
index 558faaf827cd13da739f4de4b6f6bf62917c8baa..ad0f13f66d6c68a365ae5562128c61ff0c82ce46 100644 (file)
 #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. */
-extern int fixed_outfiles;/* for -y */
+int toknumflag = 0;
+int verboseflag = 0;
+int statisticsflag = 0;
+int yaccflag = 0;      /* for -y */
 
 extern char *program_name;
 
-extern void warns PARAMS((char *, char *));    /* main.c */
-static void usage PARAMS((FILE *));
-extern void getargs PARAMS((int argc, char *[]));
-
 static struct option longopts[] =
 {
   {"debug", 0, &debugflag, 1},
   {"defines", 0, &definesflag, 1},
   {"file-prefix", 1, 0, 'b'},
-  {"fixed-output-files", 0, &fixed_outfiles, 1},
+  {"fixed-output-files", 0, &yaccflag, 1},
   {"help", 0, 0, 'h'},
   {"name-prefix", 1, 0, 'p'}, /* was 'a';  apparently unused -wjh */
   {"no-lines", 0, &nolinesflag, 1},
@@ -56,13 +55,15 @@ static struct option longopts[] =
   {"token-table", 0, &toknumflag, 1},
   {"verbose", 0, &verboseflag, 1},
   {"version", 0, 0, 'V'},
-  {"yacc", 0, &fixed_outfiles, 1},
+  {"yacc", 0, &yaccflag, 1},
+  {"statistics", 0, &statisticsflag, 1},
   {0, 0, 0, 0}
 };
 
 /*---------------------------.
 | Display the help message.  |
 `---------------------------*/
+
 static void
 usage (FILE *stream)
 {
@@ -112,18 +113,41 @@ Output:\n\
 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, _("\
+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[])
 {
-  register int c;
-
-  verboseflag = 0;
-  definesflag = 0;
-  debugflag = 0;
-  noparserflag = 0;
-  rawtoknumflag = 0;
-  toknumflag = 0;
-  fixed_outfiles = 0;
+  int c;
 
   while ((c = getopt_long (argc, argv, "yvdhrltknVo:b:p:", longopts, (int *)0))
         != EOF)
@@ -135,7 +159,7 @@ getargs (int argc, char *argv[])
          break;
 
        case 'y':
-         fixed_outfiles = 1;
+         yaccflag = 1;
          break;
 
        case 'h':
@@ -143,7 +167,7 @@ getargs (int argc, char *argv[])
          exit (0);
 
        case 'V':
-         printf ("%s\n", VERSION_STRING);
+         version (stdout);
          exit (0);
 
        case 'v':
@@ -194,12 +218,12 @@ getargs (int argc, char *argv[])
 
   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];
 }