|
|
1.1 root 1: /* Parse command line arguments for bison,
2: Copyright (C) 1984, 1986 Bob Corbett and Free Software Foundation, Inc.
3:
4: BISON is distributed in the hope that it will be useful, but WITHOUT ANY
5: WARRANTY. No author or distributor accepts responsibility to anyone
6: for the consequences of using it or for whether it serves any
7: particular purpose or works at all, unless he says so in writing.
8: Refer to the BISON General Public License for full details.
9:
10: Everyone is granted permission to copy, modify and redistribute BISON,
11: but only under the conditions described in the BISON General Public
12: License. A copy of this license is supposed to have been given to you
13: along with BISON so you can know your rights and responsibilities. It
14: should be in a file named COPYING. Among other things, the copyright
15: notice and this notice must be preserved on all copies.
16:
17: In other words, you are welcome to use, share and improve this program.
18: You are forbidden to forbid anyone else to use, share and improve
19: what you give them. Help stamp out software-hoarding! */
20:
21: #include <stdio.h>
22: #include "files.h"
23:
24: int verboseflag;
25: int definesflag;
26: extern int fixed_outfiles;/* JF */
27:
28:
29: getargs(argc, argv)
30: int argc;
31: char *argv[];
32: {
33: register int c;
34: char *p = argv[0];
35: char *lastcomponent;
36:
37: extern int optind;
38: extern char *optarg;
39:
40: verboseflag = 0;
41: definesflag = 0;
42: fixed_outfiles = 0;
43:
44: /* See if the program was invoked as "yacc". */
45:
46: lastcomponent = p;
47: while (*p)
48: {
49: if (*p == '/')
50: lastcomponent = p + 1;
51: p++;
52: }
53: if (! strcmp (lastcomponent, "yacc"))
54: /* If so, pretend we have "-y" as argument. */
55: fixed_outfiles = 1;
56:
57: while ((c = getopt (argc, argv, "yYvVdDo:O:")) != EOF)
58: switch (c)
59: {
60: case 'y':
61: case 'Y':
62: fixed_outfiles = 1;
63: break;
64:
65: case 'v':
66: case 'V':
67: verboseflag = 1;
68: break;
69:
70: case 'd':
71: case 'D':
72: definesflag = 1;
73: break;
74:
75: case 'o':
76: case 'O':
77: spec_outfile = optarg;
78: }
79:
80: if (optind == argc)
81: fatal("grammar file not specified");
82: else
83: infile = argv[optind];
84:
85: if (optind < argc - 1)
86: fprintf(stderr, "bison: warning: extra arguments ignored\n");
87: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.