Skip to content

Commit

Permalink
String constants could be used for string option values.
Browse files Browse the repository at this point in the history
Thanks to Frederik Kriewitz for the patch.
  • Loading branch information
Ondrej Zajicek committed May 29, 2014
1 parent 05476c4 commit 9eceab3
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
9 changes: 9 additions & 0 deletions conf/confbase.Y
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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; }
Expand Down
4 changes: 2 additions & 2 deletions nest/config.Y
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion proto/bfd/config.Y
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion proto/bgp/config.Y
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions sysdep/unix/config.Y
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 9eceab3

Please sign in to comment.