diff options
author | mortimer <mortimer@openbsd.org> | 2020-08-30 22:23:47 +0000 |
---|---|---|
committer | mortimer <mortimer@openbsd.org> | 2020-08-30 22:23:47 +0000 |
commit | 914fbe0c1fd933115836172c86a278bd38d9b391 (patch) | |
tree | 94973ce13cb6243d9f8d240e5bb26320fb299af1 /bin | |
parent | Don't include "net/netisr.h" header. It's not needed here. (diff) | |
download | wireguard-openbsd-914fbe0c1fd933115836172c86a278bd38d9b391.tar.xz wireguard-openbsd-914fbe0c1fd933115836172c86a278bd38d9b391.zip |
Fix multiple variable definitions to avoid errors with -fno-common.
ok millert@
Diffstat (limited to 'bin')
-rw-r--r-- | bin/csh/csh.c | 76 | ||||
-rw-r--r-- | bin/csh/csh.h | 150 | ||||
-rw-r--r-- | bin/csh/dir.c | 3 | ||||
-rw-r--r-- | bin/csh/dir.h | 4 | ||||
-rw-r--r-- | bin/csh/proc.c | 13 | ||||
-rw-r--r-- | bin/csh/proc.h | 16 |
6 files changed, 174 insertions, 88 deletions
diff --git a/bin/csh/csh.c b/bin/csh/csh.c index 98e665507d1..6ed362ab604 100644 --- a/bin/csh/csh.c +++ b/bin/csh/csh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: csh.c,v 1.46 2019/06/28 13:34:58 deraadt Exp $ */ +/* $OpenBSD: csh.c,v 1.47 2020/08/30 22:23:47 mortimer Exp $ */ /* $NetBSD: csh.c,v 1.14 1995/04/29 23:21:28 mycroft Exp $ */ /*- @@ -61,6 +61,80 @@ * June, 1991 */ +/* Globals from csh.h */ +struct timespec time0; +struct rusage ru0; +struct Bin B; +struct Ain lineloc; +struct whyle *whyles; +struct varent shvhed, aliases; +struct wordent *alhistp; +struct wordent *alhistt; +struct wordent paraml; +struct Hist Histlist; +FILE *cshin, *cshout, *csherr; +bool chkstop; +bool didfds; +bool doneinp; +bool exiterr; +bool child; +bool haderr; +bool intty; +bool intact; +bool justpr; +bool loginsh; +bool neednote; +bool noexec; +bool pjobs; +bool setintr; +bool timflg; +bool havhash; +bool needprompt; +Char *arginp; +int onelflg; +Char *ffile; +Char *doldol; +int backpid; +uid_t uid, euid; +gid_t gid, egid; +time_t chktim; +pid_t shpgrp; +pid_t tpgrp; +pid_t opgrp; +int SHIN; +int SHOUT; +int SHERR; +int OLDSTD; +jmp_buf reslab; +int exitset; +Char *gointr; +sig_t parintr; +sig_t parterm; +bool cantell; +Char *lap; +Char **alvec; +int gflag; +Char *pargs; +long pnleft; +Char *pargcp; +int eventno; +int lastev; +Char HIST; +Char HISTSUB; +char *bname; +Char *Vsav; +Char *Vdp; +Char *Vexpath; +char **Vt; +Char **evalvec; +Char *evalp; +Char *word_chars; +Char *STR_SHELLPATH; +Char *STR_BSHELL; +Char *STR_WORD_CHARS; +Char **STR_environ; + +/* Locals */ Char *dumphist[] = {STRhistory, STRmh, 0, 0}; Char *loadhist[] = {STRsource, STRmh, STRtildothist, 0}; diff --git a/bin/csh/csh.h b/bin/csh/csh.h index aa88f3ad1f9..aee7dbfa7a2 100644 --- a/bin/csh/csh.h +++ b/bin/csh/csh.h @@ -1,4 +1,4 @@ -/* $OpenBSD: csh.h,v 1.33 2018/09/18 17:48:22 millert Exp $ */ +/* $OpenBSD: csh.h,v 1.34 2020/08/30 22:23:47 mortimer Exp $ */ /* $NetBSD: csh.h,v 1.9 1995/03/21 09:02:40 cgd Exp $ */ /*- @@ -70,7 +70,7 @@ typedef void *ioctl_t; /* Third arg of ioctl */ #include "error.h" #include <stdio.h> -FILE *cshin, *cshout, *csherr; +extern FILE *cshin, *cshout, *csherr; #define isdir(d) (S_ISDIR(d.st_mode)) @@ -86,55 +86,55 @@ typedef int bool; /* * Global flags */ -bool chkstop; /* Warned of stopped jobs... allow exit */ -bool didfds; /* Have setup i/o fd's for child */ -bool doneinp; /* EOF indicator after reset from readc */ -bool exiterr; /* Exit if error or non-zero exit status */ -bool child; /* Child shell ... errors cause exit */ -bool haderr; /* Reset was because of an error */ -bool intty; /* Input is a tty */ -bool intact; /* We are interactive... therefore prompt */ -bool justpr; /* Just print because of :p hist mod */ -bool loginsh; /* We are a loginsh -> .login/.logout */ -bool neednote; /* Need to pnotify() */ -bool noexec; /* Don't execute, just syntax check */ -bool pjobs; /* want to print jobs if interrupted */ -bool setintr; /* Set interrupts on/off -> Wait intr... */ -bool timflg; /* Time the next waited for command */ -bool havhash; /* path hashing is available */ - -bool filec; /* doing filename expansion */ -bool needprompt; /* print prompt, used by filec */ +extern bool chkstop; /* Warned of stopped jobs... allow exit */ +extern bool didfds; /* Have setup i/o fd's for child */ +extern bool doneinp; /* EOF indicator after reset from readc */ +extern bool exiterr; /* Exit if error or non-zero exit status */ +extern bool child; /* Child shell ... errors cause exit */ +extern bool haderr; /* Reset was because of an error */ +extern bool intty; /* Input is a tty */ +extern bool intact; /* We are interactive... therefore prompt */ +extern bool justpr; /* Just print because of :p hist mod */ +extern bool loginsh; /* We are a loginsh -> .login/.logout */ +extern bool neednote; /* Need to pnotify() */ +extern bool noexec; /* Don't execute, just syntax check */ +extern bool pjobs; /* want to print jobs if interrupted */ +extern bool setintr; /* Set interrupts on/off -> Wait intr... */ +extern bool timflg; /* Time the next waited for command */ +extern bool havhash; /* path hashing is available */ + +extern bool filec; /* doing filename expansion */ +extern bool needprompt; /* print prompt, used by filec */ /* * Global i/o info */ -Char *arginp; /* Argument input for sh -c and internal `xx` */ -int onelflg; /* 2 -> need line for -t, 1 -> exit on read */ -Char *ffile; /* Name of shell file for $0 */ +extern Char *arginp; /* Argument input for sh -c and internal `xx` */ +extern int onelflg; /* 2 -> need line for -t, 1 -> exit on read */ +extern Char *ffile; /* Name of shell file for $0 */ -char *seterr; /* Error message from scanner/parser */ +extern char *seterr; /* Error message from scanner/parser */ #include <sys/types.h> #include <sys/time.h> #include <sys/resource.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 */ -Char *doldol; /* Character pid for $$ */ -int backpid; /* Pid of the last background process */ -uid_t uid, euid; /* Invokers uid */ -gid_t gid, egid; /* Invokers gid */ -time_t chktim; /* Time mail last checked */ -pid_t shpgrp; /* Pgrp of shell */ -pid_t tpgrp; /* Terminal process group */ +extern Char *doldol; /* Character pid for $$ */ +extern int backpid; /* Pid of the last background process */ +extern uid_t uid, euid; /* Invokers uid */ +extern gid_t gid, egid; /* Invokers gid */ +extern time_t chktim; /* Time mail last checked */ +extern pid_t shpgrp; /* Pgrp of shell */ +extern pid_t tpgrp; /* Terminal process group */ /* If tpgrp is -1, leave tty alone! */ -pid_t opgrp; /* Initial pgrp and tty pgrp */ +extern pid_t opgrp; /* Initial pgrp and tty pgrp */ /* @@ -144,10 +144,10 @@ pid_t opgrp; /* Initial pgrp and tty pgrp */ * (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 @@ -158,8 +158,8 @@ int OLDSTD; /* Old standard input (def for cmds) */ */ #include <setjmp.h> -jmp_buf reslab; -int exitset; +extern jmp_buf reslab; +extern int exitset; #define setexit() (setjmp(reslab)) #define reset() longjmp(reslab, 1) @@ -167,11 +167,11 @@ int exitset; #define getexit(a) memcpy((a), reslab, sizeof reslab) #define resexit(a) 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. @@ -192,7 +192,7 @@ sig_t parterm; /* Parents terminate catch */ * 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 */ @@ -233,9 +233,9 @@ extern int aret; /* What was the last character returned */ * For whiles, in particular, it re-seeks to the beginning of the * line the while was on; hence the while placement restrictions. */ -struct Ain lineloc; +extern struct Ain lineloc; -bool cantell; /* Is current source tellable ? */ +extern bool cantell; /* Is current source tellable ? */ /* * Input lines are parsed into doubly linked circular @@ -267,7 +267,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 @@ -365,7 +365,7 @@ extern int nsrchn; * 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 */ @@ -378,7 +378,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 */ @@ -398,14 +398,14 @@ struct varent *adrof1(Char *, 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 */ -Char **alvec, *alvecp; /* The (remnants of) alias vector */ +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 */ @@ -420,9 +420,9 @@ extern long gargc; /* Number args in gargv */ */ extern Char **pargv; /* Pointer to the argv list space */ extern long pargc; /* Count of arguments in pargv */ -Char *pargs; /* Pointer to start current word */ -long pnleft; /* Number of chars left in pargs */ -Char *pargcp; /* Current index into pargs */ +extern Char *pargs; /* Pointer to start current word */ +extern long pnleft; /* Number of chars left in pargs */ +extern Char *pargcp; /* Current index into pargs */ /* * History list @@ -435,45 +435,45 @@ Char *pargcp; /* Current index into pargs */ * 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 */ /* * setname is a macro to save space (see sh.err.c) */ -char *bname; +extern 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> -Char *STR_BSHELL; -Char *STR_WORD_CHARS; -Char **STR_environ; +extern Char *STR_BSHELL; +extern Char *STR_WORD_CHARS; +extern Char **STR_environ; diff --git a/bin/csh/dir.c b/bin/csh/dir.c index d66fc677c8f..2453531aa94 100644 --- a/bin/csh/dir.c +++ b/bin/csh/dir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dir.c,v 1.24 2019/06/28 13:34:58 deraadt Exp $ */ +/* $OpenBSD: dir.c,v 1.25 2020/08/30 22:23:47 mortimer Exp $ */ /* $NetBSD: dir.c,v 1.9 1995/03/21 09:02:42 cgd Exp $ */ /*- @@ -53,6 +53,7 @@ static void dnewcwd(struct directory *); static void dset(Char *); struct directory dhead; /* "head" of loop */ +struct directory *dcwd; /* the one we are in now */ int printd; /* force name to be printed */ static int dirflag = 0; diff --git a/bin/csh/dir.h b/bin/csh/dir.h index 552357e1027..fd4f5b62498 100644 --- a/bin/csh/dir.h +++ b/bin/csh/dir.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dir.h,v 1.3 2003/06/02 23:32:07 millert Exp $ */ +/* $OpenBSD: dir.h,v 1.4 2020/08/30 22:23:47 mortimer Exp $ */ /* $NetBSD: dir.h,v 1.6 1995/03/21 09:02:44 cgd Exp $ */ /*- @@ -41,4 +41,4 @@ 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 */ diff --git a/bin/csh/proc.c b/bin/csh/proc.c index 44274cc2744..03a8ff4e673 100644 --- a/bin/csh/proc.c +++ b/bin/csh/proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.c,v 1.33 2019/06/28 13:34:58 deraadt Exp $ */ +/* $OpenBSD: proc.c,v 1.34 2020/08/30 22:23:47 mortimer Exp $ */ /* $NetBSD: proc.c,v 1.9 1995/04/29 23:21:33 mycroft Exp $ */ /*- @@ -46,6 +46,17 @@ #define BIGINDEX 9 /* largest desirable job index */ +struct process proclist; /* list head of all processes */ +bool pnoprocesses; /* pchild found nothing to wait for */ + +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 */ + +int pmaxindex; /* current maximum job index */ + static struct rusage zru; static void pflushall(void); diff --git a/bin/csh/proc.h b/bin/csh/proc.h index 705cceae83c..a3f76d05972 100644 --- a/bin/csh/proc.h +++ b/bin/csh/proc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.h,v 1.4 2017/07/22 09:37:21 anton Exp $ */ +/* $OpenBSD: proc.h,v 1.5 2020/08/30 22:23:47 mortimer Exp $ */ /* $NetBSD: proc.h,v 1.7 1995/04/29 23:21:35 mycroft Exp $ */ /*- @@ -88,13 +88,13 @@ struct process { #define JOBDIR 0100 /* print job's dir if not the same */ #define AREASON 0200 -struct process proclist; /* list head of all processes */ -bool pnoprocesses; /* pchild found nothing to wait for */ +extern struct process proclist; /* list head of all processes */ +extern bool 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 */ |