Home | History | Annotate | Download | only in sh
      1 /*
      2  * This file was generated by the mkinit program.
      3  */
      4 
      5 #include "shell.h"
      6 #include "mystring.h"
      7 #include "init.h"
      8 #include "eval.h"
      9 #include <stdio.h>
     10 #include "input.h"
     11 #include "error.h"
     12 #include <stdlib.h>
     13 #include "options.h"
     14 #include "redir.h"
     15 #include <signal.h>
     16 #include "trap.h"
     17 #include "output.h"
     18 #include "memalloc.h"
     19 #include "var.h"
     20 
     21 
     22 
     23 #undef  ATABSIZE
     24 #define ATABSIZE 39
     25 #undef  YYBISON
     26 #define YYBISON 1
     27 #undef  YYSKELETON_NAME
     28 #define YYSKELETON_NAME "yacc.c"
     29 #undef  YYPURE
     30 #define YYPURE 0
     31 #undef  YYLSP_NEEDED
     32 #define YYLSP_NEEDED 0
     33 #undef  ARITH_NUM
     34 #define ARITH_NUM 258
     35 #undef  ARITH_LPAREN
     36 #define ARITH_LPAREN 259
     37 #undef  ARITH_RPAREN
     38 #define ARITH_RPAREN 260
     39 #undef  ARITH_OR
     40 #define ARITH_OR 261
     41 #undef  ARITH_AND
     42 #define ARITH_AND 262
     43 #undef  ARITH_BOR
     44 #define ARITH_BOR 263
     45 #undef  ARITH_BXOR
     46 #define ARITH_BXOR 264
     47 #undef  ARITH_BAND
     48 #define ARITH_BAND 265
     49 #undef  ARITH_NE
     50 #define ARITH_NE 266
     51 #undef  ARITH_EQ
     52 #define ARITH_EQ 267
     53 #undef  ARITH_LE
     54 #define ARITH_LE 268
     55 #undef  ARITH_GE
     56 #define ARITH_GE 269
     57 #undef  ARITH_GT
     58 #define ARITH_GT 270
     59 #undef  ARITH_LT
     60 #define ARITH_LT 271
     61 #undef  ARITH_RSHIFT
     62 #define ARITH_RSHIFT 272
     63 #undef  ARITH_LSHIFT
     64 #define ARITH_LSHIFT 273
     65 #undef  ARITH_SUB
     66 #define ARITH_SUB 274
     67 #undef  ARITH_ADD
     68 #define ARITH_ADD 275
     69 #undef  ARITH_REM
     70 #define ARITH_REM 276
     71 #undef  ARITH_DIV
     72 #define ARITH_DIV 277
     73 #undef  ARITH_MUL
     74 #define ARITH_MUL 278
     75 #undef  ARITH_BNOT
     76 #define ARITH_BNOT 279
     77 #undef  ARITH_NOT
     78 #define ARITH_NOT 280
     79 #undef  ARITH_UNARYPLUS
     80 #define ARITH_UNARYPLUS 281
     81 #undef  ARITH_UNARYMINUS
     82 #define ARITH_UNARYMINUS 282
     83 #undef  YYFINAL
     84 #define YYFINAL  14
     85 #undef  YYLAST
     86 #define YYLAST   170
     87 #undef  YYNTOKENS
     88 #define YYNTOKENS  28
     89 #undef  YYNNTS
     90 #define YYNNTS  3
     91 #undef  YYNRULES
     92 #define YYNRULES  26
     93 #undef  YYNSTATES
     94 #define YYNSTATES  52
     95 #undef  YYUNDEFTOK
     96 #define YYUNDEFTOK  2
     97 #undef  YYMAXUTOK
     98 #define YYMAXUTOK   282
     99 #undef  YYPACT_NINF
    100 #define YYPACT_NINF -13
    101 #undef  YYTABLE_NINF
    102 #define YYTABLE_NINF -1
    103 #undef  yyerrok
    104 #define yyerrok		(yyerrstatus = 0)
    105 #undef  yyclearin
    106 #define yyclearin	(yychar = YYEMPTY)
    107 #undef  YYEMPTY
    108 #define YYEMPTY		(-2)
    109 #undef  YYEOF
    110 #define YYEOF		0
    111 #undef  YYACCEPT
    112 #define YYACCEPT	goto yyacceptlab
    113 #undef  YYABORT
    114 #define YYABORT		goto yyabortlab
    115 #undef  YYERROR
    116 #define YYERROR		goto yyerrorlab
    117 #undef  YYFAIL
    118 #define YYFAIL		goto yyerrlab
    119 #undef  YYTERROR
    120 #define YYTERROR	1
    121 #undef  YYERRCODE
    122 #define YYERRCODE	256
    123 #undef  YYPOPSTACK
    124 #define YYPOPSTACK   (yyvsp--, yyssp--)
    125 #undef  YY_INT_ALIGNED
    126 #define  YY_INT_ALIGNED short int
    127 #undef  FLEX_SCANNER
    128 #define FLEX_SCANNER
    129 #undef  YY_FLEX_MAJOR_VERSION
    130 #define YY_FLEX_MAJOR_VERSION 2
    131 #undef  YY_FLEX_MINOR_VERSION
    132 #define YY_FLEX_MINOR_VERSION 5
    133 #undef  YY_FLEX_SUBMINOR_VERSION
    134 #define YY_FLEX_SUBMINOR_VERSION 31
    135 #undef  FLEX_BETA
    136 #define FLEX_BETA
    137 #undef  FLEXINT_H
    138 #define FLEXINT_H
    139 #undef  INT8_MIN
    140 #define INT8_MIN               (-128)
    141 #undef  INT16_MIN
    142 #define INT16_MIN              (-32767-1)
    143 #undef  INT32_MIN
    144 #define INT32_MIN              (-2147483647-1)
    145 #undef  INT8_MAX
    146 #define INT8_MAX               (127)
    147 #undef  INT16_MAX
    148 #define INT16_MAX              (32767)
    149 #undef  INT32_MAX
    150 #define INT32_MAX              (2147483647)
    151 #undef  UINT8_MAX
    152 #define UINT8_MAX              (255U)
    153 #undef  UINT16_MAX
    154 #define UINT16_MAX             (65535U)
    155 #undef  UINT32_MAX
    156 #define UINT32_MAX             (4294967295U)
    157 #undef  YY_USE_CONST
    158 #define YY_USE_CONST
    159 #undef  YY_USE_CONST
    160 #define YY_USE_CONST
    161 #undef  yyconst
    162 #define yyconst const
    163 #undef  yyconst
    164 #define yyconst
    165 #undef  YY_NULL
    166 #define YY_NULL 0
    167 #undef  BEGIN
    168 #define BEGIN (yy_start) = 1 + 2 *
    169 #undef  YY_START
    170 #define YY_START (((yy_start) - 1) / 2)
    171 #undef  YYSTATE
    172 #define YYSTATE YY_START
    173 #undef  YY_NEW_FILE
    174 #define YY_NEW_FILE yyrestart(yyin  )
    175 #undef  YY_END_OF_BUFFER_CHAR
    176 #define YY_END_OF_BUFFER_CHAR 0
    177 #undef  YY_BUF_SIZE
    178 #define YY_BUF_SIZE 16384
    179 #undef  YY_TYPEDEF_YY_BUFFER_STATE
    180 #define YY_TYPEDEF_YY_BUFFER_STATE
    181 #undef  EOB_ACT_CONTINUE_SCAN
    182 #define EOB_ACT_CONTINUE_SCAN 0
    183 #undef  EOB_ACT_END_OF_FILE
    184 #define EOB_ACT_END_OF_FILE 1
    185 #undef  EOB_ACT_LAST_MATCH
    186 #define EOB_ACT_LAST_MATCH 2
    187 #undef  YY_TYPEDEF_YY_SIZE_T
    188 #define YY_TYPEDEF_YY_SIZE_T
    189 #undef  YY_STRUCT_YY_BUFFER_STATE
    190 #define YY_STRUCT_YY_BUFFER_STATE
    191 #undef  YY_BUFFER_NEW
    192 #define YY_BUFFER_NEW 0
    193 #undef  YY_BUFFER_NORMAL
    194 #define YY_BUFFER_NORMAL 1
    195 #undef  YY_BUFFER_EOF_PENDING
    196 #define YY_BUFFER_EOF_PENDING 2
    197 #undef  YY_CURRENT_BUFFER
    198 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
    199 #undef  YY_CURRENT_BUFFER_LVALUE
    200 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
    201 #undef  YY_FLUSH_BUFFER
    202 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
    203 #undef  yy_new_buffer
    204 #define yy_new_buffer yy_create_buffer
    205 #undef  YY_SKIP_YYWRAP
    206 #define YY_SKIP_YYWRAP
    207 #undef  yytext_ptr
    208 #define yytext_ptr yytext
    209 #undef  YY_DO_BEFORE_ACTION
    210 #define YY_DO_BEFORE_ACTION \
    211 #undef  YY_NUM_RULES
    212 #define YY_NUM_RULES 29
    213 #undef  YY_END_OF_BUFFER
    214 #define YY_END_OF_BUFFER 30
    215 #undef  REJECT
    216 #define REJECT reject_used_but_not_detected
    217 #undef  YY_MORE_ADJ
    218 #define YY_MORE_ADJ 0
    219 #undef  YY_RESTORE_YY_MORE_OFFSET
    220 #define YY_RESTORE_YY_MORE_OFFSET
    221 #undef  YY_NO_UNPUT
    222 #define YY_NO_UNPUT
    223 #undef  INITIAL
    224 #define INITIAL 0
    225 #undef  YY_EXTRA_TYPE
    226 #define YY_EXTRA_TYPE void *
    227 #undef  YY_READ_BUF_SIZE
    228 #define YY_READ_BUF_SIZE 8192
    229 #undef  ECHO
    230 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
    231 #undef  YY_START_STACK_INCR
    232 #define YY_START_STACK_INCR 25
    233 #undef  YY_DECL_IS_OURS
    234 #define YY_DECL_IS_OURS 1
    235 #undef  YY_DECL
    236 #define YY_DECL int yylex (void)
    237 #undef  YY_USER_ACTION
    238 #define YY_USER_ACTION
    239 #undef  YY_BREAK
    240 #define YY_BREAK break;
    241 #undef  YY_RULE_SETUP
    242 #define YY_RULE_SETUP \
    243 #undef  YY_EXIT_FAILURE
    244 #define YY_EXIT_FAILURE 2
    245 #undef  YYTABLES_NAME
    246 #define YYTABLES_NAME "yytables"
    247 #undef  MAXPWD
    248 #define MAXPWD 256
    249 #undef  signal
    250 #define signal bsd_signal
    251 #undef  ALL
    252 #define ALL (E_OPEN|E_CREAT|E_EXEC)
    253 #undef  EV_EXIT
    254 #define EV_EXIT 01		/* exit after evaluating tree */
    255 #undef  EV_TESTED
    256 #define EV_TESTED 02		/* exit status is checked; ignore -e flag */
    257 #undef  EV_BACKCMD
    258 #define EV_BACKCMD 04		/* command executing within back quotes */
    259 #undef  CMDTABLESIZE
    260 #define CMDTABLESIZE 31		/* should be prime */
    261 #undef  ARB
    262 #define ARB 1			/* actual size determined at run time */
    263 #undef  NEWARGS
    264 #define NEWARGS 5
    265 #undef  EOF_NLEFT
    266 #define EOF_NLEFT -99		/* value of parsenleft when EOF pushed back */
    267 #undef  _PATH_DEVNULL
    268 #define _PATH_DEVNULL "/dev/null"
    269 #undef  PROFILE
    270 #define PROFILE 0
    271 #undef  SIGSSIZE
    272 #define SIGSSIZE (sizeof(sigs)/sizeof(sigs[0]))
    273 #undef  MINSIZE
    274 #define MINSIZE 504		/* minimum size of a block */
    275 #undef  DEFINE_OPTIONS
    276 #define DEFINE_OPTIONS
    277 #undef  EOFMARKLEN
    278 #define EOFMARKLEN 79
    279 #undef  OPENBRACE
    280 #define OPENBRACE '{'
    281 #undef  CLOSEBRACE
    282 #define CLOSEBRACE '}'
    283 #undef  EMPTY
    284 #define EMPTY -2		/* marks an unused slot in redirtab */
    285 #undef  signal
    286 #define signal bsd_signal
    287 #undef  sys_signame
    288 #define sys_signame sys_siglist
    289 #undef  S_DFL
    290 #define S_DFL 1			/* default signal handling (SIG_DFL) */
    291 #undef  S_CATCH
    292 #define S_CATCH 2		/* signal is caught */
    293 #undef  S_IGN
    294 #define S_IGN 3			/* signal is ignored (SIG_IGN) */
    295 #undef  S_HARD_IGN
    296 #define S_HARD_IGN 4		/* signal is ignored permenantly */
    297 #undef  S_RESET
    298 #define S_RESET 5		/* temporary - to reset a hard ignored sig */
    299 #undef  OUTBUFSIZ
    300 #define OUTBUFSIZ BUFSIZ
    301 #undef  BLOCK_OUT
    302 #define BLOCK_OUT -2		/* output to a fixed block of memory */
    303 #undef  MEM_OUT
    304 #define MEM_OUT -3		/* output to dynamically allocated memory */
    305 #undef  OUTPUT_ERR
    306 #define OUTPUT_ERR 01		/* error occurred on output */
    307 #undef  TEMPSIZE
    308 #define TEMPSIZE 24
    309 #undef  HAVE_VASPRINTF
    310 #define HAVE_VASPRINTF 1
    311 #undef  VTABSIZE
    312 #define VTABSIZE 39
    313 #undef  VTABSIZE
    314 #define VTABSIZE 517
    315 #undef  ATABSIZE
    316 #define ATABSIZE 39
    317 #undef  YYBISON
    318 #define YYBISON 1
    319 #undef  YYSKELETON_NAME
    320 #define YYSKELETON_NAME "yacc.c"
    321 #undef  YYPURE
    322 #define YYPURE 0
    323 #undef  YYLSP_NEEDED
    324 #define YYLSP_NEEDED 0
    325 #undef  ARITH_NUM
    326 #define ARITH_NUM 258
    327 #undef  ARITH_LPAREN
    328 #define ARITH_LPAREN 259
    329 #undef  ARITH_RPAREN
    330 #define ARITH_RPAREN 260
    331 #undef  ARITH_OR
    332 #define ARITH_OR 261
    333 #undef  ARITH_AND
    334 #define ARITH_AND 262
    335 #undef  ARITH_BOR
    336 #define ARITH_BOR 263
    337 #undef  ARITH_BXOR
    338 #define ARITH_BXOR 264
    339 #undef  ARITH_BAND
    340 #define ARITH_BAND 265
    341 #undef  ARITH_NE
    342 #define ARITH_NE 266
    343 #undef  ARITH_EQ
    344 #define ARITH_EQ 267
    345 #undef  ARITH_LE
    346 #define ARITH_LE 268
    347 #undef  ARITH_GE
    348 #define ARITH_GE 269
    349 #undef  ARITH_GT
    350 #define ARITH_GT 270
    351 #undef  ARITH_LT
    352 #define ARITH_LT 271
    353 #undef  ARITH_RSHIFT
    354 #define ARITH_RSHIFT 272
    355 #undef  ARITH_LSHIFT
    356 #define ARITH_LSHIFT 273
    357 #undef  ARITH_SUB
    358 #define ARITH_SUB 274
    359 #undef  ARITH_ADD
    360 #define ARITH_ADD 275
    361 #undef  ARITH_REM
    362 #define ARITH_REM 276
    363 #undef  ARITH_DIV
    364 #define ARITH_DIV 277
    365 #undef  ARITH_MUL
    366 #define ARITH_MUL 278
    367 #undef  ARITH_BNOT
    368 #define ARITH_BNOT 279
    369 #undef  ARITH_NOT
    370 #define ARITH_NOT 280
    371 #undef  ARITH_UNARYPLUS
    372 #define ARITH_UNARYPLUS 281
    373 #undef  ARITH_UNARYMINUS
    374 #define ARITH_UNARYMINUS 282
    375 #undef  YYFINAL
    376 #define YYFINAL  14
    377 #undef  YYLAST
    378 #define YYLAST   170
    379 #undef  YYNTOKENS
    380 #define YYNTOKENS  28
    381 #undef  YYNNTS
    382 #define YYNNTS  3
    383 #undef  YYNRULES
    384 #define YYNRULES  26
    385 #undef  YYNSTATES
    386 #define YYNSTATES  52
    387 #undef  YYUNDEFTOK
    388 #define YYUNDEFTOK  2
    389 #undef  YYMAXUTOK
    390 #define YYMAXUTOK   282
    391 #undef  YYPACT_NINF
    392 #define YYPACT_NINF -13
    393 #undef  YYTABLE_NINF
    394 #define YYTABLE_NINF -1
    395 #undef  yyerrok
    396 #define yyerrok		(yyerrstatus = 0)
    397 #undef  yyclearin
    398 #define yyclearin	(yychar = YYEMPTY)
    399 #undef  YYEMPTY
    400 #define YYEMPTY		(-2)
    401 #undef  YYEOF
    402 #define YYEOF		0
    403 #undef  YYACCEPT
    404 #define YYACCEPT	goto yyacceptlab
    405 #undef  YYABORT
    406 #define YYABORT		goto yyabortlab
    407 #undef  YYERROR
    408 #define YYERROR		goto yyerrorlab
    409 #undef  YYFAIL
    410 #define YYFAIL		goto yyerrlab
    411 #undef  YYTERROR
    412 #define YYTERROR	1
    413 #undef  YYERRCODE
    414 #define YYERRCODE	256
    415 #undef  YYPOPSTACK
    416 #define YYPOPSTACK   (yyvsp--, yyssp--)
    417 #undef  YY_INT_ALIGNED
    418 #define  YY_INT_ALIGNED short int
    419 #undef  FLEX_SCANNER
    420 #define FLEX_SCANNER
    421 #undef  YY_FLEX_MAJOR_VERSION
    422 #define YY_FLEX_MAJOR_VERSION 2
    423 #undef  YY_FLEX_MINOR_VERSION
    424 #define YY_FLEX_MINOR_VERSION 5
    425 #undef  YY_FLEX_SUBMINOR_VERSION
    426 #define YY_FLEX_SUBMINOR_VERSION 31
    427 #undef  FLEX_BETA
    428 #define FLEX_BETA
    429 #undef  FLEXINT_H
    430 #define FLEXINT_H
    431 #undef  INT8_MIN
    432 #define INT8_MIN               (-128)
    433 #undef  INT16_MIN
    434 #define INT16_MIN              (-32767-1)
    435 #undef  INT32_MIN
    436 #define INT32_MIN              (-2147483647-1)
    437 #undef  INT8_MAX
    438 #define INT8_MAX               (127)
    439 #undef  INT16_MAX
    440 #define INT16_MAX              (32767)
    441 #undef  INT32_MAX
    442 #define INT32_MAX              (2147483647)
    443 #undef  UINT8_MAX
    444 #define UINT8_MAX              (255U)
    445 #undef  UINT16_MAX
    446 #define UINT16_MAX             (65535U)
    447 #undef  UINT32_MAX
    448 #define UINT32_MAX             (4294967295U)
    449 #undef  YY_USE_CONST
    450 #define YY_USE_CONST
    451 #undef  YY_USE_CONST
    452 #define YY_USE_CONST
    453 #undef  yyconst
    454 #define yyconst const
    455 #undef  yyconst
    456 #define yyconst
    457 #undef  YY_NULL
    458 #define YY_NULL 0
    459 #undef  BEGIN
    460 #define BEGIN (yy_start) = 1 + 2 *
    461 #undef  YY_START
    462 #define YY_START (((yy_start) - 1) / 2)
    463 #undef  YYSTATE
    464 #define YYSTATE YY_START
    465 #undef  YY_NEW_FILE
    466 #define YY_NEW_FILE yyrestart(yyin  )
    467 #undef  YY_END_OF_BUFFER_CHAR
    468 #define YY_END_OF_BUFFER_CHAR 0
    469 #undef  YY_BUF_SIZE
    470 #define YY_BUF_SIZE 16384
    471 #undef  YY_TYPEDEF_YY_BUFFER_STATE
    472 #define YY_TYPEDEF_YY_BUFFER_STATE
    473 #undef  EOB_ACT_CONTINUE_SCAN
    474 #define EOB_ACT_CONTINUE_SCAN 0
    475 #undef  EOB_ACT_END_OF_FILE
    476 #define EOB_ACT_END_OF_FILE 1
    477 #undef  EOB_ACT_LAST_MATCH
    478 #define EOB_ACT_LAST_MATCH 2
    479 #undef  YY_TYPEDEF_YY_SIZE_T
    480 #define YY_TYPEDEF_YY_SIZE_T
    481 #undef  YY_STRUCT_YY_BUFFER_STATE
    482 #define YY_STRUCT_YY_BUFFER_STATE
    483 #undef  YY_BUFFER_NEW
    484 #define YY_BUFFER_NEW 0
    485 #undef  YY_BUFFER_NORMAL
    486 #define YY_BUFFER_NORMAL 1
    487 #undef  YY_BUFFER_EOF_PENDING
    488 #define YY_BUFFER_EOF_PENDING 2
    489 #undef  YY_CURRENT_BUFFER
    490 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
    491 #undef  YY_CURRENT_BUFFER_LVALUE
    492 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
    493 #undef  YY_FLUSH_BUFFER
    494 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
    495 #undef  yy_new_buffer
    496 #define yy_new_buffer yy_create_buffer
    497 #undef  YY_SKIP_YYWRAP
    498 #define YY_SKIP_YYWRAP
    499 #undef  yytext_ptr
    500 #define yytext_ptr yytext
    501 #undef  YY_DO_BEFORE_ACTION
    502 #define YY_DO_BEFORE_ACTION \
    503 #undef  YY_NUM_RULES
    504 #define YY_NUM_RULES 29
    505 #undef  YY_END_OF_BUFFER
    506 #define YY_END_OF_BUFFER 30
    507 #undef  REJECT
    508 #define REJECT reject_used_but_not_detected
    509 #undef  YY_MORE_ADJ
    510 #define YY_MORE_ADJ 0
    511 #undef  YY_RESTORE_YY_MORE_OFFSET
    512 #define YY_RESTORE_YY_MORE_OFFSET
    513 #undef  YY_NO_UNPUT
    514 #define YY_NO_UNPUT
    515 #undef  INITIAL
    516 #define INITIAL 0
    517 #undef  YY_EXTRA_TYPE
    518 #define YY_EXTRA_TYPE void *
    519 #undef  YY_READ_BUF_SIZE
    520 #define YY_READ_BUF_SIZE 8192
    521 #undef  ECHO
    522 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
    523 #undef  YY_START_STACK_INCR
    524 #define YY_START_STACK_INCR 25
    525 #undef  YY_DECL_IS_OURS
    526 #define YY_DECL_IS_OURS 1
    527 #undef  YY_DECL
    528 #define YY_DECL int yylex (void)
    529 #undef  YY_USER_ACTION
    530 #define YY_USER_ACTION
    531 #undef  YY_BREAK
    532 #define YY_BREAK break;
    533 #undef  YY_RULE_SETUP
    534 #define YY_RULE_SETUP \
    535 #undef  YY_EXIT_FAILURE
    536 #define YY_EXIT_FAILURE 2
    537 #undef  YYTABLES_NAME
    538 #define YYTABLES_NAME "yytables"
    539 #undef  MAXPWD
    540 #define MAXPWD 256
    541 #undef  signal
    542 #define signal bsd_signal
    543 #undef  ALL
    544 #define ALL (E_OPEN|E_CREAT|E_EXEC)
    545 #undef  EV_EXIT
    546 #define EV_EXIT 01		/* exit after evaluating tree */
    547 #undef  EV_TESTED
    548 #define EV_TESTED 02		/* exit status is checked; ignore -e flag */
    549 #undef  EV_BACKCMD
    550 #define EV_BACKCMD 04		/* command executing within back quotes */
    551 #undef  CMDTABLESIZE
    552 #define CMDTABLESIZE 31		/* should be prime */
    553 #undef  ARB
    554 #define ARB 1			/* actual size determined at run time */
    555 #undef  NEWARGS
    556 #define NEWARGS 5
    557 #undef  EOF_NLEFT
    558 #define EOF_NLEFT -99		/* value of parsenleft when EOF pushed back */
    559 #undef  _PATH_DEVNULL
    560 #define _PATH_DEVNULL "/dev/null"
    561 #undef  PROFILE
    562 #define PROFILE 0
    563 #undef  SIGSSIZE
    564 #define SIGSSIZE (sizeof(sigs)/sizeof(sigs[0]))
    565 #undef  MINSIZE
    566 #define MINSIZE 504		/* minimum size of a block */
    567 #undef  DEFINE_OPTIONS
    568 #define DEFINE_OPTIONS
    569 #undef  EOFMARKLEN
    570 #define EOFMARKLEN 79
    571 #undef  OPENBRACE
    572 #define OPENBRACE '{'
    573 #undef  CLOSEBRACE
    574 #define CLOSEBRACE '}'
    575 #undef  EMPTY
    576 #define EMPTY -2		/* marks an unused slot in redirtab */
    577 #undef  signal
    578 #define signal bsd_signal
    579 #undef  sys_signame
    580 #define sys_signame sys_siglist
    581 #undef  S_DFL
    582 #define S_DFL 1			/* default signal handling (SIG_DFL) */
    583 #undef  S_CATCH
    584 #define S_CATCH 2		/* signal is caught */
    585 #undef  S_IGN
    586 #define S_IGN 3			/* signal is ignored (SIG_IGN) */
    587 #undef  S_HARD_IGN
    588 #define S_HARD_IGN 4		/* signal is ignored permenantly */
    589 #undef  S_RESET
    590 #define S_RESET 5		/* temporary - to reset a hard ignored sig */
    591 #undef  OUTBUFSIZ
    592 #define OUTBUFSIZ BUFSIZ
    593 #undef  BLOCK_OUT
    594 #define BLOCK_OUT -2		/* output to a fixed block of memory */
    595 #undef  MEM_OUT
    596 #define MEM_OUT -3		/* output to dynamically allocated memory */
    597 #undef  OUTPUT_ERR
    598 #define OUTPUT_ERR 01		/* error occurred on output */
    599 #undef  TEMPSIZE
    600 #define TEMPSIZE 24
    601 #undef  HAVE_VASPRINTF
    602 #define HAVE_VASPRINTF 1
    603 #undef  VTABSIZE
    604 #define VTABSIZE 39
    605 #undef  VTABSIZE
    606 #define VTABSIZE 517
    607 #undef  main
    608 #define main echocmd
    609 #undef  YYBISON
    610 #define YYBISON 1
    611 #undef  YYSKELETON_NAME
    612 #define YYSKELETON_NAME "yacc.c"
    613 #undef  YYPURE
    614 #define YYPURE 0
    615 #undef  YYLSP_NEEDED
    616 #define YYLSP_NEEDED 0
    617 #undef  ARITH_NUM
    618 #define ARITH_NUM 258
    619 #undef  ARITH_LPAREN
    620 #define ARITH_LPAREN 259
    621 #undef  ARITH_RPAREN
    622 #define ARITH_RPAREN 260
    623 #undef  ARITH_OR
    624 #define ARITH_OR 261
    625 #undef  ARITH_AND
    626 #define ARITH_AND 262
    627 #undef  ARITH_BOR
    628 #define ARITH_BOR 263
    629 #undef  ARITH_BXOR
    630 #define ARITH_BXOR 264
    631 #undef  ARITH_BAND
    632 #define ARITH_BAND 265
    633 #undef  ARITH_NE
    634 #define ARITH_NE 266
    635 #undef  ARITH_EQ
    636 #define ARITH_EQ 267
    637 #undef  ARITH_LE
    638 #define ARITH_LE 268
    639 #undef  ARITH_GE
    640 #define ARITH_GE 269
    641 #undef  ARITH_GT
    642 #define ARITH_GT 270
    643 #undef  ARITH_LT
    644 #define ARITH_LT 271
    645 #undef  ARITH_RSHIFT
    646 #define ARITH_RSHIFT 272
    647 #undef  ARITH_LSHIFT
    648 #define ARITH_LSHIFT 273
    649 #undef  ARITH_SUB
    650 #define ARITH_SUB 274
    651 #undef  ARITH_ADD
    652 #define ARITH_ADD 275
    653 #undef  ARITH_REM
    654 #define ARITH_REM 276
    655 #undef  ARITH_DIV
    656 #define ARITH_DIV 277
    657 #undef  ARITH_MUL
    658 #define ARITH_MUL 278
    659 #undef  ARITH_BNOT
    660 #define ARITH_BNOT 279
    661 #undef  ARITH_NOT
    662 #define ARITH_NOT 280
    663 #undef  ARITH_UNARYPLUS
    664 #define ARITH_UNARYPLUS 281
    665 #undef  ARITH_UNARYMINUS
    666 #define ARITH_UNARYMINUS 282
    667 #undef  YYFINAL
    668 #define YYFINAL  14
    669 #undef  YYLAST
    670 #define YYLAST   170
    671 #undef  YYNTOKENS
    672 #define YYNTOKENS  28
    673 #undef  YYNNTS
    674 #define YYNNTS  3
    675 #undef  YYNRULES
    676 #define YYNRULES  26
    677 #undef  YYNSTATES
    678 #define YYNSTATES  52
    679 #undef  YYUNDEFTOK
    680 #define YYUNDEFTOK  2
    681 #undef  YYMAXUTOK
    682 #define YYMAXUTOK   282
    683 #undef  YYPACT_NINF
    684 #define YYPACT_NINF -13
    685 #undef  YYTABLE_NINF
    686 #define YYTABLE_NINF -1
    687 #undef  yyerrok
    688 #define yyerrok		(yyerrstatus = 0)
    689 #undef  yyclearin
    690 #define yyclearin	(yychar = YYEMPTY)
    691 #undef  YYEMPTY
    692 #define YYEMPTY		(-2)
    693 #undef  YYEOF
    694 #define YYEOF		0
    695 #undef  YYACCEPT
    696 #define YYACCEPT	goto yyacceptlab
    697 #undef  YYABORT
    698 #define YYABORT		goto yyabortlab
    699 #undef  YYERROR
    700 #define YYERROR		goto yyerrorlab
    701 #undef  YYFAIL
    702 #define YYFAIL		goto yyerrlab
    703 #undef  YYTERROR
    704 #define YYTERROR	1
    705 #undef  YYERRCODE
    706 #define YYERRCODE	256
    707 #undef  YYPOPSTACK
    708 #define YYPOPSTACK   (yyvsp--, yyssp--)
    709 #undef  YY_INT_ALIGNED
    710 #define  YY_INT_ALIGNED short int
    711 #undef  FLEX_SCANNER
    712 #define FLEX_SCANNER
    713 #undef  YY_FLEX_MAJOR_VERSION
    714 #define YY_FLEX_MAJOR_VERSION 2
    715 #undef  YY_FLEX_MINOR_VERSION
    716 #define YY_FLEX_MINOR_VERSION 5
    717 #undef  YY_FLEX_SUBMINOR_VERSION
    718 #define YY_FLEX_SUBMINOR_VERSION 31
    719 #undef  FLEX_BETA
    720 #define FLEX_BETA
    721 #undef  FLEXINT_H
    722 #define FLEXINT_H
    723 #undef  INT8_MIN
    724 #define INT8_MIN               (-128)
    725 #undef  INT16_MIN
    726 #define INT16_MIN              (-32767-1)
    727 #undef  INT32_MIN
    728 #define INT32_MIN              (-2147483647-1)
    729 #undef  INT8_MAX
    730 #define INT8_MAX               (127)
    731 #undef  INT16_MAX
    732 #define INT16_MAX              (32767)
    733 #undef  INT32_MAX
    734 #define INT32_MAX              (2147483647)
    735 #undef  UINT8_MAX
    736 #define UINT8_MAX              (255U)
    737 #undef  UINT16_MAX
    738 #define UINT16_MAX             (65535U)
    739 #undef  UINT32_MAX
    740 #define UINT32_MAX             (4294967295U)
    741 #undef  YY_USE_CONST
    742 #define YY_USE_CONST
    743 #undef  YY_USE_CONST
    744 #define YY_USE_CONST
    745 #undef  yyconst
    746 #define yyconst const
    747 #undef  yyconst
    748 #define yyconst
    749 #undef  YY_NULL
    750 #define YY_NULL 0
    751 #undef  BEGIN
    752 #define BEGIN (yy_start) = 1 + 2 *
    753 #undef  YY_START
    754 #define YY_START (((yy_start) - 1) / 2)
    755 #undef  YYSTATE
    756 #define YYSTATE YY_START
    757 #undef  YY_NEW_FILE
    758 #define YY_NEW_FILE yyrestart(yyin  )
    759 #undef  YY_END_OF_BUFFER_CHAR
    760 #define YY_END_OF_BUFFER_CHAR 0
    761 #undef  YY_BUF_SIZE
    762 #define YY_BUF_SIZE 16384
    763 #undef  YY_TYPEDEF_YY_BUFFER_STATE
    764 #define YY_TYPEDEF_YY_BUFFER_STATE
    765 #undef  EOB_ACT_CONTINUE_SCAN
    766 #define EOB_ACT_CONTINUE_SCAN 0
    767 #undef  EOB_ACT_END_OF_FILE
    768 #define EOB_ACT_END_OF_FILE 1
    769 #undef  EOB_ACT_LAST_MATCH
    770 #define EOB_ACT_LAST_MATCH 2
    771 #undef  YY_TYPEDEF_YY_SIZE_T
    772 #define YY_TYPEDEF_YY_SIZE_T
    773 #undef  YY_STRUCT_YY_BUFFER_STATE
    774 #define YY_STRUCT_YY_BUFFER_STATE
    775 #undef  YY_BUFFER_NEW
    776 #define YY_BUFFER_NEW 0
    777 #undef  YY_BUFFER_NORMAL
    778 #define YY_BUFFER_NORMAL 1
    779 #undef  YY_BUFFER_EOF_PENDING
    780 #define YY_BUFFER_EOF_PENDING 2
    781 #undef  YY_CURRENT_BUFFER
    782 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
    783 #undef  YY_CURRENT_BUFFER_LVALUE
    784 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
    785 #undef  YY_FLUSH_BUFFER
    786 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
    787 #undef  yy_new_buffer
    788 #define yy_new_buffer yy_create_buffer
    789 #undef  yytext_ptr
    790 #define yytext_ptr yytext
    791 #undef  YY_DO_BEFORE_ACTION
    792 #define YY_DO_BEFORE_ACTION \
    793 #undef  YY_NUM_RULES
    794 #define YY_NUM_RULES 29
    795 #undef  YY_END_OF_BUFFER
    796 #define YY_END_OF_BUFFER 30
    797 #undef  REJECT
    798 #define REJECT reject_used_but_not_detected
    799 #undef  YY_MORE_ADJ
    800 #define YY_MORE_ADJ 0
    801 #undef  YY_RESTORE_YY_MORE_OFFSET
    802 #define YY_RESTORE_YY_MORE_OFFSET
    803 #undef  YY_NO_UNPUT
    804 #define YY_NO_UNPUT
    805 #undef  INITIAL
    806 #define INITIAL 0
    807 #undef  YY_EXTRA_TYPE
    808 #define YY_EXTRA_TYPE void *
    809 #undef  YY_READ_BUF_SIZE
    810 #define YY_READ_BUF_SIZE 8192
    811 #undef  ECHO
    812 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
    813 #undef  YY_START_STACK_INCR
    814 #define YY_START_STACK_INCR 25
    815 #undef  YY_DECL_IS_OURS
    816 #define YY_DECL_IS_OURS 1
    817 #undef  YY_DECL
    818 #define YY_DECL int yylex (void)
    819 #undef  YY_USER_ACTION
    820 #define YY_USER_ACTION
    821 #undef  YY_BREAK
    822 #define YY_BREAK break;
    823 #undef  YY_RULE_SETUP
    824 #define YY_RULE_SETUP \
    825 #undef  YY_EXIT_FAILURE
    826 #define YY_EXIT_FAILURE 2
    827 #undef  YYTABLES_NAME
    828 #define YYTABLES_NAME "yytables"
    829 #undef  MAXPWD
    830 #define MAXPWD 256
    831 #undef  ALL
    832 #define ALL (E_OPEN|E_CREAT|E_EXEC)
    833 #undef  EV_EXIT
    834 #define EV_EXIT 01		/* exit after evaluating tree */
    835 #undef  EV_TESTED
    836 #define EV_TESTED 02		/* exit status is checked; ignore -e flag */
    837 #undef  EV_BACKCMD
    838 #define EV_BACKCMD 04		/* command executing within back quotes */
    839 #undef  CMDTABLESIZE
    840 #define CMDTABLESIZE 31		/* should be prime */
    841 #undef  ARB
    842 #define ARB 1			/* actual size determined at run time */
    843 #undef  NEWARGS
    844 #define NEWARGS 5
    845 #undef  EOF_NLEFT
    846 #define EOF_NLEFT -99		/* value of parsenleft when EOF pushed back */
    847 #undef  _PATH_DEVNULL
    848 #define _PATH_DEVNULL "/dev/null"
    849 #undef  PROFILE
    850 #define PROFILE 0
    851 #undef  SIGSSIZE
    852 #define SIGSSIZE (sizeof(sigs)/sizeof(sigs[0]))
    853 #undef  MINSIZE
    854 #define MINSIZE 504		/* minimum size of a block */
    855 #undef  DEFINE_OPTIONS
    856 #define DEFINE_OPTIONS
    857 #undef  EOFMARKLEN
    858 #define EOFMARKLEN 79
    859 #undef  OPENBRACE
    860 #define OPENBRACE '{'
    861 #undef  CLOSEBRACE
    862 #define CLOSEBRACE '}'
    863 #undef  EMPTY
    864 #define EMPTY -2		/* marks an unused slot in redirtab */
    865 #undef  S_DFL
    866 #define S_DFL 1			/* default signal handling (SIG_DFL) */
    867 #undef  S_CATCH
    868 #define S_CATCH 2		/* signal is caught */
    869 #undef  S_IGN
    870 #define S_IGN 3			/* signal is ignored (SIG_IGN) */
    871 #undef  S_HARD_IGN
    872 #define S_HARD_IGN 4		/* signal is ignored permenantly */
    873 #undef  S_RESET
    874 #define S_RESET 5		/* temporary - to reset a hard ignored sig */
    875 #undef  OUTBUFSIZ
    876 #define OUTBUFSIZ BUFSIZ
    877 #undef  BLOCK_OUT
    878 #define BLOCK_OUT -2		/* output to a fixed block of memory */
    879 #undef  MEM_OUT
    880 #define MEM_OUT -3		/* output to dynamically allocated memory */
    881 #undef  OUTPUT_ERR
    882 #define OUTPUT_ERR 01		/* error occurred on output */
    883 #undef  TEMPSIZE
    884 #define TEMPSIZE 24
    885 #undef  HAVE_VASPRINTF
    886 #define HAVE_VASPRINTF 1
    887 #undef  VTABSIZE
    888 #define VTABSIZE 39
    889 #undef  VTABSIZE
    890 #define VTABSIZE 517
    891 #undef  main
    892 #define main echocmd
    893 
    894 
    895 
    896 extern void rmaliases(void);
    897 
    898 extern int loopnest;		/* current loop nesting level */
    899 
    900 extern void deletefuncs(void);
    901 extern void hash_special_builtins(void);
    902 
    903 struct strpush {
    904 	struct strpush *prev;	/* preceding string on stack */
    905 	char *prevstring;
    906 	int prevnleft;
    907 	int prevlleft;
    908 	struct alias *ap;	/* if push was associated with an alias */
    909 };
    910 
    911 struct parsefile {
    912 	struct parsefile *prev;	/* preceding file on stack */
    913 	int linno;		/* current line */
    914 	int fd;			/* file descriptor (or -1 if string) */
    915 	int nleft;		/* number of chars left in this line */
    916 	int lleft;		/* number of chars left in this buffer */
    917 	char *nextc;		/* next char in buffer */
    918 	char *buf;		/* input buffer */
    919 	struct strpush *strpush; /* for pushing strings at this level */
    920 	struct strpush basestrpush; /* so pushing one is fast */
    921 };
    922 
    923 extern int parselleft;		/* copy of parsefile->lleft */
    924 extern struct parsefile basepf;	/* top level input file */
    925 extern char basebuf[BUFSIZ];	/* buffer for top level input file */
    926 
    927 extern pid_t backgndpid;	/* pid of last background process */
    928 extern int jobctl;
    929 
    930 extern int tokpushback;		/* last token pushed back */
    931 extern int checkkwd;            /* 1 == check for kwds, 2 == also eat newlines */
    932 
    933 struct redirtab {
    934 	struct redirtab *next;
    935 	short renamed[10];
    936 };
    937 
    938 extern struct redirtab *redirlist;
    939 
    940 extern char sigmode[NSIG];	/* current value of signal */
    941 
    942 extern char **environ;
    943 
    944 
    945 
    946 /*
    947  * Initialization code.
    948  */
    949 
    950 void
    951 init() {
    952 
    953       /* from exec.c: */
    954       {
    955 	      hash_special_builtins();
    956       }
    957 
    958       /* from input.c: */
    959       {
    960 	      basepf.nextc = basepf.buf = basebuf;
    961       }
    962 
    963       /* from var.c: */
    964       {
    965 	      char **envp;
    966 
    967 	      initvar();
    968 	      for (envp = environ ; *envp ; envp++) {
    969 		      if (strchr(*envp, '=')) {
    970 			      setvareq(*envp, VEXPORT|VTEXTFIXED);
    971 		      }
    972 	      }
    973       }
    974 }
    975 
    976 
    977 
    978 /*
    979  * This routine is called when an error or an interrupt occurs in an
    980  * interactive shell and control is returned to the main command loop.
    981  */
    982 
    983 void
    984 reset() {
    985 
    986       /* from eval.c: */
    987       {
    988 	      evalskip = 0;
    989 	      loopnest = 0;
    990 	      funcnest = 0;
    991       }
    992 
    993       /* from input.c: */
    994       {
    995 	      if (exception != EXSHELLPROC)
    996 		      parselleft = parsenleft = 0;	/* clear input buffer */
    997 	      popallfiles();
    998       }
    999 
   1000       /* from parser.c: */
   1001       {
   1002 	      tokpushback = 0;
   1003 	      checkkwd = 0;
   1004       }
   1005 
   1006       /* from redir.c: */
   1007       {
   1008 	      while (redirlist)
   1009 		      popredir();
   1010       }
   1011 
   1012       /* from output.c: */
   1013       {
   1014 	      out1 = &output;
   1015 	      out2 = &errout;
   1016 	      if (memout.buf != NULL) {
   1017 		      ckfree(memout.buf);
   1018 		      memout.buf = NULL;
   1019 	      }
   1020       }
   1021 }
   1022 
   1023 
   1024 
   1025 /*
   1026  * This routine is called to initialize the shell to run a shell procedure.
   1027  */
   1028 
   1029 void
   1030 initshellproc() {
   1031 
   1032       /* from alias.c: */
   1033       {
   1034 	      rmaliases();
   1035       }
   1036 
   1037       /* from eval.c: */
   1038       {
   1039 	      exitstatus = 0;
   1040       }
   1041 
   1042       /* from exec.c: */
   1043       {
   1044 	      deletefuncs();
   1045       }
   1046 
   1047       /* from input.c: */
   1048       {
   1049 	      popallfiles();
   1050       }
   1051 
   1052       /* from jobs.c: */
   1053       {
   1054 	      backgndpid = -1;
   1055 #if JOBS
   1056 	      jobctl = 0;
   1057 #endif
   1058       }
   1059 
   1060       /* from options.c: */
   1061       {
   1062 	      int i;
   1063 
   1064 	      for (i = 0; optlist[i].name; i++)
   1065 		      optlist[i].val = 0;
   1066 	      optschanged();
   1067 
   1068       }
   1069 
   1070       /* from redir.c: */
   1071       {
   1072 	      clearredir(0);
   1073       }
   1074 
   1075       /* from trap.c: */
   1076       {
   1077 	      char *sm;
   1078 
   1079 	      clear_traps(0);
   1080 	      for (sm = sigmode ; sm < sigmode + NSIG ; sm++) {
   1081 		      if (*sm == S_IGN)
   1082 			      *sm = S_HARD_IGN;
   1083 	      }
   1084       }
   1085 
   1086       /* from var.c: */
   1087       {
   1088 	      shprocvar();
   1089       }
   1090 }
   1091