File: | src/usr.bin/rdist/obj/gram.c |
Warning: | line 712, column 12 Use of zero-allocated memory |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | #include <stdlib.h> | |||
2 | #include <string.h> | |||
3 | #define YYBYACC1 1 | |||
4 | #define YYMAJOR1 1 | |||
5 | #define YYMINOR9 9 | |||
6 | #define YYLEXyylex() yylex() | |||
7 | #define YYEMPTY-1 -1 | |||
8 | #define yyclearin(yychar=(-1)) (yychar=(YYEMPTY-1)) | |||
9 | #define yyerrok(yyerrflag=0) (yyerrflag=0) | |||
10 | #define YYRECOVERING()(yyerrflag!=0) (yyerrflag!=0) | |||
11 | #define YYPREFIX"yy" "yy" | |||
12 | #line 2 "/usr/src/usr.bin/rdist/gram.y" | |||
13 | /* $OpenBSD: gram.y,v 1.12 2015/01/20 09:00:16 guenther Exp $ */ | |||
14 | ||||
15 | /* | |||
16 | * Copyright (c) 1993 Michael A. Cooper | |||
17 | * Copyright (c) 1993 Regents of the University of California. | |||
18 | * All rights reserved. | |||
19 | * | |||
20 | * Redistribution and use in source and binary forms, with or without | |||
21 | * modification, are permitted provided that the following conditions | |||
22 | * are met: | |||
23 | * 1. Redistributions of source code must retain the above copyright | |||
24 | * notice, this list of conditions and the following disclaimer. | |||
25 | * 2. Redistributions in binary form must reproduce the above copyright | |||
26 | * notice, this list of conditions and the following disclaimer in the | |||
27 | * documentation and/or other materials provided with the distribution. | |||
28 | * 3. Neither the name of the University nor the names of its contributors | |||
29 | * may be used to endorse or promote products derived from this software | |||
30 | * without specific prior written permission. | |||
31 | * | |||
32 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |||
33 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
34 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |||
35 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |||
36 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||
37 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |||
38 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |||
39 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |||
40 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |||
41 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||
42 | * SUCH DAMAGE. | |||
43 | */ | |||
44 | ||||
45 | #include "client.h" | |||
46 | ||||
47 | static struct namelist *addnl(struct namelist *, struct namelist *); | |||
48 | static struct namelist *subnl(struct namelist *, struct namelist *); | |||
49 | static struct namelist *andnl(struct namelist *, struct namelist *); | |||
50 | static int innl(struct namelist *nl, char *p); | |||
51 | ||||
52 | struct cmd *cmds = NULL((void *)0); | |||
53 | struct cmd *last_cmd; | |||
54 | struct namelist *last_n; | |||
55 | struct subcmd *last_sc; | |||
56 | int parendepth = 0; | |||
57 | ||||
58 | #line 62 "/usr/src/usr.bin/rdist/gram.y" | |||
59 | #ifndef YYSTYPE_DEFINED | |||
60 | #define YYSTYPE_DEFINED | |||
61 | typedef union { | |||
62 | opt_t optval; | |||
63 | char *string; | |||
64 | struct subcmd *subcmd; | |||
65 | struct namelist *namel; | |||
66 | } YYSTYPE; | |||
67 | #endif /* YYSTYPE_DEFINED */ | |||
68 | #line 69 "gram.c" | |||
69 | #define ARROW1 1 | |||
70 | #define COLON2 2 | |||
71 | #define DCOLON3 3 | |||
72 | #define NAME4 4 | |||
73 | #define STRING5 5 | |||
74 | #define INSTALL6 6 | |||
75 | #define NOTIFY7 7 | |||
76 | #define EXCEPT8 8 | |||
77 | #define PATTERN9 9 | |||
78 | #define SPECIAL10 10 | |||
79 | #define CMDSPECIAL11 11 | |||
80 | #define OPTION12 12 | |||
81 | #define YYERRCODE256 256 | |||
82 | const short yylhs[] = | |||
83 | { -1, | |||
84 | 0, 0, 8, 8, 8, 8, 8, 8, 4, 4, | |||
85 | 4, 4, 7, 7, 5, 5, 2, 2, 3, 3, | |||
86 | 3, 3, 3, 3, 1, 1, 6, 6, | |||
87 | }; | |||
88 | const short yylen[] = | |||
89 | { 2, | |||
90 | 0, 2, 3, 4, 6, 4, 6, 1, 1, 3, | |||
91 | 3, 3, 1, 3, 0, 2, 0, 2, 4, 3, | |||
92 | 3, 3, 4, 4, 0, 2, 0, 1, | |||
93 | }; | |||
94 | const short yydefred[] = | |||
95 | { 1, | |||
96 | 0, 8, 0, 15, 0, 0, 2, 0, 0, 0, | |||
97 | 0, 0, 0, 0, 0, 13, 0, 3, 16, 14, | |||
98 | 17, 17, 10, 11, 12, 0, 0, 0, 0, 17, | |||
99 | 17, 25, 0, 0, 0, 0, 0, 18, 0, 0, | |||
100 | 0, 0, 0, 0, 28, 0, 0, 26, 0, 20, | |||
101 | 21, 22, 0, 0, 19, 23, 24, | |||
102 | }; | |||
103 | const short yydgoto[] = | |||
104 | { 1, | |||
105 | 41, 28, 38, 45, 10, 46, 6, 7, | |||
106 | }; | |||
107 | const short yysindex[] = | |||
108 | { 0, | |||
109 | -4, 0, 19, 0, 70, -15, 0, 23, 23, -1, | |||
110 | 23, 28, 23, 23, 23, 0, 76, 0, 0, 0, | |||
111 | 0, 0, 0, 0, 0, 23, 29, 37, 37, 0, | |||
112 | 0, 0, 23, 23, 23, 23, 23, 0, 37, 37, | |||
113 | 22, -34, -20, -8, 0, 52, 53, 0, 2, 0, | |||
114 | 0, 0, 6, 24, 0, 0, 0,}; | |||
115 | const short yyrindex[] = | |||
116 | { 0, | |||
117 | 0, 0, 21, 0, 0, 1, 0, 0, 0, 0, | |||
118 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
119 | 0, 0, 0, 0, 0, 0, 0, 13, 14, 0, | |||
120 | 0, 0, 0, 0, 0, 67, 67, 0, 15, 16, | |||
121 | 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
122 | 0, 0, 0, 0, 0, 0, 0,}; | |||
123 | const short yygindex[] = | |||
124 | { 0, | |||
125 | 0, 7, 0, 41, 0, -6, 55, 0, | |||
126 | }; | |||
127 | #define YYTABLESIZE272 272 | |||
128 | const short yytable[] = | |||
129 | { 3, | |||
130 | 9, 9, 19, 9, 9, 9, 9, 9, 9, 9, | |||
131 | 9, 9, 4, 6, 5, 7, 4, 6, 5, 7, | |||
132 | 8, 13, 15, 13, 50, 16, 16, 14, 29, 13, | |||
133 | 47, 22, 31, 48, 49, 4, 39, 40, 51, 20, | |||
134 | 9, 5, 32, 33, 34, 35, 36, 37, 17, 18, | |||
135 | 52, 21, 4, 6, 5, 7, 53, 54, 13, 9, | |||
136 | 55, 4, 4, 13, 56, 13, 30, 23, 24, 25, | |||
137 | 11, 27, 12, 42, 43, 44, 26, 0, 27, 9, | |||
138 | 0, 0, 57, 27, 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, 0, 0, 0, | |||
155 | 0, 2, 0, 0, 0, 0, 9, 0, 0, 0, | |||
156 | 0, 0, 0, 0, 0, 0, 0, 0, 4, 6, | |||
157 | 5, 7, | |||
158 | }; | |||
159 | const short yycheck[] = | |||
160 | { 4, | |||
161 | 0, 1, 4, 3, 4, 5, 6, 7, 8, 9, | |||
162 | 10, 11, 0, 0, 0, 0, 4, 4, 4, 4, | |||
163 | 2, 1, 38, 3, 59, 4, 4, 43, 22, 45, | |||
164 | 37, 4, 4, 12, 41, 40, 30, 31, 59, 41, | |||
165 | 40, 1, 6, 7, 8, 9, 10, 11, 8, 9, | |||
166 | 59, 11, 40, 40, 40, 40, 5, 5, 38, 59, | |||
167 | 59, 40, 40, 43, 59, 45, 26, 13, 14, 15, | |||
168 | 1, 5, 3, 33, 34, 35, 1, -1, 3, 61, | |||
169 | -1, -1, 59, 59, -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, -1, -1, -1, | |||
184 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |||
185 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |||
186 | -1, 256, -1, -1, -1, -1, 256, -1, -1, -1, | |||
187 | -1, -1, -1, -1, -1, -1, -1, -1, 256, 256, | |||
188 | 256, 256, | |||
189 | }; | |||
190 | #define YYFINAL1 1 | |||
191 | #ifndef YYDEBUG0 | |||
192 | #define YYDEBUG0 0 | |||
193 | #endif | |||
194 | #define YYMAXTOKEN61 61 | |||
195 | #if YYDEBUG0 | |||
196 | const char * const yyname[] = | |||
197 | { | |||
198 | "end-of-file","ARROW","COLON","DCOLON","NAME","STRING","INSTALL","NOTIFY", | |||
199 | "EXCEPT","PATTERN","SPECIAL","CMDSPECIAL","OPTION",0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |||
200 | 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, | |||
201 | 0,0,"';'",0,"'='", | |||
202 | }; | |||
203 | const char * const yyrule[] = | |||
204 | {"$accept : file", | |||
205 | "file :", | |||
206 | "file : file command", | |||
207 | "command : NAME '=' namelist", | |||
208 | "command : namelist ARROW namelist cmdlist", | |||
209 | "command : NAME COLON namelist ARROW namelist cmdlist", | |||
210 | "command : namelist DCOLON NAME cmdlist", | |||
211 | "command : NAME COLON namelist DCOLON NAME cmdlist", | |||
212 | "command : error", | |||
213 | "namelist : nlist", | |||
214 | "namelist : nlist '-' nlist", | |||
215 | "namelist : nlist '+' nlist", | |||
216 | "namelist : nlist '&' nlist", | |||
217 | "nlist : NAME", | |||
218 | "nlist : '(' names ')'", | |||
219 | "names :", | |||
220 | "names : names NAME", | |||
221 | "cmdlist :", | |||
222 | "cmdlist : cmdlist cmd", | |||
223 | "cmd : INSTALL options opt_namelist ';'", | |||
224 | "cmd : NOTIFY namelist ';'", | |||
225 | "cmd : EXCEPT namelist ';'", | |||
226 | "cmd : PATTERN namelist ';'", | |||
227 | "cmd : SPECIAL opt_namelist STRING ';'", | |||
228 | "cmd : CMDSPECIAL opt_namelist STRING ';'", | |||
229 | "options :", | |||
230 | "options : options OPTION", | |||
231 | "opt_namelist :", | |||
232 | "opt_namelist : namelist", | |||
233 | }; | |||
234 | #endif | |||
235 | #ifdef YYSTACKSIZE10000 | |||
236 | #undef YYMAXDEPTH10000 | |||
237 | #define YYMAXDEPTH10000 YYSTACKSIZE10000 | |||
238 | #else | |||
239 | #ifdef YYMAXDEPTH10000 | |||
240 | #define YYSTACKSIZE10000 YYMAXDEPTH10000 | |||
241 | #else | |||
242 | #define YYSTACKSIZE10000 10000 | |||
243 | #define YYMAXDEPTH10000 10000 | |||
244 | #endif | |||
245 | #endif | |||
246 | #define YYINITSTACKSIZE200 200 | |||
247 | /* LINTUSED */ | |||
248 | int yydebug; | |||
249 | int yynerrs; | |||
250 | int yyerrflag; | |||
251 | int yychar; | |||
252 | short *yyssp; | |||
253 | YYSTYPE *yyvsp; | |||
254 | YYSTYPE yyval; | |||
255 | YYSTYPE yylval; | |||
256 | short *yyss; | |||
257 | short *yysslim; | |||
258 | YYSTYPE *yyvs; | |||
259 | unsigned int yystacksize; | |||
260 | int yyparse(void); | |||
261 | #line 224 "/usr/src/usr.bin/rdist/gram.y" | |||
262 | ||||
263 | int yylineno = 1; | |||
264 | extern FILE *fin; | |||
265 | ||||
266 | int | |||
267 | yylex(void) | |||
268 | { | |||
269 | static char yytext[INMAX3500]; | |||
270 | int c; | |||
271 | char *cp1, *cp2; | |||
272 | static char quotechars[] = "[]{}*?$"; | |||
273 | ||||
274 | again: | |||
275 | switch (c = getc(fin)(!__isthreaded ? (--(fin)->_r < 0 ? __srget(fin) : (int )(*(fin)->_p++)) : (getc)(fin))) { | |||
276 | case EOF(-1): /* end of file */ | |||
277 | return(0); | |||
278 | ||||
279 | case '#': /* start of comment */ | |||
280 | while ((c = getc(fin)(!__isthreaded ? (--(fin)->_r < 0 ? __srget(fin) : (int )(*(fin)->_p++)) : (getc)(fin))) != EOF(-1) && c != '\n') | |||
281 | ; | |||
282 | if (c == EOF(-1)) | |||
283 | return(0); | |||
284 | case '\n': | |||
285 | yylineno++; | |||
286 | case ' ': | |||
287 | case '\t': /* skip blanks */ | |||
288 | goto again; | |||
289 | ||||
290 | case '=': /* EQUAL */ | |||
291 | case ';': /* SM */ | |||
292 | case '+': | |||
293 | case '&': | |||
294 | return(c); | |||
295 | ||||
296 | case '(': /* LP */ | |||
297 | ++parendepth; | |||
298 | return(c); | |||
299 | ||||
300 | case ')': /* RP */ | |||
301 | --parendepth; | |||
302 | return(c); | |||
303 | ||||
304 | case '-': /* -> */ | |||
305 | if ((c = getc(fin)(!__isthreaded ? (--(fin)->_r < 0 ? __srget(fin) : (int )(*(fin)->_p++)) : (getc)(fin))) == '>') | |||
306 | return(ARROW1); | |||
307 | (void) ungetc(c, fin); | |||
308 | c = '-'; | |||
309 | break; | |||
310 | ||||
311 | case '"': /* STRING */ | |||
312 | cp1 = yytext; | |||
313 | cp2 = &yytext[INMAX3500 - 1]; | |||
314 | for (;;) { | |||
315 | if (cp1 >= cp2) { | |||
316 | yyerror("command string too long\n"); | |||
317 | break; | |||
318 | } | |||
319 | c = getc(fin)(!__isthreaded ? (--(fin)->_r < 0 ? __srget(fin) : (int )(*(fin)->_p++)) : (getc)(fin)); | |||
320 | if (c == EOF(-1) || c == '"') | |||
321 | break; | |||
322 | if (c == '\\') { | |||
323 | if ((c = getc(fin)(!__isthreaded ? (--(fin)->_r < 0 ? __srget(fin) : (int )(*(fin)->_p++)) : (getc)(fin))) == EOF(-1)) { | |||
324 | *cp1++ = '\\'; | |||
325 | break; | |||
326 | } | |||
327 | } | |||
328 | if (c == '\n') { | |||
329 | yylineno++; | |||
330 | c = ' '; /* can't send '\n' */ | |||
331 | } | |||
332 | *cp1++ = c; | |||
333 | } | |||
334 | if (c != '"') | |||
335 | yyerror("missing closing '\"'\n"); | |||
336 | *cp1 = '\0'; | |||
337 | yylval.string = xstrdup(yytext); | |||
338 | return(STRING5); | |||
339 | ||||
340 | case ':': /* : or :: */ | |||
341 | if ((c = getc(fin)(!__isthreaded ? (--(fin)->_r < 0 ? __srget(fin) : (int )(*(fin)->_p++)) : (getc)(fin))) == ':') | |||
342 | return(DCOLON3); | |||
343 | (void) ungetc(c, fin); | |||
344 | return(COLON2); | |||
345 | } | |||
346 | cp1 = yytext; | |||
347 | cp2 = &yytext[INMAX3500 - 1]; | |||
348 | for (;;) { | |||
349 | if (cp1 >= cp2) { | |||
350 | yyerror("input line too long\n"); | |||
351 | break; | |||
352 | } | |||
353 | if (c == '\\') { | |||
354 | if ((c = getc(fin)(!__isthreaded ? (--(fin)->_r < 0 ? __srget(fin) : (int )(*(fin)->_p++)) : (getc)(fin))) != EOF(-1)) { | |||
355 | if (any(c, quotechars)) | |||
356 | *cp1++ = QUOTECHAR160U; | |||
357 | } else { | |||
358 | *cp1++ = '\\'; | |||
359 | break; | |||
360 | } | |||
361 | } | |||
362 | *cp1++ = c; | |||
363 | c = getc(fin)(!__isthreaded ? (--(fin)->_r < 0 ? __srget(fin) : (int )(*(fin)->_p++)) : (getc)(fin)); | |||
364 | if (c == EOF(-1) || any(c, " \"'\t()=;:\n")) { | |||
365 | (void) ungetc(c, fin); | |||
366 | break; | |||
367 | } | |||
368 | } | |||
369 | *cp1 = '\0'; | |||
370 | if (yytext[0] == '-' && yytext[1] == CNULL'\0') | |||
371 | return '-'; | |||
372 | if (yytext[0] == '-' && parendepth <= 0) { | |||
373 | opt_t opt = 0; | |||
374 | static char ebuf[BUFSIZ1024]; | |||
375 | ||||
376 | switch (yytext[1]) { | |||
377 | case 'o': | |||
378 | if (parsedistopts(&yytext[2], &opt, TRUE1)) { | |||
379 | (void) snprintf(ebuf, sizeof(ebuf), | |||
380 | "Bad distfile options \"%s\".", | |||
381 | &yytext[2]); | |||
382 | yyerror(ebuf); | |||
383 | } | |||
384 | break; | |||
385 | ||||
386 | /* | |||
387 | * These options are obsoleted by -o. | |||
388 | */ | |||
389 | case 'b': opt = DO_COMPARE0x0000008; break; | |||
390 | case 'R': opt = DO_REMOVE0x0000010; break; | |||
391 | case 'v': opt = DO_VERIFY0x0000001; break; | |||
392 | case 'w': opt = DO_WHOLE0x0000002; break; | |||
393 | case 'y': opt = DO_YOUNGER0x0000004; break; | |||
394 | case 'h': opt = DO_FOLLOW0x0000020; break; | |||
395 | case 'i': opt = DO_IGNLNKS0x0000040; break; | |||
396 | case 'q': opt = DO_QUIET0x0000100; break; | |||
397 | case 'x': opt = DO_NOEXEC0x0000800; break; | |||
398 | case 'N': opt = DO_CHKNFS0x0000200; break; | |||
399 | case 'O': opt = DO_CHKREADONLY0x0000400; break; | |||
400 | case 's': opt = DO_SAVETARGETS0x0001000; break; | |||
401 | case 'r': opt = DO_NODESCEND0x0002000; break; | |||
402 | ||||
403 | default: | |||
404 | (void) snprintf(ebuf, sizeof(ebuf), | |||
405 | "Unknown option \"%s\".", yytext); | |||
406 | yyerror(ebuf); | |||
407 | } | |||
408 | ||||
409 | yylval.optval = opt; | |||
410 | return(OPTION12); | |||
411 | } | |||
412 | if (!strcmp(yytext, "install")) | |||
413 | c = INSTALL6; | |||
414 | else if (!strcmp(yytext, "notify")) | |||
415 | c = NOTIFY7; | |||
416 | else if (!strcmp(yytext, "except")) | |||
417 | c = EXCEPT8; | |||
418 | else if (!strcmp(yytext, "except_pat")) | |||
419 | c = PATTERN9; | |||
420 | else if (!strcmp(yytext, "special")) | |||
421 | c = SPECIAL10; | |||
422 | else if (!strcmp(yytext, "cmdspecial")) | |||
423 | c = CMDSPECIAL11; | |||
424 | else { | |||
425 | yylval.string = xstrdup(yytext); | |||
426 | return(NAME4); | |||
427 | } | |||
428 | yylval.subcmd = makesubcmd(c); | |||
429 | return(c); | |||
430 | } | |||
431 | ||||
432 | /* | |||
433 | * XXX We should use strchr(), but most versions can't handle | |||
434 | * some of the characters we use. | |||
435 | */ | |||
436 | int any(int c, char *str) | |||
437 | { | |||
438 | while (*str) | |||
439 | if (c == *str++) | |||
440 | return(1); | |||
441 | return(0); | |||
442 | } | |||
443 | ||||
444 | /* | |||
445 | * Insert or append ARROW command to list of hosts to be updated. | |||
446 | */ | |||
447 | void | |||
448 | insert(char *label, struct namelist *files, struct namelist *hosts, | |||
449 | struct subcmd *scmds) | |||
450 | { | |||
451 | struct cmd *c, *prev, *nc; | |||
452 | struct namelist *h, *lasth; | |||
453 | ||||
454 | debugmsg(DM_CALL0x01, "insert(%s, %p, %p, %p) start, files = %s", | |||
455 | label == NULL((void *)0) ? "(null)" : label, | |||
456 | files, hosts, scmds, getnlstr(files)); | |||
457 | ||||
458 | files = expand(files, E_VARS0x1|E_SHELL0x2); | |||
459 | hosts = expand(hosts, E_ALL0x7); | |||
460 | for (h = hosts; h != NULL((void *)0); lasth = h, h = h->n_next, | |||
461 | free((char *)lasth)) { | |||
462 | /* | |||
463 | * Search command list for an update to the same host. | |||
464 | */ | |||
465 | for (prev = NULL((void *)0), c = cmds; c!=NULL((void *)0); prev = c, c = c->c_next) { | |||
466 | if (strcmp(c->c_name, h->n_name) == 0) { | |||
467 | do { | |||
468 | prev = c; | |||
469 | c = c->c_next; | |||
470 | } while (c != NULL((void *)0) && | |||
471 | strcmp(c->c_name, h->n_name) == 0); | |||
472 | break; | |||
473 | } | |||
474 | } | |||
475 | /* | |||
476 | * Insert new command to update host. | |||
477 | */ | |||
478 | nc = ALLOC(cmd)xmalloc(sizeof(struct cmd)); | |||
479 | nc->c_type = ARROW1; | |||
480 | nc->c_name = h->n_name; | |||
481 | nc->c_label = label; | |||
482 | nc->c_files = files; | |||
483 | nc->c_cmds = scmds; | |||
484 | nc->c_flags = 0; | |||
485 | nc->c_next = c; | |||
486 | if (prev == NULL((void *)0)) | |||
487 | cmds = nc; | |||
488 | else | |||
489 | prev->c_next = nc; | |||
490 | /* update last_cmd if appending nc to cmds */ | |||
491 | if (c == NULL((void *)0)) | |||
492 | last_cmd = nc; | |||
493 | } | |||
494 | } | |||
495 | ||||
496 | /* | |||
497 | * Append DCOLON command to the end of the command list since these are always | |||
498 | * executed in the order they appear in the distfile. | |||
499 | */ | |||
500 | void | |||
501 | append(char *label, struct namelist *files, char *stamp, struct subcmd *scmds) | |||
502 | { | |||
503 | struct cmd *c; | |||
504 | ||||
505 | c = ALLOC(cmd)xmalloc(sizeof(struct cmd)); | |||
506 | c->c_type = DCOLON3; | |||
507 | c->c_name = stamp; | |||
508 | c->c_label = label; | |||
509 | c->c_files = expand(files, E_ALL0x7); | |||
510 | c->c_cmds = scmds; | |||
511 | c->c_next = NULL((void *)0); | |||
512 | if (cmds == NULL((void *)0)) | |||
513 | cmds = last_cmd = c; | |||
514 | else { | |||
515 | last_cmd->c_next = c; | |||
516 | last_cmd = c; | |||
517 | } | |||
518 | } | |||
519 | ||||
520 | /* | |||
521 | * Error printing routine in parser. | |||
522 | */ | |||
523 | void | |||
524 | yyerror(char *s) | |||
525 | { | |||
526 | error("Error in distfile: line %d: %s", yylineno, s); | |||
527 | } | |||
528 | ||||
529 | /* | |||
530 | * Allocate a namelist structure. | |||
531 | */ | |||
532 | struct namelist * | |||
533 | makenl(char *name) | |||
534 | { | |||
535 | struct namelist *nl; | |||
536 | ||||
537 | debugmsg(DM_CALL0x01, "makenl(%s)", name == NULL((void *)0) ? "null" : name); | |||
538 | ||||
539 | nl = ALLOC(namelist)xmalloc(sizeof(struct namelist)); | |||
540 | nl->n_name = name; | |||
541 | nl->n_regex = NULL((void *)0); | |||
542 | nl->n_next = NULL((void *)0); | |||
543 | ||||
544 | return(nl); | |||
545 | } | |||
546 | ||||
547 | ||||
548 | /* | |||
549 | * Is the name p in the namelist nl? | |||
550 | */ | |||
551 | static int | |||
552 | innl(struct namelist *nl, char *p) | |||
553 | { | |||
554 | for ( ; nl; nl = nl->n_next) | |||
555 | if (!strcmp(p, nl->n_name)) | |||
556 | return(1); | |||
557 | return(0); | |||
558 | } | |||
559 | ||||
560 | /* | |||
561 | * Join two namelists. | |||
562 | */ | |||
563 | static struct namelist * | |||
564 | addnl(struct namelist *n1, struct namelist *n2) | |||
565 | { | |||
566 | struct namelist *nl, *prev; | |||
567 | ||||
568 | n1 = expand(n1, E_VARS0x1); | |||
569 | n2 = expand(n2, E_VARS0x1); | |||
570 | for (prev = NULL((void *)0), nl = NULL((void *)0); n1; n1 = n1->n_next, prev = nl) { | |||
571 | nl = makenl(n1->n_name); | |||
572 | nl->n_next = prev; | |||
573 | } | |||
574 | for (; n2; n2 = n2->n_next) | |||
575 | if (!innl(nl, n2->n_name)) { | |||
576 | nl = makenl(n2->n_name); | |||
577 | nl->n_next = prev; | |||
578 | prev = nl; | |||
579 | } | |||
580 | return(prev); | |||
581 | } | |||
582 | ||||
583 | /* | |||
584 | * Copy n1 except for elements that are in n2. | |||
585 | */ | |||
586 | static struct namelist * | |||
587 | subnl(struct namelist *n1, struct namelist *n2) | |||
588 | { | |||
589 | struct namelist *nl, *prev; | |||
590 | ||||
591 | n1 = expand(n1, E_VARS0x1); | |||
592 | n2 = expand(n2, E_VARS0x1); | |||
593 | for (prev = NULL((void *)0); n1; n1 = n1->n_next) | |||
594 | if (!innl(n2, n1->n_name)) { | |||
595 | nl = makenl(n1->n_name); | |||
596 | nl->n_next = prev; | |||
597 | prev = nl; | |||
598 | } | |||
599 | return(prev); | |||
600 | } | |||
601 | ||||
602 | /* | |||
603 | * Copy all items of n1 that are also in n2. | |||
604 | */ | |||
605 | static struct namelist * | |||
606 | andnl(struct namelist *n1, struct namelist *n2) | |||
607 | { | |||
608 | struct namelist *nl, *prev; | |||
609 | ||||
610 | n1 = expand(n1, E_VARS0x1); | |||
611 | n2 = expand(n2, E_VARS0x1); | |||
612 | for (prev = NULL((void *)0); n1; n1 = n1->n_next) | |||
613 | if (innl(n2, n1->n_name)) { | |||
614 | nl = makenl(n1->n_name); | |||
615 | nl->n_next = prev; | |||
616 | prev = nl; | |||
617 | } | |||
618 | return(prev); | |||
619 | } | |||
620 | ||||
621 | /* | |||
622 | * Make a sub command for lists of variables, commands, etc. | |||
623 | */ | |||
624 | struct subcmd * | |||
625 | makesubcmd(int type) | |||
626 | { | |||
627 | struct subcmd *sc; | |||
628 | ||||
629 | sc = ALLOC(subcmd)xmalloc(sizeof(struct subcmd)); | |||
630 | sc->sc_type = type; | |||
631 | sc->sc_args = NULL((void *)0); | |||
632 | sc->sc_next = NULL((void *)0); | |||
633 | sc->sc_name = NULL((void *)0); | |||
634 | ||||
635 | return(sc); | |||
636 | } | |||
637 | #line 630 "gram.c" | |||
638 | /* allocate initial stack or double stack size, up to YYMAXDEPTH */ | |||
639 | static int yygrowstack(void) | |||
640 | { | |||
641 | unsigned int newsize; | |||
642 | long sslen; | |||
643 | short *newss; | |||
644 | YYSTYPE *newvs; | |||
645 | ||||
646 | if ((newsize = yystacksize) == 0) | |||
647 | newsize = YYINITSTACKSIZE200; | |||
648 | else if (newsize >= YYMAXDEPTH10000) | |||
649 | return -1; | |||
650 | else if ((newsize *= 2) > YYMAXDEPTH10000) | |||
651 | newsize = YYMAXDEPTH10000; | |||
652 | sslen = yyssp - yyss; | |||
653 | #ifdef SIZE_MAX | |||
654 | #define YY_SIZE_MAX0xffffffffU SIZE_MAX | |||
655 | #else | |||
656 | #define YY_SIZE_MAX0xffffffffU 0xffffffffU | |||
657 | #endif | |||
658 | if (newsize && YY_SIZE_MAX0xffffffffU / newsize < sizeof *newss) | |||
659 | goto bail; | |||
660 | newss = (short *)realloc(yyss, newsize * sizeof *newss); | |||
661 | if (newss == NULL((void *)0)) | |||
662 | goto bail; | |||
663 | yyss = newss; | |||
664 | yyssp = newss + sslen; | |||
665 | if (newsize
| |||
666 | goto bail; | |||
667 | newvs = (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs); | |||
668 | if (newvs == NULL((void *)0)) | |||
669 | goto bail; | |||
670 | yyvs = newvs; | |||
671 | yyvsp = newvs + sslen; | |||
672 | yystacksize = newsize; | |||
673 | yysslim = yyss + newsize - 1; | |||
674 | return 0; | |||
675 | bail: | |||
676 | if (yyss) | |||
677 | free(yyss); | |||
678 | if (yyvs) | |||
679 | free(yyvs); | |||
680 | yyss = yyssp = NULL((void *)0); | |||
681 | yyvs = yyvsp = NULL((void *)0); | |||
682 | yystacksize = 0; | |||
683 | return -1; | |||
684 | } | |||
685 | ||||
686 | #define YYABORTgoto yyabort goto yyabort | |||
687 | #define YYREJECTgoto yyabort goto yyabort | |||
688 | #define YYACCEPTgoto yyaccept goto yyaccept | |||
689 | #define YYERRORgoto yyerrlab goto yyerrlab | |||
690 | int | |||
691 | yyparse(void) | |||
692 | { | |||
693 | int yym, yyn, yystate; | |||
694 | #if YYDEBUG0 | |||
695 | const char *yys; | |||
696 | ||||
697 | if ((yys = getenv("YYDEBUG"))) | |||
698 | { | |||
699 | yyn = *yys; | |||
700 | if (yyn >= '0' && yyn <= '9') | |||
701 | yydebug = yyn - '0'; | |||
702 | } | |||
703 | #endif /* YYDEBUG */ | |||
704 | ||||
705 | yynerrs = 0; | |||
706 | yyerrflag = 0; | |||
707 | yychar = (-1); | |||
708 | ||||
709 | if (yyss == NULL((void *)0) && yygrowstack()) goto yyoverflow; | |||
| ||||
710 | yyssp = yyss; | |||
711 | yyvsp = yyvs; | |||
712 | *yyssp = yystate = 0; | |||
| ||||
713 | ||||
714 | yyloop: | |||
715 | if ((yyn = yydefred[yystate]) != 0) goto yyreduce; | |||
716 | if (yychar < 0) | |||
717 | { | |||
718 | if ((yychar = yylex()) < 0) yychar = 0; | |||
719 | #if YYDEBUG0 | |||
720 | if (yydebug) | |||
721 | { | |||
722 | yys = 0; | |||
723 | if (yychar <= YYMAXTOKEN61) yys = yyname[yychar]; | |||
724 | if (!yys) yys = "illegal-symbol"; | |||
725 | printf("%sdebug: state %d, reading %d (%s)\n", | |||
726 | YYPREFIX"yy", yystate, yychar, yys); | |||
727 | } | |||
728 | #endif | |||
729 | } | |||
730 | if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 && | |||
731 | yyn <= YYTABLESIZE272 && yycheck[yyn] == yychar) | |||
732 | { | |||
733 | #if YYDEBUG0 | |||
734 | if (yydebug) | |||
735 | printf("%sdebug: state %d, shifting to state %d\n", | |||
736 | YYPREFIX"yy", yystate, yytable[yyn]); | |||
737 | #endif | |||
738 | if (yyssp >= yysslim && yygrowstack()) | |||
739 | { | |||
740 | goto yyoverflow; | |||
741 | } | |||
742 | *++yyssp = yystate = yytable[yyn]; | |||
743 | *++yyvsp = yylval; | |||
744 | yychar = (-1); | |||
745 | if (yyerrflag > 0) --yyerrflag; | |||
746 | goto yyloop; | |||
747 | } | |||
748 | if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && | |||
749 | yyn <= YYTABLESIZE272 && yycheck[yyn] == yychar) | |||
750 | { | |||
751 | yyn = yytable[yyn]; | |||
752 | goto yyreduce; | |||
753 | } | |||
754 | if (yyerrflag) goto yyinrecovery; | |||
755 | #if defined(__GNUC__4) | |||
756 | goto yynewerror; | |||
757 | #endif | |||
758 | yynewerror: | |||
759 | yyerror("syntax error"); | |||
760 | #if defined(__GNUC__4) | |||
761 | goto yyerrlab; | |||
762 | #endif | |||
763 | yyerrlab: | |||
764 | ++yynerrs; | |||
765 | yyinrecovery: | |||
766 | if (yyerrflag < 3) | |||
767 | { | |||
768 | yyerrflag = 3; | |||
769 | for (;;) | |||
770 | { | |||
771 | if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE256) >= 0 && | |||
772 | yyn <= YYTABLESIZE272 && yycheck[yyn] == YYERRCODE256) | |||
773 | { | |||
774 | #if YYDEBUG0 | |||
775 | if (yydebug) | |||
776 | printf("%sdebug: state %d, error recovery shifting\ | |||
777 | to state %d\n", YYPREFIX"yy", *yyssp, yytable[yyn]); | |||
778 | #endif | |||
779 | if (yyssp >= yysslim && yygrowstack()) | |||
780 | { | |||
781 | goto yyoverflow; | |||
782 | } | |||
783 | *++yyssp = yystate = yytable[yyn]; | |||
784 | *++yyvsp = yylval; | |||
785 | goto yyloop; | |||
786 | } | |||
787 | else | |||
788 | { | |||
789 | #if YYDEBUG0 | |||
790 | if (yydebug) | |||
791 | printf("%sdebug: error recovery discarding state %d\n", | |||
792 | YYPREFIX"yy", *yyssp); | |||
793 | #endif | |||
794 | if (yyssp <= yyss) goto yyabort; | |||
795 | --yyssp; | |||
796 | --yyvsp; | |||
797 | } | |||
798 | } | |||
799 | } | |||
800 | else | |||
801 | { | |||
802 | if (yychar == 0) goto yyabort; | |||
803 | #if YYDEBUG0 | |||
804 | if (yydebug) | |||
805 | { | |||
806 | yys = 0; | |||
807 | if (yychar <= YYMAXTOKEN61) yys = yyname[yychar]; | |||
808 | if (!yys) yys = "illegal-symbol"; | |||
809 | printf("%sdebug: state %d, error recovery discards token %d (%s)\n", | |||
810 | YYPREFIX"yy", yystate, yychar, yys); | |||
811 | } | |||
812 | #endif | |||
813 | yychar = (-1); | |||
814 | goto yyloop; | |||
815 | } | |||
816 | yyreduce: | |||
817 | #if YYDEBUG0 | |||
818 | if (yydebug) | |||
819 | printf("%sdebug: state %d, reducing by rule %d (%s)\n", | |||
820 | YYPREFIX"yy", yystate, yyn, yyrule[yyn]); | |||
821 | #endif | |||
822 | yym = yylen[yyn]; | |||
823 | if (yym) | |||
824 | yyval = yyvsp[1-yym]; | |||
825 | else | |||
826 | memset(&yyval, 0, sizeof yyval); | |||
827 | switch (yyn) | |||
828 | { | |||
829 | case 3: | |||
830 | #line 80 "/usr/src/usr.bin/rdist/gram.y" | |||
831 | { | |||
832 | (void) lookup(yyvsp[-2].string, INSERT1, yyvsp[0].namel); | |||
833 | } | |||
834 | break; | |||
835 | case 4: | |||
836 | #line 83 "/usr/src/usr.bin/rdist/gram.y" | |||
837 | { | |||
838 | insert((char *)NULL((void *)0), yyvsp[-3].namel, yyvsp[-1].namel, yyvsp[0].subcmd); | |||
839 | } | |||
840 | break; | |||
841 | case 5: | |||
842 | #line 86 "/usr/src/usr.bin/rdist/gram.y" | |||
843 | { | |||
844 | insert(yyvsp[-5].string, yyvsp[-3].namel, yyvsp[-1].namel, yyvsp[0].subcmd); | |||
845 | } | |||
846 | break; | |||
847 | case 6: | |||
848 | #line 89 "/usr/src/usr.bin/rdist/gram.y" | |||
849 | { | |||
850 | append((char *)NULL((void *)0), yyvsp[-3].namel, yyvsp[-1].string, yyvsp[0].subcmd); | |||
851 | } | |||
852 | break; | |||
853 | case 7: | |||
854 | #line 92 "/usr/src/usr.bin/rdist/gram.y" | |||
855 | { | |||
856 | append(yyvsp[-5].string, yyvsp[-3].namel, yyvsp[-1].string, yyvsp[0].subcmd); | |||
857 | } | |||
858 | break; | |||
859 | case 9: | |||
860 | #line 98 "/usr/src/usr.bin/rdist/gram.y" | |||
861 | { | |||
862 | yyval.namel = yyvsp[0].namel; | |||
863 | } | |||
864 | break; | |||
865 | case 10: | |||
866 | #line 101 "/usr/src/usr.bin/rdist/gram.y" | |||
867 | { | |||
868 | yyval.namel = subnl(yyvsp[-2].namel, yyvsp[0].namel); | |||
869 | } | |||
870 | break; | |||
871 | case 11: | |||
872 | #line 104 "/usr/src/usr.bin/rdist/gram.y" | |||
873 | { | |||
874 | yyval.namel = addnl(yyvsp[-2].namel, yyvsp[0].namel); | |||
875 | } | |||
876 | break; | |||
877 | case 12: | |||
878 | #line 107 "/usr/src/usr.bin/rdist/gram.y" | |||
879 | { | |||
880 | yyval.namel = andnl(yyvsp[-2].namel, yyvsp[0].namel); | |||
881 | } | |||
882 | break; | |||
883 | case 13: | |||
884 | #line 112 "/usr/src/usr.bin/rdist/gram.y" | |||
885 | { | |||
886 | yyval.namel = makenl(yyvsp[0].string); | |||
887 | } | |||
888 | break; | |||
889 | case 14: | |||
890 | #line 115 "/usr/src/usr.bin/rdist/gram.y" | |||
891 | { | |||
892 | yyval.namel = yyvsp[-1].namel; | |||
893 | } | |||
894 | break; | |||
895 | case 15: | |||
896 | #line 120 "/usr/src/usr.bin/rdist/gram.y" | |||
897 | { | |||
898 | yyval.namel = last_n = NULL((void *)0); | |||
899 | } | |||
900 | break; | |||
901 | case 16: | |||
902 | #line 123 "/usr/src/usr.bin/rdist/gram.y" | |||
903 | { | |||
904 | if (last_n == NULL((void *)0)) | |||
905 | yyval.namel = last_n = makenl(yyvsp[0].string); | |||
906 | else { | |||
907 | last_n->n_next = makenl(yyvsp[0].string); | |||
908 | last_n = last_n->n_next; | |||
909 | yyval.namel = yyvsp[-1].namel; | |||
910 | } | |||
911 | } | |||
912 | break; | |||
913 | case 17: | |||
914 | #line 134 "/usr/src/usr.bin/rdist/gram.y" | |||
915 | { | |||
916 | yyval.subcmd = last_sc = NULL((void *)0); | |||
917 | } | |||
918 | break; | |||
919 | case 18: | |||
920 | #line 137 "/usr/src/usr.bin/rdist/gram.y" | |||
921 | { | |||
922 | if (last_sc == NULL((void *)0)) | |||
923 | yyval.subcmd = last_sc = yyvsp[0].subcmd; | |||
924 | else { | |||
925 | last_sc->sc_next = yyvsp[0].subcmd; | |||
926 | last_sc = yyvsp[0].subcmd; | |||
927 | yyval.subcmd = yyvsp[-1].subcmd; | |||
928 | } | |||
929 | } | |||
930 | break; | |||
931 | case 19: | |||
932 | #line 148 "/usr/src/usr.bin/rdist/gram.y" | |||
933 | { | |||
934 | struct namelist *nl; | |||
935 | ||||
936 | yyvsp[-3].subcmd->sc_options = yyvsp[-2].optval | options; | |||
937 | if (yyvsp[-1].namel != NULL((void *)0)) { | |||
938 | nl = expand(yyvsp[-1].namel, E_VARS0x1); | |||
939 | if (nl) { | |||
940 | if (nl->n_next != NULL((void *)0)) | |||
941 | yyerror("only one name allowed\n"); | |||
942 | yyvsp[-3].subcmd->sc_name = nl->n_name; | |||
943 | free(nl); | |||
944 | } else | |||
945 | yyvsp[-3].subcmd->sc_name = NULL((void *)0); | |||
946 | } | |||
947 | yyval.subcmd = yyvsp[-3].subcmd; | |||
948 | } | |||
949 | break; | |||
950 | case 20: | |||
951 | #line 164 "/usr/src/usr.bin/rdist/gram.y" | |||
952 | { | |||
953 | if (yyvsp[-1].namel != NULL((void *)0)) | |||
954 | yyvsp[-2].subcmd->sc_args = expand(yyvsp[-1].namel, E_VARS0x1); | |||
955 | yyval.subcmd = yyvsp[-2].subcmd; | |||
956 | } | |||
957 | break; | |||
958 | case 21: | |||
959 | #line 169 "/usr/src/usr.bin/rdist/gram.y" | |||
960 | { | |||
961 | if (yyvsp[-1].namel != NULL((void *)0)) | |||
962 | yyvsp[-2].subcmd->sc_args = expand(yyvsp[-1].namel, E_ALL0x7); | |||
963 | yyval.subcmd = yyvsp[-2].subcmd; | |||
964 | } | |||
965 | break; | |||
966 | case 22: | |||
967 | #line 174 "/usr/src/usr.bin/rdist/gram.y" | |||
968 | { | |||
969 | struct namelist *nl; | |||
970 | char ebuf[BUFSIZ1024]; | |||
971 | regex_t reg; | |||
972 | int ecode; | |||
973 | ||||
974 | for (nl = yyvsp[-1].namel; nl != NULL((void *)0); nl = nl->n_next) { | |||
975 | /* check for a valid regex */ | |||
976 | ecode = regcomp(®, nl->n_name, REG_NOSUB0004); | |||
977 | if (ecode) { | |||
978 | regerror(ecode, ®, ebuf, | |||
979 | sizeof(ebuf)); | |||
980 | yyerror(ebuf); | |||
981 | } | |||
982 | regfree(®); | |||
983 | } | |||
984 | yyvsp[-2].subcmd->sc_args = expand(yyvsp[-1].namel, E_VARS0x1); | |||
985 | yyval.subcmd = yyvsp[-2].subcmd; | |||
986 | } | |||
987 | break; | |||
988 | case 23: | |||
989 | #line 193 "/usr/src/usr.bin/rdist/gram.y" | |||
990 | { | |||
991 | if (yyvsp[-2].namel != NULL((void *)0)) | |||
992 | yyvsp[-3].subcmd->sc_args = expand(yyvsp[-2].namel, E_ALL0x7); | |||
993 | yyvsp[-3].subcmd->sc_name = yyvsp[-1].string; | |||
994 | yyval.subcmd = yyvsp[-3].subcmd; | |||
995 | } | |||
996 | break; | |||
997 | case 24: | |||
998 | #line 199 "/usr/src/usr.bin/rdist/gram.y" | |||
999 | { | |||
1000 | if (yyvsp[-2].namel != NULL((void *)0)) | |||
1001 | yyvsp[-3].subcmd->sc_args = expand(yyvsp[-2].namel, E_ALL0x7); | |||
1002 | yyvsp[-3].subcmd->sc_name = yyvsp[-1].string; | |||
1003 | yyval.subcmd = yyvsp[-3].subcmd; | |||
1004 | } | |||
1005 | break; | |||
1006 | case 25: | |||
1007 | #line 207 "/usr/src/usr.bin/rdist/gram.y" | |||
1008 | { | |||
1009 | yyval.optval = 0; | |||
1010 | } | |||
1011 | break; | |||
1012 | case 26: | |||
1013 | #line 210 "/usr/src/usr.bin/rdist/gram.y" | |||
1014 | { | |||
1015 | yyval.optval |= yyvsp[0].optval; | |||
1016 | } | |||
1017 | break; | |||
1018 | case 27: | |||
1019 | #line 215 "/usr/src/usr.bin/rdist/gram.y" | |||
1020 | { | |||
1021 | yyval.namel = NULL((void *)0); | |||
1022 | } | |||
1023 | break; | |||
1024 | case 28: | |||
1025 | #line 218 "/usr/src/usr.bin/rdist/gram.y" | |||
1026 | { | |||
1027 | yyval.namel = yyvsp[0].namel; | |||
1028 | } | |||
1029 | break; | |||
1030 | #line 1023 "gram.c" | |||
1031 | } | |||
1032 | yyssp -= yym; | |||
1033 | yystate = *yyssp; | |||
1034 | yyvsp -= yym; | |||
1035 | yym = yylhs[yyn]; | |||
1036 | if (yystate == 0 && yym == 0) | |||
1037 | { | |||
1038 | #if YYDEBUG0 | |||
1039 | if (yydebug) | |||
1040 | printf("%sdebug: after reduction, shifting from state 0 to\ | |||
1041 | state %d\n", YYPREFIX"yy", YYFINAL1); | |||
1042 | #endif | |||
1043 | yystate = YYFINAL1; | |||
1044 | *++yyssp = YYFINAL1; | |||
1045 | *++yyvsp = yyval; | |||
1046 | if (yychar < 0) | |||
1047 | { | |||
1048 | if ((yychar = yylex()) < 0) yychar = 0; | |||
1049 | #if YYDEBUG0 | |||
1050 | if (yydebug) | |||
1051 | { | |||
1052 | yys = 0; | |||
1053 | if (yychar <= YYMAXTOKEN61) yys = yyname[yychar]; | |||
1054 | if (!yys) yys = "illegal-symbol"; | |||
1055 | printf("%sdebug: state %d, reading %d (%s)\n", | |||
1056 | YYPREFIX"yy", YYFINAL1, yychar, yys); | |||
1057 | } | |||
1058 | #endif | |||
1059 | } | |||
1060 | if (yychar == 0) goto yyaccept; | |||
1061 | goto yyloop; | |||
1062 | } | |||
1063 | if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && | |||
1064 | yyn <= YYTABLESIZE272 && yycheck[yyn] == yystate) | |||
1065 | yystate = yytable[yyn]; | |||
1066 | else | |||
1067 | yystate = yydgoto[yym]; | |||
1068 | #if YYDEBUG0 | |||
1069 | if (yydebug) | |||
1070 | printf("%sdebug: after reduction, shifting from state %d \ | |||
1071 | to state %d\n", YYPREFIX"yy", *yyssp, yystate); | |||
1072 | #endif | |||
1073 | if (yyssp >= yysslim && yygrowstack()) | |||
1074 | { | |||
1075 | goto yyoverflow; | |||
1076 | } | |||
1077 | *++yyssp = yystate; | |||
1078 | *++yyvsp = yyval; | |||
1079 | goto yyloop; | |||
1080 | yyoverflow: | |||
1081 | yyerror("yacc stack overflow"); | |||
1082 | yyabort: | |||
1083 | if (yyss) | |||
1084 | free(yyss); | |||
1085 | if (yyvs) | |||
1086 | free(yyvs); | |||
1087 | yyss = yyssp = NULL((void *)0); | |||
1088 | yyvs = yyvsp = NULL((void *)0); | |||
1089 | yystacksize = 0; | |||
1090 | return (1); | |||
1091 | yyaccept: | |||
1092 | if (yyss) | |||
1093 | free(yyss); | |||
1094 | if (yyvs) | |||
1095 | free(yyvs); | |||
1096 | yyss = yyssp = NULL((void *)0); | |||
1097 | yyvs = yyvsp = NULL((void *)0); | |||
1098 | yystacksize = 0; | |||
1099 | return (0); | |||
1100 | } |