diff options
author | Robert James Kaes <rjkaes@users.sourceforge.net> | 2003-03-13 21:28:37 +0000 |
---|---|---|
committer | Robert James Kaes <rjkaes@users.sourceforge.net> | 2003-03-13 21:28:37 +0000 |
commit | 7995027c8c88dba70ef0dc048553df72c998fa3d (patch) | |
tree | 02936c288ae2cebd4f02c586f86782c635633c87 /src/grammar.y | |
parent | 056bbf84bdf87b95b9da9599db237a3392a5fe62 (diff) | |
download | tinyproxy-7995027c8c88dba70ef0dc048553df72c998fa3d.tar.gz tinyproxy-7995027c8c88dba70ef0dc048553df72c998fa3d.zip |
# Added parser support for the error file configuration keywords
(ErrorFile, DefaultErrorFile, StatFile) [Steven Young]
Diffstat (limited to '')
-rw-r--r-- | src/grammar.y | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/grammar.y b/src/grammar.y index 0f52161..851f471 100644 --- a/src/grammar.y +++ b/src/grammar.y @@ -1,4 +1,4 @@ -/* $Id: grammar.y,v 1.18 2003-01-27 17:57:39 rjkaes Exp $ +/* $Id: grammar.y,v 1.19 2003-03-13 21:28:37 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 @@ -25,6 +25,7 @@ #include "anonymous.h" #include "child.h" #include "filter.h" +#include "htmlerror.h" #include "log.h" #include "reqs.h" @@ -52,6 +53,8 @@ int yylex(void); %token KW_UPSTREAM %token KW_CONNECTPORT KW_BIND KW_HTTP_VIA %token KW_ALLOW KW_DENY +%token KW_ERRORPAGE KW_DEFAULT_ERRORPAGE +%token KW_STATPAGE /* yes/no switches */ %token KW_YES KW_NO @@ -112,6 +115,9 @@ statement | KW_USER string { config.username = $2; } | KW_GROUP string { config.group = $2; } | KW_ANONYMOUS string { anonymous_insert($2); } + | KW_ERRORPAGE NUMBER string { add_new_errorpage($3, $2); } + | KW_DEFAULT_ERRORPAGE string { config.errorpage_undef = $2; } + | KW_STATPAGE string { config.statpage = $2; } | KW_FILTER string { #ifdef FILTER_ENABLE @@ -236,5 +242,12 @@ extern unsigned int yylineno; void yyerror(char *s) { - fprintf(stderr, "Line %d: %s\n", yylineno, s); + static int headerdisplayed = 0; + + if (!headerdisplayed) { + fprintf(stderr, "Errors in configuration file:\n"); + headerdisplayed = 1; + } + + fprintf(stderr, "\t%s:%d: %s\n", config.config_file, yylineno, s); } |