summaryrefslogtreecommitdiffstats
path: root/sh/init.c
blob: 55ad17280438e1a1daddb6d943dafcc5a606b251 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
/*
 * This file was generated by the mkinit program.
 */

#include "shell.h"
#include "mystring.h"
#include "init.h"
#include "eval.h"
#include <stdio.h>
#include "input.h"
#include "error.h"
#include <stdlib.h>
#include "options.h"
#include "redir.h"
#include <signal.h>
#include "trap.h"
#include "output.h"
#include "memalloc.h"
#include "var.h"



#undef  ATABSIZE
#define ATABSIZE 39
#undef  YYBISON
#define YYBISON 1
#undef  YYSKELETON_NAME
#define YYSKELETON_NAME "yacc.c"
#undef  YYPURE
#define YYPURE 0
#undef  YYLSP_NEEDED
#define YYLSP_NEEDED 0
#undef  ARITH_NUM
#define ARITH_NUM 258
#undef  ARITH_LPAREN
#define ARITH_LPAREN 259
#undef  ARITH_RPAREN
#define ARITH_RPAREN 260
#undef  ARITH_OR
#define ARITH_OR 261
#undef  ARITH_AND
#define ARITH_AND 262
#undef  ARITH_BOR
#define ARITH_BOR 263
#undef  ARITH_BXOR
#define ARITH_BXOR 264
#undef  ARITH_BAND
#define ARITH_BAND 265
#undef  ARITH_NE
#define ARITH_NE 266
#undef  ARITH_EQ
#define ARITH_EQ 267
#undef  ARITH_LE
#define ARITH_LE 268
#undef  ARITH_GE
#define ARITH_GE 269
#undef  ARITH_GT
#define ARITH_GT 270
#undef  ARITH_LT
#define ARITH_LT 271
#undef  ARITH_RSHIFT
#define ARITH_RSHIFT 272
#undef  ARITH_LSHIFT
#define ARITH_LSHIFT 273
#undef  ARITH_SUB
#define ARITH_SUB 274
#undef  ARITH_ADD
#define ARITH_ADD 275
#undef  ARITH_REM
#define ARITH_REM 276
#undef  ARITH_DIV
#define ARITH_DIV 277
#undef  ARITH_MUL
#define ARITH_MUL 278
#undef  ARITH_BNOT
#define ARITH_BNOT 279
#undef  ARITH_NOT
#define ARITH_NOT 280
#undef  ARITH_UNARYPLUS
#define ARITH_UNARYPLUS 281
#undef  ARITH_UNARYMINUS
#define ARITH_UNARYMINUS 282
#undef  YYFINAL
#define YYFINAL  14
#undef  YYLAST
#define YYLAST   170
#undef  YYNTOKENS
#define YYNTOKENS  28
#undef  YYNNTS
#define YYNNTS  3
#undef  YYNRULES
#define YYNRULES  26
#undef  YYNSTATES
#define YYNSTATES  52
#undef  YYUNDEFTOK
#define YYUNDEFTOK  2
#undef  YYMAXUTOK
#define YYMAXUTOK   282
#undef  YYPACT_NINF
#define YYPACT_NINF -13
#undef  YYTABLE_NINF
#define YYTABLE_NINF -1
#undef  yyerrok
#define yyerrok		(yyerrstatus = 0)
#undef  yyclearin
#define yyclearin	(yychar = YYEMPTY)
#undef  YYEMPTY
#define YYEMPTY		(-2)
#undef  YYEOF
#define YYEOF		0
#undef  YYACCEPT
#define YYACCEPT	goto yyacceptlab
#undef  YYABORT
#define YYABORT		goto yyabortlab
#undef  YYERROR
#define YYERROR		goto yyerrorlab
#undef  YYFAIL
#define YYFAIL		goto yyerrlab
#undef  YYTERROR
#define YYTERROR	1
#undef  YYERRCODE
#define YYERRCODE	256
#undef  YYPOPSTACK
#define YYPOPSTACK   (yyvsp--, yyssp--)
#undef  YY_INT_ALIGNED
#define  YY_INT_ALIGNED short int
#undef  FLEX_SCANNER
#define FLEX_SCANNER
#undef  YY_FLEX_MAJOR_VERSION
#define YY_FLEX_MAJOR_VERSION 2
#undef  YY_FLEX_MINOR_VERSION
#define YY_FLEX_MINOR_VERSION 5
#undef  YY_FLEX_SUBMINOR_VERSION
#define YY_FLEX_SUBMINOR_VERSION 31
#undef  FLEX_BETA
#define FLEX_BETA
#undef  FLEXINT_H
#define FLEXINT_H
#undef  INT8_MIN
#define INT8_MIN               (-128)
#undef  INT16_MIN
#define INT16_MIN              (-32767-1)
#undef  INT32_MIN
#define INT32_MIN              (-2147483647-1)
#undef  INT8_MAX
#define INT8_MAX               (127)
#undef  INT16_MAX
#define INT16_MAX              (32767)
#undef  INT32_MAX
#define INT32_MAX              (2147483647)
#undef  UINT8_MAX
#define UINT8_MAX              (255U)
#undef  UINT16_MAX
#define UINT16_MAX             (65535U)
#undef  UINT32_MAX
#define UINT32_MAX             (4294967295U)
#undef  YY_USE_CONST
#define YY_USE_CONST
#undef  YY_USE_CONST
#define YY_USE_CONST
#undef  yyconst
#define yyconst const
#undef  yyconst
#define yyconst
#undef  YY_NULL
#define YY_NULL 0
#undef  BEGIN
#define BEGIN (yy_start) = 1 + 2 *
#undef  YY_START
#define YY_START (((yy_start) - 1) / 2)
#undef  YYSTATE
#define YYSTATE YY_START
#undef  YY_NEW_FILE
#define YY_NEW_FILE yyrestart(yyin  )
#undef  YY_END_OF_BUFFER_CHAR
#define YY_END_OF_BUFFER_CHAR 0
#undef  YY_BUF_SIZE
#define YY_BUF_SIZE 16384
#undef  YY_TYPEDEF_YY_BUFFER_STATE
#define YY_TYPEDEF_YY_BUFFER_STATE
#undef  EOB_ACT_CONTINUE_SCAN
#define EOB_ACT_CONTINUE_SCAN 0
#undef  EOB_ACT_END_OF_FILE
#define EOB_ACT_END_OF_FILE 1
#undef  EOB_ACT_LAST_MATCH
#define EOB_ACT_LAST_MATCH 2
#undef  YY_TYPEDEF_YY_SIZE_T
#define YY_TYPEDEF_YY_SIZE_T
#undef  YY_STRUCT_YY_BUFFER_STATE
#define YY_STRUCT_YY_BUFFER_STATE
#undef  YY_BUFFER_NEW
#define YY_BUFFER_NEW 0
#undef  YY_BUFFER_NORMAL
#define YY_BUFFER_NORMAL 1
#undef  YY_BUFFER_EOF_PENDING
#define YY_BUFFER_EOF_PENDING 2
#undef  YY_CURRENT_BUFFER
#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
#undef  YY_CURRENT_BUFFER_LVALUE
#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
#undef  YY_FLUSH_BUFFER
#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
#undef  yy_new_buffer
#define yy_new_buffer yy_create_buffer
#undef  YY_SKIP_YYWRAP
#define YY_SKIP_YYWRAP
#undef  yytext_ptr
#define yytext_ptr yytext
#undef  YY_DO_BEFORE_ACTION
#define YY_DO_BEFORE_ACTION \
#undef  YY_NUM_RULES
#define YY_NUM_RULES 29
#undef  YY_END_OF_BUFFER
#define YY_END_OF_BUFFER 30
#undef  REJECT
#define REJECT reject_used_but_not_detected
#undef  YY_MORE_ADJ
#define YY_MORE_ADJ 0
#undef  YY_RESTORE_YY_MORE_OFFSET
#define YY_RESTORE_YY_MORE_OFFSET
#undef  YY_NO_UNPUT
#define YY_NO_UNPUT
#undef  INITIAL
#define INITIAL 0
#undef  YY_EXTRA_TYPE
#define YY_EXTRA_TYPE void *
#undef  YY_READ_BUF_SIZE
#define YY_READ_BUF_SIZE 8192
#undef  ECHO
#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
#undef  YY_START_STACK_INCR
#define YY_START_STACK_INCR 25
#undef  YY_DECL_IS_OURS
#define YY_DECL_IS_OURS 1
#undef  YY_DECL
#define YY_DECL int yylex (void)
#undef  YY_USER_ACTION
#define YY_USER_ACTION
#undef  YY_BREAK
#define YY_BREAK break;
#undef  YY_RULE_SETUP
#define YY_RULE_SETUP \
#undef  YY_EXIT_FAILURE
#define YY_EXIT_FAILURE 2
#undef  YYTABLES_NAME
#define YYTABLES_NAME "yytables"
#undef  MAXPWD
#define MAXPWD 256
#undef  signal
#define signal bsd_signal
#undef  ALL
#define ALL (E_OPEN|E_CREAT|E_EXEC)
#undef  EV_EXIT
#define EV_EXIT 01		/* exit after evaluating tree */
#undef  EV_TESTED
#define EV_TESTED 02		/* exit status is checked; ignore -e flag */
#undef  EV_BACKCMD
#define EV_BACKCMD 04		/* command executing within back quotes */
#undef  CMDTABLESIZE
#define CMDTABLESIZE 31		/* should be prime */
#undef  ARB
#define ARB 1			/* actual size determined at run time */
#undef  NEWARGS
#define NEWARGS 5
#undef  EOF_NLEFT
#define EOF_NLEFT -99		/* value of parsenleft when EOF pushed back */
#undef  _PATH_DEVNULL
#define _PATH_DEVNULL "/dev/null"
#undef  PROFILE
#define PROFILE 0
#undef  SIGSSIZE
#define SIGSSIZE (sizeof(sigs)/sizeof(sigs[0]))
#undef  MINSIZE
#define MINSIZE 504		/* minimum size of a block */
#undef  DEFINE_OPTIONS
#define DEFINE_OPTIONS
#undef  EOFMARKLEN
#define EOFMARKLEN 79
#undef  OPENBRACE
#define OPENBRACE '{'
#undef  CLOSEBRACE
#define CLOSEBRACE '}'
#undef  EMPTY
#define EMPTY -2		/* marks an unused slot in redirtab */
#undef  signal
#define signal bsd_signal
#undef  sys_signame
#define sys_signame sys_siglist
#undef  S_DFL
#define S_DFL 1			/* default signal handling (SIG_DFL) */
#undef  S_CATCH
#define S_CATCH 2		/* signal is caught */
#undef  S_IGN
#define S_IGN 3			/* signal is ignored (SIG_IGN) */
#undef  S_HARD_IGN
#define S_HARD_IGN 4		/* signal is ignored permenantly */
#undef  S_RESET
#define S_RESET 5		/* temporary - to reset a hard ignored sig */
#undef  OUTBUFSIZ
#define OUTBUFSIZ BUFSIZ
#undef  BLOCK_OUT
#define BLOCK_OUT -2		/* output to a fixed block of memory */
#undef  MEM_OUT
#define MEM_OUT -3		/* output to dynamically allocated memory */
#undef  OUTPUT_ERR
#define OUTPUT_ERR 01		/* error occurred on output */
#undef  TEMPSIZE
#define TEMPSIZE 24
#undef  HAVE_VASPRINTF
#define HAVE_VASPRINTF 1
#undef  VTABSIZE
#define VTABSIZE 39
#undef  VTABSIZE
#define VTABSIZE 517
#undef  ATABSIZE
#define ATABSIZE 39
#undef  YYBISON
#define YYBISON 1
#undef  YYSKELETON_NAME
#define YYSKELETON_NAME "yacc.c"
#undef  YYPURE
#define YYPURE 0
#undef  YYLSP_NEEDED
#define YYLSP_NEEDED 0
#undef  ARITH_NUM
#define ARITH_NUM 258
#undef  ARITH_LPAREN
#define ARITH_LPAREN 259
#undef  ARITH_RPAREN
#define ARITH_RPAREN 260
#undef  ARITH_OR
#define ARITH_OR 261
#undef  ARITH_AND
#define ARITH_AND 262
#undef  ARITH_BOR
#define ARITH_BOR 263
#undef  ARITH_BXOR
#define ARITH_BXOR 264
#undef  ARITH_BAND
#define ARITH_BAND 265
#undef  ARITH_NE
#define ARITH_NE 266
#undef  ARITH_EQ
#define ARITH_EQ 267
#undef  ARITH_LE
#define ARITH_LE 268
#undef  ARITH_GE
#define ARITH_GE 269
#undef  ARITH_GT
#define ARITH_GT 270
#undef  ARITH_LT
#define ARITH_LT 271
#undef  ARITH_RSHIFT
#define ARITH_RSHIFT 272
#undef  ARITH_LSHIFT
#define ARITH_LSHIFT 273
#undef  ARITH_SUB
#define ARITH_SUB 274
#undef  ARITH_ADD
#define ARITH_ADD 275
#undef  ARITH_REM
#define ARITH_REM 276
#undef  ARITH_DIV
#define ARITH_DIV 277
#undef  ARITH_MUL
#define ARITH_MUL 278
#undef  ARITH_BNOT
#define ARITH_BNOT 279
#undef  ARITH_NOT
#define ARITH_NOT 280
#undef  ARITH_UNARYPLUS
#define ARITH_UNARYPLUS 281
#undef  ARITH_UNARYMINUS
#define ARITH_UNARYMINUS 282
#undef  YYFINAL
#define YYFINAL  14
#undef  YYLAST
#define YYLAST   170
#undef  YYNTOKENS
#define YYNTOKENS  28
#undef  YYNNTS
#define YYNNTS  3
#undef  YYNRULES
#define YYNRULES  26
#undef  YYNSTATES
#define YYNSTATES  52
#undef  YYUNDEFTOK
#define YYUNDEFTOK  2
#undef  YYMAXUTOK
#define YYMAXUTOK   282
#undef  YYPACT_NINF
#define YYPACT_NINF -13
#undef  YYTABLE_NINF
#define YYTABLE_NINF -1
#undef  yyerrok
#define yyerrok		(yyerrstatus = 0)
#undef  yyclearin
#define yyclearin	(yychar = YYEMPTY)
#undef  YYEMPTY
#define YYEMPTY		(-2)
#undef  YYEOF
#define YYEOF		0
#undef  YYACCEPT
#define YYACCEPT	goto yyacceptlab
#undef  YYABORT
#define YYABORT		goto yyabortlab
#undef  YYERROR
#define YYERROR		goto yyerrorlab
#undef  YYFAIL
#define YYFAIL		goto yyerrlab
#undef  YYTERROR
#define YYTERROR	1
#undef  YYERRCODE
#define YYERRCODE	256
#undef  YYPOPSTACK
#define YYPOPSTACK   (yyvsp--, yyssp--)
#undef  YY_INT_ALIGNED
#define  YY_INT_ALIGNED short int
#undef  FLEX_SCANNER
#define FLEX_SCANNER
#undef  YY_FLEX_MAJOR_VERSION
#define YY_FLEX_MAJOR_VERSION 2
#undef  YY_FLEX_MINOR_VERSION
#define YY_FLEX_MINOR_VERSION 5
#undef  YY_FLEX_SUBMINOR_VERSION
#define YY_FLEX_SUBMINOR_VERSION 31
#undef  FLEX_BETA
#define FLEX_BETA
#undef  FLEXINT_H
#define FLEXINT_H
#undef  INT8_MIN
#define INT8_MIN               (-128)
#undef  INT16_MIN
#define INT16_MIN              (-32767-1)
#undef  INT32_MIN
#define INT32_MIN              (-2147483647-1)
#undef  INT8_MAX
#define INT8_MAX               (127)
#undef  INT16_MAX
#define INT16_MAX              (32767)
#undef  INT32_MAX
#define INT32_MAX              (2147483647)
#undef  UINT8_MAX
#define UINT8_MAX              (255U)
#undef  UINT16_MAX
#define UINT16_MAX             (65535U)
#undef  UINT32_MAX
#define UINT32_MAX             (4294967295U)
#undef  YY_USE_CONST
#define YY_USE_CONST
#undef  YY_USE_CONST
#define YY_USE_CONST
#undef  yyconst
#define yyconst const
#undef  yyconst
#define yyconst
#undef  YY_NULL
#define YY_NULL 0
#undef  BEGIN
#define BEGIN (yy_start) = 1 + 2 *
#undef  YY_START
#define YY_START (((yy_start) - 1) / 2)
#undef  YYSTATE
#define YYSTATE YY_START
#undef  YY_NEW_FILE
#define YY_NEW_FILE yyrestart(yyin  )
#undef  YY_END_OF_BUFFER_CHAR
#define YY_END_OF_BUFFER_CHAR 0
#undef  YY_BUF_SIZE
#define YY_BUF_SIZE 16384
#undef  YY_TYPEDEF_YY_BUFFER_STATE
#define YY_TYPEDEF_YY_BUFFER_STATE
#undef  EOB_ACT_CONTINUE_SCAN
#define EOB_ACT_CONTINUE_SCAN 0
#undef  EOB_ACT_END_OF_FILE
#define EOB_ACT_END_OF_FILE 1
#undef  EOB_ACT_LAST_MATCH
#define EOB_ACT_LAST_MATCH 2
#undef  YY_TYPEDEF_YY_SIZE_T
#define YY_TYPEDEF_YY_SIZE_T
#undef  YY_STRUCT_YY_BUFFER_STATE
#define YY_STRUCT_YY_BUFFER_STATE
#undef  YY_BUFFER_NEW
#define YY_BUFFER_NEW 0
#undef  YY_BUFFER_NORMAL
#define YY_BUFFER_NORMAL 1
#undef  YY_BUFFER_EOF_PENDING
#define YY_BUFFER_EOF_PENDING 2
#undef  YY_CURRENT_BUFFER
#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
#undef  YY_CURRENT_BUFFER_LVALUE
#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
#undef  YY_FLUSH_BUFFER
#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
#undef  yy_new_buffer
#define yy_new_buffer yy_create_buffer
#undef  YY_SKIP_YYWRAP
#define YY_SKIP_YYWRAP
#undef  yytext_ptr
#define yytext_ptr yytext
#undef  YY_DO_BEFORE_ACTION
#define YY_DO_BEFORE_ACTION \
#undef  YY_NUM_RULES
#define YY_NUM_RULES 29
#undef  YY_END_OF_BUFFER
#define YY_END_OF_BUFFER 30
#undef  REJECT
#define REJECT reject_used_but_not_detected
#undef  YY_MORE_ADJ
#define YY_MORE_ADJ 0
#undef  YY_RESTORE_YY_MORE_OFFSET
#define YY_RESTORE_YY_MORE_OFFSET
#undef  YY_NO_UNPUT
#define YY_NO_UNPUT
#undef  INITIAL
#define INITIAL 0
#undef  YY_EXTRA_TYPE
#define YY_EXTRA_TYPE void *
#undef  YY_READ_BUF_SIZE
#define YY_READ_BUF_SIZE 8192
#undef  ECHO
#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
#undef  YY_START_STACK_INCR
#define YY_START_STACK_INCR 25
#undef  YY_DECL_IS_OURS
#define YY_DECL_IS_OURS 1
#undef  YY_DECL
#define YY_DECL int yylex (void)
#undef  YY_USER_ACTION
#define YY_USER_ACTION
#undef  YY_BREAK
#define YY_BREAK break;
#undef  YY_RULE_SETUP
#define YY_RULE_SETUP \
#undef  YY_EXIT_FAILURE
#define YY_EXIT_FAILURE 2
#undef  YYTABLES_NAME
#define YYTABLES_NAME "yytables"
#undef  MAXPWD
#define MAXPWD 256
#undef  signal
#define signal bsd_signal
#undef  ALL
#define ALL (E_OPEN|E_CREAT|E_EXEC)
#undef  EV_EXIT
#define EV_EXIT 01		/* exit after evaluating tree */
#undef  EV_TESTED
#define EV_TESTED 02		/* exit status is checked; ignore -e flag */
#undef  EV_BACKCMD
#define EV_BACKCMD 04		/* command executing within back quotes */
#undef  CMDTABLESIZE
#define CMDTABLESIZE 31		/* should be prime */
#undef  ARB
#define ARB 1			/* actual size determined at run time */
#undef  NEWARGS
#define NEWARGS 5
#undef  EOF_NLEFT
#define EOF_NLEFT -99		/* value of parsenleft when EOF pushed back */
#undef  _PATH_DEVNULL
#define _PATH_DEVNULL "/dev/null"
#undef  PROFILE
#define PROFILE 0
#undef  SIGSSIZE
#define SIGSSIZE (sizeof(sigs)/sizeof(sigs[0]))
#undef  MINSIZE
#define MINSIZE 504		/* minimum size of a block */
#undef  DEFINE_OPTIONS
#define DEFINE_OPTIONS
#undef  EOFMARKLEN
#define EOFMARKLEN 79
#undef  OPENBRACE
#define OPENBRACE '{'
#undef  CLOSEBRACE
#define CLOSEBRACE '}'
#undef  EMPTY
#define EMPTY -2		/* marks an unused slot in redirtab */
#undef  signal
#define signal bsd_signal
#undef  sys_signame
#define sys_signame sys_siglist
#undef  S_DFL
#define S_DFL 1			/* default signal handling (SIG_DFL) */
#undef  S_CATCH
#define S_CATCH 2		/* signal is caught */
#undef  S_IGN
#define S_IGN 3			/* signal is ignored (SIG_IGN) */
#undef  S_HARD_IGN
#define S_HARD_IGN 4		/* signal is ignored permenantly */
#undef  S_RESET
#define S_RESET 5		/* temporary - to reset a hard ignored sig */
#undef  OUTBUFSIZ
#define OUTBUFSIZ BUFSIZ
#undef  BLOCK_OUT
#define BLOCK_OUT -2		/* output to a fixed block of memory */
#undef  MEM_OUT
#define MEM_OUT -3		/* output to dynamically allocated memory */
#undef  OUTPUT_ERR
#define OUTPUT_ERR 01		/* error occurred on output */
#undef  TEMPSIZE
#define TEMPSIZE 24
#undef  HAVE_VASPRINTF
#define HAVE_VASPRINTF 1
#undef  VTABSIZE
#define VTABSIZE 39
#undef  VTABSIZE
#define VTABSIZE 517
#undef  main
#define main echocmd
#undef  YYBISON
#define YYBISON 1
#undef  YYSKELETON_NAME
#define YYSKELETON_NAME "yacc.c"
#undef  YYPURE
#define YYPURE 0
#undef  YYLSP_NEEDED
#define YYLSP_NEEDED 0
#undef  ARITH_NUM
#define ARITH_NUM 258
#undef  ARITH_LPAREN
#define ARITH_LPAREN 259
#undef  ARITH_RPAREN
#define ARITH_RPAREN 260
#undef  ARITH_OR
#define ARITH_OR 261
#undef  ARITH_AND
#define ARITH_AND 262
#undef  ARITH_BOR
#define ARITH_BOR 263
#undef  ARITH_BXOR
#define ARITH_BXOR 264
#undef  ARITH_BAND
#define ARITH_BAND 265
#undef  ARITH_NE
#define ARITH_NE 266
#undef  ARITH_EQ
#define ARITH_EQ 267
#undef  ARITH_LE
#define ARITH_LE 268
#undef  ARITH_GE
#define ARITH_GE 269
#undef  ARITH_GT
#define ARITH_GT 270
#undef  ARITH_LT
#define ARITH_LT 271
#undef  ARITH_RSHIFT
#define ARITH_RSHIFT 272
#undef  ARITH_LSHIFT
#define ARITH_LSHIFT 273
#undef  ARITH_SUB
#define ARITH_SUB 274
#undef  ARITH_ADD
#define ARITH_ADD 275
#undef  ARITH_REM
#define ARITH_REM 276
#undef  ARITH_DIV
#define ARITH_DIV 277
#undef  ARITH_MUL
#define ARITH_MUL 278
#undef  ARITH_BNOT
#define ARITH_BNOT 279
#undef  ARITH_NOT
#define ARITH_NOT 280
#undef  ARITH_UNARYPLUS
#define ARITH_UNARYPLUS 281
#undef  ARITH_UNARYMINUS
#define ARITH_UNARYMINUS 282
#undef  YYFINAL
#define YYFINAL  14
#undef  YYLAST
#define YYLAST   170
#undef  YYNTOKENS
#define YYNTOKENS  28
#undef  YYNNTS
#define YYNNTS  3
#undef  YYNRULES
#define YYNRULES  26
#undef  YYNSTATES
#define YYNSTATES  52
#undef  YYUNDEFTOK
#define YYUNDEFTOK  2
#undef  YYMAXUTOK
#define YYMAXUTOK   282
#undef  YYPACT_NINF
#define YYPACT_NINF -13
#undef  YYTABLE_NINF
#define YYTABLE_NINF -1
#undef  yyerrok
#define yyerrok		(yyerrstatus = 0)
#undef  yyclearin
#define yyclearin	(yychar = YYEMPTY)
#undef  YYEMPTY
#define YYEMPTY		(-2)
#undef  YYEOF
#define YYEOF		0
#undef  YYACCEPT
#define YYACCEPT	goto yyacceptlab
#undef  YYABORT
#define YYABORT		goto yyabortlab
#undef  YYERROR
#define YYERROR		goto yyerrorlab
#undef  YYFAIL
#define YYFAIL		goto yyerrlab
#undef  YYTERROR
#define YYTERROR	1
#undef  YYERRCODE
#define YYERRCODE	256
#undef  YYPOPSTACK
#define YYPOPSTACK   (yyvsp--, yyssp--)
#undef  YY_INT_ALIGNED
#define  YY_INT_ALIGNED short int
#undef  FLEX_SCANNER
#define FLEX_SCANNER
#undef  YY_FLEX_MAJOR_VERSION
#define YY_FLEX_MAJOR_VERSION 2
#undef  YY_FLEX_MINOR_VERSION
#define YY_FLEX_MINOR_VERSION 5
#undef  YY_FLEX_SUBMINOR_VERSION
#define YY_FLEX_SUBMINOR_VERSION 31
#undef  FLEX_BETA
#define FLEX_BETA
#undef  FLEXINT_H
#define FLEXINT_H
#undef  INT8_MIN
#define INT8_MIN               (-128)
#undef  INT16_MIN
#define INT16_MIN              (-32767-1)
#undef  INT32_MIN
#define INT32_MIN              (-2147483647-1)
#undef  INT8_MAX
#define INT8_MAX               (127)
#undef  INT16_MAX
#define INT16_MAX              (32767)
#undef  INT32_MAX
#define INT32_MAX              (2147483647)
#undef  UINT8_MAX
#define UINT8_MAX              (255U)
#undef  UINT16_MAX
#define UINT16_MAX             (65535U)
#undef  UINT32_MAX
#define UINT32_MAX             (4294967295U)
#undef  YY_USE_CONST
#define YY_USE_CONST
#undef  YY_USE_CONST
#define YY_USE_CONST
#undef  yyconst
#define yyconst const
#undef  yyconst
#define yyconst
#undef  YY_NULL
#define YY_NULL 0
#undef  BEGIN
#define BEGIN (yy_start) = 1 + 2 *
#undef  YY_START
#define YY_START (((yy_start) - 1) / 2)
#undef  YYSTATE
#define YYSTATE YY_START
#undef  YY_NEW_FILE
#define YY_NEW_FILE yyrestart(yyin  )
#undef  YY_END_OF_BUFFER_CHAR
#define YY_END_OF_BUFFER_CHAR 0
#undef  YY_BUF_SIZE
#define YY_BUF_SIZE 16384
#undef  YY_TYPEDEF_YY_BUFFER_STATE
#define YY_TYPEDEF_YY_BUFFER_STATE
#undef  EOB_ACT_CONTINUE_SCAN
#define EOB_ACT_CONTINUE_SCAN 0
#undef  EOB_ACT_END_OF_FILE
#define EOB_ACT_END_OF_FILE 1
#undef  EOB_ACT_LAST_MATCH
#define EOB_ACT_LAST_MATCH 2
#undef  YY_TYPEDEF_YY_SIZE_T
#define YY_TYPEDEF_YY_SIZE_T
#undef  YY_STRUCT_YY_BUFFER_STATE
#define YY_STRUCT_YY_BUFFER_STATE
#undef  YY_BUFFER_NEW
#define YY_BUFFER_NEW 0
#undef  YY_BUFFER_NORMAL
#define YY_BUFFER_NORMAL 1
#undef  YY_BUFFER_EOF_PENDING
#define YY_BUFFER_EOF_PENDING 2
#undef  YY_CURRENT_BUFFER
#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
#undef  YY_CURRENT_BUFFER_LVALUE
#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
#undef  YY_FLUSH_BUFFER
#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
#undef  yy_new_buffer
#define yy_new_buffer yy_create_buffer
#undef  yytext_ptr
#define yytext_ptr yytext
#undef  YY_DO_BEFORE_ACTION
#define YY_DO_BEFORE_ACTION \
#undef  YY_NUM_RULES
#define YY_NUM_RULES 29
#undef  YY_END_OF_BUFFER
#define YY_END_OF_BUFFER 30
#undef  REJECT
#define REJECT reject_used_but_not_detected
#undef  YY_MORE_ADJ
#define YY_MORE_ADJ 0
#undef  YY_RESTORE_YY_MORE_OFFSET
#define YY_RESTORE_YY_MORE_OFFSET
#undef  YY_NO_UNPUT
#define YY_NO_UNPUT
#undef  INITIAL
#define INITIAL 0
#undef  YY_EXTRA_TYPE
#define YY_EXTRA_TYPE void *
#undef  YY_READ_BUF_SIZE
#define YY_READ_BUF_SIZE 8192
#undef  ECHO
#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
#undef  YY_START_STACK_INCR
#define YY_START_STACK_INCR 25
#undef  YY_DECL_IS_OURS
#define YY_DECL_IS_OURS 1
#undef  YY_DECL
#define YY_DECL int yylex (void)
#undef  YY_USER_ACTION
#define YY_USER_ACTION
#undef  YY_BREAK
#define YY_BREAK break;
#undef  YY_RULE_SETUP
#define YY_RULE_SETUP \
#undef  YY_EXIT_FAILURE
#define YY_EXIT_FAILURE 2
#undef  YYTABLES_NAME
#define YYTABLES_NAME "yytables"
#undef  MAXPWD
#define MAXPWD 256
#undef  ALL
#define ALL (E_OPEN|E_CREAT|E_EXEC)
#undef  EV_EXIT
#define EV_EXIT 01		/* exit after evaluating tree */
#undef  EV_TESTED
#define EV_TESTED 02		/* exit status is checked; ignore -e flag */
#undef  EV_BACKCMD
#define EV_BACKCMD 04		/* command executing within back quotes */
#undef  CMDTABLESIZE
#define CMDTABLESIZE 31		/* should be prime */
#undef  ARB
#define ARB 1			/* actual size determined at run time */
#undef  NEWARGS
#define NEWARGS 5
#undef  EOF_NLEFT
#define EOF_NLEFT -99		/* value of parsenleft when EOF pushed back */
#undef  _PATH_DEVNULL
#define _PATH_DEVNULL "/dev/null"
#undef  PROFILE
#define PROFILE 0
#undef  SIGSSIZE
#define SIGSSIZE (sizeof(sigs)/sizeof(sigs[0]))
#undef  MINSIZE
#define MINSIZE 504		/* minimum size of a block */
#undef  DEFINE_OPTIONS
#define DEFINE_OPTIONS
#undef  EOFMARKLEN
#define EOFMARKLEN 79
#undef  OPENBRACE
#define OPENBRACE '{'
#undef  CLOSEBRACE
#define CLOSEBRACE '}'
#undef  EMPTY
#define EMPTY -2		/* marks an unused slot in redirtab */
#undef  S_DFL
#define S_DFL 1			/* default signal handling (SIG_DFL) */
#undef  S_CATCH
#define S_CATCH 2		/* signal is caught */
#undef  S_IGN
#define S_IGN 3			/* signal is ignored (SIG_IGN) */
#undef  S_HARD_IGN
#define S_HARD_IGN 4		/* signal is ignored permenantly */
#undef  S_RESET
#define S_RESET 5		/* temporary - to reset a hard ignored sig */
#undef  OUTBUFSIZ
#define OUTBUFSIZ BUFSIZ
#undef  BLOCK_OUT
#define BLOCK_OUT -2		/* output to a fixed block of memory */
#undef  MEM_OUT
#define MEM_OUT -3		/* output to dynamically allocated memory */
#undef  OUTPUT_ERR
#define OUTPUT_ERR 01		/* error occurred on output */
#undef  TEMPSIZE
#define TEMPSIZE 24
#undef  HAVE_VASPRINTF
#define HAVE_VASPRINTF 1
#undef  VTABSIZE
#define VTABSIZE 39
#undef  VTABSIZE
#define VTABSIZE 517
#undef  main
#define main echocmd



extern void rmaliases(void);

extern int loopnest;		/* current loop nesting level */

extern void deletefuncs(void);
extern void hash_special_builtins(void);

struct strpush {
	struct strpush *prev;	/* preceding string on stack */
	char *prevstring;
	int prevnleft;
	int prevlleft;
	struct alias *ap;	/* if push was associated with an alias */
};

struct parsefile {
	struct parsefile *prev;	/* preceding file on stack */
	int linno;		/* current line */
	int fd;			/* file descriptor (or -1 if string) */
	int nleft;		/* number of chars left in this line */
	int lleft;		/* number of chars left in this buffer */
	char *nextc;		/* next char in buffer */
	char *buf;		/* input buffer */
	struct strpush *strpush; /* for pushing strings at this level */
	struct strpush basestrpush; /* so pushing one is fast */
};

extern int parselleft;		/* copy of parsefile->lleft */
extern struct parsefile basepf;	/* top level input file */
extern char basebuf[BUFSIZ];	/* buffer for top level input file */

extern pid_t backgndpid;	/* pid of last background process */
extern int jobctl;

extern int tokpushback;		/* last token pushed back */
extern int checkkwd;            /* 1 == check for kwds, 2 == also eat newlines */

struct redirtab {
	struct redirtab *next;
	short renamed[10];
};

extern struct redirtab *redirlist;

extern char sigmode[NSIG];	/* current value of signal */

extern char **environ;



/*
 * Initialization code.
 */

void
init() {

      /* from exec.c: */
      {
	      hash_special_builtins();
      }

      /* from input.c: */
      {
	      basepf.nextc = basepf.buf = basebuf;
      }

      /* from var.c: */
      {
	      char **envp;

	      initvar();
	      for (envp = environ ; *envp ; envp++) {
		      if (strchr(*envp, '=')) {
			      setvareq(*envp, VEXPORT|VTEXTFIXED);
		      }
	      }
      }
}



/*
 * This routine is called when an error or an interrupt occurs in an
 * interactive shell and control is returned to the main command loop.
 */

void
reset() {

      /* from eval.c: */
      {
	      evalskip = 0;
	      loopnest = 0;
	      funcnest = 0;
      }

      /* from input.c: */
      {
	      if (exception != EXSHELLPROC)
		      parselleft = parsenleft = 0;	/* clear input buffer */
	      popallfiles();
      }

      /* from parser.c: */
      {
	      tokpushback = 0;
	      checkkwd = 0;
      }

      /* from redir.c: */
      {
	      while (redirlist)
		      popredir();
      }

      /* from output.c: */
      {
	      out1 = &output;
	      out2 = &errout;
	      if (memout.buf != NULL) {
		      ckfree(memout.buf);
		      memout.buf = NULL;
	      }
      }
}



/*
 * This routine is called to initialize the shell to run a shell procedure.
 */

void
initshellproc() {

      /* from alias.c: */
      {
	      rmaliases();
      }

      /* from eval.c: */
      {
	      exitstatus = 0;
      }

      /* from exec.c: */
      {
	      deletefuncs();
      }

      /* from input.c: */
      {
	      popallfiles();
      }

      /* from jobs.c: */
      {
	      backgndpid = -1;
#if JOBS
	      jobctl = 0;
#endif
      }

      /* from options.c: */
      {
	      int i;

	      for (i = 0; optlist[i].name; i++)
		      optlist[i].val = 0;
	      optschanged();

      }

      /* from redir.c: */
      {
	      clearredir(0);
      }

      /* from trap.c: */
      {
	      char *sm;

	      clear_traps(0);
	      for (sm = sigmode ; sm < sigmode + NSIG ; sm++) {
		      if (*sm == S_IGN)
			      *sm = S_HARD_IGN;
	      }
      }

      /* from var.c: */
      {
	      shprocvar();
      }
}