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