Delint (partially).
This commit is contained in:
parent
2e7f98d7b4
commit
5924694d3a
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: csh.c,v 1.21 1998/07/28 02:23:37 mycroft Exp $ */
|
||||
/* $NetBSD: csh.c,v 1.22 1998/07/28 02:47:19 mycroft Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1991, 1993
|
||||
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1991, 1993\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)csh.c 8.2 (Berkeley) 10/12/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: csh.c,v 1.21 1998/07/28 02:23:37 mycroft Exp $");
|
||||
__RCSID("$NetBSD: csh.c,v 1.22 1998/07/28 02:47:19 mycroft Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -71,9 +71,6 @@ __RCSID("$NetBSD: csh.c,v 1.21 1998/07/28 02:23:37 mycroft Exp $");
|
||||
#include "extern.h"
|
||||
#include "pathnames.h"
|
||||
|
||||
extern bool MapsAreInited;
|
||||
extern bool NLSMapsAreInited;
|
||||
|
||||
/*
|
||||
* C Shell
|
||||
*
|
||||
@ -100,7 +97,6 @@ bool batch = 0;
|
||||
bool mflag = 0;
|
||||
bool prompt = 1;
|
||||
bool enterhist = 0;
|
||||
bool tellwhat = 0;
|
||||
|
||||
extern char **environ;
|
||||
|
||||
@ -473,8 +469,8 @@ main(argc, argv)
|
||||
(void) signal(SIGQUIT, SIG_IGN);
|
||||
(void) signal(SIGINT, pintr);
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, SIGINT);
|
||||
sigprocmask(SIG_BLOCK, &sigset, NULL);
|
||||
(void) sigaddset(&sigset, SIGINT);
|
||||
(void) sigprocmask(SIG_BLOCK, &sigset, NULL);
|
||||
(void) signal(SIGTERM, SIG_IGN);
|
||||
if (quitit == 0 && arginp == 0) {
|
||||
(void) signal(SIGTSTP, SIG_IGN);
|
||||
@ -545,8 +541,8 @@ notty:
|
||||
sigset_t osigset;
|
||||
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, SIGINT);
|
||||
sigprocmask(SIG_BLOCK, &sigset, &osigset);
|
||||
(void) sigaddset(&sigset, SIGINT);
|
||||
(void) sigprocmask(SIG_BLOCK, &sigset, &osigset);
|
||||
|
||||
setintr = 0;
|
||||
parintr = SIG_IGN; /* Disable onintr */
|
||||
@ -559,7 +555,7 @@ notty:
|
||||
if (loginsh)
|
||||
(void) srcfile(_PATH_DOTLOGIN, 0, 0);
|
||||
#endif
|
||||
sigprocmask(SIG_SETMASK, &osigset, NULL);
|
||||
(void) sigprocmask(SIG_SETMASK, &osigset, NULL);
|
||||
setintr = osetintr;
|
||||
parintr = oparintr;
|
||||
}
|
||||
@ -747,11 +743,11 @@ srcunit(unit, onlyown, hflg)
|
||||
|
||||
if (setintr) {
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, SIGINT);
|
||||
sigprocmask(SIG_BLOCK, &sigset, &osigset);
|
||||
(void) sigaddset(&sigset, SIGINT);
|
||||
(void) sigprocmask(SIG_BLOCK, &sigset, &osigset);
|
||||
}
|
||||
/* Setup the new values of the state stuff saved above */
|
||||
memcpy(&saveB, &B, sizeof(B));
|
||||
(void) memcpy(&saveB, &B, sizeof(B));
|
||||
fbuf = NULL;
|
||||
fseekp = feobp = fblocks = 0;
|
||||
oSHIN = SHIN, SHIN = unit, arginp = 0, onelflg = 0;
|
||||
@ -767,14 +763,14 @@ srcunit(unit, onlyown, hflg)
|
||||
* interrupted.
|
||||
*/
|
||||
if (setintr)
|
||||
sigprocmask(SIG_SETMASK, &osigset, NULL);
|
||||
(void) sigprocmask(SIG_SETMASK, &osigset, NULL);
|
||||
settell();
|
||||
|
||||
if ((my_reenter = setexit()) == 0)
|
||||
process(0); /* 0 -> blow away on errors */
|
||||
|
||||
if (setintr)
|
||||
sigprocmask(SIG_SETMASK, &osigset, NULL);
|
||||
(void) sigprocmask(SIG_SETMASK, &osigset, NULL);
|
||||
if (oSHIN >= 0) {
|
||||
int i;
|
||||
|
||||
@ -785,7 +781,7 @@ srcunit(unit, onlyown, hflg)
|
||||
xfree((ptr_t) fbuf);
|
||||
|
||||
/* Reset input arena */
|
||||
memcpy(&B, &saveB, sizeof(B));
|
||||
(void) memcpy(&B, &saveB, sizeof(B));
|
||||
|
||||
(void) close(SHIN), SHIN = oSHIN;
|
||||
arginp = oarginp, onelflg = oonelflg;
|
||||
@ -960,11 +956,11 @@ pintr1(wantnl)
|
||||
sigset_t sigset, osigset;
|
||||
|
||||
sigemptyset(&sigset);
|
||||
sigprocmask(SIG_BLOCK, &sigset, &osigset);
|
||||
(void) sigprocmask(SIG_BLOCK, &sigset, &osigset);
|
||||
if (setintr) {
|
||||
sigset = osigset;
|
||||
sigdelset(&sigset, SIGINT);
|
||||
sigprocmask(SIG_SETMASK, &sigset, NULL);
|
||||
(void) sigdelset(&sigset, SIGINT);
|
||||
(void) sigprocmask(SIG_SETMASK, &sigset, NULL);
|
||||
if (pjobs) {
|
||||
pjobs = 0;
|
||||
(void) fprintf(cshout, "\n");
|
||||
@ -973,8 +969,8 @@ pintr1(wantnl)
|
||||
/* NOTREACHED */
|
||||
}
|
||||
}
|
||||
sigdelset(&osigset, SIGCHLD);
|
||||
sigprocmask(SIG_SETMASK, &osigset, NULL);
|
||||
(void) sigdelset(&osigset, SIGCHLD);
|
||||
(void) sigprocmask(SIG_SETMASK, &osigset, NULL);
|
||||
(void) fpurge(cshout);
|
||||
(void) endpwent();
|
||||
|
||||
@ -1037,8 +1033,8 @@ process(catch)
|
||||
*/
|
||||
if (setintr) {
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, SIGINT);
|
||||
sigprocmask(SIG_UNBLOCK, &sigset, NULL);
|
||||
(void) sigaddset(&sigset, SIGINT);
|
||||
(void) sigprocmask(SIG_UNBLOCK, &sigset, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1103,7 +1099,7 @@ process(catch)
|
||||
* The parser may lose space if interrupted.
|
||||
*/
|
||||
if (setintr)
|
||||
sigprocmask(SIG_BLOCK, &sigset, NULL);
|
||||
(void) sigprocmask(SIG_BLOCK, &sigset, NULL);
|
||||
|
||||
/*
|
||||
* Save input text on the history list if reading in old history, or it
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: csh.h,v 1.10 1997/07/04 21:23:54 christos Exp $ */
|
||||
/* $NetBSD: csh.h,v 1.11 1998/07/28 02:47:19 mycroft Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1991, 1993
|
||||
@ -188,8 +188,8 @@ jmp_buf reslab;
|
||||
#define setexit() (setjmp(reslab))
|
||||
#define reset() longjmp(reslab, 1)
|
||||
/* Should use structure assignment here */
|
||||
#define getexit(a) memcpy((a), reslab, sizeof reslab)
|
||||
#define resexit(a) memcpy(reslab, (a), sizeof 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 */
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: err.c,v 1.11 1998/07/28 02:23:38 mycroft Exp $ */
|
||||
/* $NetBSD: err.c,v 1.12 1998/07/28 02:47:19 mycroft Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1991, 1993
|
||||
@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: err.c,v 1.11 1998/07/28 02:23:38 mycroft Exp $");
|
||||
__RCSID("$NetBSD: err.c,v 1.12 1998/07/28 02:47:19 mycroft Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -312,7 +312,7 @@ seterror(id, va_alist)
|
||||
#endif
|
||||
if (id < 0 || id > sizeof(errorlist) / sizeof(errorlist[0]))
|
||||
id = ERR_INVALID;
|
||||
vsnprintf(berr, sizeof(berr), errorlist[id], va);
|
||||
(void) vsnprintf(berr, sizeof(berr), errorlist[id], va);
|
||||
va_end(va);
|
||||
|
||||
seterr = strsave(berr);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: exec.c,v 1.13 1998/07/28 02:23:38 mycroft Exp $ */
|
||||
/* $NetBSD: exec.c,v 1.14 1998/07/28 02:47:19 mycroft Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1991, 1993
|
||||
@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)exec.c 8.3 (Berkeley) 5/23/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: exec.c,v 1.13 1998/07/28 02:23:38 mycroft Exp $");
|
||||
__RCSID("$NetBSD: exec.c,v 1.14 1998/07/28 02:47:19 mycroft Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -202,7 +202,7 @@ doexec(v, t)
|
||||
* this shell can still do subprocesses.
|
||||
*/
|
||||
sigemptyset(&sigset);
|
||||
sigprocmask(SIG_SETMASK, &sigset, NULL);
|
||||
(void) sigprocmask(SIG_SETMASK, &sigset, NULL);
|
||||
/*
|
||||
* If no path, no words in path, or a / in the filename then restrict the
|
||||
* command search.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: extern.h,v 1.11 1998/07/28 02:23:38 mycroft Exp $ */
|
||||
/* $NetBSD: extern.h,v 1.12 1998/07/28 02:47:20 mycroft Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
@ -214,7 +214,6 @@ 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 *quote __P((Char *));
|
||||
char *strsave __P((char *));
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: file.c,v 1.13 1997/07/04 21:24:00 christos Exp $ */
|
||||
/* $NetBSD: file.c,v 1.14 1998/07/28 02:47:20 mycroft Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1991, 1993
|
||||
@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)file.c 8.2 (Berkeley) 3/19/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: file.c,v 1.13 1997/07/04 21:24:00 christos Exp $");
|
||||
__RCSID("$NetBSD: file.c,v 1.14 1998/07/28 02:47:20 mycroft Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -148,8 +148,8 @@ back_to_col_1()
|
||||
sigset_t sigset, osigset;
|
||||
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, SIGINT);
|
||||
sigprocmask(SIG_BLOCK, &sigset, &osigset);
|
||||
(void) sigaddset(&sigset, SIGINT);
|
||||
(void) sigprocmask(SIG_BLOCK, &sigset, &osigset);
|
||||
(void) tcgetattr(SHOUT, &tty);
|
||||
tty_normal = tty;
|
||||
tty.c_iflag &= ~INLCR;
|
||||
@ -157,7 +157,7 @@ back_to_col_1()
|
||||
(void) tcsetattr(SHOUT, TCSADRAIN, &tty);
|
||||
(void) write(SHOUT, "\r", 1);
|
||||
(void) tcsetattr(SHOUT, TCSADRAIN, &tty_normal);
|
||||
sigprocmask(SIG_SETMASK, &osigset, NULL);
|
||||
(void) sigprocmask(SIG_SETMASK, &osigset, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -173,8 +173,8 @@ pushback(string)
|
||||
char c;
|
||||
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, SIGINT);
|
||||
sigprocmask(SIG_BLOCK, &sigset, &osigset);
|
||||
(void) sigaddset(&sigset, SIGINT);
|
||||
(void) sigprocmask(SIG_BLOCK, &sigset, &osigset);
|
||||
(void) tcgetattr(SHOUT, &tty);
|
||||
tty_normal = tty;
|
||||
tty.c_lflag &= ~(ECHOKE | ECHO | ECHOE | ECHOK | ECHONL | ECHOPRT | ECHOCTL);
|
||||
@ -183,7 +183,7 @@ pushback(string)
|
||||
for (p = string; (c = *p) != '\0'; p++)
|
||||
(void) ioctl(SHOUT, TIOCSTI, (ioctl_t) & c);
|
||||
(void) tcsetattr(SHOUT, TCSADRAIN, &tty_normal);
|
||||
sigprocmask(SIG_SETMASK, &osigset, NULL);
|
||||
(void) sigprocmask(SIG_SETMASK, &osigset, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -430,11 +430,11 @@ free_items(items)
|
||||
sigset_t sigset, osigset;\
|
||||
\
|
||||
sigemptyset(&sigset);\
|
||||
sigaddset(&sigset, SIGINT);\
|
||||
sigprocmask(SIG_BLOCK, &sigset, &osigset);\
|
||||
(void) sigaddset(&sigset, SIGINT);\
|
||||
(void) sigprocmask(SIG_BLOCK, &sigset, &osigset);\
|
||||
free_items(items);\
|
||||
items = NULL;\
|
||||
sigprocmask(SIG_SETMASK, &osigset, NULL);\
|
||||
(void) sigprocmask(SIG_SETMASK, &osigset, NULL);\
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: func.c,v 1.14 1998/07/28 02:23:38 mycroft Exp $ */
|
||||
/* $NetBSD: func.c,v 1.15 1998/07/28 02:47:20 mycroft Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1991, 1993
|
||||
@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)func.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: func.c,v 1.14 1998/07/28 02:23:38 mycroft Exp $");
|
||||
__RCSID("$NetBSD: func.c,v 1.15 1998/07/28 02:47:20 mycroft Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -157,8 +157,8 @@ doonintr(v, t)
|
||||
if (vv == 0) {
|
||||
if (setintr) {
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, SIGINT);
|
||||
sigprocmask(SIG_BLOCK, &sigset, NULL);
|
||||
(void) sigaddset(&sigset, SIGINT);
|
||||
(void) sigprocmask(SIG_BLOCK, &sigset, NULL);
|
||||
} else
|
||||
(void) signal(SIGINT, SIG_DFL);
|
||||
gointr = 0;
|
||||
@ -220,7 +220,7 @@ doalias(v, t)
|
||||
vp = adrof1(strip(p), &aliases);
|
||||
if (vp) {
|
||||
blkpr(cshout, vp->vec);
|
||||
fputc('\n', cshout);
|
||||
(void) fputc('\n', cshout);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -549,13 +549,13 @@ preread()
|
||||
whyles->w_end.type = I_SEEK;
|
||||
if (setintr) {
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, SIGINT);
|
||||
sigprocmask(SIG_UNBLOCK, &sigset, NULL);
|
||||
(void) sigaddset(&sigset, SIGINT);
|
||||
(void) sigprocmask(SIG_UNBLOCK, &sigset, NULL);
|
||||
}
|
||||
|
||||
search(T_BREAK, 0, NULL); /* read the expression in */
|
||||
if (setintr)
|
||||
sigprocmask(SIG_BLOCK, &sigset, NULL);
|
||||
(void) sigprocmask(SIG_BLOCK, &sigset, NULL);
|
||||
btell(&whyles->w_end);
|
||||
}
|
||||
|
||||
@ -618,19 +618,19 @@ dorepeat(v, kp)
|
||||
i = getn(v[1]);
|
||||
if (setintr) {
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, SIGINT);
|
||||
sigprocmask(SIG_BLOCK, &sigset, NULL);
|
||||
(void) sigaddset(&sigset, SIGINT);
|
||||
(void) sigprocmask(SIG_BLOCK, &sigset, NULL);
|
||||
}
|
||||
lshift(v, 2);
|
||||
while (i > 0) {
|
||||
if (setintr)
|
||||
sigprocmask(SIG_UNBLOCK, &sigset, NULL);
|
||||
(void) sigprocmask(SIG_UNBLOCK, &sigset, NULL);
|
||||
reexecute(kp);
|
||||
--i;
|
||||
}
|
||||
donefds();
|
||||
if (setintr)
|
||||
sigprocmask(SIG_UNBLOCK, &sigset, NULL);
|
||||
(void) sigprocmask(SIG_UNBLOCK, &sigset, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
@ -964,8 +964,8 @@ xecho(sep, v)
|
||||
|
||||
if (setintr) {
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, SIGINT);
|
||||
sigprocmask(SIG_UNBLOCK, &sigset, NULL);
|
||||
(void) sigaddset(&sigset, SIGINT);
|
||||
(void) sigprocmask(SIG_UNBLOCK, &sigset, NULL);
|
||||
}
|
||||
v++;
|
||||
if (*v == 0)
|
||||
@ -998,7 +998,7 @@ xecho(sep, v)
|
||||
else
|
||||
(void) fflush(cshout);
|
||||
if (setintr)
|
||||
sigprocmask(SIG_BLOCK, &sigset, NULL);
|
||||
(void) sigprocmask(SIG_BLOCK, &sigset, NULL);
|
||||
if (gargv)
|
||||
blkfree(gargv), gargv = 0;
|
||||
}
|
||||
@ -1018,8 +1018,8 @@ dosetenv(v, t)
|
||||
|
||||
if (setintr) {
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, SIGINT);
|
||||
sigprocmask(SIG_UNBLOCK, &sigset, NULL);
|
||||
(void) sigaddset(&sigset, SIGINT);
|
||||
(void) sigprocmask(SIG_UNBLOCK, &sigset, NULL);
|
||||
}
|
||||
for (ep = STR_environ; *ep; ep++)
|
||||
(void) fprintf(cshout, "%s\n", vis_str(*ep));
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: hist.c,v 1.10 1998/07/28 02:23:39 mycroft Exp $ */
|
||||
/* $NetBSD: hist.c,v 1.11 1998/07/28 02:47:20 mycroft Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1991, 1993
|
||||
@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)hist.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: hist.c,v 1.10 1998/07/28 02:23:39 mycroft Exp $");
|
||||
__RCSID("$NetBSD: hist.c,v 1.11 1998/07/28 02:47:20 mycroft Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -134,8 +134,8 @@ dohist(v, t)
|
||||
return;
|
||||
if (setintr) {
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, SIGINT);
|
||||
sigprocmask(SIG_UNBLOCK, &sigset, NULL);
|
||||
(void) sigaddset(&sigset, SIGINT);
|
||||
(void) sigprocmask(SIG_UNBLOCK, &sigset, NULL);
|
||||
}
|
||||
while (*++v && **v == '-') {
|
||||
Char *vp = *v;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lex.c,v 1.13 1998/07/28 02:23:39 mycroft Exp $ */
|
||||
/* $NetBSD: lex.c,v 1.14 1998/07/28 02:47:20 mycroft Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1991, 1993
|
||||
@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)lex.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: lex.c,v 1.13 1998/07/28 02:23:39 mycroft Exp $");
|
||||
__RCSID("$NetBSD: lex.c,v 1.14 1998/07/28 02:47:20 mycroft Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -1513,7 +1513,7 @@ again:
|
||||
goto again;
|
||||
}
|
||||
if (c > 0)
|
||||
memcpy(fbuf[buf] + off, ttyline, c * sizeof(Char));
|
||||
(void) memcpy(fbuf[buf] + off, ttyline, c * sizeof(Char));
|
||||
numleft = 0;
|
||||
}
|
||||
else {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: misc.c,v 1.10 1998/07/28 02:23:39 mycroft Exp $ */
|
||||
/* $NetBSD: misc.c,v 1.11 1998/07/28 02:47:20 mycroft Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1991, 1993
|
||||
@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: misc.c,v 1.10 1998/07/28 02:23:39 mycroft Exp $");
|
||||
__RCSID("$NetBSD: misc.c,v 1.11 1998/07/28 02:47:20 mycroft Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -69,17 +69,6 @@ any(s, c)
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
setzero(cp, i)
|
||||
char *cp;
|
||||
int i;
|
||||
{
|
||||
if (i != 0)
|
||||
do
|
||||
*cp++ = 0;
|
||||
while (--i);
|
||||
}
|
||||
|
||||
char *
|
||||
strsave(s)
|
||||
char *s;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: proc.c,v 1.13 1998/07/28 02:23:39 mycroft Exp $ */
|
||||
/* $NetBSD: proc.c,v 1.14 1998/07/28 02:47:20 mycroft Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1991, 1993
|
||||
@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)proc.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: proc.c,v 1.13 1998/07/28 02:23:39 mycroft Exp $");
|
||||
__RCSID("$NetBSD: proc.c,v 1.14 1998/07/28 02:47:20 mycroft Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -212,15 +212,15 @@ pnote()
|
||||
|
||||
neednote = 0;
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, SIGCHLD);
|
||||
(void) sigaddset(&sigset, SIGCHLD);
|
||||
for (pp = proclist.p_next; pp != NULL; pp = pp->p_next) {
|
||||
if (pp->p_flags & PNEEDNOTE) {
|
||||
sigprocmask(SIG_BLOCK, &sigset, &osigset);
|
||||
(void) sigprocmask(SIG_BLOCK, &sigset, &osigset);
|
||||
pp->p_flags &= ~PNEEDNOTE;
|
||||
flags = pprint(pp, NUMBER | NAME | REASON);
|
||||
if ((flags & (PRUNNING | PSTOPPED)) == 0)
|
||||
pflush(pp);
|
||||
sigprocmask(SIG_SETMASK, &osigset, NULL);
|
||||
(void) sigprocmask(SIG_SETMASK, &osigset, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -239,8 +239,8 @@ pwait()
|
||||
* Here's where dead procs get flushed.
|
||||
*/
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, SIGCHLD);
|
||||
sigprocmask(SIG_BLOCK, &sigset, &osigset);
|
||||
(void) sigaddset(&sigset, SIGCHLD);
|
||||
(void) sigprocmask(SIG_BLOCK, &sigset, &osigset);
|
||||
for (pp = (fp = &proclist)->p_next; pp != NULL; pp = (fp = pp)->p_next)
|
||||
if (pp->p_pid == 0) {
|
||||
fp->p_next = pp->p_next;
|
||||
@ -251,7 +251,7 @@ pwait()
|
||||
xfree((ptr_t) pp);
|
||||
pp = fp;
|
||||
}
|
||||
sigprocmask(SIG_SETMASK, &osigset, NULL);
|
||||
(void) sigprocmask(SIG_SETMASK, &osigset, NULL);
|
||||
pjwait(pcurrjob);
|
||||
}
|
||||
|
||||
@ -282,12 +282,12 @@ pjwait(pp)
|
||||
*/
|
||||
fp = pp;
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, SIGCHLD);
|
||||
sigprocmask(SIG_BLOCK, &sigset, &osigset);
|
||||
(void) sigaddset(&sigset, SIGCHLD);
|
||||
(void) sigprocmask(SIG_BLOCK, &sigset, &osigset);
|
||||
for (;;) {
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, SIGCHLD);
|
||||
sigprocmask(SIG_BLOCK, &sigset, NULL);
|
||||
(void) sigaddset(&sigset, SIGCHLD);
|
||||
(void) sigprocmask(SIG_BLOCK, &sigset, NULL);
|
||||
jobflags = 0;
|
||||
do
|
||||
jobflags |= fp->p_flags;
|
||||
@ -299,10 +299,10 @@ pjwait(pp)
|
||||
fp->p_pid);
|
||||
#endif /* JOBDEBUG */
|
||||
sigset = osigset;
|
||||
sigdelset(&sigset, SIGCHLD);
|
||||
sigsuspend(&sigset);
|
||||
(void) sigdelset(&sigset, SIGCHLD);
|
||||
(void) sigsuspend(&sigset);
|
||||
}
|
||||
sigprocmask(SIG_SETMASK, &osigset, NULL);
|
||||
(void) sigprocmask(SIG_SETMASK, &osigset, NULL);
|
||||
if (tpgrp > 0) /* get tty back */
|
||||
(void) tcsetpgrp(FSHTTY, tpgrp);
|
||||
if ((jobflags & (PSIGNALED | PSTOPPED | PTIME)) ||
|
||||
@ -367,17 +367,17 @@ dowait(v, t)
|
||||
|
||||
pjobs++;
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, SIGCHLD);
|
||||
sigprocmask(SIG_BLOCK, &sigset, &osigset);
|
||||
(void) sigaddset(&sigset, SIGCHLD);
|
||||
(void) sigprocmask(SIG_BLOCK, &sigset, &osigset);
|
||||
loop:
|
||||
for (pp = proclist.p_next; pp; pp = pp->p_next)
|
||||
if (pp->p_pid && /* pp->p_pid == pp->p_jobid && */
|
||||
pp->p_flags & PRUNNING) {
|
||||
sigemptyset(&sigset);
|
||||
sigsuspend(&sigset);
|
||||
(void) sigsuspend(&sigset);
|
||||
goto loop;
|
||||
}
|
||||
sigprocmask(SIG_SETMASK, &osigset, NULL);
|
||||
(void) sigprocmask(SIG_SETMASK, &osigset, NULL);
|
||||
pjobs = 0;
|
||||
}
|
||||
|
||||
@ -1058,10 +1058,10 @@ pkill(v, signum)
|
||||
Char *cp;
|
||||
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, SIGCHLD);
|
||||
(void) sigaddset(&sigset, SIGCHLD);
|
||||
if (setintr)
|
||||
sigaddset(&sigset, SIGINT);
|
||||
sigprocmask(SIG_BLOCK, &sigset, NULL);
|
||||
(void) sigaddset(&sigset, SIGINT);
|
||||
(void) sigprocmask(SIG_BLOCK, &sigset, NULL);
|
||||
gflag = 0, tglob(v);
|
||||
if (gflag) {
|
||||
v = globall(v);
|
||||
@ -1129,7 +1129,7 @@ cont:
|
||||
}
|
||||
if (gargv)
|
||||
blkfree(gargv), gargv = 0;
|
||||
sigprocmask(SIG_UNBLOCK, &sigset, NULL);
|
||||
(void) sigprocmask(SIG_UNBLOCK, &sigset, NULL);
|
||||
if (err1) {
|
||||
stderror(ERR_SILENT);
|
||||
/* NOTREACHED */
|
||||
@ -1149,8 +1149,8 @@ pstart(pp, foregnd)
|
||||
long jobflags = 0;
|
||||
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, SIGCHLD);
|
||||
sigprocmask(SIG_BLOCK, &sigset, &osigset);
|
||||
(void) sigaddset(&sigset, SIGCHLD);
|
||||
(void) sigprocmask(SIG_BLOCK, &sigset, &osigset);
|
||||
np = pp;
|
||||
do {
|
||||
jobflags |= np->p_flags;
|
||||
@ -1170,7 +1170,7 @@ pstart(pp, foregnd)
|
||||
(void) tcsetpgrp(FSHTTY, pp->p_jobid);
|
||||
if (jobflags & PSTOPPED)
|
||||
(void) kill(-pp->p_jobid, SIGCONT);
|
||||
sigprocmask(SIG_SETMASK, &osigset, NULL);
|
||||
(void) sigprocmask(SIG_SETMASK, &osigset, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1326,13 +1326,13 @@ pfork(t, wanttty)
|
||||
* Hold SIGCHLD until we have the process installed in our table.
|
||||
*/
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, SIGCHLD);
|
||||
sigprocmask(SIG_BLOCK, &sigset, &osigset);
|
||||
(void) sigaddset(&sigset, SIGCHLD);
|
||||
(void) sigprocmask(SIG_BLOCK, &sigset, &osigset);
|
||||
while ((pid = fork()) < 0)
|
||||
if (setintr == 0)
|
||||
(void) sleep(FORKSLEEP);
|
||||
else {
|
||||
sigprocmask(SIG_SETMASK, &osigset, NULL);
|
||||
(void) sigprocmask(SIG_SETMASK, &osigset, NULL);
|
||||
stderror(ERR_NOPROC);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
@ -1377,7 +1377,7 @@ pfork(t, wanttty)
|
||||
if (wanttty >= 0)
|
||||
(void) setpgid(pid, pcurrjob ? pcurrjob->p_jobid : pid);
|
||||
palloc(pid, t);
|
||||
sigprocmask(SIG_SETMASK, &osigset, NULL);
|
||||
(void) sigprocmask(SIG_SETMASK, &osigset, NULL);
|
||||
}
|
||||
|
||||
return (pid);
|
||||
@ -1413,10 +1413,10 @@ pgetty(wanttty, pgrp)
|
||||
*/
|
||||
if (wanttty > 0) {
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, SIGTSTP);
|
||||
sigaddset(&sigset, SIGTTIN);
|
||||
sigaddset(&sigset, SIGTTOU);
|
||||
sigprocmask(SIG_BLOCK, &sigset, &osigset);
|
||||
(void) sigaddset(&sigset, SIGTSTP);
|
||||
(void) sigaddset(&sigset, SIGTTIN);
|
||||
(void) sigaddset(&sigset, SIGTTOU);
|
||||
(void) sigprocmask(SIG_BLOCK, &sigset, &osigset);
|
||||
}
|
||||
/*
|
||||
* From: Michael Schroeder <mlschroe@immd4.informatik.uni-erlangen.de>
|
||||
@ -1433,7 +1433,7 @@ pgetty(wanttty, pgrp)
|
||||
|
||||
if (wanttty > 0) {
|
||||
(void) tcsetpgrp(FSHTTY, pgrp);
|
||||
sigprocmask(SIG_SETMASK, &osigset, NULL);
|
||||
(void) sigprocmask(SIG_SETMASK, &osigset, NULL);
|
||||
}
|
||||
|
||||
if (tpgrp > 0)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sem.c,v 1.12 1998/07/28 02:23:39 mycroft Exp $ */
|
||||
/* $NetBSD: sem.c,v 1.13 1998/07/28 02:47:21 mycroft Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1991, 1993
|
||||
@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)sem.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: sem.c,v 1.12 1998/07/28 02:23:39 mycroft Exp $");
|
||||
__RCSID("$NetBSD: sem.c,v 1.13 1998/07/28 02:47:21 mycroft Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -217,14 +217,14 @@ execute(t, wanttty, pipein, pipeout)
|
||||
*/
|
||||
if (wanttty >= 0 && !nosigchld) {
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, SIGCHLD);
|
||||
sigprocmask(SIG_BLOCK, &sigset, &csigset);
|
||||
(void) sigaddset(&sigset, SIGCHLD);
|
||||
(void) sigprocmask(SIG_BLOCK, &sigset, &csigset);
|
||||
nosigchld = 1;
|
||||
}
|
||||
|
||||
pid = pfork(t, wanttty);
|
||||
if (pid == 0 && nosigchld) {
|
||||
sigprocmask(SIG_SETMASK, &csigset, NULL);
|
||||
(void) sigprocmask(SIG_SETMASK, &csigset, NULL);
|
||||
nosigchld = 0;
|
||||
}
|
||||
else if (pid != 0 && (t->t_dflg & F_AMPERSAND))
|
||||
@ -246,14 +246,14 @@ execute(t, wanttty, pipein, pipeout)
|
||||
*/
|
||||
if (wanttty >= 0 && !nosigchld && !noexec) {
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, SIGCHLD);
|
||||
sigprocmask(SIG_BLOCK, &sigset, &csigset);
|
||||
(void) sigaddset(&sigset, SIGCHLD);
|
||||
(void) sigprocmask(SIG_BLOCK, &sigset, &csigset);
|
||||
nosigchld = 1;
|
||||
}
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, SIGCHLD);
|
||||
sigaddset(&sigset, SIGINT);
|
||||
sigprocmask(SIG_BLOCK, &sigset, &osigset);
|
||||
(void) sigaddset(&sigset, SIGCHLD);
|
||||
(void) sigaddset(&sigset, SIGINT);
|
||||
(void) sigprocmask(SIG_BLOCK, &sigset, &osigset);
|
||||
ochild = child;
|
||||
osetintr = setintr;
|
||||
ohaderr = haderr;
|
||||
@ -271,7 +271,7 @@ execute(t, wanttty, pipein, pipeout)
|
||||
pid = vfork();
|
||||
|
||||
if (pid < 0) {
|
||||
sigprocmask(SIG_SETMASK, &osigset, NULL);
|
||||
(void) sigprocmask(SIG_SETMASK, &osigset, NULL);
|
||||
stderror(ERR_NOPROC);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
@ -299,7 +299,7 @@ execute(t, wanttty, pipein, pipeout)
|
||||
Vt = 0;
|
||||
/* this is from pfork() */
|
||||
palloc(pid, t);
|
||||
sigprocmask(SIG_SETMASK, &osigset, NULL);
|
||||
(void) sigprocmask(SIG_SETMASK, &osigset, NULL);
|
||||
}
|
||||
else { /* child */
|
||||
/* this is from pfork() */
|
||||
@ -307,7 +307,7 @@ execute(t, wanttty, pipein, pipeout)
|
||||
bool ignint = 0;
|
||||
|
||||
if (nosigchld) {
|
||||
sigprocmask(SIG_SETMASK, &csigset, NULL);
|
||||
(void) sigprocmask(SIG_SETMASK, &csigset, NULL);
|
||||
nosigchld = 0;
|
||||
}
|
||||
|
||||
@ -364,7 +364,7 @@ execute(t, wanttty, pipein, pipeout)
|
||||
}
|
||||
if ((t->t_dflg & F_PIPEOUT) == 0) {
|
||||
if (nosigchld) {
|
||||
sigprocmask(SIG_SETMASK, &csigset, NULL);
|
||||
(void) sigprocmask(SIG_SETMASK, &csigset, NULL);
|
||||
nosigchld = 0;
|
||||
}
|
||||
if ((t->t_dflg & F_AMPERSAND) == 0)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: set.c,v 1.11 1998/07/28 02:23:40 mycroft Exp $ */
|
||||
/* $NetBSD: set.c,v 1.12 1998/07/28 02:47:21 mycroft Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1991, 1993
|
||||
@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)set.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: set.c,v 1.11 1998/07/28 02:23:40 mycroft Exp $");
|
||||
__RCSID("$NetBSD: set.c,v 1.12 1998/07/28 02:47:21 mycroft Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -854,8 +854,8 @@ plist(p)
|
||||
|
||||
if (setintr) {
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, SIGINT);
|
||||
sigprocmask(SIG_UNBLOCK, &sigset, NULL);
|
||||
(void) sigaddset(&sigset, SIGINT);
|
||||
(void) sigprocmask(SIG_UNBLOCK, &sigset, NULL);
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
|
Loading…
Reference in New Issue
Block a user