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