24 |
#include "argmatch.h" |
#include "argmatch.h" |
25 |
#include "complain.h" |
#include "complain.h" |
26 |
#include "getargs.h" |
#include "getargs.h" |
|
#include "options.h" |
|
27 |
#include "files.h" |
#include "files.h" |
28 |
|
|
29 |
int debug_flag = 0; |
int debug_flag = 0; |
185 |
| Process the options. | |
| Process the options. | |
186 |
`----------------------*/ |
`----------------------*/ |
187 |
|
|
188 |
|
/* Shorts options. */ |
189 |
|
const char *short_options = "yvegdhr:ltknVo:b:p:S:"; |
190 |
|
|
191 |
|
static struct option const long_options[] = |
192 |
|
{ |
193 |
|
/* Operation modes. */ |
194 |
|
{ "help", no_argument, 0, 'h' }, |
195 |
|
{ "version", no_argument, 0, 'V' }, |
196 |
|
|
197 |
|
/* Parser. */ |
198 |
|
{ "name-prefix", required_argument, 0, 'p' }, |
199 |
|
{ "include", required_argument, 0, 'I' }, |
200 |
|
|
201 |
|
/* Output. */ |
202 |
|
{ "file-prefix", required_argument, 0, 'b' }, |
203 |
|
{ "output", required_argument, 0, 'o' }, |
204 |
|
{ "output-file", required_argument, 0, 'o' }, |
205 |
|
{ "graph", optional_argument, 0, 'g' }, |
206 |
|
{ "report", required_argument, 0, 'r' }, |
207 |
|
{ "verbose", no_argument, 0, 'v' }, |
208 |
|
|
209 |
|
/* Hidden. */ |
210 |
|
{ "trace", no_argument, &trace_flag, 1 }, |
211 |
|
|
212 |
|
/* FIXME: semantic parsers will output an `include' of an |
213 |
|
output file: be sure that the naem included is indeed the name of |
214 |
|
the output file. */ /* FIXME Should we activate this options ? |
215 |
|
*/ |
216 |
|
{ "output", required_argument, 0, 'o' }, |
217 |
|
{ "file-prefix", required_argument, 0, 'b' }, |
218 |
|
{ "name-prefix", required_argument, 0, 'p' }, |
219 |
|
|
220 |
|
/* |
221 |
|
* Percent and command line declarations. |
222 |
|
*/ |
223 |
|
|
224 |
|
/* Output. */ |
225 |
|
{ "defines", optional_argument, 0, 'd' }, |
226 |
|
|
227 |
|
/* Operation modes. */ |
228 |
|
{ "fixed-output-files", no_argument, 0, 'y' }, |
229 |
|
{ "yacc", no_argument, 0, 'y' }, |
230 |
|
|
231 |
|
/* Parser. */ |
232 |
|
{ "debug", no_argument, 0, 't' }, |
233 |
|
{ "locations", no_argument, &locations_flag, 1 }, |
234 |
|
{ "no-lines", no_argument, 0, 'l' }, |
235 |
|
{ "no-parser", no_argument, 0, 'n' }, |
236 |
|
{ "raw", no_argument, 0, 0 }, |
237 |
|
{ "skeleton", required_argument, 0, 'S' }, |
238 |
|
{ "token-table", no_argument, 0, 'k' }, |
239 |
|
|
240 |
|
{0, 0, 0, 0} |
241 |
|
}; |
242 |
|
|
243 |
/* Under DOS, there is no difference on the case. This can be |
/* Under DOS, there is no difference on the case. This can be |
244 |
troublesome when looking for `.tab' etc. */ |
troublesome when looking for `.tab' etc. */ |
245 |
#ifdef MSDOS |
#ifdef MSDOS |
253 |
{ |
{ |
254 |
int c; |
int c; |
255 |
|
|
256 |
struct option *longopts = long_option_table_new (); |
while ((c = getopt_long (argc, argv, short_options, long_options, NULL)) != EOF) |
|
while ((c = getopt_long (argc, argv, shortopts, longopts, NULL)) != EOF) |
|
257 |
switch (c) |
switch (c) |
258 |
{ |
{ |
259 |
case 0: |
case 0: |
335 |
exit (1); |
exit (1); |
336 |
} |
} |
337 |
|
|
|
free (longopts); |
|
|
|
|
338 |
if (optind == argc) |
if (optind == argc) |
339 |
{ |
{ |
340 |
fprintf (stderr, _("%s: no grammar file given\n"), program_name); |
fprintf (stderr, _("%s: no grammar file given\n"), program_name); |