From 44742f8aadb7a8a969f11d9b1d50c8be2573a576 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 25 Mar 2012 15:06:39 +0200 Subject: Add include command --- src/config.y | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/config.y') diff --git a/src/config.y b/src/config.y index 9868d57..2bc4fed 100644 --- a/src/config.y +++ b/src/config.y @@ -3,6 +3,7 @@ %name-prefix "fastd_config_" %parse-param {fastd_context *ctx} %parse-param {fastd_config *conf} +%parse-param {int depth} %code requires { #include @@ -29,6 +30,7 @@ %token TOK_ADDRESS %token TOK_SECRET %token TOK_KEY +%token TOK_INCLUDE %token TOK_ADDR %token TOK_ADDR6 @@ -42,7 +44,7 @@ #include #include - void fastd_config_error(fastd_context *ctx, fastd_config *conf, char *s); + void fastd_config_error(fastd_context *ctx, fastd_config *conf, int depth, char *s); extern fastd_protocol fastd_protocol_null; @@ -70,6 +72,7 @@ statement: TOK_INTERFACE interface ';' | TOK_PROTOCOL protocol ';' | TOK_SECRET secret ';' | TOK_PEER peer '{' peer_conf '}' + | TOK_INCLUDE include ';' ; interface: TOK_STRING { free(conf->ifname); conf->ifname = strdup($1); } @@ -150,6 +153,10 @@ peer_key: TOK_STRING { free(conf->peers->key); conf->peers->key = strdup($1); } ; +include: TOK_STRING { fastd_read_config(ctx, conf, $1, depth); } + ; + + maybe_string: TOK_STRING | { $$ = ""; } ; @@ -169,6 +176,6 @@ port: TOK_INTEGER { } ; %% -void fastd_config_error(fastd_context *ctx, fastd_config *conf, char *s) { +void fastd_config_error(fastd_context *ctx, fastd_config *conf, int depth, char *s) { exit_error(ctx, "config error: %s", s); } -- cgit v1.2.3