[Midnightbsd-cvs] CVS Commit: bin/ksh: Remove OpenBSD ksh

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Aug 18 01:43:55 EDT 2007


Log Message:
-----------
Remove OpenBSD ksh

Removed Files:
-------------
    src/bin/ksh:
        BUG-REPORTS
        CONTRIBUTORS
        ChangeLog
        ChangeLog.0
        IAFA-PACKAGE
        INSTALL
        LEGAL
        Makefile
        NEWS
        NOTES
        PROJECTS
        README
        alloc.c
        c_ksh.c
        c_sh.c
        c_test.c
        c_test.h
        c_ulimit.c
        config.h
        edit.c
        edit.h
        emacs-gen.sh
        emacs.c
        eval.c
        exec.c
        expand.h
        expr.c
        history.c
        io.c
        jobs.c
        ksh.1
        ksh_limval.h
        lex.c
        lex.h
        mail.c
        main.c
        misc.c
        mknod.c
        path.c
        proto.h
        sh.1
        sh.h
        shf.c
        shf.h
        syn.c
        table.c
        table.h
        trap.c
        tree.c
        tree.h
        tty.c
        tty.h
        var.c
        version.c
        vi.c
    src/bin/ksh/tests:
        README
        alias.t
        arith.t
        bksl-nl.t
        brkcont.t
        cdhist.t
        eglob.t
        glob.t
        heredoc.t
        history.t
        ifs.t
        integer.t
        lineno.t
        read.t
        regress.t
        syntax.t
        th
        unclass1.t
        unclass2.t
        version.t

-------------- next part --------------
--- bin/ksh/BUG-REPORTS
+++ /dev/null
@@ -1,1399 +0,0 @@
-$MidnightBSD: src/bin/ksh/BUG-REPORTS,v 1.2 2007/07/26 20:12:59 laffer1 Exp $
-$OpenBSD: BUG-REPORTS,v 1.16 2005/11/15 07:02:33 miod 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 *,
-problems believed to be fixed marked by x.
-
-* pdksh 5.0.3, MIPS RISC/os 5.0 (bsd universe) (noted by Michael Rendell):
-  for interactive, job controlled shells, the kernel's tty state gets twisted
-  in such a way that all output is lost (eg, if ttyXX is wedged then
-  "echo hi > /dev/ttyXX" from a separate login appears to succeed but produces
-  no output on ttyXX).
-  Work around is to run a program and hit ^C.
-
-* pdksh 5.0.1, NetBSD 0.9a? (reported by Simon J. Gerraty): problem with
-  job control not finding tty
-  [from Mail.1:71]:
-    Also, I have noticed (with 5.0.1 anyway) that if as root I su to a
-    user I get: 
-    root:511$ su foobar
-    warning: won't have full job control
-    [1] + Stopped (tty output) stty erase ^? 
-    foobar:1$
-
-* pdksh 5.0.8, - (reported by Sean Hogan): attempting file name completion
-  on a word with a single backquote causes a "no closing quote" error and
-  loses the partially entered command (vi mode).
-  [see Mail.2:48]
-  [partly fixed in 5.2.14: backquote ok, but happens for the likes of ${.]
-
-* pdksh 5.0.10, - (reported by Andrew Moore): no overflow checking is done
-  in integer parsing code.
-  [see Mail.3:78]
-
-* pdksh 5.0.6+5.1.2, BSD43/MachTen (reported by Dan Menchaca): ksh freezes up
-  terminal after a while after printing process exit message.  5.1.2 causes
-  system to hang after executing two commands.
-  [see Mail.3:96,5:42]
-
-* pdksh 5.1.3, - (reported by Brad Warkentin & others): if the last command of
-  a pipeline is a shell builtin, it is not executed in the parent shell,
-  so "echo a b | read foo bar" does not set foo and bar in the parent
-  shell (at&t ksh will).
-  [see Mail.7:32,Mail.9:65]
-
-* pdksh 5.1.3, - (reported by Gabor Zahemszky): emacs/vi doesn't have \ as quote
-  character.
-  [see Mail.7:87]
-
-* pdksh 5.1.3, - (reported by Gabor Zahemszky): emacs default bindings doesn't
-  have vt52 arrow keys or vt100 alternate keypad mode bindings.
-  [see Mail.7:87]
-
-* pdksh 5.1.3, SCO 3.2.2 (reported by Gabor Zahemszky): shell hangs
-  waiting for finished process to finish.
-  [see Mail.7:87]
-
-* pdksh 5.2.0, - (reported by Gabor Zahemszky): ^V in vi leaves cursor at
-  start of the line.
-  [see Mail.8:43]
-
-* enhancements that haven't been merged yet
-	- Mail.6:36-39,78,84 recursive function diffs (add hard limit on
-	  depeth of recursion)
-
-* pdksh 5.2.3, - (reported by David Gast(? gast at twinsun.com)): history (fc,
-  et al) don't work in shell scripts.
-  [see Mail.10:49]
-
-* pdksh 5.2.4, - (reported by Gabor Zahemszky): emacs: ^P steps through
-  multiline commands - should go to start of command.
-  [see Mail.XXX:XXX]
-
-* pdksh 5.2.7, - (reported by Adrian Marsh): typeset -L20u xxx is ok is ksh88
-  but not in pdksh.
-  [see Mail.XXX:XXX]
-
-* pdksh 5.2.7, - (reported by Gabor Zahemszky): TMOUT doesn't effect
-  select and read operations.
-  [see Mail.XXX:XXX]
-
-* pdksh 5.2.10, - (reported by Simon J. Gerraty): in emacs, <ESC><ESC> applied
-  to a word with a macro does not complete the word (only expands the macro).
-  [see Mail.XXX]
-
-* pdksh 5.2.12, - (reported by Han Holl <jeholl at euronet.nl>): pdksh does not
-  parse the whole script before executing, so some syntax errors are not
-  detected (if the shell exits before reading the whole file).
-  [see Mail.XXX]
-
-* pdksh 5.2.12, (reported by Michael Staats): emacs: file completion does
-  not complete as much as possible when file is ~/something (will list
-  possible completions but won't fill in to the first difference).
-  Happens since code doesn't distinguish between globbing and ~ (needs
-  special case to strip & replace a leading ~ during the completion
-  process).
-
-* pdksh 5.2.13, (reported by Martin Dalecki): shell dumps core when set -x
-  is used on some scripts
-  [awaiting more info...]
-
-* pdksh 5.2.13, (reported by Arthor Pool): interactive shells can't be
-  interrupted when processing ${foo#bar} expressions.
-  [same goes for globbing - fixing this means checking for interrupts in
-  the `tight' loops - could slow things down quite a bit]
-
---------------------- put fixed problems below this line ---------------------
-
-x pdksh 5.0.3, NetBSD 0.9a (reported by Simon J. Gerraty): pipelines
-  occasionally hang.
-  [from Mail.1:71]:
-    Yes, I just built 5.0.3 on zen (NetBSD) and the menu stuff worked fine.
-    However I've just done:
-
-    sjg:910$ diff -cb /etc/profile profile | more
-
-    And it has been sitting there ever since.
-  [... gdb output indicating process groups set up ok - presumed problem is
-   with tty process group]
-  [Fixed in 5.0.4 - do tcsetpgrp() in both parent and child for first process]
-
-x pdksh 5.0.2, ISC unix 3.01 (reported by Sean Hogan): set +o monitor (in
-  interactive shell?) closes tty
-  [from Mail.1:64]:
-    I'm having two problems with the job control code, which I believe might
-    be related.  The first one is that "set +o monitor" closes the tty,
-    which causes the shell to exit since its input is gone.  According to
-    the code, that would imply that FTALKING has mysteriously been turned
-    off (jobs.c:343).  But my understanding of the code is that FTALKING
-    would only be clear for background processes, and set would be done by
-    the shell.  Do you have any insights here?  It's not a big deal of course;
-    I don't need to turn off monitor anyway.
-  [fixed in 5.0.5 - problem was tty process group was being restored so
-   shell could no longer read from tty]
-
-x pdksh 5.0.4, - (reported by Simon J. Gerraty and Sean Hogan):
-  test "" -a x would fail.
-  [fixed in 5.0.5 - t_wp being unnecessarily decremented in primary()]
-
-x pdksh 5.0.4, -: test -p foo would always fail.
-  [fixed in 5.0.5 - spell S_ISFIFO correctly]
-
-x pdksh 5.0.4, -: test ! ! foo would generate error (unexpected !)
-  [fixed in 5.0.5 - nexpr() always calls nexpr(), changes to posix code]
-
-x pdksh 5.0.4, -: set -i would generate an internal error.
-  [fixed in 5.0.5 - use OF_SET in creating set_opts]
-
-x pdksh 5.0.4, -: let 0>22 would evaluate to true (and 0<22 false)
-  [fixed in 5.0.5 - reversed order of O_LT and O_GT in enum]
-
-x pdksh 5.0.4, - (reported by Sean Hogan): echo does not process escape
-  characters (ie, echo "foo\c" doesn't to the sysV thing)
-  [see Mail.1:98]
-  [fixed in 5.0.5 - echo now behaves like sysv echo]
-
-x pdksh 5.0.4, - (reported by Sean Hogan): tty process groups not restored
-  properly (vi, :sh, exit causes vi to received SIGTTOU).
-  [see Mail.1:98]
-  [fixed in 5.0.5 - restore tty process group in j_exit]
-
-x pdksh 5.0.4, - (reported by Sean Hogan): the exit command does not do the
-  stopped jobs check.
-  [see Mail.1:94,95,98]
-  [fixed in 5.0.5 - added LSHELL, hack c_exitreturn to use it]
-
-x pdksh 5.0.3, ISC unix 3.01 (reported by Sean Hogan): if notify is set,
-  running cat & produces "[1] + Stopped (tty input) cat", but jobs, fg,
-  etc. don't know about the job.
-  [from Mail.1:76]
-    I get [1] + Stopped (tty input)  cat.  Interestingly, "jobs" reports
-    nothing, and "fg" doesn't see it either.  But it's definitely there in
-    the ps output.  It only responds to kill -9, nothing else.  I guess this
-    is a side track?
-  [see also Mail.1:97,Mail.2:2,3]
-  [fixed in 5.0.6 - don't remove stopped jobs in the notify code of check_job()]
-
-x pdksh 5.0.5, - (reported by Sean Hogan): repeated history commands were being
-  echoed after the command was executed.
-  [see Mail.2:5,6]
-  [fixed in 5.0.6 - call shf_flush() in case SHIST: of yylex()]
-
-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): scripts occasionally get
-  stopped with SIGTTIN
-  [from Mail.1:68]:
-    I noticed another small problem today, which is that occasionally
-    (on an HP 9000/715, HP-UX 9.01, cc from the ANSI C developer set)
-    a background process which is definitely not reading from its input
-    stops with SIGTTIN.  I first noticed this with a nohup'ed process, but
-    it periodically happens without as well.  The process is a perl script,
-    if that makes any difference.  Have you seen this on your HP(s)?
-  [hasn't been seen in 5.0.3: Mail.1:73,76]
-  [not a shell bug, see Mail.2:14,15]
-
-x pdksh 5.0.6, - (reported by Gordan Larson, Ed Ferguson): shell does not
-  compile when VI isn't defined.
-  [see Mail.2:22,40]
-  [fixed in 5.0.7 - fixed up lex.c]
-
-x pdksh 5.0.6, - (reported by Gordan Larson): ksh.1 font typo.
-  [see Mail.2:23]
-  [fixed in 5.0.7]
-
-x pdksh 5.0.6, FreeBSd 1.1.5 (reported by Thomas Gellekum): CLK_TCK is defined
-  to wrong value on FreeBSD; no depend target in Makefile; update /etc/shells
-  in install target.
-  [see Mail.2:28]
-  [fixed in 5.0.7 - include <limits.h> in sh.h to get the right value; added
-   depend target; print warning if ksh not in /etc/shells]
-
-x pdksh 5.0.6, - (reported by Michael Haardt): shell does not compile if JOBS
-  not defined.
-  [see Mail.2:32]
-  [fixed in 5.0.7 - added ifdefs to jobs.c(check_job)]
-
-x pdksh 5.0.6, - (reported by Nick Holloway): exit status of command
-  substitution is lost (known problem).
-  [from Mail.2:33]:
-    This is a variation on a theme of bug number 10 (and is one reason why
-    currently ksh can not be used for Linux's MAKEDEV).
-
-    The exit status from command substitution is not available when used with
-    variable assignment.
-
-	    x=`false` && echo "Non-zero exit status lost".
-  [fixed in 5.0.7 - instead of faking :, set rv to subst_exstat]
-
-x pdksh 5.0.7 - (reported by Sean Hogan): CMASK redefined in emacs.c
-  [see Mail.2:44]
-  [fixed in 5.0.8 changed CMASK to CHARMASK]
-
-x pdksh 5.0.7 - (reported by Sean Hogan): "r" (fc -e -) doesn't work.
-  [see Mail.2:45]
-  [fixed in 5.0.8 - increment wp, change strcmp() test]
-
-x pdksh 5.0.7 - (reported by Thomas Gellekum): make install typeo.
-  [see Mail.2:46]
-  [fixed in 5.0.8 - added missing $]
-
-x pdksh 5.0.8 - (reported by Sean Hogan): "FOO=bar exec blah" does not
-  put FOO in environment.
-  [see Mail.2:50]
-  [fixed in 5.0.9 - re-arranged exec/command/builtin code in comexec()]
-
-x pdksh 5.0.8, QNX 4.2 (reported by Brian Campbell): "exec > /dev/null"
-  generates an error.
-  [see Mail.2:51]
-  [see Mail.2.58 - caused by ambitious compiler using same label for c_exec()
-   and c_builtin()]
-  [fixed in 5.0.9 - c_exec() no longer an empty function.]
-
-x pdksh 5.0.8, - (reported by Brian Campbell): "echo a{b," prints a "Missing }"
-  error - at&t ksh does not.  at&t ksh always has brace-expansion on (unless
-  set -o nogolob).
-  [see Mail.2:51]
-  [fixed in 5.0.9 - brace expansion now compatible with at&t ksh]
-
-x pdksh 5.0.8, - (reported by Sean Hogan): ulimit output garbled; syntax error
-  in c_ulimit.c; no configure check for HAVE_SETRLIMIT.
-  [see Mail.2:64]
-  [fixed in 5.0.9 - use shprintf instead of shellf to print values; add 
-   setrlimit() check to configure]
-
-x pdksh 5.0.7, - (reported by Jan Djarv): `echo > /foo/bar' causes a script to
-  exit - POSIX says it shouldn't.
-  [see Mail.2:60]
-  [fixed in 5.0.9 - iosetup returns error code, error messages cleaned up, etc]
-
-x pdksh 5.0.8, - : `more /etc/passwd &' followed by fg messes up tty settings.
-  [fixed in 5.0.9 - only save new tty settings if job originally started in fg]
-
-x pdksh 5.0.9, - (reported by Andrew Moore): a blank line causes $? to be
-  set to zero, newline after a here-document marker isn't read.
-  [see Mail.3:5,6]
-  [fixed in 5.0.10 - don't execute null trees, read the newline]
-
-x pdksh 5.0.9, - (reported by Michael Sullivan): mail checking reports you
-  have mail, when there is only old mail.
-  [fixed in 5.0.10 - use atime/mtime instead of size]
-
-x pdksh 5.0.9, - (reported by Chris Oates): if RANDOM is in ksh's environ
-  when it starts, the shell dumps core.
-  [see Mail.3:7,8]
-  [fixed in 5.0.10 - var.c(typeset): free t->val.s instead of
-   t->val.s + t->type]
-
-x pdksh 5.0.9, - (reported by Seah Hogan): ISC 3.01's make is confused by
-  a backslash followed by a blank line.
-  [see Mail.3:9,13]
-  [fixed in 5.0.10 - changed make depend target to change blank lines to sh.h]
-
-x pdksh 5.0.9, - (reported by Andrew Moore): commands without a newline cause
-  syntax errors - sh/ksh execute the commands.
-  [see Mail.3:15]
-  [fixed in 5.0.10 - have yyparse() accept newline and EOF]
-
-x pdksh 5.0.9, - (reported by Andrew Moore): empty arithmetic expressions not
-  accepted.
-  [see Mail.3:15,17]
-  [fixed in 5.0.10 - v_evaluate(): if first token is END, changed to literal 0]
-
-x pdksh 5.0.9, - (reported by Andrew Moore): nulls in input are not ignored.
-  [see Mail.3:15]
-  [fixed in 5.0.10 - added strip_nuls() function and calls to it]
-
-x pdksh 5.0.9, - (reported by Andrew Moore): \241 (M-!) not passed through
-  command substitutions.
-  [see Mail.3:15]
-  [fixed in 5.0.10 - evaluate(): cast c to a char before comparing to MAGIC]
-
-x pdksh 5.0.9, - (reported by Andrew Moore): newlines after here-documents
-  are read twice; shell reports an error if newline is missing.
-  [see Mail.3:25]
-  [fixed in 5.0.10 - fixed up readhere()]
-
-x pdksh 5.0.9, - (reported with fix by Mike Jetzer): 'r r' repeats the r
-  command forever.
-  [see Mail.3:38]
-  [fixed in 5.0.10 - start the search from the previous command]
-
-x pdksh 5.0.9, - (reported by Mike Jetzer): edit of multi-line commands
-  does not result in single history entry.
-  [see Mail.3:38]
-  [fixed in 5.0.10 - use hist_append() to add second+ lines]
-
-x pdksh 5.0.9, - (reported by Dale DePriest): ksh_times.h uses BROKEN_TIMES
-  [see Mail.3:43]
-  [fixed in 5.0.10 - changed ksh_times.h]
-
-x pdksh 5.0.9, - (reported by J. T. Conklin): using [ instead of test is slow.
-  [see Mail.3:46]
-  [fixed in 5.0.10 - put in kludgy check for [ in eval.c(glob)]
-
-x pdksh 5.0.9, - (reported by Michael Haardt): signals do not interrupt
-  read commands.
-  [see Mail.3:20]
-  [fixed in 5.0.10 - changed c_read() to check for fatal signals after EINTR]
-
-x pdksh 5.0.10, BSDI (reported by David Tamkin): use of _POSIX_VDISABLE in
-  tty.h causes compiler error.
-  [see Mail.3:67]
-  [fixed in 5.0.10.1 - new variable vdisable_c set/used in edit.c]
-
-x pdksh 5.0.8, - (reported by Donald Craig): on systems with both union wait
-  and waitpid(), waitpid() is passed a union wait pointer instead of an int
-  pointer.
-  [see Mail.2:54]
-  [fixed in 5.1 - added ksh_waitpid() define; cast status arg as needed.]
-
-x pdksh 5.0.10, - (reported by David Tamkin): space in vi command mode does
-  nothing.
-  [see Mail.3:76]
-  [fixed in 5.1 - vi.c(classify[]) table got changed by accident.]
-
-x pdksh 5.0.10, - (reported by Danial Quinlan): forward-word and
-  delete-word-forward functions in emacs don't go to the right place.
-  [see Mail.3:79]
-  [Fixed in 5.1 - changed order of loops in emacs.c(x_fword())]
-
-x pdksh 5.0.10, - (reported by David Tamkin): eof in multiline command
-  causes shell to exit, even if ignoreeof is set.
-  [see Mail.3:76]
-  [Fixed in 5.1 - reset eof after longjmp() in main.c(shell)]
-
-x pdksh 5.0.9, Ultrix 4.2 (reported by Matthew Nethook): type-ahead while
-  shell is waiting for a command to finish is temporarily lost until a
-  program that reads from stdin or goes a stty/gtty is run.
-  [see Mail.3:61,62]
-  [Fixed in 5.1 - changed aclocal.m4 to not define HAVE_TERMIOS_H on ultrix]
-
-x pdksh 5.0.10, - (reported by David Tamkin): if INT is trapped, ^C in
-  vi/emacs won't flush buffer/re-issue new prompt.
-  [see Mail.3:5,76]
-  [Fixed in 5.1 - use unwind() in vi/emacs to get back to shell()]
-
-x pdksh 5.0.10, - (reported by Dale DePriest): in emacs mode, file completions
-  resulting in long names (>256) cause core dumps
-  [see Mail.3:72]
-  [Fixed in 5.1 - use dynamically sized buffers in emacs code]
-
-x pdksh 5.0.10, - (reported by Dale DePriest): in emacs mode, command
-  completions (^[=) resulting in multiple hits caused internal memory error.
-  [see Mail.4:8]
-  [Fixed in 5.1 - don't call list_stash() twice in compl_command]
-
-x pdksh 5.0.10, - (reported by Dave Hatton): autoloading functions fail
-  on the first attempt, then work.
-  [see Mail.4:10]
-  [Fixed in 5.1 - in findcom(), check for include() returning non-0 (was 0)]
-
-x pdksh 5.0.10, - (reported by Art Pina via Dale DePriest): when SECONDS
-  parameter is assigned, it always acts as if 0 were assigned.
-  [see Mail.4:12]
-  [Fixed in 5.1 - set internal seconds variable to time - assigned value]
-
-x pdksh 5.1.0 - (reported by Larry Bouzane): for/select loops don't allow
-  {..} to be used instead of do...done.
-  [see Mail.4:16]
-  [Fixed in 5.1.1 - changed syn.c(dogroup) to allow {/} instead of do/done]
-
-x pdksh 5.1.0 - (reported by Andrew Moore and Larry Bouzane): a command ending
-  in ; or & that is not followed by a newline causes a syntax error.
-  [see Mail.4:126,128]
-  [Fixed in 5.1.1 - don't call syntaxerr() in get_command() if EOF is read]
-
-x pdksh 5.1.0, - (reported by Simon J. Gerraty): ksh died reading history
-  file (complex history, in hist_skip_backup()).
-  [see Mail.4:24]
-  [Fixed in 5.1.1 - hist_skip_back(): don't start past the end of the buffer]
-
-x pdksh 5.1.0 BSDI 1.1 (reported by Karl Denninger): after receipt of SIGHUP,
-  shell waits for foreground process to complete.
-  [see Mail.4:50,57]
-  [Fixed in 5.1.1 - added fatal_trap flag, check in jobs.c(j_waitj)]
-
-x pdksh 5.1.0 - (reported by Bob Manson): a leading non-white-space IFS
-  character does cause a field to be delimited.
-  [see Mail.4:68]
-  [Fixed in 5.1.2 - changed expand() to do the right thing.]
-
-x pdksh 5.1.2, -: ^c during $ENV or .profile kills shell; should just go
-  to prompt.
-  [see Mail.5:14]
-  [fixed in 5.2.4 - added intr_ok flag to main.c(include)]
-
-x pdksh 5.1.2, - (reported by Dan Quinlan): when shell prints out
-  execution trees (typeset -f), if botches elif statements.
-  [see Mail.5:17]
-  [fixed in 5.1.3 - changed tree.c(ptree) to deal with elif.]
-
-x pdksh 5.1.2, - (reported by Dale DePriest): fc -l -- -40 fails if there
-  are fewer than 40 commands.
-  [see Mail.5:19]
-  [fixed in 5.1.3 - changed history.c(histget) to allow out of range numbers]
-
-x pdksh 5.1.2, - (reported by Art Mills): file completion in command mode
-  doesn't work on a single character.
-  [see Mail.5:13]
-  [fixed in 5.1.3 - in vi.c(vi_cmd) call complete_word() with 1 not 0]
-
-x pdksh 5.1.2, - (reported by Dan Quinlan): an error in a let statement
-  causes shell to exit function/script.  at&t ksh just prints error and
-  returns from let.
-  [see Mail.5:17]
-  [fixed in 5.2.3 - added error_ok arg to evaluate() and v_evaluate()]
-
-x pdksh 5.1.2, - (reported by Art Mills): if markdirs option is set, file
-  completion in vi adds two slashes to directories.
-  [see Mail.5:35]
-  [fixed in 5.1.3 - vi.c(complete_word), don't add / if file ends in one]
-
-x pdksh 5.1.2, - (reported by Dale DePriest): history read from history file
-  have negative numbers and can't be accessed (fc thinks neg numbers are
-  relative).
-  [see Mail.5:39]
-  [fixed in 5.1.3 - EASY_HISTORY/hist_init: increment line for each line]
-
-x pdksh 5.1.2, - (reported by David Tamkin): FPATH isn't searched if PATH
-  search can't find command (undocumented at&t ksh feature).
-  [see Mail.5:45]
-  [fixed in 5.1.3 - exec.c(findcom) search FPATH if PATH search fails]
-
-x pdksh 5.1.2, - (reported by Dan Quinlan): output typeset -f isn't
-  very pretty (no indenting done).
-  [see Mail.5:17]
-  [fixed in 5.1.3 - indenting added to ptree routines]
-
-x pdksh 5.0.9, ISC 3.2 (reported by cobra at guarany.cpd.unb.br): Running the
-  following script with pdksh crashes the machine:
-    cat > /tmp/foobar
-  The same command in an interactive pdksh does not cause a crash.
-  [see Mail.3:21,Mail.5:62]
-  [Fixed by Interactive - it is caused by an OS bug for which there is a patch]
-
-x pdksh 5.1.3, linux - (reported by Dan Quinlan): doesn't compile under new
-  linux due to declaration conflict between basename() in unistd.h and
-  pdksh'd basename.
-  [see Mail.5:90]
-  [fixed in 5.2.0 - changed basename() to arrayname()]
-
-x pdksh 5.1.3, - (reported by William Hudacek): very long prompts cause
-  vi command line editor grief.
-  [see Mail.6:2]
-  [fixed in 5.2.0 - initial part of prompt is stripped if its too long]
-
-x pdksh 5.1.3, - (reported by Roberto Zacheo): when set -u, variable trimming
-  with always causes an error.
-  [see Mail.6:21]
-  [fixed in 5.2.0 - fixed varsub() to test if variable is null]
-
-x pdksh 5.1.3, - (reported by David Tamkin): when a fucntion is autoloaded,
-  ksh complains the definition file didn't define the function, even if it did.
-  [see Mail.6:52]
-  [fixed in 5.2.0 - exec.c(comexec): when checking if defined, use cp,
-
-x pdksh 5.1.3, ICS unix 3.2 (reported by Robert Clark): auto configuration
-  test for memmove doesn't work
-  [see Mail.6:65]
-  [fixed in 5.2.0 - special cases added for memmove, bcopy, memset]
-
-x pdksh 5.1.3, Unixware (Intel-SVR4.2) (reported by Thanh Ma): auto
-  configuration test for memset doesn't work; same for rlimit type.
-  [see Mail.6:67]
-  [fixed in 5.2.0 - special cases added for memmove, bcopy, memset; rlim_t
-   configuration stuff re-arranged]
-
-x pdksh 5.1.3, - (reported by Mike Jetzer + fix): . in vi doesn't work
-  after history motion or after one command is completed and another is being
-  edited.
-  [see Mail.6:85]
-  [fixed in 5.2.0 - fix up classify table, special case for empty initial
-   insert]
-
-x pdksh 5.1.3, - Janjaap van Velthooven: ^v (version) missing in vi mode.
-  [see Mail.6:98]
-  [fixed in 5.2.0 - added]
-
-x pdksh 5.1.3, - : y% on or before right bracket/paren/brace doesn't yank the
-  brackets - just what is in the brackets...
-  [fixed in 5.2.0 - changes to vi.c(domove,vi_cmd)]
-
-x pdksh 5.1.3, - (reported by Rob Mayoff): [[ ]] command doesn't do lazy
-  evaluation.
-  [see Mail.7:2]
-  [fixed in 5.2.1 - test routines re-arranged to deal with this]
-
-x pdksh 5.1.3, - (reported by Will Renkel): "r | more" doesn't work (nothing
-  is sent to more).
-  [see Mail.7:13]
-  [fixed in 5.2.0 - history commands now done in c_fc, not pushed onto input
-   stack]
-
-x pdksh 5.1.3, - (reported by Rod Byrne, John Rochester): if a program leaves
-  the non-blocking (O_NONBLOCK) flag set after it exists, the shell
-  exits (multiple eofs).
-  [see Mail.7:15,16,51]
-  [fixed in 5.2.0: O_NONBLOCK is reset if read fails with EAGAIN,EWOULDBLOCK]
-
-x pdksh 5.1.3, - (reported by Dale DePriest + fix): emacs: can't delete chars
-  from pattern in incremental search mode.
-  [see Mail.7:17]
-  [fixed in 5.2.0 - handle it]
-
-x pdksh 5.1.3, Linux 1.2.2 (reported by Fritz Heinrichmeyer + fix): siglist.sh
-  doesn't work due to bug in bash 1.4.3 (trap is called incorrectly in
-  subshell causing temp file to be removed prematurely).
-  [see Mail.7:21]
-  [fixed in 5.2.0 - clear all traps in subshell so file isn't removed]
-
-x pdksh 5.1.3, - (reported by Dale DePriest + fix): emacs: can't prefix
-  commands with more than single digit; many commands don't use nnumber
-  prefix.
-  [see Mail.7:26,40]
-  [fixed in 5.2.0 - x_set_arg reads sequence of numbers, other commands
-  changed to use x_arg]
-
-x pdksh 5.1.3, - (reported by Dale DePriest): fc command line parsing
-  (and its interaction with history alias) doesn't act like at&t ksh:
-  history -40 gives bad option 4 error.
-  [see Mail.7:41,49]
-  [fixed in 5.2.1 - kludge parsing of -40 (numbers are option letters)]
-
-x pdksh 5.1.3, - (reported by Dale DePriest): if PS1 contains paramaters that
-  get expanded, and if those parameters contain any ! characters, the !'s get
-  changed to history numbers.
-  [see Mail.7:44]
-  [fixed in 5.2.0 - substitution done after ! and !! substitution]
-
-x pdksh 5.1.3, - (reported by Steve Wallis): set -a (set -o allexport) has
-  no effect.
-  [see Mail.7:47]
-  [fixed in 5.2.0 - changes to c_read, c_getopts, and comexec]
-
-x pdksh 5.1.3, - (reported by Alexander S. Jones): (sleep 10000&) waits for
-  the sleep to complete.
-  [see Mail.7:54]
-  [fixed in 5.2.0 - execute() case TASYNC clears EXEC flag in call to execute]
-
-x pdksh 5.1.3, - (reported by Will Renkel): positional parameters can't be
-  accessed within temporary variable assignments (eg, "FOO=$1 blah" doesn't
-  set FOO to $1.
-  [see Mail.7:57]
-  [fixed in 5.2.0 - var.c(newblock) - copy argc/argv from previous environment]
-
-x pdksh 5.1.3, SCO unix ? (reported by Sean Hogan): job control stuff doesn't
-  work as sco doesn't do job control operations on /dev/tty.
-  [see Mail.7:30,43,69,70,74]
-  [fixed in 5.2.0 - don't try opening /dev/tty if on SCO]
-
-x pdksh 5.1.3, - (reported with fix by Mike Jetzer): vi globing tacks
-  * at the end of files even if there are globing chars in last component
-  of filename (at&t ksh does not).
-  [see Mail.7:71]
-  [fixed in 5.2.0 - don't append * if there are unescaped globing chars]
-
-x pdksh 5.1.3, - (reported with fix by Gabor Zahemszky): typoes in acconfig.h,
-  sh.h uses SVR3_PGRP insteda of SYSV_PGRP.
-  [see Mail.7:87]
-  [fixed in 5.2.0]
-
-x pdksh 5.1.3, - (reported by Gabor Zahemszky): emacs doesn't have ^[^].
-  [see Mail.7:87]
-  [fixed in 5.2.0 - added search-char-backward]
-
-x pdksh 5.2.0, - (reported by David Tamkin): pwd -P doesn't strip .. and .
-  properly.
-  [see Mail.7:98]
-  [fixed in 5.2.0 - include ksh_stat.h in c_ksh.c]
-
-x pdksh 5.2.0, - (reported by Dale DePriest): unistd.h config test
-  doesn't include sys/types before dirent.h.
-  [see Mail.8:2]
-  [fixed in 5.2.0]
-
-x pdksh 5.2.0, - (reported by Robert Gallant): emacs file/command completion
-  code can clobber memory.
-  [see Mail.8:11]
-  [fixed in 5.2.1 - wrong variable being checked in buffer growing in
-   emacs.c(compl_file,compl_command)]
-
-x pdksh 5.2.0, - (reported by David Tamkin): when CDPATH set and cd'ing to a
-  directory that doesn't exist, the error message contains the last element
-  of the CDPATH.
-  [see Mail.8:8]
-  [fixed in 5.2.0 - fixed error message]
-
-x pdksh 5.2.0, - (reported by David Tamkin): if PS1 has an error in it
-  (eg, parameter expansion error), the shell loops forever printing
-  the error.
-  [see Mail.8:32]
-  [fixed in 5.2.3 - create error handling environment while expanding PS1]
-
-x pdksh 5.2.0, Coherent machines (reported by Gabor Zahemszky): insert after
-  movement in emacs mode replaces all chars with first char on line.
-  System's bcopy doesn't handle overlapping src/dst.
-  [see Mail.8:38,43]
-  [fixed in 5.2.1 - check for broken memmove/bcopy in aclocal.m4]
-
-x pdksh 5.2.0, - (reported by Gabor Zahemszky): ^[= in vi prints empty
-  strings for directory matches if markdirs is set.
-  [see Mail.8:48]
-  [fixed in 5.2.1 - skip trailing /'s before looking for last /]
-
-x pdksh 5.2.0, - (reported by Gabor Zahemszky): <ESC>^H bound to del-back-char
-  not del-back-word
-  [see Mail.8:50-52]
-  [fixed in 5.2.1 - fixed x_emacs_keys]
-
-x pdksh 5.2.1, - (reported by David Tamkin): compile fails due to lack
-  of c_test.h
-  [see Mail.8:58]
-  [fixed in 5.2.2 - fixed put c_test.h in distribution]
-
-x pdksh 5.2.2, - (reported by Simon J. Gerraty): hist_source not being
-  initialized in complex history.
-  [see Mail.8:64]
-  [fixed in 5.2.3 - set it in second hist_init()]
-
-x pdksh 5.2.2, - (reported by Gabor Zahemszky): set -A does not reset
-  the array contents.
-  [see Mail.8:65]
-  [fixed in 5.2.3 - changed var.c(unset) to unset whole array if appropriate]
-
-x pdksh 5.2.2, - (reported by Gabor Zahemszky): getopts stops after an error;
-  at&t ksh carries on with next option.
-  [see Mail.8:65]
-  [fixed in 5.2.3 - remove GI_DONE flag from ksh_getopt()]
-
-x pdksh 5.2.2, - (reported by Gabor Zahemszky): getopts prints shell name
-  twice in error messages.
-  [see Mail.8:65]
-  [fixed in 5.2.3 - added GI_NONAME flag]
-
-x pdksh 5.2.2, - (reported by Gabor Zahemszky): pdksh's test doesn't know about
-  /dev/fd/n.
-  [see Mail.8:65]
-  [fixed in 5.2.3 - added test_stat() and test_eaccess()]
-
-x pdksh 5.2.2, - (reported by Thomas Gellekum): config test for memmove/bcopy
-  missing semi-colon
-  [see Mail.8:67]
-  [fixed in 5.2.3]
-
-x pdksh 5.2.2, - (reported by Donald Craig): fc string doesn't find string
-  if it is the most recent command.
-  [see Mail.8:76]
-  [fixed in 5.2.3 - fixed off by one error in history.c(hist_get)]
-
-x pdksh 5.2.2, - (reported by Gabor Zahemszky): pdksh doesn't do the
-  "You have running jobs" when user attempts to log out.
-  [see Mail.8:74]
-  [fixed in 5.2.3 - added set -o nohup option with supporting code]
-
-x pdksh 5.2.2, - (reported by Gabor Zahemszky): configure test for
-  broken memmove/bcopy doesn't work.
-  [see Mail.8:93]
-  [fixed in 5.2.3 - fixed test to copy overlapping buffers]
-
-x pdksh 5.1.3, - (reported by <wendt at sv5.mch.sni.de>): doesn't compile on
-  solaris 5.x with COMPLEX_HISTORY defined.
-  [see Mail.8:98]
-  [fixed in 5.2.3 - undef COMPLEX_HISTORY if flock not available]
-
-x pdksh 5.2.2, - (reported by Gabor Zahemszky): tilde expansion not preformed
-  in word part of ${foo[-+=?} substitution.
-  [see Mail.9:7]
-  [fixed in 5.2.3 - allow ~foo to end in a close brace]
-
-x pdksh 5.2.2, - (reported by Gabor Zahemszky): "fc 30" edits from 30 to
-  most recent history (should be just 30).
-  [see Mail.9:7]
-  [fixed in 5.2.3 - if !-l and no last given, use first]
-
-x pdksh 5.2.2, - (reported by Gabor Zahemszky): [many problems with man page]
-  [see Mail.9:12]
-  [fixed in 5.2.3 - fixed problems]
-
-x pdksh 5.2.2, - (reported by Gabor Zahemszky): #else followed by non-comment
-  in sigact.c.
-  [see Mail.9:13]
-  [fixed in 5.2.3 - turn it into a comment]
-
-x pdksh 5.2.2, - (reported with fix by Gabor Zahemszky): two argument form of
-  cd doesn't work.
-  [see Mail.9:14]
-  [fixed in 5.2.3 - in c_cd(), use current_wd not path]
-
-x pdksh 5.2.2, - (reported with fix by Gabor Zahemszky): command -V doesn't
-  report reserved words.
-  [see Mail.9:30]
-  [fixed in 5.2.3 - in c_whence(), look for reserved words if vflag set]
-
-x pdksh 5.2.3, - (reported by Dale DePriest): at&t's tbl wants space
-  between font specification and end of table descrption (ie, fB . not
-  fB.).
-  [see Mail.9:41]
-  [fixed in 5.2.4 - put spaces in]
-
-x pdksh 5.2.3, - (reported by David Tamkin & Claus L{gel Rasmussen): PS1
-  isn't imported from environment anymore.
-  [see Mail.9:43,76]
-  [fixed in 5.2.4 - main: don't set PS1 if it is already set]
-
-x pdksh 5.2.3, - (reported by Gary Rafe): If PS1 contains newlines, vi
-  editing mode dones't redraw lines properly.
-  [see Mail.9:63]
-  [fixed in 5.2.4 - added prompt_skip stuff to vi/emacs]
-
-x pdksh 5.2.3, - (reported & fixed by Mike Jetzer): cd: error message if
-  directory didn't exist was wrong.
-  [see Mail.9:66]
-  [fixed in 5.2.4 - print correct string in error message]
-
-x pdksh 5.2.3, - (reported & fixed by Mike Jetzer): vi: <ESC>* shouldn't append
-  a * if word contains a $.
-  [see Mail.9:66]
-  [fixed in 5.2.4 - vi.c(glob_word): check for $ in word, check for null
-   expansion]
-
-x pdksh 5.2.3, - (reported & fixed by Mike Jetzer): vi: <ESC>= doesn't
-  list expansions in column form.
-  [see Mail.9:66]
-  [fixed in 5.2.4 - use pr_menu to print things nicely]
-
-x pdksh 5.2.3, - (reported Larry Bouzane): should be a way of installing
-  binary/man page as pdksh instead of ksh.
-  [see Mail.9:100]
-  [fixed in 5.2.4 - use the --enable-shell=pdksh option to configure]
-
-x pdksh 5.2.3, - (reported by Gabor Zahemszky): [many problems with man
-  page]
-  [see Mail.10:20]
-  [fixed in 5.2.4 - fixed problems]
-
-x pdksh 5.2.3, - (reported by Gabor Zahemszky): exec 1<&9 reports
-  error with ">&9" in it.
-  [see Mail.10:20]
-  [fixed in 5.2.4 - changed iosetup()]
-
-x pdksh 5.2.3, - (reported by Gabor Zahemszky): man page doesn't document
-  /dev/fd/N
-  [see Mail.10:20]
-  [fixed in 5.2.4 - updated manual]
-
-x pdksh 5.2.3, - (reported by Ted Coady): [[ foo/bar = foo* ]]
-  fails; should succeed.
-  [see Mail.10:32]
-  [fixed in 5.2.4 - fixed problem in exec.c(dbteste_getopnd)]
-
-x pdksh 5.2.3, - (reported by Ruei-wun Tu): make on NeXT/NeXTSTEP 3.3
-  doesn't understand .PRECIOUS target and so does nothing.
-  [see Mail.10:43]
-  [fixed in 5.2.4 - moved .PRECIOUS after all in Makefile.in]
-
-x pdksh 5.2.3, - (reported & fixed by Paul Borman): shell doesn't kill
-  foreground process when SIGHUP received; Also, CONT sent before HUP.
-  [see Mail.10:44]
-  [fixed in 5.2.4 - j_exit now sends HUP to foreground process]
-
-x pdksh 5.2.3, AIX 3.2.5 (reported by Ian Portsmouth): C compiler compains
-  about sigtraps[] being re-declared in trap.c.
-  [see Mail.10:73]
-  [fixed in 5.2.4 - use cpp define to avoid bogus re-declaration error]
-
-x pdksh 5.2.3, - (reported by Michael Haardt): ENV should not be
-  included if shell is compiled as sh and posix option not set.
-  [see Mail.10:83]
-  [fixed in 5.2.4 - only include ENV if POSIX, if compiled as sh]
-
-x pdksh 5.2.3, - (reported & fixed by DaviD W. Sanderson): case statements
-  don't allow {/} in place of IN/ESAC.
-  [see Mail.10:77,78]
-  [fixed in 5.2.4 - allow {/} in case statements]
-
-x pdksh 5.2.3, - (reported by Larry Daffner): $? is incorrectly zero'd
-  at start of traps.
-  [see Mail.11:9]
-  [fixed in 5.2.4 - don't clear exstat in main.c(shell)]
-
-x pdksh 5.2.3, - (reported by Frank "Crash" Edwards): configure on linux XXX
-  doesn't detect the presence of lstat().
-  [see Mail.11:36]
-  [fixed in 5.2.4 - change configure to include <sys/stat.h> in lstat() test]
-
-x pdksh 5.2.3, - (reported by Gabor Zahemszky): typeset -f dumps core
-  in the after using autoload functions.
-  [see Mail.11:74?]
-  [fixed in 5.2.4 - c_typeset no longer traverses the array link for functions]
-
-x pdksh 5.2.3, - (reported by Gabor Zahemszky): typeset -f does not report
-  undefined autoload functions
-  [see Mail.11:74?]
-  [fixed in 5.2.4 - c_typeset: don't ignore unset functions]
-
-x pdksh 5.2.3, - (reported by Dale DePriest): alias -t -r does not
-  reset aliases.
-  [see Mail.11:99]
-  [fixed in 5.2.4 - c_alias: call ksh_getopt_reset() before calling c_unalias]
-
-x pdksh 5.2.3, - (reported & fixed by Jason Tyler): 'echo abc^Jfc -e - a=b e'
-  echos b, not bbc.
-  [see Mail.11:100?]
-  [fixed in 5.2.4 - hist_replace: use s, not last]
-
-x pdksh 5.2.3, - (reported by Jason Tyler): 'fc -e -' when there is
-  no history causes infinite loop.
-  [see Mail.11:100?]
-  [fixed in 5.2.4 - histbackup: allow histptr to go below history]
-
-x pdksh 5.2.4, - (reported by David Tamkin): jmp_buf is used instead of
-  sigjmp_buf.
-  [see Mail.XXX:XXX]
-  [fixed in 5.2.5 - added ksh_jmp_buf and defined appropriately]
-
-x pdksh 5.2.4, - (reported by Stephen Coffin): /<RETURN> in vi mode does not
-  repeat last search.
-  [see Mail.XXX:XXX]
-  [fixed in 5.2.5 - vi.c(vi_hook) - make it repeat last search]
-
-x pdksh 5.2.4, - (reported by Gabor Zahemszky): functions containing select
-  commands aren't printed correctly by typeset.
-  [see Mail.XXX:XXX]
-  [fixed in 5.2.5 - tree.c(ptree) - add case for TSELECT]
-
-x pdksh 5.2.4, - (reported & fixed by Stefan Dalibor): COLUMNS isn't set on
-  shell start up (and window size is ignored) 'cause tty_fd isn't valid when
-  x_init() is called.
-  [see Mail.XXX:XXX]
-  [fixed in 5.2.5 - call x_init() after j_init() is called]
-
-x pdksh 5.2.4, - (reported by Will Renkel): "echo -" just prints a blank
-  line - should print the minus.
-  [see Mail.XXX:XXX]
-  [fixed in 5.2.5 - c_ksh.c(c_print): don't do argument parsing on lone -]
-
-x pdksh 5.1.3, - (reported by Gabor Zahemszky): emacs doesn't have ^[*.
-  [see Mail.7:87]
-  [fixed in 5.2.5]
-
-x pdksh 5.2.3, - (reported by Mike Jetzer): in vi, <ESC>= doesn't append
-  a / after directories.
-  [see Mail.9:66]
-  [fixed in 5.2.5]
-
-x pdksh 5.2.0, - (reported by Gabor Zahemszky): can set readonly variables
-  via command assignments (eg, "readonly x=y; x=z /bin/echo hi" should
-  fail and doesn't).
-  [see Mail.8:50,65]
-  [fixed in 5.2.5 - LOCAL_COPY flag passed from comexec() down to local()]
-
-x pdksh 5.2.4, - (reported by Tom Karches): history: "r old=new", with
-  no commands prefix given, prints "fc: too mnay arguments" - it should
-  do the subst on the previous command.
-  [see Mail.XXX:XXX]
-  [fixed in 5.2.5]
-
-x pdksh 5.2.3, - (reported by Vigen Pogosyan): assignments in $(( ... ))
-  remember the base that was assigned in pdksh - does not in at&t ksh.
-  [see Mail.10:54]
-  [fixed in 5.2.5: uset setint() in expr.c(evalexpr)]
-
-x pdksh 5.2.4, - (reported by Gabor Zahemszky): emacs: ^O steps down
-  two lines (should be 1).
-  [see Mail.XXX:XXX]
-  [fixed in 5.2.5: convert history line to command number, then convert back]
-
-x pdksh 5.2.3, - (reported by David Gast(? gast at twinsun.com)): fc -ln -1 -1
-  reports the current command, not the previous command.
-  [see Mail.10:49]
-  [fixed in 5.2.5]
-
-x pdksh 5.2.3, - (reported by Matthew Green): foo=`^Jecho bar` doesn't
-  set foo to bar (foo is empty).
-  [see Mail.XXX:XXX]
-  [fixed in 5.2.5: syn.c: set multiline.on when source is SSTRING]
-
-x pdksh 5.2.5, - (reported by Gabor Zahemszky): continue/break: if n
-  is too big, shell prints internal error message.
-  [see Mail.XXX:XXX]
-  [fixed in 5.2.6: fix c_brkcont to use last loop if n is too big]
-
-x pdksh 5.2.5, - (reported by Gabor Zahemszky): set: +o in ksh93
-  prints command that sets various options.
-  [see Mail.XXX:XXX]
-  [fixed in 5.2.6: changed misc.c(printoptions)]
-
-x pdksh 5.2.5, - (reported by Gabor Zahemszky): COLUMNS/LINES variables
-  are not exported.
-  [see Mail.XXX:XXX]
-  [fixed in 5.2.6: use typeset() in edit.c(x_init) to export COLUMNS/LINES]
-
-x pdksh 5.2.5, - (reported by Gabor Zahemszky): emacs: <ESC><ESC> puts
-  space after completed directories.
-  [see Mail.XXX:XXX]
-  [fixed in 5.2.6: check for single/non-directory match in emacs.c(do_complete)]
-
-x pdksh 5.2.5, - (reported by Gabor Zahemszky): vi: # removes comment
-  and executes if command already commented.
-  [see Mail.XXX:XXX]
-  [fixed in 5.2.6: added vi.c(do_comment)]
-
-x pdksh 5.2.7, - (reported by Adrian Marsh): test doesn't have == operator.
-  [see Mail.XXX:XXX]
-  [fixed in 5.2.8: added == to c_test.c operator table]
-
-x pdksh 5.2.7, - (reported by Mike Jetzer): pdksh sets/exports COLUMNS/LINES
-  which causes applications not to respond to window size changes.
-  [see Mail.XXX:XXX]
-  [fixed in 5.2.8: COLUMNS/LINES no longer exported automatically]
-
-x pdksh 5.2.7, - (reported by Gabor Zahemszky): getopts sets OPTIND differently
-  that at&t ksh when a bad option is given.
-  [see Mail.XXX:XXX]
-  [fixed in 5.2.8: OPTIND not set if option was bad - fragile fix - may go away]
-
-x pdksh 5.2.7, - (reported with fix by Marc Olzheim): sh version shouldn't
-  have mail check stuff, macro expansion in PS[0-9].
-  [fixed in 5.2.8: added lots of ifdefs]
-
-x pdksh 5.2.7, - (reported by Gabor Zahemszky): sub commands in PS1 cause
-  a warning message to be printed.
-  [see Mail.XXX:XXX]
-  [fixed in 5.2.8: lex.c(set_prompt) - don't print the warning message]
-
-x pdksh 5.2.7, - (reported by Tom Watson): some environment variables
-  (eg, PATH) are converted to uppercase on 16-bit int machine.
-  [see Mail.XXX:XXX]
-  [fixed in 5.2.8: struct tbl.flag (32 bit thing) was being treated as an
-   int in some places]
-
-x pdksh 5.2.7, - (reported by Gabor Zahemszky): unset always returns 0 - should
-  return 1 if variable/function is not set.
-  [see Mail.XXX:XXX]
-  [fixed in 5.2.8: fixed c_sh.c(c_unset)]
-
-x pdksh 5.2.7, - (reported by Gabor Zahemszky): select should only print the
-  menu the first time, if REPLAY is empty, or if a blank line is entered.
-  [see Mail.XXX:XXX]
-  [fixed in 5.2.8: fixed up exec.c(execute,do_selectargs)]
-
-x pdksh 5.2.7, - (reported by Gabor Zahemszky): shell reports "cannot execute"
-  error if file exists, even if . not in path.
-  [see Mail.XXX:XXX]
-  [fixed in 5.2.8: fixed up exec.c(comexec)]
-
-x pdksh 5.1.3, - (reported with partial fix by ra at rhi.hi.is): shell doesn't
-  listen to sigwinch.
-  [see Mail.7:7 and related]
-  [fixed in 5.2.8: changed edit.c(x_init) to catch sigwinch]
-
-x pdksh 5.2.7, - (reported by Gabor Zahemszky): typeset doesn't report
-  variables that have attributes (like export) but no values.
-  [see Mail.XXX:XXX]
-  [fixed in 5.2.8: fixed up c_ksh.c(c_typeset)]
-
-x pdksh 5.2.7, - (reported by Gabor Zahemszky): error message printed as
-  a result of "set -o nounset" is different from at7t ksh.
-  [see Mail.XXX:XXX]
-  [fixed in 5.2.8: fixed error messges in eval.c]
-
-x pdksh 5.2.7, - (reported by Gabor Zahemszky): vi/emacs: when listing
-  command/file completions, should go back at most one space.  Also, should
-  allow completions on zero length names.
-  [see Mail.XXX:XXX]
-  [fixed in 5.2.8: fixed edit.c(x_locate_word); now allows zero-length
-   file completions (but not command)]
-
-* pdksh 5.2.7, - (reported by Gabor Zahemszky): emacs: <esc># doesn't do
-  the comment thing.
-  [see Mail.XXX:XXX]
-  [fixed in 5.2.8: added emacs.c(x_comment) et al.]
-
-x pdksh 5.2.7, - (reported by Gabor Zahemszky): arithmatic expressions
-  containing variables not expanded as in at&t ksh. eg, "x=1+2, let y=x"
-  fails.
-  [see Mail.XXX:XXX]
-  [fixed in 5.2.8: added evaling/INEXPREVAL/ET_RECURSIVE code to expr.c]
-
-x pdksh 5.2.7, - (reported by Gabor Zahemszky): unsetting the 0th element
-  of an array kills the whole array.
-  [see Mail.XXX:XXX]
-  [fixed in 5.2.8: var.c(unset) - allow ARRAY to be preserved]
-
-x pdksh 5.2.7, - (reported by Gabor Zahemszky): unsetting a function while
-  it is being executed can result in core dump.
-  [see Mail.XXX:XXX]
-  [fixed in 5.2.8: table.c(texpand) - dont free if FINUSE is set]
-
-* pdksh 5.2.7, - (reported by Gabor Zahemszky): exec 3<&p doesn't close
-  shells copy of the coprocess file desc.
-  [see Mail.XXX:XXX]
-  [fixed in 5.2.8: coprocess stuff made to act like ksh93 co-processes]
-
-x pdksh 5.2.8, - (reported with fix by Lars Hecking): doesn't compile as
-  sh - c_ksh.c and jobs.c boom out.
-  [see Mail.XXX:XXX]
-  [fixed in 5.2.9: added ifdef KSH to appropriate places]
-
-x pdksh 5.2.8, - (reported by Paolo Zeppegno): assignments containing brackets
-  are treated as commands.
-  [see Mail.XXX:XXX]
-  [fixed in 5.2.9: fixed bug in vars.c(skip_wdvarname).]
-
-x pdksh 5.2.5, - (reported by Adrian Marsh): configuration on Linux FT fails.
-  Caused by configure script using -g flag - gcc passes -lg to ld, ld fails
-  to find -lg (autoconf or Linux FT bug).
-  [see Mail.XXX:XXX]
-  [fixed in 5.2.9: changed autoconf's -g test to do linking as well.]
-
-x pdksh 5.2.8, Solaris 2.5.1 (reported by Stefan Dalibor): 2 tests
-  (xxx-exec-environment-1 and 2) fail because printenv isn't found.
-  [see Mail.XXX:XXX]
-  [fixed in 5.2.9: changed test to use env instead]
-
-x pdksh 5.2.8, - (reported by Stefan Dalibor): shell assumes 80 columns when
-  it starts up if COLUMNS is set correctly in the environ.
-  [see Mail.XXX:XXX]
-  [fixed in 5.2.9: fixed so window size is checked at startup]
-
-x pdksh 5.2.8, NeXT machines (reported by Kai Wong): clock_t, which lives
-  in sys/time.h, isn't found by configure (causes warning messages).
-  [fixed in 5.2.9: configure now checks in sys/time.h]
-
-x pdksh 5.2.3, - (reported by Mike Jetzer): in vi, <ESC>= on word with ~
-  but no /, beeps (or prints final path comonent?).
-  [see Mail.9:66]
-  [fixed in 5.2.9: fixed edit.c(add_glob) so no * is appended to ~username]
-
-x pdksh 5.1.3, NeXT machines (reported by Jason Baugher): job control doesn't
-  work on NeXT machines (both m68k and x86 based) in rlogin sessions.
-  (caused by open("/dev/tty") failing - rlogin on NeXT doesn't set up
-  controlling tty properly).
-  [see Mail.7:29]
-  [fixed in 5.2.9: added hack to main to get a controlling tty]
-
-x pdksh 5.2.8, NeXT 3.2 (reported by Andrew S Townley): the output of the
-  siglist.sh script fills the disk.  Also, the signal list generated (by the
-  fixed script) is mostly empty.
-  [see Mail.XXX]
-  [fixed in 5.2.9: fixed siglist.sh script to avoid infinite loops.  Added
-   comment to README warning of problem with NeXT's native cc -E]
-
-x pdksh 5.2.9, - (reported by Loris Talpo): long prompts are messed up in
-  vi mode.
-  [see Mail.XXX]
-  [fixed in 5.2.9: lex.c(pprompt) was broken]
-
-x pdksh 5.2.9, - (reported by Will Renkel): a double backslash followed
-  by a newline in an unquoted here document results in one of the backslashes
-  and the newline being stripped.
-  [see Mail.XXX]
-  [fixed in 5.2.10: fixed backslash-newline processing in lex.c]
-
-x pdksh 5.2.9, - (reported by Han Holl): read x?prompt doesn't work 
-  on non-interactive shells when the input is from a tty.
-  [see Mail.XXX]
-  [fixed in 5.2.10: changed test in c_read() from FTALKING to isatty]
-
-x pdksh 5.2.10, - (reported by Dale DePriest): expanding aliases causes
-  extra input.
-  [see Mail.XXX]
-  [fixed in 5.2.11: fixed syn.c(c_list).]
-
-x pdksh 5.2.10, - (reported by John Rochester): window size changes don't
-  happen on Dec unix (osf) because TIOCGWINSZ is defined in <sys/ioctl.h>
-  not in <termios.h>.
-  [see Mail.XXX]
-  [fixed in 5.2.12: sys/ioctl.h included with termios.h/termio.h if possible]
-
-x pdksh 5.2.11, - (reported by Randy Bouzane): aliases in command substitutions
-  result in code dumps.
-  [see Mail.XXX]
-  [fixed in 5.2.12: lex.c(getsc__): break if eof is read]
-
-x pdksh 5.2.11, - (reported by Will Renkel): aliases containing ;<newline>
-  or <newline><newline> aren't fully read/executed.
-  [see Mail.XXX]
-  [fixed in 5.2.12: syn.c(get_command): call inalias()]
-
-x pdksh 5.2.11, SGI/IRIX 5.2 (reported by bert at xpilot.com): pipelines
-  containing built in commands hang forever.
-  [see Mail.XXX]
-  [fixed in 5.2.12: fixed pgrp sync code in jobs.c]
-
-x pdksh 5.2.11, - (reported by Herbert Thielen via Larry Daffner): shell leaves
-  temp files around when executing shell scripts that have functions with
-  here documents which end in an exec.
-  [see Mail.XXX]
-  [fixed in 5.2.12: call main.c(cleanup_proc_env()) from exec.c(execute()).]
-
-x pdksh 5.2.12, - (reported with fix by Eric J. Chet via Thomas Gellekum):
-  . can cause core dump when cleaning up.
-  [see Mail.XXX]
-  [fixed in 5.2.13: call shf_close() before quitenv()]
-
-x pdksh 5.2.12, - (reported by Bruce Burns): test with a single -t option
-  always returns true (does a string test instead of isatty(1)).
-  [see Mail.XXX]
-  [fixed in 5.2.13: do the isatty(1) unless in posix mode]
-
-x pdksh 5.2.12, - (reported by David Tamkin): aliases ending in "; "
-  cause continuation prompt to be printed.
-  [see Mail.XXX]
-  [fixed in 5.2.13: syn.c(c_list) now handles blank lines, removed cf=CONTIN
-   in syn.c(get_command)]
-
-x pdksh 5.2.12, - (reported by Herbert Thielen via Larry Daffner): set
-  does not allow +o and -o options in the same command line.
-  [see Mail.XXX]
-  [fixed in 5.2.13: changed ksh_getopt to remove exclusion code.]
-
-x pdksh 5.2.12, - (reported by Han Holl <jeholl at euronet.nl>):
-  set -A foo -- bar doesn't skip the --.
-  [see Mail.XXX]
-  [fixed in 5.2.13: changed misc.c(parse_args) so A takes an option]
-
-x pdksh 5.2.12, - (reported by David Tamkin): -e (errexit) should be ignored
-  when processing profile and ENV.
-  [see Mail.XXX]
-  [fixed in 5.2.13: errexit saved/cleared/restored in main()]
-
-x pdksh 5.2.12, - (reported by Han Holl <jeholl at euronet.nl>):
-  [ -x foo ] succeeds for root if foo exists.
-  [see Mail.XXX]
-  [fixed in 5.2.13: changed c_test.c(test_access) to use stat in this case]
-
-x pdksh 5.2.4, - (reported by Gabor Zahemszky): echo ${foo[*]#/} generates
-  bad substsitution error, newer ksh's don't (older ones do);
-  error includes {...#@(/)}.
-  [fixed in 5.2.13: moved the @(..) hack from yylex() to expand()]
-
-x pdksh 5.2.8, - : extended pattern globing doesn't handle nested parens (),
-  e.g., [[ aby = +(a|b(x|y)) ]]
-
-x pdksh 5.2.12, - (reported by Marc Olzheim <marcolz at stack.nl>):
-  "echo a | (echo b | echo c)" causes a core dump.
-  [see Mail.XXX]
-  [fixed in 5.2.13: clear XPIPEI,XPIPEO at start of jobs.c(exchild)]
-
-x pdksh 5.2.12, - (reported by Curt Finch <curt at pnk.com>): in an interactive
-  shell, globbing isn't done on redirections if the command is part of
-  a pipeline.  e.g., in "cat < /tmp/*gz | grep foo", the /tmp/*gz is
-  not expanded.
-  [see Mail.XXX]
-  [fixed in 5.2.13: clear XPIPEI,XPIPEO at start of jobs.c(exchild)]
-
-x pdksh 5.2.12, - (reported with fix by Greg A. Woods <woods at most.weird.com>):
-  in emacs, ^[_ (aka ^[.) gets the word from the previous line relative to
-  where the current line came from in the history.  It should get it from
-  the last executed line ala at&t ksh.
-  [see Mail.XXX]
-  [fixed in 5.2.13: use absolute last command]
-
-x pdksh 5.2.12, - (reported by Gabor Zahemszky): MAILCHECK and MAIL
-  don't report `new mail' unless MAIL is re-assigned.
-  [see Mail.XXX]
-  [fixed in 5.2.13: mail code was using variables memory, which was later
-   trashed by exporting the MAIL variable.  Fixed by saving copy of value.]
-
-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
-  concatenation.
-  [see Mail.XXX]
-  [fixed in 5.2.13: alloc.c changed to allow malloc() to deal with large
-   blocks.]
-
-x pdksh 5.2.12, - (reported by Bernd Eggink <eggink at rrz.uni-hamburg.de>)
-  ksh style functions don't save/reset/restore OPTIND.
-  [see Mail.XXX]
-  [fixed in 5.2.13: save and restore user_opt for ksh-style functions.]
-
-x pdksh 5.2.12, - (reported by Marc Olzheim <marcolz at stack.nl>)
-  ${..%..} stuff don't work in SH mode.
-  [see Mail.XXX]
-  [fixed in 5.2.13: removed ifdef KSH from misc.c(do_gmatch)]
-
-x pdksh 5.2.12, - (reported with fix by George Robbins
-  <grr at shandakor.tharsis.com>)
-  in sh, "exec 3>&1" does not keep fd 3 open in executed commands.
-  [see Mail.XXX]
-  [fixed in 5.2.13: c_sh.c(c_exec): added ifdef KSH around fd_clexec() call]
-
-x pdksh 5.2.12, - (reported with fix by George White
-  <gwhite at bodnext.bio.dfo.ca>)
-  in remove_temps(main.c), space for name field is not allocated correctly.
-  [see Mail.XXX]
-  [fixed in 5.2.13: initialize t->name in new structure]
-
-x pdksh 5.2.12, - (reported with fix by Marc Olzheim <marcolz at stack.nl>):
-  when at (past) end of the line, word/command completion will skip back
-  [see Mail.XXX]
-  [fixed in 5.2.13: edit.c(x_locate_word): delete special handling of
-   end-of-buffer]
-
-x pdksh 5.2.12, - (reported by Mike Kelly <tfsmiles at ecst.csuchico.edu>):
-  doting a directory (or a empty path) is allowed.
-  [see Mail.XXX]
-  [fixed in 5.2.13: exec.c(search_access): don't do non-regular files for R_OK]
-
-x pdksh 5.2.13, - (reported by Mike Kelly <tfsmiles at ecst.csuchico.edu>):
-  typeset -f FUNC doesn't print follows command (and expression) substitutions.
-  [see Mail.XXX]
-  [fixed in 5.2.14: tree.c(tputS): add wp++]
-
-x pdksh 5.2.13, - (reported by Thomas Gellekum):
-  make check fails on freebsd with "chmod 644 abcx failed - Inappropriate ...".
-  [see Mail.XXX]
-  [fixed in 5.2.14: make test/th convert permissions to octal]
-
-x pdksh 5.2.13, - (reported with fix by David E. Wexelblat):
-  when re-allocating memory, too much may be copied from old memory.
-  [see Mail.XXX]
-  [fixed in 5.2.14: use min old old size and new size]
-
-x pdksh 5.2.13, - (reported with fix by David E. Wexelblat):
-  set -o printed some options sans names.
-  [see Mail.XXX]
-  [fixed in 5.2.14: use 0 instead of null in options[] table]
-
-x pdksh 5.2.13, - (reported by Gabor Zahemszky):
-  emacs mode: <esc>. in very fist command causes core dump.
-  [see Mail.XXX]
-  [fixed in 5.2.14: ring bell if no history in emacs.c(x_prev_histword)]
-
-x pdksh 5.2.13, - (reported by Keith S McCabe): pdksh dumps core
-  after a cd command.
-  [see Mail.XXX]
-  [fixed in 5.2.14: exec.c(flushcom) was setting bits in table entry, instead
-   of clearing a single bit]
-
-x pdksh 5.2.12, - (reported by Jaime A. Urquidi): typeset -i reports
-  on array elements that have no value (at&t ksh reports on array
-  base name - no index).
-  [see Mail.XXX]
-  [fixed in 5.2.14: hack to c_ksh.c(c_typeset) to generate the ksh88 style
-   output]
-
-x pdksh 5.2.13, - (reported with fix by Todd C. Miller):
-  ulimit -ctn unlimittttted kills shell (resource exceeded).
-  [see Mail.XXX]
-  [fixed in 5.2.14: hacked c_ulimit to generate error val is 0 and expr doesn't
-   start with a digit]
-
-x pdksh 5.2.13, - (reported with fix by Theo de Raadt):
-  ". /dev/null" says access denied.
-  [see Mail.XXX]
-  [fixed in 5.2.14: exec.c(search_access): allow non-regular file if reading]
-
-x pdksh 5.2.13, - (reported with fix by Eric Youngdale): flag field in aliases
-  incorrectly changed (all flags set instead of clearing ISSET) in
-  exec.c(flushcom).
-  [see Mail.XXX]
-  [fixed in 5.2.14: exec.c(flushcom): change = ~ISSET to &= ~ISSET]
-
-x pdksh 5.2.13, - (reported by Andre Delafontaine): ${#array[*]} prints
-  largest index instead of number of (set) elements in an array (ksh88 does
-  the former).
-  [see Mail.XXX]
-  [fixed in 5.2.14: eval.c(varsub): count number of elements]
-
-x pdksh 5.2.13, - (reported by Clifford Wolf): sys_siglist[] doesn't
-  always have NSIG non-null entries...
-  [see Mail.XXX]
-  [fixed in 5.2.14: trap.c(inittrap): check for null sys_siglist entries.]
-
-x pdksh 5.2.13, - (reported with fix by Todd C. Miller): waitfor in jobs.c
-  can cause core dump if j_lookup fails.
-  [fixed in 5.2.14: jobs.c(waitfor): return if j_lookup fails]
-
-x pdksh 5.2.13, - (reported by Martin Bond): if shell is started several
-  times in quick succession, echo $RANDOM produces the same results.
-  [fixed in 5.2.14: main.c(main): seed RANDOM using time, pid, ppid]
-
-x pdksh 5.2.13, - (reported by Martin Bond): repeating "echo `echo $RANDOM`"
-  will always produce the same number.
-  [fixed in 5.2.14: call var.c(change_random) from jobs.c(exchild)]
-
-x pdksh 5.2.13, hpux 10.x (reported by Mike Kelly): pwd will dump core if
-  current directory is not readable.
-  [fixed in 5.2.14: config test & code to work around hpux C library bug]
-
-x pdksh 5.2.13, linux (reported by Mike Jetzer): getwd warning from linker
-  [fixed in 5.2.14: configure.in/misc.c: check for getcwd, use it over getwd]
-
-x pdksh 5.2.13, (reported by Dmitri Kulginov): "trap exit 1" does not set a
-  trap for HUP (exit is mistaken as a signal name, not a command).
-  [fixed in 5.2.14: c_sh.c(c_trap): use case sensitive lookup for first arg]
-
-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 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]
-
-x pdksh 5.2.13.5, (reported with fix by Martin Lucina <mato at kotelna.sk>):
-  exit status parsing in exit command incorrect (sets status to random
-  value if no argument given).
-  [fixed in 5.2.14: c_sh.c(c_exitreturn): only set exstat if arg given]
-
-x pdksh 5.2.13.5, (reported with fix by Martin Lucina <mato at kotelna.sk>):
-  KSH_CHECK_H_TYPE in aclocal.m4 has too many [] around the patterns.
-  [fixed in 5.2.14: aclocal.m4(KSH_CHECK_H_TYPE): remove two pairs on []]
-
-x pdksh 5.2.13.5, (reported by Charles M. Hannum <root at ihack.net>): An exit
-  trap set in a subshell is not executed (unless explicit exit used).
-  [fixed in 5.2.14: exec.c(execute): changed exit(rv) to unwind(LEXIT).]
-
-x pdksh 5.2.12, - : MAILCHECK isn't preserved from the environment on startup.
-  [fixed in 5.2.14: changed main's initcoms[].]
-
-x pdksh 5.2.13, (reported by Marc Olzheim): time at the end of a pipeline
-  doesn't print anything.
-  [fixed in 5.2.14: exec.c(execute): clear XEXEC when calling timex().]
-
-x pdksh 5.2.13, (reported by David J. McMahon): here documents in subshells
-  don't work if the parent exits before the subshell.
-  [fixed in 5.2.14: heredocs now saved in memory, written to temp when needed.]
-
-x pdksh 5.2.13, (reported by Seiichi Namba): emacs: keys bound in .profile/$ENV
-  are overridden by stty settings (eg, binding ^U in .profile has no effect).
-  [fixed in 5.2.14: emacs.c: added x_bound array to track what user has set.]
-
-x pdksh 5.2.13: vi: failed redo (.) commands caused line to be returned to the
-  shell (eg, "echo hi/there^[Bdf/.").
-  [fixed in 5.2.14: vi.c(vi_hook): removed !=0 from VREDO switch expression]
-
-x pdksh 5.2.13, (reported by Arthor Pool): man page: (a) the time reserved
-  word is not described; (b) description of command line wrapping is in vi
-  section only (not in emacs); (c) limit on array indices not mentioned;
-  (d) ignoreeof ignored if eof read 13 times.
-  [fixed in 5.2.14: man page updated]
-
-x pdksh 5.2.13, (reported by Arthor Pool): set -u causes loss of stdout
-  when command substitution with undefined parameter reference is run
-  in an interactive shell.
-  [fixed in 5.2.14: jobs.c(fill_command): don't eval TCOM arguments]
-
-  XXX fd 1 lost (general fd pool handler?, error handler for comsub?)
-
-  AP messages:
-      time not descr
-      vi/emacs <+>
-      trap
-      typeset -f ... "$(jasdsjh)" ...
-      array
-      os2 interrupts + pattern 
-      ignoreeof
-      set -A --
-      set -u -> comsub errors & fill_command eval
-
-x pdksh 5.2.13, (reported by Dave Hillman): test -nt
-  and test -ot do not succeed if file2 (file2) does not exist.
-  [fixed in 5.2.14: c_test.c(test_eval): return true if appropriate stat fails]
-
--- bin/ksh/alloc.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/* $MidnightBSD: src/bin/ksh/alloc.c,v 1.2 2007/07/26 20:13:00 laffer1 Exp $ */
-/*	$OpenBSD: alloc.c,v 1.7 2004/02/19 18:51:17 deraadt Exp $	*/
-/*
- * Copyright (c) 2002 Marc Espie.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE OPENBSD PROJECT AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OPENBSD
- * PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * area-based allocation built on malloc/free
- */
-
-#include "sh.h"
-
-struct link {
-	struct link *prev;
-	struct link *next;
-};
-
-Area *
-ainit(Area *ap)
-{
-	ap->freelist = NULL;
-	return ap;
-}
-
-void
-afreeall(Area *ap)
-{
-	struct link *l, *l2;
-
-	for (l = ap->freelist; l != NULL; l = l2) {
-		l2 = l->next;
-		free(l);
-	}
-	ap->freelist = NULL;
-}
-
-#define L2P(l)	( (void *)(((char *)(l)) + sizeof(struct link)) )
-#define P2L(p)	( (struct link *)(((char *)(p)) - sizeof(struct link)) )
-
-void *
-alloc(size_t size, Area *ap)
-{
-	struct link *l;
-
-	l = malloc(sizeof(struct link) + size);
-	if (l == NULL)
-		internal_errorf(1, "unable to allocate memory");
-	l->next = ap->freelist;
-	l->prev = NULL;
-	if (ap->freelist)
-		ap->freelist->prev = l;
-	ap->freelist = l;
-
-	return L2P(l);
-}
-
-void *
-aresize(void *ptr, size_t size, Area *ap)
-{
-	struct link *l, *l2, *lprev, *lnext;
-
-	if (ptr == NULL)
-		return alloc(size, ap);
-
-	l = P2L(ptr);
-	lprev = l->prev;
-	lnext = l->next;
-
-	l2 = realloc(l, sizeof(struct link) + size);
-	if (l2 == NULL)
-		internal_errorf(1, "unable to allocate memory");
-	if (lprev)
-		lprev->next = l2;
-	else
-		ap->freelist = l2;
-	if (lnext)
-		lnext->prev = l2;
-
-	return L2P(l2);
-}
-
-void
-afree(void *ptr, Area *ap)
-{
-	struct link *l;
-
-	if (!ptr)
-		return;
-
-	l = P2L(ptr);
-
-	if (l->prev)
-		l->prev->next = l->next;
-	else
-		ap->freelist = l->next;
-	if (l->next)
-		l->next->prev = l->prev;
-
-	free(l);
-}
--- bin/ksh/sh.h
+++ /dev/null
@@ -1,421 +0,0 @@
-/* $MidnightBSD: src/bin/ksh/sh.h,v 1.2 2007/07/26 20:13:00 laffer1 Exp $ */
-/*	$OpenBSD: sh.h,v 1.29 2005/12/11 18:53:51 deraadt Exp $	*/
-
-/*
- * Public Domain Bourne/Korn shell
- */
-
-/* $From: sh.h,v 1.2 1994/05/19 18:32:40 michael Exp michael $ */
-
-#include "config.h"	/* system and option configuration info */
-
-/* Start of common headers */
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <setjmp.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdarg.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <limits.h>
-
-#include <signal.h>
-
-#include <paths.h>
-
-/* Find a integer type that is at least 32 bits (or die) - SIZEOF_* defined
- * by autoconf (assumes an 8 bit byte, but I'm not concerned).
- * NOTE: INT32 may end up being more than 32 bits.
- */
-# define INT32	int
-
-/* end of common headers */
-
-/* some useful #defines */
-#ifdef EXTERN
-# define I__(i) = i
-#else
-# define I__(i)
-# define EXTERN extern
-# define EXTERN_DEFINED
-#endif
-
-#define EXECSHELL	_PATH_BSHELL
-#define EXECSHELL_STR	"EXECSHELL"
-
-#define	NELEM(a) (sizeof(a) / sizeof((a)[0]))
-#define	sizeofN(type, n) (sizeof(type) * (n))
-#define	BIT(i)	(1<<(i))	/* define bit in flag */
-
-/* Table flag type - needs > 16 and < 32 bits */
-typedef INT32 Tflag;
-
-#define	NUFILE	32		/* Number of user-accessible files */
-#define	FDBASE	10		/* First file usable by Shell */
-
-/* Make MAGIC a char that might be printed to make bugs more obvious, but
- * not a char that is used often.  Also, can't use the high bit as it causes
- * portability problems (calling strchr(x, 0x80|'x') is error prone).
- */
-#define	MAGIC		(7)	/* prefix for *?[!{,} during expand */
-#define ISMAGIC(c)	((unsigned char)(c) == MAGIC)
-#define	NOT		'!'	/* might use ^ (ie, [!...] vs [^..]) */
-
-#define	LINE	2048		/* input line size */
-#define	PATH	1024		/* pathname size (todo: PATH_MAX/pathconf()) */
-#define ARRAYMAX 2047		/* max array index */
-
-EXTERN	const char *kshname;	/* $0 */
-EXTERN	pid_t	kshpid;		/* $$, shell pid */
-EXTERN	pid_t	procpid;	/* pid of executing process */
-EXTERN	uid_t	ksheuid;	/* effective uid of shell */
-EXTERN	int	exstat;		/* exit status */
-EXTERN	int	subst_exstat;	/* exit status of last $(..)/`..` */
-EXTERN	const char *safe_prompt; /* safe prompt if PS1 substitution fails */
-EXTERN	char	username[];	/* username for \u prompt expansion */
-
-/*
- * Area-based allocation built on malloc/free
- */
-typedef struct Area {
-	struct link *freelist;	/* free list */
-} Area;
-
-EXTERN	Area	aperm;		/* permanent object space */
-#define	APERM	&aperm
-#define	ATEMP	&e->area
-
-#ifdef KSH_DEBUG
-# define kshdebug_init()	kshdebug_init_()
-# define kshdebug_printf(a)	kshdebug_printf_ a
-# define kshdebug_dump(a)	kshdebug_dump_ a
-#else /* KSH_DEBUG */
-# define kshdebug_init()
-# define kshdebug_printf(a)
-# define kshdebug_dump(a)
-#endif /* KSH_DEBUG */
-
-/*
- * parsing & execution environment
- */
-EXTERN	struct env {
-	short	type;			/* environment type - see below */
-	short	flags;			/* EF_* */
-	Area	area;			/* temporary allocation area */
-	struct	block *loc;		/* local variables and functions */
-	short  *savefd;			/* original redirected fd's */
-	struct	env *oenv;		/* link to previous environment */
-	sigjmp_buf jbuf;		/* long jump back to env creator */
-	struct temp *temps;		/* temp files */
-} *e;
-
-/* struct env.type values */
-#define	E_NONE	0		/* dummy environment */
-#define	E_PARSE	1		/* parsing command # */
-#define	E_FUNC	2		/* executing function # */
-#define	E_INCL	3		/* including a file via . # */
-#define	E_EXEC	4		/* executing command tree */
-#define	E_LOOP	5		/* executing for/while # */
-#define	E_ERRH	6		/* general error handler # */
-/* # indicates env has valid jbuf (see unwind()) */
-
-/* struct env.flag values */
-#define EF_FUNC_PARSE	BIT(0)	/* function being parsed */
-#define EF_BRKCONT_PASS	BIT(1)	/* set if E_LOOP must pass break/continue on */
-#define EF_FAKE_SIGDIE	BIT(2)	/* hack to get info from unwind to quitenv */
-
-/* Do breaks/continues stop at env type e? */
-#define STOP_BRKCONT(t)	((t) == E_NONE || (t) == E_PARSE \
-			 || (t) == E_FUNC || (t) == E_INCL)
-/* Do returns stop at env type e? */
-#define STOP_RETURN(t)	((t) == E_FUNC || (t) == E_INCL)
-
-/* values for siglongjmp(e->jbuf, 0) */
-#define LRETURN	1		/* return statement */
-#define	LEXIT	2		/* exit statement */
-#define LERROR	3		/* errorf() called */
-#define LLEAVE	4		/* untrappable exit/error */
-#define LINTR	5		/* ^C noticed */
-#define	LBREAK	6		/* break statement */
-#define	LCONTIN	7		/* continue statement */
-#define LSHELL	8		/* return to interactive shell() */
-#define LAEXPR	9		/* error in arithmetic expression */
-
-/* option processing */
-#define OF_CMDLINE	0x01	/* command line */
-#define OF_SET		0x02	/* set builtin */
-#define OF_SPECIAL	0x04	/* a special variable changing */
-#define OF_INTERNAL	0x08	/* set internally by shell */
-#define OF_ANY		(OF_CMDLINE | OF_SET | OF_SPECIAL | OF_INTERNAL)
-
-struct option {
-    const char	*name;	/* long name of option */
-    char	c;	/* character flag (if any) */
-    short	flags;	/* OF_* */
-};
-extern const struct option options[];
-
-/*
- * flags (the order of these enums MUST match the order in misc.c(options[]))
- */
-enum sh_flag {
-	FEXPORT = 0,	/* -a: export all */
-#ifdef BRACE_EXPAND
-	FBRACEEXPAND,	/* enable {} globbing */
-#endif
-	FBGNICE,	/* bgnice */
-	FCOMMAND,	/* -c: (invocation) execute specified command */
-	FCSHHISTORY,	/* csh-style history enabled */
-#ifdef EMACS
-	FEMACS,		/* emacs command editing */
-	FEMACSUSEMETA,	/* use 8th bit as meta */
-#endif
-	FERREXIT,	/* -e: quit on error */
-#ifdef EMACS
-	FGMACS,		/* gmacs command editing */
-#endif
-	FIGNOREEOF,	/* eof does not exit */
-	FTALKING,	/* -i: interactive */
-	FKEYWORD,	/* -k: name=value anywhere */
-	FLOGIN,		/* -l: a login shell */
-	FMARKDIRS,	/* mark dirs with / in file name completion */
-	FMONITOR,	/* -m: job control monitoring */
-	FNOCLOBBER,	/* -C: don't overwrite existing files */
-	FNOEXEC,	/* -n: don't execute any commands */
-	FNOGLOB,	/* -f: don't do file globbing */
-	FNOHUP,		/* -H: don't kill running jobs when login shell exits */
-	FNOLOG,		/* don't save functions in history (ignored) */
-#ifdef	JOBS
-	FNOTIFY,	/* -b: asynchronous job completion notification */
-#endif
-	FNOUNSET,	/* -u: using an unset var is an error */
-	FPHYSICAL,	/* -o physical: don't do logical cd's/pwd's */
-	FPOSIX,		/* -o posix: be posixly correct */
-	FPRIVILEGED,	/* -p: use suid_profile */
-	FRESTRICTED,	/* -r: restricted shell */
-	FSH,		/* -o sh: favor sh behaviour */
-	FSTDIN,		/* -s: (invocation) parse stdin */
-	FTRACKALL,	/* -h: create tracked aliases for all commands */
-	FVERBOSE,	/* -v: echo input */
-#ifdef VI
-	FVI,		/* vi command editing */
-	FVIRAW,		/* always read in raw mode (ignored) */
-	FVISHOW8,	/* display chars with 8th bit set as is (versus M-) */
-	FVITABCOMPLETE,	/* enable tab as file name completion char */
-	FVIESCCOMPLETE,	/* enable ESC as file name completion in command mode */
-#endif
-	FXTRACE,	/* -x: execution trace */
-	FTALKING_I,	/* (internal): initial shell was interactive */
-	FNFLAGS /* (place holder: how many flags are there) */
-};
-
-#define Flag(f)	(shell_flags[(int) (f)])
-
-EXTERN	char shell_flags [FNFLAGS];
-
-EXTERN	char	null [] I__("");	/* null value for variable */
-EXTERN	char	space [] I__(" ");
-EXTERN	char	newline [] I__("\n");
-
-enum temp_type {
-	TT_HEREDOC_EXP,	/* expanded heredoc */
-	TT_HIST_EDIT	/* temp file used for history editing (fc -e) */
-};
-typedef enum temp_type Temp_type;
-/* temp/heredoc files.  The file is removed when the struct is freed. */
-struct temp {
-	struct temp	*next;
-	struct shf	*shf;
-	int		pid;		/* pid of process parsed here-doc */
-	Temp_type	type;
-	char		*name;
-};
-
-/*
- * stdio and our IO routines
- */
-
-#define shl_spare	(&shf_iob[0])	/* for c_read()/c_print() */
-#define shl_stdout	(&shf_iob[1])
-#define shl_out		(&shf_iob[2])
-EXTERN int shl_stdout_ok;
-
-/*
- * trap handlers
- */
-typedef struct trap {
-	int	signal;		/* signal number */
-	const char *name;	/* short name */
-	const char *mess;	/* descriptive name */
-	char   *trap;		/* trap command */
-	volatile sig_atomic_t set; /* trap pending */
-	int	flags;		/* TF_* */
-	sig_t cursig;		/* current handler (valid if TF_ORIG_* set) */
-	sig_t shtrap;		/* shell signal handler */
-} Trap;
-
-/* values for Trap.flags */
-#define TF_SHELL_USES	BIT(0)	/* shell uses signal, user can't change */
-#define TF_USER_SET	BIT(1)	/* user has (tried to) set trap */
-#define TF_ORIG_IGN	BIT(2)	/* original action was SIG_IGN */
-#define TF_ORIG_DFL	BIT(3)	/* original action was SIG_DFL */
-#define TF_EXEC_IGN	BIT(4)	/* restore SIG_IGN just before exec */
-#define TF_EXEC_DFL	BIT(5)	/* restore SIG_DFL just before exec */
-#define TF_DFL_INTR	BIT(6)	/* when received, default action is LINTR */
-#define TF_TTY_INTR	BIT(7)	/* tty generated signal (see j_waitj) */
-#define TF_CHANGED	BIT(8)	/* used by runtrap() to detect trap changes */
-#define TF_FATAL	BIT(9)	/* causes termination if not trapped */
-
-/* values for setsig()/setexecsig() flags argument */
-#define SS_RESTORE_MASK	0x3	/* how to restore a signal before an exec() */
-#define SS_RESTORE_CURR	0	/* leave current handler in place */
-#define SS_RESTORE_ORIG	1	/* restore original handler */
-#define SS_RESTORE_DFL	2	/* restore to SIG_DFL */
-#define SS_RESTORE_IGN	3	/* restore to SIG_IGN */
-#define SS_FORCE	BIT(3)	/* set signal even if original signal ignored */
-#define SS_USER		BIT(4)	/* user is doing the set (ie, trap command) */
-#define SS_SHTRAP	BIT(5)	/* trap for internal use (CHLD,ALRM,WINCH) */
-
-#define SIGEXIT_	0	/* for trap EXIT */
-#define SIGERR_		NSIG	/* for trap ERR */
-
-EXTERN	volatile sig_atomic_t trap;	/* traps pending? */
-EXTERN	volatile sig_atomic_t intrsig;	/* pending trap interrupts command */
-EXTERN	volatile sig_atomic_t fatal_trap;/* received a fatal signal */
-extern	Trap	sigtraps[NSIG+1];
-
-/*
- * TMOUT support
- */
-/* values for ksh_tmout_state */
-enum tmout_enum {
-	TMOUT_EXECUTING	= 0,	/* executing commands */
-	TMOUT_READING,		/* waiting for input */
-	TMOUT_LEAVING		/* have timed out */
-};
-EXTERN unsigned int ksh_tmout;
-EXTERN enum tmout_enum ksh_tmout_state I__(TMOUT_EXECUTING);
-
-/* For "You have stopped jobs" message */
-EXTERN int really_exit;
-
-/*
- * fast character classes
- */
-#define	C_ALPHA	 BIT(0)		/* a-z_A-Z */
-#define	C_DIGIT	 BIT(1)		/* 0-9 */
-#define	C_LEX1	 BIT(2)		/* \0 \t\n|&;<>() */
-#define	C_VAR1	 BIT(3)		/* *@#!$-? */
-#define	C_IFSWS	 BIT(4)		/* \t \n (IFS white space) */
-#define	C_SUBOP1 BIT(5)		/* "=-+?" */
-#define	C_SUBOP2 BIT(6)		/* "#%" */
-#define	C_IFS	 BIT(7)		/* $IFS */
-#define	C_QUOTE	 BIT(8)		/*  \n\t"#$&'()*;<>?[\`| (needing quoting) */
-
-extern	short ctypes [];
-
-#define	ctype(c, t)	!!(ctypes[(unsigned char)(c)]&(t))
-#define	letter(c)	ctype(c, C_ALPHA)
-#define	digit(c)	ctype(c, C_DIGIT)
-#define	letnum(c)	ctype(c, C_ALPHA|C_DIGIT)
-
-EXTERN int ifs0 I__(' ');	/* for "$*" */
-
-/* Argument parsing for built-in commands and getopts command */
-
-/* Values for Getopt.flags */
-#define GF_ERROR	BIT(0)	/* call errorf() if there is an error */
-#define GF_PLUSOPT	BIT(1)	/* allow +c as an option */
-#define GF_NONAME	BIT(2)	/* don't print argv[0] in errors */
-
-/* Values for Getopt.info */
-#define GI_MINUS	BIT(0)	/* an option started with -... */
-#define GI_PLUS		BIT(1)	/* an option started with +... */
-#define GI_MINUSMINUS	BIT(2)	/* arguments were ended with -- */
-
-typedef struct {
-	int		optind;
-	int		uoptind;/* what user sees in $OPTIND */
-	char		*optarg;
-	int		flags;	/* see GF_* */
-	int		info;	/* see GI_* */
-	unsigned int	p;	/* 0 or index into argv[optind - 1] */
-	char		buf[2];	/* for bad option OPTARG value */
-} Getopt;
-
-EXTERN Getopt builtin_opt;	/* for shell builtin commands */
-EXTERN Getopt user_opt;		/* parsing state for getopts builtin command */
-
-/* This for co-processes */
-
-typedef INT32 Coproc_id; /* something that won't (realisticly) wrap */
-struct coproc {
-	int	read;		/* pipe from co-process's stdout */
-	int	readw;		/* other side of read (saved temporarily) */
-	int	write;		/* pipe to co-process's stdin */
-	Coproc_id id;		/* id of current output pipe */
-	int	njobs;		/* number of live jobs using output pipe */
-	void    *job;           /* 0 or job of co-process using input pipe */
-};
-EXTERN struct coproc coproc;
-
-/* Used in jobs.c and by coprocess stuff in exec.c */
-EXTERN sigset_t		sm_default, sm_sigchld;
-
-extern const char ksh_version[];
-
-/* name of called builtin function (used by error functions) */
-EXTERN char	*builtin_argv0;
-EXTERN Tflag	builtin_flag;	/* flags of called builtin (SPEC_BI, etc.) */
-
-/* current working directory, and size of memory allocated for same */
-EXTERN char	*current_wd;
-EXTERN int	current_wd_size;
-
-#ifdef EDIT
-/* 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
-/* 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 */
-#else
-# define x_cols 80		/* for pr_menu(exec.c) */
-#endif
-
-/* These to avoid bracket matching problems */
-#define OPAREN	'('
-#define CPAREN	')'
-#define OBRACK	'['
-#define CBRACK	']'
-#define OBRACE	'{'
-#define CBRACE	'}'
-
-/* Determine the location of the system (common) profile */
-#define KSH_SYSTEM_PROFILE "/etc/profile"
-
-/* Used by v_evaluate() and setstr() to control action when error occurs */
-#define KSH_UNWIND_ERROR	0	/* unwind the stack (longjmp) */
-#define KSH_RETURN_ERROR	1	/* return 1/0 for success/failure */
-
-#include "shf.h"
-#include "table.h"
-#include "tree.h"
-#include "expand.h"
-#include "lex.h"
-#include "proto.h"
-
-/* be sure not to interfere with anyone else's idea about EXTERN */
-#ifdef EXTERN_DEFINED
-# undef EXTERN_DEFINED
-# undef EXTERN
-#endif
-#undef I__
--- bin/ksh/IAFA-PACKAGE
+++ /dev/null
@@ -1,18 +0,0 @@
-$OpenBSD: IAFA-PACKAGE,v 1.7 1999/07/14 13:37:23 millert Exp $
-
-Title:		pdksh
-Version:	5.2.14
-Description:	A public domain implementation of the Korn shell (ksh88),
-		a UNIX command line interpreter / scripting language; the few
-		missing ksh features are being added and the shell is being
-		POSIXized.
-Author:		(Eric Gisin), (Charles Forsyth), (John R MacMillan),
-		sjg at zen.void.oz.au (Simon J. Gerraty),
-		michael at cs.mun.ca (Michael Rendell), (plus many others)
-Maintained-by:	michael at cs.mun.ca (Michael Rendell)
-Maintained-at:	ftp://ftp.cs.mun.ca:/pub/pdksh/
-Platforms:	Written in C, runs on most UNIX boxes (uses GNU autoconf;
-		works best in a POSIX or BSD environment).  Also runs on OS/2
-		and (using cygwin32 package) on win95/NT
-Copying-Policy:	Freely Redistributable (mostly public domain, some copyrighted)
-Keywords:	pdksh, ksh, Korn, shell, command line interpreter
--- bin/ksh/LEGAL
+++ /dev/null
@@ -1,12 +0,0 @@
-$OpenBSD: LEGAL,v 1.2 2003/07/17 20:59:43 deraadt Exp $
-
-pdksh is provided AS IS, with NO WARRANTY, either expressed or implied.
-
-The vast majority of the code that makes pdksh is in the public domain.
-The exceptions are:
-	sigact.c and sigact.h
-		[REMOVED]
-	aclocal.m4
-		[REMOVED]
-
-That's it.  Short and simple.
--- bin/ksh/table.h
+++ /dev/null
@@ -1,184 +0,0 @@
-/* $MidnightBSD: src/bin/ksh/table.h,v 1.2 2007/07/26 20:13:00 laffer1 Exp $ */
-/*	$OpenBSD: table.h,v 1.7 2005/12/11 20:31:21 otto Exp $	*/
-
-/* $From: table.h,v 1.3 1994/05/31 13:34:34 michael Exp $ */
-
-/*
- * generic hashed associative table for commands and variables.
- */
-
-struct table {
-	Area   *areap;		/* area to allocate entries */
-	short	size, nfree;	/* hash size (always 2^^n), free entries */
-	struct	tbl **tbls;	/* hashed table items */
-};
-
-struct tbl {			/* table item */
-	Tflag	flag;		/* flags */
-	int	type;		/* command type (see below), base (if INTEGER),
-				 * or offset from val.s of value (if EXPORT) */
-	Area	*areap;		/* area to allocate from */
-	union {
-		char *s;	/* string */
-		long i;		/* integer */
-		int (*f)(char **);	/* int function */
-		struct op *t;	/* "function" tree */
-	} val;			/* value */
-	int	index;		/* index for an array */
-	union {
-	    int	field;		/* field with for -L/-R/-Z */
-	    int errno_;		/* CEXEC/CTALIAS */
-	} u2;
-	union {
-		struct tbl *array;	/* array values */
-		char *fpath;		/* temporary path to undef function */
-	} u;
-	char	name[4];	/* name -- variable length */
-};
-
-/* common flag bits */
-#define	ALLOC		BIT(0)	/* val.s has been allocated */
-#define	DEFINED		BIT(1)	/* is defined in block */
-#define	ISSET		BIT(2)	/* has value, vp->val.[si] */
-#define	EXPORT		BIT(3)	/* exported variable/function */
-#define	TRACE		BIT(4)	/* var: user flagged, func: execution tracing */
-/* (start non-common flags at 8) */
-/* flag bits used for variables */
-#define	SPECIAL		BIT(8)	/* PATH, IFS, SECONDS, etc */
-#define	INTEGER		BIT(9)	/* val.i contains integer value */
-#define	RDONLY		BIT(10)	/* read-only variable */
-#define	LOCAL		BIT(11)	/* for local typeset() */
-#define ARRAY		BIT(13)	/* array */
-#define LJUST		BIT(14)	/* left justify */
-#define RJUST		BIT(15)	/* right justify */
-#define ZEROFIL		BIT(16)	/* 0 filled if RJUSTIFY, strip 0s if LJUSTIFY */
-#define LCASEV		BIT(17)	/* convert to lower case */
-#define UCASEV_AL	BIT(18)/* convert to upper case / autoload function */
-#define INT_U		BIT(19)	/* unsigned integer */
-#define INT_L		BIT(20)	/* long integer (no-op) */
-#define IMPORT		BIT(21)	/* flag to typeset(): no arrays, must have = */
-#define LOCAL_COPY	BIT(22)	/* with LOCAL - copy attrs from existing var */
-#define EXPRINEVAL	BIT(23)	/* contents currently being evaluated */
-#define EXPRLVALUE	BIT(24)	/* useable as lvalue (temp flag) */
-/* flag bits used for taliases/builtins/aliases/keywords/functions */
-#define KEEPASN		BIT(8)	/* keep command assignments (eg, var=x cmd) */
-#define FINUSE		BIT(9)	/* function being executed */
-#define FDELETE		BIT(10)	/* function deleted while it was executing */
-#define FKSH		BIT(11)	/* function defined with function x (vs x()) */
-#define SPEC_BI		BIT(12)	/* a POSIX special builtin */
-#define REG_BI		BIT(13)	/* a POSIX regular builtin */
-/* Attributes that can be set by the user (used to decide if an unset param
- * should be repoted by set/typeset).  Does not include ARRAY or LOCAL.
- */
-#define USERATTRIB	(EXPORT|INTEGER|RDONLY|LJUST|RJUST|ZEROFIL\
-			 |LCASEV|UCASEV_AL|INT_U|INT_L)
-
-/* command types */
-#define	CNONE	0		/* undefined */
-#define	CSHELL	1		/* built-in */
-#define	CFUNC	2		/* function */
-#define	CEXEC	4		/* executable command */
-#define	CALIAS	5		/* alias */
-#define	CKEYWD	6		/* keyword */
-#define CTALIAS	7		/* tracked alias */
-
-/* Flags for findcom()/comexec() */
-#define FC_SPECBI	BIT(0)	/* special builtin */
-#define FC_FUNC		BIT(1)	/* function builtin */
-#define FC_REGBI	BIT(2)	/* regular builtin */
-#define FC_UNREGBI	BIT(3)	/* un-regular builtin (!special,!regular) */
-#define FC_BI		(FC_SPECBI|FC_REGBI|FC_UNREGBI)
-#define FC_PATH		BIT(4)	/* do path search */
-#define FC_DEFPATH	BIT(5)	/* use default path in path search */
-
-
-#define AF_ARGV_ALLOC	0x1	/* argv[] array allocated */
-#define AF_ARGS_ALLOCED	0x2	/* argument strings allocated */
-#define AI_ARGV(a, i)	((i) == 0 ? (a).argv[0] : (a).argv[(i) - (a).skip])
-#define AI_ARGC(a)	((a).argc_ - (a).skip)
-
-/* Argument info.  Used for $#, $* for shell, functions, includes, etc. */
-struct arg_info {
-	int flags;	/* AF_* */
-	char **argv;
-	int argc_;
-	int skip;	/* first arg is argv[0], second is argv[1 + skip] */
-};
-
-/*
- * activation record for function blocks
- */
-struct block {
-	Area	area;		/* area to allocate things */
-	/*struct arg_info argi;*/
-	char	**argv;
-	int	argc;
-	int	flags;		/* see BF_* */
-	struct	table vars;	/* local variables */
-	struct	table funs;	/* local functions */
-	Getopt	getopts_state;
-#if 1
-	char *	error;		/* error handler */
-	char *	exit;		/* exit handler */
-#else
-	Trap	error, exit;
-#endif
-	struct	block *next;	/* enclosing block */
-};
-
-/* Values for struct block.flags */
-#define BF_DOGETOPTS	BIT(0)	/* save/restore getopts state */
-
-/*
- * Used by ktwalk() and ktnext() routines.
- */
-struct tstate {
-	int left;
-	struct tbl **next;
-};
-
-
-EXTERN	struct table taliases;	/* tracked aliases */
-EXTERN	struct table builtins;	/* built-in commands */
-EXTERN	struct table aliases;	/* aliases */
-EXTERN	struct table keywords;	/* keywords */
-EXTERN	struct table homedirs;	/* homedir() cache */
-
-struct builtin {
-	const char   *name;
-	int  (*func)(char **);
-};
-
-/* these really are externs! Look in table.c for them */
-extern const struct builtin shbuiltins [], kshbuiltins [];
-
-/* var spec values */
-#define	V_NONE			0
-#define	V_PATH			1
-#define	V_IFS			2
-#define	V_SECONDS		3
-#define	V_OPTIND		4
-#define	V_MAIL			5
-#define	V_MAILPATH		6
-#define	V_MAILCHECK		7
-#define	V_RANDOM		8
-#define V_HISTSIZE		9
-#define V_HISTFILE		10
-#define V_VISUAL		11
-#define V_EDITOR		12
-#define V_COLUMNS		13
-#define V_POSIXLY_CORRECT	14
-#define V_TMOUT			15
-#define V_TMPDIR		16
-#define V_LINENO		17
-
-/* values for set_prompt() */
-#define PS1	0		/* command */
-#define PS2	1		/* command continuation */
-
-EXTERN char *path;		/* copy of either PATH or def_path */
-EXTERN const char *def_path;	/* path to use if PATH not set */
-EXTERN char *tmpdir;		/* TMPDIR value */
-EXTERN const char *prompt;
-EXTERN int cur_prompt;		/* PS1 or PS2 */
-EXTERN int current_lineno;	/* LINENO value */
--- bin/ksh/main.c
+++ /dev/null
@@ -1,749 +0,0 @@
-/* $MidnightBSD: src/bin/ksh/main.c,v 1.4 2007/07/26 20:13:00 laffer1 Exp $ */
-/*	$OpenBSD: main.c,v 1.41 2006/04/10 14:38:59 jaredy Exp $	*/
-
-/*
- * startup, main loop, environments and error handling
- */
-
-#define	EXTERN				/* define EXTERNs in sh.h */
-
-#include "sh.h"
-#include <sys/stat.h>
-#include <pwd.h>
-#include <sys/param.h>
-
-extern char **environ;
-
-/*
- * global data
- */
-
-static void	reclaim(void);
-static void	remove_temps(struct temp *tp);
-static int	is_restricted(char *name);
-static void	init_username(void);
-
-/*
- * shell initialization
- */
-
-static const char initifs[] = "IFS= \t\n";
-
-static const char initsubs[] = "${PS2=> } ${PS3=#? } ${PS4=+ }";
-
-static const char *initcoms [] = {
-	"typeset", "-r", "KSH_VERSION", NULL,
-	"typeset", "-x", "SHELL", "PATH", "HOME", NULL,
-	"typeset", "-i", "PPID", NULL,
-	"typeset", "-i", "OPTIND=1", NULL,
-	"eval", "typeset -i RANDOM MAILCHECK=\"${MAILCHECK-600}\" SECONDS=\"${SECONDS-0}\" TMOUT=\"${TMOUT-0}\"", NULL,
-	"alias",
-	 /* Standard ksh aliases */
-	  "hash=alias -t",	/* not "alias -t --": hash -r needs to work */
-	  "type=whence -v",
-#ifdef JOBS
-	  "stop=kill -STOP",
-	  "suspend=kill -STOP $$",
-#endif
-	  "autoload=typeset -fu",
-	  "functions=typeset -f",
-#ifdef HISTORY
-	  "history=fc -l",
-#endif /* HISTORY */
-	  "integer=typeset -i",
-	  "nohup=nohup ",
-	  "local=typeset",
-	  "r=fc -e -",
-	 /* Aliases that are builtin commands in at&t */
-	  "login=exec login",
-	  NULL,
-	/* this is what at&t ksh seems to track, with the addition of emacs */
-	"alias", "-tU",
-	  "cat", "cc", "chmod", "cp", "date", "ed", "emacs", "grep", "ls",
-	  "mail", "make", "mv", "pr", "rm", "sed", "sh", "vi", "who",
-	  NULL,
-	NULL
-};
-
-char username[MAXLOGNAME];
-
-#define version_param  (initcoms[2])
-
-int
-main(int argc, char *argv[])
-{
-	int i;
-	int argi;
-	Source *s;
-	struct block *l;
-	int restricted, errexit;
-	char **wp;
-	struct env env;
-	pid_t ppid;
-
-	/* make sure argv[] is sane */
-	if (!*argv) {
-		static const char *empty_argv[] = {
-			"ksh", (char *) 0
-		};
-
-		argv = (char **) empty_argv;
-		argc = 1;
-	}
-	kshname = *argv;
-
-	ainit(&aperm);		/* initialize permanent Area */
-
-	/* set up base environment */
-	memset(&env, 0, sizeof(env));
-	env.type = E_NONE;
-	ainit(&env.area);
-	e = &env;
-	newblock();		/* set up global l->vars and l->funs */
-
-	/* Do this first so output routines (eg, errorf, shellf) can work */
-	initio();
-
-	initvar();
-
-	initctypes();
-
-	inittraps();
-
-	coproc_init();
-
-	/* set up variable and command dictionaries */
-	ktinit(&taliases, APERM, 0);
-	ktinit(&aliases, APERM, 0);
-	ktinit(&homedirs, APERM, 0);
-
-	/* define shell keywords */
-	initkeywords();
-
-	/* define built-in commands */
-	ktinit(&builtins, APERM, 64); /* must be 2^n (currently 40 builtins) */
-	for (i = 0; shbuiltins[i].name != NULL; i++)
-		builtin(shbuiltins[i].name, shbuiltins[i].func);
-	for (i = 0; kshbuiltins[i].name != NULL; i++)
-		builtin(kshbuiltins[i].name, kshbuiltins[i].func);
-
-	init_histvec();
-
-	def_path = _PATH_DEFPATH;
-	{
-		size_t len = confstr(_CS_PATH, (char *) 0, 0);
-		char *new;
-
-		if (len > 0) {
-			confstr(_CS_PATH, new = alloc(len + 1, APERM), len + 1);
-			def_path = new;
-		}
-	}
-
-	/* Set PATH to def_path (will set the path global variable).
-	 * (import of environment below will probably change this setting).
-	 */
-	{
-		struct tbl *vp = global("PATH");
-		/* setstr can't fail here */
-		setstr(vp, def_path, KSH_RETURN_ERROR);
-	}
-
-
-	/* Turn on nohup by default for now - will change to off
-	 * by default once people are aware of its existence
-	 * (at&t ksh does not have a nohup option - it always sends
-	 * the hup).
-	 */
-	Flag(FNOHUP) = 1;
-
-	/* Turn on brace expansion by default.  At&t ksh's that have
-	 * alternation always have it on.  BUT, posix doesn't have
-	 * brace expansion, so set this before setting up FPOSIX
-	 * (change_flag() clears FBRACEEXPAND when FPOSIX is set).
-	 */
-#ifdef BRACE_EXPAND
-	Flag(FBRACEEXPAND) = 1;
-#endif /* BRACE_EXPAND */
-
-	/* set posix flag just before environment so that it will have
-	 * exactly the same effect as the POSIXLY_CORRECT environment
-	 * variable.  If this needs to be done sooner to ensure correct posix
-	 * operation, an initial scan of the environment will also have
-	 * done sooner.
-	 */
-#ifdef POSIXLY_CORRECT
-	change_flag(FPOSIX, OF_SPECIAL, 1);
-#endif /* POSIXLY_CORRECT */
-
-	/* Check to see if we're /bin/sh. */
-	if (!strcmp(&kshname[strlen(kshname) - 3], "/sh") ||
-	    !strcmp(kshname, "sh") || !strcmp(kshname, "-sh")) {
-		Flag(FSH) = 1;
-		version_param = "SH_VERSION";
-	}
-
-	/* Set edit mode to emacs by default, may be overridden
-	 * by the environment or the user.  Also, we want tab completion
-	 * on in vi by default. */
-#if defined(EDIT) && defined(EMACS)
-	change_flag(FEMACS, OF_SPECIAL, 1);
-#endif /* EDIT && EMACS */
-#if defined(EDIT) && defined(VI)
-	Flag(FVITABCOMPLETE) = 1;
-#endif /* EDIT && VI */
-
-	/* import environment */
-	if (environ != NULL)
-		for (wp = environ; *wp != NULL; wp++)
-			typeset(*wp, IMPORT|EXPORT, 0, 0, 0);
-
-	kshpid = procpid = getpid();
-	typeset(initifs, 0, 0, 0, 0);	/* for security */
-
-	/* assign default shell variable values */
-	substitute(initsubs, 0);
-
-	/* Figure out the current working directory and set $PWD */
-	{
-		struct stat s_pwd, s_dot;
-		struct tbl *pwd_v = global("PWD");
-		char *pwd = str_val(pwd_v);
-		char *pwdx = pwd;
-
-		/* Try to use existing $PWD if it is valid */
-		if (pwd[0] != '/' ||
-		    stat(pwd, &s_pwd) < 0 || stat(".", &s_dot) < 0 ||
-		    s_pwd.st_dev != s_dot.st_dev ||
-		    s_pwd.st_ino != s_dot.st_ino)
-			pwdx = (char *) 0;
-		set_current_wd(pwdx);
-		if (current_wd[0])
-			simplify_path(current_wd);
-		/* Only set pwd if we know where we are or if it had a
-		 * bogus value
-		 */
-		if (current_wd[0] || pwd != null)
-			/* setstr can't fail here */
-			setstr(pwd_v, current_wd, KSH_RETURN_ERROR);
-	}
-	ppid = getppid();
-	setint(global("PPID"), (long) ppid);
-	/* setstr can't fail here */
-	setstr(global(version_param), ksh_version, KSH_RETURN_ERROR);
-
-	/* execute initialization statements */
-	for (wp = (char**) initcoms; *wp != NULL; wp++) {
-		shcomexec(wp);
-		for (; *wp != NULL; wp++)
-			;
-	}
-
-
-	ksheuid = geteuid();
-	init_username();
-	safe_prompt = ksheuid ? "$ " : "# ";
-	{
-		struct tbl *vp = global("PS1");
-
-		/* Set PS1 if it isn't set, or we are root and prompt doesn't
-		 * contain a #.
-		 */
-		if (!(vp->flag & ISSET) ||
-		    (!ksheuid && !strchr(str_val(vp), '#')))
-			/* setstr can't fail here */
-			setstr(vp, safe_prompt, KSH_RETURN_ERROR);
-	}
-
-	/* Set this before parsing arguments */
-	Flag(FPRIVILEGED) = getuid() != ksheuid || getgid() != getegid();
-
-	/* this to note if monitor is set on command line (see below) */
-	Flag(FMONITOR) = 127;
-	argi = parse_args(argv, OF_CMDLINE, (int *) 0);
-	if (argi < 0)
-		exit(1);
-
-	if (Flag(FCOMMAND)) {
-		s = pushs(SSTRING, ATEMP);
-		if (!(s->start = s->str = argv[argi++]))
-			errorf("-c requires an argument");
-		if (argv[argi])
-			kshname = argv[argi++];
-	} else if (argi < argc && !Flag(FSTDIN)) {
-		s = pushs(SFILE, ATEMP);
-		s->file = argv[argi++];
-		s->u.shf = shf_open(s->file, O_RDONLY, 0, SHF_MAPHI|SHF_CLEXEC);
-		if (s->u.shf == NULL) {
-			exstat = 127; /* POSIX */
-			errorf("%s: %s", s->file, strerror(errno));
-		}
-		kshname = s->file;
-	} else {
-		Flag(FSTDIN) = 1;
-		s = pushs(SSTDIN, ATEMP);
-		s->file = "<stdin>";
-		s->u.shf = shf_fdopen(0, SHF_RD | can_seek(0),
-		    (struct shf *) 0);
-		if (isatty(0) && isatty(2)) {
-			Flag(FTALKING) = Flag(FTALKING_I) = 1;
-			/* The following only if isatty(0) */
-			s->flags |= SF_TTY;
-			s->u.shf->flags |= SHF_INTERRUPT;
-			s->file = (char *) 0;
-		}
-	}
-
-	/* This bizarreness is mandated by POSIX */
-	{
-		struct stat s_stdin;
-
-		if (fstat(0, &s_stdin) >= 0 && S_ISCHR(s_stdin.st_mode) &&
-		    Flag(FTALKING))
-			reset_nonblock(0);
-	}
-
-	/* initialize job control */
-	i = Flag(FMONITOR) != 127;
-	Flag(FMONITOR) = 0;
-	j_init(i);
-#ifdef EDIT
-	/* Do this after j_init(), as tty_fd is not initialized 'til then */
-	if (Flag(FTALKING))
-		x_init();
-#endif
-
-	l = e->loc;
-	l->argv = &argv[argi - 1];
-	l->argc = argc - argi;
-	l->argv[0] = (char *) kshname;
-	getopts_reset(1);
-
-	/* Disable during .profile/ENV reading */
-	restricted = Flag(FRESTRICTED);
-	Flag(FRESTRICTED) = 0;
-	errexit = Flag(FERREXIT);
-	Flag(FERREXIT) = 0;
-
-	/* Do this before profile/$ENV so that if it causes problems in them,
-	 * user will know why things broke.
-	 */
-	if (!current_wd[0] && Flag(FTALKING))
-		warningf(false, "Cannot determine current working directory");
-
-	if (Flag(FLOGIN)) {
-		include(KSH_SYSTEM_PROFILE, 0, (char **) 0, 1);
-		if (!Flag(FPRIVILEGED))
-			include(substitute("$HOME/.profile", 0), 0,
-			    (char **) 0, 1);
-	}
-
-	if (Flag(FPRIVILEGED))
-		include("/etc/suid_profile", 0, (char **) 0, 1);
-	else {
-		char *env_file;
-
-		/* include $ENV */
-		env_file = str_val(global("ENV"));
-
-#ifdef DEFAULT_ENV
-		/* If env isn't set, include default environment */
-		if (env_file == null)
-			env_file = DEFAULT_ENV;
-#endif /* DEFAULT_ENV */
-		env_file = substitute(env_file, DOTILDE);
-		if (*env_file != '\0')
-			include(env_file, 0, (char **) 0, 1);
-	}
-
-	if (is_restricted(argv[0]) || is_restricted(str_val(global("SHELL"))))
-		restricted = 1;
-	if (restricted) {
-		static const char *const restr_com[] = {
-			"typeset", "-r", "PATH",
-			"ENV", "SHELL",
-			(char *) 0
-		};
-		shcomexec((char **) restr_com);
-		/* After typeset command... */
-		Flag(FRESTRICTED) = 1;
-	}
-	if (errexit)
-		Flag(FERREXIT) = 1;
-
-	if (Flag(FTALKING)) {
-		hist_init(s);
-		alarm_init();
-	} else
-		Flag(FTRACKALL) = 1;	/* set after ENV */
-
-	shell(s, true);	/* doesn't return */
-	return 0;
-}
-
-static void
-init_username(void)
-{
-	char *p;
-	struct tbl *vp = global("USER");
-
-	if (vp->flag & ISSET)
-		p = ksheuid == 0 ? "root" : str_val(vp);
-	else
-		p = getlogin();
-
-	strlcpy(username, p != NULL ? p : "?", sizeof username);
-}
-
-int
-include(const char *name, int argc, char **argv, int intr_ok)
-{
-	Source *volatile s = NULL;
-	struct shf *shf;
-	char **volatile old_argv;
-	volatile int old_argc;
-	int i;
-
-	shf = shf_open(name, O_RDONLY, 0, SHF_MAPHI|SHF_CLEXEC);
-	if (shf == NULL)
-		return -1;
-
-	if (argv) {
-		old_argv = e->loc->argv;
-		old_argc = e->loc->argc;
-	} else {
-		old_argv = (char **) 0;
-		old_argc = 0;
-	}
-	newenv(E_INCL);
-	i = sigsetjmp(e->jbuf, 0);
-	if (i) {
-		quitenv(s ? s->u.shf : NULL);
-		if (old_argv) {
-			e->loc->argv = old_argv;
-			e->loc->argc = old_argc;
-		}
-		switch (i) {
-		case LRETURN:
-		case LERROR:
-			return exstat & 0xff; /* see below */
-		case LINTR:
-			/* intr_ok is set if we are including .profile or $ENV.
-			 * If user ^C's out, we don't want to kill the shell...
-			 */
-			if (intr_ok && (exstat - 128) != SIGTERM)
-				return 1;
-			/* FALLTHROUGH */
-		case LEXIT:
-		case LLEAVE:
-		case LSHELL:
-			unwind(i);
-			/* NOTREACHED */
-		default:
-			internal_errorf(1, "include: %d", i);
-			/* NOTREACHED */
-		}
-	}
-	if (argv) {
-		e->loc->argv = argv;
-		e->loc->argc = argc;
-	}
-	s = pushs(SFILE, ATEMP);
-	s->u.shf = shf;
-	s->file = str_save(name, ATEMP);
-	i = shell(s, false);
-	quitenv(s->u.shf);
-	if (old_argv) {
-		e->loc->argv = old_argv;
-		e->loc->argc = old_argc;
-	}
-	return i & 0xff;	/* & 0xff to ensure value not -1 */
-}
-
-int
-command(const char *comm)
-{
-	Source *s;
-
-	s = pushs(SSTRING, ATEMP);
-	s->start = s->str = comm;
-	return shell(s, false);
-}
-
-/*
- * run the commands from the input source, returning status.
- */
-int
-shell(Source *volatile s, volatile int toplevel)
-{
-	struct op *t;
-	volatile int wastty = s->flags & SF_TTY;
-	volatile int attempts = 13;
-	volatile int interactive = Flag(FTALKING) && toplevel;
-	Source *volatile old_source = source;
-	int i;
-
-	newenv(E_PARSE);
-	if (interactive)
-		really_exit = 0;
-	i = sigsetjmp(e->jbuf, 0);
-	if (i) {
-		switch (i) {
-		case LINTR: /* we get here if SIGINT not caught or ignored */
-		case LERROR:
-		case LSHELL:
-			if (interactive) {
-				if (i == LINTR)
-					shellf(newline);
-				/* Reset any eof that was read as part of a
-				 * multiline command.
-				 */
-				if (Flag(FIGNOREEOF) && s->type == SEOF &&
-				    wastty)
-					s->type = SSTDIN;
-				/* Used by exit command to get back to
-				 * top level shell.  Kind of strange since
-				 * interactive is set if we are reading from
-				 * a tty, but to have stopped jobs, one only
-				 * needs FMONITOR set (not FTALKING/SF_TTY)...
-				 */
-				/* toss any input we have so far */
-				s->start = s->str = null;
-				break;
-			}
-			/* FALLTHROUGH */
-		case LEXIT:
-		case LLEAVE:
-		case LRETURN:
-			source = old_source;
-			quitenv(NULL);
-			unwind(i);	/* keep on going */
-			/* NOTREACHED */
-		default:
-			source = old_source;
-			quitenv(NULL);
-			internal_errorf(1, "shell: %d", i);
-			/* NOTREACHED */
-		}
-	}
-
-	while (1) {
-		if (trap)
-			runtraps(0);
-
-		if (s->next == NULL) {
-			if (Flag(FVERBOSE))
-				s->flags |= SF_ECHO;
-			else
-				s->flags &= ~SF_ECHO;
-		}
-
-		if (interactive) {
-			j_notify();
-			mcheck();
-			set_prompt(PS1, s);
-		}
-
-		t = compile(s);
-		if (t != NULL && t->type == TEOF) {
-			if (wastty && Flag(FIGNOREEOF) && --attempts > 0) {
-				shellf("Use `exit' to leave ksh\n");
-				s->type = SSTDIN;
-			} else if (wastty && !really_exit &&
-			    j_stopped_running()) {
-				really_exit = 1;
-				s->type = SSTDIN;
-			} else {
-				/* this for POSIX, which says EXIT traps
-				 * shall be taken in the environment
-				 * immediately after the last command
-				 * executed.
-				 */
-				if (toplevel)
-					unwind(LEXIT);
-				break;
-			}
-		}
-
-		if (t && (!Flag(FNOEXEC) || (s->flags & SF_TTY)))
-			exstat = execute(t, 0);
-
-		if (t != NULL && t->type != TEOF && interactive && really_exit)
-			really_exit = 0;
-
-		reclaim();
-	}
-	quitenv(NULL);
-	source = old_source;
-	return exstat;
-}
-
-/* return to closest error handler or shell(), exit if none found */
-void
-unwind(int i)
-{
-	/* ordering for EXIT vs ERR is a bit odd (this is what at&t ksh does) */
-	if (i == LEXIT || (Flag(FERREXIT) && (i == LERROR || i == LINTR) &&
-	    sigtraps[SIGEXIT_].trap)) {
-		runtrap(&sigtraps[SIGEXIT_]);
-		i = LLEAVE;
-	} else if (Flag(FERREXIT) && (i == LERROR || i == LINTR)) {
-		runtrap(&sigtraps[SIGERR_]);
-		i = LLEAVE;
-	}
-	while (1) {
-		switch (e->type) {
-		case E_PARSE:
-		case E_FUNC:
-		case E_INCL:
-		case E_LOOP:
-		case E_ERRH:
-			siglongjmp(e->jbuf, i);
-			/* NOTREACHED */
-
-		case E_NONE:
-			if (i == LINTR)
-				e->flags |= EF_FAKE_SIGDIE;
-			/* FALLTHROUGH */
-
-		default:
-			quitenv(NULL);
-		}
-	}
-}
-
-void
-newenv(int type)
-{
-	struct env *ep;
-
-	ep = (struct env *) alloc(sizeof(*ep), ATEMP);
-	ep->type = type;
-	ep->flags = 0;
-	ainit(&ep->area);
-	ep->loc = e->loc;
-	ep->savefd = NULL;
-	ep->oenv = e;
-	ep->temps = NULL;
-	e = ep;
-}
-
-void
-quitenv(struct shf *shf)
-{
-	struct env *ep = e;
-	int fd;
-
-	if (ep->oenv && ep->oenv->loc != ep->loc)
-		popblock();
-	if (ep->savefd != NULL) {
-		for (fd = 0; fd < NUFILE; fd++)
-			/* if ep->savefd[fd] < 0, means fd was closed */
-			if (ep->savefd[fd])
-				restfd(fd, ep->savefd[fd]);
-		if (ep->savefd[2]) /* Clear any write errors */
-			shf_reopen(2, SHF_WR, shl_out);
-	}
-
-	/* Bottom of the stack.
-	 * Either main shell is exiting or cleanup_parents_env() was called.
-	 */
-	if (ep->oenv == NULL) {
-		if (ep->type == E_NONE) {	/* Main shell exiting? */
-			if (Flag(FTALKING))
-				hist_finish();
-			j_exit();
-			if (ep->flags & EF_FAKE_SIGDIE) {
-				int sig = exstat - 128;
-
-				/* ham up our death a bit (at&t ksh
-				 * only seems to do this for SIGTERM)
-				 * Don't do it for SIGQUIT, since we'd
-				 * dump a core..
-				 */
-				if ((sig == SIGINT || sig == SIGTERM) &&
-				    getpgrp() == kshpid) {
-					setsig(&sigtraps[sig], SIG_DFL,
-					    SS_RESTORE_CURR|SS_FORCE);
-					kill(0, sig);
-				}
-			}
-		}
-		if (shf)
-			shf_close(shf);
-		reclaim();
-		exit(exstat);
-	}
-	if (shf)
-		shf_close(shf);
-	reclaim();
-
-	e = e->oenv;
-	afree(ep, ATEMP);
-}
-
-/* Called after a fork to cleanup stuff left over from parents environment */
-void
-cleanup_parents_env(void)
-{
-	struct env *ep;
-	int fd;
-
-	/* Don't clean up temporary files - parent will probably need them.
-	 * Also, can't easily reclaim memory since variables, etc. could be
-	 * anywhere.
-	 */
-
-	/* close all file descriptors hiding in savefd */
-	for (ep = e; ep; ep = ep->oenv) {
-		if (ep->savefd) {
-			for (fd = 0; fd < NUFILE; fd++)
-				if (ep->savefd[fd] > 0)
-					close(ep->savefd[fd]);
-			afree(ep->savefd, &ep->area);
-			ep->savefd = (short *) 0;
-		}
-	}
-	e->oenv = (struct env *) 0;
-}
-
-/* Called just before an execve cleanup stuff temporary files */
-void
-cleanup_proc_env(void)
-{
-	struct env *ep;
-
-	for (ep = e; ep; ep = ep->oenv)
-		remove_temps(ep->temps);
-}
-
-/* remove temp files and free ATEMP Area */
-static void
-reclaim(void)
-{
-	remove_temps(e->temps);
-	e->temps = NULL;
-	afreeall(&e->area);
-}
-
-static void
-remove_temps(struct temp *tp)
-{
-
-	for (; tp != NULL; tp = tp->next)
-		if (tp->pid == procpid) {
-			unlink(tp->name);
-		}
-}
-
-/* Returns true if name refers to a restricted shell */
-static int
-is_restricted(char *name)
-{
-	char *p;
-
-	if ((p = strrchr(name, '/')))
-		name = p;
-	/* accepts rsh, rksh, rpdksh, pdrksh, etc. */
-	return (p = strchr(name, 'r')) && strstr(p, "sh");
-}
--- bin/ksh/tty.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* $MidnightBSD: src/bin/ksh/tty.c,v 1.2 2007/07/26 20:13:00 laffer1 Exp $ */
-/*	$OpenBSD: tty.c,v 1.9 2006/03/14 22:08:01 deraadt Exp $	*/
-
-#include "sh.h"
-#include <sys/stat.h>
-#define EXTERN
-#include "tty.h"
-#undef EXTERN
-
-/* Initialize tty_fd.  Used for saving/reseting tty modes upon
- * foreground job completion and for setting up tty process group.
- */
-void
-tty_init(int init_ttystate)
-{
-	int	do_close = 1;
-	int	tfd;
-
-	if (tty_fd >= 0) {
-		close(tty_fd);
-		tty_fd = -1;
-	}
-	tty_devtty = 1;
-
-	if ((tfd = open("/dev/tty", O_RDWR, 0)) < 0) {
-		tty_devtty = 0;
-		warningf(false, "No controlling tty (open /dev/tty: %s)",
-		    strerror(errno));
-	}
-
-	if (tfd < 0) {
-		do_close = 0;
-		if (isatty(0))
-			tfd = 0;
-		else if (isatty(2))
-			tfd = 2;
-		else {
-			warningf(false, "Can't find tty file descriptor");
-			return;
-		}
-	}
-	if ((tty_fd = fcntl(tfd, F_DUPFD, FDBASE)) < 0) {
-		warningf(false, "j_ttyinit: dup of tty fd failed: %s",
-		    strerror(errno));
-	} else if (fcntl(tty_fd, F_SETFD, FD_CLOEXEC) < 0) {
-		warningf(false, "j_ttyinit: can't set close-on-exec flag: %s",
-		    strerror(errno));
-		close(tty_fd);
-		tty_fd = -1;
-	} else if (init_ttystate)
-		tcgetattr(tty_fd, &tty_state);
-	if (do_close)
-		close(tfd);
-}
-
-void
-tty_close(void)
-{
-	if (tty_fd >= 0) {
-		close(tty_fd);
-		tty_fd = -1;
-	}
-}
--- bin/ksh/proto.h
+++ /dev/null
@@ -1,267 +0,0 @@
-/* $MidnightBSD: src/bin/ksh/proto.h,v 1.2 2007/07/26 20:13:00 laffer1 Exp $ */
-/*	$OpenBSD: proto.h,v 1.30 2006/03/17 16:30:13 millert Exp $	*/
-
-/*
- * prototypes for PD-KSH
- * originally generated using "cproto.c 3.5 92/04/11 19:28:01 cthuang "
- * $From: proto.h,v 1.3 1994/05/19 18:32:40 michael Exp michael $
- */
-
-/* alloc.c */
-Area *	ainit(Area *);
-void	afreeall(Area *);
-void *	alloc(size_t, Area *);
-void *	aresize(void *, size_t, Area *);
-void	afree(void *, Area *);
-/* c_ksh.c */
-int	c_hash(char **);
-int	c_cd(char **);
-int	c_pwd(char **);
-int	c_print(char **);
-int	c_whence(char **);
-int	c_command(char **);
-int	c_typeset(char **);
-int	c_alias(char **);
-int	c_unalias(char **);
-int	c_let(char **);
-int	c_jobs(char **);
-int	c_fgbg(char **);
-int	c_kill(char **);
-void	getopts_reset(int);
-int	c_getopts(char **);
-int	c_bind(char **);
-/* c_sh.c */
-int	c_label(char **);
-int	c_shift(char **);
-int	c_umask(char **);
-int	c_dot(char **);
-int	c_wait(char **);
-int	c_read(char **);
-int	c_eval(char **);
-int	c_trap(char **);
-int	c_brkcont(char **);
-int	c_exitreturn(char **);
-int	c_set(char **);
-int	c_unset(char **);
-int	c_ulimit(char **);
-int	c_times(char **);
-int	timex(struct op *, int);
-void	timex_hook(struct op *, char ** volatile *);
-int	c_exec(char **);
-int	c_builtin(char **);
-/* c_test.c */
-int	c_test(char **);
-/* edit.c: most prototypes in edit.h */
-void	x_init(void);
-int	x_read(char *, size_t);
-void	set_editmode(const char *);
-/* emacs.c: most prototypes in edit.h */
-int	x_bind(const char *, const char *, int, int);
-/* eval.c */
-char *	substitute(const char *, int);
-char **	eval(char **, int);
-char *	evalstr(char *cp, int);
-char *	evalonestr(char *cp, int);
-char	*debunk(char *, const char *, size_t);
-void	expand(char *, XPtrV *, int);
-int	glob_str(char *, XPtrV *, int);
-/* exec.c */
-int	execute(struct op * volatile, volatile int);
-int	shcomexec(char **);
-struct tbl * findfunc(const char *, unsigned int, int);
-int	define(const char *, struct op *);
-void	builtin(const char *, int (*)(char **));
-struct tbl *	findcom(const char *, int);
-void	flushcom(int);
-char *	search(const char *, const char *, int, int *);
-int	search_access(const char *, int, int *);
-int	pr_menu(char *const *);
-int	pr_list(char *const *);
-/* expr.c */
-int	evaluate(const char *, long *, int, bool);
-int	v_evaluate(struct tbl *, const char *, volatile int, bool);
-/* history.c */
-void	init_histvec(void);
-void	hist_init(Source *);
-void	hist_finish(void);
-void	histsave(int, const char *, int);
-#ifdef HISTORY
-int	c_fc(char **);
-void	sethistsize(int);
-void	sethistfile(const char *);
-char **	histpos(void);
-int	histnum(int);
-int	findhist(int, int, const char *, int);
-int	findhistrel(const char *);
-char  **hist_get_newest(int);
-
-#endif /* HISTORY */
-/* io.c */
-void	errorf(const char *, ...)
-	    __attribute__((__noreturn__, __format__ (printf, 1, 2)));
-void	warningf(int, const char *, ...)
-	    __attribute__((__format__ (printf, 2, 3)));
-void	bi_errorf(const char *, ...)
-	    __attribute__((__format__ (printf, 1, 2)));
-void	internal_errorf(int, const char *, ...)
-	    __attribute__((__format__ (printf, 2, 3)));
-void	error_prefix(int);
-void	shellf(const char *, ...)
-	    __attribute__((__format__ (printf, 1, 2)));
-void	shprintf(const char *, ...)
-	    __attribute__((__format__ (printf, 1, 2)));
-#ifdef KSH_DEBUG
-void	kshdebug_init_(void);
-void	kshdebug_printf_(const char *, ...)
-	    __attribute__((__format__ (printf, 1, 2)));
-void	kshdebug_dump_(const char *, const void *, int);
-#endif /* KSH_DEBUG */
-int	can_seek(int);
-void	initio(void);
-int	ksh_dup2(int, int, int);
-int	savefd(int);
-void	restfd(int, int);
-void	openpipe(int *);
-void	closepipe(int *);
-int	check_fd(char *, int, const char **);
-void	coproc_init(void);
-void	coproc_read_close(int);
-void	coproc_readw_close(int);
-void	coproc_write_close(int);
-int	coproc_getfd(int, const char **);
-void	coproc_cleanup(int);
-struct temp *maketemp(Area *, Temp_type, struct temp **);
-/* jobs.c */
-void	j_init(int);
-void	j_exit(void);
-void	j_change(void);
-int	exchild(struct op *, int, int);
-void	startlast(void);
-int	waitlast(void);
-int	waitfor(const char *, int *);
-int	j_kill(const char *, int);
-int	j_resume(const char *, int);
-int	j_jobs(const char *, int, int);
-int	j_njobs(void);
-void	j_notify(void);
-pid_t	j_async(void);
-int	j_stopped_running(void);
-/* lex.c */
-int	yylex(int);
-void	yyerror(const char *, ...)
-	    __attribute__((__noreturn__, __format__ (printf, 1, 2)));
-Source * pushs(int, Area *);
-void	set_prompt(int, Source *);
-void	pprompt(const char *, int);
-/* mail.c */
-void	mcheck(void);
-void	mcset(long);
-void	mbset(char *);
-void	mpset(char *);
-/* main.c */
-int	include(const char *, int, char **, int);
-int	command(const char *);
-int	shell(Source *volatile, int volatile);
-void	unwind(int) __attribute__((__noreturn__));
-void	newenv(int);
-void	quitenv(struct shf *);
-void	cleanup_parents_env(void);
-void	cleanup_proc_env(void);
-/* misc.c */
-void	setctypes(const char *, int);
-void	initctypes(void);
-char *	ulton(unsigned long, int);
-char *	str_save(const char *, Area *);
-char *	str_nsave(const char *, int, Area *);
-int	option(const char *);
-char *	getoptions(void);
-void	change_flag(enum sh_flag, int, int);
-int	parse_args(char **, int, int *);
-int	getn(const char *, int *);
-int	bi_getn(const char *, int *);
-int	gmatch(const char *, const char *, int);
-int	has_globbing(const char *, const char *);
-const unsigned char *pat_scan(const unsigned char *, const unsigned char *,
-    int);
-void	qsortp(void **, size_t, int (*)(void *, void *));
-int	xstrcmp(void *, void *);
-void	ksh_getopt_reset(Getopt *, int);
-int	ksh_getopt(char **, Getopt *, const char *);
-void	print_value_quoted(const char *);
-void	print_columns(struct shf *, int, char *(*)(void *, int, char *, int),
-    void *, int, int prefcol);
-int	strip_nuls(char *, int);
-int	blocking_read(int, char *, int);
-int	reset_nonblock(int);
-char	*ksh_get_wd(char *, int);
-/* mknod.c */
-int domknod(int, char **, mode_t);
-int domkfifo(int, char **, mode_t);
-/* path.c */
-int	make_path(const char *, const char *, char **, XString *, int *);
-void	simplify_path(char *);
-char	*get_phys_path(const char *);
-void	set_current_wd(char *);
-/* syn.c */
-void	initkeywords(void);
-struct op * compile(Source *);
-/* table.c */
-unsigned int	hash(const char *);
-void		ktinit(struct table *, Area *, int);
-struct tbl *	ktsearch(struct table *, const char *, unsigned int);
-struct tbl *	ktenter(struct table *, const char *, unsigned int);
-void		ktdelete(struct tbl *);
-void		ktwalk(struct tstate *, struct table *);
-struct tbl *	ktnext(struct tstate *);
-struct tbl **	ktsort(struct table *);
-/* trace.c */
-/* trap.c */
-void	inittraps(void);
-void	alarm_init(void);
-Trap *	gettrap(const char *, int);
-void	trapsig(int);
-void	intrcheck(void);
-int	fatal_trap_check(void);
-int	trap_pending(void);
-void	runtraps(int intr);
-void	runtrap(Trap *);
-void	cleartraps(void);
-void	restoresigs(void);
-void	settrap(Trap *, char *);
-int	block_pipe(void);
-void	restore_pipe(int);
-int	setsig(Trap *, sig_t, int);
-void	setexecsig(Trap *, int);
-/* tree.c */
-int	fptreef(struct shf *, int, const char *, ...);
-char *	snptreef(char *, int, const char *, ...);
-struct op *	tcopy(struct op *, Area *);
-char *	wdcopy(const char *, Area *);
-char *	wdscan(const char *, int);
-char *	wdstrip(const char *);
-void	tfree(struct op *, Area *);
-/* var.c */
-void	newblock(void);
-void	popblock(void);
-void	initvar(void);
-struct tbl *	global(const char *);
-struct tbl *	local(const char *, bool);
-char *	str_val(struct tbl *);
-long	intval(struct tbl *);
-int	setstr(struct tbl *, const char *, int);
-struct tbl *setint_v(struct tbl *, struct tbl *, bool);
-void	setint(struct tbl *, long);
-int	getint(struct tbl *, long *, bool);
-struct tbl *	typeset(const char *, Tflag, Tflag, int, int);
-void	unset(struct tbl *, int);
-char  * skip_varname(const char *, int);
-char	*skip_wdvarname(const char *, int);
-int	is_wdvarname(const char *, int);
-int	is_wdvarassign(const char *);
-char **	makenv(void);
-void	change_random(void);
-int	array_ref_len(const char *);
-char *	arrayname(const char *);
-void    set_array(const char *, int, char **);
-/* version.c */
-/* vi.c: see edit.h */
--- bin/ksh/history.c
+++ /dev/null
@@ -1,983 +0,0 @@
-/* $MidnightBSD: src/bin/ksh/history.c,v 1.2 2007/07/26 20:13:00 laffer1 Exp $ */
-/*	$OpenBSD: history.c,v 1.35 2006/05/29 18:22:24 otto Exp $	*/
-
-/*
- * command history
- *
- * only implements in-memory history.
- */
-
-/*
- *	This file contains
- *	a)	the original in-memory history  mechanism
- *	b)	a more complicated mechanism done by  pc at hillside.co.uk
- *		that more closely follows the real ksh way of doing
- *		things. You need to have the mmap system call for this
- *		to work on your system
- */
-
-#include "sh.h"
-#include <sys/stat.h>
-
-#ifdef HISTORY
-# include <sys/file.h>
-# include <sys/mman.h>
-
-/*
- *	variables for handling the data file
- */
-static int	histfd;
-static int	hsize;
-
-static int hist_count_lines(unsigned char *, int);
-static int hist_shrink(unsigned char *, int);
-static unsigned char *hist_skip_back(unsigned char *,int *,int);
-static void histload(Source *, unsigned char *, int);
-static void histinsert(Source *, int, unsigned char *);
-static void writehistfile(int, char *);
-static int sprinkle(int);
-
-static int	hist_execute(char *);
-static int	hist_replace(char **, const char *, const char *, int);
-static char   **hist_get(const char *, int, int);
-static char   **hist_get_oldest(void);
-static void	histbackup(void);
-
-static char   **current;	/* current position in history[] */
-static char    *hname;		/* current name of history file */
-static int	hstarted;	/* set after hist_init() called */
-static Source	*hist_source;
-
-
-int
-c_fc(char **wp)
-{
-	struct shf *shf;
-	struct temp *tf = NULL;
-	char *p, *editor = (char *) 0;
-	int gflag = 0, lflag = 0, nflag = 0, sflag = 0, rflag = 0;
-	int optc;
-	char *first = (char *) 0, *last = (char *) 0;
-	char **hfirst, **hlast, **hp;
-
-	if (!Flag(FTALKING_I)) {
-		bi_errorf("history functions not available");
-		return 1;
-	}
-
-	while ((optc = ksh_getopt(wp, &builtin_opt,
-	    "e:glnrs0,1,2,3,4,5,6,7,8,9,")) != -1)
-		switch (optc) {
-		case 'e':
-			p = builtin_opt.optarg;
-			if (strcmp(p, "-") == 0)
-				sflag++;
-			else {
-				size_t len = strlen(p) + 4;
-				editor = str_nsave(p, len, ATEMP);
-				strlcat(editor, " $_", len);
-			}
-			break;
-		case 'g': /* non-at&t ksh */
-			gflag++;
-			break;
-		case 'l':
-			lflag++;
-			break;
-		case 'n':
-			nflag++;
-			break;
-		case 'r':
-			rflag++;
-			break;
-		case 's':	/* posix version of -e - */
-			sflag++;
-			break;
-		  /* kludge city - accept -num as -- -num (kind of) */
-		case '0': case '1': case '2': case '3': case '4':
-		case '5': case '6': case '7': case '8': case '9':
-			p = shf_smprintf("-%c%s",
-					optc, builtin_opt.optarg);
-			if (!first)
-				first = p;
-			else if (!last)
-				last = p;
-			else {
-				bi_errorf("too many arguments");
-				return 1;
-			}
-			break;
-		case '?':
-			return 1;
-		}
-	wp += builtin_opt.optind;
-
-	/* Substitute and execute command */
-	if (sflag) {
-		char *pat = (char *) 0, *rep = (char *) 0;
-
-		if (editor || lflag || nflag || rflag) {
-			bi_errorf("can't use -e, -l, -n, -r with -s (-e -)");
-			return 1;
-		}
-
-		/* Check for pattern replacement argument */
-		if (*wp && **wp && (p = strchr(*wp + 1, '='))) {
-			pat = str_save(*wp, ATEMP);
-			p = pat + (p - *wp);
-			*p++ = '\0';
-			rep = p;
-			wp++;
-		}
-		/* Check for search prefix */
-		if (!first && (first = *wp))
-			wp++;
-		if (last || *wp) {
-			bi_errorf("too many arguments");
-			return 1;
-		}
-
-		hp = first ? hist_get(first, false, false) :
-		    hist_get_newest(false);
-		if (!hp)
-			return 1;
-		return hist_replace(hp, pat, rep, gflag);
-	}
-
-	if (editor && (lflag || nflag)) {
-		bi_errorf("can't use -l, -n with -e");
-		return 1;
-	}
-
-	if (!first && (first = *wp))
-		wp++;
-	if (!last && (last = *wp))
-		wp++;
-	if (*wp) {
-		bi_errorf("too many arguments");
-		return 1;
-	}
-	if (!first) {
-		hfirst = lflag ? hist_get("-16", true, true) :
-		    hist_get_newest(false);
-		if (!hfirst)
-			return 1;
-		/* can't fail if hfirst didn't fail */
-		hlast = hist_get_newest(false);
-	} else {
-		/* POSIX says not an error if first/last out of bounds
-		 * when range is specified; at&t ksh and pdksh allow out of
-		 * bounds for -l as well.
-		 */
-		hfirst = hist_get(first, (lflag || last) ? true : false,
-		    lflag ? true : false);
-		if (!hfirst)
-			return 1;
-		hlast = last ? hist_get(last, true, lflag ? true : false) :
-		    (lflag ? hist_get_newest(false) : hfirst);
-		if (!hlast)
-			return 1;
-	}
-	if (hfirst > hlast) {
-		char **temp;
-
-		temp = hfirst; hfirst = hlast; hlast = temp;
-		rflag = !rflag; /* POSIX */
-	}
-
-	/* List history */
-	if (lflag) {
-		char *s, *t;
-		const char *nfmt = nflag ? "\t" : "%d\t";
-
-		for (hp = rflag ? hlast : hfirst;
-		    hp >= hfirst && hp <= hlast; hp += rflag ? -1 : 1) {
-			shf_fprintf(shl_stdout, nfmt,
-			    hist_source->line - (int) (histptr - hp));
-			/* print multi-line commands correctly */
-			for (s = *hp; (t = strchr(s, '\n')); s = t)
-				shf_fprintf(shl_stdout, "%.*s\t", ++t - s, s);
-			shf_fprintf(shl_stdout, "%s\n", s);
-		}
-		shf_flush(shl_stdout);
-		return 0;
-	}
-
-	/* Run editor on selected lines, then run resulting commands */
-
-	tf = maketemp(ATEMP, TT_HIST_EDIT, &e->temps);
-	if (!(shf = tf->shf)) {
-		bi_errorf("cannot create temp file %s - %s",
-		    tf->name, strerror(errno));
-		return 1;
-	}
-	for (hp = rflag ? hlast : hfirst;
-	    hp >= hfirst && hp <= hlast; hp += rflag ? -1 : 1)
-		shf_fprintf(shf, "%s\n", *hp);
-	if (shf_close(shf) == EOF) {
-		bi_errorf("error writing temporary file - %s", strerror(errno));
-		return 1;
-	}
-
-	/* Ignore setstr errors here (arbitrary) */
-	setstr(local("_", false), tf->name, KSH_RETURN_ERROR);
-
-	/* XXX: source should not get trashed by this.. */
-	{
-		Source *sold = source;
-		int ret;
-
-		ret = command(editor ? editor : "${FCEDIT:-/bin/ed} $_");
-		source = sold;
-		if (ret)
-			return ret;
-	}
-
-	{
-		struct stat statb;
-		XString xs;
-		char *xp;
-		int n;
-
-		if (!(shf = shf_open(tf->name, O_RDONLY, 0, 0))) {
-			bi_errorf("cannot open temp file %s", tf->name);
-			return 1;
-		}
-
-		n = fstat(shf_fileno(shf), &statb) < 0 ? 128 :
-		    statb.st_size + 1;
-		Xinit(xs, xp, n, hist_source->areap);
-		while ((n = shf_read(xp, Xnleft(xs, xp), shf)) > 0) {
-			xp += n;
-			if (Xnleft(xs, xp) <= 0)
-				XcheckN(xs, xp, Xlength(xs, xp));
-		}
-		if (n < 0) {
-			bi_errorf("error reading temp file %s - %s",
-			    tf->name, strerror(shf_errno(shf)));
-			shf_close(shf);
-			return 1;
-		}
-		shf_close(shf);
-		*xp = '\0';
-		strip_nuls(Xstring(xs, xp), Xlength(xs, xp));
-		return hist_execute(Xstring(xs, xp));
-	}
-}
-
-/* Save cmd in history, execute cmd (cmd gets trashed) */
-static int
-hist_execute(char *cmd)
-{
-	Source *sold;
-	int ret;
-	char *p, *q;
-
-	histbackup();
-
-	for (p = cmd; p; p = q) {
-		if ((q = strchr(p, '\n'))) {
-			*q++ = '\0'; /* kill the newline */
-			if (!*q) /* ignore trailing newline */
-				q = (char *) 0;
-		}
-		histsave(++(hist_source->line), p, 1);
-
-		shellf("%s\n", p); /* POSIX doesn't say this is done... */
-		if ((p = q)) /* restore \n (trailing \n not restored) */
-			q[-1] = '\n';
-	}
-
-	/* Commands are executed here instead of pushing them onto the
-	 * input 'cause posix says the redirection and variable assignments
-	 * in
-	 *	X=y fc -e - 42 2> /dev/null
-	 * are to effect the repeated commands environment.
-	 */
-	/* XXX: source should not get trashed by this.. */
-	sold = source;
-	ret = command(cmd);
-	source = sold;
-	return ret;
-}
-
-static int
-hist_replace(char **hp, const char *pat, const char *rep, int global)
-{
-	char *line;
-
-	if (!pat)
-		line = str_save(*hp, ATEMP);
-	else {
-		char *s, *s1;
-		int pat_len = strlen(pat);
-		int rep_len = strlen(rep);
-		int len;
-		XString xs;
-		char *xp;
-		int any_subst = 0;
-
-		Xinit(xs, xp, 128, ATEMP);
-		for (s = *hp; (s1 = strstr(s, pat)) && (!any_subst || global);
-		    s = s1 + pat_len) {
-			any_subst = 1;
-			len = s1 - s;
-			XcheckN(xs, xp, len + rep_len);
-			memcpy(xp, s, len);		/* first part */
-			xp += len;
-			memcpy(xp, rep, rep_len);	/* replacement */
-			xp += rep_len;
-		}
-		if (!any_subst) {
-			bi_errorf("substitution failed");
-			return 1;
-		}
-		len = strlen(s) + 1;
-		XcheckN(xs, xp, len);
-		memcpy(xp, s, len);
-		xp += len;
-		line = Xclose(xs, xp);
-	}
-	return hist_execute(line);
-}
-
-/*
- * get pointer to history given pattern
- * pattern is a number or string
- */
-static char **
-hist_get(const char *str, int approx, int allow_cur)
-{
-	char **hp = (char **) 0;
-	int n;
-
-	if (getn(str, &n)) {
-		hp = histptr + (n < 0 ? n : (n - hist_source->line));
-		if (hp < history) {
-			if (approx)
-				hp = hist_get_oldest();
-			else {
-				bi_errorf("%s: not in history", str);
-				hp = (char **) 0;
-			}
-		} else if (hp > histptr) {
-			if (approx)
-				hp = hist_get_newest(allow_cur);
-			else {
-				bi_errorf("%s: not in history", str);
-				hp = (char **) 0;
-			}
-		} else if (!allow_cur && hp == histptr) {
-			bi_errorf("%s: invalid range", str);
-			hp = (char **) 0;
-		}
-	} else {
-		int anchored = *str == '?' ? (++str, 0) : 1;
-
-		/* the -1 is to avoid the current fc command */
-		n = findhist(histptr - history - 1, 0, str, anchored);
-		if (n < 0) {
-			bi_errorf("%s: not in history", str);
-			hp = (char **) 0;
-		} else
-			hp = &history[n];
-	}
-	return hp;
-}
-
-/* Return a pointer to the newest command in the history */
-char **
-hist_get_newest(int allow_cur)
-{
-	if (histptr < history || (!allow_cur && histptr == history)) {
-		bi_errorf("no history (yet)");
-		return (char **) 0;
-	}
-	if (allow_cur)
-		return histptr;
-	return histptr - 1;
-}
-
-/* Return a pointer to the newest command in the history */
-static char **
-hist_get_oldest(void)
-{
-	if (histptr <= history) {
-		bi_errorf("no history (yet)");
-		return (char **) 0;
-	}
-	return history;
-}
-
-/******************************/
-/* Back up over last histsave */
-/******************************/
-static void
-histbackup(void)
-{
-	static int last_line = -1;
-
-	if (histptr >= history && last_line != hist_source->line) {
-		hist_source->line--;
-		afree((void*)*histptr, APERM);
-		histptr--;
-		last_line = hist_source->line;
-	}
-}
-
-/*
- * Return the current position.
- */
-char **
-histpos(void)
-{
-	return current;
-}
-
-int
-histnum(int n)
-{
-	int	last = histptr - history;
-
-	if (n < 0 || n >= last) {
-		current = histptr;
-		return last;
-	} else {
-		current = &history[n];
-		return n;
-	}
-}
-
-/*
- * This will become unnecessary if hist_get is modified to allow
- * searching from positions other than the end, and in either
- * direction.
- */
-int
-findhist(int start, int fwd, const char *str, int anchored)
-{
-	char	**hp;
-	int	maxhist = histptr - history;
-	int	incr = fwd ? 1 : -1;
-	int	len = strlen(str);
-
-	if (start < 0 || start >= maxhist)
-		start = maxhist;
-
-	hp = &history[start];
-	for (; hp >= history && hp <= histptr; hp += incr)
-		if ((anchored && strncmp(*hp, str, len) == 0) ||
-		    (!anchored && strstr(*hp, str)))
-			return hp - history;
-
-	return -1;
-}
-
-int
-findhistrel(const char *str)
-{
-	int	maxhist = histptr - history;
-	int	start = maxhist - 1;
-	int	rec