xref: /original-bsd/bin/csh/init.c (revision 93152bbe)
1 /*-
2  * Copyright (c) 1980, 1991 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)init.c	5.13 (Berkeley) 07/19/91";
10 #endif /* not lint */
11 
12 #if __STDC__
13 # include <stdarg.h>
14 #else
15 # include <varargs.h>
16 #endif
17 
18 #include "csh.h"
19 #include "extern.h"
20 
21 #define	INF	1000
22 
23 struct biltins bfunc[] =
24 {
25     "@", 	dolet, 		0, INF,
26     "alias", 	doalias, 	0, INF,
27     "alloc", 	showall, 	0, 1,
28     "bg", 	dobg, 		0, INF,
29     "break", 	dobreak, 	0, 0,
30     "breaksw", 	doswbrk, 	0, 0,
31     "case", 	dozip, 		0, 1,
32     "cd", 	dochngd, 	0, INF,
33     "chdir", 	dochngd, 	0, INF,
34     "continue", docontin, 	0, 0,
35     "default", 	dozip, 		0, 0,
36     "dirs", 	dodirs,		0, INF,
37     "echo", 	doecho,		0, INF,
38     "else", 	doelse,		0, INF,
39     "end", 	doend, 		0, 0,
40     "endif", 	dozip, 		0, 0,
41     "endsw", 	dozip, 		0, 0,
42     "eval", 	doeval, 	0, INF,
43     "exec", 	execash, 	1, INF,
44     "exit", 	doexit, 	0, INF,
45     "fg", 	dofg, 		0, INF,
46     "foreach", 	doforeach, 	3, INF,
47     "glob", 	doglob, 	0, INF,
48     "goto", 	dogoto, 	1, 1,
49     "hashstat", hashstat, 	0, 0,
50     "history", 	dohist, 	0, 2,
51     "if", 	doif, 		1, INF,
52     "jobs", 	dojobs, 	0, 1,
53     "kill", 	dokill, 	1, INF,
54     "limit", 	dolimit, 	0, 3,
55     "linedit", 	doecho, 	0, INF,
56     "login", 	dologin, 	0, 1,
57     "logout", 	dologout, 	0, 0,
58     "nice", 	donice, 	0, INF,
59     "nohup", 	donohup, 	0, INF,
60     "notify", 	donotify, 	0, INF,
61     "onintr", 	doonintr, 	0, 2,
62     "popd", 	dopopd, 	0, INF,
63     "pushd", 	dopushd, 	0, INF,
64     "rehash", 	dohash, 	0, 0,
65     "repeat", 	dorepeat, 	2, INF,
66     "set", 	doset, 		0, INF,
67     "setenv", 	dosetenv, 	0, 2,
68     "shift", 	shift, 		0, 1,
69     "source", 	dosource, 	1, 2,
70     "stop", 	dostop, 	1, INF,
71     "suspend", 	dosuspend, 	0, 0,
72     "switch", 	doswitch, 	1, INF,
73     "time", 	dotime, 	0, INF,
74     "umask", 	doumask, 	0, 1,
75     "unalias", 	unalias, 	1, INF,
76     "unhash", 	dounhash, 	0, 0,
77     "unlimit", 	dounlimit, 	0, INF,
78     "unset", 	unset, 		1, INF,
79     "unsetenv", dounsetenv, 	1, INF,
80     "wait", 	dowait, 	0, 0,
81     "while", 	dowhile, 	1, INF,
82 };
83 int     nbfunc = sizeof bfunc / sizeof *bfunc;
84 
85 struct srch srchn[] =
86 {
87     "@", 	T_LET,
88     "break", 	T_BREAK,
89     "breaksw", 	T_BRKSW,
90     "case", 	T_CASE,
91     "default", 	T_DEFAULT,
92     "else", 	T_ELSE,
93     "end", 	T_END,
94     "endif", 	T_ENDIF,
95     "endsw", 	T_ENDSW,
96     "exit", 	T_EXIT,
97     "foreach", 	T_FOREACH,
98     "goto", 	T_GOTO,
99     "if", 	T_IF,
100     "label", 	T_LABEL,
101     "set", 	T_SET,
102     "switch", 	T_SWITCH,
103     "while", 	T_WHILE,
104 };
105 int     nsrchn = sizeof srchn / sizeof *srchn;
106 
107 struct mesg mesg[] =
108 {
109      /*  0 */ 	0, 		"",
110      /*  1 */ 	"HUP", 		"Hangup",
111      /*  2 */ 	"INT", 		"Interrupt",
112      /*  3 */ 	"QUIT", 	"Quit",
113      /*  4 */ 	"ILL", 		"Illegal instruction",
114      /*  5 */ 	"TRAP", 	"Trace/BPT trap",
115      /*  6 */ 	"IOT", 		"IOT trap",
116      /*  7 */ 	"EMT", 		"EMT trap",
117      /*  8 */ 	"FPE", 		"Floating exception",
118      /*  9 */ 	"KILL", 	"Killed",
119      /* 10 */ 	"BUS", 		"Bus error",
120      /* 11 */ 	"SEGV", 	"Segmentation fault",
121      /* 12 */ 	"SYS", 		"Bad system call",
122      /* 13 */ 	"PIPE", 	"Broken pipe",
123      /* 14 */ 	"ALRM", 	"Alarm clock",
124      /* 15 */ 	"TERM", 	"Terminated",
125      /* 16 */ 	"URG", 		"Urgent condition on IO channel",
126      /* 17 */ 	"STOP", 	"Suspended (signal)",
127      /* 18 */ 	"TSTP", 	"Suspended",
128      /* 19 */ 	"CONT", 	"Continued",
129      /* 20 */ 	"CHLD", 	"Child exited",
130      /* 21 */ 	"TTIN", 	"Suspended (tty input)",
131      /* 22 */ 	"TTOU", 	"Suspended (tty output)",
132      /* 23 */ 	"IO", 		"IO possible interrupt",
133      /* 24 */ 	"XCPU", 	"Cputime limit exceeded",
134      /* 25 */ 	"XFSZ", 	"Filesize limit exceeded",
135      /* 26 */ 	"VTALRM", 	"Virtual time alarm",
136      /* 27 */ 	"PROF", 	"Profiling time alarm",
137      /* 28 */ 	"WINCH", 	"Window changed",
138      /* 29 */ 	"INFO", 	"Information request",
139      /* 30 */ 	"USR1", 	"User signal 1",
140      /* 31 */ 	"USR2", 	"User signal 2",
141      /* 32 */ 	0, 		"Signal 32",
142 };
143