]>
git.saurik.com Git - bison.git/blob - src/getargs.c
d853118e0f5a261575398914254a32ab3073fee5
1 /* Parse command line arguments for bison,
2 Copyright (C) 1984, 1986, 1989 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
30 char *spec_name_prefix
; /* for -p. */
31 char *spec_file_prefix
; /* for -b. */
32 extern int fixed_outfiles
;/* for -y */
36 struct option longopts
[] =
38 {"debug", 0, &debugflag
, 1},
39 {"defines", 0, &definesflag
, 1},
40 {"file-prefix", 1, 0, 'b'},
41 {"fixed-output-files", 0, &fixed_outfiles
, 1},
42 {"name-prefix", 1, 0, 'a'},
43 {"no-lines", 0, &nolinesflag
, 1},
44 {"output", 1, 0, 'o'},
45 {"output-file", 1, 0, 'o'},
46 {"verbose", 0, &verboseflag
, 1},
47 {"version", 0, 0, 'V'},
48 {"yacc", 0, &fixed_outfiles
, 1},
59 extern char *program_name
;
60 extern char *version_string
;
67 while ((c
= getopt_long (argc
, argv
, "yvdltVo:b:p:", longopts
, &longind
))
70 if (c
== 0 && longopts
[longind
].flag
== 0)
71 c
= longopts
[longind
].val
;
75 /* Certain long options cause getopt_long to return 0. */
83 printf("%s", version_string
);
103 spec_outfile
= optarg
;
107 spec_file_prefix
= optarg
;
111 spec_name_prefix
= optarg
;
116 Usage: %s [-dltvyV] [-b file-prefix] [-o outfile] [-p name-prefix]\n\
117 [--debug] [--defines] [--fixed-output-files] [--no-lines]\n\
118 [--verbose] [--version] [--yacc]\n\
119 [--file-prefix=prefix] [--name-prefix=prefix]\n\
120 [--output=outfile] grammar-file\n",
128 fprintf(stderr
, "%s: no grammar file given\n", program_name
);
131 if (optind
< argc
- 1)
132 fprintf(stderr
, "%s: warning: extra arguments ignored\n", program_name
);
134 infile
= argv
[optind
];