jrstu@cbnewsd.ATT.COM (james.stuhlmacher) (02/10/90)
When trapping signal 15 in sh(1), sh responses with
trap: bad signal number
Of course signal 15 (SIGTERM) is not a bad signal number. After
looking through the code, sh(1) uses _NSIG, which is defined in
<signal.h>, to determine the number of signals on the system. _NSIG is
defined as 15 in MINIX with the signal numbers ranging from 1 to 15.
Sh(1), on the other hand, assumes the range is 0 to 14. The patches
below will make the high end 15 (literally _NSIG). Please note that
you may get a warning about line numbers being off in sh3.c. You
should ignore this.
Jim Stuhlmacher
j.stuhlmacher@att.com
..!att!ihlpb!jims
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of shell archive."
# Contents: sh.hdif sh3.cdif sh4.cdif
# Wrapped by root@stu on Thu Feb 8 22:38:49 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'sh.hdif' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'sh.hdif'\"
else
echo shar: Extracting \"'sh.hdif'\" \(626 characters\)
sed "s/^X//" >'sh.hdif' <<'END_OF_FILE'
X*** SVC/sh.h Thu Feb 8 22:37:42 1990
X--- sh.h Thu Feb 8 21:54:06 1990
X***************
X*** 152,159 ****
X extern char *null; /* null value for variable */
X extern int intr; /* interrupt pending */
X
X! Extern char *trap[_NSIG];
X! Extern char ourtrap[_NSIG];
X Extern int trapset; /* trap pending */
X
X extern int heedint; /* heed interrupt signals */
X--- 152,159 ----
X extern char *null; /* null value for variable */
X extern int intr; /* interrupt pending */
X
X! Extern char *trap[_NSIG+1];
X! Extern char ourtrap[_NSIG+1];
X Extern int trapset; /* trap pending */
X
X extern int heedint; /* heed interrupt signals */
END_OF_FILE
if test 626 -ne `wc -c <'sh.hdif'`; then
echo shar: \"'sh.hdif'\" unpacked with wrong size!
fi
# end of 'sh.hdif'
fi
if test -f 'sh3.cdif' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'sh3.cdif'\"
else
echo shar: Extracting \"'sh3.cdif'\" \(692 characters\)
sed "s/^X//" >'sh3.cdif' <<'END_OF_FILE'
X*** SVC/sh3.c Thu Feb 8 21:29:09 1990
X--- sh3.c Thu Feb 8 21:52:49 1990
X***************
X*** 809,815 ****
X register int resetsig;
X
X if (t->words[1] == NULL) {
X! for (i=0; i<_NSIG; i++)
X if (trap[i]) {
X prn(i);
X prs(": ");
X--- 809,815 ----
X register int resetsig;
X
X if (t->words[1] == NULL) {
X! for (i=0; i<=_NSIG; i++)
X if (trap[i]) {
X prn(i);
X prs(": ");
X***************
X*** 848,854 ****
X {
X register int n;
X
X! if ((n = getn(s)) < 0 || n >= _NSIG) {
X err("trap: bad signal number");
X n = 0;
X }
X--- 848,854 ----
X {
X register int n;
X
X! if ((n = getn(s)) < 0 || n > _NSIG) {
X err("trap: bad signal number");
X n = 0;
X }
END_OF_FILE
if test 692 -ne `wc -c <'sh3.cdif'`; then
echo shar: \"'sh3.cdif'\" unpacked with wrong size!
fi
# end of 'sh3.cdif'
fi
if test -f 'sh4.cdif' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'sh4.cdif'\"
else
echo shar: Extracting \"'sh4.cdif'\" \(469 characters\)
sed "s/^X//" >'sh4.cdif' <<'END_OF_FILE'
X*** SVC/sh4.c Thu Feb 8 21:53:12 1990
X--- sh4.c Thu Feb 8 21:53:47 1990
X***************
X*** 361,367 ****
X }
X *cp = 0;
X /* allow trapped signals */
X! for (i=0; i<_NSIG; i++)
X if (ourtrap[i] && signal(i, SIG_IGN) != SIG_IGN)
X signal(i, SIG_DFL);
X dup2(pf[1], 1);
X--- 361,367 ----
X }
X *cp = 0;
X /* allow trapped signals */
X! for (i=0; i<=_NSIG; i++)
X if (ourtrap[i] && signal(i, SIG_IGN) != SIG_IGN)
X signal(i, SIG_DFL);
X dup2(pf[1], 1);
END_OF_FILE
if test 469 -ne `wc -c <'sh4.cdif'`; then
echo shar: \"'sh4.cdif'\" unpacked with wrong size!
fi
# end of 'sh4.cdif'
fi
echo shar: End of shell archive.
exit 0