rename all the files (they weren't going to diff anyway)
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sat, 8 Jun 1991 02:13:48 +0000 (18:13 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sat, 8 Jun 1991 02:13:48 +0000 (18:13 -0800)
add function prototypes for extern functions, decls.h -> extern.h
delete btell function, VFORK #define, lots of other minor cleanups

SCCS-vsn: bin/csh/Makefile 5.21
SCCS-vsn: bin/csh/char.c 5.6
SCCS-vsn: bin/csh/csh.1 6.17
SCCS-vsn: bin/csh/csh.c 5.23
SCCS-vsn: bin/csh/csh.h 5.13
SCCS-vsn: bin/csh/dir.c 5.7
SCCS-vsn: bin/csh/dol.c 5.10
SCCS-vsn: bin/csh/err.c 5.7
SCCS-vsn: bin/csh/exec.c 5.13
SCCS-vsn: bin/csh/exp.c 5.8
SCCS-vsn: bin/csh/extern.h 5.2
SCCS-vsn: bin/csh/file.c 5.13
SCCS-vsn: bin/csh/func.c 5.16
SCCS-vsn: bin/csh/glob.c 5.16
SCCS-vsn: bin/csh/hist.c 5.6
SCCS-vsn: bin/csh/init.c 5.9
SCCS-vsn: bin/csh/lex.c 5.13
SCCS-vsn: bin/csh/misc.c 5.9
SCCS-vsn: bin/csh/parse.c 5.8
SCCS-vsn: bin/csh/proc.c 5.17
SCCS-vsn: bin/csh/sem.c 5.13
SCCS-vsn: bin/csh/set.c 5.7
SCCS-vsn: bin/csh/alloc.c 5.7
SCCS-vsn: bin/csh/const.c 5.2
SCCS-vsn: bin/csh/str.c 5.2
SCCS-vsn: bin/csh/time.c 5.10

26 files changed:
usr/src/bin/csh/Makefile
usr/src/bin/csh/alloc.c
usr/src/bin/csh/char.c
usr/src/bin/csh/const.c
usr/src/bin/csh/csh.1
usr/src/bin/csh/csh.c
usr/src/bin/csh/csh.h
usr/src/bin/csh/dir.c
usr/src/bin/csh/dol.c
usr/src/bin/csh/err.c
usr/src/bin/csh/exec.c
usr/src/bin/csh/exp.c
usr/src/bin/csh/extern.h
usr/src/bin/csh/file.c
usr/src/bin/csh/func.c
usr/src/bin/csh/glob.c
usr/src/bin/csh/hist.c
usr/src/bin/csh/init.c
usr/src/bin/csh/lex.c
usr/src/bin/csh/misc.c
usr/src/bin/csh/parse.c
usr/src/bin/csh/proc.c
usr/src/bin/csh/sem.c
usr/src/bin/csh/set.c
usr/src/bin/csh/str.c
usr/src/bin/csh/time.c

index f087ff7..ce780ae 100644 (file)
@@ -1,4 +1,4 @@
-#      @(#)Makefile    5.20 (Berkeley) %G%
+#      @(#)Makefile    5.21 (Berkeley) %G%
 #
 # C Shell with process control; VM/UNIX VAX Makefile
 # Bill Joy UC Berkeley; Jim Kulp IIASA, Austria
 #
 # C Shell with process control; VM/UNIX VAX Makefile
 # Bill Joy UC Berkeley; Jim Kulp IIASA, Austria
@@ -6,23 +6,22 @@
 # To profile, put -DPROF in DEFS and -pg in CFLAGS, and recompile.
 
 PROG=  csh
 # To profile, put -DPROF in DEFS and -pg in CFLAGS, and recompile.
 
 PROG=  csh
-CFLAGS+=-fcombine-regs -fstrength-reduce -DFILEC -DNLS \
-       -DSHORT_STRINGS -DTERMIOS -DVFORK -I${.CURDIR} -I.
-SRCS=  sh.c sh.char.c sh.dir.c sh.dol.c sh.err.c sh.exec.c sh.exp.c \
-       sh.file.c sh.func.c sh.glob.c sh.hist.c sh.init.c sh.lex.c \
-       sh.misc.c sh.parse.c sh.print.c sh.proc.c sh.sem.c sh.set.c \
-       sh.time.c tc.alloc.c tc.printf.c tc.str.c tc.const.c
+CFLAGS+=-fcombine-regs -fstrength-reduce -DFILEC -DNLS -DSHORT_STRINGS \
+       -DTERMIOS -I.
+SRCS=  csh.c char.c dir.c dol.c err.c exec.c exp.c file.c func.c glob.c \
+       hist.c init.c lex.c misc.c parse.c print.c proc.c sem.c set.c \
+       time.c tc.alloc.c tc.printf.c tc.str.c tc.const.c
 .PATH: ${.CURDIR}/../../lib/libc/stdio
 MAN1=  csh.0
 MLINKS=        csh.1 limit.1 csh.1 alias.1 csh.1 bg.1 csh.1 dirs.1 csh.1 fg.1 \
        csh.1 foreach.1 csh.1 history.1 csh.1 jobs.1 csh.1 popd.1 \
        csh.1 pushd.1 csh.1 rehash.1 csh.1 repeat.1 csh.1 suspend.1 \
        csh.1 stop.1 csh.1 source.1
 .PATH: ${.CURDIR}/../../lib/libc/stdio
 MAN1=  csh.0
 MLINKS=        csh.1 limit.1 csh.1 alias.1 csh.1 bg.1 csh.1 dirs.1 csh.1 fg.1 \
        csh.1 foreach.1 csh.1 history.1 csh.1 jobs.1 csh.1 popd.1 \
        csh.1 pushd.1 csh.1 rehash.1 csh.1 repeat.1 csh.1 suspend.1 \
        csh.1 stop.1 csh.1 source.1
-CLEANFILES+=sh.err.h tc.const.h
+CLEANFILES+=err.h tc.const.h
 
 
-tc.const.h: sh.err.h
+tc.const.h: err.h
 
 
-sh.err.h: sh.err.c
+err.h: err.c
        @rm -f $@
        @echo '/* Do not edit this file, make creates it. */' > $@
        @echo '#ifndef _h_sh_err' >> $@
        @rm -f $@
        @echo '/* Do not edit this file, make creates it. */' > $@
        @echo '#ifndef _h_sh_err' >> $@
@@ -37,6 +36,6 @@ tc.const.h: tc.const.c
            sed -e 's/Char \([a-zA-Z0-9_]*\)\(.*\)/extern Char \1[];/' | \
            sort >> $@
 
            sed -e 's/Char \([a-zA-Z0-9_]*\)\(.*\)/extern Char \1[];/' | \
            sort >> $@
 
-.depend: sh.err.h tc.const.h
+.depend: err.h tc.const.h
 
 .include <bsd.prog.mk>
 
 .include <bsd.prog.mk>
index b26c624..b967345 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)alloc.c    5.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)alloc.c    5.7 (Berkeley) %G%";
 #endif /* not lint */
 
 /*
 #endif /* not lint */
 
 /*
@@ -21,7 +21,7 @@ static char sccsid[] = "@(#)alloc.c   5.6 (Berkeley) %G%";
  * but bombs when it runs out.
  */
 
  * but bombs when it runs out.
  */
 
-#include "sh.h"
+#include "csh.h"
 
 char   *memtop = NULL;         /* PWP: top of current memory */
 char   *membot = NULL;         /* PWP: bottom of allocatable memory */
 
 char   *memtop = NULL;         /* PWP: top of current memory */
 char   *membot = NULL;         /* PWP: bottom of allocatable memory */
index 0637adf..4cb1e1c 100644 (file)
@@ -6,10 +6,10 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)char.c     5.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)char.c     5.6 (Berkeley) %G%";
 #endif /* not lint */
 
 #endif /* not lint */
 
-#include "sh.char.h"
+#include "char.h"
 
 unsigned short _cmap[256] = {
 /*     nul             soh             stx             etx     */
 
 unsigned short _cmap[256] = {
 /*     nul             soh             stx             etx     */
index 88f8274..e18b52e 100644 (file)
@@ -6,14 +6,14 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)const.c    5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)const.c    5.2 (Berkeley) %G%";
 #endif /* not lint */
 
 /*
  * tc.const.c: String constants for csh.
  */
 
 #endif /* not lint */
 
 /*
  * tc.const.c: String constants for csh.
  */
 
-#include "sh.h"
+#include "csh.h"
 
 Char STR0[]             = { '0', '\0' };
 Char STR1[]             = { '1', '\0' };
 
 Char STR0[]             = { '0', '\0' };
 Char STR1[]             = { '1', '\0' };
index 2d34a5a..4ae6949 100644 (file)
@@ -3,7 +3,7 @@
 .\"
 .\" %sccs.include.redist.man%
 .\"
 .\"
 .\" %sccs.include.redist.man%
 .\"
-.\"     @(#)csh.1      6.16 (Berkeley) %G%
+.\"     @(#)csh.1      6.17 (Berkeley) %G%
 .\"
 .Dd 
 .Dt CSH 1
 .\"
 .Dd 
 .Dt CSH 1
@@ -2008,9 +2008,10 @@ In no case are interrupts allowed when a login shell is reading the file
 .Sh AUTHOR
 William Joy.
 Job control and directory stack features first implemented by J.E. Kulp of
 .Sh AUTHOR
 William Joy.
 Job control and directory stack features first implemented by J.E. Kulp of
-I.I.A.S.A, Laxenburg, Austria,
-with different syntax than that used now.  File name completion
-code written by Ken Greer, HP Labs.
+IIASA, Laxenburg, Austria,
+with different syntax than that used now.
+File name completion code written by Ken Greer, HP Labs.
+Eight-bit implementation Christos S. Zoulas, Cornell University.
 .Sh FILES
 .Bl -tag -width /etc/passwd -compact
 .It Pa ~/.cshrc
 .Sh FILES
 .Bl -tag -width /etc/passwd -compact
 .It Pa ~/.cshrc
index 7d01f83..bdb5f83 100644 (file)
@@ -12,11 +12,12 @@ char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)csh.c      5.22 (Berkeley) %G%";
+static char sccsid[] = "@(#)csh.c      5.23 (Berkeley) %G%";
 #endif /* not lint */
 
 #endif /* not lint */
 
-#include "sh.h"
-#include "sh.dir.h"
+#include "csh.h"
+#include "dir.h"
+#include "extern.h"
 
 extern bool MapsAreInited;
 extern bool NLSMapsAreInited;
 
 extern bool MapsAreInited;
 extern bool NLSMapsAreInited;
@@ -29,6 +30,9 @@ extern bool NLSMapsAreInited;
  *
  * Jim Kulp, IIASA, Laxenburg, Austria
  * April 1980
  *
  * Jim Kulp, IIASA, Laxenburg, Austria
  * April 1980
+ *
+ * Christos Zoulas, Cornell University
+ * June, 1991
  */
 
 Char   *dumphist[] = {STRhistory, STRmh, 0, 0};
  */
 
 Char   *dumphist[] = {STRhistory, STRmh, 0, 0};
@@ -766,8 +770,10 @@ Char   *jobargv[2] = {STRjobs, 0};
  * and finally go through the normal error mechanism, which
  * gets a chance to make the shell go away.
  */
  * and finally go through the normal error mechanism, which
  * gets a chance to make the shell go away.
  */
+/* ARGSUSED */
 void
 void
-pintr()
+pintr(notused)
+       int notused;
 {
     pintr1(1);
 }
 {
     pintr1(1);
 }
@@ -947,7 +953,7 @@ process(catch)
        if (seterr)
            stderror(ERR_OLD);
 
        if (seterr)
            stderror(ERR_OLD);
 
-       execute(t, (tpgrp > 0 ? tpgrp : -1));
+       execute(t, (tpgrp > 0 ? tpgrp : -1), NULL, NULL);
 
        /*
         * Made it!
 
        /*
         * Made it!
index 14d3b01..433a6e0 100644 (file)
@@ -4,91 +4,77 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)csh.h       5.12 (Berkeley) %G%
+ *     @(#)csh.h       5.13 (Berkeley) %G%
  */
 
  */
 
-#ifdef SHORT_STRINGS
-typedef short Char;
-
-#define SAVE(a) (Strsave(str2short(a)))
-#else
-typedef char Char;
-
-#define SAVE(a) (strsave(a))
-#endif
-
-typedef void *ioctl_t;         /* Third arg of ioctl */
-typedef long sigmask_t;                /* What a signal mask is */
-
-#include <sys/types.h>
 #include <sys/param.h>
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <sys/resource.h>
 #include <sys/ioctl.h>
 #include <sys/param.h>
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <sys/resource.h>
 #include <sys/ioctl.h>
-#include <sys/file.h>
+#include <fcntl.h>
 
 #ifdef NLS
 #include <locale.h>
 #endif
 #include <time.h>
 
 #ifdef NLS
 #include <locale.h>
 #endif
 #include <time.h>
-#include <unistd.h>
-#include <stdlib.h>
 #include <limits.h>
 #include <termios.h>
 #include <errno.h>
 #include <setjmp.h>
 #include <dirent.h>
 #include <pwd.h>
 #include <limits.h>
 #include <termios.h>
 #include <errno.h>
 #include <setjmp.h>
 #include <dirent.h>
 #include <pwd.h>
+#include <unistd.h>
+#include <stdlib.h>
 #include <string.h>
 #include <string.h>
+#include "pathnames.h"
+
+#ifdef SHORT_STRINGS
+typedef short Char;
+
+#define SAVE(a) (Strsave(str2short(a)))
+#else
+typedef char Char;
+
+#define SAVE(a) (strsave(a))
+#endif
+
+typedef void *ioctl_t;         /* Third arg of ioctl */
+typedef long sigmask_t;                /* What a signal mask is */
 
 typedef void *ptr_t;
 
 
 typedef void *ptr_t;
 
+#include "tc.const.h"
+#include "local.h"
+#include "char.h"
+#include "err.h"
+
 #ifdef SYSMALLOC
 #ifdef SYSMALLOC
-#define xmalloc(i)     Malloc(i)
+#define xmalloc(i)     Malloc(i)
 #define xrealloc(p, i) Realloc(p, i)
 #define xcalloc(n, s)  Calloc(n, s)
 #define xrealloc(p, i) Realloc(p, i)
 #define xcalloc(n, s)  Calloc(n, s)
-#define xfree(p)       Free(p)
+#define xfree(p)       Free(p)
 #else
 #else
-#define xmalloc(i)     malloc(i)
+#define xmalloc(i)     malloc(i)
 #define xrealloc(p, i) realloc(p, i)
 #define xcalloc(n, s)  calloc(n, s)
 #define xrealloc(p, i) realloc(p, i)
 #define xcalloc(n, s)  calloc(n, s)
-#define xfree(p)       free(p)
+#define xfree(p)       free(p)
 #endif                         /* SYSMALLOC */
 
 #endif                         /* SYSMALLOC */
 
-#include "tc.const.h"
-
-#include "sh.local.h"
-#include "sh.char.h"
-#include "sh.err.h"
-#include "pathnames.h"
-
-
-/*
- * C shell
- *
- * Bill Joy, UC Berkeley
- * October, 1978; May 1980
- *
- * Jim Kulp, IIASA, Laxenburg Austria
- * April, 1980
- */
-
 #define        isdir(d)        ((d.st_mode & S_IFMT) == S_IFDIR)
 
 #define SIGN_EXTEND_CHAR(a) \
        ((a) & 0x80 ? ((int) (a)) | 0xffffff00 : ((int) a) & 0x000000ff)
 
 
 #define        isdir(d)        ((d.st_mode & S_IFMT) == S_IFDIR)
 
 #define SIGN_EXTEND_CHAR(a) \
        ((a) & 0x80 ? ((int) (a)) | 0xffffff00 : ((int) a) & 0x000000ff)
 
 
-
 typedef int bool;
 
 #define        eq(a, b)        (Strcmp(a, b) == 0)
 
 /* globone() flags */
 #define G_ERROR                0       /* default action: error if multiple words */
 typedef int bool;
 
 #define        eq(a, b)        (Strcmp(a, b) == 0)
 
 /* globone() flags */
 #define G_ERROR                0       /* default action: error if multiple words */
-#define G_IGNORE       1       /* ignore the rest of the words            */
-#define G_APPEND       2       /* make a sentence by cat'ing the words    */
+#define G_IGNORE       1       /* ignore the rest of the words */
+#define G_APPEND       2       /* make a sentence by cat'ing the words */
 
 /*
  * Global flags
 
 /*
  * Global flags
@@ -165,7 +151,7 @@ extern int nsrchn;
  * Ideally these should be in units which are closed across exec's
  * (this saves work) but for version 6, this is not usually possible.
  * The desired initial values for these descriptors are defined in
  * Ideally these should be in units which are closed across exec's
  * (this saves work) but for version 6, this is not usually possible.
  * The desired initial values for these descriptors are defined in
- * sh.local.h.
+ * local.h.
  */
 short   SHIN;                  /* Current shell input (script) */
 short   SHOUT;                 /* Shell output */
  */
 short   SHIN;                  /* Current shell input (script) */
 short   SHOUT;                 /* Shell output */
@@ -235,8 +221,6 @@ struct Bin {
 #define        fblocks B.Bfblocks
 #define        fbuf    B.Bfbuf
 
 #define        fblocks B.Bfblocks
 #define        fbuf    B.Bfbuf
 
-#define btell()        fseekp
-
 /*
  * The shell finds commands in loops by reseeking the input
  * For whiles, in particular, it reseeks to the beginning of the
 /*
  * The shell finds commands in loops by reseeking the input
  * For whiles, in particular, it reseeks to the beginning of the
@@ -445,11 +429,11 @@ Char    HISTSUB;          /* auto-substitute character */
  * strings.h:
  */
 #ifndef SHORT_STRINGS
  * strings.h:
  */
 #ifndef SHORT_STRINGS
-#define Strchr(a, b)           strchr(a, b)
-#define Strrchr(a, b)          strrchr(a, b)
-#define Strcat(a, b)           strcat(a, b)
+#define Strchr(a, b)           strchr(a, b)
+#define Strrchr(a, b)          strrchr(a, b)
+#define Strcat(a, b)           strcat(a, b)
 #define Strncat(a, b, c)       strncat(a, b, c)
 #define Strncat(a, b, c)       strncat(a, b, c)
-#define Strcpy(a, b)           strcpy(a, b)
+#define Strcpy(a, b)           strcpy(a, b)
 #define Strncpy(a, b, c)       strncpy(a, b, c)
 #define Strlen(a)              strlen(a)
 #define Strcmp(a, b)           strcmp(a, b)
 #define Strncpy(a, b, c)       strncpy(a, b, c)
 #define Strlen(a)              strlen(a)
 #define Strcmp(a, b)           strcmp(a, b)
@@ -466,11 +450,11 @@ Char    HISTSUB;          /* auto-substitute character */
 #define short2str(a)           (a)
 #define short2qstr(a)          (a)
 #else
 #define short2str(a)           (a)
 #define short2qstr(a)          (a)
 #else
-#define Strchr(a, b)           s_strchr(a, b)
+#define Strchr(a, b)           s_strchr(a, b)
 #define Strrchr(a, b)          s_strrchr(a, b)
 #define Strrchr(a, b)          s_strrchr(a, b)
-#define Strcat(a, b)           s_strcat(a, b)
+#define Strcat(a, b)           s_strcat(a, b)
 #define Strncat(a, b, c)       s_strncat(a, b, c)
 #define Strncat(a, b, c)       s_strncat(a, b, c)
-#define Strcpy(a, b)           s_strcpy(a, b)
+#define Strcpy(a, b)           s_strcpy(a, b)
 #define Strncpy(a, b, c)       s_strncpy(a, b, c)
 #define Strlen(a)              s_strlen(a)
 #define Strcmp(a, b)           s_strcmp(a, b)
 #define Strncpy(a, b, c)       s_strncpy(a, b, c)
 #define Strlen(a)              s_strlen(a)
 #define Strcmp(a, b)           s_strcmp(a, b)
@@ -489,14 +473,11 @@ char   *bname;
 
 #define        setname(a)      (bname = (a))
 
 
 #define        setname(a)      (bname = (a))
 
-#ifdef VFORK
 Char   *Vsav;
 Char   *Vdp;
 Char   *Vexpath;
 char  **Vt;
 
 Char   *Vsav;
 Char   *Vdp;
 Char   *Vexpath;
 char  **Vt;
 
-#endif                         /* VFORK */
-
 Char  **evalvec;
 Char   *evalp;
 
 Char  **evalvec;
 Char   *evalp;
 
@@ -520,7 +501,3 @@ Char   *STR_BSHELL;
 #endif
 Char   *STR_WORD_CHARS;
 Char  **STR_environ;
 #endif
 Char   *STR_WORD_CHARS;
 Char  **STR_environ;
-
-#include "sh.decls.h"
-
-extern char *getwd();
index 79d809f..cf4cdc9 100644 (file)
@@ -6,14 +6,14 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)dir.c      5.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)dir.c      5.7 (Berkeley) %G%";
 #endif /* not lint */
 
 #endif /* not lint */
 
-#include "sh.h"
-#include "sh.dir.h"
-/*
- * C Shell - directory management
- */
+#include "csh.h"
+#include "dir.h"
+#include "extern.h"
+
+/* Directory management. */
 
 static struct directory *dfind();
 static Char *dfollow();
 
 static struct directory *dfind();
 static Char *dfollow();
index 4ea5e7a..17da3ce 100644 (file)
@@ -6,10 +6,11 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)dol.c      5.9 (Berkeley) %G%";
+static char sccsid[] = "@(#)dol.c      5.10 (Berkeley) %G%";
 #endif /* not lint */
 
 #endif /* not lint */
 
-#include "sh.h"
+#include "csh.h"
+#include "extern.h"
 
 /*
  * These routines perform variable substitution and quoting via ' and ".
 
 /*
  * These routines perform variable substitution and quoting via ' and ".
index 649dbb5..c1ee846 100644 (file)
@@ -6,14 +6,19 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)err.c      5.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)err.c      5.7 (Berkeley) %G%";
 #endif /* not lint */
 
 #define _h_tc_err              /* Don't redefine the errors     */
 #endif /* not lint */
 
 #define _h_tc_err              /* Don't redefine the errors     */
-#include "sh.h"
+#include "csh.h"
+#include "extern.h"
+#if __STDC__
+#include <stdarg.h>
+#else
 #include <varargs.h>
 #include <varargs.h>
+#endif
 
 
-char   *seterr = (char *) 0;   /* Holds last error if there was one */
+char   *seterr = NULL; /* Holds last error if there was one */
 
 #define ERR_FLAGS      0xf0000000
 #define ERR_NAME       0x10000000
 
 #define ERR_FLAGS      0xf0000000
 #define ERR_NAME       0x10000000
@@ -252,19 +257,25 @@ static char *errorlist[] =
  * e.g. in process.
  */
 void
  * e.g. in process.
  */
 void
-/*VARARGS1*/
+#if __STDC__
+seterror(int id, ...)
+#else
 seterror(id, va_alist)
 seterror(id, va_alist)
-    int     id;
-
-va_dcl
+     int id;
+     va_dcl
+#endif
 {
     if (seterr == 0) {
 {
     if (seterr == 0) {
-       va_list va;
        char    berr[BUFSIZ];
        char    berr[BUFSIZ];
+       va_list va;
 
 
+#if __STDC__
+       va_start(va, id);
+#else
+       va_start(va);
+#endif
        if (id < 0 || id > sizeof(errorlist) / sizeof(errorlist[0]))
            id = ERR_INVALID;
        if (id < 0 || id > sizeof(errorlist) / sizeof(errorlist[0]))
            id = ERR_INVALID;
-       va_start(va);
        xvsprintf(berr, errorlist[id], va);
        va_end(va);
 
        xvsprintf(berr, errorlist[id], va);
        va_end(va);
 
@@ -291,11 +302,13 @@ va_dcl
  * place error unwinds are ever caught.
  */
 void
  * place error unwinds are ever caught.
  */
 void
-/*VARARGS*/
+#if __STDC__
+stderror(int id, ...)
+#else
 stderror(id, va_alist)
     int     id;
 stderror(id, va_alist)
     int     id;
-
-va_dcl
+    va_dcl
+#endif
 {
     va_list va;
     register Char **v;
 {
     va_list va;
     register Char **v;
@@ -327,7 +340,11 @@ va_dcl
            /* Old error. */
            xprintf("%s.\n", seterr);
        else {
            /* Old error. */
            xprintf("%s.\n", seterr);
        else {
+#if __STDC__
+           va_start(va, id);
+#else
            va_start(va);
            va_start(va);
+#endif
            xvprintf(errorlist[id], va);
            va_end(va);
            xprintf(".\n");
            xvprintf(errorlist[id], va);
            va_end(va);
            xprintf(".\n");
index da40086..7ed5a94 100644 (file)
@@ -6,10 +6,11 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)exec.c     5.12 (Berkeley) %G%";
+static char sccsid[] = "@(#)exec.c     5.13 (Berkeley) %G%";
 #endif /* not lint */
 
 #endif /* not lint */
 
-#include "sh.h"
+#include "csh.h"
+#include "extern.h"
 
 /*
  * System level search and execute of a command.
 
 /*
  * System level search and execute of a command.
@@ -49,11 +50,8 @@ static char xhash[HSHSIZ / 8];
 #define hash(a, b)     ((a) * HSHMUL + (b) & HSHMASK)
 #define bit(h, b)      ((h)[(b) >> 3] & 1 << ((b) & 7))        /* bit test */
 #define bis(h, b)      ((h)[(b) >> 3] |= 1 << ((b) & 7))       /* bit set */
 #define hash(a, b)     ((a) * HSHMUL + (b) & HSHMASK)
 #define bit(h, b)      ((h)[(b) >> 3] & 1 << ((b) & 7))        /* bit test */
 #define bis(h, b)      ((h)[(b) >> 3] |= 1 << ((b) & 7))       /* bit set */
-#ifdef VFORK
 static int hits, misses;
 
 static int hits, misses;
 
-#endif
-
 /* Dummy search path for just absolute search when no path */
 static Char *justabs[] = {STRNULL, 0};
 
 /* Dummy search path for just absolute search when no path */
 static Char *justabs[] = {STRNULL, 0};
 
@@ -94,9 +92,7 @@ doexec(t)
 
     exerr = 0;
     expath = Strsave(pv[0]);
 
     exerr = 0;
     expath = Strsave(pv[0]);
-#ifdef VFORK
     Vexpath = expath;
     Vexpath = expath;
-#endif
 
     v = adrof(STRpath);
     if (v == 0 && expath[0] != '/') {
 
     v = adrof(STRpath);
     if (v == 0 && expath[0] != '/') {
@@ -157,15 +153,11 @@ doexec(t)
     else
        pv = v->vec;
     sav = Strspl(STRslash, *av);/* / command name for postpending */
     else
        pv = v->vec;
     sav = Strspl(STRslash, *av);/* / command name for postpending */
-#ifdef VFORK
     Vsav = sav;
     Vsav = sav;
-#endif
     if (havhash)
        hashval = hashname(*av);
     i = 0;
     if (havhash)
        hashval = hashname(*av);
     i = 0;
-#ifdef VFORK
     hits++;
     hits++;
-#endif
     do {
        /*
         * Try to save time by looking at the hash table for where this command
     do {
        /*
         * Try to save time by looking at the hash table for where this command
@@ -182,28 +174,18 @@ doexec(t)
            texec(*av, av);
        else {
            dp = Strspl(*pv, sav);
            texec(*av, av);
        else {
            dp = Strspl(*pv, sav);
-#ifdef VFORK
            Vdp = dp;
            Vdp = dp;
-#endif
            texec(dp, av);
            texec(dp, av);
-#ifdef VFORK
            Vdp = 0;
            Vdp = 0;
-#endif
            xfree((ptr_t) dp);
        }
            xfree((ptr_t) dp);
        }
-#ifdef VFORK
        misses++;
        misses++;
-#endif
 cont:
        pv++;
        i++;
     } while (*pv);
 cont:
        pv++;
        i++;
     } while (*pv);
-#ifdef VFORK
     hits--;
     hits--;
-#endif
-#ifdef VFORK
     Vsav = 0;
     Vsav = 0;
-#endif
     xfree((ptr_t) sav);
     pexerr();
 }
     xfree((ptr_t) sav);
     pexerr();
 }
@@ -214,9 +196,7 @@ pexerr()
     /* Couldn't find the damn thing */
     if (expath) {
        setname(short2str(expath));
     /* Couldn't find the damn thing */
     if (expath) {
        setname(short2str(expath));
-#ifdef VFORK
        Vexpath = 0;
        Vexpath = 0;
-#endif
        xfree((ptr_t) expath);
        expath = 0;
     }
        xfree((ptr_t) expath);
        expath = 0;
     }
@@ -249,14 +229,10 @@ texec(sf, st)
     /* The order for the conversions is significant */
     t = short2blk(st);
     f = short2str(sf);
     /* The order for the conversions is significant */
     t = short2blk(st);
     f = short2str(sf);
-#ifdef VFORK
     Vt = t;
     Vt = t;
-#endif
     errno = 0;                 /* don't use a previous error */
     (void) execv(f, t);
     errno = 0;                 /* don't use a previous error */
     (void) execv(f, t);
-#ifdef VFORK
     Vt = 0;
     Vt = 0;
-#endif
     blkfree((Char **) t);
     switch (errno) {
 
     blkfree((Char **) t);
     switch (errno) {
 
@@ -308,13 +284,9 @@ texec(sf, st)
        t = short2blk(st);
        f = short2str(sf);
        xfree((ptr_t) st);
        t = short2blk(st);
        f = short2str(sf);
        xfree((ptr_t) st);
-#ifdef VFORK
        Vt = t;
        Vt = t;
-#endif
        (void) execv(f, t);
        (void) execv(f, t);
-#ifdef VFORK
        Vt = 0;
        Vt = 0;
-#endif
        blkfree((Char **) t);
        /* The sky is falling, the sky is falling! */
 
        blkfree((Char **) t);
        /* The sky is falling, the sky is falling! */
 
@@ -330,9 +302,7 @@ texec(sf, st)
            if (expath)
                xfree((ptr_t) expath);
            expath = Strsave(sf);
            if (expath)
                xfree((ptr_t) expath);
            expath = Strsave(sf);
-#ifdef VFORK
            Vexpath = expath;
            Vexpath = expath;
-#endif
        }
     }
 }
        }
     }
 }
@@ -411,7 +381,6 @@ dounhash()
     havhash = 0;
 }
 
     havhash = 0;
 }
 
-#ifdef VFORK
 void
 hashstat()
 {
 void
 hashstat()
 {
@@ -420,8 +389,6 @@ hashstat()
                hits, misses, 100 * hits / (hits + misses));
 }
 
                hits, misses, 100 * hits / (hits + misses));
 }
 
-#endif
-
 /*
  * Hash a command name.
  */
 /*
  * Hash a command name.
  */
index fb8e098..ecbd092 100644 (file)
@@ -6,10 +6,12 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)exp.c      5.7 (Berkeley) %G%";
+static char sccsid[] = "@(#)exp.c      5.8 (Berkeley) %G%";
 #endif /* not lint */
 
 #endif /* not lint */
 
-#include "sh.h"
+#include "csh.h"
+#include "dir.h"
+#include "extern.h"
 
 #define IGNORE 1       /* in ignore, it means to ignore value, just parse */
 #define NOGLOB 2       /* in ignore, it means not to globone */
 
 #define IGNORE 1       /* in ignore, it means to ignore value, just parse */
 #define NOGLOB 2       /* in ignore, it means not to globone */
@@ -584,7 +586,7 @@ evalav(v)
     t = syntax(paraml1.next, &paraml1, 0);
     if (seterr)
        stderror(ERR_OLD);
     t = syntax(paraml1.next, &paraml1, 0);
     if (seterr)
        stderror(ERR_OLD);
-    execute(t, -1);
+    execute(t, -1, NULL, NULL);
     freelex(&paraml1), freesyn(t);
 }
 
     freelex(&paraml1), freesyn(t);
 }
 
index 89496f3..159cd43 100644 (file)
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)extern.h    5.1 (Berkeley) %G%
+ *     @(#)extern.h    5.2 (Berkeley) %G%
  */
 
  */
 
+#include <sys/cdefs.h>
+
 /*
 /*
- * sh.c
+ * csh.c
  */
  */
-extern void rechist();
-extern void goodbye();
-extern void exitstat();
-extern void pintr();
-extern void pintr1();
-extern void process();
-extern void dosource();
-extern int gethdir();
-extern void importpath();
-extern void initdesc();
-extern void untty();
-#ifndef PROF
-extern void xexit();
+int    gethdir __P((Char *));
+void   dosource __P((Char **));
+void   exitstat __P((void));
+void   goodbye __P((void));
+void   importpath __P((Char *));
+void   initdesc __P((void));
+void   pintr __P((int));
+void   pintr1 __P((bool));
+void   printprompt __P((void));
+void   process __P((bool));
+void   rechist __P((void));
+void   untty __P((void));
+
+#ifdef PROF
+void done __P((int));
 #else
 #else
-extern void done();
+void xexit __P((int));
 #endif
 #endif
-extern void printprompt();
 
 /*
 
 /*
- * sh.dir.c
+ * dir.c
  */
  */
-extern void dinit();
-extern void dodirs();
-extern Char *dcanon();
-extern void dtildepr();
-extern void dtilde();
-extern void dochngd();
-extern Char *dnormalize();
-extern void dopushd();
-extern void dopopd();
-extern void dfree();
+void    dinit __P((Char *));
+void    dodirs __P((Char **));
+Char   *dcanon __P((Char *, Char *));
+void    dtildepr __P((Char *, Char *));
+void    dtilde __P((void));
+void    dochngd __P((Char **));
+Char   *dnormalize __P((Char *));
+void    dopushd __P((Char **));
+void    dopopd __P((Char **));
+struct directory;
+void    dfree __P((struct directory *));
 
 /*
 
 /*
- * sh.dol.c
+ * dol.c
  */
  */
-extern void Dfix();
-extern Char *Dfix1();
-extern void heredoc();
+void    Dfix __P((struct command *));
+Char   *Dfix1 __P((Char *));
+void    heredoc __P((Char *));
 
 /*
 
 /*
- * sh.err.c
+ * err.c
  */
  */
-extern void seterror();
-extern void stderror();
+void   seterror __P((int, ...));
+void   stderror __P((int, ...));
 
 /*
 
 /*
- * sh.exec.c
+ * exec.c
  */
  */
-extern void doexec();
-extern void execash();
-extern void xechoit();
-extern void dohash();
-extern void dounhash();
-#ifdef VFORK
-extern void hashstat();
-#endif
+void   doexec __P((struct command *));
+void   dohash __P((void));
+void   dounhash __P((void));
+void   execash __P((char **, struct command *));
+void   hashstat __P((void));
+void   xechoit __P((Char **));
 
 /*
 
 /*
- * sh.exp.c
+ * exp.c
  */
  */
-extern int exp();
-extern int exp0();
+int    exp __P((Char ***));
+int    exp0 __P((Char ***, bool));
 
 /*
 
 /*
- * sh.time.c
- */
-extern void settimes();
-
-/*
- * sh.file.c
+ * file.c
  */
 #ifdef FILEC
  */
 #ifdef FILEC
-extern int tenex();
+int    tenex __P((Char *, int));
 #endif
 
 /*
 #endif
 
 /*
- * sh.func.c
+ * func.c
  */
  */
-extern struct biltins *isbfunc();
-extern void func();
-extern void doonintr();
-extern void donohup();
-extern void dozip();
-extern void prvars();
-extern void doalias();
-extern void unalias();
-extern void dologout();
-extern void dologin();
-extern void doif();
-extern void doelse();
-extern void dogoto();
-extern void doswitch();
-extern void dobreak();
-extern void doexit();
-extern void doforeach();
-extern void dowhile();
-extern void doend();
-extern void docontin();
-extern void dorepeat();
-extern void doswbrk();
-extern int srchx();
-extern void search();
-extern void wfree();
-extern void doecho();
-extern void doglob();
-extern void dosetenv();
-extern void dounsetenv();
-extern void Setenv();
-extern void doumask();
-extern void dolimit();
-extern void dounlimit();
-extern void dosuspend();
-extern void doeval();
+void   Setenv __P((Char *, Char *));
+void   doalias __P((Char **));
+void   dobreak __P((void));
+void   docontin __P((void));
+void   doecho __P((Char **));
+void   doelse __P((void));
+void   doend __P((void));
+void   doeval __P((Char **));
+void   doexit __P((Char **));
+void   doforeach __P((Char **));
+void   doglob __P((Char **));
+void   dogoto __P((Char **));
+void   doif __P((Char **, struct command *));
+void   dolimit __P((Char **));
+void   dologin __P((Char **));
+void   dologout __P((void));
+void   donohup __P((void));
+void   doonintr __P((Char **));
+void   dorepeat __P((Char **, struct command *));
+void   dosetenv __P((Char **));
+void   dosuspend __P((void));
+void   doswbrk __P((void));
+void   doswitch __P((Char **));
+void   doumask __P((Char **));
+void   dounlimit __P((Char **));
+void   dounsetenv __P((Char **));
+void   dowhile __P((Char **));
+void   dozip __P((void));
+void   func __P((struct command *, struct biltins *));
+struct biltins *
+       isbfunc __P((struct command *));
+void   prvars __P((void));
+void   search __P((int, int, Char *));
+int    srchx __P((Char *));
+void   unalias __P((Char **));
+void   wfree __P((void));
 
 /*
 
 /*
- * sh.glob.c
+ * glob.c
  */
  */
-extern Char **globall();
-extern void ginit();
-extern void trim();
-extern int Gmatch();
-extern void Gcat();
-extern void rscan();
-extern void tglob();
-extern Char *globone();
-extern Char **dobackp();
-
-#ifdef FILEC
-extern int sortcmp();
-
-#endif
-
+Char   **dobackp __P((Char *, bool));
+void     Gcat __P((Char *, Char *));
+Char    *globone __P((Char *, int));
+int      Gmatch __P((Char *, Char *));
+void     ginit __P((void));
+Char   **globall __P((Char **));
+void     rscan __P((Char **, void (*)()));
+void     tglob __P((Char **));
+void     trim __P((Char **));
 
 /*
 
 /*
- * sh.hist.c
+ * hist.c
  */
  */
-extern void savehist();
-extern struct Hist *enthist();
-extern void dohist();
+void   dohist __P((Char **));
+struct Hist *
+       enthist __P((int, struct wordent *, bool));
+void   savehist __P((struct wordent *));
 
 /*
 
 /*
- * sh.lex.c
+ * lex.c
  */
  */
-extern int lex();
-extern void prlex();
-extern void copylex();
-extern void freelex();
-extern void addla();
-extern Char *domod();
-extern void unreadc();
-extern int readc();
-extern void bseek();
-#ifndef btell
-extern off_t btell();
-#endif
-extern void btoeof();
-extern void settell();
+void    addla __P((Char *));
+void    bseek __P((off_t));
+void    btoeof __P((void));
+void    copylex __P((struct wordent *, struct wordent *));
+Char   *domod __P((Char *, int));
+void    freelex __P((struct wordent *));
+int     lex __P((struct wordent *));
+void    prlex __P((struct wordent *));
+int     readc __P((bool));
+void    settell __P((void));
+void    unreadc __P((int));
 
 /*
 
 /*
- * sh.misc.c
+ * misc.c
  */
  */
-extern int any();
-extern char *strsave();
-extern Char **blkend();
-extern void blkpr();
-extern int number();
-extern int blklen();
-extern Char **blkcpy();
-extern Char **blkcat();
-extern void blkfree();
-extern Char **saveblk();
-extern void setzero();
-#ifndef NOTUSED
-extern char *strstr();
+int      any __P((char *, int));
+Char   **blkcat __P((Char **, Char **));
+Char   **blkcpy __P((Char **, Char **));
+Char   **blkend __P((Char **));
+void     blkfree __P((Char **));
+int      blklen __P((Char **));
+void     blkpr __P((Char **));
+Char   **blkspl __P((Char **, Char **));
+void     closem __P((void));
+Char   **copyblk __P((Char **));
+int      dcopy __P((int, int));
+int      dmove __P((int, int));
+void     donefds __P((void));
+Char     lastchr __P((Char *));
+void     lshift __P((Char **, int));
+int      number __P((Char *));
+int      prefix __P((Char *, Char *));
+Char   **saveblk __P((Char **));
+void     setzero __P((char *, int));
+Char    *strip __P((Char *));
+char    *strsave __P((char *));
+char    *strspl __P((char *, char *));
+void     udvar __P((Char *));
+
+#ifndef        NOTUSED
+char    *strstr __P((const char *, const char *));
 #endif
 #endif
-extern char *strspl();
-extern Char **blkspl();
-extern Char lastchr();
-extern void closem();
-extern void donefds();
-extern int dmove();
-extern int dcopy();
-extern void lshift();
-extern int number();
-extern Char **copyblk();
-#ifndef SHORT_STRINGS
-extern char *strend();
+#ifndef        SHORT_STRINGS
+char    *strend __P((char *));
 #endif
 #endif
-extern Char *strip();
-extern void udvar();
-extern int prefix();
 
 /*
 
 /*
- * sh.parse.c
+ * parse.c
  */
  */
-extern void alias();
-extern struct command *syntax();
-extern void freesyn();
+void   alias __P((struct wordent *));
+void   freesyn __P((struct command *));
+struct command *
+       syntax __P((struct wordent *, struct wordent *, int));
 
 /*
 
 /*
- * sh.print.c
+ * print.c
  */
  */
-extern void psecs();
-extern void pcsecs();
-extern void xputchar();
-extern int putraw();
-extern int putpure();
-extern void draino();
-extern void flush();
+void   draino __P((void));
+void   flush __P((void));
+void   pcsecs __P((long));
+void   psecs __P((long));
+int    putpure __P((int));
+int    putraw __P((int));
+void   xputchar __P((int));
 
 /*
 
 /*
- * sh.proc.c
+ * proc.c
  */
  */
-extern void pchild();
-extern void pnote();
-extern void pwait();
-extern void pjwait();
-extern void dowait();
-extern void palloc();
-extern void psavejob();
-extern void prestjob();
-extern void pendjob();
-extern void dojobs();
-extern void dofg();
-extern void dofg1();
-extern void dobg();
-extern void dobg1();
-extern void dokill();
-extern void dostop();
-extern void pstart();
-extern void panystop();
-extern struct process *pfind();
-extern void donotify();
-extern int pfork();
-extern void pgetty();
+void   dobg __P((Char **));
+void   dobg1 __P((Char **));
+void   dofg __P((Char **));
+void   dofg1 __P((Char **));
+void   dojobs __P((Char **));
+void   dokill __P((Char **));
+void   donotify __P((Char **));
+void   dostop __P((Char **));
+void   dowait __P((void));
+void   palloc __P((int, struct command *));
+void   panystop __P((bool));
+void   pchild __P((int));
+void   pendjob __P((void));
+struct process *
+       pfind __P((Char *));
+int    pfork __P((struct command *, int));
+void   pgetty __P((int, int));
+void   pjwait __P((struct process *));
+void   pnote __P((void));
+void   prestjob __P((void));
+void   psavejob __P((void));
+void   pstart __P((struct process *, int));
+void   pwait __P((void));
 
 /*
 
 /*
- * sh.sem.c
+ * sem.c
  */
  */
-extern void execute();
-extern void mypipe();
+void   execute __P((struct command *, int, int *, int *));
+void   mypipe __P((int *));
 
 /*
 
 /*
- * sh.set.c
+ * set.c
  */
  */
-extern void doset();
-extern void dolet();
-extern Char *putn();
-extern int getn();
-extern Char *value1();
-extern struct varent *adrof1();
-extern void set();
-extern void set1();
-extern void setq();
-extern void unset();
-extern void unset1();
-extern void unsetv();
-extern void setNS();
-extern void shift();
-extern void plist();
+struct varent
+       *adrof1 __P((Char *, struct varent *));
+void    doset __P((Char **));
+void    dolet __P((Char **));
+Char   *putn __P((int));
+int     getn __P((Char *));
+Char   *value1 __P((Char *, struct varent *));
+void    set __P((Char *, Char *));
+void    set1 __P((Char *, Char **, struct varent *));
+void    setq __P((Char *, Char **, struct varent *));
+void    unset __P((Char *[]));
+void    unset1 __P((Char *[], struct varent *));
+void    unsetv __P((Char *));
+void    setNS __P((Char *));
+void    shift __P((Char **));
+void    plist __P((struct varent *));
 
 /*
 
 /*
- * sh.time.c
+ * time.c
  */
  */
-extern void settimes();
-extern void dotime();
-extern void donice();
-extern void ruadd();
-extern void tvadd();
-extern void tvsub();
-extern void prusage();
+void   donice __P((Char **));
+void   dotime __P((void));
+void   prusage __P((struct rusage *, struct rusage *,
+           struct timeval *, struct timeval *));
+void   ruadd __P((struct rusage *, struct rusage *));
+void   settimes __P((void));
+void   tvadd __P((struct timeval *, struct timeval *));
+void   tvsub __P((struct timeval *, struct timeval *, struct timeval *));
 
 /*
  * tc.alloc.c
 
 /*
  * tc.alloc.c
index b4938c9..9572526 100644 (file)
@@ -6,12 +6,13 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)file.c     5.12 (Berkeley) %G%";
+static char sccsid[] = "@(#)file.c     5.13 (Berkeley) %G%";
 #endif /* not lint */
 
 #ifdef FILEC
 
 #endif /* not lint */
 
 #ifdef FILEC
 
-#include "sh.h"
+#include "csh.h"
+#include "extern.h"
 
 /*
  * Tenex style file name recognition, .. and more.
 
 /*
  * Tenex style file name recognition, .. and more.
index 0981eb2..e6bb6d8 100644 (file)
@@ -6,10 +6,11 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)func.c     5.15 (Berkeley) %G%";
+static char sccsid[] = "@(#)func.c     5.16 (Berkeley) %G%";
 #endif /* not lint */
 
 #endif /* not lint */
 
-#include "sh.h"
+#include "csh.h"
+#include "extern.h"
 
 extern char **environ;
 
 
 extern char **environ;
 
@@ -248,7 +249,7 @@ reexecute(kp)
      * pgrp's as the jobs would then have no way to get the tty (we can't give
      * it to them, and our parent wouldn't know their pgrp, etc.
      */
      * pgrp's as the jobs would then have no way to get the tty (we can't give
      * it to them, and our parent wouldn't know their pgrp, etc.
      */
-    execute(kp, (tpgrp > 0 ? tpgrp : -1), (int *) 0, (int *) 0);
+    execute(kp, (tpgrp > 0 ? tpgrp : -1), NULL, NULL);
 }
 
 void
 }
 
 void
@@ -272,7 +273,7 @@ dogoto(v)
     for (wp = whyles; wp; wp = wp->w_next)
        if (wp->w_end == 0) {
            search(T_BREAK, 0);
     for (wp = whyles; wp; wp = wp->w_next)
        if (wp->w_end == 0) {
            search(T_BREAK, 0);
-           wp->w_end = btell();
+           wp->w_end = fseekp;
        }
        else
            bseek(wp->w_end);
        }
        else
            bseek(wp->w_end);
@@ -359,7 +360,7 @@ doforeach(v)
     nwp = (struct whyle *) xcalloc(1, sizeof *nwp);
     nwp->w_fe = nwp->w_fe0 = v;
     gargv = 0;
     nwp = (struct whyle *) xcalloc(1, sizeof *nwp);
     nwp->w_fe = nwp->w_fe0 = v;
     gargv = 0;
-    nwp->w_start = btell();
+    nwp->w_start = fseekp;
     nwp->w_fename = Strsave(cp);
     nwp->w_next = whyles;
     whyles = nwp;
     nwp->w_fename = Strsave(cp);
     nwp->w_next = whyles;
     whyles = nwp;
@@ -424,7 +425,7 @@ preread()
     search(T_BREAK, 0);                /* read the expression in */
     if (setintr)
        (void) sigblock(sigmask(SIGINT));
     search(T_BREAK, 0);                /* read the expression in */
     if (setintr)
        (void) sigblock(sigmask(SIGINT));
-    whyles->w_end = btell();
+    whyles->w_end = fseekp;
 }
 
 void
 }
 
 void
@@ -432,7 +433,7 @@ doend()
 {
     if (!whyles)
        stderror(ERR_NAME | ERR_NOTWHILE);
 {
     if (!whyles)
        stderror(ERR_NAME | ERR_NOTWHILE);
-    whyles->w_end = btell();
+    whyles->w_end = fseekp;
     doagain();
 }
 
     doagain();
 }
 
@@ -734,7 +735,7 @@ toend()
 {
     if (whyles->w_end == 0) {
        search(T_BREAK, 0, NULL);
 {
     if (whyles->w_end == 0) {
        search(T_BREAK, 0, NULL);
-       whyles->w_end = btell() - 1;
+       whyles->w_end = fseekp - 1;
     }
     else
        bseek(whyles->w_end);
     }
     else
        bseek(whyles->w_end);
@@ -744,7 +745,7 @@ toend()
 void
 wfree()
 {
 void
 wfree()
 {
-    long    o = btell();
+    long    o = fseekp;
 
     while (whyles) {
        register struct whyle *wp = whyles;
 
     while (whyles) {
        register struct whyle *wp = whyles;
index 7d0a33b..0028772 100644 (file)
@@ -6,10 +6,11 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)glob.c     5.15 (Berkeley) %G%";
+static char sccsid[] = "@(#)glob.c     5.16 (Berkeley) %G%";
 #endif /* not lint */
 
 #endif /* not lint */
 
-#include "sh.h"
+#include "csh.h"
+#include "extern.h"
 #include <glob.h>
 
 static int noglob, nonomatch;
 #include <glob.h>
 
 static int noglob, nonomatch;
@@ -602,7 +603,7 @@ backeval(cp, literal)
        (void) signal(SIGTSTP, SIG_IGN);
        (void) signal(SIGTTIN, SIG_IGN);
        (void) signal(SIGTTOU, SIG_IGN);
        (void) signal(SIGTSTP, SIG_IGN);
        (void) signal(SIGTTIN, SIG_IGN);
        (void) signal(SIGTTOU, SIG_IGN);
-       execute(t, -1);
+       execute(t, -1, NULL, NULL);
        exitstat();
     }
     xfree((ptr_t) cp);
        exitstat();
     }
     xfree((ptr_t) cp);
index 3b9d76e..3c87c74 100644 (file)
@@ -6,10 +6,11 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)hist.c     5.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)hist.c     5.6 (Berkeley) %G%";
 #endif /* not lint */
 
 #endif /* not lint */
 
-#include "sh.h"
+#include "csh.h"
+#include "extern.h"
 
 static void hfree();
 static void dohist1();
 
 static void hfree();
 static void dohist1();
index 9ee67ad..81e48ac 100644 (file)
@@ -6,11 +6,12 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)init.c     5.8 (Berkeley) %G%";
+static char sccsid[] = "@(#)init.c     5.9 (Berkeley) %G%";
 #endif /* not lint */
 
 #endif /* not lint */
 
-#include "sh.h"
-#include "sh.local.h"
+#include "csh.h"
+#include "local.h"
+#include "extern.h"
 
 #define        INF     1000
 
 
 #define        INF     1000
 
@@ -40,9 +41,7 @@ struct biltins bfunc[] =
     "foreach",         doforeach,      3, INF,
     "glob",    doglob,         0, INF,
     "goto",    dogoto,         1, 1,
     "foreach",         doforeach,      3, INF,
     "glob",    doglob,         0, INF,
     "goto",    dogoto,         1, 1,
-#ifdef VFORK
     "hashstat", hashstat,      0, 0,
     "hashstat", hashstat,      0, 0,
-#endif
     "history",         dohist,         0, 2,
     "if",      doif,           1, INF,
     "jobs",    dojobs,         0, 1,
     "history",         dohist,         0, 2,
     "if",      doif,           1, INF,
     "jobs",    dojobs,         0, 1,
index 2620409..b4eba65 100644 (file)
@@ -6,11 +6,12 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)lex.c      5.12 (Berkeley) %G%";
+static char sccsid[] = "@(#)lex.c      5.13 (Berkeley) %G%";
 
 #endif                         /* not lint */
 
 
 #endif                         /* not lint */
 
-#include "sh.h"
+#include "csh.h"
+#include "extern.h"
 
 /*
  * These lexical routines read input and form lists of words.
 
 /*
  * These lexical routines read input and form lists of words.
@@ -101,7 +102,7 @@ lex(hp)
     register struct wordent *wdp;
     int     c;
 
     register struct wordent *wdp;
     int     c;
 
-    lineloc = btell();
+    lineloc = fseekp;
     hp->next = hp->prev = hp;
     hp->word = STRNULL;
     alvecp = 0, hadhist = 0;
     hp->next = hp->prev = hp;
     hp->word = STRNULL;
     alvecp = 0, hadhist = 0;
@@ -1192,7 +1193,7 @@ setexclp(cp)
 
 void
 unreadc(c)
 
 void
 unreadc(c)
-    Char    c;
+    int    c;
 {
     peekread = c;
 }
 {
     peekread = c;
 }
@@ -1468,15 +1469,6 @@ bseek(l)
     }
 }
 
     }
 }
 
-/* any similarity to bell telephone is purely accidental */
-#ifndef btell
-off_t
-btell()
-{
-    return (fseekp);
-}
-#endif
-
 void
 btoeof()
 {
 void
 btoeof()
 {
index fdb2eaa..e3b28a1 100644 (file)
@@ -6,10 +6,11 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)misc.c     5.8 (Berkeley) %G%";
+static char sccsid[] = "@(#)misc.c     5.9 (Berkeley) %G%";
 #endif /* not lint */
 
 #endif /* not lint */
 
-#include "sh.h"
+#include "csh.h"
+#include "extern.h"
 
 static int renum();
 
 
 static int renum();
 
@@ -44,7 +45,7 @@ strsave(s)
     char   *n;
     register char *p;
 
     char   *n;
     register char *p;
 
-    if (s == 0)
+    if (s == NULL)
        s = "";
     for (p = s; *p++;);
     n = p = (char *) xmalloc((size_t) ((p - s) * sizeof(char)));
        s = "";
     for (p = s; *p++;);
     n = p = (char *) xmalloc((size_t) ((p - s) * sizeof(char)));
index 4829686..cdbcc80 100644 (file)
@@ -6,10 +6,11 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)parse.c    5.7 (Berkeley) %G%";
+static char sccsid[] = "@(#)parse.c    5.8 (Berkeley) %G%";
 #endif /* not lint */
 
 #endif /* not lint */
 
-#include "sh.h"
+#include "csh.h"
+#include "extern.h"
 
 static void asyntax();
 static void asyn0();
 
 static void asyntax();
 static void asyn0();
index fcb5418..7d0ac15 100644 (file)
@@ -6,12 +6,13 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)proc.c     5.16 (Berkeley) %G%";
+static char sccsid[] = "@(#)proc.c     5.17 (Berkeley) %G%";
 #endif /* not lint */
 
 #endif /* not lint */
 
-#include "sh.h"
-#include "sh.dir.h"
-#include "sh.proc.h"
+#include "csh.h"
+#include "dir.h"
+#include "proc.h"
+#include "extern.h"
 #include <sys/wait.h>
 
 #define BIGINDEX       9       /* largest desirable job index */
 #include <sys/wait.h>
 
 #define BIGINDEX       9       /* largest desirable job index */
@@ -36,8 +37,10 @@ static void okpcntl();
  *     childs status.  Top level routines (like pwait) must be sure
  *     to mask interrupts when playing with the proclist data structures!
  */
  *     childs status.  Top level routines (like pwait) must be sure
  *     to mask interrupts when playing with the proclist data structures!
  */
+/* ARGUSED */
 void
 void
-pchild()
+pchild(notused)
+       int notused;
 {
     register struct process *pp;
     register struct process *fp;
 {
     register struct process *pp;
     register struct process *fp;
index b92c96e..4c07765 100644 (file)
@@ -6,24 +6,18 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)sem.c      5.12 (Berkeley) %G%";
+static char sccsid[] = "@(#)sem.c      5.13 (Berkeley) %G%";
 #endif /* not lint */
 
 #endif /* not lint */
 
-#include "sh.h"
-#include "sh.dir.h"
-#include "sh.proc.h"
+#include "csh.h"
+#include "dir.h"
+#include "proc.h"
+#include "extern.h"
 
 
-#ifdef VFORK
 static void vffree();
 static void vffree();
-
-#endif
 static void doio();
 static void chkclob();
 
 static void doio();
 static void chkclob();
 
-/*
- * C shell
- */
-/*VARARGS 1*/
 void
 execute(t, wanttty, pipein, pipeout)
     register struct command *t;
 void
 execute(t, wanttty, pipein, pipeout)
     register struct command *t;
@@ -36,10 +30,7 @@ execute(t, wanttty, pipein, pipeout)
 
     static sigmask_t csigmask;
 
 
     static sigmask_t csigmask;
 
-#ifdef VFORK
     static sigmask_t ocsigmask;
     static sigmask_t ocsigmask;
-
-#endif                         /* VFORK */
     static int onosigchld = 0;
     static int nosigchld = 0;
 
     static int onosigchld = 0;
     static int nosigchld = 0;
 
@@ -153,11 +144,8 @@ execute(t, wanttty, pipein, pipeout)
         */
            (bifunc && (t->t_dflg & F_PIPEIN) != 0 &&
             bifunc->bfunct == doeval))
         */
            (bifunc && (t->t_dflg & F_PIPEIN) != 0 &&
             bifunc->bfunct == doeval))
-#ifdef VFORK
            if (t->t_dtyp == NODE_PAREN ||
            if (t->t_dtyp == NODE_PAREN ||
-               t->t_dflg & (F_REPEAT | F_AMPERSAND) || bifunc)
-#endif
-           {
+               t->t_dflg & (F_REPEAT | F_AMPERSAND) || bifunc) {
                forked++;
                /*
                 * We need to block SIGCHLD here, so that if the process does
                forked++;
                /*
                 * We need to block SIGCHLD here, so that if the process does
@@ -174,8 +162,6 @@ execute(t, wanttty, pipein, pipeout)
                    nosigchld = 0;
                }
            }
                    nosigchld = 0;
                }
            }
-
-#ifdef VFORK
            else {
                int     ochild, osetintr, ohaderr, odidfds;
                int     oSHIN, oSHOUT, oSHDIAG, oOLDSTD, otpgrp;
            else {
                int     ochild, osetintr, ohaderr, odidfds;
                int     oSHIN, oSHOUT, oSHDIAG, oOLDSTD, otpgrp;
@@ -290,7 +276,6 @@ execute(t, wanttty, pipein, pipeout)
                }
 
            }
                }
 
            }
-#endif                         /* VFORK */
        if (pid != 0) {
            /*
             * It would be better if we could wait for the whole job when we
        if (pid != 0) {
            /*
             * It would be better if we could wait for the whole job when we
@@ -401,7 +386,6 @@ execute(t, wanttty, pipein, pipeout)
        donefds();
 }
 
        donefds();
 }
 
-#ifdef VFORK
 static void
 vffree()
 {
 static void
 vffree()
 {
@@ -418,8 +402,6 @@ vffree()
     _exit(1);
 }
 
     _exit(1);
 }
 
-#endif
-
 /*
  * Perform io redirection.
  * We may or maynot be forked here.
 /*
  * Perform io redirection.
  * We may or maynot be forked here.
index 22747b0..4e4fab1 100644 (file)
@@ -6,10 +6,11 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)set.c      5.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)set.c      5.7 (Berkeley) %G%";
 #endif /* not lint */
 
 #endif /* not lint */
 
-#include "sh.h"
+#include "csh.h"
+#include "extern.h"
 
 static Char *getinx();
 static void asx();
 
 static Char *getinx();
 static void asx();
index 014452b..ef31910 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)str.c      5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)str.c      5.2 (Berkeley) %G%";
 #endif /* not lint */
 
 /*
 #endif /* not lint */
 
 /*
@@ -15,7 +15,8 @@ static char sccsid[] = "@(#)str.c     5.1 (Berkeley) %G%";
  */
 #ifdef SHORT_STRINGS
 
  */
 #ifdef SHORT_STRINGS
 
-#include "sh.h"
+#include "csh.h"
+#include "extern.h"
 
 Char  **
 blk2short(src)
 
 Char  **
 blk2short(src)
index aaf7338..7a65333 100644 (file)
@@ -6,10 +6,11 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)time.c     5.9 (Berkeley) %G%";
+static char sccsid[] = "@(#)time.c     5.10 (Berkeley) %G%";
 #endif /* not lint */
 
 #endif /* not lint */
 
-#include "sh.h"
+#include "csh.h"
+#include "extern.h"
 
 /*
  * C Shell - routines handling process timing and niceing
 
 /*
  * C Shell - routines handling process timing and niceing