home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume40 / pdksh / patch09a < prev    next >
Encoding:
Text File  |  1993-10-29  |  41.0 KB  |  1,753 lines

  1. Newsgroups: comp.sources.misc
  2. From: sjg@zen.void.oz.au (Simon J. Gerraty)
  3. Subject: v40i006:  pdksh -  Public Domain Korn Shell, v4, Patch09a/2
  4. Message-ID: <csm-v40i006=pdksh.224357@sparky.Sterling.COM>
  5. X-Md4-Signature: f01a0b95a988906205fa72af8c60037c
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: Sterling Software
  8. Date: Mon, 11 Oct 1993 03:45:06 GMT
  9. Approved: kent@sparky.sterling.com
  10.  
  11. Submitted-by: sjg@zen.void.oz.au (Simon J. Gerraty)
  12. Posting-number: Volume 40, Issue 6
  13. Archive-name: pdksh/patch09a
  14. Environment: UNIX
  15. Patch-To: pdksh: Volume 25, Issue 47-55
  16.  
  17. This is patch09 to pd-ksh version 4.  It is in two parts, so
  18. be sure to apply both before attempting to re-build.
  19.  
  20. I appologize for the time taken to get this out, pressures of work
  21. and having a dead computer for a few months are my excuse :-)
  22.  
  23. This patch fixes problems with job-control on 386bsd and similar
  24. platforms as well as re-directed loops and a few core dumps.
  25. See sh/ChangeLog for the contributors of various fixes.
  26.  
  27. This is the last patch to version 4 of pd-ksh.  I hope to release
  28. version 5 "real soon now". Version 5 was to include these patches as
  29. well as a metaconfig generated configure script.  Delays in starting
  30. on version 5 have prompted the release of this patch for version 4.
  31.  
  32. --sjg
  33. start of patch 29-Sep-1993
  34. (suggested archive name: pch29Sep93.Z)
  35. It should be applied by changing directory to the root
  36. of the source tree and using the command:
  37.     patch -p0 < patch09a
  38.     patch -p0 < patch09b
  39.  
  40. The following is a complete list of patches to date.
  41.  
  42. # PD ksh Version 4
  43. Prereq: 09-Nov-91
  44. Prereq: 10-Nov-91
  45. Prereq: 25-Nov-91
  46. Prereq: 25-Apr-92
  47. Prereq: 26-Apr-92
  48. Prereq: 27-Apr-92
  49. Prereq: 12-May-92
  50. Prereq: 02-Aug-92
  51. Prereq: 12-Aug-92
  52. Prereq: 05-Dec-92
  53. *** PATCHDATES.old    Wed Sep 29 08:42:18 1993
  54. --- PATCHDATES    Wed Sep 29 08:59:56 1993
  55. ***************
  56. *** 9,11 ****
  57. --- 9,12 ----
  58.   02-Aug-92
  59.   12-Aug-92
  60.   05-Dec-92
  61. + 29-Sep-1993
  62. *** ChangeLog.old    Mon Aug 10 21:58:49 1992
  63. --- ChangeLog    Sun May  9 01:59:09 1993
  64. ***************
  65. *** 1,3 ****
  66. --- 1,7 ----
  67. + Sat May  8 15:55:24 1993  Simon J. Gerraty  (sjg@zen.void.oz.au)
  68. +     * Ported to 386bsd - sh directory only, stc/* not needed.
  69.   Sat Aug  1 17:11:24 1992  Simon J. Gerraty  (sjg@zen)
  70.   
  71.       * Incorporated massive contribution from Peter Collinson
  72. *** INSTALL.old    Sat May  2 23:25:25 1992
  73. --- INSTALL    Wed Sep 29 18:57:08 1993
  74. ***************
  75. *** 21,26 ****
  76. --- 21,29 ----
  77.   avoids problems like BSD times() calls that do not return an
  78.   indication of elapsed time and so on.
  79.   
  80. + For current *BSD (386bsd,NetBSD,FreeBSD and I assume BSD/386) it is
  81. + best to build without the ./std tree.
  82.   Using ./std:
  83.   ------------
  84.   
  85. *** MACHINES.old    Mon Aug 10 21:58:54 1992
  86. --- MACHINES    Sun May  9 01:59:12 1993
  87. ***************
  88. *** 14,19 ****
  89. --- 14,20 ----
  90.   
  91.   System, OS            Notes    Compiler/Flags
  92.   --------------------------    -----    --------------
  93. + 386bsd    386bsd-0.1 (pk0.2.3)    1,5    {cc,gcc} -D_BSD -D_POSIX_TERM
  94.   sun386, SunOS 4.0.2        1,4    {cc,gcc} -D_BSD
  95.   sun4c,    SunOS 4.1.1        1,4    {cc,gcc-2.1} -ansi -D_BSD -DHAVE_SYS_STDTYPES
  96.   sun3,    SunOS 4.0.3        1,4    {cc,gcc} -D_BSD
  97. *** Makefile.old    Mon Aug 10 21:58:56 1992
  98. --- Makefile    Sun May  9 01:59:14 1993
  99. ***************
  100. *** 1,5 ****
  101.   # PD Bourne/Korn Shell
  102. ! # $Id: Makefile,v 1.3 1992/08/10 11:59:10 sjg Exp $
  103.   
  104.   SHELL = /bin/sh
  105.   MAKE  = make
  106. --- 1,5 ----
  107.   # PD Bourne/Korn Shell
  108. ! # $Id: Makefile,v 1.5 93/05/08 15:59:28 sjg Exp $
  109.   
  110.   SHELL = /bin/sh
  111.   MAKE  = make
  112. ***************
  113. *** 7,17 ****
  114.   LN=ln -s
  115.   #LN=ln
  116.   #CONFIG= -D_SYSV
  117. ! CONFIG= -D_BSD 
  118.   #CONFIG= -D_BSD -DHAVE_SYS_STDTYPES
  119.   #CONFIG= -D_V7
  120.   #CONFIG= -D_ST                # Atari ST
  121.   #CONFIG= -D_BSDI -D_POSIX_TERM        # BSD/386
  122.   MANPAGES = ksh.1
  123.   #MANDIR=/usr/catman/u_man/man1
  124.   #MANDIR=/usr/man/man1
  125. --- 7,18 ----
  126.   LN=ln -s
  127.   #LN=ln
  128.   #CONFIG= -D_SYSV
  129. ! #CONFIG= -D_BSD 
  130.   #CONFIG= -D_BSD -DHAVE_SYS_STDTYPES
  131.   #CONFIG= -D_V7
  132.   #CONFIG= -D_ST                # Atari ST
  133.   #CONFIG= -D_BSDI -D_POSIX_TERM        # BSD/386
  134. + CONFIG= -D_BSD -D_POSIX_TERM        # 386bsd
  135.   MANPAGES = ksh.1
  136.   #MANDIR=/usr/catman/u_man/man1
  137.   #MANDIR=/usr/man/man1
  138. *** README.old    Sun Dec  6 00:14:16 1992
  139. --- README    Wed Sep 29 18:57:11 1993
  140. ***************
  141. *** 1,27 ****
  142.           Public Domain Korn Shell
  143. !               Version 4.8
  144.   
  145.   PD KSH:
  146.   
  147. ! This is the latest version of the PD ksh (pdksh).  It is not
  148. ! intended to be the ultimate shell but rather a usable ksh work
  149. ! alike.  For those of us who have to work on multiple systems it
  150. ! is nice to have the same user interface on all.  I resisted
  151. ! moving to the ksh on a System V machine where I worked, for
  152. ! nearly a year due to the lack of a ksh on my Sun systems.  When
  153. ! I first picked up the 3.2 PD KSH a couple of years ago, it took
  154. ! only a few minutes to convert a C-shell fan to a ksh fan :-)
  155. ! Pdksh is not 100% compatible with the ksh.  Having said that, I
  156. ! use it daily beside a real ksh88 and find them virtually
  157. ! indistinguishable.  With one exception - arrays!  If some one
  158. ! feels like adding arrays, I for one would appreciate it :-)
  159.   
  160. ! I only run this shell on sun's and only for interactive use.  I
  161. ! use it on sun4c, sun3 and sun386 systems.  The shell itself has
  162. ! been compiled on each of these both with and without the
  163. ! POSIX/ANSI compatability libraries in ./std.  See the file
  164. ! MACHINES for details of systems that the shell has been built
  165. ! on.
  166.   
  167.   I released version 4.0 of the shell (with the kind permission of
  168.   the previous maintainers and major contributors) to ensure that
  169. --- 1,26 ----
  170.           Public Domain Korn Shell
  171. !               Version 4.9
  172.   
  173.   PD KSH:
  174.   
  175. ! This is the latest version of the PD ksh (pdksh).  It is not intended
  176. ! to be the ultimate shell but rather a usable ksh work alike.  For
  177. ! those of us who have to work on multiple systems it is nice to have
  178. ! the same user interface on all.  I resisted moving to the ksh on a
  179. ! System V machine where I worked, for nearly a year due to the lack of
  180. ! a ksh on my Sun systems.  When I first picked up the 3.2 PD KSH a
  181. ! couple of years ago, it took only a few minutes to convert a C-shell
  182. ! fan to a ksh fan :-) Pdksh is not 100% compatible with the ksh.
  183. ! Having said that, I use it daily beside a real ksh88 and find them
  184. ! virtually indistinguishable.  With one exception - arrays!  If some
  185. ! one feels like adding arrays, I for one would appreciate it :-)
  186.   
  187. ! I only run this shell on sun's and BSD systems and only for
  188. ! interactive use.  I use it on sun4c, sun3, sun386 and 386bsd systems.
  189. ! The shell itself has been compiled on the sun's both with and without
  190. ! the POSIX/ANSI compatability libraries in ./std. I do not use ./std
  191. ! for 386bsd and friends.  See the file MACHINES for details of systems
  192. ! that the shell has been built on.
  193.   
  194.   I released version 4.0 of the shell (with the kind permission of
  195.   the previous maintainers and major contributors) to ensure that
  196. *** bug-report.old    Sun Dec  6 00:14:20 1992
  197. --- bug-report    Wed Sep 29 18:57:12 1993
  198. ***************
  199. *** 2,12 ****
  200.   Subject: [area]: [synopsis]   [replace with actual area and short description]
  201.   
  202.   VERSION:
  203. !     PD KSH: 4.8 05-Dec-92
  204.       [Official patches will edit this line to indicate the patch level]
  205.   
  206.   MACHINE and OPERATING SYSTEM:
  207. !     [e.g. Sparc/SunOS 4.1.1, DECstation 3100/Ultrix 4.2, ...]
  208.   
  209.   COMPILER:
  210.       [e.g. native cc, native ANSI cc, gcc 1.40, ...]
  211. --- 2,12 ----
  212.   Subject: [area]: [synopsis]   [replace with actual area and short description]
  213.   
  214.   VERSION:
  215. !     PD KSH: 4.9 29-Sep-1993
  216.       [Official patches will edit this line to indicate the patch level]
  217.   
  218.   MACHINE and OPERATING SYSTEM:
  219. !     [e.g. 386bsd-0.1+0.2.4, Sparc/SunOS 4.1.1, DECstation 3100/Ultrix 4.2, ...]
  220.   
  221.   COMPILER:
  222.       [e.g. native cc, native ANSI cc, gcc 1.40, ...]
  223. *** etc/ksh.kshrc.old    Sun Dec  6 00:14:34 1992
  224. --- etc/ksh.kshrc    Wed Sep 29 18:57:36 1993
  225. ***************
  226. *** 17,23 ****
  227.   #
  228.   
  229.   # RCSid:
  230. ! #    $Id: ksh.kshrc,v 1.4 1992/12/05 13:14:48 sjg Exp $
  231.   #
  232.   #    @(#)Copyright (c) 1991 Simon J. Gerraty
  233.   #
  234. --- 17,23 ----
  235.   #
  236.   
  237.   # RCSid:
  238. ! #    $Id: ksh.kshrc,v 1.6 93/09/29 08:57:50 sjg Exp $
  239.   #
  240.   #    @(#)Copyright (c) 1991 Simon J. Gerraty
  241.   #
  242. ***************
  243. *** 81,96 ****
  244.       esac
  245.       # do we want window decorations?
  246.       if [ "$ILS" ]; then
  247. -         wftp () { ilabel "ftp $*"; "ftp" $*; 
  248. -             ilabel "$USER@$HOSTNAME"; }
  249. -         wcd () { "cd" $*; eval stripe; }
  250.           ilabel () { print -n "${ILS}$*${ILE}"; }
  251.           label () { print -n "${WLS}$*${WLE}"; }
  252. !         alias stripe='label $USER @ $HOSTNAME \($tty\) - $PWD'
  253.           alias cd=wcd
  254.           alias ftp=wftp
  255.           eval stripe
  256. !         eval ilabel "$USER@$HOSTNAME"
  257.           PS1=$PROMPT
  258.       fi
  259.       alias quit=exit
  260. --- 81,112 ----
  261.       esac
  262.       # do we want window decorations?
  263.       if [ "$ILS" ]; then
  264.           ilabel () { print -n "${ILS}$*${ILE}"; }
  265.           label () { print -n "${WLS}$*${WLE}"; }
  266. !         alias stripe='label "$USER@$HOST ($tty) - $PWD"'
  267. !         alias istripe='ilabel "$USER@$HOST ($tty)"'
  268. !         wftp () { ilabel "ftp $*"; "ftp" $*; eval istripe; }
  269. !         wcd () { "cd" $*; eval stripe; }
  270. !         wtelnet ()
  271. !         {
  272. !             "telnet" "$@"
  273. !             eval istripe
  274. !             eval stripe
  275. !         }
  276. !         wsu ()
  277. !         {
  278. !             "su" "$@"
  279. !             eval istripe
  280. !             eval stripe
  281. !         }
  282. !         alias su=wsu
  283.           alias cd=wcd
  284.           alias ftp=wftp
  285. +         alias telnet=wtelnet
  286.           eval stripe
  287. !         eval istripe
  288.           PS1=$PROMPT
  289.       fi
  290.       alias quit=exit
  291. *** etc/profile.old    Mon Aug 10 21:59:57 1992
  292. --- etc/profile    Wed Sep 29 18:57:38 1993
  293. ***************
  294. *** 12,18 ****
  295.   #    /etc/ksh.kshrc
  296.   
  297.   # RCSid:
  298. ! #    $Id: profile,v 1.4 1992/08/10 12:00:11 sjg Exp $
  299.   #
  300.   #    @(#)Copyright (c) 1991 Simon J. Gerraty
  301.   #
  302. --- 12,18 ----
  303.   #    /etc/ksh.kshrc
  304.   
  305.   # RCSid:
  306. ! #    $Id: profile,v 1.6 93/09/29 08:57:52 sjg Exp $
  307.   #
  308.   #    @(#)Copyright (c) 1991 Simon J. Gerraty
  309.   #
  310. ***************
  311. *** 23,28 ****
  312. --- 23,36 ----
  313.   #    the above copyright notice and this notice are
  314.   #    left intact. 
  315.   
  316. + sigs="2 3"
  317. + trap "" $sigs    # don't interrupt us
  318. + add_path () { [ -d $1 ] && eval ${2:-PATH}="\$${2:-PATH}:$1"; }
  319. + pre_path () { [ -d $1 ] && eval ${2:-PATH}="$1:\$${2:-PATH}"; }
  320. + del_path () { eval ${2:-PATH}=`eval echo :'$'${2:-PATH}: | 
  321. +     sed -e "s;:$1:;:;g" -e "s;^:;;" -e "s;:\$;;"`; }
  322.   case "$_INIT_" in
  323.   *env*) ;;
  324.   *)    # do these once
  325. ***************
  326. *** 52,59 ****
  327.             SINGLE=n        # doesn't matter so much
  328.       fi
  329.       # pick one of the following for the default umask
  330. !     # umask 002    # relaxed    -rwxrwxr-x
  331. !     umask 022    # cautious    -rwxr-xr-x
  332.       # umask 027    # uptight    -rwxr-x---
  333.       # umask 077    # paranoid    -rwx------
  334.       # you can override the default umask
  335. --- 60,67 ----
  336.             SINGLE=n        # doesn't matter so much
  337.       fi
  338.       # pick one of the following for the default umask
  339. !     umask 002    # relaxed    -rwxrwxr-x
  340. !     # umask 022    # cautious    -rwxr-xr-x
  341.       # umask 027    # uptight    -rwxr-x---
  342.       # umask 077    # paranoid    -rwx------
  343.       # you can override the default umask
  344. ***************
  345. *** 65,70 ****
  346. --- 73,84 ----
  347.           LOCAL=/usr/local
  348.       fi
  349.   
  350. +     # defaults (might be reset below)
  351. +     PATH=/bin:/usr/bin
  352. +     MANPATH=/usr/man
  353. +     SPOOL=/usr/spool
  354. +     defterm=vt220
  355.       # set system specific things,
  356.       # eg. set PATH,MANPATH 
  357.       # override default ulimit if desired.
  358. ***************
  359. *** 74,109 ****
  360.       SunOS)
  361.           # On sun's /bin -> /usr/bin so leave it out!
  362.           PATH=/usr/bin:/usr/ucb:/usr/5bin:.
  363. -         MANPATH=/usr/man
  364. -         defterm=vt220
  365.           ;;
  366.       SCO-UNIX)
  367. -         PATH=/bin:/usr/bin:/usr/lbin:/usr/dbin:/usr/ldbin:.
  368. -         MANPATH=/usr/man
  369.           defterm=ansi
  370.           ;;
  371.       B.O.S.)
  372. -         PATH=/bin:/usr/bin:.
  373. -         if [ -d /usr/ucb ]; then
  374. -             PATH=$PATH:/usr/ucb
  375. -         fi
  376.           MANPATH=/usr/catman
  377. -         defterm=vt220
  378.           SRC_COMPAT=_SYSV
  379.           export SRC_COMPAT
  380.           ;;
  381. !     *)
  382. !         PATH=/bin:/usr/bin:.
  383. !         if [ -d /usr/ucb ]; then
  384. !             PATH=$PATH:/usr/ucb
  385. !         fi
  386. !         MANPATH=/usr/catman
  387. !         defterm=vt220
  388.           ;;
  389.       esac
  390. !     if [ -d ${LOCAL}/bin ]; then
  391. !         PATH=$PATH:${LOCAL}/bin
  392. !     fi
  393.       case "$HOME" in
  394.       /)    ;;
  395.       ""|/tmp)
  396. --- 88,122 ----
  397.       SunOS)
  398.           # On sun's /bin -> /usr/bin so leave it out!
  399.           PATH=/usr/bin:/usr/ucb:/usr/5bin:.
  400.           ;;
  401.       SCO-UNIX)
  402.           defterm=ansi
  403.           ;;
  404.       B.O.S.)
  405.           MANPATH=/usr/catman
  406.           SRC_COMPAT=_SYSV
  407.           export SRC_COMPAT
  408.           ;;
  409. !     386bsd)
  410. !         MANPATH=/usr/share/man
  411. !         add_path /usr/X386/man MANPATH
  412. !         MAILDIR=/var/mail
  413. !         SPOOL=/var/spool
  414.           ;;
  415.       esac
  416. !     # add_path only adds them if they exist
  417. !     add_path /sbin
  418. !     add_path /usr/sbin
  419. !     add_path /usr/distbin
  420. !     add_path /usr/ucb
  421. !     add_path /usr/lbin
  422. !     add_path /usr/dbin
  423. !     add_path /usr/ldbin
  424. !     add_path ${LOCAL}/bin
  425. !     add_path /usr/bin/X11
  426. !     # ensure . is at end
  427. !     PATH=$PATH:.
  428.       case "$HOME" in
  429.       /)    ;;
  430.       ""|/tmp)
  431. ***************
  432. *** 111,124 ****
  433.           HOME=/tmp; export HOME
  434.           ;;
  435.       *)
  436. !         if [ -d $HOME/bin ]; then
  437. !             PATH=$PATH:$HOME/bin
  438. !         fi
  439.           ;;
  440.       esac
  441. !     if [ -d ${LOCAL}/man ]; then
  442. !         MANPATH=$MANPATH:${LOCAL}/man
  443. !     fi
  444.       # make sure these are set at least once
  445.       LOGNAME=${LOGNAME:-`logname`}
  446.       USER=${USER:-$LOGNAME}
  447. --- 124,134 ----
  448.           HOME=/tmp; export HOME
  449.           ;;
  450.       *)
  451. !         pre_path $HOME/bin
  452.           ;;
  453.       esac
  454. !     add_path ${LOCAL}/man MANPATH
  455.       # make sure these are set at least once
  456.       LOGNAME=${LOGNAME:-`logname`}
  457.       USER=${USER:-$LOGNAME}
  458. ***************
  459. *** 152,164 ****
  460.           # we are interactive
  461.           TTY=`tty`
  462.           TTY=`basename $TTY`
  463. !         ORGANIZATION=""
  464. !         COPYRIGHT="Copyright (c) `date +19%y` $ORGANIZATION"
  465. !         export ORGANIZATION COPYRIGHT
  466.           # set up some env variables
  467. !         MAIL=/usr/spool/mail/$USER
  468. !         MAILPATH=/usr/spool/mail/$USER:/etc/motd
  469.           EMACSDIR=${LOCAL}/lib/emacs
  470.           PAGER=${PAGER:-more}
  471.           export MAIL EMACSDIR MANPATH MAILPATH PAGER
  472. --- 162,175 ----
  473.           # we are interactive
  474.           TTY=`tty`
  475.           TTY=`basename $TTY`
  476. !         if [ -f /etc/organization ]; then
  477. !             ORGANIZATION="`cat /etc/organization`"
  478. !             COPYRIGHT="Copyright (c) `date +19%y` $ORGANIZATION"
  479. !             export ORGANIZATION COPYRIGHT
  480. !         fi
  481.           # set up some env variables
  482. !         MAIL=${MAILDIR:-$SPOOL/mail}/$USER
  483. !         MAILPATH=$MAIL:/etc/motd
  484.           EMACSDIR=${LOCAL}/lib/emacs
  485.           PAGER=${PAGER:-more}
  486.           export MAIL EMACSDIR MANPATH MAILPATH PAGER
  487. ***************
  488. *** 167,181 ****
  489.           EDITOR=emacs
  490.           FCEDIT=$EDITOR
  491.           export CVSROOT FCEDIT EDITOR
  492. - #        EMACSLOADPATH=$EMACSDIR/lisp
  493. - #        [ -d $LOCAL/lib/lisp ] && EMACSLOADPATH=$LOCAL/lib/lisp:$EMACSLOADPATH
  494. - #        [ -d $HOME/lisp ] && EMACSLOADPATH=$HOME/lisp:$EMACSLOADPATH
  495.           case $UID in 
  496.           0)    PROMPT="<$LOGNAME@$HOSTNAME># ";;
  497.           *)    PROMPT="<$LOGNAME@$HOSTNAME>$ ";;
  498.           esac
  499. - #        PUBDIR=/usr/spool/uucppublic
  500. - #        export PUBDIR EMACSLOADPATH
  501.           [ -f /etc/profile.TeX ] && . /etc/profile.TeX
  502.       else
  503.           TTY=none
  504. --- 178,187 ----
  505. ***************
  506. *** 186,191 ****
  507. --- 192,200 ----
  508.           # we are Korn shell
  509.           SHELL=/bin/ksh
  510.           ENV=${HOME%/}/.kshrc
  511. +         if [ ! -f $ENV ]; then
  512. +             ENV=/etc/ksh.kshrc
  513. +         fi
  514.           HISTFILE=${HOME%/}/.ksh_hist
  515.           case $UID in
  516.           0)
  517. ***************
  518. *** 225,230 ****
  519. --- 234,240 ----
  520.           # ensure known state
  521.           stty isig icanon intr '^c' erase '^h' kill '^u' eof '^d' 
  522.           mesg y
  523.           case $TERM in
  524.           network|unknown|dialup|"") 
  525.             echo ${_N_} "Enter terminal type [$defterm]: ${_C_}" 1>&2
  526. ***************
  527. *** 232,237 ****
  528. --- 242,252 ----
  529.             TERM=${tmpterm:-$defterm}
  530.             ;;
  531.           esac
  532. +         case "$TERM" in
  533. +         pc3)
  534. +             stty erase ^?
  535. +             ;;
  536. +         esac
  537.           # not all of the following are appropriate at all sites
  538.           # Sun's don't need to cat /etc/motd for instance
  539.           case "$OS" in
  540. ***************
  541. *** 242,247 ****
  542. --- 257,271 ----
  543.                   echo "You have mail."
  544.               [ -x /usr/bin/news ] && /usr/bin/news -n
  545.               ;;
  546. +         386bsd)
  547. +             # hardware flow control works so use it
  548. +             case $TTY in
  549. +             ttyd*)    # dialups
  550. +                 stty  -ixon -ixany
  551. +                 stty crtscts
  552. +                 ;;
  553. +             esac
  554. +             ;;
  555.           *)
  556.               [ -s /etc/motd ] && cat /etc/motd
  557.               if [ -x /usr/bin/mailx ]; then
  558. ***************
  559. *** 256,261 ****
  560. --- 280,288 ----
  561.               [ -x /usr/bin/news ] && /usr/bin/news -n
  562.               ;;
  563.           esac
  564. +         if [ -f $LOCAL/etc/1stlogin.ann ]; then
  565. +             [ -f $HOME/... ] || sh $LOCAL/etc/1stlogin.ann
  566. +         fi
  567.   #        [ -x /usr/games/fortune ] && /usr/games/fortune -a
  568.           # remind folk who turned on reply.pl to turn it off.
  569.           if [ -f $HOME/.forward ]; then
  570. ***************
  571. *** 276,278 ****
  572. --- 303,309 ----
  573.   esac
  574.   # Handle X-terminals if necessary
  575.   [ "$SINGLE" = n -a -f /etc/profile.X11 ] && . /etc/profile.X11
  576. + # make sure you have this bit last
  577. + trap $sigs    # restore signals
  578. + unset sigs
  579. *** etc/sys_config.sh.old    Mon Aug 10 22:00:00 1992
  580. --- etc/sys_config.sh    Wed Sep 29 18:59:22 1993
  581. ***************
  582. *** 16,22 ****
  583.   #    /etc/profile
  584.   
  585.   # RCSid:
  586. ! #    $Id: sys_config.sh,v 1.2 1992/08/10 12:00:14 sjg Exp $
  587.   #
  588.   #    @(#)Copyright (c) 1991 Simon J. Gerraty
  589.   #
  590. --- 16,22 ----
  591.   #    /etc/profile
  592.   
  593.   # RCSid:
  594. ! #    $Id: sys_config.sh,v 1.5 93/09/29 08:59:36 sjg Exp $
  595.   #
  596.   #    @(#)Copyright (c) 1991 Simon J. Gerraty
  597.   #
  598. ***************
  599. *** 29,35 ****
  600.   #
  601.   
  602.   # determin machine type
  603. ! if [ -f /usr/bin/arch ]; then
  604.       ARCH=`arch`
  605.   elif [ -f /usr/bin/uname -o -f /bin/uname ]; then
  606.       ARCH=`uname -m`
  607. --- 29,39 ----
  608.   #
  609.   
  610.   # determin machine type
  611. ! if [ -f /386bsd ]; then        # doesn't have uname or arch
  612. !     ARCH=i386
  613. !     OS=386bsd
  614. !     HOSTNAME=`hostname`
  615. ! elif [ -f /usr/bin/arch ]; then
  616.       ARCH=`arch`
  617.   elif [ -f /usr/bin/uname -o -f /bin/uname ]; then
  618.       ARCH=`uname -m`
  619. *** ksh.1.old    Sun Dec  6 00:14:23 1992
  620. --- ksh.1    Thu May  6 06:42:57 1993
  621. ***************
  622. *** 1,4 ****
  623. ! .\" $Id: ksh.1,v 1.3 1992/12/05 13:14:37 sjg Exp $
  624.   .nr OJ 1 \" Job Control
  625.   .nr OE 1 \" Command Editing
  626.   .nr OB 1 \" BSD enhanced ulimit options
  627. --- 1,4 ----
  628. ! .\" $Id: ksh.1,v 1.4 93/05/05 20:43:11 sjg Exp $
  629.   .nr OJ 1 \" Job Control
  630.   .nr OE 1 \" Command Editing
  631.   .nr OB 1 \" BSD enhanced ulimit options
  632. *** sh/ChangeLog.old    Sun Dec  6 00:14:47 1992
  633. --- sh/ChangeLog    Wed Sep 29 09:58:39 1993
  634. ***************
  635. *** 1,3 ****
  636. --- 1,57 ----
  637. + Tue Aug 31 20:32:54 1993  Simon J. Gerraty  (sjg@zen.void.oz.au)
  638. +     * patch from meulenbr@prl.phil to avoid problem in findcom().
  639. + Tue Jun  1 23:36:36 1993  Simon J. Gerraty  (sjg@zen.void.oz.au)
  640. +     * Quick hack to "handle" multi-line prompts better.
  641. +     While in x_vi or x_emacs we use only the last line of the prompt.
  642. + Tue Jun  1 20:52:04 1993  Devetir Unix section <sgccdux@citecuc.citec.oz.au>
  643. +     * Serveral bug fixes from: Devetir Unix section 
  644. +     <sgccdux@citecuc.citec.oz.au>
  645. +     Sorry for the delay in these, but they were stuck in transit
  646. +     because zen was dead for nearly 3 months!  --sjg
  647. +     1) In history.c:hist_init(), an extra file descriptor to the
  648. +     history file is created which can remain open to the old history
  649. +     file when the history needs shrinking.  Thus, the old history file
  650. +     survives with no name, and caused me trouble under 386BSD when
  651. +     shutting down suddenly (fsck had to clean it up and have another
  652. +     re-boot). 
  653. +     2) In jobs.c:exchild() changed order of setpgid() and tcsetpgrp()
  654. +     as 386bsd at least does not allow tcsetpgrp() to an unused
  655. +     process group.
  656. +     3) bug in jobs.c:j_reapchld(), waitpid() can return 0 if there
  657. +     are no children, and even though there was code there to exit the
  658. +     loop on pid == 0, the variable sigchld_caught was not being set to
  659. +     0, so j_reapchld() would be continually called from j_waitj()
  660. +     wasting considerable cpu time. 
  661. +     4) In jobs.c:j_resume(), fg of a job that has exited, but not yet
  662. +     been flushed from pdksh's list of jobs caused the controlling
  663. +     terminal's process group to be stuffed up, and pdksh to exit, on
  664. +     some machines. 
  665. + Sat May 22 21:58:49 1993  Simon J. Gerraty  (sjg@zen.void.oz.au)
  666. +     * mail.c, expr.c: bug fixes from: Carsten Heyl
  667. +     <ch@jenny.informatik.uni-dortmund.de> 
  668. +     * eval.c: bug fix from: Peter Collinson <pc@hillside.co.uk>
  669. + Sat May  8 15:48:16 1993  Simon J. Gerraty  (sjg@zen.void.oz.au)
  670. +     * Ported to 386bsd (new base system :-), only sh directory
  671. +     involved though.  This mainly involved re-arranging some #if's so
  672. +     that if _POSIX_TERM is defined it will take precedence over _BSD
  673.   Sat Dec  5 23:54:40 1992  Simon J. Gerraty  (sjg@zen)
  674.   
  675.       * finally fixed the fd leakage that caused pipes to not terminate
  676. *** sh/Makefile.old    Sun Dec  6 00:14:52 1992
  677. --- sh/Makefile    Sun May  9 01:59:42 1993
  678. ***************
  679. *** 1,6 ****
  680.   # PD Bourne/Korn Shell
  681. ! # $Id: Makefile,v 1.4 1992/12/05 13:15:06 sjg Exp $
  682.   
  683.   SHELL = /bin/sh
  684.   MAKE  = make
  685.   
  686. --- 1,8 ----
  687.   # PD Bourne/Korn Shell
  688. ! # $Id: Makefile,v 1.6 93/05/08 15:59:56 sjg Exp $
  689.   
  690. + # Makefile is setup for 386bsd
  691.   SHELL = /bin/sh
  692.   MAKE  = make
  693.   
  694. ***************
  695. *** 25,37 ****
  696.   # to build ksh without ../std
  697.   #
  698.   # sun386 SunOS 4.0.2, sun3 SunOS 4.0.3
  699. ! # CONFIG=-D_BSD
  700.   # XOPTS=-DNOSTDHDRS
  701.   # copy these from ../std/stdc or ensure they are in libstdc.a
  702.   # XOBJS = memmove.o strstr.o 
  703.   #
  704.   # sun3  SunOS 4.1.1
  705. ! # CONFIG=-D_BSD
  706.   # XOPTS=-DNOSTDHDRS
  707.   # copy these from ../std/stdc or ensure they are in libstdc.a
  708.   # XOBJS = memmove.o
  709. --- 27,39 ----
  710.   # to build ksh without ../std
  711.   #
  712.   # sun386 SunOS 4.0.2, sun3 SunOS 4.0.3
  713. ! # SYSFLAGS=-D_BSD
  714.   # XOPTS=-DNOSTDHDRS
  715.   # copy these from ../std/stdc or ensure they are in libstdc.a
  716.   # XOBJS = memmove.o strstr.o 
  717.   #
  718.   # sun3  SunOS 4.1.1
  719. ! # SYSFLAGS=-D_BSD
  720.   # XOPTS=-DNOSTDHDRS
  721.   # copy these from ../std/stdc or ensure they are in libstdc.a
  722.   # XOBJS = memmove.o
  723. ***************
  724. *** 38,44 ****
  725.   #
  726.   # sun4c (sparc) SunOS 4.1.1
  727.   # CC=cc -pipe    # don't use gcc
  728. ! # CONFIG=-D_BSD
  729.   # XOPTS=-DNOSTDHDRS
  730.   # copy these from ../std/stdc or ensure they are in libstdc.a
  731.   # XOBJS = memmove.o
  732. --- 40,46 ----
  733.   #
  734.   # sun4c (sparc) SunOS 4.1.1
  735.   # CC=cc -pipe    # don't use gcc
  736. ! # SYSFLAGS=-D_BSD
  737.   # XOPTS=-DNOSTDHDRS
  738.   # copy these from ../std/stdc or ensure they are in libstdc.a
  739.   # XOBJS = memmove.o
  740. ***************
  741. *** 45,72 ****
  742.   #
  743.   # Bull DPX/2 B.O.S. 2.00.45
  744.   # CC=gcc -ansi
  745. ! # CONFIG=-D_POSIX_SOURCE
  746.   # XOPTS=
  747.   # XOBJS=
  748.   #
  749.   # Minix-386 1.5.10 with estdio
  750. ! # CONFIG= -D_BSD -D_MINIX -D_POSIX_SOURCE
  751.   # XOPTS=
  752.   # XOBJS=
  753.   #
  754.   # BSD/386
  755. ! # CONFIG= -D_BSDI -D_POSIX_TERM -D_POSIX_SOURCE
  756.   # XOPTS=
  757.   # XOBJS=
  758.   
  759. ! #CONFIG= -D_SYSV
  760. ! #CONFIG= -D_BSD -DHAVE_SYS_STDTYPES
  761. ! CONFIG= -D_BSD -DCOMPLEX_HISTORY
  762.   
  763.   
  764.   STD=../std
  765.   INCL=$(STD)/h
  766. ! XINCL=-I$(INCL)
  767.   LDOPTS=-L$(STD)
  768.   XOBJS=
  769.   
  770. --- 47,84 ----
  771.   #
  772.   # Bull DPX/2 B.O.S. 2.00.45
  773.   # CC=gcc -ansi
  774. ! # SYSFLAGS=-D_POSIX_SOURCE
  775.   # XOPTS=
  776.   # XOBJS=
  777.   #
  778.   # Minix-386 1.5.10 with estdio
  779. ! # SYSFLAGS= -D_BSD -D_MINIX -D_POSIX_SOURCE
  780. ! # XOPTS=
  781. ! # XOBJS=
  782. ! #
  783. ! # 386bsd-0.1 pk 0.2.3
  784. ! # SYSFLAGS= -D_BSD -D_POSIX_TERM
  785.   # XOPTS=
  786.   # XOBJS=
  787.   #
  788.   # BSD/386
  789. ! # SYSFLAGS= -D_BSDI -D_POSIX_TERM -D_POSIX_SOURCE
  790.   # XOPTS=
  791.   # XOBJS=
  792.   
  793. ! #SYSFLAGS= -D_SYSV
  794. ! #SYSFLAGS= -D_BSD -DHAVE_SYS_STDTYPES
  795. ! #SYSFLAGS= -D_BSD 
  796. ! SYSFLAGS= -D_BSD -D_POSIX_TERM
  797. ! CONFLAGS=-DCOMPLEX_HISTORY
  798.   
  799. + CONFIG=$(SYSFLAGS) $(CONFLAGS)
  800.   
  801.   STD=../std
  802.   INCL=$(STD)/h
  803. ! #XINCL=-I$(INCL)
  804.   LDOPTS=-L$(STD)
  805.   XOBJS=
  806.   
  807. ***************
  808. *** 74,82 ****
  809.   DBG=-g -O
  810.   CFLAGS = $(DBG) $(CONFIG) $(XINCL) $(XOPTS)
  811.   
  812. ! LDFLAGS = $(DBG) $(LDOPTS)
  813.   
  814. ! COMPATLIBS = -lstdc -lposix
  815.   #XLIBS = -lc_s
  816.   #XLIBS = -ldirent
  817.   LDLIBS = $(COMPATLIBS) $(XLIBS)
  818. --- 86,94 ----
  819.   DBG=-g -O
  820.   CFLAGS = $(DBG) $(CONFIG) $(XINCL) $(XOPTS)
  821.   
  822. ! LDFLAGS = $(DBG) 
  823.   
  824. ! COMPATLIBS = #$(LDOPTS) -lstdc -lposix
  825.   #XLIBS = -lc_s
  826.   #XLIBS = -ldirent
  827.   LDLIBS = $(COMPATLIBS) $(XLIBS)
  828. *** sh/alloc.c.old    Sat Apr 25 18:33:14 1992
  829. --- sh/alloc.c    Thu May  6 07:15:58 1993
  830. ***************
  831. *** 3,9 ****
  832.    */
  833.   
  834.   #ifndef lint
  835. ! static char *RCSid = "$Id: alloc.c,v 1.2 1992/04/25 08:33:28 sjg Exp $";
  836.   #endif
  837.   
  838.   #include "stdh.h"
  839. --- 3,9 ----
  840.    */
  841.   
  842.   #ifndef lint
  843. ! static char *RCSid = "$Id: alloc.c,v 1.3 93/05/05 21:16:12 sjg Exp $";
  844.   #endif
  845.   
  846.   #include "stdh.h"
  847. *** sh/c_ksh.c.old    Sun Dec  6 00:14:57 1992
  848. --- sh/c_ksh.c    Thu May  6 07:16:00 1993
  849. ***************
  850. *** 3,9 ****
  851.    */
  852.   
  853.   #ifndef lint
  854. ! static char *RCSid = "$Id: c_ksh.c,v 1.3 1992/12/05 13:15:11 sjg Exp $";
  855.   #endif
  856.   
  857.   #include "stdh.h"
  858. --- 3,9 ----
  859.    */
  860.   
  861.   #ifndef lint
  862. ! static char *RCSid = "$Id: c_ksh.c,v 1.4 93/05/05 21:16:14 sjg Exp $";
  863.   #endif
  864.   
  865.   #include "stdh.h"
  866. *** sh/c_sh.c.old    Sat Apr 25 18:29:38 1992
  867. --- sh/c_sh.c    Thu May  6 07:16:02 1993
  868. ***************
  869. *** 3,9 ****
  870.    */
  871.   
  872.   #ifndef lint
  873. ! static char *RCSid = "$Id: c_sh.c,v 1.3 1992/04/25 08:29:52 sjg Exp $";
  874.   #endif
  875.   
  876.   #include "stdh.h"
  877. --- 3,9 ----
  878.    */
  879.   
  880.   #ifndef lint
  881. ! static char *RCSid = "$Id: c_sh.c,v 1.4 93/05/05 21:16:16 sjg Exp $";
  882.   #endif
  883.   
  884.   #include "stdh.h"
  885. *** sh/c_test.c.old    Sat Apr 25 18:33:14 1992
  886. --- sh/c_test.c    Thu May  6 07:16:04 1993
  887. ***************
  888. *** 6,12 ****
  889.    */
  890.   
  891.   #ifndef lint
  892. ! static char *RCSid = "$Id: c_test.c,v 1.2 1992/04/25 08:33:28 sjg Exp $";
  893.   #endif
  894.   
  895.   #include "stdh.h"
  896. --- 6,12 ----
  897.    */
  898.   
  899.   #ifndef lint
  900. ! static char *RCSid = "$Id: c_test.c,v 1.3 93/05/05 21:16:18 sjg Exp $";
  901.   #endif
  902.   
  903.   #include "stdh.h"
  904. *** sh/config.h.old    Sun Dec  6 00:15:01 1992
  905. --- sh/config.h    Thu May  6 07:16:06 1993
  906. ***************
  907. *** 1,7 ****
  908.   /*
  909.    * Configuration file for the PD ksh
  910.    *
  911. !  * RCSid: $Id: config.h,v 1.6 1992/12/05 13:15:15 sjg Exp $
  912.    */
  913.   
  914.   #ifndef    _CONFIG_H
  915. --- 1,7 ----
  916.   /*
  917.    * Configuration file for the PD ksh
  918.    *
  919. !  * RCSid: $Id: config.h,v 1.7 93/05/05 21:16:20 sjg Exp $
  920.    */
  921.   
  922.   #ifndef    _CONFIG_H
  923. *** sh/edit.c.old    Mon Aug 10 22:02:11 1992
  924. --- sh/edit.c    Wed Jun  2 09:40:16 1993
  925. ***************
  926. *** 7,13 ****
  927.   #if defined(EMACS) || defined(VI)
  928.   
  929.   #ifndef lint
  930. ! static char *RCSid = "$Id: edit.c,v 1.5 1992/08/10 12:02:25 sjg Exp $";
  931.   #endif
  932.   
  933.   #include "stdh.h"
  934. --- 7,13 ----
  935.   #if defined(EMACS) || defined(VI)
  936.   
  937.   #ifndef lint
  938. ! static char *RCSid = "$Id: edit.c,v 1.8 93/06/01 23:40:30 sjg Exp $";
  939.   #endif
  940.   
  941.   #include "stdh.h"
  942. ***************
  943. *** 41,58 ****
  944.       char *buf;
  945.       size_t len;
  946.   {
  947. !   static int setup_done = 0;
  948.       int    i;
  949. !   if (setup_done != 42)
  950. !   {
  951. !     setup_done = 42;        /* these get done once only */
  952. !     x_do_init = 1;
  953. !     x_col = 0;
  954. !     ed_erase = -1, ed_kill = -1, ed_werase = -1, ed_intr = -1, ed_quit = -1;
  955. !     x_adj_ok = 1;
  956. !     x_adj_done = 0;
  957. !   }
  958.       if (x_do_init)
  959.           x_init();
  960.   
  961. --- 41,60 ----
  962.       char *buf;
  963.       size_t len;
  964.   {
  965. !     static int setup_done = 0;
  966.       int    i;
  967. !     char *ps1 = prompt;            /* current prompt */
  968. !     register char *rcp;
  969. !     
  970. !     if (setup_done != 42)
  971. !     {
  972. !         setup_done = 42;        /* these get done once only */
  973. !         x_do_init = 1;
  974. !         x_col = 0;
  975. !         ed_erase = -1, ed_kill = -1, ed_werase = -1, ed_intr = -1, ed_quit = -1;
  976. !         x_adj_ok = 1;
  977. !         x_adj_done = 0;
  978. !     }
  979.       if (x_do_init)
  980.           x_init();
  981.   
  982. ***************
  983. *** 60,65 ****
  984. --- 62,69 ----
  985.           return(read(ttyfd, buf, len));
  986.   
  987.       (void)x_mode(TRUE);
  988. +     if (rcp = strrchr(ps1, '\n'))
  989. +         prompt = ++rcp;            /* fake 1 line prompt */
  990.   #ifdef EMACS
  991.       if (flag[FEMACS])
  992.           i = x_emacs(buf, len);
  993. ***************
  994. *** 70,76 ****
  995.           i = x_vi(buf, len);
  996.       else
  997.   #endif
  998. !         i = -1;        /* internal error */
  999.       (void) x_mode(FALSE);
  1000.       if (i > 4 && strstr(buf, "stty"))
  1001.           x_do_init = 1;
  1002. --- 74,81 ----
  1003.           i = x_vi(buf, len);
  1004.       else
  1005.   #endif
  1006. !         i = -1;                /* internal error */
  1007. !     prompt = ps1;                /* restore it */
  1008.       (void) x_mode(FALSE);
  1009.       if (i > 4 && strstr(buf, "stty"))
  1010.           x_do_init = 1;
  1011. ***************
  1012. *** 200,206 ****
  1013.       x_putc(*s++);
  1014.   }
  1015.   
  1016. ! #ifdef _BSD
  1017.   static    struct sgttyb cb, cborig;
  1018.   #ifdef TIOCGATC
  1019.   static struct ttychars lchars, lcharsorig;
  1020. --- 205,211 ----
  1021.       x_putc(*s++);
  1022.   }
  1023.   
  1024. ! #if defined(_BSD) && !defined(_POSIX_TERM)
  1025.   static    struct sgttyb cb, cborig;
  1026.   #ifdef TIOCGATC
  1027.   static struct ttychars lchars, lcharsorig;
  1028. ***************
  1029. *** 223,229 ****
  1030.   x_init()
  1031.   {
  1032.       x_do_init = 0;
  1033. ! #ifdef _BSD
  1034.       (void)ioctl(ttyfd, TIOCGETP, &cborig);
  1035.       if ((cborig.sg_flags & ECHO) == 0)
  1036.           x_noecho = 1;
  1037. --- 228,234 ----
  1038.   x_init()
  1039.   {
  1040.       x_do_init = 0;
  1041. ! #if defined(_BSD) && !defined(_POSIX_TERM)
  1042.       (void)ioctl(ttyfd, TIOCGETP, &cborig);
  1043.       if ((cborig.sg_flags & ECHO) == 0)
  1044.           x_noecho = 1;
  1045. ***************
  1046. *** 306,312 ****
  1047.   
  1048.   /* set/clear tty cbreak mode */
  1049.   
  1050. ! #ifdef _BSD
  1051.   bool_t
  1052.   x_mode(onoff)
  1053.       bool_t    onoff;
  1054. --- 311,317 ----
  1055.   
  1056.   /* set/clear tty cbreak mode */
  1057.   
  1058. ! #if defined(_BSD) && !defined(_POSIX_TERM)
  1059.   bool_t
  1060.   x_mode(onoff)
  1061.       bool_t    onoff;
  1062. *** sh/edit.h.old    Thu Aug 13 00:15:11 1992
  1063. --- sh/edit.h    Thu May  6 07:16:11 1993
  1064. ***************
  1065. *** 8,14 ****
  1066.    *      
  1067.    *
  1068.    * RCSid:
  1069. !  *      $Id: edit.h,v 1.4 1992/08/12 14:15:25 sjg Exp $
  1070.    *
  1071.    */
  1072.   
  1073. --- 8,14 ----
  1074.    *      
  1075.    *
  1076.    * RCSid:
  1077. !  *      $Id: edit.h,v 1.5 93/05/05 21:16:25 sjg Exp $
  1078.    *
  1079.    */
  1080.   
  1081. *** sh/emacs.c.old    Sun Dec  6 00:15:06 1992
  1082. --- sh/emacs.c    Tue Jun  1 22:05:11 1993
  1083. ***************
  1084. *** 10,16 ****
  1085.   #ifdef EMACS
  1086.   
  1087.   #ifndef lint
  1088. ! static char *RCSid = "$Id: emacs.c,v 1.4 1992/12/05 13:15:20 sjg Exp $";
  1089.   #endif
  1090.   
  1091.   #include "stdh.h"
  1092. --- 10,16 ----
  1093.   #ifdef EMACS
  1094.   
  1095.   #ifndef lint
  1096. ! static char *RCSid = "$Id: emacs.c,v 1.5 93/05/05 21:16:28 sjg Exp $";
  1097.   #endif
  1098.   
  1099.   #include "stdh.h"
  1100. *** sh/eval.c.old    Sun Dec  6 00:15:11 1992
  1101. --- sh/eval.c    Sun May 23 08:46:57 1993
  1102. ***************
  1103. *** 3,9 ****
  1104.    */
  1105.   
  1106.   #ifndef lint
  1107. ! static char *RCSid = "$Id: eval.c,v 1.5 1992/12/05 13:15:25 sjg Exp $";
  1108.   #endif
  1109.   
  1110.   #include "stdh.h"
  1111. --- 3,9 ----
  1112.    */
  1113.   
  1114.   #ifndef lint
  1115. ! static char *RCSid = "$Id: eval.c,v 1.7 93/05/22 22:47:11 sjg Exp $";
  1116.   #endif
  1117.   
  1118.   #include "stdh.h"
  1119. ***************
  1120. *** 718,723 ****
  1121. --- 718,724 ----
  1122.               }
  1123.             case QCHAR:
  1124.               *dp++ = *cp++;
  1125. +           case CSUBST:
  1126.             copy:
  1127.               *dp++ = *cp++;
  1128.               break;
  1129. *** sh/exec.c.old    Sun Dec  6 00:15:15 1992
  1130. --- sh/exec.c    Wed Sep 29 09:58:42 1993
  1131. ***************
  1132. *** 3,9 ****
  1133.    */
  1134.   
  1135.   #ifndef lint
  1136. ! static char *RCSid = "$Id: exec.c,v 1.5 1992/12/05 13:15:29 sjg Exp $";
  1137.   #endif
  1138.   
  1139.   #include "stdh.h"
  1140. --- 3,9 ----
  1141.    */
  1142.   
  1143.   #ifndef lint
  1144. ! static char *RCSid = "$Id: exec.c,v 1.9 93/09/28 23:58:56 sjg Exp $";
  1145.   #endif
  1146.   
  1147.   #include "stdh.h"
  1148. ***************
  1149. *** 144,154 ****
  1150.               t = t->right;
  1151.           }
  1152.           flags &= ~ XPIPEO;
  1153.           (void) dup2(e.savefd[1], 1); /* stdout of last */
  1154.           (void) fd_clexec(e.savefd[0]);
  1155. !         (void) fd_clexec(e.savefd[1]);
  1156. !         exchild(t, flags);
  1157.           (void) dup2(e.savefd[0], 0); /* close pipe in */
  1158.           if (!(flags&XBGND))
  1159.               exstat = rv = waitlast();
  1160.           break;
  1161. --- 144,161 ----
  1162.               t = t->right;
  1163.           }
  1164.           flags &= ~ XPIPEO;
  1165. + #if 0
  1166. +         /* 
  1167. +          * this patch broke more things than it fixed
  1168. +          */
  1169. +         flags |= XEXEC;
  1170. + #endif
  1171.           (void) dup2(e.savefd[1], 1); /* stdout of last */
  1172.           (void) fd_clexec(e.savefd[0]);
  1173. !         (void) fd_clexec(e.savefd[1]); 
  1174. !         execute(t, flags);
  1175.           (void) dup2(e.savefd[0], 0); /* close pipe in */
  1176. +         flags &= ~XEXEC;
  1177.           if (!(flags&XBGND))
  1178.               exstat = rv = waitlast();
  1179.           break;
  1180. ***************
  1181. *** 284,290 ****
  1182.           fflush(shf[1]);
  1183.           fflush(shf[2]);
  1184.       }
  1185. !     if ((flags&XEXEC))
  1186.           exit(rv);    /* exit child */
  1187.       return rv;
  1188.   }
  1189. --- 291,297 ----
  1190.           fflush(shf[1]);
  1191.           fflush(shf[2]);
  1192.       }
  1193. !     if ((flags&XEXEC) && !(flags&XPIPEI))  
  1194.           exit(rv);    /* exit child */
  1195.       return rv;
  1196.   }
  1197. ***************
  1198. *** 586,592 ****
  1199.       }
  1200.       if (tp == NULL) {
  1201.           tp = tsearch(&commands, name, h);
  1202. !         if (tp != NULL && eaccess(tp->val.s,1) != 0) {
  1203.               if (tp->flag&ALLOC)
  1204.                   afree(tp->val.s, commands.areap);
  1205.               tp->type = CEXEC;
  1206. --- 593,601 ----
  1207.       }
  1208.       if (tp == NULL) {
  1209.           tp = tsearch(&commands, name, h);
  1210. !         if (tp != NULL &&
  1211. !             (tp->flag&ALLOC) &&
  1212. !             eaccess(tp->val.s,1) != 0) {
  1213.               if (tp->flag&ALLOC)
  1214.                   afree(tp->val.s, commands.areap);
  1215.               tp->type = CEXEC;
  1216. *** sh/expr.c.old    Sat Apr 25 18:33:14 1992
  1217. --- sh/expr.c    Sun May 23 08:47:00 1993
  1218. ***************
  1219. *** 3,9 ****
  1220.    */
  1221.   
  1222.   #ifndef lint
  1223. ! static char *RCSid = "$Id: expr.c,v 1.2 1992/04/25 08:33:28 sjg Exp $";
  1224.   #endif
  1225.   
  1226.   #include "stdh.h"
  1227. --- 3,9 ----
  1228.    */
  1229.   
  1230.   #ifndef lint
  1231. ! static char *RCSid = "$Id: expr.c,v 1.4 93/05/22 22:47:14 sjg Exp $";
  1232.   #endif
  1233.   
  1234.   #include "stdh.h"
  1235. ***************
  1236. *** 200,206 ****
  1237.       /* skip white space */
  1238.       do c = *cp++;    while (c != '\0' && (c == ' ' || c == '\t'));
  1239.       tokp = cp-1;
  1240.       if (letter(c)) {
  1241.           for (; letnum(c); c = *cp++)
  1242.               ;
  1243. --- 200,206 ----
  1244.       /* skip white space */
  1245.       do c = *cp++;    while (c != '\0' && (c == ' ' || c == '\t'));
  1246.       tokp = cp-1;
  1247. !  
  1248.       if (letter(c)) {
  1249.           for (; letnum(c); c = *cp++)
  1250.               ;
  1251. ***************
  1252. *** 221,227 ****
  1253.           *cp = c;
  1254.           tok = LIT;
  1255.       } else {
  1256. !         c2 = *cp++;
  1257.           if (c == '=' && c2 == '=')
  1258.               c = LEQ;
  1259.           ef (c == '!' && c2 == '=')
  1260. --- 221,230 ----
  1261.           *cp = c;
  1262.           tok = LIT;
  1263.       } else {
  1264. !         if (c)
  1265. !             c2 = *cp++;
  1266. !         else
  1267. !             c2 = 0;
  1268.           if (c == '=' && c2 == '=')
  1269.               c = LEQ;
  1270.           ef (c == '!' && c2 == '=')
  1271. *** sh/getopts.c.old    Mon Aug 10 22:02:27 1992
  1272. --- sh/getopts.c    Sun May  9 01:59:46 1993
  1273. ***************
  1274. *** 7,13 ****
  1275.    */
  1276.   
  1277.   #ifndef lint
  1278. ! static char *RCSid = "$Id: getopts.c,v 1.3 1992/08/10 12:02:41 sjg Exp $";
  1279.   #endif
  1280.   
  1281.   #include "stdh.h"
  1282. --- 7,13 ----
  1283.    */
  1284.   
  1285.   #ifndef lint
  1286. ! static char *RCSid = "$Id: getopts.c,v 1.5 93/05/08 16:00:00 sjg Exp $";
  1287.   #endif
  1288.   
  1289.   #include "stdh.h"
  1290. ***************
  1291. *** 40,46 ****
  1292.   static int
  1293.   getopt(argc, argv, opts)
  1294.       int argc;
  1295. !     register char **argv, *opts;
  1296.   {
  1297.       register int c;
  1298.       register char *cp;
  1299. --- 40,47 ----
  1300.   static int
  1301.   getopt(argc, argv, opts)
  1302.       int argc;
  1303. !     char * const *argv;
  1304. !     const char *opts;
  1305.   {
  1306.       register int c;
  1307.       register char *cp;
  1308. *** sh/history.c.old    Sun Dec  6 00:15:20 1992
  1309. --- sh/history.c    Wed Jun  2 09:40:22 1993
  1310. ***************
  1311. *** 5,11 ****
  1312.    */
  1313.   
  1314.   #ifndef lint
  1315. ! static char *RCSid = "$Id: history.c,v 1.5 1992/12/05 13:15:34 sjg Exp $";
  1316.   #endif
  1317.   /*
  1318.    *    This file contains
  1319. --- 5,11 ----
  1320.    */
  1321.   
  1322.   #ifndef lint
  1323. ! static char *RCSid = "$Id: history.c,v 1.7 93/06/01 23:40:36 sjg Exp $";
  1324.   #endif
  1325.   /*
  1326.    *    This file contains
  1327. ***************
  1328. *** 625,630 ****
  1329. --- 625,631 ----
  1330.       unsigned char    *base;
  1331.       int    lines;
  1332.       int    bytes;
  1333. +     int    fd;
  1334.       
  1335.       hstarted = 1;
  1336.       
  1337. ***************
  1338. *** 638,647 ****
  1339.   
  1340.     retry:
  1341.       /* we have a file and are interactive */
  1342. !     if ((histfd = open(hname, O_RDWR|O_CREAT|O_APPEND, 0600)) < 0)
  1343.           return;
  1344.   
  1345. !     histfd = fcntl(histfd, F_DUPFD, FDBASE);
  1346.       
  1347.       (void) fd_clexec(histfd);
  1348.   
  1349. --- 639,649 ----
  1350.   
  1351.     retry:
  1352.       /* we have a file and are interactive */
  1353. !     if ((fd = open(hname, O_RDWR|O_CREAT|O_APPEND, 0600)) < 0)
  1354.           return;
  1355.   
  1356. !     histfd = fcntl(fd, F_DUPFD, FDBASE);
  1357. !     close(fd);
  1358.       
  1359.       (void) fd_clexec(histfd);
  1360.   
  1361. *** sh/io.c.old    Sun Dec  6 00:15:25 1992
  1362. --- sh/io.c    Sun May  9 01:59:48 1993
  1363. ***************
  1364. *** 3,9 ****
  1365.    */
  1366.   
  1367.   #ifndef lint
  1368. ! static char *RCSid = "$Id: io.c,v 1.4 1992/12/05 13:15:39 sjg Exp $";
  1369.   #endif
  1370.   
  1371.   #include "stdh.h"
  1372. --- 3,9 ----
  1373.    */
  1374.   
  1375.   #ifndef lint
  1376. ! static char *RCSid = "$Id: io.c,v 1.6 93/05/08 16:00:02 sjg Exp $";
  1377.   #endif
  1378.   
  1379.   #include "stdh.h"
  1380. ***************
  1381. *** 99,113 ****
  1382.       if (shf[fd] != NULL)
  1383.           return;
  1384.       if (fd <= 2)
  1385. ! #ifndef _BSDI
  1386.   #ifdef _MINIX
  1387.           /* ? */;
  1388.   #else
  1389.           _iob[fd]._flag = 0; /* re-use stdin, stdout, stderr */
  1390.   #endif
  1391. - #else
  1392. -         /* Chris Torek's stdio replacement */
  1393. -         __sF[fd]._flags = 0;
  1394.   #endif
  1395.       shf[fd] = fdopen(fd, "r+");
  1396.       if (shf[fd] == NULL)
  1397. --- 99,113 ----
  1398.       if (shf[fd] != NULL)
  1399.           return;
  1400.       if (fd <= 2)
  1401. ! #if defined(__386BSD__) || defined(_BSDI)
  1402. !         /* Chris Torek's stdio replacement */
  1403. !         __sF[fd]._flags = 0;
  1404. ! #else
  1405.   #ifdef _MINIX
  1406.           /* ? */;
  1407.   #else
  1408.           _iob[fd]._flag = 0; /* re-use stdin, stdout, stderr */
  1409.   #endif
  1410.   #endif
  1411.       shf[fd] = fdopen(fd, "r+");
  1412.       if (shf[fd] == NULL)
  1413. ***************
  1414. *** 122,128 ****
  1415.       int fd;
  1416.   {
  1417.       if (shf[fd] != NULL) {
  1418. ! #ifndef _BSDI
  1419.           /* Chris Torek's stdio replacement */
  1420.           fseek(shf[fd], 0L, 1); /* V7 derived */
  1421.   #endif
  1422. --- 122,128 ----
  1423.       int fd;
  1424.   {
  1425.       if (shf[fd] != NULL) {
  1426. ! #if !defined(__386BSD__) && !defined(_BSDI)
  1427.           /* Chris Torek's stdio replacement */
  1428.           fseek(shf[fd], 0L, 1); /* V7 derived */
  1429.   #endif
  1430. *** sh/jobs.c.old    Sun Dec  6 00:15:29 1992
  1431. --- sh/jobs.c    Wed Jun  2 09:40:25 1993
  1432. ***************
  1433. *** 2,8 ****
  1434.    * Process and job control
  1435.    */
  1436.   #ifndef lint
  1437. ! static char *RCSid = "$Id: jobs.c,v 1.6 1992/12/05 13:15:43 sjg Exp $";
  1438.   #endif
  1439.   
  1440.   /*
  1441. --- 2,8 ----
  1442.    * Process and job control
  1443.    */
  1444.   #ifndef lint
  1445. ! static char *RCSid = "$Id: jobs.c,v 1.9 93/06/01 23:40:39 sjg Exp $";
  1446.   #endif
  1447.   
  1448.   /*
  1449. ***************
  1450. *** 25,35 ****
  1451.   #include <sys/wait.h>
  1452.   #include "sh.h"
  1453.   #ifdef JOBS
  1454. ! #ifdef _BSDI
  1455. ! #define _BSD
  1456. ! #define WIFCORED(x) WCOREDUMP(x)
  1457.   #endif
  1458. ! #ifdef _BSD
  1459.   #include <sys/ioctl.h>
  1460.   #else
  1461.   #include "termios.h"
  1462. --- 25,37 ----
  1463.   #include <sys/wait.h>
  1464.   #include "sh.h"
  1465.   #ifdef JOBS
  1466. ! #if defined(__386BSD__) || defined(_BSDI)
  1467. ! # ifndef _BSD
  1468. ! #   define _BSD
  1469. ! # endif
  1470. ! # define WIFCORED(x) WCOREDUMP(x)
  1471.   #endif
  1472. ! #if defined(_BSD) && !defined(_POSIX_TERM)
  1473.   #include <sys/ioctl.h>
  1474.   #else
  1475.   #include "termios.h"
  1476. ***************
  1477. *** 83,90 ****
  1478. --- 85,96 ----
  1479.   #ifdef JOBS
  1480.   #ifdef _BSD            /* _BSD 4.* */
  1481.   #define    setpgid(p, pg)    setpgrp(p, pg)
  1482. + #if defined(_POSIX_SOURCE) || defined(__386BSD__) || defined(_BSDI)
  1483. + #define    getpgid(p)    getpgrp()
  1484. + #else
  1485.   #define    getpgid(p)    getpgrp(p)
  1486.   #define    tcsetpgrp(fd,p)    ioctl(fd, TIOCSPGRP, &(p))
  1487. + #endif
  1488.   #else                /* POSIX-compatible */
  1489.   #define    getpgid(p)    getpgrp() /* 1003.1 stupidity */
  1490.   #define    killpg(p, s)    kill(-(p), s)
  1491. ***************
  1492. *** 101,107 ****
  1493.   #else
  1494.   #define WAIT_T int
  1495.   #endif
  1496. ! #ifdef _BSDI
  1497.   #undef WAIT_T
  1498.   #define WAIT_T int
  1499.   #endif
  1500. --- 107,113 ----
  1501.   #else
  1502.   #define WAIT_T int
  1503.   #endif
  1504. ! #if defined(__386BSD__) || defined(_BSDI)
  1505.   #undef WAIT_T
  1506.   #define WAIT_T int
  1507.   #endif
  1508. ***************
  1509. *** 350,358 ****
  1510.       {
  1511.         j->pgrp = !(flags&XPIPEI) ? j->proc : j_lastj->pgrp;
  1512.         /* do in both parent and child to avoid fork race condition */
  1513.         if (!(flags&XBGND))
  1514.           tcsetpgrp(ttyfd, j->pgrp); /* could be trouble */
  1515. -       setpgid(j->proc, j->pgrp);
  1516.       }
  1517.   #endif
  1518.       j_lastj = j;
  1519. --- 356,364 ----
  1520.       {
  1521.         j->pgrp = !(flags&XPIPEI) ? j->proc : j_lastj->pgrp;
  1522.         /* do in both parent and child to avoid fork race condition */
  1523. +       setpgid(j->proc, j->pgrp);   /* Can't set tpgrp until pgrp exists. */
  1524.         if (!(flags&XBGND))
  1525.           tcsetpgrp(ttyfd, j->pgrp); /* could be trouble */
  1526.       }
  1527.   #endif
  1528.       j_lastj = j;
  1529. ***************
  1530. *** 602,608 ****
  1531.           else
  1532.   #endif
  1533.               pid = wait(&status);
  1534. !         if (pid < 0 && errno == ECHILD)
  1535.           {
  1536.             /* no children - what are we doing here? */
  1537.             _TRACE(5, ("j_reapchld: no children"));
  1538. --- 608,614 ----
  1539.           else
  1540.   #endif
  1541.               pid = wait(&status);
  1542. !         if (pid == 0 || pid < 0 && errno == ECHILD)
  1543.           {
  1544.             /* no children - what are we doing here? */
  1545.             _TRACE(5, ("j_reapchld: no children"));
  1546. ***************
  1547. *** 753,769 ****
  1548.       if (j->pgrp == 0)
  1549.           errorf("job not job-controlled\n");
  1550.   
  1551. !     j->state = JRUN;
  1552.       j_print(j);
  1553.       flushshf(2);
  1554.   
  1555. !     if (!bg)
  1556. !           tcsetpgrp(ttyfd, j->pgrp); /* attach shell to job */
  1557. !     if (killpg(j->pgrp, SIGCONT) < 0)
  1558.           errorf("cannot continue job %%%d\n", job);
  1559. !     if (!bg)
  1560. !         return j_waitj(j, 0);
  1561. !     return 0;
  1562.   }
  1563.   
  1564.   #endif
  1565. --- 759,783 ----
  1566.       if (j->pgrp == 0)
  1567.           errorf("job not job-controlled\n");
  1568.   
  1569. !     if (j->state == JSTOP)
  1570. !         j->state = JRUN;
  1571.       j_print(j);
  1572.       flushshf(2);
  1573. +     if (j->state == JFREE)
  1574. +         return 0;
  1575. +     if (bg) {
  1576. +         if (killpg(j->pgrp, SIGCONT) < 0)
  1577. +             errorf("cannot continue job %%%d\n", job);
  1578. +         return 0;
  1579. +     }
  1580.   
  1581. !     tcsetpgrp(ttyfd, j->pgrp);        /* attach tty to job */
  1582. !     if (killpg(j->pgrp, SIGCONT) < 0) {
  1583. !         tcsetpgrp(ttyfd, our_pgrp);    /* attach tty to shell */
  1584.           errorf("cannot continue job %%%d\n", job);
  1585. !     }
  1586. !     return j_waitj(j, 0);
  1587.   }
  1588.   
  1589.   #endif
  1590. *** sh/lex.c.old    Mon Aug 10 22:02:41 1992
  1591. --- sh/lex.c    Tue Jun  1 23:39:39 1993
  1592. ***************
  1593. *** 3,9 ****
  1594.    */
  1595.   
  1596.   #ifndef lint
  1597. ! static char *RCSid = "$Id: lex.c,v 1.3 1992/08/10 12:02:55 sjg Exp $";
  1598.   #endif
  1599.   
  1600.   #include "stdh.h"
  1601. --- 3,9 ----
  1602.    */
  1603.   
  1604.   #ifndef lint
  1605. ! static char *RCSid = "$Id: lex.c,v 1.4 93/05/05 21:16:46 sjg Exp $";
  1606.   #endif
  1607.   
  1608.   #include "stdh.h"
  1609. *** sh/lex.h.old    Sun Dec  6 00:15:32 1992
  1610. --- sh/lex.h    Thu May  6 07:16:34 1993
  1611. ***************
  1612. *** 2,8 ****
  1613.    * Source input, lexer and parser
  1614.    */
  1615.   
  1616. ! /* $Id: lex.h,v 1.4 1992/08/12 14:15:37 sjg Exp $ */
  1617.   
  1618.   #define    IDENT    64
  1619.   
  1620. --- 2,8 ----
  1621.    * Source input, lexer and parser
  1622.    */
  1623.   
  1624. ! /* $Id: lex.h,v 1.6 93/05/05 21:16:48 sjg Exp $ */
  1625.   
  1626.   #define    IDENT    64
  1627.   
  1628. *** sh/mail.c.old    Sat Apr 25 18:33:14 1992
  1629. --- sh/mail.c    Sun May 23 08:47:03 1993
  1630. ***************
  1631. *** 3,9 ****
  1632.    * John R. MacMillan
  1633.    */
  1634.   #ifndef lint
  1635. ! static char *RCSid = "$Id: mail.c,v 1.2 1992/04/25 08:33:28 sjg Exp $";
  1636.   #endif
  1637.   
  1638.   #include "stdh.h"
  1639. --- 3,9 ----
  1640.    * John R. MacMillan
  1641.    */
  1642.   #ifndef lint
  1643. ! static char *RCSid = "$Id: mail.c,v 1.4 93/05/22 22:47:17 sjg Exp $";
  1644.   #endif
  1645.   
  1646.   #include "stdh.h"
  1647. ***************
  1648. *** 55,60 ****
  1649. --- 55,63 ----
  1650.       struct stat     stbuf;
  1651.   
  1652.       vp = global("MAILCHECK");
  1653. +     mailcheck.type = 0;
  1654.       if (!(vp->flag & ISSET) || strint(&mailcheck, vp) == NULL)
  1655.           return;
  1656.   
  1657. *** sh/main.c.old    Sun Dec  6 00:15:35 1992
  1658. --- sh/main.c    Thu May  6 07:16:38 1993
  1659. ***************
  1660. *** 3,9 ****
  1661.    */
  1662.   
  1663.   #ifndef lint
  1664. ! static char *RCSid = "$Id: main.c,v 1.7 1992/12/05 13:15:49 sjg Exp $";
  1665.   #endif
  1666.   
  1667.   #define    EXTERN                /* define EXTERNs in sh.h */
  1668. --- 3,9 ----
  1669.    */
  1670.   
  1671.   #ifndef lint
  1672. ! static char *RCSid = "$Id: main.c,v 1.8 93/05/05 21:16:52 sjg Exp $";
  1673.   #endif
  1674.   
  1675.   #define    EXTERN                /* define EXTERNs in sh.h */
  1676. *** sh/misc.c.old    Thu Aug 13 00:15:28 1992
  1677. --- sh/misc.c    Thu May  6 07:16:40 1993
  1678. ***************
  1679. *** 3,9 ****
  1680.    */
  1681.   
  1682.   #ifndef lint
  1683. ! static char *RCSid = "$Id: misc.c,v 1.3 1992/08/12 14:15:42 sjg Exp $";
  1684.   #endif
  1685.   
  1686.   #include "stdh.h"
  1687. --- 3,9 ----
  1688.    */
  1689.   
  1690.   #ifndef lint
  1691. ! static char *RCSid = "$Id: misc.c,v 1.4 93/05/05 21:16:54 sjg Exp $";
  1692.   #endif
  1693.   
  1694.   #include "stdh.h"
  1695. *** sh/patchlevel.h.old    Sun Dec  6 00:15:38 1992
  1696. --- sh/patchlevel.h    Thu May  6 07:16:42 1993
  1697. ***************
  1698. *** 1,6 ****
  1699.   /*
  1700.    * PD KSH
  1701. !  * $Id: patchlevel.h,v 4.8 1992/12/05 13:15:52 sjg Exp $
  1702.    */
  1703.   #define VERSION        4
  1704.   #define PATCHLEVEL    8
  1705. --- 1,6 ----
  1706.   /*
  1707.    * PD KSH
  1708. !  * $Id: patchlevel.h,v 4.9 93/05/05 21:16:56 sjg Exp $
  1709.    */
  1710.   #define VERSION        4
  1711.   #define PATCHLEVEL    8
  1712.  
  1713. exit 0 # Just in case...
  1714.