this was surprisingly straightforward, i just copied it from ospfd.
ok?
Index: parse.y
===================================================================
RCS file: /cvs/src/usr.sbin/ospf6d/parse.y,v
retrieving revision 1.20
diff -u -p -r1.20 parse.y
--- parse.y 13 Dec 2010 13:43:37 -0000 1.20
+++ parse.y 27 Jun 2011 01:29:46 -0000
@@ -121,6 +121,7 @@ typedef struct {
%token SET TYPE
%token YES NO
%token DEMOTE
+%token INCLUDE
%token ERROR
%token <v.string> STRING
%token <v.number> NUMBER
@@ -131,6 +132,7 @@ typedef struct {
%%
grammar : /* empty */
+ | grammar include '\n'
| grammar '\n'
| grammar conf_main '\n'
| grammar varset '\n'
@@ -138,6 +140,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);
@@ -526,6 +543,7 @@ lookup(char *s)
{"external-tag", EXTTAG},
{"fib-update", FIBUPDATE},
{"hello-interval", HELLOINTERVAL},
+ {"include", INCLUDE},
{"interface", INTERFACE},
{"metric", METRIC},
{"no", NO},