Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/csh Don't depend on common declarations.



details:   https://anonhg.NetBSD.org/src/rev/9af4e485083b
branches:  trunk
changeset: 1008793:9af4e485083b
user:      joerg <joerg%NetBSD.org@localhost>
date:      Fri Apr 03 18:11:29 2020 +0000

description:
Don't depend on common declarations.

diffstat:

 bin/csh/csh.c  |   95 ++++++++++++++++++++++++++++++++++-
 bin/csh/csh.h  |  152 ++++++++++++++++++++++++++++----------------------------
 bin/csh/dir.c  |    6 +-
 bin/csh/dir.h  |    4 +-
 bin/csh/proc.c |   15 ++++-
 bin/csh/proc.h |   16 +++---
 6 files changed, 196 insertions(+), 92 deletions(-)

diffs (truncated from 557 to 300 lines):

diff -r 40b80ddb3694 -r 9af4e485083b bin/csh/csh.c
--- a/bin/csh/csh.c     Fri Apr 03 17:57:30 2020 +0000
+++ b/bin/csh/csh.c     Fri Apr 03 18:11:29 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: csh.c,v 1.49 2020/01/12 18:36:55 christos Exp $ */
+/* $NetBSD: csh.c,v 1.50 2020/04/03 18:11:29 joerg Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)csh.c      8.2 (Berkeley) 10/12/93";
 #else
-__RCSID("$NetBSD: csh.c,v 1.49 2020/01/12 18:36:55 christos Exp $");
+__RCSID("$NetBSD: csh.c,v 1.50 2020/04/03 18:11:29 joerg Exp $");
 #endif
 #endif /* not lint */
 
@@ -77,6 +77,97 @@
  * June, 1991
  */
 
+FILE *cshin, *cshout, *csherr;
+struct timespec time0;
+struct rusage ru0;
+struct varent shvhed, aliases;
+Char HISTSUB;
+int editing;
+
+int child;
+int chkstop;
+int didfds;
+int doneinp;
+int exiterr;
+int haderr;
+int havhash;
+int intact;
+int intty;
+int justpr;
+int loginsh;
+int neednote;
+int noexec;
+int pjobs;
+int setintr;
+int timflg;
+
+Char *arginp;
+Char *ffile;
+int onelflg;
+Char *shtemp;
+
+time_t chktim;
+Char *doldol;
+pid_t backpid;
+gid_t egid, gid;
+uid_t euid, uid;
+int shpgrp;
+int tpgrp;
+
+int opgrp;
+
+int SHIN;
+int SHOUT;
+int SHERR;
+int OLDSTD;
+
+jmp_buf reslab;
+
+Char *gointr;
+
+sig_t parintr;
+sig_t parterm;
+
+struct Bin B;
+
+struct Ain lineloc;
+int cantell;
+Char *lap;
+struct whyle *whyles;
+
+struct wordent *alhistp,*alhistt;
+
+int AsciiOnly;
+int gflag;
+long pnleft;
+Char *pargs;
+Char *pargcp;
+struct Hist Histlist;
+struct wordent paraml;
+int eventno;
+int lastev;
+Char HIST;
+Char HISTSUB;
+const char *bname;
+Char *Vsav;
+Char *Vdp;
+Char *Vexpath;
+char **Vt;
+Char **evalvec;
+Char *evalp;
+Char *word_chars;
+Char *STR_SHELLPATH;
+#ifdef _PATH_BSHELL
+Char *STR_BSHELL;
+#endif
+Char *STR_WORD_CHARS;
+Char **STR_environ;
+#ifdef EDIT
+EditLine *el;
+History *hi;
+#endif
+int editing;
+
 Char *dumphist[] = {STRhistory, STRmh, 0, 0};
 Char *tildehist[] = {STRsource, STRmh, STRtildothist, 0};
 
diff -r 40b80ddb3694 -r 9af4e485083b bin/csh/csh.h
--- a/bin/csh/csh.h     Fri Apr 03 17:57:30 2020 +0000
+++ b/bin/csh/csh.h     Fri Apr 03 18:11:29 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: csh.h,v 1.28 2019/01/05 16:54:00 christos Exp $ */
+/* $NetBSD: csh.h,v 1.29 2020/04/03 18:11:29 joerg Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -89,7 +89,7 @@
 #define xcalloc(n, s) Calloc(n, s)
 
 #include <stdio.h>
-FILE *cshin, *cshout, *csherr;
+extern FILE *cshin, *cshout, *csherr;
 
 #define        isdir(d) (S_ISDIR(d.st_mode))
 
@@ -103,22 +103,22 @@
 /*
  * Global flags
  */
-int child;                     /* Child shell ... errors cause exit */
-int chkstop;                   /* Warned of stopped jobs... allow exit */
-int didfds;                    /* Have setup i/o fd's for child */
-int doneinp;                   /* EOF indicator after reset from readc */
-int exiterr;                   /* Exit if error or non-zero exit status */
-int haderr;                    /* Reset was because of an error */
-int havhash;                   /* path hashing is available */
-int intact;                    /* We are interactive... therefore prompt */
-int intty;                     /* Input is a tty */
-int justpr;                    /* Just print because of :p hist mod */
-int loginsh;                   /* We are a loginsh -> .login/.logout */
-int neednote;                  /* Need to pnotify() */
-int noexec;                    /* Don't execute, just syntax check */
-int pjobs;                     /* want to print jobs if interrupted */
-int setintr;                   /* Set interrupts on/off -> Wait intr... */
-int timflg;                    /* Time the next waited for command */
+extern int child;              /* Child shell ... errors cause exit */
+extern int chkstop;            /* Warned of stopped jobs... allow exit */
+extern int didfds;             /* Have setup i/o fd's for child */
+extern int doneinp;            /* EOF indicator after reset from readc */
+extern int exiterr;            /* Exit if error or non-zero exit status */
+extern int haderr;             /* Reset was because of an error */
+extern int havhash;            /* path hashing is available */
+extern int intact;             /* We are interactive... therefore prompt */
+extern int intty;              /* Input is a tty */
+extern int justpr;             /* Just print because of :p hist mod */
+extern int loginsh;            /* We are a loginsh -> .login/.logout */
+extern int neednote;           /* Need to pnotify() */
+extern int noexec;             /* Don't execute, just syntax check */
+extern int pjobs;              /* want to print jobs if interrupted */
+extern int setintr;            /* Set interrupts on/off -> Wait intr... */
+extern int timflg;             /* Time the next waited for command */
 
 #ifdef FILEC
 extern int filec;              /* doing filename expansion */
@@ -127,33 +127,33 @@
 /*
  * Global i/o info
  */
-Char *arginp;                  /* Argument input for sh -c and internal `xx` */
-Char *ffile;                   /* Name of shell file for $0 */
-int onelflg;                   /* 2 -> need line for -t, 1 -> exit on read */
+extern Char *arginp;           /* Argument input for sh -c and internal `xx` */
+extern Char *ffile;            /* Name of shell file for $0 */
+extern int onelflg;            /* 2 -> need line for -t, 1 -> exit on read */
 
 extern char *seterr;           /* Error message from scanner/parser */
-Char *shtemp;                  /* Temp name for << shell files in /tmp */
+extern Char *shtemp;           /* Temp name for << shell files in /tmp */
 
 #include <sys/resource.h>
 #include <sys/time.h>
 #include <sys/types.h>
 
-struct timespec time0;         /* Time at which the shell started */
-struct rusage ru0;
+extern struct timespec time0;  /* Time at which the shell started */
+extern struct rusage ru0;
 
 /*
  * Miscellany
  */
-time_t chktim;                 /* Time mail last checked */
-Char *doldol;                  /* Character pid for $$ */
-pid_t backpid;                 /* Pid of the last background process */
-gid_t egid, gid;               /* Invokers gid */
-uid_t euid, uid;               /* Invokers uid */
-int shpgrp;                    /* Pgrp of shell */
-int tpgrp;                     /* Terminal process group */
+extern time_t chktim;          /* Time mail last checked */
+extern Char *doldol;           /* Character pid for $$ */
+extern pid_t backpid;          /* Pid of the last background process */
+extern gid_t egid, gid;                /* Invokers gid */
+extern uid_t euid, uid;                /* Invokers uid */
+extern int shpgrp;             /* Pgrp of shell */
+extern int tpgrp;              /* Terminal process group */
 
 /* If tpgrp is -1, leave tty alone! */
-int opgrp;                     /* Initial pgrp and tty pgrp */
+extern int opgrp;              /* Initial pgrp and tty pgrp */
 
 
 /*
@@ -163,10 +163,10 @@
  * (this saves work) but for version 6, this is not usually possible.
  * The desired initial values for these descriptors are F{SHIN,...}.
  */
-int SHIN;                      /* Current shell input (script) */
-int SHOUT;                     /* Shell output */
-int SHERR;                     /* Diagnostic output... shell errs go here */
-int OLDSTD;                    /* Old standard input (def for cmds) */
+extern int SHIN;               /* Current shell input (script) */
+extern int SHOUT;              /* Shell output */
+extern int SHERR;              /* Diagnostic output... shell errs go here */
+extern int OLDSTD;             /* Old standard input (def for cmds) */
 
 /*
  * Error control
@@ -177,7 +177,7 @@
  */
 
 #include <setjmp.h>
-jmp_buf reslab;
+extern jmp_buf reslab;
 
 #define        setexit() (setjmp(reslab))
 #define        reset() longjmp(reslab, 1)
@@ -185,11 +185,11 @@
 #define        getexit(a) (void)memcpy((a), reslab, sizeof reslab)
 #define        resexit(a) (void)memcpy(reslab, (a), sizeof reslab)
 
-Char *gointr;                  /* Label for an onintr transfer */
+extern Char *gointr;           /* Label for an onintr transfer */
 
 #include <signal.h>
-sig_t parintr;                 /* Parents interrupt catch */
-sig_t parterm;                 /* Parents terminate catch */
+extern sig_t parintr;          /* Parents interrupt catch */
+extern sig_t parterm;          /* Parents terminate catch */
 
 /*
  * Lexical definitions.
@@ -210,7 +210,7 @@
 #define        TRIM ((Char)0x7f)       /* Mask to strip quote bit */
 #endif
 
-int AsciiOnly;                 /* If set only 7 bits is expected in characters */
+extern int AsciiOnly;                  /* If set only 7 bits is expected in characters */
 
 /*
  * Each level of input has a buffered input structure.
@@ -219,13 +219,13 @@
  * In other cases, the shell buffers enough blocks to keep all loops
  * in the buffer.
  */
-struct Bin {
+extern struct Bin {
     off_t Bfseekp;             /* Seek pointer */
     off_t Bfbobp;              /* Seekp of beginning of buffers */
     off_t Bfeobp;              /* Seekp of end of buffers */
     int Bfblocks;              /* Number of buffer blocks */
     Char **Bfbuf;              /* The array of buffer blocks */
-}       B;
+} B;
 
 /*
  * This structure allows us to seek inside aliases
@@ -243,7 +243,7 @@
 #define f_seek fc._f_seek
 #define c_seek fc._c_seek
     Char **a_seek;
-} ;
+};
 extern int aret;               /* What was the last character returned */
 #define SEEKEQ(a, b) ((a)->type == (b)->type && \
                      (a)->f_seek == (b)->f_seek && \
@@ -260,9 +260,9 @@
  * For whiles, in particular, it reseeks to the beginning of the
  * line the while was on; hence the while placement restrictions.
  */
-struct Ain lineloc;
+extern struct Ain lineloc;



Home | Main Index | Thread Index | Old Index