diff --git a/phoned/config.l b/phoned/config.l index d0484f8..2303d85 100644 --- a/phoned/config.l +++ b/phoned/config.l @@ -9,12 +9,20 @@ #endif #include extern int chrcnt, lincnt; +extern struct conf cf; /* ewwwww */ %} %% . ++chrcnt; REJECT; main return MAIN; +loglevel cf.loglevels = LL_CRITICAL|LL_FATAL; return LLEVEL; +all yylval.number = LL_ALL; return LNUML; +debug yylval.number = LL_DEBUG; return LNUML; +info yylval.number = LL_INFO; return LNUML; +garbage yylval.number = LL_GARBAGE; return LNUML; +warn yylval.number = LL_WARN; return LNUML; notify return NOTIFY; modemdev return MODDEV; +\| return OR; \" return QUOTE; \{ return OBRACE; \} return CBRACE; diff --git a/phoned/config.y b/phoned/config.y index c6915ad..da723bd 100644 --- a/phoned/config.y +++ b/phoned/config.y @@ -26,12 +26,13 @@ int yywrap(void) return 1; } %} -%token NOTIFY OBRACE CBRACE SCOLON QUOTE MODDEV MAIN +%token NOTIFY OBRACE CBRACE SCOLON QUOTE MODDEV MAIN LLEVEL OR +%token LNUML %token IPADDR PATH %% commands: | - command SCOLON commands + commands command SCOLON ; command: notify @@ -40,9 +41,6 @@ command: ; main: MAIN params - { - lprintf(debug, "parser: end main\n"); - } ; params: OBRACE directives CBRACE @@ -53,12 +51,11 @@ directives: ; directive: modemdev + | + loglevel ; notify: NOTIFY iplist - { - lprintf(debug, "parser: end notify\n"); - } ; iplist: OBRACE ipaddrs CBRACE @@ -76,9 +73,6 @@ ipadr: ; modemdev: MODDEV devpath - { - lprintf(debug, "parser: end modemdev\n"); - } ; devpath: QUOTE PATH QUOTE @@ -87,4 +81,23 @@ devpath: cf.modemdev = $2; } ; +/* loglevels */ +loglevel: + LLEVEL llvls + ; +llvls: + | + llvl llvls + ; +llvl: + LNUML OR + { + cf.loglevels |= $1; + } + | + LNUML + { + cf.loglevels |= $1; + } + ; %% diff --git a/phoned/phoned.conf b/phoned/phoned.conf index 5b167fd..84a1c1b 100644 --- a/phoned/phoned.conf +++ b/phoned/phoned.conf @@ -1,5 +1,6 @@ main { modemdev "/dev/cuaa2"; + loglevels warn|error; }; notify { 10.10.10.255;