home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / bsd_srcs / bin / csh / init.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-04  |  4.3 KB  |  135 lines

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