VirtualBox

source: kBuild/trunk/src/kash/generated/init.c@ 2652

Last change on this file since 2652 was 2652, checked in by bird, 12 years ago

kash: Fixes for hash-bang-scripts on windows. Related debug tracing fix. Another CWD slash fix. Fixed a couple of assertions.

  • Property svn:keywords set to Id
File size: 7.2 KB
Line 
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 "output.h"
15#include "memalloc.h"
16#include "redir.h"
17#include <signal.h>
18#include "trap.h"
19#include "var.h"
20#include "shinstance.h"
21
22
23
24#undef PROFILE
25#define PROFILE 0
26#undef SIGSSIZE
27#define SIGSSIZE (sizeof(sigs)/sizeof(sigs[0]))
28#undef MAXPWD
29#define MAXPWD 256
30#undef ALL
31#define ALL (E_OPEN|E_CREAT|E_EXEC)
32#undef EV_EXIT
33#define EV_EXIT 01 /* exit after evaluating tree */
34#undef EV_TESTED
35#define EV_TESTED 02 /* exit status is checked; ignore -e flag */
36#undef EV_BACKCMD
37#define EV_BACKCMD 04 /* command executing within back quotes */
38#undef NEWARGS
39#define NEWARGS 5
40#undef MAXHISTLOOPS
41#define MAXHISTLOOPS 4 /* max recursions through fc */
42#undef DEFEDITOR
43#define DEFEDITOR "ed" /* default editor *should* be $EDITOR */
44#undef editing
45#define editing (Eflag(psh) || Vflag(psh))
46#undef EOF_NLEFT
47#define EOF_NLEFT -99 /* value of parsenleft when EOF pushed back */
48#undef DEFINE_OPTIONS
49#define DEFINE_OPTIONS
50#undef BLOCK_OUT
51#define BLOCK_OUT -2 /* output to a fixed block of memory */
52#undef OUTPUT_ERR
53#define OUTPUT_ERR 01 /* error occurred on output */
54#undef TEMPSIZE
55#define TEMPSIZE 32
56#undef HAVE_VASPRINTF
57#define HAVE_VASPRINTF 1
58#undef EOFMARKLEN
59#define EOFMARKLEN 79
60#undef OPENBRACE
61#define OPENBRACE '{'
62#undef CLOSEBRACE
63#define CLOSEBRACE '}'
64#undef EMPTY
65#define EMPTY -2 /* marks an unused slot in redirtab */
66#undef S_DFL
67#define S_DFL 1 /* default signal handling (SIG_DFL) */
68#undef S_CATCH
69#define S_CATCH 2 /* signal is caught */
70#undef S_IGN
71#define S_IGN 3 /* signal is ignored (SIG_IGN) */
72#undef S_HARD_IGN
73#define S_HARD_IGN 4 /* signal is ignored permenantly */
74#undef S_RESET
75#define S_RESET 5 /* temporary - to reset a hard ignored sig */
76#undef INCL_BASE
77#define INCL_BASE
78#undef LIBPATHSTRICT
79#define LIBPATHSTRICT 3
80#undef QHINF_EXEINFO
81#define QHINF_EXEINFO 1 /* NE exeinfo. */
82#undef QHINF_READRSRCTBL
83#define QHINF_READRSRCTBL 2 /* Reads from the resource table. */
84#undef QHINF_READFILE
85#define QHINF_READFILE 3 /* Reads from the executable file. */
86#undef QHINF_LIBPATHLENGTH
87#define QHINF_LIBPATHLENGTH 4 /* Gets the libpath length. */
88#undef QHINF_LIBPATH
89#define QHINF_LIBPATH 5 /* Gets the entire libpath. */
90#undef QHINF_FIXENTRY
91#define QHINF_FIXENTRY 6 /* NE only */
92#undef QHINF_STE
93#define QHINF_STE 7 /* NE only */
94#undef QHINF_MAPSEL
95#define QHINF_MAPSEL 8 /* NE only */
96#undef SET_LEN
97#define SET_LEN 6 /* initial # of bitcmd struct to malloc */
98#undef SET_LEN_INCR
99#define SET_LEN_INCR 4 /* # of bitcmd structs to add as needed */
100#undef CMD2_CLR
101#define CMD2_CLR 0x01
102#undef CMD2_SET
103#define CMD2_SET 0x02
104#undef CMD2_GBITS
105#define CMD2_GBITS 0x04
106#undef CMD2_OBITS
107#define CMD2_OBITS 0x08
108#undef CMD2_UBITS
109#define CMD2_UBITS 0x10
110#undef STANDARD_BITS
111#define STANDARD_BITS (S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO)
112#undef SHMEMHDR_MAGIC_FREE
113#define SHMEMHDR_MAGIC_FREE 0xbeeff00d
114#undef SHMEMHDR_MAGIC_USED
115#define SHMEMHDR_MAGIC_USED 0xfeedface
116#undef SHMEMCHUNK_MAGIC
117#define SHMEMCHUNK_MAGIC 0x12345678
118#undef SHHEAP_MIN_CHUNK
119#define SHHEAP_MIN_CHUNK 0x80000 //(1024*1024)
120#undef SHFILE_MAX
121#define SHFILE_MAX 1024
122#undef SHFILE_GROW
123#define SHFILE_GROW 64
124#undef SHFILE_UNIX_MIN_FD
125#define SHFILE_UNIX_MIN_FD 32
126#undef SHFILE_MAX_PATH
127#define SHFILE_MAX_PATH 4096
128#undef YY_NO_UNPUT
129#define YY_NO_UNPUT
130
131
132
133extern void rmaliases(shinstance *psh);
134
135extern void deletefuncs(struct shinstance *);
136extern void hash_special_builtins(struct shinstance *);
137
138struct redirtab {
139 struct redirtab *next;
140 short renamed[10];
141};
142
143
144
145/*
146 * Initialization code.
147 */
148
149void
150init(shinstance *psh) {
151
152 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/exec.c: */
153 {
154 hash_special_builtins(psh);
155 }
156
157 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/input.c: */
158 {
159 psh->basepf.nextc = psh->basepf.buf = psh->basebuf;
160 }
161
162 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/options.c: */
163 {
164 memcpy(&psh->optlist[0], &ro_optlist[0], sizeof(psh->optlist));
165 }
166
167 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/var.c: */
168 {
169 char **envp;
170
171 initvar(psh);
172 for (envp = sh_environ(psh) ; *envp ; envp++) {
173 if (strchr(*envp, '=')) {
174 setvareq(psh, *envp, VEXPORT|VTEXTFIXED);
175 }
176 }
177 }
178}
179
180
181
182/*
183 * This routine is called when an error or an interrupt occurs in an
184 * interactive shell and control is returned to the main command loop.
185 */
186
187void
188reset(shinstance *psh) {
189
190 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/eval.c: */
191 {
192 psh->evalskip = 0;
193 psh->loopnest = 0;
194 psh->funcnest = 0;
195 }
196
197 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/input.c: */
198 {
199 if (psh->exception != EXSHELLPROC)
200 psh->parselleft = psh->parsenleft = 0; /* clear input buffer */
201 popallfiles(psh);
202 }
203
204 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/output.c: */
205 {
206 psh->out1 = &psh->output;
207 psh->out2 = &psh->errout;
208 if (psh->memout.buf != NULL) {
209 ckfree(psh, psh->memout.buf);
210 psh->memout.buf = NULL;
211 }
212 }
213
214 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/parser.c: */
215 {
216 psh->tokpushback = 0;
217 psh->checkkwd = 0;
218 }
219
220 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/redir.c: */
221 {
222 while (psh->redirlist)
223 popredir(psh);
224 }
225}
226
227
228
229/*
230 * This routine is called to initialize the shell to run a shell procedure.
231 */
232
233void
234initshellproc(shinstance *psh) {
235
236 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/alias.c: */
237 {
238 rmaliases(psh);
239 }
240
241 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/eval.c: */
242 {
243 psh->exitstatus = 0;
244 }
245
246 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/exec.c: */
247 {
248 deletefuncs(psh);
249 }
250
251 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/input.c: */
252 {
253 popallfiles(psh);
254 }
255
256 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/jobs.c: */
257 {
258 psh->backgndpid = -1;
259#if JOBS
260 psh->jobctl = 0;
261#endif
262 }
263
264 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/options.c: */
265 {
266 int i;
267
268 for (i = 0; psh->optlist[i].name; i++)
269 psh->optlist[i].val = 0;
270# if DEBUG == 2
271 debug(psh) = 1;
272# endif
273 optschanged(psh);
274 }
275
276 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/redir.c: */
277 {
278 clearredir(psh, 0);
279 }
280
281 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/trap.c: */
282 {
283 char *sm;
284
285 clear_traps(psh, 0);
286 for (sm = psh->sigmode ; sm < psh->sigmode + NSIG ; sm++) {
287 if (*sm == S_IGN)
288 *sm = S_HARD_IGN;
289 }
290 }
291
292 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/var.c: */
293 {
294 shprocvar(psh);
295 }
296}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette