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