xref: /titanic_41/usr/src/cmd/csh/sh.init.c (revision b509e89b2befbaa42939abad9da1d7f5a8c6aaae)
1 /*
2  * Copyright 1997 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T	*/
7 /*	  All Rights Reserved  	*/
8 
9 /*
10  * Copyright (c) 1980 Regents of the University of California.
11  * All rights reserved.  The Berkeley Software License Agreement
12  * specifies the terms and conditions for redistribution.
13  */
14 
15 #pragma ident	"%Z%%M%	%I%	%E% SMI"
16 
17 #include "sh.h"
18 #include "sh.tconst.h"
19 
20 /*
21  * C shell
22  */
23 
24 extern	int doalias();
25 extern	int dobg();
26 extern	int dobreak();
27 extern	int dochngd();
28 extern	int docontin();
29 extern	int dodirs();
30 extern	int doecho();
31 extern	int doelse();
32 extern	int doend();
33 extern	int doendif();
34 extern	int doendsw();
35 extern	int doeval();
36 extern	int doexit();
37 extern	int dofg();
38 extern	int doforeach();
39 extern	int doglob();
40 extern	int dogoto();
41 extern	int dohash();
42 extern	int dorehash();
43 extern	int dohist();
44 extern	int doif();
45 extern	int dojobs();
46 extern	int dokill();
47 extern	int dolet();
48 extern	int dolimit();
49 extern	int dologin();
50 extern	int dologout();
51 #ifdef NEWGRP
52 extern	int donewgrp();
53 #endif
54 extern	int donice();
55 extern	int donotify();
56 extern	int donohup();
57 extern	int doonintr();
58 extern	int dopopd();
59 extern	int dopushd();
60 extern	int dorepeat();
61 extern	int doset();
62 extern	int dosetenv();
63 extern	int dosource();
64 extern	int dostop();
65 extern	int dosuspend();
66 extern	int doswbrk();
67 extern	int doswitch();
68 extern	int dotime();
69 extern	int dounlimit();
70 extern	int doumask();
71 extern	int dowait();
72 extern	int dowhile();
73 extern	int dozip();
74 extern	int execash();
75 extern	int goodbye();
76 #ifdef VFORK
77 extern	int hashstat();
78 #endif
79 extern	int shift();
80 #ifdef OLDMALLOC
81 extern	int showall();
82 #endif
83 extern	int unalias();
84 extern	int dounhash();
85 extern	int unset();
86 extern	int dounsetenv();
87 
88 #define	INF	1000
89 
90 struct	biltins bfunc[] = {
91 	S_AT,		dolet,		0,	INF,
92 	S_alias,	doalias,	0,	INF,
93 #ifdef OLDMALLOC
94 	S_alloc,	showall,	0,	1,
95 #endif
96 	S_bg,		dobg,		0,	INF,
97 	S_break,	dobreak,	0,	0,
98 	S_breaksw,	doswbrk,	0,	0,
99 #ifdef IIASA
100 	S_bye,		goodbye,	0,	0,
101 #endif
102 	S_case,	dozip,		0,	1,
103 	S_cd,		dochngd,	0,	1,
104 	S_chdir,	dochngd,	0,	1,
105 	S_continue,	docontin,	0,	0,
106 	S_default,	dozip,		0,	0,
107 	S_dirs,	dodirs,		0,	1,
108 	S_echo,	doecho,		0,	INF,
109 	S_else,	doelse,		0,	INF,
110 	S_end,		doend,		0,	0,
111 	S_endif,	dozip,		0,	0,
112 	S_endsw,	dozip,		0,	0,
113 	S_eval,	doeval,		0,	INF,
114 	S_exec,	execash,	1,	INF,
115 	S_exit,	doexit,		0,	INF,
116 	S_fg,		dofg,		0,	INF,
117 	S_foreach,	doforeach,	3,	INF,
118 #ifdef IIASA
119 	S_gd,		dopushd,	0,	1,
120 #endif
121 	S_glob,	doglob,		0,	INF,
122 	S_goto,	dogoto,		1,	1,
123 #ifdef VFORK
124 	S_hashstat,	hashstat,	0,	0,
125 #endif
126 	S_history,	dohist,		0,	2,
127 	S_if,		doif,		1,	INF,
128 	S_jobs,	dojobs,		0,	1,
129 	S_kill,	dokill,		1,	INF,
130 	S_limit,	dolimit,	0,	3,
131 	S_login,	dologin,	0,	1,
132 	S_logout,	dologout,	0,	0,
133 #ifdef NEWGRP
134 	S_newgrp,	donewgrp,	1,	1,
135 #endif
136 	S_nice,	donice,		0,	INF,
137 	S_nohup,	donohup,	0,	INF,
138 	S_notify,	donotify,	0,	INF,
139 	S_onintr,	doonintr,	0,	2,
140 	S_popd,	dopopd,		0,	1,
141 	S_pushd,	dopushd,	0,	1,
142 #ifdef IIASA
143 	S_rd,		dopopd,		0,	1,
144 #endif
145 	S_rehash,	dorehash,	0,	0,
146 	S_repeat,	dorepeat,	2,	INF,
147 	S_set,		doset,		0,	INF,
148 	S_setenv,	dosetenv,	0,	2,
149 	S_shift,	shift,		0,	1,
150 	S_source,	dosource,	1,	2,
151 	S_stop,	dostop,		1,	INF,
152 	S_suspend,	dosuspend,	0,	0,
153 	S_switch,	doswitch,	1,	INF,
154 	S_time,		dotime,		0,	INF,
155 	S_umask,	doumask,	0,	1,
156 	S_unalias,	unalias,	1,	INF,
157 	S_unhash,	dounhash,	0,	0,
158 	S_unlimit,	dounlimit,	0,	INF,
159 	S_unset,	unset,		1,	INF,
160 	S_unsetenv,	dounsetenv,	1,	INF,
161 	S_wait,		dowait,		0,	0,
162 	S_while,	dowhile,	1,	INF,
163 };
164 int nbfunc = sizeof bfunc / sizeof *bfunc;
165 
166 #define	ZBREAK		0
167 #define	ZBRKSW		1
168 #define	ZCASE		2
169 #define	ZDEFAULT 	3
170 #define	ZELSE		4
171 #define	ZEND		5
172 #define	ZENDIF		6
173 #define	ZENDSW		7
174 #define	ZEXIT		8
175 #define	ZFOREACH	9
176 #define	ZGOTO		10
177 #define	ZIF		11
178 #define	ZLABEL		12
179 #define	ZLET		13
180 #define	ZSET		14
181 #define	ZSWITCH		15
182 #define	ZTEST		16
183 #define	ZTHEN		17
184 #define	ZWHILE		18
185 
186 struct srch srchn[] = {
187 	S_AT,		ZLET,
188 	S_break,	ZBREAK,
189 	S_breaksw,	ZBRKSW,
190 	S_case,		ZCASE,
191 	S_default, 	ZDEFAULT,
192 	S_else,		ZELSE,
193 	S_end,		ZEND,
194 	S_endif,	ZENDIF,
195 	S_endsw,	ZENDSW,
196 	S_exit,		ZEXIT,
197 	S_foreach, 	ZFOREACH,
198 	S_goto,		ZGOTO,
199 	S_if,		ZIF,
200 	S_label,	ZLABEL,
201 	S_set,		ZSET,
202 	S_switch,	ZSWITCH,
203 	S_while,	ZWHILE
204 };
205 int nsrchn = sizeof srchn / sizeof *srchn;
206 
207