1 #
2 /*
3  *	UNIX shell
4  *
5  *	S. R. Bourne
6  *	Bell Telephone Laboratories
7  *
8  */
9 
10 
11 #include	"defs.h"
12 #include	"sym.h"
13 #include	"pathnames.h"
14 
15 CMSG		version = "\nVERSION sys137	DATE 1978 Nov 6 14:29:22\n";
16 
17 /* error messages */
18 CMSG	badopt		= "bad option(s)";
19 CMSG	mailmsg		= "you have mail\n";
20 CMSG	nospace		= "no space";
21 CMSG	synmsg		= "syntax error";
22 
23 CMSG	badnum		= "bad number";
24 #if defined(SYSIII)
25 CMSG	badparam	= "parameter null or not set";
26 CMSG	unset		= "parameter not set";
27 #else /* V7 */
28 CMSG	badparam	= "parameter not set";
29 #endif
30 CMSG	badsub		= "bad substitution";
31 CMSG	badcreate	= "cannot create";
32 CMSG	illegal		= "illegal io";
33 CMSG	restricted	= "restricted";
34 #if defined(SYSIII)
35 CMSG	nofork		= "cannot fork: too many processes";
36 CMSG	noswap		= "cannot fork: no swap space";
37 #endif
38 CMSG	piperr		= "cannot make pipe";
39 CMSG	badopen		= "cannot open";
40 CMSG	coredump	= " - core dumped";
41 CMSG	arglist		= "arg list too long";
42 #if defined(SYSIII)
43 CMSG	argcount	= "argument count";
44 #endif
45 CMSG	txtbsy		= "text busy";
46 CMSG	toobig		= "too big";
47 CMSG	badexec		= "cannot execute";
48 CMSG	notfound	= "not found";
49 CMSG	badfile		= "bad file number";
50 CMSG	badshift	= "cannot shift";
51 CMSG	baddir		= "bad directory";
52 CMSG	badtrap		= "bad trap";
53 CMSG	memfault	= "cannot trap 11";
54 CMSG	wtfailed	= "is read only";
55 CMSG	notid		= "is not an identifier";
56 CMSG	badulimit	= "bad ulimit";
57 
58 #if defined(SYSIII)
59 /*	messages for 'builtin' functions	*/
60 CMSG	btest		= "test";
61 CMSG	badop		= "unknown operator";
62 #endif
63 
64 /* built in names */
65 CMSG	pathname	= "PATH";
66 CMSG	homename	= "HOME";
67 CMSG	mailname	= "MAIL";
68 CMSG	fngname		= "FILEMATCH";
69 CMSG	ifsname		= "IFS";
70 CMSG	ps1name		= "PS1";
71 CMSG	ps2name		= "PS2";
72 
73 /* string constants */
74 CMSG	nullstr		= "";
75 CMSG	sptbnl		= " \t\n";
76 CMSG	defpath		= _PATH_DEFPATH;
77 CMSG	colon		= ": ";
78 CMSG	minus		= "-";
79 CMSG	endoffile	= "end of file";
80 CMSG	endofline	= "newline or ;";
81 CMSG	unexpected 	= " unexpected";
82 CMSG	atline		= " at line ";
83 CMSG	devnull		= _PATH_DEVNULL;
84 CMSG	execpmsg	= "+ ";
85 CMSG	readmsg		= "> ";
86 CMSG	stdprompt	= "$ ";
87 CMSG	supprompt	= "# ";
88 CMSG	profile		= _PATH_DOTPROFILE;
89 #if defined(SYSIII)
90 CMSG	sysprofile	= _PATH_ETCPROFILE;
91 #endif
92 
93 /* tables */
94 SYSTAB reserved={
95 		{"in",		INSYM},
96 		{"esac",	ESSYM},
97 		{"case",	CASYM},
98 		{"for",		FORSYM},
99 		{"done",	ODSYM},
100 		{"if",		IFSYM},
101 		{"while",	WHSYM},
102 		{"do",		DOSYM},
103 		{"then",	THSYM},
104 		{"else",	ELSYM},
105 		{"elif",	EFSYM},
106 		{"fi",		FISYM},
107 		{"until",	UNSYM},
108 		{ "{",		BRSYM},
109 		{ "}",		KTSYM},
110 		{0,	0}
111 };
112 
113 CSTRING	sysmsg[]={
114 		0,
115 		"Hangup",
116 		0,	/* Interrupt */
117 		"Quit",
118 		"Illegal instruction",
119 		"Trace/BPT trap",
120 		"Abort trap",	/* IOT trap */
121 		"EMT trap",
122 		"Floating point exception",
123 		"Killed",
124 		"Bus error",
125 		"Memory fault",
126 		"Bad system call",
127 		0,	/* Broken pipe */
128 		"Alarm call",
129 		"Terminated",
130 		"Urgent I/O condition",
131 		"Stopped",
132 		"Stopped from terminal",
133 		"Continued",
134 		"Child exited",
135 		"Stopped on terminal input",
136 		"Stopped on terminal output",
137 		"Asynchronous I/O",
138 		"Cputime limit exceeded",
139 		"Filesize limit exceeded",
140 		"Virtual timer expired",
141 		"Profiling timer expired",
142 		"Window size changed",
143 		"Information request",
144 		"User defined signal 1",
145 		"User defined signal 2",
146 		"Thread interrupt"
147 };
148 #if defined(RENO)
149 INT		num_sysmsg = (sizeof sysmsg / sizeof sysmsg[0]);
150 #endif
151 
152 CMSG		export = "export";
153 CMSG		readonly = "readonly";
154 
155 SYSTAB	commands={
156 		{"cd",		SYSCD},
157 		{"read",	SYSREAD},
158 		{"set",		SYSSET},
159 		{":",		SYSNULL},
160 		{"trap",	SYSTRAP},
161 #if defined(ULTRIX)
162 		{"ulimit",	SYSULIMIT},
163 #endif
164 		{"login",	SYSLOGIN},
165 		{"wait",	SYSWAIT},
166 		{"eval",	SYSEVAL},
167 		{".",		SYSDOT},
168 #if defined(SYSIII)
169 		{"newgrp",	SYSNEWGRP},
170 #else /* V7 */
171 		{"newgrp",	SYSLOGIN},
172 #endif
173 		{readonly,	SYSRDONLY},
174 		{export,	SYSXPORT},
175 		{"chdir",	SYSCD},
176 		{"break",	SYSBREAK},
177 		{"continue",	SYSCONT},
178 		{"shift",	SYSSHFT},
179 		{"exit",	SYSEXIT},
180 		{"exec",	SYSEXEC},
181 		{"times",	SYSTIMES},
182 		{"umask",	SYSUMASK},
183 		{0,	0}
184 };
185 
186 #if defined(SYSIII)
187 SYSTAB	builtins={
188 		{btest,		TEST},
189 		{"[",		TEST},
190 		{0,	0}
191 };
192 #endif
193