From 31b3e1bbf5bc823ec5cf6d88931132f00e6c52b9 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Fri, 5 Feb 1999 21:37:34 +0000 Subject: Implemented new configuration/reconfiguration interface and defined protocol state machines. Full explanation will follow soon. --- conf/cf-lex.l | 47 ++++++++--------------------------------------- 1 file changed, 8 insertions(+), 39 deletions(-) (limited to 'conf/cf-lex.l') diff --git a/conf/cf-lex.l b/conf/cf-lex.l index 81e3b6a..791d4ad 100644 --- a/conf/cf-lex.l +++ b/conf/cf-lex.l @@ -1,7 +1,7 @@ /* * BIRD -- Configuration Lexer * - * (c) 1998 Martin Mares + * (c) 1998--1999 Martin Mares * * Can be freely distributed and used under the terms of the GNU GPL. */ @@ -15,7 +15,6 @@ #include #include "nest/bird.h" -#include "lib/string.h" #include "conf/conf.h" #include "conf/cf-parse.tab.h" @@ -34,9 +33,10 @@ static struct keyword { static struct keyword *kw_hash[KW_HASH_SIZE]; static struct symbol **sym_hash; static int allow_new_symbols; -static int cf_lino; static int default_counter; +int conf_lino; + static int cf_hash(byte *c); static struct symbol *cf_find_sym(byte *c, unsigned int h0); @@ -121,11 +121,11 @@ WHITE [ \t] {WHITE}+ \\\n { - cf_lino++; + conf_lino++; } \n { - cf_lino++; + conf_lino++; return ';'; } @@ -136,14 +136,14 @@ WHITE [ \t] . cf_error("Unknown character"); \n { - cf_lino++; + conf_lino++; BEGIN(INITIAL); } . \*\/ BEGIN(INITIAL); -\n cf_lino++; +\n conf_lino++; \/\* cf_error("Comment nesting not supported"); <> cf_error("Unterminated comment"); . @@ -206,7 +206,7 @@ cf_lex_init(int flag) { if (allow_new_symbols = flag) sym_hash = cfg_allocz(SYM_HASH_SIZE * sizeof(struct keyword *)); - cf_lino = 1; + conf_lino = 1; default_counter = 1; } @@ -222,34 +222,3 @@ cf_lex_init_tables(void) kw_hash[h] = k; } } - -void -cf_error(char *msg, ...) -{ - /* FIXME */ - - char buf[1024]; - va_list args; - - va_start(args, msg); - bvsprintf(buf, msg, args); - die(PATH_CONFIG ", line %d: %s", cf_lino, buf); -} - -void -cf_allocate(void) -{ - if (cfg_pool) - rfree(cfg_pool); - cfg_pool = rp_new(&root_pool, "Config"); - cfg_mem = lp_new(cfg_pool, 1024); -} - -char * -cfg_strdup(char *c) -{ - int l = strlen(c) + 1; - char *z = cfg_allocu(l); - memcpy(z, c, l); - return z; -} -- cgit v1.2.3