51 |
/* Prototypes */ |
/* Prototypes */ |
52 |
void yyerror(const char*); |
void yyerror(const char*); |
53 |
static char *handle_quoted_string(char *); |
static char *handle_quoted_string(char *); |
54 |
|
void steplinenobycr(char *); |
55 |
|
|
56 |
%} |
%} |
57 |
|
|
58 |
ws [ \t]+ |
ws [ \t]+ |
225 |
return CHECKDEV; |
return CHECKDEV; |
226 |
} |
} |
227 |
|
|
228 |
check[ \t]+file { |
check[ \t]+file { |
229 |
BEGIN(SERVICE_COND); |
BEGIN(SERVICE_COND); |
230 |
return CHECKFILE; |
return CHECKFILE; |
231 |
} |
} |
249 |
prog, yytext); |
prog, yytext); |
250 |
exit(1); |
exit(1); |
251 |
} |
} |
252 |
return PERCENT; |
return PERCENT; |
253 |
} |
} |
254 |
|
|
255 |
[a-zA-Z0-9]{str} { |
[a-zA-Z0-9]{str} { |
257 |
return STRING; |
return STRING; |
258 |
} |
} |
259 |
|
|
260 |
\"[/][^"\n]*["\n] { |
\"[/][^\"\n]*\" { |
261 |
yylval.string= handle_quoted_string(yytext); |
yylval.string= handle_quoted_string(yytext); |
262 |
return PATH; |
return PATH; |
263 |
} |
} |
264 |
|
|
265 |
\'[/][^'\n]*['\n] { |
\'[/][^\'\n]*\' { |
266 |
yylval.string= handle_quoted_string(yytext); |
yylval.string= handle_quoted_string(yytext); |
267 |
return PATH; |
return PATH; |
268 |
} |
} |
269 |
|
|
270 |
["'][^'"\n]*["'\n] { |
\"[^\"]*\" { |
271 |
|
steplinenobycr(yytext); |
272 |
|
yylval.string= handle_quoted_string(yytext); |
273 |
|
return STRING; |
274 |
|
} |
275 |
|
|
276 |
|
\'[^\']*\' { |
277 |
|
steplinenobycr(yytext); |
278 |
yylval.string= handle_quoted_string(yytext); |
yylval.string= handle_quoted_string(yytext); |
279 |
return STRING; |
return STRING; |
280 |
} |
} |
294 |
return PATH; |
return PATH; |
295 |
} |
} |
296 |
|
|
297 |
"from:"[ \t\n]*{str}[@]{str} { |
"from:"[ \t]*{str}[@]{str} { |
298 |
char *p= yytext+strlen("from:"); |
char *p= yytext+strlen("from:"); |
299 |
yylval.string = trim(xstrdup(p)); |
yylval.string = trim(xstrdup(p)); |
300 |
return MAILFROM; |
return MAILFROM; |
308 |
|
|
309 |
"message:"[^}]* { |
"message:"[^}]* { |
310 |
char *p= yytext+strlen("message:"); |
char *p= yytext+strlen("message:"); |
311 |
|
|
312 |
|
steplinenobycr(yytext); |
313 |
|
|
314 |
yylval.string = trim(xstrdup(p)); |
yylval.string = trim(xstrdup(p)); |
315 |
return MAILBODY; |
return MAILBODY; |
316 |
} |
} |
320 |
return STRING; |
return STRING; |
321 |
} |
} |
322 |
|
|
323 |
|
[\"\'] { |
324 |
|
|
325 |
|
yyerror("Unbalanced quotes"); |
326 |
|
|
327 |
|
} |
328 |
|
|
329 |
|
|
330 |
<SERVICE_COND>{ |
<SERVICE_COND>{ |
331 |
|
|
332 |
{ws} ; |
{ws} ; |
335 |
lineno++; |
lineno++; |
336 |
} |
} |
337 |
|
|
338 |
[^ \n\t]+ { |
{str} { |
339 |
yylval.string= xstrdup(yytext); |
yylval.string= xstrdup(yytext); |
340 |
BEGIN(INITIAL); |
BEGIN(INITIAL); |
341 |
return SERVICENAME; |
return SERVICENAME; |
342 |
} |
} |
343 |
|
|
344 |
|
\"{str}\" { |
345 |
|
yylval.string= handle_quoted_string(yytext); |
346 |
|
BEGIN(INITIAL); |
347 |
|
return SERVICENAME; |
348 |
|
} |
349 |
|
|
350 |
|
\'{str}\' { |
351 |
|
yylval.string= handle_quoted_string(yytext); |
352 |
|
BEGIN(INITIAL); |
353 |
|
return SERVICENAME; |
354 |
|
} |
355 |
|
|
356 |
|
[\"\'] { |
357 |
|
yyerror("Unbalanced quotes"); |
358 |
|
} |
359 |
|
|
360 |
} |
} |
361 |
|
|
362 |
<DEPEND_COND>{ |
<DEPEND_COND>{ |
363 |
|
|
364 |
{wws} ; |
{wws} ; |
365 |
|
|
366 |
{wws}?[\n]{wws}? { |
{wws}?[\n]{wws}? { |
367 |
lineno++; |
lineno++; |
368 |
} |
} |
369 |
|
|
370 |
[^ \n\t,]+ { |
{str} { |
371 |
yylval.string= xstrdup(yytext); |
yylval.string= xstrdup(yytext); |
372 |
return SERVICENAME; |
return SERVICENAME; |
373 |
} |
} |
374 |
|
|
375 |
[ \n\t]+[^,] { |
[ \n\t]+[^,] { |
376 |
lineno++; |
steplinenobycr(yytext); |
377 |
|
|
378 |
unput(yytext[strlen(yytext)-1]); |
unput(yytext[strlen(yytext)-1]); |
379 |
BEGIN(INITIAL); |
BEGIN(INITIAL); |
380 |
} |
} |
393 |
BEGIN(INITIAL); |
BEGIN(INITIAL); |
394 |
} |
} |
395 |
|
|
396 |
\'[^']*\' { |
\'[^\']*\' { |
397 |
|
steplinenobycr(yytext); |
398 |
yylval.string= handle_quoted_string(yytext); |
yylval.string= handle_quoted_string(yytext); |
399 |
return STRING; |
return STRING; |
400 |
} |
} |
403 |
yyerror("Unbalanced quotes"); |
yyerror("Unbalanced quotes"); |
404 |
} |
} |
405 |
|
|
406 |
\{[^}]*\} { |
\{[^\}]*\} { /* |
407 |
|
* This helps constructions like: |
408 |
|
* /bin/bash -c { cmd1; cmd2;..cmdn; } |
409 |
|
*/ |
410 |
|
steplinenobycr(yytext); |
411 |
yylval.string= xstrdup(yytext); |
yylval.string= xstrdup(yytext); |
412 |
return STRING; |
return STRING; |
413 |
} |
} |
414 |
|
|
415 |
[^ \t\n"]+ { |
[^ \t\n\{\}]+ { |
416 |
yylval.string= xstrdup(yytext); |
yylval.string= xstrdup(yytext); |
417 |
return STRING; |
return STRING; |
418 |
} |
} |
426 |
|
|
427 |
%% |
%% |
428 |
|
|
429 |
|
/* |
430 |
|
* Do lineno++ for every occurrence of '\n' in a string. This is |
431 |
|
* necessary whenever a yytext has an unknown number of CRs. |
432 |
|
*/ |
433 |
|
|
434 |
|
void steplinenobycr(char *string) { |
435 |
|
|
436 |
|
char *pos=string; |
437 |
|
|
438 |
|
while ( 0 != *pos ) { |
439 |
|
|
440 |
|
if ( '\n' == *pos ) { |
441 |
|
|
442 |
|
lineno++; |
443 |
|
|
444 |
|
} |
445 |
|
|
446 |
|
pos++; |
447 |
|
|
448 |
|
} |
449 |
|
|
450 |
|
} |
451 |
|
|
452 |
static char *handle_quoted_string(char *string) { |
static char *handle_quoted_string(char *string) { |
453 |
|
|
454 |
char *buf= xstrdup(string); |
char *buf= xstrdup(string); |