simon@its63b.ed.ac.uk (Simon Brown) (07/26/87)
Here's a patch for the System V shell job-control diffs that were posted
in comp.sources.unix a few weeks ago.
To install the patches, unshar this archive, then patch from "Patch1".
There are two bugs fixed:
1. The "io.c" patch fixes the bug that causes the shell to hang if you
try to do any input from your ".profile" (such as a `read' command).
2. The "proc.c" patch fixes up a typo that probably doesn't make any
real difference really, but it's probably better to have it mended...
Oh yes, there's a "patchversion.h" file too, so's you'll know what patches
you've stuck in.
%{
Simon!
%}
----------------- cut here and unshar -------------------------
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
# Patch1
# patchversion.h
# This archive created: Sun Jun 28 15:33:45 1987
# By: Simon Brown (Computer Science Department, Edinburgh University)
export PATH; PATH=/bin:/usr/bin:$PATH
echo shar: "extracting 'Patch1'" '(2449 characters)'
if test -f 'Patch1'
then
echo shar: "will not over-write existing file 'Patch1'"
else
cat << \SHAR_EOF > 'Patch1'
PATCH FOR "io.c":
*** io.c Sat Jun 27 18:30:46 1987
--- ../io.c Mon Mar 30 17:38:53 1987
***************
*** 347,352
#define CONSTTYIO 14
/* this is a bit naughty: still... its only declared for sgtty, not termio! */
#define TIOCEXCL (('t'<<8)|13)
static char sxt[] = "/dev/sxt/000";
--- 347,353 -----
#define CONSTTYIO 14
/* this is a bit naughty: still... its only declared for sgtty, not termio! */
+ #ifndef TIOCEXCL
#define TIOCEXCL (('t'<<8)|13)
#endif
***************
*** 348,353
/* this is a bit naughty: still... its only declared for sgtty, not termio! */
#define TIOCEXCL (('t'<<8)|13)
static char sxt[] = "/dev/sxt/000";
static char no_jobs[] = "; thus no job-control\n";
--- 349,355 -----
/* this is a bit naughty: still... its only declared for sgtty, not termio! */
#ifndef TIOCEXCL
#define TIOCEXCL (('t'<<8)|13)
+ #endif
static char sxt[] = "/dev/sxt/000";
static char no_jobs[] = "; thus no job-control\n";
***************
*** 464,471
}
close(0);
close(1); close(2); /* forget real tty */
! dup(fd); /* input is channel 0 or 1 */
! dup(0); dup(0); /* stdout/stderr channel 0 or 1 too*/
close(fd);
iflags |= jobflg;
return;
--- 466,473 -----
}
close(0);
close(1); close(2); /* forget real tty */
! dup(fd); /* input is channel 1 */
! dup(0); dup(0); /* stdout/stderr channel 1 too*/
close(fd);
ioctl(sxt_fd,SXTIOCSWTCH,1); /* switch to channel 1 */
iflags |= jobflg;
***************
*** 467,472
dup(fd); /* input is channel 0 or 1 */
dup(0); dup(0); /* stdout/stderr channel 0 or 1 too*/
close(fd);
iflags |= jobflg;
return;
--- 469,475 -----
dup(fd); /* input is channel 1 */
dup(0); dup(0); /* stdout/stderr channel 1 too*/
close(fd);
+ ioctl(sxt_fd,SXTIOCSWTCH,1); /* switch to channel 1 */
iflags |= jobflg;
return;
PATCH FOR "proc.c":
*** proc.c Sat Jun 27 18:24:56 1987
--- ../proc.c Sun Jun 28 15:26:10 1987
***************
*** 245,251
continue;
iflags |= sxtwaiting;
oldex = extracnt;
! while (ioctl(sxt_fd,SXTIOCWF,0) == -1)
iflags &= ~sxtwaiting;
setsxt(currentjob);
if (jobs[currentjob]->jb_sxtfg!=(-1))
--- 245,251 -----
continue;
iflags |= sxtwaiting;
oldex = extracnt;
! while (ioctl(sxt_fd,SXTIOCWF,0) == -1);
iflags &= ~sxtwaiting;
setsxt(currentjob);
if (jobs[currentjob]->jb_sxtfg!=(-1))
SHAR_EOF
fi
echo shar: "extracting 'patchversion.h'" '(23 characters)'
if test -f 'patchversion.h'
then
echo shar: "will not over-write existing file 'patchversion.h'"
else
cat << \SHAR_EOF > 'patchversion.h'
#define PATCHVERSION 1
SHAR_EOF
fi
exit 0
# End of shell archive
--
----------------------------------
| Simon Brown | UUCP: seismo!mcvax!ukc!its63b!simon
| Department of Computer Science | JANET: simon@uk.ac.ed.its63b
| University of Edinburgh, | ARPA: simon%its63b.ed.ac.uk@cs.ucl.ac.uk
| Scotland, UK. |
---------------------------------- "Life's like that, you know"