40e1075dbd9e33f59a0d5165f668e7da3572abed
[debian/amanda] / recover-src / uscan.c
1 /* A lexical scanner generated by flex */
2
3 /* Scanner skeleton version:
4  * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $
5  */
6
7 #define FLEX_SCANNER
8 #define YY_FLEX_MAJOR_VERSION 2
9 #define YY_FLEX_MINOR_VERSION 5
10
11 #include <stdio.h>
12 #include <unistd.h>
13
14
15 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
16 #ifdef c_plusplus
17 #ifndef __cplusplus
18 #define __cplusplus
19 #endif
20 #endif
21
22
23 #ifdef __cplusplus
24
25 #include <stdlib.h>
26
27 /* Use prototypes in function declarations. */
28 #define YY_USE_PROTOS
29
30 /* The "const" storage-class-modifier is valid. */
31 #define YY_USE_CONST
32
33 #else   /* ! __cplusplus */
34
35 #if __STDC__
36
37 #define YY_USE_PROTOS
38 #define YY_USE_CONST
39
40 #endif  /* __STDC__ */
41 #endif  /* ! __cplusplus */
42
43 #ifdef __TURBOC__
44  #pragma warn -rch
45  #pragma warn -use
46 #include <io.h>
47 #include <stdlib.h>
48 #define YY_USE_CONST
49 #define YY_USE_PROTOS
50 #endif
51
52 #ifdef YY_USE_CONST
53 #define yyconst const
54 #else
55 #define yyconst
56 #endif
57
58
59 #ifdef YY_USE_PROTOS
60 #define YY_PROTO(proto) proto
61 #else
62 #define YY_PROTO(proto) ()
63 #endif
64
65 /* Returned upon end-of-file. */
66 #define YY_NULL 0
67
68 /* Promotes a possibly negative, possibly signed char to an unsigned
69  * integer for use as an array index.  If the signed char is negative,
70  * we want to instead treat it as an 8-bit unsigned char, hence the
71  * double cast.
72  */
73 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
74
75 /* Enter a start condition.  This macro really ought to take a parameter,
76  * but we do it the disgusting crufty way forced on us by the ()-less
77  * definition of BEGIN.
78  */
79 #define BEGIN yy_start = 1 + 2 *
80
81 /* Translate the current start state into a value that can be later handed
82  * to BEGIN to return to the state.  The YYSTATE alias is for lex
83  * compatibility.
84  */
85 #define YY_START ((yy_start - 1) / 2)
86 #define YYSTATE YY_START
87
88 /* Action number for EOF rule of a given start state. */
89 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
90
91 /* Special action meaning "start processing a new file". */
92 #define YY_NEW_FILE yyrestart( yyin )
93
94 #define YY_END_OF_BUFFER_CHAR 0
95
96 /* Size of default input buffer. */
97 #define YY_BUF_SIZE 16384
98
99 typedef struct yy_buffer_state *YY_BUFFER_STATE;
100
101 extern int yyleng;
102 extern FILE *yyin, *yyout;
103
104 #define EOB_ACT_CONTINUE_SCAN 0
105 #define EOB_ACT_END_OF_FILE 1
106 #define EOB_ACT_LAST_MATCH 2
107
108 /* The funky do-while in the following #define is used to turn the definition
109  * int a single C statement (which needs a semi-colon terminator).  This
110  * avoids problems with code like:
111  *
112  *      if ( condition_holds )
113  *              yyless( 5 );
114  *      else
115  *              do_something_else();
116  *
117  * Prior to using the do-while the compiler would get upset at the
118  * "else" because it interpreted the "if" statement as being all
119  * done when it reached the ';' after the yyless() call.
120  */
121
122 /* Return all but the first 'n' matched characters back to the input stream. */
123
124 #define yyless(n) \
125         do \
126                 { \
127                 /* Undo effects of setting up yytext. */ \
128                 *yy_cp = yy_hold_char; \
129                 YY_RESTORE_YY_MORE_OFFSET \
130                 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
131                 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
132                 } \
133         while ( 0 )
134
135 #define unput(c) yyunput( c, yytext_ptr )
136
137 /* The following is because we cannot portably get our hands on size_t
138  * (without autoconf's help, which isn't available because we want
139  * flex-generated scanners to compile on their own).
140  */
141 typedef unsigned int yy_size_t;
142
143
144 struct yy_buffer_state
145         {
146         FILE *yy_input_file;
147
148         char *yy_ch_buf;                /* input buffer */
149         char *yy_buf_pos;               /* current position in input buffer */
150
151         /* Size of input buffer in bytes, not including room for EOB
152          * characters.
153          */
154         yy_size_t yy_buf_size;
155
156         /* Number of characters read into yy_ch_buf, not including EOB
157          * characters.
158          */
159         int yy_n_chars;
160
161         /* Whether we "own" the buffer - i.e., we know we created it,
162          * and can realloc() it to grow it, and should free() it to
163          * delete it.
164          */
165         int yy_is_our_buffer;
166
167         /* Whether this is an "interactive" input source; if so, and
168          * if we're using stdio for input, then we want to use getc()
169          * instead of fread(), to make sure we stop fetching input after
170          * each newline.
171          */
172         int yy_is_interactive;
173
174         /* Whether we're considered to be at the beginning of a line.
175          * If so, '^' rules will be active on the next match, otherwise
176          * not.
177          */
178         int yy_at_bol;
179
180         /* Whether to try to fill the input buffer when we reach the
181          * end of it.
182          */
183         int yy_fill_buffer;
184
185         int yy_buffer_status;
186 #define YY_BUFFER_NEW 0
187 #define YY_BUFFER_NORMAL 1
188         /* When an EOF's been seen but there's still some text to process
189          * then we mark the buffer as YY_EOF_PENDING, to indicate that we
190          * shouldn't try reading from the input source any more.  We might
191          * still have a bunch of tokens to match, though, because of
192          * possible backing-up.
193          *
194          * When we actually see the EOF, we change the status to "new"
195          * (via yyrestart()), so that the user can continue scanning by
196          * just pointing yyin at a new input file.
197          */
198 #define YY_BUFFER_EOF_PENDING 2
199         };
200
201 static YY_BUFFER_STATE yy_current_buffer = 0;
202
203 /* We provide macros for accessing buffer states in case in the
204  * future we want to put the buffer states in a more general
205  * "scanner state".
206  */
207 #define YY_CURRENT_BUFFER yy_current_buffer
208
209
210 /* yy_hold_char holds the character lost when yytext is formed. */
211 static char yy_hold_char;
212
213 static int yy_n_chars;          /* number of characters read into yy_ch_buf */
214
215
216 int yyleng;
217
218 /* Points to current character in buffer. */
219 static char *yy_c_buf_p = (char *) 0;
220 static int yy_init = 1;         /* whether we need to initialize */
221 static int yy_start = 0;        /* start state number */
222
223 /* Flag which is used to allow yywrap()'s to do buffer switches
224  * instead of setting up a fresh yyin.  A bit of a hack ...
225  */
226 static int yy_did_buffer_switch_on_eof;
227
228 void yyrestart YY_PROTO(( FILE *input_file ));
229
230 void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
231 void yy_load_buffer_state YY_PROTO(( void ));
232 YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
233 void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
234 void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
235 void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
236 #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
237
238 YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
239 YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
240 YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
241
242 static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
243 static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
244 static void yy_flex_free YY_PROTO(( void * ));
245
246 #define yy_new_buffer yy_create_buffer
247
248 #define yy_set_interactive(is_interactive) \
249         { \
250         if ( ! yy_current_buffer ) \
251                 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
252         yy_current_buffer->yy_is_interactive = is_interactive; \
253         }
254
255 #define yy_set_bol(at_bol) \
256         { \
257         if ( ! yy_current_buffer ) \
258                 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
259         yy_current_buffer->yy_at_bol = at_bol; \
260         }
261
262 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
263
264 typedef unsigned char YY_CHAR;
265 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
266 typedef int yy_state_type;
267 extern char *yytext;
268 #define yytext_ptr yytext
269
270 static yy_state_type yy_get_previous_state YY_PROTO(( void ));
271 static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
272 static int yy_get_next_buffer YY_PROTO(( void ));
273 static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
274
275 /* Done after the current pattern has been matched and before the
276  * corresponding action - sets up yytext.
277  */
278 #define YY_DO_BEFORE_ACTION \
279         yytext_ptr = yy_bp; \
280         yyleng = (int) (yy_cp - yy_bp); \
281         yy_hold_char = *yy_cp; \
282         *yy_cp = '\0'; \
283         yy_c_buf_p = yy_cp;
284
285 #define YY_NUM_RULES 38
286 #define YY_END_OF_BUFFER 39
287 static yyconst short int yy_accept[121] =
288     {   0,
289         0,    0,    0,    0,   39,   31,   37,   32,   31,   31,
290        21,   31,   31,   31,   31,   31,   31,   31,   31,   31,
291        31,   31,   36,   35,   33,   38,   31,   37,   31,   31,
292        31,   31,    7,   31,   31,   31,   31,   31,   31,   31,
293        31,   12,   31,   31,   31,   31,   31,   31,   36,   34,
294        31,   31,   31,   13,    8,   31,   31,   31,   31,   31,
295        31,   22,   31,   31,   31,   18,   31,   31,   25,   26,
296        28,   31,   31,   14,   31,   31,   10,   31,   20,   31,
297        15,   23,   27,    9,   31,   31,   31,   31,   29,   30,
298        19,   31,   31,   31,   31,   31,   31,   31,   31,   31,
299
300        16,   31,   31,   31,   31,   31,   31,   31,   31,   17,
301        24,   11,   31,    4,    3,    2,    5,    6,    1,    0
302     } ;
303
304 static yyconst int yy_ec[256] =
305     {   0,
306         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
307         1,    1,    2,    1,    1,    1,    1,    1,    1,    1,
308         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
309         1,    2,    1,    4,    1,    1,    1,    1,    1,    1,
310         1,    1,    1,    1,    5,    1,    1,    6,    6,    6,
311         6,    6,    6,    6,    6,    6,    6,    1,    1,    1,
312         1,    1,    7,    1,    1,    1,    1,    1,    1,    1,
313         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
314         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
315         1,    8,    1,    1,    1,    1,    9,   10,   11,   12,
316
317        13,    1,    1,   14,   15,    1,   16,   17,   18,    1,
318        19,   20,   21,   22,   23,   24,   25,    1,   26,   27,
319        28,    1,    1,    1,    1,    1,    1,    1,    1,    1,
320         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
321         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
322         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
323         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
324         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
325         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
326         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
327
328         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
329         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
330         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
331         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
332         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
333         1,    1,    1,    1,    1
334     } ;
335
336 static yyconst int yy_meta[29] =
337     {   0,
338         1,    2,    3,    4,    1,    1,    1,    3,    1,    1,
339         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
340         1,    1,    1,    1,    1,    1,    1,    1
341     } ;
342
343 static yyconst short int yy_base[124] =
344     {   0,
345         0,    0,   26,   28,  142,    0,  139,  143,  135,   32,
346         0,  127,   23,  125,  110,   26,   31,  117,  109,  109,
347        30,  124,    0,  143,  143,  128,    0,  129,   39,  124,
348        44,  117,  101,  114,  109,   32,  108,  101,  111,   99,
349        95,    0,  108,  107,  103,   93,  106,   93,    0,  143,
350       108,   47,   52,   86,    0,  103,   98,   86,   87,   88,
351        83,    0,   82,   93,   91,    0,   79,   47,    0,    0,
352        96,   95,   94,    0,   77,   74,    0,   88,    0,   77,
353        83,    0,    0,    0,   51,   75,   74,   83,   85,   84,
354         0,   76,   77,   65,   71,   61,   61,   60,   70,   61,
355
356        50,   46,   41,   45,   54,   48,   39,   49,   42,    0,
357         0,    0,   17,    0,    0,    0,    0,    0,    0,  143,
358        71,   75,   78
359     } ;
360
361 static yyconst short int yy_def[124] =
362     {   0,
363       120,    1,  121,  121,  120,  122,  120,  120,  122,  122,
364       122,  122,  122,  122,  122,  122,  122,  122,  122,  122,
365       122,  122,  123,  120,  120,  120,  122,  120,  122,  122,
366       122,  122,  122,  122,  122,  122,  122,  122,  122,  122,
367       122,  122,  122,  122,  122,  122,  122,  122,  123,  120,
368       122,  122,  122,  122,  122,  122,  122,  122,  122,  122,
369       122,  122,  122,  122,  122,  122,  122,  122,  122,  122,
370       122,  122,  122,  122,  122,  122,  122,  122,  122,  122,
371       122,  122,  122,  122,  122,  122,  122,  122,  122,  122,
372       122,  122,  122,  122,  122,  122,  122,  122,  122,  122,
373
374       122,  122,  122,  122,  122,  122,  122,  122,  122,  122,
375       122,  122,  122,  122,  122,  122,  122,  122,  122,    0,
376       120,  120,  120
377     } ;
378
379 static yyconst short int yy_nxt[172] =
380     {   0,
381         6,    7,    6,    8,    9,   10,   11,    6,   12,    6,
382        13,   14,   15,   16,    6,    6,   17,   18,    6,   19,
383        20,    6,   21,   22,    6,    6,    6,    6,   24,   25,
384        24,   25,  119,   26,   33,   26,   30,   31,   37,   34,
385        38,   39,   46,   51,   52,   40,   58,   47,   30,   31,
386        41,   72,   52,   42,  118,   59,   73,   53,   85,   96,
387        86,  117,  116,  115,   87,   97,  114,  113,  112,  111,
388        88,   23,   23,   23,   23,   27,  110,   27,   49,   49,
389       109,  108,  107,  106,  105,  104,  103,  102,  101,   90,
390        89,  100,   99,   98,   95,   94,   93,   92,   91,   90,
391
392        89,   71,   84,   83,   82,   81,   80,   79,   78,   77,
393        76,   75,   74,   71,   70,   69,   68,   67,   66,   65,
394        64,   63,   62,   61,   60,   57,   56,   55,   54,   53,
395        28,   50,   48,   45,   44,   43,   36,   35,   32,   29,
396        28,  120,    5,  120,  120,  120,  120,  120,  120,  120,
397       120,  120,  120,  120,  120,  120,  120,  120,  120,  120,
398       120,  120,  120,  120,  120,  120,  120,  120,  120,  120,
399       120
400     } ;
401
402 static yyconst short int yy_chk[172] =
403     {   0,
404         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
405         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
406         1,    1,    1,    1,    1,    1,    1,    1,    3,    3,
407         4,    4,  113,    3,   13,    4,   10,   10,   16,   13,
408        16,   17,   21,   29,   29,   17,   36,   21,   31,   31,
409        17,   52,   52,   17,  109,   36,   53,   53,   68,   85,
410        68,  108,  107,  106,   68,   85,  105,  104,  103,  102,
411        68,  121,  121,  121,  121,  122,  101,  122,  123,  123,
412       100,   99,   98,   97,   96,   95,   94,   93,   92,   90,
413        89,   88,   87,   86,   81,   80,   78,   76,   75,   73,
414
415        72,   71,   67,   65,   64,   63,   61,   60,   59,   58,
416        57,   56,   54,   51,   48,   47,   46,   45,   44,   43,
417        41,   40,   39,   38,   37,   35,   34,   33,   32,   30,
418        28,   26,   22,   20,   19,   18,   15,   14,   12,    9,
419         7,    5,  120,  120,  120,  120,  120,  120,  120,  120,
420       120,  120,  120,  120,  120,  120,  120,  120,  120,  120,
421       120,  120,  120,  120,  120,  120,  120,  120,  120,  120,
422       120
423     } ;
424
425 static yy_state_type yy_last_accepting_state;
426 static char *yy_last_accepting_cpos;
427
428 /* The intent behind this definition is that it'll catch
429  * any uses of REJECT which flex missed.
430  */
431 #define REJECT reject_used_but_not_detected
432 #define yymore() yymore_used_but_not_detected
433 #define YY_MORE_ADJ 0
434 #define YY_RESTORE_YY_MORE_OFFSET
435 char *yytext;
436 #line 1 "uscan.l"
437 #define INITIAL 0
438 /*
439  * Amanda, The Advanced Maryland Automatic Network Disk Archiver
440  * Copyright (c) 1991-2000 University of Maryland at College Park
441  * All Rights Reserved.
442  *
443  * Permission to use, copy, modify, distribute, and sell this software and its
444  * documentation for any purpose is hereby granted without fee, provided that
445  * the above copyright notice appear in all copies and that both that
446  * copyright notice and this permission notice appear in supporting
447  * documentation, and that the name of U.M. not be used in advertising or
448  * publicity pertaining to distribution of the software without specific,
449  * written prior permission.  U.M. makes no representations about the
450  * suitability of this software for any purpose.  It is provided "as is"
451  * without express or implied warranty.
452  *
453  * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
454  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M.
455  * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
456  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
457  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
458  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
459  *
460  * Authors: the Amanda Development Team.  Its members are listed in a
461  * file named AUTHORS, in the root directory of this distribution.
462  */
463 /*
464  * $Id: uscan.l,v 1.14.2.3.4.1.2.2.2.1 2004/02/11 13:03:38 martinea Exp $
465  *
466  * lexer for amrecover interactive language
467  */
468 #line 32 "uscan.l"
469 #include "amanda.h"
470 #undef ECHO
471 #include "uparse.h"
472
473 #define YY_NO_UNPUT
474
475 #define DATE_ALLOC_SIZE         sizeof("YYYY-MM-DD")    /* includes null */
476
477 extern void yyerror P((char *s));
478 extern int  yyparse P((void));
479 static int  ll_parse_date P((int type, char *text));
480 #define quotedstring 1
481
482 #line 48 "uscan.l"
483 static char *string_buf = NULL;
484 #line 485 "uscan.c"
485
486 /* Macros after this point can all be overridden by user definitions in
487  * section 1.
488  */
489
490 #ifndef YY_SKIP_YYWRAP
491 #ifdef __cplusplus
492 extern "C" int yywrap YY_PROTO(( void ));
493 #else
494 extern int yywrap YY_PROTO(( void ));
495 #endif
496 #endif
497
498 #ifndef YY_NO_UNPUT
499 static void yyunput YY_PROTO(( int c, char *buf_ptr ));
500 #endif
501
502 #ifndef yytext_ptr
503 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
504 #endif
505
506 #ifdef YY_NEED_STRLEN
507 static int yy_flex_strlen YY_PROTO(( yyconst char * ));
508 #endif
509
510 #ifndef YY_NO_INPUT
511 #ifdef __cplusplus
512 static int yyinput YY_PROTO(( void ));
513 #else
514 static int input YY_PROTO(( void ));
515 #endif
516 #endif
517
518 #if YY_STACK_USED
519 static int yy_start_stack_ptr = 0;
520 static int yy_start_stack_depth = 0;
521 static int *yy_start_stack = 0;
522 #ifndef YY_NO_PUSH_STATE
523 static void yy_push_state YY_PROTO(( int new_state ));
524 #endif
525 #ifndef YY_NO_POP_STATE
526 static void yy_pop_state YY_PROTO(( void ));
527 #endif
528 #ifndef YY_NO_TOP_STATE
529 static int yy_top_state YY_PROTO(( void ));
530 #endif
531
532 #else
533 #define YY_NO_PUSH_STATE 1
534 #define YY_NO_POP_STATE 1
535 #define YY_NO_TOP_STATE 1
536 #endif
537
538 #ifdef YY_MALLOC_DECL
539 YY_MALLOC_DECL
540 #else
541 #if __STDC__
542 #ifndef __cplusplus
543 #include <stdlib.h>
544 #endif
545 #else
546 /* Just try to get by without declaring the routines.  This will fail
547  * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
548  * or sizeof(void*) != sizeof(int).
549  */
550 #endif
551 #endif
552
553 /* Amount of stuff to slurp up with each read. */
554 #ifndef YY_READ_BUF_SIZE
555 #define YY_READ_BUF_SIZE 8192
556 #endif
557
558 /* Copy whatever the last rule matched to the standard output. */
559
560 #ifndef ECHO
561 /* This used to be an fputs(), but since the string might contain NUL's,
562  * we now use fwrite().
563  */
564 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
565 #endif
566
567 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
568  * is returned in "result".
569  */
570 #ifndef YY_INPUT
571 #define YY_INPUT(buf,result,max_size) \
572         if ( yy_current_buffer->yy_is_interactive ) \
573                 { \
574                 int c = '*', n; \
575                 for ( n = 0; n < max_size && \
576                              (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
577                         buf[n] = (char) c; \
578                 if ( c == '\n' ) \
579                         buf[n++] = (char) c; \
580                 if ( c == EOF && ferror( yyin ) ) \
581                         YY_FATAL_ERROR( "input in flex scanner failed" ); \
582                 result = n; \
583                 } \
584         else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
585                   && ferror( yyin ) ) \
586                 YY_FATAL_ERROR( "input in flex scanner failed" );
587 #endif
588
589 /* No semi-colon after return; correct usage is to write "yyterminate();" -
590  * we don't want an extra ';' after the "return" because that will cause
591  * some compilers to complain about unreachable statements.
592  */
593 #ifndef yyterminate
594 #define yyterminate() return YY_NULL
595 #endif
596
597 /* Number of entries by which start-condition stack grows. */
598 #ifndef YY_START_STACK_INCR
599 #define YY_START_STACK_INCR 25
600 #endif
601
602 /* Report a fatal error. */
603 #ifndef YY_FATAL_ERROR
604 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
605 #endif
606
607 /* Default declaration of generated scanner - a define so the user can
608  * easily add parameters.
609  */
610 #ifndef YY_DECL
611 #define YY_DECL int yylex YY_PROTO(( void ))
612 #endif
613
614 /* Code executed at the beginning of each rule, after yytext and yyleng
615  * have been set up.
616  */
617 #ifndef YY_USER_ACTION
618 #define YY_USER_ACTION
619 #endif
620
621 /* Code executed at the end of each rule. */
622 #ifndef YY_BREAK
623 #define YY_BREAK break;
624 #endif
625
626 #define YY_RULE_SETUP \
627         YY_USER_ACTION
628
629 YY_DECL
630         {
631         register yy_state_type yy_current_state;
632         register char *yy_cp = NULL, *yy_bp = NULL;
633         register int yy_act;
634
635 #line 51 "uscan.l"
636
637
638
639     /* literal keyword tokens */
640
641
642 #line 643 "uscan.c"
643
644         if ( yy_init )
645                 {
646                 yy_init = 0;
647
648 #ifdef YY_USER_INIT
649                 YY_USER_INIT;
650 #endif
651
652                 if ( ! yy_start )
653                         yy_start = 1;   /* first start state */
654
655                 if ( ! yyin )
656                         yyin = stdin;
657
658                 if ( ! yyout )
659                         yyout = stdout;
660
661                 if ( ! yy_current_buffer )
662                         yy_current_buffer =
663                                 yy_create_buffer( yyin, YY_BUF_SIZE );
664
665                 yy_load_buffer_state();
666                 }
667
668         while ( 1 )             /* loops until end-of-file is reached */
669                 {
670                 yy_cp = yy_c_buf_p;
671
672                 /* Support of yytext. */
673                 *yy_cp = yy_hold_char;
674
675                 /* yy_bp points to the position in yy_ch_buf of the start of
676                  * the current run.
677                  */
678                 yy_bp = yy_cp;
679
680                 yy_current_state = yy_start;
681 yy_match:
682                 do
683                         {
684                         register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
685                         if ( yy_accept[yy_current_state] )
686                                 {
687                                 yy_last_accepting_state = yy_current_state;
688                                 yy_last_accepting_cpos = yy_cp;
689                                 }
690                         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
691                                 {
692                                 yy_current_state = (int) yy_def[yy_current_state];
693                                 if ( yy_current_state >= 121 )
694                                         yy_c = yy_meta[(unsigned int) yy_c];
695                                 }
696                         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
697                         ++yy_cp;
698                         }
699                 while ( yy_base[yy_current_state] != 143 );
700
701 yy_find_action:
702                 yy_act = yy_accept[yy_current_state];
703                 if ( yy_act == 0 )
704                         { /* have to back up */
705                         yy_cp = yy_last_accepting_cpos;
706                         yy_current_state = yy_last_accepting_state;
707                         yy_act = yy_accept[yy_current_state];
708                         }
709
710                 YY_DO_BEFORE_ACTION;
711
712
713 do_action:      /* This label is used only to access EOF actions. */
714
715
716                 switch ( yy_act )
717         { /* beginning of action switch */
718                         case 0: /* must back up */
719                         /* undo the effects of YY_DO_BEFORE_ACTION */
720                         *yy_cp = yy_hold_char;
721                         yy_cp = yy_last_accepting_cpos;
722                         yy_current_state = yy_last_accepting_state;
723                         goto yy_find_action;
724
725 case 1:
726 YY_RULE_SETUP
727 #line 57 "uscan.l"
728 { return LISTDISK; }
729         YY_BREAK
730 case 2:
731 YY_RULE_SETUP
732 #line 58 "uscan.l"
733 { return SETHOST; }
734         YY_BREAK
735 case 3:
736 YY_RULE_SETUP
737 #line 59 "uscan.l"
738 { return SETDISK; }
739         YY_BREAK
740 case 4:
741 YY_RULE_SETUP
742 #line 60 "uscan.l"
743 { return SETDATE; }
744         YY_BREAK
745 case 5:
746 YY_RULE_SETUP
747 #line 61 "uscan.l"
748 { return SETMODE; }
749         YY_BREAK
750 case 6:
751 YY_RULE_SETUP
752 #line 62 "uscan.l"
753 { return SETTAPE; }
754         YY_BREAK
755 case 7:
756 YY_RULE_SETUP
757 #line 63 "uscan.l"
758 { return CD; }
759         YY_BREAK
760 case 8:
761 YY_RULE_SETUP
762 #line 64 "uscan.l"
763 { return CDX; }
764         YY_BREAK
765 case 9:
766 YY_RULE_SETUP
767 #line 65 "uscan.l"
768 { return QUIT; }
769         YY_BREAK
770 case 10:
771 YY_RULE_SETUP
772 #line 66 "uscan.l"
773 { return QUIT; }
774         YY_BREAK
775 case 11:
776 YY_RULE_SETUP
777 #line 67 "uscan.l"
778 { return DHIST; }
779         YY_BREAK
780 case 12:
781 YY_RULE_SETUP
782 #line 68 "uscan.l"
783 { return LS; }
784         YY_BREAK
785 case 13:
786 YY_RULE_SETUP
787 #line 69 "uscan.l"
788 { return ADD; }
789         YY_BREAK
790 case 14:
791 YY_RULE_SETUP
792 #line 70 "uscan.l"
793 { return ADDX; }
794         YY_BREAK
795 case 15:
796 YY_RULE_SETUP
797 #line 71 "uscan.l"
798 { return LIST; }
799         YY_BREAK
800 case 16:
801 YY_RULE_SETUP
802 #line 72 "uscan.l"
803 { return DELETE; }
804         YY_BREAK
805 case 17:
806 YY_RULE_SETUP
807 #line 73 "uscan.l"
808 { return DELETEX; }
809         YY_BREAK
810 case 18:
811 YY_RULE_SETUP
812 #line 74 "uscan.l"
813 { return PWD; }
814         YY_BREAK
815 case 19:
816 YY_RULE_SETUP
817 #line 75 "uscan.l"
818 { return CLEAR; }
819         YY_BREAK
820 case 20:
821 YY_RULE_SETUP
822 #line 76 "uscan.l"
823 { return HELP; }
824         YY_BREAK
825 case 21:
826 YY_RULE_SETUP
827 #line 77 "uscan.l"
828 { return HELP; }
829         YY_BREAK
830 case 22:
831 YY_RULE_SETUP
832 #line 78 "uscan.l"
833 { return LCD; }
834         YY_BREAK
835 case 23:
836 YY_RULE_SETUP
837 #line 79 "uscan.l"
838 { return LPWD; }
839         YY_BREAK
840 case 24:
841 YY_RULE_SETUP
842 #line 80 "uscan.l"
843 { return EXTRACT; }
844         YY_BREAK
845 case 25:
846 YY_RULE_SETUP
847 #line 81 "uscan.l"
848 { return SMB; }
849         YY_BREAK
850 case 26:
851 YY_RULE_SETUP
852 #line 82 "uscan.l"
853 { return TAR; }
854         YY_BREAK
855 case 27:
856 YY_RULE_SETUP
857 #line 83 "uscan.l"
858 { return MODE; }
859         YY_BREAK
860
861     /* dates */
862
863 case 28:
864 YY_RULE_SETUP
865 #line 89 "uscan.l"
866 { return ll_parse_date(1, yytext); }
867         YY_BREAK
868 case 29:
869 YY_RULE_SETUP
870 #line 90 "uscan.l"
871 { return ll_parse_date(2, yytext); }
872         YY_BREAK
873 case 30:
874 YY_RULE_SETUP
875 #line 91 "uscan.l"
876 { return ll_parse_date(3, yytext); }
877         YY_BREAK
878
879     /* file names */
880
881 case 31:
882 YY_RULE_SETUP
883 #line 97 "uscan.l"
884 {
885   yylval.strval = stralloc(yytext); return PATH;
886 }
887         YY_BREAK
888
889     /* quoted file names */
890
891 case 32:
892 YY_RULE_SETUP
893 #line 105 "uscan.l"
894 { if(string_buf != NULL) {printf("ERROR:string_buf != NULL: %s\n",string_buf);}; BEGIN(quotedstring); }
895         YY_BREAK
896 case 33:
897 YY_RULE_SETUP
898 #line 107 "uscan.l"
899 { /* saw closing quote - all done */
900   BEGIN(INITIAL);
901   if(string_buf) {
902     yylval.strval = string_buf;
903     string_buf = NULL;
904   } else {
905     yylval.strval = "";
906   }
907   return PATH;
908 }
909         YY_BREAK
910 case 34:
911 YY_RULE_SETUP
912 #line 118 "uscan.l"
913 {
914   /* escaped quote */
915   strappend(string_buf, "\\\"");
916 }
917         YY_BREAK
918 case 35:
919 YY_RULE_SETUP
920 #line 123 "uscan.l"
921 {
922   /* error - unterminated string constant */
923   yyerror("unterminated string");
924   amfree(string_buf);
925 }
926         YY_BREAK
927 case 36:
928 YY_RULE_SETUP
929 #line 129 "uscan.l"
930 { strappend(string_buf, yytext); }
931         YY_BREAK
932
933     /* whitespace */
934
935 case 37:
936 YY_RULE_SETUP
937 #line 135 "uscan.l"
938 ;     /* whitespace */
939         YY_BREAK
940
941     /* anything else */
942     /* everything should have been handled by now, so this rule is disabled */
943
944
945 #if 0
946 .       { yyerror("invalid character"); }
947 #endif
948
949 case 38:
950 YY_RULE_SETUP
951 #line 148 "uscan.l"
952 ECHO;
953         YY_BREAK
954 #line 955 "uscan.c"
955 case YY_STATE_EOF(INITIAL):
956 case YY_STATE_EOF(quotedstring):
957         yyterminate();
958
959         case YY_END_OF_BUFFER:
960                 {
961                 /* Amount of text matched not including the EOB char. */
962                 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
963
964                 /* Undo the effects of YY_DO_BEFORE_ACTION. */
965                 *yy_cp = yy_hold_char;
966                 YY_RESTORE_YY_MORE_OFFSET
967
968                 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
969                         {
970                         /* We're scanning a new file or input source.  It's
971                          * possible that this happened because the user
972                          * just pointed yyin at a new source and called
973                          * yylex().  If so, then we have to assure
974                          * consistency between yy_current_buffer and our
975                          * globals.  Here is the right place to do so, because
976                          * this is the first action (other than possibly a
977                          * back-up) that will match for the new input source.
978                          */
979                         yy_n_chars = yy_current_buffer->yy_n_chars;
980                         yy_current_buffer->yy_input_file = yyin;
981                         yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
982                         }
983
984                 /* Note that here we test for yy_c_buf_p "<=" to the position
985                  * of the first EOB in the buffer, since yy_c_buf_p will
986                  * already have been incremented past the NUL character
987                  * (since all states make transitions on EOB to the
988                  * end-of-buffer state).  Contrast this with the test
989                  * in input().
990                  */
991                 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
992                         { /* This was really a NUL. */
993                         yy_state_type yy_next_state;
994
995                         yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
996
997                         yy_current_state = yy_get_previous_state();
998
999                         /* Okay, we're now positioned to make the NUL
1000                          * transition.  We couldn't have
1001                          * yy_get_previous_state() go ahead and do it
1002                          * for us because it doesn't know how to deal
1003                          * with the possibility of jamming (and we don't
1004                          * want to build jamming into it because then it
1005                          * will run more slowly).
1006                          */
1007
1008                         yy_next_state = yy_try_NUL_trans( yy_current_state );
1009
1010                         yy_bp = yytext_ptr + YY_MORE_ADJ;
1011
1012                         if ( yy_next_state )
1013                                 {
1014                                 /* Consume the NUL. */
1015                                 yy_cp = ++yy_c_buf_p;
1016                                 yy_current_state = yy_next_state;
1017                                 goto yy_match;
1018                                 }
1019
1020                         else
1021                                 {
1022                                 yy_cp = yy_c_buf_p;
1023                                 goto yy_find_action;
1024                                 }
1025                         }
1026
1027                 else switch ( yy_get_next_buffer() )
1028                         {
1029                         case EOB_ACT_END_OF_FILE:
1030                                 {
1031                                 yy_did_buffer_switch_on_eof = 0;
1032
1033                                 if ( yywrap() )
1034                                         {
1035                                         /* Note: because we've taken care in
1036                                          * yy_get_next_buffer() to have set up
1037                                          * yytext, we can now set up
1038                                          * yy_c_buf_p so that if some total
1039                                          * hoser (like flex itself) wants to
1040                                          * call the scanner after we return the
1041                                          * YY_NULL, it'll still work - another
1042                                          * YY_NULL will get returned.
1043                                          */
1044                                         yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
1045
1046                                         yy_act = YY_STATE_EOF(YY_START);
1047                                         goto do_action;
1048                                         }
1049
1050                                 else
1051                                         {
1052                                         if ( ! yy_did_buffer_switch_on_eof )
1053                                                 YY_NEW_FILE;
1054                                         }
1055                                 break;
1056                                 }
1057
1058                         case EOB_ACT_CONTINUE_SCAN:
1059                                 yy_c_buf_p =
1060                                         yytext_ptr + yy_amount_of_matched_text;
1061
1062                                 yy_current_state = yy_get_previous_state();
1063
1064                                 yy_cp = yy_c_buf_p;
1065                                 yy_bp = yytext_ptr + YY_MORE_ADJ;
1066                                 goto yy_match;
1067
1068                         case EOB_ACT_LAST_MATCH:
1069                                 yy_c_buf_p =
1070                                 &yy_current_buffer->yy_ch_buf[yy_n_chars];
1071
1072                                 yy_current_state = yy_get_previous_state();
1073
1074                                 yy_cp = yy_c_buf_p;
1075                                 yy_bp = yytext_ptr + YY_MORE_ADJ;
1076                                 goto yy_find_action;
1077                         }
1078                 break;
1079                 }
1080
1081         default:
1082                 YY_FATAL_ERROR(
1083                         "fatal flex scanner internal error--no action found" );
1084         } /* end of action switch */
1085                 } /* end of scanning one token */
1086         } /* end of yylex */
1087
1088
1089 /* yy_get_next_buffer - try to read in a new buffer
1090  *
1091  * Returns a code representing an action:
1092  *      EOB_ACT_LAST_MATCH -
1093  *      EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1094  *      EOB_ACT_END_OF_FILE - end of file
1095  */
1096
1097 static int yy_get_next_buffer()
1098         {
1099         register char *dest = yy_current_buffer->yy_ch_buf;
1100         register char *source = yytext_ptr;
1101         register int number_to_move, i;
1102         int ret_val;
1103
1104         if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
1105                 YY_FATAL_ERROR(
1106                 "fatal flex scanner internal error--end of buffer missed" );
1107
1108         if ( yy_current_buffer->yy_fill_buffer == 0 )
1109                 { /* Don't try to fill the buffer, so this is an EOF. */
1110                 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
1111                         {
1112                         /* We matched a single character, the EOB, so
1113                          * treat this as a final EOF.
1114                          */
1115                         return EOB_ACT_END_OF_FILE;
1116                         }
1117
1118                 else
1119                         {
1120                         /* We matched some text prior to the EOB, first
1121                          * process it.
1122                          */
1123                         return EOB_ACT_LAST_MATCH;
1124                         }
1125                 }
1126
1127         /* Try to read more data. */
1128
1129         /* First move last chars to start of buffer. */
1130         number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
1131
1132         for ( i = 0; i < number_to_move; ++i )
1133                 *(dest++) = *(source++);
1134
1135         if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1136                 /* don't do the read, it's not guaranteed to return an EOF,
1137                  * just force an EOF
1138                  */
1139                 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
1140
1141         else
1142                 {
1143                 int num_to_read =
1144                         yy_current_buffer->yy_buf_size - number_to_move - 1;
1145
1146                 while ( num_to_read <= 0 )
1147                         { /* Not enough room in the buffer - grow it. */
1148 #ifdef YY_USES_REJECT
1149                         YY_FATAL_ERROR(
1150 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1151 #else
1152
1153                         /* just a shorter name for the current buffer */
1154                         YY_BUFFER_STATE b = yy_current_buffer;
1155
1156                         int yy_c_buf_p_offset =
1157                                 (int) (yy_c_buf_p - b->yy_ch_buf);
1158
1159                         if ( b->yy_is_our_buffer )
1160                                 {
1161                                 int new_size = b->yy_buf_size * 2;
1162
1163                                 if ( new_size <= 0 )
1164                                         b->yy_buf_size += b->yy_buf_size / 8;
1165                                 else
1166                                         b->yy_buf_size *= 2;
1167
1168                                 b->yy_ch_buf = (char *)
1169                                         /* Include room in for 2 EOB chars. */
1170                                         yy_flex_realloc( (void *) b->yy_ch_buf,
1171                                                          b->yy_buf_size + 2 );
1172                                 }
1173                         else
1174                                 /* Can't grow it, we don't own it. */
1175                                 b->yy_ch_buf = 0;
1176
1177                         if ( ! b->yy_ch_buf )
1178                                 YY_FATAL_ERROR(
1179                                 "fatal error - scanner input buffer overflow" );
1180
1181                         yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1182
1183                         num_to_read = yy_current_buffer->yy_buf_size -
1184                                                 number_to_move - 1;
1185 #endif
1186                         }
1187
1188                 if ( num_to_read > YY_READ_BUF_SIZE )
1189                         num_to_read = YY_READ_BUF_SIZE;
1190
1191                 /* Read in more data. */
1192                 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
1193                         yy_n_chars, num_to_read );
1194
1195                 yy_current_buffer->yy_n_chars = yy_n_chars;
1196                 }
1197
1198         if ( yy_n_chars == 0 )
1199                 {
1200                 if ( number_to_move == YY_MORE_ADJ )
1201                         {
1202                         ret_val = EOB_ACT_END_OF_FILE;
1203                         yyrestart( yyin );
1204                         }
1205
1206                 else
1207                         {
1208                         ret_val = EOB_ACT_LAST_MATCH;
1209                         yy_current_buffer->yy_buffer_status =
1210                                 YY_BUFFER_EOF_PENDING;
1211                         }
1212                 }
1213
1214         else
1215                 ret_val = EOB_ACT_CONTINUE_SCAN;
1216
1217         yy_n_chars += number_to_move;
1218         yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1219         yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1220
1221         yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
1222
1223         return ret_val;
1224         }
1225
1226
1227 /* yy_get_previous_state - get the state just before the EOB char was reached */
1228
1229 static yy_state_type yy_get_previous_state()
1230         {
1231         register yy_state_type yy_current_state;
1232         register char *yy_cp;
1233
1234         yy_current_state = yy_start;
1235
1236         for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
1237                 {
1238                 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1239                 if ( yy_accept[yy_current_state] )
1240                         {
1241                         yy_last_accepting_state = yy_current_state;
1242                         yy_last_accepting_cpos = yy_cp;
1243                         }
1244                 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1245                         {
1246                         yy_current_state = (int) yy_def[yy_current_state];
1247                         if ( yy_current_state >= 121 )
1248                                 yy_c = yy_meta[(unsigned int) yy_c];
1249                         }
1250                 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1251                 }
1252
1253         return yy_current_state;
1254         }
1255
1256
1257 /* yy_try_NUL_trans - try to make a transition on the NUL character
1258  *
1259  * synopsis
1260  *      next_state = yy_try_NUL_trans( current_state );
1261  */
1262
1263 #ifdef YY_USE_PROTOS
1264 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
1265 #else
1266 static yy_state_type yy_try_NUL_trans( yy_current_state )
1267 yy_state_type yy_current_state;
1268 #endif
1269         {
1270         register int yy_is_jam;
1271         register char *yy_cp = yy_c_buf_p;
1272
1273         register YY_CHAR yy_c = 1;
1274         if ( yy_accept[yy_current_state] )
1275                 {
1276                 yy_last_accepting_state = yy_current_state;
1277                 yy_last_accepting_cpos = yy_cp;
1278                 }
1279         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1280                 {
1281                 yy_current_state = (int) yy_def[yy_current_state];
1282                 if ( yy_current_state >= 121 )
1283                         yy_c = yy_meta[(unsigned int) yy_c];
1284                 }
1285         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1286         yy_is_jam = (yy_current_state == 120);
1287
1288         return yy_is_jam ? 0 : yy_current_state;
1289         }
1290
1291
1292 #ifndef YY_NO_UNPUT
1293 #ifdef YY_USE_PROTOS
1294 static void yyunput( int c, register char *yy_bp )
1295 #else
1296 static void yyunput( c, yy_bp )
1297 int c;
1298 register char *yy_bp;
1299 #endif
1300         {
1301         register char *yy_cp = yy_c_buf_p;
1302
1303         /* undo effects of setting up yytext */
1304         *yy_cp = yy_hold_char;
1305
1306         if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1307                 { /* need to shift things up to make room */
1308                 /* +2 for EOB chars. */
1309                 register int number_to_move = yy_n_chars + 2;
1310                 register char *dest = &yy_current_buffer->yy_ch_buf[
1311                                         yy_current_buffer->yy_buf_size + 2];
1312                 register char *source =
1313                                 &yy_current_buffer->yy_ch_buf[number_to_move];
1314
1315                 while ( source > yy_current_buffer->yy_ch_buf )
1316                         *--dest = *--source;
1317
1318                 yy_cp += (int) (dest - source);
1319                 yy_bp += (int) (dest - source);
1320                 yy_current_buffer->yy_n_chars =
1321                         yy_n_chars = yy_current_buffer->yy_buf_size;
1322
1323                 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1324                         YY_FATAL_ERROR( "flex scanner push-back overflow" );
1325                 }
1326
1327         *--yy_cp = (char) c;
1328
1329
1330         yytext_ptr = yy_bp;
1331         yy_hold_char = *yy_cp;
1332         yy_c_buf_p = yy_cp;
1333         }
1334 #endif  /* ifndef YY_NO_UNPUT */
1335
1336
1337 #ifndef YY_NO_INPUT
1338 #ifdef __cplusplus
1339 static int yyinput()
1340 #else
1341 static int input()
1342 #endif
1343         {
1344         int c;
1345
1346         *yy_c_buf_p = yy_hold_char;
1347
1348         if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1349                 {
1350                 /* yy_c_buf_p now points to the character we want to return.
1351                  * If this occurs *before* the EOB characters, then it's a
1352                  * valid NUL; if not, then we've hit the end of the buffer.
1353                  */
1354                 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1355                         /* This was really a NUL. */
1356                         *yy_c_buf_p = '\0';
1357
1358                 else
1359                         { /* need more input */
1360                         int offset = yy_c_buf_p - yytext_ptr;
1361                         ++yy_c_buf_p;
1362
1363                         switch ( yy_get_next_buffer() )
1364                                 {
1365                                 case EOB_ACT_LAST_MATCH:
1366                                         /* This happens because yy_g_n_b()
1367                                          * sees that we've accumulated a
1368                                          * token and flags that we need to
1369                                          * try matching the token before
1370                                          * proceeding.  But for input(),
1371                                          * there's no matching to consider.
1372                                          * So convert the EOB_ACT_LAST_MATCH
1373                                          * to EOB_ACT_END_OF_FILE.
1374                                          */
1375
1376                                         /* Reset buffer status. */
1377                                         yyrestart( yyin );
1378
1379                                         /* fall through */
1380
1381                                 case EOB_ACT_END_OF_FILE:
1382                                         {
1383                                         if ( yywrap() )
1384                                                 return EOF;
1385
1386                                         if ( ! yy_did_buffer_switch_on_eof )
1387                                                 YY_NEW_FILE;
1388 #ifdef __cplusplus
1389                                         return yyinput();
1390 #else
1391                                         return input();
1392 #endif
1393                                         }
1394
1395                                 case EOB_ACT_CONTINUE_SCAN:
1396                                         yy_c_buf_p = yytext_ptr + offset;
1397                                         break;
1398                                 }
1399                         }
1400                 }
1401
1402         c = *(unsigned char *) yy_c_buf_p;      /* cast for 8-bit char's */
1403         *yy_c_buf_p = '\0';     /* preserve yytext */
1404         yy_hold_char = *++yy_c_buf_p;
1405
1406
1407         return c;
1408         }
1409 #endif /* YY_NO_INPUT */
1410
1411 #ifdef YY_USE_PROTOS
1412 void yyrestart( FILE *input_file )
1413 #else
1414 void yyrestart( input_file )
1415 FILE *input_file;
1416 #endif
1417         {
1418         if ( ! yy_current_buffer )
1419                 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1420
1421         yy_init_buffer( yy_current_buffer, input_file );
1422         yy_load_buffer_state();
1423         }
1424
1425
1426 #ifdef YY_USE_PROTOS
1427 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1428 #else
1429 void yy_switch_to_buffer( new_buffer )
1430 YY_BUFFER_STATE new_buffer;
1431 #endif
1432         {
1433         if ( yy_current_buffer == new_buffer )
1434                 return;
1435
1436         if ( yy_current_buffer )
1437                 {
1438                 /* Flush out information for old buffer. */
1439                 *yy_c_buf_p = yy_hold_char;
1440                 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1441                 yy_current_buffer->yy_n_chars = yy_n_chars;
1442                 }
1443
1444         yy_current_buffer = new_buffer;
1445         yy_load_buffer_state();
1446
1447         /* We don't actually know whether we did this switch during
1448          * EOF (yywrap()) processing, but the only time this flag
1449          * is looked at is after yywrap() is called, so it's safe
1450          * to go ahead and always set it.
1451          */
1452         yy_did_buffer_switch_on_eof = 1;
1453         }
1454
1455
1456 #ifdef YY_USE_PROTOS
1457 void yy_load_buffer_state( void )
1458 #else
1459 void yy_load_buffer_state()
1460 #endif
1461         {
1462         yy_n_chars = yy_current_buffer->yy_n_chars;
1463         yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1464         yyin = yy_current_buffer->yy_input_file;
1465         yy_hold_char = *yy_c_buf_p;
1466         }
1467
1468
1469 #ifdef YY_USE_PROTOS
1470 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1471 #else
1472 YY_BUFFER_STATE yy_create_buffer( file, size )
1473 FILE *file;
1474 int size;
1475 #endif
1476         {
1477         YY_BUFFER_STATE b;
1478
1479         b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1480         if ( ! b )
1481                 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1482
1483         b->yy_buf_size = size;
1484
1485         /* yy_ch_buf has to be 2 characters longer than the size given because
1486          * we need to put in 2 end-of-buffer characters.
1487          */
1488         b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
1489         if ( ! b->yy_ch_buf )
1490                 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1491
1492         b->yy_is_our_buffer = 1;
1493
1494         yy_init_buffer( b, file );
1495
1496         return b;
1497         }
1498
1499
1500 #ifdef YY_USE_PROTOS
1501 void yy_delete_buffer( YY_BUFFER_STATE b )
1502 #else
1503 void yy_delete_buffer( b )
1504 YY_BUFFER_STATE b;
1505 #endif
1506         {
1507         if ( ! b )
1508                 return;
1509
1510         if ( b == yy_current_buffer )
1511                 yy_current_buffer = (YY_BUFFER_STATE) 0;
1512
1513         if ( b->yy_is_our_buffer )
1514                 yy_flex_free( (void *) b->yy_ch_buf );
1515
1516         yy_flex_free( (void *) b );
1517         }
1518
1519
1520
1521 #ifdef YY_USE_PROTOS
1522 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1523 #else
1524 void yy_init_buffer( b, file )
1525 YY_BUFFER_STATE b;
1526 FILE *file;
1527 #endif
1528
1529
1530         {
1531         yy_flush_buffer( b );
1532
1533         b->yy_input_file = file;
1534         b->yy_fill_buffer = 1;
1535
1536 #if YY_ALWAYS_INTERACTIVE
1537         b->yy_is_interactive = 1;
1538 #else
1539 #if YY_NEVER_INTERACTIVE
1540         b->yy_is_interactive = 0;
1541 #else
1542         b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1543 #endif
1544 #endif
1545         }
1546
1547
1548 #ifdef YY_USE_PROTOS
1549 void yy_flush_buffer( YY_BUFFER_STATE b )
1550 #else
1551 void yy_flush_buffer( b )
1552 YY_BUFFER_STATE b;
1553 #endif
1554
1555         {
1556         if ( ! b )
1557                 return;
1558
1559         b->yy_n_chars = 0;
1560
1561         /* We always need two end-of-buffer characters.  The first causes
1562          * a transition to the end-of-buffer state.  The second causes
1563          * a jam in that state.
1564          */
1565         b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1566         b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1567
1568         b->yy_buf_pos = &b->yy_ch_buf[0];
1569
1570         b->yy_at_bol = 1;
1571         b->yy_buffer_status = YY_BUFFER_NEW;
1572
1573         if ( b == yy_current_buffer )
1574                 yy_load_buffer_state();
1575         }
1576
1577
1578 #ifndef YY_NO_SCAN_BUFFER
1579 #ifdef YY_USE_PROTOS
1580 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
1581 #else
1582 YY_BUFFER_STATE yy_scan_buffer( base, size )
1583 char *base;
1584 yy_size_t size;
1585 #endif
1586         {
1587         YY_BUFFER_STATE b;
1588
1589         if ( size < 2 ||
1590              base[size-2] != YY_END_OF_BUFFER_CHAR ||
1591              base[size-1] != YY_END_OF_BUFFER_CHAR )
1592                 /* They forgot to leave room for the EOB's. */
1593                 return 0;
1594
1595         b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1596         if ( ! b )
1597                 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1598
1599         b->yy_buf_size = size - 2;      /* "- 2" to take care of EOB's */
1600         b->yy_buf_pos = b->yy_ch_buf = base;
1601         b->yy_is_our_buffer = 0;
1602         b->yy_input_file = 0;
1603         b->yy_n_chars = b->yy_buf_size;
1604         b->yy_is_interactive = 0;
1605         b->yy_at_bol = 1;
1606         b->yy_fill_buffer = 0;
1607         b->yy_buffer_status = YY_BUFFER_NEW;
1608
1609         yy_switch_to_buffer( b );
1610
1611         return b;
1612         }
1613 #endif
1614
1615
1616 #ifndef YY_NO_SCAN_STRING
1617 #ifdef YY_USE_PROTOS
1618 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
1619 #else
1620 YY_BUFFER_STATE yy_scan_string( yy_str )
1621 yyconst char *yy_str;
1622 #endif
1623         {
1624         int len;
1625         for ( len = 0; yy_str[len]; ++len )
1626                 ;
1627
1628         return yy_scan_bytes( yy_str, len );
1629         }
1630 #endif
1631
1632
1633 #ifndef YY_NO_SCAN_BYTES
1634 #ifdef YY_USE_PROTOS
1635 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
1636 #else
1637 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
1638 yyconst char *bytes;
1639 int len;
1640 #endif
1641         {
1642         YY_BUFFER_STATE b;
1643         char *buf;
1644         yy_size_t n;
1645         int i;
1646
1647         /* Get memory for full buffer, including space for trailing EOB's. */
1648         n = len + 2;
1649         buf = (char *) yy_flex_alloc( n );
1650         if ( ! buf )
1651                 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1652
1653         for ( i = 0; i < len; ++i )
1654                 buf[i] = bytes[i];
1655
1656         buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1657
1658         b = yy_scan_buffer( buf, n );
1659         if ( ! b )
1660                 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1661
1662         /* It's okay to grow etc. this buffer, and we should throw it
1663          * away when we're done.
1664          */
1665         b->yy_is_our_buffer = 1;
1666
1667         return b;
1668         }
1669 #endif
1670
1671
1672 #ifndef YY_NO_PUSH_STATE
1673 #ifdef YY_USE_PROTOS
1674 static void yy_push_state( int new_state )
1675 #else
1676 static void yy_push_state( new_state )
1677 int new_state;
1678 #endif
1679         {
1680         if ( yy_start_stack_ptr >= yy_start_stack_depth )
1681                 {
1682                 yy_size_t new_size;
1683
1684                 yy_start_stack_depth += YY_START_STACK_INCR;
1685                 new_size = yy_start_stack_depth * sizeof( int );
1686
1687                 if ( ! yy_start_stack )
1688                         yy_start_stack = (int *) yy_flex_alloc( new_size );
1689
1690                 else
1691                         yy_start_stack = (int *) yy_flex_realloc(
1692                                         (void *) yy_start_stack, new_size );
1693
1694                 if ( ! yy_start_stack )
1695                         YY_FATAL_ERROR(
1696                         "out of memory expanding start-condition stack" );
1697                 }
1698
1699         yy_start_stack[yy_start_stack_ptr++] = YY_START;
1700
1701         BEGIN(new_state);
1702         }
1703 #endif
1704
1705
1706 #ifndef YY_NO_POP_STATE
1707 static void yy_pop_state()
1708         {
1709         if ( --yy_start_stack_ptr < 0 )
1710                 YY_FATAL_ERROR( "start-condition stack underflow" );
1711
1712         BEGIN(yy_start_stack[yy_start_stack_ptr]);
1713         }
1714 #endif
1715
1716
1717 #ifndef YY_NO_TOP_STATE
1718 static int yy_top_state()
1719         {
1720         return yy_start_stack[yy_start_stack_ptr - 1];
1721         }
1722 #endif
1723
1724 #ifndef YY_EXIT_FAILURE
1725 #define YY_EXIT_FAILURE 2
1726 #endif
1727
1728 #ifdef YY_USE_PROTOS
1729 static void yy_fatal_error( yyconst char msg[] )
1730 #else
1731 static void yy_fatal_error( msg )
1732 char msg[];
1733 #endif
1734         {
1735         (void) fprintf( stderr, "%s\n", msg );
1736         exit( YY_EXIT_FAILURE );
1737         }
1738
1739
1740
1741 /* Redefine yyless() so it works in section 3 code. */
1742
1743 #undef yyless
1744 #define yyless(n) \
1745         do \
1746                 { \
1747                 /* Undo effects of setting up yytext. */ \
1748                 yytext[yyleng] = yy_hold_char; \
1749                 yy_c_buf_p = yytext + n; \
1750                 yy_hold_char = *yy_c_buf_p; \
1751                 *yy_c_buf_p = '\0'; \
1752                 yyleng = n; \
1753                 } \
1754         while ( 0 )
1755
1756
1757 /* Internal utility routines. */
1758
1759 #ifndef yytext_ptr
1760 #ifdef YY_USE_PROTOS
1761 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
1762 #else
1763 static void yy_flex_strncpy( s1, s2, n )
1764 char *s1;
1765 yyconst char *s2;
1766 int n;
1767 #endif
1768         {
1769         register int i;
1770         for ( i = 0; i < n; ++i )
1771                 s1[i] = s2[i];
1772         }
1773 #endif
1774
1775 #ifdef YY_NEED_STRLEN
1776 #ifdef YY_USE_PROTOS
1777 static int yy_flex_strlen( yyconst char *s )
1778 #else
1779 static int yy_flex_strlen( s )
1780 yyconst char *s;
1781 #endif
1782         {
1783         register int n;
1784         for ( n = 0; s[n]; ++n )
1785                 ;
1786
1787         return n;
1788         }
1789 #endif
1790
1791
1792 #ifdef YY_USE_PROTOS
1793 static void *yy_flex_alloc( yy_size_t size )
1794 #else
1795 static void *yy_flex_alloc( size )
1796 yy_size_t size;
1797 #endif
1798         {
1799         return (void *) malloc( size );
1800         }
1801
1802 #ifdef YY_USE_PROTOS
1803 static void *yy_flex_realloc( void *ptr, yy_size_t size )
1804 #else
1805 static void *yy_flex_realloc( ptr, size )
1806 void *ptr;
1807 yy_size_t size;
1808 #endif
1809         {
1810         /* The cast to (char *) in the following accommodates both
1811          * implementations that use char* generic pointers, and those
1812          * that use void* generic pointers.  It works with the latter
1813          * because both ANSI C and C++ allow castless assignment from
1814          * any pointer type to void*, and deal with argument conversions
1815          * as though doing an assignment.
1816          */
1817         return (void *) realloc( (char *) ptr, size );
1818         }
1819
1820 #ifdef YY_USE_PROTOS
1821 static void yy_flex_free( void *ptr )
1822 #else
1823 static void yy_flex_free( ptr )
1824 void *ptr;
1825 #endif
1826         {
1827         free( ptr );
1828         }
1829
1830 #if YY_MAIN
1831 int main()
1832         {
1833         yylex();
1834         return 0;
1835         }
1836 #endif
1837 #line 148 "uscan.l"
1838
1839
1840 int process_line(line)
1841 char *line;
1842 {
1843     YY_BUFFER_STATE b;
1844     int result;
1845
1846     b = yy_scan_string(line);           /* tell lex to scan lineread */
1847     result = yyparse();                 /* parse lineread and act */
1848     yy_delete_buffer(b);
1849     return result;
1850 }
1851
1852 static int ll_parse_date(type, text)
1853 int type;
1854 char *text;
1855 {
1856     time_t now;
1857     struct tm *t;
1858     int y, m, d;
1859     int ret;
1860
1861     now = time((time_t *)NULL);
1862     t = localtime(&now);
1863     y = 1900+t->tm_year;
1864     m = t->tm_mon+1;
1865     d = t->tm_mday;
1866     if(type == 1) {
1867         sscanf(text, "---%d", &d);
1868     } else if(type == 2) {
1869         sscanf(text, "--%d-%d", &m, &d);
1870     } else {
1871         sscanf(text, "%d-%d-%d", &y, &m, &d);
1872         if(y < 70) {
1873             y += 2000;
1874         } else if(y < 100) {
1875             y += 1900;
1876         }
1877     }
1878     ret = PATH;                         /* cause a parse error */
1879     if(y < 1000 || y > 9999) {
1880         yyerror("invalid year");
1881     } else if(m < 1 || m > 12) {
1882         yyerror("invalid month");
1883     } else if(d < 1 || d > 31) {
1884         yyerror("invalid day");
1885     } else {
1886         yylval.strval = alloc(DATE_ALLOC_SIZE);
1887         ap_snprintf(yylval.strval, DATE_ALLOC_SIZE, "%04d-%02d-%02d", y, m, d);
1888         ret = DATE;
1889     }
1890     return ret;
1891 }
1892
1893 int yywrap() {
1894   return 1;
1895 }