xref: /original-bsd/local/toolchest/ksh/sh/msg.c (revision 418903ec)
1*418903ecSmarc /* @(#)msg.c	1.1 */
2*418903ecSmarc /*
3*418903ecSmarc  *	UNIX shell
4*418903ecSmarc  *	S. R. Bourne
5*418903ecSmarc  *	Rewritten by David Korn
6*418903ecSmarc  *
7*418903ecSmarc  *	AT&T Bell Laboratories
8*418903ecSmarc  *
9*418903ecSmarc  */
10*418903ecSmarc 
11*418903ecSmarc 
12*418903ecSmarc #include	<errno.h>
13*418903ecSmarc #include	"flags.h"
14*418903ecSmarc #include	"name.h"
15*418903ecSmarc #include	"defs.h"
16*418903ecSmarc #include	"sym.h"
17*418903ecSmarc #include	"builtins.h"
18*418903ecSmarc #include	"brkincr.h"
19*418903ecSmarc #include	"test.h"
20*418903ecSmarc #include	"timeout.h"
21*418903ecSmarc #include	"history.h"
22*418903ecSmarc 
23*418903ecSmarc #ifdef MULTIBYTE
24*418903ecSmarc #include	"national.h"
25*418903ecSmarc const MSG version 	= "@(#)Version M-06/03/86a";
26*418903ecSmarc 
27*418903ecSmarc #else
28*418903ecSmarc const MSG version 	= "@(#)Version 06/03/86a";
29*418903ecSmarc #endif /* MULTIBYTE */
30*418903ecSmarc 
31*418903ecSmarc extern struct Bfunction randnum;
32*418903ecSmarc extern struct Bfunction seconds;
33*418903ecSmarc 
34*418903ecSmarc /* error messages */
35*418903ecSmarc const MSG	time_warn	= "\r\n\007shell time out in 60 seconds";
36*418903ecSmarc const MSG	timed_out	= "timed out waiting for input";
37*418903ecSmarc const MSG	recursive	= "recursive call";
38*418903ecSmarc const MSG	noquery		= "no query process";
39*418903ecSmarc const MSG	nohistory	= "no history file";
40*418903ecSmarc const MSG	badopt		= "bad option(s)";
41*418903ecSmarc const MSG	mailmsg		= "you have mail in $_";
42*418903ecSmarc const MSG	nospace		= "no space";
43*418903ecSmarc const MSG	synmsg		= "syntax error";
44*418903ecSmarc 
45*418903ecSmarc const MSG	parexp		= ") expected";
46*418903ecSmarc const MSG	argexp		= "argument expected";
47*418903ecSmarc const MSG	endmatch	= "] missing";
48*418903ecSmarc const MSG	badnum		= "bad number";
49*418903ecSmarc const MSG	badcooked	= "cannot reset tty to cooked mode";
50*418903ecSmarc const MSG	badparam	= "parameter null or not set";
51*418903ecSmarc const MSG	unset		= "parameter not set";
52*418903ecSmarc const MSG	badsub		= "bad substitution";
53*418903ecSmarc const MSG	badcreate	= "cannot create";
54*418903ecSmarc const MSG	restricted	= "restricted";
55*418903ecSmarc const MSG	nofork		= "cannot fork: too many processes";
56*418903ecSmarc const MSG	pexists		= "process already exists";
57*418903ecSmarc const MSG	noswap		= "cannot fork: no swap space";
58*418903ecSmarc const MSG	piperr		= "cannot make pipe";
59*418903ecSmarc const MSG	logout		= "Use 'exit' to logout";
60*418903ecSmarc const MSG	badopen		= "cannot open";
61*418903ecSmarc const MSG	coredump	= " - core dumped";
62*418903ecSmarc const MSG	ptrace		= "ptrace: ";
63*418903ecSmarc const MSG	arglist		= "arg list too long";
64*418903ecSmarc const MSG	txtbsy		= "text busy";
65*418903ecSmarc const MSG	toobig		= "too big";
66*418903ecSmarc const MSG	badexec		= "cannot execute";
67*418903ecSmarc const MSG	pwderr		= "cannot access parent directories";
68*418903ecSmarc const MSG	notfound	= " not found";
69*418903ecSmarc const MSG	nomorefiles	= "too many open files";
70*418903ecSmarc #ifdef ELIBACC
71*418903ecSmarc /* shared library error messages */
72*418903ecSmarc const MSG	libacc 		= "can't access a needed shared library";
73*418903ecSmarc const MSG	libbad		= "accessing a corrupted shared library";
74*418903ecSmarc const MSG	libscn		= ".lib section in a.out corrupted";
75*418903ecSmarc const MSG	libmax		= "attempting to link in too many libs";
76*418903ecSmarc #endif	/* ELIBACC */
77*418903ecSmarc const MSG	badfile		= "bad file unit number";
78*418903ecSmarc const MSG	baddir		= "bad directory";
79*418903ecSmarc const MSG	badtrap		= "bad trap";
80*418903ecSmarc const MSG	wtfailed	= "is read only";
81*418903ecSmarc const MSG	notid		= "invalid identifier";
82*418903ecSmarc const MSG	badop		= "unknown test operator";
83*418903ecSmarc const MSG	noalias		= " alias not found";
84*418903ecSmarc const MSG	is_reserved	= " is a reserved word";
85*418903ecSmarc const MSG	is_builtin	= " is a shell builtin";
86*418903ecSmarc const MSG	is_alias	= " is an alias for ";
87*418903ecSmarc const MSG	is_function	= " is a function";
88*418903ecSmarc const MSG	is_xalias	= " is an exported alias for ";
89*418903ecSmarc const MSG	is_talias	= " is a tracked alias for ";
90*418903ecSmarc const MSG	is_xfunction	= " is an exported function";
91*418903ecSmarc const MSG	is_		= " is ";
92*418903ecSmarc const MSG	on_		= "on";
93*418903ecSmarc const MSG	off_		= "off";
94*418903ecSmarc const MSG	divzero		= "division by zero";
95*418903ecSmarc const MSG	subscript	= "subscript out of range";
96*418903ecSmarc const MSG	argcount	= "bad argument count";
97*418903ecSmarc const MSG	fn_hdr		= "\n{\n";
98*418903ecSmarc #ifdef VSH
99*418903ecSmarc const MSG	big_vi		= "fc -e \"${VISUAL:-${EDITOR:-vi}}\" ";
100*418903ecSmarc #endif
101*418903ecSmarc #ifdef JOBS
102*418903ecSmarc #ifdef BSD
103*418903ecSmarc const MSG	j_not_tty	= "Warning: no access to tty; thus no job control in this shell...\n";
104*418903ecSmarc const MSG	j_newtty	= "Switching to new tty driver...\n";
105*418903ecSmarc const MSG	j_oldtty	= "Reverting to old tty driver...\n";
106*418903ecSmarc const MSG	j_no_start	= "Cannot start job control\n";
107*418903ecSmarc #endif
108*418903ecSmarc const MSG	j_Done		= " Done";
109*418903ecSmarc const MSG	j_amp		= " &\n";
110*418903ecSmarc const MSG	j_cpid		= "|&\n";
111*418903ecSmarc const MSG	j_space		= "|\n      ";
112*418903ecSmarc const MSG	j_Running	= " Running";
113*418903ecSmarc const MSG	j_coredump	= "(coredump)";
114*418903ecSmarc const MSG	j_terminate	= "You have stopped jobs\n";
115*418903ecSmarc const MSG	j_running	= "You have running jobs\n";
116*418903ecSmarc const MSG	j_no_job	= "No such job";
117*418903ecSmarc const MSG	j_no_proc	= "No such process";
118*418903ecSmarc const MSG	j_perm		= "Permission denied";
119*418903ecSmarc const MSG	j_kill		= "kill: ";
120*418903ecSmarc const MSG	kill_usage	= "Arguments should be jobs or process ids";
121*418903ecSmarc const MSG	j_no_jctl	= "No job control";
122*418903ecSmarc #endif
123*418903ecSmarc #ifdef DEVFD
124*418903ecSmarc const MSG	devfd		= "/dev/fd/";
125*418903ecSmarc #endif
126*418903ecSmarc 
127*418903ecSmarc /* string constants */
128*418903ecSmarc const MSG	test_opts	= "rwxdcbfugkLpsnzt";
129*418903ecSmarc const MSG	opt_heading	= "Current option settings";
130*418903ecSmarc const MSG	nullstr		= "";
131*418903ecSmarc const MSG	sptbnl		= " \t\n";
132*418903ecSmarc const MSG	defpath		= "/bin:/usr/bin:";
133*418903ecSmarc const MSG	defedit		= "/bin/ed";
134*418903ecSmarc const MSG	colon		= ": ";
135*418903ecSmarc const MSG	minus		= "-";
136*418903ecSmarc const MSG	endoffile	= "end of file";
137*418903ecSmarc const MSG	unexpected 	= " unexpected";
138*418903ecSmarc const MSG	unmatched 	= " unmatched";
139*418903ecSmarc const MSG	unknown 	= "<job name unknown>";
140*418903ecSmarc const MSG	let_syntax	= "arithmetic expression ending in single ')' ";
141*418903ecSmarc const MSG	atline		= " at line ";
142*418903ecSmarc const MSG	devnull		= "/dev/null";
143*418903ecSmarc const MSG	execpmsg	= "+ ";
144*418903ecSmarc const MSG	supprompt	= "# ";
145*418903ecSmarc const MSG	stdprompt	= "$ ";
146*418903ecSmarc const MSG	profile		= "${HOME:-.}/.profile";
147*418903ecSmarc const MSG	sysprofile	= "/etc/profile";
148*418903ecSmarc const MSG	suid_profile	= "/etc/suid_profile";
149*418903ecSmarc #ifdef BSD_4_2
150*418903ecSmarc const MSG	prohibited	= "login setuid/setgid shells prohibited";
151*418903ecSmarc #endif /* BSD_4_2 */
152*418903ecSmarc #ifdef SUID_EXEC
153*418903ecSmarc const MSG	suid_exec	= "/etc/suid_exec";
154*418903ecSmarc const MSG	devfdNN		= "/dev/fd/??";
155*418903ecSmarc #endif /* SUID_EXEC */
156*418903ecSmarc const MSG	histfname	= "/.sh_history";
157*418903ecSmarc const MSG	unlimited	= "unlimited";
158*418903ecSmarc #ifdef ECHO_N
159*418903ecSmarc const MSG	echo_bin	= "/bin/echo";
160*418903ecSmarc const MSG	echo_opt	= "-R";
161*418903ecSmarc #endif	/* ECHO_N */
162*418903ecSmarc const MSG	btest		= "test";
163*418903ecSmarc const MSG	bkill		= "kill";
164*418903ecSmarc const MSG	bset		= "set";
165*418903ecSmarc const MSG	blet		= "let";
166*418903ecSmarc const MSG	bread		= "read";
167*418903ecSmarc const MSG	dot		= ".";
168*418903ecSmarc const MSG	bltfn		= "function ";
169*418903ecSmarc const MSG	intbase		= "base";
170*418903ecSmarc const MSG	setpwd		= "PWD=`/bin/pwd 2>/dev/null`";
171*418903ecSmarc const MSG	t_real		= "\nreal";
172*418903ecSmarc const MSG	t_user		= "user";
173*418903ecSmarc const MSG	t_sys		= "sys";
174*418903ecSmarc 
175*418903ecSmarc #ifdef apollo
176*418903ecSmarc #undef NULL
177*418903ecSmarc #define NULL ""
178*418903ecSmarc #define nullstr	""
179*418903ecSmarc #endif	/* apollo */
180*418903ecSmarc 
181*418903ecSmarc /* built in names */ struct name_value node_names[] =
182*418903ecSmarc {
183*418903ecSmarc 	"PATH",		NULL,
184*418903ecSmarc 	"PS1",		NULL,
185*418903ecSmarc 	"PS2",		"> ",
186*418903ecSmarc #ifdef apollo
187*418903ecSmarc 	"IFS",		" \t\n",
188*418903ecSmarc #else
189*418903ecSmarc 	"IFS",		sptbnl,
190*418903ecSmarc #endif	/* apollo */
191*418903ecSmarc 	"PWD",		NULL,
192*418903ecSmarc 	"HOME",		NULL,
193*418903ecSmarc 	"MAIL",		NULL,
194*418903ecSmarc 	"REPLY",	NULL,
195*418903ecSmarc 	"SHELL",	"/bin/sh",
196*418903ecSmarc 	"EDITOR",	"/bin/ed",
197*418903ecSmarc #ifdef apollo
198*418903ecSmarc 	"MAILCHECK",	NULL,
199*418903ecSmarc 	"RANDOM",	NULL,
200*418903ecSmarc #else
201*418903ecSmarc 	"MAILCHECK",	(char*)(&mailchk),
202*418903ecSmarc 	"RANDOM",	(char*)(&randnum),
203*418903ecSmarc #endif	/* apollo */
204*418903ecSmarc 	"ENV",		NULL,
205*418903ecSmarc 	"HISTFILE",	NULL,
206*418903ecSmarc 	"HISTSIZE",	NULL,
207*418903ecSmarc 	"FCEDIT",	"/bin/ed",
208*418903ecSmarc 	"CDPATH",	NULL,
209*418903ecSmarc 	"MAILPATH",	NULL,
210*418903ecSmarc 	"PS3",		"#? ",
211*418903ecSmarc 	"OLDPWD",	NULL,
212*418903ecSmarc 	"VISUAL",	NULL,
213*418903ecSmarc 	"COLUMNS",	NULL,
214*418903ecSmarc 	"LINES",	NULL,
215*418903ecSmarc #ifdef apollo
216*418903ecSmarc 	"PPID",		NULL,
217*418903ecSmarc 	"_",		NULL,
218*418903ecSmarc 	"TMOUT",	NULL,
219*418903ecSmarc 	"SECONDS",	NULL,
220*418903ecSmarc #else
221*418903ecSmarc 	"PPID",		(char*)(&ppid),
222*418903ecSmarc 	"_",		(char*)(&lastarg),
223*418903ecSmarc 	"TMOUT",	(char*)(&timeout),
224*418903ecSmarc 	"SECONDS",	(char*)(&seconds),
225*418903ecSmarc #endif	/* apollo */
226*418903ecSmarc #ifdef ACCT
227*418903ecSmarc 	"SHACCT",	NULL,
228*418903ecSmarc #endif	/* ACCT */
229*418903ecSmarc 	nullstr,	NULL
230*418903ecSmarc };
231*418903ecSmarc 
232*418903ecSmarc 
233*418903ecSmarc /* built in aliases - automatically exported */
234*418903ecSmarc struct name_value alias_names[] =
235*418903ecSmarc {
236*418903ecSmarc 	"cat",		"/bin/cat",
237*418903ecSmarc 	"chmod",	"/bin/chmod",
238*418903ecSmarc 	"cc",		"/bin/cc",
239*418903ecSmarc 	"cp",		"/bin/cp",
240*418903ecSmarc 	"date",		"/bin/date",
241*418903ecSmarc 	"ed",		"/bin/ed",
242*418903ecSmarc 	"false",	"let 0",
243*418903ecSmarc 	"functions",	"typeset -f",
244*418903ecSmarc #ifdef BSD
245*418903ecSmarc 	"grep",		"/usr/ucb/grep",
246*418903ecSmarc #else
247*418903ecSmarc 	"grep",		"/bin/grep",
248*418903ecSmarc #endif	/* BSD */
249*418903ecSmarc 	"hash",		"alias -t",
250*418903ecSmarc 	"history",	"fc -l",
251*418903ecSmarc 	"integer",	"typeset -i",
252*418903ecSmarc 	"lpr",		"/usr/bin/lpr",
253*418903ecSmarc 	"ls",		"/bin/ls",
254*418903ecSmarc 	"make",		"/bin/make",
255*418903ecSmarc 	"mail",		"/bin/mail",
256*418903ecSmarc 	"mv",		"/bin/mv",
257*418903ecSmarc 	"nohup",	"nohup ",
258*418903ecSmarc 	"pr",		"/bin/pr",
259*418903ecSmarc 	"r",		"fc -e -",
260*418903ecSmarc 	"rm",		"/bin/rm",
261*418903ecSmarc 	"sed",		"/bin/sed",
262*418903ecSmarc 	"sh",		"/bin/sh",
263*418903ecSmarc 	"true",		":",
264*418903ecSmarc 	"type",		"whence -v",
265*418903ecSmarc #ifdef BSD
266*418903ecSmarc 	"vi",		"/usr/ucb/vi",
267*418903ecSmarc #else
268*418903ecSmarc 	"vi",		"/usr/bin/vi",
269*418903ecSmarc #endif	/* BSD */
270*418903ecSmarc 	"who",		"/bin/who",
271*418903ecSmarc #ifdef JOBS
272*418903ecSmarc #ifdef BSD
273*418903ecSmarc 	"suspend",	"kill -STOP $$",
274*418903ecSmarc #endif	/* BSD */
275*418903ecSmarc #endif	/* JOBS */
276*418903ecSmarc 	nullstr,	0
277*418903ecSmarc };
278*418903ecSmarc 
279*418903ecSmarc /* tables */
280*418903ecSmarc SYSTAB reserved=
281*418903ecSmarc {
282*418903ecSmarc 		{"case",	CASYM},
283*418903ecSmarc 		{"do",		DOSYM},
284*418903ecSmarc 		{"done",	ODSYM},
285*418903ecSmarc 		{"elif",	EFSYM},
286*418903ecSmarc 		{"else",	ELSYM},
287*418903ecSmarc 		{"esac",	ESSYM},
288*418903ecSmarc 		{"fi",		FISYM},
289*418903ecSmarc 		{"for",		FORSYM},
290*418903ecSmarc 		{"function",	PROCSYM},
291*418903ecSmarc 		{"if",		IFSYM},
292*418903ecSmarc 		{"in",		INSYM},
293*418903ecSmarc 		{"select",	SELSYM},
294*418903ecSmarc 		{"then",	THSYM},
295*418903ecSmarc 		{"time",	TIMSYM},
296*418903ecSmarc 		{"until",	UNSYM},
297*418903ecSmarc 		{"while",	WHSYM},
298*418903ecSmarc 		{"{",		BRSYM},
299*418903ecSmarc 		{"}",		KTSYM},
300*418903ecSmarc 		{nullstr,	0},
301*418903ecSmarc };
302*418903ecSmarc 
303*418903ecSmarc /*
304*418903ecSmarc  * The signal numbers go in the low bits and the attributes go in the high bits
305*418903ecSmarc  */
306*418903ecSmarc 
307*418903ecSmarc SYSTAB	signal_names =
308*418903ecSmarc {
309*418903ecSmarc 		{"ALRM",	(SIGALRM+1)|(SIGCAUGHT<<SIGBITS)},
310*418903ecSmarc 		{"BUS",		(SIGBUS+1)},
311*418903ecSmarc #ifdef SIGCHLD
312*418903ecSmarc 		{"CHLD",	(SIGCHLD+1)|(SIGNOSET<<SIGBITS)},
313*418903ecSmarc #endif	/* SIGCHLD */
314*418903ecSmarc #ifdef SIGCLD
315*418903ecSmarc 		{"CLD",		(SIGCLD+1)|(SIGNOSET<<SIGBITS)},
316*418903ecSmarc #endif	/* SIGCLD */
317*418903ecSmarc #ifdef SIGCONT
318*418903ecSmarc 		{"CONT",	(SIGCONT+1)|(SIGNOSET<<SIGBITS)},
319*418903ecSmarc #endif	/* SIGCONT */
320*418903ecSmarc 		{"EMT",		(SIGEMT+1)},
321*418903ecSmarc 		{"ERR",		(MAXTRAP+1)|(SIGIGNORE<<SIGBITS)},
322*418903ecSmarc 		{"EXIT",	1|(SIGIGNORE<<SIGBITS)},
323*418903ecSmarc 		{"FPE",		(SIGFPE+1)},
324*418903ecSmarc 		{"HUP",		(SIGHUP+1)},
325*418903ecSmarc 		{"ILL",		(SIGILL+1)|(SIGNOSET<<SIGBITS)},
326*418903ecSmarc 		{"INT",		(SIGINT+1)|(SIGCAUGHT<<SIGBITS)},
327*418903ecSmarc #ifdef SIGIO
328*418903ecSmarc 		{"IO",		(SIGIO+1)|(SIGNOSET<<SIGBITS)},
329*418903ecSmarc #endif	/* SIGIO */
330*418903ecSmarc 		{"IOT",		(SIGIOT+1)},
331*418903ecSmarc 		{"KILL",	(SIGKILL+1)|(SIGIGNORE<<SIGBITS)},
332*418903ecSmarc #ifdef SIGPHONE
333*418903ecSmarc 		{"PHONE",	(SIGPHONE+1)|((SIGNOSET|SIGCAUGHT)<<SIGBITS)},
334*418903ecSmarc #endif	/* SIGPHONE */
335*418903ecSmarc 		{"PIPE",	(SIGPIPE+1)},
336*418903ecSmarc #ifdef SIGPOLL
337*418903ecSmarc 		{"POLL",	(SIGPOLL+1)|((SIGNOSET|SIGCAUGHT)<<SIGBITS)},
338*418903ecSmarc #endif	/* SIGPOLL */
339*418903ecSmarc #ifdef SIGPROF
340*418903ecSmarc 		{"PROF",	(SIGPROF+1)|(SIGNOSET<<SIGBITS)},
341*418903ecSmarc #endif	/* SIGPROF */
342*418903ecSmarc #ifdef SIGPWR
343*418903ecSmarc # if SIGPWR>0
344*418903ecSmarc 		{"PWR",		(SIGPWR+1)|(SIGNOSET<<SIGBITS)},
345*418903ecSmarc # endif
346*418903ecSmarc #endif	/* SIGPWR */
347*418903ecSmarc 		{"QUIT",	(SIGQUIT+1)|((SIGNOSET|SIGCAUGHT)<<SIGBITS)},
348*418903ecSmarc 		{"SEGV",	(SIGSEGV+1)},
349*418903ecSmarc #ifdef SIGSTOP
350*418903ecSmarc 		{"STOP",	(SIGSTOP+1)|(SIGNOSET<<SIGBITS)},
351*418903ecSmarc #endif	/* SIGSTOP */
352*418903ecSmarc 		{"SYS",		(SIGSYS+1)|(SIGNOSET<<SIGBITS)},
353*418903ecSmarc 		{"TERM",	(SIGTERM+1)|(SIGCAUGHT<<SIGBITS)},
354*418903ecSmarc #ifdef SIGTINT
355*418903ecSmarc 		{"TINT",	(SIGTINT+1)|(SIGNOSET<<SIGBITS)},
356*418903ecSmarc #endif	/* SIGTINT */
357*418903ecSmarc 		{"TRAP",	(SIGTRAP+1)|(SIGNOSET<<SIGBITS)},
358*418903ecSmarc #ifdef SIGTSTP
359*418903ecSmarc 		{"TSTP",	(SIGTSTP+1)|(SIGNOSET<<SIGBITS)},
360*418903ecSmarc #endif	/* SIGTSTP */
361*418903ecSmarc #ifdef SIGTTIN
362*418903ecSmarc 		{"TTIN",	(SIGTTIN+1)|(SIGNOSET<<SIGBITS)},
363*418903ecSmarc #endif	/* SIGTTIN */
364*418903ecSmarc #ifdef SIGTTOU
365*418903ecSmarc 		{"TTOU",	(SIGTTOU+1)|(SIGNOSET<<SIGBITS)},
366*418903ecSmarc #endif	/* SIGTTOU */
367*418903ecSmarc #ifdef SIGURG
368*418903ecSmarc 		{"URG",		(SIGURG+1)|(SIGNOSET<<SIGBITS)},
369*418903ecSmarc #endif	/* SIGURG */
370*418903ecSmarc #ifdef SIGUSR1
371*418903ecSmarc 		{"USR1",	(SIGUSR1+1)},
372*418903ecSmarc #endif	/* SIGUSR1 */
373*418903ecSmarc #ifdef SIGUSR2
374*418903ecSmarc 		{"USR2",	(SIGUSR2+1)},
375*418903ecSmarc #endif	/* SIGUSR2 */
376*418903ecSmarc #ifdef SIGVTALRM
377*418903ecSmarc 		{"VTALRM",	(SIGVTALRM+1)|(SIGNOSET<<SIGBITS)},
378*418903ecSmarc #endif	/* SIGVTALRM */
379*418903ecSmarc #ifdef SIGWINCH
380*418903ecSmarc 		{"WINCH",	(SIGWINCH+1)|((SIGNOSET|SIGCAUGHT)<<SIGBITS)},
381*418903ecSmarc #endif	/* SIGWINCH */
382*418903ecSmarc #ifdef SIGWIND
383*418903ecSmarc 		{"WIND",	(SIGWIND+1)|((SIGNOSET|SIGCAUGHT)<<SIGBITS)},
384*418903ecSmarc #endif	/* SIGWIND */
385*418903ecSmarc #ifdef SIGXCPU
386*418903ecSmarc 		{"XCPU",	(SIGXCPU+1)|(SIGNOSET<<SIGBITS)},
387*418903ecSmarc #endif	/* SIGXCPU */
388*418903ecSmarc #ifdef SIGXFSZ
389*418903ecSmarc 		{"XFSZ",	(SIGXFSZ+1)|(SIGNOSET<<SIGBITS)},
390*418903ecSmarc #endif	/* SIGXFSZ */
391*418903ecSmarc 		{nullstr,	0}
392*418903ecSmarc };
393*418903ecSmarc 
394*418903ecSmarc SYSTAB	sig_messages =
395*418903ecSmarc {
396*418903ecSmarc 		{"Alarm call",			(SIGALRM+1)},
397*418903ecSmarc 		{"Bus error",			(SIGBUS+1)},
398*418903ecSmarc #ifdef SIGCHLD
399*418903ecSmarc 		{"Child stopped or terminated",	(SIGCHLD+1)},
400*418903ecSmarc #endif	/* SIGCHLD */
401*418903ecSmarc #ifdef SIGCLD
402*418903ecSmarc 		{"Death of Child", 		(SIGCLD+1)},
403*418903ecSmarc #endif	/* SIGCLD */
404*418903ecSmarc #ifdef SIGCONT
405*418903ecSmarc 		{"Stopped process continued",	(SIGCONT+1)},
406*418903ecSmarc #endif	/* SIGCONT */
407*418903ecSmarc 		{"EMT trap",			(SIGEMT+1)},
408*418903ecSmarc 		{"Floating exception",		(SIGFPE+1)},
409*418903ecSmarc 		{"Hangup",			(SIGHUP+1)},
410*418903ecSmarc 		{"Illegal instruction",		(SIGILL+1)},
411*418903ecSmarc #ifdef JOBS
412*418903ecSmarc 		{"Interrupt",			(SIGINT+1)},
413*418903ecSmarc #else
414*418903ecSmarc 		{nullstr,			(SIGINT+1)},
415*418903ecSmarc #endif	/* JOBS */
416*418903ecSmarc #ifdef SIGIO
417*418903ecSmarc 		{"IO signal",			(SIGIO+1)},
418*418903ecSmarc #endif	/* SIGIO */
419*418903ecSmarc 		{"abort",			(SIGIOT+1)},
420*418903ecSmarc 		{"Killed",			(SIGKILL+1)},
421*418903ecSmarc 		{"Quit",			(SIGQUIT+1)},
422*418903ecSmarc #ifdef JOBS
423*418903ecSmarc 		{"Broken Pipe",			(SIGPIPE+1)},
424*418903ecSmarc #else
425*418903ecSmarc 		{nullstr,			(SIGPIPE+1)},
426*418903ecSmarc #endif	/* JOBS */
427*418903ecSmarc #ifdef SIGPROF
428*418903ecSmarc 		{"Profiling time alarm",	(SIGPROF+1)},
429*418903ecSmarc #endif	/* SIGPROF */
430*418903ecSmarc #ifdef SIGPWR
431*418903ecSmarc # if SIGPWR>0
432*418903ecSmarc 		{"Power fail",			(SIGPWR+1)},
433*418903ecSmarc # endif
434*418903ecSmarc #endif	/* SIGPWR */
435*418903ecSmarc 		{"Memory fault",		(SIGSEGV+1)},
436*418903ecSmarc #ifdef SIGSTOP
437*418903ecSmarc 		{"Stopped (signal)",		(SIGSTOP+1)},
438*418903ecSmarc #endif	/* SIGSTOP */
439*418903ecSmarc 		{"Bad system call", 		(SIGSYS+1)},
440*418903ecSmarc 		{"Terminated",			(SIGTERM+1)},
441*418903ecSmarc #ifdef SIGTINT
442*418903ecSmarc #ifdef JOBS
443*418903ecSmarc 		{"Interrupt",			(SIGTINT+1)},
444*418903ecSmarc #else
445*418903ecSmarc 		{nullstr,			(SIGTINT+1)},
446*418903ecSmarc #endif	/* JOBS */
447*418903ecSmarc #endif	/* SIGTINT */
448*418903ecSmarc 		{"Trace/BPT trap",		(SIGTRAP+1)},
449*418903ecSmarc #ifdef SIGTSTP
450*418903ecSmarc 		{"Stopped",			(SIGTSTP+1)},
451*418903ecSmarc #endif	/* SIGTSTP */
452*418903ecSmarc #ifdef SIGTTIN
453*418903ecSmarc 		{"Stopped (tty input)",		(SIGTTIN+1)},
454*418903ecSmarc #endif	/* SIGTTIN */
455*418903ecSmarc #ifdef SIGTTOU
456*418903ecSmarc 		{"Stopped(tty output)",		(SIGTTOU+1)},
457*418903ecSmarc #endif	/* SIGTTOU */
458*418903ecSmarc #ifdef SIGURG
459*418903ecSmarc 		{"Socket interrupt",		(SIGURG+1)},
460*418903ecSmarc #endif	/* SIGURG */
461*418903ecSmarc #ifdef SIGUSR1
462*418903ecSmarc 		{"User signal 1",		(SIGUSR1+1)},
463*418903ecSmarc #endif	/* SIGUSR1 */
464*418903ecSmarc #ifdef SIGUSR2
465*418903ecSmarc 		{"User signal 2",		(SIGUSR2+1)},
466*418903ecSmarc #endif	/* SIGUSR2 */
467*418903ecSmarc #ifdef SIGVTALRM
468*418903ecSmarc 		{"Virtual time alarm",		(SIGVTALRM+1)},
469*418903ecSmarc #endif	/* SIGVTALRM */
470*418903ecSmarc #ifdef SIGWINCH
471*418903ecSmarc 		{"Window size change", 		(SIGWINCH+1)},
472*418903ecSmarc #endif	/* SIGWINCH */
473*418903ecSmarc #ifdef SIGXCPU
474*418903ecSmarc 		{"Exceeded CPU time limit",	(SIGXCPU+1)},
475*418903ecSmarc #endif	/* SIGXCPU */
476*418903ecSmarc #ifdef SIGXFSZ
477*418903ecSmarc 		{"Exceeded file size limit",	(SIGXFSZ+1)},
478*418903ecSmarc #endif	/* SIGXFSZ */
479*418903ecSmarc 		{nullstr,	0}
480*418903ecSmarc };
481*418903ecSmarc 
482*418903ecSmarc SYSTAB option_flags=
483*418903ecSmarc {
484*418903ecSmarc 	{"allexport",		Allexp},
485*418903ecSmarc 	{"bgnice",		Bgnice},
486*418903ecSmarc 	{"emacs",		Emacs},
487*418903ecSmarc 	{"errexit",		Errflg},
488*418903ecSmarc 	{"gmacs",		Gmacs},
489*418903ecSmarc 	{"ignoreeof",		Noeof},
490*418903ecSmarc #ifdef apollo
491*418903ecSmarc 	{"inprocess",		Inproc},
492*418903ecSmarc #endif	/* apollo */
493*418903ecSmarc 	{"interactive",		Intflg},
494*418903ecSmarc 	{"keyword",		Keyflg},
495*418903ecSmarc 	{"markdirs",		Markdir},
496*418903ecSmarc 	{"monitor",		Monitor},
497*418903ecSmarc 	{"noexec",		Noexec},
498*418903ecSmarc 	{"noglob",		Noglob},
499*418903ecSmarc 	{"nounset",		Noset},
500*418903ecSmarc 	{"protected",		Privmod},
501*418903ecSmarc 	{"restricted",		Rshflg},
502*418903ecSmarc 	{"trackall",		Hashall},
503*418903ecSmarc 	{"verbose",		Readpr},
504*418903ecSmarc 	{"vi",			Editvi},
505*418903ecSmarc 	{"viraw",		Viraw},
506*418903ecSmarc 	{"xtrace",		Execpr},
507*418903ecSmarc 	{nullstr,		0}
508*418903ecSmarc };
509*418903ecSmarc 
510*418903ecSmarc #ifdef BSD
511*418903ecSmarc # ifndef apollo
512*418903ecSmarc char  *limit_names[] =
513*418903ecSmarc {
514*418903ecSmarc 	"time(seconds)   ",
515*418903ecSmarc 	"memory(kbytes)  ",
516*418903ecSmarc 	"data(kbytes)    ",
517*418903ecSmarc 	"stack(kbytes)   ",
518*418903ecSmarc 	"file(blocks)    ",
519*418903ecSmarc 	"coredump(blocks)"
520*418903ecSmarc };
521*418903ecSmarc # endif /* apollo */
522*418903ecSmarc #endif	/* BSD */
523*418903ecSmarc 
524*418903ecSmarc SYSTAB	commands=
525*418903ecSmarc {
526*418903ecSmarc 		{".",		SYSDOT},
527*418903ecSmarc 		{":",		SYSNULL},
528*418903ecSmarc 		{"[",		SYSTEST},
529*418903ecSmarc 		{ "alias",	SYSALIAS},
530*418903ecSmarc #ifdef JOBS
531*418903ecSmarc #if BSD || SXT
532*418903ecSmarc 		{ "bg",		SYSBG},
533*418903ecSmarc #endif	/* BSD */
534*418903ecSmarc #endif	/* JOBS */
535*418903ecSmarc 		{"break",	SYSBREAK},
536*418903ecSmarc 		{"cd",		SYSCD},
537*418903ecSmarc 		{"continue",	SYSCONT},
538*418903ecSmarc 		{"echo",	SYSECHO},
539*418903ecSmarc 		{"exec",	SYSEXEC},
540*418903ecSmarc 		{"exit",	SYSEXIT},
541*418903ecSmarc 		{"export",	SYSXPORT},
542*418903ecSmarc 		{"eval",	SYSEVAL},
543*418903ecSmarc 		{"fc",		SYSFC},
544*418903ecSmarc #ifdef JOBS
545*418903ecSmarc # if BSD || SXT
546*418903ecSmarc 		{"fg",		SYSFG},
547*418903ecSmarc # endif /* BSD */
548*418903ecSmarc #endif	/* JOBS */
549*418903ecSmarc #ifdef apollo
550*418903ecSmarc 		{"inlib",	SYSINLIB},
551*418903ecSmarc 		{"inprocess",	SYSINPROCESS},
552*418903ecSmarc #endif	/* apollo */
553*418903ecSmarc #ifdef JOBS
554*418903ecSmarc 		{"jobs",	SYSJOBS},
555*418903ecSmarc 		{"kill",	SYSKILL},
556*418903ecSmarc #endif	/* JOBS */
557*418903ecSmarc 		{"let",		SYSLET},
558*418903ecSmarc 		{"login",	SYSLOGIN},
559*418903ecSmarc #ifndef BSD
560*418903ecSmarc 		{"newgrp",	SYSLOGIN},
561*418903ecSmarc #endif	/* BSD */
562*418903ecSmarc 		{"print",	SYSPRINT},
563*418903ecSmarc 		{"pwd",		SYSPWD},
564*418903ecSmarc 		{"read",	SYSREAD},
565*418903ecSmarc 		{"readonly",	SYSRDONLY},
566*418903ecSmarc 		{"return",	SYSRETURN},
567*418903ecSmarc 		{"set",		SYSSET},
568*418903ecSmarc 		{"shift",	SYSSHFT},
569*418903ecSmarc 		{"test",	SYSTEST},
570*418903ecSmarc 		{"times",	SYSTIMES},
571*418903ecSmarc 		{"trap",	SYSTRAP},
572*418903ecSmarc 		{"typeset",	SYSTYPESET},
573*418903ecSmarc 		{"ulimit",	SYSULIMIT},
574*418903ecSmarc 		{"umask",	SYSUMASK},
575*418903ecSmarc 		{"unalias",	SYSUNALIAS},
576*418903ecSmarc 		{"unset",	SYSUNSET},
577*418903ecSmarc 		{"wait",	SYSWAIT},
578*418903ecSmarc 		{"whence",	SYSWHENCE},
579*418903ecSmarc 		{nullstr,		0}
580*418903ecSmarc };
581*418903ecSmarc 
582*418903ecSmarc SYSTAB	testops =
583*418903ecSmarc {
584*418903ecSmarc 		{"!=",		TEST_SNE},
585*418903ecSmarc 		{"-a",		TEST_AND},
586*418903ecSmarc 		{"-ef",		TEST_EF},
587*418903ecSmarc 		{"-eq",		TEST_EQ},
588*418903ecSmarc 		{"-ge",		TEST_GE},
589*418903ecSmarc 		{"-gt",		TEST_GT},
590*418903ecSmarc 		{"-le",		TEST_LE},
591*418903ecSmarc 		{"-lt",		TEST_LT},
592*418903ecSmarc 		{"-ne",		TEST_NE},
593*418903ecSmarc 		{"-nt",		TEST_NT},
594*418903ecSmarc 		{"-o",		TEST_OR},
595*418903ecSmarc 		{"-ot",		TEST_OT},
596*418903ecSmarc 		{"=",		TEST_SEQ},
597*418903ecSmarc 		{nullstr,	0}
598*418903ecSmarc };
599*418903ecSmarc 
600*418903ecSmarc SYSTAB	attributes =
601*418903ecSmarc {
602*418903ecSmarc 		{"export",	N_EXPORT},
603*418903ecSmarc 		{"readonly",	N_RDONLY},
604*418903ecSmarc 		{"tagged",	T_FORM},
605*418903ecSmarc #ifdef apollo
606*418903ecSmarc 		{" filename",	A_FLAG},
607*418903ecSmarc #endif	/* apollo */
608*418903ecSmarc 		{"long",	(L_FLAG|INT_GER)},
609*418903ecSmarc 		{"unsigned",	(UN_SIGN|INT_GER)},
610*418903ecSmarc 		{"function",	(BLT_NOD|INT_GER)},
611*418903ecSmarc 		{"integer",	INT_GER},
612*418903ecSmarc 		{"lowercase",	U_TO_L},
613*418903ecSmarc 		{"zerofill",	Z_FILL},
614*418903ecSmarc 		{"leftjust",	L_JUST},
615*418903ecSmarc 		{"rightjust",	R_JUST},
616*418903ecSmarc 		{"uppercase",	L_TO_U},
617*418903ecSmarc 		{nullstr,	0}
618*418903ecSmarc };
619*418903ecSmarc 
620*418903ecSmarc 
621*418903ecSmarc #ifdef BSD
622*418903ecSmarc int tty_speeds[] = {0, 50, 75, 110, 134, 150, 200, 300,
623*418903ecSmarc 			600,1200,1800,2400,9600,19200,0};
624*418903ecSmarc #endif /* BSD */
625*418903ecSmarc 
626*418903ecSmarc #ifdef MULTIBYTE
627*418903ecSmarc char int_charsize[] =
628*418903ecSmarc {
629*418903ecSmarc 	1, CCS1_IN_SIZE, CCS2_IN_SIZE, CCS3_IN_SIZE,	/* input sizes */
630*418903ecSmarc 	1, CCS1_OUT_SIZE, CCS2_OUT_SIZE, CCS3_OUT_SIZE	/* output widths */
631*418903ecSmarc };
632*418903ecSmarc #endif /* MULTIBYTE */
633*418903ecSmarc 
634