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