From a9720e85f6e47df91622d6b66ee13c45cf0eb060 Mon Sep 17 00:00:00 2001 From: Robert James Kaes Date: Sat, 2 Jun 2001 03:10:09 +0000 Subject: Include LogLevel and it's settings into the grammar of the config file. --- src/grammar.y | 16 +++++++++++++++- src/scanner.l | 12 ++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/grammar.y b/src/grammar.y index e8600f0..42a8033 100644 --- a/src/grammar.y +++ b/src/grammar.y @@ -1,4 +1,4 @@ -/* $Id: grammar.y,v 1.2 2001-05-27 02:25:21 rjkaes Exp $ +/* $Id: grammar.y,v 1.3 2001-06-02 03:10:09 rjkaes Exp $ * * This is the grammar for tinyproxy's configuration file. It needs to be * in sync with scanner.l. If you know more about yacc and lex than I do @@ -50,6 +50,10 @@ int yylex(void); /* yes/no switches */ %token KW_YES KW_NO +/* settings for loglevel */ +%token KW_LOGLEVEL +%token KW_LOG_CRITICAL KW_LOG_ERROR KW_LOG_WARNING KW_LOG_NOTICE KW_LOG_INFO + %token IDENTIFIER %token NUMBER %token STRING @@ -61,6 +65,7 @@ int yylex(void); %type string %type network_address %type unique_address +%type loglevels %% @@ -122,8 +127,17 @@ statement | KW_LISTEN NUMERIC_ADDRESS { config.ipAddr = $2; } | KW_ALLOW network_address { insert_acl($2, ACL_ALLOW); } | KW_DENY network_address { insert_acl($2, ACL_DENY); } + | KW_LOGLEVEL loglevels { set_log_level($2); } ; +loglevels + : KW_LOG_CRITICAL { $$ = LOG_CRIT; } + | KW_LOG_ERROR { $$ = LOG_ERR; } + | KW_LOG_WARNING { $$ = LOG_WARNING; } + | KW_LOG_NOTICE { $$ = LOG_NOTICE; } + | KW_LOG_INFO { $$ = LOG_INFO; } + ; + network_address : unique_address | NETMASK_ADDRESS diff --git a/src/scanner.l b/src/scanner.l index 86c2b77..01c5843 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -1,4 +1,4 @@ -/* $Id: scanner.l,v 1.2 2001-01-02 19:30:40 rjkaes Exp $ +/* $Id: scanner.l,v 1.3 2001-06-02 03:10:09 rjkaes Exp $ * * This builds the scanner for the tinyproxy configuration file. This * file needs to stay in sync with grammar.y. If someone knows lex and yacc @@ -50,6 +50,14 @@ static struct keyword keywords[] = { { "allow", KW_ALLOW }, { "deny", KW_DENY }, + /* loglevel and the settings */ + { "loglevel", KW_LOGLEVEL }, + { "critical", KW_LOG_CRITICAL }, + { "error", KW_LOG_ERROR }, + { "warning", KW_LOG_WARNING }, + { "notice", KW_LOG_NOTICE }, + { "info", KW_LOG_INFO }, + /* on/off switches */ { "yes", KW_YES }, { "on", KW_YES }, @@ -143,4 +151,4 @@ static void append_char(char c) *tiny_str = c; tiny_str++; *tiny_str = 0; -} \ No newline at end of file +} -- cgit v1.2.3