clang -cc1 -cc1 -triple amd64-unknown-openbsd7.0 -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name arparse.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 1 -pic-is-pie -mframe-pointer=all -relaxed-aliasing -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-feature +retpoline-indirect-calls -target-feature +retpoline-indirect-branches -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/usr/src/gnu/usr.bin/binutils-2.17/obj/binutils -resource-dir /usr/local/lib/clang/13.0.0 -D HAVE_CONFIG_H -I . -I /usr/src/gnu/usr.bin/binutils-2.17/binutils -I . -D _GNU_SOURCE -I . -I /usr/src/gnu/usr.bin/binutils-2.17/binutils -I ../bfd -I /usr/src/gnu/usr.bin/binutils-2.17/binutils/../bfd -I /usr/src/gnu/usr.bin/binutils-2.17/binutils/../include -I /usr/src/gnu/usr.bin/binutils-2.17/binutils/../intl -I ../intl -D LOCALEDIR="/usr/share/locale" -D bin_dummy_emulation=bin_vanilla_emulation -D PIE_DEFAULT=1 -internal-isystem /usr/local/lib/clang/13.0.0/include -internal-externc-isystem /usr/include -O2 -fdebug-compilation-dir=/usr/src/gnu/usr.bin/binutils-2.17/obj/binutils -ferror-limit 19 -fwrapv -D_RET_PROTECTOR -ret-protector -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-valloc -fno-builtin-free -fno-builtin-strdup -fno-builtin-strndup -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /home/ben/Projects/vmm/scan-build/2022-01-12-194120-40624-1 -x c arparse.c
1 | #include <stdlib.h> |
2 | #include <string.h> |
3 | #define YYBYACC 1 |
4 | #define YYMAJOR 1 |
5 | #define YYMINOR 9 |
6 | #define YYLEX yylex() |
7 | #define YYEMPTY -1 |
8 | #define yyclearin (yychar=(YYEMPTY)) |
9 | #define yyerrok (yyerrflag=0) |
10 | #define YYRECOVERING() (yyerrflag!=0) |
11 | #define YYPREFIX "yy" |
12 | #line 2 "arparse.y" |
13 | |
14 | |
15 | |
16 | |
17 | |
18 | |
19 | |
20 | |
21 | |
22 | |
23 | |
24 | |
25 | |
26 | |
27 | |
28 | |
29 | |
30 | |
31 | |
32 | |
33 | |
34 | |
35 | |
36 | |
37 | |
38 | |
39 | #define DONTDECLARE_MALLOC |
40 | #include "bfd.h" |
41 | #include "bucomm.h" |
42 | #include "arsup.h" |
43 | extern int verbose; |
44 | extern int yylex (void); |
45 | static int yyerror (const char *); |
46 | #line 37 "arparse.y" |
47 | #ifndef YYSTYPE_DEFINED |
48 | #define YYSTYPE_DEFINED |
49 | typedef union { |
50 | char *name; |
51 | struct list *list ; |
52 | |
53 | } YYSTYPE; |
54 | #endif /* YYSTYPE_DEFINED */ |
55 | #line 56 "arparse.c" |
56 | #define NEWLINE 257 |
57 | #define VERBOSE 258 |
58 | #define FILENAME 259 |
59 | #define ADDLIB 260 |
60 | #define LIST 261 |
61 | #define ADDMOD 262 |
62 | #define CLEAR 263 |
63 | #define CREATE 264 |
64 | #define DELETE 265 |
65 | #define DIRECTORY 266 |
66 | #define END 267 |
67 | #define EXTRACT 268 |
68 | #define FULLDIR 269 |
69 | #define HELP 270 |
70 | #define QUIT 271 |
71 | #define REPLACE 272 |
72 | #define SAVE 273 |
73 | #define OPEN 274 |
74 | #define YYERRCODE 256 |
75 | const short yylhs[] = |
76 | { -1, |
77 | 5, 0, 4, 4, 6, 7, 7, 7, 7, 7, |
78 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, |
79 | 7, 16, 17, 13, 18, 14, 19, 15, 8, 9, |
80 | 12, 11, 3, 3, 1, 1, 2, 2, 20, 20, |
81 | 10, |
82 | }; |
83 | const short yylen[] = |
84 | { 2, |
85 | 0, 2, 2, 0, 2, 1, 1, 1, 1, 1, |
86 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
87 | 0, 2, 2, 1, 2, 2, 1, 1, 2, 2, |
88 | 3, 4, 1, 0, 3, 0, 3, 0, 1, 0, |
89 | 1, |
90 | }; |
91 | const short yydefred[] = |
92 | { 1, |
93 | 0, 4, 0, 19, 41, 20, 0, 27, 38, 24, |
94 | 0, 38, 0, 18, 38, 38, 28, 0, 3, 0, |
95 | 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, |
96 | 16, 17, 0, 0, 30, 0, 0, 0, 0, 29, |
97 | 5, 38, 31, 39, 0, 0, 0, 37, 33, 32, |
98 | 35, |
99 | }; |
100 | const short yydgoto[] = |
101 | { 1, |
102 | 43, 34, 50, 3, 2, 19, 20, 21, 22, 23, |
103 | 24, 25, 26, 27, 28, 29, 30, 31, 32, 45, |
104 | }; |
105 | const short yysindex[] = |
106 | { 0, |
107 | 0, 0, -251, 0, 0, 0, -257, 0, 0, 0, |
108 | -253, 0, -240, 0, 0, 0, 0, -234, 0, -221, |
109 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
110 | 0, 0, -3, -6, 0, -6, -3, -6, -6, 0, |
111 | 0, 0, 0, 0, -220, -219, -17, 0, 0, 0, |
112 | 0,}; |
113 | const short yyrindex[] = |
114 | { 0, |
115 | 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, |
116 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
117 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
118 | 0, 0, -216, -239, 0, -231, -228, -225, -224, 0, |
119 | 0, 0, 0, 0, 0, -215, -234, 0, 0, 0, |
120 | 0,}; |
121 | const short yygindex[] = |
122 | { 0, |
123 | 6, -12, 0, 0, 0, 0, 0, 0, 0, 0, |
124 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
125 | }; |
126 | #define YYTABLESIZE 258 |
127 | const short yytable[] = |
128 | { 36, |
129 | 2, 33, 38, 39, 4, 35, 5, 6, 7, 8, |
130 | 9, 10, 11, 12, 13, 14, 15, 26, 37, 40, |
131 | 16, 17, 18, 51, 40, 25, 44, 40, 36, 47, |
132 | 36, 22, 23, 40, 40, 41, 42, 44, 48, 49, |
133 | 36, 34, 46, 0, 0, 0, 0, 0, 0, 0, |
134 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
135 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
136 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
137 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
138 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
139 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
140 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
141 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
142 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
143 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
144 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
145 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
146 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
147 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
148 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
149 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
150 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
151 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
152 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
153 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
154 | 0, 0, 0, 0, 0, 0, 0, 21, |
155 | }; |
156 | const short yycheck[] = |
157 | { 12, |
158 | 0, 259, 15, 16, 256, 259, 258, 259, 260, 261, |
159 | 262, 263, 264, 265, 266, 267, 268, 257, 259, 259, |
160 | 272, 273, 274, 41, 259, 257, 44, 259, 257, 42, |
161 | 259, 257, 257, 259, 259, 257, 40, 44, 259, 259, |
162 | 257, 257, 37, -1, -1, -1, -1, -1, -1, -1, |
163 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
164 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
165 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
166 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
167 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
168 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
169 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
170 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
171 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
172 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
173 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
174 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
175 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
176 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
177 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
178 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
179 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
180 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
181 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
182 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
183 | -1, -1, -1, -1, -1, -1, -1, 257, |
184 | }; |
185 | #define YYFINAL 1 |
186 | #ifndef YYDEBUG |
187 | #define YYDEBUG 0 |
188 | #endif |
189 | #define YYMAXTOKEN 274 |
190 | #if YYDEBUG |
191 | const char * const yyname[] = |
192 | { |
193 | "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
194 | 0,0,0,0,0,0,"'('","')'",0,0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
195 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
196 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
197 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
198 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
199 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"NEWLINE","VERBOSE", |
200 | "FILENAME","ADDLIB","LIST","ADDMOD","CLEAR","CREATE","DELETE","DIRECTORY","END", |
201 | "EXTRACT","FULLDIR","HELP","QUIT","REPLACE","SAVE","OPEN", |
202 | }; |
203 | const char * const yyrule[] = |
204 | {"$accept : start", |
205 | "$$1 :", |
206 | "start : $$1 session", |
207 | "session : session command_line", |
208 | "session :", |
209 | "command_line : command NEWLINE", |
210 | "command : open_command", |
211 | "command : create_command", |
212 | "command : verbose_command", |
213 | "command : directory_command", |
214 | "command : addlib_command", |
215 | "command : clear_command", |
216 | "command : addmod_command", |
217 | "command : save_command", |
218 | "command : extract_command", |
219 | "command : replace_command", |
220 | "command : delete_command", |
221 | "command : list_command", |
222 | "command : END", |
223 | "command : error", |
224 | "command : FILENAME", |
225 | "command :", |
226 | "extract_command : EXTRACT modulename", |
227 | "replace_command : REPLACE modulename", |
228 | "clear_command : CLEAR", |
229 | "delete_command : DELETE modulename", |
230 | "addmod_command : ADDMOD modulename", |
231 | "list_command : LIST", |
232 | "save_command : SAVE", |
233 | "open_command : OPEN FILENAME", |
234 | "create_command : CREATE FILENAME", |
235 | "addlib_command : ADDLIB FILENAME modulelist", |
236 | "directory_command : DIRECTORY FILENAME modulelist optional_filename", |
237 | "optional_filename : FILENAME", |
238 | "optional_filename :", |
239 | "modulelist : '(' modulename ')'", |
240 | "modulelist :", |
241 | "modulename : modulename optcomma FILENAME", |
242 | "modulename :", |
243 | "optcomma : ','", |
244 | "optcomma :", |
245 | "verbose_command : VERBOSE", |
246 | }; |
247 | #endif |
248 | #ifdef YYSTACKSIZE |
249 | #undef YYMAXDEPTH |
250 | #define YYMAXDEPTH YYSTACKSIZE |
251 | #else |
252 | #ifdef YYMAXDEPTH |
253 | #define YYSTACKSIZE YYMAXDEPTH |
254 | #else |
255 | #define YYSTACKSIZE 10000 |
256 | #define YYMAXDEPTH 10000 |
257 | #endif |
258 | #endif |
259 | #define YYINITSTACKSIZE 200 |
260 | |
261 | int yydebug; |
262 | int yynerrs; |
263 | int yyerrflag; |
264 | int yychar; |
265 | short *yyssp; |
266 | YYSTYPE *yyvsp; |
267 | YYSTYPE yyval; |
268 | YYSTYPE yylval; |
269 | short *yyss; |
270 | short *yysslim; |
271 | YYSTYPE *yyvs; |
272 | unsigned int yystacksize; |
273 | int yyparse(void); |
274 | #line 195 "arparse.y" |
275 | |
276 | static int |
277 | yyerror (const char *x ATTRIBUTE_UNUSED) |
278 | { |
279 | extern int linenumber; |
280 | |
281 | printf (_("Syntax error in archive script, line %d\n"), linenumber + 1); |
282 | return 0; |
283 | } |
284 | #line 277 "arparse.c" |
285 | |
286 | static int yygrowstack(void) |
287 | { |
288 | unsigned int newsize; |
289 | long sslen; |
290 | short *newss; |
291 | YYSTYPE *newvs; |
292 | |
293 | if ((newsize = yystacksize) == 0) |
| 3 | | Assuming the condition is false | |
|
| |
294 | newsize = YYINITSTACKSIZE; |
295 | else if (newsize >= YYMAXDEPTH) |
| 5 | | Assuming 'newsize' is < YYMAXDEPTH | |
|
| |
296 | return -1; |
297 | else if ((newsize *= 2) > YYMAXDEPTH) |
| 7 | | Assuming the condition is false | |
|
| |
298 | newsize = YYMAXDEPTH; |
299 | sslen = yyssp - yyss; |
300 | #ifdef SIZE_MAX |
301 | #define YY_SIZE_MAX SIZE_MAX |
302 | #else |
303 | #define YY_SIZE_MAX 0xffffffffU |
304 | #endif |
305 | if (newsize && YY_SIZE_MAX / newsize < sizeof *newss) |
| |
306 | goto bail; |
307 | newss = (short *)realloc(yyss, newsize * sizeof *newss); |
308 | if (newss == NULL) |
| 10 | | Assuming 'newss' is not equal to NULL | |
|
| |
309 | goto bail; |
310 | yyss = newss; |
311 | yyssp = newss + sslen; |
312 | if (newsize && YY_SIZE_MAX / newsize < sizeof *newvs) |
313 | goto bail; |
314 | newvs = (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs); |
315 | if (newvs == NULL) |
| 12 | | Assuming 'newvs' is not equal to NULL | |
|
| |
316 | goto bail; |
317 | yyvs = newvs; |
318 | yyvsp = newvs + sslen; |
319 | yystacksize = newsize; |
320 | yysslim = yyss + newsize - 1; |
321 | return 0; |
322 | bail: |
323 | if (yyss) |
324 | free(yyss); |
325 | if (yyvs) |
326 | free(yyvs); |
327 | yyss = yyssp = NULL; |
328 | yyvs = yyvsp = NULL; |
329 | yystacksize = 0; |
330 | return -1; |
331 | } |
332 | |
333 | #define YYABORT goto yyabort |
334 | #define YYREJECT goto yyabort |
335 | #define YYACCEPT goto yyaccept |
336 | #define YYERROR goto yyerrlab |
337 | int |
338 | yyparse(void) |
339 | { |
340 | int yym, yyn, yystate; |
341 | #if YYDEBUG |
342 | const char *yys; |
343 | |
344 | if ((yys = getenv("YYDEBUG"))) |
345 | { |
346 | yyn = *yys; |
347 | if (yyn >= '0' && yyn <= '9') |
348 | yydebug = yyn - '0'; |
349 | } |
350 | #endif /* YYDEBUG */ |
351 | |
352 | yynerrs = 0; |
353 | yyerrflag = 0; |
354 | yychar = (-1); |
355 | |
356 | if (yyss == NULL && yygrowstack()) goto yyoverflow; |
| 1 | Assuming 'yyss' is equal to NULL | |
|
| |
| 14 | | Returning from 'yygrowstack' | |
|
| |
357 | yyssp = yyss; |
358 | yyvsp = yyvs; |
359 | *yyssp = yystate = 0; |
| 16 | | Use of zero-allocated memory |
|
360 | |
361 | yyloop: |
362 | if ((yyn = yydefred[yystate]) != 0) goto yyreduce; |
363 | if (yychar < 0) |
364 | { |
365 | if ((yychar = yylex()) < 0) yychar = 0; |
366 | #if YYDEBUG |
367 | if (yydebug) |
368 | { |
369 | yys = 0; |
370 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
371 | if (!yys) yys = "illegal-symbol"; |
372 | printf("%sdebug: state %d, reading %d (%s)\n", |
373 | YYPREFIX, yystate, yychar, yys); |
374 | } |
375 | #endif |
376 | } |
377 | if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 && |
378 | yyn <= YYTABLESIZE && yycheck[yyn] == yychar) |
379 | { |
380 | #if YYDEBUG |
381 | if (yydebug) |
382 | printf("%sdebug: state %d, shifting to state %d\n", |
383 | YYPREFIX, yystate, yytable[yyn]); |
384 | #endif |
385 | if (yyssp >= yysslim && yygrowstack()) |
386 | { |
387 | goto yyoverflow; |
388 | } |
389 | *++yyssp = yystate = yytable[yyn]; |
390 | *++yyvsp = yylval; |
391 | yychar = (-1); |
392 | if (yyerrflag > 0) --yyerrflag; |
393 | goto yyloop; |
394 | } |
395 | if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && |
396 | yyn <= YYTABLESIZE && yycheck[yyn] == yychar) |
397 | { |
398 | yyn = yytable[yyn]; |
399 | goto yyreduce; |
400 | } |
401 | if (yyerrflag) goto yyinrecovery; |
402 | #if defined(__GNUC__) |
403 | goto yynewerror; |
404 | #endif |
405 | yynewerror: |
406 | yyerror("syntax error"); |
407 | #if defined(__GNUC__) |
408 | goto yyerrlab; |
409 | #endif |
410 | yyerrlab: |
411 | ++yynerrs; |
412 | yyinrecovery: |
413 | if (yyerrflag < 3) |
414 | { |
415 | yyerrflag = 3; |
416 | for (;;) |
417 | { |
418 | if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 && |
419 | yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) |
420 | { |
421 | #if YYDEBUG |
422 | if (yydebug) |
423 | printf("%sdebug: state %d, error recovery shifting\ |
424 | to state %d\n", YYPREFIX, *yyssp, yytable[yyn]); |
425 | #endif |
426 | if (yyssp >= yysslim && yygrowstack()) |
427 | { |
428 | goto yyoverflow; |
429 | } |
430 | *++yyssp = yystate = yytable[yyn]; |
431 | *++yyvsp = yylval; |
432 | goto yyloop; |
433 | } |
434 | else |
435 | { |
436 | #if YYDEBUG |
437 | if (yydebug) |
438 | printf("%sdebug: error recovery discarding state %d\n", |
439 | YYPREFIX, *yyssp); |
440 | #endif |
441 | if (yyssp <= yyss) goto yyabort; |
442 | --yyssp; |
443 | --yyvsp; |
444 | } |
445 | } |
446 | } |
447 | else |
448 | { |
449 | if (yychar == 0) goto yyabort; |
450 | #if YYDEBUG |
451 | if (yydebug) |
452 | { |
453 | yys = 0; |
454 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
455 | if (!yys) yys = "illegal-symbol"; |
456 | printf("%sdebug: state %d, error recovery discards token %d (%s)\n", |
457 | YYPREFIX, yystate, yychar, yys); |
458 | } |
459 | #endif |
460 | yychar = (-1); |
461 | goto yyloop; |
462 | } |
463 | yyreduce: |
464 | #if YYDEBUG |
465 | if (yydebug) |
466 | printf("%sdebug: state %d, reducing by rule %d (%s)\n", |
467 | YYPREFIX, yystate, yyn, yyrule[yyn]); |
468 | #endif |
469 | yym = yylen[yyn]; |
470 | if (yym) |
471 | yyval = yyvsp[1-yym]; |
472 | else |
473 | memset(&yyval, 0, sizeof yyval); |
474 | switch (yyn) |
475 | { |
476 | case 1: |
477 | #line 68 "arparse.y" |
478 | { prompt(); } |
479 | break; |
480 | case 5: |
481 | #line 77 "arparse.y" |
482 | { prompt(); } |
483 | break; |
484 | case 18: |
485 | #line 93 "arparse.y" |
486 | { ar_end(); return 0; } |
487 | break; |
488 | case 20: |
489 | #line 95 "arparse.y" |
490 | { yyerror("foo"); } |
491 | break; |
492 | case 22: |
493 | #line 102 "arparse.y" |
494 | { ar_extract(yyvsp[0].list); } |
495 | break; |
496 | case 23: |
497 | #line 107 "arparse.y" |
498 | { ar_replace(yyvsp[0].list); } |
499 | break; |
500 | case 24: |
501 | #line 112 "arparse.y" |
502 | { ar_clear(); } |
503 | break; |
504 | case 25: |
505 | #line 117 "arparse.y" |
506 | { ar_delete(yyvsp[0].list); } |
507 | break; |
508 | case 26: |
509 | #line 121 "arparse.y" |
510 | { ar_addmod(yyvsp[0].list); } |
511 | break; |
512 | case 27: |
513 | #line 126 "arparse.y" |
514 | { ar_list(); } |
515 | break; |
516 | case 28: |
517 | #line 131 "arparse.y" |
518 | { ar_save(); } |
519 | break; |
520 | case 29: |
521 | #line 138 "arparse.y" |
522 | { ar_open(yyvsp[0].name,0); } |
523 | break; |
524 | case 30: |
525 | #line 143 "arparse.y" |
526 | { ar_open(yyvsp[0].name,1); } |
527 | break; |
528 | case 31: |
529 | #line 149 "arparse.y" |
530 | { ar_addlib(yyvsp[-1].name,yyvsp[0].list); } |
531 | break; |
532 | case 32: |
533 | #line 153 "arparse.y" |
534 | { ar_directory(yyvsp[-2].name, yyvsp[-1].list, yyvsp[0].name); } |
535 | break; |
536 | case 33: |
537 | #line 160 "arparse.y" |
538 | { yyval.name = yyvsp[0].name; } |
539 | break; |
540 | case 34: |
541 | #line 161 "arparse.y" |
542 | { yyval.name = 0; } |
543 | break; |
544 | case 35: |
545 | #line 166 "arparse.y" |
546 | { yyval.list = yyvsp[-1].list; } |
547 | break; |
548 | case 36: |
549 | #line 168 "arparse.y" |
550 | { yyval.list = 0; } |
551 | break; |
552 | case 37: |
553 | #line 173 "arparse.y" |
554 | { struct list *n = (struct list *) malloc(sizeof(struct list)); |
555 | n->next = yyvsp[-2].list; |
556 | n->name = yyvsp[0].name; |
557 | yyval.list = n; |
558 | } |
559 | break; |
560 | case 38: |
561 | #line 178 "arparse.y" |
562 | { yyval.list = 0; } |
563 | break; |
564 | case 41: |
565 | #line 190 "arparse.y" |
566 | { verbose = !verbose; } |
567 | break; |
568 | #line 561 "arparse.c" |
569 | } |
570 | yyssp -= yym; |
571 | yystate = *yyssp; |
572 | yyvsp -= yym; |
573 | yym = yylhs[yyn]; |
574 | if (yystate == 0 && yym == 0) |
575 | { |
576 | #if YYDEBUG |
577 | if (yydebug) |
578 | printf("%sdebug: after reduction, shifting from state 0 to\ |
579 | state %d\n", YYPREFIX, YYFINAL); |
580 | #endif |
581 | yystate = YYFINAL; |
582 | *++yyssp = YYFINAL; |
583 | *++yyvsp = yyval; |
584 | if (yychar < 0) |
585 | { |
586 | if ((yychar = yylex()) < 0) yychar = 0; |
587 | #if YYDEBUG |
588 | if (yydebug) |
589 | { |
590 | yys = 0; |
591 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
592 | if (!yys) yys = "illegal-symbol"; |
593 | printf("%sdebug: state %d, reading %d (%s)\n", |
594 | YYPREFIX, YYFINAL, yychar, yys); |
595 | } |
596 | #endif |
597 | } |
598 | if (yychar == 0) goto yyaccept; |
599 | goto yyloop; |
600 | } |
601 | if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && |
602 | yyn <= YYTABLESIZE && yycheck[yyn] == yystate) |
603 | yystate = yytable[yyn]; |
604 | else |
605 | yystate = yydgoto[yym]; |
606 | #if YYDEBUG |
607 | if (yydebug) |
608 | printf("%sdebug: after reduction, shifting from state %d \ |
609 | to state %d\n", YYPREFIX, *yyssp, yystate); |
610 | #endif |
611 | if (yyssp >= yysslim && yygrowstack()) |
612 | { |
613 | goto yyoverflow; |
614 | } |
615 | *++yyssp = yystate; |
616 | *++yyvsp = yyval; |
617 | goto yyloop; |
618 | yyoverflow: |
619 | yyerror("yacc stack overflow"); |
620 | yyabort: |
621 | if (yyss) |
622 | free(yyss); |
623 | if (yyvs) |
624 | free(yyvs); |
625 | yyss = yyssp = NULL; |
626 | yyvs = yyvsp = NULL; |
627 | yystacksize = 0; |
628 | return (1); |
629 | yyaccept: |
630 | if (yyss) |
631 | free(yyss); |
632 | if (yyvs) |
633 | free(yyvs); |
634 | yyss = yyssp = NULL; |
635 | yyvs = yyvsp = NULL; |
636 | yystacksize = 0; |
637 | return (0); |
638 | } |