]>
git.saurik.com Git - bison.git/blob - src/getargs.c
1 /* Parse command line arguments for bison,
2 Copyright (C) 1984, 1986, 1989, 1992 Free Software Foundation, Inc.
4 This file is part of Bison, the GNU Compiler Compiler.
6 Bison is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 Bison is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Bison; see the file COPYING. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
33 int rawtoknumflag
= 0;
34 char *spec_name_prefix
; /* for -p. */
35 char *spec_file_prefix
; /* for -b. */
36 extern int fixed_outfiles
;/* for -y */
38 void usage
PARAMS((FILE *));
39 void getargs
PARAMS((int, char *[]));
41 extern char *program_name
;
42 extern char *version_string
;
44 extern void warns
PARAMS((char *, char *)); /* main.c */
46 struct option longopts
[] =
48 {"debug", 0, &debugflag
, 1},
49 {"defines", 0, &definesflag
, 1},
50 {"file-prefix", 1, 0, 'b'},
51 {"fixed-output-files", 0, &fixed_outfiles
, 1},
53 {"name-prefix", 1, 0, 'p'}, /* was 'a'; apparently unused -wjh */
54 {"no-lines", 0, &nolinesflag
, 1},
55 {"no-parser", 0, &noparserflag
, 1},
56 {"output", 1, 0, 'o'},
57 {"output-file", 1, 0, 'o'},
58 {"raw", 0, &rawtoknumflag
, 1},
59 {"token-table", 0, &toknumflag
, 1},
60 {"verbose", 0, &verboseflag
, 1},
61 {"version", 0, 0, 'V'},
62 {"yacc", 0, &fixed_outfiles
, 1},
70 Usage: %s [-dhklntvyV] [-b file-prefix] [-o outfile] [-p name-prefix]\n\
71 [--debug] [--defines] [--fixed-output-files] [--no-lines]\n\
72 [--verbose] [--version] [--help] [--yacc]\n\
73 [--no-parser] [--token-table]\n\
74 [--file-prefix=prefix] [--name-prefix=prefix]\n\
75 [--output=outfile] grammar-file\n\n\
76 Report bugs to bug-bison@gnu.org\n"),
81 getargs (int argc
, char *argv
[])
93 while ((c
= getopt_long (argc
, argv
, "yvdhrltknVo:b:p:", longopts
, (int *)0))
99 /* Certain long options cause getopt_long to return 0. */
111 printf ("%s", version_string
);
143 spec_outfile
= optarg
;
147 spec_file_prefix
= optarg
;
151 spec_name_prefix
= optarg
;
162 fprintf(stderr
, _("%s: no grammar file given\n"), program_name
);
165 if (optind
< argc
- 1)
166 fprintf(stderr
, _("%s: extra arguments ignored after '%s'\n"),
167 program_name
, argv
[optind
]);
169 infile
= argv
[optind
];