home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-12-11 | 28.5 KB | 1,147 lines |
- Newsgroups: comp.sources.misc
- From: sjg@zen.void.oz.au (Simon J. Gerraty)
- Subject: v34i027: pdksh - Public Domain Korn Shell, v4, Patch08
- Message-ID: <1992Dec13.033015.6978@sparky.imd.sterling.com>
- X-Md4-Signature: d7d38bc976062eec9124f1095b7e38f3
- Date: Sun, 13 Dec 1992 03:30:15 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: sjg@zen.void.oz.au (Simon J. Gerraty)
- Posting-number: Volume 34, Issue 27
- Archive-name: pdksh/patch08
- Environment: UNIX
- Patch-To: pdksh: Volume 25, Issue 47-55
-
- This is patch08.
-
- It contains a couple of very useful bug fixes.
- Including that of pipes such as:
-
- $ zcat foo.tar.Z | tar tvf - | more
-
- not terminating immediately when you press 'q'.
-
- Apply this patch by changing directory to the root
- of the source tree and using the command:
-
- patch -p0 < this_file
-
- The following is a complete list of patches to date.
-
- # PD ksh Version 4
- Prereq: 09-Nov-91
- Prereq: 10-Nov-91
- Prereq: 25-Nov-91
- Prereq: 25-Apr-92
- Prereq: 26-Apr-92
- Prereq: 27-Apr-92
- Prereq: 12-May-92
- Prereq: 02-Aug-92
- Prereq: 12-Aug-92
- *** PATCHDATES.old Thu Aug 13 00:14:06 1992
- --- PATCHDATES Sun Dec 6 00:14:24 1992
- ***************
- *** 8,10 ****
- --- 8,11 ----
- 12-May-92
- 02-Aug-92
- 12-Aug-92
- + 05-Dec-92
- *** README.old Tue May 12 19:30:10 1992
- --- README Sun Dec 6 00:14:30 1992
- ***************
- *** 1,5 ****
- Public Domain Korn Shell
- ! Version 4.5
-
- PD KSH:
-
- --- 1,5 ----
- Public Domain Korn Shell
- ! Version 4.8
-
- PD KSH:
-
- ***************
- *** 7,18 ****
- intended to be the ultimate shell but rather a usable ksh work
- alike. For those of us who have to work on multiple systems it
- is nice to have the same user interface on all. I resisted
- ! moving to the ksh on a Bull system at work for nearly a year due
- ! to the lack of a ksh on my Sun systems. When I first picked up
- ! the 3.2 PD KSH a couple of years ago, it took only a few minutes
- ! to convert a C-shell fan to a ksh fan :-) Pdksh is not 100%
- ! compatible with the ksh. Having said that, I use it daily
- ! beside a real ksh88 and find them virtually indistinguishable.
-
- I only run this shell on sun's and only for interactive use. I
- use it on sun4c, sun3 and sun386 systems. The shell itself has
- --- 7,20 ----
- intended to be the ultimate shell but rather a usable ksh work
- alike. For those of us who have to work on multiple systems it
- is nice to have the same user interface on all. I resisted
- ! moving to the ksh on a System V machine where I worked, for
- ! nearly a year due to the lack of a ksh on my Sun systems. When
- ! I first picked up the 3.2 PD KSH a couple of years ago, it took
- ! only a few minutes to convert a C-shell fan to a ksh fan :-)
- ! Pdksh is not 100% compatible with the ksh. Having said that, I
- ! use it daily beside a real ksh88 and find them virtually
- ! indistinguishable. With one exception - arrays! If some one
- ! feels like adding arrays, I for one would appreciate it :-)
-
- I only run this shell on sun's and only for interactive use. I
- use it on sun4c, sun3 and sun386 systems. The shell itself has
- ***************
- *** 21,40 ****
- MACHINES for details of systems that the shell has been built
- on.
-
- ! I have released this version of the shell (with the kind
- ! permission of the previous maintainers and major contributors) to
- ! ensure that it is available from usenet archive sites. Of
- ! course it remains in the Public Domain. Equally obviously
- ! neither myself nor any other contributors make any claims of
- ! suitability etc. Ie. NO WARRANTY!!! If you make any changes
- ! and distribute them, please leave your own finger prints in the
- ! source. Its bad enough being flamed for my own bugs let alone
- ! anyone elses :-)
-
- - WHATS NEW:
- -
- - This update includes Job Control for System V (POSIX), many bug
- - fixes and a simple history file mechanism. See sh/ChangeLog.
-
- HISTORY:
-
- --- 23,37 ----
- MACHINES for details of systems that the shell has been built
- on.
-
- ! I released version 4.0 of the shell (with the kind permission of
- ! the previous maintainers and major contributors) to ensure that
- ! it is available from usenet archive sites. Of course it remains
- ! in the Public Domain. Equally obviously neither myself nor any
- ! other contributors make any claims of suitability etc. Ie. NO
- ! WARRANTY!!! If you make any changes and distribute them, please
- ! leave your own finger prints in the source. Its bad enough
- ! being flamed for my own bugs let alone anyone elses :-)
-
-
- HISTORY:
-
- *** bug-report.old Thu Aug 13 00:14:09 1992
- --- bug-report Sun Dec 6 00:14:34 1992
- ***************
- *** 2,8 ****
- Subject: [area]: [synopsis] [replace with actual area and short description]
-
- VERSION:
- ! PD KSH: 4.7 12-Aug-92
- [Official patches will edit this line to indicate the patch level]
-
- MACHINE and OPERATING SYSTEM:
- --- 2,8 ----
- Subject: [area]: [synopsis] [replace with actual area and short description]
-
- VERSION:
- ! PD KSH: 4.8 05-Dec-92
- [Official patches will edit this line to indicate the patch level]
-
- MACHINE and OPERATING SYSTEM:
- *** etc/ksh.kshrc.old Mon Aug 10 22:00:08 1992
- --- etc/ksh.kshrc Sun Dec 6 00:14:48 1992
- ***************
- *** 17,23 ****
- #
-
- # RCSid:
- ! # $Id: ksh.kshrc,v 1.3 1992/08/10 12:00:08 sjg Exp $
- #
- # @(#)Copyright (c) 1991 Simon J. Gerraty
- #
- --- 17,23 ----
- #
-
- # RCSid:
- ! # $Id: ksh.kshrc,v 1.4 1992/12/05 13:14:48 sjg Exp $
- #
- # @(#)Copyright (c) 1991 Simon J. Gerraty
- #
- ***************
- *** 97,102 ****
- --- 97,105 ----
- alias cls=clear
- alias logout=exit
- alias bye=exit
- + alias p='ps -l'
- + alias j=jobs
- + alias o='fg %-'
-
-
- # add your favourite aliases here
- *** ksh.1.old Mon Aug 10 21:59:15 1992
- --- ksh.1 Sun Dec 6 00:14:37 1992
- ***************
- *** 1,4 ****
- ! .\" $Id: ksh.1,v 1.2 1992/08/10 11:59:15 sjg Exp $
- .nr OJ 1 \" Job Control
- .nr OE 1 \" Command Editing
- .nr OB 1 \" BSD enhanced ulimit options
- --- 1,4 ----
- ! .\" $Id: ksh.1,v 1.3 1992/12/05 13:14:37 sjg Exp $
- .nr OJ 1 \" Job Control
- .nr OE 1 \" Command Editing
- .nr OB 1 \" BSD enhanced ulimit options
- ***************
- *** 88,94 ****
- .SS Alternation
- Csh provides a filename expansion method known as alternation.
- This has been added into this version of ksh.
- ! When performing filename subsitution, you can get the shell to create
- a set of strings for you. For example, `exampl{a,b,c,d,e}' will expand
- to ``exampla examplb examplc exampld example''.
- A comma separated set of strings in curly braces
- --- 88,94 ----
- .SS Alternation
- Csh provides a filename expansion method known as alternation.
- This has been added into this version of ksh.
- ! When performing filename substitution, you can get the shell to create
- a set of strings for you. For example, `exampl{a,b,c,d,e}' will expand
- to ``exampla examplb examplc exampld example''.
- A comma separated set of strings in curly braces
- ***************
- *** 112,118 ****
- .IP FCEDIT
- The editor used by the \fIfc\fP command.
- During startup the shell checks the value of \fBFCEDIT\fP,
- ! \fBEDITOR\fP and finally \fBVISUAL\fP to try and determin what
- command line edit mode to use. Note that this is not strictly
- ksh compatible behaviour.
- .IP COLUMNS
- --- 112,118 ----
- .IP FCEDIT
- The editor used by the \fIfc\fP command.
- During startup the shell checks the value of \fBFCEDIT\fP,
- ! \fBEDITOR\fP and finally \fBVISUAL\fP to try and determine what
- command line edit mode to use. Note that this is not strictly
- ksh compatible behaviour.
- .IP COLUMNS
- ***************
- *** 178,184 ****
- A single \fB#\fP results in the shortest match,
- two \fB#\fP's results in the longest match.
- .IP "${var%pattern} ${var%%pattern}"
- ! Like \fB#\fP substition, but deleting from the end of the value.
- .SS Expressions
- Expressions can be used with the \fBlet\fP command,
- as numeric arguments to the \fBtest\fP command,
- --- 178,184 ----
- A single \fB#\fP results in the shortest match,
- two \fB#\fP's results in the longest match.
- .IP "${var%pattern} ${var%%pattern}"
- ! Like \fB#\fP substitution, but deleting from the end of the value.
- .SS Expressions
- Expressions can be used with the \fBlet\fP command,
- as numeric arguments to the \fBtest\fP command,
- ***************
- *** 250,256 ****
- .IP "fc [\fB\-e\fP \fIeditor\fP] [\fB\-lnr\fP] [\fIfirst\fP [\fIlast\fP]]"
- \fIFirst\fP and \fIlast\fP select commands.
- Commands can be selected by history number,
- ! or a string specifing the most recent command starting with that string.
- The \fB\-l\fP option lists the command on stdout,
- and \fB\-n\fP inhibits the default command numbers.
- The \fB\-r\fP option reverses the order of the list.
- --- 250,256 ----
- .IP "fc [\fB\-e\fP \fIeditor\fP] [\fB\-lnr\fP] [\fIfirst\fP [\fIlast\fP]]"
- \fIFirst\fP and \fIlast\fP select commands.
- Commands can be selected by history number,
- ! or a string specifying the most recent command starting with that string.
- The \fB\-l\fP option lists the command on stdout,
- and \fB\-n\fP inhibits the default command numbers.
- The \fB\-r\fP option reverses the order of the list.
- ***************
- *** 340,346 ****
- .ta 5n 10n
- \t\-i\tThe variable's value is stored as an integer.
- .br
- ! \t\-x\tThe variable is exported to the enviroment.
- .br
- \t\-r\tThe variable is read-only cannot be reassigned a value.
- .br
- --- 340,346 ----
- .ta 5n 10n
- \t\-i\tThe variable's value is stored as an integer.
- .br
- ! \t\-x\tThe variable is exported to the environment.
- .br
- \t\-r\tThe variable is read-only cannot be reassigned a value.
- .br
- ***************
- *** 466,472 ****
- job reporting. The jobs and kill commands
- functions as above, and you will
- be informed when background jobs complete. Fg and bg are not
- ! availiable.
- .PD
- .br
- .SS "Interactive Input Line Editing"
- --- 466,472 ----
- job reporting. The jobs and kill commands
- functions as above, and you will
- be informed when background jobs complete. Fg and bg are not
- ! available.
- .PD
- .br
- .SS "Interactive Input Line Editing"
- ***************
- *** 540,546 ****
- (note that the ASCII
- .SM ESC
- character is written as \s-1^[\s0\|),
- ! then the editing function performed is decribed.
- Note that
- .I "editing command"
- names are used only with the
- --- 540,546 ----
- (note that the ASCII
- .SM ESC
- character is written as \s-1^[\s0\|),
- ! then the editing function performed is described.
- Note that
- .I "editing command"
- names are used only with the
- ***************
- *** 873,879 ****
- .br
- \fB[\fP \fIexpression\fP \fB]\fP
- .SH DESCRIPTION
- ! \fBTest\f evalutates the \fIexpression\fP and returns zero status if true,
- and non-zero status otherwise.
- It is normally used as the controlling command of the \fBif\fP and \fBwhile\fP statements.
- .LP
- --- 873,879 ----
- .br
- \fB[\fP \fIexpression\fP \fB]\fP
- .SH DESCRIPTION
- ! \fBTest\f evaluates the \fIexpression\fP and returns zero status if true,
- and non-zero status otherwise.
- It is normally used as the controlling command of the \fBif\fP and \fBwhile\fP statements.
- .LP
- *** sh/ChangeLog.old Thu Aug 13 00:15:18 1992
- --- sh/ChangeLog Sun Dec 6 00:15:01 1992
- ***************
- *** 1,3 ****
- --- 1,40 ----
- + Sat Dec 5 23:54:40 1992 Simon J. Gerraty (sjg@zen)
- +
- + * finally fixed the fd leakage that caused pipes to not terminate
- + immediately.
- +
- + Sat Nov 28 23:01:38 1992 Simon J. Gerraty (sjg@zen)
- +
- + * Makefile: added install target
- +
- + Wed Nov 25 09:10:11 1992 Simon J. Gerraty (sjg@zen)
- +
- + * c_cd(c_ksh.c): fixed bug causing cd ., cd .. to look at $CDPATH.
- +
- + Thu Nov 19 23:32:42 1992 Simon J. Gerraty (sjg@zen)
- +
- + * For now bind emacs mode complete-list to ESC=
- +
- + Tue Sep 15 15:24:38 1992 Simon J. Gerraty (sjg@zen)
- +
- + * main.c: call init_editmode() between processing .profile and
- + .kshrc so that edit mode can be explicitly set in .kshrc
- + regardless of FCEDIT, EDITOR and VISUAL values.
- +
- + Tue Sep 15 15:08:06 1992 Philippe Michel (michel@thomson-lcr.fr)
- +
- + * main.c: fixed bug in command line argument processing.
- +
- + Fri Aug 21 15:24:37 1992 Bruce Momjian (root%candle.uucp@bts.com)
- +
- + * exec.c: replace all calls of execute(tree, 0) with
- + execute(tree, flags & XXWHL) to ensure it is passed to children.
- +
- + Thu Aug 20 23:18:45 1992 Simon J. Gerraty (sjg@zen)
- +
- + * fixed bug in complex_history: histsize not initialized before
- + call to alloc().
- +
- Thu Aug 13 00:00:42 1992 Simon J. Gerraty (sjg@zen)
-
- * setstr(), varsub(): be robust when given dud args.
- *** sh/Makefile.old Thu Aug 13 00:00:07 1992
- --- sh/Makefile Sun Dec 6 00:15:06 1992
- ***************
- *** 1,5 ****
- # PD Bourne/Korn Shell
- ! # $Id: Makefile,v 1.3 1992/08/10 12:02:18 sjg Exp $
-
- SHELL = /bin/sh
- MAKE = make
- --- 1,5 ----
- # PD Bourne/Korn Shell
- ! # $Id: Makefile,v 1.4 1992/12/05 13:15:06 sjg Exp $
-
- SHELL = /bin/sh
- MAKE = make
- ***************
- *** 6,11 ****
- --- 6,17 ----
-
- LN = ln -s
-
- + CHMOD=chmod
- +
- + prefix=/usr/local
- +
- + target=$(prefix)/bin/ksh
- +
- # You _can_ build this shell without the ../std tree if your
- # system provides a sufficiently POSIX environment, or if your
- # BSD system is a Sun or close. If not try ../std.
- ***************
- *** 107,116 ****
- makedepend $(CFLAGS) $(SRCS1) $(SRCS2)
-
- install:
- ! @echo "Try:"
- ! @echo "cp ksh /bin"
- ! @echo "strip /bin/ksh"
- ! @echo "chmod 555 /bin/ksh"
-
- .c.s:
- $(CC) $(CFLAGS) -S -o $@ $<
- --- 113,121 ----
- makedepend $(CFLAGS) $(SRCS1) $(SRCS2)
-
- install:
- ! -if test -f $(target); then mv $(target) $(target).old; fi
- ! cp ksh $(target)
- ! $(CHMOD) 755 $(target)
-
- .c.s:
- $(CC) $(CFLAGS) -S -o $@ $<
- *** sh/c_ksh.c.old Sat Apr 25 18:33:28 1992
- --- sh/c_ksh.c Sun Dec 6 00:15:11 1992
- ***************
- *** 3,9 ****
- */
-
- #ifndef lint
- ! static char *RCSid = "$Id: c_ksh.c,v 1.2 1992/04/25 08:33:28 sjg Exp $";
- #endif
-
- #include "stdh.h"
- --- 3,9 ----
- */
-
- #ifndef lint
- ! static char *RCSid = "$Id: c_ksh.c,v 1.3 1992/12/05 13:15:11 sjg Exp $";
- #endif
-
- #include "stdh.h"
- ***************
- *** 78,85 ****
- dir = strval(v_oldpwd = global("OLDPWD"));
- prt = 1;
- }
- ! if (dir[0] == '/' || (dir[0] == '.' && (dir[1] == '/' ||
- ! (dir[1] == '.' && dir[2] == '/')))) {
- /*
- * dir is an explicitly named path, so no CDPATH search
- */
- --- 78,87 ----
- dir = strval(v_oldpwd = global("OLDPWD"));
- prt = 1;
- }
- ! if (dir[0] == '/' ||
- ! (dir[0] == '.' &&
- ! (dir[1] == '.' || dir[1] == '/' || dir[1] == '\0'))) {
- !
- /*
- * dir is an explicitly named path, so no CDPATH search
- */
- *** sh/config.h.old Thu Aug 13 00:15:22 1992
- --- sh/config.h Sun Dec 6 00:15:15 1992
- ***************
- *** 1,7 ****
- /*
- * Configuration file for the PD ksh
- *
- ! * RCSid: $Id: config.h,v 1.5 1992/08/12 14:15:22 sjg Exp $
- */
-
- #ifndef _CONFIG_H
- --- 1,7 ----
- /*
- * Configuration file for the PD ksh
- *
- ! * RCSid: $Id: config.h,v 1.6 1992/12/05 13:15:15 sjg Exp $
- */
-
- #ifndef _CONFIG_H
- ***************
- *** 49,61 ****
- /* #define SILLY /* Game of life in EMACS mode */
- /* #define SWTCH /* Handle SWTCH for shl(1) */
-
- ! /*
- ! * better to leave this one out, and let users that
- ! * like it add
- ! * bind '^[^['=complete-list
- ! * to their .kshrc
- ! */
- ! /*#define COMPLETE_LIST /* default to Emacs style completion */
- /*
- * ALTERNATIONS is csh not ksh, but it is such a nice feature...
- */
- --- 49,55 ----
- /* #define SILLY /* Game of life in EMACS mode */
- /* #define SWTCH /* Handle SWTCH for shl(1) */
-
- !
- /*
- * ALTERNATIONS is csh not ksh, but it is such a nice feature...
- */
- *** sh/emacs.c.old Mon Aug 10 22:02:31 1992
- --- sh/emacs.c Sun Dec 6 00:15:20 1992
- ***************
- *** 10,16 ****
- #ifdef EMACS
-
- #ifndef lint
- ! static char *RCSid = "$Id: emacs.c,v 1.3 1992/08/10 12:02:31 sjg Exp $";
- #endif
-
- #include "stdh.h"
- --- 10,16 ----
- #ifdef EMACS
-
- #ifndef lint
- ! static char *RCSid = "$Id: emacs.c,v 1.4 1992/12/05 13:15:20 sjg Exp $";
- #endif
-
- #include "stdh.h"
- ***************
- *** 203,215 ****
- {x_stuff, "stuff", 0, 0, 0 },
- {x_transpose, "transpose-chars", 0, CTRL('T'), 0 },
- #endif
- - #ifdef COMPLETE_LIST
- - {x_complete, "complete", 1, 0, 0 },
- - {x_comp_list, "complete-list", 1, CTRL('['), 0 },
- - #else
- {x_complete, "complete", 1, CTRL('['), 0 },
- ! {x_comp_list, "complete-list", 1, 0, 0 },
- ! #endif
- {x_enumerate, "list", 1, '?', 0 },
- {x_comp_file, "complete-file", 1, CTRL('X'), 0 },
- {x_comp_comm, "complete-command", 2, CTRL('['), 0 },
- --- 203,210 ----
- {x_stuff, "stuff", 0, 0, 0 },
- {x_transpose, "transpose-chars", 0, CTRL('T'), 0 },
- #endif
- {x_complete, "complete", 1, CTRL('['), 0 },
- ! {x_comp_list, "complete-list", 1, '=', 0 },
- {x_enumerate, "list", 1, '?', 0 },
- {x_comp_file, "complete-file", 1, CTRL('X'), 0 },
- {x_comp_comm, "complete-command", 2, CTRL('['), 0 },
- *** sh/eval.c.old Thu Aug 13 00:15:28 1992
- --- sh/eval.c Sun Dec 6 00:15:25 1992
- ***************
- *** 3,9 ****
- */
-
- #ifndef lint
- ! static char *RCSid = "$Id: eval.c,v 1.4 1992/08/12 14:15:28 sjg Exp $";
- #endif
-
- #include "stdh.h"
- --- 3,9 ----
- */
-
- #ifndef lint
- ! static char *RCSid = "$Id: eval.c,v 1.5 1992/12/05 13:15:25 sjg Exp $";
- #endif
-
- #include "stdh.h"
- ***************
- *** 469,479 ****
- ofd1 = savefd(1);
- dup2(pv[1], 1);
- close(pv[1]);
- ! #if 0
- ! exchild(t, XXCOM|XPIPEO);
- ! #else
- execute(t, XFORK|XXCOM|XPIPEO);
- - #endif
- dup2(ofd1, 1);
- close(ofd1);
- xp->split = 1; /* waitlast() */
- --- 469,477 ----
- ofd1 = savefd(1);
- dup2(pv[1], 1);
- close(pv[1]);
- ! (void) fd_clexec(pv[0]);
- ! (void) fd_clexec(ofd1);
- execute(t, XFORK|XXCOM|XPIPEO);
- dup2(ofd1, 1);
- close(ofd1);
- xp->split = 1; /* waitlast() */
- *** sh/exec.c.old Mon Aug 10 22:02:38 1992
- --- sh/exec.c Sun Dec 6 00:15:29 1992
- ***************
- *** 3,9 ****
- */
-
- #ifndef lint
- ! static char *RCSid = "$Id: exec.c,v 1.4 1992/08/10 12:02:38 sjg Exp $";
- #endif
-
- #include "stdh.h"
- --- 3,9 ----
- */
-
- #ifndef lint
- ! static char *RCSid = "$Id: exec.c,v 1.5 1992/12/05 13:15:29 sjg Exp $";
- #endif
-
- #include "stdh.h"
- ***************
- *** 46,56 ****
- --- 46,66 ----
- {
- (void) memset(clexec_tab, 0, sizeof(clexec_tab)-1);
- }
- + #endif
-
- + /*
- + * we now use this function always.
- + */
- int
- fd_clexec(fd)
- int fd;
- {
- + #ifndef F_SETFD
- + static int once = 0;
- +
- + if (once++ == 0)
- + init_clexec();
- +
- if (fd < sizeof(clexec_tab))
- {
- clexec_tab[fd] = 1;
- ***************
- *** 57,64 ****
- return 0;
- }
- return -1;
- ! }
- #endif
-
-
- /*
- --- 67,76 ----
- return 0;
- }
- return -1;
- ! #else
- ! return fcntl(fd, F_SETFD, 1);
- #endif
- + }
-
-
- /*
- ***************
- *** 123,128 ****
- --- 135,142 ----
- while (t->type == TPIPE) {
- openpipe(pv);
- (void) dup2(pv[1], 1); /* stdout of curr */
- + (void) fd_clexec(pv[0]);
- + (void) fd_clexec(pv[1]);
- exchild(t->left, flags);
- (void) dup2(pv[0], 0); /* stdin of next */
- closepipe(pv);
- ***************
- *** 131,136 ****
- --- 145,152 ----
- }
- flags &= ~ XPIPEO;
- (void) dup2(e.savefd[1], 1); /* stdout of last */
- + (void) fd_clexec(e.savefd[0]);
- + (void) fd_clexec(e.savefd[1]);
- exchild(t, flags);
- (void) dup2(e.savefd[0], 0); /* close pipe in */
- if (!(flags&XBGND))
- ***************
- *** 139,148 ****
-
- case TLIST:
- while (t->type == TLIST) {
- ! execute(t->left, 0);
- t = t->right;
- }
- ! rv = execute(t, 0);
- break;
-
- case TASYNC:
- --- 155,164 ----
-
- case TLIST:
- while (t->type == TLIST) {
- ! execute(t->left, flags & XXWHL);
- t = t->right;
- }
- ! rv = execute(t, flags & XXWHL);
- break;
-
- case TASYNC:
- ***************
- *** 151,159 ****
-
- case TOR:
- case TAND:
- ! rv = execute(t->left, 0);
- if (t->right != NULL && (rv == 0) == (t->type == TAND))
- ! rv = execute(t->right, 0);
- break;
-
- case TFOR:
- --- 167,175 ----
-
- case TOR:
- case TAND:
- ! rv = execute(t->left, flags & XXWHL);
- if (t->right != NULL && (rv == 0) == (t->type == TAND))
- ! rv = execute(t->right, flags & XXWHL);
- break;
-
- case TFOR:
- ***************
- *** 165,171 ****
- goto Break1;
- while (*ap != NULL) {
- setstr(global(t->str), *ap++);
- ! rv = execute(t->left, 0);
- }
- Break1:
- break;
- --- 181,187 ----
- goto Break1;
- while (*ap != NULL) {
- setstr(global(t->str), *ap++);
- ! rv = execute(t->left, flags & XXWHL);
- }
- Break1:
- break;
- ***************
- *** 183,189 ****
- if ((cp = do_selectargs(ap, cp)) == (char *)1)
- break;
- setstr(global(t->str), cp);
- ! rv = execute(t->left, 0);
- }
- break;
-
- --- 199,205 ----
- if ((cp = do_selectargs(ap, cp)) == (char *)1)
- break;
- setstr(global(t->str), cp);
- ! rv = execute(t->left, flags & XXWHL);
- }
- break;
-
- ***************
- *** 193,199 ****
- while ((i = setjmp(e.jbuf)))
- if (i == LBREAK)
- goto Break2;
- ! while ((execute(t->left, 0) == 0) == (t->type == TWHILE))
- rv = execute(t->right, XXWHL);
- Break2:
- break;
- --- 209,215 ----
- while ((i = setjmp(e.jbuf)))
- if (i == LBREAK)
- goto Break2;
- ! while ((execute(t->left, flags & XXWHL) == 0) == (t->type == TWHILE))
- rv = execute(t->right, XXWHL);
- Break2:
- break;
- ***************
- *** 202,210 ****
- case TELIF:
- if (t->right == NULL)
- break; /* should be error */
- ! rv = execute(t->left, 0) == 0 ?
- ! execute(t->right->left, 0) :
- ! execute(t->right->right, 0);
- break;
-
- case TCASE:
- --- 218,226 ----
- case TELIF:
- if (t->right == NULL)
- break; /* should be error */
- ! rv = execute(t->left, flags & XXWHL) == 0 ?
- ! execute(t->right->left, flags & XXWHL) :
- ! execute(t->right->right, flags & XXWHL);
- break;
-
- case TCASE:
- ***************
- *** 215,225 ****
- goto Found;
- break;
- Found:
- ! rv = execute(t->left, 0);
- break;
-
- case TBRACE:
- ! rv = execute(t->left, 0);
- break;
-
- case TFUNCT:
- --- 231,241 ----
- goto Found;
- break;
- Found:
- ! rv = execute(t->left, flags & XXWHL);
- break;
-
- case TBRACE:
- ! rv = execute(t->left, flags & XXWHL);
- break;
-
- case TFUNCT:
- ***************
- *** 351,357 ****
- if (setjmp(e.jbuf))
- rv = exstat; /* return # */
- else
- ! rv = execute(tp->val.t, 0);
- break;
-
- case CEXEC: /* executable command */
- --- 367,373 ----
- if (setjmp(e.jbuf))
- rv = exstat; /* return # */
- else
- ! rv = execute(tp->val.t, flags & XXWHL);
- break;
-
- case CEXEC: /* executable command */
- *** sh/history.c.old Thu Aug 13 00:15:33 1992
- --- sh/history.c Sun Dec 6 00:15:34 1992
- ***************
- *** 5,11 ****
- */
-
- #ifndef lint
- ! static char *RCSid = "$Id: history.c,v 1.4 1992/08/12 14:15:33 sjg Exp $";
- #endif
- /*
- * This file contains
- --- 5,11 ----
- */
-
- #ifndef lint
- ! static char *RCSid = "$Id: history.c,v 1.5 1992/12/05 13:15:34 sjg Exp $";
- #endif
- /*
- * This file contains
- ***************
- *** 643,650 ****
-
- histfd = fcntl(histfd, F_DUPFD, FDBASE);
-
- ! (void) fcntl(histfd, F_SETFD, 1); /* close on exec */
- !
- (void) flock(histfd, LOCK_EX);
-
- hsize = lseek(histfd, 0L, L_XTND);
- --- 643,650 ----
-
- histfd = fcntl(histfd, F_DUPFD, FDBASE);
-
- ! (void) fd_clexec(histfd);
- !
- (void) flock(histfd, LOCK_EX);
-
- hsize = lseek(histfd, 0L, L_XTND);
- *** sh/io.c.old Mon Aug 10 22:02:49 1992
- --- sh/io.c Sun Dec 6 00:15:39 1992
- ***************
- *** 3,9 ****
- */
-
- #ifndef lint
- ! static char *RCSid = "$Id: io.c,v 1.3 1992/08/10 12:02:49 sjg Exp $";
- #endif
-
- #include "stdh.h"
- --- 3,9 ----
- */
-
- #ifndef lint
- ! static char *RCSid = "$Id: io.c,v 1.4 1992/12/05 13:15:39 sjg Exp $";
- #endif
-
- #include "stdh.h"
- ***************
- *** 147,157 ****
- return -1;
- else
- errorf("too many files open in shell\n");
- - #ifdef F_SETFD
- - (void) fcntl(nfd, F_SETFD, 1);
- - #else
- (void) fd_clexec(ttyfd);
- - #endif
- close(fd);
- } else
- nfd = fd;
- --- 147,153 ----
- *** sh/jobs.c.old Mon Aug 10 22:02:52 1992
- --- sh/jobs.c Sun Dec 6 00:15:43 1992
- ***************
- *** 2,8 ****
- * Process and job control
- */
- #ifndef lint
- ! static char *RCSid = "$Id: jobs.c,v 1.5 1992/08/10 12:02:52 sjg Exp $";
- #endif
-
- /*
- --- 2,8 ----
- * Process and job control
- */
- #ifndef lint
- ! static char *RCSid = "$Id: jobs.c,v 1.6 1992/12/05 13:15:43 sjg Exp $";
- #endif
-
- /*
- ***************
- *** 320,327 ****
- for (i = (flags&XXWHL) ? 1 : 0; i < NUFILE; i++)
- flushshf(i);
-
- - /* create child process */
- - forksleep = 0;
- #ifdef JOBS
- /* don't allow SIGCHLD until we are ready */
-
- --- 320,325 ----
- ***************
- *** 331,336 ****
- --- 329,336 ----
- sigsetmask(sm_sigchld);
- # endif
- #endif
- + /* create child process */
- + forksleep = 0;
- while ((i = fork()) < 0 && errno == EAGAIN && forksleep < 32) {
- if (forksleep) {
- sleep(forksleep);
- *** sh/main.c.old Thu Aug 13 00:15:39 1992
- --- sh/main.c Sun Dec 6 00:15:49 1992
- ***************
- *** 3,9 ****
- */
-
- #ifndef lint
- ! static char *RCSid = "$Id: main.c,v 1.6 1992/08/12 14:15:39 sjg Exp $";
- #endif
-
- #define EXTERN /* define EXTERNs in sh.h */
- --- 3,9 ----
- */
-
- #ifndef lint
- ! static char *RCSid = "$Id: main.c,v 1.7 1992/12/05 13:15:49 sjg Exp $";
- #endif
-
- #define EXTERN /* define EXTERNs in sh.h */
- ***************
- *** 119,127 ****
- #endif
- ainit(&aperm); /* initialize permanent Area */
-
- - #ifndef F_SETFD
- - init_clexec();
- - #endif
- /* set up base enviroment */
- e.type = E_NONE;
- ainit(&e.area);
- --- 119,124 ----
- ***************
- *** 238,248 ****
- }
- if (s->type == STTY) {
- ttyfd = fcntl(0, F_DUPFD, FDBASE);
- - #ifdef F_SETFD
- - (void) fcntl(ttyfd, F_SETFD, 1);
- - #else
- (void) fd_clexec(ttyfd);
- - #endif
- #ifdef EMACS
- x_init_emacs();
- #endif
- --- 235,241 ----
- ***************
- *** 254,269 ****
- if (!qflag)
- ignoresig(SIGQUIT);
-
- ! l->argv = &argv[argi];
- l->argc = argc - argi;
- l->argv[0] = name;
- resetopts();
-
- ! if (name[0] == '-') {
- flag[FTALKING] = 1;
- (void) include("/etc/profile");
- (void) include(".profile");
- }
-
- /* include $ENV */
- arg = substitute(strval(global("ENV")), DOTILDE);
- --- 247,271 ----
- if (!qflag)
- ignoresig(SIGQUIT);
-
- ! l->argv = &argv[argi - 1];
- l->argc = argc - argi;
- l->argv[0] = name;
- resetopts();
-
- ! if (name[0] == '-' ||
- ! ((arg = strrchr(name, '/')) && *++arg == '-')) {
- flag[FTALKING] = 1;
- (void) include("/etc/profile");
- (void) include(".profile");
- }
- + /*
- + * do this after reading *profile but before
- + * reading $ENV if any.
- + */
- + #if defined(EMACS) || defined(VI)
- + if (flag[FTALKING])
- + init_editmode();
- + #endif
-
- /* include $ENV */
- arg = substitute(strval(global("ENV")), DOTILDE);
- ***************
- *** 278,286 ****
- signal(SIGTERM, trapsig);
- #endif
- ignoresig(SIGINT);
- - #if defined(EMACS) || defined(VI)
- - init_editmode();
- - #endif
- } else
- flag[FHASHALL] = 1;
-
- --- 280,285 ----
- *** sh/patchlevel.h.old Thu Aug 13 00:15:45 1992
- --- sh/patchlevel.h Sun Dec 6 00:15:52 1992
- ***************
- *** 1,6 ****
- /*
- * PD KSH
- ! * $Id: patchlevel.h,v 4.7 1992/08/12 14:15:45 sjg Exp $
- */
- #define VERSION 4
- ! #define PATCHLEVEL 7
- --- 1,6 ----
- /*
- * PD KSH
- ! * $Id: patchlevel.h,v 4.8 1992/12/05 13:15:52 sjg Exp $
- */
- #define VERSION 4
- ! #define PATCHLEVEL 8
- *** sh/version.c.old Thu Aug 13 00:15:53 1992
- --- sh/version.c Sun Dec 6 00:15:55 1992
- ***************
- *** 3,9 ****
- */
-
- #ifndef lint
- ! static char *RCSid = "$Id: version.c,v 1.6 1992/08/12 14:15:53 sjg Exp $";
- #endif
-
- #include "stdh.h"
- --- 3,9 ----
- */
-
- #ifndef lint
- ! static char *RCSid = "$Id: version.c,v 1.7 1992/12/05 13:15:55 sjg Exp $";
- #endif
-
- #include "stdh.h"
- ***************
- *** 12,59 ****
- #include "patchlevel.h"
-
- char ksh_version [] =
- ! "KSH_VERSION=@(#)PD KSH v4.7 92/08/12";
-
- - /***
- - $Log: version.c,v $
- - * Revision 1.6 1992/08/12 14:15:53 sjg
- - * Patch07: fix some build problems,
- - * and avoid core dump from arg processing bug.
- - *
- - * Revision 1.5 1992/08/10 12:03:29 sjg
- - * Update for patch06.
- - * Contributions from Peter Collinson, Neil Smithline and sjg
- - *
- - * Revision 1.4 1992/05/12 09:30:37 sjg
- - * see ChangeLog
- - *
- - * Revision 1.3 1992/05/03 08:29:20 sjg
- - * Update for Patch05
- - *
- - * Revision 1.2 1992/04/25 08:33:28 sjg
- - * Added RCS key.
- - *
- - * Revision 1.1 1992/04/18 05:51:48 sjg
- - * Initial revision
- - *
- - Version 4.0 91/11/09 sjg
- - distribution
- - Revision 3.3 89/03/27 15:52:29 egisin
- - distribution
- -
- - Revision 3.2 88/12/14 20:10:41 egisin
- - many fixes
- -
- - Revision 3.1 88/11/03 09:18:36 egisin
- - alpha distribution
- -
- - Revision 1.3 88/10/20 17:34:03 egisin
- - added @(#) to ksh_version
- -
- - Revision 1.2 88/09/27 19:01:58 egisin
- - fix version.c
- -
- - Revision 1.1 88/09/27 18:59:06 egisin
- - Initial revision
- - ***/
-
- --- 12,17 ----
- #include "patchlevel.h"
-
- char ksh_version [] =
- ! "KSH_VERSION=@(#)PD KSH v4.8 92/12/05";
-
-
-
- exit 0 # Just in case...
-