/[hydra]/hydra/src/boa_grammar.y
ViewVC logotype

Annotation of /hydra/src/boa_grammar.y

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (hide annotations)
Sun Oct 27 10:06:28 2002 UTC (21 years, 5 months ago) by nmav
Branch: MAIN
CVS Tags: hydra_0_1_6_without_hic, hydra_0_0_10, hydra_0_0_9, hydra_0_1_3, hydra_0_1_2, hydra_0_1_1, hydra_0_1_0, hydra_0_1_7, hydra_0_1_6, hydra_0_1_4, hydra_0_1_8, HEAD
Branch point for: hydra_0_1_0_patches
Changes since 1.3: +2 -3 lines
Added file access control lists per virtual host. Based on patch for
Boa by Peter Korsgaard <jacmet@sunsite.dk>.

1 nmav 1.1 %{
2    
3     /*
4     * Boa, an http server
5     * Copyright (C) 1995 Paul Phillips <psp@well.com>
6     *
7     * This program is free software; you can redistribute it and/or modify
8     * it under the terms of the GNU General Public License as published by
9     * the Free Software Foundation; either version 1, or (at your option)
10     * any later version.
11     *
12     * This program is distributed in the hope that it will be useful,
13     * but WITHOUT ANY WARRANTY; without even the implied warranty of
14     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15     * GNU General Public License for more details.
16     *
17     * You should have received a copy of the GNU General Public License
18     * along with this program; if not, write to the Free Software
19     * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20     *
21     */
22    
23 nmav 1.4 /* $Id: boa_grammar.y,v 1.3 2002/09/25 06:42:34 nmav Exp $*/
24 nmav 1.1
25     #include <string.h>
26     #include <stdio.h>
27     #include <stdlib.h>
28     #include <unistd.h>
29     /* #include "boa.h" */
30     #include "parse.h"
31    
32     int yyerror(char * msg);
33    
34     /* yydebug = 1; */
35     #ifdef DEBUG
36     #define DBG(x) x
37     #else
38     #define DBG(x)
39     #endif
40    
41     char *arg1hold;
42 nmav 1.2 char *arg2hold;
43     char *arg3hold;
44 nmav 1.1 char mime_type[256]; /* global to inherit */
45    
46     %}
47    
48     %union {
49     char * sval;
50     int ival;
51     struct ccommand * cval;
52     };
53    
54     /* boa.conf tokens */
55 nmav 1.3 %token <cval> STMT_NO_ARGS STMT_ONE_ARG STMT_TWO_ARGS STMT_THREE_ARGS STMT_FOUR_ARGS
56 nmav 1.1
57     /* mime.type tokens */
58     %token <sval> MIMETYPE
59     %token <sval> STRING
60     %token <ival> INTEGER
61 nmav 1.2 %token STRING_SEP ':'
62 nmav 1.1
63     %start ConfigFiles
64    
65     %%
66    
67     ConfigFiles: BoaConfigStmts MimeTypeStmts
68     ;
69    
70     BoaConfigStmts: BoaConfigStmts BoaConfigStmt
71     | /* empty */
72     ;
73    
74     BoaConfigStmt:
75     StmtNoArgs
76     | StmtOneArg
77     | StmtTwoArgs
78 nmav 1.3 | StmtThreeArgs
79 nmav 1.2 | StmtFourArgs
80 nmav 1.1 ;
81    
82     StmtNoArgs: STMT_NO_ARGS
83     { if ($1->action) {
84     DBG(printf("StmtNoArgs: %s\n",$1->name);)
85 nmav 1.2 $1->action(NULL, NULL, NULL,NULL,$1->object);
86 nmav 1.1 }
87     }
88     ;
89    
90     StmtOneArg: STMT_ONE_ARG STRING
91     { if ($1->action) {
92     DBG(printf("StmtOneArg: %s %s\n",$1->name,$2);)
93 nmav 1.2 $1->action($2,NULL, NULL, NULL,$1->object);
94 nmav 1.1 }
95     }
96     ;
97    
98     StmtTwoArgs: STMT_TWO_ARGS STRING
99     { arg1hold = strdup($2); }
100     STRING
101     { if ($1->action) {
102     DBG(printf("StmtTwoArgs: '%s' '%s' '%s'\n",
103     $1->name,arg1hold,$4);)
104 nmav 1.4 $1->action(arg1hold, $4,NULL, NULL, $1->object);
105 nmav 1.1 }
106     free(arg1hold);
107     }
108 nmav 1.3 ;
109    
110     StmtThreeArgs: STMT_THREE_ARGS STRING
111     { arg1hold = strdup($2); }
112     STRING
113     { arg2hold = strdup($4); }
114     STRING
115     { if ($1->action) {
116     DBG(printf("StmtThreeArgs: '%s' '%s' '%s' '%s'\n",
117     $1->name,arg1hold, arg2hold, $6);)
118     $1->action(arg1hold, arg2hold, $6, NULL, $1->object);
119     }
120     free(arg1hold);
121     free(arg2hold);
122     }
123     ;
124    
125 nmav 1.2 StmtFourArgs: STMT_FOUR_ARGS STRING
126     { arg1hold = strdup($2); }
127     STRING
128     { arg2hold = strdup($4); }
129     STRING
130     { arg3hold = strdup($6); }
131     STRING
132     { if ($1->action) {
133 nmav 1.3 DBG(printf("StmtFourArgs: '%s' '%s' '%s' '%s' '%s'\n",
134 nmav 1.2 $1->name,arg1hold, arg2hold, arg3hold, $8);)
135     $1->action(arg1hold, arg2hold, arg3hold, $8, $1->object);
136     }
137     free(arg1hold);
138     free(arg2hold);
139     free(arg3hold);
140     }
141 nmav 1.1 ;
142    
143     /******************* mime.types **********************/
144    
145     MimeTypeStmts: MimeTypeStmts MimeTypeStmt
146     | /* empty */
147     ;
148    
149     MimeTypeStmt: MIMETYPE
150     { strcpy(mime_type, $1); }
151     ExtensionList
152     ;
153    
154     ExtensionList: ExtensionList Extension
155     | /* empty */
156     ;
157    
158     Extension: STRING
159     { add_mime_type($1, mime_type); }
160     ;
161    
162     %%
163    

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26