Time to import OpenBSD once again. Expect breakage.

This commit is contained in:
tg 2003-12-22 20:22:51 +00:00
parent 2bfc0acc6d
commit f7ecabd91c
24 changed files with 165 additions and 115 deletions

View File

@ -1,4 +1,4 @@
$OpenBSD: BUG-REPORTS,v 1.14 2003/02/28 09:45:09 jmc Exp $
$OpenBSD: BUG-REPORTS,v 1.15 2003/10/22 07:40:38 jmc Exp $
List of reported problems (problems reported and fixed before 5.0.4 not
included). Unresolved problems (may or may not still exist) marked by *,
@ -182,7 +182,7 @@ x pdksh 5.0.5, - (reported by Sean Hogan): repeated history commands were being
x pdksh 5.0.5, -: wait with no arguments would hang forever.
[fixed in 5.0.6 - only wait for running jobs in waitfor()]
x pdksh 5.0.2, HP-UX 9.01 (reported by Sean Hogan): scipts occasionally get
x pdksh 5.0.2, HP-UX 9.01 (reported by Sean Hogan): scripts occasionally get
stopped with SIGTTIN
[from Mail.1:68]:
I noticed another small problem today, which is that occasionally
@ -1201,7 +1201,7 @@ x pdksh 5.2.12, - (reported by Gabor Zahemszky): MAILCHECK and MAIL
x pdksh 5.2.12, - (reported by Gabor Zahemszky): memory gets badly fragmented
when reversing a (large) file using a simple while read loop and variable
contatenation.
concatenation.
[see Mail.XXX]
[fixed in 5.2.13: alloc.c changed to allow malloc() to deal with large
blocks.]
@ -1332,7 +1332,7 @@ x pdksh 5.2.13, (reported by Mark Funkenhauser): eval "$(false)" does not
result in $? being set to 1 (is 0).
[fixed in 5.2.14: c_sh.c(c_eval): set exstat to subst_exstat before shell()]
x pdksh 5.2.13, (reported with fix by Kevin Schoedel): word boardaries in
x pdksh 5.2.13, (reported with fix by Kevin Schoedel): word boundaries in
file completion are only spaces - at&t ksh uses ()<>&| and spaces.
[fixed in 5.2.14: edit.c(IS_WORDC): changed macro to be LEX1 + quotes]

4
NEWS
View File

@ -57,7 +57,7 @@ Version 5.2.13
* editing: completion after "cmd " now completes files (was command).
$OpenBSD: NEWS,v 1.12 2003/02/28 09:45:09 jmc Exp $
$OpenBSD: NEWS,v 1.13 2003/10/22 07:40:38 jmc Exp $
Version 5.2.12
@ -438,7 +438,7 @@ Version 5.0.10
* configuration: look for clock_t in sys/times.h.
* configuration: use _SIGMAX, if available, for # of signals.
* SIGHUP now causes builtin read command to exit.
* wait builtin now returns whenever a traped signal occurs as per POSIX.
* wait builtin now returns whenever a trapped signal occurs as per POSIX.
* v command now works in vi; anchored searches now work in vi mode (/^ptrn);
multi-line commands displayed correctly by history.

4
NOTES
View File

@ -1,4 +1,4 @@
$OpenBSD: NOTES,v 1.8 2003/02/26 03:53:35 david Exp $
$OpenBSD: NOTES,v 1.9 2003/10/26 15:07:25 jmc Exp $
General features of at&t ksh88 that are not (yet) in pdksh:
- exported aliases and functions (not in ksh93).
@ -131,7 +131,7 @@ Known differences between pdksh & at&t ksh (that are not likely to change)
- . file: at&t ksh parses the whole file before executing anything,
pdksh executes as it parses. This means aliases defined in the file
will affect how pdksh parses the file, but won't affect how at&t ksh
parses the file. Also means pdksh will not parse statements occuring
parses the file. Also means pdksh will not parse statements occurring
after a (executed) return statement.
- a return in $ENV in at&t ksh will cause the shell to exit, while in
pdksh it will stop executing the script (this is consistent with

View File

@ -1,4 +1,4 @@
/* $OpenBSD: c_ksh.c,v 1.16 2003/02/28 09:45:09 jmc Exp $ */
/* $OpenBSD: c_ksh.c,v 1.17 2003/10/22 07:40:38 jmc Exp $ */
/*
* built-in Korn commands: c_*
@ -75,7 +75,7 @@ c_cd(wp)
bi_errorf("don't know current directory");
return 1;
}
/* substitue arg1 for arg2 in current path.
/* substitute arg1 for arg2 in current path.
* if the first substitution fails because the cd fails
* we could try to find another substitution. For now
* we don't
@ -652,7 +652,7 @@ c_typeset(wp)
flag = LCASEV;
break;
case 'p': /* posix export/readonly -p flag.
* typset -p is the same as typeset (in pdksh);
* typeset -p is the same as typeset (in pdksh);
* here for compatibility with ksh93.
*/
pflag = 1;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: c_test.c,v 1.9 2003/02/28 09:45:09 jmc Exp $ */
/* $OpenBSD: c_test.c,v 1.10 2003/10/10 19:09:07 millert Exp $ */
/*
* test(1); version 7-like -- author Erik Baalbergen
@ -458,10 +458,12 @@ test_eaccess(path, mode)
}
#endif /* !HAVE_DEV_FD */
/* On most (all?) unixes, access() says everything is executable for
res = eaccess(path, mode);
/*
* On most (all?) unixes, access() says everything is executable for
* root - avoid this on files by using stat().
*/
if ((mode & X_OK) && ksheuid == 0) {
if (res == 0 && ksheuid == 0 && (mode & X_OK)) {
struct stat statb;
if (stat(path, &statb) < 0)
@ -471,13 +473,7 @@ test_eaccess(path, mode)
else
res = (statb.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH))
? 0 : -1;
/* Need to check other permissions? If so, use access() as
* this will deal with root on NFS.
*/
if (res == 0 && (mode & (R_OK|W_OK)))
res = eaccess(path, mode);
} else
res = eaccess(path, mode);
}
return res;
}

View File

@ -1,7 +1,7 @@
/* $OpenBSD: c_test.h,v 1.1.1.1 1996/08/14 06:19:10 downsj Exp $ */
/* $OpenBSD: c_test.h,v 1.2 2003/10/22 07:40:38 jmc Exp $ */
/* Various types of operations. Keeping things grouped nicely
* (unary,binary) makes switch() statements more efficeint.
* (unary,binary) makes switch() statements more efficient.
*/
enum Test_op {
TO_NONOP = 0, /* non-operator */

View File

@ -1,10 +1,10 @@
/* $OpenBSD: c_ulimit.c,v 1.9 2002/06/09 05:47:27 todd Exp $ */
/* $OpenBSD: c_ulimit.c,v 1.10 2003/10/22 07:40:38 jmc Exp $ */
/*
ulimit -- handle "ulimit" builtin
Reworked to use getrusage() and ulimit() at once (as needed on
some schizophenic systems, eg, HP-UX 9.01), made argument parsing
some schizophrenic systems, eg, HP-UX 9.01), made argument parsing
conform to at&t ksh, added autoconf support. Michael Rendell, May, '94
Eric Gisin, September 1988

View File

@ -1,4 +1,4 @@
/* $OpenBSD: config.h,v 1.8 2003/05/16 18:49:46 jsyn Exp $ */
/* $OpenBSD: config.h,v 1.9 2003/10/22 07:40:38 jmc Exp $ */
/* config.h. NOT generated automatically. */
@ -76,7 +76,7 @@
/* Define if the closedir function returns void instead of int. */
/* #undef VOID_CLOSEDIR */
/* Define if your kernal doesn't handle scripts starting with #! */
/* Define if your kernel doesn't handle scripts starting with #! */
/* #undef SHARPBANG */
/* Define if dup2() preserves the close-on-exec flag (ultrix does this) */

18
emacs.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: emacs.c,v 1.27 2003/09/01 15:47:40 naddy Exp $ */
/* $OpenBSD: emacs.c,v 1.28 2003/10/22 07:40:38 jmc Exp $ */
/*
* Emacs-like command line editing and history
@ -212,7 +212,7 @@ static const struct x_ftab x_ftab[] = {
{ x_yank, "yank", 0 },
{ x_comp_list, "complete-list", 0 },
{ x_expand, "expand-file", 0 },
{ x_fold_capitialize, "capitalize-word", XF_ARG },
{ x_fold_capitalize, "capitalize-word", XF_ARG },
{ x_fold_lower, "downcase-word", XF_ARG },
{ x_fold_upper, "upcase-word", XF_ARG },
{ x_set_arg, "set-arg", XF_NOBIND },
@ -307,8 +307,8 @@ static struct x_defbindings const x_defbindings[] = {
{ XFUNC_fold_upper, 1, 'u' },
{ XFUNC_fold_lower, 1, 'L' },
{ XFUNC_fold_lower, 1, 'l' },
{ XFUNC_fold_capitialize, 1, 'C' },
{ XFUNC_fold_capitialize, 1, 'c' },
{ XFUNC_fold_capitalize, 1, 'C' },
{ XFUNC_fold_capitalize, 1, 'c' },
#ifdef OS2
{ XFUNC_meta3, 0, 0xE0 },
{ XFUNC_mv_back, 3, 'K' },
@ -1135,7 +1135,7 @@ x_transpose(c)
* gnu emacs: abCd acbD abcd_ abdc_
* Pdksh currently goes with GNU behavior since I believe this is the
* most common version of emacs, unless in gmacs mode, in which case
* it does the at&t ksh gmacs mdoe.
* it does the at&t ksh gmacs mode.
* This should really be broken up into 3 functions so users can bind
* to the one they want.
*/
@ -2103,7 +2103,7 @@ x_fold_lower(c)
/* Lowercase N(1) words */
static int
x_fold_capitialize(c)
x_fold_capitalize(c)
int c;
{
return x_fold_case('C');
@ -2132,7 +2132,7 @@ x_fold_case(c)
}
while (x_arg--) {
/*
* fisrt skip over any white-space
* first skip over any white-space
*/
while (cp != xep && is_mfs(*cp))
cp++;
@ -2144,7 +2144,7 @@ x_fold_case(c)
if (c == 'L') { /* lowercase */
if (isupper(*cp))
*cp = tolower(*cp);
} else { /* uppercase, capitialize */
} else { /* uppercase, capitalize */
if (islower(*cp))
*cp = toupper(*cp);
}
@ -2157,7 +2157,7 @@ x_fold_case(c)
if (c == 'U') { /* uppercase */
if (islower(*cp))
*cp = toupper(*cp);
} else { /* lowercase, capitialize */
} else { /* lowercase, capitalize */
if (isupper(*cp))
*cp = tolower(*cp);
}

8
eval.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: eval.c,v 1.13 2003/04/16 23:11:52 tdeval Exp $ */
/* $OpenBSD: eval.c,v 1.14 2003/11/10 21:26:39 millert Exp $ */
/*
* Expansion - quoting, separation, substitution, globbing
@ -874,8 +874,10 @@ comsub(xp, cp)
openpipe(pv);
shf = shf_fdopen(pv[0], SHF_RD, (struct shf *) 0);
ofd1 = savefd(1, 0); /* fd 1 may be closed... */
ksh_dup2(pv[1], 1, FALSE);
close(pv[1]);
if (pv[1] != 1) {
ksh_dup2(pv[1], 1, FALSE);
close(pv[1]);
}
execute(t, XFORK|XXCOM|XPIPEO);
restfd(1, ofd1);
startlast();

20
exec.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: exec.c,v 1.27 2003/02/28 09:45:09 jmc Exp $ */
/* $OpenBSD: exec.c,v 1.31 2003/12/15 05:25:52 otto Exp $ */
/*
* execute command tree
@ -230,8 +230,10 @@ execute(t, flags)
e->savefd[1] = savefd(1, 0);
openpipe(pv);
ksh_dup2(pv[0], 0, FALSE);
close(pv[0]);
if (pv[0] != 0) {
ksh_dup2(pv[0], 0, FALSE);
close(pv[0]);
}
coproc.write = pv[1];
coproc.job = (void *) 0;
@ -457,11 +459,12 @@ comexec(t, tp, ap, flags)
int type_flags;
int keepasn_ok;
int fcflags = FC_BI|FC_FUNC|FC_PATH;
int bourne_function_call = 0;
#ifdef KSH
/* snag the last argument for $_ XXX not the same as at&t ksh,
* which only seems to set $_ after a newline (but not in
* functions/dot scripts, but in interactive and scipt) -
* functions/dot scripts, but in interactive and script) -
* perhaps save last arg here and set it in shell()?.
*/
if (!Flag(FSH) && Flag(FTALKING) && *(lastp = ap)) {
@ -546,9 +549,10 @@ comexec(t, tp, ap, flags)
newblock();
/* ksh functions don't keep assignments, POSIX functions do. */
if (keepasn_ok && tp && tp->type == CFUNC
&& !(tp->flag & FKSH))
&& !(tp->flag & FKSH)) {
bourne_function_call = 1;
type_flags = 0;
else
} else
type_flags = LOCAL|LOCAL_COPY|EXPORT;
}
if (Flag(FEXPORT))
@ -565,6 +569,8 @@ comexec(t, tp, ap, flags)
shf_flush(shl_out);
}
typeset(cp, type_flags, 0, 0, 0);
if (bourne_function_call && !(type_flags & EXPORT))
typeset(cp, LOCAL|LOCAL_COPY|EXPORT, 0, 0, 0);
}
if ((cp = *ap) == NULL) {
@ -1355,6 +1361,8 @@ iosetup(iop, tp)
snptreef((char *) 0, 32, "%R", &iotmp), emsg);
return -1;
}
if (u == iop->unit)
return 0; /* "dup from" == "dup to" */
break;
}
}

8
expr.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: expr.c,v 1.8 2003/02/28 09:45:09 jmc Exp $ */
/* $OpenBSD: expr.c,v 1.9 2003/10/22 07:40:38 jmc Exp $ */
/*
* Korn expression evaluation
@ -140,7 +140,7 @@ static struct tbl *tempvar ARGS((void));
static struct tbl *intvar ARGS((Expr_state *es, struct tbl *vp));
/*
* parse and evalute expression
* parse and evaluate expression
*/
int
evaluate(expr, rval, error_ok)
@ -159,7 +159,7 @@ evaluate(expr, rval, error_ok)
}
/*
* parse and evalute expression, storing result in vp.
* parse and evaluate expression, storing result in vp.
*/
int
v_evaluate(vp, expr, error_ok)
@ -208,7 +208,7 @@ v_evaluate(vp, expr, error_ok)
if (vp->flag & INTEGER)
setint_v(vp, v);
else
/* can fail if readony */
/* can fail if readonly */
setstr(vp, str_val(v), error_ok);
quitenv();

4
io.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: io.c,v 1.12 2003/03/10 03:48:16 david Exp $ */
/* $OpenBSD: io.c,v 1.13 2003/11/10 21:26:39 millert Exp $ */
/*
* shell buffered IO and formatted output
@ -321,7 +321,7 @@ restfd(fd, ofd)
shf_flush(&shf_iob[fd]);
if (ofd < 0) /* original fd closed */
close(fd);
else {
else if (fd != ofd) {
ksh_dup2(ofd, fd, TRUE); /* XXX: what to do if this fails? */
close(ofd);
}

14
jobs.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: jobs.c,v 1.19 2003/03/13 09:03:07 deraadt Exp $ */
/* $OpenBSD: jobs.c,v 1.21 2003/11/10 21:26:39 millert Exp $ */
/*
* Process and job control
@ -15,7 +15,7 @@
*
* Notes regarding the copious ifdefs:
* - JOB_SIGS is independent of JOBS - it is defined if there are modern
* signal and wait routines available. This is prefered, even when
* signal and wait routines available. This is preferred, even when
* JOBS is not defined, since the shell will not otherwise notice when
* background jobs die until the shell waits for a foreground process
* to die.
@ -123,7 +123,7 @@ struct proc {
#define JF_CHANGED 0x040 /* process has changed state */
#define JF_KNOWN 0x080 /* $! referenced */
#define JF_ZOMBIE 0x100 /* known, unwaited process */
#define JF_REMOVE 0x200 /* flaged for removal (j_jobs()/j_noityf()) */
#define JF_REMOVE 0x200 /* flagged for removal (j_jobs()/j_noityf()) */
#define JF_USETTYMODE 0x400 /* tty mode saved if process exits normally */
#define JF_SAVEDTTYPGRP 0x800 /* j->saved_ttypgrp is valid */
@ -629,8 +629,10 @@ exchild(t, flags, close_fd)
SS_RESTORE_IGN|SS_FORCE);
if (!(flags & (XPIPEI | XCOPROC))) {
int fd = open("/dev/null", 0);
(void) ksh_dup2(fd, 0, TRUE);
close(fd);
if (fd != 0) {
(void) ksh_dup2(fd, 0, TRUE);
close(fd);
}
}
}
remove_job(j, "child"); /* in case of `jobs` command */
@ -1435,7 +1437,7 @@ check_job(j)
*/
if (j->state == PEXITED || j->state == PSIGNALLED) {
/* No need to keep co-process input any more
* (at leasst, this is what ksh93d thinks)
* (at least, this is what ksh93d thinks)
*/
if (coproc.job == j) {
coproc.job = (void *) 0;

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: ksh.1tbl,v 1.58 2003/09/04 14:21:43 jmc Exp $
.\" $OpenBSD: ksh.1tbl,v 1.62 2003/12/22 11:54:02 jmc Exp $
.\"
.\" Copyright (c) 1980, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@ -409,6 +409,19 @@ have equal precedence which is higher than that of
and
.Ql \&; ,
which also have equal precedence.
Note that the
.Ql &&
and
.Ql ||
operators are
.Qq left-associative .
For example, both of these commands will print only
.Qq bar :
.Bd -literal -offset indent
false && echo foo || echo bar
true || echo foo && echo bar
.Ed
.Pp
The
.Ql &
token causes the preceding command to be executed asynchronously; that is,
@ -1031,7 +1044,10 @@ Parameter substitutions take the form
.Ic ${ Ns Ar name Ns Ic \&} ,
or
.Sm off
.Ic ${ Ar name Oo Ar expr Oc Ic \&} ,
.Xo
.Ic ${ Ar name Oo Ar expr Oc
.Ic \&} ,
.Xc
.Sm on
where
.Ar name
@ -2473,7 +2489,10 @@ loop
.It
.Ic alias a='for ' i='j'
.It
.Ic a i in 1 2; do echo i=$i j=$j; done
.Xo
.Ic a i in 1 2; do echo i=$i j=$j;
.Ic done
.Xc
.El
.Pp
uses parameter
@ -2546,7 +2565,7 @@ Additional ksh special commands
Very special commands
.Pq Pf non- Tn POSIX
.Pp
.Ic alias , readonly , set , typset
.Ic alias , readonly , set , typeset
.Pp
.Tn POSIX
regular commands
@ -5108,6 +5127,22 @@ deleted and a new prompt to be printed.
.%D 1993
.%O "ISBN 1-55937-266-9"
.Re
.Sh VERSION
This page documents version @(#)PD KSH v5.2.14 99/07/13.2 of the public
domain Korn shell.
.Sh AUTHORS
This shell is based on the public domain 7th edition Bourne shell clone by
Charles Forsyth and parts of the BRL shell by Doug A. Gwyn, Doug Kingston,
Ron Natalie, Arnold Robbins, Lou Salkind, and others.
The first release of
.Nm pdksh
was created by Eric Gisin, and it was subsequently maintained by John R.
MacMillan (change!john@sq.sq.com) and Simon J. Gerraty (sjg@zen.void.oz.au).
The current maintainer is Michael Rendell (michael@cs.mun.ca).
The
.Pa CONTRIBUTORS
file in the source distribution contains a more complete list of people and
their part in the shell's development.
.Sh BUGS
Any bugs in
.Nm pdksh
@ -5140,19 +5175,3 @@ echo hi | read a; echo $a\ \ \ # Does not print hi
.Ed
.Pp
I'm aware of this and there is no need to report it.
.Sh VERSION
This page documents version @(#)PD KSH v5.2.14 99/07/13.2 of the public
domain Korn shell.
.Sh AUTHORS
This shell is based on the public domain 7th edition Bourne shell clone by
Charles Forsyth and parts of the BRL shell by Doug A. Gwyn, Doug Kingston,
Ron Natalie, Arnold Robbins, Lou Salkind, and others.
The first release of
.Nm pdksh
was created by Eric Gisin, and it was subsequently maintained by John R.
MacMillan (change!john@sq.sq.com) and Simon J. Gerraty (sjg@zen.void.oz.au).
The current maintainer is Michael Rendell (michael@cs.mun.ca).
The
.Pa CONTRIBUTORS
file in the source distribution contains a more complete list of people and
their part in the shell's development.

4
misc.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: misc.c,v 1.19 2003/09/01 15:47:40 naddy Exp $ */
/* $OpenBSD: misc.c,v 1.20 2003/10/22 07:40:38 jmc Exp $ */
/*
* Miscellaneous functions
@ -183,7 +183,7 @@ const struct option options[] = {
#endif
{ "xtrace", 'x', OF_ANY },
/* Anonymous flags: used internally by shell only
* (not visable to user)
* (not visible to user)
*/
{ (char *) 0, 0, OF_INTERNAL }, /* FTALKING_I */
};

4
path.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: path.c,v 1.8 2003/02/28 09:45:09 jmc Exp $ */
/* $OpenBSD: path.c,v 1.9 2003/10/22 07:40:38 jmc Exp $ */
#include "sh.h"
#include "ksh_stat.h"
@ -29,7 +29,7 @@ static char *do_phys_path ARGS((XString *xsp, char *xp, const char *path));
* - cdpathp is set to the start of the next element in cdpathp (or NULL
* if there are no more elements.
* The return value indicates whether a non-null element from cdpathp
* was appened to result.
* was appended to result.
*/
int
make_path(cwd, file, cdpathp, xsp, phys_pathp)

48
sh.1tbl
View File

@ -1,4 +1,4 @@
.\" $OpenBSD: sh.1tbl,v 1.36 2003/09/04 14:21:43 jmc Exp $
.\" $OpenBSD: sh.1tbl,v 1.40 2003/12/22 11:54:02 jmc Exp $
.\"
.\" Copyright (c) 1980, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@ -400,6 +400,19 @@ have equal precedence which is higher than that of
and
.Ql \&; ,
which also have equal precedence.
Note that the
.Ql &&
and
.Ql ||
operators are
.Qq left-associative .
For example, both of these commands will print only
.Qq bar :
.Bd -literal -offset indent
false && echo foo || echo bar
true || echo foo && echo bar
.Ed
.Pp
The
.Ql &
token causes the preceding command to be executed asynchronously; that is,
@ -2069,7 +2082,10 @@ loop
.It
.Ic alias a='for ' i='j'
.It
.Ic a i in 1 2; do echo i=$i j=$j; done
.Xo
.Ic a i in 1 2; do echo i=$i j=$j;
.Ic done
.Xc
.El
.Pp
uses parameter
@ -2142,7 +2158,7 @@ Additional ksh special commands
Very special commands
.Pq Pf non- Tn POSIX
.Pp
.Ic alias , readonly , set , typset
.Ic alias , readonly , set , typeset
.Pp
.Tn POSIX
regular commands
@ -3784,6 +3800,19 @@ extensions exposed, caution should be used where backwards compatibility with
traditional Bourne or
.Tn POSIX
compliant shells is an issue.
.Sh AUTHORS
This shell is based on the public domain 7th edition Bourne shell clone by
Charles Forsyth and parts of the BRL shell by Doug A. Gwyn, Doug Kingston,
Ron Natalie, Arnold Robbins, Lou Salkind, and others.
The first release of
.Nm pdksh
was created by Eric Gisin, and it was subsequently maintained by John R.
MacMillan (change!john@sq.sq.com) and Simon J. Gerraty (sjg@zen.void.oz.au).
The current maintainer is Michael Rendell (michael@cs.mun.ca).
The
.Pa CONTRIBUTORS
file in the source distribution contains a more complete list of people and
their part in the shell's development.
.Sh BUGS
Any bugs in
.Nm pdksh
@ -3816,16 +3845,3 @@ echo hi | read a; echo $a\ \ \ # Does not print hi
.Ed
.Pp
I'm aware of this and there is no need to report it.
.Sh AUTHORS
This shell is based on the public domain 7th edition Bourne shell clone by
Charles Forsyth and parts of the BRL shell by Doug A. Gwyn, Doug Kingston,
Ron Natalie, Arnold Robbins, Lou Salkind, and others.
The first release of
.Nm pdksh
was created by Eric Gisin, and it was subsequently maintained by John R.
MacMillan (change!john@sq.sq.com) and Simon J. Gerraty (sjg@zen.void.oz.au).
The current maintainer is Michael Rendell (michael@cs.mun.ca).
The
.Pa CONTRIBUTORS
file in the source distribution contains a more complete list of people and
their part in the shell's development.

10
sh.h
View File

@ -1,4 +1,4 @@
/* $OpenBSD: sh.h,v 1.14 2003/09/01 15:47:40 naddy Exp $ */
/* $OpenBSD: sh.h,v 1.15 2003/10/22 07:40:38 jmc Exp $ */
/*
* Public Domain Bourne/Korn shell
@ -482,7 +482,7 @@ enum sh_flag {
#endif
FIGNOREEOF, /* eof does not exit */
FTALKING, /* -i: interactive */
FKEYWORD, /* -k: name=value anywere */
FKEYWORD, /* -k: name=value anywhere */
FLOGIN, /* -l: a login shell */
FMARKDIRS, /* mark dirs with / in file name completion */
FMONITOR, /* -m: job control monitoring */
@ -499,7 +499,7 @@ enum sh_flag {
FPOSIX, /* -o posix: be posixly correct */
FPRIVILEGED, /* -p: use suid_profile */
FRESTRICTED, /* -r: restricted shell */
FSH, /* -o sh: favor sh behavour */
FSH, /* -o sh: favor sh behaviour */
FSTDIN, /* -s: (invocation) parse stdin */
FTRACKALL, /* -h: create tracked aliases for all commands */
FVERBOSE, /* -v: echo input */
@ -689,11 +689,11 @@ EXTERN char *current_wd;
EXTERN int current_wd_size;
#ifdef EDIT
/* Minimium required space to work with on a line - if the prompt leaves less
/* Minimum required space to work with on a line - if the prompt leaves less
* space than this on a line, the prompt is truncated.
*/
# define MIN_EDIT_SPACE 7
/* Minimium allowed value for x_cols: 2 for prompt, 3 for " < " at end of line
/* Minimum allowed value for x_cols: 2 for prompt, 3 for " < " at end of line
*/
# define MIN_COLS (2 + MIN_EDIT_SPACE + 3)
EXTERN int x_cols I__(80); /* tty columns */

4
syn.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: syn.c,v 1.13 2002/06/09 05:47:27 todd Exp $ */
/* $OpenBSD: syn.c,v 1.14 2003/10/22 07:40:38 jmc Exp $ */
/*
* shell parser (C version)
@ -571,7 +571,7 @@ function_body(name, ksh_func)
/*
* Probably something like foo() followed by eof or ;.
* This is accepted by sh and ksh88.
* To make "typset -f foo" work reliably (so its output can
* To make "typeset -f foo" work reliably (so its output can
* be used as input), we pretend there is a colon here.
*/
t->left = newtp(TCOM);

View File

@ -19,7 +19,7 @@ description:
category: !os:os2
file-setup: dir 755 "dir"
file-setup: symlink 644 "dir/abc"
non-existant-file
non-existent-file
stdin:
echo d*/*
echo d*/abc

View File

@ -1,4 +1,4 @@
# $OpenBSD: regress.t,v 1.11 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: regress.t,v 1.12 2003/11/08 19:17:27 jmc Exp $
#
# The first 39 of these tests are from the old Bugs script.
@ -290,7 +290,7 @@ description:
The command
. /foo/bar
should set the exit status to non-zero (sh and at&t ksh88 do).
XXX doting a non existant file is a fatal error for a script
XXX doting a non existent file is a fatal error for a script
stdin:
. does/not/exist
expected-exit: e != 0

4
tree.h
View File

@ -1,4 +1,4 @@
/* $OpenBSD: tree.h,v 1.7 1999/07/14 13:37:24 millert Exp $ */
/* $OpenBSD: tree.h,v 1.8 2003/10/22 07:40:38 jmc Exp $ */
/*
* command trees for compile/execute
@ -109,7 +109,7 @@ struct ioword {
#define XCCLOSE BIT(7) /* exchild: close close_fd in child */
#define XERROK BIT(8) /* non-zero exit ok (for set -e) */
#define XCOPROC BIT(9) /* starting a co-process */
#define XTIME BIT(10) /* timeing TCOM command */
#define XTIME BIT(10) /* timing TCOM command */
#define XINTACT BIT(11) /* OS2: proc started from interactive session */
/*

19
vi.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: vi.c,v 1.11 2003/03/13 09:03:07 deraadt Exp $ */
/* $OpenBSD: vi.c,v 1.12 2003/10/16 22:08:48 millert Exp $ */
/*
* vi command editing
@ -238,7 +238,7 @@ x_vi(buf, len)
x_putc('\r'); x_putc('\n'); x_flush();
if (c == -1)
if (c == -1 || len <= es->linelen)
return -1;
if (es->cbuf != buf)
@ -462,15 +462,22 @@ vi_hook(ch)
else {
locpat[srchlen++] = ch;
if ((ch & 0x80) && Flag(FVISHOW8)) {
if (es->linelen + 2 > es->cbufsize)
vi_error();
es->cbuf[es->linelen++] = 'M';
es->cbuf[es->linelen++] = '-';
ch &= 0x7f;
}
if (ch < ' ' || ch == 0x7f) {
if (es->linelen + 2 > es->cbufsize)
vi_error();
es->cbuf[es->linelen++] = '^';
es->cbuf[es->linelen++] = ch ^ '@';
} else
} else {
if (es->linelen >= es->cbufsize)
vi_error();
es->cbuf[es->linelen++] = ch;
}
es->cursor = es->linelen;
refresh(0);
}
@ -693,7 +700,7 @@ vi_insert(ch)
/* End nonstandard vi commands } */
default:
if (es->linelen == es->cbufsize - 1)
if (es->linelen >= es->cbufsize - 1)
return -1;
ibuf[inslen++] = ch;
if (insert == INSERT) {
@ -1405,8 +1412,8 @@ save_edstate(old)
new = (struct edstate *)alloc(sizeof(struct edstate), APERM);
new->cbuf = alloc(old->cbufsize, APERM);
memcpy(new->cbuf, old->cbuf, old->linelen);
new->cbufsize = old->cbufsize;
strlcpy(new->cbuf, old->cbuf, new->cbufsize);
new->linelen = old->linelen;
new->cursor = old->cursor;
new->winleft = old->winleft;
@ -1417,7 +1424,7 @@ static void
restore_edstate(new, old)
struct edstate *old, *new;
{
strncpy(new->cbuf, old->cbuf, old->linelen);
memcpy(new->cbuf, old->cbuf, old->linelen);
new->linelen = old->linelen;
new->cursor = old->cursor;
new->winleft = old->winleft;