SCCS-vsn: bin/csh/Makefile 4.3
SCCS-vsn: bin/csh/csh.c 4.12
SCCS-vsn: bin/csh/exec.c 4.7
SCCS-vsn: bin/csh/func.c 4.10
SCCS-vsn: bin/csh/csh.h 4.9
SCCS-vsn: bin/csh/hist.c 4.6
SCCS-vsn: bin/csh/proc.c 4.10
SCCS-vsn: bin/csh/sem.c 4.3
#
# 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
SCCS= /usr/local/sccs
# strings.o must be last in OBJS since it can change when previous files compile
SCCS= /usr/local/sccs
# strings.o must be last in OBJS since it can change when previous files compile
-OBJS= sh.o sh.dol.o sh.err.o sh.exec.o sh.exp.o sh.func.o sh.glob.o \
- sh.hist.o sh.lex.o sh.misc.o sh.parse.o sh.print.o sh.sem.o sh.set.o \
- sh.proc.o sh.dir.o sh.time.o alloc.o sh.init.o printf.o \
- strings.o doprnt.o
+OBJS= alloc.o doprnt.o printf.o sh.o sh.dir.o sh.dol.o sh.err.o sh.exec.o \
+ sh.exp.o sh.func.o sh.glob.o sh.hist.o sh.init.o sh.lex.o sh.misc.o \
+ sh.parse.o sh.print.o sh.proc.o sh.sem.o sh.set.o sh.sig.o sh.time.o \
+ strings.o
# Special massaging of C files for sharing of strings
.c.o:
# Special massaging of C files for sharing of strings
.c.o:
install -s csh ${DESTDIR}/bin/csh
clean:
install -s csh ${DESTDIR}/bin/csh
clean:
- ${RM} -f a.out strings x.c xs.c csh
+ ${RM} -f a.out strings x.c xs.c csh errs
${RM} -f *.o sh.prof.c
tags: /tmp
${RM} -f *.o sh.prof.c
tags: /tmp
-static char *sccsid = "@(#)csh.c 4.11 %G%";
+static char *sccsid = "@(#)csh.c 4.12 %G%";
#include "sh.h"
#include <sys/ioctl.h>
#include "sh.h"
#include <sys/ioctl.h>
* We catch it only if we are the login shell.
*/
parintr = signal(SIGINT, SIG_IGN); /* parents interruptibility */
* We catch it only if we are the login shell.
*/
parintr = signal(SIGINT, SIG_IGN); /* parents interruptibility */
- signal(SIGINT, parintr); /* ... restore */
+ sigset(SIGINT, parintr); /* ... restore */
parterm = signal(SIGTERM, SIG_IGN); /* parents terminability */
signal(SIGTERM, parterm); /* ... restore */
if (loginsh) {
parterm = signal(SIGTERM, SIG_IGN); /* parents terminability */
signal(SIGTERM, parterm); /* ... restore */
if (loginsh) {
**av = '-';
if (!quitit) /* Wary! */
signal(SIGQUIT, SIG_IGN);
**av = '-';
if (!quitit) /* Wary! */
signal(SIGQUIT, SIG_IGN);
- sigblock(mask(SIGINT));
- signal(SIGINT, pintr);
+ sigset(SIGINT, pintr);
+ sighold(SIGINT);
signal(SIGTERM, SIG_IGN);
if (quitit == 0 && arginp == 0) {
signal(SIGTSTP, SIG_IGN);
signal(SIGTERM, SIG_IGN);
if (quitit == 0 && arginp == 0) {
signal(SIGTSTP, SIG_IGN);
if (ioctl(f, TIOCGPGRP, &tpgrp) == 0 && tpgrp != -1) {
int ldisc;
if (tpgrp != shpgrp) {
if (ioctl(f, TIOCGPGRP, &tpgrp) == 0 && tpgrp != -1) {
int ldisc;
if (tpgrp != shpgrp) {
- int (*old)() = signal(SIGTTIN, SIG_DFL);
+ int (*old)() = sigsys(SIGTTIN, SIG_DFL);
goto retry;
}
if (ioctl(f, TIOCGETD, &oldisc) != 0)
goto retry;
}
if (ioctl(f, TIOCGETD, &oldisc) != 0)
}
if (setintr == 0 && parintr == SIG_DFL)
setintr++;
}
if (setintr == 0 && parintr == SIG_DFL)
setintr++;
- signal(SIGCHLD, pchild); /* while signals not ready */
+ sigset(SIGCHLD, pchild); /* while signals not ready */
/*
* Set an exit here in case of an interrupt or error reading
/*
* Set an exit here in case of an interrupt or error reading
getexit(oldexit);
reenter = 0;
if (setintr)
getexit(oldexit);
reenter = 0;
if (setintr)
- (void) sigblock(mask(SIGINT));
setexit();
reenter++;
if (reenter == 1) {
setexit();
reenter++;
if (reenter == 1) {
* we let ourselves be interrupted.
*/
if (setintr)
* we let ourselves be interrupted.
*/
if (setintr)
- (void) sigrelse(mask(SIGINT));
#ifdef TELL
settell();
#endif
process(0); /* 0 -> blow away on errors */
}
if (setintr)
#ifdef TELL
settell();
#endif
process(0); /* 0 -> blow away on errors */
}
if (setintr)
- (void) sigrelse(mask(SIGINT));
if (oSHIN >= 0) {
register int i;
if (oSHIN >= 0) {
register int i;
{
if (loginsh) {
signal(SIGQUIT, SIG_IGN);
{
if (loginsh) {
signal(SIGQUIT, SIG_IGN);
- signal(SIGINT, SIG_IGN);
+ sigset(SIGINT, SIG_IGN);
signal(SIGTERM, SIG_IGN);
setintr = 0; /* No interrupts after "logout" */
if (adrof("home"))
signal(SIGTERM, SIG_IGN);
setintr = 0; /* No interrupts after "logout" */
if (adrof("home"))
register char **v;
if (setintr) {
register char **v;
if (setintr) {
- (void) sigrelse(mask(SIGINT));
if (pjobs) {
pjobs = 0;
printf("\n");
if (pjobs) {
pjobs = 0;
printf("\n");
- sigblock(mask(SIGINT));
- sigrelse(mask(SIGCHLD));
+ sighold(SIGINT);
+ sigrelse(SIGCHLD);
* Interruptible during interactive reads
*/
if (setintr)
* Interruptible during interactive reads
*/
if (setintr)
- (void) sigrelse(mask(SIGINT));
/*
* For the sake of reset()
/*
* For the sake of reset()
* The parser may lose space if interrupted.
*/
if (setintr)
* The parser may lose space if interrupted.
*/
if (setintr)
- sigblock(mask(SIGINT));
/*
* Save input text on the history list if
/*
* Save input text on the history list if
-/* csh.h 4.8 83/06/11 */
+/* csh.h 4.9 83/06/11 */
#include "sh.local.h"
#include <time.h>
#include "sh.local.h"
#include <time.h>
typedef char bool;
#define eq(a, b) (strcmp(a, b) == 0)
typedef char bool;
#define eq(a, b) (strcmp(a, b) == 0)
+
+/*
+ * For 4.2bsd signals.
+ */
#define mask(s) (1 << ((s)-1))
#define mask(s) (1 << ((s)-1))
+#define sigsys(s, a) signal(s, a)
+#define sighold(s) sigblock(mask(s))
-static char *sccsid = "@(#)exec.c 4.6 %G%";
+static char *sccsid = "@(#)exec.c 4.7 %G%";
#include "sh.h"
#include <dir.h>
#include "sh.h"
#include <dir.h>
* We must do this AFTER any possible forking (like `foo`
* in glob) so that this shell can still do subprocesses.
*/
* We must do this AFTER any possible forking (like `foo`
* in glob) so that this shell can still do subprocesses.
*/
- signal(SIGCHLD, SIG_IGN);
- sigsetmask(0); /* sanity */
+#ifdef notdef
+ sigsys(SIGCHLD, SIG_IGN); /* sigsys for vforks sake */
+#endif
+ sigsetmask(0);
/*
* If no path, no words in path, or a / in the filename
/*
* If no path, no words in path, or a / in the filename
-static char *sccsid = "@(#)func.c 4.9 83/06/10";
+static char *sccsid = "@(#)func.c 4.10 83/06/11";
#include "sh.h"
#include <sys/ioctl.h>
#include "sh.h"
#include <sys/ioctl.h>
cp = gointr, gointr = 0, xfree(cp);
if (vv == 0) {
if (setintr)
cp = gointr, gointr = 0, xfree(cp);
if (vv == 0) {
if (setintr)
- (void) sigblock(mask(SIGINT));
- signal(SIGINT, SIG_DFL);
+ sigset(SIGINT, SIG_DFL);
gointr = 0;
} else if (eq((vv = strip(vv)), "-")) {
gointr = 0;
} else if (eq((vv = strip(vv)), "-")) {
- signal(SIGINT, SIG_IGN);
+ sigset(SIGINT, SIG_IGN);
gointr = "-";
} else {
gointr = savestr(vv);
gointr = "-";
} else {
gointr = savestr(vv);
whyles->w_end = -1;
if (setintr)
whyles->w_end = -1;
if (setintr)
- (void) sigrelse(mask(SIGINT));
search(ZBREAK, 0);
if (setintr)
search(ZBREAK, 0);
if (setintr)
- sigblock(mask(SIGINT));
whyles->w_end = btell();
}
whyles->w_end = btell();
}
i = getn(v[1]);
if (setintr)
i = getn(v[1]);
if (setintr)
- (void) sigblock(mask(SIGINT));
lshift(v, 2);
while (i > 0) {
if (setintr)
lshift(v, 2);
while (i > 0) {
if (setintr)
- (void) sigrelse(mask(SIGINT));
reexecute(kp);
--i;
}
donefds();
if (setintr)
reexecute(kp);
--i;
}
donefds();
if (setintr)
- (void) sigrelse(mask(SIGINT));
int nonl = 0;
if (setintr)
int nonl = 0;
if (setintr)
- (void) sigrelse(mask(SIGINT));
v++;
if (*v == 0)
return;
v++;
if (*v == 0)
return;
else
flush();
if (setintr)
else
flush();
if (setintr)
- (void) sigblock(mask(SIGINT));
if (gargv)
blkfree(gargv), gargv = 0;
}
if (gargv)
blkfree(gargv), gargv = 0;
}
if (loginsh)
error("Can't suspend a login shell (yet)");
untty();
if (loginsh)
error("Can't suspend a login shell (yet)");
untty();
- old = signal(SIGTSTP, SIG_DFL);
+ old = sigsys(SIGTSTP, SIG_DFL);
kill(0, SIGTSTP);
/* the shell stops here */
kill(0, SIGTSTP);
/* the shell stops here */
if (tpgrp != -1) {
retry:
ioctl(FSHTTY, TIOCGPGRP, &ctpgrp);
if (ctpgrp != opgrp) {
if (tpgrp != -1) {
retry:
ioctl(FSHTTY, TIOCGPGRP, &ctpgrp);
if (ctpgrp != opgrp) {
- old = signal(SIGTTIN, SIG_DFL);
+ old = sigsys(SIGTTIN, SIG_DFL);
goto retry;
}
ioctl(FSHTTY, TIOCSPGRP, &shpgrp);
goto retry;
}
ioctl(FSHTTY, TIOCSPGRP, &shpgrp);
-static char *sccsid = "@(#)hist.c 4.5 %G%";
+static char *sccsid = "@(#)hist.c 4.6 %G%";
if (getn(value("history")) == 0)
return;
if (setintr)
if (getn(value("history")) == 0)
return;
if (setintr)
- (void) sigrelse(mask(SIGINT));
vp++;
while (*vp && *vp[0] == '-') {
if (*vp && eq(*vp, "-h")) {
vp++;
while (*vp && *vp[0] == '-') {
if (*vp && eq(*vp, "-h")) {
-static char *sccsid = "@(#)proc.c 4.9 (Berkeley) 83/06/10";
+static char *sccsid = "@(#)proc.c 4.10 (Berkeley) 83/06/11";
#include "sh.h"
#include "sh.dir.h"
#include "sh.h"
#include "sh.dir.h"
neednote = 0;
for (pp = proclist.p_next; pp != PNULL; pp = pp->p_next) {
if (pp->p_flags & PNEEDNOTE) {
neednote = 0;
for (pp = proclist.p_next; pp != PNULL; pp = pp->p_next) {
if (pp->p_flags & PNEEDNOTE) {
- (void) sigblock(mask(SIGCHLD));
pp->p_flags &= ~PNEEDNOTE;
flags = pprint(pp, NUMBER|NAME|REASON);
if ((flags&(PRUNNING|PSTOPPED)) == 0)
pflush(pp);
pp->p_flags &= ~PNEEDNOTE;
flags = pprint(pp, NUMBER|NAME|REASON);
if ((flags&(PRUNNING|PSTOPPED)) == 0)
pflush(pp);
- (void) sigrelse(mask(SIGCHLD));
/*
* Here's where dead procs get flushed.
*/
/*
* Here's where dead procs get flushed.
*/
- (void) sigblock(mask(SIGCHLD));
for (pp = (fp = &proclist)->p_next; pp != PNULL; pp = (fp = pp)->p_next)
if (pp->p_pid == 0) {
fp->p_next = pp->p_next;
for (pp = (fp = &proclist)->p_next; pp != PNULL; pp = (fp = pp)->p_next)
if (pp->p_pid == 0) {
fp->p_next = pp->p_next;
xfree((char *)pp);
pp = fp;
}
xfree((char *)pp);
pp = fp;
}
- (void) sigrelse(mask(SIGCHLD));
-#ifdef notdef
- signal(SIGINT, SIG_IGN);
-#endif
register struct process *pp;
{
register struct process *fp;
register struct process *pp;
{
register struct process *fp;
- int jobflags, reason, omask;
* and the target process, or any of its friends, are running
*/
fp = pp;
* and the target process, or any of its friends, are running
*/
fp = pp;
- omask = sigblock(mask(SIGCHLD));
jobflags = 0;
do
jobflags |= fp->p_flags;
while((fp = (fp->p_friends)) != pp);
if ((jobflags & PRUNNING) == 0)
break;
jobflags = 0;
do
jobflags |= fp->p_flags;
while((fp = (fp->p_friends)) != pp);
if ((jobflags & PRUNNING) == 0)
break;
- sigpause(omask &~ mask(SIGCHLD));
+ sigpause(sigblock(0) &~ mask(SIGCHLD));
if (tpgrp > 0)
ioctl(FSHTTY, TIOCSPGRP, &tpgrp); /* get tty back */
if ((jobflags&(PSIGNALED|PSTOPPED|PTIME)) ||
if (tpgrp > 0)
ioctl(FSHTTY, TIOCSPGRP, &tpgrp); /* get tty back */
if ((jobflags&(PSIGNALED|PSTOPPED|PTIME)) ||
dowait()
{
register struct process *pp;
dowait()
{
register struct process *pp;
- (void) sigrelse(mask(SIGINT));
- omask = sigblock(mask(SIGCHLD));
for (pp = proclist.p_next; pp; pp = pp->p_next)
if (pp->p_pid && pp->p_pid == pp->p_jobid &&
pp->p_flags&PRUNNING) {
for (pp = proclist.p_next; pp; pp = pp->p_next)
if (pp->p_pid && pp->p_pid == pp->p_jobid &&
pp->p_flags&PRUNNING) {
- sigpause(omask &~ mask(SIGCHLD));
+ sigpause(sigblock(0) &~ mask(SIGCHLD));
pp = pfind(*v);
pstart(pp, 1);
if (setintr)
pp = pfind(*v);
pstart(pp, 1);
if (setintr)
- signal(SIGINT, SIG_IGN);
pjwait(pp);
} while (*v && *++v);
}
pjwait(pp);
} while (*v && *++v);
}
pp = pfind(v[0]);
pstart(pp, 1);
if (setintr)
pp = pfind(v[0]);
pstart(pp, 1);
if (setintr)
- signal(SIGINT, SIG_IGN);
register int jobflags = 0;
int pid;
extern char *sys_errlist[];
register int jobflags = 0;
int pid;
extern char *sys_errlist[];
- int err = 0, omask = 0;
- omask |= mask(SIGINT);
- omask |= mask(SIGCHLD);
- omask = sigblock(omask);
+ sighold(SIGINT);
+ sighold(SIGCHLD);
while (*v) {
if (**v == '%') {
np = pp = pfind(*v);
while (*v) {
if (**v == '%') {
np = pp = pfind(*v);
+ sigrelse(SIGCHLD);
+ if (setintr)
+ sigrelse(SIGINT);
register struct process *np;
int jobflags = 0;
register struct process *np;
int jobflags = 0;
- (void) sigblock(mask(SIGCHLD));
np = pp;
do {
jobflags |= np->p_flags;
np = pp;
do {
jobflags |= np->p_flags;
ioctl(FSHTTY, TIOCSPGRP, &pp->p_jobid);
if (jobflags&PSTOPPED)
killpg(pp->p_jobid, SIGCONT);
ioctl(FSHTTY, TIOCSPGRP, &pp->p_jobid);
if (jobflags&PSTOPPED)
killpg(pp->p_jobid, SIGCONT);
- (void) sigrelse(mask(SIGCHLD));
{
register int pid;
bool ignint = 0;
{
register int pid;
bool ignint = 0;
/*
* A child will be uninterruptible only under very special
/*
* A child will be uninterruptible only under very special
/*
* Hold SIGCHLD until we have the process installed in our table.
*/
/*
* Hold SIGCHLD until we have the process installed in our table.
*/
- (void) sigblock(mask(SIGCHLD));
while ((pid = fork()) < 0)
if (setintr == 0)
sleep(FORKSLEEP);
else {
while ((pid = fork()) < 0)
if (setintr == 0)
sleep(FORKSLEEP);
else {
- (void) sigrelse(mask(SIGINT)|mask(SIGCHLD));
+ sigrelse(SIGINT);
+ sigrelse(SIGCHLD);
error("No more processes");
}
if (pid == 0) {
error("No more processes");
}
if (pid == 0) {
child++;
if (setintr) {
setintr = 0; /* until I think otherwise */
child++;
if (setintr) {
setintr = 0; /* until I think otherwise */
- (void) sigrelse(mask(SIGCHLD));
/*
* Children just get blown away on SIGINT, SIGQUIT
* unless "onintr -" seen.
/*
* Children just get blown away on SIGINT, SIGQUIT
* unless "onintr -" seen.
- sigrelse(mask(SIGINT));
- (void) sigrelse(mask(SIGCHLD));
if (tpgrp == 0)
error("No job control in subshells");
}
if (tpgrp == 0)
error("No job control in subshells");
}
-
-/*
- * For "compatibility".
- */
-sigrelse(m)
-{
-
- return (sigsetmask(sigblock(0) &~ m));
-}
-static char *sccsid = "@(#)sem.c 4.2 %G%";
+static char *sccsid = "@(#)sem.c 4.3 %G%";
#include "sh.h"
#include "sh.proc.h"
#include "sh.h"
#include "sh.proc.h"
int ochild, osetintr, ohaderr, odidfds, odidcch;
int oSHIN, oSHOUT, oSHDIAG, oOLDSTD, otpgrp;
int ochild, osetintr, ohaderr, odidfds, odidcch;
int oSHIN, oSHOUT, oSHDIAG, oOLDSTD, otpgrp;
- (void) sigblock(mask(SIGCHLD));
ochild = child; osetintr = setintr;
ohaderr = haderr; odidfds = didfds; odidcch = didcch;
oSHIN = SHIN; oSHOUT = SHOUT;
ochild = child; osetintr = setintr;
ohaderr = haderr; odidfds = didfds; odidcch = didcch;
oSHIN = SHIN; oSHOUT = SHOUT;
Vsav = Vdp = 0; Vav = 0;
pid = vfork();
if (pid < 0) {
Vsav = Vdp = 0; Vav = 0;
pid = vfork();
if (pid < 0) {
- (void) sigrelse(mask(SIGCHLD));
error("No more processes");
}
forked++;
error("No more processes");
}
forked++;
xfree(Vav); Vav = 0;
/* this is from pfork() */
palloc(pid, t);
xfree(Vav); Vav = 0;
/* this is from pfork() */
palloc(pid, t);
- (void) sigrelse(mask(SIGCHLD));
} else {
/* this is from pfork() */
int pgrp;
} else {
/* this is from pfork() */
int pgrp;
if (setintr) {
setintr = 0;
#ifdef notdef
if (setintr) {
setintr = 0;
#ifdef notdef
- signal(SIGCHLD, SIG_DFL);
+ sigsys(SIGCHLD, SIG_DFL);
ignint ? SIG_IGN : vffree);
ignint ? SIG_IGN : vffree);
ignint ? SIG_IGN : SIG_DFL);
if (wanttty >= 0) {
ignint ? SIG_IGN : SIG_DFL);
if (wanttty >= 0) {
- signal(SIGTSTP, SIG_DFL);
- signal(SIGTTIN, SIG_DFL);
- signal(SIGTTOU, SIG_DFL);
+ sigsys(SIGTSTP, SIG_DFL);
+ sigsys(SIGTTIN, SIG_DFL);
+ sigsys(SIGTTOU, SIG_DFL);
- signal(SIGTERM, parterm);
+ sigsys(SIGTERM, parterm);
} else if (tpgrp == -1 && (t->t_dflg&FINT)) {
} else if (tpgrp == -1 && (t->t_dflg&FINT)) {
- signal(SIGINT, SIG_IGN);
- signal(SIGQUIT, SIG_IGN);
+ sigsys(SIGINT, SIG_IGN);
+ sigsys(SIGQUIT, SIG_IGN);
}
if (wanttty > 0)
ioctl(FSHTTY, TIOCSPGRP, &pgrp);
}
if (wanttty > 0)
ioctl(FSHTTY, TIOCSPGRP, &pgrp);
if (tpgrp > 0)
tpgrp = 0;
if (t->t_dflg & FNOHUP)
if (tpgrp > 0)
tpgrp = 0;
if (t->t_dflg & FNOHUP)
- signal(SIGHUP, SIG_IGN);
+ sigsys(SIGHUP, SIG_IGN);
if (t->t_dflg & FNICE)
nice(t->t_nice);
}
if (t->t_dflg & FNICE)
nice(t->t_nice);
}