String constants could be used for string option values.

Thanks to Frederik Kriewitz for the patch.
This commit is contained in:
Ondrej Zajicek 2014-05-29 23:05:03 +02:00
parent 05476c4d04
commit 9eceab33f9
5 changed files with 16 additions and 7 deletions

View file

@ -77,6 +77,7 @@ CF_DECLS
%type <time> datetime
%type <a> ipa
%type <px> prefix prefix_or_ipa
%type <t> text
%type <t> text_or_none
%nonassoc PREFIX_DUMMY
@ -191,6 +192,14 @@ datetime:
}
;
text:
TEXT
| SYM {
if ($1->class != (SYM_CONSTANT | T_STRING)) cf_error("String expected");
$$ = SYM_VAL($1).s;
}
;
text_or_none:
TEXT { $$ = $1; }
| { $$ = NULL; }

View file

@ -208,7 +208,7 @@ proto_item:
| IMPORT KEEP FILTERED bool { this_proto->in_keep_filtered = $4; }
| TABLE rtable { this_proto->table = $2; }
| ROUTER ID idval { this_proto->router_id = $3; }
| DESCRIPTION TEXT { this_proto->dsc = $2; }
| DESCRIPTION text { this_proto->dsc = $2; }
;
imexport:
@ -388,7 +388,7 @@ password_item:
;
password_item_begin:
PASSWORD TEXT {
PASSWORD text {
if (!this_p_list) {
this_p_list = cfg_alloc(sizeof(list));
init_list(this_p_list);

View file

@ -99,7 +99,7 @@ bfd_multihop: bfd_iface_start bfd_iface_opt_list
bfd_neigh_iface:
/* empty */ { $$ = NULL; }
| '%' SYM { $$ = if_get_by_name($2->name); }
| DEV TEXT { $$ = if_get_by_name($2); }
| DEV text { $$ = if_get_by_name($2); }
;
bfd_neigh_local:

View file

@ -103,7 +103,7 @@ bgp_proto:
| bgp_proto ENABLE AS4 bool ';' { BGP_CFG->enable_as4 = $4; }
| bgp_proto CAPABILITIES bool ';' { BGP_CFG->capabilities = $3; }
| bgp_proto ADVERTISE IPV4 bool ';' { BGP_CFG->advertise_ipv4 = $4; }
| bgp_proto PASSWORD TEXT ';' { BGP_CFG->password = $3; }
| bgp_proto PASSWORD text ';' { BGP_CFG->password = $3; }
| bgp_proto ROUTE LIMIT expr ';' {
this_proto->in_limit = cfg_allocz(sizeof(struct proto_limit));
this_proto->in_limit->limit = $4;

View file

@ -35,12 +35,12 @@ log_config: LOG log_file log_mask ';' {
;
syslog_name:
NAME TEXT { $$ = $2; }
NAME text { $$ = $2; }
| { $$ = bird_name; }
;
log_file:
TEXT {
text {
FILE *f = tracked_fopen(new_config->pool, $1, "a");
if (!f) cf_error("Unable to open log file `%s': %m", $1);
$$ = f;
@ -76,7 +76,7 @@ CF_ADDTO(conf, mrtdump_base)
mrtdump_base:
MRTDUMP PROTOCOLS mrtdump_mask ';' { new_config->proto_default_mrtdump = $3; }
| MRTDUMP TEXT ';' {
| MRTDUMP text ';' {
FILE *f = tracked_fopen(new_config->pool, $2, "a");
if (!f) cf_error("Unable to open MRTDump file '%s': %m", $2);
new_config->mrtdump_file = fileno(f);