diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2009-11-25 12:55:36 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2009-11-25 12:55:36 +0000 |
commit | 2b6a020c162860b6e30ae19180feb4f7aa6dcf20 (patch) | |
tree | 2d96015a666dc6e6eaa462fec40e47a8d8c690cc /usr.sbin/ospfd | |
parent | 8f8f7fbb6ccd25c5584adc1731a38de89f12d2c2 (diff) |
add support for include
ok claudio@
Diffstat (limited to 'usr.sbin/ospfd')
-rw-r--r-- | usr.sbin/ospfd/parse.y | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/usr.sbin/ospfd/parse.y b/usr.sbin/ospfd/parse.y index 9d97031d35c..004f4fef401 100644 --- a/usr.sbin/ospfd/parse.y +++ b/usr.sbin/ospfd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.67 2009/06/05 04:12:52 claudio Exp $ */ +/* $OpenBSD: parse.y,v 1.68 2009/11/25 12:55:35 dlg Exp $ */ /* * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org> @@ -124,6 +124,7 @@ typedef struct { %token SET TYPE %token YES NO %token DEMOTE +%token INCLUDE %token ERROR %token <v.string> STRING %token <v.number> NUMBER @@ -134,6 +135,7 @@ typedef struct { %% grammar : /* empty */ + | grammar include '\n' | grammar '\n' | grammar conf_main '\n' | grammar varset '\n' @@ -141,6 +143,21 @@ grammar : /* empty */ | grammar error '\n' { file->errors++; } ; +include : INCLUDE STRING { + struct file *nfile; + + if ((nfile = pushfile($2, 1)) == NULL) { + yyerror("failed to include file %s", $2); + free($2); + YYERROR; + } + free($2); + + file = nfile; + lungetc('\n'); + } + ; + string : string STRING { if (asprintf(&$$, "%s %s", $1, $2) == -1) { free($1); @@ -674,6 +691,7 @@ lookup(char *s) {"external-tag", EXTTAG}, {"fib-update", FIBUPDATE}, {"hello-interval", HELLOINTERVAL}, + {"include", INCLUDE}, {"interface", INTERFACE}, {"metric", METRIC}, {"no", NO}, |