Module Name: src
Committed By: joerg
Date: Fri Apr 3 18:11:29 UTC 2020
Modified Files:
src/bin/csh: csh.c csh.h dir.c dir.h proc.c proc.h
Log Message:
Don't depend on common declarations.
To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/bin/csh/csh.c
cvs rdiff -u -r1.28 -r1.29 src/bin/csh/csh.h
cvs rdiff -u -r1.32 -r1.33 src/bin/csh/dir.c
cvs rdiff -u -r1.8 -r1.9 src/bin/csh/dir.h
cvs rdiff -u -r1.38 -r1.39 src/bin/csh/proc.c
cvs rdiff -u -r1.14 -r1.15 src/bin/csh/proc.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/bin/csh/csh.c
diff -u src/bin/csh/csh.c:1.49 src/bin/csh/csh.c:1.50
--- src/bin/csh/csh.c:1.49 Sun Jan 12 18:36:55 2020
+++ src/bin/csh/csh.c Fri Apr 3 18:11:29 2020
@@ -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 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
#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 @@ __RCSID("$NetBSD: csh.c,v 1.49 2020/01/1
* 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};
Index: src/bin/csh/csh.h
diff -u src/bin/csh/csh.h:1.28 src/bin/csh/csh.h:1.29
--- src/bin/csh/csh.h:1.28 Sat Jan 5 16:54:00 2019
+++ src/bin/csh/csh.h Fri Apr 3 18:11:29 2020
@@ -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 @@ typedef void *ioctl_t; /* Third arg of
#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 @@ FILE *cshin, *cshout, *csherr;
/*
* 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 @@ extern int filec; /* doing filename exp
/*
* 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 @@ int opgrp; /* Initial pgrp and tty pgr
* (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 @@ int OLDSTD; /* Old standard input (def
*/
#include <setjmp.h>
-jmp_buf reslab;
+extern jmp_buf reslab;
#define setexit() (setjmp(reslab))
#define reset() longjmp(reslab, 1)
@@ -185,11 +185,11 @@ jmp_buf reslab;
#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 @@ sig_t parterm; /* Parents terminate ca
#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 @@ int AsciiOnly; /* If set only 7 bits i
* 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 @@ struct Ain {
#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 @@ extern int aret; /* What was the last c
* 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;
-int cantell; /* Is current source tellable ? */
+extern int cantell; /* Is current source tellable ? */
/*
* Input lines are parsed into doubly linked circular
@@ -294,7 +294,7 @@ struct wordent {
* process id's from `$$', and modified variable values (from qualifiers
* during expansion in sh.dol.c) here.
*/
-Char *lap;
+extern Char *lap;
/*
* Parser structure
@@ -393,7 +393,7 @@ extern struct srch {
* source level. Loops are implemented by seeking back in the
* input. For foreach (fe), the word list is attached here.
*/
-struct whyle {
+extern struct whyle {
struct Ain w_start; /* Point to restart loop */
struct Ain w_end; /* End of loop (0 if unknown) */
Char **w_fe, **w_fe0; /* Current/initial wordlist for fe */
@@ -406,7 +406,7 @@ struct whyle {
*
* Aliases and variables are stored in AVL balanced binary trees.
*/
-struct varent {
+extern struct varent {
Char **vec; /* Array of words which is the value */
Char *v_name; /* Name of variable/alias */
struct varent *v_link[3]; /* The links, see below */
@@ -424,14 +424,14 @@ struct varent {
* The following are for interfacing redo substitution in
* aliases to the lexical routines.
*/
-struct wordent *alhistp; /* Argument list (first) */
-struct wordent *alhistt; /* Node after last in arg list */
+extern struct wordent *alhistp; /* Argument list (first) */
+extern struct wordent *alhistt; /* Node after last in arg list */
extern Char **alvec, *alvecp; /* The (remnants of) alias vector */
/*
* Filename/command name expansion variables
*/
-int gflag; /* After tglob -> is globbing needed? */
+extern int gflag; /* After tglob -> is globbing needed? */
#define MAXVARLEN 30 /* Maximum number of char in a variable name */
@@ -446,9 +446,9 @@ extern Char **gargv; /* Pointer to the
*/
extern Char **pargv; /* Pointer to the argv list space */
extern long pargc; /* Count of arguments in pargv */
-long pnleft; /* Number of chars left in pargs */
-Char *pargs; /* Pointer to start current word */
-Char *pargcp; /* Current index into pargs */
+extern long pnleft; /* Number of chars left in pargs */
+extern Char *pargs; /* Pointer to start current word */
+extern Char *pargcp; /* Current index into pargs */
/*
* History list
@@ -461,19 +461,19 @@ Char *pargcp; /* Current index into pa
* when history substitution includes modifiers, and thrown away
* at the next discarding since their event numbers are very negative.
*/
-struct Hist {
+extern struct Hist {
struct wordent Hlex;
int Hnum;
int Href;
struct Hist *Hnext;
} Histlist;
-struct wordent paraml; /* Current lexical word list */
-int eventno; /* Next events number */
-int lastev; /* Last event reference (default) */
+extern struct wordent paraml; /* Current lexical word list */
+extern int eventno; /* Next events number */
+extern int lastev; /* Last event reference (default) */
-Char HIST; /* history invocation character */
-Char HISTSUB; /* auto-substitute character */
+extern Char HIST; /* history invocation character */
+extern Char HISTSUB; /* auto-substitute character */
/*
* strings.h:
@@ -518,39 +518,39 @@ Char HISTSUB; /* auto-substitute chara
/*
* setname is a macro to save space (see sh.err.c)
*/
-const char *bname;
+extern const char *bname;
#define setname(a) (bname = (a))
-Char *Vsav;
-Char *Vdp;
-Char *Vexpath;
-char **Vt;
+extern Char *Vsav;
+extern Char *Vdp;
+extern Char *Vexpath;
+extern char **Vt;
-Char **evalvec;
-Char *evalp;
+extern Char **evalvec;
+extern Char *evalp;
/* word_chars is set by default to WORD_CHARS but can be overridden by
the worchars variable--if unset, reverts to WORD_CHARS */
-Char *word_chars;
+extern Char *word_chars;
#define WORD_CHARS "*?_-.[]~=" /* default chars besides alnums in words */
-Char *STR_SHELLPATH;
+extern Char *STR_SHELLPATH;
#include <paths.h>
#ifdef _PATH_BSHELL
-Char *STR_BSHELL;
+extern Char *STR_BSHELL;
#endif
-Char *STR_WORD_CHARS;
-Char **STR_environ;
+extern Char *STR_WORD_CHARS;
+extern Char **STR_environ;
#ifdef EDIT
#include <histedit.h>
-EditLine *el;
-History *hi;
+extern EditLine *el;
+extern History *hi;
#endif
-int editing;
+extern int editing;
#endif /* !_CSH_H_ */
Index: src/bin/csh/dir.c
diff -u src/bin/csh/dir.c:1.32 src/bin/csh/dir.c:1.33
--- src/bin/csh/dir.c:1.32 Sat Jan 5 16:54:00 2019
+++ src/bin/csh/dir.c Fri Apr 3 18:11:29 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.c,v 1.32 2019/01/05 16:54:00 christos Exp $ */
+/* $NetBSD: dir.c,v 1.33 2020/04/03 18:11:29 joerg Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)dir.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: dir.c,v 1.32 2019/01/05 16:54:00 christos Exp $");
+__RCSID("$NetBSD: dir.c,v 1.33 2020/04/03 18:11:29 joerg Exp $");
#endif
#endif /* not lint */
@@ -66,6 +66,8 @@ int printd; /* force name to be printe
static int dirflag = 0;
+struct directory *dcwd;
+
/*
* dinit - initialize current working directory
*/
Index: src/bin/csh/dir.h
diff -u src/bin/csh/dir.h:1.8 src/bin/csh/dir.h:1.9
--- src/bin/csh/dir.h:1.8 Thu Aug 7 09:05:04 2003
+++ src/bin/csh/dir.h Fri Apr 3 18:11:29 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.h,v 1.8 2003/08/07 09:05:04 agc Exp $ */
+/* $NetBSD: dir.h,v 1.9 2020/04/03 18:11:29 joerg Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993
@@ -43,6 +43,6 @@ struct directory {
unsigned short *di_count; /* refcount of processes */
Char *di_name; /* actual name */
};
-struct directory *dcwd; /* the one we are in now */
+extern struct directory *dcwd; /* the one we are in now */
#endif /* !_DIR_H_ */
Index: src/bin/csh/proc.c
diff -u src/bin/csh/proc.c:1.38 src/bin/csh/proc.c:1.39
--- src/bin/csh/proc.c:1.38 Sat Jan 5 16:54:00 2019
+++ src/bin/csh/proc.c Fri Apr 3 18:11:29 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: proc.c,v 1.38 2019/01/05 16:54:00 christos Exp $ */
+/* $NetBSD: proc.c,v 1.39 2020/04/03 18:11:29 joerg Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)proc.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: proc.c,v 1.38 2019/01/05 16:54:00 christos Exp $");
+__RCSID("$NetBSD: proc.c,v 1.39 2020/04/03 18:11:29 joerg Exp $");
#endif
#endif /* not lint */
@@ -56,6 +56,17 @@ __RCSID("$NetBSD: proc.c,v 1.38 2019/01/
extern int insource;
+struct process proclist;
+int pnoprocesses;
+
+struct process *pholdjob;
+
+struct process *pcurrjob;
+struct process *pcurrent;
+struct process *pprevious;
+
+int pmaxindex;
+
static void pflushall(void);
static void pflush(struct process *);
static void pclrcurr(struct process *);
Index: src/bin/csh/proc.h
diff -u src/bin/csh/proc.h:1.14 src/bin/csh/proc.h:1.15
--- src/bin/csh/proc.h:1.14 Tue Jul 16 17:47:43 2013
+++ src/bin/csh/proc.h Fri Apr 3 18:11:29 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: proc.h,v 1.14 2013/07/16 17:47:43 christos Exp $ */
+/* $NetBSD: proc.h,v 1.15 2020/04/03 18:11:29 joerg Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993
@@ -90,15 +90,15 @@ struct process {
#define JOBDIR 0100 /* print job's dir if not the same */
#define AREASON 0200
-struct process proclist; /* list head of all processes */
-int pnoprocesses; /* pchild found nothing to wait for */
+extern struct process proclist; /* list head of all processes */
+extern int pnoprocesses; /* pchild found nothing to wait for */
-struct process *pholdjob; /* one level stack of current jobs */
+extern struct process *pholdjob; /* one level stack of current jobs */
-struct process *pcurrjob; /* current job */
-struct process *pcurrent; /* current job in table */
-struct process *pprevious; /* previous job in table */
+extern struct process *pcurrjob; /* current job */
+extern struct process *pcurrent; /* current job in table */
+extern struct process *pprevious; /* previous job in table */
-int pmaxindex; /* current maximum job index */
+extern int pmaxindex; /* current maximum job index */
#endif /* !_PROC_H_ */