/* $OpenBSD: flex.skl,v 1.10 2007/01/26 14:38:19 tsi Exp $ */ /* A lexical scanner generated by flex */ /* Scanner skeleton version: * $Header: /home/cvs/courtesan/sudo/toke.c,v 1.37 2009/07/18 13:55:37 millert Exp $ */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #include #include /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ #ifdef c_plusplus #ifndef __cplusplus #define __cplusplus #endif #endif #ifdef __cplusplus #include #include /* Use prototypes in function declarations. */ #define YY_USE_PROTOS /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ #ifdef __STDC__ #define YY_USE_PROTOS #define YY_USE_CONST #endif /* __STDC__ */ #endif /* ! __cplusplus */ #ifdef __TURBOC__ #pragma warn -rch #pragma warn -use #include #include #define YY_USE_CONST #define YY_USE_PROTOS #endif #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif #ifdef YY_USE_PROTOS #define YY_PROTO(proto) proto #else #define YY_PROTO(proto) () #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN yy_start = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START ((yy_start - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE yyrestart( yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #define YY_BUF_SIZE 16384 typedef struct yy_buffer_state *YY_BUFFER_STATE; extern int yyleng; extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 /* The funky do-while in the following #define is used to turn the definition * int a single C statement (which needs a semi-colon terminator). This * avoids problems with code like: * * if ( condition_holds ) * yyless( 5 ); * else * do_something_else(); * * Prior to using the do-while the compiler would get upset at the * "else" because it interpreted the "if" statement as being all * done when it reached the ';' after the yyless() call. */ /* Return all but the first 'n' matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ *yy_cp = yy_hold_char; \ YY_RESTORE_YY_MORE_OFFSET \ yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) #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). */ typedef unsigned int yy_size_t; struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via yyrestart()), so that the user can continue scanning by * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; static YY_BUFFER_STATE yy_current_buffer = 0; /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". */ #define YY_CURRENT_BUFFER yy_current_buffer /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 1; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void yyrestart YY_PROTO(( FILE *input_file )); void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); void yy_load_buffer_state YY_PROTO(( void )); YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); static void *yy_flex_alloc YY_PROTO(( yy_size_t )); static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); static void yy_flex_free YY_PROTO(( void * )); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! yy_current_buffer ) \ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ yy_current_buffer->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! yy_current_buffer ) \ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ yy_current_buffer->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (yy_current_buffer->yy_at_bol) #define yywrap() 1 #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; typedef int yy_state_type; extern char *yytext; #define yytext_ptr yytext static yy_state_type yy_get_previous_state YY_PROTO(( void )); static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); static int yy_get_next_buffer YY_PROTO(( void )); static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ yytext_ptr = yy_bp; \ yyleng = (int) (yy_cp - yy_bp); \ yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yy_c_buf_p = yy_cp; #define YY_NUM_RULES 50 #define YY_END_OF_BUFFER 51 static yyconst short int yy_accept[554] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, 38, 46, 45, 44, 38, 49, 38, 39, 40, 38, 41, 38, 38, 38, 38, 43, 42, 49, 33, 33, 33, 33, 33, 33, 49, 38, 38, 46, 49, 33, 33, 33, 33, 33, 1, 49, 38, 38, 16, 15, 16, 15, 15, 49, 49, 49, 2, 8, 7, 8, 3, 8, 4, 49, 12, 12, 12, 10, 11, 38, 0, 46, 44, 38, 0, 0, 0, 48, 0, 38, 28, 0, 0, 27, 0, 36, 36, 0, 38, 38, 0, 38, 38, 38, 38, 0, 31, 33, 33, 33, 33, 33, 33, 38, 47, 38, 46, 0, 0, 0, 0, 0, 0, 38, 38, 38, 38, 38, 1, 0, 34, 34, 0, 38, 16, 16, 14, 13, 14, 0, 0, 2, 8, 0, 5, 6, 8, 8, 12, 0, 12, 12, 0, 9, 37, 37, 0, 0, 28, 0, 0, 38, 38, 38, 38, 38, 0, 0, 31, 31, 33, 33, 33, 33, 33, 33, 33, 38, 0, 0, 0, 0, 0, 0, 38, 38, 38, 38, 38, 0, 38, 9, 0, 38, 38, 38, 38, 38, 38, 0, 32, 32, 32, 0, 0, 31, 31, 31, 31, 31, 31, 31, 33, 33, 33, 33, 33, 33, 33, 38, 0, 0, 0, 0, 0, 0, 38, 38, 38, 38, 38, 38, 38, 0, 0, 32, 32, 32, 0, 31, 31, 0, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 0, 24, 33, 33, 33, 33, 33, 38, 0, 0, 0, 0, 38, 38, 38, 38, 38, 38, 38, 38, 0, 32, 0, 31, 31, 31, 0, 0, 0, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 33, 33, 33, 33, 33, 38, 0, 0, 0, 38, 38, 38, 29, 29, 29, 0, 0, 31, 31, 31, 31, 31, 31, 31, 0, 0, 0, 0, 0, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 0, 23, 33, 33, 0, 22, 0, 25, 38, 0, 0, 0, 38, 38, 38, 38, 29, 29, 29, 29, 0, 31, 0, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 0, 0, 0, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 33, 33, 35, 0, 0, 0, 38, 19, 34, 38, 30, 30, 30, 31, 0, 0, 0, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 0, 0, 0, 0, 0, 31, 31, 31, 31, 31, 31, 31, 31, 0, 21, 0, 26, 0, 19, 0, 0, 38, 0, 38, 38, 38, 30, 30, 30, 30, 30, 0, 0, 0, 0, 0, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 0, 0, 0, 20, 19, 0, 19, 0, 38, 38, 38, 30, 30, 0, 0, 0, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 20, 0, 17, 0, 38, 38, 38, 38, 38, 0, 0, 0, 0, 0, 31, 31, 31, 31, 31, 31, 31, 31, 0, 38, 38, 38, 31, 31, 31, 31, 31, 31, 0, 38, 38, 38, 38, 38, 31, 31, 31, 31, 31, 0, 18, 29, 29, 29, 29, 29, 29, 0 } ; static yyconst int yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 5, 6, 1, 7, 1, 1, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 22, 22, 23, 24, 1, 1, 25, 26, 10, 27, 28, 29, 30, 31, 32, 29, 33, 34, 33, 33, 33, 33, 33, 35, 36, 37, 33, 38, 39, 40, 41, 42, 43, 44, 33, 33, 10, 45, 10, 1, 46, 1, 47, 48, 49, 50, 51, 52, 53, 53, 54, 53, 53, 55, 56, 57, 58, 53, 53, 59, 60, 61, 62, 53, 53, 53, 53, 53, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static yyconst int yy_meta[63] = { 0, 1, 2, 3, 4, 5, 6, 1, 4, 4, 1, 1, 2, 1, 7, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 6, 4, 1, 9, 9, 9, 9, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 11, 12, 13, 13, 13, 13, 13, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12 } ; static yyconst short int yy_base[620] = { 0, 0, 61, 62, 63, 69, 84, 128, 189, 250, 294, 80, 101, 2349, 2303, 2345, 3488, 2316, 338, 381, 52, 3488, 3488, 2272, 3488, 107, 391, 119, 137, 2292, 3488, 3488, 443, 2271, 490, 2270, 2260, 2253, 541, 145, 55, 167, 565, 2228, 2232, 2224, 2219, 2206, 2254, 193, 256, 56, 0, 3488, 2249, 0, 3488, 264, 617, 77, 0, 2199, 3488, 82, 3488, 99, 3488, 110, 2189, 126, 106, 3488, 145, 2179, 306, 2185, 2182, 639, 2145, 2144, 2135, 3488, 201, 209, 74, 2082, 347, 2079, 550, 276, 2078, 587, 410, 669, 2098, 2104, 306, 358, 317, 2092, 179, 706, 0, 2083, 240, 2075, 2071, 389, 3488, 76, 355, 2039, 2041, 2033, 2021, 2000, 63, 115, 219, 29, 212, 98, 2056, 507, 361, 1986, 598, 154, 0, 2024, 256, 3488, 3488, 636, 284, 0, 1982, 567, 3488, 3488, 1981, 532, 1979, 1994, 271, 300, 288, 1975, 1905, 3488, 1944, 1916, 1873, 669, 603, 745, 777, 809, 841, 1902, 1876, 878, 268, 916, 953, 1869, 1854, 1854, 1849, 1841, 1831, 236, 1805, 1788, 1746, 1748, 1719, 317, 157, 1722, 307, 266, 258, 777, 296, 1766, 1764, 686, 402, 992, 1024, 725, 337, 1727, 1726, 787, 499, 1708, 1707, 343, 755, 1056, 796, 694, 1094, 819, 1705, 393, 1681, 1673, 1671, 1639, 1646, 373, 1629, 1616, 1601, 1614, 1586, 543, 400, 556, 233, 506, 1133, 1165, 1197, 1620, 1619, 827, 1619, 1602, 1601, 1590, 540, 858, 546, 895, 602, 1229, 0, 935, 1240, 970, 731, 1278, 1002, 601, 3488, 1581, 1571, 1577, 1577, 1537, 486, 1532, 1515, 1470, 387, 343, 380, 616, 1010, 423, 1317, 1349, 1044, 1470, 1469, 1451, 1450, 1379, 645, 1076, 1113, 1143, 652, 983, 1035, 1151, 1042, 1418, 0, 1175, 1429, 1184, 866, 1467, 1207, 644, 1430, 1436, 648, 672, 625, 1428, 1400, 680, 576, 487, 715, 1505, 1536, 1567, 1430, 1382, 1381, 1215, 1599, 1257, 903, 1636, 1297, 1325, 1347, 1335, 1359, 1369, 841, 1024, 1067, 1124, 1396, 1308, 1675, 0, 1448, 1686, 1484, 1265, 1724, 1515, 955, 3488, 1329, 1282, 956, 3488, 975, 3488, 807, 1266, 1244, 591, 1074, 569, 917, 1523, 155, 1762, 1793, 1546, 1280, 1243, 1553, 768, 1576, 810, 1825, 0, 429, 1836, 1584, 1404, 1873, 1618, 1655, 1705, 1743, 1288, 1335, 1734, 1772, 1772, 1803, 1912, 0, 1805, 1923, 1781, 1492, 1814, 993, 1156, 1221, 1211, 1181, 730, 635, 1952, 1194, 1984, 2016, 2048, 2080, 1153, 1855, 1892, 1943, 1152, 1184, 1198, 1964, 1350, 2112, 0, 762, 2123, 1972, 1992, 2160, 2000, 2024, 1126, 2034, 2058, 2068, 1369, 1609, 1934, 772, 806, 2199, 0, 844, 1173, 3488, 1468, 3488, 1090, 2086, 1389, 142, 991, 1076, 1075, 2140, 1038, 2209, 2241, 2273, 2305, 2103, 2177, 1088, 2219, 2229, 2251, 1077, 1076, 1656, 1706, 2257, 1837, 2337, 0, 881, 2348, 2281, 2088, 2385, 2291, 2314, 2323, 2366, 1855, 981, 927, 934, 957, 902, 898, 808, 2416, 743, 2441, 2454, 2486, 2518, 2438, 1951, 2468, 2496, 2506, 757, 716, 1893, 2001, 2526, 2035, 2550, 0, 1012, 2561, 2534, 2148, 2580, 647, 2599, 2608, 2477, 634, 3488, 629, 3488, 1051, 2616, 1195, 2648, 2680, 2627, 2633, 594, 2659, 2669, 2690, 573, 566, 2049, 557, 549, 2698, 0, 1045, 1545, 2712, 2744, 2776, 2720, 2728, 2752, 509, 0, 455, 357, 2760, 1535, 2808, 2840, 2790, 3488, 2796, 2820, 2185, 3488, 345, 3488, 2828, 2848, 2858, 25, 2878, 2870, 3488, 2923, 2936, 2949, 2962, 2975, 2988, 3001, 3014, 3027, 3040, 3045, 3058, 3071, 3073, 3086, 3099, 3112, 3125, 3138, 3151, 3164, 3177, 3182, 3188, 3201, 3214, 3219, 3225, 3230, 3235, 3240, 3246, 3251, 3256, 3261, 3267, 3274, 3279, 3284, 3289, 3295, 3302, 3307, 3312, 3318, 3325, 3330, 3337, 3343, 3350, 3355, 3362, 3368, 3375, 3388, 3401, 3406, 3413, 3419, 3432, 3437, 3444, 3449, 3456, 3461, 3474 } ; static yyconst short int yy_def[620] = { 0, 553, 1, 1, 1, 554, 554, 555, 555, 556, 556, 557, 557, 553, 558, 553, 553, 553, 559, 560, 561, 553, 553, 562, 553, 563, 558, 26, 26, 564, 553, 553, 553, 32, 32, 34, 34, 34, 558, 26, 558, 553, 560, 32, 32, 34, 34, 34, 553, 553, 565, 558, 566, 553, 566, 566, 553, 553, 560, 553, 567, 568, 553, 568, 553, 568, 553, 569, 570, 570, 570, 553, 553, 558, 558, 553, 553, 559, 571, 559, 572, 553, 573, 553, 561, 574, 561, 562, 562, 563, 575, 558, 558, 26, 564, 93, 93, 93, 93, 576, 577, 32, 34, 34, 34, 34, 34, 558, 553, 558, 553, 553, 553, 553, 553, 553, 572, 558, 93, 558, 558, 558, 553, 553, 565, 578, 558, 558, 566, 566, 553, 553, 553, 573, 553, 567, 568, 568, 553, 553, 568, 568, 570, 553, 570, 570, 553, 553, 558, 553, 572, 579, 574, 574, 553, 558, 558, 558, 93, 158, 580, 553, 581, 553, 32, 34, 34, 34, 34, 34, 34, 558, 553, 553, 553, 553, 553, 572, 558, 158, 558, 558, 558, 553, 558, 553, 579, 558, 558, 558, 558, 558, 558, 582, 583, 583, 195, 584, 583, 585, 163, 553, 201, 201, 553, 201, 34, 34, 34, 34, 34, 34, 34, 558, 553, 553, 553, 553, 553, 572, 558, 558, 558, 558, 558, 558, 558, 553, 586, 586, 229, 586, 587, 588, 589, 553, 590, 204, 590, 590, 239, 590, 553, 242, 242, 553, 242, 553, 553, 34, 34, 34, 34, 34, 558, 553, 553, 553, 572, 558, 558, 558, 558, 558, 558, 558, 558, 591, 591, 592, 593, 553, 553, 553, 553, 553, 594, 594, 595, 245, 595, 595, 281, 595, 553, 284, 284, 553, 284, 34, 34, 34, 34, 34, 558, 553, 553, 572, 558, 558, 558, 558, 558, 558, 553, 596, 597, 271, 553, 308, 308, 553, 308, 553, 553, 553, 553, 553, 553, 598, 598, 599, 287, 599, 599, 324, 599, 553, 327, 327, 553, 327, 553, 553, 34, 34, 553, 553, 553, 553, 558, 553, 553, 572, 558, 558, 558, 558, 558, 558, 558, 558, 553, 600, 553, 601, 311, 601, 601, 358, 358, 553, 361, 361, 553, 361, 553, 553, 553, 553, 602, 602, 603, 330, 603, 603, 375, 603, 553, 378, 378, 378, 34, 34, 558, 553, 553, 572, 558, 558, 558, 558, 558, 558, 558, 553, 553, 553, 553, 604, 604, 605, 364, 605, 605, 404, 404, 553, 407, 407, 553, 407, 553, 553, 553, 553, 553, 553, 606, 606, 607, 607, 607, 422, 422, 553, 553, 553, 553, 553, 553, 572, 572, 558, 608, 609, 558, 558, 558, 558, 558, 558, 558, 553, 553, 553, 553, 553, 553, 610, 610, 611, 410, 611, 611, 454, 454, 553, 457, 457, 553, 457, 553, 553, 553, 553, 612, 612, 553, 613, 572, 558, 608, 608, 609, 609, 558, 558, 558, 558, 558, 553, 553, 553, 553, 614, 614, 615, 460, 615, 615, 490, 490, 553, 493, 493, 493, 553, 553, 553, 553, 553, 553, 613, 553, 572, 558, 558, 558, 558, 558, 553, 553, 553, 553, 553, 553, 616, 616, 617, 617, 617, 521, 521, 572, 558, 558, 558, 553, 553, 553, 553, 618, 618, 619, 558, 558, 558, 558, 558, 553, 553, 553, 553, 553, 619, 553, 558, 558, 558, 558, 558, 558, 0, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553 } ; static yyconst short int yy_nxt[3551] = { 0, 14, 15, 16, 17, 18, 19, 20, 21, 22, 14, 23, 24, 14, 14, 25, 26, 27, 28, 26, 26, 26, 26, 26, 29, 30, 31, 14, 32, 32, 32, 32, 33, 34, 34, 35, 34, 36, 34, 37, 34, 34, 34, 34, 34, 38, 14, 39, 39, 39, 39, 39, 39, 14, 14, 14, 14, 14, 14, 14, 40, 14, 14, 41, 48, 48, 81, 42, 49, 49, 74, 15, 53, 54, 74, 55, 85, 50, 50, 134, 108, 56, 69, 16, 70, 71, 15, 53, 54, 180, 55, 43, 44, 56, 55, 45, 56, 86, 553, 46, 74, 74, 47, 69, 16, 70, 71, 138, 56, 55, 145, 90, 141, 108, 57, 90, 90, 109, 127, 86, 177, 74, 51, 51, 139, 72, 171, 137, 144, 57, 15, 16, 17, 90, 58, 96, 96, 96, 96, 96, 96, 96, 96, 74, 137, 81, 72, 146, 147, 182, 142, 143, 91, 97, 97, 97, 97, 97, 98, 73, 74, 95, 95, 95, 95, 95, 95, 95, 95, 110, 347, 143, 178, 59, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 15, 16, 17, 161, 58, 470, 111, 112, 74, 74, 113, 74, 163, 184, 114, 123, 220, 115, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 73, 59, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 15, 16, 17, 62, 58, 74, 134, 108, 125, 63, 64, 65, 125, 125, 130, 108, 131, 181, 132, 179, 166, 144, 131, 66, 132, 167, 74, 168, 90, 74, 125, 161, 90, 90, 134, 108, 132, 132, 146, 147, 200, 220, 213, 67, 15, 16, 17, 62, 58, 126, 90, 74, 145, 63, 64, 65, 73, 132, 73, 74, 73, 222, 73, 73, 143, 220, 73, 66, 81, 91, 159, 159, 159, 159, 159, 159, 159, 159, 73, 73, 73, 159, 159, 159, 159, 159, 159, 67, 78, 74, 78, 73, 78, 143, 78, 78, 546, 84, 78, 84, 74, 84, 223, 84, 84, 110, 161, 84, 546, 94, 78, 78, 78, 125, 219, 200, 220, 125, 125, 298, 84, 84, 159, 159, 159, 159, 159, 159, 159, 159, 74, 79, 81, 111, 112, 125, 74, 113, 81, 134, 108, 114, 82, 247, 115, 83, 83, 83, 83, 83, 83, 83, 83, 92, 126, 93, 93, 93, 93, 93, 93, 93, 93, 94, 187, 248, 74, 95, 95, 95, 95, 95, 254, 74, 155, 156, 157, 155, 155, 155, 155, 155, 74, 299, 74, 262, 95, 95, 95, 95, 95, 95, 73, 74, 259, 74, 73, 297, 73, 399, 399, 73, 73, 74, 73, 73, 73, 101, 101, 101, 101, 101, 101, 101, 101, 94, 74, 354, 73, 101, 101, 101, 101, 101, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 74, 102, 95, 95, 95, 95, 95, 95, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 102, 102, 102, 102, 102, 102, 102, 102, 553, 231, 231, 231, 102, 102, 102, 102, 102, 83, 83, 83, 83, 83, 83, 83, 83, 74, 74, 488, 134, 108, 294, 73, 73, 73, 73, 73, 73, 107, 108, 73, 81, 73, 345, 73, 73, 74, 87, 73, 87, 161, 87, 261, 87, 87, 235, 161, 87, 553, 200, 73, 73, 73, 81, 136, 237, 354, 136, 136, 87, 87, 87, 137, 82, 136, 94, 83, 83, 83, 83, 83, 83, 83, 83, 89, 488, 73, 136, 89, 81, 73, 73, 452, 258, 89, 124, 74, 73, 247, 124, 90, 73, 73, 511, 90, 124, 89, 89, 73, 74, 90, 553, 161, 260, 116, 81, 74, 124, 124, 73, 248, 237, 90, 90, 389, 133, 344, 504, 553, 553, 553, 553, 553, 553, 553, 553, 78, 387, 78, 148, 78, 332, 78, 78, 161, 336, 78, 553, 553, 553, 553, 553, 553, 553, 553, 161, 74, 161, 78, 78, 78, 300, 161, 333, 200, 74, 152, 337, 152, 338, 152, 237, 152, 152, 340, 74, 152, 433, 81, 79, 158, 158, 158, 158, 158, 158, 158, 158, 152, 152, 152, 339, 158, 158, 158, 158, 158, 224, 225, 226, 224, 224, 224, 224, 224, 240, 240, 240, 240, 240, 241, 158, 158, 158, 158, 158, 158, 164, 164, 164, 164, 164, 164, 164, 164, 343, 74, 431, 81, 164, 164, 164, 164, 164, 187, 452, 188, 188, 188, 188, 188, 188, 282, 282, 282, 282, 282, 283, 158, 158, 158, 158, 158, 158, 187, 74, 188, 188, 188, 188, 188, 188, 188, 188, 346, 74, 205, 205, 205, 205, 205, 205, 205, 205, 125, 432, 402, 354, 125, 449, 449, 235, 161, 475, 125, 74, 187, 356, 189, 189, 189, 189, 189, 189, 189, 189, 125, 125, 229, 229, 230, 231, 231, 231, 231, 231, 197, 239, 239, 239, 239, 239, 239, 239, 239, 553, 161, 74, 187, 553, 190, 190, 190, 190, 190, 191, 188, 188, 553, 356, 238, 238, 238, 238, 238, 238, 238, 238, 268, 268, 268, 268, 268, 268, 268, 268, 197, 74, 473, 74, 73, 161, 192, 192, 192, 192, 192, 192, 192, 192, 237, 466, 466, 384, 192, 192, 192, 192, 192, 273, 274, 275, 273, 273, 273, 273, 273, 325, 325, 325, 325, 325, 326, 192, 192, 192, 192, 192, 192, 194, 195, 196, 196, 196, 196, 196, 196, 197, 485, 485, 81, 198, 198, 198, 198, 198, 246, 246, 246, 246, 246, 246, 246, 246, 359, 359, 359, 359, 359, 360, 198, 198, 198, 198, 198, 198, 161, 201, 202, 203, 201, 201, 201, 201, 201, 204, 235, 161, 74, 205, 205, 205, 205, 205, 235, 161, 277, 277, 277, 277, 277, 277, 332, 336, 237, 504, 505, 74, 205, 205, 205, 205, 205, 205, 206, 206, 206, 206, 206, 206, 206, 206, 338, 390, 333, 337, 206, 206, 206, 206, 206, 281, 281, 281, 281, 281, 281, 281, 281, 502, 425, 161, 235, 161, 339, 192, 192, 192, 192, 192, 192, 187, 237, 188, 188, 188, 188, 188, 188, 188, 188, 553, 426, 280, 280, 280, 280, 280, 280, 280, 280, 301, 302, 303, 301, 301, 301, 301, 301, 517, 517, 74, 74, 187, 161, 188, 188, 188, 188, 188, 188, 188, 188, 279, 235, 161, 471, 436, 524, 81, 74, 553, 161, 262, 279, 263, 263, 263, 263, 263, 263, 279, 532, 532, 74, 235, 161, 236, 236, 236, 236, 236, 236, 236, 236, 237, 235, 161, 74, 238, 238, 238, 238, 238, 74, 313, 279, 314, 314, 314, 314, 314, 314, 314, 314, 402, 356, 443, 238, 238, 238, 238, 238, 238, 161, 242, 243, 244, 242, 242, 242, 242, 242, 245, 74, 475, 473, 246, 246, 246, 246, 246, 313, 388, 315, 315, 315, 315, 315, 315, 315, 315, 468, 235, 161, 412, 246, 246, 246, 246, 246, 246, 262, 322, 263, 263, 263, 263, 263, 263, 263, 263, 313, 427, 316, 316, 316, 316, 316, 317, 314, 314, 288, 288, 288, 288, 288, 288, 288, 288, 425, 356, 307, 74, 262, 428, 264, 264, 264, 264, 264, 264, 264, 264, 235, 161, 320, 320, 320, 320, 320, 320, 426, 354, 279, 324, 324, 324, 324, 324, 324, 324, 324, 356, 506, 74, 262, 354, 265, 265, 265, 265, 265, 266, 263, 263, 553, 402, 323, 323, 323, 323, 323, 323, 323, 323, 312, 312, 312, 312, 312, 312, 312, 312, 74, 74, 430, 74, 235, 161, 277, 277, 277, 277, 277, 277, 277, 277, 237, 235, 161, 278, 278, 278, 278, 278, 278, 278, 278, 279, 429, 74, 307, 280, 280, 280, 280, 280, 358, 358, 358, 358, 358, 358, 358, 358, 376, 376, 376, 376, 376, 377, 280, 280, 280, 280, 280, 280, 161, 284, 285, 286, 284, 284, 284, 284, 284, 287, 161, 233, 386, 288, 288, 288, 288, 288, 553, 279, 357, 357, 357, 357, 357, 357, 357, 357, 385, 553, 161, 383, 288, 288, 288, 288, 288, 288, 262, 322, 263, 263, 263, 263, 263, 263, 263, 263, 366, 367, 368, 366, 366, 366, 366, 366, 313, 161, 314, 314, 314, 314, 314, 314, 314, 314, 322, 382, 313, 74, 262, 553, 263, 263, 263, 263, 263, 263, 263, 263, 313, 402, 314, 314, 314, 314, 314, 314, 314, 314, 313, 161, 314, 314, 314, 314, 314, 314, 431, 81, 322, 74, 308, 309, 310, 308, 308, 308, 308, 308, 311, 469, 307, 233, 312, 312, 312, 312, 312, 331, 331, 331, 331, 331, 331, 331, 331, 405, 405, 405, 405, 405, 406, 312, 312, 312, 312, 312, 312, 235, 161, 320, 320, 320, 320, 320, 320, 320, 320, 279, 235, 161, 321, 321, 321, 321, 321, 321, 321, 321, 322, 197, 342, 341, 323, 323, 323, 323, 323, 235, 161, 371, 371, 371, 371, 371, 371, 427, 335, 322, 334, 307, 233, 323, 323, 323, 323, 323, 323, 161, 327, 328, 329, 327, 327, 327, 327, 327, 330, 428, 197, 197, 331, 331, 331, 331, 331, 375, 375, 375, 375, 375, 375, 375, 375, 423, 423, 423, 423, 423, 424, 331, 331, 331, 331, 331, 331, 347, 348, 348, 348, 348, 348, 348, 348, 348, 553, 255, 374, 374, 374, 374, 374, 374, 374, 374, 391, 392, 393, 394, 391, 391, 391, 391, 524, 81, 535, 74, 347, 349, 349, 349, 349, 349, 349, 349, 349, 534, 347, 348, 348, 348, 348, 348, 348, 74, 396, 397, 398, 396, 396, 396, 396, 396, 296, 295, 293, 74, 74, 347, 350, 350, 350, 350, 350, 351, 348, 348, 74, 365, 365, 365, 365, 365, 365, 365, 365, 404, 404, 404, 404, 404, 404, 404, 404, 292, 291, 290, 289, 74, 354, 271, 355, 355, 355, 355, 355, 355, 355, 355, 356, 161, 233, 197, 357, 357, 357, 357, 357, 553, 373, 403, 403, 403, 403, 403, 403, 403, 403, 267, 197, 100, 255, 357, 357, 357, 357, 357, 357, 361, 362, 363, 361, 361, 361, 361, 361, 364, 257, 255, 256, 365, 365, 365, 365, 365, 412, 354, 413, 413, 413, 413, 413, 413, 413, 413, 255, 402, 253, 252, 365, 365, 365, 365, 365, 365, 235, 161, 371, 371, 371, 371, 371, 371, 371, 371, 322, 235, 161, 372, 372, 372, 372, 372, 372, 372, 372, 373, 251, 250, 249, 374, 374, 374, 374, 374, 412, 354, 414, 414, 414, 414, 414, 414, 414, 414, 94, 452, 197, 233, 374, 374, 374, 374, 374, 374, 161, 378, 379, 380, 378, 378, 378, 378, 378, 235, 161, 197, 100, 381, 381, 381, 381, 381, 412, 322, 415, 415, 415, 415, 415, 416, 413, 413, 81, 185, 221, 218, 381, 381, 381, 381, 381, 381, 347, 348, 348, 348, 348, 348, 348, 348, 348, 235, 161, 381, 381, 381, 381, 381, 381, 381, 381, 373, 422, 422, 422, 422, 422, 422, 422, 422, 217, 216, 74, 347, 348, 348, 348, 348, 348, 348, 348, 348, 553, 161, 235, 161, 419, 419, 419, 419, 419, 419, 373, 553, 373, 421, 421, 421, 421, 421, 421, 421, 421, 74, 354, 215, 400, 400, 400, 400, 400, 400, 400, 400, 356, 354, 553, 401, 401, 401, 401, 401, 401, 401, 401, 402, 452, 214, 212, 403, 403, 403, 403, 403, 443, 161, 444, 444, 444, 444, 444, 444, 444, 444, 373, 211, 210, 209, 403, 403, 403, 403, 403, 403, 407, 408, 409, 407, 407, 407, 407, 407, 410, 208, 207, 100, 411, 411, 411, 411, 411, 443, 354, 445, 445, 445, 445, 445, 445, 445, 445, 92, 452, 153, 81, 411, 411, 411, 411, 411, 411, 235, 161, 419, 419, 419, 419, 419, 419, 419, 419, 373, 235, 161, 420, 420, 420, 420, 420, 420, 420, 420, 81, 235, 161, 74, 421, 421, 421, 421, 421, 434, 443, 373, 446, 446, 446, 446, 446, 447, 444, 444, 480, 480, 480, 421, 421, 421, 421, 421, 421, 434, 185, 434, 435, 411, 411, 411, 411, 411, 411, 411, 411, 454, 454, 454, 454, 454, 454, 454, 454, 74, 74, 436, 142, 437, 437, 437, 437, 437, 437, 437, 437, 455, 455, 455, 455, 455, 456, 553, 354, 453, 453, 453, 453, 453, 453, 453, 453, 143, 488, 137, 137, 129, 74, 436, 183, 438, 438, 438, 438, 438, 438, 438, 438, 462, 463, 464, 462, 462, 462, 462, 462, 412, 553, 413, 413, 413, 413, 413, 413, 413, 413, 122, 488, 176, 74, 436, 354, 439, 439, 439, 439, 439, 440, 441, 441, 412, 488, 413, 413, 413, 413, 413, 413, 413, 413, 412, 175, 413, 413, 413, 413, 413, 413, 434, 174, 173, 74, 436, 172, 442, 442, 442, 437, 437, 437, 437, 437, 491, 491, 491, 491, 491, 492, 434, 170, 434, 434, 169, 165, 100, 436, 73, 480, 480, 480, 100, 154, 88, 74, 354, 153, 450, 450, 450, 450, 450, 450, 450, 450, 402, 354, 81, 451, 451, 451, 451, 451, 451, 451, 451, 452, 74, 148, 149, 453, 453, 453, 453, 453, 476, 477, 478, 476, 476, 476, 476, 476, 522, 522, 522, 522, 522, 523, 453, 453, 453, 453, 453, 453, 457, 458, 459, 457, 457, 457, 457, 457, 460, 74, 76, 75, 461, 461, 461, 461, 461, 481, 482, 483, 481, 481, 481, 481, 481, 540, 540, 540, 540, 540, 540, 461, 461, 461, 461, 461, 461, 235, 161, 467, 467, 467, 467, 467, 467, 467, 467, 436, 74, 441, 441, 441, 441, 441, 441, 441, 441, 443, 143, 444, 444, 444, 444, 444, 444, 444, 444, 443, 137, 444, 444, 444, 444, 444, 444, 444, 444, 129, 74, 436, 122, 441, 441, 441, 441, 441, 441, 441, 441, 443, 121, 444, 444, 444, 444, 444, 444, 461, 461, 461, 461, 461, 461, 461, 461, 120, 119, 118, 117, 106, 74, 436, 105, 441, 441, 441, 441, 441, 441, 479, 479, 490, 490, 490, 490, 490, 490, 490, 490, 553, 104, 489, 489, 489, 489, 489, 489, 489, 489, 103, 100, 88, 74, 436, 76, 479, 479, 479, 479, 479, 479, 479, 479, 161, 497, 497, 497, 497, 497, 497, 497, 497, 161, 498, 498, 498, 498, 498, 498, 498, 498, 75, 74, 553, 74, 354, 553, 486, 486, 486, 486, 486, 486, 486, 486, 452, 354, 553, 487, 487, 487, 487, 487, 487, 487, 487, 488, 553, 553, 553, 489, 489, 489, 489, 489, 161, 499, 499, 499, 499, 499, 500, 497, 497, 553, 553, 553, 553, 553, 489, 489, 489, 489, 489, 489, 493, 494, 495, 493, 493, 493, 493, 493, 553, 553, 553, 553, 496, 496, 496, 496, 496, 472, 553, 472, 553, 472, 553, 472, 472, 553, 553, 472, 553, 553, 553, 496, 496, 496, 496, 496, 496, 553, 553, 472, 472, 472, 474, 553, 474, 553, 474, 553, 474, 474, 553, 553, 474, 479, 479, 479, 479, 479, 479, 479, 479, 553, 553, 553, 474, 474, 474, 506, 553, 507, 507, 507, 507, 507, 507, 507, 507, 553, 553, 553, 553, 511, 74, 512, 512, 512, 512, 512, 512, 512, 512, 161, 497, 497, 497, 497, 497, 497, 74, 506, 553, 508, 508, 508, 508, 508, 508, 508, 508, 511, 553, 513, 513, 513, 513, 513, 513, 513, 513, 511, 553, 514, 514, 514, 514, 514, 515, 512, 512, 553, 74, 506, 553, 509, 509, 509, 509, 509, 510, 507, 507, 496, 496, 496, 496, 496, 496, 496, 496, 521, 521, 521, 521, 521, 521, 521, 521, 553, 553, 553, 553, 553, 74, 354, 553, 518, 518, 518, 518, 518, 518, 518, 518, 488, 354, 553, 519, 519, 519, 519, 519, 519, 519, 519, 553, 553, 553, 553, 520, 520, 520, 520, 520, 553, 553, 520, 520, 520, 520, 520, 520, 520, 520, 553, 553, 553, 553, 520, 520, 520, 520, 520, 520, 161, 497, 497, 497, 497, 497, 497, 497, 497, 161, 497, 497, 497, 497, 497, 497, 497, 497, 525, 526, 527, 525, 525, 525, 525, 525, 553, 506, 553, 507, 507, 507, 507, 507, 507, 528, 529, 530, 528, 528, 528, 528, 528, 553, 553, 553, 553, 74, 506, 553, 507, 507, 507, 507, 507, 507, 507, 507, 74, 511, 553, 512, 512, 512, 512, 512, 512, 512, 512, 511, 553, 512, 512, 512, 512, 512, 512, 512, 512, 74, 506, 553, 507, 507, 507, 507, 507, 507, 507, 507, 511, 553, 512, 512, 512, 512, 512, 512, 354, 553, 533, 533, 533, 533, 533, 533, 533, 533, 553, 553, 553, 74, 535, 553, 536, 536, 536, 536, 536, 536, 536, 536, 540, 540, 540, 540, 540, 540, 540, 540, 541, 541, 541, 541, 541, 541, 541, 541, 553, 553, 553, 553, 553, 74, 535, 553, 537, 537, 537, 537, 537, 537, 537, 537, 542, 542, 542, 542, 542, 543, 540, 540, 547, 548, 549, 547, 547, 547, 547, 547, 553, 553, 553, 553, 553, 74, 535, 553, 538, 538, 538, 538, 538, 539, 536, 536, 553, 553, 553, 553, 535, 74, 536, 536, 536, 536, 536, 536, 540, 540, 540, 540, 540, 540, 540, 540, 553, 74, 535, 553, 536, 536, 536, 536, 536, 536, 536, 536, 553, 553, 553, 74, 540, 540, 540, 540, 540, 540, 540, 540, 550, 550, 550, 550, 550, 550, 550, 550, 553, 74, 535, 553, 536, 536, 536, 536, 536, 536, 536, 536, 547, 547, 547, 547, 547, 547, 547, 547, 553, 74, 551, 551, 551, 551, 551, 552, 550, 550, 553, 553, 553, 74, 550, 550, 550, 550, 550, 550, 553, 74, 550, 550, 550, 550, 550, 550, 550, 550, 553, 74, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 74, 553, 553, 553, 553, 553, 553, 553, 74, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 73, 553, 553, 553, 73, 553, 73, 73, 73, 553, 73, 73, 73, 77, 77, 553, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 84, 553, 553, 553, 84, 553, 84, 84, 84, 84, 84, 84, 84, 87, 553, 553, 553, 87, 553, 87, 87, 87, 553, 87, 87, 87, 89, 553, 553, 89, 89, 553, 89, 89, 89, 553, 89, 89, 89, 99, 99, 553, 553, 99, 124, 553, 553, 124, 124, 553, 124, 124, 124, 553, 124, 124, 124, 128, 553, 553, 128, 128, 128, 128, 128, 128, 553, 553, 128, 128, 135, 135, 136, 553, 553, 136, 553, 553, 136, 136, 136, 136, 136, 136, 136, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 142, 142, 553, 142, 553, 142, 142, 142, 142, 142, 142, 142, 142, 78, 78, 553, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 151, 151, 553, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 152, 553, 553, 553, 152, 553, 152, 152, 152, 553, 152, 152, 152, 90, 553, 553, 90, 90, 553, 90, 90, 90, 553, 90, 90, 90, 160, 160, 553, 553, 160, 162, 162, 162, 553, 553, 162, 125, 553, 553, 125, 125, 553, 125, 125, 125, 553, 125, 125, 125, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 193, 193, 553, 553, 193, 199, 199, 199, 553, 553, 199, 227, 227, 553, 553, 227, 228, 228, 553, 553, 228, 232, 232, 553, 553, 232, 234, 234, 234, 553, 553, 234, 267, 267, 553, 553, 267, 269, 269, 553, 553, 269, 270, 270, 553, 553, 270, 272, 272, 272, 553, 553, 272, 276, 276, 276, 276, 553, 553, 276, 304, 304, 553, 553, 304, 305, 305, 553, 553, 305, 306, 306, 553, 553, 306, 318, 318, 318, 553, 553, 318, 319, 319, 319, 319, 553, 553, 319, 352, 352, 553, 553, 352, 353, 353, 553, 553, 353, 369, 369, 369, 553, 553, 369, 370, 370, 370, 370, 553, 553, 370, 395, 395, 553, 553, 395, 399, 553, 399, 399, 553, 553, 399, 417, 417, 417, 553, 553, 417, 418, 418, 418, 418, 553, 553, 418, 448, 448, 553, 553, 448, 449, 553, 449, 449, 553, 553, 449, 465, 465, 465, 553, 553, 465, 466, 466, 466, 553, 553, 553, 466, 472, 553, 553, 553, 472, 553, 472, 472, 472, 553, 472, 472, 472, 474, 553, 553, 553, 474, 553, 474, 474, 474, 553, 474, 474, 474, 484, 484, 553, 553, 484, 485, 553, 485, 485, 553, 553, 485, 501, 501, 553, 553, 553, 501, 503, 503, 503, 503, 503, 503, 503, 503, 503, 503, 503, 503, 503, 516, 516, 553, 553, 516, 517, 553, 517, 517, 553, 553, 517, 531, 531, 553, 553, 531, 532, 553, 532, 553, 553, 553, 532, 544, 553, 553, 553, 544, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 13, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553 } ; static yyconst short int yy_chk[3551] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 116, 2, 3, 4, 550, 5, 5, 5, 119, 5, 20, 3, 4, 59, 59, 5, 11, 11, 11, 11, 6, 6, 6, 119, 6, 2, 2, 5, 5, 2, 6, 20, 84, 2, 40, 51, 2, 12, 12, 12, 12, 63, 6, 6, 70, 25, 67, 67, 5, 25, 25, 40, 51, 84, 116, 109, 3, 4, 65, 11, 109, 63, 69, 6, 7, 7, 7, 25, 7, 27, 27, 27, 27, 27, 27, 27, 27, 121, 65, 432, 12, 72, 72, 121, 72, 70, 25, 28, 28, 28, 28, 28, 28, 39, 117, 39, 39, 39, 39, 39, 39, 39, 39, 41, 348, 69, 117, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 100, 8, 432, 41, 41, 127, 348, 41, 178, 100, 127, 41, 49, 178, 41, 49, 49, 49, 49, 49, 49, 49, 49, 82, 82, 82, 82, 82, 82, 82, 82, 83, 83, 83, 83, 83, 83, 83, 83, 118, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 120, 130, 130, 50, 9, 9, 9, 50, 50, 57, 57, 57, 120, 57, 118, 104, 144, 57, 9, 57, 104, 222, 104, 89, 171, 50, 162, 89, 89, 134, 134, 57, 57, 146, 146, 162, 222, 171, 9, 10, 10, 10, 10, 10, 50, 89, 182, 145, 10, 10, 10, 74, 57, 74, 181, 74, 181, 74, 74, 144, 182, 74, 10, 177, 89, 96, 96, 96, 96, 96, 96, 96, 96, 74, 74, 74, 98, 98, 98, 98, 98, 98, 10, 18, 184, 18, 18, 18, 145, 18, 18, 545, 86, 18, 86, 180, 86, 184, 86, 86, 110, 199, 86, 534, 192, 18, 18, 18, 124, 177, 199, 180, 124, 124, 259, 86, 86, 97, 97, 97, 97, 97, 97, 97, 97, 192, 18, 19, 110, 110, 124, 259, 110, 258, 107, 107, 110, 19, 207, 110, 19, 19, 19, 19, 19, 19, 19, 19, 26, 124, 26, 26, 26, 26, 26, 26, 26, 26, 26, 188, 207, 213, 26, 26, 26, 26, 26, 213, 260, 92, 92, 92, 92, 92, 92, 92, 92, 107, 260, 26, 263, 26, 26, 26, 26, 26, 26, 32, 220, 220, 188, 32, 258, 32, 360, 360, 32, 32, 92, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 263, 533, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 34, 34, 34, 34, 34, 34, 34, 34, 34, 196, 196, 196, 34, 34, 34, 34, 34, 123, 123, 123, 123, 123, 123, 123, 123, 254, 299, 531, 141, 141, 254, 34, 34, 34, 34, 34, 34, 38, 38, 38, 219, 38, 299, 38, 38, 223, 88, 38, 88, 234, 88, 223, 88, 88, 236, 236, 88, 520, 234, 38, 38, 38, 42, 137, 236, 519, 137, 137, 88, 88, 88, 141, 42, 137, 221, 42, 42, 42, 42, 42, 42, 42, 42, 91, 517, 91, 137, 91, 343, 91, 91, 516, 219, 91, 126, 221, 126, 247, 126, 154, 126, 126, 512, 154, 126, 91, 91, 91, 345, 154, 238, 238, 221, 42, 58, 298, 126, 126, 126, 247, 238, 154, 154, 345, 58, 298, 503, 58, 58, 58, 58, 58, 58, 58, 58, 77, 343, 77, 77, 77, 289, 77, 77, 501, 292, 77, 133, 133, 133, 133, 133, 133, 133, 133, 272, 261, 497, 77, 77, 77, 261, 276, 289, 272, 294, 153, 292, 153, 293, 153, 276, 153, 153, 294, 388, 153, 388, 297, 77, 93, 93, 93, 93, 93, 93, 93, 93, 153, 153, 153, 293, 93, 93, 93, 93, 93, 187, 187, 187, 187, 187, 187, 187, 187, 203, 203, 203, 203, 203, 203, 93, 93, 93, 93, 93, 93, 101, 101, 101, 101, 101, 101, 101, 101, 297, 187, 387, 387, 101, 101, 101, 101, 101, 191, 485, 191, 191, 191, 191, 191, 191, 244, 244, 244, 244, 244, 244, 101, 101, 101, 101, 101, 101, 155, 300, 155, 155, 155, 155, 155, 155, 155, 155, 300, 191, 200, 200, 200, 200, 200, 200, 200, 200, 183, 387, 484, 355, 183, 406, 406, 420, 420, 474, 183, 155, 156, 355, 156, 156, 156, 156, 156, 156, 156, 156, 183, 183, 195, 195, 195, 195, 195, 195, 195, 195, 195, 202, 202, 202, 202, 202, 202, 202, 202, 421, 421, 156, 157, 357, 157, 157, 157, 157, 157, 157, 157, 157, 205, 357, 205, 205, 205, 205, 205, 205, 205, 205, 229, 229, 229, 229, 229, 229, 229, 229, 229, 340, 472, 157, 158, 318, 158, 158, 158, 158, 158, 158, 158, 158, 318, 424, 424, 340, 158, 158, 158, 158, 158, 235, 235, 235, 235, 235, 235, 235, 235, 286, 286, 286, 286, 286, 286, 158, 158, 158, 158, 158, 158, 161, 161, 161, 161, 161, 161, 161, 161, 161, 456, 456, 470, 161, 161, 161, 161, 161, 237, 237, 237, 237, 237, 237, 237, 237, 310, 310, 310, 310, 310, 310, 161, 161, 161, 161, 161, 161, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 467, 467, 471, 163, 163, 163, 163, 163, 241, 241, 241, 241, 241, 241, 241, 241, 332, 336, 241, 469, 470, 346, 163, 163, 163, 163, 163, 163, 164, 164, 164, 164, 164, 164, 164, 164, 338, 346, 332, 336, 164, 164, 164, 164, 164, 243, 243, 243, 243, 243, 243, 243, 243, 468, 382, 466, 277, 277, 338, 164, 164, 164, 164, 164, 164, 189, 277, 189, 189, 189, 189, 189, 189, 189, 189, 246, 382, 246, 246, 246, 246, 246, 246, 246, 246, 262, 262, 262, 262, 262, 262, 262, 262, 492, 492, 433, 189, 190, 319, 190, 190, 190, 190, 190, 190, 190, 190, 319, 278, 278, 433, 437, 505, 505, 262, 280, 280, 266, 278, 266, 266, 266, 266, 266, 266, 280, 523, 523, 190, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 320, 320, 437, 201, 201, 201, 201, 201, 266, 273, 320, 273, 273, 273, 273, 273, 273, 273, 273, 449, 448, 444, 201, 201, 201, 201, 201, 201, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 344, 435, 434, 204, 204, 204, 204, 204, 274, 344, 274, 274, 274, 274, 274, 274, 274, 274, 429, 321, 321, 413, 204, 204, 204, 204, 204, 204, 224, 321, 224, 224, 224, 224, 224, 224, 224, 224, 275, 383, 275, 275, 275, 275, 275, 275, 275, 275, 279, 279, 279, 279, 279, 279, 279, 279, 425, 399, 395, 224, 225, 383, 225, 225, 225, 225, 225, 225, 225, 225, 283, 283, 283, 283, 283, 283, 283, 283, 425, 400, 283, 285, 285, 285, 285, 285, 285, 285, 285, 400, 507, 225, 226, 401, 226, 226, 226, 226, 226, 226, 226, 226, 288, 401, 288, 288, 288, 288, 288, 288, 288, 288, 307, 307, 307, 307, 307, 307, 307, 307, 390, 507, 386, 226, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 385, 384, 353, 242, 242, 242, 242, 242, 309, 309, 309, 309, 309, 309, 309, 309, 329, 329, 329, 329, 329, 329, 242, 242, 242, 242, 242, 242, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 369, 352, 342, 245, 245, 245, 245, 245, 312, 369, 312, 312, 312, 312, 312, 312, 312, 312, 341, 323, 323, 335, 245, 245, 245, 245, 245, 245, 264, 323, 264, 264, 264, 264, 264, 264, 264, 264, 313, 313, 313, 313, 313, 313, 313, 313, 315, 370, 315, 315, 315, 315, 315, 315, 315, 315, 370, 334, 314, 264, 265, 403, 265, 265, 265, 265, 265, 265, 265, 265, 316, 403, 316, 316, 316, 316, 316, 316, 316, 316, 317, 417, 317, 317, 317, 317, 317, 317, 431, 431, 417, 265, 271, 271, 271, 271, 271, 271, 271, 271, 271, 431, 306, 305, 271, 271, 271, 271, 271, 322, 322, 322, 322, 322, 322, 322, 322, 363, 363, 363, 363, 363, 363, 271, 271, 271, 271, 271, 271, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 304, 296, 295, 284, 284, 284, 284, 284, 326, 326, 326, 326, 326, 326, 326, 326, 427, 291, 326, 290, 270, 269, 284, 284, 284, 284, 284, 284, 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, 427, 268, 267, 287, 287, 287, 287, 287, 328, 328, 328, 328, 328, 328, 328, 328, 380, 380, 380, 380, 380, 380, 287, 287, 287, 287, 287, 287, 301, 301, 301, 301, 301, 301, 301, 301, 301, 331, 257, 331, 331, 331, 331, 331, 331, 331, 331, 347, 347, 347, 347, 347, 347, 347, 347, 524, 524, 536, 301, 302, 302, 302, 302, 302, 302, 302, 302, 302, 524, 351, 351, 351, 351, 351, 351, 351, 347, 354, 354, 354, 354, 354, 354, 354, 354, 256, 255, 253, 536, 302, 303, 303, 303, 303, 303, 303, 303, 303, 303, 351, 356, 356, 356, 356, 356, 356, 356, 356, 362, 362, 362, 362, 362, 362, 362, 362, 252, 251, 250, 249, 303, 308, 233, 308, 308, 308, 308, 308, 308, 308, 308, 308, 418, 232, 231, 308, 308, 308, 308, 308, 365, 418, 365, 365, 365, 365, 365, 365, 365, 365, 230, 228, 227, 218, 308, 308, 308, 308, 308, 308, 311, 311, 311, 311, 311, 311, 311, 311, 311, 217, 216, 215, 311, 311, 311, 311, 311, 366, 450, 366, 366, 366, 366, 366, 366, 366, 366, 214, 450, 212, 211, 311, 311, 311, 311, 311, 311, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, 210, 209, 208, 327, 327, 327, 327, 327, 367, 451, 367, 367, 367, 367, 367, 367, 367, 367, 206, 451, 198, 197, 327, 327, 327, 327, 327, 327, 330, 330, 330, 330, 330, 330, 330, 330, 330, 371, 371, 194, 193, 330, 330, 330, 330, 330, 368, 371, 368, 368, 368, 368, 368, 368, 368, 368, 186, 185, 179, 176, 330, 330, 330, 330, 330, 330, 349, 349, 349, 349, 349, 349, 349, 349, 349, 372, 372, 373, 373, 373, 373, 373, 373, 373, 373, 372, 379, 379, 379, 379, 379, 379, 379, 379, 175, 174, 349, 350, 350, 350, 350, 350, 350, 350, 350, 350, 374, 374, 377, 377, 377, 377, 377, 377, 377, 377, 374, 381, 377, 381, 381, 381, 381, 381, 381, 381, 381, 350, 358, 173, 358, 358, 358, 358, 358, 358, 358, 358, 358, 361, 453, 361, 361, 361, 361, 361, 361, 361, 361, 361, 453, 172, 170, 361, 361, 361, 361, 361, 396, 465, 396, 396, 396, 396, 396, 396, 396, 396, 465, 169, 168, 167, 361, 361, 361, 361, 361, 361, 364, 364, 364, 364, 364, 364, 364, 364, 364, 166, 165, 160, 364, 364, 364, 364, 364, 397, 486, 397, 397, 397, 397, 397, 397, 397, 397, 159, 486, 152, 151, 364, 364, 364, 364, 364, 364, 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 150, 419, 419, 148, 378, 378, 378, 378, 378, 389, 398, 419, 398, 398, 398, 398, 398, 398, 398, 398, 480, 480, 480, 378, 378, 378, 378, 378, 378, 389, 147, 389, 389, 402, 402, 402, 402, 402, 402, 402, 402, 408, 408, 408, 408, 408, 408, 408, 408, 480, 389, 391, 143, 391, 391, 391, 391, 391, 391, 391, 391, 409, 409, 409, 409, 409, 409, 411, 487, 411, 411, 411, 411, 411, 411, 411, 411, 142, 487, 140, 136, 129, 391, 392, 125, 392, 392, 392, 392, 392, 392, 392, 392, 412, 412, 412, 412, 412, 412, 412, 412, 414, 489, 414, 414, 414, 414, 414, 414, 414, 414, 122, 489, 115, 392, 393, 518, 393, 393, 393, 393, 393, 393, 393, 393, 415, 518, 415, 415, 415, 415, 415, 415, 415, 415, 416, 114, 416, 416, 416, 416, 416, 416, 430, 113, 112, 393, 394, 111, 394, 394, 394, 394, 394, 394, 394, 394, 459, 459, 459, 459, 459, 459, 430, 106, 430, 430, 105, 103, 99, 442, 95, 442, 442, 442, 94, 90, 87, 394, 404, 85, 404, 404, 404, 404, 404, 404, 404, 404, 404, 407, 80, 407, 407, 407, 407, 407, 407, 407, 407, 407, 442, 79, 78, 407, 407, 407, 407, 407, 436, 436, 436, 436, 436, 436, 436, 436, 495, 495, 495, 495, 495, 495, 407, 407, 407, 407, 407, 407, 410, 410, 410, 410, 410, 410, 410, 410, 410, 436, 76, 75, 410, 410, 410, 410, 410, 443, 443, 443, 443, 443, 443, 443, 443, 543, 543, 543, 543, 543, 543, 410, 410, 410, 410, 410, 410, 422, 422, 422, 422, 422, 422, 422, 422, 422, 422, 438, 73, 438, 438, 438, 438, 438, 438, 438, 438, 445, 68, 445, 445, 445, 445, 445, 445, 445, 445, 446, 61, 446, 446, 446, 446, 446, 446, 446, 446, 54, 438, 439, 48, 439, 439, 439, 439, 439, 439, 439, 439, 447, 47, 447, 447, 447, 447, 447, 447, 452, 452, 452, 452, 452, 452, 452, 452, 46, 45, 44, 43, 37, 439, 440, 36, 440, 440, 440, 440, 440, 440, 440, 440, 458, 458, 458, 458, 458, 458, 458, 458, 461, 35, 461, 461, 461, 461, 461, 461, 461, 461, 33, 29, 23, 440, 441, 17, 441, 441, 441, 441, 441, 441, 441, 441, 462, 462, 462, 462, 462, 462, 462, 462, 462, 463, 463, 463, 463, 463, 463, 463, 463, 463, 15, 14, 13, 441, 454, 0, 454, 454, 454, 454, 454, 454, 454, 454, 454, 457, 0, 457, 457, 457, 457, 457, 457, 457, 457, 457, 0, 0, 0, 457, 457, 457, 457, 457, 464, 464, 464, 464, 464, 464, 464, 464, 464, 0, 0, 0, 0, 0, 457, 457, 457, 457, 457, 457, 460, 460, 460, 460, 460, 460, 460, 460, 0, 0, 0, 0, 460, 460, 460, 460, 460, 473, 0, 473, 0, 473, 0, 473, 473, 0, 0, 473, 0, 0, 0, 460, 460, 460, 460, 460, 460, 0, 0, 473, 473, 473, 475, 0, 475, 0, 475, 0, 475, 475, 0, 0, 475, 479, 479, 479, 479, 479, 479, 479, 479, 0, 0, 0, 475, 475, 475, 476, 0, 476, 476, 476, 476, 476, 476, 476, 476, 0, 0, 0, 0, 481, 479, 481, 481, 481, 481, 481, 481, 481, 481, 500, 500, 500, 500, 500, 500, 500, 476, 477, 0, 477, 477, 477, 477, 477, 477, 477, 477, 482, 0, 482, 482, 482, 482, 482, 482, 482, 482, 483, 0, 483, 483, 483, 483, 483, 483, 483, 483, 0, 477, 478, 0, 478, 478, 478, 478, 478, 478, 478, 478, 488, 488, 488, 488, 488, 488, 488, 488, 494, 494, 494, 494, 494, 494, 494, 494, 0, 0, 0, 0, 0, 478, 490, 0, 490, 490, 490, 490, 490, 490, 490, 490, 490, 493, 0, 493, 493, 493, 493, 493, 493, 493, 493, 0, 0, 0, 0, 493, 493, 493, 493, 493, 496, 0, 496, 496, 496, 496, 496, 496, 496, 496, 0, 0, 0, 0, 493, 493, 493, 493, 493, 493, 498, 498, 498, 498, 498, 498, 498, 498, 498, 499, 499, 499, 499, 499, 499, 499, 499, 499, 506, 506, 506, 506, 506, 506, 506, 506, 0, 510, 0, 510, 510, 510, 510, 510, 510, 511, 511, 511, 511, 511, 511, 511, 511, 0, 0, 0, 0, 506, 508, 0, 508, 508, 508, 508, 508, 508, 508, 508, 510, 513, 0, 513, 513, 513, 513, 513, 513, 513, 513, 514, 0, 514, 514, 514, 514, 514, 514, 514, 514, 508, 509, 0, 509, 509, 509, 509, 509, 509, 509, 509, 515, 0, 515, 515, 515, 515, 515, 515, 521, 0, 521, 521, 521, 521, 521, 521, 521, 521, 0, 0, 0, 509, 525, 0, 525, 525, 525, 525, 525, 525, 525, 525, 528, 528, 528, 528, 528, 528, 528, 528, 529, 529, 529, 529, 529, 529, 529, 529, 0, 0, 0, 0, 0, 525, 526, 0, 526, 526, 526, 526, 526, 526, 526, 526, 530, 530, 530, 530, 530, 530, 530, 530, 535, 535, 535, 535, 535, 535, 535, 535, 0, 0, 0, 0, 0, 526, 527, 0, 527, 527, 527, 527, 527, 527, 527, 527, 0, 0, 0, 0, 539, 535, 539, 539, 539, 539, 539, 539, 541, 541, 541, 541, 541, 541, 541, 541, 0, 527, 537, 0, 537, 537, 537, 537, 537, 537, 537, 537, 0, 0, 0, 539, 542, 542, 542, 542, 542, 542, 542, 542, 547, 547, 547, 547, 547, 547, 547, 547, 0, 537, 538, 0, 538, 538, 538, 538, 538, 538, 538, 538, 548, 548, 548, 548, 548, 548, 548, 548, 0, 547, 549, 549, 549, 549, 549, 549, 549, 549, 0, 0, 0, 538, 552, 552, 552, 552, 552, 552, 0, 548, 551, 551, 551, 551, 551, 551, 551, 551, 0, 549, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 552, 0, 0, 0, 0, 0, 0, 0, 551, 554, 554, 554, 554, 554, 554, 554, 554, 554, 554, 554, 554, 554, 555, 555, 555, 555, 555, 555, 555, 555, 555, 555, 555, 555, 555, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 557, 557, 557, 557, 557, 557, 557, 557, 557, 557, 557, 557, 557, 558, 0, 0, 0, 558, 0, 558, 558, 558, 0, 558, 558, 558, 559, 559, 0, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 561, 0, 0, 0, 561, 0, 561, 561, 561, 561, 561, 561, 561, 562, 0, 0, 0, 562, 0, 562, 562, 562, 0, 562, 562, 562, 563, 0, 0, 563, 563, 0, 563, 563, 563, 0, 563, 563, 563, 564, 564, 0, 0, 564, 565, 0, 0, 565, 565, 0, 565, 565, 565, 0, 565, 565, 565, 566, 0, 0, 566, 566, 566, 566, 566, 566, 0, 0, 566, 566, 567, 567, 568, 0, 0, 568, 0, 0, 568, 568, 568, 568, 568, 568, 568, 569, 569, 569, 569, 569, 569, 569, 569, 569, 569, 569, 569, 569, 570, 570, 0, 570, 0, 570, 570, 570, 570, 570, 570, 570, 570, 571, 571, 0, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 572, 572, 572, 572, 572, 572, 572, 572, 572, 572, 572, 572, 572, 573, 573, 0, 573, 573, 573, 573, 573, 573, 573, 573, 573, 573, 574, 0, 0, 0, 574, 0, 574, 574, 574, 0, 574, 574, 574, 575, 0, 0, 575, 575, 0, 575, 575, 575, 0, 575, 575, 575, 576, 576, 0, 0, 576, 577, 577, 577, 0, 0, 577, 578, 0, 0, 578, 578, 0, 578, 578, 578, 0, 578, 578, 578, 579, 579, 579, 579, 579, 579, 579, 579, 579, 579, 579, 579, 579, 580, 580, 0, 0, 580, 581, 581, 581, 0, 0, 581, 582, 582, 0, 0, 582, 583, 583, 0, 0, 583, 584, 584, 0, 0, 584, 585, 585, 585, 0, 0, 585, 586, 586, 0, 0, 586, 587, 587, 0, 0, 587, 588, 588, 0, 0, 588, 589, 589, 589, 0, 0, 589, 590, 590, 590, 590, 0, 0, 590, 591, 591, 0, 0, 591, 592, 592, 0, 0, 592, 593, 593, 0, 0, 593, 594, 594, 594, 0, 0, 594, 595, 595, 595, 595, 0, 0, 595, 596, 596, 0, 0, 596, 597, 597, 0, 0, 597, 598, 598, 598, 0, 0, 598, 599, 599, 599, 599, 0, 0, 599, 600, 600, 0, 0, 600, 601, 0, 601, 601, 0, 0, 601, 602, 602, 602, 0, 0, 602, 603, 603, 603, 603, 0, 0, 603, 604, 604, 0, 0, 604, 605, 0, 605, 605, 0, 0, 605, 606, 606, 606, 0, 0, 606, 607, 607, 607, 0, 0, 0, 607, 608, 0, 0, 0, 608, 0, 608, 608, 608, 0, 608, 608, 608, 609, 0, 0, 0, 609, 0, 609, 609, 609, 0, 609, 609, 609, 610, 610, 0, 0, 610, 611, 0, 611, 611, 0, 0, 611, 612, 612, 0, 0, 0, 612, 613, 613, 613, 613, 613, 613, 613, 613, 613, 613, 613, 613, 613, 614, 614, 0, 0, 614, 615, 0, 615, 615, 0, 0, 615, 616, 616, 0, 0, 616, 617, 0, 617, 0, 0, 0, 617, 618, 0, 0, 0, 618, 619, 619, 619, 619, 619, 619, 619, 619, 619, 619, 619, 619, 619, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; #line 1 "toke.l" #define INITIAL 0 #line 2 "toke.l" /* * Copyright (c) 1996, 1998-2005, 2007-2009 * Todd C. Miller * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * Sponsored in part by the Defense Advanced Research Projects * Agency (DARPA) and Air Force Research Laboratory, Air Force * Materiel Command, USAF, under agreement number F39502-99-1-0512. */ #include #include #include #include #include #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif /* STDC_HEADERS */ #ifdef HAVE_STRING_H # include #else # ifdef HAVE_STRINGS_H # include # endif #endif /* HAVE_STRING_H */ #ifdef HAVE_UNISTD_H # include #endif /* HAVE_UNISTD_H */ #if defined(HAVE_MALLOC_H) && !defined(STDC_HEADERS) # include #endif /* HAVE_MALLOC_H && !STDC_HEADERS */ #ifdef HAVE_DIRENT_H # include # define NAMLEN(dirent) strlen((dirent)->d_name) #else # define dirent direct # define NAMLEN(dirent) (dirent)->d_namlen # ifdef HAVE_SYS_NDIR_H # include # endif # ifdef HAVE_SYS_DIR_H # include # endif # ifdef HAVE_NDIR_H # include # endif #endif #include #include "sudo.h" #include "parse.h" #include #ifndef lint __unused static const char rcsid[] = "$Sudo: toke.c,v 1.37 2009/07/18 13:55:37 millert Exp $"; #endif /* lint */ extern YYSTYPE yylval; int sudolineno = 1; char *sudoers; static int sawspace = 0; static int arg_len = 0; static int arg_size = 0; static int append __P((char *, int)); static int _fill __P((char *, int, int)); static int fill_cmnd __P((char *, int)); static int fill_args __P((char *, int, int)); static int _push_include __P((char *, int)); static int pop_include __P((void)); static int ipv6_valid __P((const char *s)); static char *parse_include __P((char *)); extern void yyerror __P((const char *)); #define fill(a, b) _fill(a, b, 0) #define push_include(_p) (_push_include((_p), FALSE)) #define push_includedir(_p) (_push_include((_p), TRUE)) /* realloc() to size + COMMANDARGINC to make room for command args */ #define COMMANDARGINC 64 #ifdef TRACELEXER #define LEXTRACE(msg) fputs(msg, stderr) #else #define LEXTRACE(msg) #endif #define YY_NO_UNPUT 1 #define GOTDEFS 1 #define GOTCMND 2 #define STARTDEFS 3 #define INDEFS 4 #define INSTR 5 #line 1465 "lex.yy.c" /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int yywrap YY_PROTO(( void )); #else extern int yywrap YY_PROTO(( void )); #endif #endif #ifndef YY_NO_UNPUT static void yyunput YY_PROTO(( int c, char *buf_ptr )); #endif #ifndef yytext_ptr static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen YY_PROTO(( yyconst char * )); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput YY_PROTO(( void )); #else static int input YY_PROTO(( void )); #endif #endif #if defined(YY_STACK_USED) && YY_STACK_USED static int yy_start_stack_ptr = 0; static int yy_start_stack_depth = 0; static int *yy_start_stack = 0; #ifndef YY_NO_PUSH_STATE static void yy_push_state YY_PROTO(( int new_state )); #endif #ifndef YY_NO_POP_STATE static void yy_pop_state YY_PROTO(( void )); #endif #ifndef YY_NO_TOP_STATE static int yy_top_state YY_PROTO(( void )); #endif #else #define YY_NO_PUSH_STATE 1 #define YY_NO_POP_STATE 1 #define YY_NO_TOP_STATE 1 #endif #ifdef YY_MALLOC_DECL YY_MALLOC_DECL #else #ifdef __STDC__ #ifndef __cplusplus #include #endif #else /* Just try to get by without declaring the routines. This will fail * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) * or sizeof(void*) != sizeof(int). */ #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #define YY_READ_BUF_SIZE 8192 #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* 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 ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ if ( yy_current_buffer->yy_is_interactive ) \ { \ int c = '*', n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL int yylex YY_PROTO(( void )) #endif /* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK break; #endif #define YY_RULE_SETUP \ if ( yyleng > 0 ) \ yy_current_buffer->yy_at_bol = \ (yytext[yyleng - 1] == '\n'); \ YY_USER_ACTION YY_DECL { register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; #line 131 "toke.l" #line 1621 "lex.yy.c" if ( yy_init ) { yy_init = 0; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! yy_start ) yy_start = 1; /* first start state */ if ( ! yyin ) yyin = stdin; if ( ! yyout ) yyout = stdout; if ( ! yy_current_buffer ) yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); yy_load_buffer_state(); } while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = yy_c_buf_p; /* Support of yytext. */ *yy_cp = yy_hold_char; /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = yy_start; yy_current_state += YY_AT_BOL(); yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 554 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 3488 ); yy_find_action: yy_act = yy_accept[yy_current_state]; if ( yy_act == 0 ) { /* have to back up */ yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state; yy_act = yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = yy_hold_char; yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state; goto yy_find_action; case 1: YY_RULE_SETUP #line 132 "toke.l" BEGIN STARTDEFS; YY_BREAK case 2: YY_RULE_SETUP #line 134 "toke.l" { BEGIN INDEFS; LEXTRACE("DEFVAR "); if (!fill(yytext, yyleng)) yyterminate(); return(DEFVAR); } YY_BREAK case 3: YY_RULE_SETUP #line 143 "toke.l" { BEGIN STARTDEFS; LEXTRACE(", "); return(','); } /* return ',' */ YY_BREAK case 4: YY_RULE_SETUP #line 149 "toke.l" { LEXTRACE("= "); return('='); } /* return '=' */ YY_BREAK case 5: YY_RULE_SETUP #line 154 "toke.l" { LEXTRACE("+= "); return('+'); } /* return '+' */ YY_BREAK case 6: YY_RULE_SETUP #line 159 "toke.l" { LEXTRACE("-= "); return('-'); } /* return '-' */ YY_BREAK case 7: YY_RULE_SETUP #line 164 "toke.l" { LEXTRACE("BEGINSTR "); yylval.string = NULL; BEGIN INSTR; } YY_BREAK case 8: YY_RULE_SETUP #line 170 "toke.l" { LEXTRACE("WORD(2) "); if (!fill(yytext, yyleng)) yyterminate(); return(WORD); } YY_BREAK case 9: YY_RULE_SETUP #line 179 "toke.l" { /* Line continuation char followed by newline. */ ++sudolineno; LEXTRACE("\n"); } YY_BREAK case 10: YY_RULE_SETUP #line 185 "toke.l" { LEXTRACE("ENDSTR "); BEGIN INDEFS; return(WORD); } YY_BREAK case 11: YY_RULE_SETUP #line 191 "toke.l" { LEXTRACE("BACKSLASH "); if (!append(yytext, yyleng)) yyterminate(); } YY_BREAK case 12: YY_RULE_SETUP #line 197 "toke.l" { LEXTRACE("STRBODY "); if (!append(yytext, yyleng)) yyterminate(); } YY_BREAK case 13: YY_RULE_SETUP #line 205 "toke.l" { /* quoted fnmatch glob char, pass verbatim */ LEXTRACE("QUOTEDCHAR "); if (!fill_args(yytext, 2, sawspace)) yyterminate(); sawspace = FALSE; } YY_BREAK case 14: YY_RULE_SETUP #line 213 "toke.l" { /* quoted sudoers special char, strip backslash */ LEXTRACE("QUOTEDCHAR "); if (!fill_args(yytext + 1, 1, sawspace)) yyterminate(); sawspace = FALSE; } YY_BREAK case 15: YY_RULE_SETUP #line 221 "toke.l" { BEGIN INITIAL; yyless(0); return(COMMAND); } /* end of command line args */ YY_BREAK case 16: YY_RULE_SETUP #line 227 "toke.l" { LEXTRACE("ARG "); if (!fill_args(yytext, yyleng, sawspace)) yyterminate(); sawspace = FALSE; } /* a command line arg */ YY_BREAK case 17: YY_RULE_SETUP #line 235 "toke.l" { char *path; if ((path = parse_include(yytext)) == NULL) yyterminate(); LEXTRACE("INCLUDE\n"); /* Push current buffer and switch to include file */ if (!push_include(path)) yyterminate(); } YY_BREAK case 18: YY_RULE_SETUP #line 248 "toke.l" { char *path; if ((path = parse_include(yytext)) == NULL) yyterminate(); LEXTRACE("INCLUDEDIR\n"); /* Push current buffer and switch to include file */ if (!push_includedir(path)) yyterminate(); } YY_BREAK case 19: YY_RULE_SETUP #line 261 "toke.l" { int n; for (n = 0; isblank((unsigned char)yytext[n]); n++) continue; n += 8; BEGIN GOTDEFS; switch (yytext[n++]) { case ':': yyless(n); LEXTRACE("DEFAULTS_USER "); return(DEFAULTS_USER); case '>': yyless(n); LEXTRACE("DEFAULTS_RUNAS "); return(DEFAULTS_RUNAS); case '@': yyless(n); LEXTRACE("DEFAULTS_HOST "); return(DEFAULTS_HOST); case '!': yyless(n); LEXTRACE("DEFAULTS_CMND "); return(DEFAULTS_CMND); default: LEXTRACE("DEFAULTS "); return(DEFAULTS); } } YY_BREAK case 20: YY_RULE_SETUP #line 290 "toke.l" { int n; for (n = 0; isblank((unsigned char)yytext[n]); n++) continue; switch (yytext[n]) { case 'H': LEXTRACE("HOSTALIAS "); return(HOSTALIAS); case 'C': LEXTRACE("CMNDALIAS "); return(CMNDALIAS); case 'U': LEXTRACE("USERALIAS "); return(USERALIAS); case 'R': LEXTRACE("RUNASALIAS "); return(RUNASALIAS); } } YY_BREAK case 21: YY_RULE_SETUP #line 310 "toke.l" { /* cmnd does not require passwd for this user */ LEXTRACE("NOPASSWD "); return(NOPASSWD); } YY_BREAK case 22: YY_RULE_SETUP #line 316 "toke.l" { /* cmnd requires passwd for this user */ LEXTRACE("PASSWD "); return(PASSWD); } YY_BREAK case 23: YY_RULE_SETUP #line 322 "toke.l" { LEXTRACE("NOEXEC "); return(NOEXEC); } YY_BREAK case 24: YY_RULE_SETUP #line 327 "toke.l" { LEXTRACE("EXEC "); return(EXEC); } YY_BREAK case 25: YY_RULE_SETUP #line 332 "toke.l" { LEXTRACE("SETENV "); return(SETENV); } YY_BREAK case 26: YY_RULE_SETUP #line 337 "toke.l" { LEXTRACE("NOSETENV "); return(NOSETENV); } YY_BREAK case 27: YY_RULE_SETUP #line 342 "toke.l" { /* netgroup */ if (!fill(yytext, yyleng)) yyterminate(); LEXTRACE("NETGROUP "); return(NETGROUP); } YY_BREAK case 28: YY_RULE_SETUP #line 350 "toke.l" { /* UN*X group */ if (!fill(yytext, yyleng)) yyterminate(); LEXTRACE("USERGROUP "); return(USERGROUP); } YY_BREAK case 29: YY_RULE_SETUP #line 358 "toke.l" { if (!fill(yytext, yyleng)) yyterminate(); LEXTRACE("NTWKADDR "); return(NTWKADDR); } YY_BREAK case 30: YY_RULE_SETUP #line 365 "toke.l" { if (!fill(yytext, yyleng)) yyterminate(); LEXTRACE("NTWKADDR "); return(NTWKADDR); } YY_BREAK case 31: YY_RULE_SETUP #line 372 "toke.l" { if (!ipv6_valid(yytext)) { LEXTRACE("ERROR "); return(ERROR); } if (!fill(yytext, yyleng)) yyterminate(); LEXTRACE("NTWKADDR "); return(NTWKADDR); } YY_BREAK case 32: YY_RULE_SETUP #line 383 "toke.l" { if (!ipv6_valid(yytext)) { LEXTRACE("ERROR "); return(ERROR); } if (!fill(yytext, yyleng)) yyterminate(); LEXTRACE("NTWKADDR "); return(NTWKADDR); } YY_BREAK case 33: YY_RULE_SETUP #line 394 "toke.l" { if (strcmp(yytext, "ALL") == 0) { LEXTRACE("ALL "); return(ALL); } #ifdef HAVE_SELINUX /* XXX - restrict type/role to initial state */ if (strcmp(yytext, "TYPE") == 0) { LEXTRACE("TYPE "); return(TYPE); } if (strcmp(yytext, "ROLE") == 0) { LEXTRACE("ROLE "); return(ROLE); } #endif /* HAVE_SELINUX */ if (!fill(yytext, yyleng)) yyterminate(); LEXTRACE("ALIAS "); return(ALIAS); } YY_BREAK case 34: YY_RULE_SETUP #line 416 "toke.l" { /* no command args allowed for Defaults!/path */ if (!fill_cmnd(yytext, yyleng)) yyterminate(); LEXTRACE("COMMAND "); return(COMMAND); } YY_BREAK case 35: YY_RULE_SETUP #line 424 "toke.l" { BEGIN GOTCMND; LEXTRACE("COMMAND "); if (!fill_cmnd(yytext, yyleng)) yyterminate(); } /* sudo -e */ YY_BREAK case 36: YY_RULE_SETUP #line 431 "toke.l" { /* directories can't have args... */ if (yytext[yyleng - 1] == '/') { LEXTRACE("COMMAND "); if (!fill_cmnd(yytext, yyleng)) yyterminate(); return(COMMAND); } else { BEGIN GOTCMND; LEXTRACE("COMMAND "); if (!fill_cmnd(yytext, yyleng)) yyterminate(); } } /* a pathname */ YY_BREAK case 37: YY_RULE_SETUP #line 446 "toke.l" { /* a quoted user/group name */ if (!fill(yytext + 1, yyleng - 2)) yyterminate(); switch (yytext[1]) { case '%': LEXTRACE("USERGROUP "); return(USERGROUP); case '+': LEXTRACE("NETGROUP "); return(NETGROUP); default: LEXTRACE("WORD(4) "); return(WORD); } } YY_BREAK case 38: YY_RULE_SETUP #line 463 "toke.l" { /* a word */ if (!fill(yytext, yyleng)) yyterminate(); LEXTRACE("WORD(5) "); return(WORD); } YY_BREAK case 39: YY_RULE_SETUP #line 471 "toke.l" { LEXTRACE("( "); return ('('); } YY_BREAK case 40: YY_RULE_SETUP #line 476 "toke.l" { LEXTRACE(") "); return(')'); } YY_BREAK case 41: YY_RULE_SETUP #line 481 "toke.l" { LEXTRACE(", "); return(','); } /* return ',' */ YY_BREAK case 42: YY_RULE_SETUP #line 486 "toke.l" { LEXTRACE("= "); return('='); } /* return '=' */ YY_BREAK case 43: YY_RULE_SETUP #line 491 "toke.l" { LEXTRACE(": "); return(':'); } /* return ':' */ YY_BREAK case 44: YY_RULE_SETUP #line 496 "toke.l" { if (yyleng % 2 == 1) return('!'); /* return '!' */ } YY_BREAK case 45: YY_RULE_SETUP #line 501 "toke.l" { BEGIN INITIAL; ++sudolineno; LEXTRACE("\n"); return(COMMENT); } /* return newline */ YY_BREAK case 46: YY_RULE_SETUP #line 508 "toke.l" { /* throw away space/tabs */ sawspace = TRUE; /* but remember for fill_args */ } YY_BREAK case 47: YY_RULE_SETUP #line 512 "toke.l" { sawspace = TRUE; /* remember for fill_args */ ++sudolineno; LEXTRACE("\n\t"); } /* throw away EOL after \ */ YY_BREAK case 48: YY_RULE_SETUP #line 518 "toke.l" { BEGIN INITIAL; ++sudolineno; LEXTRACE("\n"); return(COMMENT); } /* comment, not uid/gid */ YY_BREAK case 49: YY_RULE_SETUP #line 525 "toke.l" { LEXTRACE("ERROR "); return(ERROR); } /* parse error */ YY_BREAK case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(GOTDEFS): case YY_STATE_EOF(GOTCMND): case YY_STATE_EOF(STARTDEFS): case YY_STATE_EOF(INDEFS): case YY_STATE_EOF(INSTR): #line 530 "toke.l" { if (YY_START != INITIAL) { BEGIN INITIAL; LEXTRACE("ERROR "); return(ERROR); } if (!pop_include()) yyterminate(); } YY_BREAK case 50: YY_RULE_SETUP #line 540 "toke.l" ECHO; YY_BREAK #line 2272 "lex.yy.c" case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = yy_hold_char; YY_RESTORE_YY_MORE_OFFSET if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure * consistency between yy_current_buffer and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ yy_n_chars = yy_current_buffer->yy_n_chars; yy_current_buffer->yy_input_file = yyin; yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) { /* This was really a NUL. */ yy_state_type yy_next_state; yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state(); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = yytext_ptr + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++yy_c_buf_p; yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = yy_c_buf_p; goto yy_find_action; } } else switch ( yy_get_next_buffer() ) { case EOB_ACT_END_OF_FILE: { yy_did_buffer_switch_on_eof = 0; if ( yywrap() ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state(); yy_cp = yy_c_buf_p; yy_bp = yytext_ptr + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: yy_c_buf_p = &yy_current_buffer->yy_ch_buf[yy_n_chars]; yy_current_state = yy_get_previous_state(); yy_cp = yy_c_buf_p; yy_bp = yytext_ptr + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer() { register char *dest = yy_current_buffer->yy_ch_buf; register char *source = yytext_ptr; register int number_to_move, i; int ret_val; if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( yy_current_buffer->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ yy_current_buffer->yy_n_chars = yy_n_chars = 0; else { int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ #ifdef YY_USES_REJECT YY_FATAL_ERROR( "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); #else /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = yy_current_buffer; int yy_c_buf_p_offset = (int) (yy_c_buf_p - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ yy_flex_realloc( (void *) b->yy_ch_buf, b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; #endif } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), yy_n_chars, num_to_read ); yy_current_buffer->yy_n_chars = yy_n_chars; } if ( yy_n_chars == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; yyrestart( yyin ); } else { ret_val = EOB_ACT_LAST_MATCH; yy_current_buffer->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; yy_n_chars += number_to_move; yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state() { register yy_state_type yy_current_state; register char *yy_cp; yy_current_state = yy_start; yy_current_state += YY_AT_BOL(); for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 554 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ #ifdef YY_USE_PROTOS static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) #else static yy_state_type yy_try_NUL_trans( yy_current_state ) yy_state_type yy_current_state; #endif { register int yy_is_jam; register char *yy_cp = yy_c_buf_p; register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 554 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 553); return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_UNPUT #ifdef YY_USE_PROTOS static void yyunput( int c, register char *yy_bp ) #else static void yyunput( c, yy_bp ) int c; register char *yy_bp; #endif { register char *yy_cp = yy_c_buf_p; /* undo effects of setting up yytext */ *yy_cp = yy_hold_char; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ register int number_to_move = yy_n_chars + 2; register char *dest = &yy_current_buffer->yy_ch_buf[ yy_current_buffer->yy_buf_size + 2]; register char *source = &yy_current_buffer->yy_ch_buf[number_to_move]; while ( source > yy_current_buffer->yy_ch_buf ) *--dest = *--source; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); yy_current_buffer->yy_n_chars = yy_n_chars = yy_current_buffer->yy_buf_size; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } *--yy_cp = (char) c; yytext_ptr = yy_bp; yy_hold_char = *yy_cp; yy_c_buf_p = yy_cp; } #endif /* ifndef YY_NO_UNPUT */ #ifdef __cplusplus static int yyinput() #else static int input() #endif { int c; *yy_c_buf_p = yy_hold_char; if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) /* This was really a NUL. */ *yy_c_buf_p = '\0'; else { /* need more input */ int offset = yy_c_buf_p - yytext_ptr; ++yy_c_buf_p; switch ( yy_get_next_buffer() ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ yyrestart( yyin ); /* fall through */ case EOB_ACT_END_OF_FILE: { if ( yywrap() ) return EOF; if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: yy_c_buf_p = yytext_ptr + offset; break; } } } c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ *yy_c_buf_p = '\0'; /* preserve yytext */ yy_hold_char = *++yy_c_buf_p; yy_current_buffer->yy_at_bol = (c == '\n'); return c; } #ifdef YY_USE_PROTOS void yyrestart( FILE *input_file ) #else void yyrestart( input_file ) FILE *input_file; #endif { if ( ! yy_current_buffer ) yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); yy_init_buffer( yy_current_buffer, input_file ); yy_load_buffer_state(); } #ifdef YY_USE_PROTOS void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) #else void yy_switch_to_buffer( new_buffer ) YY_BUFFER_STATE new_buffer; #endif { if ( yy_current_buffer == new_buffer ) return; if ( yy_current_buffer ) { /* Flush out information for old buffer. */ *yy_c_buf_p = yy_hold_char; yy_current_buffer->yy_buf_pos = yy_c_buf_p; yy_current_buffer->yy_n_chars = yy_n_chars; } yy_current_buffer = new_buffer; yy_load_buffer_state(); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ yy_did_buffer_switch_on_eof = 1; } #ifdef YY_USE_PROTOS void yy_load_buffer_state( void ) #else void yy_load_buffer_state() #endif { yy_n_chars = yy_current_buffer->yy_n_chars; yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; yyin = yy_current_buffer->yy_input_file; yy_hold_char = *yy_c_buf_p; } #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) #else YY_BUFFER_STATE yy_create_buffer( file, size ) FILE *file; int size; #endif { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; yy_init_buffer( b, file ); return b; } #ifdef YY_USE_PROTOS void yy_delete_buffer( YY_BUFFER_STATE b ) #else void yy_delete_buffer( b ) YY_BUFFER_STATE b; #endif { if ( ! b ) return; if ( b == yy_current_buffer ) yy_current_buffer = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) yy_flex_free( (void *) b->yy_ch_buf ); yy_flex_free( (void *) b ); } #ifndef YY_ALWAYS_INTERACTIVE #ifndef YY_NEVER_INTERACTIVE #include #endif #endif #ifdef YY_USE_PROTOS void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) #else void yy_init_buffer( b, file ) YY_BUFFER_STATE b; FILE *file; #endif { int oerrno = errno; yy_flush_buffer( b ); b->yy_input_file = file; b->yy_fill_buffer = 1; #if defined(YY_ALWAYS_INTERACTIVE) && YY_ALWAYS_INTERACTIVE b->yy_is_interactive = 1; #else #if defined(YY_NEVER_INTERACTIVE) && YY_NEVER_INTERACTIVE b->yy_is_interactive = 0; #else b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; #endif #endif errno = oerrno; } #ifdef YY_USE_PROTOS void yy_flush_buffer( YY_BUFFER_STATE b ) #else void yy_flush_buffer( b ) YY_BUFFER_STATE b; #endif { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == yy_current_buffer ) yy_load_buffer_state(); } #ifndef YY_NO_SCAN_BUFFER #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) #else YY_BUFFER_STATE yy_scan_buffer( base, size ) char *base; yy_size_t size; #endif { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = 0; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; yy_switch_to_buffer( b ); return b; } #endif #ifndef YY_NO_SCAN_STRING #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) #else YY_BUFFER_STATE yy_scan_string( yy_str ) yyconst char *yy_str; #endif { int len; for ( len = 0; yy_str[len]; ++len ) ; return yy_scan_bytes( yy_str, len ); } #endif #ifndef YY_NO_SCAN_BYTES #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) #else YY_BUFFER_STATE yy_scan_bytes( bytes, len ) yyconst char *bytes; int len; #endif { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = len + 2; buf = (char *) yy_flex_alloc( n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < len; ++i ) buf[i] = bytes[i]; buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; b = yy_scan_buffer( buf, n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } #endif #ifndef YY_NO_PUSH_STATE #ifdef YY_USE_PROTOS static void yy_push_state( int new_state ) #else static void yy_push_state( new_state ) int new_state; #endif { if ( yy_start_stack_ptr >= yy_start_stack_depth ) { yy_size_t new_size; yy_start_stack_depth += YY_START_STACK_INCR; new_size = yy_start_stack_depth * sizeof( int ); if ( ! yy_start_stack ) yy_start_stack = (int *) yy_flex_alloc( new_size ); else yy_start_stack = (int *) yy_flex_realloc( (void *) yy_start_stack, new_size ); if ( ! yy_start_stack ) YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); } yy_start_stack[yy_start_stack_ptr++] = YY_START; BEGIN(new_state); } #endif #ifndef YY_NO_POP_STATE static void yy_pop_state() { if ( --yy_start_stack_ptr < 0 ) YY_FATAL_ERROR( "start-condition stack underflow" ); BEGIN(yy_start_stack[yy_start_stack_ptr]); } #endif #ifndef YY_NO_TOP_STATE static int yy_top_state() { return yy_start_stack[yy_start_stack_ptr - 1]; } #endif #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif #ifdef YY_USE_PROTOS static void yy_fatal_error( yyconst char msg[] ) #else static void yy_fatal_error( msg ) char msg[]; #endif { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ yytext[yyleng] = yy_hold_char; \ yy_c_buf_p = yytext + n; \ yy_hold_char = *yy_c_buf_p; \ *yy_c_buf_p = '\0'; \ yyleng = n; \ } \ while ( 0 ) /* Internal utility routines. */ #ifndef yytext_ptr #ifdef YY_USE_PROTOS static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) #else static void yy_flex_strncpy( s1, s2, n ) char *s1; yyconst char *s2; int n; #endif { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN #ifdef YY_USE_PROTOS static int yy_flex_strlen( yyconst char *s ) #else static int yy_flex_strlen( s ) yyconst char *s; #endif { register int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif #ifdef YY_USE_PROTOS static void *yy_flex_alloc( yy_size_t size ) #else static void *yy_flex_alloc( size ) yy_size_t size; #endif { return (void *) malloc( size ); } #ifdef YY_USE_PROTOS static void *yy_flex_realloc( void *ptr, yy_size_t size ) #else static void *yy_flex_realloc( ptr, size ) void *ptr; yy_size_t size; #endif { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); } #ifdef YY_USE_PROTOS static void yy_flex_free( void *ptr ) #else static void yy_flex_free( ptr ) void *ptr; #endif { free( ptr ); } #if defined(YY_MAIN) && YY_MAIN int main() { yylex(); return 0; } #endif #line 540 "toke.l" static unsigned char hexchar(s) const char *s; { int i; int result = 0; s += 2; /* skip \\x */ for (i = 0; i < 2; i++) { switch (*s) { case 'A': case 'a': result += 10; break; case 'B': case 'b': result += 11; break; case 'C': case 'c': result += 12; break; case 'D': case 'd': result += 13; break; case 'E': case 'e': result += 14; break; case 'F': case 'f': result += 15; break; default: result += *s - '0'; break; } if (i == 0) { result *= 16; s++; } } return((unsigned char)result); } static int _fill(src, len, olen) char *src; int len, olen; { char *dst; dst = olen ? realloc(yylval.string, olen + len + 1) : malloc(len + 1); if (dst == NULL) { yyerror("unable to allocate memory"); return(FALSE); } yylval.string = dst; /* Copy the string and collapse any escaped characters. */ dst += olen; while (len--) { if (*src == '\\' && len) { if (src[1] == 'x' && len >= 3 && isxdigit((unsigned char) src[2]) && isxdigit((unsigned char) src[3])) { *dst++ = hexchar(src); src += 4; len -= 3; } else { src++; len--; *dst++ = *src++; } } else { *dst++ = *src++; } } *dst = '\0'; return(TRUE); } static int append(src, len) char *src; int len; { int olen = 0; if (yylval.string != NULL) olen = strlen(yylval.string); return(_fill(src, len, olen)); } #define SPECIAL(c) \ ((c) == ',' || (c) == ':' || (c) == '=' || (c) == ' ' || (c) == '\t' || (c) == '#') static int fill_cmnd(src, len) char *src; int len; { char *dst; int i; arg_len = arg_size = 0; dst = yylval.command.cmnd = (char *) malloc(len + 1); if (yylval.command.cmnd == NULL) { yyerror("unable to allocate memory"); return(FALSE); } /* Copy the string and collapse any escaped sudo-specific characters. */ for (i = 0; i < len; i++) { if (src[i] == '\\' && i != len - 1 && SPECIAL(src[i + 1])) *dst++ = src[++i]; else *dst++ = src[i]; } *dst = '\0'; yylval.command.args = NULL; return(TRUE); } static int fill_args(s, len, addspace) char *s; int len; int addspace; { int new_len; char *p; if (yylval.command.args == NULL) { addspace = 0; new_len = len; } else new_len = arg_len + len + addspace; if (new_len >= arg_size) { /* Allocate more space than we need for subsequent args */ while (new_len >= (arg_size += COMMANDARGINC)) ; p = yylval.command.args ? (char *) realloc(yylval.command.args, arg_size) : (char *) malloc(arg_size); if (p == NULL) { efree(yylval.command.args); yyerror("unable to allocate memory"); return(FALSE); } else yylval.command.args = p; } /* Efficiently append the arg (with a leading space if needed). */ p = yylval.command.args + arg_len; if (addspace) *p++ = ' '; if (strlcpy(p, s, arg_size - (p - yylval.command.args)) != len) { yyerror("fill_args: buffer overflow"); /* paranoia */ return(FALSE); } arg_len = new_len; return(TRUE); } struct path_list { char *path; struct path_list *next; }; struct include_stack { YY_BUFFER_STATE bs; char *path; struct path_list *more; /* more files in case of includedir */ int lineno; int keepopen; }; static int pl_compare(v1, v2) const void *v1; const void *v2; { const struct path_list * const *p1 = v1; const struct path_list * const *p2 = v2; return(strcmp((*p1)->path, (*p2)->path)); } static char * switch_dir(stack, dirpath) struct include_stack *stack; char *dirpath; { DIR *dir; int i, count = 0; char *path = NULL; struct dirent *dent; struct stat sb; struct path_list *pl, *first = NULL; struct path_list **sorted = NULL; if (!(dir = opendir(dirpath))) { yyerror(dirpath); return(FALSE); } while ((dent = readdir(dir))) { /* Ignore files that end in '~' or have a '.' in them. */ if (dent->d_name[0] == '\0' || dent->d_name[NAMLEN(dent) - 1] == '~' || strchr(dent->d_name, '.') != NULL) { continue; } if (asprintf(&path, "%s/%s", dirpath, dent->d_name) == -1) { closedir(dir); goto bad; } if (stat(path, &sb) != 0 || !S_ISREG(sb.st_mode)) { efree(path); continue; } pl = malloc(sizeof(*pl)); if (pl == NULL) goto bad; pl->path = path; pl->next = first; first = pl; count++; } closedir(dir); if (count == 0) goto done; /* Sort the list as an array. */ sorted = malloc(sizeof(*sorted) * count); if (sorted == NULL) goto bad; pl = first; for (i = 0; i < count; i++) { sorted[i] = pl; pl = pl->next; } qsort(sorted, count, sizeof(*sorted), pl_compare); /* Apply sorting to the list. */ first = sorted[0]; sorted[count - 1]->next = NULL; for (i = 1; i < count; i++) sorted[i - 1]->next = sorted[i]; efree(sorted); /* Pull out the first element for parsing, leave the rest for later. */ if (count) { path = first->path; pl = first->next; efree(first); stack->more = pl; } else { path = NULL; } done: efree(dirpath); return(path); bad: while (first != NULL) { pl = first; first = pl->next; free(pl->path); free(pl); } efree(sorted); efree(dirpath); efree(path); return(NULL); } #define MAX_SUDOERS_DEPTH 128 #define SUDOERS_STACK_INCREMENT 16 static size_t istacksize, idepth; static struct include_stack *istack; static int keepopen; void init_lexer() { struct path_list *pl; while (idepth) { idepth--; while ((pl = istack[idepth].more) != NULL) { istack[idepth].more = pl->next; efree(pl->path); efree(pl); } efree(istack[idepth].path); if (!istack[idepth].keepopen) fclose(istack[idepth].bs->yy_input_file); yy_delete_buffer(istack[idepth].bs); } efree(istack); istack = NULL; istacksize = idepth = 0; keepopen = FALSE; } static int _push_include(path, isdir) char *path; int isdir; { FILE *fp; /* push current state onto stack */ if (idepth >= istacksize) { if (idepth > MAX_SUDOERS_DEPTH) { yyerror("too many levels of includes"); return(FALSE); } istacksize += SUDOERS_STACK_INCREMENT; istack = (struct include_stack *) realloc(istack, sizeof(istack) * istacksize); if (istack == NULL) { yyerror("unable to allocate memory"); return(FALSE); } } if (isdir) { if (!(path = switch_dir(&istack[idepth], path))) { yyerror(path); return(FALSE); } if ((fp = open_sudoers(path, FALSE, &keepopen)) == NULL) { yyerror(path); return(FALSE); /* XXX - just to go next one? */ } } else { if ((fp = open_sudoers(path, TRUE, &keepopen)) == NULL) { yyerror(path); return(FALSE); } istack[idepth].more = NULL; } /* Push the old (current) file and open the new one. */ istack[idepth].path = sudoers; /* push old path */ istack[idepth].bs = YY_CURRENT_BUFFER; istack[idepth].lineno = sudolineno; istack[idepth].keepopen = keepopen; idepth++; sudolineno = 1; sudoers = path; yy_switch_to_buffer(yy_create_buffer(fp, YY_BUF_SIZE)); return(TRUE); } static int pop_include() { struct path_list *pl; FILE *fp; if (idepth == 0) return(FALSE); if (!keepopen) fclose(YY_CURRENT_BUFFER->yy_input_file); yy_delete_buffer(YY_CURRENT_BUFFER); keepopen = FALSE; if ((pl = istack[idepth - 1].more) != NULL) { /* Move to next file in the dir. */ istack[idepth - 1].more = pl->next; if ((fp = open_sudoers(pl->path, FALSE, &keepopen)) == NULL) { yyerror(pl->path); return(FALSE); /* XXX - just to go next one? */ } efree(sudoers); sudoers = pl->path; sudolineno = 1; yy_switch_to_buffer(yy_create_buffer(fp, YY_BUF_SIZE)); efree(pl); } else { idepth--; yy_switch_to_buffer(istack[idepth].bs); efree(sudoers); sudoers = istack[idepth].path; sudolineno = istack[idepth].lineno; } return(TRUE); } static char * parse_include(base) char *base; { char *cp, *ep, *path; int len = 0, subst = 0; size_t shost_len = 0; /* Pull out path from #include line. */ cp = base + sizeof("#include"); if (*cp == 'i') cp += 3; /* includedir */ while (isblank((unsigned char) *cp)) cp++; ep = cp; while (*ep != '\0' && !isspace((unsigned char) *ep)) { if (ep[0] == '%' && ep[1] == 'h') { shost_len = strlen(user_shost); len += shost_len - 2; subst = 1; } ep++; } /* Make a copy of path and return it. */ len += (int)(ep - cp); if ((path = malloc(len + 1)) == NULL) yyerror("unable to allocate memory"); if (subst) { /* substitute for %h */ char *pp = path; while (cp < ep) { if (cp[0] == '%' && cp[1] == 'h') { memcpy(pp, user_shost, shost_len); pp += shost_len; cp += 2; continue; } *pp++ = *cp++; } *pp = '\0'; } else { memcpy(path, cp, len); path[len] = '\0'; } /* Push any excess characters (e.g. comment, newline) back to the lexer */ if (*ep != '\0') yyless((int)(ep - base)); return(path); } /* * Check to make sure an IPv6 address does not contain multiple instances * of the string "::". Assumes strlen(s) >= 1. * Returns TRUE if address is valid else FALSE. */ static int ipv6_valid(s) const char *s; { int nmatch = 0; for (; *s != '\0'; s++) { if (s[0] == ':' && s[1] == ':') { if (++nmatch > 1) break; } if (s[0] == '/') nmatch = 0; /* reset if we hit netmask */ } return (nmatch <= 1); }