diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1998-10-29 04:09:22 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1998-10-29 04:09:22 +0000 |
commit | 48e72123566c3d7650be6571b80f9f70b41c6724 (patch) | |
tree | 0d23d0de2abdb77ca3971067b7984db08dcd8da6 /bin/ksh/syn.c | |
parent | f3f5bf3ebf1aaee9195c0d49323beb781e0c1676 (diff) |
Bug fixes from pdksh-unstable-5.2.13.4, including "official" versions of
some that we had already fixed locally.
o typeset -f FUNC doesn't print follows command (and expression) substitutions.
o when re-allocating memory, too much may be copied from old memory.
o set -o printed some options sans names.
o emacs mode: <esc>. in very fist command causes core dump.
o pdksh dumps core after a cd command.
o typeset -i reports on array elements that have no value
(at&t ksh reports on array base name - no index).
o ulimit -ctn unlimittttted kills shell (resource exceeded).
o ". /dev/null" says access denied.
o flag field in aliases incorrectly changed (all flags set instead of
clearing ISSET) in exec.c(flushcom).
o ${#array[*]} prints largest index instead of number of (set) elements
in an array (ksh88 does the former).
o sys_siglist[] doesn't always have NSIG non-null entries...
Diffstat (limited to 'bin/ksh/syn.c')
-rw-r--r-- | bin/ksh/syn.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/bin/ksh/syn.c b/bin/ksh/syn.c index 3f075af0316..068d7d40552 100644 --- a/bin/ksh/syn.c +++ b/bin/ksh/syn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: syn.c,v 1.10 1998/10/09 16:21:36 millert Exp $ */ +/* $OpenBSD: syn.c,v 1.11 1998/10/29 04:09:21 millert Exp $ */ /* * shell parser (C version) @@ -565,10 +565,19 @@ function_body(name, ksh_func) old_func_parse = e->flags & EF_FUNC_PARSE; e->flags |= EF_FUNC_PARSE; if ((t->left = get_command(CONTIN)) == (struct op *) 0) { - /* create empty command so foo(): will work */ + /* + * 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 + * be used as input), we pretend there is a colon here. + */ t->left = newtp(TCOM); - t->left->args = (char **) alloc(sizeof(char *), ATEMP); - t->left->args[0] = (char *) 0; + t->left->args = (char **) alloc(sizeof(char *) * 2, ATEMP); + t->left->args[0] = alloc(sizeof(char) * 3, ATEMP); + t->left->args[0][0] = CHAR; + t->left->args[0][1] = ':'; + t->left->args[0][2] = EOS; + t->left->args[1] = (char *) 0; t->left->vars = (char **) alloc(sizeof(char *), ATEMP); t->left->vars[0] = (char *) 0; } |