xref: /original-bsd/bin/csh/init.c (revision b89cedda)
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 /*###9 [cc] warning: `sccsid' defined but not used%%%*/
10 static char sccsid[] = "@(#)init.c	5.16 (Berkeley) 05/22/93";
11 #endif /* not lint */
12 
13 #if __STDC__
14 # include <stdarg.h>
15 #else
16 # include <varargs.h>
17 #endif
18 
19 #include "csh.h"
20 #include "extern.h"
21 
22 #define	INF	1000
23 
24 struct biltins bfunc[] =
25 {
26     { "@", 		dolet, 		0, INF	},
27     { "alias", 		doalias, 	0, INF	},
28     { "alloc", 		showall, 	0, 1	},
29     { "bg", 		dobg, 		0, INF	},
30     { "break", 		dobreak, 	0, 0	},
31     { "breaksw", 	doswbrk, 	0, 0	},
32     { "case", 		dozip, 		0, 1	},
33     { "cd", 		dochngd, 	0, INF	},
34     { "chdir", 		dochngd, 	0, INF	},
35     { "continue", 	docontin, 	0, 0	},
36     { "default", 	dozip, 		0, 0	},
37     { "dirs", 		dodirs,		0, INF	},
38     { "echo", 		doecho,		0, INF	},
39     { "else", 		doelse,		0, INF	},
40     { "end", 		doend, 		0, 0	},
41     { "endif", 		dozip, 		0, 0	},
42     { "endsw", 		dozip, 		0, 0	},
43     { "eval", 		doeval, 	0, INF	},
44     { "exec", 		execash, 	1, INF	},
45     { "exit", 		doexit, 	0, INF	},
46     { "fg", 		dofg, 		0, INF	},
47     { "foreach", 	doforeach, 	3, INF	},
48     { "glob", 		doglob, 	0, INF	},
49     { "goto", 		dogoto, 	1, 1	},
50     { "hashstat", 	hashstat, 	0, 0	},
51     { "history", 	dohist, 	0, 2	},
52     { "if", 		doif, 		1, INF	},
53     { "jobs", 		dojobs, 	0, 1	},
54     { "kill", 		dokill, 	1, INF	},
55     { "limit", 		dolimit, 	0, 3	},
56     { "linedit", 	doecho, 	0, INF	},
57     { "login", 		dologin, 	0, 1	},
58     { "logout", 	dologout, 	0, 0	},
59     { "nice", 		donice, 	0, INF	},
60     { "nohup", 		donohup, 	0, INF	},
61     { "notify", 	donotify, 	0, INF	},
62     { "onintr", 	doonintr, 	0, 2	},
63     { "popd", 		dopopd, 	0, INF	},
64     { "printf",		doprintf,	1, INF	},
65     { "pushd", 		dopushd, 	0, INF	},
66     { "rehash", 	dohash, 	0, 0	},
67     { "repeat", 	dorepeat, 	2, INF	},
68     { "set", 		doset, 		0, INF	},
69     { "setenv", 	dosetenv, 	0, 2	},
70     { "shift", 		shift, 		0, 1	},
71     { "source", 	dosource, 	1, 2	},
72     { "stop", 		dostop, 	1, INF	},
73     { "suspend", 	dosuspend, 	0, 0	},
74     { "switch", 	doswitch, 	1, INF	},
75     { "time", 		dotime, 	0, INF	},
76     { "umask", 		doumask, 	0, 1	},
77     { "unalias", 	unalias, 	1, INF	},
78     { "unhash", 	dounhash, 	0, 0	},
79     { "unlimit", 	dounlimit, 	0, INF	},
80     { "unset", 		unset, 		1, INF	},
81     { "unsetenv", 	dounsetenv, 	1, INF	},
82     { "wait",		dowait, 	0, 0	},
83     { "which",		dowhich, 	1, INF	},
84     { "while", 		dowhile, 	1, INF	}
85 };
86 int     nbfunc = sizeof bfunc / sizeof *bfunc;
87 
88 struct srch srchn[] =
89 {
90     { "@", 		T_LET		},
91     { "break", 		T_BREAK		},
92     { "breaksw", 	T_BRKSW		},
93     { "case", 		T_CASE		},
94     { "default", 	T_DEFAULT	},
95     { "else", 		T_ELSE		},
96     { "end", 		T_END		},
97     { "endif", 		T_ENDIF		},
98     { "endsw", 		T_ENDSW		},
99     { "exit", 		T_EXIT		},
100     { "foreach", 	T_FOREACH	},
101     { "goto", 		T_GOTO		},
102     { "if", 		T_IF		},
103     { "label", 		T_LABEL		},
104     { "set", 		T_SET		},
105     { "switch", 	T_SWITCH	},
106     { "while", 		T_WHILE		}
107 };
108 int     nsrchn = sizeof srchn / sizeof *srchn;
109 
110