55 |
static int reg_modifier_add(int *, char *); |
static int reg_modifier_add(int *, char *); |
56 |
static int check_kw(char *ident); |
static int check_kw(char *ident); |
57 |
static int is_prog_allowed(); |
static int is_prog_allowed(); |
58 |
|
static void parse_error(const char *fmt, ...); |
59 |
|
|
60 |
static RC_SECTION *rc_section; |
static RC_SECTION *rc_section; |
61 |
static int debug_level; |
static int debug_level; |
62 |
static int error_count; |
static int error_count; |
185 |
asgn_stmt: keyword meq { verbatim(); } arglist |
asgn_stmt: keyword meq { verbatim(); } arglist |
186 |
{ |
{ |
187 |
if (!check_kw($1)) { |
if (!check_kw($1)) { |
188 |
yyerror(_("unknown keyword")); |
parse_error(_("unknown keyword: %s"), $1); |
189 |
YYERROR; |
YYERROR; |
190 |
} |
} |
191 |
|
|
295 |
{ |
{ |
296 |
$$ = $1; |
$$ = $1; |
297 |
if ($$.key) |
if ($$.key) |
298 |
yyerror("regexp is not allowed in this context"); |
parse_error("regexp is not allowed in this context"); |
299 |
} |
} |
300 |
; |
; |
301 |
|
|
469 |
$$->v.inst.part = $2.part; |
$$->v.inst.part = $2.part; |
470 |
$$->v.inst.key = $2.key; |
$$->v.inst.key = $2.key; |
471 |
if ($3 == NULL) { |
if ($3 == NULL) { |
472 |
yyerror(_("missing replacement value")); |
parse_error(_("missing replacement value")); |
473 |
} |
} |
474 |
$$->v.inst.key2 = $3; |
$$->v.inst.key2 = $3; |
475 |
$$->v.inst.arg = NULL; |
$$->v.inst.arg = NULL; |
487 |
|
|
488 |
%% |
%% |
489 |
|
|
490 |
|
static int |
491 |
|
err_line_num() |
492 |
|
{ |
493 |
|
return yychar == EOL ? cfg_line_num - 1 : cfg_line_num; |
494 |
|
} |
495 |
|
|
496 |
|
void |
497 |
|
parse_error(const char *fmt, ...) |
498 |
|
{ |
499 |
|
char buf[LINEBUFFER]; |
500 |
|
va_list ap; |
501 |
|
|
502 |
|
va_start(ap, fmt); |
503 |
|
vsnprintf(buf, sizeof buf, fmt, ap); |
504 |
|
va_end(ap); |
505 |
|
anubis_error(SOFT, "%s:%d: %s", cfg_file, err_line_num(), buf); |
506 |
|
} |
507 |
|
|
508 |
int |
int |
509 |
yyerror(char *s) |
yyerror(char *s) |
510 |
{ |
{ |
920 |
else if (strcasecmp(opt, "icase") == 0) |
else if (strcasecmp(opt, "icase") == 0) |
921 |
re_clear_flag(*flag, R_SCASE); |
re_clear_flag(*flag, R_SCASE); |
922 |
else { |
else { |
923 |
yyerror(_("Unknown regexp modifier")); |
parse_error(_("Unknown regexp modifier")); |
924 |
return 1; |
return 1; |
925 |
} |
} |
926 |
return 0; |
return 0; |
1272 |
p = anubis_find_section("RULE"); |
p = anubis_find_section("RULE"); |
1273 |
|
|
1274 |
if (!p->allow_prog) |
if (!p->allow_prog) |
1275 |
yyerror(_("program is not allowed in this section")); |
parse_error(_("program is not allowed in this section")); |
1276 |
return p->allow_prog; |
return p->allow_prog; |
1277 |
} |
} |