Loglevels can be specified in the config file now

This commit is contained in:
dcp1990 2005-06-05 18:28:24 +00:00
parent e438ef8a4c
commit 85b3943b73
3 changed files with 33 additions and 11 deletions

View File

@ -9,12 +9,20 @@
#endif
#include <phoned.h>
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;

View File

@ -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 <number> LNUML
%token <string> 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;
}
;
%%

View File

@ -1,5 +1,6 @@
main {
modemdev "/dev/cuaa2";
loglevels warn|error;
};
notify {
10.10.10.255;