X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=oldrecover-src%2Fuscan.c;h=d53a9e6542fd61a848164e4f76a76536f28ba22b;hb=d65404863e3d293566f37e99a062a7524eff623f;hp=01f7936bb5d1f0591884c1555d7c49d5fda6b39a;hpb=94a044f90357edefa6f4ae9f0b1d5885b0e34aee;p=debian%2Famanda diff --git a/oldrecover-src/uscan.c b/oldrecover-src/uscan.c index 01f7936..d53a9e6 100644 --- a/oldrecover-src/uscan.c +++ b/oldrecover-src/uscan.c @@ -8,7 +8,7 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 33 +#define YY_FLEX_SUBMINOR_VERSION 35 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -30,7 +30,7 @@ /* C99 systems have . Non-C99 systems may or may not. */ -#if __STDC_VERSION__ >= 199901L +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. @@ -93,11 +93,12 @@ typedef unsigned int flex_uint32_t; #else /* ! __cplusplus */ -#if __STDC__ +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) #define YY_USE_CONST -#endif /* __STDC__ */ +#endif /* defined (__STDC__) */ #endif /* ! __cplusplus */ #ifdef YY_USE_CONST @@ -177,14 +178,9 @@ extern FILE *yyin, *yyout; #define unput(c) yyunput( c, (yytext_ptr) ) -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ - #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T -typedef unsigned int yy_size_t; +typedef size_t yy_size_t; #endif #ifndef YY_STRUCT_YY_BUFFER_STATE @@ -537,6 +533,7 @@ char *yytext; /* * amanda, the advanced maryland automatic network disk archiver * Copyright (c) 1991-2000 University of Maryland at College Park + * Copyright (c) 2007-2012 Zmanda, Inc. All Rights Reserved. * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software and its @@ -564,7 +561,7 @@ char *yytext; * * lexer for amrecover interactive language */ -#line 32 "uscan.l" +#line 33 "uscan.l" #include "amanda.h" #include "uparse.h" @@ -591,9 +588,9 @@ extern int yyparse(void); static int ll_parse_date(int type, char *text); int process_line(char *line); -#line 62 "uscan.l" +#line 63 "uscan.l" static char *string_buf = NULL; -#line 597 "uscan.c" +#line 594 "uscan.c" #define INITIAL 0 #define quotedpath 1 @@ -683,7 +680,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -694,7 +691,7 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - size_t n; \ + unsigned n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -776,14 +773,14 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -#line 65 "uscan.l" +#line 66 "uscan.l" /* literal keyword tokens */ -#line 787 "uscan.c" +#line 784 "uscan.c" if ( !(yy_init) ) { @@ -868,142 +865,142 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 71 "uscan.l" +#line 72 "uscan.l" { return LISTHOST; } YY_BREAK case 2: YY_RULE_SETUP -#line 72 "uscan.l" +#line 73 "uscan.l" { return LISTDISK; } YY_BREAK case 3: YY_RULE_SETUP -#line 73 "uscan.l" +#line 74 "uscan.l" { return SETHOST; } YY_BREAK case 4: YY_RULE_SETUP -#line 74 "uscan.l" +#line 75 "uscan.l" { return SETDISK; } YY_BREAK case 5: YY_RULE_SETUP -#line 75 "uscan.l" +#line 76 "uscan.l" { return SETDATE; } YY_BREAK case 6: YY_RULE_SETUP -#line 76 "uscan.l" +#line 77 "uscan.l" { return SETMODE; } YY_BREAK case 7: YY_RULE_SETUP -#line 77 "uscan.l" +#line 78 "uscan.l" { return SETTAPE; } YY_BREAK case 8: YY_RULE_SETUP -#line 78 "uscan.l" +#line 79 "uscan.l" { return CD; } YY_BREAK case 9: YY_RULE_SETUP -#line 79 "uscan.l" +#line 80 "uscan.l" { return CDX; } YY_BREAK case 10: YY_RULE_SETUP -#line 80 "uscan.l" +#line 81 "uscan.l" { return QUIT; } YY_BREAK case 11: YY_RULE_SETUP -#line 81 "uscan.l" +#line 82 "uscan.l" { return QUIT; } YY_BREAK case 12: YY_RULE_SETUP -#line 82 "uscan.l" +#line 83 "uscan.l" { return DHIST; } YY_BREAK case 13: YY_RULE_SETUP -#line 83 "uscan.l" +#line 84 "uscan.l" { return LS; } YY_BREAK case 14: YY_RULE_SETUP -#line 84 "uscan.l" +#line 85 "uscan.l" { return ADD; } YY_BREAK case 15: YY_RULE_SETUP -#line 85 "uscan.l" +#line 86 "uscan.l" { return ADDX; } YY_BREAK case 16: YY_RULE_SETUP -#line 86 "uscan.l" +#line 87 "uscan.l" { return LIST; } YY_BREAK case 17: YY_RULE_SETUP -#line 87 "uscan.l" +#line 88 "uscan.l" { return DELETE; } YY_BREAK case 18: YY_RULE_SETUP -#line 88 "uscan.l" +#line 89 "uscan.l" { return DELETEX; } YY_BREAK case 19: YY_RULE_SETUP -#line 89 "uscan.l" +#line 90 "uscan.l" { return PWD; } YY_BREAK case 20: YY_RULE_SETUP -#line 90 "uscan.l" +#line 91 "uscan.l" { return CLEAR; } YY_BREAK case 21: YY_RULE_SETUP -#line 91 "uscan.l" +#line 92 "uscan.l" { return HELP; } YY_BREAK case 22: YY_RULE_SETUP -#line 92 "uscan.l" +#line 93 "uscan.l" { return HELP; } YY_BREAK case 23: YY_RULE_SETUP -#line 93 "uscan.l" +#line 94 "uscan.l" { return LCD; } YY_BREAK case 24: YY_RULE_SETUP -#line 94 "uscan.l" +#line 95 "uscan.l" { return LPWD; } YY_BREAK case 25: YY_RULE_SETUP -#line 95 "uscan.l" +#line 96 "uscan.l" { return EXTRACT; } YY_BREAK case 26: YY_RULE_SETUP -#line 96 "uscan.l" +#line 97 "uscan.l" { return SMB; } YY_BREAK case 27: YY_RULE_SETUP -#line 97 "uscan.l" +#line 98 "uscan.l" { return TAR; } YY_BREAK case 28: YY_RULE_SETUP -#line 98 "uscan.l" +#line 99 "uscan.l" { return MODE; } YY_BREAK @@ -1011,27 +1008,27 @@ YY_RULE_SETUP case 29: YY_RULE_SETUP -#line 104 "uscan.l" +#line 105 "uscan.l" { return ll_parse_date(1, yytext); } YY_BREAK case 30: YY_RULE_SETUP -#line 105 "uscan.l" +#line 106 "uscan.l" { return ll_parse_date(2, yytext); } YY_BREAK case 31: YY_RULE_SETUP -#line 106 "uscan.l" +#line 107 "uscan.l" { return ll_parse_date(3, yytext); } YY_BREAK case 32: YY_RULE_SETUP -#line 107 "uscan.l" +#line 108 "uscan.l" { return ll_parse_date(4, yytext); } YY_BREAK case 33: YY_RULE_SETUP -#line 108 "uscan.l" +#line 109 "uscan.l" { return ll_parse_date(5, yytext); } YY_BREAK @@ -1039,7 +1036,7 @@ YY_RULE_SETUP case 34: YY_RULE_SETUP -#line 114 "uscan.l" +#line 115 "uscan.l" { if(string_buf != NULL) { g_printf("ERROR:string_buf != NULL: %s\n",string_buf); @@ -1051,14 +1048,14 @@ YY_RULE_SETUP case 35: /* rule 35 can match eol */ YY_RULE_SETUP -#line 122 "uscan.l" +#line 123 "uscan.l" { strappend(string_buf, yytext); } YY_BREAK case 36: YY_RULE_SETUP -#line 126 "uscan.l" +#line 127 "uscan.l" { /* escaped character (including quote) */ strappend(string_buf, yytext); @@ -1066,7 +1063,7 @@ YY_RULE_SETUP YY_BREAK case 37: YY_RULE_SETUP -#line 131 "uscan.l" +#line 132 "uscan.l" { /* saw closing quote - all done */ strappend(string_buf, yytext); yylval.strval = string_buf; @@ -1080,7 +1077,7 @@ YY_RULE_SETUP case 38: YY_RULE_SETUP -#line 143 "uscan.l" +#line 144 "uscan.l" { yylval.strval = stralloc(yytext); return PATH; @@ -1092,7 +1089,7 @@ YY_RULE_SETUP case 39: /* rule 39 can match eol */ YY_RULE_SETUP -#line 152 "uscan.l" +#line 153 "uscan.l" ; /* whitespace */ YY_BREAK @@ -1106,10 +1103,10 @@ YY_RULE_SETUP case 40: YY_RULE_SETUP -#line 165 "uscan.l" +#line 166 "uscan.l" ECHO; YY_BREAK -#line 1113 "uscan.c" +#line 1110 "uscan.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(quotedpath): yyterminate(); @@ -1341,7 +1338,7 @@ static int yy_get_next_buffer (void) /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), num_to_read ); + (yy_n_chars), (size_t) num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } @@ -1365,6 +1362,14 @@ static int yy_get_next_buffer (void) else ret_val = EOB_ACT_CONTINUE_SCAN; + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + (yy_n_chars) += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; @@ -1780,7 +1785,9 @@ static void yyensure_buffer_stack (void) (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); - + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; @@ -1798,6 +1805,8 @@ static void yyensure_buffer_stack (void) ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); @@ -1842,7 +1851,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) /** Setup the input buffer state to scan a string. The next call to yylex() will * scan from a @e copy of @a str. - * @param str a NUL-terminated string to scan + * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use @@ -2096,7 +2105,7 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 165 "uscan.l" +#line 166 "uscan.l"