# Added parser support for the error file configuration keywords
(ErrorFile, DefaultErrorFile, StatFile) [Steven Young]
This commit is contained in:
		
							parent
							
								
									056bbf84bd
								
							
						
					
					
						commit
						7995027c8c
					
				@ -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
 | 
					 * 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
 | 
					 * in sync with scanner.l. If you know more about yacc and lex than I do
 | 
				
			||||||
@ -25,6 +25,7 @@
 | 
				
			|||||||
#include "anonymous.h"
 | 
					#include "anonymous.h"
 | 
				
			||||||
#include "child.h"
 | 
					#include "child.h"
 | 
				
			||||||
#include "filter.h"
 | 
					#include "filter.h"
 | 
				
			||||||
 | 
					#include "htmlerror.h"
 | 
				
			||||||
#include "log.h"
 | 
					#include "log.h"
 | 
				
			||||||
#include "reqs.h"
 | 
					#include "reqs.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -52,6 +53,8 @@ int yylex(void);
 | 
				
			|||||||
%token KW_UPSTREAM
 | 
					%token KW_UPSTREAM
 | 
				
			||||||
%token KW_CONNECTPORT KW_BIND KW_HTTP_VIA
 | 
					%token KW_CONNECTPORT KW_BIND KW_HTTP_VIA
 | 
				
			||||||
%token KW_ALLOW KW_DENY
 | 
					%token KW_ALLOW KW_DENY
 | 
				
			||||||
 | 
					%token KW_ERRORPAGE KW_DEFAULT_ERRORPAGE
 | 
				
			||||||
 | 
					%token KW_STATPAGE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* yes/no switches */
 | 
					/* yes/no switches */
 | 
				
			||||||
%token KW_YES KW_NO
 | 
					%token KW_YES KW_NO
 | 
				
			||||||
@ -112,6 +115,9 @@ statement
 | 
				
			|||||||
	| KW_USER string		{ config.username = $2; }
 | 
						| KW_USER string		{ config.username = $2; }
 | 
				
			||||||
	| KW_GROUP string		{ config.group = $2; }
 | 
						| KW_GROUP string		{ config.group = $2; }
 | 
				
			||||||
	| KW_ANONYMOUS string		{ anonymous_insert($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
 | 
						| KW_FILTER string
 | 
				
			||||||
	  {
 | 
						  {
 | 
				
			||||||
#ifdef FILTER_ENABLE
 | 
					#ifdef FILTER_ENABLE
 | 
				
			||||||
@ -236,5 +242,12 @@ extern unsigned int yylineno;
 | 
				
			|||||||
void
 | 
					void
 | 
				
			||||||
yyerror(char *s)
 | 
					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);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
/* $Id: scanner.l,v 1.17 2003-01-27 17:57:38 rjkaes Exp $
 | 
					/* $Id: scanner.l,v 1.18 2003-03-13 21:28:36 rjkaes Exp $
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * This builds the scanner for the tinyproxy configuration file. This
 | 
					 * 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
 | 
					 * file needs to stay in sync with grammar.y. If someone knows lex and yacc
 | 
				
			||||||
@ -55,6 +55,9 @@ static struct keyword keywords[] = {
 | 
				
			|||||||
        { "connectport",         KW_CONNECTPORT },
 | 
					        { "connectport",         KW_CONNECTPORT },
 | 
				
			||||||
        { "bind",                KW_BIND },
 | 
					        { "bind",                KW_BIND },
 | 
				
			||||||
        { "viaheader",           KW_HTTP_VIA },
 | 
					        { "viaheader",           KW_HTTP_VIA },
 | 
				
			||||||
 | 
						{ "errorfile",	         KW_ERRORPAGE },
 | 
				
			||||||
 | 
						{ "defaulterrorfile",    KW_DEFAULT_ERRORPAGE },
 | 
				
			||||||
 | 
						{ "statfile",            KW_STATPAGE },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* loglevel and the settings */
 | 
					        /* loglevel and the settings */
 | 
				
			||||||
        { "loglevel",            KW_LOGLEVEL },
 | 
					        { "loglevel",            KW_LOGLEVEL },
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user