xref: /original-bsd/bin/csh/init.c (revision cf2124ff)
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.15 (Berkeley) 08/04/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     "printf",	doprintf,	1, INF,
64     "pushd", 	dopushd, 	0, INF,
65     "rehash", 	dohash, 	0, 0,
66     "repeat", 	dorepeat, 	2, INF,
67     "set", 	doset, 		0, INF,
68     "setenv", 	dosetenv, 	0, 2,
69     "shift", 	shift, 		0, 1,
70     "source", 	dosource, 	1, 2,
71     "stop", 	dostop, 	1, INF,
72     "suspend", 	dosuspend, 	0, 0,
73     "switch", 	doswitch, 	1, INF,
74     "time", 	dotime, 	0, INF,
75     "umask", 	doumask, 	0, 1,
76     "unalias", 	unalias, 	1, INF,
77     "unhash", 	dounhash, 	0, 0,
78     "unlimit", 	dounlimit, 	0, INF,
79     "unset", 	unset, 		1, INF,
80     "unsetenv", dounsetenv, 	1, INF,
81     "wait", 	dowait, 	0, 0,
82     "which", 	dowhich, 	1, INF,
83     "while", 	dowhile, 	1, INF,
84 };
85 int     nbfunc = sizeof bfunc / sizeof *bfunc;
86 
87 struct srch srchn[] =
88 {
89     "@", 	T_LET,
90     "break", 	T_BREAK,
91     "breaksw", 	T_BRKSW,
92     "case", 	T_CASE,
93     "default", 	T_DEFAULT,
94     "else", 	T_ELSE,
95     "end", 	T_END,
96     "endif", 	T_ENDIF,
97     "endsw", 	T_ENDSW,
98     "exit", 	T_EXIT,
99     "foreach", 	T_FOREACH,
100     "goto", 	T_GOTO,
101     "if", 	T_IF,
102     "label", 	T_LABEL,
103     "set", 	T_SET,
104     "switch", 	T_SWITCH,
105     "while", 	T_WHILE,
106 };
107 int     nsrchn = sizeof srchn / sizeof *srchn;
108 
109