chiark / gitweb /
copyright: Simplify notices (automatic part)
[userv.git] / lexer.c
1
2 #line 3 "<stdout>"
3
4 #define  YY_INT_ALIGNED short int
5
6 /* A lexical scanner generated by flex */
7
8 #define FLEX_SCANNER
9 #define YY_FLEX_MAJOR_VERSION 2
10 #define YY_FLEX_MINOR_VERSION 6
11 #define YY_FLEX_SUBMINOR_VERSION 4
12 #if YY_FLEX_SUBMINOR_VERSION > 0
13 #define FLEX_BETA
14 #endif
15
16 /* First, we deal with  platform-specific or compiler-specific issues. */
17
18 /* begin standard C headers. */
19 #include <stdio.h>
20 #include <string.h>
21 #include <errno.h>
22 #include <stdlib.h>
23
24 /* end standard C headers. */
25
26 /* flex integer type definitions */
27
28 #ifndef FLEXINT_H
29 #define FLEXINT_H
30
31 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
32
33 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
34
35 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
36  * if you want the limit (max/min) macros for int types. 
37  */
38 #ifndef __STDC_LIMIT_MACROS
39 #define __STDC_LIMIT_MACROS 1
40 #endif
41
42 #include <inttypes.h>
43 typedef int8_t flex_int8_t;
44 typedef uint8_t flex_uint8_t;
45 typedef int16_t flex_int16_t;
46 typedef uint16_t flex_uint16_t;
47 typedef int32_t flex_int32_t;
48 typedef uint32_t flex_uint32_t;
49 #else
50 typedef signed char flex_int8_t;
51 typedef short int flex_int16_t;
52 typedef int flex_int32_t;
53 typedef unsigned char flex_uint8_t; 
54 typedef unsigned short int flex_uint16_t;
55 typedef unsigned int flex_uint32_t;
56
57 /* Limits of integral types. */
58 #ifndef INT8_MIN
59 #define INT8_MIN               (-128)
60 #endif
61 #ifndef INT16_MIN
62 #define INT16_MIN              (-32767-1)
63 #endif
64 #ifndef INT32_MIN
65 #define INT32_MIN              (-2147483647-1)
66 #endif
67 #ifndef INT8_MAX
68 #define INT8_MAX               (127)
69 #endif
70 #ifndef INT16_MAX
71 #define INT16_MAX              (32767)
72 #endif
73 #ifndef INT32_MAX
74 #define INT32_MAX              (2147483647)
75 #endif
76 #ifndef UINT8_MAX
77 #define UINT8_MAX              (255U)
78 #endif
79 #ifndef UINT16_MAX
80 #define UINT16_MAX             (65535U)
81 #endif
82 #ifndef UINT32_MAX
83 #define UINT32_MAX             (4294967295U)
84 #endif
85
86 #ifndef SIZE_MAX
87 #define SIZE_MAX               (~(size_t)0)
88 #endif
89
90 #endif /* ! C99 */
91
92 #endif /* ! FLEXINT_H */
93
94 /* begin standard C++ headers. */
95
96 /* TODO: this is always defined, so inline it */
97 #define yyconst const
98
99 #if defined(__GNUC__) && __GNUC__ >= 3
100 #define yynoreturn __attribute__((__noreturn__))
101 #else
102 #define yynoreturn
103 #endif
104
105 /* Returned upon end-of-file. */
106 #define YY_NULL 0
107
108 /* Promotes a possibly negative, possibly signed char to an
109  *   integer in range [0..255] for use as an array index.
110  */
111 #define YY_SC_TO_UI(c) ((YY_CHAR) (c))
112
113 /* Enter a start condition.  This macro really ought to take a parameter,
114  * but we do it the disgusting crufty way forced on us by the ()-less
115  * definition of BEGIN.
116  */
117 #define BEGIN (yy_start) = 1 + 2 *
118 /* Translate the current start state into a value that can be later handed
119  * to BEGIN to return to the state.  The YYSTATE alias is for lex
120  * compatibility.
121  */
122 #define YY_START (((yy_start) - 1) / 2)
123 #define YYSTATE YY_START
124 /* Action number for EOF rule of a given start state. */
125 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
126 /* Special action meaning "start processing a new file". */
127 #define YY_NEW_FILE yyrestart( yyin  )
128 #define YY_END_OF_BUFFER_CHAR 0
129
130 /* Size of default input buffer. */
131 #ifndef YY_BUF_SIZE
132 #ifdef __ia64__
133 /* On IA-64, the buffer size is 16k, not 8k.
134  * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
135  * Ditto for the __ia64__ case accordingly.
136  */
137 #define YY_BUF_SIZE 32768
138 #else
139 #define YY_BUF_SIZE 16384
140 #endif /* __ia64__ */
141 #endif
142
143 /* The state buf must be large enough to hold one state per character in the main buffer.
144  */
145 #define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
146
147 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
148 #define YY_TYPEDEF_YY_BUFFER_STATE
149 typedef struct yy_buffer_state *YY_BUFFER_STATE;
150 #endif
151
152 #ifndef YY_TYPEDEF_YY_SIZE_T
153 #define YY_TYPEDEF_YY_SIZE_T
154 typedef size_t yy_size_t;
155 #endif
156
157 extern int yyleng;
158
159 extern FILE *yyin, *yyout;
160
161 #define EOB_ACT_CONTINUE_SCAN 0
162 #define EOB_ACT_END_OF_FILE 1
163 #define EOB_ACT_LAST_MATCH 2
164     
165     #define YY_LESS_LINENO(n)
166     #define YY_LINENO_REWIND_TO(ptr)
167     
168 /* Return all but the first "n" matched characters back to the input stream. */
169 #define yyless(n) \
170         do \
171                 { \
172                 /* Undo effects of setting up yytext. */ \
173         int yyless_macro_arg = (n); \
174         YY_LESS_LINENO(yyless_macro_arg);\
175                 *yy_cp = (yy_hold_char); \
176                 YY_RESTORE_YY_MORE_OFFSET \
177                 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
178                 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
179                 } \
180         while ( 0 )
181 #define unput(c) yyunput( c, (yytext_ptr)  )
182
183 #ifndef YY_STRUCT_YY_BUFFER_STATE
184 #define YY_STRUCT_YY_BUFFER_STATE
185 struct yy_buffer_state
186         {
187         FILE *yy_input_file;
188
189         char *yy_ch_buf;                /* input buffer */
190         char *yy_buf_pos;               /* current position in input buffer */
191
192         /* Size of input buffer in bytes, not including room for EOB
193          * characters.
194          */
195         int yy_buf_size;
196
197         /* Number of characters read into yy_ch_buf, not including EOB
198          * characters.
199          */
200         int yy_n_chars;
201
202         /* Whether we "own" the buffer - i.e., we know we created it,
203          * and can realloc() it to grow it, and should free() it to
204          * delete it.
205          */
206         int yy_is_our_buffer;
207
208         /* Whether this is an "interactive" input source; if so, and
209          * if we're using stdio for input, then we want to use getc()
210          * instead of fread(), to make sure we stop fetching input after
211          * each newline.
212          */
213         int yy_is_interactive;
214
215         /* Whether we're considered to be at the beginning of a line.
216          * If so, '^' rules will be active on the next match, otherwise
217          * not.
218          */
219         int yy_at_bol;
220
221     int yy_bs_lineno; /**< The line count. */
222     int yy_bs_column; /**< The column count. */
223
224         /* Whether to try to fill the input buffer when we reach the
225          * end of it.
226          */
227         int yy_fill_buffer;
228
229         int yy_buffer_status;
230
231 #define YY_BUFFER_NEW 0
232 #define YY_BUFFER_NORMAL 1
233         /* When an EOF's been seen but there's still some text to process
234          * then we mark the buffer as YY_EOF_PENDING, to indicate that we
235          * shouldn't try reading from the input source any more.  We might
236          * still have a bunch of tokens to match, though, because of
237          * possible backing-up.
238          *
239          * When we actually see the EOF, we change the status to "new"
240          * (via yyrestart()), so that the user can continue scanning by
241          * just pointing yyin at a new input file.
242          */
243 #define YY_BUFFER_EOF_PENDING 2
244
245         };
246 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
247
248 /* Stack of input buffers. */
249 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
250 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
251 static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */
252
253 /* We provide macros for accessing buffer states in case in the
254  * future we want to put the buffer states in a more general
255  * "scanner state".
256  *
257  * Returns the top of the stack, or NULL.
258  */
259 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
260                           ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
261                           : NULL)
262 /* Same as previous macro, but useful when we know that the buffer stack is not
263  * NULL or when we need an lvalue. For internal use only.
264  */
265 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
266
267 /* yy_hold_char holds the character lost when yytext is formed. */
268 static char yy_hold_char;
269 static int yy_n_chars;          /* number of characters read into yy_ch_buf */
270 int yyleng;
271
272 /* Points to current character in buffer. */
273 static char *yy_c_buf_p = NULL;
274 static int yy_init = 0;         /* whether we need to initialize */
275 static int yy_start = 0;        /* start state number */
276
277 /* Flag which is used to allow yywrap()'s to do buffer switches
278  * instead of setting up a fresh yyin.  A bit of a hack ...
279  */
280 static int yy_did_buffer_switch_on_eof;
281
282 void yyrestart ( FILE *input_file  );
283 void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer  );
284 YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size  );
285 void yy_delete_buffer ( YY_BUFFER_STATE b  );
286 void yy_flush_buffer ( YY_BUFFER_STATE b  );
287 void yypush_buffer_state ( YY_BUFFER_STATE new_buffer  );
288 void yypop_buffer_state ( void );
289
290 static void yyensure_buffer_stack ( void );
291 static void yy_load_buffer_state ( void );
292 static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file  );
293 #define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER )
294
295 YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size  );
296 YY_BUFFER_STATE yy_scan_string ( const char *yy_str  );
297 YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len  );
298
299 void *yyalloc ( yy_size_t  );
300 void *yyrealloc ( void *, yy_size_t  );
301 void yyfree ( void *  );
302
303 #define yy_new_buffer yy_create_buffer
304 #define yy_set_interactive(is_interactive) \
305         { \
306         if ( ! YY_CURRENT_BUFFER ){ \
307         yyensure_buffer_stack (); \
308                 YY_CURRENT_BUFFER_LVALUE =    \
309             yy_create_buffer( yyin, YY_BUF_SIZE ); \
310         } \
311         YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
312         }
313 #define yy_set_bol(at_bol) \
314         { \
315         if ( ! YY_CURRENT_BUFFER ){\
316         yyensure_buffer_stack (); \
317                 YY_CURRENT_BUFFER_LVALUE =    \
318             yy_create_buffer( yyin, YY_BUF_SIZE ); \
319         } \
320         YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
321         }
322 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
323
324 /* Begin user sect3 */
325
326 #define yywrap() (/*CONSTCOND*/1)
327 #define YY_SKIP_YYWRAP
328 typedef flex_uint8_t YY_CHAR;
329
330 FILE *yyin = NULL, *yyout = NULL;
331
332 typedef int yy_state_type;
333
334 extern int yylineno;
335 int yylineno = 1;
336
337 extern char *yytext;
338 #ifdef yytext_ptr
339 #undef yytext_ptr
340 #endif
341 #define yytext_ptr yytext
342
343 static yy_state_type yy_get_previous_state ( void );
344 static yy_state_type yy_try_NUL_trans ( yy_state_type current_state  );
345 static int yy_get_next_buffer ( void );
346 static void yynoreturn yy_fatal_error ( const char* msg  );
347
348 /* Done after the current pattern has been matched and before the
349  * corresponding action - sets up yytext.
350  */
351 #define YY_DO_BEFORE_ACTION \
352         (yytext_ptr) = yy_bp; \
353         yyleng = (int) (yy_cp - yy_bp); \
354         (yy_hold_char) = *yy_cp; \
355         *yy_cp = '\0'; \
356         (yy_c_buf_p) = yy_cp;
357 #define YY_NUM_RULES 112
358 #define YY_END_OF_BUFFER 113
359 /* This struct is not used in this scanner,
360    but its presence is necessary. */
361 struct yy_trans_info
362         {
363         flex_int32_t yy_verify;
364         flex_int32_t yy_nxt;
365         };
366 static const flex_int16_t yy_accept[587] =
367     {   0,
368         0,    0,  113,  108,  103,  104,   95,  109,  106,   89,
369        96,   93,   94,   99,  110,  108,  108,  108,  108,  108,
370       108,  108,  108,  108,  108,  108,  108,  108,  108,  108,
371       108,  108,  108,  108,  108,  108,  108,   97,  108,  103,
372       104,  106,    0,    0,  107,    0,  106,  106,  105,  101,
373        99,    0,  102,  108,  108,  108,  108,   21,  108,  108,
374       108,  108,  108,  108,  108,  108,  108,  108,   39,  108,
375       108,  108,  108,   34,  108,  108,  108,  108,  108,  108,
376       108,  108,  108,  108,  108,  108,  108,  108,  108,  108,
377       108,  108,  108,  108,  108,  108,  108,  108,  108,  108,
378
379       108,    0,    0,    0,  100,   99,  102,  108,  108,  108,
380       108,  108,  108,  108,  108,  108,  108,  108,  108,  108,
381       108,  108,   33,   65,  108,  108,  108,  108,  108,  108,
382       108,  108,  108,  108,   73,  108,  108,  108,  108,  108,
383       108,  108,  108,  108,  108,  108,  108,  108,  108,  108,
384       108,  108,  108,  108,  108,  108,  108,  108,  108,  108,
385       108,  108,  108,  108,    0,    0,  100,   99,  108,  108,
386       108,   69,  108,  108,   66,   70,  108,  108,  108,   37,
387        38,  108,  108,  108,  108,   42,   44,  108,   53,  108,
388       108,   62,   72,  108,   74,  108,   75,  108,  108,  108,
389
390       108,  108,  108,  108,   32,  108,   87,  108,  108,  108,
391       108,  108,  108,  108,  108,  108,  108,  108,  108,  108,
392       108,   77,   78,  108,   64,  108,    0,  100,   99,  108,
393        67,  108,  108,  108,  108,  108,   61,  108,   68,  108,
394        98,  108,   40,  108,  108,  108,  108,  108,  108,  108,
395       108,  108,  108,  108,  108,   43,  108,  108,   51,  108,
396       108,  108,  108,  108,  108,   90,  108,  108,  108,  108,
397       108,  108,  108,   88,  100,   99,  108,  108,  108,  108,
398       108,   71,  108,  108,  108,  108,  108,  108,   72,   79,
399        80,   81,   82,   83,   84,   85,   86,  108,  108,  108,
400
401       108,   63,  108,  108,  108,    1,  108,  108,  108,  108,
402       108,   41,   92,   91,  108,   76,  108,  108,  108,  108,
403       100,   99,  108,  108,  108,  108,  108,  108,  108,  108,
404        52,  108,   23,   28,  108,  108,  108,   12,  108,  108,
405       108,  108,  108,   54,  108,  108,  108,  108,  108,   47,
406        64,  100,   99,  108,   11,   69,  108,  108,  108,  108,
407       108,  108,  108,  108,  108,  108,  108,  108,   49,  108,
408       108,  108,  108,  108,   50,  108,   48,  108,  100,  108,
409       108,  108,  108,  108,  108,  108,  108,  108,  108,   14,
410       108,  108,  108,  108,  108,  108,   46,   13,  108,  108,
411
412       108,  108,  108,  108,  100,  108,  108,  108,  108,  108,
413        35,  108,  108,  108,  108,  108,  108,  108,  108,  108,
414       108,  108,  108,   10,  108,  108,  108,  108,  108,  108,
415       108,  108,  108,  108,  108,   45,   36,  108,  108,  108,
416       108,  108,  108,  108,  108,  108,  108,  108,  108,  108,
417       108,   22,  108,  108,  108,  108,   55,  108,  108,  108,
418       108,  108,  108,  108,  108,  108,  108,  108,  108,  108,
419        58,  108,  108,  108,  108,  108,   56,  108,  108,  108,
420       108,  108,  108,  108,  108,  108,  108,  108,  108,  108,
421        59,  108,  108,   17,  108,  108,  108,  108,   19,    7,
422
423       108,  108,  108,  108,  108,  108,  108,   25,  108,  108,
424       108,  108,  108,  108,  108,  108,  108,  108,  108,    4,
425       108,  108,  108,   24,  108,  108,  108,  108,  108,   15,
426       108,  108,  108,  108,    5,    6,  108,  108,  108,  108,
427       108,  108,  108,   18,  108,  108,  108,  108,  108,  108,
428         3,   27,  108,  108,   20,  108,  108,  108,   29,  108,
429        57,  108,   26,  108,   16,   60,  108,  108,  108,  108,
430       108,   30,  108,  108,  108,  108,  108,   31,    2,  108,
431       108,  108,  108,    9,    8,    0
432     } ;
433
434 static const YY_CHAR yy_ec[256] =
435     {   0,
436         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
437         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
438         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
439         1,    2,    4,    5,    6,    7,    8,    9,    8,   10,
440        11,    8,    8,    8,   12,    8,    8,   13,   14,   15,
441        16,   17,   18,   19,   20,   21,   21,    8,    8,    8,
442         8,    8,    8,    8,   22,   22,   22,   22,   22,   22,
443         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
444         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
445         8,   23,    8,    8,   24,    8,   25,   26,   27,   28,
446
447        29,   30,   31,   32,   33,   34,   35,   36,   37,   38,
448        39,   40,   41,   42,   43,   44,   45,   46,   47,   48,
449        49,   50,    8,   51,    8,    8,    1,    1,    1,    1,
450         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
451         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
452         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
453         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
454         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
455         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
456         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
457
458         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
459         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
460         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
461         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
462         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
463         1,    1,    1,    1,    1
464     } ;
465
466 static const YY_CHAR yy_meta[52] =
467     {   0,
468         1,    2,    3,    1,    2,    1,    1,    1,    1,    1,
469         1,    1,    4,    4,    4,    4,    4,    4,    4,    4,
470         4,    1,    2,    1,    1,    1,    1,    1,    1,    1,
471         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
472         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
473         1
474     } ;
475
476 static const flex_int16_t yy_base[593] =
477     {   0,
478         0,    0,  801,    0,   50,  802,    0,   49,   55,    0,
479         0,    0,    0,   67,   59,  767,   19,   49,   34,   56,
480       766,   29,   39,   59,  769,   30,   71,   70,  751,  771,
481       750,   76,   74,  755,   65,  764,   82,    0,    0,  111,
482       802,  789,   73,   97,  802,  134,  123,  788,  802,  170,
483       179,  109,  119,  752,   93,  745,   94,    0,   94,  759,
484       761,  743,   98,  756,  738,  753,  740,  752,    0,  741,
485       750,  734,  741,    0,  738,  113,  733,  747,  731,  739,
486       728,  723,  120,  733,  739,  119,  734,  728,  133,  118,
487       720,  725,  735,  722,  718,  720,  730,  731,  715,  714,
488
489       722,  163,    0,  196,  214,  223,  157,  727,  711,  713,
490       719,  714,  722,  704,  709,  709,  700,  717,  713,  713,
491       699,  707,    0,  700,  711,  711,  696,  710,  694,  694,
492       696,  692,  692,  704,    0,  692,  684,  683,  135,  692,
493       688,  681,  689,  696,  676,  688,  690,  688,  671,  686,
494       669,  667,  700,  667,  668,  140,  669,  672,  671,  664,
495       665,  661,  665,  658,    0,  232,  250,  259,  665,  656,
496       652,  658,  664,  664,    0,    0,  656,  663,  654,    0,
497         0,  661,  649,  648,  644,    0,    0,  661,    0,  645,
498       641,    0,  656,  648,    0,  658,    0,  649,  175,  654,
499
500       668,  637,  651,  640,    0,  647,    0,  648,  641,  629,
501       630,  638,  641,  641,  626,  625,  628,  620,  622,  624,
502       633,  649,    0,  627,  626,  629,  276,  287,  296,  612,
503         0,  644,  613,  616,  641,  614,    0,  613,    0,  611,
504       606,  604,    0,  618,  618,  609,  305,  613,  600,  598,
505       601,  611,  609,  605,  608,    0,  592,  593,    0,  601,
506       606,  594,  592,  601,  587,    0,  584,  598,  595,  579,
507       582,  584,  584,    0,  313,  322,  593,  590,  586,  587,
508       576,    0,  578,  577,  602,  584,  600,  582,    0,    0,
509         0,    0,    0,    0,    0,    0,    0,  581,  582,  596,
510
511       567,    0,  578,  577,  560,  591,  573,  557,  571,  553,
512       551,    0,    0,    0,  554,    0,  567,  568,  556,  562,
513       331,  340,  563,  563,  544,  577,  543,  558,  549,  128,
514       573,  554,  571,    0,  543,  552,  538,    0,  550,  549,
515       547,  564,  526,  562,  540,  534,  528,  534,  539,    0,
516         0,  349,  556,  555,    0,    0,  251,  533,  538,  535,
517       518,  523,  145,  533,  255,  522,  521,  529,    0,  515,
518       528,  525,  253,  512,    0,  541,    0,  519,  358,  353,
519       509,  507,  505,  504,  509,  503,  533,  499,  501,    0,
520       509,  511,  501,  501,  492,  494,    0,    0,  508,  493,
521
522       491,  494,  507,  495,    0,  494,  480,  485,  488,  497,
523         0,  513,  480,  491,  351,  489,  482,  478,  490,  479,
524       488,  483,  472,    0,  475,  484,  474,  469,  481,  476,
525       465,  478,  461,  463,  472,    0,    0,  470,   95,  466,
526       464,  471,  451,  463,  470,  454,  483,  449,  451,  455,
527       460,    0,  461,  462,  446,  447,  474,  440,  448,  455,
528       439,  437,  468,  452,  445,  432,  432,  436,  449,  433,
529       460,  442,  427,  431,  429,  455,    0,  423,  425,  435,
530       434,  426,  428,  257,  416,  416,  418,  445,  418,  413,
531         0,  411,  415,    0,  408,  413,  408,  417,    0,    0,
532
533       406,  408,  408,  412,  419,  404,  398,  429,  408,  402,
534       407,  405,  392,  423,  404,  406,  403,  389,  399,    0,
535       387,  384,  385,    0,  358,  381,  396,  381,  394,    0,
536       395,  388,  390,  383,    0,    0,  389,  385,  367,  370,
537       357,  361,  359,    0,  359,  354,  361,  358,  354,  362,
538         0,    0,  352,  348,    0,  342,  349,  346,    0,  346,
539         0,  251,    0,  250,    0,    0,  263,  263,  251,  260,
540       254,    0,  244,  244,  224,  159,  164,    0,    0,  178,
541       170,  158,  153,    0,    0,  802,  399,  403,  407,  411,
542       173,  166
543
544     } ;
545
546 static const flex_int16_t yy_def[593] =
547     {   0,
548       586,    1,  586,  587,  586,  586,  587,  588,  589,  587,
549       587,  587,  587,  587,  586,  587,  587,  587,  587,  587,
550       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
551       587,  587,  587,  587,  587,  587,  587,  587,  587,  586,
552       586,  590,  586,  588,  586,  588,  589,  590,  586,  587,
553        14,  586,  586,  587,  587,  587,  587,  587,  587,  587,
554       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
555       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
556       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
557       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
558
559       587,  586,  591,  588,  587,   14,  586,  587,  587,  587,
560       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
561       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
562       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
563       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
564       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
565       587,  587,  587,  587,  592,  104,  587,   14,  587,  587,
566       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
567       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
568       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
569
570       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
571       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
572       587,  587,  587,  587,  587,  587,  588,  587,   14,  587,
573       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
574       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
575       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
576       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
577       587,  587,  587,  587,  587,   14,  587,  587,  587,  587,
578       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
579       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
580
581       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
582       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
583       587,   14,  587,  587,  587,  587,  587,  587,  587,  587,
584       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
585       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
586       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
587       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
588       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
589       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
590       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
591
592       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
593       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
594       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
595       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
596       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
597       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
598       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
599       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
600       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
601       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
602
603       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
604       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
605       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
606       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
607       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
608       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
609       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
610       587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
611       587,  587,  587,  587,  587,    0,  586,  586,  586,  586,
612       586,  586
613
614     } ;
615
616 static const flex_int16_t yy_nxt[854] =
617     {   0,
618         4,    5,    6,    7,    8,    9,   10,    4,   11,   12,
619        13,    4,   14,   14,   14,   14,   14,   14,   14,   14,
620        14,    4,   15,   16,   17,    4,   18,   19,   20,   21,
621        22,   23,   24,    4,   25,   26,   27,   28,   29,   30,
622        31,   32,   33,   34,   35,   36,   37,    4,    4,    4,
623        38,   40,   41,   45,   55,   42,   48,   49,   60,   48,
624        52,   53,   61,   56,   70,   72,   62,   73,   78,   79,
625        71,   46,   43,   57,   52,   53,   58,   48,   50,   51,
626        51,   51,   51,   51,   51,   51,   51,   51,   74,   75,
627        59,   63,   64,   65,   66,   80,   76,   67,   82,   81,
628
629        88,   45,   90,   68,   89,   91,  100,   97,   83,   98,
630        52,   53,   40,   41,   84,   92,   42,   93,   94,   46,
631       107,  109,   95,  101,   48,   49,  114,   48,  110,  112,
632       119,  139,  115,   43,  586,  102,   44,  113,  460,  131,
633       120,   43,  132,  461,  151,   48,  103,  103,  103,  103,
634       103,  103,  103,  103,  103,  586,  143,  147,  107,  152,
635       144,  153,  198,  140,  102,   44,  148,  361,  216,   44,
636       388,  362,  217,  149,  389,  150,  165,  199,  218,   43,
637       585,  104,  105,  105,  105,  105,  105,  105,  105,  105,
638       105,  106,  106,  106,  106,  106,  106,  106,  106,  106,
639
640        45,  580,  581,  250,  584,  583,  582,  579,  166,  166,
641       166,  166,  166,  166,  166,  166,  166,  166,   46,  251,
642       166,  166,  166,  166,  166,  166,  167,  167,  167,  167,
643       167,  167,  167,  167,  167,  168,  168,  168,  168,  168,
644       168,  168,  168,  168,  227,  227,  227,  227,  227,  227,
645       227,  227,  227,  227,  578,  577,  227,  227,  227,  227,
646       227,  227,  228,  228,  228,  228,  228,  228,  228,  228,
647       228,  229,  229,  229,  229,  229,  229,  229,  229,  229,
648        45,  381,  391,  400,  504,  576,  575,  392,  574,  573,
649       393,  572,  571,  570,  569,  382,  505,  401,   46,  275,
650
651       275,  275,  275,  275,  275,  275,  275,  275,  276,  276,
652       276,  276,  276,  276,  276,  276,  276,  290,  291,  292,
653       293,  294,  295,  296,  297,  321,  321,  321,  321,  321,
654       321,  321,  321,  321,  322,  322,  322,  322,  322,  322,
655       322,  322,  322,  352,  352,  352,  352,  352,  352,  352,
656       352,  352,  353,  353,  353,  353,  353,  353,  353,  353,
657       353,  379,  379,  379,  379,  379,  379,  379,  379,  379,
658       405,  405,  405,  405,  405,  405,  405,  405,  405,  406,
659       438,  568,  540,  567,  566,  565,  564,  563,  562,  561,
660       560,  559,  558,  439,  557,  407,  556,  408,  541,   39,
661
662       555,  554,   39,   44,   44,  553,   44,   47,   47,   47,
663        47,   48,   48,   48,   48,  552,  551,  550,  549,  548,
664       547,  546,  545,  544,  543,  542,  539,  538,  537,  536,
665       535,  534,  533,  532,  531,  530,  529,  528,  527,  526,
666       525,  524,  523,  522,  521,  520,  519,  518,  517,  516,
667       515,  514,  513,  512,  511,  510,  509,  508,  507,  506,
668       503,  502,  501,  500,  499,  498,  497,  496,  495,  494,
669       493,  492,  491,  490,  489,  488,  487,  486,  485,  484,
670       483,  482,  481,  480,  479,  478,  477,  476,  475,  474,
671       473,  472,  471,  470,  469,  468,  467,  466,  465,  464,
672
673       463,  462,  459,  458,  457,  456,  455,  454,  453,  452,
674       451,  450,  449,  448,  447,  446,  445,  444,  443,  442,
675       441,  440,  437,  436,  435,  434,  433,  432,  431,  430,
676       429,  428,  427,  426,  425,  424,  423,  422,  421,  420,
677       419,  418,  417,  416,  415,  414,  413,  412,  411,  410,
678       409,  404,  403,  402,  399,  398,  397,  396,  395,  394,
679       390,  387,  386,  385,  384,  383,  380,   50,  378,  377,
680       376,  375,  374,  373,  356,  372,  371,  370,  369,  368,
681       367,  366,  365,  364,  363,  360,  359,  358,  357,  356,
682       355,  354,  351,  350,  349,  348,  347,  346,  345,  344,
683
684       343,  342,  341,  340,  339,  338,  337,  336,  335,  334,
685       333,  332,  331,  330,  329,  328,  327,  326,  325,  324,
686       323,  320,  319,  318,  317,  316,  315,  314,  313,  312,
687       311,  310,  309,  308,  307,  306,  305,  304,  303,  302,
688       301,  300,  299,  298,  289,  288,  287,  286,  285,  284,
689       283,  282,  281,  280,  279,  278,  277,  274,  273,  272,
690       271,  270,  269,  268,  267,  266,  265,  264,  263,  262,
691       261,  260,  259,  258,  257,  256,  255,  239,  254,  253,
692       252,  249,  248,  247,  246,  245,  244,  243,  242,  241,
693       240,  239,  238,  237,  236,  235,  234,  233,  232,  231,
694
695       230,  226,  225,  224,  223,  222,  221,  220,  219,  215,
696       214,  213,  212,  211,  210,  209,  208,  207,  206,  205,
697       204,  203,  202,  201,  200,  197,  196,  195,  194,  193,
698       192,  191,  190,  189,  188,  187,  186,  185,  184,  183,
699       182,  181,  180,  179,  178,  177,  176,  175,  174,  173,
700       172,  171,  170,  169,  164,  163,  162,  161,  160,  159,
701       158,  157,  156,  155,  154,  146,  145,  142,  141,  138,
702       137,  136,  135,  134,  133,  130,  129,  128,  127,  126,
703       125,  124,  123,  122,  121,  118,  117,  116,  111,  108,
704        49,   49,   99,   96,   87,   86,   85,   77,   69,   54,
705
706       586,    3,  586,  586,  586,  586,  586,  586,  586,  586,
707       586,  586,  586,  586,  586,  586,  586,  586,  586,  586,
708       586,  586,  586,  586,  586,  586,  586,  586,  586,  586,
709       586,  586,  586,  586,  586,  586,  586,  586,  586,  586,
710       586,  586,  586,  586,  586,  586,  586,  586,  586,  586,
711       586,  586,  586
712     } ;
713
714 static const flex_int16_t yy_chk[854] =
715     {   0,
716         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
717         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
718         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
719         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
720         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
721         1,    5,    5,    8,   17,    5,    9,    9,   19,    9,
722        15,   15,   19,   17,   22,   23,   19,   23,   26,   26,
723        22,    8,    5,   18,   43,   43,   18,    9,   14,   14,
724        14,   14,   14,   14,   14,   14,   14,   14,   24,   24,
725        18,   20,   20,   20,   20,   27,   24,   20,   28,   27,
726
727        32,   44,   33,   20,   32,   33,   37,   35,   28,   35,
728        52,   52,   40,   40,   28,   33,   40,   33,   33,   44,
729        53,   55,   33,   37,   47,   47,   59,   47,   55,   57,
730        63,   83,   59,   40,   46,   46,   46,   57,  439,   76,
731        63,   53,   76,  439,   90,   47,   46,   46,   46,   46,
732        46,   46,   46,   46,   46,   46,   86,   89,  107,   90,
733        86,   90,  139,   83,  102,  102,   89,  330,  156,  592,
734       363,  330,  156,   89,  363,   89,  591,  139,  156,  107,
735       583,   46,   50,   50,   50,   50,   50,   50,   50,   50,
736        50,   51,   51,   51,   51,   51,   51,   51,   51,   51,
737
738       104,  577,  577,  199,  582,  581,  580,  576,  104,  104,
739       104,  104,  104,  104,  104,  104,  104,  104,  104,  199,
740       104,  104,  104,  104,  104,  104,  105,  105,  105,  105,
741       105,  105,  105,  105,  105,  106,  106,  106,  106,  106,
742       106,  106,  106,  106,  166,  166,  166,  166,  166,  166,
743       166,  166,  166,  166,  575,  574,  166,  166,  166,  166,
744       166,  166,  167,  167,  167,  167,  167,  167,  167,  167,
745       167,  168,  168,  168,  168,  168,  168,  168,  168,  168,
746       227,  357,  365,  373,  484,  573,  571,  365,  570,  569,
747       365,  568,  567,  564,  562,  357,  484,  373,  227,  228,
748
749       228,  228,  228,  228,  228,  228,  228,  228,  229,  229,
750       229,  229,  229,  229,  229,  229,  229,  247,  247,  247,
751       247,  247,  247,  247,  247,  275,  275,  275,  275,  275,
752       275,  275,  275,  275,  276,  276,  276,  276,  276,  276,
753       276,  276,  276,  321,  321,  321,  321,  321,  321,  321,
754       321,  321,  322,  322,  322,  322,  322,  322,  322,  322,
755       322,  352,  352,  352,  352,  352,  352,  352,  352,  352,
756       379,  379,  379,  379,  379,  379,  379,  379,  379,  380,
757       415,  560,  525,  558,  557,  556,  554,  553,  550,  549,
758       548,  547,  546,  415,  545,  380,  543,  380,  525,  587,
759
760       542,  541,  587,  588,  588,  540,  588,  589,  589,  589,
761       589,  590,  590,  590,  590,  539,  538,  537,  534,  533,
762       532,  531,  529,  528,  527,  526,  523,  522,  521,  519,
763       518,  517,  516,  515,  514,  513,  512,  511,  510,  509,
764       508,  507,  506,  505,  504,  503,  502,  501,  498,  497,
765       496,  495,  493,  492,  490,  489,  488,  487,  486,  485,
766       483,  482,  481,  480,  479,  478,  476,  475,  474,  473,
767       472,  471,  470,  469,  468,  467,  466,  465,  464,  463,
768       462,  461,  460,  459,  458,  457,  456,  455,  454,  453,
769       451,  450,  449,  448,  447,  446,  445,  444,  443,  442,
770
771       441,  440,  438,  435,  434,  433,  432,  431,  430,  429,
772       428,  427,  426,  425,  423,  422,  421,  420,  419,  418,
773       417,  416,  414,  413,  412,  410,  409,  408,  407,  406,
774       404,  403,  402,  401,  400,  399,  396,  395,  394,  393,
775       392,  391,  389,  388,  387,  386,  385,  384,  383,  382,
776       381,  378,  376,  374,  372,  371,  370,  368,  367,  366,
777       364,  362,  361,  360,  359,  358,  354,  353,  349,  348,
778       347,  346,  345,  344,  343,  342,  341,  340,  339,  337,
779       336,  335,  333,  332,  331,  329,  328,  327,  326,  325,
780       324,  323,  320,  319,  318,  317,  315,  311,  310,  309,
781
782       308,  307,  306,  305,  304,  303,  301,  300,  299,  298,
783       288,  287,  286,  285,  284,  283,  281,  280,  279,  278,
784       277,  273,  272,  271,  270,  269,  268,  267,  265,  264,
785       263,  262,  261,  260,  258,  257,  255,  254,  253,  252,
786       251,  250,  249,  248,  246,  245,  244,  242,  241,  240,
787       238,  236,  235,  234,  233,  232,  230,  226,  225,  224,
788       222,  221,  220,  219,  218,  217,  216,  215,  214,  213,
789       212,  211,  210,  209,  208,  206,  204,  203,  202,  201,
790       200,  198,  196,  194,  193,  191,  190,  188,  185,  184,
791       183,  182,  179,  178,  177,  174,  173,  172,  171,  170,
792
793       169,  164,  163,  162,  161,  160,  159,  158,  157,  155,
794       154,  153,  152,  151,  150,  149,  148,  147,  146,  145,
795       144,  143,  142,  141,  140,  138,  137,  136,  134,  133,
796       132,  131,  130,  129,  128,  127,  126,  125,  124,  122,
797       121,  120,  119,  118,  117,  116,  115,  114,  113,  112,
798       111,  110,  109,  108,  101,  100,   99,   98,   97,   96,
799        95,   94,   93,   92,   91,   88,   87,   85,   84,   82,
800        81,   80,   79,   78,   77,   75,   73,   72,   71,   70,
801        68,   67,   66,   65,   64,   62,   61,   60,   56,   54,
802        48,   42,   36,   34,   31,   30,   29,   25,   21,   16,
803
804         3,  586,  586,  586,  586,  586,  586,  586,  586,  586,
805       586,  586,  586,  586,  586,  586,  586,  586,  586,  586,
806       586,  586,  586,  586,  586,  586,  586,  586,  586,  586,
807       586,  586,  586,  586,  586,  586,  586,  586,  586,  586,
808       586,  586,  586,  586,  586,  586,  586,  586,  586,  586,
809       586,  586,  586
810     } ;
811
812 static yy_state_type yy_last_accepting_state;
813 static char *yy_last_accepting_cpos;
814
815 extern int yy_flex_debug;
816 int yy_flex_debug = 0;
817
818 /* The intent behind this definition is that it'll catch
819  * any uses of REJECT which flex missed.
820  */
821 #define REJECT reject_used_but_not_detected
822 #define yymore() yymore_used_but_not_detected
823 #define YY_MORE_ADJ 0
824 #define YY_RESTORE_YY_MORE_OFFSET
825 char *yytext;
826 #line 1 "lexer.l"
827 /* userv is
828  * Copyright 1996-2017 Ian Jackson <ian@davenant.greenend.org.uk>.
829  * Copyright 2000      Ben Harris <bjh21@cam.ac.uk>
830  * Copyright 2016-2017 Peter Benie <pjb1008@cam.ac.uk>
831  *
832  * This is free software; you can redistribute it and/or modify it
833  * under the terms of the GNU General Public License as published by
834  * the Free Software Foundation; either version 3 of the License, or
835  * (at your option) any later version.
836  *
837  * This program is distributed in the hope that it will be useful, but
838  * WITHOUT ANY WARRANTY; without even the implied warranty of
839  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
840  * General Public License for more details.
841  *
842  * You should have received a copy of the GNU General Public License
843  * along with userv; if not, see <http://www.gnu.org/licenses/>.
844  */
845 #line 21 "lexer.l"
846
847
848
849
850
851 #include <syslog.h>
852 #include <assert.h>
853 #include <stdio.h>
854 #include <stdarg.h>
855 #include <ctype.h>
856 #include <string.h>
857 #include <unistd.h>
858 #include <pwd.h>
859 #include <grp.h>
860 #include <fnmatch.h>
861 #include <limits.h>
862 #include <dirent.h>
863 #include <sys/types.h>
864 #include <sys/stat.h>
865 #include <time.h>
866 #include <errno.h>
867
868 #include "config.h"
869 #include "common.h"
870 #include "daemon.h"
871 #include "lib.h"
872 #include "both.h"
873 #include "tokens.h"
874
875 #define HYPHEN '-'
876
877 typedef int directive_fnt(int dtoken);
878 static directive_fnt df_reject, df_execute, df_executefrompath;
879 static directive_fnt df_executefromdirectory, df_executebuiltin;
880 static directive_fnt df_errorstostderr, df_errorstosyslog, df_errorstofile;
881 static directive_fnt dfg_fdwant, dfg_setflag, dfg_lookupquotemode;
882 static directive_fnt df_reset, df_cd, df_userrcfile, df_include;
883 static directive_fnt df_includelookup, df_includedirectory;
884 static directive_fnt df_message, df_error, df_quit, df_eof;
885 static directive_fnt df_if, df_catchquit, df_errorspush;
886 static directive_fnt dfi_includeuserrcfile, dfi_includeclientconfig;
887 /* directive functions return:
888  *  0 for success having scanned up to and including end of line but not beyond,
889  *  or tokv_error or tokv_quit.
890  * They expect to parse the whitespace before their parameters (if any).
891  */
892
893 typedef int parmcondition_fnt(int ctoken, char *const *parmvalues, int *rtrue);
894 static parmcondition_fnt pcf_glob, pcf_range, pcf_grep;
895 /* all conditional functions return tokv_error for failure or 0 for success
896  *  at parsing and testing, in which case *rtrue is set to 0 or 1.
897  *  On success they have scanned up to and including the condition's
898  *  terminating newline; the pcf_... functions expect to parse the whitespace
899  *  between the parameter name and the condition's arguments.
900  * Otherwise they return tokv_error.
901  * The parameter-based conditionals take a list of parameter values
902  * as obtained from the parameter functions and pa_parameter,
903  * and do _not_ free it.
904  */
905
906 typedef int parameter_fnt(int ptoken, char ***rvalues);
907 static parameter_fnt pf_service;
908 static parameter_fnt pf_callinguser, pf_serviceuser;
909 static parameter_fnt pf_callinggroup, pf_servicegroup;
910 static parameter_fnt pf_callingusershell, pf_serviceusershell;
911 /* Parameter functions return tokv_error or 0 for success at parsing
912  * and determining the value, in which case *rvalues is made to be
913  * a mallocd null-terminated array of pointers to mallocd strings.
914  * freeparm can be used to free such an array.
915  */
916
917 typedef int builtinserviceparse_fnt(char ***rnewargs);
918 static builtinserviceparse_fnt bispa_none, bispa_parameter;
919 /* These parse the arguments to a builtin service, including the
920  * newline at the end of the line.  *rnewargs will initially be
921  * null, indicating that no arguments are to be set; the function
922  * may store a mallocd array of mallocd strings in it,
923  * containing the arguments it wishes to have set (null-pointer
924  * terminated).
925  */
926
927 static int yylex(void);
928 /* Returns a token (which may be an eof or error exception) */
929
930 static directive_fnt *lr_dir;
931 static parmcondition_fnt *lr_parmcond;
932 static builtinserviceparse_fnt *lr_bispa;
933 static builtinserviceexec_fnt *lr_bisexec;
934 static parameter_fnt *lr_parameter;
935 static int lr_loglevel, lr_logfacility, lr_min, lr_max, *lr_flag;
936 static int lr_flagval, lr_controlend;
937 static int lr_fdwant_readwrite; /* -1=never, 0=opt, 1=always */
938
939 /* Forward declarations of things used in lexer and parser */
940
941 struct parser_state {
942   int lineno, reportlineno, notedreferer, isinternal;
943   const char *filename;
944   struct stat filestab;
945   YY_BUFFER_STATE ybuf;
946   struct parser_state *upstate;
947 };
948
949 static struct parser_state *cstate;
950
951 struct error_handling {
952   int handling; /* One of the error handling modes tokt_ehandlemode */
953   int logfacility, loglevel;
954   int filekeep; /* File is in use by higher-level errors-push, leave it open */
955   FILE *file;
956   char *filename;
957 };
958
959 static struct error_handling eh = { tokv_word_errorstostderr, 0,0,0,0,0 };
960
961 static int dequote(char *inplace);
962 static void countnewlines(void);
963
964 #define YY_NO_INPUT
965
966 #line 967 "<stdout>"
967 #line 968 "<stdout>"
968
969 #define INITIAL 0
970
971 #ifndef YY_NO_UNISTD_H
972 /* Special case for "unistd.h", since it is non-ANSI. We include it way
973  * down here because we want the user's section 1 to have been scanned first.
974  * The user has a chance to override it with an option.
975  */
976 #include <unistd.h>
977 #endif
978
979 #ifndef YY_EXTRA_TYPE
980 #define YY_EXTRA_TYPE void *
981 #endif
982
983 static int yy_init_globals ( void );
984
985 /* Accessor methods to globals.
986    These are made visible to non-reentrant scanners for convenience. */
987
988 int yylex_destroy ( void );
989
990 int yyget_debug ( void );
991
992 void yyset_debug ( int debug_flag  );
993
994 YY_EXTRA_TYPE yyget_extra ( void );
995
996 void yyset_extra ( YY_EXTRA_TYPE user_defined  );
997
998 FILE *yyget_in ( void );
999
1000 void yyset_in  ( FILE * _in_str  );
1001
1002 FILE *yyget_out ( void );
1003
1004 void yyset_out  ( FILE * _out_str  );
1005
1006                         int yyget_leng ( void );
1007
1008 char *yyget_text ( void );
1009
1010 int yyget_lineno ( void );
1011
1012 void yyset_lineno ( int _line_number  );
1013
1014 /* Macros after this point can all be overridden by user definitions in
1015  * section 1.
1016  */
1017
1018 #ifndef YY_SKIP_YYWRAP
1019 #ifdef __cplusplus
1020 extern "C" int yywrap ( void );
1021 #else
1022 extern int yywrap ( void );
1023 #endif
1024 #endif
1025
1026 #ifndef YY_NO_UNPUT
1027     
1028 #endif
1029
1030 #ifndef yytext_ptr
1031 static void yy_flex_strncpy ( char *, const char *, int );
1032 #endif
1033
1034 #ifdef YY_NEED_STRLEN
1035 static int yy_flex_strlen ( const char * );
1036 #endif
1037
1038 #ifndef YY_NO_INPUT
1039 #ifdef __cplusplus
1040 static int yyinput ( void );
1041 #else
1042 static int input ( void );
1043 #endif
1044
1045 #endif
1046
1047 /* Amount of stuff to slurp up with each read. */
1048 #ifndef YY_READ_BUF_SIZE
1049 #ifdef __ia64__
1050 /* On IA-64, the buffer size is 16k, not 8k */
1051 #define YY_READ_BUF_SIZE 16384
1052 #else
1053 #define YY_READ_BUF_SIZE 8192
1054 #endif /* __ia64__ */
1055 #endif
1056
1057 /* Copy whatever the last rule matched to the standard output. */
1058 #ifndef ECHO
1059 /* This used to be an fputs(), but since the string might contain NUL's,
1060  * we now use fwrite().
1061  */
1062 #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
1063 #endif
1064
1065 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
1066  * is returned in "result".
1067  */
1068 #ifndef YY_INPUT
1069 #define YY_INPUT(buf,result,max_size) \
1070         if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
1071                 { \
1072                 int c = '*'; \
1073                 int n; \
1074                 for ( n = 0; n < max_size && \
1075                              (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
1076                         buf[n] = (char) c; \
1077                 if ( c == '\n' ) \
1078                         buf[n++] = (char) c; \
1079                 if ( c == EOF && ferror( yyin ) ) \
1080                         YY_FATAL_ERROR( "input in flex scanner failed" ); \
1081                 result = n; \
1082                 } \
1083         else \
1084                 { \
1085                 errno=0; \
1086                 while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
1087                         { \
1088                         if( errno != EINTR) \
1089                                 { \
1090                                 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1091                                 break; \
1092                                 } \
1093                         errno=0; \
1094                         clearerr(yyin); \
1095                         } \
1096                 }\
1097 \
1098
1099 #endif
1100
1101 /* No semi-colon after return; correct usage is to write "yyterminate();" -
1102  * we don't want an extra ';' after the "return" because that will cause
1103  * some compilers to complain about unreachable statements.
1104  */
1105 #ifndef yyterminate
1106 #define yyterminate() return YY_NULL
1107 #endif
1108
1109 /* Number of entries by which start-condition stack grows. */
1110 #ifndef YY_START_STACK_INCR
1111 #define YY_START_STACK_INCR 25
1112 #endif
1113
1114 /* Report a fatal error. */
1115 #ifndef YY_FATAL_ERROR
1116 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
1117 #endif
1118
1119 /* end tables serialization structures and prototypes */
1120
1121 /* Default declaration of generated scanner - a define so the user can
1122  * easily add parameters.
1123  */
1124 #ifndef YY_DECL
1125 #define YY_DECL_IS_OURS 1
1126
1127 extern int yylex (void);
1128
1129 #define YY_DECL int yylex (void)
1130 #endif /* !YY_DECL */
1131
1132 /* Code executed at the beginning of each rule, after yytext and yyleng
1133  * have been set up.
1134  */
1135 #ifndef YY_USER_ACTION
1136 #define YY_USER_ACTION
1137 #endif
1138
1139 /* Code executed at the end of each rule. */
1140 #ifndef YY_BREAK
1141 #define YY_BREAK /*LINTED*/break;
1142 #endif
1143
1144 #define YY_RULE_SETUP \
1145         YY_USER_ACTION
1146
1147 /** The main scanner function which does all the work.
1148  */
1149 YY_DECL
1150 {
1151         yy_state_type yy_current_state;
1152         char *yy_cp, *yy_bp;
1153         int yy_act;
1154     
1155         if ( !(yy_init) )
1156                 {
1157                 (yy_init) = 1;
1158
1159 #ifdef YY_USER_INIT
1160                 YY_USER_INIT;
1161 #endif
1162
1163                 if ( ! (yy_start) )
1164                         (yy_start) = 1; /* first start state */
1165
1166                 if ( ! yyin )
1167                         yyin = stdin;
1168
1169                 if ( ! yyout )
1170                         yyout = stdout;
1171
1172                 if ( ! YY_CURRENT_BUFFER ) {
1173                         yyensure_buffer_stack ();
1174                         YY_CURRENT_BUFFER_LVALUE =
1175                                 yy_create_buffer( yyin, YY_BUF_SIZE );
1176                 }
1177
1178                 yy_load_buffer_state(  );
1179                 }
1180
1181         {
1182 #line 146 "lexer.l"
1183
1184
1185 #line 1186 "<stdout>"
1186
1187         while ( /*CONSTCOND*/1 )                /* loops until end-of-file is reached */
1188                 {
1189                 yy_cp = (yy_c_buf_p);
1190
1191                 /* Support of yytext. */
1192                 *yy_cp = (yy_hold_char);
1193
1194                 /* yy_bp points to the position in yy_ch_buf of the start of
1195                  * the current run.
1196                  */
1197                 yy_bp = yy_cp;
1198
1199                 yy_current_state = (yy_start);
1200 yy_match:
1201                 do
1202                         {
1203                         YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
1204                         if ( yy_accept[yy_current_state] )
1205                                 {
1206                                 (yy_last_accepting_state) = yy_current_state;
1207                                 (yy_last_accepting_cpos) = yy_cp;
1208                                 }
1209                         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1210                                 {
1211                                 yy_current_state = (int) yy_def[yy_current_state];
1212                                 if ( yy_current_state >= 587 )
1213                                         yy_c = yy_meta[yy_c];
1214                                 }
1215                         yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1216                         ++yy_cp;
1217                         }
1218                 while ( yy_base[yy_current_state] != 802 );
1219
1220 yy_find_action:
1221                 yy_act = yy_accept[yy_current_state];
1222                 if ( yy_act == 0 )
1223                         { /* have to back up */
1224                         yy_cp = (yy_last_accepting_cpos);
1225                         yy_current_state = (yy_last_accepting_state);
1226                         yy_act = yy_accept[yy_current_state];
1227                         }
1228
1229                 YY_DO_BEFORE_ACTION;
1230
1231 do_action:      /* This label is used only to access EOF actions. */
1232
1233                 switch ( yy_act )
1234         { /* beginning of action switch */
1235                         case 0: /* must back up */
1236                         /* undo the effects of YY_DO_BEFORE_ACTION */
1237                         *yy_cp = (yy_hold_char);
1238                         yy_cp = (yy_last_accepting_cpos);
1239                         yy_current_state = (yy_last_accepting_state);
1240                         goto yy_find_action;
1241
1242 case 1:
1243 YY_RULE_SETUP
1244 #line 148 "lexer.l"
1245 { lr_dir= df_reject; return tokv_word_reject; }
1246         YY_BREAK
1247 case 2:
1248 YY_RULE_SETUP
1249 #line 149 "lexer.l"
1250 { lr_dir= df_executefromdirectory; return tokv_word_executefromdirectory; }
1251         YY_BREAK
1252 case 3:
1253 YY_RULE_SETUP
1254 #line 150 "lexer.l"
1255 { lr_dir= df_executefrompath; return tokv_word_executefrompath; }
1256         YY_BREAK
1257 case 4:
1258 YY_RULE_SETUP
1259 #line 151 "lexer.l"
1260 { lr_dir= df_executebuiltin; return tokv_word_executebuiltin; }
1261         YY_BREAK
1262 case 5:
1263 YY_RULE_SETUP
1264 #line 152 "lexer.l"
1265 { lr_dir= df_errorstostderr; return tokv_word_errorstostderr; }
1266         YY_BREAK
1267 case 6:
1268 YY_RULE_SETUP
1269 #line 153 "lexer.l"
1270 { lr_dir= df_errorstosyslog; return tokv_word_errorstosyslog; }
1271         YY_BREAK
1272 case 7:
1273 YY_RULE_SETUP
1274 #line 154 "lexer.l"
1275 { lr_dir= df_errorstofile; return tokv_word_errorstofile; }
1276         YY_BREAK
1277 case 8:
1278 YY_RULE_SETUP
1279 #line 155 "lexer.l"
1280 { lr_dir= dfg_lookupquotemode; return tokv_word_includelookupquoteold; }
1281         YY_BREAK
1282 case 9:
1283 YY_RULE_SETUP
1284 #line 156 "lexer.l"
1285 { lr_dir= dfg_lookupquotemode; return tokv_word_includelookupquotenew; }
1286         YY_BREAK
1287 case 10:
1288 YY_RULE_SETUP
1289 #line 157 "lexer.l"
1290 { lr_dir= dfg_fdwant; lr_fdwant_readwrite=1; return tokv_word_requirefd; }
1291         YY_BREAK
1292 case 11:
1293 YY_RULE_SETUP
1294 #line 158 "lexer.l"
1295 { lr_dir= dfg_fdwant; lr_fdwant_readwrite=0; return tokv_word_allowfd; }
1296         YY_BREAK
1297 case 12:
1298 YY_RULE_SETUP
1299 #line 159 "lexer.l"
1300 { lr_dir= dfg_fdwant; lr_fdwant_readwrite=0; return tokv_word_nullfd; }
1301         YY_BREAK
1302 case 13:
1303 YY_RULE_SETUP
1304 #line 160 "lexer.l"
1305 { lr_dir= dfg_fdwant; lr_fdwant_readwrite=-1; return tokv_word_rejectfd; }
1306         YY_BREAK
1307 case 14:
1308 YY_RULE_SETUP
1309 #line 161 "lexer.l"
1310 { lr_dir= dfg_fdwant; lr_fdwant_readwrite=-1; return tokv_word_ignorefd; }
1311         YY_BREAK
1312 case 15:
1313 YY_RULE_SETUP
1314 #line 162 "lexer.l"
1315 { lr_dir= dfg_setflag; lr_flag= &setenvironment; lr_flagval= 1; return tokv_word_setenvironment; }
1316         YY_BREAK
1317 case 16:
1318 YY_RULE_SETUP
1319 #line 163 "lexer.l"
1320 { lr_dir= dfg_setflag; lr_flag= &setenvironment; lr_flagval= 0; return tokv_word_nosetenvironment; }
1321         YY_BREAK
1322 case 17:
1323 YY_RULE_SETUP
1324 #line 164 "lexer.l"
1325 { lr_dir= dfg_setflag; lr_flag= &suppressargs; lr_flagval= 1; return tokv_word_suppressargs; }
1326         YY_BREAK
1327 case 18:
1328 YY_RULE_SETUP
1329 #line 165 "lexer.l"
1330 { lr_dir= dfg_setflag; lr_flag= &suppressargs; lr_flagval= 0; return tokv_word_nosuppressargs; }
1331         YY_BREAK
1332 case 19:
1333 YY_RULE_SETUP
1334 #line 166 "lexer.l"
1335 { lr_dir= dfg_setflag; lr_flag= &disconnecthup; lr_flagval= 1; return tokv_word_disconnecthup; }
1336         YY_BREAK
1337 case 20:
1338 YY_RULE_SETUP
1339 #line 167 "lexer.l"
1340 { lr_dir= dfg_setflag; lr_flag= &disconnecthup; lr_flagval= 0; return tokv_word_nodisconnecthup; }
1341         YY_BREAK
1342 case 21:
1343 YY_RULE_SETUP
1344 #line 168 "lexer.l"
1345 { lr_dir= df_cd; return tokv_word_cd; }
1346         YY_BREAK
1347 case 22:
1348 YY_RULE_SETUP
1349 #line 169 "lexer.l"
1350 { lr_dir= df_userrcfile; return tokv_word_userrcfile; }
1351         YY_BREAK
1352 case 23:
1353 YY_RULE_SETUP
1354 #line 170 "lexer.l"
1355 { lr_dir= df_include; return tokv_word_include; }
1356         YY_BREAK
1357 case 24:
1358 YY_RULE_SETUP
1359 #line 171 "lexer.l"
1360 { lr_dir= df_include; return tokv_word_includeifexist; }
1361         YY_BREAK
1362 case 25:
1363 YY_RULE_SETUP
1364 #line 172 "lexer.l"
1365 { lr_dir= df_includelookup; return tokv_word_includelookup; }
1366         YY_BREAK
1367 case 26:
1368 YY_RULE_SETUP
1369 #line 173 "lexer.l"
1370 { lr_dir= df_includelookup; return tokv_word_includelookupall; }
1371         YY_BREAK
1372 case 27:
1373 YY_RULE_SETUP
1374 #line 174 "lexer.l"
1375 { lr_dir= df_includedirectory; return tokv_word_includedirectory; }
1376         YY_BREAK
1377 case 28:
1378 YY_RULE_SETUP
1379 #line 175 "lexer.l"
1380 { lr_dir= df_message; return tokv_word_message; }
1381         YY_BREAK
1382 case 29:
1383 YY_RULE_SETUP
1384 #line 176 "lexer.l"
1385 { lr_dir= df_include; return tokv_word_includesysconfig; }
1386         YY_BREAK
1387 case 30:
1388 YY_RULE_SETUP
1389 #line 177 "lexer.l"
1390 { lr_dir= dfi_includeuserrcfile; return tokv_word_includeuserrcfile; }
1391         YY_BREAK
1392 case 31:
1393 YY_RULE_SETUP
1394 #line 178 "lexer.l"
1395 { lr_dir= dfi_includeclientconfig; return tokv_word_includeclientconfig; }
1396         YY_BREAK
1397 case 32:
1398 YY_RULE_SETUP
1399 #line 179 "lexer.l"
1400 { lr_dir= df_quit; return tokv_word_quit; }
1401         YY_BREAK
1402 case 33:
1403 YY_RULE_SETUP
1404 #line 180 "lexer.l"
1405 { lr_dir= df_eof; return tokv_word_eof; }
1406         YY_BREAK
1407 case 34:
1408 YY_RULE_SETUP
1409 #line 181 "lexer.l"
1410 { lr_dir= df_if; return tokv_word_if; }
1411         YY_BREAK
1412 case 35:
1413 YY_RULE_SETUP
1414 #line 182 "lexer.l"
1415 { lr_dir= df_catchquit; return tokv_word_catchquit; }
1416         YY_BREAK
1417 case 36:
1418 YY_RULE_SETUP
1419 #line 183 "lexer.l"
1420 { lr_dir= df_errorspush; return tokv_word_errorspush; }
1421         YY_BREAK
1422 case 37:
1423 YY_RULE_SETUP
1424 #line 184 "lexer.l"
1425 { lr_controlend= tokv_word_if; return tokv_word_elif; }
1426         YY_BREAK
1427 case 38:
1428 YY_RULE_SETUP
1429 #line 185 "lexer.l"
1430 { lr_controlend= tokv_word_if; return tokv_word_else; }
1431         YY_BREAK
1432 case 39:
1433 YY_RULE_SETUP
1434 #line 186 "lexer.l"
1435 { lr_controlend= tokv_word_if; return tokv_word_fi; }
1436         YY_BREAK
1437 case 40:
1438 YY_RULE_SETUP
1439 #line 187 "lexer.l"
1440 { lr_controlend= tokv_word_catchquit; return tokv_word_hctac; }
1441         YY_BREAK
1442 case 41:
1443 YY_RULE_SETUP
1444 #line 188 "lexer.l"
1445 { lr_controlend= tokv_word_errorspush; return tokv_word_srorre; }
1446         YY_BREAK
1447 case 42:
1448 YY_RULE_SETUP
1449 #line 189 "lexer.l"
1450 { lr_parmcond= pcf_glob; return tokv_word_glob; }
1451         YY_BREAK
1452 case 43:
1453 YY_RULE_SETUP
1454 #line 190 "lexer.l"
1455 { lr_parmcond= pcf_range; return tokv_word_range; }
1456         YY_BREAK
1457 case 44:
1458 YY_RULE_SETUP
1459 #line 191 "lexer.l"
1460 { lr_parmcond= pcf_grep; return tokv_word_grep; }
1461         YY_BREAK
1462 case 45:
1463 YY_RULE_SETUP
1464 #line 192 "lexer.l"
1465 { lr_bispa= bispa_none; lr_bisexec= bisexec_environment; return tokv_word_environment; }
1466         YY_BREAK
1467 case 46:
1468 YY_RULE_SETUP
1469 #line 193 "lexer.l"
1470 { lr_bispa= bispa_parameter; lr_bisexec= bisexec_parameter; return tokv_word_parameter; }
1471         YY_BREAK
1472 case 47:
1473 YY_RULE_SETUP
1474 #line 194 "lexer.l"
1475 { lr_bispa= bispa_none; lr_bisexec= bisexec_version; return tokv_word_version; }
1476         YY_BREAK
1477 case 48:
1478 YY_RULE_SETUP
1479 #line 195 "lexer.l"
1480 { lr_bispa= bispa_none; lr_bisexec= bisexec_toplevel; return tokv_word_toplevel; }
1481         YY_BREAK
1482 case 49:
1483 YY_RULE_SETUP
1484 #line 196 "lexer.l"
1485 { lr_bispa= bispa_none; lr_bisexec= bisexec_override; return tokv_word_override; }
1486         YY_BREAK
1487 case 50:
1488 YY_RULE_SETUP
1489 #line 197 "lexer.l"
1490 { lr_bispa= bispa_none; lr_bisexec= bisexec_shutdown; return tokv_word_shutdown; }
1491         YY_BREAK
1492 case 51:
1493 YY_RULE_SETUP
1494 #line 198 "lexer.l"
1495 { lr_bispa= bispa_none; lr_bisexec= bisexec_reset; lr_dir= df_reset; return tokv_word_reset; }
1496         YY_BREAK
1497 case 52:
1498 YY_RULE_SETUP
1499 #line 199 "lexer.l"
1500 { lr_bispa= bispa_none; lr_bisexec= bisexec_execute; lr_dir= df_execute; return tokv_word_execute; }
1501         YY_BREAK
1502 case 53:
1503 YY_RULE_SETUP
1504 #line 200 "lexer.l"
1505 { lr_bispa= bispa_none; lr_bisexec= bisexec_help; return tokv_word_help; }
1506         YY_BREAK
1507 case 54:
1508 YY_RULE_SETUP
1509 #line 201 "lexer.l"
1510 { lr_parameter= pf_service; return tokv_word_service; }
1511         YY_BREAK
1512 case 55:
1513 YY_RULE_SETUP
1514 #line 202 "lexer.l"
1515 { lr_parameter= pf_callinguser; return tokv_word_callinguser; }
1516         YY_BREAK
1517 case 56:
1518 YY_RULE_SETUP
1519 #line 203 "lexer.l"
1520 { lr_parameter= pf_callinggroup; return tokv_word_callinggroup; }
1521         YY_BREAK
1522 case 57:
1523 YY_RULE_SETUP
1524 #line 204 "lexer.l"
1525 { lr_parameter= pf_callingusershell; return tokv_word_callingusershell; }
1526         YY_BREAK
1527 case 58:
1528 YY_RULE_SETUP
1529 #line 205 "lexer.l"
1530 { lr_parameter= pf_serviceuser; return tokv_word_serviceuser; }
1531         YY_BREAK
1532 case 59:
1533 YY_RULE_SETUP
1534 #line 206 "lexer.l"
1535 { lr_parameter= pf_servicegroup; return tokv_word_servicegroup; }
1536         YY_BREAK
1537 case 60:
1538 YY_RULE_SETUP
1539 #line 207 "lexer.l"
1540 { lr_parameter= pf_serviceusershell; return tokv_word_serviceusershell; }
1541         YY_BREAK
1542 case 61:
1543 YY_RULE_SETUP
1544 #line 208 "lexer.l"
1545 { lr_loglevel= LOG_DEBUG; return tokv_syslog_debug; }
1546         YY_BREAK
1547 case 62:
1548 YY_RULE_SETUP
1549 #line 209 "lexer.l"
1550 { lr_loglevel= LOG_INFO; return tokv_syslog_info; }
1551         YY_BREAK
1552 case 63:
1553 YY_RULE_SETUP
1554 #line 210 "lexer.l"
1555 { lr_loglevel= LOG_NOTICE; return tokv_syslog_notice; }
1556         YY_BREAK
1557 case 64:
1558 YY_RULE_SETUP
1559 #line 211 "lexer.l"
1560 { lr_loglevel= LOG_WARNING; return tokv_syslog_warning; }
1561         YY_BREAK
1562 case 65:
1563 YY_RULE_SETUP
1564 #line 212 "lexer.l"
1565 { lr_loglevel= LOG_ERR; return tokv_syslog_err; }
1566         YY_BREAK
1567 case 66:
1568 YY_RULE_SETUP
1569 #line 213 "lexer.l"
1570 { lr_loglevel= LOG_CRIT; return tokv_syslog_crit; }
1571         YY_BREAK
1572 case 67:
1573 YY_RULE_SETUP
1574 #line 214 "lexer.l"
1575 { lr_loglevel= LOG_ALERT; return tokv_syslog_alert; }
1576         YY_BREAK
1577 case 68:
1578 YY_RULE_SETUP
1579 #line 215 "lexer.l"
1580 { lr_loglevel= LOG_EMERG; return tokv_syslog_emerg; }
1581         YY_BREAK
1582 case 69:
1583 YY_RULE_SETUP
1584 #line 216 "lexer.l"
1585 { lr_logfacility= LOG_AUTHPRIV; return tokv_syslog_authpriv; }
1586         YY_BREAK
1587 case 70:
1588 YY_RULE_SETUP
1589 #line 217 "lexer.l"
1590 { lr_logfacility= LOG_CRON; return tokv_syslog_cron; }
1591         YY_BREAK
1592 case 71:
1593 YY_RULE_SETUP
1594 #line 218 "lexer.l"
1595 { lr_logfacility= LOG_DAEMON; return tokv_syslog_daemon; }
1596         YY_BREAK
1597 case 72:
1598 YY_RULE_SETUP
1599 #line 219 "lexer.l"
1600 { lr_logfacility= LOG_KERN; return tokv_syslog_kern; }
1601         YY_BREAK
1602 case 73:
1603 YY_RULE_SETUP
1604 #line 220 "lexer.l"
1605 { lr_logfacility= LOG_LPR; return tokv_syslog_lpr; }
1606         YY_BREAK
1607 case 74:
1608 YY_RULE_SETUP
1609 #line 221 "lexer.l"
1610 { lr_logfacility= LOG_MAIL; return tokv_syslog_mail; }
1611         YY_BREAK
1612 case 75:
1613 YY_RULE_SETUP
1614 #line 222 "lexer.l"
1615 { lr_logfacility= LOG_NEWS; return tokv_syslog_news; }
1616         YY_BREAK
1617 case 76:
1618 YY_RULE_SETUP
1619 #line 223 "lexer.l"
1620 { lr_logfacility= LOG_SYSLOG; return tokv_syslog_syslog; }
1621         YY_BREAK
1622 case 77:
1623 YY_RULE_SETUP
1624 #line 224 "lexer.l"
1625 { lr_logfacility= LOG_USER; return tokv_syslog_user; }
1626         YY_BREAK
1627 case 78:
1628 YY_RULE_SETUP
1629 #line 225 "lexer.l"
1630 { lr_logfacility= LOG_UUCP; return tokv_syslog_uucp; }
1631         YY_BREAK
1632 case 79:
1633 YY_RULE_SETUP
1634 #line 226 "lexer.l"
1635 { lr_logfacility= LOG_LOCAL0; return tokv_syslog_local0; }
1636         YY_BREAK
1637 case 80:
1638 YY_RULE_SETUP
1639 #line 227 "lexer.l"
1640 { lr_logfacility= LOG_LOCAL1; return tokv_syslog_local1; }
1641         YY_BREAK
1642 case 81:
1643 YY_RULE_SETUP
1644 #line 228 "lexer.l"
1645 { lr_logfacility= LOG_LOCAL2; return tokv_syslog_local2; }
1646         YY_BREAK
1647 case 82:
1648 YY_RULE_SETUP
1649 #line 229 "lexer.l"
1650 { lr_logfacility= LOG_LOCAL3; return tokv_syslog_local3; }
1651         YY_BREAK
1652 case 83:
1653 YY_RULE_SETUP
1654 #line 230 "lexer.l"
1655 { lr_logfacility= LOG_LOCAL4; return tokv_syslog_local4; }
1656         YY_BREAK
1657 case 84:
1658 YY_RULE_SETUP
1659 #line 231 "lexer.l"
1660 { lr_logfacility= LOG_LOCAL5; return tokv_syslog_local5; }
1661         YY_BREAK
1662 case 85:
1663 YY_RULE_SETUP
1664 #line 232 "lexer.l"
1665 { lr_logfacility= LOG_LOCAL6; return tokv_syslog_local6; }
1666         YY_BREAK
1667 case 86:
1668 YY_RULE_SETUP
1669 #line 233 "lexer.l"
1670 { lr_logfacility= LOG_LOCAL7; return tokv_syslog_local7; }
1671         YY_BREAK
1672 case 87:
1673 YY_RULE_SETUP
1674 #line 234 "lexer.l"
1675 { return tokv_word_read; }
1676         YY_BREAK
1677 case 88:
1678 YY_RULE_SETUP
1679 #line 235 "lexer.l"
1680 { return tokv_word_write; }
1681         YY_BREAK
1682 case 89:
1683 YY_RULE_SETUP
1684 #line 236 "lexer.l"
1685 { return tokv_dollar; }
1686         YY_BREAK
1687 case 90:
1688 YY_RULE_SETUP
1689 #line 237 "lexer.l"
1690 {  lr_max= lr_min= 0; return tokv_word_stdin; }
1691         YY_BREAK
1692 case 91:
1693 YY_RULE_SETUP
1694 #line 238 "lexer.l"
1695 {  lr_max= lr_min= 1; return tokv_word_stdout; }
1696         YY_BREAK
1697 case 92:
1698 YY_RULE_SETUP
1699 #line 239 "lexer.l"
1700 {  lr_max= lr_min= 2; return tokv_word_stderr; }
1701         YY_BREAK
1702 case 93:
1703 YY_RULE_SETUP
1704 #line 240 "lexer.l"
1705 { return tokv_openparen; }
1706         YY_BREAK
1707 case 94:
1708 YY_RULE_SETUP
1709 #line 241 "lexer.l"
1710 { return tokv_closeparen; }
1711         YY_BREAK
1712 case 95:
1713 YY_RULE_SETUP
1714 #line 242 "lexer.l"
1715 { return tokv_not; }
1716         YY_BREAK
1717 case 96:
1718 YY_RULE_SETUP
1719 #line 243 "lexer.l"
1720 { return tokv_and; }
1721         YY_BREAK
1722 case 97:
1723 YY_RULE_SETUP
1724 #line 244 "lexer.l"
1725 { return tokv_or; }
1726         YY_BREAK
1727 case 98:
1728 YY_RULE_SETUP
1729 #line 245 "lexer.l"
1730 { lr_dir= df_error; lr_loglevel= LOG_ERR; return tokv_word_error; }
1731         YY_BREAK
1732 case 99:
1733 YY_RULE_SETUP
1734 #line 249 "lexer.l"
1735 {
1736                           char *ep;
1737                           lr_min=lr_max= (int)strtoul(yytext,&ep,10);
1738                           assert(!*ep);
1739                           return tokv_ordinal;
1740                         }
1741         YY_BREAK
1742 case 100:
1743 YY_RULE_SETUP
1744 #line 255 "lexer.l"
1745 {
1746                           char *ep;
1747                           lr_min= (int)strtoul(yytext,&ep,10);
1748                           assert(*ep == HYPHEN);
1749                           ep++;  assert(*ep);
1750                           lr_max= (int)strtoul(ep,&ep,10);
1751                           assert(!*ep);
1752                           if (lr_max < lr_min)
1753                             return parseerrprint("fd range has min > max");
1754                           return tokv_fdrange;
1755                         }
1756         YY_BREAK
1757 case 101:
1758 YY_RULE_SETUP
1759 #line 266 "lexer.l"
1760 {
1761                           char *ep;
1762                           lr_min= (int)strtoul(yytext,&ep,10);
1763                           assert(*ep == HYPHEN);
1764                           ep++;  assert(!*ep);
1765                           lr_max=-1;
1766                           return tokv_fdstoend;
1767                         }
1768         YY_BREAK
1769 case 102:
1770 /* rule 102 can match eol */
1771 YY_RULE_SETUP
1772 #line 274 "lexer.l"
1773 countnewlines(); return tokv_lwsp;
1774         YY_BREAK
1775 case 103:
1776 YY_RULE_SETUP
1777 #line 275 "lexer.l"
1778 return tokv_lwsp;
1779         YY_BREAK
1780 case 104:
1781 /* rule 104 can match eol */
1782 YY_RULE_SETUP
1783 #line 276 "lexer.l"
1784 cstate->lineno++; return tokv_newline;
1785         YY_BREAK
1786 case 105:
1787 /* rule 105 can match eol */
1788 YY_RULE_SETUP
1789 #line 277 "lexer.l"
1790 cstate->lineno++; return tokv_newline;
1791         YY_BREAK
1792 case 106:
1793 YY_RULE_SETUP
1794 #line 278 "lexer.l"
1795 return parseerrprint("missing newline at eof after comment");
1796         YY_BREAK
1797 case 107:
1798 /* rule 107 can match eol */
1799 YY_RULE_SETUP
1800 #line 279 "lexer.l"
1801 {
1802                           countnewlines();
1803                           return dequote(yytext);
1804                         }
1805         YY_BREAK
1806 case 108:
1807 YY_RULE_SETUP
1808 #line 283 "lexer.l"
1809 return tokv_barestring;
1810         YY_BREAK
1811 case YY_STATE_EOF(INITIAL):
1812 #line 284 "lexer.l"
1813 return tokv_eof;
1814         YY_BREAK
1815 case 109:
1816 YY_RULE_SETUP
1817 #line 285 "lexer.l"
1818 return parseerrprint("misquoted or unterminated string");
1819         YY_BREAK
1820 case 110:
1821 YY_RULE_SETUP
1822 #line 286 "lexer.l"
1823 return parseerrprint("unexpected backslash");
1824         YY_BREAK
1825 case 111:
1826 YY_RULE_SETUP
1827 #line 287 "lexer.l"
1828 abort(); /* expect lex warning "rule cannot be matched" */
1829         YY_BREAK
1830 case 112:
1831 YY_RULE_SETUP
1832 #line 290 "lexer.l"
1833 ECHO;
1834         YY_BREAK
1835 #line 1836 "<stdout>"
1836
1837         case YY_END_OF_BUFFER:
1838                 {
1839                 /* Amount of text matched not including the EOB char. */
1840                 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1841
1842                 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1843                 *yy_cp = (yy_hold_char);
1844                 YY_RESTORE_YY_MORE_OFFSET
1845
1846                 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1847                         {
1848                         /* We're scanning a new file or input source.  It's
1849                          * possible that this happened because the user
1850                          * just pointed yyin at a new source and called
1851                          * yylex().  If so, then we have to assure
1852                          * consistency between YY_CURRENT_BUFFER and our
1853                          * globals.  Here is the right place to do so, because
1854                          * this is the first action (other than possibly a
1855                          * back-up) that will match for the new input source.
1856                          */
1857                         (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1858                         YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1859                         YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1860                         }
1861
1862                 /* Note that here we test for yy_c_buf_p "<=" to the position
1863                  * of the first EOB in the buffer, since yy_c_buf_p will
1864                  * already have been incremented past the NUL character
1865                  * (since all states make transitions on EOB to the
1866                  * end-of-buffer state).  Contrast this with the test
1867                  * in input().
1868                  */
1869                 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1870                         { /* This was really a NUL. */
1871                         yy_state_type yy_next_state;
1872
1873                         (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1874
1875                         yy_current_state = yy_get_previous_state(  );
1876
1877                         /* Okay, we're now positioned to make the NUL
1878                          * transition.  We couldn't have
1879                          * yy_get_previous_state() go ahead and do it
1880                          * for us because it doesn't know how to deal
1881                          * with the possibility of jamming (and we don't
1882                          * want to build jamming into it because then it
1883                          * will run more slowly).
1884                          */
1885
1886                         yy_next_state = yy_try_NUL_trans( yy_current_state );
1887
1888                         yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1889
1890                         if ( yy_next_state )
1891                                 {
1892                                 /* Consume the NUL. */
1893                                 yy_cp = ++(yy_c_buf_p);
1894                                 yy_current_state = yy_next_state;
1895                                 goto yy_match;
1896                                 }
1897
1898                         else
1899                                 {
1900                                 yy_cp = (yy_c_buf_p);
1901                                 goto yy_find_action;
1902                                 }
1903                         }
1904
1905                 else switch ( yy_get_next_buffer(  ) )
1906                         {
1907                         case EOB_ACT_END_OF_FILE:
1908                                 {
1909                                 (yy_did_buffer_switch_on_eof) = 0;
1910
1911                                 if ( yywrap(  ) )
1912                                         {
1913                                         /* Note: because we've taken care in
1914                                          * yy_get_next_buffer() to have set up
1915                                          * yytext, we can now set up
1916                                          * yy_c_buf_p so that if some total
1917                                          * hoser (like flex itself) wants to
1918                                          * call the scanner after we return the
1919                                          * YY_NULL, it'll still work - another
1920                                          * YY_NULL will get returned.
1921                                          */
1922                                         (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1923
1924                                         yy_act = YY_STATE_EOF(YY_START);
1925                                         goto do_action;
1926                                         }
1927
1928                                 else
1929                                         {
1930                                         if ( ! (yy_did_buffer_switch_on_eof) )
1931                                                 YY_NEW_FILE;
1932                                         }
1933                                 break;
1934                                 }
1935
1936                         case EOB_ACT_CONTINUE_SCAN:
1937                                 (yy_c_buf_p) =
1938                                         (yytext_ptr) + yy_amount_of_matched_text;
1939
1940                                 yy_current_state = yy_get_previous_state(  );
1941
1942                                 yy_cp = (yy_c_buf_p);
1943                                 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1944                                 goto yy_match;
1945
1946                         case EOB_ACT_LAST_MATCH:
1947                                 (yy_c_buf_p) =
1948                                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1949
1950                                 yy_current_state = yy_get_previous_state(  );
1951
1952                                 yy_cp = (yy_c_buf_p);
1953                                 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1954                                 goto yy_find_action;
1955                         }
1956                 break;
1957                 }
1958
1959         default:
1960                 YY_FATAL_ERROR(
1961                         "fatal flex scanner internal error--no action found" );
1962         } /* end of action switch */
1963                 } /* end of scanning one token */
1964         } /* end of user's declarations */
1965 } /* end of yylex */
1966
1967 /* yy_get_next_buffer - try to read in a new buffer
1968  *
1969  * Returns a code representing an action:
1970  *      EOB_ACT_LAST_MATCH -
1971  *      EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1972  *      EOB_ACT_END_OF_FILE - end of file
1973  */
1974 static int yy_get_next_buffer (void)
1975 {
1976         char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1977         char *source = (yytext_ptr);
1978         int number_to_move, i;
1979         int ret_val;
1980
1981         if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1982                 YY_FATAL_ERROR(
1983                 "fatal flex scanner internal error--end of buffer missed" );
1984
1985         if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1986                 { /* Don't try to fill the buffer, so this is an EOF. */
1987                 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1988                         {
1989                         /* We matched a single character, the EOB, so
1990                          * treat this as a final EOF.
1991                          */
1992                         return EOB_ACT_END_OF_FILE;
1993                         }
1994
1995                 else
1996                         {
1997                         /* We matched some text prior to the EOB, first
1998                          * process it.
1999                          */
2000                         return EOB_ACT_LAST_MATCH;
2001                         }
2002                 }
2003
2004         /* Try to read more data. */
2005
2006         /* First move last chars to start of buffer. */
2007         number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1);
2008
2009         for ( i = 0; i < number_to_move; ++i )
2010                 *(dest++) = *(source++);
2011
2012         if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
2013                 /* don't do the read, it's not guaranteed to return an EOF,
2014                  * just force an EOF
2015                  */
2016                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
2017
2018         else
2019                 {
2020                         int num_to_read =
2021                         YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
2022
2023                 while ( num_to_read <= 0 )
2024                         { /* Not enough room in the buffer - grow it. */
2025
2026                         /* just a shorter name for the current buffer */
2027                         YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
2028
2029                         int yy_c_buf_p_offset =
2030                                 (int) ((yy_c_buf_p) - b->yy_ch_buf);
2031
2032                         if ( b->yy_is_our_buffer )
2033                                 {
2034                                 int new_size = b->yy_buf_size * 2;
2035
2036                                 if ( new_size <= 0 )
2037                                         b->yy_buf_size += b->yy_buf_size / 8;
2038                                 else
2039                                         b->yy_buf_size *= 2;
2040
2041                                 b->yy_ch_buf = (char *)
2042                                         /* Include room in for 2 EOB chars. */
2043                                         yyrealloc( (void *) b->yy_ch_buf,
2044                                                          (yy_size_t) (b->yy_buf_size + 2)  );
2045                                 }
2046                         else
2047                                 /* Can't grow it, we don't own it. */
2048                                 b->yy_ch_buf = NULL;
2049
2050                         if ( ! b->yy_ch_buf )
2051                                 YY_FATAL_ERROR(
2052                                 "fatal error - scanner input buffer overflow" );
2053
2054                         (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
2055
2056                         num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
2057                                                 number_to_move - 1;
2058
2059                         }
2060
2061                 if ( num_to_read > YY_READ_BUF_SIZE )
2062                         num_to_read = YY_READ_BUF_SIZE;
2063
2064                 /* Read in more data. */
2065                 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
2066                         (yy_n_chars), num_to_read );
2067
2068                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2069                 }
2070
2071         if ( (yy_n_chars) == 0 )
2072                 {
2073                 if ( number_to_move == YY_MORE_ADJ )
2074                         {
2075                         ret_val = EOB_ACT_END_OF_FILE;
2076                         yyrestart( yyin  );
2077                         }
2078
2079                 else
2080                         {
2081                         ret_val = EOB_ACT_LAST_MATCH;
2082                         YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
2083                                 YY_BUFFER_EOF_PENDING;
2084                         }
2085                 }
2086
2087         else
2088                 ret_val = EOB_ACT_CONTINUE_SCAN;
2089
2090         if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
2091                 /* Extend the array by 50%, plus the number we really need. */
2092                 int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
2093                 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
2094                         (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size  );
2095                 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
2096                         YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
2097                 /* "- 2" to take care of EOB's */
2098                 YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
2099         }
2100
2101         (yy_n_chars) += number_to_move;
2102         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
2103         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
2104
2105         (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
2106
2107         return ret_val;
2108 }
2109
2110 /* yy_get_previous_state - get the state just before the EOB char was reached */
2111
2112     static yy_state_type yy_get_previous_state (void)
2113 {
2114         yy_state_type yy_current_state;
2115         char *yy_cp;
2116     
2117         yy_current_state = (yy_start);
2118
2119         for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
2120                 {
2121                 YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
2122                 if ( yy_accept[yy_current_state] )
2123                         {
2124                         (yy_last_accepting_state) = yy_current_state;
2125                         (yy_last_accepting_cpos) = yy_cp;
2126                         }
2127                 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2128                         {
2129                         yy_current_state = (int) yy_def[yy_current_state];
2130                         if ( yy_current_state >= 587 )
2131                                 yy_c = yy_meta[yy_c];
2132                         }
2133                 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
2134                 }
2135
2136         return yy_current_state;
2137 }
2138
2139 /* yy_try_NUL_trans - try to make a transition on the NUL character
2140  *
2141  * synopsis
2142  *      next_state = yy_try_NUL_trans( current_state );
2143  */
2144     static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
2145 {
2146         int yy_is_jam;
2147         char *yy_cp = (yy_c_buf_p);
2148
2149         YY_CHAR yy_c = 1;
2150         if ( yy_accept[yy_current_state] )
2151                 {
2152                 (yy_last_accepting_state) = yy_current_state;
2153                 (yy_last_accepting_cpos) = yy_cp;
2154                 }
2155         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2156                 {
2157                 yy_current_state = (int) yy_def[yy_current_state];
2158                 if ( yy_current_state >= 587 )
2159                         yy_c = yy_meta[yy_c];
2160                 }
2161         yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
2162         yy_is_jam = (yy_current_state == 586);
2163
2164                 return yy_is_jam ? 0 : yy_current_state;
2165 }
2166
2167 #ifndef YY_NO_UNPUT
2168
2169 #endif
2170
2171 #ifndef YY_NO_INPUT
2172 #ifdef __cplusplus
2173     static int yyinput (void)
2174 #else
2175     static int input  (void)
2176 #endif
2177
2178 {
2179         int c;
2180     
2181         *(yy_c_buf_p) = (yy_hold_char);
2182
2183         if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
2184                 {
2185                 /* yy_c_buf_p now points to the character we want to return.
2186                  * If this occurs *before* the EOB characters, then it's a
2187                  * valid NUL; if not, then we've hit the end of the buffer.
2188                  */
2189                 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
2190                         /* This was really a NUL. */
2191                         *(yy_c_buf_p) = '\0';
2192
2193                 else
2194                         { /* need more input */
2195                         int offset = (int) ((yy_c_buf_p) - (yytext_ptr));
2196                         ++(yy_c_buf_p);
2197
2198                         switch ( yy_get_next_buffer(  ) )
2199                                 {
2200                                 case EOB_ACT_LAST_MATCH:
2201                                         /* This happens because yy_g_n_b()
2202                                          * sees that we've accumulated a
2203                                          * token and flags that we need to
2204                                          * try matching the token before
2205                                          * proceeding.  But for input(),
2206                                          * there's no matching to consider.
2207                                          * So convert the EOB_ACT_LAST_MATCH
2208                                          * to EOB_ACT_END_OF_FILE.
2209                                          */
2210
2211                                         /* Reset buffer status. */
2212                                         yyrestart( yyin );
2213
2214                                         /*FALLTHROUGH*/
2215
2216                                 case EOB_ACT_END_OF_FILE:
2217                                         {
2218                                         if ( yywrap(  ) )
2219                                                 return 0;
2220
2221                                         if ( ! (yy_did_buffer_switch_on_eof) )
2222                                                 YY_NEW_FILE;
2223 #ifdef __cplusplus
2224                                         return yyinput();
2225 #else
2226                                         return input();
2227 #endif
2228                                         }
2229
2230                                 case EOB_ACT_CONTINUE_SCAN:
2231                                         (yy_c_buf_p) = (yytext_ptr) + offset;
2232                                         break;
2233                                 }
2234                         }
2235                 }
2236
2237         c = *(unsigned char *) (yy_c_buf_p);    /* cast for 8-bit char's */
2238         *(yy_c_buf_p) = '\0';   /* preserve yytext */
2239         (yy_hold_char) = *++(yy_c_buf_p);
2240
2241         return c;
2242 }
2243 #endif  /* ifndef YY_NO_INPUT */
2244
2245 /** Immediately switch to a different input stream.
2246  * @param input_file A readable stream.
2247  * 
2248  * @note This function does not reset the start condition to @c INITIAL .
2249  */
2250     void yyrestart  (FILE * input_file )
2251 {
2252     
2253         if ( ! YY_CURRENT_BUFFER ){
2254         yyensure_buffer_stack ();
2255                 YY_CURRENT_BUFFER_LVALUE =
2256             yy_create_buffer( yyin, YY_BUF_SIZE );
2257         }
2258
2259         yy_init_buffer( YY_CURRENT_BUFFER, input_file );
2260         yy_load_buffer_state(  );
2261 }
2262
2263 /** Switch to a different input buffer.
2264  * @param new_buffer The new input buffer.
2265  * 
2266  */
2267     void yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
2268 {
2269     
2270         /* TODO. We should be able to replace this entire function body
2271          * with
2272          *              yypop_buffer_state();
2273          *              yypush_buffer_state(new_buffer);
2274      */
2275         yyensure_buffer_stack ();
2276         if ( YY_CURRENT_BUFFER == new_buffer )
2277                 return;
2278
2279         if ( YY_CURRENT_BUFFER )
2280                 {
2281                 /* Flush out information for old buffer. */
2282                 *(yy_c_buf_p) = (yy_hold_char);
2283                 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
2284                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2285                 }
2286
2287         YY_CURRENT_BUFFER_LVALUE = new_buffer;
2288         yy_load_buffer_state(  );
2289
2290         /* We don't actually know whether we did this switch during
2291          * EOF (yywrap()) processing, but the only time this flag
2292          * is looked at is after yywrap() is called, so it's safe
2293          * to go ahead and always set it.
2294          */
2295         (yy_did_buffer_switch_on_eof) = 1;
2296 }
2297
2298 static void yy_load_buffer_state  (void)
2299 {
2300         (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2301         (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
2302         yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
2303         (yy_hold_char) = *(yy_c_buf_p);
2304 }
2305
2306 /** Allocate and initialize an input buffer state.
2307  * @param file A readable stream.
2308  * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
2309  * 
2310  * @return the allocated buffer state.
2311  */
2312     YY_BUFFER_STATE yy_create_buffer  (FILE * file, int  size )
2313 {
2314         YY_BUFFER_STATE b;
2315     
2316         b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state )  );
2317         if ( ! b )
2318                 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2319
2320         b->yy_buf_size = size;
2321
2322         /* yy_ch_buf has to be 2 characters longer than the size given because
2323          * we need to put in 2 end-of-buffer characters.
2324          */
2325         b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2)  );
2326         if ( ! b->yy_ch_buf )
2327                 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2328
2329         b->yy_is_our_buffer = 1;
2330
2331         yy_init_buffer( b, file );
2332
2333         return b;
2334 }
2335
2336 /** Destroy the buffer.
2337  * @param b a buffer created with yy_create_buffer()
2338  * 
2339  */
2340     void yy_delete_buffer (YY_BUFFER_STATE  b )
2341 {
2342     
2343         if ( ! b )
2344                 return;
2345
2346         if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2347                 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
2348
2349         if ( b->yy_is_our_buffer )
2350                 yyfree( (void *) b->yy_ch_buf  );
2351
2352         yyfree( (void *) b  );
2353 }
2354
2355 /* Initializes or reinitializes a buffer.
2356  * This function is sometimes called more than once on the same buffer,
2357  * such as during a yyrestart() or at EOF.
2358  */
2359     static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file )
2360
2361 {
2362         int oerrno = errno;
2363     
2364         yy_flush_buffer( b );
2365
2366         b->yy_input_file = file;
2367         b->yy_fill_buffer = 1;
2368
2369     /* If b is the current buffer, then yy_init_buffer was _probably_
2370      * called from yyrestart() or through yy_get_next_buffer.
2371      * In that case, we don't want to reset the lineno or column.
2372      */
2373     if (b != YY_CURRENT_BUFFER){
2374         b->yy_bs_lineno = 1;
2375         b->yy_bs_column = 0;
2376     }
2377
2378         b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
2379     
2380         errno = oerrno;
2381 }
2382
2383 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2384  * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2385  * 
2386  */
2387     void yy_flush_buffer (YY_BUFFER_STATE  b )
2388 {
2389         if ( ! b )
2390                 return;
2391
2392         b->yy_n_chars = 0;
2393
2394         /* We always need two end-of-buffer characters.  The first causes
2395          * a transition to the end-of-buffer state.  The second causes
2396          * a jam in that state.
2397          */
2398         b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2399         b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2400
2401         b->yy_buf_pos = &b->yy_ch_buf[0];
2402
2403         b->yy_at_bol = 1;
2404         b->yy_buffer_status = YY_BUFFER_NEW;
2405
2406         if ( b == YY_CURRENT_BUFFER )
2407                 yy_load_buffer_state(  );
2408 }
2409
2410 /** Pushes the new state onto the stack. The new state becomes
2411  *  the current state. This function will allocate the stack
2412  *  if necessary.
2413  *  @param new_buffer The new state.
2414  *  
2415  */
2416 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
2417 {
2418         if (new_buffer == NULL)
2419                 return;
2420
2421         yyensure_buffer_stack();
2422
2423         /* This block is copied from yy_switch_to_buffer. */
2424         if ( YY_CURRENT_BUFFER )
2425                 {
2426                 /* Flush out information for old buffer. */
2427                 *(yy_c_buf_p) = (yy_hold_char);
2428                 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
2429                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2430                 }
2431
2432         /* Only push if top exists. Otherwise, replace top. */
2433         if (YY_CURRENT_BUFFER)
2434                 (yy_buffer_stack_top)++;
2435         YY_CURRENT_BUFFER_LVALUE = new_buffer;
2436
2437         /* copied from yy_switch_to_buffer. */
2438         yy_load_buffer_state(  );
2439         (yy_did_buffer_switch_on_eof) = 1;
2440 }
2441
2442 /** Removes and deletes the top of the stack, if present.
2443  *  The next element becomes the new top.
2444  *  
2445  */
2446 void yypop_buffer_state (void)
2447 {
2448         if (!YY_CURRENT_BUFFER)
2449                 return;
2450
2451         yy_delete_buffer(YY_CURRENT_BUFFER );
2452         YY_CURRENT_BUFFER_LVALUE = NULL;
2453         if ((yy_buffer_stack_top) > 0)
2454                 --(yy_buffer_stack_top);
2455
2456         if (YY_CURRENT_BUFFER) {
2457                 yy_load_buffer_state(  );
2458                 (yy_did_buffer_switch_on_eof) = 1;
2459         }
2460 }
2461
2462 /* Allocates the stack if it does not exist.
2463  *  Guarantees space for at least one push.
2464  */
2465 static void yyensure_buffer_stack (void)
2466 {
2467         yy_size_t num_to_alloc;
2468     
2469         if (!(yy_buffer_stack)) {
2470
2471                 /* First allocation is just for 2 elements, since we don't know if this
2472                  * scanner will even need a stack. We use 2 instead of 1 to avoid an
2473                  * immediate realloc on the next call.
2474          */
2475       num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
2476                 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
2477                                                                 (num_to_alloc * sizeof(struct yy_buffer_state*)
2478                                                                 );
2479                 if ( ! (yy_buffer_stack) )
2480                         YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2481
2482                 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2483
2484                 (yy_buffer_stack_max) = num_to_alloc;
2485                 (yy_buffer_stack_top) = 0;
2486                 return;
2487         }
2488
2489         if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
2490
2491                 /* Increase the buffer to prepare for a possible push. */
2492                 yy_size_t grow_size = 8 /* arbitrary grow size */;
2493
2494                 num_to_alloc = (yy_buffer_stack_max) + grow_size;
2495                 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
2496                                                                 ((yy_buffer_stack),
2497                                                                 num_to_alloc * sizeof(struct yy_buffer_state*)
2498                                                                 );
2499                 if ( ! (yy_buffer_stack) )
2500                         YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2501
2502                 /* zero only the new slots.*/
2503                 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
2504                 (yy_buffer_stack_max) = num_to_alloc;
2505         }
2506 }
2507
2508 /** Setup the input buffer state to scan directly from a user-specified character buffer.
2509  * @param base the character buffer
2510  * @param size the size in bytes of the character buffer
2511  * 
2512  * @return the newly allocated buffer state object.
2513  */
2514 YY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size )
2515 {
2516         YY_BUFFER_STATE b;
2517     
2518         if ( size < 2 ||
2519              base[size-2] != YY_END_OF_BUFFER_CHAR ||
2520              base[size-1] != YY_END_OF_BUFFER_CHAR )
2521                 /* They forgot to leave room for the EOB's. */
2522                 return NULL;
2523
2524         b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state )  );
2525         if ( ! b )
2526                 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
2527
2528         b->yy_buf_size = (int) (size - 2);      /* "- 2" to take care of EOB's */
2529         b->yy_buf_pos = b->yy_ch_buf = base;
2530         b->yy_is_our_buffer = 0;
2531         b->yy_input_file = NULL;
2532         b->yy_n_chars = b->yy_buf_size;
2533         b->yy_is_interactive = 0;
2534         b->yy_at_bol = 1;
2535         b->yy_fill_buffer = 0;
2536         b->yy_buffer_status = YY_BUFFER_NEW;
2537
2538         yy_switch_to_buffer( b  );
2539
2540         return b;
2541 }
2542
2543 /** Setup the input buffer state to scan a string. The next call to yylex() will
2544  * scan from a @e copy of @a str.
2545  * @param yystr a NUL-terminated string to scan
2546  * 
2547  * @return the newly allocated buffer state object.
2548  * @note If you want to scan bytes that may contain NUL values, then use
2549  *       yy_scan_bytes() instead.
2550  */
2551 YY_BUFFER_STATE yy_scan_string (const char * yystr )
2552 {
2553     
2554         return yy_scan_bytes( yystr, (int) strlen(yystr) );
2555 }
2556
2557 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
2558  * scan from a @e copy of @a bytes.
2559  * @param yybytes the byte buffer to scan
2560  * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
2561  * 
2562  * @return the newly allocated buffer state object.
2563  */
2564 YY_BUFFER_STATE yy_scan_bytes  (const char * yybytes, int  _yybytes_len )
2565 {
2566         YY_BUFFER_STATE b;
2567         char *buf;
2568         yy_size_t n;
2569         int i;
2570     
2571         /* Get memory for full buffer, including space for trailing EOB's. */
2572         n = (yy_size_t) (_yybytes_len + 2);
2573         buf = (char *) yyalloc( n  );
2574         if ( ! buf )
2575                 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2576
2577         for ( i = 0; i < _yybytes_len; ++i )
2578                 buf[i] = yybytes[i];
2579
2580         buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2581
2582         b = yy_scan_buffer( buf, n );
2583         if ( ! b )
2584                 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2585
2586         /* It's okay to grow etc. this buffer, and we should throw it
2587          * away when we're done.
2588          */
2589         b->yy_is_our_buffer = 1;
2590
2591         return b;
2592 }
2593
2594 #ifndef YY_EXIT_FAILURE
2595 #define YY_EXIT_FAILURE 2
2596 #endif
2597
2598 static void yynoreturn yy_fatal_error (const char* msg )
2599 {
2600                         fprintf( stderr, "%s\n", msg );
2601         exit( YY_EXIT_FAILURE );
2602 }
2603
2604 /* Redefine yyless() so it works in section 3 code. */
2605
2606 #undef yyless
2607 #define yyless(n) \
2608         do \
2609                 { \
2610                 /* Undo effects of setting up yytext. */ \
2611         int yyless_macro_arg = (n); \
2612         YY_LESS_LINENO(yyless_macro_arg);\
2613                 yytext[yyleng] = (yy_hold_char); \
2614                 (yy_c_buf_p) = yytext + yyless_macro_arg; \
2615                 (yy_hold_char) = *(yy_c_buf_p); \
2616                 *(yy_c_buf_p) = '\0'; \
2617                 yyleng = yyless_macro_arg; \
2618                 } \
2619         while ( 0 )
2620
2621 /* Accessor  methods (get/set functions) to struct members. */
2622
2623 /** Get the current line number.
2624  * 
2625  */
2626 int yyget_lineno  (void)
2627 {
2628     
2629     return yylineno;
2630 }
2631
2632 /** Get the input stream.
2633  * 
2634  */
2635 FILE *yyget_in  (void)
2636 {
2637         return yyin;
2638 }
2639
2640 /** Get the output stream.
2641  * 
2642  */
2643 FILE *yyget_out  (void)
2644 {
2645         return yyout;
2646 }
2647
2648 /** Get the length of the current token.
2649  * 
2650  */
2651 int yyget_leng  (void)
2652 {
2653         return yyleng;
2654 }
2655
2656 /** Get the current token.
2657  * 
2658  */
2659
2660 char *yyget_text  (void)
2661 {
2662         return yytext;
2663 }
2664
2665 /** Set the current line number.
2666  * @param _line_number line number
2667  * 
2668  */
2669 void yyset_lineno (int  _line_number )
2670 {
2671     
2672     yylineno = _line_number;
2673 }
2674
2675 /** Set the input stream. This does not discard the current
2676  * input buffer.
2677  * @param _in_str A readable stream.
2678  * 
2679  * @see yy_switch_to_buffer
2680  */
2681 void yyset_in (FILE *  _in_str )
2682 {
2683         yyin = _in_str ;
2684 }
2685
2686 void yyset_out (FILE *  _out_str )
2687 {
2688         yyout = _out_str ;
2689 }
2690
2691 int yyget_debug  (void)
2692 {
2693         return yy_flex_debug;
2694 }
2695
2696 void yyset_debug (int  _bdebug )
2697 {
2698         yy_flex_debug = _bdebug ;
2699 }
2700
2701 static int yy_init_globals (void)
2702 {
2703         /* Initialization is the same as for the non-reentrant scanner.
2704      * This function is called from yylex_destroy(), so don't allocate here.
2705      */
2706
2707     (yy_buffer_stack) = NULL;
2708     (yy_buffer_stack_top) = 0;
2709     (yy_buffer_stack_max) = 0;
2710     (yy_c_buf_p) = NULL;
2711     (yy_init) = 0;
2712     (yy_start) = 0;
2713
2714 /* Defined in main.c */
2715 #ifdef YY_STDINIT
2716     yyin = stdin;
2717     yyout = stdout;
2718 #else
2719     yyin = NULL;
2720     yyout = NULL;
2721 #endif
2722
2723     /* For future reference: Set errno on error, since we are called by
2724      * yylex_init()
2725      */
2726     return 0;
2727 }
2728
2729 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
2730 int yylex_destroy  (void)
2731 {
2732     
2733     /* Pop the buffer stack, destroying each element. */
2734         while(YY_CURRENT_BUFFER){
2735                 yy_delete_buffer( YY_CURRENT_BUFFER  );
2736                 YY_CURRENT_BUFFER_LVALUE = NULL;
2737                 yypop_buffer_state();
2738         }
2739
2740         /* Destroy the stack itself. */
2741         yyfree((yy_buffer_stack) );
2742         (yy_buffer_stack) = NULL;
2743
2744     /* Reset the globals. This is important in a non-reentrant scanner so the next time
2745      * yylex() is called, initialization will occur. */
2746     yy_init_globals( );
2747
2748     return 0;
2749 }
2750
2751 /*
2752  * Internal utility routines.
2753  */
2754
2755 #ifndef yytext_ptr
2756 static void yy_flex_strncpy (char* s1, const char * s2, int n )
2757 {
2758                 
2759         int i;
2760         for ( i = 0; i < n; ++i )
2761                 s1[i] = s2[i];
2762 }
2763 #endif
2764
2765 #ifdef YY_NEED_STRLEN
2766 static int yy_flex_strlen (const char * s )
2767 {
2768         int n;
2769         for ( n = 0; s[n]; ++n )
2770                 ;
2771
2772         return n;
2773 }
2774 #endif
2775
2776 void *yyalloc (yy_size_t  size )
2777 {
2778                         return malloc(size);
2779 }
2780
2781 void *yyrealloc  (void * ptr, yy_size_t  size )
2782 {
2783                 
2784         /* The cast to (char *) in the following accommodates both
2785          * implementations that use char* generic pointers, and those
2786          * that use void* generic pointers.  It works with the latter
2787          * because both ANSI C and C++ allow castless assignment from
2788          * any pointer type to void*, and deal with argument conversions
2789          * as though doing an assignment.
2790          */
2791         return realloc(ptr, size);
2792 }
2793
2794 void yyfree (void * ptr )
2795 {
2796                         free( (char *) ptr );   /* see yyrealloc() for (char *) cast */
2797 }
2798
2799 #define YYTABLES_NAME "yytables"
2800
2801 #line 290 "lexer.l"
2802
2803
2804 const char *const builtinservicehelpstrings[]= {
2805   "environment",
2806   "parameter <parameter>",
2807   "version",
2808   "toplevel",
2809   "override",
2810   "shutdown",
2811   "reset",
2812   "execute",
2813   "help",
2814    0
2815 };
2816
2817 #include "parser.c"
2818
2819