53 |
static void rc_stmt_list_destroy(RC_STMT *); |
static void rc_stmt_list_destroy(RC_STMT *); |
54 |
static void rc_stmt_print(RC_STMT *, int); |
static void rc_stmt_print(RC_STMT *, int); |
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, int *flags); |
57 |
static int is_prog_allowed(); |
static int is_prog_allowed(); |
58 |
|
|
59 |
static RC_SECTION *rc_section; |
static RC_SECTION *rc_section; |
212 |
|
|
213 |
asgn_stmt: keyword arglist |
asgn_stmt: keyword arglist |
214 |
{ |
{ |
215 |
if (!check_kw($1)) { |
int flags; |
216 |
|
if (!check_kw($1, &flags)) { |
217 |
parse_error(_("unknown keyword: %s"), $1); |
parse_error(_("unknown keyword: %s"), $1); |
218 |
YYERROR; |
YYERROR; |
219 |
} |
} |
226 |
list_remove($2, s, NULL); |
list_remove($2, s, NULL); |
227 |
} |
} |
228 |
$$->v.asgn.rhs = $2; |
$$->v.asgn.rhs = $2; |
229 |
|
$$->v.asgn.flags = flags; |
230 |
} |
} |
231 |
; |
; |
232 |
|
|
1010 |
return 0; |
return 0; |
1011 |
} |
} |
1012 |
|
|
1013 |
|
static int |
1014 |
|
_print_stars(void *item, void *data) |
1015 |
|
{ |
1016 |
|
int i, len = strlen ((char*)item); |
1017 |
|
putchar(' '); |
1018 |
|
for (i = 0; i < len; i++) |
1019 |
|
putchar('*'); |
1020 |
|
return 0; |
1021 |
|
} |
1022 |
|
|
1023 |
void |
void |
1024 |
rc_stmt_print(RC_STMT *stmt, int level) |
rc_stmt_print(RC_STMT *stmt, int level) |
1025 |
{ |
{ |
1028 |
case rc_stmt_asgn: |
case rc_stmt_asgn: |
1029 |
rc_level_print(level, "ASGN: "); |
rc_level_print(level, "ASGN: "); |
1030 |
printf("%s =", stmt->v.asgn.lhs); |
printf("%s =", stmt->v.asgn.lhs); |
1031 |
list_iterate(stmt->v.asgn.rhs, _print_str, NULL); |
list_iterate(stmt->v.asgn.rhs, |
1032 |
|
(stmt->v.asgn.flags & KWF_HIDDEN) ? |
1033 |
|
_print_stars : _print_str, NULL); |
1034 |
break; |
break; |
1035 |
|
|
1036 |
case rc_stmt_cond: |
case rc_stmt_cond: |
1127 |
} |
} |
1128 |
|
|
1129 |
struct rc_secdef_child * |
struct rc_secdef_child * |
1130 |
rc_child_lookup(struct rc_secdef_child *child, char *str, int method, int *key) |
rc_child_lookup(struct rc_secdef_child *child, char *str, int method, |
1131 |
|
int *key, int *flags) |
1132 |
{ |
{ |
1133 |
for (; child; child = child->next) { |
for (; child; child = child->next) { |
1134 |
if (child->method & method) { |
if (child->method & method) { |
1136 |
for (kw = child->kwdef; kw->name; kw++) |
for (kw = child->kwdef; kw->name; kw++) |
1137 |
if (strcmp(kw->name, str) == 0) { |
if (strcmp(kw->name, str) == 0) { |
1138 |
*key = kw->tok; |
*key = kw->tok; |
1139 |
|
if (flags) |
1140 |
|
*flags = kw->flags; |
1141 |
return child; |
return child; |
1142 |
} |
} |
1143 |
} |
} |
1237 |
{ |
{ |
1238 |
int key; |
int key; |
1239 |
struct rc_secdef_child *p = rc_child_lookup(env->child, asgn->lhs, |
struct rc_secdef_child *p = rc_child_lookup(env->child, asgn->lhs, |
1240 |
env->method, &key); |
env->method, &key, NULL); |
1241 |
if (!p) |
if (!p) |
1242 |
return; |
return; |
1243 |
|
|
1471 |
} |
} |
1472 |
|
|
1473 |
static int |
static int |
1474 |
check_kw(char *ident) |
check_kw(char *ident, int *flags) |
1475 |
{ |
{ |
1476 |
struct rc_secdef *p = rc_secdef; |
struct rc_secdef *p = rc_secdef; |
1477 |
int key; |
int key; |
1478 |
|
|
1479 |
if (!p) |
if (!p) |
1480 |
p = anubis_find_section("RULE"); |
p = anubis_find_section("RULE"); |
1481 |
return rc_child_lookup(p->child, ident, CF_ALL, &key) != NULL; |
return rc_child_lookup(p->child, ident, CF_ALL, &key, flags) != NULL; |
1482 |
} |
} |
1483 |
|
|
1484 |
static int |
static int |