2 * This file was generated by the mkinit program.
28 #define ALL (E_OPEN|E_CREAT|E_EXEC)
30 #define EV_EXIT 01 /* exit after evaluating tree */
32 #define EV_TESTED 02 /* exit status is checked; ignore -e flag */
34 #define EV_BACKCMD 04 /* command executing within back quotes */
36 #define CMDTABLESIZE 31 /* should be prime */
38 #define ARB 1 /* actual size determined at run time */
42 #define MAXHISTLOOPS 4 /* max recursions through fc */
44 #define DEFEDITOR "ed" /* default editor *should* be $EDITOR */
46 #define editing (Eflag || Vflag)
48 #define EOF_NLEFT -99 /* value of parsenleft when EOF pushed back */
54 #define SIGSSIZE (sizeof(sigs)/sizeof(sigs[0]))
56 #define MINSIZE 504 /* minimum size of a block */
58 #define DEFINE_OPTIONS
60 #define OUTBUFSIZ BUFSIZ
62 #define BLOCK_OUT -2 /* output to a fixed block of memory */
64 #define MEM_OUT -3 /* output to dynamically allocated memory */
66 #define OUTPUT_ERR 01 /* error occurred on output */
70 #define HAVE_VASPRINTF 1
76 #define CLOSEBRACE '}'
78 #define EMPTY -2 /* marks an unused slot in redirtab */
80 #define S_DFL 1 /* default signal handling (SIG_DFL) */
82 #define S_CATCH 2 /* signal is caught */
84 #define S_IGN 3 /* signal is ignored (SIG_IGN) */
86 #define S_HARD_IGN 4 /* signal is ignored permenantly */
88 #define S_RESET 5 /* temporary - to reset a hard ignored sig */
92 #define LIBPATHSTRICT 3
94 #define QHINF_EXEINFO 1 /* NE exeinfo. */
95 #undef QHINF_READRSRCTBL
96 #define QHINF_READRSRCTBL 2 /* Reads from the resource table. */
98 #define QHINF_READFILE 3 /* Reads from the executable file. */
99 #undef QHINF_LIBPATHLENGTH
100 #define QHINF_LIBPATHLENGTH 4 /* Gets the libpath length. */
102 #define QHINF_LIBPATH 5 /* Gets the entire libpath. */
103 #undef QHINF_FIXENTRY
104 #define QHINF_FIXENTRY 6 /* NE only */
106 #define QHINF_STE 7 /* NE only */
108 #define QHINF_MAPSEL 8 /* NE only */
120 extern void rmaliases(void);
122 extern int loopnest
; /* current loop nesting level */
124 extern void deletefuncs(void);
125 extern void hash_special_builtins(void);
128 struct strpush
*prev
; /* preceding string on stack */
132 struct alias
*ap
; /* if push was associated with an alias */
136 struct parsefile
*prev
; /* preceding file on stack */
137 int linno
; /* current line */
138 int fd
; /* file descriptor (or -1 if string) */
139 int nleft
; /* number of chars left in this line */
140 int lleft
; /* number of chars left in this buffer */
141 char *nextc
; /* next char in buffer */
142 char *buf
; /* input buffer */
143 struct strpush
*strpush
; /* for pushing strings at this level */
144 struct strpush basestrpush
; /* so pushing one is fast */
147 extern int parselleft
; /* copy of parsefile->lleft */
148 extern struct parsefile basepf
; /* top level input file */
149 extern char basebuf
[BUFSIZ
]; /* buffer for top level input file */
151 extern pid_t backgndpid
; /* pid of last background process */
154 extern int tokpushback
; /* last token pushed back */
155 extern int checkkwd
; /* 1 == check for kwds, 2 == also eat newlines */
158 struct redirtab
*next
;
162 extern struct redirtab
*redirlist
;
164 extern char sigmode
[NSIG
]; /* current value of signal */
166 extern char **environ
;
171 * Initialization code.
179 hash_special_builtins();
184 basepf
.nextc
= basepf
.buf
= basebuf
;
192 for (envp
= environ
; *envp
; envp
++) {
193 if (strchr(*envp
, '=')) {
194 setvareq(*envp
, VEXPORT
|VTEXTFIXED
);
203 * This routine is called when an error or an interrupt occurs in an
204 * interactive shell and control is returned to the main command loop.
219 if (exception
!= EXSHELLPROC
)
220 parselleft
= parsenleft
= 0; /* clear input buffer */
228 if (memout
.buf
!= NULL
) {
250 * This routine is called to initialize the shell to run a shell procedure.
284 /* from options.c: */
288 for (i
= 0; optlist
[i
].name
; i
++)
304 for (sm
= sigmode
; sm
< sigmode
+ NSIG
; sm
++) {