Sync usage with man page.
[netbsd-mini2440.git] / bin / csh / init.c
blob2a69286fa18172bb965d524503251c4932e2ffeb
1 /* $NetBSD: init.c,v 1.9 2002/05/25 23:29:16 wiz Exp $ */
3 /*-
4 * Copyright (c) 1980, 1991, 1993
5 * The Regents of the University of California. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the University nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
32 #include <sys/cdefs.h>
33 #ifndef lint
34 #if 0
35 static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 5/31/93";
36 #else
37 __RCSID("$NetBSD: init.c,v 1.9 2002/05/25 23:29:16 wiz Exp $");
38 #endif
39 #endif /* not lint */
41 #include <stdarg.h>
43 #include "csh.h"
44 #include "extern.h"
46 #define INF 1000
48 struct biltins bfunc[] =
50 { "@", dolet, 0, INF },
51 { "alias", doalias, 0, INF },
52 { "alloc", showall, 0, 1 },
53 { "bg", dobg, 0, INF },
54 { "break", dobreak, 0, 0 },
55 { "breaksw", doswbrk, 0, 0 },
56 { "case", dozip, 0, 1 },
57 { "cd", dochngd, 0, INF },
58 { "chdir", dochngd, 0, INF },
59 { "continue", docontin, 0, 0 },
60 { "default", dozip, 0, 0 },
61 { "dirs", dodirs, 0, INF },
62 { "echo", doecho, 0, INF },
63 { "else", doelse, 0, INF },
64 { "end", doend, 0, 0 },
65 { "endif", dozip, 0, 0 },
66 { "endsw", dozip, 0, 0 },
67 { "eval", doeval, 0, INF },
68 { "exec", execash, 1, INF },
69 { "exit", doexit, 0, INF },
70 { "fg", dofg, 0, INF },
71 { "foreach", doforeach, 3, INF },
72 { "glob", doglob, 0, INF },
73 { "goto", dogoto, 1, 1 },
74 { "hashstat", hashstat, 0, 0 },
75 { "history", dohist, 0, 2 },
76 { "if", doif, 1, INF },
77 { "jobs", dojobs, 0, 1 },
78 { "kill", dokill, 1, INF },
79 { "limit", dolimit, 0, 3 },
80 { "linedit", doecho, 0, INF },
81 { "login", dologin, 0, 1 },
82 { "logout", dologout, 0, 0 },
83 { "nice", donice, 0, INF },
84 { "nohup", donohup, 0, INF },
85 { "notify", donotify, 0, INF },
86 { "onintr", doonintr, 0, 2 },
87 { "popd", dopopd, 0, INF },
88 { "printf", doprintf, 1, INF },
89 { "pushd", dopushd, 0, INF },
90 { "rehash", dohash, 0, 0 },
91 { "repeat", dorepeat, 2, INF },
92 { "set", doset, 0, INF },
93 { "setenv", dosetenv, 0, 2 },
94 { "shift", shift, 0, 1 },
95 { "source", dosource, 1, 2 },
96 { "stop", dostop, 1, INF },
97 { "suspend", dosuspend, 0, 0 },
98 { "switch", doswitch, 1, INF },
99 { "time", dotime, 0, INF },
100 { "umask", doumask, 0, 1 },
101 { "unalias", unalias, 1, INF },
102 { "unhash", dounhash, 0, 0 },
103 { "unlimit", dounlimit, 0, INF },
104 { "unset", unset, 1, INF },
105 { "unsetenv", dounsetenv, 1, INF },
106 { "wait", dowait, 0, 0 },
107 { "which", dowhich, 1, INF },
108 { "while", dowhile, 1, INF }
110 int nbfunc = sizeof(bfunc) / sizeof(*bfunc);
112 struct srch srchn[] =
114 { "@", T_LET },
115 { "break", T_BREAK },
116 { "breaksw", T_BRKSW },
117 { "case", T_CASE },
118 { "default", T_DEFAULT },
119 { "else", T_ELSE },
120 { "end", T_END },
121 { "endif", T_ENDIF },
122 { "endsw", T_ENDSW },
123 { "exit", T_EXIT },
124 { "foreach", T_FOREACH },
125 { "goto", T_GOTO },
126 { "if", T_IF },
127 { "label", T_LABEL },
128 { "set", T_SET },
129 { "switch", T_SWITCH },
130 { "while", T_WHILE }
132 int nsrchn = sizeof(srchn) / sizeof(*srchn);