xref: /csrg-svn/bin/csh/init.c (revision 60765)
147823Sbostic /*-
2*60765Sbostic  * Copyright (c) 1980, 1991, 1993
3*60765Sbostic  *	The Regents of the University of California.  All rights reserved.
447823Sbostic  *
547823Sbostic  * %sccs.include.redist.c%
621936Sdist  */
721936Sdist 
817511Sedward #ifndef lint
960237Schristos /*###9 [cc] warning: `sccsid' defined but not used%%%*/
10*60765Sbostic static char sccsid[] = "@(#)init.c	8.1 (Berkeley) 05/31/93";
1147823Sbostic #endif /* not lint */
121298Sbill 
1350033Schristos #if __STDC__
1450033Schristos # include <stdarg.h>
1550033Schristos #else
1650033Schristos # include <varargs.h>
1750033Schristos #endif
1850033Schristos 
1950023Sbostic #include "csh.h"
2050023Sbostic #include "extern.h"
211298Sbill 
221298Sbill #define	INF	1000
231298Sbill 
2449992Sbostic struct biltins bfunc[] =
2549992Sbostic {
2660237Schristos     { "@", 		dolet, 		0, INF	},
2760237Schristos     { "alias", 		doalias, 	0, INF	},
2860237Schristos     { "alloc", 		showall, 	0, 1	},
2960237Schristos     { "bg", 		dobg, 		0, INF	},
3060237Schristos     { "break", 		dobreak, 	0, 0	},
3160237Schristos     { "breaksw", 	doswbrk, 	0, 0	},
3260237Schristos     { "case", 		dozip, 		0, 1	},
3360237Schristos     { "cd", 		dochngd, 	0, INF	},
3460237Schristos     { "chdir", 		dochngd, 	0, INF	},
3560237Schristos     { "continue", 	docontin, 	0, 0	},
3660237Schristos     { "default", 	dozip, 		0, 0	},
3760237Schristos     { "dirs", 		dodirs,		0, INF	},
3860237Schristos     { "echo", 		doecho,		0, INF	},
3960237Schristos     { "else", 		doelse,		0, INF	},
4060237Schristos     { "end", 		doend, 		0, 0	},
4160237Schristos     { "endif", 		dozip, 		0, 0	},
4260237Schristos     { "endsw", 		dozip, 		0, 0	},
4360237Schristos     { "eval", 		doeval, 	0, INF	},
4460237Schristos     { "exec", 		execash, 	1, INF	},
4560237Schristos     { "exit", 		doexit, 	0, INF	},
4660237Schristos     { "fg", 		dofg, 		0, INF	},
4760237Schristos     { "foreach", 	doforeach, 	3, INF	},
4860237Schristos     { "glob", 		doglob, 	0, INF	},
4960237Schristos     { "goto", 		dogoto, 	1, 1	},
5060237Schristos     { "hashstat", 	hashstat, 	0, 0	},
5160237Schristos     { "history", 	dohist, 	0, 2	},
5260237Schristos     { "if", 		doif, 		1, INF	},
5360237Schristos     { "jobs", 		dojobs, 	0, 1	},
5460237Schristos     { "kill", 		dokill, 	1, INF	},
5560237Schristos     { "limit", 		dolimit, 	0, 3	},
5660237Schristos     { "linedit", 	doecho, 	0, INF	},
5760237Schristos     { "login", 		dologin, 	0, 1	},
5860237Schristos     { "logout", 	dologout, 	0, 0	},
5960237Schristos     { "nice", 		donice, 	0, INF	},
6060237Schristos     { "nohup", 		donohup, 	0, INF	},
6160237Schristos     { "notify", 	donotify, 	0, INF	},
6260237Schristos     { "onintr", 	doonintr, 	0, 2	},
6360237Schristos     { "popd", 		dopopd, 	0, INF	},
6460237Schristos     { "printf",		doprintf,	1, INF	},
6560237Schristos     { "pushd", 		dopushd, 	0, INF	},
6660237Schristos     { "rehash", 	dohash, 	0, 0	},
6760237Schristos     { "repeat", 	dorepeat, 	2, INF	},
6860237Schristos     { "set", 		doset, 		0, INF	},
6960237Schristos     { "setenv", 	dosetenv, 	0, 2	},
7060237Schristos     { "shift", 		shift, 		0, 1	},
7160237Schristos     { "source", 	dosource, 	1, 2	},
7260237Schristos     { "stop", 		dostop, 	1, INF	},
7360237Schristos     { "suspend", 	dosuspend, 	0, 0	},
7460237Schristos     { "switch", 	doswitch, 	1, INF	},
7560237Schristos     { "time", 		dotime, 	0, INF	},
7660237Schristos     { "umask", 		doumask, 	0, 1	},
7760237Schristos     { "unalias", 	unalias, 	1, INF	},
7860237Schristos     { "unhash", 	dounhash, 	0, 0	},
7960237Schristos     { "unlimit", 	dounlimit, 	0, INF	},
8060237Schristos     { "unset", 		unset, 		1, INF	},
8160237Schristos     { "unsetenv", 	dounsetenv, 	1, INF	},
8260237Schristos     { "wait",		dowait, 	0, 0	},
8360237Schristos     { "which",		dowhich, 	1, INF	},
8460237Schristos     { "while", 		dowhile, 	1, INF	}
851298Sbill };
8649992Sbostic int     nbfunc = sizeof bfunc / sizeof *bfunc;
871298Sbill 
8849992Sbostic struct srch srchn[] =
8949992Sbostic {
9060237Schristos     { "@", 		T_LET		},
9160237Schristos     { "break", 		T_BREAK		},
9260237Schristos     { "breaksw", 	T_BRKSW		},
9360237Schristos     { "case", 		T_CASE		},
9460237Schristos     { "default", 	T_DEFAULT	},
9560237Schristos     { "else", 		T_ELSE		},
9660237Schristos     { "end", 		T_END		},
9760237Schristos     { "endif", 		T_ENDIF		},
9860237Schristos     { "endsw", 		T_ENDSW		},
9960237Schristos     { "exit", 		T_EXIT		},
10060237Schristos     { "foreach", 	T_FOREACH	},
10160237Schristos     { "goto", 		T_GOTO		},
10260237Schristos     { "if", 		T_IF		},
10360237Schristos     { "label", 		T_LABEL		},
10460237Schristos     { "set", 		T_SET		},
10560237Schristos     { "switch", 	T_SWITCH	},
10660237Schristos     { "while", 		T_WHILE		}
1071298Sbill };
10849992Sbostic int     nsrchn = sizeof srchn / sizeof *srchn;
1091298Sbill 
110