Imported from ../bash-2.01.tar.gz.
authorJari Aalto <jari.aalto@cante.net>
Thu, 5 Jun 1997 14:59:13 +0000 (14:59 +0000)
committerJari Aalto <jari.aalto@cante.net>
Sat, 12 Sep 2009 16:46:50 +0000 (16:46 +0000)
304 files changed:
.distribution [deleted file]
.patchlevel [deleted file]
AUTHORS [new file with mode: 0644]
CHANGES
COMPAT
CWRU/PLATFORMS
CWRU/POSIX.NOTES
CWRU/changelog
INSTALL
MANIFEST
Makefile.in
NEWS
NOTES
README
aclocal.m4
alias.c
array.c
bashhist.c
bashhist.h
bashjmp.h
bashline.c
bracecomp.c
braces.c
builtins/Makefile.in
builtins/alias.def
builtins/break.def
builtins/cd.def
builtins/command.def
builtins/common.c
builtins/common.h
builtins/declare.def
builtins/echo.def
builtins/enable.def
builtins/eval.def
builtins/evalfile.c
builtins/evalstring.c
builtins/exec.def
builtins/exit.def
builtins/fc.def
builtins/fg_bg.def
builtins/getopt.c
builtins/getopt.h
builtins/getopts.def
builtins/hash.def
builtins/help.def
builtins/history.def
builtins/jobs.def
builtins/kill.def
builtins/let.def
builtins/mkbuiltins.c
builtins/psize.c
builtins/pushd.def
builtins/read.def
builtins/return.def
builtins/set.def
builtins/setattr.def
builtins/shift.def
builtins/shopt.def
builtins/suspend.def
builtins/trap.def
builtins/type.def
builtins/ulimit.def
builtins/umask.def
builtins/wait.def
command.h
config.h.bot
config.h.in
config.h.top
configure
configure.in
copy_cmd.c
dispose_cmd.c
doc/FAQ
doc/Makefile.in
doc/bash.1
doc/bashref.info
doc/bashref.texi
doc/readline.3
error.c
eval.c
examples/bashdb/bashdb
examples/bashdb/bashdb.fns
examples/bashdb/bashdb.pre
examples/functions/xalias.bash [new file with mode: 0644]
examples/loadables/pushd.c
examples/scripts/spin.bash [new file with mode: 0644]
examples/scripts/vtree2
examples/scripts/vtree3 [new file with mode: 0644]
execute_cmd.c
expr.c
externs.h
flags.c
flags.h
general.c
general.h
getcwd.c
hashcmd.c [new file with mode: 0644]
hashcmd.h [moved from builtins/hashcom.h with 80% similarity]
hashlib.c
hashlib.h
input.h
jobs.c
jobs.h
lib/glob/Makefile.in
lib/glob/fnmatch.c
lib/glob/glob.c
lib/malloc/Makefile.in
lib/malloc/getpagesize.h
lib/malloc/malloc.c
lib/posixheaders/memalloc.h
lib/posixheaders/posixdir.h
lib/posixheaders/posixjmp.h [new file with mode: 0644]
lib/readline/Makefile.in
lib/readline/bind.c
lib/readline/callback.c
lib/readline/complete.c
lib/readline/display.c
lib/readline/doc/Makefile
lib/readline/doc/hstech.texinfo
lib/readline/doc/rltech.texinfo
lib/readline/doc/rluser.texinfo
lib/readline/examples/Makefile
lib/readline/examples/fileman.c
lib/readline/examples/rl.c [new file with mode: 0644]
lib/readline/examples/rltest.c
lib/readline/funmap.c
lib/readline/histexpand.c
lib/readline/histfile.c
lib/readline/history.h
lib/readline/isearch.c
lib/readline/kill.c
lib/readline/nls.c
lib/readline/posixdir.h
lib/readline/posixjmp.h [new file with mode: 0644]
lib/readline/readline.c
lib/readline/readline.h
lib/readline/rldefs.h
lib/readline/rltty.c
lib/readline/rltty.h
lib/readline/search.c
lib/readline/shell.c [new file with mode: 0644]
lib/readline/signals.c
lib/readline/tcap.h
lib/readline/terminal.c
lib/readline/tilde.c
lib/readline/tilde.h
lib/readline/undo.c
lib/readline/util.c
lib/tilde/Makefile.in
lib/tilde/tilde.c
lib/tilde/tilde.h
list.c
mailcheck.c
make_cmd.c
memalloc.h
nojobs.c
oslib.c
parse.y
parser-built
pathexp.c
posixdir.h
posixjmp.h [new file with mode: 0644]
posixwait.h [new file with mode: 0644]
print_cmd.c
shell.c
shell.h
sig.c
sig.h
siglist.c
stringlib.c
subst.c
support/SYMLINKS
support/bashbug.sh
support/config.guess
support/config.sub
support/mkconffiles [new file with mode: 0755]
support/mksignames.c
support/mkversion.c [deleted file]
support/mkversion.sh [new file with mode: 0755]
support/printenv.c [new file with mode: 0644]
support/printenv.sh [moved from support/printenv with 100% similarity]
support/recho.c
support/xenix-link.sh [new file with mode: 0755]
test.c
tests/arith.right
tests/arith.tests
tests/array.right
tests/array.tests
tests/braces-tests
tests/braces.right
tests/builtins.right [new file with mode: 0644]
tests/builtins.sub1 [new file with mode: 0644]
tests/builtins.tests [new file with mode: 0644]
tests/dirstack.right [new file with mode: 0644]
tests/dirstack.tests [new file with mode: 0644]
tests/dollar-star.sh
tests/dollar.right
tests/errors.right [new file with mode: 0644]
tests/errors.tests [new file with mode: 0644]
tests/execscript [new file with mode: 0644]
tests/execscript.right [new file with mode: 0644]
tests/execscript.sub [new file with mode: 0755]
tests/execscript.sub2 [new file with mode: 0644]
tests/execscript.sub3 [new file with mode: 0644]
tests/execscript.sub4 [new file with mode: 0644]
tests/exp-tests
tests/exp.right
tests/func.right [new file with mode: 0644]
tests/func.tests [new file with mode: 0644]
tests/getopts.right [new file with mode: 0644]
tests/getopts.sub1 [moved from tests/misc/gotest with 100% similarity]
tests/getopts.sub2 [new file with mode: 0644]
tests/getopts.sub3 [new file with mode: 0644]
tests/getopts.sub4 [new file with mode: 0644]
tests/getopts.sub5 [new file with mode: 0644]
tests/getopts.sub6 [new file with mode: 0644]
tests/getopts.sub7 [new file with mode: 0644]
tests/getopts.tests [new file with mode: 0644]
tests/glob-test
tests/glob.right
tests/heredoc.right
tests/heredoc.tests
tests/histexpand.right [new file with mode: 0644]
tests/histexpand.tests [new file with mode: 0644]
tests/history.list [new file with mode: 0644]
tests/history.right [new file with mode: 0644]
tests/history.tests [new file with mode: 0644]
tests/jobs.right [new file with mode: 0644]
tests/jobs.tests [new file with mode: 0644]
tests/minus-e [deleted file]
tests/minus-e.right [deleted file]
tests/misc/chld-trap.sh [deleted file]
tests/misc/dot-test-1.sh [deleted file]
tests/misc/dot-test-1.sub [deleted file]
tests/misc/haertel.perftest [new file with mode: 0644]
tests/misc/redir.t3.sh [deleted file]
tests/misc/redir.t3.sub [deleted file]
tests/misc/redir.t4.sh [deleted file]
tests/misc/run.r1.sh [deleted file]
tests/misc/run.r3.sh [deleted file]
tests/misc/test-minus-e.1
tests/misc/test-minus-e.2
tests/new-exp.right
tests/new-exp.sub1 [new file with mode: 0644]
tests/new-exp.tests
tests/nquote.right
tests/nquote.tests
tests/read.right
tests/read.tests
tests/redir.right [new file with mode: 0644]
tests/redir.tests [new file with mode: 0644]
tests/redir1.sub [new file with mode: 0644]
tests/redir2.sub [new file with mode: 0644]
tests/redir3.in1 [new file with mode: 0644]
tests/redir3.in2 [new file with mode: 0644]
tests/redir3.sub [moved from tests/misc/redir.t1.sh with 91% similarity]
tests/redir4.in1 [new file with mode: 0644]
tests/redir4.sub [new file with mode: 0644]
tests/rsh.right [new file with mode: 0644]
tests/rsh.tests [new file with mode: 0644]
tests/run-all
tests/run-builtins [new file with mode: 0644]
tests/run-dirstack [new file with mode: 0644]
tests/run-errors [new file with mode: 0644]
tests/run-execscript [new file with mode: 0644]
tests/run-func [new file with mode: 0644]
tests/run-getopts [new file with mode: 0644]
tests/run-histexpand [new file with mode: 0644]
tests/run-history [new file with mode: 0644]
tests/run-jobs [new file with mode: 0644]
tests/run-minimal [new file with mode: 0644]
tests/run-minus-e [deleted file]
tests/run-redir [new file with mode: 0644]
tests/run-rsh [new file with mode: 0644]
tests/run-test
tests/run-trap [new file with mode: 0644]
tests/run-type [new file with mode: 0644]
tests/set-e-test
tests/set-e.right
tests/source.sub1 [new file with mode: 0644]
tests/source.sub2 [new file with mode: 0644]
tests/source.sub3 [new file with mode: 0644]
tests/source.sub4 [new file with mode: 0644]
tests/test-tests
tests/test.right
tests/tilde-tests
tests/tilde.right
tests/trap.right [new file with mode: 0644]
tests/trap.sub1 [new file with mode: 0755]
tests/trap.tests [new file with mode: 0644]
tests/type.right [new file with mode: 0644]
tests/type.tests [new file with mode: 0644]
tests/varenv.right
tests/varenv.sh
tests/version [new file with mode: 0644]
tests/version.mini [new file with mode: 0644]
trap.c
trap.h
unionwait.h [moved from bashwait.h with 95% similarity]
unwind_prot.c
variables.c
variables.h
xmalloc.c
y.tab.c

diff --git a/.distribution b/.distribution
deleted file mode 100644 (file)
index cd5ac03..0000000
+++ /dev/null
@@ -1 +0,0 @@
-2.0
diff --git a/.patchlevel b/.patchlevel
deleted file mode 100644 (file)
index 573541a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..6035dcf
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,408 @@
+#
+# Master author manifest for bash
+#
+# Any files appearing in the bash distribution not listed in this file
+# were created by Chet Ramey.
+#
+# Filename     authors (first is original author)
+#
+README         Brian Fox, Chet Ramey
+INSTALL                Brian Fox, Chet Ramey
+COPYING                Brian Fox, Chet Ramey
+MANIFEST       Brian Fox, Chet Ramey
+configure      Chet Ramey
+Makefile.in    Brian Fox, Chet Ramey
+configure.in   Chet Ramey
+aclocal.m4     Chet Ramey
+config.h.top   Chet Ramey
+config.h.bot   Chet Ramey
+config.h.in    Chet Ramey
+array.c                Chet Ramey
+print_cmd.c    Brian Fox, Chet Ramey
+general.c      Brian Fox, Chet Ramey
+variables.c    Brian Fox, Chet Ramey
+make_cmd.c     Brian Fox, Chet Ramey
+copy_cmd.c     Brian Fox, Chet Ramey
+unwind_prot.c  Brian Fox, Chet Ramey
+dispose_cmd.c  Brian Fox, Chet Ramey
+getcwd.c       Roland McGrath, Brian Fox, Chet Ramey
+bashhist.c     Chet Ramey
+hash.c         Brian Fox, Chet Ramey
+parse.y                Brian Fox, Chet Ramey
+subst.c                Brian Fox, Chet Ramey
+shell.c                Brian Fox, Chet Ramey
+sig.c          Chet Ramey
+trap.c         Brian Fox, Chet Ramey
+siglist.c      Brian Fox, Chet Ramey
+version.c      Brian Fox, Chet Ramey
+flags.c                Brian Fox, Chet Ramey
+jobs.c         Brian Fox, Chet Ramey
+input.c                Chet Ramey
+mailcheck.c    Brian Fox, Chet Ramey
+pathexp.c      Chet Ramey
+test.c         Brian Fox, Chet Ramey
+expr.c         Chet Ramey, Brian Fox
+alias.c                Brian Fox, Chet Ramey
+execute_cmd.c  Brian Fox, Chet Ramey
+bashline.c     Brian Fox, Chet Ramey
+braces.c       Brian Fox, Chet Ramey
+bracecomp.c    Brian Fox, Chet Ramey, Tom Tromey
+nojobs.c       Brian Fox, Chet Ramey
+vprint.c       Chet Ramey
+oslib.c                Chet Ramey
+error.c                Brian Fox, Chet Ramey
+xmalloc.c      Brian Fox, Chet Ramey
+alias.h                Brian Fox, Chet Ramey
+array.h                Chet Ramey
+builtins.h     Brian Fox, Chet Ramey
+parser.h       Brian Fox, Chet Ramey
+variables.h    Brian Fox, Chet Ramey
+machines.h     Brian Fox, Chet Ramey
+jobs.h         Brian Fox, Chet Ramey
+maxpath.h      Brian Fox, Chet Ramey
+pathexp.h      Chet Ramey
+mailcheck.h    Chet Ramey
+filecntl.h     Brian Fox, Chet Ramey
+hash.h         Brian Fox, Chet Ramey
+quit.h         Brian Fox, Chet Ramey
+flags.h                Brian Fox, Chet Ramey
+shell.h                Brian Fox, Chet Ramey
+bashjmp.h      Chet Ramey
+sig.h          Chet Ramey
+trap.h         Brian Fox, Chet Ramey
+general.h      Brian Fox, Chet Ramey
+unwind_prot.h  Brian Fox, Chet Ramey
+input.h                Brian Fox, Chet Ramey
+error.h                Brian Fox, Chet Ramey
+command.h      Brian Fox, Chet Ramey
+externs.h      Chet Ramey
+siglist.h      Chet Ramey
+subst.h                Brian Fox, Chet Ramey
+dispose_cmd.h  Brian Fox, Chet Ramey
+bashansi.h     Brian Fox, Chet Ramey
+make_cmd.h     Brian Fox, Chet Ramey
+bashhist.h     Chet Ramey
+bashline.h     Chet Ramey
+execute_cmd.h  Chet Ramey
+bashtypes.h    Chet Ramey
+bashtty.h      Chet Ramey
+pathnames.h    Chet Ramey
+y.tab.c                Brian Fox, Chet Ramey
+y.tab.h                Brian Fox, Chet Ramey
+parser-built   Brian Fox, Chet Ramey
+posixstat.h    Brian Fox, Chet Ramey
+stdc.h         Chet Ramey
+ansi_stdlib.h  Brian Fox, Chet Ramey
+memalloc.h     Chet Ramey
+builtins/ChangeLog     Brian Fox, Chet Ramey
+builtins/Makefile.in   Brian Fox, Chet Ramey
+builtins/alias.def     Brian Fox, Chet Ramey
+builtins/bind.def      Brian Fox, Chet Ramey
+builtins/break.def     Brian Fox, Chet Ramey
+builtins/builtin.def   Brian Fox, Chet Ramey
+builtins/cd.def                Brian Fox, Chet Ramey
+builtins/colon.def     Brian Fox, Chet Ramey
+builtins/command.def   Brian Fox, Chet Ramey
+builtins/common.c      Brian Fox, Chet Ramey
+builtins/declare.def   Brian Fox, Chet Ramey
+builtins/echo.def      Brian Fox, Chet Ramey
+builtins/enable.def    Brian Fox, Chet Ramey
+builtins/eval.def      Brian Fox, Chet Ramey
+builtins/exec.def      Brian Fox, Chet Ramey
+builtins/exit.def      Brian Fox, Chet Ramey
+builtins/fc.def                Brian Fox, Chet Ramey
+builtins/fg_bg.def     Brian Fox, Chet Ramey
+builtins/getopt.c      Roland McGrath, Brian Fox, Chet Ramey
+builtins/getopt.h      Roland McGrath, Brian Fox, Chet Ramey
+builtins/getopts.def   Brian Fox, Chet Ramey
+builtins/hash.def      Brian Fox, Chet Ramey
+builtins/hashcom.h     Brian Fox, Chet Ramey
+builtins/help.def      Brian Fox, Chet Ramey
+builtins/let.def       Chet Ramey, Brian Fox
+builtins/history.def   Brian Fox, Chet Ramey
+builtins/jobs.def      Brian Fox, Chet Ramey
+builtins/kill.def      Brian Fox, Chet Ramey
+builtins/mkbuiltins.c  Brian Fox, Chet Ramey
+builtins/pushd.def     Brian Fox, Chet Ramey
+builtins/read.def      Brian Fox, Chet Ramey
+builtins/reserved.def  Brian Fox, Chet Ramey
+builtins/return.def    Brian Fox, Chet Ramey
+builtins/set.def       Brian Fox, Chet Ramey
+builtins/setattr.def   Brian Fox, Chet Ramey
+builtins/shift.def     Brian Fox, Chet Ramey
+builtins/shopt.def     Chet Ramey
+builtins/source.def    Brian Fox, Chet Ramey
+builtins/suspend.def   Brian Fox, Chet Ramey
+builtins/test.def      Brian Fox, Chet Ramey
+builtins/times.def     Brian Fox, Chet Ramey
+builtins/trap.def      Brian Fox, Chet Ramey
+builtins/type.def      Brian Fox, Chet Ramey
+builtins/ulimit.def    Chet Ramey, Brian Fox
+builtins/umask.def     Brian Fox, Chet Ramey
+builtins/wait.def      Brian Fox, Chet Ramey
+builtins/psize.c       Chet Ramey, Brian Fox
+builtins/psize.sh      Chet Ramey, Brian Fox
+builtins/inlib.def     Chet Ramey
+builtins/bashgetopt.c  Chet Ramey
+builtins/common.h      Chet Ramey
+builtins/bashgetopt.h  Chet Ramey
+lib/doc-support/texindex.c     bug-texinfo@prep.ai.mit.edu, Chet Ramey
+lib/doc-support/Makefile.in    Chet Ramey
+lib/doc-support/getopt.h       Roland McGrath
+lib/doc-support/getopt.c       Roland McGrath
+lib/doc-support/getopt1.c      Roland McGrath
+lib/glob/ChangeLog     Brian Fox, Chet Ramey
+lib/glob/Makefile.in   Brian Fox, Chet Ramey
+lib/glob/fnmatch.c     Roland McGrath, Brian Fox, Chet Ramey
+lib/glob/fnmatch.h     Roland McGrath, Brian Fox, Chet Ramey
+lib/glob/glob.c                Richard Stallman, Roland McGrath, Brian Fox, Chet Ramey
+lib/glob/glob.h                Chet Ramey
+lib/glob/ndir.h                Doug Gwyn, Richard Stallman
+lib/glob/doc/Makefile.in       Brian Fox, Chet Ramey
+lib/glob/doc/glob.texi Brian Fox, Chet Ramey
+lib/malloc/Makefile.in Chet Ramey
+lib/malloc/alloca.c    Doug Gwyn, Richard Stallman, Brian Fox, Chet Ramey
+lib/malloc/getpagesize.h       Brian Fox, Chet Ramey
+lib/malloc/malloc.c    Chris Kingsley, Mike Muuss, Richard Stallman, Brian Fox, Chet Ramey
+lib/malloc/gmalloc.c   Mike Haertel, Roland McGrath
+lib/malloc/stub.c      Chet Ramey
+lib/malloc/i386-alloca.s       Richard Stallman
+lib/malloc/x386-alloca.s       Chip Salzenberg, Richard Stallman
+lib/malloc/xmalloc.c   Brian Fox, Chet Ramey
+lib/posixheaders/posixstat.h   Brian Fox, Chet Ramey
+lib/posixheaders/ansi_stdlib.h Brian Fox, Chet Ramey
+lib/posixheaders/stdc.h        Chet Ramey
+lib/posixheaders/memalloc.h    Chet Ramey
+lib/posixheaders/filecntl.h    Brian Fox, Chet Ramey
+lib/readline/Makefile.in       Brian Fox, Chet Ramey
+lib/readline/COPYING   Brian Fox, Chet Ramey
+lib/readline/ChangeLog Brian Fox, Chet Ramey
+lib/readline/readline.c        Brian Fox, Chet Ramey
+lib/readline/vi_mode.c Brian Fox, Chet Ramey
+lib/readline/emacs_keymap.c    Brian Fox, Chet Ramey
+lib/readline/vi_keymap.c       Brian Fox, Chet Ramey
+lib/readline/funmap.c  Brian Fox, Chet Ramey
+lib/readline/keymaps.c Brian Fox, Chet Ramey
+lib/readline/xmalloc.c Brian Fox, Chet Ramey
+lib/readline/search.c  Brian Fox, Chet Ramey
+lib/readline/isearch.c Brian Fox, Chet Ramey
+lib/readline/parens.c  Brian Fox, Chet Ramey
+lib/readline/rltty.c   Brian Fox, Chet Ramey
+lib/readline/complete.c        Brian Fox, Chet Ramey
+lib/readline/bind.c    Brian Fox, Chet Ramey
+lib/readline/display.c Brian Fox, Chet Ramey
+lib/readline/signals.c Brian Fox, Chet Ramey
+lib/readline/kill.c    Brian Fox, Chet Ramey
+lib/readline/undo.c    Brian Fox, Chet Ramey
+lib/readline/input.c   Brian Fox, Chet Ramey
+lib/readline/macro.c   Brian Fox, Chet Ramey
+lib/readline/util.c    Brian Fox, Chet Ramey
+lib/readline/callback.c        Chet Ramey
+lib/readline/readline.h        Brian Fox, Chet Ramey
+lib/readline/chardefs.h        Brian Fox, Chet Ramey
+lib/readline/keymaps.h Brian Fox, Chet Ramey
+lib/readline/rldefs.h  Brian Fox, Chet Ramey
+lib/readline/posixstat.h       Brian Fox, Chet Ramey
+lib/readline/ansi_stdlib.h     Brian Fox, Chet Ramey
+lib/readline/memalloc.h        Chet Ramey
+lib/readline/rlconf.h  Chet Ramey
+lib/readline/rltty.h   Chet Ramey
+lib/readline/history.c Brian Fox, Chet Ramey
+lib/readline/histexpand.c      Brian Fox, Chet Ramey
+lib/readline/histfile.c        Brian Fox, Chet Ramey
+lib/readline/histsearch.c      Brian Fox, Chet Ramey
+lib/readline/history.h Brian Fox, Chet Ramey
+lib/readline/histlib.h Brian Fox, Chet Ramey
+lib/readline/tilde.c   Brian Fox, Chet Ramey
+lib/readline/tilde.h   Brian Fox, Chet Ramey
+lib/readline/doc/texindex.c    bug-texinfo@prep.ai.mit.edu, Chet Ramey
+lib/readline/doc/Makefile      Brian Fox, Chet Ramey
+lib/readline/doc/rlman.texinfo Brian Fox, Chet Ramey
+lib/readline/doc/rltech.texinfo        Brian Fox, Chet Ramey
+lib/readline/doc/rluser.texinfo        Brian Fox, Chet Ramey
+lib/readline/doc/hist.texinfo  Brian Fox, Chet Ramey
+lib/readline/doc/hstech.texinfo        Brian Fox, Chet Ramey
+lib/readline/doc/hsuser.texinfo        Brian Fox, Chet Ramey
+lib/readline/examples/Makefile Brian Fox
+lib/readline/examples/fileman.c        Brian Fox
+lib/readline/examples/manexamp.c       Brian Fox
+lib/readline/examples/histexamp.c      Brian Fox, Chet Ramey
+lib/readline/examples/rltest.c Brian Fox, Chet Ramey
+lib/readline/examples/Inputrc  Brian Fox, Chet Ramey
+lib/termcap/Makefile.in        David MacKenzie, Chet Ramey
+lib/termcap/termcap.c  David MacKenzie
+lib/termcap/termcap.h  David MacKenzie
+lib/termcap/tparam.c   David MacKenzie
+lib/termcap/version.c  David MacKenzie
+lib/termcap/grot/termcap.info  David MacKenzie
+lib/termcap/grot/termcap.info-1        David MacKenzie
+lib/termcap/grot/termcap.info-2        David MacKenzie
+lib/termcap/grot/termcap.info-3        David MacKenzie
+lib/termcap/grot/termcap.info-4        David MacKenzie
+lib/termcap/grot/NEWS  David MacKenzie
+lib/termcap/grot/INSTALL       David MacKenzie
+lib/termcap/grot/ChangeLog     David MacKenzie
+lib/termcap/grot/texinfo.tex   David MacKenzie
+lib/termcap/grot/termcap.texi  David MacKenzie
+lib/termcap/grot/Makefile.in   David MacKenzie
+lib/termcap/grot/configure     David MacKenzie
+lib/termcap/grot/configure.in  David MacKenzie
+lib/termcap/grot/COPYING       David MacKenzie
+lib/termcap/grot/README        David MacKenzie
+lib/tilde/ChangeLog    Brian Fox, Chet Ramey
+lib/tilde/Makefile.in  Brian Fox, Chet Ramey
+lib/tilde/doc/tilde.texi       Brian Fox, Chet Ramey
+lib/tilde/doc/Makefile Brian Fox, Chet Ramey
+lib/tilde/tilde.c      Brian Fox, Chet Ramey
+lib/tilde/tilde.h      Brian Fox, Chet Ramey
+lib/tilde/memalloc.h   Brian Fox, Chet Ramey
+CWRU/misc/open-files.c Chet Ramey
+CWRU/misc/sigs.c       Chet Ramey
+CWRU/misc/pid.c                Chet Ramey
+CWRU/misc/sigstat.c    Chet Ramey
+CWRU/misc/bison                Chet Ramey
+CWRU/misc/aux-machine-desc     Chet Ramey
+CWRU/PLATFORMS         Chet Ramey
+CWRU/README            Chet Ramey
+CWRU/CWRU.CHANGES.051093       Chet Ramey
+CWRU/POSIX.NOTES       Chet Ramey
+CWRU/CWRU.CHANGES.071193       Chet Ramey
+CWRU/CWRU.CHANGES.090393       Chet Ramey
+doc/Makefile.in                Brian Fox, Chet Ramey
+doc/bash.1             Chet Ramey
+doc/builtins.1         Chet Ramey
+doc/bash.ps            Chet Ramey
+doc/bash.txt           Chet Ramey
+doc/readline.3         Chet Ramey
+doc/readline.ps                Chet Ramey
+doc/readline.txt       Chet Ramey
+doc/texinfo.tex                Richard Stallman
+doc/features.texi      Brian Fox, Chet Ramey
+doc/features.ps                Brian Fox, Chet Ramey
+doc/features.info      Brian Fox, Chet Ramey
+doc/features.dvi       Brian Fox, Chet Ramey
+doc/bash_builtins.1    Chet Ramey
+doc/bash_builtins.ps   Chet Ramey
+doc/bash_builtins.txt  Chet Ramey
+doc/bash_builtins.readme       Chet Ramey
+doc/article.ms         Chet Ramey
+doc/FAQ                        Chet Ramey
+support/cat-s          Brian Fox, Chet Ramey
+support/mksysdefs      Brian Fox, Chet Ramey
+support/mkversion.c    Brian Fox, Chet Ramey
+support/mksignames.c   Brian Fox, Chet Ramey
+support/getcppsyms.c   Brian Fox, Chet Ramey
+support/cppmagic       Brian Fox, Chet Ramey
+support/pagesize.sh    Chet Ramey, Brian Fox
+support/pagesize.c     Chet Ramey, Brian Fox
+support/bash.xbm       Brian Fox
+support/FAQ            Brian Fox
+support/PORTING                Brian Fox
+support/mklinks                Brian Fox
+support/fixlinks       Chet Ramey
+support/mkdirs         Chet Ramey
+support/clone-bash     Chet Ramey
+support/bashbug.sh     Chet Ramey
+support/mkmachtype     Chet Ramey
+support/recho.c                Chet Ramey
+support/config.guess   Per Bothner, Chet Ramey
+support/config.sub     Richard Stallman, Chet Ramey
+support/install.sh     MIT X Consortium (X11R5)
+support/endian.c       Chet Ramey
+support/printenv       Chet Ramey
+examples/precedence-tester     Brian Fox, Chet Ramey
+examples/functions/substr      Brian Fox, Chet Ramey
+examples/functions/kshenv      Chet Ramey
+examples/functions/autoload    Chet Ramey
+examples/functions/csh-compat  Brian Fox, Chet Ramey
+examples/functions/shcat       Chet Ramey
+examples/functions/substr2     Chet Ramey
+examples/functions/term                Chet Ramey
+examples/functions/whatis      Chet Ramey
+examples/functions/whence      Chet Ramey
+examples/functions/func                Chet Ramey
+examples/functions/dirname     Brian Fox, Noah Friedman
+examples/functions/basename    Brian Fox, Noah Friedman
+examples/functions/exitstat    Noah Friedman, Roland McGrath
+examples/functions/external    Noah Friedman
+examples/functions/fact                Brian Fox
+examples/functions/manpage     Tom Tromey
+examples/functions/fstty       Chet Ramey
+examples/functions/jj.bash     Chet Ramey
+examples/functions/notify.bash Chet Ramey
+examples/scripts/shprompt      Chet Ramey
+examples/scripts/adventure.sh  Chet Ramey, Doug Gwyn
+examples/scripts/bcsh.sh       Chris Robertson, Chet Ramey
+examples/startup-files/Bashrc  Brian Fox
+examples/startup-files/Bash_aliases    Brian Fox
+examples/startup-files/Bash_profile    Brian Fox
+examples/startup-files/bash-profile    Brian Fox
+examples/startup-files/bashrc  Chet Ramey
+examples/suncmd.termcap        Brian Fox, Chet Ramey
+examples/alias-conv.sh Brian Fox, Chet Ramey
+tests/README           Chet Ramey
+tests/arith.tests      Chet Ramey
+tests/arith.right      Chet Ramey
+tests/array.tests      Chet Ramey
+tests/array.right      Chet Ramey
+tests/dollar-at.sh      Chet Ramey
+tests/dollar-star.sh    Chet Ramey
+tests/dollar.right      Chet Ramey
+tests/exp-tests        Chet Ramey
+tests/exp.right        Chet Ramey
+tests/glob-test        Chet Ramey
+tests/glob.right        Chet Ramey
+tests/ifs-test-1.sh     Chet Ramey
+tests/ifs-test-2.sh     Chet Ramey
+tests/ifs-test-3.sh     Chet Ramey
+tests/ifs.1.right       Chet Ramey
+tests/ifs.2.right       Chet Ramey
+tests/ifs.3.right       Chet Ramey
+tests/input-line.sh     Chet Ramey
+tests/input-line.sub    Chet Ramey
+tests/input.right       Chet Ramey
+tests/minus-e          Chet Ramey
+tests/minus-e.right     Chet Ramey
+tests/new-exp.tests     Chet Ramey
+tests/new-exp.right     Chet Ramey
+tests/prec.right        Chet Ramey
+tests/precedence        Chet Ramey
+tests/run-all          Chet Ramey
+tests/run-dollars       Chet Ramey
+tests/run-exp-tests     Chet Ramey
+tests/run-glob-test     Chet Ramey
+tests/run-ifs-tests     Chet Ramey
+tests/run-input-test    Chet Ramey
+tests/run-minus-e       Chet Ramey
+tests/run-new-exp       Chet Ramey
+tests/run-precedence    Chet Ramey
+tests/run-set-e-test    Chet Ramey
+tests/run-strip        Chet Ramey
+tests/run-varenv        Chet Ramey
+tests/set-e-test        Chet Ramey
+tests/set-e.right       Chet Ramey
+tests/strip.tests       Chet Ramey
+tests/strip.right       Chet Ramey
+tests/tilde-tests       Chet Ramey
+tests/tilde.right       Chet Ramey
+tests/varenv.right      Chet Ramey
+tests/varenv.sh        Chet Ramey
+tests/misc/chld-trap.sh Chet Ramey
+tests/misc/dot-test-1.sh        Chet Ramey
+tests/misc/dot-test-1.sub       Chet Ramey
+tests/misc/gotest       Chet Ramey
+tests/misc/perf-script  Chet Ramey
+tests/misc/redir.t1.sh  Chet Ramey
+tests/misc/redir.t2.sh  Chet Ramey
+tests/misc/redir.t3.sh  Chet Ramey
+tests/misc/redir.t3.sub Chet Ramey
+tests/misc/redir.t4.sh  Chet Ramey
+tests/misc/run.r1.sh    Chet Ramey
+tests/misc/run.r2.sh    Chet Ramey
+tests/misc/run.r3.sh    Chet Ramey
+tests/misc/sigint.t1.sh Chet Ramey
+tests/misc/sigint.t2.sh Chet Ramey
+tests/misc/sigint.t3.sh Chet Ramey
+tests/misc/sigint.t4.sh Chet Ramey
+tests/misc/test-minus-e.1       Chet Ramey
+tests/misc/test-minus-e.2       Chet Ramey
diff --git a/CHANGES b/CHANGES
index 4f17c9f..a6f7472 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,401 @@
+This document details the changes between this version, bash-2.01-release,
+and the previous version, bash-2.01-beta2.
+
+1.  Changes to Bash
+
+a.  The `distclean' target should remove the `printenv' executable if it
+    has been created.
+
+b.  The test suite was changed slightly to ensure that the error messages
+    are printed in English.
+
+c.  A bug that caused the shell to dump core when a filename containing a
+    `/' was passed to `hash' was fixed.
+
+d.  Pathname canonicalization now leaves a leading `//' intact, as POSIX.1
+    requires.
+
+e.  A memory leak when completing commands was fixed.
+
+f.  A memory leak that occurred when checking the hash table for commands
+    with relative paths was fixed.
+
+------------------------------------------------------------------------------
+This document details the changes between this version, bash-2.01-beta2,
+and the previous version, bash-2.01-beta1.
+
+1.  Changes to Bash
+
+a.  The `ulimit' builtin translates RLIM_INFINITY to the hard limit only if
+    the current (soft) limit is less than or equal to the hard limit.
+
+b.  Fixed a bug that caused the bash emulation of strcasecmp to produce
+    incorrect results.
+
+c.  A bug that caused memory to be freed twice when a trap handler resets
+    the trap more than once was fixed.
+
+d.  A bug that caused machines where sizeof (pointer) > sizeof (int) to
+    fail (and possibly dump core) when trying to unwind-protect a null
+    pointer was fixed.
+
+e.  The startup files should not be run with job control enabled.  This fix
+    allows SIGINT to once again interrupt startup file execution.
+
+f.  Bash should not change the SIGPROF handler if it is set to something
+    other than SIG_DFL.
+
+g.  The completion code that provides bash-specific completions for readline
+    now quotes characters that the readline code would treat as word break
+    characters if they appear in a file name.
+
+h.  The completion code now correctly quotes filenames containing a `!',
+    even if the user attempted to use double quotes when attempting
+    completion.
+
+i.  A bug that caused the shell to dump core when `disown' was called without
+    arguments and there was no current job was fixed.
+
+j.  A construct like $((foo);bar) is now processed as a command substitution
+    rather than as a bad arithmetic substitution.
+
+k.  A couple of bugs that caused `fc' to not obey the `cmdhist' and `lithist'
+    shell options when editing and re-executing a series of commands were
+    fixed.
+
+l.  A fix was made to the grammar -- the list of commands between `do' and
+    `done' in the body of a `for' command should be treated the same as a
+    while loop.
+
+2.  Changes to Readline
+
+a.  A couple of bugs that caused the history search functions to attempt to
+    free a NULL pointer were fixed.
+
+b.  If the C library provides setlocale(3), readline does not need to look
+    at various environment variables to decide whether or not to go into
+    eight-bit mode automatically -- just check whether the current locale
+    is not `C' or `POSIX'.
+
+c.  If the filename completion function finds that a directory was not closed
+    by a previous (interrupted) completion, it closes the directory with
+    closedir().
+
+3.  New Features in Bash
+
+a.  New bindable readline commands:  history-and-alias-expand-line and
+    alias-expand-line.  The code was always in there, there was just no
+    way to execute it.
+
+------------------------------------------------------------------------------
+This document details the changes between this version, bash-2.01-beta1,
+and the previous version, bash-2.01-alpha1.
+
+1.  Changes to Bash
+
+a.  Fixed a problem that could cause file descriptors used for process
+    substitution to conflict with those used explicitly in redirections.
+
+b.  Made it easier to regenerate configure if the user changes configure.in.
+
+c.  ${GROUPS[0]} should always be the primary group, even on systems without
+    multiple groups.
+
+d.  Spelling correction is no longer enabled by default.
+
+e.  Fixes to quoting problems in `bashbug'.
+
+f.  OS-specific configuration changes were made for: Irix 6.
+
+g.  OS-specific code changes were made for: QNX.
+
+h.  A more meaningful message is now printed when the file in /tmp for a
+    here document cannot be created.
+
+i.  Many changes to the shell's variable initialization code to speed
+    non-interactive startup.
+
+j.  Changes to the non-job-control code so that it does not try to open
+    /dev/tty.
+
+k.  The output of `set' and `export' is once again sorted, as POSIX wants.
+
+l.  Fixed a problem caused by a recursive call reparsing the value of
+    $SHELLOPTS.
+
+m.  The tilde code no longer calls getenv() when it's compiled as part of
+    the shell, which should eliminate problems on systems that cannot
+    redefine getenv(), like the NeXT OS.
+
+n.  Fixed a problem that caused `bash -o' or `bash +o' to not list all
+    the shell options.
+
+o.  Fixed `ulimit' to convert RLIM_INFINITY to the appropriate hard limit
+    only if the hard limit is greater than the current (soft) limit.
+
+p.  Fixed a problem that arose when building bash in a different directory
+    than the source and y.tab.[ch] were remade with something other than
+    bison.  This came up most often on NetBSD.
+
+q.  Fixed a problem with completion -- it thought that `pwd`/[TAB] indicated
+    an unfinished command completion (`/), which generated errors.
+
+r.  The bash special tilde expansions (~-, ~+) are now attempted before
+    calling the standard tilde expansion code, which should eliminate the
+    problems people have been seeing with this on Solaris 2.5.1.
+
+s.  Added support for <stdarg.h> to places where it was missing.
+
+t.  Changed the code that reads the output of a command substitution to not
+    go through stdio.  This reduces the memory requirements and is faster.
+
+u.  A number of changes to speed up export environment creation were made.
+
+v.  A number of memory leaks were fixed as the result of running the test
+    scripts through Purify.
+
+w.  Fixed a bug that caused subshells forked to interpret executable
+    scripts without a leading `#!' to not reinitialize the values of
+    the shell options.
+
+2.  Changes to Readline
+
+a.  History library has less `#ifdef SHELL' code -- abstracted stuff out
+    into application-specific function hooks.
+
+b.  Readline no longer calls getenv() if it's compiled as part of the shell,
+    which should eliminate problems on systems that cannot redefine getenv(),
+    like the NeXT OS.
+
+c.  Fixed translation of ESC when `untranslating' macro values.
+
+d.  The region kill operation now fixes the mark if it ends up beyond the
+    boundaries of the line after the region is deleted.
+
+3.  New Features in Bash
+
+a.  New argument for `configure':  `--with-curses'.  This can be used to
+    override the selection of the termcap library on systems where it is
+    deficient.
+
+------------------------------------------------------------------------------
+This document details the changes between this version, bash-2.01-alpha1,
+and the previous version, bash-2.0-release.
+
+1.  Changes to Bash
+
+a.  System-specific configuration changes for: FreeBSD, SunOS4, Irix,
+    MachTen, QNX 4.2, Harris Night Hawk, SunOS5.
+
+b.  System-specific code changes were made for: Linux, 4.4 BSD, QNX 4.2,
+    HP-UX, AIX 4.2.
+
+c.  A bug that caused the exec builtin to fail because the full pathname of
+    the command could not be found was fixed.
+
+d.  The code that performs output redirections is now more resistant to
+    race conditions and possible security exploits.
+
+e.  A bug that caused the shell to dump core when performing pattern
+    substitutions on variable values was fixed.
+
+f.  More hosts are now recognized by the auto-configuration mechanism
+    (OpenBSD, QNX, others).
+
+g.  Assignments to read-only variables that attempt to convert them to
+    arrays are now errors.
+
+h.  A bug that caused shell scripts using array assignments in POSIX mode
+    to exit after the assignment was performed was fixed.
+
+i.  The substring expansion code is now more careful about running off the
+    ends of the expanded variable value.
+
+j.  A bug that caused completion to fail if a backquoted command substitution
+    appeared anywhere on the line was fixed.
+
+k.  The `source' builtin no longer turns off history if it has been enabled
+    in a non-interactive shell.
+
+l.  A bug that caused the shell to crash when `disown' was given a pid
+    instead of a job number was fixed.
+
+m.  The `cd' spelling correction code will not try to change to `.' if no
+    directory entries match a single-character argument.
+
+n.  A bad variable name supplied to `declare', `export', or `readonly' no
+    longer causes a non-interactive shell in POSIX mode to exit.
+
+o.  Some fixes were made to the test suite to handle peculiarities of
+    various Unix versions.
+
+p.  The bash completion code now quotes characters that readline would
+    treat as word breaks for completion but are not shell metacharacters.
+
+q.  Bad options supplied at invocation now cause a usage message to be
+    displayed.
+
+r.  Fixes were made to the code that handles DEBUG traps so that the trap
+    string is not freed inappropriately.
+
+s.  Some changes were made to the bash debugger in examples/bashdb -- it
+    should be closer to working now.
+
+t.  A problem that caused the default filename used for mail checking to be
+    wrong was fixed.
+
+u.  A fix was made to the `echo' builtin so that NUL characters printed with
+    `echo -e' do not cause the output to be truncated.
+
+v.  A fix was made to the job control code so that the shell behaves better
+    when monitor mode is enabled in a non-interactive shell.
+
+w.  Bash no longer catches all of the terminating signals in a non-
+    interactive shell until a trap is set on EXIT, which should result in
+    quicker startup.
+
+x.  A fix was made to the command timing code so that `time' can be used in
+    a loop.
+
+y.  A fix was made to the parser so that `((cmd); cmd2)' is now parsed as
+    a nested subshell rather than strictly as an (errnoeous) arithmetic
+    command.
+
+z.  A fix was made to the globbing code so that it correctly matches quoted
+    filenames beginning with a `.'.
+
+aa. A bug in `fc' that caused some multi-line commands to not be stored as
+    one command in the history when they were re-executed after editing
+    (with `fc -e') was fixed.
+
+bb. The `ulimit' builtin now attempts to catch some classes of integer
+    overflows.
+
+cc. The command-oriented-history code no longer attempts to add `;'
+    inappropriately when a newline appears while reading a $(...) command
+    substitution.
+
+dd. A bug that caused the shell to dump core when `help --' was executed
+    was fixed.
+
+ee. A bug that caused the shell to crash when an unset variable appeared
+    in the body of a here document after `set -u' had been executed was
+    fixed.
+
+ff. Implicit input redirections from /dev/null for asynchronous commands
+    are now handled better.
+
+gg. A bug that caused the shell to fail to compile when configured with
+    `--disable-readline' was fixed.
+
+hh. The globbing code should now be interruptible.
+
+ii. Bash now notices when the `kill' builtin is used to send SIGCONT to a
+    stopped job and adjusts the data structures accordingly, as if `bg' had
+    been executed instead.
+
+jj. A bug that caused the shell to crash when mixing calls to `getopts'
+    and `shift' on the same set of positional parameters was fixed.
+
+kk. The command printing code now preserves the `-p' flag to `time'.
+
+ll. The command printing code now handles here documents better when there
+    are other redirections associated with the command.
+
+mm. The special glibc environment variable (NNN_GNU_nonoption_argv_flags_)
+    is no longer placed into the environment of executed commands -- users
+    of glibc had too many problems with it.
+
+nn. Reorganized the code that generates signames.h.  The signal_names list
+    is now more complete but may be slightly different (SIGABRT is favored
+    over SIGIOT, for example).  The preferred signal names are those
+    listed in the POSIX.2 standard.
+
+oo. `bashbug' now uses a filename shorter than 14 characters for its
+    temporary file, and asks for confirmation before sending the bug
+    report.
+
+pp. A bug that caused TAB completion in vi editing mode to not be turned
+    off when `set -o posix' was executed or back on when `set +o posix'
+    was executed was fixed.
+
+qq. A bug in the brace expansion code that caused brace expansions appearing
+    in new-style $(...) command substitutions to be inappropriately expanded
+    was fixed.
+
+rr. A bug in the readline hook shell-expand-line that could cause memory to
+    be inappropriately freed was fixed.
+
+ss. A bug that caused some arithmetic expressions containing `&&' and `||'
+    to be parsed with the wrong precedence has been fixed.
+
+tt. References to unbound variables after `set -u' has been executed now
+    cause the shell to exit immediately, as they should.
+
+uu. A bug that caused the shell to exit inappropriately when `set -e' had
+    been executed and a command's return status was being inverted with the
+    `!' reserved word was fixed.
+
+vv. A bug that could occasionally cause the shell to crash with a
+    divide-by-zero error when timing a command was fixed.
+
+ww. A bug that caused parameter pattern substitution to leave stray
+    backslashes in the replacement string when the expression is in
+    double quotes was fixed.
+
+xx. The `break' and `continue' builtins now break out of all loops when an
+    invalid count argument is supplied.
+
+yy. Fixed a bug that caused PATH to be set to the empty string if
+    `command -p' is executed with PATH unset.
+
+zz. Fixed `kill -l signum' to print the signal name without the `SIG' prefix,
+    as POSIX specifies.
+
+aaa. Fixed a bug that caused the shell to crash while setting $SHELLOPTS
+     if there were no shell options set.
+
+bbb. Fixed `export -p' and `readonly -p' so that when the shell is in POSIX
+     mode, their output is as POSIX.2 specifies.
+
+ccc. Fixed a bug in `readonly' so that `readonly -a avar=(...)' actually
+     creates an array variable.
+
+ddd. Fixed a bug that prevented `time' from correctly timing background
+     pipelines.
+
+2.  Changes to Readline
+
+a.  A bug that caused an extra newline to be printed when the cursor was on
+    an otherwise empty line was fixed.
+
+b.  An instance of memory being used after it was freed was corrected.
+
+c.  The redisplay code now works when the prompt is longer than the screen
+    width.
+
+d.  `dump-macros' is now a bindable name, as it should have been all along.
+
+e.  Non-printable characters are now expanded when displaying macros and
+    their values.
+
+f.  The `dump-variables' and `dump-macros' commands now output a leading
+    newline if they're called as the result of a key sequence, rather
+    than directly by an application.
+
+3.  New Features in Bash
+
+a.  There is a new builtin array variable: GROUPS, the set of groups to which
+    the user belongs.  This is used by the test suite.
+
+4.  New Features in Readline
+
+a.  If a key sequence bound to `universal-argument' is read while reading a
+    numeric argument started with `universal-argument', it terminates the
+    argument but is otherwise ignored.  This provides a way to insert multiple
+    instances of a digit string, and is how GNU emacs does it.
+
+------------------------------------------------------------------------------
 This document details the changes between this version, bash-2.0-release,
 and the previous version, bash-2.0-beta3.
 
diff --git a/COMPAT b/COMPAT
index af6c127..1cb91f9 100644 (file)
--- a/COMPAT
+++ b/COMPAT
@@ -1,7 +1,7 @@
 This document details the incompatibilites between this version of bash,
-bash-2.0, and the previous version, bash-1.14.  These were discovered
-by alpha and beta testers, so they will likely be encountered by a
-significant number of users.
+bash-2.01, and the previous widely-available version, bash-1.14.  These
+were discovered by alpha and beta testers, so they will likely be
+encountered by a significant number of users. 
 
 1.  Bash now uses a new quoting syntax, $"...", to do locale-specific
     string translation.  Users who have relied on the (undocumented)
@@ -71,8 +71,33 @@ significant number of users.
     command_oriented_history, glob_dot_filenames, allow_null_glob_expansion,
     nolinks, hostname_completion_file, noclobber, no_exit_on_failed_exec, and
     cdable_vars.  Most of them are now implemented with the new `shopt'
-    builtin; others were already implemented by `set'.
+    builtin; others were already implemented by `set'.  Here is a list of
+    correspondences:
+
+       MAIL_WARNING                    shopt mailwarn
+       notify                          set -o notify
+       history_control                 HISTCONTROL
+       command_oriented_history        shopt cmdhist
+       glob_dot_filenames              shopt dotglob
+       allow_null_glob_expansion       shopt nullglob
+       nolinks                         set -o physical
+       hostname_completion_file        HOSTFILE
+       noclobber                       set -o noclobber
+       no_exit_on_failed_exec          shopt execfail
+       cdable_vars                     shopt cdable_vars
+
+8. `ulimit' now sets both hard and soft limits and reports the soft limit
+    by default (when neither -H nor -S is specified).  This is compatible
+    with versions of sh and ksh that implement `ulimit'.  The bash-1.14
+    behavior of, for example,
+
+               ulimit -c 0
+
+    can be obtained with
+
+               ulimit -S -c 0
+
+    It may be useful to define an alias:
+
+               alias ulimit="ulimit -S"
 
-8.  The `ulimit' builtins now sets both hard and soft limits and reports the
-    soft limit by default (when neither -H nor -S is specified).  This is
-    compatible with versions of sh and ksh that implement `ulimit'.
index e479a29..4d2b484 100644 (file)
@@ -6,10 +6,13 @@ By chet:
 SunOS 4.1.4
 SunOS 5.5
 BSDI BSD/OS 2.1
-Motorola SVR3.2
-FreeBSD 2.1.5
+FreeBSD 2.1.7
+NetBSD 1.2
 AIX 4.2
+AIX 4.1.4
 HP/UX 9.05, 10.01, 10.10, 10.20
+Linux 2.0.29 (libc 5.3.12)
+Linux 2.0.4 (libc 5.3.12)
 
 By other testers:
 
index 304289e..af3acbc 100644 (file)
@@ -77,6 +77,9 @@ The following list is what's changed when `POSIX mode' is in effect:
  20. Assignment statements preceding POSIX.2 `special' builtins persist
      in the shell environment after the builtin completes.
 
+ 21. The `export' and `readonly' builtin commands display their output
+     in the format required by POSIX.2.
+
 
 There is other POSIX.2 behavior that Bash does not implement.
 Specifically:
index d09a5b5..331c9e6 100644 (file)
-                                   6/2
-                                   ---
-lib/readline/readline.c
-       - fixed an off-by-one error in the kill ring reallocation code
-         in rl_kill_text
-
-Makefile
-       - replaced instances of /bin/sh with $(SHELL)
+                               12/23/1996
+                               ----------
+[bash-2.0 released]
 
-Makefile, cpp-Makefile, documentation/Makefile
-       - added a working `uninstall' target
+                                  12/27
+                                  -----
+configure.in
+       - don't automatically use GNU malloc on FreeBSD, the builtin one
+         is supposed to be better (but doesn't have the debugging hooks)
 
-[1.14.0 FCS release made available for FTP]
+builtins/exec.def
+       - check that full_pathname(command) doesn't return NULL because of
+         inaccessible parent directories
 
-                                   6/3
-                                   ---
-README
-       - added note about building with gcc, same as in Makefile
+support/config.sub
+       - recognize OpenBSD
 
-documentation/Makefile
-       - some versions of make don't understand `$*' in a regular recipe;
-         replace with features.dvi in the recipe for features.ps
+execute_cmd.c
+       - broke the code that opens a file for output redirection when in
+         noclobber mode out into a separate function: noclobber_open().
+         This tries to avoid race conditions and file replacement between
+         stat(2) and open(2)
 
-                                   6/4
-                                   ---
 subst.c
-       - fix up the calls to string_extract_double_quoted and 
-         string_extract_single_quoted in char_is_quoted so the initial
-         value of the index is *after* the opening quote character
-       - make sure we only return 1 from char_is_quoted if the index
-         into the string after a call to string_extract_double_quoted or
-         string_extract_single_quoted is *greater than* `eindex'
-
-lib/readline/complete.c
-       - change the order and sense of the quoting tests in
-         rl_complete_internal so that the expensive char_is_quoted
-         is only called if `scan' actually is a word break character
+       - make sure pat_subst does not run off the end of its return
+         string when copying the unmatched portion of the input string
 
-shell.c
-       - fixed a typo in the test for a restricted shell
+                                  12/30
+                                  -----
+doc/Makefile.in
+       - don't install readline.3 by default
 
-builtins/exec.def
-       - need to include flags.h
+lib/tilde/tilde.c
+       - removed an unnecessary check for string[i] being non-null in
+         tilde_find_suffix
 
-                                   6/6
-                                   ---
-make_cmd.c
-       - make sure that we don't try to walk down a null command tree
-         in connect_async_list (tickled by `(command &) &')
-       - if a command has the CMD_WANT_SUBSHELL bit set in its flags,
-         don't even try to walk the command tree and move the `&';
-         just connect the command with a null command using `&'
+                                  12/31
+                                  -----
+support/config.{sub,guess}
+       - merged in changes from config.sub in autoconf-2.12 distribution
 
-execute_cmd.c
-       - make sure we don't try to reference a command struct without
-         first checking it (case '&')
+lib/readline/readline.c
+       - in rl_newline, only call _rl_vi_done_inserting and _rl_vi_reset_last
+         if readline is currently in vi mode
 
-                                   6/7
-                                   ---
-machines.h
-       - fix a typo in the NeXT/i386 description; change the NeXT description
-         to #define HAVE_RESOURCE if not already defined rather than putting
-         -DHAVE_RESOURCE into the SYSDEP_CFLAGS
+lib/readline/display.c
+       - corrected a misuse of inv_lbreaks where vis_lbreaks was wanted in
+         the code that decides whether the cursor is at the beginning of
+         an otherwise-empty line
 
-                                   6/9
+                                   1/2
                                    ---
-Makefile
-       - make sure all of the rules that reinvoke `make' have the
-         `-f bash-Makefile' before the assignment statements; some
-         versions of make like it that way
-
-variables.c
-       - make sure that `interactive' is set to 0 before evaluating the
-         string containing an exported function obtained from the
-         environment, so that it does not try to execute PROMPT_COMMAND
-         (this may not be the best fix)
+support/bashbug.sh
+       - fixed a typo, thanks to eggert@twinsun.com
 
-                                  6/13
-                                  ----
-documentation/Makefile
-       - make sure all of the directories exist before trying to install
-         doc files into them
+aclocal.m4
+       - new test, BASH_STRUCT_DIRENT_D_FILENO, testing for d_fileno member
+         of struct dirent
 
-lib/readline/history.c
-       - add a missing O_TRUNC to the open call for writing in
-         history_truncate_file
+configure.in
+       - call BASH_STRUCT_DIRENT_D_FILENO
 
-trap.c
-       - run_interrupt_trap should only try to run the trap command if
-         the value is not IMPOSSIBLE_TRAP_HANDLER
+config.h.in
+       - new #define for STRUCT_DIRENT_HAS_D_FILENO
 
-Makefile
-       - add `realclean'
+lib/posixheaders/posixdir.h
+       - only define d_fileno as d_ino if STRUCT_DIRENT_HAS_D_INO is defined
+         and STRUCT_DIRENT_HAS_D_FILENO is not defined.  This fixed the
+         problem of compiling getcwd.c on SunOS4.1.4 with cc
 
+                                   1/3
+                                   ---
 lib/readline/complete.c
-       - do the same kind of double-quoting a replacement string if the
-         user supplies the opening double quote as we would if we were
-         adding both quotes ourselves
+       - fix a memory-used-after-freed bug reported by Andreas Schwab
 
-variables.c
-       - fixed the variable initialization so that history_control/HISTCONTROL
-         can be inherited from a parent shell
+configure.in
+       - call BASH_CHECK_SOCKLIB only if getpeername is not found in libc
+         (ac_cv_func_getpeername = no)
 
-INSTALL, README, cpp-Makefile, documentation/bash.1, documentation/readline.3
-       - ai.mit.edu -> prep.ai.mit.edu
+                                  1/13
+                                  ----
 
-shell.c
-       - fixed a problem with setting no_line_editing to the result of the
-         check for running inside emacs, thereby losing any value
-         initialized by the `-nolineediting' flag
+builtins/getopt.h
+       - change #define guard to _SH_GETOPT_H to avoid similar guards in
+         /usr/include/getopt.h (Dec OSF/1 4.x, for example)
 
-cpp-Makefile
-       - `make distclean' will now remove the `installed-bash' link
+variables.h
+       - fix assign_array_from_string so that it rejects attempts to assign
+         to readonly variables
 
-print_cmd.c
-       - fixed a problem with undefined variables when HAVE_VARARGS_H is
-         not defined
+subst.c
+       - fix verify_substring_values to handle offsets that are past the
+         end or before the beginning (in the case of a negative offset)
+         of the expanded variable value
 
-                                  6/14
+                                  1/14
                                   ----
-lib/readline/history.c
-       - fixed an error in the csh history expansion code so that the
-         `-y' word designator now expands to `0-y' rather than `1-y'
-
-lib/readline/isearch.c
-       - changed an absolute check for a character falling within the
-         ASCII 32-126 range (printable chars) with checks for CTRL_P
-         and META_CHAR and a check against the value RUBOUT
-       - changed a `break' to a `continue' so that the first non-matching
-         character in the search string does not cause the search to
-         end abruptly
-       - initialize prev_line_found to 0 at the top of rl_search_history
-         to avoid duplicate history lines being saved across searches
-
-lib/readline/rltty.c
-       - consolidated repeated code for setting special characters into
-         `SET_SPECIAL' defines
+bashline.c
+       - fix a problem where any completion after a `cmd` command
+         substitution would inappropriately attempt command completion,
+         even if the previous command substitution was correctly closed
 
-lib/readline/readline.c
-       - include <sys/ioctl.h> if VSTATUS is defined
-       - add bindable command rl_tty_status (unbound by default)
+builtins/evalstring.c
+       - unwind_protect remember_on_history even if the shell is not
+         interactive, since history can now be used in scripts, and
+         `source' will turn off interactive_shell before calling
+         parse_and_execute
 
-lib/readline/funmap.c
-       - assign bindable command name `tty-status' to rl_tty_status
+jobs.c
+       - new function get_job_by_pid(pid, block) to translate a pid to
+         a job number.  The block argument says whether or not to block
+         SIGCHLD
 
-INSTALL
-       - add note about compiling with gcc, same text as README
+jobs.h
+       - new extern declaration for get_job_by_pid
 
-lib/readline/display.c
-       - many changes and tweaks to make redisplay work better when the
-         prompt has invisible characters.  These changes are non-optimal
-         in that the prompt is redrawn more than it needs to be, but
-         things are a hell of a lot better than they were
+builtins/jobs.def
+       - call get_job_by_pid if an argument appears to be a pid rather
+         than a jobspec
 
-                                  6/15
-                                  ----
-documentation/Makefile
-       - make a variable NROFF that people can set to `groff -Tascii' if
-         they don't have real nroff
-       - changed the suffix rules to use $<
+configure.in
+       - configure --without-gnu-malloc automatically on MachTen 4.x
 
-support/bashbug.sh
-       - if rmail doesn't exist or fails, save the bug report in
-         ~/dead.bashbug
+builtins/cd.def
+       - change to mindist() so that a best guess of `.' returns 3,
+         which means not reasonable
 
-execute_cmd.c
-       - in setup_async_signals, only ignore SIGINT and SIGQUIT if job
-         control is not active.  If it is active and the job is restarted,
-         SIGINT remains ignored, and the now-foregrounded job is not
-         interruptible
+lib/posixheaders/memalloc.h
+       - changed hpux_9 to __hpux, since the new config stuff doesn't
+         define hpux_9
 
 subst.c
-       - fixed up a problem with char_is_quoted that caused backslash-
-         escaped characters to cause incorrect results
+       - fix parameter_brace_patsub to handle null patterns (doesn't
+         do anything)
 
-tests/run-dollars, tests/dollar-at.sh, tests/dollar-star.sh
-       - since the error messages produced by `cat' vary, changed `cat'
-         to `recho' and updated the correct answers file
+oslib.c
+       - slight change to bzero replacement
 
-machines.h
-       - fixes to CRAY_STACKSEG_END definitions for different versions of
-         Unicos on the YMP (from Bill Jones)
-       - Motorola SVR4 machines have getcwd() and should not undef
-         HAVE_GETCWD
-       - on hpux 9.x, don't try to link with -lPW if compiling with gcc
-         (for alloca)
+support/bashbug.sh
+       - changed TEMP to be /tmp/bbug.$$ as a sop to systems with 14-char
+         file names
 
-parse.y
-       - an ugly fix for a compiler problem with structure assignment on
-         the cray
+doc/bashref.texi
+       - add note to POSIX Mode section that the output of `set' when
+         invoked without arguments is sorted when in POSIX mode
 
-                                  6/16
+                                  1/15
                                   ----
-builtins/wait.def
-       - replaced a call to sscanf with a validity check using all_digits()
-         and a call to atoi, since a pid_t is not necessarily an int, and
-         the sscanf clobbered the stack frame on systems where it is shorter
-         than an int (e.g., SCO)
+support/recho.c
+       - a couple of changes prompted by a `gcc -Wall'
 
-lib/readline/display.c
-       - since META_CHAR and the other macros only work with unsigned
-         chars, make rl_character_len convert its argument to an unsigned
-         char before testing it
+subst.c
+       - changed ASSIGN_RETURN macro to use the do...while(0) idiom to
+         avoid problems with its multiple statements
 
-documentation/Makefile
-       - use $(INSTALL_DATA) instead of $(CP) to install the man pages and
-         info files
+builtins/setattr.def
+       - a bad identifier given to readonly or export without an assignment
+         statement (e.g. `readonly a[5]') is an error, but not an assignment
+         error (i.e., return EXECUTION_FAILURE rather than EX_BADASSIGN)
 
-cpp-Makefile
-       - use INSTALL_PROGRAM and INSTALL_DATA to install binaries and
-         documentation; pass both values to installs in subdirectories
+tests/{{array,new-exp}.,tilde-}tests
+       - added `set +o posix' at the beginning to disable POSIX mode, which
+         causes some of the tests to fail.  Some systems (e.g. LINUX-FT),
+         set POSIXLY_CORRECT by default
 
-                                  6/18
-                                  ----
-builtins/ulimit.def
-       - compensate for systems which define RLIMIT_OFILE instead of
-         RLIMIT_NOFILE, or don't provide such a compatibility define
-         themselves
+tests/test-tests
+       - added a warning if $UID is 0 to the effect that the test suite
+         should not be run as root
+       - worked around the `noread' and `nowrite' tests failing when run
+         as root
 
-shell.c
-       - make maybe_execute_file check for directories and print an
-         appropriate error message, since it's doing an fstat anyway
+test.c
+       - began removing the remains of the STANDALONE code, since test is
+         included in GNU shellutils
 
-support/mksysdefs
-       - added support for a `-s srcdir' option so it can find
-         cpp-Makefile if ansi-Makefile is to be created
+                                  1/16
+                                  ----
+lib/readline/{readline,display}.c
+       - a couple of slight changes to build on Win95 using djgpp (reported
+         by x-aes@telelogic.se)
 
-Makefile
-       - call mksysdefs with -s $(srcdir)
+Makefile.in
+       - changed TERMCAP_LIBDIR to TERM_LIBDIR, so building the termcap
+         library (if necessary) should work now
 
-jobs.c
-       - add the magic #undef lines to avoid redefinition warnings on
-         SunOS 4 only
+bashline.c
+       - new function: quote_word_break_characters(), to backslash-quote 
+         characters in a filename that the readline completion code would
+         treat as word breaks
+       - change bash_quote_filename to call quote_word_break_characters if
+         the completion quoting style says to use backslashes
+       - add `:' to rl_filename_quote_characters, since it's part of
+         filename_word_break_characters
+
+lib/posixheaders/posixjmp.h
+       - new file, with half of bashjmp.h
+       - posixjmp.h and lib/readline/posixjmp.h are symlinks to this file
 
-                                  6/20
+bashjmp.h
+       - include "posixjmp.h" for possible redefinitions of setjmp/longjmp
+         and procenv_t
+
+                                  1/17
                                   ----
-cpp-Makefile
-       - install `bashbug' with `make install'
+shell.c
+       - bad options now cause the standard shell usage message (a subset
+         of what `bash --help' prints) to be displayed on stderr
 
 trap.c
-       - make sure that `interactive' is set to 0 when running trap
-         commands
-
-builtins/umask.c
-       - fixed typo in usage error message
+       - don't free the trap command for a DEBUG trap in
+         restore_default_signal if SIG_INPROGRESS is set -- there's already
+         a pointer saved to the old value in _run_trap_internal.  This
+         makes bashdb run better, too
 
-subst.c
-       - fix process_substitute to set subshell_environment
-
-jobs.c, nojobs.c
-       - only mess with the terminal settings for an interactive shell
-         that is not in a subshell environment
+examples/bashdb/bashdb.{pre,fns}
+       - a couple of minor fixes; it actually has a chance of working now
 
-                                  6/21
+                                  1/21
                                   ----
-lib/readline/history.h
-       - add extern declaration of history_get
+config.h.in
+       - add a define for <dlfcn.h>, HAVE_DLFCN_H
 
-builtins/fc.def
-       - make history replacement when using `r' or `fc -s' obey the
-         setting of HISTCONTROL
+configure.in
+       - look for <dlfcn.h>, define HAVE_DLFCN_H if found
 
-general.c
-       - in canonicalize_pathname, preserve a double // at the start
-         of an absolute pathname, since that means something special
-         for the network directory system
+builtins/enable.def
+       - include <dlfcn.h> only if HAVE_DLFCN_H is defined
 
-README, INSTALL
-       - updated information about submitting bug reports
+lib/readline/display.c
+       - renamed clear_to_eol to _rl_clear_to_eol and made it global, so
+         other library files (readline.c) can use it
+       - new function _rl_clear_screen, to clear the screen with the right
+         termcap escape sequence
 
-lib/readline/vi_mode.c, lib/readline/isearch.c
-       - make sure unistd.h is included before rldefs.h, if
-         HAVE_UNISTD_H is defined
+lib/readline/readline.c
+       - call _rl_clear_to_eol and _rl_clear_screen instead of using tputs
+       - extern declarations for _rl_clear_to_eol and _rl_clear_screen
 
-                                  6/24
+                                  1/22
                                   ----
-lib/readline/complete.c
-       - add `#' to the list of characters which cause a completed filename
-         to be quoted
+mailcheck.c
+       - fixed a problem in make_default_mailpath() where a slash was not
+         added between the default mail directory and the username
 
-execute_cmd.c
-       - be more careful about closing pipe file descriptors in do_piping;
-         don't want to have `dup2(i, i); close(i);' problem
+                                  1/23
+                                  ----
+stringlib.c
+       - added a fourth parameter to ansicstr: the length of the returned
+         string
 
-lib/readline/{keymaps,readline}.h
-       - include local copies of include files if READLINE_LIBRARY is
-         defined, otherwise include the `official, installed' versions
-         using #include <readline/xxx.h>
+externs.h
+       - changed declaration of ansicstr
 
-lib/readline/*.c
-       - define READLINE_LIBRARY before including any files
-       - include only `local' copies of include files using #include "xxx.h"
-         rather than #include <readline/xxx.h>
+parse.y
+       - changed call to ansicstr -- saves a call to strlen
 
-                                  6/26
-                                  ----
-execute_cmd.c
-       - check for clobbering the bash input stream before closing a file
-         descriptor due to an r_close_this redirection
+builtins/echo.def
+       - changed call to ansicstr
+       - if do_v9 is non-zero, use putchar to output the string instead
+         of printf, since there may be embedded NULL characters
 
-lib/readline/history.c
-       - made history_expand inhibit history expansion if the history
-         expansion char is set to 0
+doc/{bash.1,bashref.texi}, builtins/trap.def
+       - modified the `trap' documentation to make it clearer that trap
+         takes multiple signal specs as arguments
 
-lib/readline/chardefs.h
-       - moved savestring() definition to rldefs.h
-       - changed lowercase_p, uppercase_p, to_lower, to_upper defines to
-         use <ctype.h> macros rather than assume ASCII
+jobs.c, nojobs.c, jobs.h
+       - renamed initialize_jobs to initialize_job_control, added an
+         argument (force)
 
-lib/readline/bind.c, general.c, general.h
-       - use strcasecmp, strncasecmp instead of str[n]icmp if
-         HAVE_STRCASECMP is defined
+jobs.c
+       - set shell_tty to fileno(stderr) in initialize_job_control if
+         the shell is not interactive.  This fixes the problem of bad
+         tty pgrps when monitor mode is turned on in a non-interactive
+         shell
 
-cpp-Makefile
-       - pass -DHAVE_STRCASECMP to builds in the libraries, primarily
-         readline
+sig.c
+       - made initialize_terminating_signals do only that; moved the rest
+         of the code that used to be there into a new function:
+         initialize_shell_signals, which calls initialize_terminating_signals
+         if the shell is interactive
+       - initialize_terminating_signals is now extern
+       - made reset_terminating_signals return immediately if
+         termsigs_intitialized is zero, meaning that
+         initialize_terminating_signals has not been called
 
-machines.h
-       - add HAVE_STRCASECMP to the entries for BSD/386, NetBSD, FreeBSD,
-         and 4.4 BSD
+sig.h
+       - new extern declaration for initialize_terminating_signals
 
-builtins/hash.def
-       - add a fourth parameter to remember_filename, the initial value
-         of times_found (0 if we're just looking it up for `hash', 1
-         for the command execution code)
+trap.c
+       - call initialize_terminating_signals from set_signal if sig is
+         EXIT_TRAP and the shell is not interactive.  Since the terminating
+         signals do not need to be initialized until a trap on exit is
+         set, not doing that at startup should result in a speed increase
+         for scripts
 
 execute_cmd.c
-       - call remember_filename with an initial value of 1 for times_found
+       - save and restore command->flags in time_command, so you can use
+         `time command' in a loop
 
-builtins/wait.def
-       - handle a null argument with an error message
-
-builtins/common.c
-       - parse_and_execute now takes a third parameter: the value for
-         `interactive' while it is executing commands
-
-bashline.c, jobs.c, parse.y, shell.c, subst.c, trap.c, variables.c
-       - set the new third argument to parse_and_execute appropriately
+                                  1/24
+                                  ----
+lib/readline/display.c
+       - fix redisplay code to wrap correctly if the prompt is longer than
+         the screen width (reported by bos@Eng.Sun.COM)
 
-builtins/eval.def, builtins/fc.def, builtins/source.def
-       - set the new third argument to parse_and_execute appropriately
+lib/readline/undo.c
+       - don't include <setjmp.h>, it's not needed
+
+lib/readline/{util,readline}.c
+       - include "posixjmp.h" instead of <setjmp.h>
+       - readline_top_level is now a `procenv_t' instead of a `jmp_buf'
+         (now readline uses the correct posix semantics for preserving
+         the signal mask and other things across longjmp)
+
+parse.y
+       - fixes to push_string/pop_string to make them more general -- they
+         now can be used generally, instead of having to be associated
+         with an alias being expanded
+       - fixes to the parser so that it parses (( ls abc; ls def); ls ghi)
+         as a nested subshell command for backwards compatibility.  Broke
+         the double-paren expression parsing off into a new function:
+         parse_arith_cmd, called from read_token when a `((' is seen.  If
+         it looks like an arithmetic command, return `let' and set things
+         up so that the expression is returned as a double-quoted string
+         by the next call to read_token.  If it's a nested subshell, push
+         the text we parsed onto the list of strings for later consumption
+         and return `('
 
-builtins/help.def
-       - changed a call to strnicmp to strncmp when trying to find what
-         to give help on; it seems more correct
+lib/glob/glob.c
+       - fix glob_vector so it doesn't short-circuit checking a filename if
+         it starts with a `.' and the pattern starts with `\.' (if
+         noglob_dot_filenames is set).  This makes `".junk2"*' match
+         `.junk2.txt' correctly
 
-                                  6/27
+                                  1/27
                                   ----
-machines.h
-       - cleaned up the SunOS section so it no longer relies on
-         HAVE_SHARED_LIBS being defined; it uses SunOS4 and SunOS5
-         instead
+support/bashbug.sh
+       - ask for confirmation before sending the bug report
 
-support/mksysdefs
-       - define SYSDEF to be SunOS4 or SunOS5 depending on the output
-         of uname rather than looking for ld.so
+builtins/fc.def
+       - when editing and re-executing a multiline command, make sure
+         current_command_line_count is initialized and then incremented
+         for each line read from the file so that the lines added to
+         the history list by fc_replhist and fc_addhist obey the `lithist'
+         and `cmdhist' shopt options.  Reported by tibbitts@pb.seflin.org
 
-                                  6/29
+                                  1/28
                                   ----
-machines.h
-       - minor change to the ardent titan machine description
-       - move the ardent and stardent descriptions before the
-         mips riscos description
-
-print_cmd.c
-       - ardent machines also need the extern declaration for printf
+lib/readline/readline.h
+       - added a couple of extern declarations for variables described in
+         the documentation but heretofore undeclared
 
-make_cmd.c
-       - connect_async_list should do its work only if the lists to be
-         backgrounded are connected with `;'.  This makes `;' bind tighter
-         than `&', so only the last job in the list is backgrounded.  All
-         other lists should have the entire thing put in the background
+builtins/ulimit.def
+       - try to catch some classes of integer overflows before calling
+         set_limit
 
+                                  1/29
+                                  ----
 parse.y
-       - added a function `print_prompt' to take care of displaying the
-         prompt string if readline is not being used.  This fixes problems
-         with the prompt being displayed before the status of completed
-         jobs is printed
+       - push and pop a `(' delimiter while parsing a $(...) construct, so
+         the history code doesn't try to inappropriately add a `;' when
+         a newline appears in the `...'
 
-                                  6/30
-                                  ----
-builtins/fg_bg.def
-       - `fg' and `bg' now print error messages if invoked when job control
-         is disabled
+aclocal.m4
+       - new macro, BASH_STRUCT_WINSIZE, which looks for `struct winsize'
+         in <sys/ioctl.h> (or one of the files it includes)
 
-lib/readline/rltty.c
-       - if not compiled into the shell, make get_tty_settings get and set
-         the window size.  This noop stops the process if it is started in
-         the background
+configure.in
+       - call BASH_STRUCT_WINSIZE
+       - slightly reorganized the calls to bash-specific macros
 
-lib/readline/readline.c
-       - provide a function version of savestring, if not being compiled
-         into the shell, since the macro has been removed from the
-         `public' header files
+config.h.in
+       - add an `#undef STRUCT_WINSIZE_IN_SYS_IOCTL'
 
-lib/readline/readline.h
-       - provide all extern function declarations without checking whether
-         VI_MODE or PAREN_MATCHING are defined.  It does not hurt to define
-         them if they are not used and not in the library, and other
-         applications using readline can't tell whether or not VI_MODE was
-         defined when the library was compiled anyway
+jobs.c, nojobs.c
+       - only look in sys/ptem.h for struct winsize if
+         STRUCT_WINSIZE_IN_SYS_IOCTL is not defined to cpp
 
-                                   7/1
-                                   ---
-machines.h
-       - add #undef HAVE_DIRENT_H to the ardent titan description
+                                  1/30
+                                  ----
+.{distribution,patchlevel}
+       - renamed to _{distribution,patchlevel}
 
-                                   7/2
-                                   ---
-lib/readline/chardefs.h
-       - removed META_P define, renamed CTRL_P to CTRL_CHAR
+configure.in
+       - create a variable BASHVERS, from the contents of _distribution,
+         and a variable BASHPATCH, from the contents of _patchlevel,
+         (using m4 magic so we don't have to distribute .distribution
+         and .patchlevel) and substitute them into Makefile.in
 
-lib/readline/bind.c, lib/readline/isearch.c
-       - changed instances of CTRL_P to CTRL_CHAR
+Makefile.in
+       - use Version and PatchLevel variables instead of the contents of
+         .distribution and .patchlevel, respectively.  These are set by
+         configure
+       - removed `.machine' from targets and dependencies
 
-lib/readline/search.c
-       - include <unistd.h> before rldefs.h, if HAVE_UNISTD_H is defined
+support/mkversion.sh
+       - new shell script to handle updating version.h, replaces mkversion.c
+         (which is now overkill)
 
-lib/readline/readline.c
-       - declare PC, UP, and BC as extern rather than `local' to the
-         readline library
+support/mkdist
+       - don't bother with writing .distribution and .patchlevel files,
+         since they're no longer distributed
 
-                                   7/5
-                                   ---
-bashline.c
-       - implement command word completion inside of command substitution
-         with a new function: `command_subst_completion_function'
+support/mknewvers.sh
+       - simple bash script to make new version files.  It can increment
+         the major or minor version numbers or patchlevel, or take a
+         completely new version number (e.g., 2.01) as an argument
 
-subst.c
-       - new function to help with command subst completion: unclosed_pair
+doc/Makefile.in
+       - added support for the `install-info' command to update the info
+         directory file after installing bash.info
 
-lib/readline/complete.c
-       - new variable rl_filename_quoting_desired, which can be set to 0
-         to inhibit the quoting of filenames after completion
+                                  1/31
+                                  ----
+builtins/help.def
+       - fix core dump with `help --'
 
-lib/readline/readline.h
-       - declare rl_filename_completion_desired and
-         rl_filename_quoting_desired
+susbt.c
+       - make call_expand_word_internal obey the convention that if
+         expand_word_internal returns &expand_word_{fatal,error}, then
+         w->word has already been freed
+       - return &expand_word_fatal from expand_word_internal if the shell
+         is not interactive and `set -u' has been executed
 
-builtins/bind.def
-       - don't save the old value of rl_outstream before initializing
-         readline -- it saves garbage values and screws up readline
+test.c, general.c
+       - moved group_member from test.c to general.c
 
-parse.y
-       - don't have private state telling whether or not readline has
-         been initialized -- use bash_readline_initialized like other
-         functions in bashline.c
+externs.h, general.h
+       - moved extern declaration of group_member from externs.h to general.h
 
-lib/readline/readline.c
-       - make the default 8-bit behavior be based on whether LC_CTYPE is
-         defined and its value (accept iso-8859-1 or iso_8859_1)
+general.c
+       - broke the code that initializes the group array out into a new
+         function, initialize_group_array()
+       - initialize_group_array() now initializes an array even if the OS
+         does not have getgroups().  If it does not, an array with one
+         element (the real gid) is created
+       - call sysconf(_SC_NGROUPS_MAX) if sysconf is available and
+         _SC_NGROUPS_MAX is defined
+       - new function, char **get_group_list(int *), to return an array
+         of strings made from the groups list
 
-                                   7/6
-                                   ---
 variables.c
-       - fix up the declaration of getenv() for convex machines
+       - new dynamic array variable: GROUPS, expands to the group set as
+         obtained with getgroups() (or whatever initialize_group_array()
+         makes)
 
-                                   7/7
-                                   ---
-lib/readline/readline.c
-       - fixed up typos in the declaration of `savestring'
+doc/{bash.{1,html},bashref.texi}
+       - added description of GROUPS variable
 
-lib/readline/history.c
-       - fixed an off-by-one error in the ADD_CHAR macro which caused one
-         extra character to be overwritten, causing the gnu malloc to abort
-         when that one character was at the end of an allocated block
-       - changed the ADD_STRING macro to avoid some unnecessary xreallocs
+test/test-tests
+       - before modifying the setgid bit on /tmp/setgid, try to change its
+         group to ${GROUPS[0]} 
 
-lib/readline/display.c
-       - fixed a problem with move_cursor_relative -- function now returns
-         immediately if it has nothing to do
-       - fixed another problem with displaying prompts with invisible chars
+                                   2/3
+                                   ---
+aclocal.m4
+       - new autconf macro, BASH_MISC_SPEED_T, to see if speed_t is defined
+         in <sys/types.h>
 
-lib/readline/chardefs.h
-       - fixed the CTRL macro to be right (agree with the BSD kernel, for
-         example)
+configure.in
+       - call BASH_MISC_SPEED_T
 
-cpp-Makefile
-       - fixed typo in the `install' recipe
+config.h.in
+       - add `#undef SPEED_T_IN_SYS_TYPES'
 
-                                   7/8
-                                   ---
-support/srcdir
-       - fixed to handle srcdir when it begins with ./ or ../ to handle
-         $(srcdir) being a relative path better
+lib/readline/tcap.h
+       - include `rltty.h' if HAVE_TERMCAP_H and __linux__ are defined, but
+         SPEED_T_IN_SYS_STYPES is not, before including <termcap.h>
+
+support/mksignames.c, siglist.c
+       - add support for 4.4 BSD SIGLOST
 
-cpp-Makefile
-       - changed some include paths to $(BUILTIN_ABSSRC) when building in
-         `builtins' to handle $(srcdir) being a relative path
-       - change the `chmod' on bashbug to turn on read and execute for all
-       - added a couple of definitions to make it easier for a later
-         `configure' program
+support/config.guess
+       - add support for recognizing QNX based on `uname' output
 
-support/mksysdefs
-       - added a -i option to specify an alternate set of directories to
-         search for include files
+Makefile.in
+       - make sure recho and zecho are compiled with the same set of CC
+         options as the rest of the sources
 
 lib/readline/bind.c
-       - in rl_read_init_file, when skipping whitespace at the start of
-         the line, decrement `i' so that we don't jump past the start
-         of the next line
+       - change calls to rl_generic_bind to cast the third argument to
+         (char *) where necessary
 
-machines.h
-       - SCOv4 has a `robust' opendir that checks that you're actually
-         opening a directory
+command.h
+       - two new flags: CMD_AMPERSAND (currently unused), and CMD_STDIN_REDIR,
+         which means that this command should have its standard input
+         redirected from /dev/null if there are not any explicit redirections
+         to stdin
 
-                                  7/11
-                                  ----
-lib/readline/complete.c
-       - make sure a word break character is unquoted before using it to
-         separate out the current word for completing
+execute_cmd.c
+       - a redirection of type r_inputa_direction is no longer added at the
+         beginning of the redirection chain for an async command;
+         CMD_STDIN_REDIR is set in the flags instead
+       - new function: stdin_redirects: returns the number of redirections to
+         stdin in a chain of redirections
+       - new functions: async_redirect_stdin() to open /dev/null and make it
+         file descriptor 0
+       - changes to make CMD_STDIN_REDIR propagate to all of the necessary
+         functions (like execute_simple_command)
+       - execute_disk command now takes the flags from simple_command rather
+         than just the CMD_NO_FORK flag as its last argument
+       - various places after make_child is executed (in the child) check for
+         CMD_STDIN_REDIRECT (and no stdin redirections or piping) and call
+         async_redirect_stdin
+       - stdin_redir is now global
 
-machines.h
-       - new machine description: NetBSD on motorola m68k machines like
-         the hp300
-       - undef HAVE_GETWD in the generic svr4 machine description, like
-         other svr4 descriptions
+eval.c
+       - set stdin_redir to 0 just before calling execute_command so it
+         gets reset to a known value and doesn't persist across commands
 
-lib/readline/rltty.c
-       - make sure to fflush (rl_outstream) after toggling the setting
-         of the keypad and meta key
+                                   2/4
+                                   ---
+builtins/ulimit.def
+       - add a stub function for ulimit(2) on systems without HAVE_RESOURCE
+         or HAVE_ULIMIT that just sets errno to EINVAL and returns -1 --
+         QNX is one such system
 
-portbash/libc.sh
-       - add a test for OPENDIR_NOT_ROBUST
+bashhist.c
+       - pre_process_line needs to protect all occurrences of hist_verify
+         with #ifdef READLINE
 
-support/getcppsyms.c
-       - output __svr4__ if we find __uxps__ (this makes the Fujitsu port of
-         SVR4 to the sparc build OK)
+builtins/shopt.def
+       - hist_verify needs to be protected with #ifdef READLINE, not
+         #ifdef HISTORY
 
-                                  7/12
-                                  ----
-lib/readline/display.c
-       - more display-related fixes when the prompt has invisible chars;
-         this time for screen updates when moving between screen lines
+                                   2/5
+                                   ---
+support/config.{guess,sub}, configure.in
+       - chages to better support the Harris Night Hawk
 
-lib/readline/readline.c, lib/readline/display.c
-       - changes to make readline work with terminals that have auto-wrap
-         from Per Bothner (new function _rl_update_final, term_xn changes,
-         some efficiency speedups, new function space_to_eol)
+[many files]
+       - changes for things pointed out by gcc -Wall
 
-                                  7/13
-                                  ----
-lib/readline/display.c
-       - after moving up screen lines using term_up in _rl_move_vert, if
-         the new screen line is 0, _rl_last_c_pos needs to be adjusted
-         to take invisible characters into account.  This was the source
-         of many bugs
+lib/glob/Makefile.in
+       - make sure -DSHELL is included in CCFLAGS so that globbing is
+         interruptible
 
-                                  
-                                  7/14
-                                  ----
-documentation/Makefile
-       - change instances of `groff' to `${GROFF}', GROFF is set to
-         `groff' by default
+lib/malloc/malloc.c
+       - extern declaration for botch: if botch is #defined, it should be
+         the name of a void function
 
-general.c, variables.c
-       - moved `qsort_string_compare' from variables.c to general.c
+configure.in,Makefile.in,builtins/Makefile.in,
+lib/{glob,malloc,readline,tilde}/Makefile.in
+       - add a LOCAL_DEFS variable, substituted from configure into the
+         various Makefiles.  It's set to -DSHELL, so that define gets
+         passed to all sub-makes without doing anything special
 
-general.h, variables.h
-       - moved declaration of `qsort_string_compare' from variables.h
-         to general.h
+lib/readline/readline.c
+       - change to rl_digit_loop to make it compatible with GNU emacs:
+         if a key bound to `universal-argument' is read after reading
+         some digits, it terminates the argument but is otherwise
+         ignored.  This is how people can insert repeated digits
 
-alias.c, lib/readline/funmap.c
-       - moved qsort auxiliary functions after their use and added
-         forward declarations to avoid warnings from ANSI C compilers
+doc/{bash.{1,html},readline.3}, lib/readline/doc/rluser.texinfo
+       - changed description of `universal-argument' to describe how
+         to terminate a numeric argument
 
-memalloc.h
-       - hpux_9 needs alloca declared as `extern void *' if __STDC__
-         is defined
+                                   2/6
+                                   ---
+jobs.c
+       - changed kill_pid to diddle the job and process data structures
+         if we're sending SIGCONT to a stopped job with `kill' so that
+         the shell knows the job is running again.  ksh93 does this
 
-support/mksysdefs
-       - removed HAVE_SHARED_LIBS entirely
-       - make a call to /bin/uname -X for SCO machines to avoid running
-         a different uname from the $PATH
+                                   2/7
+                                   ---
+unwind_prot.c
+       - changed bcopy to FASTCOPY
 
-machines.h
-       - new descriptions: Intel i860 running SVR4, Tahoe running 4.3 BSD
-       - changed descriptions: Mips/RiscOS, DG AViiON, unknown machine
+builtins/enable.def
+       - changed pointer arithmetic in delete_builtin to just subtract
+         the head of the builtins list (shell_builtins) from a pointer
+         to the builtin to be deleted (b) to find its index in the list
+         on ANSI C systems
 
-jobs.c
-       - changes to how the shell handles foreground jobs dying of SIGINT:
-               an interactive shell using job control will no longer
-               act as if it received a SIGINT if the foreground job
-               dies from a SIGINT
-
-               a non-interactive shell or shell without job control tries
-               to differentiate between SIGINTs it has seen (in
-               wait_sigint_handler) and a foreground job dying of a SIGINT
-               not sent from the keyboard, and runs the normal SIGINT code
-               only in the former case
-
-                                  7/15
+                                  2/10
                                   ----
-support/mksysdefs
-       - check for ${UNAME}${RELEASE} expanding to `SunOS4*' or `SunOS5*'
-         to set SYSDEF to SunOS4 or SunOS5, respectively.  Apparently
-         this does not work for Solbourne
+lib/readline/bind.c
+       - when using old-style keynames to bind to a new-style macro,
+         pass an array of type (unsigned char *) to rl_macro_bind
+
+builtins/getopt.c
+       - change sh_getopt to return EOF if nextchar is empty or NULL
+         and sh_optind is greater than argc.  This can happen if a
+         script mixes calls to `getopts' with calls to `shift'
 
-                                  7/18
+                                  2/11
                                   ----
+print_cmd.c
+       - fixed make_command_string_internal so that commands with the
+         CMD_TIME_POSIX flag set print `time -p' instead of `time'
+       - changed print_redirection_list so the here documents are
+         printed after all the other redirections, and followed by a
+         newline (rather than a possible semicolon)
+       - added a new variable, was_heredoc, to avoid adding a semicolon
+         at the beginning of an empty line after printing the heredoc
+         ending delimiter
+
+execute_cmd.c
+       - don't put the gnu_argv_flags into the environment any more; it's
+         proven to be a bad idea
 
-lib/readline/rltty.c
-       - if output is being flushed on termios systems, loop until the
-         FLUSHO bit is no longer set in the termios struct
+configure.in
+       - set LOCAL_CFLAGS to `-DSunOS5' on Solaris 5.5[.x]
 
-support/mksysdefs
-       - added a -A flag to force creation of ansi-Makefile
+builtins/echo.def
+       - only call fflush() after printing each word on SunOS 5.5, since
+         that's the system with the bug that prompted its inclusion in
+         the first place
 
-machines.h
-       - new entry for Tandem machines running SVR3
+support/mksignames.c
+       - added support for more system-specific signals from AIX 4.2,
+         changed initialization order so that system-specific signals
+         are done first, before the common signals
 
-                                  7/19
+                                  2/12
                                   ----
-lib/readline/rldefs.h
-       - include <termcap.h> if HAVE_TERMCAP_H is defined
-       - use <termio.h> stuff if HAVE_TERMIO_H is defined and _POSIX_VERSION
-         is not defined
+execute_cmd.c
+       - broke the code that creates a file containing the text of a
+         here document out into a separate function: here_doc_to_fd
+       - create the temp file used for a here document with mode 600
+       - open the temp file used for a here document with O_EXCL
 
-lib/readline/rldefs.h, lib/readline/history.c
-       - include "config.h" if HAVE_CONFIG_H is defined
+shell.h
+       - changed the uid members of struct user_info to be of type uid_t
+         and the gid members to be of type gid_t
 
-lib/readline/{rldefs.h,signals.c,readline.c}
-       - WINSIZE_IN_IOCTL_H -> GWINSZ_IN_SYS_IOCTL for compatibility with
-         other GNU programs
+parse.y
+       - changed the type of the `type' argument to init_yy_io() to be
+         `enum stream_type', since that's what's always passed
 
-lib/readline/doc/Makefile
-       - fixed up to create the readline and history manuals in dvi and
-         ps format
+input.h
+       - changed the function prototype for init_yy_io so the third arg is
+         type `enum stream_type'
 
-lib/readline/Makefile
-       - changes inspired by the standalone readline-2.0 distribution
+externs.h
+       - added a prototype for getcwd, if HAVE_GETCWD is not defined
 
-                                  7/20
-                                  ----
-lib/readline/history.c
-       - new function, history_is_stifled (), returns history_stifled
-       - set history_state flags member in the history state functions
+builtins/umask.def
+       - changed all variables that are used as arguments to or save the
+         return value from umask(2) to be of type mode_t
+       - changed print_symbolic_umask to take an argument of type mode_t
 
-lib/readline/history.h
-       - reorganized the function declarations, added missing declarations
-       - history_stifled is no longer exported by the library
-       - added a `flags' member to the HISTORY_STATE structure
+                                  2/13
+                                  ----
+jobs.c
+       - if old_sigint_handler is set to SIG_DFL, as it will be in a script
+         without a trap on SIGINT installed, call termination_unwind_protect()
+         directly from waitchld()
 
-bashline.c
-       - use history_is_stifled () instead of history_stifled
+                                  2/14
+                                  ----
+configure.in
+       - added a section before the call to BASH_CHECK_LIB_TERMCAP to
+         set a variable prefer_curses on some systems (AIX, for one)
 
-lib/readline/readline.c, lib/readline/vi_mode.c
-       - filled in correct argument declarations for functions called via
-         keymaps (count, key)
+aclocal.m4
+       - in BASH_CHECK_LIB_TERMCAP, don't return -ltermcap if $prefer_curses
+         is non-empty
 
-lib/readline/complete.c
-       - efficiency improvement for compare_strings
+lib/readline/Makefile.in
+       - redid the dependencies
 
-                                  7/21
+                                  2/17
                                   ----
-examples/dirfuncs
-       - new directory functions from ksh book, contributed by
-         Ken Konecki (kenk@wfg.com)
+hashlib.c, getcwd.c
+       - include `bashansi.h' instead of stdlib.h and string.h
 
-machines.h
-       - hpux_8 and hpux_9 should both #undef HAVE_ALLOCA unless gcc is
-         being used
+error.c, siglist.c, xmalloc.c, builtins/{common,evalfile,mkbuiltins,psize}.c,
+builtins/{exec,exit,fg_bg,hash,history}.def
+       - include `bashtypes.h' instead of directly including <sys/types.h> 
 
-                                  7/22
-                                  ----
-bashline.c
-       - fixed up command_word_completion_function so that filenames with
-         leading tildes are completed correctly
+builtins/fc.def
+       - include ../bashtypes.h and ../posixstat.h instead of bashtypes.h
+         and posixstat.h
 
-                                  7/26
-                                  ----
-builtins/read.def
-       - if -r not given, make sure CTLESC is removed from input string
-         when reading \<newline>
+builtins/mkbuiltins.c
+       - include ../posixstat.h instead of <sys/stat.h>
 
-lib/readline/readline.c
-       - new function bind_arrow_keys, which binds vt100/ansi arrow key
-         escape sequences after reading the termcap definition and the
-         inputrc file
-       - new function rl_yank_last_arg, which does what insert-last-arg
-         does in bash
+general.h
+       - include `bashtypes.h' if RLIMTYPE is defined, so we can fetch
+         a definition of quad_t (or whatever) from <sys/types.h> before
+         using it in a function prototype
+
+Makefile.in, builtins/Makefile.in
+       - updated dependencies
 
-lib/readline/emacs_keymap.c
-       - remove default bindings to rl_arrow_keys for M-[ and M-O
-       - rl_yank_last_arg is now bound to `M-.' and `M-_' in
-         emacs_meta_keymap
+                                  2/18
+                                  ----
+builtins/set.def
+       - new function, set_posix_mode, called when `set [-+]o posix'
+         or `shopt -[su] -o posix' is executed.  It sets or unsets
+         $POSIXLY_CORRECT and calls sv_strict_posix
 
 subst.c
-       - when performing process substitution on systems with /dev/fd,
-         make sure the child clears the slot in dev_fd_list it gets
-         from its parent so the file descriptor does not get closed
-         inappropriately if reallocated by, e.g., pipe(2)
+       - in sv_strict_posix, call posix_readline_initialize only if
+         the shell is interactive (interactive_shell != 0)
 
-bashline.c
-       - removed insert_last_arg and the calls to bind in to `M-.' and `M-_'.
-         `insert-last-argument' is now bound to rl_yank_last_arg for
-         backwards compatibility
+shell.c
+       - if we are acting like `sh', call posix_readline_initialize
+         if the shell is interactive
+       - moved the code that does posix.2 mode initialization after
+         interactive_shell is set, and call posix_readline_initialize
+         if interactive_shell is non-zero
 
-lib/readline/funmap.c
-       - `yank-last-arg' is now a named command for rl_yank_last_arg
+bashwait.h
+       - renamed to unionwait.h, since that is what it defines
 
+posixwait.h
+       - moved the POSIX 1003.1 job control defines here from jobs.h
 
-documentation/bash.1, documentation/readline.3
-       - add description of yank-last-arg as one of the readline user
-         commands
+jobs.h
+       - include `posixwait.h'
 
-lib/readline/doc/rluser.texinfo
-       - added description of yank-last-arg
+                                  2/19
+                                  ----
+braces.c
+       - if SHELL is defined, pass the contents of new-style command
+         substitution through without expanding brace constructs between
+         the parens -- let the subshell do it
 
-builtins/getopts.def
-       - fixed a typo in the int-to-string code computing the value to set
-         OPTIND to: had '\0' instead of '0'
-       - made getopts handle the case where there are more than 9 dollar
-         variables (where rest_of_args is non-null) correctly
+subst.c
+       - when brace-expanding words, preserve the flags (word->flags) if
+         brace expansion does not change the word.  This fixes the problem
+         of things like
 
-                                  7/28
-                                  ----
-lib/readline/display.c
-       - fixes to the display code for single-line-display in the presence
-         of prompts containing invisible characters
+                local -a avar=( ${PATH//: } );
 
-lib/readline/readline.c
-       - if we are using horizontal scrolling and we have term_xn, decrement
-         the screenwidth by 1, since we won't be doing any line wrapping
+bashline.c
+       - have shell_expand_line pass a copy of rl_line_buffer to expand_string
+         in case there are substitution errors and the string gets freed
 
-                                  7/31
+                                  2/20
                                   ----
-jobs.c
-       - new variable `freeze_jobs_list' to set when changes to the jobs
-         list or status of jobs in the list (other than calling something
-         like `jobs -n') are undesirable.  This is set when execuing traps
-         on SIGCHLD
+expr.c
+       - make sure that expland and explor set `lasttok' to LAND and LOR,
+         respectively, if they parse `&&' or `||'.  This makes the
+         precedence code work right
 
-                                   8/1
-                                   ---
 subst.c
-       - check that `~' is unquoted before performing tilde expansion in
-         an assignment statement
+       - changes so that non-interactive shells exit immediately when a
+         parameter that is unset is referenced after `set -u' has been
+         executed causes the shell to exit immediately
 
-                                   8/3
-                                   ---
-bracecomp.c
-       - keep brace completion from dumping core if there is only one
-         match
-
-lib/readline/chardefs.h
-       - add a define for digit_p, which returns the value of isdigit()
+                                  2/21
+                                  ----
+flags.c
+       - if `set -r' is executed, call maybe_make_restricted so that $PATH
+         and $SHELL are made read-only
 
-lib/readline/readline.c
-       - added function equivalents for uppercase_p, lowercase_p, to_upper,
-         to_lower, pure_alphabetic, digit_p, and digit_value
-       - replaced calls to numeric () with calls to digit_p, removed
-         definition of numeric ()
-
-lib/readline/history.c
-       - digit -> digit_p
-
-lib/readline/vi_mode.c
-       - replaced uses of the `isletter' define to use pure_alphabetic
-         from chartypes.h
-       - replaced uses of `numeric' with calls to digit_p
-       - added do...while(0) to `exchange' define
-
-                                   
-                                   8/4
-                                   ---
 execute_cmd.c
-       - make sure execute_function saves and restores the current loop
-         count with unwind_protect_int
-
-documentation/features.texi
-       - change the `Shell Command Line Options' section to `Invoking
-         Bash' to be closer to the GNU coding standards
+       - if `set -e' has been executed, and we're inverting a pipeline's
+         return status with `!', set CMD_IGNORE_RETURN so a failing
+         command does not inadvertently cause the shell to exit before
+         the exit status can be inverted.  This is probably only a problem
+         with the `eval' builtin.
 
-                                   8/5
-                                   ---
-builtins/read.def
-       - fixed up a memory leak and made behavior correct when no
-         variables given and backslash escaped at least one input char
-       - if we added CTLESC anywhere while reading the input string,
-         make sure we call dequote_string on each word of the input
-         before calling bind_variable with that string
-
-                                   8/6
-                                   ---
-lib/readline/readline.h
-       - removed definition of rl_show_star -- the variable no longer
-         exists
-
-lib/readline/readline.h, lib/readline/history.h
-       - reorganized to follow texinfo manual structure
-
-lib/readline/bind.c
-       - rl_function_dumper is now static
-       - rl_list_funmap names does not take any arguments
-
-builtins/bind.def
-       - rl_list_funmap names does not take any arguments
+                                  2/24
+                                  ----
+builtins/hash.def
+       - add a missing argument of 0 to add_hashed_command
 
-lib/readline/readline.c, lib/readline/signals.c
-       - rl_init_argument ->_rl_init_argument
+builtins/kill.def
+       - job identifiers can be used in non-interactive shells as long as
+         job control has been turned on with `set -m'
 
-lib/readline/rltty.c
-       - remove declaration and references to output_was_flushed
+jobs.c
+       - we want to be notified of stopped jobs if job_control is non-zero,
+         even if the shell is not interactive
 
-support/getcppsyms.c
-       - if __uxps__ is defined, define __uxps__ and __svr4__
+execute_cmd.c
+       - make sure shell_execve returns EX_NOTFOUND if execve fails and
+         errno is set to ENOENT
+       - makes sure execute_builtin saves the temporary environment to
+         builtin_env for the `eval' builtin, since it can destroy the
+         temporary environment when it calls parse_and_execute
 
-                                   8/9
-                                   ---
-support/mkdist
-       - added a -r option to set the `root name' of the distribution
-         (e.g., `bash' or `readline')
+bashhist.c
+       - new variable: hist_last_line_added, set to 1 if the last command
+         line was added to the history successfully as a separate entry.
+         Used by `history' and `fc'
 
-                                  8/10
+                                  2/25
                                   ----
-input.c
-       - if check_bash_input sees that default_buffered_input is about
-         to be the target of a redirection, but the buffered input stream
-         is not the current input stream (e.g. as the result of an
-         `eval' while in a script, change default_buffered_input to a
-         new fd and use a new variable `bash_input_fd_changed' to note
-         the change
-
-parse.y
-       - if pop_stream sees that default_buffered_input has changed while
-         a buffered stream was on the save stack (because
-         bash_input_fd_changed is non-zero), then make the popped stream
-         and the corresponding buffer use the new fd
-
-test.c
-       - fixed an off-by-one error in test_stat when testing /dev/fd/n.
+trap.c
+       - save line number before executing trap command, because
+         parse_and_execute resets it to 1 and the trap command might
+         want it
 
-cpp-Makefile
-       - add -I$(incdir) to CPPFLAGS
-       - add `incdir = $(prefix)/include' assignment
+execute_cmd.c
+       - change to executing_line_number to return trap_line_number if
+         the shell is currently running a trap
 
-                                  8/11
+                                  2/26
                                   ----
-lib/readline/signals.c
-       - changed some calls to signal () to call rl_set_sighandler()
-       - call _rl_redisplay_after_sigwinch from the sigwinch handler
-         to do better redisplay of wrapped command lines and multi-line
-         prompts
+execute_cmd.c
+       - change to time_command so that a `real' value of 0 does not
+         cause a divide-by-zero error when computing cpu percentage
 
-builtins/suspend.def
-       - changed some calls to signal () to call set_signal_handler()
+lib/readline/signals.c
+       - if MUST_REINSTALL_SIGHANDLERS is defined, reinstall the SIGWINCH
+         handler in rl_handle_sigwinch
 
-lib/readline/*.c
-       - include config.h before anything else if HAVE_CONFIG_H is defined
+builtins/set.def
+       - `unset' now rejects attempts to unset names that are not valid
+         shell identifiers as errors
+       - add a description of `-o history' option to help text
 
-lib/readline/readline.c
-       - renamed rl_set_mark to _rl_set_mark_at_pos
-       - call _rl_vi_initialize_line from rl_initialize if the current
-         editing mode is vi mode
-       - only output a term_cr in crlf if term_cr is non-null
+subst.c
+       - in parameter_brace_patsub, we want backslash removal done on
+         the replacement if (mflags & MATCH_QUOTED), since the code
+         in expand_word_internal will not do it.  We need to call
+         expand_string_unsplit directly, since maybe_expand_string does
+         not do the right thing
 
-lib/readline/readline.h
-       - added declarations for rl_vi_set_mark and rl_vi_goto_mark
+                                  2/28
+                                  ----
+execute_cmd.c
+       - if execute_for_command finds that the iteration variable is readonly,
+         decrement loop_level before returning
 
-lib/readline/readline.c, lib/readline/readline.h
-       - added a new bindable command to set the mark, rl_set_mark
+builtins/break.def
+       - if the break count is <= 0, display an error message and break out
+         of all loops
 
-lib/readline/funmap.c
-       - new bindable function with name `set-mark', bound to rl_set_mark
-       - new bindable vi-mode functions with names `vi-set-mark' and
-         `vi-goto-mark'
+builtins/command.def
+       - if PATH is unset, and we're using command -p, we don't want PATH
+         to be set to the empty string when `command' completes
 
-documentation/{bash.1,readline.3}, lib/readline/doc/rluser.texinfo
-       - added documentation for `set-mark' (unbound)
+builtins/common.c
+       - POSIX.2 says `kill -l signum' prints the signal name without the
+         leading `SIG' prefix, so check for this_shell_builtin == kill_builtin
+         in display_signal_list
 
-lib/readline/vi_mode.c
-       - new vi-command mode commands to save marks (the vi `m' command)
-         and go to saved marks (the ``' command)
-       - new function _rl_vi_initialize_line called from rl_initialize
-         to set up the line state in vi mode.  Right now this just resets
-         all the marks
+builtins/getopts.def
+       - when invoked without any arguments, `getopts' now prints a usage
+         message
 
-lib/readline/vi_keymap.c
-       - new vi command-mode bindings to set the mark (`m') and to go to
-         a saved mark (``')
+                                   3/3
+                                   ---
+builtins/common.c
+       - add a second argument to get_numeric_arg: if non-zero, the shell
+         exits on a bad argument; if not, the shell jumps to top_level
+         with a DISCARD argument, which aborts the current command
 
-documentation/readline.3
-       - added vi-set-mark and vi-goto-mark to list of key bindings for
-         vi command mode
+builtins/{break,exit,history,return,shift}.def
+       - change calls to get_numeric_argument
 
-lib/readline/{readline.c,display.c}
-       - renamed term_xn to _rl_term_autowrap
+lib/readline/funmap.c
+       - add `dump-macros' to list of bindable names
 
-lib/readline/display.c
-       - new function _rl_redisplay_after_sigwinch to encapsulate the
-         necessary redisplay code after a SIGWINCH is received
+lib/readline/readline.h
+       - added extern declaration for rl_prompt (it was apparently missing)
 
-variables.c
-       - only call find_user_command on the shell name in shell_initialize
-         if shell_name is not an absolute program name
-       - call canonicalize_pathname on the full shell pathname after
-         calling make_absolute on it if the shell name starts with a `.'
+lib/readline/readline.c
+       - new internal function, _rl_init_line_state, which sets rl_point
+         and rl_end to 0, sets the_line to point to _rl_line_buffer, and
+         clears the line
 
-siglist.h
-       - FreeBSD does not need a definition of sys_siglist[]
+lib/readline/callback.c
+       - if a user's callback function does not clear the line, clear it
+         for him by calling _rl_init_line_state
 
-                                  8/12
-                                  ----
-lib/readline/rltty.c
-       - don't try to use FLUSHO unless FLUSHO is defined
+                                   3/4
+                                   ---
+alias.c
+       - made the readline support functions #ifdef READLINE, so they're
+         not compiled into the shell unless readline is
 
-cpp-Makefile
-       - make sure to pass $(CC) to the make in the lib/malloc subdirectory
+lib/readline/bind.c
+       - new function _rl_untranslate_macro_value, to expand meta-prefixes
+         and other special characters in a macro value for printing by
+         _rl_macro_dumper_internal
+       - call _rl_untranslate_macro_value in _rl_macro_dumper_internal to
+         get a printable version of the macro value
 
 lib/readline/readline.c
-       - don't declare PC, UP, and BC as extern; it causes too many problems
+       - new variable, rl_dispatching, set to 1 when we call a function
+         from _rl_dispatch
 
-                                  8/13
-                                  ----
-machines.h
-       - add -DNO_SBRK_DECL to SYSDEP_CFLAGS for SVR4.2 on i386
+lib/readline/readline.h
+       - extern declaration for rl_dispatching
 
-support/mksysdefs
-       - new variable UNAME_S for the output of `uname -s'
-       - if uname -s does not output the same thing as uname, and uname -s
-         outputs UNIX_SV, then set UNAME to UNIX_SV.  Some versions of i386
-         SVR4.2 make `uname' equivalent to `uname -n'
+lib/readline/complete.c
+       - make sure S_ISCHR and S_ISBLK are defined before using them
 
-lib/readline/memalloc.h
-       - removed from the library; not needed since readline does not use
-         alloca
+lib/readline/terminal.c
+       - add a new #define NEED_EXTERN_PC.  Define this if the termcap
+         or curses libraries need `extern' before declarations of PC,
+         BC, and UP
 
-lib/readline/{history.c,isearch.c,search.c,rldefs.h}, lib/tilde/tilde.c
-       - no longer include memalloc.h
+lib/readline/{readline,terminal,histfile}.c
+       - changes to compile on OS/2 with OS/2 `EMX' port of gcc, originally
+         sent by ilya@math.ohio-state.edu
 
-lib/readline/Makefile
-       - remove dependencies on memalloc.h
+builtins/set.def
+       - fixed a bug in set_shellopts that caused the shell to crash if
+         there were no shell options set
 
-lib/readline/signals.c
-       - overhauled signal handling based on ideas from Bruno Haible
-         (haible@ma2s2.mathematik.uni-karlsruhe.de) so that readline
-         saves and restores the signal mask and flags on Posix systems
-       - don't include fcntl.h, sys/file.h, errno.h, or stdlib.h
-       - ignore SIGALRM during rl_signal_handler like SIGINT until the
-         old handler is installed, on non-Posix or non-BSD systems
-       - new define SIGHANDLER_RETURN, dependent on the value of
-         VOID_SIGHANDLER
-       - use RETSIGTYPE instead of `sighandler' as the signal handler
-         return type; it's the name autoconf uses.  If not defined,
-         set up from VOID_SIGHANDLER
-
-lib/readline/rltty.c
-       - call control_meta_key and control_keypad from rl_deprep_terminal
-         before putting the terminal back into ICANON mode to avoid
-         messing up the tty driver
-
-                                  8/15
-                                  ----
-cpp-Makefile
-       - changes so that fewer -Idir arguments are passed to the make
-         in ./builtins
+                                   3/5
+                                   ---
+configure.in,Makefile.in
+       - choose run-all or run-minimal as the test script based on whether
+         the --enable-minimal-config option was given to configure
 
-                                  8/16
-                                  ----
-lib/readline/bind.c
-       - use KEYMAP_SIZE instead of 128 in rl_invoking_keyseqs_in_map
+builtins/setattr.def
+       - fixed `export -p' and `readonly -p' so that they output `export'
+         or `readonly' when in POSIX mode, as POSIX.2 specifies
 
-lib/readline/complete.c
-       - qsort the array of matches omitting matches[0], which must stay
-         in place no matter what, even if strcmp doesn't compare unsigned
-         chars correctly
-       - some fixes to the loop that prints the list of completions
+                                   3/6
+                                   ---
+builtins/setattr.def
+       - make `readonly -a var=(...)' work just like `declare -ar var=(...)',
+         since the two logically mean the same
+       - `readonly -f' and `export -f' don't print the function definition
+         for each readonly or exported function, respectively, when in
+         POSIX mode
 
-lib/readline/keymaps.c
-       - run the loop up to 127 when creating a new keymap in rl_make_keymap
+jobs.c, nojobs.c
+       - don't report status for processes killed by SIGPIPE if
+         DONT_REPORT_SIGPIPE is defined
 
-input.h, general.h, lib/readline/keymaps.h, lib/readline/tilde.h
-       - use _FUNCTION_DEF instead of __FUNCTION_DEF
+config.h.top
+       - added a commented-out define for DONT_REPORT_SIGPIPE
 
-lib/readline/parens.c
-       - include "config.h" if HAVE_CONFIG_H is defined
-       - include <sys/select.h> if HAVE_SYS_SELECT_H is defined
-       - use HAVE_SELECT instead of FD_SET as the `configuring define';
-         define HAVE_SELECT if it is not already defined but FD_SET is
+execute_cmd.c
+       - `time' can now be used to time background pipelines, and reports
+         the timing statistics when the pipeline completes
 
-lib/readline/readline.c, lib/readline/rltty.c
-       - the __GO32__ include file is <pc.h>
+[bash-2.01-alpha1 frozen]
 
-lib/tilde/tilde.c
-       - rewrote tilde_expand_word, eliminated static u_name array in
-         favor of using xmalloc
+                                  3/12
+                                  ----
+subst.c
+       - move the parent end of the pipe file descriptor used for process
+         substitution to a high, unused file descriptor to avoid clashes
+         with redirections performed explicitly by a script
 
-lib/tilde/tilde.h
-       - use single leading underscore for file inclusion guard
+configure.in
+       - added a `--with-curses' argument so curses can be forcibly chosen
+         over libtermcap (some Unix versions ship lousy termcap databases)
 
-lib/readline/vi_mode.c
-       - use KEYMAP_SIZE rather than a literal 127 as the loop limit when
-         creating the overstrike keymap
+support/mkconffiles
+       - new script to create _distribution and _patchlevel from values
+         contained in `configure'
 
-support/install.sh
-       - new file, from the make-3.71 distribution
+doc/bashref.texi
+       - updated installation instructions
 
-                                  8/17
+                                  3/13
                                   ----
-lib/readline/complete.c, lib/readline/readline.h
-       - new variable, rl_basic_quote_characters, used to see
-         if a word break character was a quoting character, so we can
-         do appropriate quoting after the completion
-
-lib/readline/parens.c
-       - use rl_basic_quote_characters when trying to find a matching
-         open paren
-
-lib/readline/doc/rltech.texinfo
-       - description of rl_basic_quote_characters
+general.c
+       - if `getgroups' returns 0, make sure we add the primary group id
+         as GROUPS[0].
+       - if we have getgroups, and the primary gid is not in the array
+         getgroups returns, add it as group_array[0] and shuffle everything
+         up one element.  This ensures that current_user.gid == group_array[0]
+         all the time
+
+tests/builtins.tests
+       - changes to avoid stray variables in environment when the shell
+         version of printenv is used with bash as /bin/sh, running the
+         `exec -c' tests.
 
-                                  8/18
+                                  3/14
                                   ----
-newversion.c
-       - renamed to support/mkversion.c, which builds to mkversion
-
-cpp-Makefile
-       - changed to use support/mkversion
-       - removed instances of $< except in suffix rules -- some makes don't
-         handle those right
+builtins/cd.def
+       - spelling correction is no longer enabled by default
 
-lib/readline/rldefs.h
-       - make sure to #undef HAVE_DIRENT_H on NeXT machines
+support/bashbug.sh
+       - if the shell's release status is alpha or beta, offer the option
+         of sending the bug report to the bash-testers mailing list as
+         well as to chet
 
-                                  
-                                  8/19
+                                  3/17
                                   ----
-lib/readline/readline.h
-       - removed some duplicate function declarations
-
-trap.h
-       - define DEBUG_TRAP as NSIG for the last slot in trap_list
-       - define EXIT_TRAP as 0
-       - declare trap_list as array of unknown size, since this is just a
-         header file
-
-trap.c
-       - extend trap_list and sigmodes to NSIG+1
-       - initialize DEBUG_TRAP to do nothing; changes to functions to handle
-         DEBUG_TRAP
-       - let decode_signal return OK if NSIG is given, even though this will
-         vary between systems, for DEBUG_TRAP
-       - make reset_signal_handlers and restore_original_signals loop from
-         1 to NSIG, not 0 to NSIG
-       - change GET_ORIGINAL_SIGNAL to try to get the original signal handler
-         only if `sig' is less than NSIG
-       - restore_default_signal just frees the trap string for both EXIT_TRAP
-         and DEBUG_TRAP
-       - run_debug_trap: new function to run traps on DEBUG
-       - free_trap_command: new function to free a trap string if it is
-         really a command and not one of the special trap values
-       - if a SIGINT trap resets the SIGINT trap string, free the old string
-       - new function: set_debug_trap(char *), which will reset the DEBUG
-         trap string, suitable for calling from an unwind-protect handler
-
-signames.c
-       - arrange things so that signal_names[NSIG] == "DEBUG"
-
-builtins/trap.def
-       - make sure traps on DEBUG are printed
+configure.in
+       - configure --without-gnu-malloc by default on *-sgi-irix6* because
+         their code needs 8-byte alignment
 
-execute_cmd.c
-       - call run_debug_trap at the end of the `cm_simple' case in
-         execute_command_internal
-       - change execute_function so that traps on DEBUG do not propagate
-         into the function
+support/bashbug.sh
+       - ``' needs to be quoted with a backslash in double-quoted strings
 
-documentation/bash.1, documentation/features.texi
-       - documented the new DEBUG trap
+aclocal.m4
+       - slight changes to the strcoll test, since AIX 4.2 returns -1, 0, or
+         1 from strcmp(3) but a numeric collation order difference from
+         strcoll(3)
 
-                                  8/20
+                                  3/18
                                   ----
-shell.c, config.h
-       - made the name of the restricted shell configurable in config.h;
-         the option is RESTRICTED_SHELL_NAME
-
-shell.c
-       - if the shell is invoked as `sh', enter Posix.2 mode after running
-         /etc/profile and ~/.profile
-
-builtins/read.def
-       - added a -p option for a prompt string, which is displayed before
-         trying to read anything
-
-documentation/bash.1
-       - description of `read -p'
-       - description of new -r and -s options to `jobs' 
-
-documentation/features.texi
-       - description of new -r and -s options to `jobs' 
-
-jobs.c
-       - new functions: list_running_jobs, list_stopped_jobs
-       - list_jobs -> list_all_jobs
-       - new function `print_job' to do the work for all of the list*jobs
-         functions
-       - list_one_job type now void, calls print_job to do the work
-
-jobs.h
-       - new declarations for list_running_jobs, list_stopped_jobs
-       - list_one_job now void
-       - list_jobs -> list_all_jobs
+command.h
+       - new redirection error code:  HEREDOC_REDIRECT
 
-builtins/jobs.def
-       - new options: -r to print only running jobs, -s to print only
-         stopped jobs
+execute_cmd.c
+       - return HEREDOC_REDIRECT from do_redirection_internal when
+         here_document_to_fd cannot create the temp file for a here document
+       - changed redirection_error to print a meaningful message when
+         here document temp file creation fails (HEREDOC_REDIRECT)
 
-                                  8/22
+                                  3/19
                                   ----
-lib/readline/readline.c
-       - don't try to expand a null prompt string
-
 subst.c
-       - remove special handling of hostname_completion_file and
-         history_control; HOSTFILE and HISTCONTROL are the acceptable
-         names
-       - new function sv_histignore; call if HISTIGNORE variable is
-         assigned to
-
-bashhist.c
-       - new functions and declarations for handling HISTIGNORE variable
-         and its specifications for command lines to ignore
-       - change maybe_add_history to call history_should_ignore if the
-         HISTCONTROL tests are passed
+       - changes to match_pattern_char: return 1 if the first char of the
+         pattern is `?' only if the string is non-null; just return 1 if
+         the first char of the pattern is `[' and the string is non-empty
+         rather than try to re-implement the brace matching code from fnmatch
 
-documentation/bash.1, documentation/features.texi
-       - removed mention of history_control and hostname_completion_file
-       - added description of HISTIGNORE
+lib/glob/fnmatch.c
+       - some changes from glibc-2.0.1 posix/fnmatch.c
 
-                                  8/23
+                                  3/21
                                   ----
-array.c, array.h
-       - promoted to the shell mainline code; the `array' subdir is now
-         gone
+variables.c
+       - only do the initialization of `ignoreeof' if the shell is
+         interactive
+       - reset values of $SHLVL > 1000 to 1 in adjust_shell_level, and
+         don't call itos, since we don't need its generality
+       - new function, initialize_shell_level, just calls adjust_shell_level
+         with argument of 1.  If $SHLVL is unset, adjust_shell_level will
+         deal with it correctly
+       - change initialize_shell_variables to not malloc a copy of each
+         environment variable, just keep two pointers into the env string:
+         one for the name, one for the value
+       - broke the code that computes the value of $BASH out into a separate
+         function: get_bash_name
+       - get_bash_name special-cases shell_name with a `./' prefix when
+         initializing $BASH
+       - new function: set_home_var, sets $HOME to current_user.home_dir if
+         it's not already set, calling get_current_user_info if
+         current_user.home_dir is NULL
+       - new function: set_shell_var, sets $SHELL to current_user.shell if
+         it's not already set, calling get_current_user_info if
+         current_user.shell is NULL
+       - changed places that reference information in current_user to check
+         for NULL values of the member they're interested in and call
+         get_current_user_info if necessary
 
-variables.h
-       - include `array.h' for the ARRAY typedef
+shell.c
+       - moved the code that sets up the information in current_user that
+         comes from the password file into a new function,
+         get_current_user_info
+       - shell_initialize calls get_current_user_info only if the shell is
+         interactive
 
-variables.c
-       - changes to assignment() to handle array assignments a[x]=b
-       - split off the creation of new variables into a new function:
-         make_new_variable
-       - split off the construction of variable values for assignments and
-         bindings into a new function: make_variable_value
-       - new function: bind_array_variable, to handle the addition of
-         new array variables and indices
+externs.h
+       - new extern declaration for get_current_user_info(), so variables.c
+         can use it
 
-subst.c
-       - changes to do_assignment_internal to handle a[x]=b:
-               parse the subscript out of the name and call evalexp() on it
-               call bind_array_variable to do the value assignment
-       - change the printing of assignment statements when -x is in effect
-         to before the variable binding is attempted, so any error messages
-         look better
-       - new functions for referencing indexed arrays and to find the length
-         of arrays or array indices
-
-                                  8/24
+                                  3/24
                                   ----
-expr.c
-       - fixed up error reporting to use get_name_for_error if not executing
-         a builtin
+lib/tilde/tilde.c
+       - if SHELL is defined, user the current_user struct info to find
+         the user's home directory rather than calling getpwuid
 
-subst.c
-       - everywhere evalexp() is called, use maybe_expand_string to expand
-         the expression (calls expand_string if necessary)
+                                  3/25
+                                  ----
+nojobs.c
+       - don't try to open /dev/tty when getting or setting the tty state
+         and window size; use shell_tty instead
+       - initialize shell_tty to standard error in initialize_job_control
+       - only fetch the tty state initially if the shell is interactive
 
-subst.h
-       - extern declarations for array convenience functions exported to the
-         rest of the shell
+general.c
+       - open /dev/tty with the O_NONBLOCK flag
 
 variables.c
-       - more new convenience array functions: make_new_array_variable and
-         convert_var_to_array
-
-builtins/declare.def
-       - additions to declare_internal to add a -a flag which makes array
-         variables, and the requisite semantics (declare +a does not work,
-         declare -a name=value does not work, etc.)
-       - code to support the ksh-like declare a[] syntax to make array
-         variables
-
-builtins/setattr.def
-       - made set_or_show_attributes understand array variables and `-a'
+       - changed all_vars so that it sorts its output all the time, not
+         just when in POSIX mode.  This means that the output of `set'
+         and `export' will be sorted
 
 builtins/set.def
-       - changes to make `unset name' work, where name is an array variable
-       - changes to make `unset name[xxx]' work
-
-                                  8/25
-                                  ----
+       - in initialize_shell_options, only call parse_shellopts if we
+         inherited $SHELLOPTS from the environment
+       - make sure we call parse_shellopts from initialize_shell_options
+         with a copy of the value of SHELLOPTS, in case one of the functions
+         called while setting one of the variables modifies $SHELLOPTS
 
 lib/readline/readline.c
-       - make sure meta characters are added to a keyboard macro as
-         ESC-char if we are converting meta chars to ascii
-       - change rl_unix_word_rubout to handle repeat counts
-       - move the check of LC_CTYPE from rl_initialize to
-         readline_initialize_everything, where it should have been
-         all along
+       - make sure that digit arguments don't change the state of
+         rl_last_func
 
-error.c
-       - make sure <sys/types.h> is included before <fcntl.h>
-
-machines.h
-       - new entry for Bull DPX2
+support/printenv.c
+       - new file, printenv(1) clone, used to avoid environment variables
+         that might be set automatically when using printenv.sh
 
 lib/tilde/tilde.c
-       - include <sys/types.h> before <pwd.h>
-
-variables.c
-       - PS1 and PS2 are no longer non-unsettable
+       - if SHELL is defined, don't call getenv to get the value of $HOME,
+         call get_string_value () directly
 
-                                  8/26
+                                  3/26
                                   ----
-variables.c
-       - PPID, UID, and EUID, since they are read-only, need not appear on
-         the `non-unsettable' list
-       - PATH and IFS now have the `nounset' attribute set rather than use
-         a separate `non-unsettable' list
-       - the non-unsettable list and non_unsettable() are gone
+lib/readline/histexpand.c
+       - abstracted the `#ifdef SHELL' stuff that checked for special cases
+         that should not be history expanded ([!...], ${!...}) into a call
+         to a function that is the value of the
+         new history_inhibit_expansion_function variable
 
-variables.h
-       - new define `non_unsettable_p' to test nounset attribute
+lib/readline/history.h
+       - extern declaration for history_inhibit_expansion_function
 
-builtins/set.def
-       - `unset' now uses non_unsettable_p to tell whether a variable can
-         be unset even if it's not readonly
+bashhist.c
+       - new function, bash_history_inhibit_expansion, which checks for
+         the special cases in which history expansion should be inhibited
+       - changes to the various history initialization functions to
+         set history_inhibit_expansion_function
 
-builtins/read.def
-       - read -a arrayname will read a list of values from stdin and assign
-         them to the array `arrayname', splitting on " \t\n" (honoring
-         backslash quoting if -r is not supplied)
+lib/readline/doc/hstech.texinfo
+       - documented history_inhibit_expansion_function
 
-builtins/declare.def
-       - print values of arrays when `display -a' is invoked
+lib/readline/shell.c
+       - new file, containing versions of the functions that are provided
+         by bash when readline is linked as part of bash
+       - new function: get_env_value().  If SHELL is defined, this calls
+         get_string_value().  If SHELL is not defined, this calls getenv()
 
-builtins/exit.def
-       - remove references to `bye'
+lib/readline/histexpand.c
+       - moved single_quote() to shell.c
 
-                                  8/28
-                                  ----
-lib/readline/rltty.c
-       - removed calls to control_keypad; they cause problems on some
-         machines and should not really be performed by an application
+lib/readline/util.c
+       - moved savestring() to shell.c
 
-cpp-Makefile
-       - support for optionally linking array.o into the shell
+lib/readline/terminal.c
+       - moved set_lines_and_columns() to shell.c
 
-lib/glob/glob.c
-       - when returning an error after glob_filename on the directory name
-         returns an error result, make sure to free `result'.  This fixes
-         a memory leak for names passed to glob_filename which contain
-         globbing characters before the first `/' but do not match any
-         existing files
+lib/readline/Makefile.in, Makefile.in
+       - added shell.c and shell.o to the appropriate variables that contain
+         the files comprising the readline and history libraries
 
-                                  8/29
-                                  ----
-execute_cmd.c
-       - the `for' and `select' commands should expand their word lists
-         using expand_words_no_vars
+lib/readline/signals.c
+       - introduced two new cpp defines:  HANDLE_JOB_SIGNALS and
+         HANDLE_SIGTERM.  When HANDLE_JOB_SIGNALS is defined, SIGTSTP,
+         SIGTTIN, and SIGTTOU are caught and handled.  When HANDLE_SIGTERM
+         is defined, SIGTERM is caught and handled.  These are both
+         defined automatically if SHELL is not defined
 
-command.h, execute_cmd.c, general.c, make_cmd.c, print_cmd.c, subst.c,parse.y
-       - changed the `dollar_present', `quoted', and `assignment' members
-         of WORD_DESC to a single flags word
+lib/readline/{bind,histfile,nls,readline,terminal}.c
+       - call get_env_value instead of getenv().  This should remove the
+         dependency on being able to redefine getenv() in oslib.c
 
-                                  8/30
-                                  ----
-variables.c
-       - make get_string_value return array[0] if called with a variable
-         that is an array
+shell.c
+       - added a missing argument of -1 to the call to list_minus_o_opts.
+         Now `bash -o' lists all options, not just random ones depending
+         on what's on the stack
 
-                                  8/31
+                                  3/28
                                   ----
-lib/readline/display.c
-       - don't take the value of _rl_term_autowrap into account when
-         computing which screen line the cursor should be on; it screws
-         up wrapping on terminals without the `xn' capability
+builtins/ulimit.def
+       - change RLIM_INFINITY to the hard limit only if the hard limit is
+         greater than the current (soft) limit
 
-lib/readline/examples/rltest.c
-       - new file, test code moved here from readline.c
+hashlib.c
+       - return immediately from flush_hash_table if the hash table passed
+         is NULL
 
-documentation/features.texi, lib/readline/doc/hsuser.texinfo
-       - fixed up printing of some of the shell options and the history
-         commands and modifiers
+                                   4/1
+                                   ---
+shell.c
+       - remove call to initialize_filename_hashing -- initialize the hash
+         table the first time a hashed command has to be remembered
 
-subst.c
-       - make sure $name, where `name' is an array variable, returns
-         ${name[0]}
+hashcmd.c
+       - new file, with functions to perform filename hashing and lookup
+         taken from builtins/hash.def and builtins/common.c
+       - change to remember_filename -- call initialize_filename_hashing
+         if hashing_initialized is 0
 
-variables.c
-       - convert a variable to an array even if index 0 is being assigned to,
-         instead of leaving it a `normal' variable
+hashcmd.h
+       - new file, mostly from builtins/hashcom.h, with extern function
+         declarations added
 
-                                   9/1
-                                   ---
+execute_cmd.c, builtins/{hash,type}.def
+       - include hashcmd.h for hash function and type definitions
 
-builtins/setattr.def
-       - make sure that array variables printed by `declare' single-quote
-         the value after the `=' so the statement can be reused as input
+builtins/{common.{c,h},hash.def}
+       - moved hashing functions and declarations to hashcmd.c/hashcmd.h
 
-variables.c
-       - make sure array variables can be exported (name=(assignments)), and
-         that the export code works.  The code is commented out because of
-         the possible confusion between an array and a regular string that
-         looks like an array assignment string.
+Makefile.in, builtins/Makefile.in
+       - changed source and object file definitions and dependencies because
+         of addition of hashcmd.h and hashcmd.c
 
-                                   9/2
-                                   ---
-variables.c
-       - make sure there is an executable file with the same name as
-         `shell' name in the current directory before assigning it to
-         $BASH at startup.  If there is not, just make $BASH the login
-         shell name
+builtins/hash.def
+       - return immediately from print_hashed_commands if hashed_commands
+         is empty, indicating that the hash table has not been initialized
 
-                                   9/3
+                                   4/2
                                    ---
-parse.y
-       - removed a reduction from the `list0' production that could cause
-         statements which require semicolons to be allowed without error
-         (like before a `}' in a group command)
+lib/readline/bind.c
+       - fixed translation of ESC in rl_untranslate_keyseq and
+         rl_untranslate_macro_value
 
-lib/readline/display.c
-       - new functions: _rl_save_prompt and _rl_restore_prompt to save and
-         restore prompt invisible character info
-       - if the redisplay code encounters a line shorter than the old one
-          and containing invisible characters, make sure that the cursor is
-         at the end of the new text before calling clear_to_eol
-       - new variable last_invisible containing the index in the prompt
-         string of the last invisible character.  We only have to redraw
-         the prompt string of _rl_last_c_pos is < last_invisible
-       - new function _rl_make_prompt_for_search to take care of setting
-         up the prompt string for a non-incremental search when the prompt
-         contains invisible characters
-       - fix so that a prompt string with invisible characters is not
-         redrawn each time through update_line (don't tputs term_cr unless
-         the cursor is before the last invisible character in the prompt
-         and will be moving past the last invisible char of the prompt
+lib/readline/{readline,kill}.c
+       - added an argument to _rl_fix_point telling it whether or not to
+         fix up the mark also; changed calls to _rl_fix_point to add the
+         appropriate argument
 
-lib/readline/isearch.c
-       - call _rl_save_prompt and _rl_restore_prompt when changing the prompt
-         to do i-search
+Makefile.in
+       - changed the substitution delimiter in the `sed' commands that
+         create bashbug from `:' to `%' to avoid conflicts with options
+         containing `:'
 
-                                   9/4
+                                   4/3
                                    ---
-lib/readline/readline.c
-       - doing_an_undo -> _rl_doing_an_undo for use by the vi-mode code
-       - rewrote rl_do_undo to reformat and eliminate a clumsy goto
-       - new split the add-to-kill-ring code off into a separate function,
-         _rl_copy_to_kill_ring
-       - added a new bindable function rl_copy_region_as_kill
-       - added a new bindable function rl_kill_region
-       - moved _rl_char_search_internal to here from vi_mode.c
-       - new bindable function rl_char_search
-
-lib/readline/vi_mode.c
-       - made `.' work for the `cw' and `[Ss]' commands, which implicitly
-         put the editor into insertion mode after they run
-       - split rl_vi_char_search code that actually searches for a character
-         into a new function, _rl_char_search_internal
-
-lib/readline/emacs_keymap.c
-       - bind M-= to possible-completions for ksh compatibility
-       - bind M-* to insert-completions
-       - bind C-x C-x to exchange-point-and-mark
-       - bind C-] to character-search
-       - bind C-@ to set-mark
-
-lib/readline/funmap.c
-       - new bindable function names: exchange-point-and-mark, kill-region,
-         copy-region-as-kill, character-search
+print_cmd.c
+       - made the initial value and the default growth value for the
+         printed command somewhat smaller -- we don't really need to
+         allocate 4096 bytes for the printed command
+       - added stdarg support to xprintf if PREFER_STDARG is defined
 
-lib/readline/readline.h
-       - declare rl_exchange_point_and_mark, rl_copy_region_to_kill,
-         rl_kill_region, and rl_char_search externally
+stringlib.c
+       - changed strip_trailing to take the index of the last character
+         as the second argument, saving a (useless) call to strlen, since
+         the caller already knows where the end of the string is
 
-documentation/{bash.1,readline.3}, lib/readline/doc/rluser.texinfo
-       - document new exchange-point-and-mark bindable command
-       - documented M-* default emacs-mode binding to insert-completions
-       - documented new copy-region-as-kill and kill-region commands
-       - documented new character search emacs-mode command
-       - documented new binding for set-mark
+subst.c
+       - change call to strip_trailing in command_substitute to add the
+         new second argument
 
-lib/readline/rldefs.h
-       - moved values for `dir' when searching for characters in the line
-         from vi_mode.c to here
+externs.h
+       - changed extern declaration for strip_trailing
 
-                                   9/6
+                                   4/4
                                    ---
-general.c
-       - new function ansicstr, which decodes ANSI-C backslash-escaped
-         characters (with the addition of \e and \E to mean escape) and
-         returns a new string
+Makefile.in, configure.in, lib/malloc/Makefile.in
+       - changed the strategy for picking which `malloc' to include by
+         having configure define a `malloc target' and the Makefile in
+         lib/malloc implementing rules for that target
 
-subst.c
-       - new expansion $'...' which translates ANSI-C backslash escapes
-         in `...' and expands to the result
+                                   4/5
+                                   ---
+Makefile.in
+       - slightly changed the rules for remaking `parser-built':  it is
+         now a copy of y.tab.h, updated only when the contents of y.tab.h
+         change
+       - everything that used to depend on y.tab.h now depends on
+         parser-built
 
-builtins/echo.def
-       - ifdefs for ANSI-C for \a and \v rather than just expanding to
-         literal ASCII values
+                                   4/6
+                                   ---
+execute_cmd.c, print_cmd.c
+       - use #include <y.tab.h> so we pick up y.tab.h from the build
+         directory instead of the source directory if it happens to be
+         recreated in the build directory
 
-documentation/bash.1
-       - documented new $'...' expansion
+                                   4/7
+                                   ---
+bashline.c
+       - fixed another problem with `pwd`/[TAB] thinking that the `/
+         started an unclosed command substitution, generating errors
 
-                                   9/7
+                                   4/8
                                    ---
-builtins/enable.def
-       - fixed up the help text
-       - added a -s flag to restrict operation to Posix.2 `special' builtins
-       - removed -all option; -a is the way to do it now
-       - converted to use the builtin getopt
+general.c
+       - renamed bash_tilde_expansion_failure_hook to be
+         bash_special_tilde_expansions, since that more accurately reflects
+         its function
+       - changed tilde_initialize so that there is no failure hook -- the
+         special expansions are handled first with the preexpansion hook
 
-builtins/common.c
-       - changed builtin_address_internal to return a pointer to a
-         struct builtin, which makes it much more useful.  Changed
-         find_shell_builtin and builtin_address accordingly
-       - new function find_special_builtin, which returns special builtins
-         ((flags & SPECIAL_BUILTIN) != 0)
+lib/tilde/tilde.c
+       - new variable: tilde_expansion_preexpansion_hook -- if non-null, it
+         points to a function that is called before standard tilde expansion
+         is attempted
 
-execute_cmd.c
-       - in Posix.2 mode, find special builtins before shell functions
-         when performing command lookup
-       - in find_user_command_internal, return NULL if there is no $PATH
-       - in Posix.2 mode, failure of a special builtin causes a non-
-         interactive shell to exit
+lib/tilde/tilde.h
+       - extern declaration for tilde_expansion_preexpansion_hook
 
-variables.c
-       - allow $PATH to be unset
+doc/{bash.{1,html},bashref.texi}
+       - added optional open paren to description of `case' command syntax
 
-                                   9/8
+                                   4/9
                                    ---
-input.h
-       - added a new `input type': st_stdin, for use when using readline,
-         since readline is not properly a string
+variables.c
+       - on qnx, set and export a variable `NODE' which contains the QNX
+         `node id'
 
-parse.y
-       - surgery on the grammar:
-               o added new `compound_list' production: a list that can end
-                 without a newline, `;' or `&' (used in subshell commands
-                 and case clause commands)
-               o removed shell_command_1, folded rules into command
-               o eliminated pattern_list_1; changed case_clause_sequence to
-                 directly incorporate the SEMI_SEMI token (a pattern_list_1
-                 was just a pattern_list with a trailing SEMI_SEMI)
-               o new `for_command' and `case_command' productions
-               o redirections -> redirection_list
-               o newlines -> newline_list
-               o redid the code that attaches redirections to the function
-                 command rather than the function definition and eliminated
-                 all of the shift/reduce conflicts
-       - changed with_input_from_stdin in the readline case to set
-         bash_input.type to st_stdin
+general.c
+       - QNX system can now handle pathnames with a leading `//'
 
-print_cmd.c
-       - a couple of changes to the way functions are printed
+configure.in
+       - added `-Dqnx' to LOCAL_CFLAGS on QNX machines
 
-shell.c
-       - only execute the PROMPT_COMMAND if input is not coming from a
-         string (bash_input.type != st_string).  This fixes the problem
-         of PROMPT_COMMAND being executed by `eval' commands in an
-         interactive shell
+lib/malloc/getpagesize.h
+       - some systems need sysconf(_SC_PAGE_SIZE) to obtain the page size;
+         added code to check for it
 
-                                  9/12
+                                  4/10
                                   ----
-shell.c
-       - all interactive shells SIGHUP running jobs when exiting due to
-         a SIGHUP, not just login shells
+print_cmd.c
+       - include the prototype for cprintf only if PREFER_STDARG is defined,
+         otherwise just have a K&R-style forward function declaration
 
-                                  9/13
-                                  ----
-config.h, config.h.mini
-       - changed the default primary prompt (PPROMPT) to "\s\$ "
-       - removed the INTERACTIVE_COMMENTS define
+hashlib.h
+       - reduced the default number of buckets in a hash table to 53
 
-flags.c
-       - interactive comments are now enabled by default, regardless of the
-         INTERACTIVE_COMMENTS define
+lib/tilde/tilde.c
+       - prime the result string in tilde_expand by allocating a new string
+         that's as long as the input string (+16 if a tilde appears in
+         the string to be expanded).  This should reduce the number of
+         reallocs
 
-input.h
-       - a new enum: stream_type, used in the BASH_INPUT struct
+subst.c
+       - broke the code that reads the output of a command substitution
+         through the pipe to the subshell out into a separate function:
+         read_comsub().  This does not use stdio, but rather reads
+         directly from the pipe into a local 128-character buffer
 
-parse.y
-       - bash_input.type is now initialized to st_none
+                                  4/11
+                                  ----
+execute_cmd.c
+       - some systems need both <sys/time.h> and <time.h>, so include both
+         if it's possible, otherwise include <sys/time.h> (if present)
 
-bashhist.c
-       - command_oriented_history is now the default
+lib/readline/rl{tty,defs}.h
+       - moved includes of <sys/stream.h>, <sys/ptem.h>, etc. to rltty.h
 
-documentation/bash.1
-       - removed description of `nolinks' variable, updated set -P
-         description
-       - removed description of `notify' variable, updated set -b
-         description
-       - removed description of `noclobber' variable, updated set -C
-         description
+lib/readline/terminal.c
+       - include rltty.h after rldefs.h
 
 variables.c
-       - IFS may now be unset
-
-builtins/read.def
-       - now does the right thing if IFS is unset (acts as if it is
-         set to " \t\n")
+       - changes to make environment creation faster and use less memory
+         (fewer malloc/free calls, too):
+
+               o two new variables: export_env_index (how many environment
+                 strings are in export_env) and export_env_size (the
+                 number of slots for strings allocated in export_env)
+               o added new function add_to_export_env, since adding the
+                 exported shell variables and shell functions does not
+                 need to search the export_env for a definition to supersede
+                 (we just cleared it out!)
+               o renamed add_or_supersede to add_or_supersede_exported_var,
+                 since it always works on export_env, and changed the second
+                 argument to a flag saying whether or not to allocate a new
+                 copy of the string placed into the environment
+               o changed calls to add_or_supersede to the new
+                 add_or_supersede_exported_var with the appropriate flags
+               o don't free and reallocate export_env in maybe_make_export_env,
+                 just free the strings and start anew
+               o prime the size of export_env from the total number of shell
+                 variables and shell functions -- this will always be enough
+                 for the exported shell functions and variables, and big
+                 enough most of the time for the entire environment
 
 builtins/cd.def
-       - added a new parameter to change_to_directory () which says
-         whether or not to follow symlinks, instead of using the
-         global no_symbolic_links
-       - changed cd_builtin to accept a -P option to disable symlink
-         following temporarily
+       - efficiency hack in bindpwd():  if PWD is exported, we will have to
+         rebuild the entire exported environment after every time we change
+         directories.  What we do is see if array_needs_making changes value
+         from 0 to 1 after bind_variable ("PWD", dirname) is called, and
+         that PWD is exported.  If that happens, we just replace the value
+         of PWD in the exported environment with a call to
+         add_or_supersede_exported_var
+
+bashline.c, parse.y
+       - check calls to pre_process_line to make a fresh copy of the line
+         if pre_process_line returns what it was passed, in preparation
+         for future changes
 
-builtins/ulimit.def
-       - instead of using a hardcoded `long' for the return type of the
-         rlimit functions, use RLIMTYPE, which defaults to long
-       - new defines string_to_rlimtype -> string_to_long and
-         print_rlimtype for systems which do not need `RLIMTYPE' defined
-         to something other than long
+bashhist.c
+       - pre_process_line now returns its argument if it did not make
+         any changes to it
 
-general.c
-       - function replacements for string_to_rlimtype and print_rlimtype
-         for machines which have RLIMTYPE defined in the machine description
+alias.c
+       - free the bucket entry holding the alias to be removed in
+         remove_alias, as well as the data
 
-general.h
-       - extern declarations for string_to_rlimtype and print_rlimtype
+                                  4/14
+                                  ----
+unwind_prot.c
+       - if an unwind-protect frame is being discarded, and its cleanup
+         function is `restore_variable', the `arg' member points to a
+         SAVED_VAR that must be freed.  This change is made in
+         remove_unwind_protect_internal and unwind_frame_discard_internal
 
-shell.c
-       - don't source file named by $ENV at script startup if act_like_sh
-         is turned on
+parse.y
+       - need to free memory allocated by parse_arith_cmd if it is an
+         arithmetic command, after using it to make a new word
 
-machines.h
-       - new entry for amiga/netbsd
-       - change all the netbsd entries to add -DRLIMTYPE=quad_t to
-         SYSDEP_CFLAGS
+subst.c
+       - fixed some memory leaks caused by not freeing the argument to
+         make_bare_word, which duplicates its string argument
+       - need to dispose list generated by list_rest_of_args in
+         paramter_list_remove_pattern
+       - make sure the return value from getpattern() is freed
+       - make sure array_value_internal always returns newly-allocated
+         memory
+       - get_var_and_type returns a new type: VT_ARRAYMEMBER if the
+         string passed is of the form var[index]
+       - make sure parameter_brace_substring frees the memory allocated
+         by get_var_and_type if verify_substring_values returns 0
 
-siglist.h
-       - define sys_siglist as _sys_siglist on the amiga only if USGr4 is
-         defined
+hashlib.c, hashlib.h
+       - new function, dispose_hash_table (table), which frees the
+         table's bucket array and the table itself
 
-print_cmd.c
-       - change so that printf is not prototyped on LynxOS with gcc
+alias.c
+       - call dispose_hash_table from delete_all_aliases instead of just
+         freeing the table
 
-lib/readline/Makefile
-       - changed the `installdirs' target to not fail if the directories
-         do not need creating
+pathexp.c
+       - make sure to free `newnames' (but *not* its contents) before
+         returning from ignore_globbed_names
 
-lib/readline/history.c
-       - fixed a bug in history_arg_extract which manifested itself when
-         !* was used after a command without arguments (e.g., pwd ; echo !*)
+builtins/exec.def
+       - make sure the argv created to pass to shell_execve is freed if
+         the execve fails and we're not exiting on failed execs
 
-                                  9/15
-                                  ----
-subst.c
-       - expand_word_internal should preserve the flags (other than
-         W_QUOTED) from the word passed as a parameter on the word it returns
-       - expand_words_internal renamed to expand_word_list_internal
-       - expand_word_list_internal does not perform word splitting or
-         globbing on words with the W_ASSIGNMENT bit set
-       - removed special treatment of `notify', `command_oriented_history',
-         `history_control', and `nolinks'
-       - rewrote some of the sv_* functions to remove or avoid calls to
-         sscanf, one of the most expensive C library functions
+expr.c
+       - broke evalexp into two functions: evalexp, which sets up the
+         jmp_buf that errors jump to, and subexpr, which does the
+         evaluation and pushing and popping of contexts
+       - readtok now calls subexpr to evaluate subexpressions in
+         parentheses
+       - evalexp now takes an additional paramter, a pointer to an int.
+         If the expression contains errors, the location to which this
+         points gets 0, otherwise it gets 1 to show that the value
+         returned may be used.  This plugs up memory leaks that were
+         the result of evalexp() longjmping back to top_level
+       - fixed a memory leak: expr_stack[0] was not being freed
 
-variables.c
-       - don't look for $command_oriented_history at startup, since it now
-         defaults to `on'
-
-general.h, general.c
-       - new function posix_initialize to do whatever is necessary to enable
-         `Posix mode'
-
-shell.c, subst.c
-       - call posix_initialize
-
-general.c
-       - rewrote replacements for strchr, strrchr to make them faster
-
-builtins/enable.def
-       - new -f option and necessary support to load builtins from a shared
-         object file on systems supporting both dlopen() and dlsym().  New
-         builtins loaded this way can replace existing shell builtins or
-         add completely new functionality
-
-builtins.h
-       - mkbuiltins.c creates `static_shell_builtins', which is a fixed
-         array, `shell_builtins' points to this array initially
-       - extern declaration for current_builtin
-
-builtins/mkbuiltins.c
-       - change to creat static_shell_builtins[] and declare shell_builtins
-         as a pointer to it
-       - change to declare `current_builtin' in created builtins.c
-
-builtins/source.def
-       - print an error message and return failure if no filename argument
-         is supplied
-
-builtins/common.c
-       - current_builtin is set by find_shell_builtin, find_special_builtin,
-         and builtin_address_internal
-       - new function builtin_usage, which prints the contents of
-         current_builtin->short_doc
-
-builtins/{bind,declare,enable,fc,getopts,hash,history,jobs,kill,read,set,
-         setattr,trap,ulimit,umask}.def
-       - changed the builtins in these files to use builtin_usage() to
-         print usage messages
-
-cpp-Makefile
-       - support for the HAVE_DLOPEN and HAVE_DLSYM defines
-
-machines.h
-       - added -ldl and -Bdynamic to the SunOS4 entry
-
-documentation/{bash.1,features.texi}
-       - documented new enable -f option to dynamically load builtins
+externs.h
+       - changed extern declaration for evalexp
 
-                                  9/16
-                                  ----
-test.c
-       - added `==' as a synonym for `='
+variables.c, subst.c, builtins/let.def
+       - changed calls to evalexp appropriately.  They either cause a
+         longjmp (top_level, DISCARD) (which is what the old stuff in
+         expr.c did) or are handled by returning an appropriate error
+         value (e.g., &expand_word_error in subst.c)
 
-                                  9/18
+                                  4/16
                                   ----
-bashline.c
-       - include readline/rlconf.h so that VI_MODE is defined if
-         appropriate
-
 shell.c
-       - removed `-nobraceexpansion' option
-
-flags.c, flags.h
-       - added new -B flag; enabled if brace expansion is turned on
-
-subst.c
-       - use brace_expand instead of !no_brace_expand
-
-builtins/set.def
-       - change set -o braceexpand to be equivalent to set -B
-
-parse.y
-       - in with_input_from_stdin, do nothing if bash_input.type already
-         is st_stdin or if there is already a stream with type st_stdin
-         on the saved stream stack
-       - new function stream_on_stack to find out if there is a saved
-         stream of a specified type
-
-documentation/bash.1, documentation/features.texi
-       - doeumented new set -B option
-       - removed -nobraceexpansion shell startup option
-
-                                  9/19
-                                  ----
-builtins/reserved.def
-       - made `help select' work
+       - make sure to free dollar_vars[0] before assigning it the first
+         argument following `-c command'
 
-cpp-Makefile
-       - removed references to the nonexistant `load.def'
-       - removed conditionals based on GETOPTS_BUILTIN
-
-builtins/getopts.def
-       - no longer $DEPENDS_ON GETOPTS_BUILTIN
-
-config.h, config.h.mini, builtins/help.def
-       - made the `help' builtin dependent on the HELP_BUILTIN define
-       - removed GETOPTS_BUILTIN
-
-builtins/mkbuiltins.c
-       - made the `$DEPENDS_ON' clause work for reserved words and
-         shell control structures in reserved.def by writing out
-         dependencies to builtext.h even if there is no `function'
-       - made the long_doc for each builtin and reserved word get
-         written out to builtins.c with #ifdef HELP_BUILTIN surrounding
-         the doc strings -- this makes the minimal shell much smaller
-
-shell.c, documentation/bash.1
-       - removed `-quiet' long option
-
-parse.y
-       - make sure that word splitting is not performed on the prompt
-         string after expanding in prompt_string_decode by calling
-         expand_string_unsplit instead of expand_string
-
-lib/readline/bind.c
-       - new readline variable `mark-directories': if set, completed
-         directory names have a slash appended
-
-lib/readline/complete.c
-       - support for `mark-directories'
-
-documentation/{bash.1,readline.3}, lib/readline/doc/rluser.texinfo
-       - documented the new `mark-directories' variable
-
-builtins/bind.def
-       - new option `-r' to remove a binding for a specified key sequence
-       - make sure that a failure return from bind resets the keymap
-         correctly if a -m option was supplied
+variables.c
+       - if unsetting a local variable with a previous context, make sure      
+         to free the hash table element used to store the local variable
 
-documentation/{bash.1,features.texi}
-       - documented new bind -r option
+lib/readline/terminal.c
+       - rearrange the includes so <sys/ioctl.h> is included before rltty.h,
+         as it is in rltty.c
 
-                                  9/20
+                                  4/17
                                   ----
-builtins/jobs.def
-       - new `disown' builtin
-
-documentation/{bash.1,features.texi}
-       - documented new `disown' builtin
-
-cpp-Makefile
-       - removed support for `MAKE_SHELL' cpp variable
-       - renamed endian.aux to mkendian, look for endian.c in support dir
-       - link in array.o, alias.o, braces.o, bracecomp.o
-         unconditionally, rely on cpp defines in the files to exclude code
-       - pass -DHAVE_SYS_SIGLIST if sys_siglist is defined
-       - pass -DHAVE_GETCWD if HAVE_GETCWD is defined in machines.h
-       - pass -DHAVE_VFPRINTF_EMUALTION through from machines.h to
-         compilation
-
-array.c
-       - don't compile in body of file unless ARRAY_VARS is defined
-
-braces.c
-       - don't compile in body of file unless BRACE_EXPANSION is defined
-
-alias.c
-       - don't compile in body of file unless ALIAS is defined
-
-bracecomp.c
-       - don't compile in body of file unless BRACE_EXPANSION and READLINE
-         are defined
+flags.c
+       - new function: reset_shell_flags, which resets all of the flags
+         back to their initial values
 
-bashline.c
-       - don't compile in body of file unless READLINE is defined
+flags.h
+       - extern declaration for reset_shell_flags
 
-bashhist.c
-       - don't compile in body of file unless HISTORY is defined
+builtins/set.def
+       - new function: reset_shell_options, which resets all of the -o
+         options that are not also shell flags back to their initial values
 
-siglist.c
-       - don't compile in body of file unless HAVE_SYS_SIGLIST is not
-         defined
+builtins/shopt.def
+       - new function: reset_shopt_options, which resets all of the shopt
+         options that are not also shell flags or -o options back to their
+         initial values
 
-getcwd.c
-       - don't compile in body of file unless HAVE_GETCWD is not defined
+builtins/common.h
+       - extern declarations for reset_shell_options and reset_shopt_options
 
-vprint.c
-       - don't compile in body of file unless USE_VFPRINTF_EMULATION
-         is defined
+execute_cmd.c
+       - broke the code that reinitializes things when an executable script
+         without a leading `#!' is found out into a new function:
+         initialize_subshell
+       - initialize_subshell now calls the reset_* functions that reset the
+         shell flags and options
 
-support/mksysdefs
-       - for SCO machines, define SYSDEF as SCO or SCOv4
+general.c, general.h
+       - move_to_high_fd now takes a third argument: the highest fd at which
+         to start looking.  If that's less than 20, the maximum number of
+         open files as returned by getdtablesize() is used (which is what
+         it did before this)
 
-lib/readline/readline.[ch]
-       - new function rl_push_macro_input (s), which makes s the current
-         macro input string
+jobs.c, shell.c, subst.c
+       - changed calls to move_to_high_fd appropriately
 
-endian.c
-       - renamed to support/endian.c
+[bash-2.01-beta1 frozen]
 
-                                  9/21
+                                  4/18
                                   ----
-lib/readline/complete.c
-       - more file types for the VISIBLE_STATS code:
-               |       FIFOs
-               %       character special devices
-               #       block special devices
-
-lib/readline/isearch.c
-       - made RETURN an alternate search string terminator
-
-builtins/read.def
-       - removed use of stdio -- unbuffered stdio on a dup of fd 0 is
-         a big loss
-
-builtins/set.def
-       - new function: minus_o_option_value, returns 1, 0, or -1 given
-         a -o option name (-1 means a bad name)
-       - reorganized list_minus_o_options to be more efficient
-
-execute_cmd.c
-       - when expanding a here document, use maybe_expand_string rather
-         than a simple expand_string to try a speed things up a bit
-
-input.c
-       - don't compile in the body of the file unless BUFFERED_INPUT
-         is defined in config.h
+general.c
+       - itos now uses a local char buffer to do its conversion, but still
+         returns newly-allocated memory
 
-                                  9/22
+                                  4/21
                                   ----
-jobs.h, siglist.h
-       - replaced instances of Solaris with SunOS5
-
-shell.c
-       - changed long option parsing code so that --arg is equivalent
-         to -arg, when `arg' is one of the recognized multichar options
-
-builtins/history.def
-       - rewrote to regularize the option parsing and use internal_getopt
-       - now allows only one of -awrn to be specified
-       - added a new -p option that adds each of its arguments to the
-         end of the history list, and deletes the `history -p' history
-         entry
-
-builtins/trap.def
-       - added new -p option to display specified trap values, or all
-         trap values if no other arguments supplied
-
-documentation/{bash.1,features.texi}
-       - documented new history -p option
-       - documented new trap -p option
+variables.c
+       - be a little more careful when checking for backwards-compatibility
+         with exported function definitions
 
-                                  9/25
+                                  4/22
                                   ----
-lib/readline/display.c
-       - fixed up the calcluation of the correct cursor line number (a `+'
-         and `-' were transposed in the calculation of `nleft')
+builtins/ulimit.def
+       - translate RLIM_INFINITY to limit.rlim_max if the current limit is
+         less than or equal to the hard limit, not just strictly less than
+         (the change of 3/28 was too drastic)
 
-                                  9/26
+                                  4/23
                                   ----
-general.c
-       - moved isint() here from test.c, renamed to legal_number
-
-general.h
-       - extern declaration of legal_number
-
-test.c
-       - only compile isint() if SHELL is not defined, define it as
-         legal_number otherwise
+oslib.c
+       - fixed definition of to_lower on machines without strcasecmp
 
 trap.c
-       - use legal_number in decode_signal instead of sscanf()
-
-builtins/common.c
-       - moved list_sigs to here from trap.def, renamed to
-         display_signal_list
-       - changed get_numeric_arg to use legal_number instead of doing
-         the parsing and calculation itself
+       - don't free the trap command in change_signal if the SIG_INPROGRESS
+         is set in the signal's flags -- it will cause memory to be freed
+         twice if a trap command resets the signal handler more than once,
+         and _run_trap_internal keeps a pointer to the trap command so it
+         can free it, so there will be no leaks
 
-builtins/common.h
-       - extern declaration for display_signal_list
-
-builtins/{trap.def
-       - changed to use display_signal_list for trap -l
-
-builtins/kill.def
-       - changed to use display_signal_list for kill -l
-       - added new kill -n signum option
-
-documentation/bash.1
-       - added description of new kill -l signame functionality
-       - added description of new kill -n signum feature
-       - added description of new enable -d option
-
-builtins.h
-       - added a char *handle member to `struct builtin' for later use
-       - new flags value: BUILTIN_DELETED
-
-builtins/mkbuiltins.c
-       - added code to inintialize the `handle' member to null in the
-         static builtin array definition
-
-builtins/common.c
-       - don't `find' a builtin if the BUILTIN_DELETED flag is set in the
-         flags word of the struct builtins array
-
-builtins/enable.def
-       - new option -d to remove a builtin loaded with -f, depends on
-         HAVE_DLCLOSE
-
-cpp-Makefile
-       - pass -DHAVE_DLCLOSE through from machines.h to compilation
-
-machines.h
-       - change SunOS4 machine description to define HAVE_DLCLOSE
-
-                                  9/27
+                                  4/24
                                   ----
-shell.c
-       - split shell exit code off into a separate function: exit_shell(status)
+aclocal.m4,configure.in
+       - removed BASH_CC_WORKS, since AC_PROG_CC now has the functionality
 
-builtins/exec.def
-       - rewrote for clarity and speed and to use the builtin getopt()
-       - added new -a, -c, and -l options
-       - now calls exit_shell if shell_execve fails and the shell is not
-         interactive
+shell.c, externs.h
+       - get_current_user_info is now a void function
 
-documentation/bash.1
-       - documented the new options to `exec'
+bashline.c
+       - alias_expand_line_internal was removed
+       - new function, alias_expand_line, performs alias expansion on
+         rl_line_buffer and either replaces rl_line_buffer or signals
+         an error
+       - new bindable commands: alias-expand-line and
+         history-and-alias-expand-line, available if ALIAS is defined
 
-                                  9/28
+                                  4/25
                                   ----
-builtins/exec.def
-       - if the execve fails and the shell is not going to exit, reinitialize
-         traps and signals
-       - only call end_job_control if subshell_environment != 0
-       - exec should exit unconditionally if the execve fails and
-         subshell_environment != 0
-
-subst.c
-       - if valid_brace_expansion_word fails, make sure `temp' is set to
-         NULL before trying to free it after the `goto bad_substitution'
+Makefile.in, lib/malloc/malloc.c
+       - changed the define that turns on malloc range checking from
+         `rcheck' to `RCHECK'
 
-cpp-Makefile
-       - add $(CPPFLAGS) to the compilation flags when making `mksignames'
-
-documentation/features.texi
-       - fixed a typo in the tilde expansion section
+lib/readline/isearch.c
+       - fixed a couple of places where rl_search_history would try to
+         free a NULL pointer
 
-                                  9/29
+                                  4/29
                                   ----
-machines.h
-       - DEC OSF/1 has the dlopen/dlsym/dlclose set of library functions
+unwind_prot.c
+       - fixed a problem with saving a variable that is a null pointer
+         in unwind_protect_var.  It happens only on machines where the
+         size of a pointer is not the size of an int.  The old FASTCOPY
+         code would copy the eight bytes at memory location zero, which
+         did not necessarily make a null pointer
 
+                                  4/30
+                                  ----
 shell.c
-       - don't execute /etc/profile if -noprofile given
-
-builtins/pushd.def
-       - new file, pushd/popd/dirs split off from cd.def
-       - replaced calls to sscanf with calls to legal_number
-
-builtins/Makefile, cpp-Makefile
-       - changes for pushd.def
-
-config.h, config.h.mini
-       - ALLOW_RIGID_POSIX_COMPLIANCE is no longer used
+       - run_startup_files should turn off job control, since the startup
+         files should be run without job control enabled -- this makes
+         SIGINT interrupt startup file execution again
+       - if we get a SIGINT or other longjmp to top_level while executing
+         the startup files, re-enable job control for interactive shells
+         before setting locally_skip_execution
 
-subst.c, variables.c
-       - GETOPTS_BUILTIN is no longer used
+                                   5/2
+                                   ---
+lib/readline/nls.c
+       - if we have setlocale(3), don't bother with checking the
+         environment variables for valid values; just use setlocale()
+         to set the locale categories from the environment variables
+         directly and go into eight-bit mode if the current locale is
+         not C or POSIX
 
-variables.c
-       - if the first character of argv[0] is not a `/', search the path
-         and canonicalize the result to find out how to set $BASH
+                                   5/5
+                                   ---
+sig.c
+       - make sure that the handler for SIGPROF is not changed if it has
+         been set to something other than SIG_IGN or SIG_DFL -- this makes
+         profiling work after the terminating signals have been initialized
 
-                                  10/2
-                                  ----
-builtins/enable.def
-       - changed enable_shell_builtin to use builtin_address_internal to find
-         the builtin rather than searching the list itself
-       - list_some_builtins skips a builtin if flags & BUILTIN_DISABLED != 0
-       - rewrote dyn_load_builtin to take a list of names to load from a
-         single filename
-       - don't dlclose the shared object in dyn_unload_builtin unless its
-         reference count drops to 0
-
-builtins/test.def
-       - don't bother making new copies of everything in the argument list
-         when constructing the argc and argv for test_command; just make
-         sure not to free anything but ARGV
-
-                                  10/3
-                                  ----
 bashline.c
-       - remove C-e binding in vi movement mode which switches into emacs
-         mode
-
-general.c
-       - make xfree only try to call free on non-null strings
+       - if a filename containing `!' is completed, and the user has started
+         the string with a `"', change the completion style to backslash-      
+         quoting, since there's no way to use `!' with double quotes (this
+         requires more changes to readline to really work right)
 
-                                  10/4
-                                  ----
-builtins/read.def
-       - new `-e' option that uses readline to read the line
-       - if one of the arguments is not a legal variable name, print an
-         error message and return failure
-
-builtins/reserved.def
-       - changed the `Variables' to `variables' so `help variables' works
-
-subst.c
-       - set startup_state to 2 in child of command substitution to try to
-         avoid some unneeded forks
+                                   5/6
+                                   ---
+lib/readline/complete.c
+       - changes to make_quoted_replacement, insert_all_matches, and
+         insert_match and their callers to allow the application-specific
+         filename quoting function to change the quote character (e.g., for
+         bash to change a filename containing a `!' and started with a
+         double quote by the user into a filename with the `!' quoted by
+         a backslas and no double quote)
 
-trap.c
-       - removed call to reset_terminating_signals in restore_original
-         signals; callers are now required to take care of that themselves,
-         if necessary
+                                   5/8
+                                   ---
+jobs.c
+       - new function: nohup_all_jobs(), calls nohup_job for each entry in
+         the jobs list
+       - delete_all_jobs is now global
 
-execute_cmd.c, subst.c
-       - added necessary calls to reset_terminating_signals before calls
-         to restore_original_signals
+jobs.h
+       - new extern declarations for delete_all_jobs() and nohup_all_jobs()
 
-execute_cmd.c
-       - when executing a null command in a subshell, don't bother passing
-         a string to make_child; just pass NULL
-       - in execute_builtin_or_function, don't add so many unwind-protects
-         if `subshell' == 1
-       - in command_substitute, call cleanup_the_pipeline to discard the
-         old pipeline, so pipeline_pgrp does not get set to 0 in
-         start_pipeline, which is called by make_child via making_children
+builtins/jobs.def
+       - `disown' without any jobspec arguments means the current job.  Fix
+         a core dump printing the error message when there is no current job
 
-jobs.c, nojobs.c
-       - new function, ignore_tty_job_signals, to set SIGTTIN, SIGTTOU, and
-         SIGTSTP to SIG_IGN
-       - new function, default_tty_job_signals, to set those signals
-         to SIG_DFL
-       - new function, cleanup_the_pipeline to free up the_pipeline and
-         set it to NULL
-
-                                  10/5
+                                  5/12
                                   ----
-builtins/history.def
-       - the history -p option is now -s (to sort of parallel the ksh
-         print -s option)
-       - the -s option now combines all of its arguments into a single
-         string and appends the string to the history list
-       - new history -p option to history expand each argument and print
-         the result without modifying the history list
-
-documentation/bash.1, documentation/features.texi
-       - documented the new -e option to read
-       - documented the new history -s and -p options
-       - documented the new cd and pwd -L options
-
-builtins/cd.def
-       - changed cd and pwd to use internal_getopt
-       - added the -L option to cd and pwd to follow symlinks (like if
-         set +P were issued)
-
-builtins/pushd.def
-       - added text for dirs +N and dirs -N to the dirs builtin long doc
-       - added -v option to dirs to print dirstack one dir per line with
-         stack index prepended
+subst.c
+       - process an expansion like $((foo); bar) as a command substitution,
+         not as an arithmetic expansion.  An arithmetic expansion must have
+         a closing `))'
 
-                                  10/6
+                                  5/14
                                   ----
-execute_cmd.c
-       - split the command searching code into a new function:
-         search_for_command
-       - removed a bunch of dead code from shell_execve
-       - removed call to reset_terminating_signals when executing a function
-         or builtin in a subshell (either via (xxx) or xxx &)
-       - don't add unwind protects at all in execute_function if subshell == 1
-
-lib/readline/chardefs.h
-       - new macro ALPHABETIC(c), returns 1 if c is a letter or digit
+builtins/evalstring.c
+       - the third argument to parse_and_execute() is now a flags word.
+         The caller can control the value of `interactive' and whether
+         or not history is disabled while parse_and_execute() runs
 
-lib/readline/readline.c
-       - don't call abort() in rl_change_case(); it's impolite in a
-         library function
-       - new macro, SWAP, used to swap values of two integers
-       - changed alphabetic to use ALPHABETIC, made it slightly faster
-       - modified rl_change_case() so that word capitalization is the
-         same as GNU Emacs
-
-lib/readline/search.c
-       - in noninc_dosearch, don't reset the history positition to what
-         it was if we're currently in vi editing mode (as per Posix.2
-         `/' and `?' vi-mode editing commands)
-
-                                  10/7
-                                  ----
-builtins/common.c
-       - changed single_quote and double_quote to use char pointers
-         rather than string indexing
-       - new function backslash_quote(string), which quotes special
-         characters in STRING using backslashes
+builtins/common.h
+       - new #defines for the flag values for parse_and_execute()
 
-                                  10/8
-                                  ----
-alias.h
-       - added an extern declaration for alias_expand_word
+{bashline,jobs,shell,subst,trap,variables}.c, parse.y, builtins/evalfile.c,
+builtins/{eval,fc}.def
+       - changed calls to parse_and_execute appropriately
 
-parse.y
-       - broke the alias expansion code off into a function
-         alias_expand_token; its return value says whether to re-read
-         a token or go on
-       - changed the alias expansion code to handle aliases that expand
-         to nothing better
-       - broke the code that does special-case token recognition off into
-         a function: special_case_tokens
-       - used the new functions to make sure that the special-case tokens
-         can be the expansion of an alias
-       - made sure that if in `posix mode' that reserved words cannot be
-         aliased and that all reserved words can be the values of aliases
-         and be recognized after expansion
-
-                                  10/10
-                                  -----
-lib/readline/complete.c
-       - replaced #ifdef SHELL code with two new exported readline interfaces:
-         rl_filename_quoting_function and rl_filename_dequoting_function.
-         Both return a pointer to char.
-       - new extern variable rl_filename_quote_characters, containing a list
-         of characters that cause a word to be quoted by the completer if
-         they appear in a file name
+builtins/evalfile.c
+       - if _evalfile() is passed FEVAL_HISTORY as part of the flags arg,
+         don't pass SEVAL_NOHIST to parse_and_execute
+       - new function: fc_execute_file, which sets FEVAL_HISTORY in the
+         flags argument to _evalfile()
 
 bashline.c
-       - new functions for rl_filename_quoting_function and
-         rl_filename_dequoting_function.
-       - initialize rl_filename_quoting_function and rl_filename_dequoting_function
-         in initialize_readline
-       - initialize rl_filename_quote_characters
-
-lib/readline/readline.h
-       - extern declarations for new public interfaces
-         rl_filename_quoting_function and rl_filename_dequoting_function
-       - added declarations for NO_MATCH, SINGLE_MATCH, and MULT_MATCH for
-         use by the filename quoting functions
-       - new extern declaration for rl_filename_quote_characters
-
-lib/readline/history.c
-       - made a version of single_quote be compiled in if SHELL is not
-         defined
-       - the `q' and `x' modifiers are now compiled in by default, not
-         just if SHELL is defined
-
-                                  10/11
-                                  -----
-subst.c
-       - string_quote_removal was being a little overzealous in stripping
-         things within embedded quoted strings when `quoted' was == 1.
-         Only remove one level of quotes each time through the function
-         This fixes the problem of quotes being stripped incorrectly in
-               var="The text \"hello\" should show up inside double quotes."
-
-lib/readline/history.c
-       - made the behavior of single quotes inhibiting history expansion
-         configurable with a variable: history_quotes_inhibit_expansion,
-         not just shell-specific
-       - added a new variable: history_search_delimiter_chars, which is a
-         list of characters that can also delimit a history search string
-
-lib/readline/history.h
-       - extern declaration of history_quotes_inhibit_expansion
-       - extern declaration of history_search_delimiter_chars
+       - call bash_add_history instead of add_history from
+         vi_edit_and_execute_command so the bash state variables get
+         updated properly.  This keeps the `v' command from operating
+         on an empty command when the history list is stifled
 
 bashhist.c
-       - set history_quotes_inhibit_expansion to 1 in bash_initialize_history
-       - initialize history_search_delimiter_chars to ";&()|<>"
-
-lib/readline/doc/{rltech,hstech}.texinfo
-       - documented new readline and history library interfaces
+       - bash_add_history is now global
 
-parse.y
-       - split the part of read_token that reads a single word off into
-         a new function: read_token_word
+bashhist.h
+       - extern declaration for bash_add_history
 
-lib/readline/chardefs.h
-       - include <string.h> by default; only check HAVE_STRING_H if
-         HAVE_CONFIG_H is defined
+builtins/fc.def
+       - call fc_execute_file instead of maybe_execute_file in the
+         edit-and-re-execute case (fc -e ...)
+       - don't manually insert the commands from the file created by `fc -e'
+         into the history list, just set remember_on_history and let
+         fc_execute_file take care of telling parse_and_execute to do the
+         right thing.  This makes compound commands and the `cmdhist'
+         and `lithist' settings work better.  This supersedes the fix of
+         1/27.  This was reported again by rchen@fractal.eng.yale.edu.
 
-                                  10/12
-                                  -----
 parse.y
-       - moved the `RESET' code out of read_token into reset_parser
-       - rewrote some of decode_prompt_string to make it more efficient
-       - rewrote more of read_token_word to make it more efficient
-       - make shell_getc cast its result to `unsigned char' before
-         returning it.  This fixes the problem of \255 appearing in a
-         line
-
-machines.h
-       - new entry for m68k machines running Linux
-
-                                  10/13
-                                  -----
-builtins/exec.def
-       - use search_for_command rather than find_user_command to look up
-         the path to exec, so the hash table and temp environment are used
-
-variables.c
-       - don't rebuild the export environment after binding a shell
-         function unless that function is exported
-       - make sure that copy_variable copies arrays correctly, using
-         dup_array()
-       - in assign_in_env, only call tilde_expand if a `~' appears somewhere
-         in the value
-
-execute_cmd.c
-       - if we found $PATH in the temp environment in search_for_command,
-         call find_user_command_in_path instead of find_user_command, so
-         we don't try to search the temporary env again.  Call
-         find_user_command as normal if PATH is not in the temp environment
-
-subst.c
-       - char_is_quoted should not be compiled in if READLINE is not
-         defined
+       - the body of a `for' command (the commands between do...done or
+         {...}) should be a `compound_list' instead of a `list'.  Problem
+         reported by cpg@research.bell-labs.com
 
+                                  5/19
+                                  ----
 lib/readline/complete.c
-       - add a new external interface: Function *rl_char_is_quoted_p,
-         which is called to find out whether a word break character is
-         quoted and should be skipped over when breaking words for
-         the completer
-
-lib/readline/readline.h
-       - extern declaration for rl_char_is_quoted_p
-
-bashline.c
-       - initialize rl_char_is_quoted_p to char_is_quoted
-
-lib/readline/doc/rltech.texinfo
-       - documented rl_char_is_quoted_p
-
-lib/readline/readline.c
-       - extend the undo records so that a `start' or `end' value of -1
-         means rl_point and a value of -2 means rl_end.  This is a start
-         to better support for undoing vi-mode commands like `C'
-
-lib/readline/vi_mode.c
-       - don't save what's entered in insert mode after a `C' command
-         for later insertion when doing a `redo'
-
-                                  10/16
-                                  -----
-test.c
-       - rewrote unop() to use a switch statement instead of a call to
-         strchr
-       - remove #ifdef SHELL blocks by defining getuid, geteuid, getgid
-         and getegid as references to current_user.{uid,euid,gid,egid}
-         respectively
-       - change group_member to only fetch the group list once and to use
-         NGROUPS_MAX or NGROUPS to find the maximum number of groups
-
-documentation/bash.1
-       - fixed description of ${#@} expansion
-
-                                  10/17
-                                  -----
-support/bashbug.sh
-       - add a `From:' line to the mail message handed to rmail
-
-                                  10/18
-                                  -----
-test.c
-       - rewrote binary_operator for speed and clarity
-       - removed age_of, added arithcomp(), filecomp() to support new
-         binary_operator
-       - removed support for `-l string'
+       - in filename_completion_function, if we find that the directory
+         pointer (return value from opendir(3)), is not null when state
+         is 0 (indicating that this is the first time the completion
+         function has been called for the current completion), call
+         closedir on it, assuming that it was left open by a previous
+         (interrupted) completion
 
-documentation/bash.1
-       - removed mention of `-l string' from `test' description
+[bash-2.01-beta2 frozen]
 
-                                  10/19
-                                  -----
-cpp-Makefile
-       - pass PROGRAM as the double-quoted shell name to compilation of
-         shell.c and error.c
+                                  5/27
+                                  ----
+Makefile.in
+       - make sure that `make distclean' (and other clean targets) remove
+         the `printenv' executable
 
-                                  10/20
-                                  -----
-support/bashbug.sh
-       - don't try to use ${word:-expansion}; ultrix sh doesn't understand it
+tests/execscript, tests/redir.tests
+       - make sure to set LANG=C and LC_ALL=C so the messages show up in
+         English
 
-hash.c
-       - new function: flush_hash_table (table, free_data) to delete the
-         contents of a given hash table.  *free_data is called to free
-         each item's data, if free() is inappropriate
+tests/run-func
+       - add a warning about exported functions in the environment
 
+                                  5/29
+                                  ----
 builtins/hash.def
-       - new functions free_hashed_filenames and free_filename_data to
-         flush the table of hashed filenames
-
-subst.c
-       - change sv_path to call flush_hashed_filenames directly
-
-variables.c
-       - only sort arrays of variables or functions for the environment or
-         `set' output if `posixly_correct' is set.  sh does it; ksh does
-         not, and there's no real requirement to do so
-       - rewrote delete_all_variables so it looks like flush_hash_table
-
-trap.c
-       - two new flag values for the `sigmodes' array: SIG_INPROGRESS,
-         which is set for sigmodes[sig] while a trap handler for sig
-         is executing, and SIG_CHANGED, which is set if a new trap
-         value is set when SIG_INPROGRESS is set.  This should obviate
-         the need to set the trap value to IMPOSSIBLE_TRAP_HANDLER while
-         the trap handler is executing
-
-alias.c
-       - rewrote delete_all_aliases so it looks like flush_hash_table
-
-                                  10/21
-                                  -----
-alias.c
-       - changed delete_all_aliases to call flush_hash_table directly
-         and use free_alias_data as the `free function' argument
+       - if one of the arguments passed to `hash' is an absolute pathname,
+         just continue the loop, don't do list=list->next first.  This
+         fixes the `hash a/b' -> core dump bug
 
-variables.c
-       - changed delete_all_variables to call flush_hash_table directly
+                                  5/30
+                                  ----
+general.c
+       - change canonicalize_pathname to leave a leading `/' alone, as
+         POSIX requires
 
-tests/run-test, tests/test-tests
-       - new scripts to run tests of the `test' builtin as part of the
-         regression test
+                                   6/2
+                                   ---
+support/xenix-link.sh
+       - shell script for linking bash under Xenix
 
-                                  10/24
-                                  -----
+                                   6/3
+                                   ---
 bashline.c
-       - initialize_hostname_list needs to look for HOSTFILE first
-       - hostname list is no longer sorted
-       - replaced binary search in hostnames_matching with a simple
-         linear search
-       - made the code that reads hostnames skip over the first word on
-         a line only if its first character is a digit, assuming it's
-         an Internet address
-
-copy_cmd.c
-       - removed copy_select_command; overload copy_for_command, since the
-         select and for command structs are exactly the same
-
-make_cmd.c
-       - combined make_for_command and make_select_command into a new
-         function, make_for_or_select
-       - rewrote make_here_document to remove the unneeded `switch' statement
-
-builtins/common.c, builtins/hash.def
-       - moved remove_hashed_filename from common.c to hash.def
-
-builtins/common.c
-       - remove the \r from error message printed by get_working_directory
-       - change parse_and_execute to call dispose_fd_bitmap directly then
-         discard the `pe_dispose' unwind-protect frame rather than running
-         the frame
-
-builtins/set.def
-       - changed how set -o options are set and retrieved, using set and get
-         functions to avoid all that special-case inline code
-
-                                  10/26
-                                  -----
-test.c
-       - added unary operator `-o', which returns true of the shell option
-         name given as an argument is set
-
-lib/readline/readline.c
-       - added a definition of set_lines_and_columns to be called if the
-         library is not compiled -DSHELL
-
-shell.c
-       - added a --verbose startup long option
-       - renamed `--nolineediting' to `--noediting'
-
-                                  10/27
-                                  -----
-lib/readline/util.c
-       - new file, for readline utility functions
-
-lib/readline/readline.c
-       - moved a bunch of functions to util.c
-
-subst.c
-       - make sure set_sigint_handler is called only by the subshells doing
-         command and process substitution
-
-builtins/read.def
-       - make sure that rlbuf is initialized to null
-
-trap.c
-       - new flag for sigmodes[] members: SIG_IGNORED, set when signal is
-         ignored, even if it's special or untrappable
-       - new function: signal_is_ignored (sig), which returns 1 if SIG
-         has been ignored with trap ''
+       - fixed a memory leak in command_word_completion_function, courtesy
+         of a.pfaller@pop.gun.de
 
-builtins/trap.def
-       - changed to use the builtin getopt
+hashcmd.c
+       - fixed find_hashed_filename to always return a newly-allocated
+         string
 
-shell.c
-       - added a check to sigint_sighandler for whether or not SIGINT has
-         been ignored with trap '' in an interactive shell.  This fixes
-         the problem with `read' being interruptible in an interactive
-         shell even if SIGINT is being ignored
-
-                                  11/8
-                                  ----
-lib/readline/Makefile
-       - added definition of INSTALLED_HEADERS, just in case
-
-                                  11/11
-                                  -----
-variables.c
-       - change assign_in_env so that it doesn't use savestring ("") to
-         set `value' to a dummy value; don't call strcpy if there's
-         nothing to copy
-
-                                  11/15
-                                  -----
-general.h
-       - new defines, legal_variable_starter and legal_variable_char
-       - new define SIGRETURN(n) which encapsulates the VOID_SIGHANDLER
-         differences when returning from a signal handler
-
-general.c, variables.c, subst.c, expr.c
-       - use legal_variable_starter and legal_variable_char
-
-shell.c, nojobs.c, trap.c, jobs.c, builtins/suspend.def
-       - change to use SIGRETURN macro
-
-subst.c
-       - massive changes to clean up the code and remove unused code and
-         variables
-       - expanded the ${#param} code so that all of the shell special
-         variables may have their length taken
-
-tests/run-tilde
-       - new test for tilde expansion
-
-bashline.c
-       - fix a bug in command_subst_completion_matches: make sure that
-         `matches' is static
-
-parse.y
-       - don't print a prompt when not using readline if the current
-         input type is st_string
-
-machines.h
-       - add -DINT_GROUPS_ARRAY to SYSDEP_CFLAGS on ultrix
-       - fixes to the cray machine description from Bill Jones
-
-braces.c
-       - fixed a bug in brace_gobbler that prevented a backslash from
-         escaping an open brace
-
-                                  11/16
-                                  -----
-tests/braces-tests, tests/run-braces
-       - new regression tests for brace expansion
-
-builtins/pushd.def
-       - new -p option for `dirs' that prints dirstack on per line
-         without numbers
-
-                                  11/17
-                                  -----
-command.h
-       - move redirection error values here from execute_cmd.c
-       - new defines INPUT_REDIRECT and OUTPUT_REDIRECT
-
-shell.c
-       - make the default MAINTAINER `bash-maintainers@prep.ai.mit.edu'
-
-execute_cmd.c
-       - many changes to clean up the code and remove unused variables and
-         functions
-       - new functions: redirection_error, find_in_path_element,
-         find_absolute_program
-       - fixes to redirection error reporting, so things like exec 4<&y*
-         and exec 4<&$FOO are displayed correctly
-       - removed the `lexical_scoping' code
-
-flags.c, flags.h
-       - removed the lexical_scoping code and variable
-
-documentation/{bash.1,features.texi}
-       - removed the description of the `-l' option to `set'
-
-jobs.c
-       - don't try to open /dev/tty to get the controlling tty, use
-         fd 2 like other job control shells
-
-lib/readline/vi_mode.c
-       - when using `d%', make sure the matching character found by
-         the `%' is deleted by the `d'.  Ditto for `c%'.
-       - stub function for vi undo: rl_vi_undo.  Right now it just
-         calls rl_undo_command
-
-lib/readline/vi_keymap.c
-       - change to call rl_vi_undo instead of rl_undo_command
-
-lib/readline/readline.h
-       - extern declaration for rl_vi_undo
-
-                                  11/21
-                                  -----
-execute_cmd.c
-       - fix to print_select_list to avoid a possible divide-by-zero error
-         and subsequent core dump
-       - fix to execute_select_command to just return 0 if there is no
-         select list
-
-parse.y
-       - remove `in' from the list of tokens that cannot take trailing
-         semicolons
-
-builtins/read.def
-       - make sure that leading IFS whitespace is removed before calling
-         get_word_from_string the first time.  This matters when IFS is
-         not " \t\n" but non-null
-       - make sure the array code uses IFS to split the input string
-         before assigning it to the array
-
-                                  11/22
-                                  -----
-parse.y
-       - make sure that if \nnn expands to CTLESC or CTLNUL, the char
-         is protected by a CTLESC
-       - new variable `promptvars', which, if non-zero, causes all the
-         variable expansions to be performed in decode_prompt_string.
-         If zero, only quote removal is performed.
-
-builtins/source.def
-       - new variable: `source_uses_path', set to 1 by default.  If
-         non-zero, the `.' builtin uses $PATH to find the script to
-         source
-
-builtins/getopt.h
-       - cut out everything not needed by bash
-
-builtins/getopt.c
-       - cut out everything not needed by bash
-
-builtins/getopts.def
-       - removed the call to getopt_set_posix_option_order, which is no
-         longer necessary
-
-execute_cmd.c
-       - split the code that writes out here documents to files out into
-         a separate function
-
-                                  11/23
-                                  -----
-builtins/getopt.c, builtins/getopt.h, builtins/getopts.def, subst.c
-       - prefix all of the getopt variables and functions with `sh_'
-         (that is, optind becomes sh_optind and getopt becomes sh_getopt)
-         to avoid confusion with a system's getopt(3) implementation
-
-subst.c
-       - new functions: parameter_brace_substring and verify_substring_values
-         and changes to expand_word_internal to support the ksh-93
-         ${var:exp1:exp2} substring syntax
-
-documentation/bash.1
-       - documented the new ${var:exp1[:exp2]} syntax
-
-                                  11/25
-                                  -----
-builtins/setattr.def
-       - don't allow readonly -n at all
-
-array.c
-       - split array_to_string into two parts; a new function
-         array_to_string_internal does the real work
-       - new function array_subrange () to return a subset of the elements
-         in an array
-
-subst.c
-       - augmented the substring code to handle the positional parameters
-         and array variables
-       - made quote_list and dequote_list return their WORD_LIST *
-         arguments so they can be used like
-
-               z = string_list ((quoted ? quote_list (l) : l), xxx);
-
-       - augmented the ${xxx} expansion code to do indirect variable
-         references if the first character of the variable name is `!'
-
-tests/new-exp.tests
-       - added regression tests for substring expansion
-       - added regression tests for indirect variable references
-
-                                  11/28
-                                  -----
-builtins/set.def
-       - added set -o hashfunc and set -o onecmd, synonyms for set -h
-         and set -t, respectively
-
-builtins/shift.def
-       - changed shift so that the positional parameters are not changed
-         if the argument is > $# (this is ksh and Posix.2, unlike sh)
-
-documentation/bash.1
-       - documented true behavior of `shift'
-
-lib/readline/kill.c
-       - split the kill ring management code and the kill commands out
-         from readline.c into this file
-
-lib/readline/undo.c
-       - split the code that does undoing out of readline.c into this file
-
-shell.c
-       - force the shell to exit with status 127 if a longjmp back to
-         run_one_command occurs with bash -c
-       - force the last command exit status to 1 if a
-         longjmp (top_level, DISCARD) is performed
-
-builtins/read.def
-       - don't throw away partial lines after reading EOF
-
-subst.c
-       - command substitution should not inherit the -e flag
-
-builtins/source.def
-       - make sure to set the exit status correctly when in posix mode
-         and the filename argument to `.' does not exist
-
-                                  11/29
-                                  -----
-lib/readline/input.c
-       - split the input buffering and character input code out of
-         readline.c to here
-
-lib/readline/macro.c
-       - moved the keyboard macro management code to here from readline.c
-
-lib/readline/readline.c
-       - removed the STATIC_MALLOC code
-
-lib/readline/rltty.c
-       - return -1 in POSIX get_tty_settings if tcgetattr returns -1 and
-         errno != EINTR, even if output is being flushed
-
-                                  12/1
-                                  ----
-machines.h
-       - fixes to the hpux_8 and hpux_9 machine descriptions
-
-trap.c
-       - make run_exit_trap return the right exit status
-         (last_command_exit_value)
-       - run_exit_trap no longer preserves the value of last_command_exit_value
-         around the execution of the trap commands
-       - run_exit_trap now turns off SIG_TRAPPED and sets SIG_INPROGRESS
-         and will not try to run anything if SIG_INPROGRESS is set
-
-trap.h
-       - change definition for run_exit_trap
-
-shell.c
-       - call run_exit_trap only if trap[0] is set and not ignored
-
-builtins/exit.def
-       - make sure we only source the .bash_logout file once, even if it
-         contains a call to `exit'
-
-execute_cmd.c
-       - if we run an exit trap in a (...) user subshell, allow it to
-         override the exit status of the subshell
-
-lib/readline/readline.c
-       - made rl_delete_text bounds check its `to' argument, and limit
-         it at rl_end
-
-lib/readline/vi_mode.c
-       - make rl_vi_subst call `rl_delete_text' directly for the `s'
-         command
-
-support/mksysdefs
-       - define a new variable for the sysdefs.h file for ISC machines:
-         ISC_release, which can be ISC_2, ISC_3, or ISC_4
-
-machines.h
-       - don't `#undef' HAVE_GETCWD on ISC 4.x machines
-       - `#undef' HAVE_RESOURCE on ISC 4.x machines
-
-support/mkversion.c
-       - include "posixstat.h" rather than <sys/stat.h> for the benefit
-         of ISC machines
-
-                                  12/5
-                                  ----
-lib/readline/complete.c
-       - changed username_completion_function so that a null username
-         generates a list of all users as possible completions
-
-lib/readline/readline.h
-       - added definitions for STREQ, STREQN
-
-lib/readline/{search.c,isearch.c,kill.c}
-       - removed private definitions of STREQ, STREQN
-
-execute_cmd.c
-       - in find_user_command_internal, just return a copy of the pathname
-         passed as an argument if there is no PATH
-
-                                  12/6
-                                  ----
-siglist.h
-       - NetBSD 1.0 does not need a define for strsignal()
-
-                                  12/8
-                                  ----
-subst.c
-       - removed assignment_name, word_list_quote_removal, word_quote_removal,
-         and sub_append_number -- unused functions
-       - removed some unexecuted code from expand_word_internal
-
-                                  12/9
-                                  ----
-execute_cmd.c
-       - if PATH is set to the empty string, find executables in the
-         current directory
-
-shell.c, parse.y, trap.c
-       - before setting the SIGINT sighandler unconditionally to one of
-         sigint_sighandler or termination_unwind_protect, check that it
-         is not ignored.  Now trap '' 2 really sets the SIGINT signal
-         handler to SIG_IGN. [In 1.14.3]
-
-trap.c
-       - rewrote set_sigint_handler to use SIG_IGNORED rather than checking
-         against IGNORE_SIG
-       - changed ignore_signal, run_exit_trap, maybe_call_trap_handler, and
-         run_trap_internal to check SIG_IGNORED
-
-shell.c
-       - removed the check for signal_is_ignored(SIGINT) in sigint_sighandler
-
-                                  12/11
-                                  -----
-sig.c, sig.h
-       - new files, moved signal-related definitions and code here from
-         shell.c, general.h, general.c, jobs.c, jobs.h, externs.h
-
-unwind_prot.c, shell.h, nojobs.c
-       - include sig.h
-
-                                  12/12
-                                  -----
-jobs.c
-       - only break out of loops if SIGTSTP was used to stop a job in the
-         loop, the shell is currently interactive, and job control is on.
-         SIGSTOP does not break loops. [In 1.14.3]
-
-                                  12/13
-                                  -----
-expr.c
-       - bases < 2 or > 36 are now accepted without silently being reset
-         to 10
-
-braces.c
-       - make sure array_concat copies the array it returns if one of
-         the arguments is null [In 1.14.3]
-
-                                  12/14
-                                  -----
-subst.c
-       - split the ${...} expansion code out into a separate function,
-         static char *parameter_brace_expand()
-       - changes to array_value so that any variable can be referred to
-         as an array with an integer subscript.  The value will be
-         returned if a non-array variable is referred to as ${var[0]};
-         if the subscript is > 0 a null string is returned
-
-                                  12/15
-                                  -----
-machines.h
-       - fixes to freebsd description for FreeBSD 2 [In 1.14.3]
-
-support/bashbug.sh
-       - changed to use /usr/lib/sendmail if present or /usr/sbin/sendmail
-         if present, defaulting to rmail [In 1.14.3]
-
-bashhist.c
-       - HISTFILESIZE now controls how large the history file is after
-         it is written.  After saving the shell history, sv_histfilesize
-         will truncate it if necessary.  history -w can override this.
-
-documentation/bash.1
-       - documented change to treatment of HISTSIZE when saving history
-
-lib/malloc/malloc.c
-       - removed the calls to sigsetmask() in malloc().  This should
-         result in a speed improvement
-
-                                  12/19
-                                  -----
-builtins/enable.def
-       - don't allow -f or -d in a restricted shell
-
-builtins/alias.def
-       - rewrote alias and unalias to use the internal getopt
-       - added -p option to print the alias list to alias
-       - fixed up the documentation for `alias'
-
-documentation/{bash.1,features.texi}
-       - updated the documentation for `alias'
-       - updated the documentation for $_
-
-array.c,array.h
-       - new function `empty_array (ARRAY *a)' removes all of the
-         elements in a without destroying the array variable in
-         preparation for overwriting it.  Used by read -a.
-
-builtins/read.def
-       - call empty_array() before assigning list of values with read -a
-       - changed dispose_array to use empty_array to destroy the
-         array elements
-
-variables.c
-       - set $_ to argv[0] at variable initialization time
-
-                                  12/20
-                                  -----
-subst.c
-       - broke the pattern removal code into a few separate functions:
-         getpatspec to get the pattern specifier, getpattern to do the
-         necessary word expansions and return the pattern to be matched
-       - new function: parameter_list_remove_pattern(), which implements
-         the ${param[#%][[%#]]pattern} where param is `@' or `*'
-
-documentation/bash.1
-       - documented new pattern removal functionality for the positional
-         paramters
-
-general.c
-       - new function strsub (s, pat, rep, gflag) replaces PAT with REP
-         in S.  All occurrences are replaced if GFLAG != 0; the first is
-         replaced otherwise
-       - changed strindex() to avoid multiple calls to strnicmp by
-         checking first character of the string
-
-builtins/fc.def
-       - changed to use builtin_getopt with a check for fc numbers as
-         arguments
-       - some code rearranging for efficiency and clarity
-       - fc_dosubs now just calls strsub(); fc_replace is gone
-
-                                  12/21
-                                  -----
-subst.c
-       - new function, match_pattern, which matches a shell globbing
-         pattern anywhere in a string and returns the boundaries of the
-         match
-
-lib/readline/readline.h
-       - declarations for rl_insert_command and rl_backward_char_search
-
-lib/readline/readline.c
-       - new function rl_insert_comment, no longer vi-mode-specific
-       - new function rl_backward_char_search
-
-lib/readline/bind.c
-       - comment-begin now sets the comment char for emacs and vi modes
-       - variable holding the value is now _rl_comment_begin
-
-lib/readline/vi_mode.c
-       - move the `comment-begin' stuff to readline.c and bind.c
-
-lib/readline/funmap.c
-       - vi-comment is now insert-comment
-       - new bindable command character-search-backward
-
-lib/readline/vi_mode.c
-       - command mode `#' now invokes rl_insert_comment
-
-lib/readline/emacs_keymap.c
-       - M-# now bound to insert-comment
-       - M-space now bound to set-mark
-       - M-^] now bound to character-search-backward
-
-bashline.c
-       - posix_readline_initialize now calls rl_variable_bind to set the
-         value of comment-begin rather than directly modifying
-         _rl_comment_begin
-
-documentation/{bash.1,readline.3}, lib/readline/doc/rluser.texinfo
-       - added description of new bindable `insert-comment' command
-       - documented new M-space emacs mode binding
-       - documented new character-search-backward command and default
-         emacs mode binding to M-C-]
-
-shell.c
-       - only call posix_initialize if posixly_correct is set
-
-                                  12/22
-                                  -----
-cpp-Makefile
-       - make $(Program) depend on $(srcdir)/.distribution, for the
-         benefit of systems where `make' does not have VPATH support
-         [In 1.14.3]
-
-jobs.c
-       - if a foreground job is killed by SIGINT while job control is
-         active, print a newline to compensate for the kernel printing
-         ^C without one [in 1.14.3]
-
-bashline.c
-       - make sure bashline_reinitialize resets rl_completion_entry_function
-         to NULL, as the comment says it should [In 1.14.3]
-
-                                  12/23
-                                  -----
-test.c
-       - fix a problem that caused core dumps if a `)' was missing in a
-         parenthesized expression [In 1.14.3]
-
-jobs.c
-       - broke the code the manages the manipulation of the job table and
-         process status out of flush_child into a new function waitchld()
-       - flush_child now just calls waitchld() with a parameter that tells
-         it not to block
-       - wait_for calls waitchld() with the pid it's looking for and tells
-         it to block (don't call it with WNOHANG)
-       - cleaned up wait_for considerably -- turned the wait_loop: label
-         stuff into a do-while loop and removed the setting of job status
-         (that's now done only by waitchld).  wait_for now calls
-         waitchld continuously until the job it is interested in is
-         marked JDEAD.
-
-                                  12/28
-                                  -----
-subst.c
-       - fixed expand_word_internal so that any word that expands into
-         nothing and contains a double-quoted $@ is removed, like sh
-         and ksh
-       - new function: expand_string_for_rhs, which calls expand_word_internal
-         with a variable that lets it find out whether or not a $@ appeared
-         in the WORD in ${paramOPword} when expanding it, so that "$@"
-         and various other things are handled correctly on the rhs
-       - added params for parameter_brace_expand to tell expand_word_internal
-         if a quoted $@ was processed as part of the rhs (or even the lhs);
-         these new params are passed along to parameter_brace_expand_rhs
-       - pass the right value of quoted to parameter_brace_expand_rhs from
-         parameter_brace_expand.  expand_string_for_rhs doesn't need to know
-         whether the brace expression is quoted
-
-                                  12/31
-                                  -----
-support/printenv
-       - now an official part of the distribution, moved from CWRU/misc
-         [in 1.14.3]
-
-cpp-Makefile
-       - copy support/printenv into the `tests' directory when making tests
-         [in 1.14.3]
-       - change to understand GCC_STANDARD [in 1.14.3]
-
-support/bashbug.sh
-       - fixed a typo that caused it to not parse correctly [in 1.14.3]
-
-machines.h
-       - define GCC_STANDARD if the standard `cc' is gcc and you don't want
-         to use the compiler named `gcc' for some reason [in 1.14.3]
-
-                                   1/2
-                                   ---
-general.h
-       - added FS_DIRECTORY to the list of flags that file_status returns
-
-execute_cmd.c
-       - changed find_in_path_element to return null if the flags argument
-         specifies FS_EXEC_ONLY and the file is not executable
-       - return FS_DIRECTORY from file_status if the argument specifies a
-         directory
-       - new function, is_directory (char *), which returns non-zero if the
-         filename argument is a directory
-
-execute_cmd.h
-       - extern declaration for is_directory
-
-flags.c, flags.h
-       - hashing_disabled and locate_commands_in_functions were removed,
-         hashing_enabled added
-
-execute_cmd.c, builtins/common.c. builtins/hash.def
-       - use hashing_enabled instead of hashing_disabled, and reverse
-         the sense of tests of it
-
-documentation/bash.1, documentation/features.texi
-       - changed description of `set -h/set -o hashcmds', removed
-         set -d/set -o nohash
-
-bashline.c
-       - changed command_word_completion_function to return matches if names
-         are directories as well as if they are executable files
-
-support/mksysdefs
-       - look for `ranlib' in $PATH before searching the file system;
-         look in /usr/gnu/bin for it; default to `:' if not found
-
-general.c
-       - change ansicstr to accept a second argument telling it whether to
-         recognize \c and to pass back a non-zero value in it if \c is
-         seen
-
-general.h
-       - changed extern declaration of ansicstr
-
-subst.c
-       - call ansicstr with an extra argument
-
-                                   1/3
-                                   ---
-builtins/echo.def
-       - rewrote to use ansicstr() with the new argument
-
-                                   1/4
-                                   ---
-trap.c
-       - changed instances of signal() to set_signal_handler() [in 1.14.4]
-       - combined reset_signals and restore_signals into a single function,
-         since they were essentially identical
-
-subst.c
-       - if set -u is set, references to the positional parameters now
-         generate errors if that parameter is not set [in 1.14.4]
-
-lib/*/Makefile, builtins/Makefile
-       - since RANLIB can be just `ranlib', just try to run it without
-         checking that the file exists [in 1.14.4]
-
-builtins/set.def
-       - changed `hashcmds' to `hashall'
-
-documentation/{bash.1,features.texi}
-       - changed `hashcmds' to `hashall'
-
-                                   1/5
-                                   ---
-trap.c
-       - make the loop that restores signal handlers run from signal 0 to
-         make sure user subshells don't inherit traps on `exit' (to fix
-         for 1.14.3, change restore_original_signals so that the loop
-         starts from 0) [in 1.14.4]
-
-variables.c
-       - don't import exported function definitions at startup if the
-         shell is restricted
-
-builtins/source.def
-       - don't allow use of pathname arguments containing `/' in a
-         restricted shell
-
-execute_cmd.c
-       - when a shell is spawned to execute a shell script without a
-         #! line, turn off the -r flag if the shell is restricted
-
-shell.c
-       - added a new long option `--restricted'
-
-documentation/bash.1
-       - added a section on the restricted shell, and documented the
-         new `--restricted' long invocation option
-
-                                   1/7
-                                   ---
-shell.c
-       - when using bash -c command, make run_one_command return
-         last_command_exit_value if a throw_to_top_level with value
-         EXITPROG occurs [in 1.14.4]
-
-print_cmd.c
-       - make sure to initialize arg_index in the non-varargs implementation
-         of cprintf [in 1.14.4]
-
-jobs.c
-       - don't try to change the state of the SIGCHLD handler before
-         calling waitchld() from wait_for, since SIGCHLD is blocked
-         while this code is executing [in 1.14.4]
-
-                                  1/11
-                                  ----
-lib/readline/rltty.c
-       - call control_keypad iff the value of a new variable,
-         _rl_enable_keypad, is non-zero
-
-lib/readline/bind.c
-       - new readline variable `enable-keypad' to control whether readline
-         tries to manipulate the application keypad
-
-documentation/{bash.1,readline.3}, lib/readline/doc/rluser.texinfo
-       - documented new `enable-keypad' variable
-
-                                  1/12
-                                  ----
-lib/readline/search.c
-       - make sure to call rl_unix_word_rubout and rl_unix_line_discard
-         with the correct arguments [in 1.14.4]
-
-make_cmd.h
-       - make sure make_select_command is declared even if SELECT_COMMAND
-         is not defined
-
-parse.y
-       - make sure the \[ and \] escape sequences are not recognized if
-         READLINE is not defined [in 1.14.4]
-
-config.h
-       - make sure HISTORY is defined if READLINE is; code moved here
-         from bashhist.c [in 1.14.4]
-
-bashhist.c
-       - removed check for READLINE being defined without HISTORY; now
-         in config.h
-       - new function, bash_history_reinit
-
-flags.h, flags.c, builtins/set.def
-       - the -H/-o histexpand flag should be compiled into the shell
-         only if BANG_HISTORY is defined [in 1.14.4]
-
-subst.c
-       - don't include sv_histchars unless BANG_HISTORY is defined
-         [in 1.14.4]
-       - if QUOTED is true in parameter_brace_expand_rhs, pre-process the
-         word on the rhs of the parameter expansion by a call to
-         string_extract_double_quoted with the STRIPDQ parameter set to 1
-       - new arg for string_extract_double_quoted; causes it to strip
-         double quotes and alter its backslash handling behavior; designed
-         to be called from parameter_brace_expand_rhs
-       - changed all other instances of string_extract_double_quoted to
-         call it with STRIPDQ set to 0, to get old behavior
-
-shell.c
-       - call bash_history_reinit rather than manipulating history
-         variables directly
-
-variables.c
-       - don't auto-export $BASH [in 1.14.4]
-
-tests/rhs-exp.tests
-       - new test script to check for behavior fixed by changes to
-         string_extract_double_quoted and parameter_brace_expand_rhs
-
-parse.y
-       - `for' and `select' must now take non-empty lists between
-         `in' and `;'
-
-                                  1/16
-                                  ----
-subst.c
-       - fixed string_quote_removal to do double-quoted string processing
-         itself rather than call string_extract_double_quoted, which
-         assumes that a call to expand_word_internal or the equivalent
-         will follow immediately and leaves some backslashes in place,
-         inappropriately for quote removal
-
-                                  1/23
-                                  ----
-subst.c
-       - make sure to set `temp' to NULL after it's freed by sub_append_string
-         in expand_word_internal to keep it from pointing to newly-allocated
-         memory that will be subsequently freed, causing a `memory freed
-         twice' error [in 1.14.4]
-
-trap.c
-       - handle the EXIT_TRAP specially in reset_or_restore_signal_handlers,
-         since in both cases we simply want to free up the trap string and
-         mark the signal as not trapped
-
-shell.h
-       - added \n to the list of characters in slashify_in_double_quotes
-
-                                  1/26
-                                  ----
-subst.c
-       - make string_extract_single_quoted and string_extract_double_quoted
-         `inline'
-       - new function skip_single_quoted, used when we used to call
-         string_extract_single_quoted and just throw the returned string
-         away
-       - new function skip_double_quoted for the same purpose
-
-                                  1/28
-                                  ----
-subst.c
-       - fixed expand_word_internal so that if an assignment word
-         is expanded, no word splitting is performed [in 1.14.4]
-
-builtins/ulimit.def
-       - some systems lack RLIMIT_CPU; so `#ifdef' its use [in 1.14.4]
-       - some versions of cpp expand parameters like \n if `n' is an
-         argument to the macro; change `n' to `num' in the definition
-         of print_rlimtype to compensate [in 1.14.4]
-
-builtins/read.def
-       - make sure the read loop sets `saw_escape' to note that an
-         escape character was read if CTLESC or CTLNUL is read [in 1.14.4]
-
-shell.c, sig.c
-       - only test interactive_shell before calling maybe_save_shell_history
-         [in 1.14.4]
-shell.c
-       - include <locale.h> if HAVE_LOCALE_H is defined
-       - call setlocale(LC_ALL, "") at the beginning of main() if
-         either _POSIX_VERSION or HAVE_SETLOCALE is defined
-
-support/mksysdefs
-       - look for <locale.h>, define HAVE_LOCALE_H if found
-
-cpp-Makefile
-       - pass HAVE_LOCALE_H through from sysdefs.h to the build process
-
-bashhist.c
-       - remove test against interactive_shell in maybe_save_shell_history
-         [in 1.14.4]
-
-variables.c
-       - moved definition of DEFAULT_MAIL_PATH to config.h
-
-config.h, config.h.mini
-       - now has definition of DEFAULT_MAIL_PATH [in 1.14.4]
-       - changed default value of PATH to
-         `/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin:.'
-         [in 1.14.4]
-
-documentation/bash.1
-       - updated the example of the default path in the description of
-         the PATH variable
-
-lib/readline/readline.c
-       - set up a table of `legal' LC_CTYPE values and match the value of
-         $LC_CTYPE against it when deciding whether or not to default to
-         eight-bit input and output
-       - check for LC_ALL, LC_CTYPE, and LANG, in that order, for names to
-         check against the legal_lc_ctype_values table
-
-lib/readline/bind.c
-       - moved strindex, stricmp, and strnicmp to lib/readline/util.c, 
-         added _rl_ prefix to names
-       - some miscellaneous code cleanups and speedups
-
-lib/readline/rldefs.h
-       - define _POSIX_VDISABLE as _SVR4_VDISABLE if there is a define
-         for the latter and not the former [in 1.14.4]
-       - moved defining _rl_stricmp and _rl_strnicmp as strcasecmp and
-         strncasecmp, respectively, here from bind.c, since the functions
-         are now defined in util.c and used in two files
-
-builtins/common.c
-       - removed the \n case in double_quote, so a backslash is not added
-         before an existing newline.  The \<newline> pair is removed by
-         the parser before anything else in the shell gets hold of it
-         except within single quotes [in 1.14.4]
-
-                                  1/30
-                                  ----
-general.c
-       - make sure the string index in canonicalize_pathname never goes
-         < 0 (it can, in some cases, result in `start' being -1, and `i'
-         being set to that) [in 1.14.4]
-
-                                   2/1
-                                   ---
-execute_cmd.c
-       - fix a typo in a call to `access' in AFS-specific code [in 1.14.4]
-
-                                   2/3
-                                   ---
-builtins/shopt.def
-       - finally added new `shopt' builtin
-
-builtins/umask.def
-       - converted to use builtin_getopt
-
-bashhist.c
-       - support for storing literal newlines in the history list when
-         command_oriented_history is enabled, rather than using semicolons
-
-builtins/Makefile
-       - changed rule to make a .o file from a .def file to remove the
-         .c file if the compilation fails
-
-                                   2/6
-                                   ---
-bashhist.c
-       - added new variable `force_append_history' that will force the
-         history list to be appended to the history file at shell exit
-       - new function, maybe_append_history, to append any history lines
-         from the current session to the history file.  Used by history -a
-
-builtins/bind.def
-       - changed the `-d' option to -p
-
-builtins/set.def
-       - added `allenv' as a -o synonym for `set -k'.  Now all of the
-         single-letter shell options have -o equivalents
-
-builtins/shopt.def
-       - added -p option to display shell options, like other builtins
-       - added `interactive_comments' as a shell option, like set -o
-
-builtins/bind.def, builtins/history.def, builtins/enable.def
-       - changed use of multiple variables to hold option flag settings to
-         one variable with bits representing flag values
-
-documentation/bash.1, documentation/features.texi
-       - changed the description of the `bind' builtin for the new -p option
-       - changed the description of the `set' builtin for the new
-         `-o allenv' option
-       - updated the description of the `shopt' builtin
-
-builtins/history.def
-       - changed -a option to use maybe_append_history
-
-subst.c
-       - changed the substring/subarray code to make negative offsets
-         count backwards from the end of the string or array
-
-builtins/bashgetopt.c
-       - added option modifiers `;' (argument is optional) and `#'
-         (argument is optional, but if present must be numeric)
-
-builtins/hash.def
-       - converted to use builtin_getopt
-       - broke code out into a new function: add_hashed_command
-
-                                   2/7
-                                   ---
-builtins/getopt.c
-       - changed to save state to avoid relying on `nextchar' staying the
-         same across calls to sh_getopt [in 1.14.4]
-       - added a function to restore `nextchar' from this saved state
-         [in 1.14.4]
-       - removed some dead code
-
-builtins/getopts.def
-       - call function to restore sh_getopt state when parsing explicitly
-         supplied arguments rather than the positional parameters [in 1.14.4]
-
-lib/readline/vi_mode.c
-       - fixed an off-by-one error in _rl_vi_done_inserting that put the
-         \0 in vi_insert_buf at offset `len' instead of `len - 1'
-
-lib/readline/complete.c
-       - print_filename now filters out control characters and displays
-         them in printable format, rather than relying on the tty driver
-         to do the right thing [in 1.14.4]
-
-                                   2/8
-                                   ---
-lib/posixheaders/stdc.h
-       - test for each special keyword being defined individually, rather
-         than just testing on `const' [in 1.14.4]
-
-lib/readline/util.c
-       - new function _rl_abort_internal; rl_abort just calls this
-
-nojobs.c
-       - include error.h for extern function definitions [in 1.14.4]
-
-builtins/ulimit.def
-       - include <unistd.h> if HAVE_UNISTD_H is defined
-       - use HAVE_LIMITS_H to decide whether or not to include <limits.h>
-
-variables.c, subst.c, builtins/set.def
-       - removed special handling of `noclobber' variable
-
-builtins/set.def
-       - new function set_shellopts to set up the $SHELLOPTS variable
-         based on the values of the set -o options; `set' calls this
-         function whenever one of the options is changed
-       - new function parse_shellopts to take the value of SHELLOPTS and
-         turn on each option found therein
-       - new function initialize_shell_options to parse any inherited
-         value of $SHELLOPTS and set up $SHELLOPTS
-
-shell.c
-       - call initialize_shell_options at the end of shell_initialize()
-
-execute_cmd.c, general.c
-       - moved extract_colon_unit from execute_cmd.c to general.c
-
-execute_cmd.h, general.h
-       - moved extern declaration of extract_colon_unit from
-         execute_cmd.h to general.h
-
-documentation/{bash.1,features.texi}
-       - documented SHELLOPTS
-
-                                  2/18
-                                  ----
-builtins/{shopt,pushd,jobs,umask}.def
-       - removed the `longjobs', `longdirs', `pushd_home' and `symbolic_umask'
-         options
-
-lib/readline/{histexpand,histsearch,histfile}.c, lib/readline/histlib.h
-       - new files, split off from old history library history.c
-
-lib/readline/history.c, lib/readline/history.h
-       - new function clear_history() to clear the history list
-
-lib/readline/doc/hstech.texinfo
-       - documented clear_history ()
-
-builtins/pushd.def
-       - new function clear_directory_stack() to delete all elements of
-         the dir stack
-       - new -c option for `dirs' to clear directory stack
-       - new function get_dirstack_index for dirs -N and dirs +N to use
-       - new function get_dirstack_element(i, dir) for use by other parts of
-         the shell that want the functionality of dirs -N and dirs +N
-         (dir is 1 for dirs +N, -1 for dirs -N)
-       - new function set_dirstack_element(i, dir, val) for use by other
-         parts of the shell to change values in the dirstack (dir is -1
-         for dirs -N, +1 for dirs +N).  Used when assigning to $DIRSTACK.
-
-builtins/history.def
-       - new -c option to clear the history list
-
-documentation/bash.1, documentation/features.texi
-       - removed no-longer-valid shopt options
-       - documented new dirs -c option
-       - documented new history -c option
-       - documented new \T and \H prompt escape sequences
-       - documented new $DIRSTACK dynamic array variable
-       - documented the new expand-glob and list-glob readline commands
-
-variables.c
-       - set PS4 to its default value of `+ ', so that unsetting it will
-         disable the tracing characters [in 1.14.4]
-       - new framework for dynamic array variables -- each place an
-         array index is assigned to, a test is made.  if a dynamic
-         assignment function exists, it is called with args `self',
-         the index being assigned to, and the new value
-       - new variable `$DIRSTACK', a dynamic array variable that holds
-         the current contents of the directory stack.  You can even
-         change the stack by assigning to thie variable
-
-shell.c
-       - changed indirection_level_string to return the null string if
-         $PS4 is unset or null [in 1.14.4]
-
-parse.y
-       - new \H prompt escape for hostname up to first `.'; changed \h
-         to return full hostname (like \w/\W)
-       - new \T prompt escape for 12-hour time
-
-bashline.c
-       - new readline functions to expand glob patterns and insert or
-         list the expansions (special completion functions)
-
-
-                                  2/20
-                                  ----
-builtins/pushd.def
-       - new code for `pushd -n' and `popd -n' to inhibit cd when
-         adding or removing directories from the stack
-       - broke functionality off into separate functions for use by the
-         $DIRSTACK manipulation functions
-
-                                  2/21
-                                  ----
-lib/readline/kill.c
-       - new functions to copy words to the kill ring, backward or
-         forward
-
-lib/readline/readline.h
-       - extern declarations for rl_copy_{backward,forward}_word
-
-
-lib/readline/funmap.c
-       - new bindable readline commands: copy-backward-word and
-         copy-forward-word to copy portions of the line to the kill
-         ring without deleting them
-
-documentation/{bash.1,readline.3}, lib/readline/doc/hsuser.texinfo
-       - documented the new copy-backward-word and copy-forward-word
-         readline commands
-
-mailcheck.c, config.h
-       - the declaration of DEFAULT_MAIL_PATH is now only in config.h
-         and used by mailcheck.c and variables.c.  There is no need to
-         use DEFAULT_MAIL_PATH_LEN; `sizeof' does the job [in 1.14.4]
-
-                                  2/22
-                                  ----
-support/mksysdefs
-       - changes to fix `RELEASE' if it ends up being set to the empty string
-         [in 1.14.4]
-       - check for amdahl UTS [in 1.14.4]
-       - check for SGI Irix version 6.x [in 1.14.4]
-
-machines.h
-       - new entry for Amdahl UTS [in 1.14.4]
-       - changes to the SGI entry for Irix 6.x [in 1.14.4]
-
-                                  2/23
-                                  ----
-machines.h
-       - changes for BSD/OS 2.0 (M_OS now set to `BSD_OS') [in 1.14.4]
-
-support/mksysdefs
-       - change to recognize BSD/OS 2.0 and set SYSDEF to BSDI2 [in 1.14.4]
-
-siglist.h
-       - don't declare sys_siglist on BSD/OS 2.0 [in 1.14.4]
-
-                                  2/24
-                                  ----
-parse.y
-       - if reset_parser is called while the prompt command is being
-         executed because of a syntax error in $PROMPT_COMMAND, an
-         infinite loop results.  set token_to_read back to 0 at the
-         end of execute_prompt_command to stop the looping [in 1.14.4]
-
-                                  2/25
-                                  ----
-mailcheck.h
-       - new header file for mail-checking and related definitions
-       - declaration of DEFAULT_MAIL_PATH is now here
-
-mailcheck.c
-       - new function, make_default_mailpath, which constructs a default
-         $MAILPATH string from DEFAULT_MAIL_PATH [in 1.14.4]
-       - change remember_mail_dates to call make_default_mailpath
-         [in 1.14.4]
-
-externs.h
-       - moved function declarations for functions in mailcheck.c to
-         mailcheck.h
-
-variables.c
-       - change initialize_shell_variables to call make_default_mailpath
-         [in 1.14.4]
-       - removed some unneeded variables in initialize_shell_variables
-
-                                  2/26
-                                  ----
-lib/readline/callback.c
-       - new file with readline callback function interface
-
-lib/readline/rlconf.h
-       - new READLINE_CALLBACKS define for the readline callback code to
-         be compiled in and available
-
-lib/readline/readline.c
-       - broke readline_internal into three functions: readline_internal_setup,
-         readline_internal_charloop, and readline_internal_teardown
-       - changes for READLINE_CALLBACKS
-
-lib/readline/readline.h
-       - extern declarations for the readline callback code
-
-cpp-Makefile
-       - added lib/readline/callback.c to the list of readline files
-
-lib/readline/input.c
-       - added a layer of indirection to allow the user to specify the
-         function that reads a character from rl_instream.  The variable
-         name is rl_getc_function, set by default to rl_getc
-
-                                  2/27
-                                  ----
-lib/readline/display.c
-       - added a variable rl_redisplay_function to allow an application-
-         specified redisplay function, for those apps that want to control
-         redisplay
-
-lib/readline/readline.c
-       - extern declarations for rl_getc_function and rl_redisplay_function
-
-lib/readline/{readline,display,isearch,search,parens}.c
-       - changed to call through rl_redisplay_function rather than
-         rl_redisplay directly
-
-parse.y
-       - try to avoid some work in reset_readline_prompt and prompt_again
-         if the prompt is the empty or null string [in 1.14.4]
-
-lib/readline/readline.c
-       - call rl_expand_prompt unconditionally [in 1.14.4]
-
-lib/readline/display.c
-       - short-circuit out of rl_expand_prompt if the prompt string is null
-         after clearing out the saved local prompt values.  This allows
-         $PS2 to be set to "" [in 1.14.4]
-
-lib/readline/doc/rltech.texinfo
-       - documented the callback code and functions
-       - documented rl_getc_function and rl_redisplay_function
-
-lib/readline/{callback,readline,rltty,signals}.c
-       - added layer of indirction for terminal prep and deprep, with
-         rl_term_prep_function and rl_term_deprep_function.  These are
-         set by default to rl_prep_terminal and rl_deprep_terminal,
-         respectively
-
-lib/readline/readline.h
-       - make rl_term_prep_function and rl_term_deprep_function available
-         to callers
-
-                                   3/1
-                                   ---
-lib/readline/complete.c
-       - broke the (long, complicated) rl_complete_internal code into a
-         number of separate functions:
-
-               find_completion_word
-               gen_completion_matches
-               remove_duplicate_matches
-               display_matches
-               insert_text
-               insert_match
-               append_to_match
-               insert_all_matches
-
-       - made some efficiency improvments to filename_completion_function
-       - the completion ignore function is now called no matter what type
-         of completion is being performed (as it should have been all along)
-
-lib/readline/rldefs.h
-       - use #defines for the possible values ORed into `found_quote' by
-         the completion code
-
-                                   3/2
-                                   ---
-make_cmd.c, general.c
-       - moved make_word_array from make_cmd.c to general.c, renamed to
-         word_list_to_argv, extended it to optionally not malloc all of
-         the strings and to reserve space at the start of the array
-
-execute_cmd.c
-       - changed to use word_list_to_argv, not mallocing space for the
-         strings
-
-builtins/common.c, builtins/common.h
-       - new function make_builtin_argv, which uses word_list_to_argv
-         and reserves 1 slot at the beginning for the command name
-
-builtins/exec.def
-       - changed to use word_list_to_argv
-
-builtins/{getopts,test}.def
-       - changed to use make_builtin_argv
-
-subst.c
-       - new function match_pattern_char, to see if the first char of
-         a string has a chance to match a given pattern (test against
-         the first char of the pattern); used by match_pattern in the
-         MATCH_ANY case
-
-                                   3/3
-                                   ---
-jobs.c
-       - renamed flush_child to sigchld to capture the functionality better
-
-array.c
-       - new function array_pat_subst, to do pattern substitution on each
-         element in an array
-
-array.h
-       - extern declaration for array_pat_subst
-
-subst.c
-       - new function pat_subst to do pattern matching and substitution on
-         a string
-       - new function parameter_brace_pat_subst to implement
-         ${v/[/]pat[/sub]}; calls pat_subst for simple vars,
-         pos_params_pat_subst to do substitution on the positional params,
-         and array_pat_subst for things like ${v[@]/p/r}
-
-subst.h
-       - extern declaration for pat_subst so array.c can find it
-
-                                   3/6
-                                   ---
-parse.y
-       - <>filename now dups filename to file descriptor 0 for both input
-         and output even when not in posix.2 mode
-
-bashline.c
-       - add the globbing characters to the list of characters that need
-         to be quoted by filename completion
-
-jobs.h
-       - new convenience macros:
-               RUNNING, STOPPED, DEADJOB - to test a job's state
-               IS_FOREGROUND, IS_NOTIFIED, IS_JOBCONTROL - flags
-
-jobs.c, builtins/{kill,fg_bg}.def
-       - changed to use new jobs.h macros
-
-                                   3/7
-                                   ---
-array.c, array.h
-       - new function dup_array_subrange(a, s, e) to make a new array
-         out of the elements of array A between S and E, inclusive
-       - add `quoted' parameters to array_subrange and array_pat_subst
-         to preserve proper quoting of elements when expanding things
-         like "${av[@]/xx/yy}"
-       - new function array_quote to quote the members of an array like
-         the functions in subst.c
-
-subst.c
-       - pass the quoted flag to array_subrange and array_pat_subst
-       - quote_string is no longer static
-
-subst.h
-       - extern declaration for quote_string
-
-builtins/hash.def
-       - added a -p pathname option to specify a pathname for the command
-         name to be hashed.  With -p, no path search is performed.
-
-lib/readline/histexpand.c
-       - broke history_tokenize off into history_tokenize_internal and
-         added two arguments: a character index and a word index.  If
-         the char index is >= 0, the word index will be modified to point
-         into the returned array of strings to the word surrounding that
-         particular character index
-       - new function history_find_word(line, ind) to return the word 
-         containing the character at index IND in LINE
-       - new variable search_match, found by history_find_word, to hold the
-         word last matched by a !?string? search
-       - corrected a problem with the `%' modifier: it should insert the
-         word last matched, not the last search string
-
-                                   3/8
-                                   ---
-cpp-Makefile
-       - changed INSTALL_PROGRAM and INSTALL_DATA to use support/install.sh
-       - changed `install' target to not explicitly save the old version of
-         bash in `bash.old'; let install take care of it
-
-shell.c
-       - new static variable `running_under_emacs', set to 1 if the
-         variable `EMACS' is in the startup environment, and to 2 if
-         we're running under the `eterm' terminal emulator
-       - send an escape sequence to eterm if running_under_emacs is 2
-         after executing any $PROMPT_COMMAND to tell it the current
-         directory
-
-                                   3/9
-                                   ---
-builtins/ulimit.def
-       - made getting -u work for systems that have a MAXUPRC define.
-         it still cannot be set without RLIMIT_NPROC
-
-shell.c
-       - include trap.h for sig definitions
-
-builtins/common.h, subst.h, general.h, externs.h
-       - more extern function declarations
-
-bashhist.c
-       - new function, bash_history_disable(), to turn off history and
-         history expansion
-       - bash_history_disable now sets history_expansion_inhibited
-
-bashline.h
-       - new file with extern declarations from bashline.c
-
-parse.y, bashhist.c, builtins/bind.def, subst.c, sig.c
-       - include bashline.h
-
-                                  3/10
-                                  ----
-lib/glob/glob.h
-       - new file with extern declarations for local glob library
-
-shell.c
-       - include glob.h, mailcheck.h
-
-cpp-Makefile
-       - changes to dependencies due to mailcheck.h, bashline.h, glob.h
-
-                                  3/13
-                                  ----
-execute_cmd.c
-       - new function execute_connection to execute commands of type
-         cm_connection
-       - new function execute_pipeline, to execute pipelines
-
-lib/readline/rltty.c
-       - add a `tty' argument to the set_winsize function/macro, the
-         non-shell version needs it
-
-                                  3/14
-                                  ----
-parse.y
-       - added \a (bell) and \e (escape) prompt string escape sequences
-
-                                  3/16
-                                  ----
-lib/readline/display.c
-       - fixed bug in update_line that caused stray characters to be left on
-         lines after the first if characters are deleted so that the first
-         line becomes exactly as long as the screen width [in 1.14.4]
-
-lib/readline/doc-support
-       - brought in the GNU getopt because texindex needs it
-
-documentation/Makefile
-       - adopted the BSD convention of a suffix of `.0' for formatted
-         manual pages
-
-                                  3/17
-                                  ----
-support/inpath
-       - a script to find out if a particular command name appears in
-         a directory in $PATH [in 1.14.4]
-
-support/mksysdefs
-       - changed to use inpath to find `ranlib' [in 1.14.4]
-
-                                  3/18
-                                  ----
-bashline.c
-       - include bashline.h
-       - removed the DYNAMIC_HISTORY_COMPLETION define; that code is now
-         included unconditionally
-       - renamed ETCHOSTS to DEFAULT_HOSTS_FILE; moved definition to
-         bashline.h
-       - moved definition of BRACE_COMPLETION to config.h
-
-config.h
-       - conditional definition of BRACE_COMPLETION is now here
-
-pathnames.h
-       - new file with defines that are absolute pathnames
-
-shell.h
-       - include pathnames.h
-
-mailcheck.h
-       - def of DEFAULT_MAIL_PATH now moved to pathnames.h
-
-shell.c
-       - def of SYS_PROFILE moved to pathnames.h
-
-alias.h
-       - removed a bunch of extra definitions
-
-lib/readline/{vi_mode.c,bind.c}
-       - removed superfluous STATIC_MALLOC code
-
-variables.c
-       - removed SHADOWED_ENV code
-
-                                  3/20
-                                  ----
-machines.h
-       - don't define USG or USGr3 for linux machines [in 1.14.4]
-       - change REVERSED_SETVBUF_ARGS to SETVBUF_REVERSED for autoconf
-         compatibility
-
-shell.c
-       - change REVERSED_SETVBUF_ARGS to SETVBUF_REVERSED for autoconf
-         compatibility
-
-support/mksysdefs, maxpath.h
-       - change HAVE_SYS_PARAM to HAVE_SYS_PARAM_H for autoconf
-         compatibility
-
-support/mksysdefs, jobs.h
-       - use HAVE_SYS_WAIT_H
-
-machines.h, error.c
-       - change HAVE_VFPRINTF to HAVE_VPRINTF for autoconf compatibility
-
-test.c
-       - replace UID_T and GID_T with GETGROUPS_T, the size of the elements
-         of the array returned by getgroups
-
-general.c
-       - define HAVE_KILLPG if killpg() is present; compile in a replacement
-         killpg if not
-
-machines.h, jobs.c
-       - change BSD_GETPGRP to HAVE_BSD_PGRP
-
-sig.c
-       - don't call initialize_siglist if HAVE_SYS_SIGLIST is defined, no
-         longer use INITIALIZE_SIGLIST
-
-machines.h, lib/malloc/malloc.c
-       - change NO_SBRK_DECL to SBRK_DECLARED
-
-                                  3/22
-                                  ----
-machines.h
-       - BSD/OS 2.0 does not need INT_GROUPS_ARRAY in SYSDEP_CFLAGS
-
-lib/readline/rldefs.h
-       - don't check `Linux'; just include <termcap.h> if HAVE_TERMCAP_H
-         is defined
-
-builtins/command.def
-       - changed get_standard_path to use HAVE_CONFSTR 
-
-execute_cmd.c
-       - execute_simple_command no longer uses alloca
-       - don't check RISC6000 anymore when deciding whether to use
-         #pragma alloca
-
-execute_cmd.c, shell.c
-       - check for ultrix instead of Ultrix when calling alloca(0)
-
-jobs.h
-       - check HAVE_UNISTD_H to see whether to declare fork, getpid,
-         and getpgrp
-
-builtins/common.c
-       - include <signal.h> for NSIG
-
-sig.h
-       - don't define SIGABRT as SIGIOT unless SIGIOT is defined
-
-jobs.c
-       - check for ultrix instead of Ultrix
-
-                                  3/23
-                                  ----
-general.c, general.h
-       - new function check_dev_tty, which makes sure we can open
-         /dev/tty
-
-shell.c
-       - call check_dev_tty instead of having the code inline
-
-posixstat.h
-       - removed references to isc386
-
-general.h
-       - code to define one of TERMIOS_TTY_DRIVER, TERMIO_TTY_DRIVER,
-         or NEW_TTY_DRIVER
-
-jobs.c, nojobs.c
-       - use the general.h code to define the tty driver types
-
-                                  3/24
-                                  ----
-builtins/declare.def
-       - new -p option to display variables and their values and attributes
-         `declare -p xxx' displays attribs and value of var `xxx'
-
-builtins/setattr.def
-       - new function to display the attributes and value of a particular
-         variable; used by set_or_show_attributes
-       - new function to look up a variable by name and show that name's
-         attributes and value
-
-builtins/common.c
-       - declarations for new functions in setattr.def
-
-variables.c
-       - don't set a default value for MAILPATH in initialize_shell_variables;
-         let remember_mail_dates take care of it [in 1.14.4]
-
-mailcheck.c
-       - fixed an off-by-one bug in make_default_mailpath [in 1.14.4]
-
-                                  3/28
-                                  ----
-[changes for autoconf-generated config files]
-
-lib/malloc/malloc.c
-       - use HAVE_GETPAGESIZE, HAVE_BSD_SIGNALS, HAVE_POSIX_SIGNALS
-
-trap.c
-       - remove tests for USG and USGr4
-       - test on HAVE_POSIX_SIGNALS rather than _POSIX_VERSION
-       - use MUST_REINSTALL_SIGHANDLERS define to decide whether trap_handler
-         should call signal again
-
-getcwd.c
-       - redid the directory includes for autoconf compatibility
-       - use HAVE_LSTAT instead of testing for S_ISLNK
-       - use STRUCT_DIRENT_HAS_D_INO
-       - include memalloc.h for alloca define
-
-general.h
-       - cleaned up strchr, strrchr definitions
-       - removed tests against USG
-       - use HAVE_MEMMOVE instead of MEMMOVE_MISSING
-
-jobs.c
-       - use HAVE_WAIT3, MUST_REINSTALL_SIGHANDLERS, GETPGRP_VOID
-
-mailcheck.h
-       - removed definition of DEFAULT_MAIL_DIRECTORY; now set by
-         autoconf in config.h
-
-shell.c
-       - remove checks on USG, just check for HAVE_GETPW_DECLS
-       - use C_ALLOCA define
-       - redid the isnetconn() code using HAVE_SYS_SOCKET_H,
-         HAVE_GETPEERNAME, SVR4 and SVR4_2
-
-general.c
-       - use HAVE_KILLPG, HAVE_RESTARTABLE_SYSCALLS, HAVE_UNAME,
-         ULIMIT_MAXFDS, HAVE_TIMEVAL, HAVE_TIMES
-
-lib/readline/rldefs.h
-       - redid the tty driver definitions using HAVE_TERMIOS_H, etc.
-       - don't define anything having to do with signal type
-
-lib/glob/glob.c
-       - redid the DIRENT defines and includes
-       - redid other includes to remove dependencies on USG and system
-         type (e.g., NeXT)
-
-builtins/times.def
-       - changed to use HAVE_GETRUSAGE, HAVE_TIMEVAL, HAVE_TIMES, and
-         the autoconf way to include <sys/time.h> and <time.h>
-
-builtins/ulimit.def
-       - changed to use HAVE_GETRLIMIT
-       - removed test of USG being defined
-
-siglist.h
-       - changed to use SYS_SIGLIST_DECLARED, HAVE_UNDER_SYS_SIGLIST, and
-         HAVE_STRSIGNAL
-
-print_cmd.c
-       - use PRINTF_DECLARED
-
-builtins/command.def
-       - use HAVE_CONFSTR along with _CS_PATH to get the standard path
-
-execute_cmd.c
-       - only compile in execute_shell_script if HAVE_HASH_BANG_EXEC is not
-         defined
-
-nojobs.c
-       - use HAVE_SIGINTERRUPT, HAVE_KILLPG, HAVE_POSIX_SIGNALS,
-         MUST_REINSTALL_SIGHANDLERS, HAVE_WAITPID, *_TTY_DRIVER defines
-
-test.c
-       - set up a new `getmaxgroups' define, moving the code out of inline
-       - eliminate use of GETGROUPS_T
-
-variables.c
-       - use CAN_REDEFINE_GETENV
-
-sig.c, sig.h
-       - use HAVE_POSIX_SIGNALS, MUST_REINSTALL_SIGHANDLERS
-
-pathnames.h
-       - removed the default mail directory defines; now set by autoconf
-
-oslib.c
-       - new file, functions from general.c that are unix-version variable
-
-general.h
-       - slightly changed function declarations for use by oslib.c
-
-support/bashbug.sh
-       - changed @xxx@ to !xxx! for sed substitutions to avoid conflicts
-         with autoconf substitutions in the Makefile
-       - added MACHTYPE variable
-
-mailcheck.c
-       - changed DEFAULT_MAIL_PATH to DEFAULT_MAIL_DIRECTORY, since that
-         more clearly defines its function
-
-lib/readline/rltty.h
-       - new file, to include the correct tty driver #include file
-
-lib/readline/rltty.c
-       - include rltty.h
-
-lib/malloc/malloc.c
-       - make systems with Posix signals block all signals while malloc
-         is executing
-
-                                  3/29
-                                  ----
-input.c
-       - use off_t as the type of a seek offset, rather that int or long
-
-variables.c, oslib.c
-       - moved `getenv' from variables.c to oslib.c
-
-                                  3/31
-                                  ----
-sig.c, sig.h
-       - new function, jump_to_top_level, which just calls longjmp with
-         top_level as an argument -- here to isolate calls to longjmp
-
-subst.c
-       - replaced calls to longjmp with jump_to_top_level
-
-bashjmp.h
-       - new file with setjmp/longjmp defines and declarations
-
-shell.h, nojobs.c
-       - include bashjmp.h in place of setjmp.h
-
-shell.c, sig.c, execute_cmd.c, unwind_prot.h, expr.c,
-builtins/{return,source}.def
-       - change to use new defs in bashjmp.h
-
-subst.c
-       - make sure PAT and REP in pattern substitution are run through
-         expand_string_unsplit
-
-builtins/set.def
-       - don't try to blindly dereference the value returned by
-         find_flags in set_shellopts
-
-                                   4/2
-                                   ---
-aclocal.m4, config.h.in, config.h.top, config.h.bot, configure.in,
-support/install.sh, support/config.guess, support/config.sub
-       - new files for (now official) autoconf-based configuration
-
-Makefile.in, builtins/Makefile.in,
-lib/{doc-support,malloc,glob,termcap,tilde,readline}/Makefile.in
-       - new Makefiles for autoconf
-
-[additionally, all source files now include config.h]
-
-                                   4/3
-                                   ---
-array.c, array.h
-       - index_t --> arrayind_t, because some systems define index_t in
-         <sys/types.h>
-
-                                   4/4
-                                   ---
-aclocal.m4
-       - fix test for broken dup2
-
-lib/*/Makefile.in
-       - make all object files depend on $(BUILD_DIR)/config.h
-
-                                   4/5
-                                   ---
-array.c
-       - fixed problems in empty_array: need to reset max_index
-         and max_size, and remove the links in the element chain
-         after freeing them
-
-jobs.c
-       - new functions to save an array of status values for each
-         foreground job that exits (degenerate case is to have a
-         single-process job exit and have a 1-element array)
-       - new function to set a shell array variable `PIPESTATUS'
-         which holds the status values from each member of the
-         last-executed pipeline that spawned children
-
-documentation/bash.1
-       - documented $PIPESTATUS
-
-                                   4/6
-                                   ---
-configure.in
-       - added new --with-afs argument to #define AFS for execute_cmd.c
-
-                                  4/10
-                                  ----
-builtins/ulimit.def
-       - use sysconf(_SC_CHILD_MAX) to find the maximum number of child
-         proceeses per user if HAVE_SYSCONF and _SC_CHILD_MAX are both
-         defined and RLIMIT_NPROC is not
-
-                                  4/12
-                                  ----
-lib/readline/undo.c
-       - new variable, local to library, to keep track of the number of
-         `open' undo groups (UNDO_BEGIN without corresponding UNDO_END)
-       - new function _rl_fix_last_undo_of_type to modify start and end
-         bounds of last undo record of a specified type
-
-lib/readline/vi_mode.c
-       - _rl_vi_done_inserting now calls rl_end_undo_group if the count
-         of unclosed groups is > 0
-       - fixed rl_vi_change_to to save an undo record when redoing and
-         to fix the buffer corruption when doing `u' undo after a `.'
-         redo of `C'
-
-                                  4/13
-                                  ----
-unwind_prot.h
-       - changed to use a union { char *s; int i; } when unwind-protecting
-         integers to force correct alignment on machines where ints and
-         pointers differ in size
-
-lib/readline/readline.c
-       - new variable Keymap rl_executing_keymap, which is set to the
-         keymap the last function was invoked out of
-
-lib/readline/bind.c
-       - new variable Keymap rl_binding_keymap, which is set to the last
-         keymap a function and key sequence were bound in
-
-                                  4/17
-                                  ----
-general.c
-       - removed xmalloc, xrealloc, xfree to xmalloc.c
-
-lib/malloc/Makefile.in
-       - MALLOC and ALLOCA are both set by autoconf
-       - need to provide some empty stub file to make up the library
-         in case neither malloc.c and alloca.c are compiled into the
-         shell
-
-lib/malloc/gmalloc.c
-       - new file, GNU libc malloc code
-
-Makefile.in
-       - new source file, xmalloc.c, new object file, xmalloc.o
-
-general.h
-       - changed type of size argument to xmalloc, xrealloc to `size_t'
-
-configure.in
-       - changes for new argument `--with-glibc-malloc' that includes
-         gmalloc.o in libmalloc.a
-
-                                  4/18
-                                  ----
-xmalloc.c
-       - if malloc or realloc return null, report in the error message
-         how many bytes have been allocated
-
-lib/readline/display.c
-       - changed redisplay code to use an array of positions in the visible
-         and invisible lines at which to break lines instead of simply
-         calculating based on the screenwidth and number of invisible
-         characters.  In the future, this will allow newlines embedded in
-         the lines to display to be handled better
-
-[Bash-1.14.4 released to net]
-
-                                  4/19
-                                  ----
-lib/readline/signals.c
-       - changed last call to signal() to call rl_set_sighandler()
-
-                                  4/20
-                                  ----
-lib/readline/display.c
-       - changed some ascii-specific code to use CTRL_CHAR and UNCTRL
-       - finished up the changes that keep an array of line breaks
-
-shell.h
-       - moved #define constants for parameter pattern substitution here
-         from subst.c
-
-subst.c
-       - changed the pattern substitution functions to take a `flags'
-         parameter, which subsumes the match type, global replacement
-         flag, and quoted variables
-       - changed the pattern substitution functions to handle the `#'
-         and `%' match qualifiers, which anchor the match at the
-         beginning and end of the string, respectively
-
-shell.c
-       - moved the code that turns off privileged mode into a function
-         named `disable_priv_mode'
-       - if the shell is running setuid or setgid and `-p' is not
-         supplied, turn off privileged mode and reset the effective
-         uid/gid
-
-                                  4/21
-                                  ----
-subst.c
-       - added a `quoted' paramter to parameter_brace_remove_pattern;
-         Posix.2 says that the pattern is parsed differently if the
-         entire expression is double-quoted
-       - `getpattern' now takes a second argument, `quoted'
-       - fixed `getpattern' to correctly handles a pattern spec when
-         the whole expression is double-quoted.  Posix.2 says that
-         quote characters inside the pattern spec don't quote any
-         special pattern chars if the whole thing is double-quoted.
-         For example, the `*' in "${foo#'*'}" is not quoted, and the
-         single quotes must appear literally.
-
-Makefile.in
-       - add `documentation' as a dependency of `.made'
-
-                                  4/24
-                                  ----
-Makefile.in
-       - added `installdirs' target that makes bindir, infodir, mandir,
-         and man3dir [in 1.14.5 cpp-Makefile]
-
-                                  4/25
-                                  ----
-builtins/fc.def
-       - fixed problem with `fc -l' that occurred when fewer than 16 lines
-         were in the history list [in 1.14.5]
-
-                                   5/1
-                                   ---
-Makefile.in, {builtins,documentation}/Makefile.in, lib/*/Makefile.in
-       - fixed up the various `clean' targets to agree with Gnu coding
-         standards
-
-                                   5/2
-                                   ---
-lib/readline/complete.c
-       - made insert_all_matches correctly quote each of the filenames
-         inserted into the line, if necessary
-
-config.h.top
-       - surround definitions of DEFAULT_PATH_VALUE and STANDARD_UTILS_PATH
-         with #ifndef/#endif to allow them to be overridden from the command
-         line
-
-builtins/set.def
-       - changed set -o allenv to set -o keyword for ksh88 compatibility
-
-documentation/{bash.1,features.texi}
-       - changed set -o allenv to set -o keyword
-
-builtins/setattr.def
-       - added a `nodefs' attribute to set_or_show_attributes,
-         show_var_attributes, and show_name_attributes to inhibit printing
-         of definition as well as name
-
-builtins/declare.def
-       - changed calls to set_or_show_attributes, and show_var_attributes
-         accordingly
-
-                                   5/3
-                                   ---
-Makefile.in
-       - LIBPATH -> LIBSUBDIR
-
-                                   5/4
-                                   ---
-lib/readline/bind.c
-       - renamed readline variable meta-flag to be input-meta
-
-documentation/bash.1, lib/readline/doc/rluser.texinfo
-       - changed meta-flag to input-meta
-
-documentation/Makefile.in
-       - use groff -Tascii to convert .1 -> .0
-
-subst.c
-       - new function, strip_trailing_ifs_whitespace, does the obvious
-
-builtins/read.def
-       - call strip_trailing_ifs_whitespace before assigning last
-         variable to remainder of input string [in 1.14.5]
-
-                                   5/5
-                                   ---
-builtins/hashcom.h
-       - changed check_dot member of the PATH_DATA struct to flags, and
-         added a HASH_CHKDOT define to replace the check_dot semantics
-       - add HASH_RELPATH define for flags value
-
-builtins/hash.def, builtins/common.c
-       - instead of xxx->check_dot, use (xxx->flags & HASH_CHKDOT)
-
-builtins/hash.def
-       - if the full pathname to which a command is being hashed does
-         not begin with a `/', set the HASH_RELPATH flag for it
-
-builtins/common.c
-       - if a hashed filename as HASH_RELPATH set, check ./filename,
-         returning null if that filename is not executable
-
-execute_cmd.c, general.c, execute_cmd.h, general.h
-       - moved same_file and check_binary_file from execute_cmd.c to
-         general.c
-
-hashlib.c, Makefile.in
-       - renamed hash.c to hashlib.c
-
-hashlib.h, Makefile.in, builtins/Makefile.in, alias.h, variables.h,
-execute_cmd.c, hashlib.c, builtins/hashcom.h
-       - renamed hash.h to hashlib.h
-
-variables.c, alias.c
-       - removed inclusion of `hash.h'; header files already include
-         correct file
-
-Makefile.in
-       - new rule to remake all the Makefiles (`make Makefiles')
-       - more changes to adhere to GNU coding standards for the various
-         flavors of `clean' targets
-
-                                   5/8
-                                   ---
-documentation/Makefile.in
-       - use `texi2dvi' to make dvi files rather than tex and texindex
-         [in 1.14.5]
-       - don't install `bash_builtins.1' [in 1.14.5]
-
-Makefile.in
-       - removed instances of doc-support/texindex
-
-                                   5/9
-                                   ---
-make_cmd.c
-       - new function make_bare_word, to make a WORD_DESC from a string but
-         not to set any of its flags
-       - broke make_word into make_bare_word and make_word_flags
-       - fixed a bug in make_word_flags to make backslash-quoting a quoting
-         character work right to not set the W_QUOTED flags
-
-subst.c, array.c, execute_cmd.c
-       - call make_bare_word instead of make_word in situations where we
-         don't want the flags set inadvertently
-
-                                  5/11
-                                  ----
-subst.c
-       - removed special handling of $POSIX_PEDANTIC
-
-                                  5/12
-                                  ----
-shell.c
-       - broke the code that fetches the uids and gids into a new
-         function, uidget()
-
-subst.c
-       - EUID and UID are no longer handled specially, since they're
-         readonly
-       - removed sv_uids function
-       - merge sv_histfilesize into sv_histsize
-
-variables.c
-       - instead of calling sv_uids from initialize_shell_variables,
-         call uidset() instead
-       - sv_uids -> uidset with mods to make it faster and avoid an
-         extra call to free, malloc, and itos
-
-bashhist.c
-       - call sv_histsize instead of sv_histfilesize
-
-                                  5/13
-                                  ----
-pathexp.c
-       - moved setup_ignore_patterns here from bashline.c, so GLOBIGNORE
-         works even when readline is compiled out of the shell
-       - changed the ignore data structure to a `struct ignorevar',
-         defined in pathexp.h
-       - added functions to implement GLOBIGNORE
-
-bashline.c
-       - setup_ignore_patterns now in pathexp.c
-       - renamed _ignore_names to ignore_completion_names
-
-subst.c
-       - new function sv_globignore to be called when GLOBIGNORE changes
-         value
-
-documentation/{bash.1,features.texi}
-       - documented GLOBIGNORE
-
-                                  5/15
-                                  ----
-documentation/texinfo.tex
-       - upgraded to version 2.145 from autoconf-2.3 distribution
-
-                                  5/16
-                                  ----
-lib/readline/display.c
-       - delicate surgery on rl_redisplay, update_line, and _rl_update_final
-         to convert to using the line breaks array instead of assuming that
-         lines wrap because they're too long and using absolute buffer
-         positioning calculated from the screen width.  Now the `lithist'
-         shopt option works right
-
-lib/readline/complete.c
-       - make sure insert_match doesn't double an opening quote character
-         after make_quoted_replacement adds an opening quote [in 1.14.5]
-       - make sure append_match doesn't double a closing quote character
-         [in 1.14.5]
-
-quit.h
-       - new macros: SETINTERRUPT, CLRINTERRUPT, ADDINTERRUPT, DELINTERRUPT
-         to manipulate the value of interrupt_state
-
-trap.c, sig.c, jobs.c
-       - changes to use the new macros from quit.h
-
-jobs.c
-       - make an a job that exits due to SIGINT make the shell act as if
-         it received the interrupt itself, but only if SIGINT is not
-         trapped [in 1.14.5]
-
-                                  5/18
-                                  ----
-builtins/common.c
-       - fix up find_hashed_filename and the HASH_RELPATH code.  still need
-         to use `shopt -s checkhash' to check the hashed pathnames.  could
-         fix this up more to make that unnecessary in the HASH_RELPATH case
-
-subst.c
-       - new function get_array_value that does array subscripting for
-         things like aa[1], for use by other parts of the shell like the
-         expression evaluator
-
-expr.c
-       - changes to make things like $(( aa[1] + aa[2])) work without
-         using ${aa[1]}
-
-bashhist.c
-       - converted the HISTIGNORE code to use the `struct ignorevar'
-         framework, with a callback function histignore_item_func to
-         set the HIGN_EXPAND flag if needed
-
-pathexp.c
-       - made the `globignore' variable static
-       - redid the code that removes ignored names from the `names' array
-         in ignore_globbed_names to make it more efficient
-
-bashline.c
-       - made the `fignore' variable static
-
-                                  5/20
-                                  ----
-Makefile.in
-       - made the `distclean' target remove the Makefiles in subdirectories
-         created by autoconf
-
-                                  5/22
-                                  ----
-builtins/command.def
-       - don't allow `command -p' if the shell is restricted
-
-documentation/bash.1
-       - documented the restriction on command -p for rbash
-
-                                  5/23
-                                  ----
-aclocal.m4
-       - add a new macro BASH_CHECK_TYPE, based on AC_CHECK_TYPE, that
-         allows the caller to specify the header files to be included
-         in the test program and provides for a default value to be
-         defined if the type is found in the system files
-
-configure.in
-       - check for getrusage and gettimeofday functions/syscalls
-       - use BASH_CHECK_TYPE to check for clock_t in sys/types.h and
-         sys/times.h
-       - use BASH_CHECK_TYPE to check for sigset_t instead of a special
-         BASH_TYPE_SIGSET_T
-       - use BASH_CHECK_TYPE to check for quad_t instead of BASH_QUAD_T
-       - new argument --enable-command-timing to compile in the `time'
-         reserved word and command timing
-
-general.c
-       - print_time_in_hz takes a `clock_t', not a `time_t'
-
-execute_cmd.c
-       - support for timing pipelines with a new function time_command
-       - execute_command_internal calls time_command if it is passed a
-         command with the CMD_TIME_PIPELINE bit set in command->flags
-       - new functions difftimeval and addtimeval to do arithmetic on
-         timeval structs with overflow
-
-parse.y
-       - new production: pipeline_command, used by list1 and simple_list1
-       - pipeline_command includes rules to handle `!' and time
-       - code to recognize `time' as a reserved word
-
-print_cmd.c
-       - new code to print `time ' before a command if the CMD_TIME_PIPELINE
-         flag bit is turned on
-
-builtins/test.def
-       - added description of string1 < string2 and string1 > string2 to
-         the long doc
-
-test.c
-       - added `<' and `>' string binary operators
-
-documentation/bash.1
-       - documented the `time' reserved word and command timing
-       - documented the new test `<' and `>' binary operators
-
-documentation/features.texi
-       - documented the `time' reserved word and command timing
-       - added more to the section detailing the differences between bash
-         and sh
-       - added descriptions of LINENO and ENV to the Ksh variables section
-       - added description of echo to bash builtins section
-       - added PPID, BASH, SHLVL to the Bash variables section
-
-subst.c
-       - added a `quoted' parameter to extract_dollar_brace_string; changed
-         all calls to it
-
-                                  5/24
-                                  ----
-builtins/let.def
-       - wrote code for an `exp' builtin that treats all of its arguments
-         as an expression, concatenates them like `eval', and runs the
-         expression evaluator
-
-expr.c
-       - added code to do the Posix.2 conditional operator: expr?expr:expr
-       - added a `noeval' flag to suppress evaluation.  currently it only
-         suppresses assignment
-       - added code to the && and || functions so that evaluation is
-         suppressed in the part of the statement that is not supposed to
-         be executed (a && b: set noeval if a is false; a || b; set
-         noeval if a is true)
-
-                                  5/25
-                                  ----
-documentation/{bash.1,features.texi}
-       - documented new `expr?expr:expr' conditional expression syntax
-         now arithmetic evaluation is Posix.2-conformant
-
-lib/readline/readline.c
-       - added several more locale names to the list of legal $LANG
-         values
-
-subst.c
-       - fixed a bug in parameter_brace_patsub: when replacing a string 
-         with nothing, rep was set to "", and the code attempted to
-         free "", which the GNU malloc upchucked on
-
-bashhist.c
-       - just add a line to the history if command_oriented_history is
-         set to 1 and the current line in the command is > 1; don't
-         even bother checking history_ignore
-
-parse.y
-       - new variable `two_tokens_ago' to remember the token read before
-         `token_before_that'
-       - fix to history_delimiting_chars to make sure that no semicolon
-         is added after `()' (assume its a function definition), but that
-         a semicolon is added after other `)' (assume its a parenthesized
-         command)
-
-                                  5/31
-                                  ----
-tests/run-all
-       - put `.' first in $PATH and don't export ENV
-       - set THIS_SH to ../bash if it's unset
-
-lib/readline/complete.c
-       - only try to find a word break character in rl_complete_internal
-         if we hit the end of the input string and found_quote == 0
-         (the opening quote could have been the last character in the
-         string)
-
-                                   6/2
-                                   ---
-subst.c
-       - changed make_quoted_char to return CTLNUL\0 if passed a \0
-         (this is what quote_string does, too) [in 1.14.5]
-       - changed list_string to use make_quoted_char when adding a quoted
-         null argument due to a null field when ifs != ' \t\n'
-       - added an `expandpat' argument to getpattern, which tells it to
-         call string_extract_double_quoted if the pattern expression is
-         double-quoted, and changed all calls to initially pass `1' as
-         its value
-
-jobs.c
-       - changed start_job so that an attempt to start a job marked as
-         JDEAD elicits an error message [in 1.14.5]
-
-Makefile.in
-       - fixed `distclean' target so that it removes Makefiles in subdirs
-         *after* descending into them to do submakes (!)
-       - fixed `realclean' target to remove everything that distclean does
-
-                                   6/5
-                                   ---
-builtins/declare.def
-       - fixed a typo that made `declare +r var' turn off read-only status
-         for a variable [in 1.14.5]
-       - added -p option to short doc and long doc
-       - added code to allow `declare -f -options name' to set and unset
-         attributes for the named functions.  Only when no other options
-         are supplied will the named and value of the function be displayed
-         [in 1.14.5]
-
-variables.h
-       - new SETVARATTR macro to set or unset attributes for a specific
-         SHELL_VAR *
-
-builtins/setattr.def
-       - use SETVARATTR
-
-                                   6/7
-                                   ---
-execute_cmd.c
-       - moved the retrieval of $PS3 inside the loop in execute_select_command
-         so that PS3 can be modified in the select command's body
-         [in 1.14.5]
-
-execute_cmd.c
-       - changed execute_builtin and execute_function to not set
-         builtin_env and function_env, respectively, to NULL if there is
-         no temporary env.  This makes the temp env persist across calls
-         to functions from other functions [in 1.14.5]
-
-configure.in
-       - Linux needs LOCAL_LDFLAGS set to -rdynamic
-
-                                   6/8
-                                   ---
-general.c
-       - canonicalize_pathname should not attempt to interpret backslash
-         quoting `/', since Unix doesn't really allow it [in 1.14.5]
-
-bashline.c
-       - added `\', `!', and `)' to the list of characters which
-         cause filenames to be quoted
-       - changed bash_quote_filename to use any of the three shell
-         quoting styles based on the value of a variable,
-         completion_quoting_style
-       - if *qcp is not 0 when passed to bash_quote_filename, adjust the
-         type of completion we're doing based on its value (i.e.,
-         *qcp == '"' forces double quoting, *qcp == '\'' forces single)
-       - bash_quote_filename now leaves the quotes intact in the filename
-         it returns.  The readline completion code takes care of avoiding
-         doubled open quotes
-       - if a filename containing a `!' is passed to bash_quote_filename
-         without an opening quote character, and we are performing history
-         expansion, use single quoting as the quoting style
-
-bashhist.c
-       - changed bash_history_disable to not call bash_history_reinit(0),
-         but do what it needs to directly
-       - new function bash_history_enable
-       - make history_expansion_inhibited exist only if BANG_HISTORY
-         is defined
-
-bashhist.h
-       - extern declaration for bash_history_enable
-
-lib/readline/complete.c
-       - make make_quoted_replacement set should_quote to 1 if the quote
-         character is `'' as well as if it's `"'
-
-test.c
-       - added the csh-like `=~' and `!~' pattern-matching binary operators
-         which match the string on the lhs against the shell pattern on
-         the rhs.  PATTERN_MATCHING must be defined for this to work; it is
-         undefined and undocumented by default
-
-jobs.c
-       - broke the code that gets the new window size and sets $LINES and
-         $COLUMNS out of sigwinch_sighandler into a new function,
-         get_window_size, which sigwinch_sighandler calls
-
-                                  6/12
-                                  ----
-parse.y
-       - new function, pop_expansion, to remove the top string on the
-         expanded token stack
-       - renamed save_expansion to push_expansion
-
-lib/readline/complete.c
-       - fixed a bug in find_completion_word that tested found_quote
-         instead of quote_char when trying to decide if we have an unclosed
-         quoted string [in 1.14.6]
-
-                                  6/26
-                                  ----
-subst.c
-       - fixed expand_word_internal to remove all traces of $*, even if
-         it's quoted, if there are no positional parameters and there are
-         other characters in the expansion
-
-bashline.c
-       - don't attempt hostname completion if multiple consecutive `@'
-         characters appear
-
-                                  6/27
-                                  ----
-shell.c
-       - initialize top_level early, and exit if a longjmp sends us there
-         before we reinitialize
-
-subst.c
-       - more fixes to expansion of quoted $* when no positional parameters
-       - broke the code that assigns a value to an array element (and parses
-         the array element reference) into a new function,
-         do_array_element_assignment
-
-builtins/read.def
-       - new function, bind_read_variable, to allow binding simple variables
-         and array elements to strings read (uses do_array_element_assignment)
-       - changed occurrences of bind_variable to bind_read_variable where
-         it matters
-
-variables.c
-       - tentative change to bind_variable to make x=y the same as x[0]=y
-         if x is already an array variable.  This works for `read' as well.
-         This is what ksh does.
-
-                                  6/28
-                                  ----
-alias.h
-       - added a `flags' member to the ASSOC struct and renamed it to
-         `alias_t'
-
-alias.c, bashline.c, builtins/alias.def, builtins/type.def
-       - changed ASSOC to alias_t
-
-alias.c
-       - changed add_alias to set the AL_EXPANDNEXT flag when the alias is
-         inserted into the hash table
-
-parse.y
-       - added a third parameter to push_string: a pointer to the alias_t
-         that is being expanded
-       - push_string marks the alias it's passed as being expanded
-         (AL_BEINGEXPANDED)
-       - pop_string marks the alias being popped as no longer being
-         expanded
-       - changed shell_getc to defer popping an alias expansion until
-         the parser has had a chance to catch up, since the parser reads
-         ahead and would cause the expansion to be popped before it
-         fully parsed the expanded string
-       - changed alias_expand_word to check the AL_BEINGEXPANDED flag
-         instead of the expanded_token_stack when checking whether an
-         alias is already being expanded
-
-oslib.c
-       - make the definition of bzero be surrounded by #ifdef HAVE_BZERO
-         rather than lumping it in with bcopy
-
-configure.in
-       - add a test for bzero
-
-config.h.in
-       - add a template for HAVE_BZERO
-
-                                   7/3
-                                   ---
-builtins/set.def
-       - added new meaning for `set +o' without options, as per the latest
-         draft of Posix.2.  It means to list -o options as a series of set
-         commands to recreate the current settings
-
-documentation/bash.1
-       - augmented description of the `set' builtin
-
-                                   7/6
-                                   ---
-jobs.c
-       - make sure that temp_handler is not set to SIG_DFL before calling
-         it from waitchld
-
-builtins/cd.def
-       - rewrote cd_builtin to make the code flow clearer
-       - broke full directory name construction out into a separate
-         function: mkpath
-       - cd_builtin now tests that a directory constructed from a $CDPATH
-         entry is actually a directory before trying to chdir to it
-       - added an error message if $HOME is not set
-       - added a descriptive error message if `cd -' used and OLDPWD unset
-       - changed the error messages to use builtin_error, not file_error
-       - moved the code at the bind_and_exit label into a function,
-         bindpwd (no_symlinks)
-       - Posix.2 says that when using $CDPATH, the resultant value of PWD
-         should have no symlinks
-
-                                   7/7
-                                   ---
-input.c
-       - if fd_to_buffered_stream fails in some way and returns a NULL
-         buffered stream, with_input_from_buffered_stream uses a function
-         that does nothing but return EOF as the `getter'.  This keeps
-         the shell from crashing if invoked with fd 0 closed
-
-subst.c
-       - made the `quoted' parameter to expand_word_internal into a flags
-         word with flag values defined in shell.h.  Each place where
-         `quoted' is tested for a non-zero value was changed to test
-         (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) != 0 instead
-
-mailcheck.c, shell.c, parse.y
-       - change calls to the expand_string* functions to pass an explicit
-         Q_DOUBLE_QUOTES where appropriate
-
-                                   7/9
-                                   ---
-subst.c
-       - getpattern now passes Q_NOQUOTE to expand_word_internal, indicating
-         that quotes in the pattern spec are not to be treated specially
-
-                                  7/12
-                                  ----
-jobs.c
-       - fixed up the MUST_UNBLOCK_CHILD code in wait_for so that it now
-         unblocks all signals and sets the signal handler for SIGCHLD to
-         SIG_DFL.  pre-v4 SCO machines seem to require this [in 1.14.5]
-
-[Bash-1.14.5 released to net 7/16]
-
-                                  7/17
-                                  ----
-documentation/features.texi
-       - changed the Bourne Shell builtins section to have the same format
-         as the bash builtins section, with usage synopses
-       - added a section on the restricted shell
-
-                                  7/18
-                                  ----
-documentation/features.texi
-       - changed the name of this document to the Bash Reference Manual
-       - added sections on POSIX mode and restricted shell
-
-lib/readline/doc/hsuser.texinfo
-       - added the text from the bash manual page about the bash history
-         facilities if BashFeatures is set
-
-                                  7/19
-                                  ----
-documentation/features.texi
-       - added more stuff to the bash basics section
-
-lib/readline/doc/rluser.texinfo
-       - added a sample inputrc file
-
-                                  7/20
-                                  ----
-documentation/features.texi
-       - added section on shell expansions to bash basics section
-
-builtins/Makefile.in, lib/glob/Makefile.in, lib/malloc/Makefile.in,
-lib/readline/Makefile.in, lib/termcap/Makefile.in, lib/tilde/Makefile.in
-       - ar is now called with flags `cr' when building libraries
-
-                                  7/21
-                                  ----
-lib/readline/complete.c
-       - fixed a bug in find_completion_word that resulted in the found_quote
-         flag and the delimiter character not being passed back to the
-         caller (tested (*fp) instead of (fp) before assigning found_quote;
-         similarly for dp).  With this fix, the filename dequoting function
-         is properly called
-
-                                  7/25
-                                  ----
-general.c
-       - renamed bash_tilde_expand to bash_tilde_expansion_failure_hook
-       - new function, bash_tilde_expand, that just sets interrupt_immediately
-         and calls tilde_expand, returning what tilde_expand returns
-
-subst.c, general.c, shell.c, execute_cmd.c, variables.c, bashline.c,
-builtins/cd.def
-       - changed calls to tilde_expand to calls to bash_tilde_expand instead
-
-                                  7/27
-                                  ----
-builtins/set.def
-       - added a -o history option to enable and disable command history
-         saving.  This uses bash_history_enable() and bash_history_disable()
-         It's keyed off of remember_on_history.  With this, shell scripts 
-         can use the command history
-
-bashhist.c
-       - bash_history_enable now calls sv_history_control and sv_histignore
-
-builtins/fc.def
-       - if history_list() returns a null pointer, immediately return
-         [in 1.14.6]
-
-documentation/{bash.1,features.texi}, lib/readline/doc/hsuser.texinfo
-       - added a description of the `set -o history' option and changed
-         text to refer to it rather than strictly interactive shells
-
-                                   8/1
-                                   ---
-variables.c
-       - new builtin variable $HOSTNAME, initialized to current_host_name
-         as set in shell.c
-
-documentation/bash.1, documentation/features.texi
-       - documented $HOSTNAME
-
-                                   8/3
-                                   ---
-support/texi2html
-       - new program, a texinfo-html converter
-
-documentation/Makefile.in
-       - added directives to produce features.html from features.texi
-
-MANIFEST.doc
-       - added features.html and features_toc.html to the doc distribution
-
-                                  8/10
-                                  ----
-lib/readline/bind.c
-       - new functions rl_variable_dumper and rl_dump_variables to print
-         readline variables and their values to rl_outstream
-       - new functions rl_get_keymap_name and rl_get_keymap_name_from_edit_mode
-         to get the name of the current keymap for the variable dumper
-
-lib/readline/readline.h
-       - extern declarations for rl_variable_dumper, rl_dump_variables, and
-         rl_get_keymap_name
-
-builtins/bind.def
-       - added -V flag to print variable names and bindings
-       - added -P flag to print variable names and bindings in the syntax
-         of the inputrc file
-
-lib/readline/funmap.c
-       - added new bindable `dump-variables' readline command
-
-documentation/{bash.{1,html},readline.3,features.html},
-lib/readline/doc/rluser.texinfo
-       - documented new `dump-variables' readline command
-
-documentation/{bash.{1,html},features.{texi,html}
-       - documented new bind -P and -V options
-
-documentation/bashbug.1
-       - new manual page
-
-documentation/Makefile.in
-       - changes to build and install bashbug.1
-
-                                  8/15
-                                  ----
-print_cmd.c
-       - new function `xprintf' that just calls vfprintf(stdout, ...)
-         to avoid having to declare printf
-
-parse.y
-       - slight change in how read_token_word computes `all_digits'
-
-                                  8/21
-                                  ----
-
-subst.c
-       - new function dequote_escapes to remove CTLESC escaping
-         CTLESC and CTLNUL in a string, returning a new string
-
-                                  8/25
-                                  ----
-shell.c
-       - execute the file SYS_BASHRC for interactive shells if SYS_BASHRC
-         is defined, before executing ~/.bashrc
-
-config.h.top
-       - add a dummy commented definition for SYS_BASHRC, defaulting to
-         /etc/bash.bashrc
-
-lib/readline/input.c
-       - added code to call select() in rl_gather_tyi() and return
-         immediately if it indicates that there is nothing to read on
-         the readline input fd (#ifdef HAVE_SELECT)
-
-lib/posixheaders/posixdir.h
-       - new file to localize the <dirent.h>/<sys/dir.h> and dirent/direct
-         mess
-
-posixdir.h, lib/readline/posixdir.h
-       - symlinks to lib/posixheaders/posixdir.h
-
-lib/readline/rldefs.h
-       - removed the posix dir includes and defines
-
-lib/readline/complete.c, getcwd.c
-       - include posixdir.h rather than having the code inline
-
-builtins/cd.def
-       - new code to do spelling correction on the directory name
-         modified from patch sent by Neil Russell (caret@c-side.com)
-
-                                  8/29
-                                  ----
-builtins/shopt.def
-       - new option `cdspell' to toggle cd directory name spelling
-         correction
-
-documentation/{bash.{1,html},features.texi}
-       - documented new shopt `cdspell' option
-
-                                   9/5
-                                   ---
-subst.c
-       - $'' should expand to the same thing as '' (a quoted null string)
-
-shell.h
-       - changed CTLNUL to '\177'; some scripts use ^B for things like IFS
-         [in 1.14.6]
-
-                                   9/7
-                                   ---
-support/config.guess
-       - added code to identify a PPC running Solaris 2
-
-doc
-       - new directory replacing documentation
-
-Makefile.in, MANIFEST, MANIFEST.doc, configure.in
-       - replaced `documentation' with `doc'
-
-                                   9/8
-                                   ---
-lib/readline/display.c
-       - fixed the code in _rl_update_final that decides whether or not the
-         cursor is at character position 0 on an otherwise-empty line and
-         adjusts _rl_vis_botlin accordingly
-
-                                  9/13
-                                  ----
-general.c
-       - fixed canonicalize_pathname to make sure that intermediate
-         results correspond to directories before blindly chopping
-         off the last component when we see a `..'.  This fixes the
-         `cd ../.../..' being equivalent to `cd ..' problem
-
-subst.c
-       - fixed make_named_pipe so that mkfifo is called with mode 0600
-         for security reasons [in 1.14.6]
-       - changed the /dev/fd version of add_fifo_list to zero out new
-         entries to the fifo_list when it resizes it larger [in 1.14.6]
-       - changed make_dev_fd_filename to use DEV_FD_PREFIX
-
-aclocal.m4
-       - changed BASH_HAVE_DEV_FD to check for /proc/self/fd and define
-         DEV_FD_PREFIX to either "/dev/fd/" or "/proc/self/fd/" as
-         appropriate
-
-                                  9/14
-                                  ----
-lib/readline/display.c
-       - when displaying the first line of a multiline prompt, make sure
-         that the final \n is followed by a \r (outputting one if necessary)
-         so that we know we are starting at column 0
-
-variables.h
-       - new attribute: att_local
-
-variables.c
-       - changed make_local_variable to set the att_local attribute
-       - changed makunbound to just make variables marked as `local' in
-         the current context invisible.  This makes the local variable
-         persist throughout the function even if it is unset, so a
-         subsequent assignment preserves the `local' attribute
-       - changed kill_all_local_variables to unset the att_local attribute
-         before calling makunbound
-
-                                  9/18
-                                  ----
-lib/readline/complete.c
-       - make sure the cursor is on the last line of a possibly-multiple-
-         line command line before listing the completions in
-         display_matches
-
-                                  9/19
-                                  ----
-braces.c
-       - fixed the non-SHELL case in brace_gobbler so the loop exits when
-         it should
-
-lib/readline/bind.c, lib/readline/readline.h
-       - added functions to dump key sequences bound to macros and their
-         values
-
-builtins/bind.def
-       - added -S and -s options to dump the readline macros and their values
-       - changed the options so that -p and -P dump functions, -v and -V
-         dump variables, and -s and -S dump macros (s for string)
-
-doc/{bash.{1,html},readline.3,features.texi}, lib/readline/doc/rluser.texinfo
-       - added documentation for the new `bind' options
-       - added documentation for the new readline functions to dump macros
-         and the key sequences that output them
-
-                                  9/22
-                                  ----
-print_cmd.c
-       - new function xtrace_print_word_list (WORD_LIST *) to print the
-         words of a simple command when set -x is on.  This prints ''
-         when it encounters an empty string
-
-externs.h
-       - new extern declaration for xtrace_print_word_list
-
-execute_cmd.c
-       - call xtrace_print_word_list in execute_simple_command
-
-                                  9/25
-                                  ----
-builtins/getopts.def
-       - make sure that the loop counter stops at 10 when stepping through
-         the dollar_vars array to count the number of positional parameters
-         [in 1.14.6]
-
-                                  9/30
-                                  ----
-lib/readline/histsearch.c
-       - fixed history_search_internal to bail immediately if it gets a
-         null or empty search string.  This fixes the !? core dumps.
-         [in 1.14.6]
-
-                                  10/3
-                                  ----
-lib/readline/histexpand.c
-       - if there is a null string given with a !? search specifier, use
-         a previous search string if one exists, else fail immediately
-
-trap.c
-       - made run_exit_trap preserve $? around the call to execute the
-         trap string, unless the trap string contains an `exit'
-         command, in which case it can set the shell's exit status
-         [in 1.14.6]
-
-         In other words:
-
-               touch /tmp/z
-               trap 'rm /tmp/z ; exit 5' 0
-               exit 1
-
-         exits with status 5; while
-
-               touch /tmp/z
-               trap 'rm /tmp/z' 0
-               exit 1
-
-         exits with status 1
-
-subst.c, parse.y
-       - moved the $'...' code from subst.c to parse.y, more like ksh
-         does it
-
-doc/bash.1, doc/bash.html, doc/features.texi
-       - moved the description of $'...' from the expansion section to
-         the quoting section
-
-                                  10/4
-                                  ----
-command.h
-       - added a `line' member to the function struct for the source line
-         the function definition starts on
-
-make_cmd.c
-       - initialize the `line' member in Function_def to 0
-       - make_function_def takes a third parameter telling which line the
-         function definition started on and a fourth telling which line
-         the function body started on
-
-make_cmd.h
-       - changed prototype for make_function_def
-
-parse.y
-       - new variable `function_dstart', set by read_token and read_token_word
-         to keep track of where a function definition begins
-       - new variable `function_bstart' to keep track of where function
-         body begins
-       - pass function_dstart and function_bstart to make_function_def
-       - new function strtrans to do the $"..." locale-specific translation
-         of `...'
-       - call strtrans() to translate $"string".  The translated string is
-         double-quoted
-
-doc/bash.{1,html}
-       - updated the description of LINENO now that line numbers within
-         functions are correct
-
-configure.in
-       - look for the `gettext' library function
-
-config.h.in
-       - define HAVE_GETTEXT if gettext(3) exists in a findable library
-
-                                  10/5
-                                  ----
-builtins/common.c
-       - changed backslash_quote so that `#' is only quoted at the start
-         of a word
-       - new function contains_shell_metas returns 1 if the argument
-         string contains one or more shell meta-characters that require
-         quoting
-
-builtins/common.h
-       - extern declaration for contains_shell_metas
-
-print_cmd.c
-       - changed xtrace_print_word_list to print words containing
-         shell metacharacters within single quotes
-
-lib/termcap
-       - upgraded to GNU termcap version 1.3
-
-                                  10/9
-                                  ----
-lib/readline/readline.c
-       - call setlocale(LC_CTYPE, ...) after finding a legal value for
-         one of LC_ALL, LC_CTYPE, or LANG
-
-                                  10/11
-                                  -----
-lib/readline/search.c
-       - make rl_history_search_internal just do previous-history or
-         next-history as appropriate when given a null search string
-         (rl_point == 0)
-
-                                  10/24
-                                  -----
-subst.c
-       - fixed an off-by-one error in char_is_quoted that skipped a
-         characters after calling skip_single_quoted or skip_double_quoted
-         [in 1.14.6]
-       - fixed an off-by-one error in string_extract_verbatim so it
-         leaves *sindex at the separator character if the separator
-         character is "'" [in 1.14.6]
-
-                                  10/27
-                                  -----
-parse.y
-       - in CHECK_FOR_RESERVED_WORD, make sure that reading a `}'
-         decrements open_brace_awaiting_satisfaction if it is non-zero
-         [in 1.14.6]
-
-shell.c
-       - don't run the shell startup files if the shell is running
-         setuid
-       - don't source $ENV if the shell is running setuid
-
-variables.c
-       - new parameter to initialize_shell_variables: no_functions.  If
-         non-zero, don't import functions from the environment
-
-variables.h
-       - change to function prototype for initialize_shell_variables
-
-lib/readline/complete.c
-       - fix for the code that decides whether or not a char is quoted for
-         applications that don't supply a value for rl_char_is_quoted_p
-       - fixed insert_match to not remove a user-supplied opening quote
-         character if make_quoted_replacement does not return a string
-         beginning with that quote character
-
-                                  11/2
-                                  ----
-general.c
-       - new function ungetc_with_restart that handles the local buffering
-         [in 1.14.6]
-
-parse.y
-       - changed yy_stream_unget to call ungetc_with_restart if the OS
-         does not have restartable syscalls [in 1.14.6]
-
-                                  11/3
-                                  ----
-bashline.c
-       - rewrote _ignore_completion_names to actually free and remove
-         names from the array if more than one names in the array
-         passed is acceptable, instead of just bailing [in 1.14.6]
-
-                                  11/7
-                                  ----
-bashline.c
-       - if no matches are acceptable to _ignore_completion_names,
-         free the entries in NAMES, set NAMES[0] == 0, and let the
-         caller clean up [in 1.14.6]
-       - fixed a problem with backslash-quoted characters in
-         bash_dequote_filename that caused the character after the
-         backslash to be interpreted
-       - bash_dequote_filename now takes a quote_char parameter that,
-         if non-zero, gives the quote character (`'' or `"') that
-         delimits the filename.  Used to initialize the quoting state
-
-lib/readline/complete.c
-       - if the completion ignore function returns with MATCHES == 0
-         or MATCHES[0] == 0, ring the bell and quit the completion
-         attempt [in 1.14.6]
-       - pass quote_char to gen_completion_matches so it can pass it
-         along to the app-specific filename dequoting function
-       - have gen_completion_matches pass quote_char to whatever function
-         is pointed to by rl_filename_dequoting_function
-
-pathexp.c
-       - rewrote ignore_globbed_names to be more like _ignore_completion_names
-
-lib/readline/doc/rltech.texinfo
-       - updated documentation for rl_filename_dequoting_function
-
-                                  11/10
-                                  -----
-subst.c
-       - fixed remove_quoted_nulls so that it is now a full function that
-         removes unquoted CTLNUL chars from the string it is passed
-         [in 1.14.6]
-       - fixed expand_word_internal to avoid generating some unneeded
-         quoted nulls (if the string is partially quoted, note that we
-         have seen a quoted null and add one if the rest of the string
-         doesn't expand to anything)
-
-                                  11/13
-                                  -----
-variables.c
-       - bind HOSTTYPE, OSTYPE, and HOSTNAME unconditionally
-
-pathexp.c
-       - new function quote_globbing_chars, adds `\' before globbing
-         chars in its string argument, returns new string
-
-pathexp.h
-       - extern declaration for quote_globbing_chars
-
-bashhist.c
-       - if the previous line contains globbing chars, run it through
-         quote_globbing_chars before trying to match.  This affects
-         only HISTIGNORE patterns containing `&'
-
-                                  11/14
-                                  -----
-bashhist.c
-       - if the history line to be added contains globbing chars, quote
-         them with backslashes by calling quote_globbing_chars in
-         history_should_ignore before comparing them against the
-         patterns in HISTIGNORE
-
-bashline.c
-       - make sure that we erase the current readline line after running
-         fc on it and executing the resultant commands in
-         vi_edit_and_execute_command, so the original readline line
-         doesn't get returned [in 1.14.6]
-
-jobs.h
-       - added a new job listing format: JLIST_NONINTERACTIVE -- like
-         JLIST_LONG, but does not print the job number
-
-jobs.c
-       - added code to pretty_print_job to handle JLIST_NONINTERACTIVE
-       - call notify_and_cleanup() from wait_for even if the shell is
-         running a script (interactive_shell == 0)
-       - changed notify_and_cleanup to call notify_of_job_status if
-         interactive or interactive_shell == 0, so scripts report
-         about jobs they run
-       - changed notify_of_job_status to call pretty_print_job with a
-         JLIST_NONINTERACTIVE format if interactive_shell is 0 and a
-         job is marked JDEAD, after printing the script name and line
-         number.  This message is printed only if the job dies due to
-         a fatal signal
-
-support/mkversion.c
-       - added support for a `-status status' argument to set the
-         `release status' of the shell (alpha, beta, or release).  It
-         defines `RELSTATUS' in version.h and changes the definition
-         of SCCSVERSION, if present
-
-Makefile.in
-       - set a RELSTATUS variable that is included when printing the build
-         message and passed to mkversion with the -status option
-       - make RELSTATUS one of the variables sed sets when it creates
-         bashbug from support/bashbug.sh
-
-version.c
-       - added a `release_status' variable that's set to RELSTATUS if
-         it's defined
-
-support/bashbug.sh
-       - added the `RELSTATUS' variable to the report with heading
-         `Release Status'
-       - set the bug address to chet@po.cwru.edu if the release status
-         is `alpha' or `beta'
-
-                                  11/15
-                                  -----
-
-shell.c, execute_cmd.c
-       - new variable expand_aliases to control alias expansion.  For now,
-         this is set to the same value as interactive_shell when that is
-         set
-
-parse.y
-       - perform alias expansion if expand_aliases is non-zero rather than
-         checking the value of interactive_shell
-
-                                  11/16
-                                  -----
-builtins/shopt.def
-       - new option `expand_aliases' to control the value of expand_aliases
-
-doc/bash.1, doc/bash.html
-       - updated the description of `shopt' with the `expand_aliases' option
-
-                                  11/28
-                                  -----
-bashline.c
-       - if there is only one completion in _ignore_completion_names, see
-         if it is acceptable and return right away [in 1.14.6]
-
-configure.in
-       - change to define WAITPID_BROKEN on SCO 3.2v5
-
-                                  12/6
-                                  ----
-parse.y
-       - call prompt_again in read_token_word if a newline is read in an
-         interactive shell and bash_input.type is either st_stdin or
-         st_stream
-       - remove superfluous call to reset_readline_prompt in yy_readline_get
-
-                                  12/7
-                                  ----
-parse.y
-       - combine delimiters, delimiter_depth, and delimiter_space into a
-         single structure of type `struct dstack'
-       - replace all references to delimiter* with dstack.delimiter*
-       - include parser.h for struct dstack
-       - new define pop_delimiter(), analogous to push_delimiter
-       - current_delimiter, push_delimiter, and pop_delimiter defines now
-         include the delimiter stack struct as the first parameter
-
-parser.h
-       - now includes definition of struct dstack
-
-bashline.c
-       - include parser.h for struct dstack
-       - refer to dstack.delimiter_depth instead of delimiter_depth
-
-                                  12/12
-                                  -----
-execute_cmd.c
-       - before doing a longjmp(subshell_top_level,...) when executing a
-         shell script without a leading #!, set history_lines_this_session
-         to 0 to forget about the history and not save it on an exec
-         (we don't free the memory with clear_history(), though -- that
-         would slow bash down)
-
-                                  12/14
-                                  -----
-jobs.c, nojobs.c
-       - cause the sigwinch handling code to be compiled into the shell
-         even if READLINE is defined
-       - new functions: set_sigwinch_handler and unset_sigwith_handler
-         to enable and disable catching of SIGWINCH and adjusting $LINES
-         and $COLUMNS
-       - changed initialize_job_signals to install a signal handler for
-         SIGWINCH with set_sigwinch_handler
-
-jobs.h
-       - extern declarations for set_sigwinch_handler and
-         unset_sigwinch_handler
-
-                                  12/20
-                                  -----
-doc/bash.{1,html}, doc/readline.3, lib/readline/doc/rluser.texinfo
-       - documented the readline `visible-stats' variable
-
-                                  12/21
-                                  -----
-trap.c
-       - new global variable `running_trap' incremented and decremented
-         around running a trap command in _run_trap_internal
-
-execute_cmd.c
-       - new variable currently_executing_command, set to the COMMAND *
-         currently being processed by execute_command_internal, unless a
-         trap command is being run (running_trap != 0)
-       - new function executing_line_number, which returns the line number
-         of the currently executing command (which may not be the same as
-         line_number)
-       - don't run the debug trap if it was not set before the current
-         simple command was executed, since we don't want to run it after
-         the trap command that sets the DEBUG trap
-
-variables.c
-       - new function assign_lineno, to assign a value to line_number
-         when LINENO is set
-       - changed get_lineno to call executing_line_number() rather than
-         returning line_number
-
-parse.y
-       - new argument for push_stream telling it whether or not to reset
-         line_number to 0
-
-builtins/common.c
-       - change to parse_and_execute to call push_stream with an argument
-
-                                  12/29
-                                  -----
-subst.c
-       - set subshell_environment in command_substitute and process_substitute
-         for the child process
-
-                                   1/2
-                                   ---
-trap.c
-       - made decode_signal recognize signal names case insensitively
-
-shell.c
-       - make the shell exit on a longjmp (DISCARD, ...) if
-         subshell_environment is non-zero
-
-                                  1/16
-                                  ----
-lib/readline/histexpand.c
-       - let the `!' in ${!xxx} pass through without error
-
-shell.c
-       - new --help long option
-       - new function show_shell_usage() for use by --help
-
-                                  1/19
-                                  ----
-parse.y
-       - changes to shell_getc to make sure that lines consisting of only a
-         newline get added to the history correctly when they are part of
-         a quoted string
-
-                                  1/24
-                                  ----
-aclocal.m4, configure.in
-       - added a check for -lsocket (and -lnsl) to fix solaris problems
-         with isnetconn()
-
-shell.c
-       - rearranged the code in isnetconn to check for a socket using
-         getpeername() first, before any SVR4 or SVR4.2-specific checks
-       - added checks for ttys (isatty) and FIFOs (S_ISFIFO) to the
-         SVR4/SVR4.2 case of isnetconn()
-
-general.h
-       - new macro RESIZE_MALLOCED_BUFFER to check and see whether there
-         is enough room in a string to add a given number of characters
-         and to resize it if there is not
-
-                                  1/25
-                                  ----
-parse.y, general.c, subst.c, bashhist.c, alias.c, array.c, variables.c
-       - use RESIZE_MALLOCED_BUFFER where appropriate
-
-                                  1/26
-                                  ----
-support/config.{guess,sub}
-       - merged in latest changes from GNU master copies
-
-                                  1/30
-                                  ----
-
-jobs.c
-       - make sure to freeze the jobs list when calling a trap handler
-         for SIGINT
-       - added code to waitchld() so that a SIGINT trap handler is called
-         if the shell is running a shell script and a SIGINT is received
-         while waiting for a foreground job, even if that job does not
-         die from the SIGINT
-
-jobs.c, nojobs.c
-       - make get_tty_state reset $LINES and $COLUMNS after each process
-         exits if the variable `check_window_size' is non-zero
-
-builtins/shopt.def
-       - new variable `checkwinsize', which controls the value of
-         check_window_size
-
-doc/{bash.{1,html},features.texi}
-       - updated description of `shopt' to include `checkwinsize'
-
-execute_cmd.c, lib/readline,complete.c
-       - some changes from the GNU WIN32 project for the bash port to
-         Windows NT and Windows 95
-
-bashwait.h
-       - new file, with `union wait' defines from jobs.h
-
-jobs.h
-       - include `bashwait.h' if <sys/wait.h> is not present and
-         _POSIX_VERSION is not defined
-       - removed define of pid_t for non-Posix systems; now provided by
-         autoconf in config.h
-
-                                  1/31
-                                  ----
-parse.y
-       - new temporary delimiter stack, used when decoding prompt strings.
-         This is needed so command substitutions in the prompt strings
-         (especially PS2) don't screw up the parser's quoting state
-
-lib/readline/complete.c
-       - new variable for readline library users:
-         rl_completion_append_character.  The value of this variable is
-         the character appended to a completion when it occurs at the
-         end of a line.  Setting it to '\0' causes nothing to be
-         appended.
-
-lib/readline/readline.h
-       - declaration for rl_completion_append_character
-
-lib/readline/doc/rltech.texinfo
-       - documented rl_completion_append_character as int variable available
-         to library users
-
-subst.c
-       - new code for maintaining a string array saying which words in the
-         output of expand_word_list_internal are the result of globbing
-
-variables.c
-       - new function put_gnu_argv_flags_into_env (pid, flags_string)
-         to put Roland's GNU getopt helper variable into the export_env
-
-execute_cmd.c
-       - in execute_disk_command, after forking the child, put the GNU
-         getopt helper environment variable into the child's export_env
-
-unwind_prot.c
-       - changed unwind_protect_var and restore_variable to do the
-         bcopy of the variable's value if it's shorter than the size of
-         an int, as well as if it's longer.  This keeps stray data
-         from being copied if a short is being unwind-protected
-
-unwind_prot.h
-       - new define, unwind_protect_short, to protect variables smaller
-         than an int
-
-jobs.c
-       - in the code that handles SIGCHLD traps, call unwind_protect_short
-         if that is the size of a pid_t (for last_made_pid)
-
-                                   2/5
-                                   ---
-Makefile.in
-       - only try make distclean in HIST_LIBDIR if Makefile exists -- could
-         have already been removed if HIST_LIBDIR is the same as RL_LIBDIR
-
-general.c
-       - make canonicalize_pathname be more careful about what it checks
-         for being a directory name when processing a full pathname
-
-Makefile.in, configure.in, doc/Makefile.in
-       - small changes to get bash to build better in a directory not the
-         source directory
-
-                                  2/12
-                                  ----
-Makefile.in
-       - added `install-strip' target
-
-                                  2/14
-                                  ----
-doc/bash.{1,html}, doc/features.texi
-       - documented the `--verbose' startup option
-
-lib/readline/complete.c
-       - fix to gen_completion_matches to fix a memory leak
-       - fix to rl_complete_internal to fix a memory leak
-
-                                  2/15
-                                  ----
-bashwait.h
-       - changed to use WORDS_BIGENDIAN instead of LITTLE_ENDIAN or
-         BIG_ENDIAN
-
-configure.in, config.h.in
-       - call AC_C_BIGENDIAN, define WORDS_BIGENDIAN
-
-Makefile.in
-       - remove all references to mkendian.c, mkendian, and bash_endian.h
-       - added a `symlinks' target that just runs support/fixlinks
-
-MANIFEST
-       - mkendian.c is no longer in the distribution
-
-                                  2/16
-                                  ----
-execute_cmd.c
-       - include <sys/times.h> if HAVE_SYS_TIMES_H and HAVE_TIMES are
-         defined
-
-bashline.c
-       - fix to bash_directory_completion_hook to compensate for
-         canonicalize_pathname returning NULL
-
-variables.c
-       - fix to initialize_shell_variables to compensate for
-         canonicalize_pathname returning NULL
-
-                                  2/22
-                                  ----
-tests/test-tests, tests/test.right
-       - changes to avoid writing in the source directory -- all temp files
-         are created in /tmp
-
-[First alpha release at Thu Feb 22 15:59:51 EST 1996]
-
-                                  2/23
-                                  ----
-lib/readline/rldefs.h
-       - work around SVR4.2 bug including <sys/ptem.h> and <termios.h>
-
-lib/readline/chardefs.h
-       - fix to CTRL_CHAR macro for chars > 128 on systems with signed
-         characters
-
-builtins/ulimit.def
-       - protect more of the RLIMIT_* defines with checks
-       - new macro RETINVALID() to set errno and return the correct
-         value for an invalid request
-
-doc/Makefile.in
-       - add a definition for INSTALL, set by autoconf
-
-                                  2/26
-                                  ----
-support/bashbug.sh
-       - if USER is unset, assign it the value of $LOGNAME or `whoami`
-
-Makefile.in,{lib/*,doc,builtins}/Makefile.in
-       - use `test' instead of `[' to conform to GNU coding standards
-       - `incdir' -> `includedir' as per latest GNU coding standards
-
-lib/readline/Makefile.in, lib/glob/Makefile.in
-       - use $(srcdir)/ instead of $(srcdir) in the CSOURCES variable
-
-general.h
-       - new define, FS_NODIRS, to not find directory names when searching
-         $PATH
-
-execute_cmd.c
-       - fix to find_in_path_element so it does not return directories
-       - executable_file() no longer returns directories as executable
-
-                                  2/27
-                                  ----
-jobs.h
-       - new flag value: J_NOHUP
-
-jobs.c
-       - new function: nohup_job(job).  Sets J_NOHUP flag for specified
-         job
-       - change hangup_all_jobs so that jobs marked J_NOHUP are not
-         sent SIGHUP.  If stopped, the job still gets SIGCONT.
-       - changed calls to report_error to call internal_error, which will
-         not exit the shell
-       - changed FIND_CHILD define to call internal_error, restore the
-         SIGINT handler, set termination_state to 127 and return, rather
-         than aborting the shell
-
-builtins/jobs.def
-       - new option for disown: `-h'.  Marks the specified jobs J_NOHUP.
-
-doc/{bash.{1,html},features.texi}
-       - added description of `disown -h'
-
-jobs.c, nojobs.c
-       - include some files needed for struct winsize by SCO
-
-lib/readline/input.c
-       - added some #ifdefs to avoid including <sys/time.h> on systems
-         with select but without <sys/select.h>
-
-configure.in
-       - check for <stdarg.h>, define HAVE_STDARG_H in config.h if found
-
-config.h.bot
-       - define USE_VARARGS and either PREFER_STDARG or PREFER_VARARGS
-         if one of <stdarg.h> or <varargs.h> is present
-
-aclocal.m4
-       - moved default mail directory check here from configure.in, macro
-         name is BASH_DEFAULT_MAIL_DIR
-       - rewrote BASH_CHECK_DEV_FD to cache the value
-       - minor fixes from Bruno Haible
-
-shell.c
-       - no longer includes <varargs.h>
-
-builtins/Makefile.in
-       - add -I$(topdir)/builtins to list of includes
-
-execute_cmd.c, lib/glob/glob.c
-       - include memalloc.h for correct alloca definitions
-
-error.[ch], print_cmd.c, builtins/common.[ch]
-       - changes to include new ANSI-C stdargs code if PREFER_STDARG is
-         defined
-
-                                  2/28
-                                  ----
-aclocal.m4
-       - more minor fixes from Andreas Schwab
-
-doc/Makefile.in
-       - change TEXINPUTS makefile variables to TEXINPUTDIR to avoid
-         conflict with shell variable of the same name
-
-builtins/pushd.def
-       - fix to avoid a bad call to free after a call to
-         polite_directory_format does not change its argument string
-
-lib/readline/bind.c
-       - fixes to _rl_macro_dumper_internal so that it prints whatever
-         prefix it's passed, if any
-
-                                  2/29
-                                  ----
-Makefile.in
-       - slight change to the rule for `stamp-h': it should be created by
-         running `config.status', not explicitly by the makefile rule
-
-builtins/Makefile.in
-       - replace `..' in the dependencies with `$(topdir)'
-       - replace `.' in the dependencies with `$(srcdir)'
-
-                                   3/1
-                                   ---
-Makefile.in
-       - add a rule to build builtins/builtext.h for the benefit of
-         deficient makes like the SunOS one
-
-variables.c
-       - fix to assign_in_env so that values in the environment are
-         properly null-terminated
-
-builtins/Makefile.in
-       - added dependencies for object files made from .c files in this
-         directory: common.o, getopt.o, bashgetopt.o.  SunOS /bin/make
-         doesn't seem to be able to handle anything else
-
-support/mkclone
-       - new script to replace clone-bash that works from MANIFEST to link
-         only those files contained in a distribution
-
-support/mkversion.c
-       - change so that it doesn't try to get `.build' from the source
-         directory when that's different from the build directory
-
-                                   3/4
-                                   ---
-bashjmp.h
-       - #undef setjmp and longjmp before redefining them as sigsetjmp and
-         siglongjmp, respectively
-
-bashhist.c
-       - fixed an uninitialized variable problem in expand_histignore_pattern
-
-builtins/set.def
-       - used `on_or_off' where `value' was needed in minus_o_option_commands
-
-builtins/common.h
-       - added extern declaration for set_var_attribute
-
-print_cmd.c
-       - include `bashansi.h' instead of just string.h or strings.h
-
-builtins/*.def, builtins/common.c
-       - include `../bashansi.h' where appropriate
-
-parse.y
-       - fixed a parenthesization problem in alias_expand_token
-
-general.h
-       - added extern declaration for `ungetc_with_restart'
-
-lib/readline/readline.c
-       - renamed LibraryVersion to rl_library_version, made it extern,
-         assigned `2.1' to it
-
-lib/readline/readline.h
-       - extern declaration for `rl_library_version'
-
-lib/readline/doc/rltech.texinfo
-       - added description of `rl_library_version'
-
-lib/glob/glob.c
-       - changed call to sprintf in glob_dir_to_array to a couple of
-         calls to strcpy, since we keep the length of the first string
-         we copy
-
-                                   3/7
-                                   ---
-aclocal.m4
-       - added new macro `BASH_FUNC_LSTAT' to check for lstat on Linux,
-         which defines it as an inline function in <sys/stat.h>
-
-configure.in
-       - call BASH_FUNC_LSTAT if $ac_cv_func_lstat has value `no'
-
-                                   3/8
-                                   ---
-parse.y
-       - changed the occurrences of `list' in the if command productions
-         to use `compound_list' instead
-
-                                  3/11
-                                  ----
-parse.y
-       - changed the occurrences of `list' in the while and until command
-         productions to use `compound_list'
-
-lib/readline/complete.c
-       - fix to filename_completion_function -- off-by-one error when
-         expand-tilde is enabled and a filename to be completed begins
-         with `~/'
-
-                                  3/12
-                                  ----
-builtins/cd.def
-       - made the POSIX.2 behavior of PWD not containing symlinks after
-         using $CDPATH part of `posix mode', not default shell behavior
-
-lib/readline/display.c
-       - fix to update_line to handle update problems when using
-         horizontal scroll mode.  This is a dumb update solution -- it
-         should use a better one
-
-                                  3/14
-                                  ----
-examples/functions/csh-compat
-       - replaced the defintion for `alias' with a better one posted to
-         usenet by Mohit Aron <aron@cs.rice.edu>
-
-                                  3/15
-                                  ----
-jobs.c
-       - fix to wait_for_background_pids to keep `wait' from hanging
-
-                                  3/19
-                                  ----
-lib/readline/input.c
-       - new function `_rl_input_available()' returns > 0 if there is
-         input available on the readline input file descriptor.  Only
-         works if select(2) or FIONREAD are available
-
-lib/readline/isearch.c
-       - slight change to the isearch termination behavior -- ESC still
-         terminates the search, but if there is pending input or if input
-         arrives within 0.1 seconds (on systems with select(2)) it is
-         used as a prefix character with rl_execute_next
-
-shell.c
-       - the GNU coding standards say to write the output generated by
-         the --help command line option to stdout, not stderr
-       - show_shell_version now takes an `extended' option that displays
-         copyright information if non-zero
-       - show_shell_version now prints the value of `MACHTYPE' by default
-       - the `--version' option now causes the shell to exit successfully
-         after printing the extended version information
-
-externs.h
-       - changed prototype for show_shell_version
-
-shell.c, bashline.c, builtins/help.def
-       - changed calls to show_shell_version to add appropriate argument
-
-Makefile.in
-       - pass a `MACHTYPE' define to the compiler
-
-                                  3/22
-                                  ----
-general.c
-       - changed print_timeval() and print_time_in_hz() to output three
-         fractional digits after the decimal point
-
-examples/loadables/sleep.c
-       - changed to an implementation that will sleep fractional portions
-         of seconds if select() is available
-
-                                  3/25
-                                  ----
-builtins/shopt.def
-       - fixes to shopt -o from Andreas Schwab.  Use FLAG_ON/FLAG_OFF
-         instead of SETOPT/UNSETOPT
-
-                                  3/26
-                                  ----
-Makefile.in, builtins/Makefile.in
-       - use `@includedir@' instead of `@incdir' for autoconf 2.9
-
-Makefile.in
-       - the `info', `dvi', and `ps' targets do not depend on `texindex'
-       - add a `dist' target that just prints a message describing how
-         distributions are constructed
-
-support/mkdirs
-       - replace uses of [...] with `test'
-
-                                  3/28
-                                  ----
-parse.y
-       - fix for a problem with \@ prompt expansion from Tim Mooney
-
-jobs.c
-       - broke the code that prints a pipeline out into a separate
-         function: print_pipeline().  This gets called by
-         pretty_print_job and can be used for debugging
-       - two new functions to save and restore the_pipeline around calls
-         to make_child that you don't want to disturb the current pipeline,
-         for example in process substitution
-
-subst.c
-       - changed process_substitute to call save_pipeline and
-         restore_pipeline in the appropriate places
-
-                                  3/29
-                                  ----
-general.c
-       - ansicstr now takes an additional parameter, the length of the
-         string to be translated.  It's the second paramter.
-
-builtins/echo.def
-       - changed call to ansicstr to pass strlen(list->word->word)
-
-parse.y
-       - redid the $'...' expansion so it works like it's supposed to:
-         the quoted strings may appear anywhere in a token, and multiple
-         ansi-c quoted strings may appear in a token
-       - redid the $"..." expansion so it works like it's supposed to
-
-tests/nquote.{tests,right}, tests/run-nquote
-       - tests for the $'...' and $"..." quoting stuff -- simple-minded
-
-subst.c
-       - on systems without /dev/fd, open the named pipe for a `reading
-         in child' process substitution (>(...)) with O_NONBLOCK
-
-lib/posixheaders/filecntl.h
-       - add code to make sure the O_NONBLOCK is defined to O_NDELAY if
-         it is present and O_NONBLOCK is not defined by <fcntl.h>
-
-general.c
-       - don't bother handling both O_NONBLOCK and O_NDELAY in
-         unset_nodelay_mode, since filecntl.h defines O_NONBLOCK as
-         O_NDELAY for non-Posix systems
-
-                                   4/1
-                                   ---
-lib/readline/funmap.c
-       - made `vi-fetch-history' a bindable command name
-
-doc/readline.3
-       - many cleanups, updated the list of default bindings 
-
-                                   4/4
-                                   ---
-doc/bash.1, doc/readline.3
-       - fixed up use of \-; now it is not used unless the text is being
-         printed in bold or italic
-
-configure.in, config.h.in
-       - add a configuration option, --enable-usg-echo-default, to turn
-         on DEFAULT_ECHO_TO_USG and make `echo' expand backslash-escaped
-         characters by default
-
-                                   4/8
-                                   ---
-parse.y
-       - another small change to localeexpand to handle backslash-escaped
-         double quotes in the double-quoted string
-
-                                   4/9
-                                   ---
-shell.c
-       - add the value of MACHTYPE to the text output by `--help'
-
-                                  4/11
-                                  ----
-parse.y
-       - more changes to the $"..." and $'...' code to move it into
-         read_token
-       - don't try to check token[token_index - 1] unless token_index
-         is greater than 0
-
-                                  4/12
-                                  ----
-trap.c
-       - new function run_trap_cleanup to clean up after _run_trap_internal
-         in the event that parse_and_execute does not return normally
-         (e.g., if a `return' is executed in the trap command)
-       - set running_trap to the number of the signal whose trap is being
-         run plus one in _run_trap_internal
-
-trap.h
-       - extern declaration for run_trap_cleanup
-
-jobs.c
-       - new function `unfreeze_jobs_list' to set freeze_jobs_list back to 0.
-         called from parse_and_execute_cleanup so a `return' while running
-         an interrupt trap does not leave the jobs list frozen
-
-jobs.h
-       - new extern declaration for unfreeze_jobs_list
-
-builtins/common.c
-       - if running_trap is non-zero in parse_and_execute_cleanup, indicating
-         that parse_and_execute was running a trap command when it got a
-         `return', call run_trap_cleanup (running_trap - 1)
-       - parse_and_execute_cleanup now calls unfreeze_jobs_list
-
-                                  4/16
-                                  ----
-Makefile.in
-       - don't try to make `doc' as a dependency of `install'
-
-doc/Makefile.in
-       - make `info' a dependency of `install' to make sure the info
-         document is present and up to date before installing it
-       - make the `install' target install the documents with a $(srcdir)/
-         prefix in case we're building in another directory
-
-lib/glob/glob.c
-       - fixed an off-by-one error in glob_dir_to_array
-
-shell.c
-       - removed an extra increment of arg_index when setting up the
-         arguments for -c command
-
-                                  4/17
-                                  ----
-pathexp.c
-       - made quote_globbing_chars backslash-quote backslashes as well as
-         `?*[]'; changed it to be a little faster
-
-bashhist.c
-       - call quote_globbing_chars to quote backslashes in the previous
-         history line even if no other globbing chars are present.  This
-         is done only if we're matching against a HISTIGNORE pattern of `&'
-       - don't bother quoting globbing characters in the current history
-         line in history_should_ignore -- fnmatch ignores special chars in
-         its `string' argument
-
-[bash-2.0-alpha2 frozen]
-
-                                  4/18
-                                  ----
-command.h
-       - new flag value for a word: W_NOSPLIT.  A word with this bit set
-         in its flags will not have word splitting performed
-
-parse.y
-       - turn on the W_NOSPLIT flags for assignment statements appearing
-         where an assignment statement is acceptable (words that would
-         return ASSIGNMENT_WORD rather than WORD).  This means that, for
-         the time being, assignment statement arguments to builtins like
-         `declare' or `alias' will be split unless they are quoted
-
-subst.c
-       - don't split a word in expand_word_internal if the W_NOSPLIT flag
-         is set, rather than checking W_ASSIGNMENT; do the same thing in
-         expand_word_list_internal
-
-builtins.h
-       - a new flag, ASSIGNMENT_BUILTIN, indicating that this builtin takes
-         assignment statements as arguments
-       - rearranged the values of the builtin flags, so the BUILTIN_* flags
-         come first, then the *_BUILTIN flags
-
-builtins/makebuiltins.c
-       - added code for an array of `assignment builtins' -- builtins that
-         take assignment statements as arguments -- and to add the
-         ASSIGNMENT_BUILTIN flag for those builtins
-
-execute_cmd.c
-       - added a hack function `fix_assignment_words', which checks the
-         first word of a builtin command to see if it is a builtin that
-         has the ASSIGNMENT_BUILTIN flag set, and adds W_NOSPLIT to the
-         flags for all words with the W_ASSIGNMENT bit set.  This means
-         that word splitting is not done for any of the assignment
-         statements in commands like `declare z=$a'
-
-                                  4/19
-                                  ----
-execute_cmd.c
-       - fixed a memory-freed-twice error in find_in_path_element
-
-lib/readline/rltty.c
-       - include <sys/ioctl.h> if GWINSZ_IN_SYS_IOCTL is defined and
-         SHELL is not defined
-
-lib/readline/input.c
-       - changed a stray HAVE_FIONREAD to FIONREAD
-       - include <sys/ioctl.h> if FIONREAD_IN_SYS_IOCTL is defined
-
-aclocal.m4
-       - new macro, BASH_HAVE_FIONREAD, to check for a #define of
-         FIONREAD in <sys/ioctl.h> or one of the files it includes;
-         defines FIONREAD_IN_SYS_IOCTL if present
-
-config.h.in
-       - new line for FIONREAD_IN_SYS_IOCTL
-
-configure.in
-       - call BASH_HAVE_FIONREAD
-
-                                  4/22
-                                  ----
-builtins/cd.def
-       - fixed a memory-freed-twice error in mkpath()
-
-jobs.c
-       - don't print a job termination message for a non-interactive shell
-         with startup_state == 2 (those shells are started to run commands
-         when bash is invoked with `-c command')
-
-                                  4/23
-                                  ----
-general.h
-       - definition for a `generic pointer' type PTR_T -- `void *' on ANSI
-         C systems, `char *' otherwise
-
-jobs.h
-       - new members of job struct: `j_cleanup', a function to call when the
-         job is marked JDEAD, and `cleanarg', argument to pass to j_cleanup
-
-jobs.c
-       - initialize j_cleanup and cleanarg to NULL in stop_pipeline
-       - call j_cleanup from waitchld() when a job is marked JDEAD
-
-test.c
-       - fixed binop() so it recognizes `<' and `>' as binary operators
-       - fixed a bug in binary_operator so `<' works correctly
-
-tests/test-tests
-       - fixed the tests so they no longer rely on the modes of files in
-         the file system to test -u, -g, -r, -x, -w, and so on, except
-         for a few `standard' files like /dev/tty and /dev/null
-       - added tests for string < string and string > string
-
-xmalloc.c
-       - include <unistd.h> if HAVE_UNISTD_H is defined for a prototype
-         for sbrk
-       - add an extern declaration for sbrk if SBRK_DECLARED is not defined
-       - use PTR_T to cast the return value of sbrk() when finding out where
-         the break is and how many bytes of memory have been allocated
-
-lib/malloc/malloc.c
-       - added code to write 0xcf into memory as it's freed, to uncover
-         callers that try to refer to freed memory, and writes 0xdf into
-         newly-allocated memory, to uncover callers that assume something
-         about new allocations (e.g., that newmem[0] == 0)
-
-lib/malloc/gmalloc.c
-       - latest version from GNU sources
-
-                                  4/25
-                                  ----
-doc/bash.1
-       - changed the description of `unset' to include a description of
-         the `-v' option
-
-parse.y
-       - fixed a problem with conversion to 12-hour time in
-         decode_prompt_string that made 12:00pm show up as 00:00pm
-
-                                  4/26
-                                  ----
-builtins/common.c, subst.c
-       - a couple of fixes from Andreas Schwab
-
-configure.in
-       - set up the minimal configuration after checking for
-         --enable-minimal-config with AC_ARG_ENABLE, before checking any
-         of the other options, instead of after checking all options.
-         This makes `--enable-minimal-config --enable-prompt-string-decoding'
-         work as documented
-       - changed AC_PREREQ to require autoconf version 2.8 or higher
-       - added some code to disable gnu malloc by default on the systems
-         listed in NOTES
-       - set MALLOC_SRC to have the $(ALLOC_LIBSRC)/ prefix to avoid having
-         a directory in the dependencies when making without the gnu
-         malloc
-
-lib/malloc/Makefile.in
-       - make gmalloc.o depend on $(BUILD_DIR)/config.h
-
-                                  4/30
-                                  ----
-COMPAT
-       - new file listing user-visible incompatibilites between bash-1.14
-         and bash-2.0
-
-parse.y
-       - new prompt expansions, \v (version) and \V (version + patchlevel)
-
-config.h.top
-       - the default value of PS1 is now '\s-\v\$ '
-
-doc/{bash.{1,html},features.texi}
-       - added descriptions of \v and \V prompt expansions
-       - changed default value of PS1
-
-Makefile.in
-       - added dependencies on config.h.top for files that use definitions
-         included there
-
-builtins/exec.def
-       - removed reference to `no_exit_on_failed_exec' from the help text
-
-                                   5/3
-                                   ---
-builtins/cd.def
-       - fixed a typo in fix from 4/22
-
-                                   5/7
-                                   ---
-builtins/common.c
-       - new function `no_options (WORD_LIST *)' to be called by builtins
-         that do not take options to check for options and -?.  It returns
-         0 on success, non-zero if an unwanted option is supplied
-
-builtins/common.h
-       - extern declaration for no_options
-
-builtins/return.def
-       - corrected the error message to include returning from a sourced
-         script
-
-builtins/{getopts,eval,wait,source,fg_bg,help}.def
-       - changed the following builtins to either call no_options or test
-         explicitly for options and return EX_USAGE if any are found:
-
-               getopts eval wait source . fg bg help
-
-builtins/help.def
-       - error messages are now printed using builtin_error
-
-                                   5/8
-                                   ---
-builtins/jobs.def
-       - fixed an unitialized variable problem
-
-tests/more-exp.tests
-       - added additional tests for IFS problem uncovered by `iffe'
-
-                                   5/9
-                                   ---
-lib/malloc/Makefile.in
-       - use $(ALLOCA_SOURCE) instead of $< in rule that builds alloca.o.
-         Some makes don't expand the $< in non-suffix rules
-
-lib/readline/rldefs.h
-       - fix workaround for SVR4.2 bug
-
-shell.c
-       - even though SVR4.2 has getpeername(), isnetconn() should not use it
-
-maxpath.h
-       - rework to make sure PATH_MAX and NAME_MAX are defined, and remove
-         the BUILDING_MAKEFILE code
-
-general.c, parse.y, oslib.c, jobs.c, builtins/common.c, builtins/cd.def
-       - change uses of MAXPATHLEN to PATH_MAX
-
-examples/loadables/{{log,base,dir}name,tty,pathchk,tee}.c
-       - new loadable builtins:
-
-               logname basename dirname tty pathchk tee
-
-configuure.in, config.h.in
-       - look for tzset(3), define HAVE_TZSET if found
-
-subst.c
-       - new special variable function, sv_tz, which calls tzset when
-         TZ is changed, if tzset(3) exists and the shell is compiled
-         to do prompt string decoding
-
-subst.h
-       - extern declaration for sv_tz
-
-                                  5/10
-                                  ----
-builtins/echo.def
-       - only call printf if the string to print is non-null
-       - add an fflush(stdout) after the printf call to work around a
-         bug in SunOS 5.5
-
-                                  5/16
-                                  ----
-shell.c
-       - moved some variable declarations out of this file to more
-         logical places
-
-support/config.guess
-       - small fixes from rfg@monkeys.com
-
-version.c
-       - moved functions for getting, setting, and displaying shell version
-         information here from shell.c
-
-general.c
-       - moved set_lines_and_columns to variables.c
-       - moved getc_with_restart and ungetc_with_restart to input.c
-       - new function argv_to_word_list(), converts an array of strings
-         into a WORD_LIST
-       - renamed find_name_in_list to find_name_in_array to match rest
-         of functions that operate on arrays of strings
-
-configure.in, Makefile.in, jobs.c, nojobs.c
-       - changes so that jobs.c no longer includes nojobs.c, and the correct
-         object file (jobs.o or nojobs.o) is selected by configure
-         and substituted into the Makefile
-
-list.c
-       - new file, list manipulation functions from general.c
-
-externs.h, general.h
-       - moved extern declarations for functions defined in oslib.c and
-         list.c to externs.h from general.h
-
-                                  5/17
-                                  ----
-locale.c
-       - new file, with locale code from parse.y and shell.c
-
-shell.c
-       - don't turn off job control if act_like_sh is set
-       - if an unknown option is supplied at startup or if -c is
-         supplied without an argument, exit with EX_USAGE
-       - call posix_initialize after parsing all the options, to
-         catch `bash -o posix'
-       - new functions: init_interactive(), init_noninteractive()
-       - exit with EX_NOTFOUND if a script argument is not found
-       - exit with EX_NOINPUT if a script file cannot be opened for
-         some reason
-
-shell.h
-       - new define for EX_NOINPUT exit status (126)
-
-                                  5/18
-                                  ----
-lib/readline/bind.c
-       - fixed _rl_get_keyname() so that it properly handles C-\ and outputs
-         it as \C-\\ and C-" as \C-\".  This fixes the improper binding
-         commands written by `bind -p' that caused weird things to happen
-         when people used the output of `bind -p' as a start for their
-         own inputrc files
-       - new function _rl_init_file_error to print error messages encountered
-         while parsing the inputrc file
-       - print out an error message if parsing an inputrc line and no closing
-         double quote is found for a key binding
-
-lib/readline/complete.c
-       - in rl_complete_internal, if the completion function results in
-         multiple matches, but none match up to even the first character, 
-         use what the user typed in (which is presumably a glob pattern
-         that expanded into multiple files) as matches[0].  This makes
-         things like show-all-if-ambiguous work right, too
-
-oslib.c
-       - if we are providing our own version of getenv(), provide a function
-         _getenv() as well, which just calls getenv()
-
-builtins/ulimit.def
-       - #define _KERNEL before including <sys/resource.h> if HPUX is
-         defined.  This makes the full set of limits available on hpux
-         version 8 and above
-
-bashline.c
-       - new function, enable_hostname_completion, sets up readline to
-         perform or not perform hostname completion.  Hostname completion
-         is on by default.
-       - don't attempt hostname completion in attempt_shell_completion()
-         unless perform_hostname_completion is set
-
-builtins/shopt.def
-       - add a `set_func' member to the shopt options structure, to provide
-         a hook for those variables that require a little more than just
-         toggling a variable on or off
-       - new shopt variable `hostcomplete', turns hostname completion on and
-         off
-
-doc/{bash.{1,html},features.texi}
-       - added description of new shopt `hostcomplete' variable
-
-                                  5/21
-                                  ----
-sig.c
-       - don't try to save the shell history in termination_unwind_protect
-         if we're dying due to SIGABRT
-
-bashhist.c
-       - new functions: last_history_entry (static), last_history_line
-
-bashhist.h
-       - extern declarations for new functions in bashhist.c
-
-error.c
-       - have programming_error() report the last command in the history
-         before aborting
-
-builtins/fc.def
-       - if the editor returns a non-zero exit status when using `fc -e',
-         return immediately without trying to execute the commands, as
-         per Posix.2, 5.12.2
-       - when using `fc -s', echo the command to be executed to stderr,
-         not stdout
-
-lib/readline/terminal.c
-       - new file, with all code related to termcap/terminfo
-
-lib/readline/{readline,rltty,display,util}.c
-       - moved functions dealing with termcap to terminal.c
-
-lib/readline/readline.c
-       - readline_initialize_everything now calls _rl_enable_meta_key()
-         to turn on the meta key, based on the value of _rl_enable_meta
-         (on by default)
-
-lib/readline/rltty.c
-       - do not enable and disable the meta key each time readline is
-         called; do it once at initialization
-
-                                  5/23
-                                  ----
-bashhist.c
-       - when `hist_verify' is set, call re_edit with the expanded line,
-         not the original one, and do not print the results of the
-         expansion before re-editing
-
-                                  5/24
-                                  ----
-support/config.guess
-       - recognize linux/sparc
-
-configure.in
-       - don't use GNU malloc on linux/sparc
-
-variables.c
-       - initialize a new $MACHTYPE variable to the value of MACHTYPE as
-         set by autoconf
-
-doc/{bash.{1,html},features.texi}
-       - documented $MACHTYPE
-
-                                  5/30
-                                  ----
-builtins/ulimit.def
-       - allow the max vm size to be set via setrlimit() if RLIMIT_VMEM
-         is defined
-
-                                  5/31
-                                  ----
-shell.h
-       - changed EX_USAGE to 258, EX_BADUSAGE is now 2
-       - added a number of execution failure statuses, so that builtins
-         can indicate various failures.  All are greater than 256, so
-         they cannot be returned by other utilities
-
-execute_cmd.c
-       - new function, builtin_status(), to translate the new return
-         status codes to something the shell can export
-       - changed execute_simple_command to call builtin_status after
-         execute_builtin_or_function to translate error codes if a
-         builtin is invoked.  If a function or regular builtin is
-         invoked, all return values greater than EX_SHERRBASE get
-         translated to EXECUTION_FAILURE, with the exception that
-         EX_USAGE gets translated to EX_BADUSAGE.  If a special
-         builtin failed with a status > EX_SHERRBASE, special_builtin_failed
-         is set to cause the shell to exit in POSIX mode
-       - changed execute_builtin_or_function to return EX_REDIRFAIL if
-         redirections fail
-       - changed execute_subshell_builtin_or_function to translate
-         EX_USAGE to EX_BADUSAGE if a builtin is executed
-       - set this_command_name to NULL in execute_for_command before binding
-         each member of the word list to the loop variable, to avoid
-         garbled error messages if the variable has the integer attribute
-
-builtins/{set,unset}.def
-       - return EX_USAGE instead of EXECUTION_FAILURE if a bad option is
-         supplied
-
-builtins/source.def
-       - return EX_USAGE instead of EXECUTION_FAILURE if the required
-         filename argument is missing
-
-builtins/setattr.def
-       - return EX_BADASSIGN if any assignment statements given as arguments
-         to readonly, export, etc. return failures (assignment to
-         non-identifier, assignment to readonly variable)
-
-builtins/declare.def
-       - don't allow `declare var=value' to assign value to a readonly
-         variable
-
-lib/readline/rldefs.h
-       - include <stdarg.h> if we're going to be using stdarg instead of
-         varargs
-
-lib/readline/display.c
-       - added `stdarg' version of rl_message
-
-lib/readline/readline.h
-       - changed extern declaration for rl_message to be in ANSI-C format
-         if __STDC__ is defined and we're using stdarg
-
-variables.c
-       - make sure this_command_name is set to null before calling
-         make_variable_value in assign_array_var_from_string so any
-         error messages are not garbled
-
-                                   6/2
-                                   ---
-builtins/common.c
-       - don't execute the command in parse_and_execute if -n has been
-         enabled and the shell is not interactive
-       - include flags.h for read_but_dont_execute
-
-[bash-2.0-alpha3 released]
-
-                                   6/5
-                                   ---
-subst.c
-       - array_length_reference and parameter_brace_expand_length now
-         return -1 on errors
-       - parameter_brace_expand now returns &expand_param_error if
-         paramter_brace_expand_length returns something < 0
-
-variables.c
-       - assign_in_env now checks for assignments to readonly shell
-         variables and disallows them
-
-                                   6/6
-                                   ---
-xmalloc.c
-       - only do pointer arithmetic on pointers cast to (char *), since
-         it's not required that compilers support arithmetic on void *
-
-shell.c
-       - make sure <sys/socket.h> is included with the same conditions
-         used to call getpeername(2) in isnetconn()
-
-parse.y
-       - added a new function, paren_match, to parse the contents of $(...)
-         constructs.  This function correctly handles embedded quoted
-         strings, embedded command substitutions, embedded command
-         substitutions with embedded quoted strings, etc.  The implementation
-         is much closer to that described in POSIX.2, section 3.6.3.
-       - changed read_token_word to call paren_match where appropriate
-
-subst.c
-       - rewrote extract_delimited_string so that it correctly understands
-         quoted strings inside command substitutions, a la paren_match
-         in parse.y.  Corrected the description of the function's output
-         in the code.  extract_delimited_string is now very recursive, and
-         does not try to do everything in one pass without recursion
-
-                                   6/7
-                                   ---
-test.c
-       - fixed three_arguments() to test the second argument for a valid
-         binary operator before checking whether or not the first argument
-         is `!'.  This is what POSIX.2 says to do.
-
-lib/malloc/malloc.c
-       - don't compile in the memory scrambling code (#define MEMSCRAMBLE)
-         if NO_MEMSCRAMBLE is defined.
-
-configure.in
-       - define NO_MEMSCRAMBLE in LOCAL_CFLAGS for SCO 3.2v[45]
-
-                                   6/9
-                                   ---
-parse.y
-       - renamed paren_match to parse_matched_pair
-       - call parse_matched_pair to parse <(...) and >(...) constructs,
-         since those should be treated the same as $(...) for the purposes
-         of matching parens and skipping embedded quoted strings
-
-                                  6/13
-                                  ----
-parse.y
-       - augmented parse_matched_pair
-               o fixed up backslash quoting and CTLESC handling after
-                 backslashes
-               o match pairs of ${...} and $[...] inside double-quoted
-                 strings or `` strings
-               o keep track of line number quoted string starts on for
-                 better error messages
-               o push and pop delimiters when parsing quoted strings
-                 inside $(...), ${...}, and $[...] for use by the
-                 history code
-               o set EOF_Reached to 1 if we get an EOF before finding the
-                 match closer
-       - rewrote read_token_word from scratch to use parse_matched_pair:
-               o shell quote characters use parse_matched_pair to find
-                 the matching quote
-               o fixed up backslash parsing code
-               o compound array assignments use parse_matched_pair
-               o corrected all_digits and dollar_present computations, so,
-                 for instance, 2''>/dev/null is no longer accepted as
-                 identical to 2>/dev/null
-               o converted ${...} parsing to use parse_matched_pair
-               o removed printing of error messages about unmatched quotes;
-                 now handled by parse_matched_pair
-               o converted $'...' and $"..." to use parse_matched_pair
-               o removed all of the delimited_xxx and dollar_xxx variables
-                 and embedded_quoted_string
-       - modified report_syntax_error to regularize error messages:
-               o non-interactive shells and interactive shells running
-                 scripts with `.' now always report line numbers
-               o unexpected EOF is always reported when EOF_Reached is true
-               o non-interactive shells no longer duplicate the script name
-                 in error messages (e.g., `./z3: ./z3: line 3: syntax error')
-
-bashline.c
-       - make sure `newnames' is freed in _ignore_completion_names
-
-lib/readline/complete.c
-       - don't insert the first match on TAB completion in
-         rl_complete_internal() if matches[0] is the empty string --
-         that will overwrite whatever the user has typed, if dequoting
-         what the user typed results in the empty string
-
-execute_cmd.c
-       - include <limits.h> if HAVE_LIMITS_H is defined for ARG_MAX
-       - only put the special environment variable for GNU getopt into
-         the environment if ARG_MAX exceeds 10240
-
-subst.c
-       - rewrote extract_dollar_brace_string so that it fully obeys
-         the POSIX.2 rules for finding the closing `}' and uses
-         skip_{single,double}_quoted rather than trying to do it with
-         inline delimiters
-       - removed the INC_NEST and DEC_NEST defines
-
-                                  6/14
-                                  ----
-jobs.c
-       - don't print status messages for background jobs that complete
-         successfully when running shell scripts
-
-builtins/shopt.def
-       - when using shopt -o as a synonym for set -o, make sure $SHELLOPTS
-         is updated
-       - make sure to update $SHELLOPTS when using shopt to set or unset
-         interactive comments
-
-execute_cmd.c
-       - fixed find_in_path_element to not return non-executable files
-         when FS_EXEC_PREFERRED is one of the flags, after saving such
-         a file as file_to_lose_on (fix from william@nscs.fast.net)
-
-                                  6/17
-                                  ----
-lib/readline/complete.c
-       - after printing possible completions, all lines of a multi-line
-         prompt are redisplayed using rl_forced_update_display()
-
-subst.c
-       - in expand_word_internal, only do tilde expansion on words where
-         (flags & (W_ASSIGNMENT|W_QUOTED)) == W_ASSIGNMENT (unquoted
-         assignment statements) and contain unquoted `=~' or `:~', and
-         only if posixly_correct is off.  POSIX.2 says that only the
-         assignments preceding the command name should be tilde-expanded.
-
-                                  6/18
-                                  ----
-support/config.guess
-       - recognize the new Pyramid DC-OSx as `mips-pyramid-sysv4'
-
-configure.in
-       - set LOCAL_CFLAGS to -Xa for mips-pyramid-sysv4 as per
-         Peter Chubb
-
-subst.c
-       - variable assignment errors when there is not a command name
-         after the assignments now causes a non-interactive shell to 
-         exit in POSIX.2 mode
-
-execute_cmd.c
-       - if the iteration variable in a for statement is a read-only
-         variable, a variable assignment error occurs.  This causes
-         non-interactive shells to exit in posix mode, and a failure
-         status to be returned for other non-interactive shells and
-         interactive shells
-       - if the selection variable in a select statement is a read-only
-         variable, a variable assignment error occurs, with the same
-         consequences as a for statement variable assignment error
-
-doc/bashref.*
-       - renamed features.* to bashref.*, since that more accurately
-         reflects the current contents
-
-                                  6/19
-                                  ----
-test.c
-       - changed three_arguments() to do one-argument tests on $1 and
-         $3 and return the appropriate values if -a or -o is given as
-         the second argument
-       - changed three_arguments() to perform a one-argument test on
-         $2 if $1 == '(' and $3 == ')' and return that result
-       - make sure test_stat translates /dev/fd/xx to DEV_FD_PREFIX/xx
-         so /dev/fd/0 always means the same thing, even on linux,
-         which uses /proc/self/fd
-
-aclocal.m4
-       - added a check for libncurses in BASH_CHECK_LIB_TERMCAP
-
-configure.in
-       - added an initial message saying we're configuring for bash-2.0
-
-lib/glob/fnmatch.c
-       - made a small change to fnmatch() to fix a bug matching patterns
-         with multiple consecutive `*'s
-
-                                  6/20
-                                  ----
-parse.y
-       - inhibit history expansion when calling pre_process_line() from
-         shell_getc() if the current delimiter is a single quote, even
-         if we're on a different line than the opening quote
-       - make sure read_a_line prints a prompt if we're interactive and
-         not using readline, and make sure we call clearerr() if we
-         get EOF when interactive and not using readline
-
-bashhist.c
-       - new function history_expansion_p(char *) returns 1 if the string
-         passed contains the history expansion or history substitution
-         characters
-       - pre_process_line() now calls history_expansion_p and calls
-         the history expansion code only if that returns 1
-
-                                  6/26
-                                  ----
-lib/readline/isearch.c
-       - swap the behavior of ^J and ^M when i-searching.  ^J now terminates
-         the search without accepting the line.  ^M terminates the search
-         and accepts the line, executing the command
-
-examples/loadables/sprintf.c
-       - new `sprintf' builtin: sprintf var format [args...]
-
-lib/readline/readline.c
-       - added a line in _rl_dispatch that sets _rl_suppress_redisplay if
-         the function is rl_insert and there is input available
-
-                                  6/27
-                                  ----
-builtins/getopts.def
-       - new function, getopts_bind_variable(), used when assigning a value
-         to the user-supplied variable passed to getopts().  It makes sure
-         that that variable name is legal and prints an error message if it
-         is not
-
-builtins/getopt.c
-       - don't increment sh_optind until after we've checked whether or not
-         the current option character appears in the list of options passed
-         to getopts by the user
-
-                                  6/28
-                                  ----
-variables.c
-       - added a new parameter to print_var_value: QUOTE.  If it's non-zero
-         and the variable's value contains shell metacharacters, quote the
-         value so it can be read back in
-
-variables.h
-       - changed extern declaration for print_var_value
-
-siglist.h
-       - if SYS_SIGLIST_DECLARED is not defined, but HAVE_UNDER_SYS_SIGLIST
-         is, only declare sys_siglist as extern char *sys_siglist[] if
-         sys_siglist is not `#define'd
-
-parse.y
-       - make sure a reserved word is acceptable before returning `}' as
-         a token from special_case_tokens, even if the token read so far
-         is "}"
-       - make reset_parser set allow_open_brace to 0
-
-                                   7/1
-                                   ---
-test.c
-       - fixed binop to not try to read s[3] if s[2] == '\0'.  There are
-         no one-character binary operators that begin with `-'
-
-variables.c
-       - fixed kill_all_local_variables to do nothing if variable_context
-         is >= local_variable_stack_size (indicating that we do have some
-         local variables, but not at this level of function nesting, and
-         we are beyond the end of the array allocated the last time we
-         had local variables)
-
-                                   7/2
-                                   ---
-execute_cmd.c
-       - non-interactive shells in posix mode should exit if the variable
-         in a for command is not a valid identifier.  This should really
-         be caught by the parser
-       - non-interactive shells in posix mode should exit if a function
-         name is not a valid identifier.  This should also be caught by
-         the parser
-
-                                   7/3
-                                   ---
-jobs.c
-       - non-interactive shells should ignore stopped children, so
-         waitchld() should set waitpid_flags to WUNTRACED only if the
-         shell is interactive and it's not a subshell environment
-
-lib/readline/signals.c
-       - if not being compiled as part of the shell, readline should
-         catch SIGTERM and clean up
-
-shell.c
-       - change to isnetconn: on Solaris 2.5, getpeername() can return
-         EINVAL rather than ENOTSOCK if the fd passed as the first
-         argument is not a socket
-
-                                   7/5
-                                   ---
-lib/readline/complete.c
-       - new variable, available to library users, to inhibit completion
-         and cause the completion character to be inserted into the
-         line with self-insert: rl_inhibit_completion.  Set to 0 by default.
-
-lib/readline/readline.h
-       - extern declaration for rl_inhibit_completion
-
-lib/readline/doc/rltech.texinfo
-       - documented rl_inhibit_completion
-
-lib/readline/bind.c
-       - new readline user variable: disable-completion.  This provides
-         users a way to toggle the value of rl_inhibit_completion
-
-doc/{bash.{1,html},readline.3}, lib/readline/doc/rluser.texinfo
-       - documented disable-completion variable
-
-lib/readline/doc/Makefile
-       - added `html' target to create html from rlman.texinfo and
-         hist.texinfo
-
-                                   7/8
-                                   ---
-builtins/cd.def
-       - only try cd spelling correction if the shell is currently
-         interactive, regardless of value of `cdspell' option
-
-lib/posixheaders/alloca.h
-       - AIX 4.2 needs `#pragma alloca' if gcc is not being used
-
-                                   7/9
-                                   ---
-builtins/getopts.def
-       - return EXECUTION_FAILURE from getopts if it's trying to assign
-         to a read-only variable
-       - reset sh_badopt to zero in getopts_reset()
-
-builtins/getopt.c
-       - new variable, sh_badopt, set to 1 if we find an illegal option
-       - do the increment of sh_optind if sh_badopt is non-zero and we're
-         at the end of the option string at the beginning of sh_getopt().
-         The increment is deferred until the next call so $OPTIND is
-         correct
-
-builtins/getopt.h
-       - extern declaration of sh_badopt
-
-                                  7/10
-                                  ----
-Makefile.in
-       - don't pass ALLOCA_SOURCE or ALLOCA_OBJECT to the make in lib/malloc
-       - don't make libmalloc.a depend on ALLOCA_DEP -- it causes some
-         compilers to build alloca.o in the top directory, and if ALLOCA
-         is not defined, makes the malloc library depend on a directory
-
-aclocal.m4
-       - some small changes to make the output look better
-
-memalloc.h
-       - made some small changes suggested by the autoconf documentation
-
-                                  7/11
-                                  ----
-parse.y
-       - swapped meanings of \h and \H in prompt_string_decode for
-         bash-1.14.6 compatibility
-
-doc/{bash.{1,html},bashref.texi}
-       - updated prompt string decoding section with swap of \h and \H
-
-general.c
-       - print_timeval and print_time_in_hz now accept a FILE * as the
-         first argument, so `times' can print to stdout while `time'
-         prints to stderr
-
-execute_cmd.c
-       - changed time_command to print the timing statistics to stderr
-
-builtins/times.def
-       - added the FILE * argument to the calls to print_timeval and
-         print_time_in_hz
-
-support/texi2html
-       - upgraded to version 1.50
-
-error.c
-       - include bashhist.h if HISTORY is defined for declarations of
-         last_history_line() and remember_on_history
-
-lib/glob/glob.c
-       - add a `#pragma alloca' as the first thing in the file if we're
-         not using gcc and _AIX is defined
-
-lib/posixheaders/memalloc.h
-       - remove the `#pragma alloca' stuff; it is done in the C source
-         files now, to avoid problems with other AIX header file
-         declarations
-
-                                  7/12
-                                  ----
-lib/readline/rltty.c
-       - some changes to work around AIX 4.2 bugs (sometimes OPOST is unset
-         in termios, sometimes FLUSHO is inexplicably set in termios, etc.)
-
-                                  7/15
-                                  ----
-lib/readline/rltty.c
-       - make SETATTR use TCSADRAIN on POSIX machines.  This setting is
-         supposed to be used for changes that affect output
-
-[bash-2.0-alpha4 released]
-
-                                  7/16
-                                  ----
-trap.c
-       - changed reset_or_restore_signal_handlers to honor traps before
-         special signals, so that `trap "" 2' works right and causes
-         children to ignore SIGINT
-
-locale.c
-       - added lc_all variable to track the value of LC_ALL
-       - added new functions: set_default_locale_vars, set_locale_var,
-         set_lang, get_locale_var, removed get_current_messages_locale
-
-subst.h
-       - added extern declaration for sv_locale
-
-subst.c
-       - LC_ALL, LC_CTYPE, LC_MESSAGES, and LANG are now special variables;
-         sv_locale() is called when they are assigned a value
-
-shell.c
-       - call set_default_locale_vars after initializing the shell variables
-         in main(), so LC_CTYPE and LC_MESSAGES (if present) have values
-       - shell.c does not need to include <locale.h>
-
-general.c
-       - changed print_timeval and print_time_in_hz to format their output
-         as Posix.2 specifies for `time -p' if the new POSIX_TIME argument
-         is non-zero
-
-parse.y
-       - new grammar production: timespec, to handle `time' and `time -p'
-       - change to special_case_tokens so that -p after `time' returns
-         TIMEOPT
-
-execute_cmd.c
-       - set posix_time in time_command if the command's flags include
-         CMD_TIME_POSIX
-       - call print_timeval and print_time_in_hz with posix_time as
-         the new third argument
-       - use a space to separate the word (`real') and the time if we're
-         in posix mode.  This is what POSIX.2 defines for `time -p'
-
-builtins/times.def
-       - call print_timeval and print_time_in_hz with 0 as the new third
-         argument
-
-command.h
-       - new flag: CMD_TIME_POSIX, used to handle `time -p'
-
-doc/{bash.{1,html},bashref.texi}
-       - documented `time -p'
-
-                                  7/17
-                                  ----
-support/mkversion.c
-       - include `config.h' before any other include files
-
-parse.y
-       - initialize was_dollar to 0 in parse_matched_pair
-
-configure.in
-       - removed duplicate check for <sys/file.h> from call to
-         AC_HAVE_HEADERS
-
-sig.c
-       - include siglist.h so we can find out if it defines HAVE_SYS_SIGLIST
-
-siglist.h
-       - define HAVE_SYS_SIGLIST if we end up defining sys_siglist as
-         _sys_siglist (Solaris 2.[45])
-
-siglist.c
-       - include "siglist.h" before testing whether or not HAVE_SYS_SIGLIST
-         is defined; it may be defined in there (Solaris 2.[45])
-
-                                  7/19
-                                  ----
-examples/misc/alias-conv.sh
-       - updated, now uses code from examples/functions/csh-compat to do
-         the alias conversion, uses `command' builtin in functions it
-         creates, does some substitution of csh special variables to
-         bash equivalents
-
-examples/misc/cshtobash
-       - a more ambitious script that attempts to convert csh aliases,
-         environment variables, and local variables to bash equivalents
-
-                                  7/22
-                                  ----
-bashline.c
-       - added `:' to the set of completion word break characters so that
-         individual directories in $PATH assignments can be completed
-
-aclocal.m4
-       - added a new macro, BASH_CC_WORKS, that aborts configuration if
-         ${CC} can't compile a simple program successfully
-
-configure.in
-       - call BASH_CC_WORKS before doing anything else
-
-                                  7/23
-                                  ----
-execute_cmd.c
-       - fixed select_query to print the prompt ($PS3) to stderr
-
-support/bashbug.sh
-       - workaround for bug in SunOS 5.x /bin/sh that causes it to
-         not ignore interrupts while waiting for a foreground process
-         to exit
-
-                                  7/24
-                                  ----
-general.c
-       - added new functions to decompose `timeval's and `clock_t's into
-         seconds and thousandths of seconds:  timeval_to_secs and
-         clock_t_to_secs
-       - changed print_timeval and print_time_in_hz to call timeval_to_secs
-         and clock_t_to_secs, respectively
-       - removed no-longer-used third argument for print_timeval and
-         print_time_in_hz -- `time' output is now done in execute_cmd.c
-
-general.h
-       - new extern declarations for timeval_to_secs and clock_t_to_secs
-
-builtins/times.def
-       - changed calls to print_timeval and print_time_in_hz, removing the
-         no-longer-used third argument
-
-execute_cmd.c
-       - changed the way time_command prints its output:  it now interprets
-         a format string, replacing several escape sequences prefixed with
-         a `%' with the real, user, and system times.  There are options in
-         the format string to ask for the `long' format that `times' uses
-         as well as to specify the number of places after the decimal point,
-         and whether to output fractional seconds at all
-       - time_command now uses the value of the `TIMEFORMAT' variable, if
-         present, to format the timing output.  This is flexible enough to
-         encompass the bash default, posix `time -p', BSD, and SV time
-         formats
-
-                                  7/25
-                                  ----
-Makefile.in
-       - `make clean' should delete the files listed in $(CREATED_SUPPORT);
-         `make mostlyclean' should not
-
-doc/{bash.{1,html},bashref.texi}
-       - fixed an error in the description of the effect that setting and
-         unsetting GLOBIGNORE has on the setting of the `dotglob' option
-
-doc/bashref.texi
-       - updated the section listing the major differences between bash
-         and the SVR4.2 shell
-
-lib/readline/readline.c
-       - removed the setting of _rl_suppress_redisplay, since it doesn't
-         really do anything yet
-
-oslib.c
-       - new function get_clk_tck (void), returns the value of _SC_CLK_TCK
-         if sysconf(3) is available, otherwise returns the value of
-         CLOCKS_PER_SEC (default 60)
-
-general.c
-       - moved CLOCKS_PER_SEC defines to oslib.c
-       - changed clock_t_to_secs to call get_clk_tck once to get the
-         right value to use
-
-externs.h
-       - extern declaration for get_clk_tck
-
-execute_cmd.c
-       - changed print_formatted_time so that a `%' at the end of the string
-         is output literally
-       - changed print_formatted_time to output a newline after the
-         translated format string, so it does not need to be included in
-         the format
-       - changed BASH_TIMEFORMAT (the default time format) to have a leading
-         newline to match ksh93
-
-configure.in
-       - use `shlicc2' on BSD/OS machines
-
-                                  7/26
-                                  ----
-doc/bash.html
-       - major overhaul, cleaned up text, corrected some minor HTML errors
-
-variables.c
-       - call sv_optind and sv_opterr to initialize the getopts stuff in
-         initialize_shell_variables
-
-                                  7/29
-                                  ----
-shell.c
-       - don't let maybe_execute_file try to read files that are not
-         `regular files'
-
-                                  7/30
-                                  ----
-parse.y
-       - cast `string' in yy_string_get() to unsigned char * to avoid
-         sign extension bugs.  For example, bash -c $'ls\377who'
-
-
-builtins/reserved.def
-       - add help text for the `time' reserved word
-       - deleted description of `HISTCONTROL'
-       - added descriptions for HISTIGNORE, PWD, HOSTNAME, GLOBIGNORE,
-         MACHTYPE
-
-                                  7/31
-                                  ----
-builtins/common.c
-       - parse_and_execute saves and restores the line number around
-         calls, and resets it to 0 when pushing the string onto the
-         input stack
-
-parse.y
-       - added code that parses `` within a double-quoted string as a
-         single word
-
-                                   8/6
-                                   ---
-configure.in, config.h.in
-       - look for `textdomain' as well as `gettext' for internationalization
-
-locale.c
-       - when LC_MESSAGES is set, call textdomain as well as setlocale
-       - new variable `default_domain', used to track the value of
-         $TEXTDOMAIN
-
-subst.c        
-       - call sv_locale when TEXTDOMAIN changes
-
-                                   8/7
-                                   ---
-error.c
-       - new function, sys_error(), which prints a formatted string followed
-         by a colon and strerror(errno) to stderr
-
-error.h
-       - extern declaration for sys_error
-
-jobs.c, nojobs.c, input.c, execute_cmd.c, subst.c
-       - changes to use sys_error()
-
-[many files]
-       - changes to many of the literal strings in the code for consistency
-         and easier potential translation
-
-                                   8/8
-                                   ---
-parse.y
-       - new function debug_parser(int) to toggle the value of yydebug
-         if YYDEBUG != 0
-
-                                   8/9
-                                   ---
-oslib.c
-       - don't use CLOCKS_PER_SEC, just try to get CLK_TCK (60 by default)
-
-bashline.c
-       - set saved_history_line_to_use to -1 when it's not going to be used
-         rather than 0.  A value of 0 can be confused with the first
-         history line
-
-builtins/evalstring.c
-       - moved parse_and_execute and auxiliary functions here from
-         builtins/common.c
-
-builtins/evalfile.c
-       - moved maybe_execute_file here from shell.c
-
-Makefile.in, builtins/Makefile.in
-       - changes necessitated by the new files
-
-                                  8/12
-                                  ----
-builtins/common.c
-       - fixed an off-by-one bug in single_quote that could make bash
-         run off the end of a string if it consisted entirely of single
-         quotes
-
-                                  8/13
-                                  ----
-shell.c
-       - moved code from main() to a new function: open_shell_script
-       - don't try to fclose(default_input) if BUFFERED_INPUT is defined
-       - moved argument binding code out of two places in main() and
-         open_shell_script() to a new function: bind_args().  This takes
-         an additional argument telling whether to bind starting at $0
-         or $1
-       - moved the code that calls the with_input_from_* functions into
-         a new function: set_bash_input
-       - moved the normal shell command-line option parsing code out of
-         main() into a new function: parse_shell_options
-       - moved the long option parsing code out of main() into a new
-         function: parse_long_options()
-
-general.c
-       - new function: move_to_high_fd(fd), which tries to move FD to a
-         file descriptor close to the allowed maximum, returning the new
-         fd and closing the old one (or returning the old one if something
-         goes wrong)
-
-general.h
-       - new extern declaration for move_to_high_fd
-
-variables.c
-       - moved indirection_level_string() here from shell.c
-
-jobs.c
-       - change initialize_jobs to use move_to_high_fd() instead of the
-         inline code to do the same thing
-
-                                  8/14
-                                  ----
-lib/readline/readline.c
-       - add `en_US.ISO8859-1' to the list of legal LANG values that turns
-         on readline's 8-bit mode
-
-                                  8/15
-                                  ----
-builtins/evalfile.c
-       - combined source_file and maybe_execute_file into a new function
-         _evalfile(fname, flags), where the flags select the appropriate
-         behavior
-
-eval.c
-       - moved the functions that perform the read-eval loop here from
-         shell.c
-
-execute_cmd.c
-       - changed CPU calculation for printing timing statistics using
-         ideas and code from Deven Corzine (deven@ties.org)
-
-eval.c, builtins/evalstring.c
-       - make sure we dispose of global_command if set -n is on and the
-         shell is not interactive
-
-                                  8/16
-                                  ----
-variables.c
-       - make a new array variable, BASH_VERSINFO, with version information:
-
-               BASH_VERSINFO[0] = release      (2)
-               BASH_VERSINFO[1] = version      (00)
-               BASH_VERSINFO[2] = patch level  (0)
-               BASH_VERSINFO[3] = build version (1058)
-               BASH_VERSINFO[4] = release status (beta1)
-               BASH_VERSINFO[5] = $MACHTYPE    (sparc-sun-sunos4.1.4)
-
-doc/{bash.{1,html},bashref.texi}
-       - Documented BASH_VERSINFO
-
-configure.in, config.h.in
-       - look for bindtextdomain(), set HAVE_BINDTEXTDOMAIN if found
-
-subst.c
-       - call sv_locale if TEXTDOMAINDIR is set or changes
-
-locale.c
-       - handle TEXTDOMAINDIR in set_locale_var; call bindtextdomain if
-         it is present
-
-tests/array.tests
-       - added calls to egrep to filter out BASH_VERSINFO and PIPESTATUS,
-         which can vary from system to system
-
-                                  8/19
-                                  ----
-shell.c
-       - moved line_buffer_stream from here to oslib.c, made it into a
-         replacement for setlinebuf() if that is not available
-
-externs.h
-       - extern declaration for setlinebuf()
-
-lib/readline/input.c
-       - in rl_gather_tyi, punt if chars_avail < 0 after checking input fd
-
-                                  8/20
-                                  ----
-builtins/suspend.def
-       - send SIGSTOP instead of SIGTSTP
-
-                                  8/21
-                                  ----
-builtins/colon.def
-       - added true and false as builtins (undocumented)
-
-CWRU/POSIX.NOTES, doc/bashref.texi
-       - note that process substitution is not available in posix mode
-
-bashintl.h
-       - new header file for internationalization, included by locale.c
-
-                                  8/22
-                                  ----
-subst.c
-       - in command_substitute, set istring to NULL before trying to
-         make the pipe, so if that fails, the code at error_exit:
-         doesn't try to free it
-
-execute_cmd.c
-       - when executing a shell script without a leading `#!' internally,
-         and the shell is not interactive, close the fd to the script
-         we're reading.  If this is called by the exec builtin, the shell
-         will not have forked, and the fd will not have been closed, even
-         though it's marked close-on-exec
-       - if subshell_argv is non-null, free its members (except 0) and
-         subshell_argv in shell_execve before reassigning it
-       - dispose of currently_executing_command before jumping back to
-         subshell_top_level
-
-builtins/hash.def
-       - use a sentinel variable so we only initialize the hash table
-         once in initialize_filename_hashing
-
-shell.c
-       - don't flush the filename hash table in shell_reinitialize
-       - free dollar_vars[0] in set_shell_name before assigning it
-       - don't fetch the current hostname more than once
-       - don't fetch the current user information more than once unless
-         the uid changes
-
-parse.y
-       - initialize_bash_input should free bash_input.name if it is
-         non-null before zeroing it
-
-                                  8/23
-                                  ----
-aclocal.m4
-       - changed BASH_CHECK_SOCKLIB:  if -lsocket is present, check for
-         and cache the existence of -lnsl.  Define LIBS appropriately
-         based on the values of the cache variables rather than relying
-         on the autoconf tests to do it
-
-                                  8/26
-                                  ----
-parse.y
-       - fix up yy_readline_get and yy_stream_get to fix the sign
-         extension problem
-
-shell.c
-       - move the setjmp(top_level) that catches early SIGINTs to the
-         first statement in main()
-
-Makefile.in
-       - added a `strip' target to strip the binary
-
-[bash-2.0-beta1 frozen]
-
-                                  8/27
-                                  ----
-parse.y
-       - replaced several static state variables with a single flags word:
-         parser_state
-
-                                  8/28
-                                  ----
-parse.y
-       - in read_token_word, combined the ${...} case with the other
-         expansion cases -- the code was identical
-       - added code to handle ksh-style ((...)) -- equivalent to
-         `let "..."'.  In fact, the above construct is translated internally
-         into `let "..."', so error messages output by the evaluator
-         will contain `let'
-
-expr.c
-       - changed evalerror to call internal_error so the name of the
-         shell script is prefixed to the message, if necessary
-
-Makefile.in
-       - changed RELSTATUS to `beta2'
-
-tests/{arith,new-exp}.{tests,right}
-       - changed the expected error message because of the change in format
-         of the arithmetic evaluation error messages in expr.c
-
-builtins/pushd.def
-       - changed pushd_builtin so `pushd -' is equivalent to `pushd $OLDPWD'
-
-externs.h
-       - changed the extern declaration for setlinebuf() to avoid having
-         to include stdio.h before externs.h everywhere
-
-                                  8/29
-                                  ----
-error.c
-       - new function, parser_error, for use by parts of the parser that
-         don't want to call report_syntax_error
-
-error.h
-       - extern declaration for parser_error
-
-parse.y
-       - changed some parts of the parser to use parser_error
-       - made the ((...)) code #ifdef'd on DPAREN_ARITHMETIC
-
-shell.c
-       - added a line to the --help output saying to use `bashbug' to
-         report bugs
-
-configure.in
-       - added new option: --enable-dparen-arithmetic; it controls
-         the DPAREN_ARITHMETIC define in config.h
-       - changed $host_os check for SCO to only enable -DWAITPID_BROKEN
-         for sco3.2v5; all other SCO versions enable -DMUST_UNBLOCK_CHILD
-
-config.h.in
-       - added line for DPAREN_ARITHMETIC, modified by configure
-
-doc/{bash.{1,html},bashref.texi}
-       - documented new ((...)) command and new configuration option
-
-execute_cmd.c
-       - shell_execve should not try to close default_buffered_input unless
-         it is >= 0.  Other code that closes it and deallocates the buffer
-         should set default_buffered_input to -1
-
-                                  8/30
-                                  ----
-configure.in
-       - more changes to LOCAL_CFLAGS for sco machines
-
-error.c
-       - changed parser_error to handle all cases of the shell being
-         interactive, not interactive, reading from a script, and reading
-         from some other file
-
-parse.y
-       - changed report_syntax_error to call parser_error for consistent
-         messages
-
-dispose_cmd.c
-       - change dispose_command to use programming_error instead of
-         report_error
-
-execute_cmd.c, input.c, general.c
-       - changed calls to report_error to internal_error, since we don't
-         want to possibly exit in any of those cases
-
-                                   9/3
-                                   ---
-input.c
-       - changed the `localbuf' type to `unsigned char'
-
-parse.y
-       - changed yy_stream_get to use feof to test for end of file when
-         not using getc_with_restart
-
-                                   9/6
-                                   ---
-config.h.top
-       - added a commented-out define for SYS_BASH_LOGOUT, which is a
-         system-wide .bash_logout file, run when a login shell exits
-       - added /sbin to STANDARD_UTILS_PATH
-
-builtins/exit.def
-       - added support for SYS_BASH_LOGOUT
-
-                                  9/10
-                                  ----
-lib/readline/{{chardefs,histlib}.h,{bind,histexpand,readline,util,vi_mode}.c}
-       - changed to_upper to _rl_to_upper and to_lower to _rl_to_lower
-       - changed digit_value to _rl_digit_value
-       - changed digit_p to _rl_digit_p
-       - changed uppercase_p and lowercase_p to _rl_uppercase_p and
-         _rl_lowercase_p respectively
-       - changed pure_alphabetic to _rl_pure_alphabetic
-
-support/zecho.c
-       - new file, implements a bare-bones echo (no -n, no \-escapes),
-         to be used by tests
-
-tests/rhs-exp.tests
-       - changed calls to echo to use recho to avoid errors when bash is
-         configured with --enable-usg-echo-default
-
-tests/more-exp.tests
-       - changed some calls to echo to use zecho to avoid errors when bash
-         is configured with --enable-usg-echo-default
-
-                                  9/11
-                                  ----
-lib/readline/histexpand.c
-       - fixed a possible off-by-one error in history_expand_internal when
-         deciding whether or not to reallocate `result'
-
-expr.c
-       - fixed expcond() so that an assignment may be supplied as the
-         token after the `?'
-       - illegal bases now cause an evaluation error
-       - multiple base specifications now cause an evaluation error
-
-tests/arith.tests
-       - added more tests for conditional operator and associativity
-
-tests/{run-heredoc,heredoc.{tests,right}}
-       - new set of tests for here-documents
-
-builtins/common.c
-       - print out the name returned by get_name_for_error in
-         builtin_error()
-
-subst.c
-       - set this_command_name to NULL before processing command-line
-         assignment statements so arithmetic evaluation errors don't
-         print garbage
-       - according to POSIX.2, echo ${foo?$x} should print the expanded
-         value of $x, even when it doesn't expand into anything
-
-                                  9/12
-                                  ----
-shell.c
-       - changed the execution of startup files so that $ENV is never
-         run by a non-interactive shell and an interactive shell begun
-         as `sh' reads and executes $ENV, as posix specifies
-
-doc/{bash.{1,html},bashref.texi}
-       - updated description of startup file behavior
-
-doc/Makefile.in
-       - make sure references to bashref.texi are preceded by $(srcdir)/
-         so we can build the documentation in another directory just by
-         typing `make'; e.g. after giving configure the --srcdir option
-
-subst.c
-       - change to array_remove_pattern to avoid evaluating the `param'
-         part of the ${param#word} spec twice when doing things like
-         echo ${A[x=(i+=1)]#${A[y=(i+=2)]}}
-
-                                  9/13
-                                  ----
-builtins/bashgetopt.c
-       - fixed a problem with `;' option specifier (optional argument)
-
-support/config.{sub,guess}
-       - added cases to recognize CRAY C90 and T90
-
-builtins/ulimit.def
-       - rewritten almost from scratch to use internal_getopt and to not
-         mask the return value from getrlimit/setrlimit, and to make it
-         easier to maintain
-       - added `-l' option for systems with RLIMIT_MEMLOCK (4.4 BSD)
-
-doc/{bash.{1,html},bashref.texi}
-       - documented new `-l' option to `ulimit'
-
-                                  9/24
-                                  ----
-parse.y
-       - added `in' to the list of tokens that should not be followed by
-         a semicolon when combining history lines
-       - removed the special-case code in history_delimiting_chars that
-         tried to be smart about `()'
-
-                                  9/25
-                                  ----
-print_cmd.c
-       - fixes to print_group_command from Andreas Schwab
-       - rewrote indent() to use a single malloced string for the spaces
-         to print, rather than calling cprintf multiple times
-
-shell.c
-       - make sure to set the strings in current_user to NULL after freeing
-         their contents in uidget().
-
-parse.y
-       - make sure decode_prompt_string quotes the values inserted by the
-         \w and \W escape sequences using backslashes if the string will be
-         expanded later because promptvars is set
-
-support/mkdirs
-       - removed leading `^' from regular expressions to be matched by
-         `expr' on the advice of meyering@appaloosa.asic.sc.ti.com
-
-                                  9/26
-                                  ----
-parse.y
-       - added a few more possible flag values for parser_state
-       - changed history_delimiting_chars to not add a semicolon after a
-         right paren if we're parsing a case statement
-
-                                  9/27
-                                  ----
-builtins/ulimit.def
-       - a few minor cleanups
-
-                                  10/1
-                                  ----
-builtins/trap.def
-       - make sure first_arg is non-empty before calling signal_object_p()
-
-[bash-2.0-beta2 frozen]
-
-                                  10/2
-                                  ----
-bashintl.h
-       - if we have setlocale(), but don't have a definition for LC_ALL,
-         undefine HAVE_SETLOCALE
-
-configure.in
-       - set LOCAL_LDFLAGS on AIX 4.2 to allow dynamic loading of builtins
-
-builtins/enable.def
-       - use correct flags for AIX 4.2 in dlopen call if _AIX is defined
-
-examples/loadables/Makefile
-       - add sample commands for AIX 4.2
-
-                                  10/3
-                                  ----
-variables.c
-       - new functions: merge_temporary_env(), merge_builtin_env(), to
-         take temporary_env and builtin_env, respectively, and create
-         shell variables from them
-
-variables.h
-       - new extern declarations for merge_temporary_env() and
-         merge_builtin_env()
-
-execute_cmd.c
-       - if variable assignments preceds a posix special builtin, and the
-         shell is in posix mode, those assignments should persist in the
-         shell environment after the builtin completes
-
-doc/bashref.texi
-       - modified description of what's changed by posix mode to include
-         the persistance of assignment statements preceding special builtins
-
-doc/mkposix
-       - new script to create CWRU/POSIX.NOTES directly from the `Bash
-         POSIX Mode' node of bashref.texi, like INSTALL is created
-
-                                  10/4
-                                  ----
-lib/{malloc,glob,readline}/Makefile.in, builtins/Makefile.in
-       - don't have autoconf substitute LOCAL_CFLAGS into the CFLAGS
-         assignment so people on SCO 3.2v[45] can still build with
-         NO_MEMSCRAMBLE even when they run `make CFLAGS=...'
-
-test.c
-       - renamed eaccess() to test_eaccess() to avoid conflict with SCO
-
-config.h.bot
-       - #undef HAVE_GETCWD if GETCWD_BROKEN is defined, so we use the
-         replacement in getcwd.c
-
-general.c
-       - fixed a small memory leak in full_pathname that occurs if
-         getcwd() returns NULL
-
-oslib.c
-       - new constant string variable: bash_getcwd_errstr, to use when
-         getcwd() returns NULL
-
-{general,jobs}.c, parse.y, builtins/{cd.def,common.c}
-       - change calls to getwd() to use getcwd() instead
-
-general.c, builtins/common.c, builtins/cd.def
-       - changed error behavior when getcwd() returns NULL to use
-         bash_getcwd_errstr, sys_error(), and strerror(errno) where
-         appropriate
-
-sig.c
-       - change a couple of calls to signal to set_signal_handler
-
-aclocal.m4
-       - added definitions of _popen and _pclose to the BASH_FUNC_GETCWD
-         macro
-
-configure.in
-       - added -DPATH_MAX=1024 to LOCAL_CFLAGS for sco3.2v[45] on the
-         advice of <grog@lemis.de>
-       - removed check for getwd(3)
-
-externs.h
-       - removed extern declaration for getwd(), added extern declaration
-         for getcwd() if HAVE_GETCWD is not defined
-
-oslib.c
-       - removed definition of getwd(); it is no longer used
-
-lib/readline/rltty.c
-       - changed SETATTR macro for SCO POSIX systems to call tcsetattr
-         with TCSANOW, on advice of <wbader@nacs.fast.net>
-
-                                  10/7
-                                  ----
-support/mkdirs
-       - slight change to work around a bug in the HP-UX `expr'
-
-                                  10/8
-                                  ----
-lib/readline/vi_mode.c
-       - changes so that the text inserted with an `i' command is available
-         to be reinserted with `.'
-
-examples/functions/autoload.v2
-       - new implementation: uses arrays, keeps a list of autoloaded
-         functions, allows autoloaded functions to be removed, allows
-         autoloaded functions to be listed
-
-execute_cmd.c
-       - when freeing the members of subshell_argv in shell_execve(), free
-         only the members up to subshell_argc
-
-                                  10/9
-                                  ----
-configure.in
-       - replaced calls to AC_HAVE_FUNCS with AC_CHECK_FUNCS
-       - replaced calls to AC_FUNC_CHECK with AC_CHECK_FUNC
-       - replaced calls to AC_HAVE_HEADERS with AC_CHECK_HEADERS
-       - added additional code to check for libintl.{a,so} for the
-         internationalization functions if bindtextdomain is not found
-         in libc
-       - define HAVE_WAIT3 if AC_FUNC_CHECK(wait3,...) succeeds, rather
-         than HAVE_FUNC_WAIT3, which is not used in the source
-       - added a call to AC_FUNC_STRCOLL to check for the presence of a
-         working strcoll(3)
-
-config.h.in
-       - removed HAVE_FUNC_WAIT3
-       - added HAVE_STRCOLL
-
-variables.c, stringlib.c
-       - move sort_char_array from variables.c to stringlib.c
-
-variables.h, externs.h
-       - move extern declaration of sort_char_array from variables.h to
-         externs.h
-
-variables.c
-       - don't sort the exported environment, even when we're not in
-         posix mode
-
-stringlib.c
-       - changed qsort_string_compare to use strcoll(3) if it is available
-         (HAVE_STRCOLL is defined).  This means that the results of glob
-         expansions are now sorted in the per-locale collation order
-
-locale.c
-       - track the value of $LC_COLLATE and call setlocale(LC_COLLATE,...)
-         when it changes.  Also, set its default value
-
-subst.c
-       - LC_COLLATE is now a special variable; call sv_locale when it is
-         assigned to or unset
-
-lib/readline/util.c
-       - move compare_strings here from complete.c; renamed it
-         _rl_qsort_string_compare; made it use strcoll(3) if it's
-         available; made it global so other library files can use it
-
-lib/readline/complete.c
-       - use _rl_qsort_string_compare instead of static compare_strings.
-         This means that completions are now sorted in a locale-specific
-         collation order
-
-lib/readline/funmap.c
-       - removed static declaration of qsort_string_compare; qsort now
-         uses _rl_qsort_string_compare instead
-
-oslib.c
-       - rewrote stricmp, strnicmp; renamed them strcasecmp and
-         strncasecmp, since they're only compiled in if HAVE_STRCASECMP
-         is not defined
-
-externs.h
-       - removed extern declarations of strnicmp, stricmp, replacing them
-         with declarations of strcasecmp and strncasecmp if HAVE_STRCASECMP
-         is not defined; removed #defines of stricmp and strnicmp to
-         strcasecmp and strncasecmp
-
-trap.c
-       - changed calls to stricmp to direct calls to strcasecmp
-
-Makefile.in
-       - bumped RELSTATUS to `beta3'
-
-doc/bash.{1,html}
-       - added mention of LC_COLLATE
-
-doc/bashref.texi
-       - removed item about sorting environment from the section on posix
-         mode
-
-                                  10/16
-                                  -----
-subst.c
-       - fixed array_length_reference to return 0 for an unbound variable
-         and 1 for a variable that is not an array
-
-examples/scripts.v2/cdhist.bash
-       - package with functions to replace cd and maintain a cd directory
-         stack
-
-examples/scripts.v2/pmtop
-       - a `poor man's top' for SunOS 4.x and BSD
-
-examples/scripts.v2/bashrand
-       - a script to return a random number within a specified range, with
-         an optional seed
-
-examples/scripts/zprintf
-       - printf(1) replacement that uses gawk to do the output
-
-doc/{bash.{1,html},bashref.texi}, lib/readline/doc/hsuser.texinfo
-       - several small corrections
-
-                                  10/17
-                                  -----
-variables.c
-       - changed the calls to list_string_with_quotes and then
-         expand_words_no_vars in assign_array_var_from_string to a single
-         call to expand_string.  This behaves more rationally, and closer
-         to ksh93
-
-subst.c
-       - commented out list_string_with_quotes -- it is no longer used
-
-lib/readline/terminal.c
-       - new function, _rl_set_screen_size(int rows, int cols), to set
-         readline's idea of the screen size
-
-jobs.c, nojobs.c
-       - make sure that window size changes are propagated back down to
-         the readline code, by calling _rl_set_screen_size with the
-         new sizes.  This happens when bash gets a SIGWINCH or if
-         `checkwinsize' is set with `shopt'
-
-                                  10/18
-                                  -----
-support/config.guess
-       - added code to recognize the various NetBSD ports
-
-lib/readline/signals.c
-       - don't install a handler for SIGALRM if the containing application
-         has installed a handler with SA_RESTART as part of the flags.
-         This is in effect, obviously, only for systems with POSIX signals.
-
-subst.c
-       - make parameter_brace_expand_length expand variables in a double-
-         quoted environment so it takes spaces in the variable value into
-         account
-
-                                  10/21
-                                  -----
-command.h
-       - flags for possible values of subshell_environment telling what
-         caused the subshell
-
-builtins/command.def
-       - the `command' builtin should not be setting CMD_NO_FORK at all;
-         it doesn't know enough about the execution context to do so
-
-execute_cmd.c, subst.c
-       - set subshell_environment to one of the values in command.h rather
-         than to `1', so we know what kind of subshell it is (just for
-         informational purposes; nothing actually uses this yet)
-
-
-                                  10/22
-                                  -----
-execute_cmd.c
-       - just return EXECUTION_SUCCESS immediately in execute_command_internal
-         if read_but_dont_execute is set
-
-                                  10/23
-                                  -----
-general.c
-       - fixed check_dev_tty to return immediately if ttyname() returns NULL
-
-builtins/suspend.def
-       - SIGSTOP cannot be caught, so there's no reason to try to do so
-
-examples/loadables/{finfo,pathchk,print}.c
-       - minor fixes
-
-pathexp.c
-       - fix to off-by-one error in setup_ignore_patterns
-
-jobs.c
-       - try to set the tty pgrp to our pgrp if we change our pgrp to our
-         pid and become a process group leader.  If it doesn't work,
-         reset our pgrp to what it was originally and disable job control
-
-aclocal.m4
-       - new test, BASH_STRUCT_TERMIO_LDISC, to test for a c_line member
-         of struct termio
-
-config.h.in
-       - add a new preprocessor variable, TERMIO_LDISC, undefined by default
-
-configure.in
-       - call BASH_STRUCT_TERMIO_LDISC after BASH_STRUCT_TERMIOS_LDISC
-
-                                  10/25
-                                  -----
-lib/readline/terminal.c
-       - increased the size of the termcap buffers to 4096
-
-                                  10/29
-                                  -----
-parse.y
-       - include memalloc.h for uses of alloca that the code in the
-         generated bison parser does not catch (e.g., HP-UX 10.10)
-
-aclocal.m4
-       - new test, BASH_KERNEL_RLIMIT_CHECK, to check whether a given
-         HP-UX machine needs _KERNEL defined for the RLIMIT_* defines in
-         <sys/resource.h> (9.05, 10.01 yes, 10.10,10.20 no)
-
-configure.in
-       - call BASH_KERNEL_RLIMIT_CHECK if $host_os begins with `hpux'
-
-config.h.in
-       - new #undef for RLIMIT_NEEDS_KERNEL
-
-builtins/ulimit.def
-       - only define _KERNEL before including <sys/resource.h> if HPUX
-         and RLIMIT_NEEDS_KERNEL are both defined
-
-[bash-2.0-beta3 frozen]
-
-                                  11/1
-                                  ----
-locale.c
-       - if setting LC_ALL to a null value (as is done when `unset LC_ALL'
-         is run), call setlocale() to set LC_ALL back to default_locale
-
-lib/readline/readline.c
-       - moved i18n code from here to nls.c
-
-lib/readline/Makefile.in, Makefile.in
-       - new readline library member, nls.c
-
-lib/readline/nls.c
-       - new file, with internationalization code from readline.c (such as
-         it is)
-       - updated legal_lang_values to just contain a list of codesets
-       - added code modified from a diff sent by Ulrich Drepper
-         <drepper@cygnus.com> to parse a locale specification and isolate
-         and normalize the codeset part, for checking against the values
-         in legal_lang_values
-
-                                  11/4
-                                  ----
-builtins/setattr.def, locale.c, aclocal.m4, oslib.c
-       - minor cleanups
-
-                                  11/5
-                                  ----
-lib/readline/complete.c, test.c, trap.c
-       - more minor cleanups
-
-                                  11/6
-                                  ----
-parse.y
-       - added a `flags' parameter to parse_matched_pair, currently unused
-
-                                  11/7
-                                  ----
-configure.in, config.h.in
-       - add a check for time_t, defaulting to `long' if it's not
-         defined in <sys/types.h>
-
-builtins/fc.def
-       - use `time_t *' instead of `long *' in call to time()
-
-                                  11/8
-                                  ----
-configure.in
-       - removed check for getpwent in libsun.a; it's not necessary for
-         recent versions of irix (irix[56].?)
-
-                                  11/11
-                                  -----
-test.c
-       - used `&&' where `||' was needed when testing if HAVE_LSTAT and
-         S_IFLNK are both defined
-
-[bash-2.0-beta3 net release version frozen]
-
-                                  11/12
-                                  -----
-builtins/getopt.c
-       - when sh_getopt detects that a required argument is not present,
-         set sh_optarg to "" so that getopts does the right thing
-
-                                  11/15
-                                  -----
-builtins/ulimit.c
-       - made the default (without -H or -S) report the soft limit and set
-         both soft and hard limits (like sh and ksh)
-
-expr.c
-       - changed the maximum base in base#num constants to 64, implemented
-         just like ksh93
-
-doc/{bash.{1,html},bashref.texi}
-       - updated description of ulimit builtin to new behavior when
-         neither -H nor -S is supplied
-       - updated arithmetic evaluation section with new maximum base and
-         explanation of how numbers between 10 and 63 are represented
-
-lib/readline/vi_mode.c
-       - in rl_vi_done_inserting, don't try to save the text entered while
-         in insert mode unless rl_undo_list is non-null (indicating that
-         there was actually some text to be saved)
-
-                                  11/19
-                                  -----
-lib/readline/tcap.h
-       - new file, for termcap library definitions.  Uses <termcap.h> if
-         it is available
-
-lib/readline/rldefs.h
-       - remove inclusion of termcap.h; now included in tcap.h
-
-lib/readline/{terminal,display,readline}.c
-       - include tcap.h
-
-lib/readline/Makefile.in
-       - update dependencies to include tcap.h
-
-                                  11/21
-                                  -----
-lib/readline/complete.c
-       - broke the code that computes the lcd of the list of completion
-         matches out into a separate function, compute_lcd_of_matches()
-
-lib/readline/complete.c
-       - call compute_lcd_of_matches after calling the application-specific
-         completion ignore function, since it may have eliminated some
-         names from the match list
-
-builtins/cd.def
-       - replaced instances of MAXNAMLEN in the spelling correction code
-         with PATH_MAX
-
-lib/readline/terminal.c
-       - new termcap capabilities: kh (sent by Home key) and kH (sent by
-         End key) automatically bound to beginning-of-line and end-of-line
-         respectively in emacs_standard and vi_movement maps
-
-mailcheck.c
-       - fix to remember_mail_dates so any message following the
-         filename is saved correctly
-
-                                  11/22
-                                  -----
-lib/readline/bind.c
-       - fixed extern declaration of _rl_parsing_coditionalized_out
-         to match declaration in readline.c
-
-                                  11/25
-                                  -----
-doc/{bash.{1,html},bashref.texi}
-       - fixed a gross documentation error in the description of
-         ${parameter:offset:length} (offset and length were transposed)
-       - slight changes to the description of output redirection
-
-subst.c
-       - new function, quoted_substring, to return substrings of variables
-         when the expression is within double quotes and the value has
-         CTLESC characters embedded within it.  Called by
-         parameter_brace_substring
-       - get_var_and_type should return VT_POSPARMS if `*' is passed as
-         the variable name
-       - added a new first parameter for pos_params -- the variable name
-       - changed pos_params to obey the rules for "$*" wrt using the
-         first character of IFS as the separator in the result
-       - if an unquoted $* or $@ is expanded, call quote_escapes on the
-         result to protect any special characters from inadvertently
-         causing quoting
-
-                                  12/3
-                                  ----
-builtins/ulimit.def
-       - corrected a misspelling of `unlimited'
-       - added support for linux RLIMIT_AS resource limit for -v option
-         and changed the block multiplier to 1024 if we have RLIMIT_VMEM
-         or RLIMIT_AS
-
-                                  12/5
-                                  ----
-lib/readline/readline.c
-       - fix rl_insert to handle a count of exactly 1024
-
-shell.c
-       - new function: unbind_args(), which removes all the positional
-         parameters.  Just calls remember_args(NULL, 1)
-
-execute_cmd.c
-       - call unbind_args when executing a subshell, after setting up
-         subshell_argX
-
-bashintl.h
-       - include <libintl.h> if HAVE_LIBINTL_H defined
-
-config.h.in
-       - add HAVE_LIBINTL_H define
-
-configure.in
-       - add call to AC_CHECK_HEADERS for libintl.h
-
-doc/Makefile.in
-       - added infodir and various mandir defines for completeness
-
-Makefile.in
-       - changed some of the *dir defines to use the autoconf values
-         (e.g., bindir = @bindir@)
-       - changed manroot to mandir, removed old mandir and manext variables
-       - added `manpfx' variable; should be either `man' or `cat'
-
-                                  12/6
-                                  ----
-lib/readline/readline.c
-       - fixed rl_digit_loop so it once again displays the argument count
-         as it's being entered (added calls to _rl_save_prompt and
-         _rl_restore_prompt)
-
-                                  12/7
-                                  ----
-support/config.guess
-       - recognize netbsd/vax
-       - recognize openbsd on all supported platforms
-       - recognize tenon's machten running on powerpc and macintosh
-
-                                  12/9
-                                  ----
-support/config.guess
-       - added all sorts of systems from config.guess distributed with
-         autoconf-2.12
-
-                                  12/10
-                                  -----
-subst.c
-       - new function quoted_strchr(); does the same thing as strchr but
-         honors shell backslash and CTLESC quoting conventions
-       - parameter_brace_patsub now calls quoted_strchr
-
-                                  12/11
-                                  -----
-shell.c
-       - if the shell is named `-su', run the normal login shell startup
-         files, even if the shell is not interactive.  This handles the
-         case of `su - username -c command' compatibly
-
-lib/readline/readline.c
-       - minor change to rl_digit_loop so that M-- and M--1 are equivalent,
-         as the prompt for digit arguments has always implied
-
-lib/malloc/malloc.c
-       - added definitions of calloc() and cfree(), compiled in unless
-         NO_CALLOC is defined to cpp
-
-
-                                  12/16
-                                  -----
-parse.y
-       - protect uses of history_expansion_inhibited with #ifdef
-         BANG_HISTORY
-
-[bash-2.0-release candidate frozen]
-
-builtins/common.c
-       - changed backslash_quote to quote a tilde if it's the first
-         character in the string
-
-                                  12/17
-                                  -----
-aclocal.m4
-       - changed BASH_CC_WORKS to provide a cross-compiling default for
-         better error messages
-
-configure.in
-       - generated configure using autoconf-2.12
-       - changed the default value of CFLAGS to `-g -O2'
-
-                                  12/18
-                                  -----
-aclocal.m4
-       - look for /var/spool/mail before /usr/spool/mail when checking
-         for the default mail directory
-
-jobs.c, builtins/shopt.def
-       - fixed a couple of `macro replacement within a string literal'
-         problems
-
-Makefile.in
-       - removed `realclean' target
-
-shell.c
-       - changed the first line ouput by bash --version to conform to
-         the latest GNU coding standards (replace space between version
-         and machtype with a hyphen)
-
-                                  12/19
-                                  -----
 execute_cmd.c
-       - when looking at the debug trap in execute_function and
-         execute_command_internal, make sure it's trapped and not
-         ignored before trying to save the value of the trap string
-
-                                  12/20
-                                  -----
-trap.c
-       - changed set_signal and ignore_signal to handle EXIT_TRAP and
-         DEBUG_TRAP specially, so we don't try to fetch signal handlers
-         or do other unnecessary things
-
-                                  12/22
-                                  -----
-builtins/ulimit.def
-       - if the current euid is not 0, and we're trying to set the hard
-         limit of a resource to RLIM_INFINITY, set it to the current hard
-         limit to avoid error messages
+       - since find_hashed_filename returns newly-allocated memory, don't
+         call savestring() on it, and free it if the data is stale (in
+         search_for_command()).  Another memory leak fixed courtesy of
+         a.pfaller@pop.gun.de
 
-builtins/read.def
-       - fix for bug that caused core dump if line read had leading white
-         space and IFS was set to ''
+builtins/type.def
+       - free the value returned by find_hashed_filename
 
-[bash-2.0-release frozen]
+[bash-2.01-release frozen]
diff --git a/INSTALL b/INSTALL
index a4e702e..8df7216 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -1,7 +1,7 @@
 Basic Installation
 ==================
 
-These are generic installation instructions for Bash.
+These are installation instructions for Bash.
 
 The `configure' shell script attempts to guess correct values for
 various system-dependent variables used during compilation.  It uses
@@ -24,7 +24,15 @@ they can be considered for the next release.
 The file `configure.in' is used to create `configure' by a program
 called Autoconf.  You only need `configure.in' if you want to change it
 or regenerate `configure' using a newer version of Autoconf.  If you do
-this, make sure you are using Autoconf version 2.9 or newer.
+this, make sure you are using Autoconf version 2.10 or newer.
+
+If you need to change `configure.in' or regenerate `configure', you
+will need to create two files: `_distribution' and `_patchlevel'.
+`_distribution' should contain the major and minor version numbers of
+the Bash distribution, for example `2.01'.  `_patchlevel' should
+contain the patch level of the Bash distribution, `0' for example.  The
+script `support/mkconffiles' has been provided to automate the creation
+of these files.
 
 The simplest way to compile Bash is:
 
@@ -179,21 +187,27 @@ configure Bash without a feature that is enabled by default, use
 Here is a complete list of the `--enable-' and `--with-' options that
 the Bash `configure' recognizes.
 
-`--with-gnu-malloc'
-     Use the GNU version of `malloc' in `lib/malloc/malloc.c'.  This is
-     not the same `malloc' that appears in GNU libc, but an older
-     version derived from the 4.2 BSD `malloc'.  This `malloc' is very
-     fast, but wastes a lot of space.  This option is enabled by
-     default.  The `NOTES' file contains a list of systems for which
-     this should be turned off.
+`--with-afs'
+     Define if you are using the Andrew File System from Transarc.
+
+`--with-curses'
+     Use the curses library instead of the termcap library.  This should
+     be supplied if your system has an inadequate or incomplete termcap
+     database.
 
 `--with-glibc-malloc'
      Use the GNU libc version of `malloc' in `lib/malloc/gmalloc.c'.
      This is somewhat slower than the default `malloc', but wastes
      considerably less space.
 
-`--with-afs'
-     Define if you are using the Andrew File System from Transarc.
+`--with-gnu-malloc'
+     Use the GNU version of `malloc' in `lib/malloc/malloc.c'.  This is
+     not the same `malloc' that appears in GNU libc, but an older
+     version derived from the 4.2 BSD `malloc'.  This `malloc' is very
+     fast, but wastes a lot of space.  This option is enabled by
+     default.  The `NOTES' file contains a list of systems for which
+     this should be turned off, and `configure' disables this option
+     automatically for a number of systems.
 
 `--with-purify'
      Define this to use the Purify memory allocation checker from Pure
@@ -211,32 +225,48 @@ All of the following options except for `disabled-builtins' and
 `usg-echo-default' are enabled by default, unless the operating system
 does not provide the necessary support.
 
-`--enable-job-control'
-     This enables job control features, if the OS supports them.
-
 `--enable-alias'
      Allow alias expansion and include the `alias' and `unalias'
      builtins.
 
-`--enable-readline'
-     Include support for command-line editing and history with the Bash
-     version of the Readline library.
-
-`--enable-history'
-     Include command history and the `fc' and `history' builtin
-     commands.
+`--enable-array-variables'
+     Include support for one-dimensional array shell variables.
 
 `--enable-bang-history'
      Include support for `csh'-like history substitution.
 
+`--enable-brace-expansion'
+     Include `csh'-like brace expansion ( `b{a,b}c' ==> `bac bbc' ).
+
+`--enable-command-timing'
+     Include support for recognizing `time' as a reserved word and for
+     displaying timing statistics for the pipeline following `time'.
+     This allows pipelines as well as shell builtins and functions to
+     be timed.
+
 `--enable-directory-stack'
      Include support for a `csh'-like directory stack and the `pushd',
      `popd', and `dirs' builtins.
 
-`--enable-restricted'
-     Include support for a "restricted shell".  If this is enabled,
-     Bash, when called as `rbash', enters a restricted mode.  See *Note
-     The Restricted Shell::, for a description of restricted mode.
+`--enable-disabled-builtins'
+     Allow builtin commands to be invoked via `builtin xxx' even after
+     `xxx' has been disabled using `enable -n xxx'.  See *Note Bash
+     Builtins::, for details of the `builtin' and `enable' builtin
+     commands.
+
+`--enable-dparen-arithmetic'
+     Include support for the `ksh' `((...))' command.
+
+`--enable-help-builtin'
+     Include the `help' builtin, which displays help on shell builtins
+     and variables.
+
+`--enable-history'
+     Include command history and the `fc' and `history' builtin
+     commands.
+
+`--enable-job-control'
+     This enables job control features, if the OS supports them.
 
 `--enable-process-substitution'
      This enables process substitution (*note Process Substitution::.)
@@ -247,35 +277,19 @@ does not provide the necessary support.
      characters in the `$PS1', `$PS2', `$PS3', and `$PS4' prompt
      strings.
 
+`--enable-readline'
+     Include support for command-line editing and history with the Bash
+     version of the Readline library.
+
+`--enable-restricted'
+     Include support for a "restricted shell".  If this is enabled,
+     Bash, when called as `rbash', enters a restricted mode.  See *Note
+     The Restricted Shell::, for a description of restricted mode.
+
 `--enable-select'
      Include the `ksh' `select' builtin, which allows the generation of
      simple menus.
 
-`--enable-help-builtin'
-     Include the `help' builtin, which displays help on shell builtins
-     and variables.
-
-`--enable-array-variables'
-     Include support for one-dimensional array shell variables.
-
-`--enable-dparen-arithmetic'
-     Include support for the `ksh' `((...))' command.
-
-`--enable-brace-expansion'
-     Include `csh'-like brace expansion ( `b{a,b}c' ==> `bac bbc' ).
-
-`--enable-disabled-builtins'
-     Allow builtin commands to be invoked via `builtin xxx' even after
-     `xxx' has been disabled using `enable -n xxx'.  See *Note Bash
-     Builtins::, for details of the `builtin' and `enable' builtin
-     commands.
-
-`--enable-command-timing'
-     Include support for recognizing `time' as a reserved word and for
-     displaying timing statistics for the pipeline following `time'.
-     This allows pipelines as well as shell builtins and functions to
-     be timed.
-
 `--enable-usg-echo-default'
      Make the `echo' builtin expand backslash-escaped characters by
      default, without requiring the `-e' option.  This makes the Bash
index 7110038..95db0db 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -40,6 +40,7 @@ MANIFEST      f
 NEWS           f
 NOTES          f
 README         f
+AUTHORS                f
 configure.in   f
 configure      f
 Makefile.in    f
@@ -62,6 +63,7 @@ unwind_prot.c f
 dispose_cmd.c  f
 getcwd.c       f
 bashhist.c     f
+hashcmd.c      f
 hashlib.c      f
 parse.y                f
 pathexp.c      f
@@ -112,10 +114,10 @@ externs.h f
 siglist.h      f
 subst.h                f
 dispose_cmd.h  f
+hashcmd.h      f
 bashansi.h     f
 bashtty.h      f
 bashjmp.h      f
-bashwait.h     f
 bashintl.h     f
 make_cmd.h     f
 execute_cmd.h  f
@@ -125,7 +127,10 @@ pathnames.h        f
 y.tab.c                f
 y.tab.h                f
 posixdir.h     f
+posixjmp.h     f
 posixstat.h    f
+posixwait.h    f
+unionwait.h    f
 stdc.h         f
 ansi_stdlib.h  f
 memalloc.h     f
@@ -154,7 +159,6 @@ builtins/getopt.c   f
 builtins/getopt.h      f
 builtins/getopts.def   f
 builtins/hash.def      f
-builtins/hashcom.h     f
 builtins/help.def      f
 builtins/let.def       f
 builtins/history.def   f
@@ -203,6 +207,7 @@ lib/malloc/stub.c   f
 lib/malloc/i386-alloca.s       f
 lib/malloc/x386-alloca.s       f
 lib/posixheaders/posixdir.h    f
+lib/posixheaders/posixjmp.h    f
 lib/posixheaders/posixstat.h   f
 lib/posixheaders/ansi_stdlib.h f
 lib/posixheaders/stdc.h        f
@@ -240,6 +245,7 @@ lib/readline/macro.c        f
 lib/readline/input.c   f
 lib/readline/callback.c        f
 lib/readline/nls.c     f
+lib/readline/shell.c   f
 lib/readline/tilde.c   f
 lib/readline/tilde.h   f
 lib/readline/rldefs.h  f
@@ -252,6 +258,7 @@ lib/readline/history.h      f
 lib/readline/histlib.h f
 lib/readline/chardefs.h        f
 lib/readline/posixdir.h        f
+lib/readline/posixjmp.h        f
 lib/readline/posixstat.h       f
 lib/readline/ansi_stdlib.h     f
 lib/readline/doc/Makefile      f
@@ -266,6 +273,7 @@ lib/readline/examples/fileman.c     f
 lib/readline/examples/manexamp.c       f
 lib/readline/examples/histexamp.c      f
 lib/readline/examples/rltest.c f
+lib/readline/examples/rl.c     f
 lib/readline/examples/Inputrc  f
 lib/termcap/Makefile.in        f
 lib/termcap/termcap.c  f
@@ -318,11 +326,13 @@ doc/builtins.1    f
 doc/article.ms f
 support/config.guess   f
 support/config.sub     f
-support/printenv       f       755
+support/printenv.sh    f       755
+support/printenv.c     f
 support/bash.xbm       f
 support/mkclone                f       755
+support/mkconffiles    f       755
 support/mkdirs         f       755
-support/mkversion.c    f
+support/mkversion.sh   f       755
 support/mksignames.c   f
 support/bashbug.sh     f
 support/recho.c                f
@@ -332,6 +342,7 @@ support/fixlinks    f       755
 support/install.sh     f       755
 support/texi2dvi       f
 support/texi2html      f
+support/xenix-link.sh  f       755
 examples/bashdb/PERMISSION     f
 examples/bashdb/README f
 examples/bashdb/bashdb f
@@ -386,6 +397,7 @@ examples/functions/seq              f
 examples/functions/mhfold      f
 examples/functions/repeat2     f
 examples/functions/lowercase   f
+examples/functions/xalias.bash f
 examples/scripts/shprompt      f
 examples/scripts/adventure.sh  f
 examples/scripts/precedence    f
@@ -393,7 +405,9 @@ examples/scripts/bcsh.sh    f
 examples/scripts/inpath                f
 examples/scripts/nohup.bash    f
 examples/scripts/vtree2                f
+examples/scripts/vtree3                f
 examples/scripts/scrollbar     f
+examples/scripts/spin.bash     f
 examples/scripts/zprintf       f
 examples/startup-files/README  f
 examples/startup-files/Bashrc  f
@@ -412,15 +426,48 @@ tests/array.tests f
 tests/array.right      f
 tests/braces-tests     f
 tests/braces.right     f
+tests/builtins.tests   f
+tests/builtins.right   f
+tests/builtins.sub1    f
+tests/source.sub1      f
+tests/source.sub2      f
+tests/source.sub3      f
+tests/source.sub4      f
+tests/dirstack.tests   f
+tests/dirstack.right   f
 tests/dollar-at.sh     f
 tests/dollar-star.sh   f
 tests/dollar.right     f
+tests/errors.tests     f
+tests/errors.right     f
+tests/execscript       f
+tests/execscript.right f
+tests/execscript.sub   f       755
+tests/execscript.sub2  f
+tests/execscript.sub3  f
+tests/execscript.sub4  f
 tests/exp-tests                f
 tests/exp.right                f
+tests/func.tests       f
+tests/func.right       f
+tests/getopts.tests    f
+tests/getopts.right    f
+tests/getopts.sub1     f
+tests/getopts.sub2     f
+tests/getopts.sub3     f
+tests/getopts.sub4     f
+tests/getopts.sub5     f
+tests/getopts.sub6     f
+tests/getopts.sub7     f
 tests/glob-test                f
 tests/glob.right       f
 tests/heredoc.tests    f
 tests/heredoc.right    f
+tests/histexpand.tests f
+tests/histexpand.right f
+tests/history.tests    f
+tests/history.right    f
+tests/history.list     f
 tests/ifs-test-1.sh    f
 tests/ifs-test-2.sh    f
 tests/ifs-test-3.sh    f
@@ -430,11 +477,12 @@ tests/ifs.3.right f
 tests/input-line.sh    f
 tests/input-line.sub   f
 tests/input.right      f
-tests/minus-e          f
-tests/minus-e.right    f
+tests/jobs.tests       f
+tests/jobs.right       f
 tests/more-exp.tests   f
 tests/more-exp.right   f
 tests/new-exp.tests    f
+tests/new-exp.sub1     f
 tests/new-exp.right    f
 tests/nquote.tests     f
 tests/nquote.right     f
@@ -446,19 +494,39 @@ tests/quote.tests f
 tests/quote.right      f
 tests/read.tests       f
 tests/read.right       f
+tests/redir.tests      f
+tests/redir.right      f
+tests/redir1.sub       f
+tests/redir2.sub       f
+tests/redir3.sub       f
+tests/redir3.in1       f
+tests/redir3.in2       f
+tests/redir4.sub       f
+tests/redir4.in1       f
 tests/rhs-exp.tests    f
 tests/rhs-exp.right    f
+tests/rsh.tests                f
+tests/rsh.right                f
 tests/run-all          f
+tests/run-minimal      f
 tests/run-arith                f
 tests/run-array                f
 tests/run-braces       f
+tests/run-builtins     f
+tests/run-dirstack     f
 tests/run-dollars      f
+tests/run-errors       f
+tests/run-execscript   f
 tests/run-exp-tests    f
+tests/run-func         f
+tests/run-getopts      f
 tests/run-glob-test    f
 tests/run-heredoc      f
+tests/run-histexpand   f
+tests/run-history      f
 tests/run-ifs-tests    f
 tests/run-input-test   f
-tests/run-minus-e      f
+tests/run-jobs         f
 tests/run-more-exp     f
 tests/run-new-exp      f
 tests/run-nquote       f
@@ -466,11 +534,15 @@ tests/run-posix2  f
 tests/run-precedence   f
 tests/run-quote                f
 tests/run-read         f
+tests/run-redir                f
 tests/run-rhs-exp      f
+tests/run-rsh          f
 tests/run-set-e-test   f
 tests/run-strip                f
 tests/run-test         f
 tests/run-tilde                f
+tests/run-trap         f
+tests/run-type         f
 tests/run-varenv       f
 tests/set-e-test       f
 tests/set-e.right      f
@@ -480,21 +552,19 @@ tests/test-tests  f
 tests/test.right       f
 tests/tilde-tests      f
 tests/tilde.right      f
+tests/trap.tests       f
+tests/trap.right       f
+tests/trap.sub1                f       755
+tests/type.tests       f
+tests/type.right       f
 tests/varenv.right     f
 tests/varenv.sh                f
-tests/misc/chld-trap.sh        f
-tests/misc/dot-test-1.sh       f
-tests/misc/dot-test-1.sub      f
-tests/misc/gotest              f
+tests/version          f
+tests/version.mini     f
+tests/misc/haertel.perftest    f
 tests/misc/perf-script         f
-tests/misc/redir.t1.sh         f
 tests/misc/redir.t2.sh         f
-tests/misc/redir.t3.sh         f
-tests/misc/redir.t3.sub                f
-tests/misc/redir.t4.sh         f
-tests/misc/run.r1.sh   f
 tests/misc/run.r2.sh   f
-tests/misc/run.r3.sh   f
 tests/misc/sigint.t1.sh                f
 tests/misc/sigint.t2.sh                f
 tests/misc/sigint.t3.sh                f
index 3f15866..86596f5 100644 (file)
@@ -1,3 +1,5 @@
+# Makefile for bash-2.01, version 2.32
+#
 # Make sure the first target in the makefile is the right one
 all: .made
 
@@ -39,6 +41,8 @@ INSTALL_DATA = @INSTALL_DATA@
 COMPRESS = gzip
 COMPRESS_EXT = .gz
 
+TESTSCRIPT = @TESTSCRIPT@
+
 #If you have purify, and want to use it, uncomment this definition or
 # run the make as `make PURIFY=purify'
 # or run configure with the --with-purify argument.
@@ -50,31 +54,29 @@ PURIFY = @PURIFY@
        $(RM) $@
        $(CC) $(CCFLAGS) -c $<
 
-# The name of this program.
+# The name of this program and some version information.
 Program = bash
+Version = @BASHVERS@
+PatchLevel = @BASHPATCH@
+RELSTATUS = release
+
 Machine = @host_cpu@
 OS = @host_os@
 MACHTYPE = @host@
 
-RELSTATUS = release
-
 THIS_SH = $(BUILD_DIR)/$(Program)
 
 # PROFILE_FLAGS is either -pg, to generate profiling info for use
 # with gprof, or nothing (the default).
 PROFILE_FLAGS=
 
-# set to alloca.o if we are using the C alloca in lib/malloc
-ALLOCA = @ALLOCA@
-ALLOCA_SOURCE = @ALLOCA_SOURCE@
-ALLOCA_OBJECT = @ALLOCA_OBJECT@
-
 # The GNU coding standards don't recognize the possibility that
 # other information besides optimization and debugging might be
 # passed to cc.  A different name should have been used.
 CFLAGS = @CFLAGS@
 LOCAL_CFLAGS = @LOCAL_CFLAGS@
 DEFS = @DEFS@
+LOCAL_DEFS = @LOCAL_DEFS@
 LOCAL_LIBS = @LOCAL_LIBS@
 LIBS = $(BUILTINS_LIB) $(LIBRARIES) $(LOCAL_LIBS) @LIBS@
 LDFLAGS = @LDFLAGS@ $(LOCAL_LDFLAGS) $(PROFILE_FLAGS) $(CFLAGS)
@@ -82,7 +84,7 @@ LOCAL_LDFLAGS = @LOCAL_LDFLAGS@
 
 SYSTEM_FLAGS = -DPROGRAM='"$(Program)"' -DHOSTTYPE='"$(Machine)"' -DOSTYPE='"$(OS)"' -DMACHTYPE='"$(MACHTYPE)"'
 
-CCFLAGS        = $(PROFILE_FLAGS) $(SYSTEM_FLAGS) -DSHELL \
+CCFLAGS        = $(PROFILE_FLAGS) $(SYSTEM_FLAGS) $(LOCAL_DEFS) \
          $(DEFS) $(LOCAL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(CFLAGS)
 
 INCLUDES = -I. -I$(srcdir) -I$(LIBSRC)
@@ -132,6 +134,7 @@ READLINE_SOURCE     = $(RL_LIBSRC)/rldefs.h $(RL_LIBSRC)/rlconf.h \
                  $(RL_LIBSRC)/undo.c $(RL_LIBSRC)/macro.c \
                  $(RL_LIBSRC)/terminal.c $(RL_LIBSRC)/nls.c \
                  $(RL_LIBSRC)/input.c $(RL_LIBSRC)/xmalloc.c \
+                 $(RL_LIBSRC)/shell.c \
                  $(RL_LIBSRC)/histexpand.c $(RL_LIBSRC)/history.c \
                  $(RL_LIBSRC)/histsearch.c $(RL_LIBSRC)/histfile.c
 
@@ -145,6 +148,7 @@ READLINE_OBJ        = $(RL_LIBDIR)/readline.o $(RL_LIBDIR)/funmap.o \
                  $(RL_LIBDIR)/kill.o $(RL_LIBDIR)/undo.o $(RL_LIBDIR)/nls.o \
                  $(RL_LIBDIR)/macro.o $(RL_LIBDIR)/input.o \
                  $(RL_LIBDIR)/terminal.o $(RL_LIBDIR)/callback.o \
+                 $(RL_LIBDIR)/shell.o \
                  $(RL_LIBDIR)/history.o $(RL_LIBDIR)/histexpand.o \
                  $(RL_LIBDIR)/histsearch.o $(RL_LIBDIR)/histfile.o
 
@@ -160,9 +164,11 @@ HISTORY_DEP = @HISTORY_DEP@
 # The source, object and documentation of the history library.
 HISTORY_SOURCE = $(HIST_LIBSRC)/history.c $(HIST_LIBSRC)/histexpand.c \
                  $(HIST_LIBSRC)/histsearch.c $(HIST_LIBSRC)/histfile.c \
+                 $(HIST_LIBSRC)/shell.c \
                  $(HIST_LIBSRC)/history.h $(HIST_LIBSRC)/histlib.h
 HISTORY_OBJ    = $(HIST_LIBDIR)/history.o $(HIST_LIBDIR)/histexpand.o \
-                 $(HIST_LIBDIR)/histsearch.o $(HIST_LIBDIR)/histfile.o
+                 $(HIST_LIBDIR)/histsearch.o $(HIST_LIBDIR)/histfile.o \
+                 $(HIST_LIBDIR)/shell.o
 
 # You only need termcap (or curses) if you are linking with GNU Readline.
 TERM_LIBSRC = $(LIBSRC)/termcap
@@ -204,15 +210,18 @@ TILDE_SOURCE      = $(TILDE_LIBSRC)/tilde.c $(TILDE_LIBSRC)/tilde.h
 TILDE_OBJ      = $(TILDE_LIBDIR)/tilde.o
 
 # Our malloc.
+MALLOC_TARGET = @MALLOC_TARGET@
+
+# set to alloca.o if we are using the C alloca in lib/malloc
+ALLOCA = @ALLOCA@
+
 ALLOC_LIBSRC = $(LIBSRC)/malloc
 ALLOC_LIBDIR = $(dot)/$(LIBSUBDIR)/malloc
 ALLOC_ABSSRC = ${topdir}/$(ALLOC_LIBDIR)
 
-ALLOCA_DEP = $(ALLOC_LIBDIR)/@ALLOCA@
-
-MALLOC_OBJ = $(ALLOC_LIBDIR)/@MALLOC@
 MALLOC_SRC = @MALLOC_SRC@
-MALLOC_CFLAGS = -Drcheck -Dbotch=programming_error
+MALLOC_SOURCE = ${ALLOC_LIBSRC}/${MALLOC_SRC}
+MALLOC_CFLAGS = -DRCHECK -Dbotch=programming_error
 
 MALLOC_LIB     = -lmalloc
 MALLOC_LIBRARY = $(ALLOC_LIBDIR)/libmalloc.a
@@ -221,11 +230,10 @@ MALLOC_DEP = $(MALLOC_LIBRARY)
 
 ALLOC_HEADERS = $(ALLOC_LIBSRC)/getpagesize.h
 
-$(MALLOC_LIBRARY): $(MALLOC_SRC)
-               @$(RM) $@
+$(MALLOC_LIBRARY):     ${MALLOC_SOURCE}
                @(cd $(ALLOC_LIBDIR) && \
                 $(MAKE) $(MFLAGS) \
-                MALLOC_CFLAGS="$(MALLOC_CFLAGS)" libmalloc.a ) || exit 1
+                MALLOC_CFLAGS="$(MALLOC_CFLAGS)" ${MALLOC_TARGET} ) || exit 1
 
 BASHPOSIX_LIB     = $(LIBSRC)/posixheaders
 BASHPOSIX_SUPPORT = $(BASHPOSIX_LIB)/posixstat.h $(BASHPOSIX_LIB)/ansi_stdlib.h \
@@ -247,18 +255,20 @@ LIBRARY_LDFLAGS = $(READLINE_LDFLAGS) $(HISTORY_LDFLAGS) $(TILDE_LDFLAGS) \
 # The main source code for the Bourne Again SHell.
 CSOURCES = shell.c eval.c parse.y general.c make_cmd.c print_cmd.c y.tab.c \
           dispose_cmd.c execute_cmd.c variables.c $(GLOBC) version.c \
-          expr.c copy_cmd.c flags.c subst.c hashlib.c mailcheck.c \
-          test.c trap.c jobs.c nojobs.c $(ALLOC_FILES) braces.c \
+          expr.c copy_cmd.c flags.c subst.c hashcmd.c hashlib.c mailcheck.c \
+          test.c trap.c alias.c jobs.c nojobs.c $(ALLOC_FILES) braces.c \
           vprint.c input.c bashhist.c array.c sig.c pathexp.c oslib.c \
-          unwind_prot.c siglist.c getcwd.c $(RL_SUPPORT_SRC) error.c \
+          unwind_prot.c siglist.c getcwd.c bashline.c bracecomp.c error.c \
           list.c stringlib.c locale.c xmalloc.c
 
-HSOURCES = shell.h flags.h trap.h hashlib.h jobs.h builtins.h alias.c y.tab.h \
+HSOURCES = shell.h flags.h trap.h hashcmd.h hashlib.h jobs.h builtins.h \
           general.h variables.h config.h $(ALLOC_HEADERS) alias.h maxpath.h \
-          quit.h posixstat.h filecntl.h unwind_prot.h \
+          quit.h posixdir.h posixstat.h filecntl.h unwind_prot.h ansi_stdlib.h \
           command.h input.h error.h bashansi.h dispose_cmd.h make_cmd.h \
           subst.h externs.h siglist.h bashhist.h bashline.h bashtypes.h \
-          array.h sig.h mailcheck.h bashtty.h
+          array.h sig.h mailcheck.h bashtty.h bashintl.h bashjmp.h ${GRAM_H} \
+          posixwait.h execute_cmd.h memalloc.h parser.h pathexp.h pathnames.h \
+          posixjmp.h stdc.h unionwait.h $(BASHPOSIX_SUPPORT)
 
 SOURCES         = $(CSOURCES) $(HSOURCES) $(BUILTIN_DEFS)
 
@@ -268,8 +278,8 @@ JOBS_O = @JOBS_O@
 # Matching object files.
 OBJECTS         = shell.o eval.o y.tab.o general.o make_cmd.o print_cmd.o $(GLOBO) \
           dispose_cmd.o execute_cmd.o variables.o copy_cmd.o error.o \
-          expr.o flags.o $(JOBS_O) subst.o hashlib.o mailcheck.o test.o \
-          trap.o input.o unwind_prot.o pathexp.o sig.o version.o \
+          expr.o flags.o $(JOBS_O) subst.o hashcmd.o hashlib.o mailcheck.o \
+          trap.o input.o unwind_prot.o pathexp.o sig.o test.o version.o \
           alias.o array.o braces.o bracecomp.o bashhist.o bashline.o \
           getcwd.o siglist.o vprint.o oslib.o list.o stringlib.o \
           locale.o xmalloc.o
@@ -296,8 +306,7 @@ BUILTIN_DEFS = $(DEFSRC)/alias.def $(DEFSRC)/bind.def $(DEFSRC)/break.def \
               $(DEFSRC)/pushd.def $(DEFSRC)/shopt.def
 BUILTIN_C_SRC  = $(DEFSRC)/mkbuiltins.c $(DEFSRC)/common.c \
                 $(DEFSRC)/evalstring.c $(DEFSRC)/evalfile.c \
-                $(DEFSRC)/bashgetopt.c $(GETOPT_SOURCE) \
-                $(DEFSRC)/hashcom.h 
+                $(DEFSRC)/bashgetopt.c $(GETOPT_SOURCE)
 BUILTIN_C_OBJ  = $(DEFDIR)/common.o $(DEFDIR)/evalstring.o \
                 $(DEFDIR)/evalfile.o $(DEFDIR)/bashgetopt.o
 BUILTIN_OBJS = $(DEFDIR)/alias.o $(DEFDIR)/bind.o $(DEFDIR)/break.o \
@@ -317,22 +326,23 @@ BUILTIN_OBJS = $(DEFDIR)/alias.o $(DEFDIR)/bind.o $(DEFDIR)/break.o \
 GETOPT_SOURCE   = $(DEFSRC)/getopt.c $(DEFSRC)/getopt.h
 PSIZE_SOURCE   = $(DEFSRC)/psize.sh $(DEFSRC)/psize.c
 
-BUILTINS_LIBRARY = builtins/libbuiltins.a
+BUILTINS_LIBRARY = $(DEFDIR)/libbuiltins.a
 BUILTINS_LIB = -lbuiltins
 BUILTINS_LDFLAGS = -L$(DEFDIR)
 BUILTINS_DEP = $(BUILTINS_LIBRARY)
 
 # Documentation for the shell.
 DOCSRC = $(srcdir)/doc
-DOCDIR = ./doc
+DOCDIR = $(dot)/doc
 
 SIGNAMES_SUPPORT = $(SUPPORT_SRC)mksignames.c
 
 SUPPORT_SRC = $(srcdir)/support/
-SDIR = ./support/
+SDIR = $(dot)/support/
 
-CREATED_SUPPORT = signames.h recho zecho tests/recho tests/zecho \
-                 tests/printenv mksignames mkversion 
+TESTS_SUPPORT = recho zecho printenv
+CREATED_SUPPORT = signames.h recho zecho printenv tests/recho tests/zecho \
+                 tests/printenv mksignames 
 CREATED_CONFIGURE = config.h config.cache config.status config.log \
                    stamp-h
 CREATED_MAKEFILES = Makefile builtins/Makefile doc/Makefile \
@@ -344,32 +354,28 @@ CREATED_MAKEFILES = Makefile builtins/Makefile doc/Makefile \
 .NOEXPORT:
 
 .made: $(Program) bashbug
-       cp .machine .made
+       @echo "$(Program) last made for a $(Machine) running $(OS)" >.made
 
-$(Program):  .build $(OBJECTS) $(BUILTINS_DEP) $(LIBDEP) $(srcdir)/.distribution
+$(Program):  .build $(OBJECTS) $(BUILTINS_DEP) $(LIBDEP)
        $(RM) $@
        $(PURIFY) $(CC) $(LDFLAGS) $(BUILTINS_LDFLAGS) $(LIBRARY_LDFLAGS) -o $(Program) $(OBJECTS) $(LIBS)
        ls -l $(Program)
        size $(Program)
 
-.build:        $(SOURCES) config.h Makefile mkversion version.h .machine
+.build:        $(SOURCES) config.h Makefile version.h
        @echo
        @echo "   ***********************************************************"
        @echo "   *                                                         *"
-       @echo "   * Making Bash-`cat $(srcdir)/.distribution`.`cat $(srcdir)/.patchlevel`-$(RELSTATUS) for a $(Machine) running $(OS)"
+       @echo "   * Making Bash-$(Version).$(PatchLevel)-$(RELSTATUS) for a $(Machine) running $(OS)"
        @echo "   *                                                         *"
        @echo "   ***********************************************************"
        @echo
 
-.machine: $(SOURCES) config.h Makefile mkversion version.h
-       @echo "$(Program) last made for a $(Machine) running $(OS)" >.machine
-
-bashbug: $(SUPPORT_SRC)bashbug.sh mkversion config.h Makefile
-       @sed -e "s:!MACHINE!:$(Machine):" -e "s:!OS!:$(OS):" \
-            -e "s:!CFLAGS!:$(CCFLAGS):" -e "s:!CC!:$(CC):" \
-            -e "s:!RELEASE!:`cat $(srcdir)/.distribution`:" \
-            -e "s:!PATCHLEVEL!:`cat $(srcdir)/.patchlevel`:" \
-            -e "s:!MACHTYPE!:$(MACHTYPE):" -e "s:!RELSTATUS!:$(RELSTATUS):" \
+bashbug: $(SUPPORT_SRC)bashbug.sh config.h Makefile
+       @sed -e "s%!MACHINE!%$(Machine)%" -e "s%!OS!%$(OS)%" \
+            -e "s%!CFLAGS!%$(CCFLAGS)%" -e "s%!CC!%$(CC)%" \
+            -e "s%!RELEASE!%$(Version)%" -e "s%!PATCHLEVEL!%$(PatchLevel)%" \
+            -e "s%!MACHTYPE!%$(MACHTYPE)%" -e "s%!RELSTATUS!%$(RELSTATUS)%" \
             $(SUPPORT_SRC)bashbug.sh > $@
        @chmod a+rx bashbug
 
@@ -378,19 +384,21 @@ strip:    $(Program) .made
        ls -l $(Program)
        size $(Program)
 
-version.h:  $(SOURCES) config.h Makefile mkversion .patchlevel .distribution
-       if ./mkversion -dir $(srcdir) -build -status $(RELSTATUS); then mv -f newversion.h version.h; fi
+version.h:  $(SOURCES) config.h Makefile 
+       if $(SHELL) $(SUPPORT_SRC)mkversion.sh -b -s $(RELSTATUS) -d $(Version) -p $(PatchLevel) -o newversion.h; \
+       then mv newversion.h version.h; fi;
 
 # old rules
-y.tab.o: y.tab.c parser-built
-y.tab.c: parser-built
-y.tab.h: parser-built
-parser-built:  parse.y command.h stdc.h input.h
-       $(RM) $@
-       -if test -f y.tab.h; then mv -f y.tab.h old-y.tab.h; fi
+GRAM_H = parser-built
+y.tab.o: y.tab.c ${GRAM_H} command.h stdc.h input.h
+${GRAM_H}:     y.tab.h
+       @-if test -f y.tab.h ; then \
+               cmp -s $@ y.tab.h 2>/dev/null || cp -p y.tab.h $@; \
+       fi
+y.tab.c y.tab.h: parse.y
+#      -if test -f y.tab.h; then mv -f y.tab.h old-y.tab.h; fi
        $(YACC) -d $(srcdir)/parse.y
-       -if cmp -s old-y.tab.h y.tab.h; then mv old-y.tab.h y.tab.h; fi
-       touch $@
+#      -if cmp -s old-y.tab.h y.tab.h; then mv old-y.tab.h y.tab.h; else cp -p y.tab.h ${GRAM_H}; fi
 
 # experimental new rules - work with GNU make but not BSD (or OSF) make
 #y.tab.o: y.tab.c y.tab.h
@@ -402,7 +410,7 @@ parser-built:       parse.y command.h stdc.h input.h
 $(READLINE_LIBRARY): config.h $(READLINE_SOURCE)
        @echo making $@ in ${RL_LIBDIR}
        @(cd ${RL_LIBDIR} && \
-               $(MAKE) $(MFLAGS) APP_CFLAGS=-DSHELL libreadline.a) || exit 1
+               $(MAKE) $(MFLAGS) libreadline.a) || exit 1
 
 $(HISTORY_LIBRARY): config.h $(HISTORY_SOURCE)
        @echo making $@ in ${HIST_LIBDIR}
@@ -420,8 +428,8 @@ $(TILDE_LIBRARY): config.h $(TILDE_SOURCE)
                $(MAKE) $(MFLAGS) libtilde.a) || exit 1
 
 $(TERMCAP_LIBRARY): config.h ${TERMCAP_SOURCE}
-       @echo making $@ in ${TERMCAP_LIBDIR}    
-       @(cd ${TERMCAP_LIBDIR} && \
+       @echo making $@ in ${TERM_LIBDIR}       
+       @(cd ${TERM_LIBDIR} && \
                $(MAKE) $(MFLAGS) libtermcap.a) || exit 1
 
 mksignames:    $(SUPPORT_SRC)mksignames.c
@@ -435,20 +443,20 @@ $(BUILTINS_LIBRARY): $(BUILTIN_DEFS) $(BUILTIN_C_SRC) config.h memalloc.h
        @(cd $(DEFDIR) && $(MAKE) $(MFLAGS) libbuiltins.a ) || exit 1
 
 # these require special rules to circumvent make builtin rules
-builtins/common.o:     $(BUILTIN_SRCDIR)/common.c
+${DEFDIR}/common.o:    $(BUILTIN_SRCDIR)/common.c
        @(cd $(DEFDIR) && $(MAKE) $(MFLAGS) common.o) || exit 1
 
-builtins/bashgetopt.o: $(BUILTIN_SRCDIR)/bashgetopt.c
+${DEFDIR}/bashgetopt.o:        $(BUILTIN_SRCDIR)/bashgetopt.c
        @(cd $(DEFDIR) && $(MAKE) $(MFLAGS) bashgetopt.o) || exit 1
 
-builtins/builtext.h: $(BUILTIN_DEFS)
+${DEFDIR}/builtext.h: $(BUILTIN_DEFS)
        @(cd $(DEFDIR) && $(MAKE) $(MFLAGS) builtext.h ) || exit 1
 
 # For the justification of the following Makefile rules, see node
 # `Automatic Remaking' in GNU Autoconf documentation.
 
-Makefile     config.status $(srcdir)/Makefile.in
-       CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
+Makefile makefile:     config.status $(srcdir)/Makefile.in
+       CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
 
 Makefiles makefiles:   config.status $(srcdir)/Makefile.in
        @for mf in $(CREATED_MAKEFILES); do \
@@ -467,14 +475,11 @@ config.status:    $(srcdir)/configure
 #$(srcdir)/configure:  $(srcdir)/configure.in $(srcdir)/aclocal.m4
 #      cd $(srcdir) && autoconf
 
-mkversion:     $(SUPPORT_SRC)mkversion.c
-       $(CC) $(CCFLAGS) -I.. -o $@ $(SUPPORT_SRC)mkversion.c
-
-newversion:    mkversion
-       $(RM) .build
-       ./mkversion -dir $(srcdir) -dist
-       mv -f newversion.h version.h
-       $(MAKE) -f $(srcdir)/Makefile $(MFLAGS) srcdir=$(srcdir)
+#newversion:   mkversion
+#      $(RM) .build
+#      ./mkversion -dir $(srcdir) -dist
+#      mv -f newversion.h version.h
+#      $(MAKE) -f $(srcdir)/Makefile $(MFLAGS) srcdir=$(srcdir)
 
 doc documentation:  force
        @(cd $(DOCDIR) ; $(MAKE) $(MFLAGS) )
@@ -519,7 +524,7 @@ uninstall:  .made
 .PHONY: basic-clean clean realclean maintainer-clean distclean mostlyclean
 basic-clean:
        $(RM) $(OBJECTS) $(Program) bashbug
-       $(RM) .build .made .machine version.h
+       $(RM) .build .made version.h
 
 clean: basic-clean
        ( cd $(DOCDIR) && $(MAKE) $(MFLAGS) $@ )
@@ -557,7 +562,7 @@ distclean:  basic-clean
 maintainer-clean:      basic-clean
        @echo This command is intended for maintainers to use.
        @echo It deletes files that may require special tools to rebuild.
-       $(RM) y.tab.c y.tab.h parser-built tags TAGS
+       $(RM) y.tab.c y.tab.h parser-built.h tags TAGS
        ( cd $(DOCDIR) && $(MAKE) $(MFLAGS) $@ )
        ( cd builtins && $(MAKE) $(MFLAGS) $@ )
        -(cd $(RL_LIBDIR) && $(MAKE) $(MFLAGS) $@)
@@ -570,16 +575,19 @@ maintainer-clean: basic-clean
        $(RM) $(CREATED_SUPPORT) Makefile
 
 recho:         $(SUPPORT_SRC)recho.c
-       @$(CC) -o $@ $(SUPPORT_SRC)recho.c
+       @$(CC) $(CCFLAGS) -o $@ $(SUPPORT_SRC)recho.c
 
 zecho:         $(SUPPORT_SRC)zecho.c
-       @$(CC) -o $@ $(SUPPORT_SRC)zecho.c
+       @$(CC) $(CCFLAGS) -o $@ $(SUPPORT_SRC)zecho.c
+
+printenv:              $(SUPPORT_SRC)printenv.c
+       @$(CC) $(CCFLAGS) -o $@ $(SUPPORT_SRC)printenv.c
 
-tests check:           force $(Program) recho zecho
+test tests check:              force $(Program) $(TESTS_SUPPORT)
        @-test -d tests || mkdir tests
-       @cp recho zecho $(SUPPORT_SRC)printenv tests
+       @cp $(TESTS_SUPPORT) tests
        @( cd $(srcdir)/tests && \
-               PATH=$$PATH:$(BUILD_DIR)/tests THIS_SH=$(THIS_SH) sh run-all )
+               PATH=$$PATH:$(BUILD_DIR)/tests THIS_SH=$(THIS_SH) sh ${TESTSCRIPT} )
 
 symlinks:
        $(SHELL) $(SUPPORT_SRC)fixlinks -s $(srcdir)
@@ -587,9 +595,14 @@ symlinks:
 dist:  force
        @echo Bash distributions are created using $(srcdir)/support/mkdist.
        @echo Here is a sample of the necessary commands:
-       @echo $(Program) $(srcdir)/support/mkdist -m $(srcdir)/MANIFEST -s $(srcdir) -r ${Program} `cat $(srcdir)/.distribution`
-       @echo tar cf $(Program)-`cat $(srcdir)/.distribution`.tar ${Program}-`cat $(srcdir)/.distribution`
-       @echo gzip $(Program)-`cat $(srcdir)/.distribution`.tar
+       @echo $(Program) $(srcdir)/support/mkdist -m $(srcdir)/MANIFEST -s $(srcdir) -r ${Program} $(Version)
+       @echo tar cf $(Program)-$(Version).tar ${Program}-$(Version)
+       @echo gzip $(Program)-$(Version).tar
+
+depend:        depends
+
+sdepend: force
+       $(Program) $(SUPPORT_SRC)mkdep -c ${CC} -- ${CCFLAGS} ${CSOURCES}
 
 ############################ DEPENDENCIES ###############################
 
@@ -601,146 +614,238 @@ y.tab.o: config.h.top
 jobs.o: config.h.top
 nojobs.o: config.h.top
 execute_cmd.o: config.h.top
-builtins/break.o: config.h.top
-builtins/common.o: config.h.top
-builtins/echo.o: config.h.top
 variables.o: config.h.top
 builtins/command.o: config.h.top
-
-copy_cmd.o: shell.h bashjmp.h sig.h command.h stdc.h hashlib.h
-copy_cmd.o: general.h variables.h config.h memalloc.h quit.h
-copy_cmd.o: dispose_cmd.h make_cmd.h subst.h externs.h
-dispose_cmd.o: shell.h bashjmp.h sig.h command.h stdc.h
-dispose_cmd.o: general.h variables.h config.h memalloc.h quit.h
-dispose_cmd.o: dispose_cmd.h make_cmd.h subst.h externs.h
-error.o: error.h
-execute_cmd.o: shell.h bashjmp.h sig.h command.h stdc.h y.tab.h posixstat.h
-execute_cmd.o: general.h variables.h config.h memalloc.h quit.h hashlib.h jobs.h
-execute_cmd.o: unwind_prot.h siglist.h builtins/builtext.h config.h flags.h
-execute_cmd.o: dispose_cmd.h make_cmd.h subst.h externs.h bashtypes.h
-execute_cmd.o: pathexp.h
-expr.o: shell.h bashjmp.h sig.h command.h stdc.h hashlib.h
-expr.o: general.h variables.h config.h memalloc.h quit.h
-expr.o: dispose_cmd.h make_cmd.h subst.h externs.h
-flags.o: flags.h stdc.h config.h memalloc.h general.h quit.h
-general.o: shell.h bashjmp.h sig.h command.h stdc.h maxpath.h
-general.o: general.h variables.h config.h memalloc.h quit.h unwind_prot.h
-general.o: dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
-getcwd.o: config.h config.h.bot bashtypes.h maxpath.h posixstat.h
-hashlib.o: shell.h bashjmp.h sig.h command.h stdc.h hashlib.h
-hashlib.o: general.h variables.h config.h memalloc.h quit.h
-hashlib.o: dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
-jobs.o: shell.h bashjmp.h sig.h command.h stdc.h hashlib.h trap.h jobs.h 
-jobs.o: general.h variables.h config.h memalloc.h quit.h bashtty.h siglist.h
-jobs.o: dispose_cmd.h make_cmd.h subst.h externs.h builtins/builtext.h
-jobs.o: unwind_prot.h
-mailcheck.o: posixstat.h maxpath.h variables.h
-mailcheck.o: hashlib.h quit.h mailcheck.h
-make_cmd.o: shell.h bashjmp.h sig.h command.h stdc.h flags.h input.h 
-make_cmd.o: general.h variables.h config.h memalloc.h quit.h bashtypes.h
-make_cmd.o: dispose_cmd.h make_cmd.h subst.h externs.h
-y.tab.o: shell.h bashjmp.h sig.h command.h stdc.h flags.h maxpath.h alias.h
-y.tab.o: general.h variables.h config.h memalloc.h quit.h mailcheck.h parser.h
-y.tab.o: dispose_cmd.h make_cmd.h subst.h externs.h bashtypes.h bashline.h
-y.tab.o: builtins/builtext.h
-print_cmd.o: shell.h bashjmp.h sig.h command.h stdc.h y.tab.h
-print_cmd.o: general.h variables.h config.h memalloc.h quit.h
-print_cmd.o: dispose_cmd.h make_cmd.h subst.h externs.h unwind_prot.h
-shell.o: shell.h bashjmp.h sig.h command.h stdc.h flags.h stdc.h
-shell.o: general.h variables.h config.h memalloc.h quit.h
-shell.o: dispose_cmd.h make_cmd.h subst.h externs.h mailcheck.h
-shell.o: posixstat.h filecntl.h jobs.h input.h
-subst.o: shell.h bashjmp.h sig.h command.h stdc.h flags.h jobs.h siglist.h
-subst.o: general.h variables.h config.h memalloc.h quit.h bashtypes.h
-subst.o: dispose_cmd.h make_cmd.h subst.h externs.h execute_cmd.h
-subst.o: ${DEFSRC}/getopt.h pathexp.h bashline.h
-pathexp.o: config.h shell.h bashjmp.h command.h stdc.h general.h
-pathexp.o: error.h variables.h quit.h maxpath.h unwind_prot.h dispose_cmd.h
+builtins/common.o: config.h.top
+builtins/break.o: config.h.top
+builtins/echo.o: config.h.top
+builtins/evalstring.o: config.h.top
+builtins/exit.o: config.h.top
+builtins/kill.o: config.h.top
+
+# shell basics
+copy_cmd.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
+copy_cmd.o: general.h bashtypes.h variables.h array.h hashlib.h
+copy_cmd.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
+copy_cmd.o: make_cmd.h subst.h sig.h pathnames.h externs.h
+dispose_cmd.o: bashansi.h ansi_stdlib.h
+dispose_cmd.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h
+dispose_cmd.o: error.h general.h bashtypes.h variables.h array.h hashlib.h
+dispose_cmd.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
+dispose_cmd.o: make_cmd.h subst.h sig.h pathnames.h externs.h
+getcwd.o: config.h bashtypes.h bashansi.h
+getcwd.o: maxpath.h posixstat.h posixdir.h memalloc.h
+error.o: config.h bashtypes.h bashansi.h ansi_stdlib.h flags.h stdc.h error.h
+error.o: command.h general.h externs.h input.h bashhist.h
+eval.o: config.h bashansi.h ansi_stdlib.h trap.h flags.h ${DEFSRC}/common.h
+eval.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
+eval.o: general.h bashtypes.h variables.h array.h hashlib.h
+eval.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
+eval.o: make_cmd.h subst.h sig.h pathnames.h externs.h
+eval.o: input.h execute_cmd.h
+execute_cmd.o: config.h bashtypes.h filecntl.h posixstat.h bashansi.h ansi_stdlib.h
+execute_cmd.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
+execute_cmd.o: general.h bashtypes.h variables.h array.h hashlib.h
+execute_cmd.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
+execute_cmd.o: make_cmd.h subst.h sig.h pathnames.h externs.h
+execute_cmd.o: memalloc.h ${GRAM_H} flags.h builtins.h jobs.h quit.h siglist.h
+execute_cmd.o: execute_cmd.h trap.h pathexp.h $(DEFSRC)/common.h
+execute_cmd.o: ${DEFDIR}/builtext.h ${GLOB_LIBSRC}/fnmatch.h
+expr.o: config.h bashansi.h ansi_stdlib.h
+expr.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
+expr.o: general.h bashtypes.h variables.h array.h hashlib.h
+expr.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
+expr.o: make_cmd.h subst.h sig.h pathnames.h externs.h
+flags.o: config.h flags.h
+flags.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
+flags.o: general.h bashtypes.h variables.h array.h hashlib.h
+flags.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
+flags.o: make_cmd.h subst.h sig.h pathnames.h externs.h
+general.o: config.h bashtypes.h posixstat.h filecntl.h bashansi.h ansi_stdlib.h
+general.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
+general.o: general.h bashtypes.h variables.h array.h hashlib.h
+general.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
+general.o: make_cmd.h subst.h sig.h pathnames.h externs.h
+general.o: maxpath.h
+hashcmd.o: config.h posixstat.h bashtypes.h bashansi.h ansi_stdlib.h
+hashcmd.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
+hashcmd.o: general.h bashtypes.h variables.h array.h hashcmd.h
+hashcmd.o: execute_cmd.h stdc.h
+hashlib.o: config.h bashansi.h ansi_stdlib.h
+hashlib.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
+hashlib.o: general.h bashtypes.h variables.h array.h hashlib.h
+hashlib.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
+hashlib.o: make_cmd.h subst.h sig.h pathnames.h externs.h
+input.o: config.h bashtypes.h filecntl.h posixstat.h bashansi.h ansi_stdlib.h
+input.o: command.h stdc.h general.h input.h error.h externs.h
+list.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
+list.o: general.h bashtypes.h variables.h array.h hashlib.h
+list.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
+list.o: make_cmd.h subst.h sig.h pathnames.h externs.h
+locale.o: config.h bashtypes.h bashintl.h bashansi.h ansi_stdlib.h
+locale.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
+locale.o: general.h bashtypes.h variables.h array.h hashlib.h
+locale.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
+locale.o: make_cmd.h subst.h sig.h pathnames.h externs.h
+mailcheck.o: config.h bashtypes.h posixstat.h bashansi.h ansi_stdlib.h
+mailcheck.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
+mailcheck.o: general.h bashtypes.h variables.h array.h hashlib.h
+mailcheck.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
+mailcheck.o: make_cmd.h subst.h sig.h pathnames.h externs.h
+mailcheck.o: execute_cmd.h mailcheck.h
+make_cmd.o: config.h bashtypes.h filecntl.h bashansi.h
+make_cmd.o: command.h stdc.h general.h error.h flags.h make_cmd.h
+make_cmd.o: variables.h array.h hashlib.h subst.h input.h externs.h
+make_cmd.o: jobs.h quit.h siglist.h
+oslib.o: config.h bashtypes.h posixstat.h filecntl.h bashansi.h maxpath.h
+oslib.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
+oslib.o: general.h bashtypes.h variables.h array.h hashlib.h
+oslib.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
+oslib.o: make_cmd.h subst.h sig.h pathnames.h externs.h
+y.tab.o: config.h bashtypes.h bashansi.h ansi_stdlib.h memalloc.h
+y.tab.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
+y.tab.o: general.h bashtypes.h variables.h array.h hashlib.h
+y.tab.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
+y.tab.o: make_cmd.h subst.h sig.h pathnames.h externs.h
+y.tab.o: trap.h flags.h parser.h input.h mailcheck.h $(DEFSRC)/common.h
+y.tab.o: $(DEFDIR)/builtext.h bashline.h bashhist.h jobs.h siglist.h alias.h
+pathexp.o: config.h bashtypes.h bashansi.h ansi_stdlib.h
+pathexp.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
+pathexp.o: general.h bashtypes.h variables.h array.h hashlib.h
+pathexp.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
 pathexp.o: make_cmd.h subst.h sig.h pathnames.h externs.h
+pathexp.o: pathexp.h flags.h 
 pathexp.o: $(GLOB_LIBSRC)/glob.h $(GLOB_LIBSRC)/fnmatch.h
-test.o: posixstat.h
-trap.o: trap.h shell.h bashjmp.h sig.h command.h stdc.h hashlib.h unwind_prot.h
-trap.o: general.h variables.h config.h memalloc.h quit.h signames.h
-trap.o: dispose_cmd.h make_cmd.h subst.h externs.h
-unwind_prot.o: config.h memalloc.h general.h unwind_prot.h sig.h
-variables.o: shell.h bashjmp.h sig.h command.h stdc.h hashlib.h flags.h
-variables.o: config.h memalloc.h general.h variables.h quit.h mailcheck.h
-variables.o: execute_cmd.h dispose_cmd.h make_cmd.h subst.h externs.h
-sig.o: shell.h bashjmp.h sig.h command.h stdc.h hashlib.h flags.h
-sig.o: config.h memalloc.h general.h variables.h quit.h
-sig.o: bashtypes.h jobs.h bashline.h unwind_prot.h
+print_cmd.o: config.h bashansi.h ansi_stdlib.h
+print_cmd.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
+print_cmd.o: general.h bashtypes.h variables.h array.h hashlib.h
+print_cmd.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
+print_cmd.o: make_cmd.h subst.h sig.h pathnames.h externs.h
+print_cmd.o: ${GRAM_H} $(DEFSRC)/common.h
+shell.o: config.h bashtypes.h posixstat.h bashansi.h ansi_stdlib.h filecntl.h
+shell.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
+shell.o: general.h bashtypes.h variables.h array.h hashlib.h
+shell.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
+shell.o: make_cmd.h subst.h sig.h pathnames.h externs.h
+shell.o: flags.h trap.h mailcheck.h builtins.h $(DEFSRC)/common.h
+shell.o: jobs.h siglist.h input.h execute_cmd.h bashhist.h
+shell.o: ${GLOB_LIBSRC}/fnmatch.h
+sig.o: config.h bashtypes.h
+sig.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
+sig.o: general.h bashtypes.h variables.h array.h hashlib.h
+sig.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
+sig.o: make_cmd.h subst.h sig.h pathnames.h externs.h
+sig.o: jobs.h siglist.h trap.h $(DEFSRC)/common.h bashline.h bashhist.h
+siglist.o: config.h bashtypes.h siglist.h trap.h
+stringlib.o: bashtypes.h
+stringlib.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
+stringlib.o: general.h bashtypes.h variables.h array.h hashlib.h
+stringlib.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
+stringlib.o: make_cmd.h subst.h sig.h pathnames.h externs.h
+subst.o: config.h bashtypes.h bashansi.h ansi_stdlib.h posixstat.h
+subst.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
+subst.o: general.h bashtypes.h variables.h array.h hashlib.h
+subst.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
+subst.o: make_cmd.h subst.h sig.h pathnames.h externs.h
+subst.o: flags.h jobs.h siglist.h execute_cmd.h filecntl.h trap.h pathexp.h
+subst.o: mailcheck.h input.h $(DEFSRC)/getopt.h $(DEFSRC)/common.h
+subst.o: bashline.h bashhist.h ${GLOB_LIBSRC}/fnmatch.h
+test.o: bashtypes.h posixstat.h filecntl.h
+test.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
+test.o: general.h bashtypes.h variables.h array.h hashlib.h
+test.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
+test.o: make_cmd.h subst.h sig.h pathnames.h externs.h
+test.o: ${DEFSRC}/common.h
+trap.o: config.h bashtypes.h trap.h bashansi.h ansi_stdlib.h
+trap.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
+trap.o: general.h bashtypes.h variables.h array.h hashlib.h
+trap.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
+trap.o: make_cmd.h subst.h sig.h pathnames.h externs.h
+trap.o: signames.h $(DEFSRC)/common.h
+unwind_prot.o: config.h bashtypes.h bashansi.h ansi_stdlib.h command.h stdc.h
+unwind_prot.o: general.h unwind_prot.h quit.h sig.h
+variables.o: config.h bashtypes.h posixstat.h bashansi.h ansi_stdlib.h
+variables.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
+variables.o: general.h bashtypes.h variables.h array.h hashlib.h
+variables.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
+variables.o: make_cmd.h subst.h sig.h pathnames.h externs.h
+varibales.o: flags.h execute_cmd.h mailcheck.h input.h $(DEFSRC)/common.h
+variables.o: bashhist.h
 version.o: version.h .build
-oslib.o: config.h bashtypes.h posixstat.h filecntl.h bashansi.h maxpath.h
-oslib.o: shell.h bashjmp.h sig.h command.h stdc.h mailcheck.h
-oslib.o: general.h error.h variables.h quit.h unwind_prot.h dispose_cmd.h
-oslib.o: make_cmd.h subst.h pathnames.h externs.h
-xmalloc.o: config.h ansi_stdlib.h general.h error.h
-
-eval.o: config.h bashansi.h shell.h trap.h flags.h builtins/common.h
-eval.o: input.h execute_cmd.h
-eval.o: bashjmp.h command.h general.h error.h variables.h quit.h
-eval.o: maxpath.h unwind_prot.h dispose_cmd.h make_cmd.h subst.h
-eval.o: sig.h pathnames.h externs.h
-
-locale.o: bashintl.h bashansi.h config.h bashtypes.h shell.h
-locale.o: bashjmp.h command.h general.h error.h variables.h quit.h
-locale.o: maxpath.h unwind_prot.h dispose_cmd.h make_cmd.h subst.h
-locale.o: sig.h pathnames.h externs.h
-
-
-alias.o: ansi_stdlib.h
-bashline.o: ansi_stdlib.h
-variables.o: ansi_stdlib.h
-shell.o: ansi_stdlib.h
-error.o: ansi_stdlib.h
-hash.o: ansi_stdlib.h
-signames.o: ansi_stdlib.h
-expr.o: ansi_stdlib.h
-general.o: ansi_stdlib.h
-input.o: ansi_stdlib.h
-
-jobs.o: jobs.c
-nojobs.o: nojobs.c
-
-array.o: general.h shell.h bashjmp.h sig.h variables.h quit.h config.h
-array.o: command.h error.h maxpath.h unwind_prot.h dispose_cmd.h memalloc.h
-array.o: make_cmd.h subst.h externs.h
-array.o: array.h stdc.h $(DEFSRC)/common.h
-
-braces.o: general.h shell.h bashjmp.h sig.h variables.h quit.h config.h
-braces.o: dispose_cmd.h make_cmd.h subst.h externs.h memalloc.h
-braces.o: maxpath.h unwind_prot.h command.h stdc.h
-
-bracecomp.o: bracecomp.c
-bracecomp.o: shell.h bashjmp.h sig.h command.h hashlib.h builtins.h general.h
+vprint.o: config.h
+xmalloc.o: config.h bashtypes.h ansi_stdlib.h error.h
+
+# job control
+
+jobs.o: config.h bashtypes.h trap.h filecntl.h input.h bashtty.h
+jobs.o: bashansi.h ansi_stdlib.h
+jobs.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
+jobs.o: general.h bashtypes.h variables.h array.h hashlib.h
+jobs.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
+jobs.o: make_cmd.h subst.h sig.h pathnames.h externs.h
+jobs.o: jobs.h flags.h $(DEFSRC)/common.h $(DEFDIR)/builtext.h
+nojobs.o: config.h bashtypes.h filecntl.h bashjmp.h posixjmp.h
+nojobs.o: command.h stdc.h general.h jobs.h quit.h siglist.h externs.h
+nojobs.o: sig.h error.h bashtty.h input.h
+
+# shell features that may be compiled in
+
+array.o: config.h bashansi.h ansi_stdlib.h
+array.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
+array.o: general.h bashtypes.h variables.h array.h hashlib.h
+array.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
+array.o: make_cmd.h subst.h sig.h pathnames.h externs.h
+array.o: $(DEFSRC)/common.h
+braces.o: config.h bashansi.h ansi_stdlib.h
+braces.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
+braces.o: general.h bashtypes.h variables.h array.h hashlib.h
+braces.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
+braces.o: make_cmd.h subst.h sig.h pathnames.h externs.h
+alias.o: config.h bashansi.h ansi_stdlib.h command.h stdc.h
+alias.o: general.h bashtypes.h externs.h alias.h
+
+# library support files
+
+bashhist.o: config.h bashtypes.h bashansi.h ansi_stdlib.h posixstat.h
+bashhist.o: filecntl.h
+bashhist.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
+bashhist.o: general.h bashtypes.h variables.h array.h hashlib.h
+bashhist.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
+bashhist.o: make_cmd.h subst.h sig.h pathnames.h externs.h
+bashhist.o: flags.h input.h parser.h pathexp.h $(DEFSRC)/common.h bashline.h
+bashhist.o: $(GLOB_LIBSRC)/fnmatch.h
+bashline.o: config.h bashtypes.h posixstat.h bashansi.h ansi_stdlib.h
+bashline.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
+bashline.o: general.h bashtypes.h variables.h array.h hashlib.h
+bashline.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
+bashline.o: make_cmd.h subst.h sig.h pathnames.h externs.h
+bashline.o: builtins.h bashhist.h bashline.h execute_cmd.h pathexp.h
+bashline.o: $(DEFSRC)/common.h $(GLOB_LIBSRC)/glob.h alias.h
+bracecomp.o: config.h bashansi.h ansi_stdlib.h
+bracecomp.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
+bracecomp.o: general.h bashtypes.h variables.h array.h hashlib.h
+bracecomp.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
+bracecomp.o: make_cmd.h subst.h sig.h pathnames.h externs.h
+bracecomp.o: shell.h bashjmp.h posixjmp.h sig.h command.h hashlib.h builtins.h general.h
 bracecomp.o: quit.h alias.h config.h  variables.h
 bracecomp.o: dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
-bracecomp.o: $(RL_LIBSRC)/readline.h
-
-bashline.o: shell.h bashjmp.h sig.h command.h stdc.h hashlib.h builtins.h
-bashline.o: general.h variables.h config.h memalloc.h quit.h alias.h
-bashline.o: dispose_cmd.h make_cmd.h subst.h externs.h config.h bashline.h
-bashline.o: $(GLOB_LIBSRC)/glob.h pathexp.h execute_cmd.h
 
-bashhist.o: config.h bashansi.h posixstat.h filecntl.h parser.h
-bashhist.o: shell.h bashjmp.h sig.h command.h stdc.h hashlib.h builtins.h
-bashhist.o: general.h variables.h memalloc.h quit.h alias.h execute_cmd.h
-bashhist.o: dispose_cmd.h make_cmd.h subst.h externs.h flags.h
+# library dependencies
 
-bashline.o: $(RL_LIBSRC)/chardefs.h $(RL_LIBSRC)/readline.h
+bashline.o: $(RL_LIBSRC)/rlconf.h
 bashline.o: $(RL_LIBSRC)/keymaps.h
-y.tab.o: $(RL_LIBSRC)/keymaps.h $(RL_LIBSRC)/chardefs.h
-y.tab.o: $(RL_LIBSRC)/readline.h
+bashline.o: $(RL_LIBSRC)/chardefs.h $(RL_LIBSRC)/readline.h
+bracecomp.o: $(RL_LIBSRC)/keymaps.h $(RL_LIBSRC)/chardefs.h
+bracecomp.o: $(RL_LIBSRC)/readline.h
+y.tab.o: $(RL_LIBSRC)/keymaps.h $(RL_LIBSRC)/chardefs.h $(RL_LIBSRC)/readline.h
+subst.o: $(RL_LIBSRC)/keymaps.h $(RL_LIBSRC)/chardefs.h $(RL_LIBSRC)/readline.h
 
+shell.o: $(HIST_LIBSRC)/history.h
 subst.o: $(HIST_LIBSRC)/history.h
 bashline.o: $(HIST_LIBSRC)/history.h
 bashhist.o: $(HIST_LIBSRC)/history.h
 y.tab.o: $(HIST_LIBSRC)/history.h
 
-subst.o: $(GLOB_LIBSRC)/fnmatch.h
-execute_cmd.o: $(GLOB_LIBSRC)/fnmatch.h
-bashhist.o: $(GLOB_LIBSRC)/fnmatch.h
-
 execute_cmd.o: $(TILDE_LIBSRC)/tilde.h
 general.o: $(TILDE_LIBSRC)/tilde.h
 mailcheck.o: $(TILDE_LIBSRC)/tilde.h
@@ -748,147 +853,182 @@ shell.o: $(TILDE_LIBSRC)/tilde.h
 subst.o: $(TILDE_LIBSRC)/tilde.h
 variables.o: $(TILDE_LIBSRC)/tilde.h
 
-builtins/common.o: shell.h bashjmp.h sig.h command.h config.h memalloc.h
-builtins/common.o: variables.h input.h $(DEFSRC)/hashcom.h siglist.h
+# XXX - dependencies checked through here
+
+# builtin c sources
+builtins/bashgetopt.o: config.h bashansi.h ansi_stdlib.h
+builtins/bashgetopt.o: shell.h config.h bashjmp.h command.h general.h error.h
+builtins/bashgetopt.o: variables.h quit.h maxpath.h unwind_prot.h dispose_cmd.h
+builtins/bashgetopt.o: make_cmd.h subst.h sig.h pathnames.h externs.h
+builtins/bashgetopt.o: $(DEFSRC)/common.h
+builtins/common.o: bashtypes.h posixstat.h bashansi.h ansi_stdlib.h
+builtins/common.o: shell.h config.h bashjmp.h posixjmp.h sig.h command.h
+builtins/common.o: memalloc.h variables.h input.h siglist.h
 builtins/common.o: quit.h unwind_prot.h maxpath.h jobs.h builtins.h
 builtins/common.o: dispose_cmd.h make_cmd.h subst.h externs.h bashhist.h
-builtins/common.o: execute_cmd.h stdc.h general.h error.h unwind_prot.h
+builtins/common.o: execute_cmd.h stdc.h general.h error.h pathnames.h
+builtins/common.o: ${DEFDIR}/builtext.h
+builtins/evalfile.o: bashtypes.h posixstat.h filecntl.h bashansi.h ansi_stdlib.h
+builtins/evalfile.o: shell.h config.h bashjmp.h command.h general.h error.h
+builtins/evalfile.o: variables.h quit.h maxpath.h unwind_prot.h dispose_cmd.h
+builtins/evalfile.o: make_cmd.h subst.h sig.h pathnames.h externs.h
+builtins/evalfile.o: jobs.h builtins.h flags.h input.h execute_cmd.h
+builtins/evalfile.o: bashhist.h $(DEFSRC)/common.h
+builtins/evalstring.o: config.h bashansi.h ansi_stdlib.h
+builtins/evalstring.o: shell.h bashjmp.h posixjmp.h sig.h command.h siglist.h
+builtins/evalstring.o: memalloc.h variables.h input.h
+builtins/evalstring.o: quit.h unwind_prot.h maxpath.h jobs.h builtins.h
+builtins/evalstring.o: dispose_cmd.h make_cmd.h subst.h externs.h 
+builtins/evalstring.o: jobs.h builtins.h flags.h input.h execute_cmd.h
+builtins/evalstring.o: bashhist.h $(DEFSRC)/common.h
+builtins/getopt.o: config.h memalloc.h
+builtins/getopt.o: shell.h bashjmp.h command.h general.h error.h
+builtins/getopt.o: variables.h quit.h maxpath.h unwind_prot.h dispose_cmd.h
+builtins/getopt.o: make_cmd.h subst.h sig.h pathnames.h externs.h
+builtins/getopt.o: $(DEFSRC)/getopt.h
+builtins/mkbuiltins.o: config.h bashtypes.h posixstat.h filecntl.h
+builtins/mkbuiltins.o: bashansi.h ansi_stdlib.h
+
+# builtin def files
 builtins/alias.o: command.h config.h memalloc.h error.h general.h maxpath.h
 builtins/alias.o: quit.h $(DEFSRC)/common.h
-builtins/alias.o: shell.h bashjmp.h sig.h command.h stdc.h unwind_prot.h
+builtins/alias.o: shell.h bashjmp.h posixjmp.h sig.h command.h stdc.h unwind_prot.h
 builtins/alias.o: dispose_cmd.h make_cmd.h subst.h externs.h variables.h 
 builtins/bind.o: command.h config.h memalloc.h error.h general.h maxpath.h
 builtins/bind.o: dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
-builtins/bind.o: shell.h bashjmp.h sig.h unwind_prot.h variables.h quit.h
+builtins/bind.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h quit.h
 builtins/bind.o: $(DEFSRC)/bashgetopt.h
 builtins/break.o: command.h config.h memalloc.h error.h general.h maxpath.h
-builtins/break.o: shell.h bashjmp.h sig.h unwind_prot.h variables.h quit.h
+builtins/break.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h quit.h
 builtins/break.o: dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
 builtins/builtin.o: command.h config.h memalloc.h error.h general.h maxpath.h
 builtins/builtin.o: quit.h $(DEFSRC)/common.h
-builtins/builtin.o: shell.h bashjmp.h sig.h unwind_prot.h variables.h 
+builtins/builtin.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h 
 builtins/builtin.o: dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
 builtins/cd.o: command.h config.h memalloc.h error.h general.h maxpath.h
-builtins/cd.o: shell.h bashjmp.h sig.h unwind_prot.h variables.h
+builtins/cd.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h
 builtins/cd.o: dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
 builtins/cd.o: $(DEFSRC)/common.h quit.h 
 builtins/command.o: command.h config.h memalloc.h error.h general.h maxpath.h
 builtins/command.o: quit.h $(DEFSRC)/bashgetopt.h
-builtins/command.o: shell.h bashjmp.h sig.h unwind_prot.h variables.h 
+builtins/command.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h 
 builtins/command.o: dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
 builtins/declare.o: command.h config.h memalloc.h error.h general.h maxpath.h
-builtins/declare.o: shell.h bashjmp.h sig.h unwind_prot.h variables.h quit.h
+builtins/declare.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h quit.h
 builtins/declare.o: dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
 builtins/echo.o: command.h config.h memalloc.h error.h general.h maxpath.h
-builtins/echo.o: shell.h bashjmp.h sig.h unwind_prot.h variables.h quit.h
+builtins/echo.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h quit.h
 builtins/echo.o: dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
 builtins/enable.o: command.h config.h memalloc.h error.h general.h maxpath.h
-builtins/enable.o: shell.h bashjmp.h sig.h unwind_prot.h variables.h quit.h
+builtins/enable.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h quit.h
 builtins/enable.o: dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
 builtins/eval.o: command.h config.h memalloc.h error.h general.h maxpath.h
-builtins/eval.o: shell.h bashjmp.h sig.h unwind_prot.h variables.h quit.h 
+builtins/eval.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h quit.h 
 builtins/eval.o: dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
+builtins/exec.o: bashtypes.h
 builtins/exec.o: command.h config.h memalloc.h error.h general.h maxpath.h
-builtins/exec.o: shell.h bashjmp.h sig.h unwind_prot.h variables.h
+builtins/exec.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h
 builtins/exec.o: dispose_cmd.h make_cmd.h subst.h externs.h execute_cmd.h
 builtins/exec.o: flags.h quit.h $(DEFSRC)/common.h stdc.h
+builtins/exit.o: bashtypes.h
 builtins/exit.o: command.h config.h memalloc.h error.h general.h maxpath.h
-builtins/exit.o: shell.h bashjmp.h sig.h unwind_prot.h variables.h quit.h
+builtins/exit.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h quit.h
 builtins/exit.o: dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
-builtins/fc.o: builtins.h command.h stdc.h 
+builtins/fc.o: bashtypes.h posixstat.h
+builtins/fc.o: bashansi.h ansi_stdlib.h builtins.h command.h stdc.h 
 builtins/fc.o: command.h config.h memalloc.h error.h general.h maxpath.h
-builtins/fc.o: flags.h unwind_prot.h variables.h shell.h bashjmp.h sig.h 
+builtins/fc.o: flags.h unwind_prot.h variables.h shell.h bashjmp.h posixjmp.h sig.h 
 builtins/fc.o: dispose_cmd.h make_cmd.h subst.h externs.h stdc.h quit.h 
 builtins/fc.o: $(DEFSRC)/bashgetopt.h bashhist.h
+builtins/fg_bg.o: bashtypes.h
 builtins/fg_bg.o: command.h config.h memalloc.h error.h general.h maxpath.h
-builtins/fg_bg.o: shell.h bashjmp.h sig.h unwind_prot.h variables.h quit.h
+builtins/fg_bg.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h quit.h
 builtins/fg_bg.o: dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
 builtins/getopts.o: command.h config.h memalloc.h error.h general.h maxpath.h
-builtins/getopts.o: shell.h bashjmp.h sig.h unwind_prot.h variables.h quit.h 
+builtins/getopts.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h quit.h 
 builtins/getopts.o: dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
+builtins/hash.o: bashtypes.h
 builtins/hash.o: builtins.h command.h execute_cmd.h stdc.h $(DEFSRC)/common.h
 builtins/hash.o: command.h config.h memalloc.h error.h general.h maxpath.h
-builtins/hash.o: shell.h bashjmp.h sig.h unwind_prot.h variables.h quit.h 
+builtins/hash.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h quit.h 
 builtins/help.o: command.h config.h memalloc.h error.h general.h maxpath.h
 builtins/help.o: dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
-builtins/help.o: shell.h bashjmp.h sig.h unwind_prot.h variables.h quit.h
+builtins/help.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h quit.h
 builtins/help.o: $(GLOB_LIBSRC)/glob.h
+builtins/history.o: bashtypes.h
 builtins/history.o: command.h config.h memalloc.h error.h general.h maxpath.h
 builtins/history.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
-builtins/history.o: filecntl.h shell.h bashjmp.h sig.h unwind_prot.h
+builtins/history.o: filecntl.h shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h
 builtins/history.o: bashhist.h variables.h 
 builtins/inlib.o: command.h config.h memalloc.h error.h general.h maxpath.h
-builtins/inlib.o: shell.h bashjmp.h sig.h unwind_prot.h variables.h quit.h 
+builtins/inlib.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h quit.h 
 builtins/inlib.o: dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
 builtins/jobs.o: command.h config.h memalloc.h error.h general.h maxpath.h
 builtins/jobs.o: quit.h $(DEFSRC)/bashgetopt.h
-builtins/jobs.o: shell.h bashjmp.h sig.h unwind_prot.h variables.h 
+builtins/jobs.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h 
 builtins/jobs.o: dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
 builtins/kill.o: command.h config.h memalloc.h error.h general.h maxpath.h
 builtins/kill.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
-builtins/kill.o: shell.h bashjmp.h sig.h trap.h unwind_prot.h variables.h 
+builtins/kill.o: shell.h bashjmp.h posixjmp.h sig.h trap.h unwind_prot.h variables.h 
 builtins/let.o: command.h config.h memalloc.h error.h general.h maxpath.h
 builtins/let.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
-builtins/let.o: shell.h bashjmp.h sig.h unwind_prot.h variables.h 
+builtins/let.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h 
 builtins/pushd.o: command.h config.h memalloc.h error.h general.h maxpath.h
 builtins/pushd.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
-builtins/pushd.o: shell.h bashjmp.h sig.h unwind_prot.h variables.h
+builtins/pushd.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h
 builtins/pushd.o: $(DEFSRC)/common.h
 builtins/read.o: command.h config.h memalloc.h error.h general.h maxpath.h
 builtins/read.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
-builtins/read.o: shell.h bashjmp.h sig.h unwind_prot.h variables.h 
+builtins/read.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h 
 builtins/return.o: command.h config.h memalloc.h error.h general.h maxpath.h
 builtins/return.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
-builtins/return.o: shell.h bashjmp.h sig.h unwind_prot.h variables.h 
+builtins/return.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h 
 builtins/set.o: command.h config.h memalloc.h error.h general.h maxpath.h
 builtins/set.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
-builtins/set.o: shell.h bashjmp.h sig.h unwind_prot.h variables.h flags.h
+builtins/set.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h flags.h
 builtins/setattr.o: command.h config.h memalloc.h error.h general.h maxpath.h
 builtins/setattr.o: quit.h $(DEFSRC)/common.h $(DEFSRC)/bashgetopt.h
-builtins/setattr.o: shell.h bashjmp.h sig.h unwind_prot.h variables.h 
+builtins/setattr.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h 
 builtins/setattr.o: dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
 builtins/shift.o: command.h config.h memalloc.h error.h general.h maxpath.h
 builtins/shift.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
-builtins/shift.o: shell.h bashjmp.h sig.h unwind_prot.h variables.h 
+builtins/shift.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h 
 builtins/shift.o: dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
+builtins/shopt.o: command.h config.h memalloc.h error.h general.h
+builtins/shopt.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h
+builtins/shopt.o: shell.h bashjmp.h posixjmp.h unwind_prot.h variables.h maxpath.h
+builtins/shopt.o: $(DEFSRC)/common.h $(DEFSRC)/bashgetopt.h
 builtins/source.o: command.h config.h memalloc.h error.h general.h maxpath.h
 builtins/source.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
-builtins/source.o: shell.h bashjmp.h sig.h unwind_prot.h variables.h 
+builtins/source.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h 
 builtins/suspend.o: command.h config.h memalloc.h error.h general.h maxpath.h
 builtins/suspend.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
-builtins/suspend.o: shell.h bashjmp.h sig.h unwind_prot.h variables.h 
+builtins/suspend.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h 
 builtins/test.o: command.h config.h memalloc.h error.h general.h maxpath.h
 builtins/test.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
-builtins/test.o: shell.h bashjmp.h sig.h unwind_prot.h variables.h 
+builtins/test.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h 
 builtins/times.o: command.h config.h memalloc.h error.h general.h maxpath.h
 builtins/times.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
-builtins/times.o: shell.h bashjmp.h sig.h unwind_prot.h variables.h 
+builtins/times.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h 
 builtins/trap.o: command.h config.h memalloc.h error.h general.h maxpath.h
 builtins/trap.o: quit.h $(DEFSRC)/common.h
-builtins/trap.o: shell.h bashjmp.h sig.h unwind_prot.h variables.h 
+builtins/trap.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h 
 builtins/trap.o: dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
 builtins/type.o: command.h config.h memalloc.h error.h general.h maxpath.h
 builtins/type.o: quit.h $(DEFSRC)/common.h execute_cmd.h
-builtins/type.o: shell.h bashjmp.h sig.h unwind_prot.h variables.h
+builtins/type.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h
 builtins/type.o: dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
 builtins/ulimit.o: command.h config.h memalloc.h error.h general.h maxpath.h
 builtins/ulimit.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
-builtins/ulimit.o: shell.h bashjmp.h sig.h unwind_prot.h variables.h 
+builtins/ulimit.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h 
 builtins/umask.o: command.h config.h memalloc.h error.h general.h maxpath.h
 builtins/umask.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
-builtins/umask.o: shell.h bashjmp.h sig.h unwind_prot.h variables.h 
+builtins/umask.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h 
 builtins/wait.o: command.h config.h memalloc.h error.h general.h maxpath.h
 builtins/wait.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
-builtins/wait.o: shell.h bashjmp.h sig.h unwind_prot.h variables.h
-builtins/shopt.o: command.h config.h memalloc.h error.h general.h
-builtins/shopt.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h
-builtins/shopt.o: shell.h bashjmp.h unwind_prot.h variables.h maxpath.h
-builtins/shopt.o: $(DEFSRC)/common.h $(DEFSRC)/bashgetopt.h
-
-builtins/bashgetopt.o: bashansi.h ansi_stdlib.h
-builtins/mkbuiltins.o: bashansi.h ansi_stdlib.h
-builtins/fc.o: bashansi.h ansi_stdlib.h
+builtins/wait.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h
 
+# builtin library dependencies
 builtins/bind.o: $(RL_LIBSRC)/chardefs.h $(RL_LIBSRC)/readline.h
 builtins/bind.o: $(RL_LIBSRC)/keymaps.h
 
diff --git a/NEWS b/NEWS
index 82e1bcc..af7170f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,20 @@
+This is a terse description of the new features added to bash-2.01 since
+the release of bash-2.0.  As always, the manual page (doc/bash.1) is the
+place to look for complete descriptions.
+
+1. New Features in Bash
+
+a.  There is a new builtin array variable: GROUPS, the set of groups to which
+    the user belongs.  This is used by the test suite.
+
+2.  New Features in Readline
+
+a.  If a key sequence bound to `universal-argument' is read while reading a
+    numeric argument started with `universal-argument', it terminates the
+    argument but is otherwise ignored.  This provides a way to insert multiple
+    instances of a digit string, and is how GNU emacs does it.
+
+-------------------------------------------------------------------------------
 This is a terse description of the new features added to bash-2.0 since
 the release of bash-1.14.7.  As always, the manual page (doc/bash.1) is
 the place to look for complete descriptions.
diff --git a/NOTES b/NOTES
index 0594d22..af6c73f 100644 (file)
--- a/NOTES
+++ b/NOTES
@@ -1,5 +1,5 @@
-Platform-Specific Configuration Notes
-=====================================
+Platform-Specific Configuration and Operation Notes
+===================================================
 
 1.  configure --without-gnu-malloc on:
 
@@ -10,7 +10,7 @@ Platform-Specific Configuration Notes
 
        all machines running SunOS YP code: SunOS4, SunOS5, HP/UX
 
-       linux (optional)
+       linux (optional, but don't do it if you're using Doug Lea's malloc)
 
        QNX 4.2
        other OSF/1 machines (KSR/1, HP, IBM AIX/ESA)
@@ -32,11 +32,108 @@ being built and linked against, but there is only a stub file in the archive.)
 
 3.  Bash cannot be built in a directory separate from the source directory
     using configure --srcdir=... unless the version of `make' you're using
-    does $VPATH handling right.  The SunOS make, for one, does not seem to
-    do it right.  The script support/mkclone can be used to create a
-    `build tree' using symlinks to get around this.
-
-4.  I've had reports that username completion does not work on IRIX 5.3
-    when linking with -lnsl.  This is only a problem when you're running
-    NIS.  Editing the Makefile after configure runs and removing the
-    `-lnsl' from the assignment to `LIBS' fixes the problem.
+    does $VPATH handling right.  The script support/mkclone can be used to
+    create a `build tree' using symlinks to get around this.
+
+4.  I've had reports that username completion (as well as tilde expansion
+    and \u prompt expansion) does not work on IRIX 5.3 when linking with
+    -lnsl.  This is only a problem when you're running NIS, since
+    apparently -lnsl supports only /etc/passwd and not the NIS functions
+    for retrieving usernames and passwords.  Editing the Makefile after
+    configure runs and removing the `-lnsl' from the assignment to `LIBS'
+    fixes the problem.
+
+5.  There is a problem with Red Hat Linux's `makewhatis' script.
+    Running `makewhatis' with bash-2.0 results in error messages
+    like this:
+
+    /usr/sbin/makewhatis: cd: manpath: No such file or directory
+    /usr/sbin/makewhatis: manpath/whatis: No such file or directory
+    chmod: manpath/whatis: No such file or directory
+    /usr/sbin/makewhatis: cd: catpath: No such file or directory
+    /usr/sbin/makewhatis: catpath/whatis: No such file or directory
+    chmod: catpath/whatis: No such file or directory
+
+    The problem is with `makewhatis'.  Red Hat (and possibly other
+    Linux distributors) uses a construct like this in the code:
+
+        eval path=$"$pages"path
+
+    to do indirect variable expansion.  This `happened to work' in
+    bash-1.14 and previous versions, but that was more an accident
+    of implementation than anything else -- it was never supported
+    and certainly is not portable.
+
+    Bash-2.0 has a new feature that gives a new meaning to $"...".
+    This is explained more completely in item 1 in the COMPAT file.
+
+    The three lines in the `makewhatis' script that need to be changed
+    look like this:
+
+             eval $topath=$"$topath":$name
+    [...]
+       eval path=$"$pages"path
+    [...]
+    eval path=$"$pages"path
+
+    The portable way to write this code is
+
+             eval $topath="\$$topath":$name
+       eval path="\$$pages"path
+    eval path="\$$pages"path
+
+    You could also experiment with another new bash feature: ${!var}.
+    This does indirect variable expansion, making the use of eval
+    unnecessary.
+
+6.  There is a problem with syslogd on many Linux distributions (Red Hat
+    and Slackware are two that I have received reports about).  syslogd
+    sends a SIGINT to its parent process, which is waiting for the daemon
+    to finish its initialization.  The parent process then dies due to
+    the SIGINT, and bash reports it, causing unexpected console output
+    while the system is booting that looks something like
+
+       starting daemons: syslogd/etc/rc.d/rc.M: line 29: 38 Interrupt ${NET}/syslogd
+
+    Bash-2.0 reports events such as processes dying in scripts due to
+    signals when the standard output is a tty.  Bash-1.14.x and previous
+    versions did not report such events.
+
+    This should probably be reported as a bug to whatever Linux distributor
+    people see the problem on.  In my opinion, syslogd should be changed to
+    use some other method of communication, or the wrapper function (which
+    appeared to be `daemon' when I looked at it some time ago) or script
+    (which appeared to be `syslog') should catch SIGINT, since it's an
+    expected event, and exit cleanly.
+
+7.  Several people have reported that `dip' (a program for SLIP/PPP
+    on Linux) does not work with bash-2.0 installed as /bin/sh.
+
+    I don't run any Linux boxes myself, and do not have the dip
+    code handy to look at, but the `problem' with bash-2.0, as
+    it has been related to me, is that bash requires the `-p'
+    option to be supplied at invocation if it is to run setuid
+    or setgid. 
+
+    This means, among other things, that setuid or setgid programs
+    which call system(3) (a horrendously bad practice in any case)
+    relinquish their setuid/setgid status in the child that's forked
+    to execute /bin/sh. 
+
+    The following is an *unofficial* patch to bash-2.0 that causes it
+    to not require `-p' to run setuid or setgid if invoked as `sh'.
+    It has been reported to work on Linux.  It will make your system
+    vulnerable to bogus system(3) calls in setuid executables.
+
+--- ../bash-2.0.orig/shell.c    Wed Dec 18 14:16:30 1996
++++ shell.c     Fri Mar  7 13:12:03 1997
+@@ -347,7 +347,7 @@
+   if (posixly_correct)
+     posix_initialize (posixly_correct);
+
+-  if (running_setuid && privileged_mode == 0)
++  if (running_setuid && privileged_mode == 0 && act_like_sh == 0)
+     disable_priv_mode ();
+
+   /* Need to get the argument to a -c option processed in the
+
diff --git a/README b/README
index 89afad4..788edcc 100644 (file)
--- a/README
+++ b/README
@@ -1,26 +1,30 @@
 Introduction
 ============
 
-This is GNU Bash, version 2.0.  Bash is the GNU Project's Bourne
+This is GNU Bash, version 2.01.  Bash is the GNU Project's Bourne
 Again SHell, a complete implementation of the POSIX.2 shell spec,
 but also with interactive command line editing, job control on
 architectures that support it, csh-like features such as history
 substitution and brace expansion, and a slew of other features. 
 For more information on the features of Bash that are new to this
-type of shell, see the file `doc/features.texi'.  There is also a
-large man page.  The manual page is the definitive description of
-the shell's features. 
+type of shell, see the file `doc/bashref.texi'.  There is also a
+large Unix-style man page.  The man page is the definitive description
+of the shell's features. 
 
 See the file CWRU/POSIX.NOTES for a discussion of how Bash differs
 from the POSIX.2 spec and a description of the Bash `posix mode'.
 
 There are some user-visible incompatibilities between this version
-of Bash and the previous version, bash-1.14.  For details, see the
-file COMPAT.
+of Bash and the previous widely-distributed version, bash-1.14.
+For details, see the file COMPAT.  The NEWS file tersely lists
+features that are new in this release. 
 
 Bash is free software, distributed under the terms of the GNU Public
 License, version 2.  For more information, see the file COPYING.
 
+A number of frequently-asked questions are answered in the file
+`doc/FAQ'.
+
 To compile Bash, try typing `./configure', then `make'.  Bash
 auto-configures the build process, so no further intervention
 should be necessary.  Bash builds with `gcc' by default if it is
@@ -39,12 +43,13 @@ platform-specific installation and configuration information.
 
 If you are a csh user and wish to convert your csh aliases to Bash
 aliases, you may wish to use the script `examples/misc/alias-conv.sh'
-as a starting point.
+as a starting point.  The script `examples/misc/cshtobash' is a
+more ambitious script that attempts to do a more complete job.
 
 Reporting Bugs
 ==============
 
-Bug reports for 2.0 should be sent to:
+Bug reports for bash-2.01 should be sent to:
 
        bug-bash@prep.ai.mit.edu
 
@@ -52,15 +57,19 @@ using the `bashbug' program that is built and installed at the same
 time as bash.
 
 The discussion list `bug-bash@prep.ai.mit.edu' often contains
-information about new ports of Bash, or discussions of new
-features or behavior changes that people would like.  This
-mailing list is also available as a usenet newsgroup:
-gnu.bash.bug. 
-
-When you send a bug report to bug-bash@prep.ai.mit.edu, please include:
-
-       * the version number of Bash
-       * the machine and OS that it is running on (see .machine or .made)
+information about new ports of Bash, or discussions of new features or
+behavior changes that people would like.  This mailing list is also
+available as a usenet newsgroup: gnu.bash.bug. 
+
+When you send a bug report, please use the `bashbug' program that is
+built at the same time as bash.  If bash fails to build, try building
+bashbug directly with `make bashbug'.  If you cannot build `bashbug',
+please send mail to bug-bash@prep.ai.mit.edu with the following
+information:
+
+       * the version number and release status of Bash (e.g., 2.01-release)
+       * the machine and OS that it is running on (look at the file
+         `.made' in the bash build directory)
        * a list of the compilation flags or the contents of `config.h', if
          appropriate
        * a description of the bug
@@ -69,8 +78,8 @@ When you send a bug report to bug-bash@prep.ai.mit.edu, please include:
 
 The `bashbug' program includes much of this automatically.
 
-If you would like to contact the Bash maintainers directly, send mail to
-bash-maintainers@prep.ai.mit.edu.
+If you would like to contact the Bash maintainers directly, send mail
+to bash-maintainers@prep.ai.mit.edu. 
 
 While the Bash maintainers do not promise to fix all bugs, we would
 like this shell to be the best that we can make it.
index 8391f78..b852ac0 100644 (file)
@@ -3,20 +3,6 @@ dnl Bash specific tests
 dnl
 dnl Some derived from PDKSH 5.1.3 autoconf tests
 dnl
-dnl check whether cc can create executables
-dnl
-AC_DEFUN(BASH_CC_WORKS,
-[AC_CACHE_CHECK(whether CC works at all, bash_cv_prog_cc_works,        
-       [AC_TRY_RUN([main() { exit(0); }],
-               bash_cv_prog_cc_works=yes, bash_cv_prog_cc_works=no,
-               bash_cv_prog_cc_works=no)
-       ]
-)
-if test "$bash_cv_prog_cc_works" = "no"; then
-AC_MSG_ERROR([Installation or configuration problem: C compiler cannot create executables])
-fi
-])
-
 dnl
 dnl Check if dup2() does not clear the close on exec flag
 dnl
@@ -497,7 +483,7 @@ if test $bash_cv_termcap_lib = gnutermcap; then
 LDFLAGS="$LDFLAGS -L./lib/termcap"
 TERMCAP_LIB="./lib/termcap/libtermcap.a"
 TERMCAP_DEP="./lib/termcap/libtermcap.a"
-elif test $bash_cv_termcap_lib = libtermcap; then
+elif test $bash_cv_termcap_lib = libtermcap && test -z "$prefer_curses"; then
 TERMCAP_LIB=-ltermcap
 TERMCAP_DEP=
 elif test $bash_cv_termcap_lib = libncurses; then
@@ -604,6 +590,39 @@ AC_DEFINE(STRUCT_DIRENT_HAS_D_INO)
 fi
 ])
 
+AC_DEFUN(BASH_STRUCT_DIRENT_D_FILENO,
+[AC_REQUIRE([AC_HEADER_DIRENT])
+AC_MSG_CHECKING(if struct dirent has a d_fileno member)
+AC_CACHE_VAL(bash_cv_dirent_has_d_fileno,
+[AC_TRY_COMPILE([
+#include <stdio.h>
+#include <sys/types.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif /* HAVE_UNISTD_H */
+#if defined(HAVE_DIRENT_H)
+# include <dirent.h>
+#else
+# define dirent direct
+# ifdef HAVE_SYS_NDIR_H
+#  include <sys/ndir.h>
+# endif /* SYSNDIR */
+# ifdef HAVE_SYS_DIR_H
+#  include <sys/dir.h>
+# endif /* SYSDIR */
+# ifdef HAVE_NDIR_H
+#  include <ndir.h>
+# endif
+#endif /* HAVE_DIRENT_H */
+],[
+struct dirent d; int z; z = d.d_fileno;
+], bash_cv_dirent_has_d_fileno=yes, bash_cv_dirent_has_d_fileno=no)])
+AC_MSG_RESULT($bash_cv_dirent_has_d_fileno)
+if test $bash_cv_dirent_has_d_fileno = yes; then
+AC_DEFINE(STRUCT_DIRENT_HAS_D_FILENO)
+fi
+])
+
 AC_DEFUN(BASH_REINSTALL_SIGHANDLERS,
 [AC_REQUIRE([AC_TYPE_SIGNAL])
 AC_REQUIRE([BASH_SIGNAL_CHECK])
@@ -834,6 +853,18 @@ AC_DEFINE(GWINSZ_IN_SYS_IOCTL)
 fi
 ])
 
+AC_DEFUN(BASH_STRUCT_WINSIZE,
+[AC_MSG_CHECKING(for struct winsize in sys/ioctl.h)
+AC_CACHE_VAL(bash_cv_struct_winsize_in_ioctl,
+[AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/ioctl.h>], [struct winsize x;],
+  bash_cv_struct_winsize_in_ioctl=yes,bash_cv_struct_winsize_in_ioctl=no)])
+AC_MSG_RESULT($bash_cv_struct_winsize_in_ioctl)
+if test $bash_cv_struct_winsize_in_ioctl = yes; then   
+AC_DEFINE(STRUCT_WINSIZE_IN_SYS_IOCTL)
+fi
+])
+
 AC_DEFUN(BASH_HAVE_TIOCSTAT,
 [AC_MSG_CHECKING(for TIOCSTAT in sys/ioctl.h)
 AC_CACHE_VAL(bash_cv_tiocstat_in_ioctl,
@@ -858,6 +889,23 @@ AC_DEFINE(FIONREAD_IN_SYS_IOCTL)
 fi
 ])
 
+dnl
+dnl See if speed_t is declared in <sys/types.h>.  Some versions of linux
+dnl require a definition of speed_t each time <termcap.h> is included,
+dnl but you can only get speed_t if you include <termios.h> (on some
+dnl versions) or <sys/types.h> (on others).
+dnl
+AC_DEFUN(BASH_MISC_SPEED_T,
+[AC_MSG_CHECKING(for speed_t in sys/types.h)
+AC_CACHE_VAL(bash_cv_speed_t_in_sys_types,
+[AC_TRY_COMPILE([#include <sys/types.h>], [speed_t x;],
+  bash_cv_speed_t_in_sys_types=yes,bash_cv_speed_t_in_sys_types=no)])
+AC_MSG_RESULT($bash_cv_speed_t_in_sys_types)
+if test $bash_cv_speed_t_in_sys_types = yes; then   
+AC_DEFINE(SPEED_T_IN_SYS_TYPES)
+fi
+])
+
 AC_DEFUN(BASH_CHECK_GETPW_FUNCS,
 [AC_MSG_CHECKING(whether programs are able to redeclare getpw functions)
 AC_CACHE_VAL(bash_cv_can_redecl_getpw,
@@ -892,6 +940,13 @@ elif test $bash_cv_dev_fd = "whacky"; then
 fi
 ])
 
+dnl
+dnl Check for the presence of getpeername (the only networking function
+dnl bash currently requires) in libsocket.  If libsocket is present,
+dnl check for libnsl and add it to LIBS if it's there, since most
+dnl systems with libsocket require linking with libnsl as well.
+dnl This should only be called if getpeername was not found in libc.
+dnl
 AC_DEFUN(BASH_CHECK_SOCKLIB,
 [
 if test "X$bash_cv_have_socklib" = "X"; then
@@ -991,3 +1046,51 @@ if test $bash_cv_kernel_rlimit = yes; then
 AC_DEFINE(RLIMIT_NEEDS_KERNEL)
 fi
 ])
+
+AC_DEFUN(BASH_FUNC_STRCOLL,
+[
+AC_MSG_CHECKING(whether or not strcoll and strcmp differ)
+AC_CACHE_VAL(bash_cv_func_strcoll_broken,
+[AC_TRY_RUN([
+#include <stdio.h>
+#if defined (HAVE_LOCALE_H)
+#include <locale.h>
+#endif
+
+main(c, v)
+int     c;
+char    *v[];
+{
+        int     r1, r2;
+        char    *deflocale, *defcoll;
+
+#ifdef HAVE_SETLOCALE
+        deflocale = setlocale(LC_ALL, "");
+       defcoll = setlocale(LC_COLLATE, "");
+#endif
+
+#ifdef HAVE_STRCOLL
+       /* These two values are taken from tests/glob-test. */
+        r1 = strcoll("abd", "aXd");
+#else
+       r1 = 0;
+#endif
+        r2 = strcmp("abd", "aXd");
+
+       /* These two should both be greater than 0.  It is permissible for
+          a system to return different values, as long as the sign is the
+          same. */
+
+        /* Exit with 1 (failure) if these two values are both > 0, since
+          this tests whether strcoll(3) is broken with respect to strcmp(3)
+          in the default locale. */
+       exit (r1 > 0 && r2 > 0);
+}
+], bash_cv_func_strcoll_broken=yes, bash_cv_func_strcoll_broken=no,
+   AC_MSG_ERROR(cannot check strcoll if cross compiling))
+])
+AC_MSG_RESULT($bash_cv_func_strcoll_broken)
+if test $bash_cv_func_strcoll_broken = yes; then
+AC_DEFINE(STRCOLL_BROKEN)
+fi
+])
diff --git a/alias.c b/alias.c
index 707e38b..d37d1d6 100644 (file)
--- a/alias.c
+++ b/alias.c
@@ -151,6 +151,7 @@ remove_alias (name)
     {
       free_alias_data (elt->data);
       free (elt->key);         /* alias name */
+      free (elt);              /* XXX */
       return (aliases->nentries);
     }
   return (-1);
@@ -164,7 +165,7 @@ delete_all_aliases ()
     return;
 
   flush_hash_table (aliases, free_alias_data);
-  free (aliases);
+  dispose_hash_table (aliases);
   aliases = (HASH_TABLE *)NULL;
 }
 
@@ -247,6 +248,10 @@ alias_expand_word (s)
   return (r ? savestring (r->value) : (char *)NULL);
 }
 
+/* Readline support functions -- expand all aliases in a line. */
+
+#if defined (READLINE)
+
 /* Return non-zero if CHARACTER is a member of the class of characters
    that are self-delimiting in the shell (this really means that these
    characters delimit tokens). */
@@ -529,4 +534,5 @@ alias_expand (string)
       command_word = 0;
     }
 }
+#endif /* READLINE */
 #endif /* ALIAS */
diff --git a/array.c b/array.c
index 0de505c..379eb43 100644 (file)
--- a/array.c
+++ b/array.c
@@ -17,6 +17,8 @@
 #endif
 
 #include <stdio.h>
+#include "bashansi.h"
+
 #include "shell.h"
 #include "array.h"
 #include "builtins/common.h"
@@ -123,6 +125,7 @@ ARRAY       *a;
        return(a1);
 }
 
+#ifdef INCLUDE_UNUSED
 /*
  * Make and return a new array composed of the elements in array A from
  * S to E, inclusive.
@@ -146,6 +149,7 @@ ARRAY_ELEMENT       *s, *e;
        a->num_elements = a->max_index = i;
        return a;
 }
+#endif
 
 ARRAY_ELEMENT *
 copy_array_element(ae)
@@ -392,6 +396,7 @@ register char *s1, *s2;
 }
 #endif
 
+#if defined (INCLUDE_UNUSED) || defined (TEST_ARRAY)
 /*
  * Return an array consisting of elements in S, separated by SEP
  */
@@ -410,6 +415,7 @@ char        *s, *sep;
        a = word_list_to_array (w);
        return (a);
 }
+#endif
 
 /* Convenience routines for the shell to translate to and from the form used
    by the rest of the code. */
@@ -549,7 +555,7 @@ main()
        array_add_element(a, 12, "twelve");
        array_add_element(a, 42, "forty-two");
        print_array(a);
-       s = array_to_string (a, " ");
+       s = array_to_string (a, " ", 0);
        printf("s = %s\n", s);
        copy_of_a = string_to_array(s, " ");
        printf("copy_of_a:");
@@ -563,7 +569,7 @@ main()
        destroy_array_element(ae);
        array_add_element(a, 16, "sixteen");
        print_array(a);
-       s = array_to_string (a, " ");
+       s = array_to_string (a, " ", 0);
        printf("s = %s\n", s);
        copy_of_a = string_to_array(s, " ");
        printf("copy_of_a:");
@@ -576,7 +582,7 @@ main()
        array_add_element(a, 0, "zero");
        array_add_element(a, 134, "");
        print_array(a);
-       s = array_to_string (a, ":");
+       s = array_to_string (a, ":", 0);
        printf("s = %s\n", s);
        copy_of_a = string_to_array(s, ":");
        printf("copy_of_a:");
@@ -586,9 +592,9 @@ main()
        free(s);
        new_a = copy_array(a);
        print_array(new_a);
-       s = array_to_string (new_a, ":");
+       s = array_to_string (new_a, ":", 0);
        printf("s = %s\n", s);
-       copy_of_a = string_to_array(s, ":");
+       copy_of_a = string_to_array(s, ":", 0);
        printf("copy_of_a:");
        print_array(copy_of_a);
        dispose_array(copy_of_a);
index 102d4d8..e515687 100644 (file)
 #include "bashansi.h"
 #include "posixstat.h"
 #include "filecntl.h"
+
 #include "shell.h"
 #include "flags.h"
 #include "input.h"
 #include "parser.h"    /* for the struct dstack stuff. */
 #include "pathexp.h"   /* for the struct ignorevar stuff */
 #include "builtins/common.h"
+
 #include <readline/history.h>
 #include <glob/fnmatch.h>
 
@@ -49,6 +51,8 @@
 extern int errno;
 #endif
 
+extern int glob_pattern_p ();
+
 static int histignore_item_func ();
 
 static struct ignorevar histignore =
@@ -124,6 +128,11 @@ int force_append_history;
    Value of 2 means save all lines that do not match the last line saved. */
 int history_control;
 
+/* Set to 1 if the last command was added to the history list successfully
+   as a separate history entry; set to 0 if the line was ignored or added
+   to a previous entry as part of command-oriented-history processing. */
+int hist_last_line_added;
+
 #if defined (READLINE)
 /* If non-zero, and readline is being used, the user is offered the
    chance to re-edit a failed history expansion. */
@@ -133,7 +142,8 @@ int history_reediting;
    line with history substitution.  Reload it into the editing buffer
    instead and let the user further edit and confirm with a newline. */
 int hist_verify;
-#endif
+
+#endif /* READLINE */
 
 /* Variables declared in other files used here. */
 extern int interactive;
@@ -144,15 +154,36 @@ extern struct dstack dstack;
 extern char *extract_colon_unit ();
 extern char *history_delimiting_chars ();
 extern void maybe_add_history ();      /* forward declaration */
+extern void bash_add_history ();       /* forward declaration */
 
-static void bash_add_history ();
 static int history_should_ignore ();
 
+/* Is the history expansion starting at string[i] one that should not
+   be expanded? */
+static int
+bash_history_inhibit_expansion (string, i)
+     char *string;
+     int i;
+{
+  /* The shell uses ! as a pattern negation character in globbing [...]
+     expressions, so let those pass without expansion. */
+  if (i > 0 && (string[i - 1] == '[') && member (']', string + i + 1))
+    return (1);
+  /* The shell uses ! as the indirect expansion character, so let those
+     expansions pass as well. */
+  else if (i > 1 && string[i - 1] == '{' && string[i - 2] == '$' &&
+            member ('}', string + i + 1))
+    return (1);
+  else
+    return (0);
+}
+
 void
 bash_initialize_history ()
 {
   history_quotes_inhibit_expansion = 1;
   history_search_delimiter_chars = ";&()|<>";
+  history_inhibit_expansion_function = bash_history_inhibit_expansion;
 }
 
 void
@@ -164,6 +195,7 @@ bash_history_reinit (interact)
   history_expansion_inhibited = 1;
 #endif
   remember_on_history = interact != 0;
+  history_inhibit_expansion_function = bash_history_inhibit_expansion;
 }
 
 void
@@ -182,6 +214,7 @@ bash_history_enable ()
 #if defined (BANG_HISTORY)
   history_expansion_inhibited = 0;
 #endif
+  history_inhibit_expansion_function = bash_history_inhibit_expansion;
   sv_history_control ("HISTCONTROL");
   sv_histignore ("HISTIGNORE");
 }
@@ -211,6 +244,7 @@ load_history ()
     }
 }
 
+#ifdef INCLUDE_UNUSED
 /* Write the existing history out to the history file. */
 void
 save_history ()
@@ -233,6 +267,7 @@ save_history ()
       sv_histsize ("HISTFILESIZE");
     }
 }
+#endif
 
 int
 maybe_append_history (filename)
@@ -365,7 +400,11 @@ pre_process_line (line, print_changes, addit)
            {
              if (expanded < 0)
                internal_error (history_value);
+#if defined (READLINE)
              else if (hist_verify == 0)
+#else
+             else
+#endif
                fprintf (stderr, "%s\n", history_value);
            }
 
@@ -403,8 +442,10 @@ pre_process_line (line, print_changes, addit)
   if (addit && remember_on_history && *return_value)
     maybe_add_history (return_value);
 
+#if 0
   if (expanded == 0)
     return_value = savestring (line);
+#endif
 
   return (return_value);
 }
@@ -417,7 +458,7 @@ maybe_add_history (line)
   int should_add;
   HIST_ENTRY *temp;
 
-  should_add = 0;
+  should_add = hist_last_line_added = 0;
 
   /* Don't use the value of history_control to affect the second
      and subsequent lines of a multi-line command when
@@ -461,7 +502,7 @@ maybe_add_history (line)
    remembering;  when non-zero, and LINE is not the first line of a
    complete parser construct, append LINE to the last history line instead
    of adding it as a new line. */
-static void
+void
 bash_add_history (line)
      char *line;
 {
@@ -512,6 +553,7 @@ bash_add_history (line)
 
   if (add_it)
     {
+      hist_last_line_added = 1;
       add_history (line);
       history_lines_this_session++;
     }
index 409f531..d7bade0 100644 (file)
@@ -27,6 +27,7 @@ extern int history_lines_in_file;
 extern int history_expansion;
 extern int history_control;
 extern int command_oriented_history;
+extern int hist_last_line_added;
 
 #  if defined (BANG_HISTORY)
 extern int history_expansion_inhibited;
@@ -43,6 +44,7 @@ extern int maybe_save_shell_history ();
 extern char *pre_process_line ();
 extern int history_number ();
 extern void maybe_add_history ();
+extern void bash_add_history ();
 
 extern void setup_history_ignore ();
 
index 82dd41f..ec21e6c 100644 (file)
--- a/bashjmp.h
+++ b/bashjmp.h
@@ -3,19 +3,7 @@
 #ifndef _BASHJMP_H_
 #define _BASHJMP_H_
 
-#include <setjmp.h>
-
-/* This *must* be included *after* config.h */
-
-#if defined (HAVE_POSIX_SIGSETJMP)
-#  define procenv_t    sigjmp_buf
-#  undef setjmp
-#  define setjmp(x)    sigsetjmp((x), 1)
-#  undef longjmp
-#  define longjmp(x, n)        siglongjmp((x), (n))
-#else
-#  define procenv_t    jmp_buf
-#endif
+#include "posixjmp.h"
 
 extern procenv_t       top_level;
 extern procenv_t       subshell_top_level;
index 7d2e5d7..fbd196a 100644 (file)
@@ -56,6 +56,11 @@ extern void bash_brace_completion ();
 static void shell_expand_line ();
 static void display_shell_version (), operate_and_get_next ();
 static void history_expand_line (), bash_ignore_filenames ();
+#ifdef ALIAS
+static void alias_expand_line ();
+#endif
+static void history_and_alias_expand_line ();
+static void cleanup_expansion_error (), set_up_new_line ();
 
 /* Helper functions for Readline. */
 static int bash_directory_completion_hook ();
@@ -194,6 +199,11 @@ initialize_readline ()
   rl_add_defun ("history-expand-line", (Function *)history_expand_line, -1);
   rl_bind_key_in_map ('^', (Function *)history_expand_line, emacs_meta_keymap);
 
+#ifdef ALIAS
+  rl_add_defun ("alias-expand-line", (Function *)alias_expand_line, -1);
+  rl_add_defun ("history-and-alias-expand-line", (Function *)history_and_alias_expand_line, -1);
+#endif
+
   /* Backwards compatibility. */
   rl_add_defun ("insert-last-argument", rl_yank_last_arg, -1);
 
@@ -285,7 +295,7 @@ initialize_readline ()
   enable_hostname_completion (perform_hostname_completion);
 
   /* characters that need to be quoted when appearing in filenames. */
-  rl_filename_quote_characters = " \t\n\\\"'@<>=;|&()#$`?*[!";
+  rl_filename_quote_characters = " \t\n\\\"'@<>=;|&()#$`?*[!:";
   rl_filename_quoting_function = bash_quote_filename;
   rl_filename_dequoting_function = bash_dequote_filename;
   rl_char_is_quoted_p = char_is_quoted;
@@ -592,13 +602,13 @@ vi_edit_and_execute_command (count, c)
         the end of the history because fc ignores the last command (assumes
         it's supposed to deal with the command before the `fc'). */
       using_history ();
-      add_history (rl_line_buffer);
-      add_history ("");
+      bash_add_history (rl_line_buffer);
+      bash_add_history ("");
       history_lines_this_session++;
       using_history ();
       command = savestring (VI_EDIT_COMMAND);
     }
-  parse_and_execute (command, "v", -1);
+  parse_and_execute (command, "v", SEVAL_NOHIST);
   rl_line_buffer[0] = '\0';    /* XXX */
 }
 #endif /* VI_MODE */
@@ -688,8 +698,18 @@ attempt_shell_completion (text, start, end)
         assignments. */
     }
 
-  /* Special handling for command substitution. */
-  if (*text == '`' && unclosed_pair (rl_line_buffer, start, "`"))
+  /* Check that we haven't incorrectly flagged a closed command substitution
+     as indicating we're in a command position. */
+  if (in_command_position && rl_line_buffer[ti] == '`' && *text != '`' && 
+       unclosed_pair (rl_line_buffer, 0, "`") == 0)
+    in_command_position = 0;
+
+  /* Special handling for command substitution.  If *TEXT is a backquote,
+     it can be the start or end of an old-style command substitution, or
+     unmatched.  If it's unmatched, both calls to unclosed_pair will
+     succeed.  */
+  if (*text == '`' && unclosed_pair (rl_line_buffer, start, "`") &&
+       unclosed_pair (rl_line_buffer, end, "`"))
     matches = completion_matches (text, command_subst_completion_function);
 
   /* Variable name? */
@@ -928,7 +948,7 @@ command_word_completion_function (hint_text, state)
     }
   else
     {
-      int match;
+      int match, freetemp;
       char *temp;
 
       if (absolute_program (hint))
@@ -948,6 +968,7 @@ command_word_completion_function (hint_text, state)
            }
          else
            temp = savestring (val);
+         freetemp = 1;
        }
       else
        {
@@ -956,12 +977,12 @@ command_word_completion_function (hint_text, state)
          if (temp)
            {
              temp++;
-             match = strncmp (temp, hint, hint_len) == 0;
+             freetemp = match = strncmp (temp, hint, hint_len) == 0;
              if (match)
                temp = savestring (temp);
            }
          else
-           match = 0;
+           freetemp = match = 0;
        }
 
       /* If we have found a match, and it is an executable file or a
@@ -974,12 +995,15 @@ command_word_completion_function (hint_text, state)
        }
       else
        {
+         if (freetemp)
+           free (temp);
          free (val);
          goto inner;
        }
     }
 }
 
+/* Completion inside an unterminated command substitution. */
 static char *
 command_subst_completion_function (text, state)
      char *text;
@@ -1148,19 +1172,23 @@ history_expand_line_internal (line)
   char *new_line;
 
   new_line = pre_process_line (line, 0, 0);
-  return new_line;
+  return (new_line == line) ? savestring (line) : new_line;
 }
 
 #if defined (ALIAS)
-/* Perform alias expansion on LINE and return the new line. */
-static char *
-alias_expand_line_internal (line)
-     char *line;
+/* Expand aliases in the current readline line. */
+static void
+alias_expand_line (ignore)
+     int ignore;
 {
-  char *alias_line;
+  char *new_line;
+
+  new_line = alias_expand (rl_line_buffer);
 
-  alias_line = alias_expand (line);
-  return alias_line;
+  if (new_line)
+    set_up_new_line (new_line);
+  else
+    cleanup_expansion_error ();
 }
 #endif
 
@@ -1173,7 +1201,8 @@ cleanup_expansion_error ()
 
   fprintf (rl_outstream, "\r\n");
   to_free = pre_process_line (rl_line_buffer, 1, 0);
-  free (to_free);
+  if (to_free != rl_line_buffer)
+    free (to_free);
   putc ('\r', rl_outstream);
   rl_forced_update_display ();
 }
@@ -1244,6 +1273,8 @@ history_and_alias_expand_line (ignore)
   char *new_line;
 
   new_line = pre_process_line (rl_line_buffer, 0, 0);
+  if (new_line == rl_line_buffer)
+    new_line = savestring (new_line);
 
 #if defined (ALIAS)
   if (new_line)
@@ -1272,6 +1303,8 @@ shell_expand_line (ignore)
   WORD_LIST *expanded_string;
 
   new_line = pre_process_line (rl_line_buffer, 0, 0);
+  if (new_line == rl_line_buffer)
+    new_line = savestring (new_line);
 
 #if defined (ALIAS)
   if (new_line)
@@ -1296,7 +1329,9 @@ shell_expand_line (ignore)
 
       /* If there is variable expansion to perform, do that as a separate
         operation to be undone. */
-      expanded_string = expand_string (rl_line_buffer, 0);
+      new_line = savestring (rl_line_buffer);
+      expanded_string = expand_string (new_line, 0);
+      FREE (new_line);
       if (expanded_string == 0)
        {
          new_line = xmalloc (1);
@@ -1862,7 +1897,44 @@ bash_dequote_filename (text, quote_char)
   return ret;
 }
 
-/* Quote a filename using double quotes. */
+/* Quote characters that the readline completion code would treat as
+   word break characters with backslashes.  Pass backslash-quoted
+   characters through without examination. */
+static char *
+quote_word_break_chars (text)
+     char *text;
+{
+  char *ret, *r, *s;
+  int l;
+
+  l = strlen (text);
+  ret = xmalloc ((2 * l) + 1);
+  for (s = text, r = ret; *s; s++)
+    {
+      /* Pass backslash-quoted characters through, including the backslash. */
+      if (*s == '\\')
+       {
+         *r++ = '\\';
+         *r++ = *++s;
+         if (*s == '\0')
+           break;
+         continue;
+       }
+      /* OK, we have an unquoted character.  Check its presence in
+        rl_completer_word_break_characters. */
+      if (strchr (rl_completer_word_break_characters, *s))
+        *r++ = '\\';
+      *r++ = *s;
+    }
+  *r = '\0';
+  return ret;
+}
+
+/* Quote a filename using double quotes, single quotes, or backslashes
+   depending on the value of completion_quoting_style.  If we're
+   completing using backslashes, we need to quote some additional
+   characters (those that readline treats as word breaks), so we call
+   quote_word_break_chars on the result. */
 static char *
 bash_quote_filename (s, rtype, qcp)
      char *s;
@@ -1896,6 +1968,13 @@ bash_quote_filename (s, rtype, qcp)
   else if (*qcp == '\0' && history_expansion && cs == COMPLETE_DQUOTE &&
           history_expansion_inhibited == 0 && strchr (mtext, '!'))
     cs = COMPLETE_BSQUOTE;
+
+  if (*qcp == '"' && history_expansion && cs == COMPLETE_DQUOTE &&
+        history_expansion_inhibited == 0 && strchr (mtext, '!'))
+    {
+      cs = COMPLETE_BSQUOTE;
+      *qcp = '\0';
+    }
 #endif
 
   switch (cs)
@@ -1914,6 +1993,15 @@ bash_quote_filename (s, rtype, qcp)
   if (mtext != s)
     free (mtext);
 
+  /* We may need to quote additional characters: those that readline treats
+     as word breaks that are not quoted by backslash_quote. */
+  if (rtext && cs == COMPLETE_BSQUOTE)
+    {
+      mtext = quote_word_break_chars (rtext);
+      free (rtext);
+      rtext = mtext;
+    }
+
   /* Leave the opening quote intact.  The readline completion code takes
      care of avoiding doubled opening quotes. */
   rlen = strlen (rtext);
index 3edfcdc..47f6bc3 100644 (file)
 #  include <unistd.h>
 #endif
 
-#if defined (HAVE_STRING_H)
-#  include <string.h>
-#else /* !HAVE_STRING_H */
-#  include <strings.h>
-#endif /* !HAVE_STRING_H */
+#include "bashansi.h"
 
 #include "shell.h"
 #include <readline/readline.h>
@@ -103,7 +99,7 @@ really_munge_braces (array, real_start, real_end, gcd_zero)
             top level, and there isn't a consistent prefix. */
          result_size += 1;
          result = xrealloc (result, result_size);
-         strcpy (result, "{");
+         result[0] = '{'; result[1] = '\0';
          flag++;
        }
 
index 00952db..a7d9db1 100644 (file)
--- a/braces.c
+++ b/braces.c
 #  include <unistd.h>
 #endif
 
-#if defined (HAVE_STRING_H)
-#  include <string.h>
-#else /* !HAVE_STRING_H */
-#  include <strings.h>
-#endif /* !HAVE_STRING_H */
+#include "bashansi.h"
 
 #if defined (SHELL)
 #  include "shell.h"
 #include "general.h"
 #define brace_whitespace(c) (!(c) || (c) == ' ' || (c) == '\t' || (c) == '\n')
 
+#if defined (SHELL)
+extern char *extract_command_subst ();
+#endif
+
 /* Basic idea:
 
    Segregate the text into 3 sections: preamble (stuff before an open brace),
@@ -210,6 +210,10 @@ brace_gobbler (text, indx, satisfy)
      int satisfy;
 {
   register int i, c, quoted, level, pass_next;
+#if defined (SHELL)
+  int si;
+  char *t;
+#endif
 
   level = quoted = pass_next = 0;
 
@@ -242,6 +246,18 @@ brace_gobbler (text, indx, satisfy)
          continue;
        }
 
+#if defined (SHELL)
+      /* Pass new-style command substitutions through unchanged. */
+      if (c == '$' && text[i+1] == '(')                        /* ) */
+       {
+         si = i + 2;
+         t = extract_command_subst (text, &si);
+         i = si;
+         free (t);
+         continue;
+       }
+#endif
+
       if (c == satisfy && level == 0 && quoted == 0)
        {
          /* We ignore an open brace surrounded by whitespace, and also
index f38917b..205f4fc 100644 (file)
@@ -1,29 +1,31 @@
 # This Makefile for building libbuiltins.a is in -*- text -*- for Emacs.
 #
-MKBUILTINS = mkbuiltins
-RANLIB = @RANLIB@
-CFLAGS = @CFLAGS@
-LOCAL_CFLAGS = @LOCAL_CFLAGS@
-CPPFLAGS = @CPPFLAGS@
 SHELL = /bin/sh
+RANLIB = @RANLIB@
 CC = @CC@
 AR = @AR@
 RM = rm -f
 CP = cp
 
-LIBS = @LIBS@
-
 srcdir = @srcdir@
 VPATH = .:@srcdir@
 topdir = @top_srcdir@
 includedir = @includedir@
 
+PROFILE_FLAGS =
+CFLAGS = @CFLAGS@
+LOCAL_CFLAGS = @LOCAL_CFLAGS@
+CPPFLAGS = @CPPFLAGS@
 DEFS = @DEFS@
+LOCAL_DEFS = @LOCAL_DEFS@
+LIBS = @LIBS@
 
 INCLUDES = -I. -I.. -I$(topdir) -I$(topdir)/lib -I$(srcdir)
 
-CCFLAGS = $(DEFS) $(SYSTEM_FLAGS) $(CPPFLAGS) ${INCLUDES} $(LOCAL_CFLAGS) $(CFLAGS)
+CCFLAGS = ${PROFILE_FLAGS} $(DEFS) $(LOCAL_DEFS) $(SYSTEM_FLAGS) $(CPPFLAGS) \
+         ${INCLUDES} $(LOCAL_CFLAGS) $(CFLAGS)
 
+MKBUILTINS = mkbuiltins
 DIRECTDEFINE = -D $(srcdir)
 
 # xxx this is bad style
@@ -158,13 +160,57 @@ wait.o: wait.def
 getopts.o: getopts.def
 reserved.o: reserved.def
 
-common.o: $(topdir)/shell.h $(topdir)/command.h ../config.h
-common.o: $(topdir)/memalloc.h $(topdir)/general.h
-common.o: $(topdir)/variables.h $(topdir)/input.h $(srcdir)/hashcom.h
-common.o: $(topdir)/bashhist.h $(topdir)/quit.h  $(topdir)/unwind_prot.h
-common.o: $(topdir)/maxpath.h $(topdir)/jobs.h $(topdir)/builtins.h
-common.o: $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h $(topdir)/subst.h
-common.o: $(topdir)/execute_cmd.h $(topdir)/error.h $(topdir)/externs.h
+# C files
+bashgetopt.o: ../config.h $(topdir)/bashansi.h $(topdir)/ansi_stdlib.h
+bashgetopt.o: $(topdir)/shell.h $(topdir)/bashjmp.h
+bashgetopt.o: $(topdir)/command.h $(topdir)/general.h $(topdir)/error.h
+bashgetopt.o: $(topdir)/variables.h $(topdir)/quit.h $(topdir)/maxpath.h
+bashgetopt.o: $(topdir)/unwind_prot.h $(topdir)/dispose_cmd.h
+bashgetopt.o: $(topdir)/make_cmd.h $(topdir)/subst.h $(topdir)/sig.h
+bashgetopt.o: $(topdir)/pathnames.h $(topdir)/externs.h $(srcdir)/common.h
+common.o: $(topdir)/bashtypes.h $(topdir)/posixstat.h $(topdir)/bashansi.h $(topdir)/ansi_stdlib.h
+common.o: $(topdir)/shell.h ../config.h $(topdir)/bashjmp.h $(topdir)/posixjmp.h
+common.o: $(topdir)/sig.h $(topdir)/command.h
+common.o: $(topdir)/general.h $(topdir)/stdc.h $(topdir)/memalloc.h
+common.o: $(topdir)/variables.h $(topdir)/input.h
+common.o: $(topdir)/siglist.h $(topdir)/bashhist.h $(topdir)/quit.h
+common.o: $(topdir)/unwind_prot.h $(topdir)/maxpath.h $(topdir)/jobs.h
+common.o: $(topdir)/builtins.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
+common.o: $(topdir)/subst.h $(topdir)/execute_cmd.h $(topdir)/error.h
+common.o: $(topdir)/externs.h $(topdir)/pathnames.h ./builtext.h
+evalfile.o: $(topdir)/bashtypes.h $(topdir)/posixstat.h $(topdir)/filecntl.h
+evalfile.o: $(topdir)/bashansi.h $(topdir)/ansi_stdlib.h
+evalfile.o: $(topdir)/shell.h ../config.h $(topdir)/bashjmp.h
+evalfile.o: $(topdir)/command.h $(topdir)/general.h $(topdir)/error.h
+evalfile.o: $(topdir)/variables.h $(topdir)/quit.h $(topdir)/maxpath.h
+evalfile.o: $(topdir)/unwind_prot.h $(topdir)/dispose_cmd.h
+evalfile.o: $(topdir)/make_cmd.h $(topdir)/subst.h $(topdir)/sig.h
+evalfile.o: $(topdir)/pathnames.h $(topdir)/externs.h
+evalfile.o: $(topdir)/jobs.h $(topdir)/builtins.h $(topdir)/flags.h
+evalfile.o: $(topdir)/input.h $(topdir)/execute_cmd.h
+evalfile.o: $(topdir)/bashhist.h $(srcdir)/common.h
+evalstring.o: ../config.h $(topdir)/bashansi.h $(topdir)/ansi_stdlib.h
+evalstring.o: $(topdir)/shell.h $(topdir)/bashjmp.h $(topdir)/posixjmp.h
+evalstring.o: $(topdir)/sig.h $(topdir)/command.h $(topdir)/siglist.h
+evalstring.o: $(topdir)/memalloc.h $(topdir)/variables.h $(topdir)/input.h
+evalstring.o: $(topdir)/quit.h $(topdir)/unwind_prot.h
+evalstring.o: $(topdir)/maxpath.h $(topdir)/jobs.h $(topdir)/builtins.h
+evalstring.o: $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h $(topdir)/subst.h
+evalstring.o: $(topdir)/externs.h $(topdir)/jobs.h $(topdir)/builtins.h
+evalstring.o: $(topdir)/flags.h $(topdir)/input.h $(topdir)/execute_cmd.h
+evalstring.o: $(topdir)/bashhist.h $(srcdir)/common.h
+getopt.o: ../config.h $(topdir)/memalloc.h
+getopt.o: $(topdir)/shell.h $(topdir)/bashjmp.h $(topdir)/command.h
+getopt.o: $(topdir)/general.h $(topdir)/error.h $(topdir)/variables.h
+getopt.o: $(topdir)/quit.h $(topdir)/maxpath.h $(topdir)/unwind_prot.h
+getopt.o: $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h $(topdir)/subst.h
+getopt.o: $(topdir)/sig.h $(topdir)/pathnames.h $(topdir)/externs.h
+getopt.o: $(srcdir)/getopt.h
+mkbuiltins.o: ../config.h $(topdir)/bashtypes.h $(topdir)/posixstat.h
+mkbuiltins.o: $(topdir)/filecntl.h
+mkbuiltins.o: $(topdir)/bashansi.h $(topdir)/ansi_stdlib.h
+
+# def files
 alias.o: $(topdir)/command.h ../config.h $(topdir)/memalloc.h
 alias.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/maxpath.h
 alias.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
@@ -217,18 +263,21 @@ eval.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
 eval.o: $(topdir)/subst.h $(topdir)/externs.h
 eval.o: $(topdir)/shell.h $(topdir)/unwind_prot.h $(topdir)/variables.h
 eval.o: $(topdir)/maxpath.h
+exec.o: $(topdir)/bashtypes.h
 exec.o: $(topdir)/command.h ../config.h $(topdir)/memalloc.h
 exec.o: $(topdir)/error.h $(topdir)/general.h
 exec.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
 exec.o: $(topdir)/subst.h $(topdir)/externs.h $(topdir)/flags.h
 exec.o: $(topdir)/shell.h $(topdir)/unwind_prot.h $(topdir)/variables.h
 exec.o: $(srcdir)/common.h $(topdir)/execute_cmd.h $(topdir)/maxpath.h
+exit.o: $(topdir)/bashtypes.h
 exit.o: $(topdir)/command.h ../config.h $(topdir)/memalloc.h
 exit.o: $(topdir)/error.h $(topdir)/general.h
 exit.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
 exit.o: $(topdir)/subst.h $(topdir)/externs.h
 exit.o: $(topdir)/shell.h $(topdir)/unwind_prot.h $(topdir)/variables.h
-exit.o: $(topdir)/maxpath.h
+exit.o: $(topdir)/maxpath.h ./builtext.h
+fc.o: $(topdir)/bashtypes.h $(topdir)/posixstat.h
 fc.o: $(topdir)/builtins.h $(topdir)/command.h $(srcdir)/bashgetopt.h
 fc.o: $(topdir)/bashhist.h
 fc.o: $(topdir)/command.h ../config.h $(topdir)/memalloc.h $(topdir)/error.h
@@ -236,6 +285,8 @@ fc.o: $(topdir)/general.h $(topdir)/maxpath.h
 fc.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
 fc.o: $(topdir)/subst.h $(topdir)/externs.h $(topdir)/shell.h
 fc.o: $(topdir)/flags.h $(topdir)/unwind_prot.h $(topdir)/variables.h
+fc.o: $(topdir)/bashansi.h $(topdir)/ansi_stdlib.h
+fg_bg.o: $(topdir)/bashtypes.h
 fg_bg.o: $(topdir)/command.h ../config.h $(topdir)/memalloc.h
 fg_bg.o: $(topdir)/error.h $(topdir)/general.h
 fg_bg.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
@@ -257,6 +308,7 @@ help.o: $(topdir)/error.h $(topdir)/general.h
 help.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
 help.o: $(topdir)/subst.h $(topdir)/externs.h $(topdir)/maxpath.h
 help.o: $(topdir)/shell.h $(topdir)/unwind_prot.h $(topdir)/variables.h
+history.o: $(topdir)/bashtypes.h
 history.o: $(topdir)/command.h ../config.h $(topdir)/memalloc.h
 history.o: $(topdir)/error.h $(topdir)/general.h
 history.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
@@ -288,7 +340,7 @@ pushd.o: $(topdir)/error.h $(topdir)/general.h
 pushd.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
 pushd.o: $(topdir)/subst.h $(topdir)/externs.h
 pushd.o: $(topdir)/shell.h $(topdir)/unwind_prot.h $(topdir)/variables.h
-pushd.o: $(topdir)/maxpath.h $(srcdir)/common.h
+pushd.o: $(topdir)/maxpath.h $(srcdir)/common.h ./builtext.h
 read.o: $(topdir)/command.h ../config.h $(topdir)/memalloc.h
 read.o: $(topdir)/error.h $(topdir)/general.h
 read.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
@@ -345,7 +397,7 @@ type.o: $(topdir)/command.h ../config.h $(topdir)/memalloc.h
 type.o: $(topdir)/error.h $(topdir)/general.h
 type.o: $(topdir)/quit.h $(srcdir)/common.h $(topdir)/maxpath.h
 type.o: $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h $(topdir)/subst.h
-type.o: $(topdir)/externs.h
+type.o: $(topdir)/externs.h $(topdir)/hashcmd.h
 type.o: $(topdir)/shell.h $(topdir)/unwind_prot.h $(topdir)/variables.h 
 ulimit.o: $(topdir)/command.h ../config.h $(topdir)/memalloc.h
 ulimit.o: $(topdir)/error.h $(topdir)/general.h
@@ -368,8 +420,5 @@ shopt.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
 shopt.o: $(topdir)/subst.h $(topdir)/externs.h $(topdir)/maxpath.h
 shopt.o: $(topdir)/shell.h $(topdir)/unwind_prot.h $(topdir)/variables.h
 shopt.o: $(srcdir)/common.h $(srcdir)/bashgetopt.h
-bashgetopt.o: $(topdir)/bashansi.h $(topdir)/ansi_stdlib.h
-mkbuiltins.o: $(topdir)/bashansi.h $(topdir)/ansi_stdlib.h
-fc.o: $(topdir)/bashansi.h $(topdir)/ansi_stdlib.h
 
 #bind.o: $(RL_LIBSRC)chardefs.h $(RL_LIBSRC)readline.h $(RL_LIBSRC)keymaps.h
index 42955b7..044b44d 100644 (file)
@@ -40,6 +40,8 @@ $END
 #  include <unistd.h>
 #endif
 
+#  include "../bashansi.h"
+
 #  include <stdio.h>
 #  include "../shell.h"
 #  include "../alias.h"
index d6f8598..5354ef6 100644 (file)
@@ -57,13 +57,17 @@ break_builtin (list)
 {
   int newbreak;
 
-  if (!check_loop_level ())
+  if (check_loop_level () == 0)
     return (EXECUTION_FAILURE);
 
-  newbreak = get_numeric_arg (list);
+  newbreak = get_numeric_arg (list, 1);
 
   if (newbreak <= 0)
-    return (EXECUTION_FAILURE);
+    {
+      builtin_error ("loop count must be > 0");
+      breaking = loop_level;
+      return (EXECUTION_FAILURE);
+    }
 
   if (newbreak > loop_level)
     newbreak = loop_level;
@@ -88,13 +92,17 @@ continue_builtin (list)
 {
   int newcont;
 
-  if (!check_loop_level ())
+  if (check_loop_level () == 0)
     return (EXECUTION_FAILURE);
 
-  newcont = get_numeric_arg (list);
+  newcont = get_numeric_arg (list, 1);
 
   if (newcont <= 0)
-    return (EXECUTION_FAILURE);
+    {
+      builtin_error ("loop count must be > 0");
+      breaking = loop_level;
+      return (EXECUTION_FAILURE);
+    }
 
   if (newcont > loop_level)
     newcont = loop_level;
@@ -110,7 +118,7 @@ static int
 check_loop_level ()
 {
 #if defined (BREAK_COMPLAINS)
-  if (!loop_level)
+  if (loop_level == 0)
     builtin_error ("only meaningful in a `for', `while', or `until' loop");
 #endif /* BREAK_COMPLAINS */
 
index e6611d0..4bbad7e 100644 (file)
@@ -49,13 +49,16 @@ extern int errno;
 #endif /* !errno */
 
 extern int posixly_correct, interactive;
+extern int array_needs_making;
 extern char *bash_getcwd_errstr;
 
 static int change_to_directory ();
 
 static char *cdspell ();
 static int spname (), mindist (), spdist ();
-int cdspelling = 1;
+
+/* Change this to 1 to get cd spelling correction by default. */
+int cdspelling = 0;
 
 int cdable_vars;
 
@@ -118,8 +121,9 @@ static int
 bindpwd (no_symlinks)
      int no_symlinks;
 {
-  char *dirname;
-  int old_symlinks;
+  char *dirname, *pwdvar;
+  int old_symlinks, old_anm;
+  SHELL_VAR *tvar;
 
   if (no_symlinks)
     {
@@ -132,7 +136,22 @@ bindpwd (no_symlinks)
     dirname = get_working_directory ("cd");
 
   bind_variable ("OLDPWD", get_string_value ("PWD"));
-  bind_variable ("PWD", dirname);
+
+  old_anm = array_needs_making;
+  tvar = bind_variable ("PWD", dirname);
+  /* This is an efficiency hack.  If PWD is exported, we will need to
+     remake the exported environment every time we change directories.
+     If there is no other reason to make the exported environment, just
+     update PWD in place and mark the exported environment as no longer
+     needing a remake. */
+  if (old_anm == 0 && array_needs_making && exported_p (tvar))
+    {
+      pwdvar = xmalloc (strlen (dirname) + 5); /* 5 = "PWD" + '=' + '\0' */
+      strcpy (pwdvar, "PWD=");
+      strcpy (pwdvar + 4, dirname);
+      add_or_supercede_exported_var (pwdvar, 0);
+      array_needs_making = 0;
+    }
 
   FREE (dirname);
   return (EXECUTION_SUCCESS);
@@ -547,6 +566,9 @@ mindist(dir, guess, best)
     }
   (void)closedir(fd);
 
+  /* Don't return `.' */
+  if (best[0] == '.' && best[1] == '\0')
+    dist = 3;
   return dist;
 }
 
index 3a14dc6..6e6e5f6 100644 (file)
@@ -117,13 +117,10 @@ command_builtin (list)
   if (use_standard_path)
     {      
       old_path = get_string_value ("PATH");
+      /* If old_path is NULL, $PATH is unset.  If so, we want to make sure
+        it's unset after this command completes. */
       if (old_path)
        old_path = savestring (old_path);
-      else
-       {
-         old_path = xmalloc (1);
-         old_path[0] = '\0';
-       }
       add_unwind_protect ((Function *)restore_path, old_path);
 
       standard_path = get_standard_path ();
@@ -162,8 +159,13 @@ static void
 restore_path (var)
      char *var;
 {
-  bind_variable ("PATH", var);
-  free (var);
+  if (var)
+    {
+      bind_variable ("PATH", var);
+      free (var);
+    }
+  else
+    unbind_variable ("PATH");
 }
 
 /* Return a value for PATH that is guaranteed to find all of the standard
index 2936b88..1b82032 100644 (file)
@@ -23,7 +23,7 @@
 #endif
 
 #include <stdio.h>
-#include <sys/types.h>
+#include "../bashtypes.h"
 #include "../posixstat.h"
 #include <signal.h>
 
@@ -45,9 +45,9 @@
 #include "../input.h"
 #include "../execute_cmd.h"
 #include "../trap.h"
-#include "hashcom.h"
 #include "bashgetopt.h"
 #include "common.h"
+#include "builtext.h"
 #include <tilde/tilde.h>
 
 #if defined (HISTORY)
@@ -59,14 +59,16 @@ extern int indirection_level, startup_state, subshell_environment;
 extern int line_number;
 extern int last_command_exit_value;
 extern int running_trap;
-extern int hashing_enabled;
 extern int variable_context;
 extern int posixly_correct;
 extern char *this_command_name, *shell_name;
 extern COMMAND *global_command;
-extern HASH_TABLE *hashed_filenames;
 extern char *bash_getcwd_errstr;
 
+/* Used by some builtins and the mainline code. */
+Function *last_shell_builtin = (Function *)NULL;
+Function *this_shell_builtin = (Function *)NULL;
+
 /* **************************************************************** */
 /*                                                                 */
 /*          Error reporting, usage, and option processing          */
@@ -317,10 +319,13 @@ set_dollar_vars_changed ()
 /* Read a numeric arg for this_command_name, the name of the shell builtin
    that wants it.  LIST is the word list that the arg is to come from.
    Accept only the numeric argument; report an error if other arguments
-   follow. */
+   follow.  If FATAL is true, call throw_to_top_level, which exits the
+   shell; if not, call jump_to_top_level (DISCARD), which aborts the
+   current command. */
 int
-get_numeric_arg (list)
+get_numeric_arg (list, fatal)
      WORD_LIST *list;
+     int fatal;
 {
   long count = 1;
 
@@ -332,7 +337,10 @@ get_numeric_arg (list)
       if (!arg || (legal_number (arg, &count) == 0))
        {
          builtin_error ("bad non-numeric arg `%s'", list->word->word);
-         throw_to_top_level ();
+         if (fatal)
+           throw_to_top_level ();
+         else
+           jump_to_top_level (DISCARD);
        }
       no_args (list->next);
     }
@@ -362,80 +370,6 @@ read_octal (string)
 
 /* **************************************************************** */
 /*                                                                 */
-/*                     Command name hashing                        */
-/*                                                                 */
-/* **************************************************************** */
-
-/* Return the full pathname that FILENAME hashes to.  If FILENAME
-   is hashed, but (data->flags & HASH_CHKDOT) is non-zero, check
-   ./FILENAME and return that if it is executable. */
-char *
-find_hashed_filename (filename)
-     char *filename;
-{
-  register BUCKET_CONTENTS *item;
-  char *path, *dotted_filename, *tail;
-  int same;
-
-  if (hashing_enabled == 0)
-    return ((char *)NULL);
-
-  item = find_hash_item (filename, hashed_filenames);
-
-  if (item == NULL)
-    return ((char *)NULL);
-
-  /* If this filename is hashed, but `.' comes before it in the path,
-     see if ./filename is executable.  If the hashed value is not an
-     absolute pathname, see if ./`hashed-value' exists. */
-  path = pathdata(item)->path;
-  if (pathdata(item)->flags & (HASH_CHKDOT|HASH_RELPATH))
-    {
-      tail = (pathdata(item)->flags & HASH_RELPATH) ? path : filename;
-      dotted_filename = xmalloc (3 + strlen (tail));
-      dotted_filename[0] = '.'; dotted_filename[1] = '/';
-      strcpy (dotted_filename + 2, tail);
-
-      if (executable_file (dotted_filename))
-       return (dotted_filename);
-
-      free (dotted_filename);
-
-#if 0
-      if (pathdata(item)->flags & HASH_RELPATH)
-       return ((char *)NULL);
-#endif
-
-      /* Watch out.  If this file was hashed to "./filename", and
-        "./filename" is not executable, then return NULL. */
-
-      /* Since we already know "./filename" is not executable, what
-        we're really interested in is whether or not the `path'
-        portion of the hashed filename is equivalent to the current
-        directory, but only if it starts with a `.'.  (This catches
-        ./. and so on.)  same_file () tests general Unix file
-        equivalence -- same device and inode. */
-      if (*path == '.')
-       {
-         same = 0;
-         tail = (char *)strrchr (path, '/');
-
-         if (tail)
-           {
-             *tail = '\0';
-             same = same_file (".", path, (struct stat *)NULL, (struct stat *)NULL);
-             *tail = '/';
-           }
-
-         return same ? (char *)NULL : path;
-       }
-    }
-
-  return (path);
-}
-
-/* **************************************************************** */
-/*                                                                 */
 /*          Manipulating the current working directory             */
 /*                                                                 */
 /* **************************************************************** */
@@ -635,7 +569,13 @@ display_signal_list (list, forcecols)
              list = list->next;
              continue;
            }
+#if defined (JOB_CONTROL)
+         /* POSIX.2 says that `kill -l signum' prints the signal name without
+            the `SIG' prefix. */
+         printf ("%s\n", (this_shell_builtin == kill_builtin) ? name + 3 : name);
+#else
          printf ("%s\n", name);
+#endif
        }
       else
        {
@@ -852,6 +792,9 @@ backslash_quote (string)
          *r++ = c;
          break;
        case '#':                               /* comment char */
+#if 0
+       case '~':                               /* tilde expansion */
+#endif
          if (s == string)
            *r++ = '\\';
          /* FALLTHROUGH */
index ce831f7..eec5444 100644 (file)
 
 #define ISOPTION(s, c) (s[0] == '-' && !s[2] && s[1] == c)
 
+/* Flag values for parse_and_execute () */
+#define SEVAL_NONINT   0x01
+#define SEVAL_INTERACT 0x02
+#define SEVAL_NOHIST   0x04
+
 extern void builtin_error __P((const char *, ...));
 extern void builtin_usage ();
 extern void bad_option ();
@@ -69,18 +74,15 @@ extern char *double_quote ();
 extern char *backslash_quote ();
 extern int contains_shell_metas ();
 
-/* Functions from hash.def */
-extern void initialize_filename_hashing ();
-extern void flush_hashed_filenames ();
-extern char *find_hashed_filename ();
-extern void remove_hashed_filename ();
-extern void remember_filename ();
-
 /* Functions from set.def */
 extern void initialize_shell_options ();
 extern void list_minus_o_opts ();
 extern int set_minus_o_option ();
 extern int minus_o_option_value ();
+extern void reset_shell_options ();
+
+/* Functions from shopt.def */
+extern void reset_shopt_options ();
 
 /* Functions from type.def */
 extern int describe_command ();
index 68514d3..10a3146 100644 (file)
@@ -268,7 +268,8 @@ declare_internal (list, local_var)
        {
          if (offset)   /* declare -f [-rix] foo=bar */
            {
-             builtin_error ("Can't use `-f' to make functions");
+             builtin_error ("cannot use `-f' to make functions");
+             free (name);
              return (EXECUTION_FAILURE);
            }
          else          /* declare -f [-rx] name [name...] */
index 74ca0f4..e8b6edb 100644 (file)
@@ -26,6 +26,8 @@ $PRODUCES echo.c
 #  include <unistd.h>
 #endif
 
+#include "../bashansi.h"
+
 #include <stdio.h>
 #include "../shell.h"
 
@@ -72,8 +74,8 @@ int
 echo_builtin (list)
      WORD_LIST *list;
 {
-  int display_return, do_v9, i;
-  char *temp;
+  int display_return, do_v9, i, len;
+  char *temp, *s;
 
 #if defined (DEFAULT_ECHO_TO_USG)
 /* System V machines already have a /bin/sh with a v9 behaviour.  We
@@ -130,13 +132,21 @@ just_echo:
 
   while (list)
     {
-      i = 0;
-      temp = do_v9 ? ansicstr (list->word->word, STRLEN (list->word->word), &i)
+      i = len = 0;
+      temp = do_v9 ? ansicstr (list->word->word, STRLEN (list->word->word), &i, &len)
                   : list->word->word;
       if (temp)
        {
-         printf ("%s", temp);
+         if (do_v9)
+           {
+             for (s = temp; len > 0; len--)
+               putchar (*s++);
+           }
+         else      
+           printf ("%s", temp);
+#if defined (SunOS5)
          fflush (stdout);      /* Fix for bug in SunOS 5.5 printf(3) */
+#endif
        }
       if (do_v9 && temp)
        free (temp);
index 37c4f2b..049a7f0 100644 (file)
@@ -238,7 +238,10 @@ enable_shell_command (name, disable_p)
 }
 
 #if defined (HAVE_DLOPEN) && defined (HAVE_DLSYM)
-#include <dlfcn.h>
+
+#if defined (HAVE_DLFCN_H)
+#  include <dlfcn.h>
+#endif
 
 static int
 dyn_load_builtin (list, flags, filename)
@@ -359,7 +362,11 @@ delete_builtin (b)
   struct builtin *new_shell_builtins;
 
   /* XXX - funky pointer arithmetic - XXX */
+#ifdef __STDC__
+  ind = b - shell_builtins;
+#else
   ind = ((int)b - (int)shell_builtins) / sizeof (struct builtin);
+#endif
   size = num_shell_builtins * sizeof (struct builtin);
   new_shell_builtins = (struct builtin *)xmalloc (size);
 
index a394896..62db712 100644 (file)
@@ -34,8 +34,7 @@ $END
 
 #include "../shell.h"
 #include "bashgetopt.h"
-
-extern int parse_and_execute ();
+#include "common.h"
 
 /* Parse the string that these words make, and execute the command found. */
 int
@@ -46,5 +45,5 @@ eval_builtin (list)
     return (EX_USAGE);
 
   /* Note that parse_and_execute () frees the string it is passed. */
-  return (list ? parse_and_execute (string_list (list), "eval", -1) : EXECUTION_SUCCESS);
+  return (list ? parse_and_execute (string_list (list), "eval", SEVAL_NOHIST) : EXECUTION_SUCCESS);
 }
index 14fbc4d..3ffccbe 100644 (file)
@@ -22,7 +22,7 @@
 #  include <unistd.h>
 #endif
 
-#include <sys/types.h>
+#include "../bashtypes.h"
 #include "../posixstat.h"
 #include "../filecntl.h"
 
@@ -55,6 +55,7 @@ extern int errno;
 #define FEVAL_UNWINDPROT       0x004
 #define FEVAL_NONINT           0x008
 #define FEVAL_LONGJMP          0x010
+#define FEVAL_HISTORY          0x020
 
 extern int interactive, interactive_shell, posixly_correct;
 extern int indirection_level, startup_state, subshell_environment;
@@ -71,7 +72,7 @@ _evalfile (filename, flags)
 {
   volatile int old_interactive;
   procenv_t old_return_catch;
-  int return_val, fd, result;
+  int return_val, fd, result, pflags;
   char *string;
   struct stat finfo;
   VFunction *errfunc;
@@ -151,6 +152,9 @@ file_error_and_exit:
   return_catch_flag++;
   sourcelevel++;
 
+  /* set the flags to be passed to parse_and_execute */
+  pflags = (flags & FEVAL_HISTORY) ? 0 : SEVAL_NOHIST;
+
   if (flags & FEVAL_BUILTIN)
     result = EXECUTION_SUCCESS;
 
@@ -164,7 +168,7 @@ file_error_and_exit:
       result = return_catch_value;
     }
   else
-    result = parse_and_execute (string, filename, -1);
+    result = parse_and_execute (string, filename, pflags);
 
   if (flags & FEVAL_UNWINDPROT)
     run_unwind_frame ("_evalfile");
@@ -197,6 +201,20 @@ maybe_execute_file (fname, force_noninteractive)
   return result;
 }
 
+#if defined (HISTORY)
+int
+fc_execute_file (filename)
+     char *filename;
+{
+  int flags;
+
+  /* We want these commands to show up in the history list if
+     remember_on_history is set. */
+  flags = FEVAL_ENOENTOK|FEVAL_HISTORY;
+  return (_evalfile (filename, flags));
+}
+#endif /* HISTORY */
+
 int
 source_file (filename)
      char *filename;
index 2e84068..bf4a8a5 100644 (file)
@@ -40,6 +40,8 @@
 
 #include "common.h"
 
+extern void run_trap_cleanup ();
+
 extern int interactive, interactive_shell;
 extern int indirection_level, startup_state, subshell_environment;
 extern int line_number;
@@ -62,14 +64,19 @@ parse_and_execute_cleanup ()
 }
 
 /* Parse and execute the commands in STRING.  Returns whatever
-   execute_command () returns.  This frees STRING.  INTERACT is
-   the new value for `interactive' while the commands are being
-   executed.  A value of -1 means don't change it. */
+   execute_command () returns.  This frees STRING.  FLAGS is a
+   flags word; look in common.h for the possible values.  Actions
+   are:
+       (flags & SEVAL_NONINT) -> interactive = 0;
+       (flags & SEVAL_INTERACT) -> interactive = 1;
+       (flags & SEVAL_NOHIST) -> call bash_history_disable ()
+*/
+
 int
-parse_and_execute (string, from_file, interact)
+parse_and_execute (string, from_file, flags)
      char *string;
      char *from_file;
-     int interact;
+     int flags;
 {
   int code;
   volatile int should_jump_to_top_level, last_result;
@@ -83,17 +90,17 @@ parse_and_execute (string, from_file, interact)
   unwind_protect_jmp_buf (top_level);
   unwind_protect_int (indirection_level);
   unwind_protect_int (line_number);
-  if (interact != -1 && interactive != interact)
+  if (flags & (SEVAL_NONINT|SEVAL_INTERACT))
     unwind_protect_int (interactive);
 
 #if defined (HISTORY)
+  unwind_protect_int (remember_on_history);    /* can be used in scripts */
+#  if defined (BANG_HISTORY)
   if (interactive_shell)
     {
-      unwind_protect_int (remember_on_history);
-#  if defined (BANG_HISTORY)
       unwind_protect_int (history_expansion_inhibited);
-#  endif /* BANG_HISTORY */
     }
+#  endif /* BANG_HISTORY */
 #endif /* HISTORY */
 
   add_unwind_protect (pop_stream, (char *)NULL);
@@ -104,11 +111,12 @@ parse_and_execute (string, from_file, interact)
   parse_and_execute_level++;
   push_stream (1);     /* reset the line number */
   indirection_level++;
-  if (interact != -1)
-    interactive = interact;
+  if (flags & (SEVAL_NONINT|SEVAL_INTERACT))
+    interactive = (flags & SEVAL_NONINT) ? 0 : 1;
 
 #if defined (HISTORY)
-  bash_history_disable ();
+  if (flags & SEVAL_NOHIST)
+    bash_history_disable ();
 #endif /* HISTORY */
 
   code = should_jump_to_top_level = 0;
@@ -177,6 +185,7 @@ parse_and_execute (string, from_file, interact)
              bitmap = new_fd_bitmap (FD_BITMAP_SIZE);
              begin_unwind_frame ("pe_dispose");
              add_unwind_protect (dispose_fd_bitmap, bitmap);
+             add_unwind_protect (dispose_command, command);    /* XXX */
 
              global_command = (COMMAND *)NULL;
 
index c14af75..cc7f5a9 100644 (file)
@@ -36,7 +36,7 @@ $END
 
 #include <config.h>
 
-#include <sys/types.h>
+#include "../bashtypes.h"
 #include "../posixstat.h"
 #include <signal.h>
 #include <errno.h>
@@ -65,7 +65,7 @@ $END
 extern int errno;
 #endif /* !errno */
 
-extern int interactive, subshell_environment;
+extern int interactive, interactive_shell, subshell_environment;
 extern REDIRECT *redirection_undo_list;
 
 int no_exit_on_failed_exec;
@@ -90,7 +90,7 @@ exec_builtin (list)
 {
   int exit_value = EXECUTION_FAILURE;
   int cleanenv, login, opt;
-  char *argv0, *command, **args, **env, *newname;
+  char *argv0, *command, **args, **env, *newname, *com2;
 
   cleanenv = login = 0;
   argv0 = (char *)NULL;
@@ -143,7 +143,13 @@ exec_builtin (list)
       goto failed_exec;
     }
 
-  command = full_pathname (command);
+  com2 = full_pathname (command);
+  if (com2)
+    {
+      if (command != args[0])
+       free (command);
+      command = com2;
+    }
 
   if (argv0)
     {
@@ -172,7 +178,8 @@ exec_builtin (list)
     }
 
 #if defined (HISTORY)
-  maybe_save_shell_history ();
+  if (interactive_shell && subshell_environment == 0)
+    maybe_save_shell_history ();
 #endif /* HISTORY */
 
   restore_original_signals ();
@@ -201,6 +208,9 @@ failed_exec:
   if (subshell_environment || (interactive == 0 && no_exit_on_failed_exec == 0))
     exit_shell (exit_value);
 
+  if (args)
+    free_array (args);
+
   initialize_traps ();
   reinitialize_signals ();
 
index 23a89ca..ee02b38 100644 (file)
@@ -30,7 +30,7 @@ $END
 
 #include <config.h>
 
-#include <sys/types.h>
+#include "../bashtypes.h"
 #include <stdio.h>
 
 #if defined (HAVE_UNISTD_H)
@@ -45,6 +45,8 @@ $END
 
 extern int interactive, login_shell;
 extern int last_command_exit_value;
+extern Function *this_shell_builtin;
+extern Function *last_shell_builtin;
 
 static int exit_or_logout ();
 static int sourced_logout;
@@ -82,10 +84,6 @@ logout_builtin (list)
     return (exit_or_logout (list));
 }
 
-/* Clean up work for exiting or logging out. */
-Function *last_shell_builtin = (Function *)NULL;
-Function *this_shell_builtin = (Function *)NULL;
-
 static int
 exit_or_logout (list)
      WORD_LIST *list;
@@ -121,7 +119,7 @@ exit_or_logout (list)
 
   /* Get return value if present.  This means that you can type
      `logout 5' to a shell, and it returns 5. */
-  exit_value = list ? get_numeric_arg (list) : last_command_exit_value;
+  exit_value = list ? get_numeric_arg (list, 1) : last_command_exit_value;
 
   /* Run our `~/.bash_logout' file if it exists, and this is a login shell. */
   if (login_shell && sourced_logout++ == 0)
index 16eb8d2..e88ba12 100644 (file)
@@ -50,8 +50,8 @@ $END
 
 #if defined (HISTORY)
 #include <sys/param.h>
-#include "bashtypes.h"
-#include "posixstat.h"
+#include "../bashtypes.h"
+#include "../posixstat.h"
 #include <sys/file.h>
 
 #if defined (HAVE_UNISTD_H)
@@ -77,9 +77,13 @@ extern int errno;
 #endif /* !errno */
 
 extern int echo_input_at_read;
+extern int current_command_line_count;
+extern int literal_history;
 
 extern int unlink ();
 
+extern int fc_execute_file ();
+
 /* **************************************************************** */
 /*                                                                 */
 /*     The K*rn shell style fc command (Fix Command)               */
@@ -252,7 +256,7 @@ fc_builtin (list)
 
       fprintf (stderr, "%s\n", command);
       fc_replhist (command);   /* replace `fc -s' with command */
-      return (parse_and_execute (command, "fc", -1));
+      return (parse_and_execute (command, "fc", SEVAL_NOHIST));
     }
 
   /* This is the second form of the command (the list-or-edit-and-rerun
@@ -266,9 +270,11 @@ fc_builtin (list)
      ("fc blah..." and so on) is already part of the history list by
      the time we get to this point.  This just skips over that command
      and makes the last command that this deals with be the last command
-     the user entered before the fc. */
+     the user entered before the fc.  We need to check whether the
+     line was actually added (HISTIGNORE may have caused it to not be),
+     so we check hist_last_line_added. */
 
-  last_hist = i - 2;
+  last_hist = i - 1 - hist_last_line_added;
 
   if (list)
     {
@@ -317,6 +323,7 @@ fc_builtin (list)
   else
     {
       numbering = 0;
+      /* XXX - this is raceable */
       sprintf (fn, "/tmp/bash%d", (int)time ((time_t *) 0) + (int)getpid ());
 
       stream = fopen (fn, "w");
@@ -354,7 +361,7 @@ fc_builtin (list)
       command = (char *)xmalloc (3 + strlen (FC_EDIT_COMMAND) + strlen (fn));
       sprintf (command, "%s %s", FC_EDIT_COMMAND, fn);
     }
-  retval = parse_and_execute (command, "fc", -1);
+  retval = parse_and_execute (command, "fc", SEVAL_NOHIST);
   if (retval != EXECUTION_SUCCESS)
     {
       unlink (fn);
@@ -375,10 +382,18 @@ fc_builtin (list)
   retval = EXECUTION_SUCCESS;
   first = 1;
 
+#if 1
+  /* Make sure parse_and_execute doesn't turn this off, even though a
+     call to parse_and_execute farther up the function call stack (e.g.,
+     if this is called by vi_edit_and_execute_command) may have already
+     called bash_history_disable. */
+  remember_on_history = 1;
+#else
   /* First, write the commands to the history file.  This will not happen
      when we call parse_and_execute, since parse_and_execute disables
      the command line history while it executes. */
-     
+
+  opt = current_command_line_count;
   while ((line = fc_readline (stream)) != NULL)
     {
       if (line[0] == '\n')
@@ -390,23 +405,36 @@ fc_builtin (list)
       if (first)
        {
          first = 0;
+         /* If we retrieved only one command from the history file, but we
+            read multiple lines from the edited file, and literal_history
+            has been set by `shopt', we assume that it was a compound
+            command stored with embedded newlines.  In this case, we want
+            the history code to store it as one command again. */
+         if (literal_history && histbeg == histend)
+           current_command_line_count = 1;
          fc_replhist (line);
        }
       else
-       fc_addhist (line);
+       {
+         if (literal_history && histbeg == histend)
+           current_command_line_count++;
+         fc_addhist (line);
+       }
 
       free (line);
     }
   fclose (stream);
+  current_command_line_count = opt;
+#endif
 
-  /* Turn on the `v' flag while maybe_execute_file runs so the commands
+  /* Turn on the `v' flag while fc_execute_file runs so the commands
      will be echoed as they are read by the parser. */
   begin_unwind_frame ("fc builtin");
   add_unwind_protect (unlink, fn);
   unwind_protect_int (echo_input_at_read);
   echo_input_at_read = 1;
     
-  retval = maybe_execute_file (fn, 0);
+  retval = fc_execute_file (fn);
 
   run_unwind_frame ("fc builtin");
 
@@ -447,8 +475,10 @@ fc_gethnum (command, hlist)
      ("fc blah..." and so on) is already part of the history list by
      the time we get to this point.  This just skips over that command
      and makes the last command that this deals with be the last command
-     the user entered before the fc. */
-  i -= 2;
+     the user entered before the fc.  We need to check whether the
+     line was actually added (HISTIGNORE may have caused it to not be),
+     so we check hist_last_line_added. */
+  i -= 1 + hist_last_line_added;
 
   /* No specification defaults to most recent command. */
   if (command == NULL)
index 49d0200..2f1b826 100644 (file)
@@ -32,7 +32,7 @@ $END
 
 #include <config.h>
 
-#include <sys/types.h>
+#include "../bashtypes.h"
 #include <signal.h>
 
 #if defined (HAVE_UNISTD_H)
index bc69489..b5f8bc4 100644 (file)
@@ -115,7 +115,7 @@ sh_getopt (argc, argv, optstring)
 
   sh_optarg = 0;
 
-  if (sh_optind > argc || sh_optind < 0)
+  if (sh_optind >= argc || sh_optind < 0)      /* XXX was sh_optind > argc */
     {
       sh_optind = argc;
       return (EOF);
@@ -144,7 +144,7 @@ sh_getopt (argc, argv, optstring)
   if (nextchar == 0 || *nextchar == '\0')
     {
       /* If we have done all the ARGV-elements, stop the scan. */
-      if (sh_optind == argc)
+      if (sh_optind >= argc)
        return EOF;
 
       temp = argv[sh_optind];
index 7086bb7..cf5854a 100644 (file)
@@ -17,8 +17,8 @@
 
 /* XXX THIS HAS BEEN MODIFIED FOR INCORPORATION INTO BASH XXX */
 
-#ifndef _GETOPT_H
-#define _GETOPT_H 1
+#ifndef _SH_GETOPT_H
+#define _SH_GETOPT_H 1
 
 /* For communication from `getopt' to the caller.
    When `getopt' finds an option that takes an argument,
@@ -57,4 +57,4 @@ extern int sh_badopt;
 extern int sh_getopt ();
 extern void sh_getopt_restore_state ();
 
-#endif /* _GETOPT_H */
+#endif /* _SH_GETOPT_H */
index f3d9aee..a9c5116 100644 (file)
@@ -292,7 +292,10 @@ getopts_builtin (list)
   int ac, ret;
 
   if (list == 0)
-    return EXECUTION_FAILURE;
+    {
+      builtin_usage ();
+      return EX_USAGE;
+    }
 
   reset_internal_getopt ();
   while ((ret = internal_getopt (list, "")) != -1)
index 2f69f65..813cb03 100644 (file)
@@ -33,9 +33,6 @@ $END
 
 #include <config.h>
 
-#include <sys/types.h>
-#include "../posixstat.h"
-
 #include <stdio.h>
 
 #if defined (HAVE_UNISTD_H)
@@ -46,9 +43,9 @@ $END
 
 #include "../shell.h"
 #include "../builtins.h"
-#include "../flags.h"
 #include "../execute_cmd.h"
-#include "hashcom.h"
+#include "../flags.h"
+#include "../hashcmd.h"
 #include "common.h"
 #include "bashgetopt.h"
 
@@ -58,54 +55,6 @@ extern char *this_command_name;
 static int add_hashed_command ();
 static int print_hashed_commands ();
 
-static int hashing_initialized = 0;
-
-HASH_TABLE *hashed_filenames;
-
-void
-initialize_filename_hashing ()
-{
-  if (hashing_initialized == 0)
-    {
-      hashed_filenames = make_hash_table (FILENAME_HASH_BUCKETS);
-      hashing_initialized = 1;
-    }
-}
-
-static void
-free_filename_data (data)
-     char *data;
-{
-  free (((PATH_DATA *)data)->path);
-  free (data);
-}
-
-void
-flush_hashed_filenames ()
-{
-  flush_hash_table (hashed_filenames, free_filename_data);
-}
-
-/* Remove FILENAME from the table of hashed commands. */
-void
-remove_hashed_filename (filename)
-     char *filename;
-{
-  register BUCKET_CONTENTS *item;
-
-  if (hashing_enabled == 0)
-    return;
-
-  item = remove_hash_item (filename, hashed_filenames);
-  if (item)
-    {
-      if (item->data)
-       free_filename_data (item->data);
-      free (item->key);
-      free (item);
-    }
-}
-
 /* Print statistics on the current state of hashed commands.  If LIST is
    not empty, then rehash (or hash in the first place) the specified
    commands. */
@@ -161,56 +110,16 @@ hash_builtin (list)
       word = list->word->word;
       if (pathname)
        remember_filename (word, pathname, 0, 0);
-      else
-       {
-         if (absolute_program (word))
-           {
-             list = list->next;
-             continue;
-           }
-
-         if (add_hashed_command (word))
-           opt = EXECUTION_FAILURE;
-       }
+      else if (absolute_program (word))
+       continue;
+      else if (add_hashed_command (word, 0))
+       opt = EXECUTION_FAILURE;
     }
 
   fflush (stdout);
-
   return (opt);
 }
 
-/* Place FILENAME (key) and FULL_PATHNAME (data->path) into the
-   hash table.  CHECK_DOT if non-null is for future calls to
-   find_hashed_filename (); it means that this file was found
-   in a directory in $PATH that is not an absolute pathname.
-   FOUND is the initial value for times_found. */
-void
-remember_filename (filename, full_pathname, check_dot, found)
-     char *filename, *full_pathname;
-     int check_dot, found;
-{
-  register BUCKET_CONTENTS *item;
-
-  if (hashing_enabled == 0)
-    return;
-
-  item = add_hash_item (filename, hashed_filenames);
-  if (item->data)
-    free (pathdata(item)->path);
-  else
-    {
-      item->key = savestring (filename);
-      item->data = xmalloc (sizeof (PATH_DATA));
-    }
-  pathdata(item)->path = savestring (full_pathname);
-  pathdata(item)->flags = 0;
-  if (check_dot)
-    pathdata(item)->flags |= HASH_CHKDOT;
-  if (*full_pathname != '/')
-    pathdata(item)->flags |= HASH_RELPATH;
-  item->times_found = found;
-}
-
 static int
 add_hashed_command (word, quiet)
      char *word;
@@ -244,6 +153,9 @@ print_hashed_commands ()
   BUCKET_CONTENTS *item_list;
   int bucket, any_printed;
 
+  if (hashed_filenames == 0)
+    return (0);
+
   for (bucket = any_printed = 0; bucket < hashed_filenames->nbuckets; bucket++)
     {
       item_list = get_hash_bucket (bucket, hashed_filenames);
index e5e82d5..9c47910 100644 (file)
@@ -46,7 +46,10 @@ $END
 #include <glob/fnmatch.h>
 #include <glob/glob.h>
 
-static void show_builtin_command_help ();
+extern void builtin_error ();
+extern void builtin_usage ();
+
+static  void show_builtin_command_help ();
 
 /* Print out a list of the known functions in the shell, and what they do.
    If LIST is supplied, print out the list which matches for each pattern
@@ -59,13 +62,6 @@ help_builtin (list)
   char *pattern, *name;
   int plen, match_found;
 
-  if (list == 0)
-    {
-      show_shell_version (0);
-      show_builtin_command_help ();
-      return (EXECUTION_SUCCESS);
-    }
-
   /* Placeholder for future options. */
   reset_internal_getopt ();
   while ((i = internal_getopt (list, "")) != -1)
@@ -79,6 +75,13 @@ help_builtin (list)
     }
   list = loptend;
 
+  if (list == 0)
+    {
+      show_shell_version (0);
+      show_builtin_command_help ();
+      return (EXECUTION_SUCCESS);
+    }
+
   /* We should consider making `help bash' do something. */
 
   if (glob_pattern_p (list->word->word))
index 939eb25..b1e3ab3 100644 (file)
@@ -45,7 +45,7 @@ $END
 #include <config.h>
 
 #if defined (HISTORY)
-#include <sys/types.h>
+#include "../bashtypes.h"
 #include <sys/file.h>
 #include "../posixstat.h"
 #include "../filecntl.h"
@@ -193,7 +193,7 @@ display_history (list)
   if (list)
     {
       limited = 1;
-      limit = get_numeric_arg (list);
+      limit = get_numeric_arg (list, 0);
     }
   else
     limited = limit = 0;
@@ -259,7 +259,7 @@ push_history (list)
 {
   char *s;
 
-  if (delete_last_history () == 0)
+  if (hist_last_line_added && delete_last_history () == 0)
     return;
   s = string_list (list);
   maybe_add_history (s);       /* Obeys HISTCONTROL setting. */
@@ -274,7 +274,7 @@ expand_and_print_history (list)
   char *s;
   int r, result;
 
-  if (delete_last_history () == 0)
+  if (hist_last_line_added && delete_last_history () == 0)
     return EXECUTION_FAILURE;
   result = EXECUTION_SUCCESS;
   while (list)
index 2896a76..2c818af 100644 (file)
@@ -237,14 +237,28 @@ disown_builtin (list)
   list = loptend;
   retval = EXECUTION_SUCCESS;
 
+#if 0
+  /* For the future `disown -a' */
+  if (list == 0)
+    {
+      if (nohup_only)
+       nohup_all_jobs ();
+      else
+       delete_all_jobs ();
+      return (EXECUTION_SUCCESS);
+    }
+#endif
+
   do
     {
       BLOCK_CHILD (set, oset);
-      job = get_job_spec (list);
+      job = (list && all_digits(list->word->word))
+               ? get_job_by_pid (atoi(list->word->word), 0)
+               : get_job_spec (list);
 
       if (job == NO_JOB || jobs == 0 || jobs[job] == 0)
        {
-         builtin_error ("no such job %s", list->word->word);
+         builtin_error ("%s: no such job", list ? list->word->word : "current");
          retval = EXECUTION_FAILURE;
        }
       else if (nohup_only)
@@ -257,6 +271,7 @@ disown_builtin (list)
        list = list->next;
     }
   while (list);
+
   return (retval);
 }
 #endif /* JOB_CONTROL */
index ba779bf..ea78bd5 100644 (file)
@@ -56,6 +56,7 @@ extern int errno;
 
 #if defined (JOB_CONTROL)
 extern int interactive;
+extern int job_control;
 extern int posixly_correct;
 
 #if !defined (CONTINUE_AFTER_KILL_ERROR)
@@ -166,7 +167,7 @@ kill_builtin (list)
          builtin_error ("%s: no such pid", list->word->word);
          CONTINUE_OR_FAIL;
        }
-      else if (interactive)
+      else if (interactive || job_control)
        /* Posix.2 says you can kill without job control active (4.32.4) */
        {                       /* Must be a job spec.  Check it out. */
          int job;
index 60b6675..b747962 100644 (file)
@@ -75,6 +75,7 @@ let_builtin (list)
      WORD_LIST *list;
 {
   long ret;
+  int expok;
 
   if (list == 0)
     {
@@ -83,17 +84,22 @@ let_builtin (list)
     }
 
   for (; list; list = list->next)
-    ret = evalexp (list->word->word);
+    {
+      ret = evalexp (list->word->word, &expok);
+      if (expok == 0)
+       return (EXECUTION_FAILURE);
+    }
 
   return ((ret == 0L) ? EXECUTION_FAILURE : EXECUTION_SUCCESS);
 }
 
+#ifdef INCLUDE_UNUSED
 int
 exp_builtin (list)
      WORD_LIST *list;
 {
   char *exp;
-  int ret;
+  int ret, expok;
 
   if (list == 0)
     {
@@ -102,7 +108,8 @@ exp_builtin (list)
     }
 
   exp = string_list (list);
-  ret = evalexp (exp);
-  free (exp);
-  return ((ret == 0L) ? EXECUTION_FAILURE : EXECUTION_SUCCESS);
+  ret = evalexp (exp, &expok);
+  (void)free (exp);
+  return (((ret == 0L) || (expok == 0)) ? EXECUTION_FAILURE : EXECUTION_SUCCESS);
 }
+#endif
index ae93bd4..983bada 100644 (file)
@@ -25,23 +25,17 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
 #  include <unistd.h>
 #endif
 
-#include "../bashansi.h"
-#include "../config.h"
-#include <stdio.h>
-#include <sys/types.h>
+#include "../bashtypes.h"
 #include <sys/file.h>
-#include <sys/stat.h>
+#include "../posixstat.h"
 #include "../filecntl.h"
 
 #if defined (HAVE_UNISTD_H)
 #  include <unistd.h>
 #endif /* HAVE_UNISTD_H */
 
-#if defined (HAVE_STRING_H)
-#  include <string.h>
-#else /* !HAVE_STRING_H */
-#  include <strings.h>
-#endif /* !HAVE_STRING_H */
+#include "../bashansi.h"
+#include <stdio.h>
 
 #define DOCFILE "builtins.texi"
 
@@ -351,9 +345,9 @@ array_add (element, array)
       (array->array, (array->size += array->growth_rate) * array->width);
 
 #if defined (HAVE_BCOPY)
-  bcopy (&element, &(array->array[array->sindex]), array->width);
+  bcopy (&element, (char *) &(array->array[array->sindex]), array->width);
   array->sindex++;
-  bzero (&(array->array[array->sindex]), array->width);
+  bzero ((char *) &(array->array[array->sindex]), array->width);
 #else
   array->array[array->sindex++] = element;
   array->array[array->sindex] = (char *)NULL;
index 0ba1c51..6037d7a 100644 (file)
@@ -28,7 +28,7 @@
 #endif
 
 #include <stdio.h>
-#include <sys/types.h>
+#include "../bashtypes.h"
 #include <signal.h>
 #include <errno.h>
 
@@ -47,6 +47,7 @@ sigpipe (sig)
   exit (0);
 }
 
+int
 main (argc, argv)
      int argc;
      char **argv;
@@ -66,4 +67,5 @@ main (argc, argv)
       n = write (1, buf, 128);
       nw += n;
     }
+  return (0);
 }
index 3eadae0..87300dc 100644 (file)
@@ -30,10 +30,12 @@ the stack, making the new top of the stack the current working
 directory.  With no arguments, exchanges the top two directories.
 
 +N     Rotates the stack so that the Nth directory (counting
-       from the left of the list shown by `dirs') is at the top.
+       from the left of the list shown by `dirs', starting with
+       zero) is at the top.
 
 -N     Rotates the stack so that the Nth directory (counting
-       from the right) is at the top.
+       from the right of the list shown by `dirs', starting with
+       zero) is at the top.
 
 -n     suppress the normal change of directory when adding directories
        to the stack, so only the stack is manipulated.
@@ -257,6 +259,8 @@ pushd_builtin (list)
     {
       add_dirstack_element ((flags & NOCD) ? savestring (list->word->word) : current_directory);
       dirs_builtin ((WORD_LIST *)NULL);
+      if (flags & NOCD)
+       free (current_directory);
       return (EXECUTION_SUCCESS);
     }
   else
@@ -277,7 +281,9 @@ popd_builtin (list)
   long which;
   int flags;
   char direction;
+  char *which_word;
 
+  which_word = (char *)NULL;
   for (flags = 0, which = 0L, direction = '+'; list; list = list->next)
     {
       if (ISOPTION (list->word->word, 'n'))
@@ -297,6 +303,7 @@ popd_builtin (list)
              builtin_usage ();
              return (EXECUTION_FAILURE);
            }
+         which_word = list->word->word;
        }
       else if (*list->word->word == '-')
        {
@@ -310,7 +317,7 @@ popd_builtin (list)
 
   if (which > directory_list_offset || (directory_list_offset == 0 && which == 0))
     {
-      pushd_error (directory_list_offset, list ? list->word->word : "");
+      pushd_error (directory_list_offset, which_word ? which_word : "");
       return (EXECUTION_FAILURE);
     }
 
index eb04a30..64a4a11 100644 (file)
@@ -164,7 +164,7 @@ read_builtin (list)
        {
          if (rlbuf && rlbuf[rlind] == '\0')
            {
-             free (rlbuf);
+             xfree (rlbuf);
              rlbuf = (char *)0;
            }
          if (rlbuf == 0)
@@ -247,13 +247,28 @@ read_builtin (list)
          assign_array_var_from_word_list (var, alist);
          dispose_words (alist);
        }
-      free (input_string);
+      xfree (input_string);
       return (retval);
     }
 #endif /* ARRAY_VARS */ 
 
-  if (!list)
+  /* If there are no variables, save the text of the line read to the
+     variable $REPLY.  ksh93 strips leading and trailing IFS whitespace,
+     so that `read x ; echo "$x"' and `read ; echo "$REPLY"' behave the
+     same way, but I believe that the difference in behaviors is useful
+     enough to not do it.  Without the bash behavior, there is no way
+     to read a line completely without interpretation or modification.
+     If you disagree, change the occurrences of `#if 0' to `#if 1' below. */
+  if (list == 0)
     {
+#if 0
+      orig_input_string = input_string;
+      for (t = input_string; ifs_chars && *ifs_chars && spctabnl(*t) && issep(*t); t++)
+       ;
+      input_string = t;
+      input_string = strip_trailing_ifs_whitespace (input_string, ifs_chars, saw_escape);
+#endif
+
       if (saw_escape)
        {
          t = dequote_string (input_string);
@@ -263,7 +278,11 @@ read_builtin (list)
       else
        var = bind_variable ("REPLY", input_string);
       var->attributes &= ~att_invisible;
+#if 0
+      free (orig_input_string);
+#else
       free (input_string);
+#endif
       return (retval);
     }
 
index 2ab01ef..da5b76b 100644 (file)
@@ -48,7 +48,7 @@ int
 return_builtin (list)
      WORD_LIST *list;
 {
-  return_catch_value = list ? get_numeric_arg (list) : last_command_exit_value;
+  return_catch_value = list ? get_numeric_arg (list, 1) : last_command_exit_value;
 
   if (return_catch_flag)
     longjmp (return_catch, 1);
index d31e77e..74f2e5c 100644 (file)
@@ -78,6 +78,9 @@ $SHORT_DOC set [--abefhkmnptuvxBCHP] [-o option] [arg ...]
 #if defined (BANG_HISTORY)
             histexpand   same as -H
 #endif /* BANG_HISTORY */
+#if defined (HISTORY)
+            history      enable command history
+#endif
             ignoreeof    the shell will not exit upon reading EOF
             interactive-comments
                          allow comments to appear in interactive commands
@@ -110,12 +113,12 @@ $SHORT_DOC set [--abefhkmnptuvxBCHP] [-o option] [arg ...]
 #if defined (BRACE_EXPANSION)
     -B  the shell will perform brace expansion
 #endif /* BRACE_EXPANSION */
+    -C  If set, disallow existing regular files to be overwritten
+        by redirection of output.
 #if defined (BANG_HISTORY)
     -H  Enable ! style history substitution.  This flag is on
         by default.
 #endif /* BANG_HISTORY */
-    -C  If set, disallow existing regular files to be overwritten
-        by redirection of output.
     -P  If set, do not follow symbolic links when executing commands
         such as cd which change the current directory.
 
@@ -127,6 +130,7 @@ ARGs are given, all shell variables are printed.
 $END
 
 static int set_ignoreeof ();
+static int set_posix_mode ();
 
 #if defined (READLINE)
 static int set_edit_mode ();
@@ -183,7 +187,7 @@ struct {
 #endif
   { "ignoreeof", &ignoreeof, set_ignoreeof, (Function *)NULL },
   { "interactive-comments", &interactive_comments, (Function *)NULL, (Function *)NULL },
-  { "posix", &posixly_correct, (Function *)NULL, (Function *)NULL },
+  { "posix", &posixly_correct, set_posix_mode, (Function *)NULL },
 #if defined (READLINE)
   { "emacs", (int *)NULL, set_edit_mode, get_edit_mode },
   { "vi", (int *)NULL, set_edit_mode, get_edit_mode },
@@ -283,6 +287,20 @@ set_ignoreeof (on_or_off, option_name)
   return 0;
 }
 
+static int
+set_posix_mode (on_or_off, option_name)
+     int on_or_off;
+     char *option_name;
+{
+  posixly_correct = on_or_off == FLAG_ON;
+  if (posixly_correct == 0)
+    unbind_variable ("POSIXLY_CORRECT");
+  else
+    bind_variable ("POSIXLY_CORRECT", "y");
+  sv_strict_posix ("POSIXLY_CORRECT");
+  return (0);
+}
+
 #if defined (READLINE)
 /* Magic.  This code `knows' how readline handles rl_editing_mode. */
 static int
@@ -435,7 +453,9 @@ set_shellopts ()
        vptr += strlen (binary_o_options[i].name);
        value[vptr++] = ':';
       }
-  value[--vptr] = '\0';                /* cut off trailing colon */
+  if (vptr)
+    vptr--;                    /* cut off trailing colon */
+  value[vptr] = '\0';
 
   v = find_variable ("SHELLOPTS");
   if (v)
@@ -465,15 +485,34 @@ void
 initialize_shell_options ()
 {
   char *temp;
+  SHELL_VAR *var;
 
+  var = find_variable ("SHELLOPTS");
   /* set up any shell options we may have inherited. */
-  if (temp = get_string_value ("SHELLOPTS"))
-    parse_shellopts (temp);
+  if (var && imported_p (var))
+    {
+      temp = (array_p (var)) ? (char *)NULL : savestring (value_cell (var));
+      if (temp)
+       {
+         parse_shellopts (temp);
+         free (temp);
+       }
+    }
 
   /* Set up the $SHELLOPTS variable. */
   set_shellopts ();
 }
 
+/* Reset the values of the -o options that are not also shell flags. */
+void
+reset_shell_options ()
+{
+#if defined (HISTORY)
+  remember_on_history = 1;
+#endif
+  ignoreeof = posixly_correct = 0;
+}
+
 /* Set some flags from the word values in the input list.  If LIST is empty,
    then print out the values of the variables instead.  If LIST contains
    non-flags, then set $1 - $9 to the successive words of LIST. */
@@ -691,6 +730,12 @@ unset_builtin (list)
        }
 #endif
 
+      if (legal_identifier (name) == 0)
+        {
+          builtin_error ("`%s': not a valid identifier", name);
+          NEXT_VARIABLE ();
+        }
+
       var = unset_function ? find_function (name) : find_variable (name);
 
       if (var && !unset_function && non_unsettable_p (var))
index a83f348..e465eec 100644 (file)
@@ -34,8 +34,17 @@ $PRODUCES setattr.c
 #include "common.h"
 #include "bashgetopt.h"
 
+extern int posixly_correct;
 extern int array_needs_making;
 extern char *this_command_name;
+extern Function *this_shell_builtin;
+
+#ifdef ARRAY_VARS
+extern int declare_builtin ();
+#endif
+
+#define READONLY_OR_EXPORT \
+  (this_shell_builtin == readonly_builtin || this_shell_builtin == export_builtin)
 
 $BUILTIN export
 $FUNCTION export_builtin
@@ -94,6 +103,10 @@ set_or_show_attributes (list, attribute, nodefs)
   register SHELL_VAR *var;
   int assign, undo, functions_only, arrays_only, any_failed, assign_error, opt;
   char *name;
+#if defined (ARRAY_VARS)
+  WORD_LIST *nlist, *tlist;
+  WORD_DESC *w;
+#endif
 
   undo = functions_only = arrays_only = any_failed = assign_error = 0;
   /* Read arguments from the front of the list. */
@@ -159,7 +172,10 @@ set_or_show_attributes (list, attribute, nodefs)
          if (legal_identifier (name) == 0)
            {
              builtin_error ("`%s': not a valid identifier", name);
-             assign_error++;
+             if (assign)
+               assign_error++;
+             else
+               any_failed++;
              list = list->next;
              continue;
            }
@@ -167,6 +183,24 @@ set_or_show_attributes (list, attribute, nodefs)
          if (assign)   /* xxx [-np] name=value */
            {
              name[assign] = '=';
+#if defined (ARRAY_VARS)
+             /* Let's try something here.  Turn readonly -a xxx=yyy into
+                declare -ra xxx=yyy and see what that gets us. */
+             if (arrays_only)
+               {
+                 tlist = list->next;
+                 list->next = (WORD_LIST *)NULL;
+                 w = make_word ("-ra");
+                 nlist = make_word_list (w, list);
+                 opt = declare_builtin (nlist);
+                 if (opt != EXECUTION_SUCCESS)
+                   assign_error++;
+                 list->next = tlist;
+                 dispose_word (w);
+                 free (nlist);
+               }
+             else
+#endif
              /* This word has already been expanded once with command
                 and parameter expansion.  Call do_assignment_no_expand (),
                 which does not do command or parameter substitution.  If
@@ -212,7 +246,7 @@ set_or_show_attributes (list, attribute, nodefs)
                continue;
 #endif
              if ((var->attributes & attribute) && invisible_p (var) == 0)
-               show_var_attributes (var, nodefs);
+               show_var_attributes (var, READONLY_OR_EXPORT, nodefs);
            }
          free (variable_list);
        }
@@ -223,43 +257,70 @@ set_or_show_attributes (list, attribute, nodefs)
                                            : EXECUTION_FAILURE));
 }
 
+/* Show the attributes for shell variable VAR.  If NODEFS is non-zero,
+   don't show function definitions along with the name.  If PATTR is
+   non-zero, it indicates we're being called from `export' or `readonly'.
+   In POSIX mode, this prints the name of the calling builtin (`export'
+   or `readonly') instead of `declare', and doesn't print function defs
+   when called by `export' or `readonly'. */
 int
-show_var_attributes (var, nodefs)
+show_var_attributes (var, pattr, nodefs)
      SHELL_VAR *var;
-     int nodefs;
+     int pattr, nodefs;
 {
   char flags[6], *x;
   int i;
 
   i = 0;
 
+  /* pattr == 0 means we are called from `declare'. */
+  if (pattr == 0 || posixly_correct == 0)
+    {
 #if defined (ARRAY_VARS)
-  if (array_p (var))
-    flags[i++] = 'a';
+      if (array_p (var))
+       flags[i++] = 'a';
 #endif
 
-  if (function_p (var))
-    flags[i++] = 'f';
+      if (function_p (var))
+        flags[i++] = 'f';
 
-  if (integer_p (var))
-    flags[i++] = 'i';
+      if (integer_p (var))
+        flags[i++] = 'i';
 
-  if (readonly_p (var))
-    flags[i++] = 'r';
+      if (readonly_p (var))
+        flags[i++] = 'r';
 
-  if (exported_p (var))
-    flags[i++] = 'x';
+      if (exported_p (var))
+        flags[i++] = 'x';
+    }
+  else
+    {
+#if defined (ARRAY_VARS)
+      if (array_p (var))
+       flags[i++] = 'a';
+#endif
+
+      if (function_p (var))
+        flags[i++] = 'f';
+    }
 
   flags[i] = '\0';
 
-  printf ("declare -%s ", i ? flags : "-");
+  if (pattr == 0 || posixly_correct == 0)
+    printf ("declare -%s ", i ? flags : "-");
+  else if (i)
+    printf ("%s -%s ", this_command_name, flags);
+  else
+    printf ("%s ", this_command_name);
 
 #if defined (ARRAY_VARS)
  if (array_p (var))
     print_array_assignment (var, 1);
   else
 #endif
-  if (nodefs)
+  /* force `readline' and `export' to not print out function definitions
+     when in POSIX mode. */
+  if (nodefs || (function_p (var) && pattr != 0 && posixly_correct))
     printf ("%s\n", var->name);
   else if (function_p (var))
     printf ("%s\n", named_function_string (var->name, function_cell (var), 1));
@@ -285,7 +346,7 @@ show_name_attributes (name, nodefs)
 
   if (var && invisible_p (var) == 0)
     {
-      show_var_attributes (var, nodefs);
+      show_var_attributes (var, READONLY_OR_EXPORT, nodefs);
       return (0);
     }
   else
index 8af4d5d..293c31b 100644 (file)
@@ -53,7 +53,7 @@ shift_builtin (list)
   register int count;
   WORD_LIST *temp;
 
-  times = get_numeric_arg (list);
+  times = get_numeric_arg (list, 0);
 
   if (times == 0)
     return (EXECUTION_SUCCESS);
index 5372bbb..bc26a96 100644 (file)
@@ -61,15 +61,17 @@ extern int cdspelling, expand_aliases;
 extern int check_window_size;
 
 #if defined (HISTORY)
-extern int hist_verify, literal_history, command_oriented_history;
+extern int literal_history, command_oriented_history;
 extern int force_append_history;
 #endif
 
 #if defined (READLINE)
-extern int history_reediting, perform_hostname_completion;
+extern int hist_verify, history_reediting, perform_hostname_completion;
 extern void enable_hostname_completion ();
 #endif
 
+extern void set_shellopts ();
+
 static int set_interactive_comments ();
 
 static struct {
@@ -92,9 +94,9 @@ static struct {
 #endif
 #if defined (HISTORY)
   { "histappend", &force_append_history, (Function *)NULL },
-  { "histverify", &hist_verify, (Function *)NULL },
 #endif
 #if defined (READLINE)
+  { "histverify", &hist_verify, (Function *)NULL },
   { "hostcomplete", &perform_hostname_completion, (Function *)enable_hostname_completion },
 #endif
   { "interactive_comments", &interactive_comments, set_interactive_comments },
@@ -178,6 +180,29 @@ shopt_builtin (list)
   return (rval);
 }
 
+/* Reset the options managed by `shopt' to the values they would have at
+   shell startup. */
+void
+reset_shopt_options ()
+{
+  allow_null_glob_expansion = glob_dot_filenames = 0;
+  cdable_vars = mail_warning = 0;
+  no_exit_on_failed_exec = print_shift_error = 0;
+  check_hashed_filenames = cdspelling = expand_aliases = check_window_size = 0;
+
+  source_uses_path = promptvars = 1;
+
+#if defined (HISTORY)
+  literal_history = force_append_history = 0;
+  command_oriented_history = 1;
+#endif
+
+#if defined (READLINE)
+  hist_verify = history_reediting = 0;
+  perform_hostname_completion = 1;
+#endif
+}
+
 static int
 find_shopt (name)
      char *name;
index 151c34d..82ec71b 100644 (file)
@@ -46,7 +46,10 @@ $END
 
 extern int job_control;
 
-static SigHandler *old_cont, *old_stop;
+static SigHandler *old_cont;
+#if 0
+static SigHandler *old_stop;
+#endif
 
 /* Continue handler. */
 sighandler
index f6a8ee4..2d5daca 100644 (file)
@@ -23,17 +23,17 @@ $PRODUCES trap.c
 
 $BUILTIN trap
 $FUNCTION trap_builtin
-$SHORT_DOC trap [arg] [signal_spec] or trap -l
+$SHORT_DOC trap [arg] [signal_spec ...] or trap -l
 The command ARG is to be read and executed when the shell receives
 signal(s) SIGNAL_SPEC.  If ARG is absent all specified signals are
 reset to their original values.  If ARG is the null string each
 SIGNAL_SPEC is ignored by the shell and by the commands it invokes.
-If SIGNAL_SPEC is EXIT (0) the command ARG is executed on exit from
-the shell.  If SIGNAL_SPEC is DEBUG, ARG is executed after every
+If SIGNAL_SPEC is EXIT (0) the command ARG is executed on exit from
+the shell.  If SIGNAL_SPEC is DEBUG, ARG is executed after every
 command.  If ARG is `-p' then the trap commands associated with
 each SIGNAL_SPEC are displayed.  If no arguments are supplied or if
 only `-p' is given, trap prints the list of commands associated with
-each signal number.  SIGNAL_SPEC is either a signal name in <signal.h>
+each signal number.  Each SIGNAL_SPEC is either a signal name in <signal.h>
 or a signal number.  `trap -l' prints a list of signal names and their
 corresponding numbers.  Note that a signal can be sent to the shell
 with "kill -signal $$".
@@ -115,7 +115,8 @@ trap_builtin (list)
 
       operation = SET;
       first_arg = list->word->word;
-      if (first_arg && *first_arg && signal_object_p (first_arg))
+      if (first_arg && *first_arg && (*first_arg != '-' || first_arg[1]) &&
+               signal_object_p (first_arg))
        operation = REVERT;
       else
        {
index 5e828c6..3af018f 100644 (file)
@@ -57,6 +57,7 @@ $END
 
 #include "../shell.h"
 #include "../execute_cmd.h"
+#include "../hashcmd.h"
 
 #if defined (ALIAS)
 #include "../alias.h"
@@ -307,6 +308,7 @@ describe_command (command, verbose, all)
          else if (verbose == 3 || verbose == 4)
            printf ("%s\n", full_path);
 
+         free (full_path);
          return (1);
        }
     }
index 546dfd4..3cdf26a 100644 (file)
@@ -35,7 +35,7 @@ option is given, it is interpreted as follows:
     -c the maximum size of core files created
     -d the maximum size of a process's data segment
     -f the maximum size of files created by the shell
-    -l  the maximum size a process may lock into memory
+    -l the maximum size a process may lock into memory
     -m the maximum resident set size
     -n the maximum number of open file descriptors
     -p the pipe buffer size
@@ -215,6 +215,17 @@ static ULCMD *cmdlist;
 static int ncmd;
 static int cmdlistsz;
 
+#if !defined (HAVE_RESOURCE) && !defined (HAVE_ULIMIT)
+long
+ulimit (cmd, newlim)
+     int cmd;
+     long newlim;
+{
+  errno = EINVAL;
+  return -1;
+}
+#endif /* !HAVE_RESOURCE && !HAVE_ULIMIT */
+
 static int
 _findlim (opt)
      int opt;
@@ -368,6 +379,12 @@ ulimit_internal (cmd, cmdarg, mode, multiple)
   block_factor = (limit == RLIM_INFINITY) ? 1 : limits[limind].block_factor;
   real_limit = limit * block_factor;
 
+  if (real_limit < 0 || (real_limit == 0 && limit != 0))
+    {
+      builtin_error ("limit out of range: %d", limit);
+      return (EXECUTION_FAILURE);
+    }
+
   if (set_limit (limind, real_limit, mode) < 0)
     {
       builtin_error ("cannot modify limit: %s", strerror (errno));
@@ -444,6 +461,9 @@ set_limit (ind, newlim, mode)
       case RLIMIT_FILESIZE:
 #if !defined (HAVE_RESOURCE)
        return (ulimit (2, newlim / 512L));
+#else
+       errno = EINVAL;
+       return -1;
 #endif
 
       case RLIMIT_OPENFILES:
@@ -462,8 +482,9 @@ set_limit (ind, newlim, mode)
 #if defined (HAVE_RESOURCE)
       if (getrlimit (limits[ind].parameter, &limit) < 0)
        return -1;
-      val = (current_user.euid != 0 && newlim == RLIM_INFINITY)
-               ? limit.rlim_max : newlim;
+      val = (current_user.euid != 0 && newlim == RLIM_INFINITY &&
+              (limit.rlim_cur <= limit.rlim_max))
+                ? limit.rlim_max : newlim;
       if (mode & LIMIT_SOFT)
        limit.rlim_cur = val;
       if (mode & LIMIT_HARD)
index 5ef8f3b..85bf220 100644 (file)
@@ -64,6 +64,7 @@ umask_builtin (list)
      WORD_LIST *list;
 {
   int print_symbolically, opt, umask_value;
+  mode_t umask_arg;
 
   print_symbolically = 0;
   reset_internal_getopt ();
@@ -105,19 +106,20 @@ umask_builtin (list)
          if (umask_value == -1)
            return (EXECUTION_FAILURE);
        }
-      umask (umask_value);
+      umask_arg = (mode_t)umask_value;
+      umask (umask_arg);
       if (print_symbolically)
-       print_symbolic_umask (umask_value);
+       print_symbolic_umask (umask_arg);
     }
   else                         /* Display the UMASK for this user. */
     {
-      umask_value = umask (022);
-      umask (umask_value);
+      umask_arg = umask (022);
+      umask (umask_arg);
 
       if (print_symbolically)
-       print_symbolic_umask (umask_value);
+       print_symbolic_umask (umask_arg);
       else
-       printf ("%03o\n", umask_value);
+       printf ("%03o\n", umask_arg);
     }
 
   fflush (stdout);
@@ -128,7 +130,7 @@ umask_builtin (list)
    printed if the corresponding bit is clear in the umask. */
 static void
 print_symbolic_umask (um)
-     int um;
+     mode_t um;
 {
   char ubits[4], gbits[4], obits[4];           /* u=rwx,g=rwx,o=rwx */
   int i;
@@ -267,9 +269,12 @@ symbolic_umask (list)
                umc |= perm;
                break;
 
+#if 0
+             /* No other values are possible. */
              default:
                builtin_error ("bad symbolic mode operator: %c", op);
                return (-1);
+#endif
            }
 
          if (!*s)
index b9290d9..741ff5c 100644 (file)
@@ -50,9 +50,12 @@ $END
 #  include <unistd.h>
 #endif
 
+#include "../bashansi.h"
+
 #include "../shell.h"
 #include "../jobs.h"
 #include "common.h"
+#include "bashgetopt.h"
 
 extern int interrupt_immediately;
 
@@ -71,6 +74,8 @@ wait_builtin (list)
 
   if (no_options (list))
     return (EX_USAGE);
+  if (list != loptend)
+    list = loptend;
 
   begin_unwind_frame ("wait_builtin");
   unwind_protect_int (interrupt_immediately);
index cbbb028..92c7fb4 100644 (file)
--- a/command.h
+++ b/command.h
@@ -37,6 +37,7 @@ enum r_instruction {
 #define AMBIGUOUS_REDIRECT  -1
 #define NOCLOBBER_REDIRECT  -2
 #define RESTRICTED_REDIRECT -3 /* can only happen in restricted shells. */
+#define HEREDOC_REDIRECT    -4  /* here-doc temp file can't be created */
 
 #define OUTPUT_REDIRECT(ri) \
   (ri == r_output_direction || ri == r_input_output || ri == r_err_and_out)
@@ -121,6 +122,8 @@ typedef struct element {
 #define CMD_NO_FORK       0x40 /* Don't fork; just call execve */
 #define CMD_TIME_PIPELINE  0x80 /* Time a pipeline */
 #define CMD_TIME_POSIX    0x100 /* time -p; use POSIX.2 time output spec. */
+#define CMD_AMPERSAND     0x200 /* command & */
+#define CMD_STDIN_REDIR           0x400 /* async command needs implicit </dev/null */
 
 /* What a command looks like. */
 typedef struct command {
index 2261917..270e80d 100644 (file)
@@ -61,3 +61,7 @@
 #    define USE_VARARGS
 #  endif
 #endif
+
+#if defined (STRCOLL_BROKEN)
+#  undef HAVE_STRCOLL
+#endif
index 584f814..6a85ad7 100644 (file)
 
 #undef STRUCT_DIRENT_HAS_D_INO
 
+#undef STRUCT_DIRENT_HAS_D_FILENO
+
+#undef STRUCT_WINSIZE_IN_SYS_IOCTL
+
+#undef SPEED_T_IN_SYS_TYPES
+
 #undef CAN_REDEFINE_GETENV
 
 #undef MUST_REINSTALL_SIGHANDLERS
 /* Define if you have the <dirent.h> header file.  */
 #undef HAVE_DIRENT_H
 
+/* Define if you have the <dlfcn.h> header file.  */
+#undef HAVE_DLFCN_H
+
 /* Define if you have the <limits.h> header file.  */
 #undef HAVE_LIMITS_H
 
    <sys/resource.h>? */
 #undef RLIMIT_NEEDS_KERNEL
 
+/* Do strcoll(3) and strcmp(3) give different results in the default locale? */
+#undef STRCOLL_BROKEN
+
 #include "config.h.bot"
 
 #endif /* _CONFIG_H_ */
+
index 491a49f..ec11b8d 100644 (file)
    without this option. */
 #define V9_ECHO
 
+/* Define DONT_REPORT_SIGPIPE if you don't want to see `Broken pipe' messages
+   when a job like `cat jobs.c | exit 1' is executed. */
+/* #define DONT_REPORT_SIGPIPE */
+
 /* The default value of the PATH variable. */
 #ifndef DEFAULT_PATH_VALUE
 #define DEFAULT_PATH_VALUE \
index 463c027..705c5af 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,6 +1,12 @@
 #! /bin/sh
 
-# From configure.in for Bash 2.0, version 1.14, from autoconf version 2.12
+# From configure.in for Bash 2.01, version 1.26, from autoconf version 2.12
+
+
+
+
+
+
 
 
 
@@ -80,47 +86,51 @@ ac_help=
 ac_default_prefix=/usr/local
 # Any additions from configure.in:
 ac_help="$ac_help
---with-gnu-malloc      use the GNU version of malloc"
+--with-afs             if you are running AFS"
+ac_help="$ac_help
+--with-curses          use the curses library instead of the termcap library"
 ac_help="$ac_help
 --with-glibc-malloc    use the GNU C library version of malloc"
 ac_help="$ac_help
---with-purify          configure to postprocess with purify"
+--with-gnu-malloc      use the GNU version of malloc"
 ac_help="$ac_help
---with-afs             if you are running AFS"
+--with-purecov         configure to postprocess with pure coverage"
 ac_help="$ac_help
---enable-minimal-config        a minimal sh-like configuration"
+--with-purify          configure to postprocess with purify"
 ac_help="$ac_help
---enable-job-control   enable job control features"
+--enable-minimal-config        a minimal sh-like configuration"
 ac_help="$ac_help
 --enable-alias         enable shell aliases"
 ac_help="$ac_help
---enable-readline      turn on command line editing"
-ac_help="$ac_help
---enable-history       turn on command history"
+--enable-array-variables       include shell array variables"
 ac_help="$ac_help
 --enable-bang-history  turn on csh-style history substitution"
 ac_help="$ac_help
---enable-directory-stack       enable builtins pushd/popd/dirs"
+--enable-brace-expansion       include brace expansion"
 ac_help="$ac_help
---enable-restricted    enable a restricted shell"
+--enable-command-timing        enable the time reserved word and command timing"
 ac_help="$ac_help
---enable-process-substitution  enable process substitution"
+--enable-directory-stack       enable builtins pushd/popd/dirs"
 ac_help="$ac_help
---enable-prompt-string-decoding        turn on escape character decoding in prompts"
+--enable-disabled-builtins     allow disabled builtins to still be invoked"
 ac_help="$ac_help
---enable-select                include select command"
+--enable-dparen-arithmetic     include ((...)) command"
 ac_help="$ac_help
 --enable-help-builtin  include the help builtin"
 ac_help="$ac_help
---enable-array-variables       include shell array variables"
+--enable-history       turn on command history"
 ac_help="$ac_help
---enable-dparen-arithmetic     include ((...)) command"
+--enable-job-control   enable job control features"
 ac_help="$ac_help
---enable-brace-expansion       include brace expansion"
+--enable-process-substitution  enable process substitution"
 ac_help="$ac_help
---enable-disabled-builtins     allow disabled builtins to still be invoked"
+--enable-prompt-string-decoding        turn on escape character decoding in prompts"
 ac_help="$ac_help
---enable-command-timing        enable the time reserved word and command timing"
+--enable-readline      turn on command line editing"
+ac_help="$ac_help
+--enable-restricted    enable a restricted shell"
+ac_help="$ac_help
+--enable-select                include select command"
 ac_help="$ac_help
 --enable-usg-echo-default      make the echo builtin expand escape sequences by default"
 
@@ -661,7 +671,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:665: checking host system type" >&5
+echo "configure:675: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
@@ -685,7 +695,9 @@ echo "$ac_t""$host" 1>&6
 opt_gnu_malloc=yes
 opt_glibc_malloc=no
 opt_purify=no
+opt_purecov=no
 opt_afs=no
+opt_curses=no
 
 case "${host_cpu}-${host_os}" in
 alpha-*)       opt_gnu_malloc=no ;;    # alpha running osf/1 or linux
@@ -693,18 +705,27 @@ alpha-*)  opt_gnu_malloc=no ;;    # alpha running osf/1 or linux
 *-osf1*)       opt_gnu_malloc=no ;;    # other osf/1 machines
 sparc-svr4*)   opt_gnu_malloc=no ;;    # sparc SVR4, SVR4.2
 sparc-netbsd*) opt_gnu_malloc=no ;;    # needs 8-byte alignment
+*-sgi-irix6*)  opt_gnu_malloc=no ;;    # needs 8-byte alignment
 sparc-linux*)  opt_gnu_malloc=no ;;    # sparc running linux; requires ELF
+*-freebsd*)    opt_gnu_malloc=no ;;    # they claim it's better
 *-aix*)                opt_gnu_malloc=no ;;    # AIX machines
 *-nextstep*)   opt_gnu_malloc=no ;;    # NeXT machines running NeXTstep
 *-dgux*)       opt_gnu_malloc=no ;;    # DG/UX machines
-*-qnx)         opt_gnu_malloc=no ;;    # QNX 4.2
+*-qnx*)                opt_gnu_malloc=no ;;    # QNX 4.2
+*-machten4)    opt_gnu_malloc=no ;;    # MachTen 4.x
 *-bsdi2.1)     opt_gnu_malloc=no ; : ${CC:=shlicc2} ;; # for loadable builtins
 esac
 
-# Check whether --with-gnu-malloc or --without-gnu-malloc was given.
-if test "${with_gnu_malloc+set}" = set; then
-  withval="$with_gnu_malloc"
-  opt_gnu_malloc=$withval
+# Check whether --with-afs or --without-afs was given.
+if test "${with_afs+set}" = set; then
+  withval="$with_afs"
+  opt_afs=$withval
+fi
+
+# Check whether --with-curses or --without-curses was given.
+if test "${with_curses+set}" = set; then
+  withval="$with_curses"
+  opt_curses=$withval
 fi
 
 # Check whether --with-glibc-malloc or --without-glibc-malloc was given.
@@ -713,33 +734,46 @@ if test "${with_glibc_malloc+set}" = set; then
   opt_glibc_malloc=$withval
 fi
 
+# Check whether --with-gnu-malloc or --without-gnu-malloc was given.
+if test "${with_gnu_malloc+set}" = set; then
+  withval="$with_gnu_malloc"
+  opt_gnu_malloc=$withval
+fi
+
+# Check whether --with-purecov or --without-purecov was given.
+if test "${with_purecov+set}" = set; then
+  withval="$with_purecov"
+  opt_purecov=$withval
+fi
+
 # Check whether --with-purify or --without-purify was given.
 if test "${with_purify+set}" = set; then
   withval="$with_purify"
   opt_purify=$withval
 fi
 
-# Check whether --with-afs or --without-afs was given.
-if test "${with_afs+set}" = set; then
-  withval="$with_afs"
-  opt_afs=$withval
-fi
-
 
 if test "$opt_glibc_malloc" = yes; then 
-       MALLOC=gmalloc.o MALLOC_SRC='$(ALLOC_LIBSRC)/gmalloc.c'
+       MALLOC_TARGET=gmalloc
+       MALLOC_SRC=gmalloc.c
 elif test "$opt_gnu_malloc" = yes; then
-       MALLOC=malloc.o MALLOC_SRC='$(ALLOC_LIBSRC)/malloc.c'
+       MALLOC_TARGET=malloc
+       MALLOC_SRC=malloc.c
 else
-       MALLOC= MALLOC_SRC=
+       MALLOC_TARGET=stubmalloc
+       MALLOC_SRC=stub.c
 fi
 
 if test "$opt_purify" = yes; then
-       PURIFY=purify
+       PURIFY="purify "
 else
        PURIFY=
 fi
 
+if test "$opt_purecov" = yes; then
+       PURIFY="${PURIFY}purecov"
+fi
+
 if test "$opt_afs" = yes; then
        cat >> confdefs.h <<\EOF
 #define AFS 1
@@ -747,6 +781,10 @@ EOF
 
 fi
 
+if test "$opt_curses" = yes; then
+       prefer_curses=yes
+fi
+
 opt_minimal_config=no
 
 opt_job_control=yes
@@ -782,28 +820,16 @@ if test $opt_minimal_config = yes; then
        opt_brace_expansion=no opt_disabled_builtins=no opt_command_timing=no
 fi
 
-# Check whether --enable-job-control or --disable-job-control was given.
-if test "${enable_job_control+set}" = set; then
-  enableval="$enable_job_control"
-  opt_job_control=$enableval
-fi
-
 # Check whether --enable-alias or --disable-alias was given.
 if test "${enable_alias+set}" = set; then
   enableval="$enable_alias"
   opt_alias=$enableval
 fi
 
-# Check whether --enable-readline or --disable-readline was given.
-if test "${enable_readline+set}" = set; then
-  enableval="$enable_readline"
-  opt_readline=$enableval
-fi
-
-# Check whether --enable-history or --disable-history was given.
-if test "${enable_history+set}" = set; then
-  enableval="$enable_history"
-  opt_history=$enableval
+# Check whether --enable-array-variables or --disable-array-variables was given.
+if test "${enable_array_variables+set}" = set; then
+  enableval="$enable_array_variables"
+  opt_array_variables=$enableval
 fi
 
 # Check whether --enable-bang-history or --disable-bang-history was given.
@@ -812,34 +838,34 @@ if test "${enable_bang_history+set}" = set; then
   opt_bang_history=$enableval
 fi
 
-# Check whether --enable-directory-stack or --disable-directory-stack was given.
-if test "${enable_directory_stack+set}" = set; then
-  enableval="$enable_directory_stack"
-  opt_dirstack=$enableval
+# Check whether --enable-brace-expansion or --disable-brace-expansion was given.
+if test "${enable_brace_expansion+set}" = set; then
+  enableval="$enable_brace_expansion"
+  opt_brace_expansion=$enableval
 fi
 
-# Check whether --enable-restricted or --disable-restricted was given.
-if test "${enable_restricted+set}" = set; then
-  enableval="$enable_restricted"
-  opt_restricted=$enableval
+# Check whether --enable-command-timing or --disable-command-timing was given.
+if test "${enable_command_timing+set}" = set; then
+  enableval="$enable_command_timing"
+  opt_command_timing=$enableval
 fi
 
-# Check whether --enable-process-substitution or --disable-process-substitution was given.
-if test "${enable_process_substitution+set}" = set; then
-  enableval="$enable_process_substitution"
-  opt_process_subst=$enableval
+# Check whether --enable-directory-stack or --disable-directory-stack was given.
+if test "${enable_directory_stack+set}" = set; then
+  enableval="$enable_directory_stack"
+  opt_dirstack=$enableval
 fi
 
-# Check whether --enable-prompt-string-decoding or --disable-prompt-string-decoding was given.
-if test "${enable_prompt_string_decoding+set}" = set; then
-  enableval="$enable_prompt_string_decoding"
-  opt_prompt_decoding=$enableval
+# Check whether --enable-disabled-builtins or --disable-disabled-builtins was given.
+if test "${enable_disabled_builtins+set}" = set; then
+  enableval="$enable_disabled_builtins"
+  opt_disabled_builtins=$enableval
 fi
 
-# Check whether --enable-select or --disable-select was given.
-if test "${enable_select+set}" = set; then
-  enableval="$enable_select"
-  opt_select=$enableval
+# Check whether --enable-dparen-arithmetic or --disable-dparen-arithmetic was given.
+if test "${enable_dparen_arithmetic+set}" = set; then
+  enableval="$enable_dparen_arithmetic"
+  opt_dparen_arith=$enableval
 fi
 
 # Check whether --enable-help-builtin or --disable-help-builtin was given.
@@ -848,34 +874,46 @@ if test "${enable_help_builtin+set}" = set; then
   opt_help=$enableval
 fi
 
-# Check whether --enable-array-variables or --disable-array-variables was given.
-if test "${enable_array_variables+set}" = set; then
-  enableval="$enable_array_variables"
-  opt_array_variables=$enableval
+# Check whether --enable-history or --disable-history was given.
+if test "${enable_history+set}" = set; then
+  enableval="$enable_history"
+  opt_history=$enableval
 fi
 
-# Check whether --enable-dparen-arithmetic or --disable-dparen-arithmetic was given.
-if test "${enable_dparen_arithmetic+set}" = set; then
-  enableval="$enable_dparen_arithmetic"
-  opt_dparen_arith=$enableval
+# Check whether --enable-job-control or --disable-job-control was given.
+if test "${enable_job_control+set}" = set; then
+  enableval="$enable_job_control"
+  opt_job_control=$enableval
 fi
 
-# Check whether --enable-brace-expansion or --disable-brace-expansion was given.
-if test "${enable_brace_expansion+set}" = set; then
-  enableval="$enable_brace_expansion"
-  opt_brace_expansion=$enableval
+# Check whether --enable-process-substitution or --disable-process-substitution was given.
+if test "${enable_process_substitution+set}" = set; then
+  enableval="$enable_process_substitution"
+  opt_process_subst=$enableval
 fi
 
-# Check whether --enable-disabled-builtins or --disable-disabled-builtins was given.
-if test "${enable_disabled_builtins+set}" = set; then
-  enableval="$enable_disabled_builtins"
-  opt_disabled_builtins=$enableval
+# Check whether --enable-prompt-string-decoding or --disable-prompt-string-decoding was given.
+if test "${enable_prompt_string_decoding+set}" = set; then
+  enableval="$enable_prompt_string_decoding"
+  opt_prompt_decoding=$enableval
 fi
 
-# Check whether --enable-command-timing or --disable-command-timing was given.
-if test "${enable_command_timing+set}" = set; then
-  enableval="$enable_command_timing"
-  opt_command_timing=$enableval
+# Check whether --enable-readline or --disable-readline was given.
+if test "${enable_readline+set}" = set; then
+  enableval="$enable_readline"
+  opt_readline=$enableval
+fi
+
+# Check whether --enable-restricted or --disable-restricted was given.
+if test "${enable_restricted+set}" = set; then
+  enableval="$enable_restricted"
+  opt_restricted=$enableval
+fi
+
+# Check whether --enable-select or --disable-select was given.
+if test "${enable_select+set}" = set; then
+  enableval="$enable_select"
+  opt_select=$enableval
 fi
 
 # Check whether --enable-usg-echo-default or --disable-usg-echo-default was given.
@@ -995,6 +1033,13 @@ EOF
 
 fi
 
+if test "$opt_minimal_config" = yes; then
+       TESTSCRIPT=run-minimal
+else
+       TESTSCRIPT=run-all
+fi
+
+
 
 
 
@@ -1003,12 +1048,15 @@ fi
 
 
 
-echo "Beginning configuration for bash-2.0"
+BASHVERS=2.01
+BASHPATCH=0
+
+echo "Beginning configuration for bash-$BASHVERS"
 
 # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1012: checking for $ac_word" >&5
+echo "configure:1060: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1037,7 +1085,7 @@ if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1041: checking for $ac_word" >&5
+echo "configure:1089: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1085,7 +1133,7 @@ fi
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1089: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1137: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -1095,11 +1143,11 @@ ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS
 cross_compiling=$ac_cv_prog_cc_cross
 
 cat > conftest.$ac_ext <<EOF
-#line 1099 "configure"
+#line 1147 "configure"
 #include "confdefs.h"
 main(){return(0);}
 EOF
-if { (eval echo configure:1103: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1151: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -1119,12 +1167,12 @@ if test $ac_cv_prog_cc_works = no; then
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:1123: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1171: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:1128: checking whether we are using GNU C" >&5
+echo "configure:1176: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1133,7 +1181,7 @@ else
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1137: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1185: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -1148,7 +1196,7 @@ if test $ac_cv_prog_gcc = yes; then
   ac_save_CFLAGS="$CFLAGS"
   CFLAGS=
   echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1152: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1200: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1176,7 +1224,7 @@ else
 fi
 
 echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
-echo "configure:1180: checking for POSIXized ISC" >&5
+echo "configure:1228: checking for POSIXized ISC" >&5
 if test -d /etc/conf/kconfig.d &&
   grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
 then
@@ -1197,7 +1245,7 @@ else
 fi
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1201: checking how to run the C preprocessor" >&5
+echo "configure:1249: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -1212,13 +1260,13 @@ else
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 1216 "configure"
+#line 1264 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1222: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1270: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -1229,13 +1277,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 1233 "configure"
+#line 1281 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1239: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1287: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -1259,17 +1307,17 @@ echo "$ac_t""$CPP" 1>&6
 
 ac_safe=`echo "minix/config.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for minix/config.h""... $ac_c" 1>&6
-echo "configure:1263: checking for minix/config.h" >&5
+echo "configure:1311: checking for minix/config.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1268 "configure"
+#line 1316 "configure"
 #include "confdefs.h"
 #include <minix/config.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1273: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1321: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1307,41 +1355,6 @@ EOF
 fi
 
 
-echo $ac_n "checking whether CC works at all""... $ac_c" 1>&6
-echo "configure:1312: checking whether CC works at all" >&5
-if eval "test \"`echo '$''{'bash_cv_prog_cc_works'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test "$cross_compiling" = yes; then
-  bash_cv_prog_cc_works=no
-else
-  cat > conftest.$ac_ext <<EOF
-#line 1320 "configure"
-#include "confdefs.h"
-main() { exit(0); }
-EOF
-if { (eval echo configure:1324: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
-then
-  bash_cv_prog_cc_works=yes
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -fr conftest*
-  bash_cv_prog_cc_works=no
-fi
-rm -fr conftest*
-fi
-
-       
-
-fi
-
-echo "$ac_t""$bash_cv_prog_cc_works" 1>&6
-if test "$bash_cv_prog_cc_works" = "no"; then
-{ echo "configure: error: Installation or configuration problem: C compiler cannot create executables" 1>&2; exit 1; }
-fi
-
-
 test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1
 
 test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O2"
@@ -1352,13 +1365,13 @@ test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O2"
 
 if test $ac_cv_prog_gcc = yes; then
     echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:1356: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:1369: checking whether ${CC-cc} needs -traditional" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
     ac_pattern="Autoconf.*'x'"
   cat > conftest.$ac_ext <<EOF
-#line 1362 "configure"
+#line 1375 "configure"
 #include "confdefs.h"
 #include <sgtty.h>
 Autoconf TIOCGETP
@@ -1376,7 +1389,7 @@ rm -f conftest*
 
   if test $ac_cv_prog_gcc_traditional = no; then
     cat > conftest.$ac_ext <<EOF
-#line 1380 "configure"
+#line 1393 "configure"
 #include "confdefs.h"
 #include <termio.h>
 Autoconf TCGETA
@@ -1409,7 +1422,7 @@ fi
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:1413: checking for a BSD compatible install" >&5
+echo "configure:1426: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1461,7 +1474,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 # Extract the first word of "ar", so it can be a program name with args.
 set dummy ar; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1465: checking for $ac_word" >&5
+echo "configure:1478: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1489,7 +1502,7 @@ fi
 # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1493: checking for $ac_word" >&5
+echo "configure:1506: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1520,7 +1533,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1524: checking for $ac_word" >&5
+echo "configure:1537: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1550,7 +1563,7 @@ done
 test -n "$YACC" || YACC="yacc"
 
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:1554: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:1567: checking whether ${MAKE-make} sets \${MAKE}" >&5
 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1580,19 +1593,19 @@ fi
 # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
 # for constant arguments.  Useless!
 echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
-echo "configure:1584: checking for working alloca.h" >&5
+echo "configure:1597: checking for working alloca.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1589 "configure"
+#line 1602 "configure"
 #include "confdefs.h"
 #include <alloca.h>
 int main() {
 char *p = alloca(2 * sizeof(int));
 ; return 0; }
 EOF
-if { (eval echo configure:1596: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1609: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ac_cv_header_alloca_h=yes
 else
@@ -1613,12 +1626,12 @@ EOF
 fi
 
 echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:1617: checking for alloca" >&5
+echo "configure:1630: checking for alloca" >&5
 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1622 "configure"
+#line 1635 "configure"
 #include "confdefs.h"
 
 #ifdef __GNUC__
@@ -1641,7 +1654,7 @@ int main() {
 char *p = (char *) alloca(1);
 ; return 0; }
 EOF
-if { (eval echo configure:1645: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1658: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ac_cv_func_alloca_works=yes
 else
@@ -1673,12 +1686,12 @@ EOF
 
 
 echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:1677: checking whether alloca needs Cray hooks" >&5
+echo "configure:1690: checking whether alloca needs Cray hooks" >&5
 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1682 "configure"
+#line 1695 "configure"
 #include "confdefs.h"
 #if defined(CRAY) && ! defined(CRAY2)
 webecray
@@ -1703,12 +1716,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6
 if test $ac_cv_os_cray = yes; then
 for ac_func in _getb67 GETB67 getb67; do
   echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1707: checking for $ac_func" >&5
+echo "configure:1720: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1712 "configure"
+#line 1725 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1731,7 +1744,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1735: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1748: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -1758,7 +1771,7 @@ done
 fi
 
 echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:1762: checking stack direction for C alloca" >&5
+echo "configure:1775: checking stack direction for C alloca" >&5
 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1766,7 +1779,7 @@ else
   ac_cv_c_stack_direction=0
 else
   cat > conftest.$ac_ext <<EOF
-#line 1770 "configure"
+#line 1783 "configure"
 #include "confdefs.h"
 find_stack_direction ()
 {
@@ -1785,7 +1798,7 @@ main ()
   exit (find_stack_direction() < 0);
 }
 EOF
-if { (eval echo configure:1789: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1802: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   ac_cv_c_stack_direction=1
 else
@@ -1807,7 +1820,7 @@ EOF
 fi
 
 echo $ac_n "checking whether getpgrp takes no argument""... $ac_c" 1>&6
-echo "configure:1811: checking whether getpgrp takes no argument" >&5
+echo "configure:1824: checking whether getpgrp takes no argument" >&5
 if eval "test \"`echo '$''{'ac_cv_func_getpgrp_void'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1815,7 +1828,7 @@ else
   { echo "configure: error: cannot check getpgrp if cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 1819 "configure"
+#line 1832 "configure"
 #include "confdefs.h"
 
 /*
@@ -1870,7 +1883,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:1874: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1887: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_getpgrp_void=yes
 else
@@ -1894,7 +1907,7 @@ EOF
 fi
 
 echo $ac_n "checking whether setvbuf arguments are reversed""... $ac_c" 1>&6
-echo "configure:1898: checking whether setvbuf arguments are reversed" >&5
+echo "configure:1911: checking whether setvbuf arguments are reversed" >&5
 if eval "test \"`echo '$''{'ac_cv_func_setvbuf_reversed'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1902,7 +1915,7 @@ else
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 1906 "configure"
+#line 1919 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 /* If setvbuf has the reversed format, exit 0. */
@@ -1916,7 +1929,7 @@ main () {
   exit(0);                     /* Non-reversed systems segv here.  */
 }
 EOF
-if { (eval echo configure:1920: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1933: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_setvbuf_reversed=yes
 else
@@ -1940,12 +1953,12 @@ EOF
 fi
 
 echo $ac_n "checking for vprintf""... $ac_c" 1>&6
-echo "configure:1944: checking for vprintf" >&5
+echo "configure:1957: checking for vprintf" >&5
 if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1949 "configure"
+#line 1962 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char vprintf(); below.  */
@@ -1968,7 +1981,7 @@ vprintf();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1972: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1985: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_vprintf=yes"
 else
@@ -1992,12 +2005,12 @@ fi
 
 if test "$ac_cv_func_vprintf" != yes; then
 echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
-echo "configure:1996: checking for _doprnt" >&5
+echo "configure:2009: checking for _doprnt" >&5
 if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2001 "configure"
+#line 2014 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char _doprnt(); below.  */
@@ -2020,7 +2033,7 @@ _doprnt();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2024: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2037: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func__doprnt=yes"
 else
@@ -2045,7 +2058,7 @@ fi
 fi
 
 echo $ac_n "checking for wait3 that fills in rusage""... $ac_c" 1>&6
-echo "configure:2049: checking for wait3 that fills in rusage" >&5
+echo "configure:2062: checking for wait3 that fills in rusage" >&5
 if eval "test \"`echo '$''{'ac_cv_func_wait3_rusage'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2053,7 +2066,7 @@ else
   ac_cv_func_wait3_rusage=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 2057 "configure"
+#line 2070 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -2084,7 +2097,7 @@ main() {
   }
 }
 EOF
-if { (eval echo configure:2088: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2101: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_wait3_rusage=yes
 else
@@ -2107,7 +2120,7 @@ EOF
 fi
 
 echo $ac_n "checking for working strcoll""... $ac_c" 1>&6
-echo "configure:2111: checking for working strcoll" >&5
+echo "configure:2124: checking for working strcoll" >&5
 if eval "test \"`echo '$''{'ac_cv_func_strcoll_works'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2115,7 +2128,7 @@ else
   ac_cv_func_strcoll_works=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 2119 "configure"
+#line 2132 "configure"
 #include "confdefs.h"
 #include <string.h>
 main ()
@@ -2125,7 +2138,7 @@ main ()
        strcoll ("123", "456") >= 0);
 }
 EOF
-if { (eval echo configure:2129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2142: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_strcoll_works=yes
 else
@@ -2150,9 +2163,9 @@ fi
 
 if test "$ac_cv_func_vprintf" = no; then
     echo $ac_n "checking for declaration of vprintf in stdio.h""... $ac_c" 1>&6
-echo "configure:2154: checking for declaration of vprintf in stdio.h" >&5
+echo "configure:2167: checking for declaration of vprintf in stdio.h" >&5
     cat > conftest.$ac_ext <<EOF
-#line 2156 "configure"
+#line 2169 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 EOF
@@ -2173,12 +2186,12 @@ EOF
 fi
 
 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:2177: checking return type of signal handlers" >&5
+echo "configure:2190: checking return type of signal handlers" >&5
 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2182 "configure"
+#line 2195 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -2195,7 +2208,7 @@ int main() {
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:2199: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2212: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_type_signal=void
 else
@@ -2215,12 +2228,12 @@ EOF
 
 
 echo $ac_n "checking for __setostype""... $ac_c" 1>&6
-echo "configure:2219: checking for __setostype" >&5
+echo "configure:2232: checking for __setostype" >&5
 if eval "test \"`echo '$''{'ac_cv_func___setostype'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2224 "configure"
+#line 2237 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char __setostype(); below.  */
@@ -2243,7 +2256,7 @@ __setostype();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2247: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2260: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func___setostype=yes"
 else
@@ -2266,12 +2279,12 @@ else
 fi
 
 echo $ac_n "checking for wait3""... $ac_c" 1>&6
-echo "configure:2270: checking for wait3" >&5
+echo "configure:2283: checking for wait3" >&5
 if eval "test \"`echo '$''{'ac_cv_func_wait3'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2275 "configure"
+#line 2288 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char wait3(); below.  */
@@ -2294,7 +2307,7 @@ wait3();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2298: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2311: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_wait3=yes"
 else
@@ -2318,12 +2331,12 @@ fi
 
 
 echo $ac_n "checking for mkfifo""... $ac_c" 1>&6
-echo "configure:2322: checking for mkfifo" >&5
+echo "configure:2335: checking for mkfifo" >&5
 if eval "test \"`echo '$''{'ac_cv_func_mkfifo'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2327 "configure"
+#line 2340 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char mkfifo(); below.  */
@@ -2346,7 +2359,7 @@ mkfifo();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2350: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2363: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_mkfifo=yes"
 else
@@ -2378,12 +2391,12 @@ for ac_func in dup2 select getdtablesize getgroups gethostname \
                getrlimit getrusage gettimeofday waitpid tcgetpgrp
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2382: checking for $ac_func" >&5
+echo "configure:2395: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2387 "configure"
+#line 2400 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2406,7 +2419,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2410: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2423: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -2436,12 +2449,12 @@ for ac_func in bcopy bzero confstr getcwd strcasecmp setenv putenv \
                sysconf ulimit times tzset siginterrupt memmove
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2440: checking for $ac_func" >&5
+echo "configure:2453: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2445 "configure"
+#line 2458 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2464,7 +2477,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2468: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2481: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -2493,17 +2506,17 @@ for ac_hdr in libintl.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2497: checking for $ac_hdr" >&5
+echo "configure:2510: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2502 "configure"
+#line 2515 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2507: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2520: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2532,12 +2545,12 @@ done
 for ac_func in gettext textdomain bindtextdomain
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2536: checking for $ac_func" >&5
+echo "configure:2549: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2541 "configure"
+#line 2554 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2560,7 +2573,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2564: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2577: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -2587,7 +2600,7 @@ done
 
 if test "$ac_cv_func_bindtextdomain" = "no"; then
     echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6
-echo "configure:2591: checking for bindtextdomain in -lintl" >&5
+echo "configure:2604: checking for bindtextdomain in -lintl" >&5
 ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2595,7 +2608,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lintl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2599 "configure"
+#line 2612 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2606,7 +2619,7 @@ int main() {
 bindtextdomain()
 ; return 0; }
 EOF
-if { (eval echo configure:2610: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2623: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2637,12 +2650,12 @@ fi
        for ac_func in gettext textdomain bindtextdomain
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2641: checking for $ac_func" >&5
+echo "configure:2654: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2646 "configure"
+#line 2659 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2665,7 +2678,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2669: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2682: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -2693,7 +2706,7 @@ done
 fi
 
 echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:2697: checking for dlopen in -ldl" >&5
+echo "configure:2710: checking for dlopen in -ldl" >&5
 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2701,7 +2714,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2705 "configure"
+#line 2718 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2712,7 +2725,7 @@ int main() {
 dlopen()
 ; return 0; }
 EOF
-if { (eval echo configure:2716: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2729: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2742,12 +2755,12 @@ fi
 for ac_func in dlopen dlclose dlsym
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2746: checking for $ac_func" >&5
+echo "configure:2759: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2751 "configure"
+#line 2764 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2770,7 +2783,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2774: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2787: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -2796,12 +2809,12 @@ done
 
 
 echo $ac_n "checking for sys_siglist declaration in signal.h or unistd.h""... $ac_c" 1>&6
-echo "configure:2800: checking for sys_siglist declaration in signal.h or unistd.h" >&5
+echo "configure:2813: checking for sys_siglist declaration in signal.h or unistd.h" >&5
 if eval "test \"`echo '$''{'ac_cv_decl_sys_siglist'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2805 "configure"
+#line 2818 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -2813,7 +2826,7 @@ int main() {
 char *msg = *(sys_siglist + 1);
 ; return 0; }
 EOF
-if { (eval echo configure:2817: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_decl_sys_siglist=yes
 else
@@ -2839,12 +2852,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
-echo "configure:2843: checking for $ac_hdr that defines DIR" >&5
+echo "configure:2856: checking for $ac_hdr that defines DIR" >&5
 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2848 "configure"
+#line 2861 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <$ac_hdr>
@@ -2852,7 +2865,7 @@ int main() {
 DIR *dirp = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:2856: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2869: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   eval "ac_cv_header_dirent_$ac_safe=yes"
 else
@@ -2877,7 +2890,7 @@ done
 # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
 if test $ac_header_dirent = dirent.h; then
 echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
-echo "configure:2881: checking for opendir in -ldir" >&5
+echo "configure:2894: checking for opendir in -ldir" >&5
 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2885,7 +2898,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldir  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2889 "configure"
+#line 2902 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2896,7 +2909,7 @@ int main() {
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:2900: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2913: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2918,7 +2931,7 @@ fi
 
 else
 echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:2922: checking for opendir in -lx" >&5
+echo "configure:2935: checking for opendir in -lx" >&5
 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2926,7 +2939,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lx  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2930 "configure"
+#line 2943 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2937,7 +2950,7 @@ int main() {
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:2941: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2954: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2960,12 +2973,12 @@ fi
 fi
 
 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:2964: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:2977: checking whether time.h and sys/time.h may both be included" >&5
 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2969 "configure"
+#line 2982 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -2974,7 +2987,7 @@ int main() {
 struct tm *tp;
 ; return 0; }
 EOF
-if { (eval echo configure:2978: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2991: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_time=yes
 else
@@ -2996,21 +3009,21 @@ fi
 
 
 for ac_hdr in unistd.h stdlib.h stdarg.h varargs.h limits.h string.h \
-                memory.h locale.h termcap.h termio.h termios.h
+                memory.h locale.h termcap.h termio.h termios.h dlfcn.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3004: checking for $ac_hdr" >&5
+echo "configure:3017: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3009 "configure"
+#line 3022 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3014: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3027: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3042,17 +3055,17 @@ for ac_hdr in sys/ptem.h sys/pte.h sys/stream.h sys/select.h sys/file.h \
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3046: checking for $ac_hdr" >&5
+echo "configure:3059: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3051 "configure"
+#line 3064 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3056: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3069: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3079,19 +3092,20 @@ fi
 done
 
 
-
+if test "$ac_cv_func_getpeername" = no; then
+       
 if test "X$bash_cv_have_socklib" = "X"; then
 _bash_needmsg=
 else
 echo $ac_n "checking for socket library""... $ac_c" 1>&6
-echo "configure:3088: checking for socket library" >&5
+echo "configure:3102: checking for socket library" >&5
 _bash_needmsg=yes
 fi
 if eval "test \"`echo '$''{'bash_cv_have_socklib'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   echo $ac_n "checking for getpeername in -lsocket""... $ac_c" 1>&6
-echo "configure:3095: checking for getpeername in -lsocket" >&5
+echo "configure:3109: checking for getpeername in -lsocket" >&5
 ac_lib_var=`echo socket'_'getpeername | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3099,7 +3113,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket -lnsl $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3103 "configure"
+#line 3117 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3110,7 +3124,7 @@ int main() {
 getpeername()
 ; return 0; }
 EOF
-if { (eval echo configure:3114: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3128: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3143,14 +3157,14 @@ if test $bash_cv_have_socklib = yes; then
     _bash_needmsg=
   else
     echo $ac_n "checking for libnsl""... $ac_c" 1>&6
-echo "configure:3147: checking for libnsl" >&5
+echo "configure:3161: checking for libnsl" >&5
     _bash_needmsg=yes
   fi
   if eval "test \"`echo '$''{'bash_cv_have_libnsl'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   echo $ac_n "checking for t_open in -lnsl""... $ac_c" 1>&6
-echo "configure:3154: checking for t_open in -lnsl" >&5
+echo "configure:3168: checking for t_open in -lnsl" >&5
 ac_lib_var=`echo nsl'_'t_open | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3158,7 +3172,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3162 "configure"
+#line 3176 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3169,7 +3183,7 @@ int main() {
 t_open()
 ; return 0; }
 EOF
-if { (eval echo configure:3173: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3187: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3211,14 +3225,15 @@ EOF
 
 fi
 
+fi
 
 echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:3217: checking for uid_t in sys/types.h" >&5
+echo "configure:3232: checking for uid_t in sys/types.h" >&5
 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3222 "configure"
+#line 3237 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 EOF
@@ -3247,7 +3262,7 @@ EOF
 fi
 
 echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6
-echo "configure:3251: checking type of array argument to getgroups" >&5
+echo "configure:3266: checking type of array argument to getgroups" >&5
 if eval "test \"`echo '$''{'ac_cv_type_getgroups'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3255,7 +3270,7 @@ else
   ac_cv_type_getgroups=cross
 else
   cat > conftest.$ac_ext <<EOF
-#line 3259 "configure"
+#line 3274 "configure"
 #include "confdefs.h"
 
 /* Thanks to Mike Rendell for this test.  */
@@ -3280,7 +3295,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:3284: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3299: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
     ac_cv_type_getgroups=gid_t
 else
@@ -3294,7 +3309,7 @@ fi
 
 if test $ac_cv_type_getgroups = cross; then
         cat > conftest.$ac_ext <<EOF
-#line 3298 "configure"
+#line 3313 "configure"
 #include "confdefs.h"
 #include <unistd.h>
 EOF
@@ -3318,12 +3333,12 @@ EOF
 
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:3322: checking for ANSI C header files" >&5
+echo "configure:3337: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3327 "configure"
+#line 3342 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -3331,7 +3346,7 @@ else
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3335: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3350: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3348,7 +3363,7 @@ rm -f conftest*
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 3352 "configure"
+#line 3367 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -3366,7 +3381,7 @@ fi
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 3370 "configure"
+#line 3385 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -3387,7 +3402,7 @@ if test "$cross_compiling" = yes; then
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 3391 "configure"
+#line 3406 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -3398,7 +3413,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
 exit (0); }
 
 EOF
-if { (eval echo configure:3402: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3417: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -3422,12 +3437,12 @@ EOF
 fi
 
 echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:3426: checking for off_t" >&5
+echo "configure:3441: checking for off_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3431 "configure"
+#line 3446 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -3455,12 +3470,12 @@ EOF
 fi
 
 echo $ac_n "checking for mode_t""... $ac_c" 1>&6
-echo "configure:3459: checking for mode_t" >&5
+echo "configure:3474: checking for mode_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3464 "configure"
+#line 3479 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -3488,12 +3503,12 @@ EOF
 fi
 
 echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:3492: checking for uid_t in sys/types.h" >&5
+echo "configure:3507: checking for uid_t in sys/types.h" >&5
 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3497 "configure"
+#line 3512 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 EOF
@@ -3522,12 +3537,12 @@ EOF
 fi
 
 echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:3526: checking for pid_t" >&5
+echo "configure:3541: checking for pid_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3531 "configure"
+#line 3546 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -3555,12 +3570,12 @@ EOF
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:3559: checking for size_t" >&5
+echo "configure:3574: checking for size_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3564 "configure"
+#line 3579 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -3588,12 +3603,12 @@ EOF
 fi
 
 echo $ac_n "checking for time_t""... $ac_c" 1>&6
-echo "configure:3592: checking for time_t" >&5
+echo "configure:3607: checking for time_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_time_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3597 "configure"
+#line 3612 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -3622,12 +3637,12 @@ fi
 
 
 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:3626: checking return type of signal handlers" >&5
+echo "configure:3641: checking return type of signal handlers" >&5
 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3631 "configure"
+#line 3646 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -3644,7 +3659,7 @@ int main() {
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:3648: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3663: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_type_signal=void
 else
@@ -3664,12 +3679,12 @@ EOF
 
 
 echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6
-echo "configure:3668: checking whether stat file-mode macros are broken" >&5
+echo "configure:3683: checking whether stat file-mode macros are broken" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3673 "configure"
+#line 3688 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -3720,7 +3735,7 @@ EOF
 fi
 
 cat > conftest.$ac_ext <<EOF
-#line 3724 "configure"
+#line 3739 "configure"
 #include "confdefs.h"
 #include <sys/time.h>
 EOF
@@ -3733,7 +3748,7 @@ rm -f conftest*
 
 if test -z "$bash_cv_struct_timeval"; then
 cat > conftest.$ac_ext <<EOF
-#line 3737 "configure"
+#line 3752 "configure"
 #include "confdefs.h"
 #include <time.h>
 EOF
@@ -3756,14 +3771,14 @@ EOF
 fi
 
 echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:3760: checking whether byte ordering is bigendian" >&5
+echo "configure:3775: checking whether byte ordering is bigendian" >&5
 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_cv_c_bigendian=unknown
 # See if sys/param.h defines the BYTE_ORDER macro.
 cat > conftest.$ac_ext <<EOF
-#line 3767 "configure"
+#line 3782 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/param.h>
@@ -3774,11 +3789,11 @@ int main() {
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:3778: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3793: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   # It does; now see whether it defined to BIG_ENDIAN or not.
 cat > conftest.$ac_ext <<EOF
-#line 3782 "configure"
+#line 3797 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/param.h>
@@ -3789,7 +3804,7 @@ int main() {
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:3793: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3808: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_bigendian=yes
 else
@@ -3809,7 +3824,7 @@ if test "$cross_compiling" = yes; then
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 3813 "configure"
+#line 3828 "configure"
 #include "confdefs.h"
 main () {
   /* Are we little or big endian?  From Harbison&Steele.  */
@@ -3822,7 +3837,7 @@ main () {
   exit (u.c[sizeof (long) - 1] == 1);
 }
 EOF
-if { (eval echo configure:3826: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3841: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   ac_cv_c_bigendian=no
 else
@@ -3849,7 +3864,7 @@ fi
 # Pull the hash mark out of the macro call to avoid m4 problems.
 ac_msg="whether #! works in shell scripts"
 echo $ac_n "checking $ac_msg""... $ac_c" 1>&6
-echo "configure:3853: checking $ac_msg" >&5
+echo "configure:3868: checking $ac_msg" >&5
 if eval "test \"`echo '$''{'ac_cv_sys_interpreter'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3875,7 +3890,7 @@ EOF
 
 fi
 echo $ac_n "checking for restartable system calls""... $ac_c" 1>&6
-echo "configure:3879: checking for restartable system calls" >&5
+echo "configure:3894: checking for restartable system calls" >&5
 if eval "test \"`echo '$''{'ac_cv_sys_restartable_syscalls'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3883,7 +3898,7 @@ else
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 3887 "configure"
+#line 3902 "configure"
 #include "confdefs.h"
 /* Exit 0 (true) if wait returns something other than -1,
    i.e. the pid of the child, which means that wait was restarted
@@ -3901,7 +3916,7 @@ main () {
 }
 
 EOF
-if { (eval echo configure:3905: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3920: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sys_restartable_syscalls=yes
 else
@@ -3926,12 +3941,12 @@ fi
 
 if test "$ac_cv_func_lstat" = "no"; then
 echo $ac_n "checking for lstat""... $ac_c" 1>&6
-echo "configure:3930: checking for lstat" >&5
+echo "configure:3945: checking for lstat" >&5
 if eval "test \"`echo '$''{'bash_cv_func_lstat'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3935 "configure"
+#line 3950 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -3941,7 +3956,7 @@ int main() {
  lstat("",(struct stat *)0); 
 ; return 0; }
 EOF
-if { (eval echo configure:3945: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3960: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   bash_cv_func_lstat=yes
 else
@@ -3964,7 +3979,7 @@ fi
 fi
 
 echo $ac_n "checking if dup2 fails to clear the close-on-exec flag""... $ac_c" 1>&6
-echo "configure:3968: checking if dup2 fails to clear the close-on-exec flag" >&5
+echo "configure:3983: checking if dup2 fails to clear the close-on-exec flag" >&5
 if eval "test \"`echo '$''{'bash_cv_dup2_broken'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3972,7 +3987,7 @@ else
   { echo "configure: error: cannot check dup2 if cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 3976 "configure"
+#line 3991 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -3992,7 +4007,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:3996: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4011: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   bash_cv_dup2_broken=yes
 else
@@ -4017,7 +4032,7 @@ fi
 
 
 echo $ac_n "checking whether pgrps need synchronization""... $ac_c" 1>&6
-echo "configure:4021: checking whether pgrps need synchronization" >&5
+echo "configure:4036: checking whether pgrps need synchronization" >&5
 if eval "test \"`echo '$''{'bash_cv_pgrp_pipe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4025,7 +4040,7 @@ else
   { echo "configure: error: cannot check pgrp synchronization if cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 4029 "configure"
+#line 4044 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_UNISTD_H
@@ -4077,7 +4092,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:4081: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4096: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   bash_cv_pgrp_pipe=no
 else
@@ -4100,43 +4115,144 @@ EOF
 
 fi
 
-echo $ac_n "checking for sys_errlist and sys_nerr""... $ac_c" 1>&6
-echo "configure:4105: checking for sys_errlist and sys_nerr" >&5
-if eval "test \"`echo '$''{'bash_cv_sys_errlist'+set}'`\" = set"; then
+
+echo $ac_n "checking for type of signal functions""... $ac_c" 1>&6
+echo "configure:4121: checking for type of signal functions" >&5
+if eval "test \"`echo '$''{'bash_cv_signal_vintage'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
+  
   cat > conftest.$ac_ext <<EOF
-#line 4110 "configure"
+#line 4127 "configure"
 #include "confdefs.h"
-#include <errno.h>
+#include <signal.h>
 int main() {
-extern char *sys_errlist[];
- extern int sys_nerr;
- char *msg = sys_errlist[sys_nerr - 1];
+
+    sigset_t ss;
+    struct sigaction sa;
+    sigemptyset(&ss); sigsuspend(&ss);
+    sigaction(SIGINT, &sa, (struct sigaction *) 0);
+    sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0);
+  
 ; return 0; }
 EOF
-if { (eval echo configure:4119: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4140: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
-  bash_cv_sys_errlist=yes
+  bash_cv_signal_vintage=posix
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  bash_cv_sys_errlist=no
-fi
-rm -f conftest*
-fi
-echo "$ac_t""$bash_cv_sys_errlist" 1>&6
-if test $bash_cv_sys_errlist = yes; then
-cat >> confdefs.h <<\EOF
-#define HAVE_SYS_ERRLIST 1
-EOF
-
-fi
-
+  
+    cat > conftest.$ac_ext <<EOF
+#line 4149 "configure"
+#include "confdefs.h"
+#include <signal.h>
+int main() {
+
+       int mask = sigmask(SIGINT);
+       sigsetmask(mask); sigblock(mask); sigpause(mask);
+    
+; return 0; }
+EOF
+if { (eval echo configure:4159: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  bash_cv_signal_vintage=4.2bsd
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  
+      cat > conftest.$ac_ext <<EOF
+#line 4168 "configure"
+#include "confdefs.h"
+
+       #include <signal.h>
+       RETSIGTYPE foo() { }
+int main() {
+
+               int mask = sigmask(SIGINT);
+               sigset(SIGINT, foo); sigrelse(SIGINT);
+               sighold(SIGINT); sigpause(SIGINT);
+        
+; return 0; }
+EOF
+if { (eval echo configure:4181: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  bash_cv_signal_vintage=svr3
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  bash_cv_signal_vintage=v7
+    
+fi
+rm -f conftest*
+  
+fi
+rm -f conftest*
+
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$bash_cv_signal_vintage" 1>&6
+if test "$bash_cv_signal_vintage" = posix; then
+cat >> confdefs.h <<\EOF
+#define HAVE_POSIX_SIGNALS 1
+EOF
+
+elif test "$bash_cv_signal_vintage" = "4.2bsd"; then
+cat >> confdefs.h <<\EOF
+#define HAVE_BSD_SIGNALS 1
+EOF
+
+elif test "$bash_cv_signal_vintage" = svr3; then
+cat >> confdefs.h <<\EOF
+#define HAVE_USG_SIGHOLD 1
+EOF
+
+fi
+
+
+echo $ac_n "checking for sys_errlist and sys_nerr""... $ac_c" 1>&6
+echo "configure:4221: checking for sys_errlist and sys_nerr" >&5
+if eval "test \"`echo '$''{'bash_cv_sys_errlist'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 4226 "configure"
+#include "confdefs.h"
+#include <errno.h>
+int main() {
+extern char *sys_errlist[];
+ extern int sys_nerr;
+ char *msg = sys_errlist[sys_nerr - 1];
+; return 0; }
+EOF
+if { (eval echo configure:4235: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  bash_cv_sys_errlist=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  bash_cv_sys_errlist=no
+fi
+rm -f conftest*
+fi
+echo "$ac_t""$bash_cv_sys_errlist" 1>&6
+if test $bash_cv_sys_errlist = yes; then
+cat >> confdefs.h <<\EOF
+#define HAVE_SYS_ERRLIST 1
+EOF
+
+fi
+
 
 echo $ac_n "checking for sys_siglist in system C library""... $ac_c" 1>&6
-echo "configure:4140: checking for sys_siglist in system C library" >&5
+echo "configure:4256: checking for sys_siglist in system C library" >&5
 if eval "test \"`echo '$''{'bash_cv_sys_siglist'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4144,7 +4260,7 @@ else
   { echo "configure: error: cannot check for sys_siglist if cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 4148 "configure"
+#line 4264 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -4161,7 +4277,7 @@ char *msg = sys_siglist[2];
 exit(msg == 0);
 }
 EOF
-if { (eval echo configure:4165: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4281: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   bash_cv_sys_siglist=yes
 else
@@ -4183,7 +4299,7 @@ EOF
 fi
 
 echo $ac_n "checking for _sys_siglist in system C library""... $ac_c" 1>&6
-echo "configure:4187: checking for _sys_siglist in system C library" >&5
+echo "configure:4303: checking for _sys_siglist in system C library" >&5
 if eval "test \"`echo '$''{'bash_cv_under_sys_siglist'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4191,7 +4307,7 @@ else
   { echo "configure: error: cannot check for _sys_siglist if cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 4195 "configure"
+#line 4311 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -4208,7 +4324,7 @@ char *msg = _sys_siglist[2];
 exit(msg == 0);
 }
 EOF
-if { (eval echo configure:4212: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4328: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   bash_cv_under_sys_siglist=yes
 else
@@ -4230,112 +4346,13 @@ EOF
 fi
 
 
-echo $ac_n "checking for type of signal functions""... $ac_c" 1>&6
-echo "configure:4235: checking for type of signal functions" >&5
-if eval "test \"`echo '$''{'bash_cv_signal_vintage'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  
-  cat > conftest.$ac_ext <<EOF
-#line 4241 "configure"
-#include "confdefs.h"
-#include <signal.h>
-int main() {
-
-    sigset_t ss;
-    struct sigaction sa;
-    sigemptyset(&ss); sigsuspend(&ss);
-    sigaction(SIGINT, &sa, (struct sigaction *) 0);
-    sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0);
-  
-; return 0; }
-EOF
-if { (eval echo configure:4254: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
-  rm -rf conftest*
-  bash_cv_signal_vintage=posix
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  
-    cat > conftest.$ac_ext <<EOF
-#line 4263 "configure"
-#include "confdefs.h"
-#include <signal.h>
-int main() {
-
-       int mask = sigmask(SIGINT);
-       sigsetmask(mask); sigblock(mask); sigpause(mask);
-    
-; return 0; }
-EOF
-if { (eval echo configure:4273: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
-  rm -rf conftest*
-  bash_cv_signal_vintage=4.2bsd
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  
-      cat > conftest.$ac_ext <<EOF
-#line 4282 "configure"
-#include "confdefs.h"
-
-       #include <signal.h>
-       RETSIGTYPE foo() { }
-int main() {
-
-               int mask = sigmask(SIGINT);
-               sigset(SIGINT, foo); sigrelse(SIGINT);
-               sighold(SIGINT); sigpause(SIGINT);
-        
-; return 0; }
-EOF
-if { (eval echo configure:4295: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
-  rm -rf conftest*
-  bash_cv_signal_vintage=svr3
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  bash_cv_signal_vintage=v7
-    
-fi
-rm -f conftest*
-  
-fi
-rm -f conftest*
-
-fi
-rm -f conftest*
-
-fi
-
-echo "$ac_t""$bash_cv_signal_vintage" 1>&6
-if test "$bash_cv_signal_vintage" = posix; then
-cat >> confdefs.h <<\EOF
-#define HAVE_POSIX_SIGNALS 1
-EOF
-
-elif test "$bash_cv_signal_vintage" = "4.2bsd"; then
-cat >> confdefs.h <<\EOF
-#define HAVE_BSD_SIGNALS 1
-EOF
-
-elif test "$bash_cv_signal_vintage" = svr3; then
-cat >> confdefs.h <<\EOF
-#define HAVE_USG_SIGHOLD 1
-EOF
-
-fi
-
 echo $ac_n "checking whether signal handlers are of type void""... $ac_c" 1>&6
-echo "configure:4334: checking whether signal handlers are of type void" >&5
+echo "configure:4351: checking whether signal handlers are of type void" >&5
 if eval "test \"`echo '$''{'bash_cv_void_sighandler'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4339 "configure"
+#line 4356 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -4350,7 +4367,7 @@ int main() {
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:4354: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4371: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_void_sighandler=yes
 else
@@ -4370,12 +4387,12 @@ EOF
 fi
 
 echo $ac_n "checking for clock_t""... $ac_c" 1>&6
-echo "configure:4374: checking for clock_t" >&5
+echo "configure:4391: checking for clock_t" >&5
 if eval "test \"`echo '$''{'bash_cv_type_clock_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4379 "configure"
+#line 4396 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -4406,12 +4423,12 @@ EOF
 fi
 
 echo $ac_n "checking for sigset_t""... $ac_c" 1>&6
-echo "configure:4410: checking for sigset_t" >&5
+echo "configure:4427: checking for sigset_t" >&5
 if eval "test \"`echo '$''{'bash_cv_type_sigset_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4415 "configure"
+#line 4432 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -4442,12 +4459,12 @@ EOF
 fi
 
 echo $ac_n "checking for quad_t""... $ac_c" 1>&6
-echo "configure:4446: checking for quad_t" >&5
+echo "configure:4463: checking for quad_t" >&5
 if eval "test \"`echo '$''{'bash_cv_type_quad_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4451 "configure"
+#line 4468 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -4483,19 +4500,19 @@ EOF
 fi
 
 echo $ac_n "checking for size and type of struct rlimit fields""... $ac_c" 1>&6
-echo "configure:4487: checking for size and type of struct rlimit fields" >&5
+echo "configure:4504: checking for size and type of struct rlimit fields" >&5
 if eval "test \"`echo '$''{'bash_cv_type_rlimit'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4492 "configure"
+#line 4509 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 int main() {
 rlim_t xxx;
 ; return 0; }
 EOF
-if { (eval echo configure:4499: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4516: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_type_rlimit=rlim_t
 else
@@ -4507,7 +4524,7 @@ if test "$cross_compiling" = yes; then
   { echo "configure: error: cannot check quad_t if cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 4511 "configure"
+#line 4528 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -4523,7 +4540,7 @@ main()
   exit(1);
 }
 EOF
-if { (eval echo configure:4527: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4544: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   bash_cv_type_rlimit=quad_t
 else
@@ -4553,13 +4570,14 @@ EOF
 
 fi
 
+
 echo $ac_n "checking for a c_line member of struct termios""... $ac_c" 1>&6
-echo "configure:4558: checking for a c_line member of struct termios" >&5
+echo "configure:4576: checking for a c_line member of struct termios" >&5
 if eval "test \"`echo '$''{'bash_cv_termios_ldisc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4563 "configure"
+#line 4581 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <termios.h>
@@ -4567,7 +4585,7 @@ int main() {
 struct termios t; int i; i = t.c_line;
 ; return 0; }
 EOF
-if { (eval echo configure:4571: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4589: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_termios_ldisc=yes
 else
@@ -4587,12 +4605,12 @@ EOF
 fi
 
 echo $ac_n "checking for a c_line member of struct termio""... $ac_c" 1>&6
-echo "configure:4591: checking for a c_line member of struct termio" >&5
+echo "configure:4609: checking for a c_line member of struct termio" >&5
 if eval "test \"`echo '$''{'bash_cv_termio_ldisc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4596 "configure"
+#line 4614 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <termio.h>
@@ -4600,7 +4618,7 @@ int main() {
 struct termio t; int i; i = t.c_line;
 ; return 0; }
 EOF
-if { (eval echo configure:4604: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4622: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_termio_ldisc=yes
 else
@@ -4621,12 +4639,12 @@ fi
 
 
 echo $ac_n "checking if struct dirent has a d_ino member""... $ac_c" 1>&6
-echo "configure:4625: checking if struct dirent has a d_ino member" >&5
+echo "configure:4643: checking if struct dirent has a d_ino member" >&5
 if eval "test \"`echo '$''{'bash_cv_dirent_has_dino'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4630 "configure"
+#line 4648 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -4655,7 +4673,7 @@ struct dirent d; int z; z = d.d_ino;
 
 ; return 0; }
 EOF
-if { (eval echo configure:4659: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4677: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_dirent_has_dino=yes
 else
@@ -4675,13 +4693,104 @@ EOF
 
 fi
 
+
+echo $ac_n "checking if struct dirent has a d_fileno member""... $ac_c" 1>&6
+echo "configure:4699: checking if struct dirent has a d_fileno member" >&5
+if eval "test \"`echo '$''{'bash_cv_dirent_has_d_fileno'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 4704 "configure"
+#include "confdefs.h"
+
+#include <stdio.h>
+#include <sys/types.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif /* HAVE_UNISTD_H */
+#if defined(HAVE_DIRENT_H)
+# include <dirent.h>
+#else
+# define dirent direct
+# ifdef HAVE_SYS_NDIR_H
+#  include <sys/ndir.h>
+# endif /* SYSNDIR */
+# ifdef HAVE_SYS_DIR_H
+#  include <sys/dir.h>
+# endif /* SYSDIR */
+# ifdef HAVE_NDIR_H
+#  include <ndir.h>
+# endif
+#endif /* HAVE_DIRENT_H */
+
+int main() {
+
+struct dirent d; int z; z = d.d_fileno;
+
+; return 0; }
+EOF
+if { (eval echo configure:4733: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  bash_cv_dirent_has_d_fileno=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  bash_cv_dirent_has_d_fileno=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$bash_cv_dirent_has_d_fileno" 1>&6
+if test $bash_cv_dirent_has_d_fileno = yes; then
+cat >> confdefs.h <<\EOF
+#define STRUCT_DIRENT_HAS_D_FILENO 1
+EOF
+
+fi
+
+echo $ac_n "checking for struct winsize in sys/ioctl.h""... $ac_c" 1>&6
+echo "configure:4754: checking for struct winsize in sys/ioctl.h" >&5
+if eval "test \"`echo '$''{'bash_cv_struct_winsize_in_ioctl'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 4759 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/ioctl.h>
+int main() {
+struct winsize x;
+; return 0; }
+EOF
+if { (eval echo configure:4767: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  bash_cv_struct_winsize_in_ioctl=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  bash_cv_struct_winsize_in_ioctl=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$bash_cv_struct_winsize_in_ioctl" 1>&6
+if test $bash_cv_struct_winsize_in_ioctl = yes; then   
+cat >> confdefs.h <<\EOF
+#define STRUCT_WINSIZE_IN_SYS_IOCTL 1
+EOF
+
+fi
+
+
 echo $ac_n "checking for the existance of strsignal""... $ac_c" 1>&6
-echo "configure:4680: checking for the existance of strsignal" >&5
+echo "configure:4789: checking for the existance of strsignal" >&5
 if eval "test \"`echo '$''{'bash_cv_have_strsignal'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4685 "configure"
+#line 4794 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -4689,7 +4798,7 @@ int main() {
 char *s = (char *)strsignal(2);
 ; return 0; }
 EOF
-if { (eval echo configure:4693: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4802: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   bash_cv_have_strsignal=yes
 else
@@ -4710,7 +4819,7 @@ EOF
 fi
 
 echo $ac_n "checking if opendir() opens non-directories""... $ac_c" 1>&6
-echo "configure:4714: checking if opendir() opens non-directories" >&5
+echo "configure:4823: checking if opendir() opens non-directories" >&5
 if eval "test \"`echo '$''{'bash_cv_opendir_not_robust'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4718,7 +4827,7 @@ else
   { echo "configure: error: cannot check opendir if cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 4722 "configure"
+#line 4831 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -4754,7 +4863,7 @@ unlink("/tmp/not_a_directory");
 exit (dir == 0);
 }
 EOF
-if { (eval echo configure:4758: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4867: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   bash_cv_opendir_not_robust=yes
 else
@@ -4777,7 +4886,7 @@ EOF
 fi
 
 echo $ac_n "checking for declaration of printf in <stdio.h>""... $ac_c" 1>&6
-echo "configure:4781: checking for declaration of printf in <stdio.h>" >&5
+echo "configure:4890: checking for declaration of printf in <stdio.h>" >&5
 if eval "test \"`echo '$''{'bash_cv_printf_declared'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4785,7 +4894,7 @@ else
   { echo "configure: error: cannot check printf declaration if cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 4789 "configure"
+#line 4898 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -4802,7 +4911,7 @@ exit(pf == 0);
 }
 
 EOF
-if { (eval echo configure:4806: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4915: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   bash_cv_printf_declared=yes
 else
@@ -4825,7 +4934,7 @@ EOF
 fi
 
 echo $ac_n "checking whether ulimit can substitute for getdtablesize""... $ac_c" 1>&6
-echo "configure:4829: checking whether ulimit can substitute for getdtablesize" >&5
+echo "configure:4938: checking whether ulimit can substitute for getdtablesize" >&5
 if eval "test \"`echo '$''{'bash_cv_ulimit_maxfds'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4833,7 +4942,7 @@ else
   { echo "configure: error: cannot check ulimit if cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 4837 "configure"
+#line 4946 "configure"
 #include "confdefs.h"
 
 main()
@@ -4843,7 +4952,7 @@ exit (maxfds == -1L);
 }
 
 EOF
-if { (eval echo configure:4847: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4956: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   bash_cv_ulimit_maxfds=yes
 else
@@ -4866,7 +4975,7 @@ EOF
 fi
 
 echo $ac_n "checking to see if getenv can be redefined""... $ac_c" 1>&6
-echo "configure:4870: checking to see if getenv can be redefined" >&5
+echo "configure:4979: checking to see if getenv can be redefined" >&5
 if eval "test \"`echo '$''{'bash_cv_getenv_redef'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4874,7 +4983,7 @@ else
   { echo "configure: error: cannot check getenv redefinition if cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 4878 "configure"
+#line 4987 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_UNISTD_H
@@ -4909,7 +5018,7 @@ exit(s == 0);     /* force optimizer to leave getenv in */
 }
 
 EOF
-if { (eval echo configure:4913: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5022: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   bash_cv_getenv_redef=yes
 else
@@ -4932,7 +5041,7 @@ EOF
 fi
 
 echo $ac_n "checking if getcwd() calls popen()""... $ac_c" 1>&6
-echo "configure:4936: checking if getcwd() calls popen()" >&5
+echo "configure:5045: checking if getcwd() calls popen()" >&5
 if eval "test \"`echo '$''{'bash_cv_getcwd_calls_popen'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4940,7 +5049,7 @@ else
   { echo "configure: error: cannot check whether getcwd calls popen if cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 4944 "configure"
+#line 5053 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -4995,7 +5104,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:4999: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5108: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   bash_cv_getcwd_calls_popen=no
 else
@@ -5018,12 +5127,12 @@ EOF
 fi
 
 echo $ac_n "checking for declaration of sbrk in <unistd.h>""... $ac_c" 1>&6
-echo "configure:5022: checking for declaration of sbrk in <unistd.h>" >&5
+echo "configure:5131: checking for declaration of sbrk in <unistd.h>" >&5
 if eval "test \"`echo '$''{'bash_cv_sbrk_declared'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5027 "configure"
+#line 5136 "configure"
 #include "confdefs.h"
 #include <unistd.h>
 EOF
@@ -5049,7 +5158,7 @@ fi
 
 
 echo $ac_n "checking for presence of POSIX-style sigsetjmp/siglongjmp""... $ac_c" 1>&6
-echo "configure:5053: checking for presence of POSIX-style sigsetjmp/siglongjmp" >&5
+echo "configure:5162: checking for presence of POSIX-style sigsetjmp/siglongjmp" >&5
 if eval "test \"`echo '$''{'bash_cv_func_sigsetjmp'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5057,7 +5166,7 @@ else
   { echo "configure: error: cannot check for sigsetjmp/siglongjmp if cross-compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 5061 "configure"
+#line 5170 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_UNISTD_H
@@ -5098,7 +5207,7 @@ exit(1);
 #endif
 }
 EOF
-if { (eval echo configure:5102: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5211: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   bash_cv_func_sigsetjmp=present
 else
@@ -5122,9 +5231,82 @@ EOF
 fi
 
 
+echo $ac_n "checking whether or not strcoll and strcmp differ""... $ac_c" 1>&6
+echo "configure:5236: checking whether or not strcoll and strcmp differ" >&5
+if eval "test \"`echo '$''{'bash_cv_func_strcoll_broken'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$cross_compiling" = yes; then
+  { echo "configure: error: cannot check strcoll if cross compiling" 1>&2; exit 1; }
+else
+  cat > conftest.$ac_ext <<EOF
+#line 5244 "configure"
+#include "confdefs.h"
+
+#include <stdio.h>
+#if defined (HAVE_LOCALE_H)
+#include <locale.h>
+#endif
+
+main(c, v)
+int     c;
+char    *v[];
+{
+        int     r1, r2;
+        char    *deflocale, *defcoll;
+
+#ifdef HAVE_SETLOCALE
+        deflocale = setlocale(LC_ALL, "");
+       defcoll = setlocale(LC_COLLATE, "");
+#endif
+
+#ifdef HAVE_STRCOLL
+       /* These two values are taken from tests/glob-test. */
+        r1 = strcoll("abd", "aXd");
+#else
+       r1 = 0;
+#endif
+        r2 = strcmp("abd", "aXd");
+
+       /* These two should both be greater than 0.  It is permissible for
+          a system to return different values, as long as the sign is the
+          same. */
+
+        /* Exit with 1 (failure) if these two values are both > 0, since
+          this tests whether strcoll(3) is broken with respect to strcmp(3)
+          in the default locale. */
+       exit (r1 > 0 && r2 > 0);
+}
+
+EOF
+if { (eval echo configure:5283: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+  bash_cv_func_strcoll_broken=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  bash_cv_func_strcoll_broken=no
+fi
+rm -fr conftest*
+fi
+
+
+fi
+
+echo "$ac_t""$bash_cv_func_strcoll_broken" 1>&6
+if test $bash_cv_func_strcoll_broken = yes; then
+cat >> confdefs.h <<\EOF
+#define STRCOLL_BROKEN 1
+EOF
+
+fi
+
+
+
 
 echo $ac_n "checking if signal handlers must be reinstalled when invoked""... $ac_c" 1>&6
-echo "configure:5128: checking if signal handlers must be reinstalled when invoked" >&5
+echo "configure:5310: checking if signal handlers must be reinstalled when invoked" >&5
 if eval "test \"`echo '$''{'bash_cv_must_reinstall_sighandlers'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5132,7 +5314,7 @@ else
   { echo "configure: error: cannot check signal handling if cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 5136 "configure"
+#line 5318 "configure"
 #include "confdefs.h"
 
 #include <signal.h>
@@ -5179,7 +5361,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:5183: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5365: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   bash_cv_must_reinstall_sighandlers=no
 else
@@ -5203,7 +5385,7 @@ fi
 
 
 echo $ac_n "checking for presence of necessary job control definitions""... $ac_c" 1>&6
-echo "configure:5207: checking for presence of necessary job control definitions" >&5
+echo "configure:5389: checking for presence of necessary job control definitions" >&5
 if eval "test \"`echo '$''{'bash_cv_job_control_missing'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5211,7 +5393,7 @@ else
   { echo "configure: error: cannot check job control if cross-compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 5215 "configure"
+#line 5397 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -5258,7 +5440,7 @@ exit(1);
 exit(0);
 }
 EOF
-if { (eval echo configure:5262: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5444: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   bash_cv_job_control_missing=present
 else
@@ -5282,7 +5464,7 @@ EOF
 fi
 
 echo $ac_n "checking for presence of named pipes""... $ac_c" 1>&6
-echo "configure:5286: checking for presence of named pipes" >&5
+echo "configure:5468: checking for presence of named pipes" >&5
 if eval "test \"`echo '$''{'bash_cv_sys_named_pipes'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5290,7 +5472,7 @@ else
   { echo "configure: error: cannot check for named pipes if cross-compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 5294 "configure"
+#line 5476 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -5324,7 +5506,7 @@ unlink ("/tmp/sh-np-autoconf");
 exit(0);
 }
 EOF
-if { (eval echo configure:5328: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5510: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   bash_cv_sys_named_pipes=present
 else
@@ -5347,13 +5529,14 @@ EOF
 
 fi
 
+
 echo $ac_n "checking for TIOCGWINSZ in sys/ioctl.h""... $ac_c" 1>&6
-echo "configure:5352: checking for TIOCGWINSZ in sys/ioctl.h" >&5
+echo "configure:5535: checking for TIOCGWINSZ in sys/ioctl.h" >&5
 if eval "test \"`echo '$''{'bash_cv_tiocgwinsz_in_ioctl'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5357 "configure"
+#line 5540 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/ioctl.h>
@@ -5361,7 +5544,7 @@ int main() {
 int x = TIOCGWINSZ;
 ; return 0; }
 EOF
-if { (eval echo configure:5365: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5548: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_tiocgwinsz_in_ioctl=yes
 else
@@ -5382,12 +5565,12 @@ EOF
 fi
 
 echo $ac_n "checking for TIOCSTAT in sys/ioctl.h""... $ac_c" 1>&6
-echo "configure:5386: checking for TIOCSTAT in sys/ioctl.h" >&5
+echo "configure:5569: checking for TIOCSTAT in sys/ioctl.h" >&5
 if eval "test \"`echo '$''{'bash_cv_tiocstat_in_ioctl'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5391 "configure"
+#line 5574 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/ioctl.h>
@@ -5395,7 +5578,7 @@ int main() {
 int x = TIOCSTAT;
 ; return 0; }
 EOF
-if { (eval echo configure:5399: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5582: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_tiocstat_in_ioctl=yes
 else
@@ -5416,12 +5599,12 @@ EOF
 fi
 
 echo $ac_n "checking for FIONREAD in sys/ioctl.h""... $ac_c" 1>&6
-echo "configure:5420: checking for FIONREAD in sys/ioctl.h" >&5
+echo "configure:5603: checking for FIONREAD in sys/ioctl.h" >&5
 if eval "test \"`echo '$''{'bash_cv_fionread_in_ioctl'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5425 "configure"
+#line 5608 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/ioctl.h>
@@ -5429,7 +5612,7 @@ int main() {
 int x = FIONREAD;
 ; return 0; }
 EOF
-if { (eval echo configure:5433: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5616: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_fionread_in_ioctl=yes
 else
@@ -5449,13 +5632,47 @@ EOF
 
 fi
 
+
+echo $ac_n "checking for speed_t in sys/types.h""... $ac_c" 1>&6
+echo "configure:5638: checking for speed_t in sys/types.h" >&5
+if eval "test \"`echo '$''{'bash_cv_speed_t_in_sys_types'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 5643 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+int main() {
+speed_t x;
+; return 0; }
+EOF
+if { (eval echo configure:5650: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  bash_cv_speed_t_in_sys_types=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  bash_cv_speed_t_in_sys_types=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$bash_cv_speed_t_in_sys_types" 1>&6
+if test $bash_cv_speed_t_in_sys_types = yes; then   
+cat >> confdefs.h <<\EOF
+#define SPEED_T_IN_SYS_TYPES 1
+EOF
+
+fi
+
 echo $ac_n "checking whether programs are able to redeclare getpw functions""... $ac_c" 1>&6
-echo "configure:5454: checking whether programs are able to redeclare getpw functions" >&5
+echo "configure:5671: checking whether programs are able to redeclare getpw functions" >&5
 if eval "test \"`echo '$''{'bash_cv_can_redecl_getpw'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5459 "configure"
+#line 5676 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <pwd.h>
@@ -5464,7 +5681,7 @@ int main() {
 struct passwd *z; z = getpwent();
 ; return 0; }
 EOF
-if { (eval echo configure:5468: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5685: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_can_redecl_getpw=yes
 else
@@ -5484,51 +5701,15 @@ EOF
 
 fi
 
-echo $ac_n "checking whether /dev/fd is available""... $ac_c" 1>&6
-echo "configure:5489: checking whether /dev/fd is available" >&5
-if eval "test \"`echo '$''{'bash_cv_dev_fd'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test -d /dev/fd  && test -r /dev/fd/0; then
-   bash_cv_dev_fd=standard
- elif test -d /proc/self/fd && test -r /proc/self/fd/0; then
-   bash_cv_dev_fd=whacky
- else
-   bash_cv_dev_fd=absent
- fi
-
-fi
-
-echo "$ac_t""$bash_cv_dev_fd" 1>&6
-if test $bash_cv_dev_fd = "standard"; then
-  cat >> confdefs.h <<\EOF
-#define HAVE_DEV_FD 1
-EOF
-
-  cat >> confdefs.h <<\EOF
-#define DEV_FD_PREFIX "/dev/fd/"
-EOF
-
-elif test $bash_cv_dev_fd = "whacky"; then
-  cat >> confdefs.h <<\EOF
-#define HAVE_DEV_FD 1
-EOF
-
-  cat >> confdefs.h <<\EOF
-#define DEV_FD_PREFIX "/proc/self/fd/"
-EOF
-
-fi
-
 
 case "$host_os" in
 hpux*) echo $ac_n "checking whether $host_os needs _KERNEL for RLIMIT defines""... $ac_c" 1>&6
-echo "configure:5527: checking whether $host_os needs _KERNEL for RLIMIT defines" >&5
+echo "configure:5708: checking whether $host_os needs _KERNEL for RLIMIT defines" >&5
 if eval "test \"`echo '$''{'bash_cv_kernel_rlimit'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5532 "configure"
+#line 5713 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -5541,7 +5722,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:5545: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5726: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_kernel_rlimit=no
 else
@@ -5549,7 +5730,7 @@ else
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   cat > conftest.$ac_ext <<EOF
-#line 5553 "configure"
+#line 5734 "configure"
 #include "confdefs.h"
 
      #include <sys/types.h>
@@ -5564,7 +5745,7 @@ int main() {
      
 ; return 0; }
 EOF
-if { (eval echo configure:5568: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5749: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_kernel_rlimit=yes
 else
@@ -5590,19 +5771,22 @@ fi
 esac
 
 if test "$opt_readline" = yes; then
+case "$host_os" in
+aix*)  prefer_curses=yes ;;
+esac
 
 if test "X$bash_cv_termcap_lib" = "X"; then
 _bash_needmsg=yes
 else
 echo $ac_n "checking which library has the termcap functions""... $ac_c" 1>&6
-echo "configure:5599: checking which library has the termcap functions" >&5
+echo "configure:5783: checking which library has the termcap functions" >&5
 _bash_needmsg=
 fi
 if eval "test \"`echo '$''{'bash_cv_termcap_lib'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6
-echo "configure:5606: checking for tgetent in -ltermcap" >&5
+echo "configure:5790: checking for tgetent in -ltermcap" >&5
 ac_lib_var=`echo termcap'_'tgetent | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5610,7 +5794,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ltermcap  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5614 "configure"
+#line 5798 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5621,7 +5805,7 @@ int main() {
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:5625: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5809: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5640,7 +5824,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for tgetent in -lcurses""... $ac_c" 1>&6
-echo "configure:5644: checking for tgetent in -lcurses" >&5
+echo "configure:5828: checking for tgetent in -lcurses" >&5
 ac_lib_var=`echo curses'_'tgetent | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5648,7 +5832,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lcurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5652 "configure"
+#line 5836 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5659,7 +5843,7 @@ int main() {
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:5663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5847: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5678,7 +5862,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for tgetent in -lncurses""... $ac_c" 1>&6
-echo "configure:5682: checking for tgetent in -lncurses" >&5
+echo "configure:5866: checking for tgetent in -lncurses" >&5
 ac_lib_var=`echo ncurses'_'tgetent | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5686,7 +5870,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lncurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5690 "configure"
+#line 5874 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5697,7 +5881,7 @@ int main() {
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:5701: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5885: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5726,14 +5910,14 @@ fi
 
 if test "X$_bash_needmsg" = "Xyes"; then
 echo $ac_n "checking which library has the termcap functions""... $ac_c" 1>&6
-echo "configure:5730: checking which library has the termcap functions" >&5
+echo "configure:5914: checking which library has the termcap functions" >&5
 fi
 echo "$ac_t""using $bash_cv_termcap_lib" 1>&6
 if test $bash_cv_termcap_lib = gnutermcap; then
 LDFLAGS="$LDFLAGS -L./lib/termcap"
 TERMCAP_LIB="./lib/termcap/libtermcap.a"
 TERMCAP_DEP="./lib/termcap/libtermcap.a"
-elif test $bash_cv_termcap_lib = libtermcap; then
+elif test $bash_cv_termcap_lib = libtermcap && test -z "$prefer_curses"; then
 TERMCAP_LIB=-ltermcap
 TERMCAP_DEP=
 elif test $bash_cv_termcap_lib = libncurses; then
@@ -5748,8 +5932,44 @@ fi
 
 
 
+echo $ac_n "checking whether /dev/fd is available""... $ac_c" 1>&6
+echo "configure:5937: checking whether /dev/fd is available" >&5
+if eval "test \"`echo '$''{'bash_cv_dev_fd'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -d /dev/fd  && test -r /dev/fd/0; then
+   bash_cv_dev_fd=standard
+ elif test -d /proc/self/fd && test -r /proc/self/fd/0; then
+   bash_cv_dev_fd=whacky
+ else
+   bash_cv_dev_fd=absent
+ fi
+
+fi
+
+echo "$ac_t""$bash_cv_dev_fd" 1>&6
+if test $bash_cv_dev_fd = "standard"; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_DEV_FD 1
+EOF
+
+  cat >> confdefs.h <<\EOF
+#define DEV_FD_PREFIX "/dev/fd/"
+EOF
+
+elif test $bash_cv_dev_fd = "whacky"; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_DEV_FD 1
+EOF
+
+  cat >> confdefs.h <<\EOF
+#define DEV_FD_PREFIX "/proc/self/fd/"
+EOF
+
+fi
+
 echo $ac_n "checking for default mail directory""... $ac_c" 1>&6
-echo "configure:5753: checking for default mail directory" >&5
+echo "configure:5973: checking for default mail directory" >&5
 if eval "test \"`echo '$''{'bash_cv_mail_dir'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5813,6 +6033,9 @@ fi
 
 
 
+LOCAL_DEFS=-DSHELL
+
+
 case "$host_os" in
 sysv4.2)       cat >> confdefs.h <<\EOF
 #define SVR4_2 1
@@ -5832,9 +6055,12 @@ isc*)            LOCAL_CFLAGS=-Disc386;;
 sco3.2v5*)     LOCAL_CFLAGS="-DWAITPID_BROKEN -DNO_MEMSCRAMBLE -DPATH_MAX=1024" ;;
 sco3.2v4*)     LOCAL_CFLAGS="-DMUST_UNBLOCK_CHLD -DNO_MEMSCRAMBLE -DPATH_MAX=1024" ;;
 sco3.2*)       LOCAL_CFLAGS=-DMUST_UNBLOCK_CHLD ;;
-sunos4*)       LOCAL_CFLAGS=-DSunOS4;;
-linux*)                LOCAL_LDFLAGS=-rdynamic ;;      # allow dynamic loading
-aix4.2*)       LOCAL_LDFLAGS="-bexpall -brtl";;# allow dynamic loading
+sunos4*)       LOCAL_CFLAGS=-DSunOS4 ;;
+solaris2.5*)   LOCAL_CFLAGS=-DSunOS5 ;;
+linux*)                LOCAL_LDFLAGS=-rdynamic ;;       # allow dynamic loading
+aix4.2*)       LOCAL_LDFLAGS="-bexpall -brtl" ;;# allow dynamic loading
+*qnx*)         LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s -lunix -lncurses" ;;
+powerux)       LOCAL_LIBS="-lgen" ;;
 esac
 
 case "$host_cpu" in
@@ -5881,6 +6107,10 @@ BUILD_DIR=`pwd`
 
 
 
+
+#AC_SUBST(ALLOCA_SOURCE)
+#AC_SUBST(ALLOCA_OBJECT)
+
 trap '' 1 2 15
 cat > confcache <<\EOF
 # This file is a shell script that caches the results of configure
@@ -6019,8 +6249,9 @@ s%@host_alias@%$host_alias%g
 s%@host_cpu@%$host_cpu%g
 s%@host_vendor@%$host_vendor%g
 s%@host_os@%$host_os%g
+s%@TESTSCRIPT@%$TESTSCRIPT%g
 s%@PURIFY@%$PURIFY%g
-s%@MALLOC@%$MALLOC%g
+s%@MALLOC_TARGET@%$MALLOC_TARGET%g
 s%@MALLOC_SRC@%$MALLOC_SRC%g
 s%@READLINE_LIB@%$READLINE_LIB%g
 s%@READLINE_DEP@%$READLINE_DEP%g
@@ -6040,11 +6271,12 @@ s%@TERMCAP_DEP@%$TERMCAP_DEP%g
 s%@JOBS_O@%$JOBS_O%g
 s%@incdir@%$incdir%g
 s%@BUILD_DIR@%$BUILD_DIR%g
+s%@BASHVERS@%$BASHVERS%g
+s%@BASHPATCH@%$BASHPATCH%g
 s%@LOCAL_LIBS@%$LOCAL_LIBS%g
 s%@LOCAL_CFLAGS@%$LOCAL_CFLAGS%g
 s%@LOCAL_LDFLAGS@%$LOCAL_LDFLAGS%g
-s%@ALLOCA_SOURCE@%$ALLOCA_SOURCE%g
-s%@ALLOCA_OBJECT@%$ALLOCA_OBJECT%g
+s%@LOCAL_DEFS@%$LOCAL_DEFS%g
 
 CEOF
 EOF
index 62d1e51..32ddb2f 100644 (file)
@@ -1,17 +1,18 @@
 dnl
-dnl Configure script for bash-2.0
+dnl Configure script for bash-2.01
 dnl
 dnl report bugs to chet@po.cwru.edu
 dnl
 dnl Process this file with autoconf to produce a configure script.
 dnl checks for version info
-AC_REVISION([for Bash 2.0, version 1.14, from autoconf version] AC_ACVERSION)dnl
+
+AC_REVISION([for Bash 2.01, version 1.26, from autoconf version] AC_ACVERSION)dnl
 
 AC_INIT(shell.h)
 AC_CONFIG_HEADER(config.h)
 
 dnl make sure we are using a recent autoconf version
-AC_PREREQ(2.8)
+AC_PREREQ(2.10)
 
 dnl where to find install.sh, config.sub, and config.guess
 AC_CONFIG_AUX_DIR(./support)
@@ -24,7 +25,9 @@ dnl configure defaults
 opt_gnu_malloc=yes
 opt_glibc_malloc=no
 opt_purify=no
+opt_purecov=no
 opt_afs=no
+opt_curses=no
 
 dnl some systems should be configured without gnu malloc by default
 dnl and some need a special compiler or loader
@@ -35,40 +38,56 @@ alpha-*)    opt_gnu_malloc=no ;;    # alpha running osf/1 or linux
 *-osf1*)       opt_gnu_malloc=no ;;    # other osf/1 machines
 sparc-svr4*)   opt_gnu_malloc=no ;;    # sparc SVR4, SVR4.2
 sparc-netbsd*) opt_gnu_malloc=no ;;    # needs 8-byte alignment
+*-sgi-irix6*)  opt_gnu_malloc=no ;;    # needs 8-byte alignment
 sparc-linux*)  opt_gnu_malloc=no ;;    # sparc running linux; requires ELF
+*-freebsd*)    opt_gnu_malloc=no ;;    # they claim it's better
 *-aix*)                opt_gnu_malloc=no ;;    # AIX machines
 *-nextstep*)   opt_gnu_malloc=no ;;    # NeXT machines running NeXTstep
 *-dgux*)       opt_gnu_malloc=no ;;    # DG/UX machines
-*-qnx)         opt_gnu_malloc=no ;;    # QNX 4.2
+*-qnx*)                opt_gnu_malloc=no ;;    # QNX 4.2
+*-machten4)    opt_gnu_malloc=no ;;    # MachTen 4.x
 *-bsdi2.1)     opt_gnu_malloc=no ; : ${CC:=shlicc2} ;; # for loadable builtins
 esac
 
 dnl arguments to configure
 dnl packages
-AC_ARG_WITH(gnu-malloc, --with-gnu-malloc      use the GNU version of malloc,opt_gnu_malloc=$withval)
+AC_ARG_WITH(afs, --with-afs            if you are running AFS, opt_afs=$withval)
+AC_ARG_WITH(curses, --with-curses              use the curses library instead of the termcap library,opt_curses=$withval)
 AC_ARG_WITH(glibc-malloc, --with-glibc-malloc  use the GNU C library version of malloc,opt_glibc_malloc=$withval)
+AC_ARG_WITH(gnu-malloc, --with-gnu-malloc      use the GNU version of malloc,opt_gnu_malloc=$withval)
+AC_ARG_WITH(purecov, --with-purecov            configure to postprocess with pure coverage, opt_purecov=$withval)
 AC_ARG_WITH(purify, --with-purify              configure to postprocess with purify, opt_purify=$withval)
-AC_ARG_WITH(afs, --with-afs            if you are running AFS, opt_afs=$withval)
 
 dnl test for glibc malloc first because it can override the default
 if test "$opt_glibc_malloc" = yes; then 
-       MALLOC=gmalloc.o MALLOC_SRC='$(ALLOC_LIBSRC)/gmalloc.c'
+       MALLOC_TARGET=gmalloc
+       MALLOC_SRC=gmalloc.c
 elif test "$opt_gnu_malloc" = yes; then
-       MALLOC=malloc.o MALLOC_SRC='$(ALLOC_LIBSRC)/malloc.c'
+       MALLOC_TARGET=malloc
+       MALLOC_SRC=malloc.c
 else
-       MALLOC= MALLOC_SRC=
+       MALLOC_TARGET=stubmalloc
+       MALLOC_SRC=stub.c
 fi
 
 if test "$opt_purify" = yes; then
-       PURIFY=purify
+       PURIFY="purify "
 else
        PURIFY=
 fi
 
+if test "$opt_purecov" = yes; then
+       PURIFY="${PURIFY}purecov"
+fi
+
 if test "$opt_afs" = yes; then
        AC_DEFINE(AFS)
 fi
 
+if test "$opt_curses" = yes; then
+       prefer_curses=yes
+fi
+
 dnl optional shell features in config.h.in
 opt_minimal_config=no
 
@@ -103,22 +122,22 @@ if test $opt_minimal_config = yes; then
        opt_brace_expansion=no opt_disabled_builtins=no opt_command_timing=no
 fi
 
-AC_ARG_ENABLE(job-control, --enable-job-control        enable job control features, opt_job_control=$enableval)
 AC_ARG_ENABLE(alias, --enable-alias            enable shell aliases, opt_alias=$enableval)
-AC_ARG_ENABLE(readline, --enable-readline      turn on command line editing, opt_readline=$enableval)
-AC_ARG_ENABLE(history, --enable-history        turn on command history, opt_history=$enableval)
+AC_ARG_ENABLE(array-variables, --enable-array-variables        include shell array variables, opt_array_variables=$enableval)
 AC_ARG_ENABLE(bang-history, --enable-bang-history      turn on csh-style history substitution, opt_bang_history=$enableval)
+AC_ARG_ENABLE(brace-expansion, --enable-brace-expansion        include brace expansion, opt_brace_expansion=$enableval)
+AC_ARG_ENABLE(command-timing, --enable-command-timing  enable the time reserved word and command timing, opt_command_timing=$enableval)
 AC_ARG_ENABLE(directory-stack, --enable-directory-stack        enable builtins pushd/popd/dirs, opt_dirstack=$enableval)
-AC_ARG_ENABLE(restricted, --enable-restricted  enable a restricted shell, opt_restricted=$enableval)
+AC_ARG_ENABLE(disabled-builtins, --enable-disabled-builtins    allow disabled builtins to still be invoked, opt_disabled_builtins=$enableval)
+AC_ARG_ENABLE(dparen-arithmetic, [--enable-dparen-arithmetic   include ((...)) command], opt_dparen_arith=$enableval)
+AC_ARG_ENABLE(help-builtin, --enable-help-builtin      include the help builtin, opt_help=$enableval)
+AC_ARG_ENABLE(history, --enable-history        turn on command history, opt_history=$enableval)
+AC_ARG_ENABLE(job-control, --enable-job-control        enable job control features, opt_job_control=$enableval)
 AC_ARG_ENABLE(process-substitution, --enable-process-substitution      enable process substitution, opt_process_subst=$enableval)
 AC_ARG_ENABLE(prompt-string-decoding, --enable-prompt-string-decoding  turn on escape character decoding in prompts, opt_prompt_decoding=$enableval)
+AC_ARG_ENABLE(readline, --enable-readline      turn on command line editing, opt_readline=$enableval)
+AC_ARG_ENABLE(restricted, --enable-restricted  enable a restricted shell, opt_restricted=$enableval)
 AC_ARG_ENABLE(select, --enable-select          include select command, opt_select=$enableval)
-AC_ARG_ENABLE(help-builtin, --enable-help-builtin      include the help builtin, opt_help=$enableval)
-AC_ARG_ENABLE(array-variables, --enable-array-variables        include shell array variables, opt_array_variables=$enableval)
-AC_ARG_ENABLE(dparen-arithmetic, [--enable-dparen-arithmetic   include ((...)) command], opt_dparen_arith=$enableval)
-AC_ARG_ENABLE(brace-expansion, --enable-brace-expansion        include brace expansion, opt_brace_expansion=$enableval)
-AC_ARG_ENABLE(disabled-builtins, --enable-disabled-builtins    allow disabled builtins to still be invoked, opt_disabled_builtins=$enableval)
-AC_ARG_ENABLE(command-timing, --enable-command-timing  enable the time reserved word and command timing, opt_command_timing=$enableval)
 AC_ARG_ENABLE(usg-echo-default, --enable-usg-echo-default      make the echo builtin expand escape sequences by default, opt_usg_echo=$enableval)
 
 dnl opt_job_control is handled later, after BASH_JOB_CONTROL_MISSING runs
@@ -184,25 +203,36 @@ if test $opt_usg_echo = yes ; then
 AC_DEFINE(DEFAULT_ECHO_TO_USG)
 fi
 
+if test "$opt_minimal_config" = yes; then
+       TESTSCRIPT=run-minimal
+else
+       TESTSCRIPT=run-all
+fi
+
 dnl now substitute in the values generated by arguments
+AC_SUBST(TESTSCRIPT)
 AC_SUBST(PURIFY)
-AC_SUBST(MALLOC)
+AC_SUBST(MALLOC_TARGET)
 AC_SUBST(MALLOC_SRC)
 AC_SUBST(READLINE_LIB)
 AC_SUBST(READLINE_DEP)
 AC_SUBST(HISTORY_LIB)
 AC_SUBST(HISTORY_DEP)
 
-echo "Beginning configuration for bash-2.0"
+dnl Use GNU m4 macros to get the distribution and patchlevel information
+dnl into configure without requiring the files to be distributed
+[BASHVERS=]dnl
+esyscmd(cat _distribution)dnl
+[BASHPATCH=]dnl
+esyscmd(cat _patchlevel)dnl
+
+echo "Beginning configuration for bash-$BASHVERS"
 
 dnl compilation checks
 AC_PROG_CC
 AC_ISC_POSIX
 AC_MINIX
 
-dnl See whether cc works at all
-BASH_CC_WORKS
-
 dnl We want these before the checks, so the checks can modify their values.
 test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1
 
@@ -285,7 +315,7 @@ AC_HEADER_DIRENT
 AC_HEADER_TIME
 
 AC_CHECK_HEADERS(unistd.h stdlib.h stdarg.h varargs.h limits.h string.h \
-                memory.h locale.h termcap.h termio.h termios.h)
+                memory.h locale.h termcap.h termio.h termios.h dlfcn.h)
 AC_CHECK_HEADERS(sys/ptem.h sys/pte.h sys/stream.h sys/select.h sys/file.h \
                 sys/resource.h sys/param.h sys/socket.h \
                 sys/time.h sys/times.h sys/wait.h)
@@ -293,7 +323,10 @@ AC_CHECK_HEADERS(sys/ptem.h sys/pte.h sys/stream.h sys/select.h sys/file.h \
 dnl libraries
 dnl this is reportedly no longer necessary for irix[56].?
 dnl AC_CHECK_LIB(sun, getpwent)
-BASH_CHECK_SOCKLIB
+dnl check for getpeername in the socket library only if it's not in libc
+if test "$ac_cv_func_getpeername" = no; then
+       BASH_CHECK_SOCKLIB
+fi
 
 dnl system types
 AC_TYPE_GETGROUPS
@@ -332,20 +365,31 @@ if test "$ac_cv_func_lstat" = "no"; then
 BASH_FUNC_LSTAT
 fi
 
+dnl behavior of system calls and library functions
 BASH_DUP2_CLOEXEC_CHECK
 BASH_PGRP_SYNC
+BASH_SIGNAL_CHECK
+
+dnl checking for the presence of certain library symbols
 BASH_SYS_ERRLIST
 BASH_SYS_SIGLIST
 BASH_UNDER_SYS_SIGLIST
-BASH_SIGNAL_CHECK
+
+dnl various system types
 BASH_TYPE_SIGHANDLER
 BASH_CHECK_TYPE(clock_t, [#include <sys/times.h>], long)
 BASH_CHECK_TYPE(sigset_t, [#include <signal.h>], int)
 BASH_CHECK_TYPE(quad_t, , long, HAVE_QUAD_T)
 BASH_RLIMIT_TYPE
+
+dnl presence and contents of structures used by system calls
 BASH_STRUCT_TERMIOS_LDISC
 BASH_STRUCT_TERMIO_LDISC
 BASH_STRUCT_DIRENT_D_INO
+BASH_STRUCT_DIRENT_D_FILENO
+BASH_STRUCT_WINSIZE
+
+dnl presence and behavior of C library functions
 BASH_FUNC_STRSIGNAL
 BASH_FUNC_OPENDIR_CHECK
 BASH_FUNC_PRINTF
@@ -354,26 +398,38 @@ BASH_FUNC_GETENV
 BASH_FUNC_GETCWD
 BASH_FUNC_SBRK_DECLARED
 BASH_FUNC_POSIX_SETJMP
+BASH_FUNC_STRCOLL
+
+dnl presence and behavior of OS functions
 BASH_REINSTALL_SIGHANDLERS
 BASH_JOB_CONTROL_MISSING
 BASH_SYS_NAMED_PIPES
+
+dnl presence of certain CPP defines
 BASH_HAVE_TIOCGWINSZ
 BASH_HAVE_TIOCSTAT
 BASH_HAVE_FIONREAD
+
+dnl miscellaneous
+BASH_MISC_SPEED_T
 BASH_CHECK_GETPW_FUNCS
-BASH_CHECK_DEV_FD
 
+dnl special checks
 case "$host_os" in
 hpux*) BASH_KERNEL_RLIMIT_CHECK ;;
 esac
 
 if test "$opt_readline" = yes; then
+dnl yuck
+case "$host_os" in
+aix*)  prefer_curses=yes ;;
+esac
 BASH_CHECK_LIB_TERMCAP
 fi
 AC_SUBST(TERMCAP_LIB)
 AC_SUBST(TERMCAP_DEP)
 
-dnl special checks
+BASH_CHECK_DEV_FD
 BASH_DEFAULT_MAIL_DIR
 
 if test "$bash_cv_job_control_missing" = missing; then
@@ -389,6 +445,11 @@ fi
 
 AC_SUBST(JOBS_O)
 
+dnl Defines that we want to propagate to the Makefiles in subdirectories,
+dnl like glob and readline
+
+LOCAL_DEFS=-DSHELL
+
 dnl use this section to possibly define more cpp variables, specify local
 dnl libraries, and specify any additional local cc flags
 dnl
@@ -404,9 +465,12 @@ isc*)              LOCAL_CFLAGS=-Disc386;;
 sco3.2v5*)     LOCAL_CFLAGS="-DWAITPID_BROKEN -DNO_MEMSCRAMBLE -DPATH_MAX=1024" ;;
 sco3.2v4*)     LOCAL_CFLAGS="-DMUST_UNBLOCK_CHLD -DNO_MEMSCRAMBLE -DPATH_MAX=1024" ;;
 sco3.2*)       LOCAL_CFLAGS=-DMUST_UNBLOCK_CHLD ;;
-sunos4*)       LOCAL_CFLAGS=-DSunOS4;;
-linux*)                LOCAL_LDFLAGS=-rdynamic ;;      # allow dynamic loading
-aix4.2*)       LOCAL_LDFLAGS="-bexpall -brtl";;# allow dynamic loading
+sunos4*)       LOCAL_CFLAGS=-DSunOS4 ;;
+solaris2.5*)   LOCAL_CFLAGS=-DSunOS5 ;;
+linux*)                LOCAL_LDFLAGS=-rdynamic ;;       # allow dynamic loading
+aix4.2*)       LOCAL_LDFLAGS="-bexpall -brtl" ;;# allow dynamic loading
+*qnx*)         LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s -lunix -lncurses" ;;
+powerux)       LOCAL_LIBS="-lgen" ;;
 esac
 
 case "$host_cpu" in
@@ -443,15 +507,19 @@ AC_SUBST(BUILD_DIR)
 AC_SUBST(YACC)
 AC_SUBST(AR)
 
+AC_SUBST(BASHVERS)
+AC_SUBST(BASHPATCH)
+
 AC_SUBST(host_cpu)
 AC_SUBST(host_os)
 
 AC_SUBST(LOCAL_LIBS)
 AC_SUBST(LOCAL_CFLAGS)
 AC_SUBST(LOCAL_LDFLAGS)
+AC_SUBST(LOCAL_DEFS)
 
-AC_SUBST(ALLOCA_SOURCE)
-AC_SUBST(ALLOCA_OBJECT)
+#AC_SUBST(ALLOCA_SOURCE)
+#AC_SUBST(ALLOCA_OBJECT)
 
 AC_OUTPUT([Makefile builtins/Makefile lib/readline/Makefile lib/glob/Makefile \
          lib/malloc/Makefile lib/termcap/Makefile lib/tilde/Makefile \
index 2ac2049..8667678 100644 (file)
 #  include <unistd.h>
 #endif
 
-#if defined (HAVE_STRING_H)
-#  include <string.h>
-#else /* !HAVE_STRING_H */
-#  include <strings.h>
-#endif /* !HAVE_STRING_H */
-
 #include "shell.h"
 
 WORD_DESC *
@@ -119,6 +113,10 @@ copy_redirect (redirect)
     case r_duplicating_output_word:
       new_redirect->redirectee.filename = copy_word (redirect->redirectee.filename);
       break;
+    case r_duplicating_input:
+    case r_duplicating_output:
+    case r_close_this:
+      break;
     }
   return (new_redirect);
 }
index 86443f1..d0b6bbd 100644 (file)
@@ -175,18 +175,24 @@ dispose_words (list)
     }
 }
 
-/* How to dispose of an array of pointers to char. */
+#ifdef INCLUDE_UNUSED
+/* How to dispose of an array of pointers to char.  This is identical to
+   free_array in stringlib.c. */
 void
 dispose_word_array (array)
      char **array;
 {
   register int count;
 
+  if (array == 0)
+    return;
+
   for (count = 0; array[count]; count++)
     free (array[count]);
 
   free (array);
 }
+#endif
 
 /* How to dispose of an list of redirections.  A REDIRECT. */
 void
diff --git a/doc/FAQ b/doc/FAQ
index 2723f8f..411990b 100644 (file)
--- a/doc/FAQ
+++ b/doc/FAQ
@@ -1,4 +1,4 @@
-This is the Bash FAQ, version 2.1, for Bash version 2.0.
+This is the Bash FAQ, version 2.5, for Bash version 2.01.
 
 This document contains a set of frequently-asked questions concerning
 Bash, the GNU Bourne-Again Shell.  Bash is a freely-available command
@@ -24,77 +24,78 @@ Section A:  The Basics
 2) What's the latest version?
 3) Where can I get it?
 4) On what machines will bash run?
-5) How can I build bash with gcc?
-6) How can I make bash my login shell?
-7) I just changed my login shell to bash, and now I can't FTP into my
+5) Will bash run on operating systems other than Unix?
+6) How can I build bash with gcc?
+7) How can I make bash my login shell?
+8) I just changed my login shell to bash, and now I can't FTP into my
    machine.  Why not?
-8) What's the `POSIX 1003.2 standard'?
-9) What is the bash `posix mode'?
+9) What's the `POSIX 1003.2 standard'?
+10) What is the bash `posix mode'?
 
 Section B:  The latest version
 
-10) What's new in version 2.0?
-11) Are there any user-visible incompatibilities between bash-2.0 and
+11) What's new in version 2.01?
+12) Are there any user-visible incompatibilities between bash-2.01 and
     bash-1.14.7?
 
 Section C:  Differences from other Unix shells
 
-12) How does bash differ from sh, the Bourne shell?
-13) How does bash differ from the Korn shell, version ksh88?
-14) Which new features in ksh-93 are not in bash, and which are?
+13) How does bash differ from sh, the Bourne shell?
+14) How does bash differ from the Korn shell, version ksh88?
+15) Which new features in ksh-93 are not in bash, and which are?
 
 Section D:  Why does bash do some things differently than other Unix shells?
 
-15) Why does bash run a different version of `command' than
+16) Why does bash run a different version of `command' than
     `which command' says it will?
-16) Why doesn't bash treat brace expansions exactly like csh?
-17) Why doesn't bash have csh variable modifiers?
-18) How can I make my csh aliases work when I convert to bash?
-19) How can I pipe standard output and standard error from one command to
+17) Why doesn't bash treat brace expansions exactly like csh?
+18) Why doesn't bash have csh variable modifiers?
+19) How can I make my csh aliases work when I convert to bash?
+20) How can I pipe standard output and standard error from one command to
     another, like csh does with `|&'?
-20) Now that I've converted from ksh to bash, are there equivalents to
+21) Now that I've converted from ksh to bash, are there equivalents to
     ksh features like autoloaded functions and the `whence' command?
 
 Section E:  How can I get bash to do certain things, and why does bash do
             things the way it does?
 
-21) Why is the bash builtin `test' slightly different from /bin/test?
-22) Why does bash sometimes say `Broken pipe'?
-23) How can I get bash to read and display eight-bit characters?
-24) How do I write a function `x' to replace builtin command `x', but
+22) Why is the bash builtin `test' slightly different from /bin/test?
+23) Why does bash sometimes say `Broken pipe'?
+24) How can I get bash to read and display eight-bit characters?
+25) How do I write a function `x' to replace builtin command `x', but
     still invoke the command from within the function?
-25) When I have terminal escape sequences in my prompt, why does bash
+26) When I have terminal escape sequences in my prompt, why does bash
     wrap lines at the wrong column?
-26) How can I find the value of a shell variable whose name is the value
+27) How can I find the value of a shell variable whose name is the value
     of another shell variable?
-27) If I pipe the output of a command into `read variable', why doesn't
+28) If I pipe the output of a command into `read variable', why doesn't
     the output show up in $variable when the read command finishes?
-28) I have a bunch of shell scripts that use backslash-escaped characters
+29) I have a bunch of shell scripts that use backslash-escaped characters
     in arguments to `echo'.  Bash doesn't interpret these characters.  Why
     not, and how can I make it understand them?
-29) Why doesn't a while or for loop get suspended when I type ^Z?
-30) How can I make the bash `time' reserved word print timing output that
+30) Why doesn't a while or for loop get suspended when I type ^Z?
+31) How can I make the bash `time' reserved word print timing output that
     looks like the output from my system's /usr/bin/time?
 
 Section F:  Things to watch out for on certain Unix versions
 
-31) Why can't I use command line editing in my `cmdtool'?
-32) I built bash on Solaris 2.  Why do globbing expansions and filename
+32) Why can't I use command line editing in my `cmdtool'?
+33) I built bash on Solaris 2.  Why do globbing expansions and filename
     completion chop off the first few characters of each filename?
-33) Why does bash dump core after I interrupt username completion or
+34) Why does bash dump core after I interrupt username completion or
     `~user' tilde expansion on a machine running NIS?
-34) I'm running SVR4.2.  Why is the line erased every time I type `@'?
-35) Why does bash report syntax errors when my C News scripts use a
+35) I'm running SVR4.2.  Why is the line erased every time I type `@'?
+36) Why does bash report syntax errors when my C News scripts use a
     redirection before a subshell command?
 
 Section G:  Where do I go from here?
 
-36) How do I report bugs in bash, and where should I look for fixes and
+37) How do I report bugs in bash, and where should I look for fixes and
     advice?
-37) What kind of bash documentation is there?
-38) What's coming in future versions?
-39) What's on the bash `wish list'?
-40) When will the next release appear?
+38) What kind of bash documentation is there?
+39) What's coming in future versions?
+40) What's on the bash `wish list'?
+41) When will the next release appear?
 
 ----------
 Section A:  The Basics
@@ -119,7 +120,7 @@ of Case Western Reserve University.
 
 2)  What's the latest version?
 
-The latest version is 2.0, first made available on December 23, 1996.
+The latest version is 2.01, first made available on June 6, 1997.
 
 3)  Where can I get it?
 
@@ -127,15 +128,15 @@ Bash is the GNU project's shell, and so is available from the
 master GNU archive site, prep.ai.mit.edu, and its mirrors.  The
 latest version is also available for FTP from slc2.ins.cwru.edu,
 the maintainer's machine.  The following URLs tell how to get
-version 2.0:
+version 2.01:
 
-ftp://prep.ai.mit.edu/pub/gnu/bash-2.0.tar.gz
-ftp://slc2.ins.cwru.edu/pub/dist/bash-2.0.tar.gz
+ftp://prep.ai.mit.edu/pub/gnu/bash-2.01.tar.gz
+ftp://slc2.ins.cwru.edu/pub/dist/bash-2.01.tar.gz
 
 Formatted versions of the documentation are available with the URLs:
 
-ftp://prep.ai.mit.edu/pub/gnu/bash-doc-2.0.tar.gz
-ftp://slc2.ins.cwru.edu/pub/dist/bash-doc-2.0.tar.gz
+ftp://prep.ai.mit.edu/pub/gnu/bash-doc-2.01.tar.gz
+ftp://slc2.ins.cwru.edu/pub/dist/bash-doc-2.01.tar.gz
 
 4)  On what machines will bash run?
 
@@ -147,12 +148,49 @@ itself accordingly, using a script created by GNU autoconf.
 
 More information appears in the file `INSTALL' in the distribution.
 
-5) How can I build bash with gcc? 
+5) Will bash run on operating systems other than Unix?
+
+Configuration specifics for Unix-like systems such as QNX and
+LynxOS are included in the distribution.  Previous versions of
+bash have been ported to Minix, but I don't believe anyone has
+built bash-2.x on Minix yet.
+
+Bash has been ported to versions of Windows implementing the Win32
+programming interface.  This includes Windows 95 and Windows NT.
+The port was done by Cygnus Solutions as part of their GNU-Win32
+project.  For more information about the project, look at the URL
+
+http://www.cygnus.com/misc/gnu-win32
+
+Cygnus has ported bash-1.14.7.  Maybe someday they (or I) will port
+bash-2.01 (or later) to the GNU-Win32 environment.
+
+D. J. Delorie has ported bash-1.14.7 to run under MS-DOS, as part of
+the DJGPP project.  For more information on the project, see
+
+http://www.delorie.com/djgpp/
+
+I picked up a binary of bash-1.14.7 that is purported to work with
+the DJGPP V2 environment from
+
+ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bsh1147b.zip
+
+The corresponding source is
+
+ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bsh1147s.zip
+
+A port of bash-1.12 is available for OS/2 from
+
+ftp://hobbes.nmsu.edu/os2/unix/bash_112.zip
+
+I haven't looked at it.
+
+6) How can I build bash with gcc? 
 
 Bash configures to use gcc by default if it is available.  Read the
 file INSTALL in the distribution for more information.
 
-6)  How can I make bash my login shell?
+7)  How can I make bash my login shell?
 
 Some machines let you use `chsh' to change your login shell.  Other
 systems use `passwd -s'.  If one of these works for you, that's all
@@ -182,18 +220,23 @@ like
 
 to ensure that bash is exec'd only when the csh is interactive.
 
-If your login shell is sh or ksh, you have to do two things.  First, add
-a line similar to the above to ~/.profile:
+If your login shell is sh or ksh, you have to do two things.
 
-       [ -f /usr/gnu/bin/bash ] && exec /usr/gnu/bin/bash --login
-
-Next, create an empty file in your home directory named `.bash_profile'.
+First, create an empty file in your home directory named `.bash_profile'.
 The existence of this file will prevent the exec'd bash from trying to
 read ~/.profile, and re-execing itself over and over again.  ~/.bash_profile
-is the file bash tries to read initialization commands from when it is
-invoked as a login shell.
+is the first file bash tries to read initialization commands from when
+it is invoked as a login shell.
+
+Next, add a line similar to the above to ~/.profile:
+
+        [ -f /usr/gnu/bin/bash ] && exec /usr/gnu/bin/bash --login
 
-7) I just changed my login shell to bash, and now I can't FTP into my
+This will cause login shells to replace themselves with bash running as
+a login shell.  Once you have this working, you can copy your initialization
+code from ~/.profile to ~/.bash_profile.
+
+8) I just changed my login shell to bash, and now I can't FTP into my
    machine.  Why not?
 
 You must add the full pathname to bash to the file /etc/shells.  As
@@ -203,7 +246,7 @@ this before you can make bash your login shell.
 Most versions of ftpd use this file to prohibit `special' users
 such as `uucp' and `news' from using FTP. 
 
-8)  What's the `POSIX 1003.2 standard'?
+9)  What's the `POSIX 1003.2 standard'?
 
 POSIX is a name originally coined by Richard Stallman for a
 family of open system standards based on UNIX.  There are a
@@ -238,7 +281,7 @@ line editing.  Only vi-style line editing commands have been
 standardized; emacs editing commands were left out due to
 objections.
 
-9)  What is the bash `posix mode'?
+10)  What is the bash `posix mode'?
 
 Although bash is an implementation of the POSIX.2 shell
 specification, there are areas where the bash default behavior
@@ -255,10 +298,16 @@ Reference Manual.
 
 Section B:  The latest version
 
-10) What's new in version 2.0?
+11) What's new in version 2.01?
+
+Bash-2.01 contains only a few new features.
+
+new `GROUPS' builtin array variable containing the user's group list
+new bindable readline commands: history-and-alias-expand-line and
+       alias-expand-line
 
-This version contains extensive changes and new features.  Here's a
-short list:
+Bash-2.0 contains extensive changes and new features from bash-1.14.7.
+Here's a short list:
 
 new `time' reserved word to time pipelines, shell builtins, and
        shell functions
@@ -295,15 +344,15 @@ grammar tighter and smaller (66 reduce-reduce conflicts gone)
 lots of code now smaller and faster
 test suite greatly expanded
 
-11) Are there any user-visible incompatibilities between bash-2.0 and
+12) Are there any user-visible incompatibilities between bash-2.01 and
     bash-1.14.7?
 
-There are a few incompatibilities between version 1.14.7 and version 2.0.
-They are detailed in the file COMPAT in the bash-2.0 distribution.
+There are a few incompatibilities between version 1.14.7 and version 2.01.
+They are detailed in the file COMPAT in the bash-2.01 distribution.
 
 Section C:  Differences from other Unix shells
 
-12) How does bash differ from sh, the Bourne shell?
+13) How does bash differ from sh, the Bourne shell?
 
 This is a non-comprehensive list of features that differentiate bash
 from the SVR4.2 shell.  The bash manual page explains these more
@@ -370,7 +419,6 @@ Things sh has that bash does not:
        includes `stop' builtin (bash can use alias stop='kill -s STOP')
        `newgrp' builtin
        turns on job control if called as `jsh'
-       ulimit attempts to set both soft & hard limits if -S/-H not given
        $TIMEOUT (like bash $TMOUT)
        `^' is a synonym for `|'
        new SVR4.2 sh builtins: mldmode, priv
@@ -386,11 +434,12 @@ Implementation differences:
        sh does not allow traps on SIGALRM or SIGCHLD
        bash allows multiple option arguments when invoked (e.g. -x -v);
                sh allows only a single option argument (`sh -x -v' attempts
-               to open a file named `-v', and, on SunOS 4.1.4, dumps core)
+               to open a file named `-v', and, on SunOS 4.1.4, dumps core.
+               On Solaris 2, sh goes into an infinite loop.)
        sh exits a script if any builtin fails; bash exits only if one of
                the POSIX.2 `special' builtins fails
 
-13)  How does bash differ from the Korn shell, version ksh88?
+14)  How does bash differ from the Korn shell, version ksh88?
 
 Things bash has or uses that ksh88 does not:
        long invocation options
@@ -438,15 +487,14 @@ Things ksh88 has or uses that bash does not:
 
 Implementation differences:
        ksh runs last command of a pipeline in parent shell context
-       ksh ulimit sets hard and soft limits by default
        bash has brace expansion by default (ksh88 compile-time option)
        bash has fixed startup file for all interactive shells; ksh reads $ENV
        bash has exported functions
        bash command search finds functions before builtins
 
-14)  Which new features in ksh-93 are not in bash, and which are?
+15)  Which new features in ksh-93 are not in bash, and which are?
 
-New things in ksh-93 not in bash-2.0:
+New things in ksh-93 not in bash-2.01:
        associative arrays
        floating point arithmetic
        ++, --, comma arithmetic operators
@@ -466,11 +514,10 @@ New things in ksh-93 not in bash-2.0:
        `fc' has been renamed to `hist'
        read -t/-d
        `.' can execute shell functions
-       ENV processed only for interactive shells
 
-New things in ksh-93 present in bash-2.0:
+New things in ksh-93 present in bash-2.01:
        ?: arithmetic operator
-       expansions: ${!param}, ${param:len[:offset]}, ${param/pat[/str]}
+       expansions: ${!param}, ${param:offset[:len]}, ${param/pat[/str]}
        compound array assignment
        the `!' reserved word
        loadable builtins -- but ksh uses `builtin' while bash uses `enable'
@@ -488,10 +535,11 @@ New things in ksh-93 present in bash-2.0:
        unalias -a
        command and arithmetic substitution performed on PS1, PS4, and ENV
        command name completion
+       ENV processed only for interactive shells
 
 Section D:  Why does bash do some things differently than other Unix shells?
 
-15) Why does bash run a different version of `command' than
+16) Why does bash run a different version of `command' than
     `which command' says it will?
 
 `which' is actually a csh script that assumes you're running csh. 
@@ -500,7 +548,7 @@ those to determine which `command' will be invoked.  Since bash
 doesn't use any of those startup files, there's a good chance
 that your bash environment differs from your csh environment. 
 
-16) Why doesn't bash treat brace expansions exactly like csh?
+17) Why doesn't bash treat brace expansions exactly like csh?
 
 The only difference between bash and csh brace expansion is that
 bash requires a brace expression to contain at least one unquoted
@@ -511,7 +559,7 @@ compatibility.
 
 Bash, ksh, zsh, and pd-ksh all implement brace expansion this way. 
 
-17) Why doesn't bash have csh variable modifiers?
+18) Why doesn't bash have csh variable modifiers?
 
 Posix has specified a more powerful, albeit somewhat more cryptic,
 mechanism cribbed from ksh, and bash implements it.
@@ -566,7 +614,7 @@ Given
        $b:e                    ${b##*.}           xxx
 
 
-18) How can I make my csh aliases work when I convert to bash?
+19) How can I make my csh aliases work when I convert to bash?
 
 Bash uses a different syntax to support aliases than csh does. 
 The details can be found in the documentation.  We have provided
@@ -609,7 +657,7 @@ simply `cshtobash' to convert your normal interactive
 environment, or as `cshtobash ~/.login' to convert your login
 environment. 
 
-19) How can I pipe standard output and standard error from one command to
+20) How can I pipe standard output and standard error from one command to
     another, like csh does with `|&'?
 
 Use
@@ -619,7 +667,7 @@ The key is to remember that piping is performed before redirection, so
 file descriptor 1 points to the pipe when it is duplicated onto file
 descriptor 2.
 
-20) Now that I've converted from ksh to bash, are there equivalents to
+21) Now that I've converted from ksh to bash, are there equivalents to
     ksh features like autoloaded functions and the `whence' command?
 
 There are features in ksh-88 that do not have direct bash equivalents.
@@ -642,7 +690,7 @@ read var?prompt             read -p prompt var
 Section E:  How can I get bash to do certain things, and why does bash do
            things the way it does?
 
-21) Why is the bash builtin `test' slightly different from /bin/test?
+22) Why is the bash builtin `test' slightly different from /bin/test?
 
 The specific example used here is [ ! x -o x ], which is false.
 
@@ -671,7 +719,7 @@ of the 3 Arg case.
    
 As you can see, the test becomes (not (x or x)), which is false.
 
-22) Why does bash sometimes say `Broken pipe'?
+23) Why does bash sometimes say `Broken pipe'?
 
 If a sequence of commands appears in a pipeline, and one of the
 reading commands finishes before the writer has finished, the
@@ -686,7 +734,7 @@ will try to write on a pipe without a reader.  In that case, bash
 will print `Broken pipe' to stderr when ps is killed by a
 SIGPIPE. 
 
-23) How can I get bash to read and display eight-bit characters?
+24) How can I get bash to read and display eight-bit characters?
 
 This is a process requiring several steps.
 
@@ -720,7 +768,7 @@ this.  These variables can be set in your .inputrc or using the bash
 The `set' commands between the single quotes may also be placed
 in ~/.inputrc.
 
-24) How do I write a function `x' to replace builtin command `x', but
+25) How do I write a function `x' to replace builtin command `x', but
     still invoke the command from within the function?
 
 This is why the `command' and `builtin' builtins exist.  The
@@ -741,7 +789,7 @@ something like the following:
 This could also be written using `command' instead of `builtin';
 the version above is marginally more efficient. 
 
-25) When I have terminal escape sequences in my prompt, why does bash
+26) When I have terminal escape sequences in my prompt, why does bash
     wrap lines at the wrong column?
 
 Readline, the line editing library that bash uses, does not know
@@ -757,10 +805,10 @@ characters in the prompt strings take up no screen space.
 Use the \[ escape to begin a sequence of non-printing characters,
 and the \] escape to signal the end of such a sequence. 
 
-26) How can I find the value of a shell variable whose name is the value
+27) How can I find the value of a shell variable whose name is the value
     of another shell variable?
 
-Bash-2.0 supports this directly.  You can use 
+Bash-2.01 supports this directly.  You can use 
 
        ${!var}
 
@@ -782,13 +830,13 @@ parameter:
 
 The expansion of the quoted portions of this expression will be
 deferred until `eval' runs, while the `$#' will be expanded
-before `eval' is executed.  In bash-2.0,
+before `eval' is executed.  In bash-2.01,
 
        echo ${!#}
 
 does the same thing.
 
-27) If I pipe the output of a command into `read variable', why doesn't
+28) If I pipe the output of a command into `read variable', why doesn't
     the output show up in $variable when the read command finishes?
 
 This has to do with the parent-child relationship between Unix
@@ -844,7 +892,7 @@ this.
 This is the general approach -- in most cases you will not need to
 set $IFS to a different value.
 
-28) I have a bunch of shell scripts that use backslash-escaped characters
+29) I have a bunch of shell scripts that use backslash-escaped characters
     in arguments to `echo'.  Bash doesn't interpret these characters.  Why
     not, and how can I make it understand them?
 
@@ -864,7 +912,7 @@ configure with the --enable-usg-echo-default option to turn this
 on.  Be aware that this will cause some of the tests run when you
 type `make tests' to fail.
 
-29) Why doesn't a while or for loop get suspended when I type ^Z?
+30) Why doesn't a while or for loop get suspended when I type ^Z?
 
 This is a consequence of how job control works on Unix.  The only
 thing that can be suspended is the process group.  This is a single
@@ -879,7 +927,7 @@ If you want to be able to stop the entire loop, you need to put it
 within parentheses, which will force the loop into a subshell that
 may be stopped (and subsequently restarted) as a single unit.
 
-30) How can I make the bash `time' reserved word print timing output that
+31) How can I make the bash `time' reserved word print timing output that
     looks like the output from my system's /usr/bin/time?
 
 The bash command timing code looks for a variable `TIMEFORMAT' and
@@ -913,7 +961,7 @@ The ksh format can be emulated with:
 
 Section F:  Things to watch out for on certain Unix versions
 
-31) Why can't I use command line editing in my `cmdtool'?
+32) Why can't I use command line editing in my `cmdtool'?
 
 The problem is `cmdtool' and bash fighting over the input.  When
 scrolling is enabled in a cmdtool window, cmdtool puts the tty in
@@ -941,7 +989,7 @@ The bash command-line editing should behave better in the new
 cmdtool.  If this works, you can put the assignment to TERMCAP
 in your bashrc file.
 
-32) I built bash on Solaris 2.  Why do globbing expansions and filename
+33) I built bash on Solaris 2.  Why do globbing expansions and filename
     completion chop off the first few characters of each filename?
 
 This is the consequence of building bash on SunOS 5 and linking
@@ -961,7 +1009,7 @@ If you have installed the Sun C compiler, you may also need to
 put /usr/ccs/bin and /opt/SUNWspro/bin into your $PATH before
 /usr/ucb.
 
-33) Why does bash dump core after I interrupt username completion or
+34) Why does bash dump core after I interrupt username completion or
     `~user' tilde expansion on a machine running NIS?
 
 This is a famous and long-standing bug in the SunOS YP (sorry, NIS)
@@ -984,7 +1032,7 @@ times; that's probably why this has never been fixed.  You can
 run configure with the `--without-gnu-malloc' option to use
 the C library malloc and avoid the problem.
 
-34) I'm running SVR4.2.  Why is the line erased every time I type `@'?
+35) I'm running SVR4.2.  Why is the line erased every time I type `@'?
 
 The `@' character is the default `line kill' character in most
 versions of System V, including SVR4.2.  You can change this
@@ -995,7 +1043,7 @@ change the line kill character to control-u, type
 
 where the `^' and `U' can be two separate characters.
 
-35) Why does bash report syntax errors when my C News scripts use a
+36) Why does bash report syntax errors when my C News scripts use a
     redirection before a subshell command?
 
 The actual command in question is something like
@@ -1007,7 +1055,7 @@ is, in fact, a syntax error.  Redirections may only precede `simple
 commands'.  A subshell construct such as the above is one of the shell's
 `compound commands'.  A redirection may only follow a compound command.
 
-The file CWRU/sh-redir-hack in the bash-2.0 distribution is an
+The file CWRU/sh-redir-hack in the bash-2.01 distribution is an
 (unofficial) patch to parse.y that will modify the grammar to
 support this construct.  It will not apply with `patch'; you must
 modify parse.y by hand.  Note that if you apply this, you must
@@ -1016,7 +1064,7 @@ number of reduce/reduce conflicts into the shell grammar.
 
 Section G:  Where do I go from here?
 
-36) How do I report bugs in bash, and where should I look for fixes and
+37) How do I report bugs in bash, and where should I look for fixes and
     advice?
 
 Use the `bashbug' script to report bugs.  It is built and
@@ -1034,7 +1082,7 @@ and problems also take place there.
 To reach the bash maintainers directly, send mail to
 bash-maintainers@prep.ai.mit.edu.
 
-37) What kind of bash documentation is there?
+38) What kind of bash documentation is there?
 
 First, look in the doc directory in the bash distribution.  It should
 contain at least the following files:
@@ -1056,19 +1104,23 @@ slc2.ins.cwru.edu in the `pub/bash' directory.
 
 Cameron Newham and Bill Rosenblatt have written a book on bash, published
 by O'Reilly and Associates.  The book is based on Bill Rosenblatt's Korn
-Shell book.  The title is ``Learning the Bash Shell''.  The ISBN number is
-1-56592-147-X.  Look for it in fine bookstores near you.  This book covers
-bash-1.14, but has an appendix describing some of the new features in
-bash-2.0. 
+Shell book.  The title is ``Learning the Bash Shell'', and the ISBN number
+is 1-56592-147-X.  Look for it in fine bookstores near you.  This book
+covers bash-1.14, but has an appendix describing some of the new features
+in bash-2.0.  There are rumors of a second edition of this book, describing
+bash-2.0 (and 2.01).  I do not know what ORA's publication schedule for
+this edition is.
 
-38) What's coming in future versions?
+39) What's coming in future versions?
 
 These are features I plan to include in a future version of bash.
 
 POSIX.2-style globbing character classes ([:alpha:], [:alnum:], etc.)
-a bash debugger (an incomplete, untested version is included with bash-2.0)
+POSIX.2-style globbing equivalence classes
+POSIX.2-style globbing collating symbols
+a bash debugger (a minimally-tested version is included with bash-2.01)
 
-39) What's on the bash `wish list' for future versions?
+40) What's on the bash `wish list' for future versions?
 
 These are features that may or may not appear in a future version of bash.
 
@@ -1084,7 +1136,7 @@ timeouts for the `read' builtin
 the ksh-93 ${!prefix*} and ${!prefix@} operators
 arithmetic ++ and -- prefix and postfix operators
 
-40) When will the next release appear?
+41) When will the next release appear?
 
 The next version will appear sometime in 1997.  Never make predictions.
 
index 3ac3012..3f4ee98 100644 (file)
@@ -148,14 +148,20 @@ installdirs:
 install: info installdirs
        -$(INSTALL_DATA) $(srcdir)/bash.1 $(man1dir)/bash.${man1ext}
        -$(INSTALL_DATA) $(srcdir)/bashbug.1 $(man1dir)/bashbug.${man1ext}
-       -$(INSTALL_DATA) $(srcdir)/readline.3 $(man3dir)/readline.${man3ext}
-       -$(INSTALL_DATA) $(srcdir)/bashref.info $(infodir)/bash.info
+# uncomment the next line to install the readline man page
+#      -$(INSTALL_DATA) $(srcdir)/readline.3 $(man3dir)/readline.${man3ext}
 # uncomment the next line to install the builtins man page
 #      $(INSTALL_DATA) builtins.1 $(man1dir)/bash_builtins.${man1ext}
+       -$(INSTALL_DATA) $(srcdir)/bashref.info $(infodir)/bash.info
+# run install-info if it is present to update the info directory
+       if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
+               install-info --dir-file=$(infodir)/dir $(infodir)/bash.info; \
+       else true; fi
 
 uninstall:
-       $(RM) $(man1dir)/bash.${man1ext} $(man1dir)/bashbug.${man1ext}
-       $(RM) $(man3dir)/readline.${man3ext} $(infodir)/bash.info
+       -$(RM) $(man1dir)/bash.${man1ext} $(man1dir)/bashbug.${man1ext}
+       -$(RM) $(man3dir)/readline.${man3ext}
+       $(RM) $(infodir)/bash.info
 
 # for use by chet
 inst:  bashref.texi
index 68ace07..ef37d2a 100644 (file)
@@ -6,11 +6,11 @@
 .\"    Case Western Reserve University
 .\"    chet@ins.CWRU.Edu
 .\"
-.\"    Last Change: Mon Nov 25 15:36:20 EST 1996
+.\"    Last Change: Mon May 19 12:45:24 EDT 1997
 .\"
 .\" bash_builtins, strip all but Built-Ins section
 .if \n(zZ=1 .ig zZ
-.TH BASH 1 "1996 Nov 25" GNU
+.TH BASH 1 "1997 May 19" GNU
 .\"
 .\" There's some problem with having a `@'
 .\" in a tagged paragraph with the BSD man macros.
@@ -256,8 +256,9 @@ section.
 .PP
 When
 .B bash
-is invoked as a login shell, it first reads and executes commands
-from the file \fI/etc/profile\fP, if that file exists.
+is invoked as an interactive login shell, it first reads and
+executes commands from the file \fI/etc/profile\fP, if that
+file exists.
 After reading that file, it looks for \fI~/.bash_profile\fP,
 \fI~/.bash_login\fP, and \fI~/.profile\fP, in that order, and reads
 and executes commands from the first one that exists and is readable.
@@ -623,7 +624,7 @@ is the exit status of the last command executed in
 .IR list ,
 or zero if no commands were executed.
 .TP
-\fBcase\fP \fIword\fP \fBin\fP [ \fIpattern\fP [ \fB|\fP \fIpattern\fP ] \
+\fBcase\fP \fIword\fP \fBin\fP [ \fIpattern\fP [ \fB|\fP \fIpattern\fP ] \
 ... ) \fIlist\fP ;; ] ... \fBesac\fP
 A \fBcase\fP command first expands \fIword\fP, and tries to match
 it against each \fIpattern\fP in turn, using the same matching rules
@@ -902,7 +903,11 @@ is the first character of the value of the
 variable.  If
 .SM
 .B IFS
-is null or unset, the parameters are separated by spaces.
+is unset, the parameters are separated by spaces.
+If
+.SM
+.B IFS
+is null, the parameters are joined without intervening separators.
 .TP
 .B @
 Expands to the positional parameters, starting from one.  When the
@@ -999,6 +1004,10 @@ Expands to the user ID of the current user, initialized at shell startup.
 Expands to the effective user ID of the current user, initialized at
 shell startup.
 .TP
+.B GROUPS
+An array variable containing the list of groups of which the current
+user is a member.
+.TP
 .B BASH
 Expands to the full file name used to invoke this instance of
 .BR bash .
@@ -1221,14 +1230,14 @@ specified by the
 command.  A sample value is
 ``.:~:/usr''.
 .TP
-.B ENV
+.B BASH_ENV
 If this parameter is set when \fBbash\fP is executing a shell script,
 its value is interpreted as a filename containing commands to
 initialize the shell, as in
 .IR .bashrc .
 The value of
 .SM
-.B ENV
+.B BASH_ENV
 is subjected to parameter expansion, command substitution, and arithmetic
 expansion before being interpreted as a file name.
 .SM
@@ -3130,7 +3139,7 @@ below).
 .SH READLINE
 This is the library that handles reading input when using an interactive
 shell, unless the
-.B \-noediting
+.B \-\-noediting
 option is given at shell invocation.
 By default, the line editing commands are similar to those of emacs.
 A vi-style line editing interface is also available.
@@ -3668,11 +3677,22 @@ word expansions.  See
 below for a description of history expansion.
 .TP
 .B history\-expand\-line (M\-^)
-Perform history expansion on the current line.  See
+Perform history expansion on the current line.
+See
 .SM
 .B HISTORY EXPANSION
 below for a description of history expansion.
 .TP
+.B alias\-expand\-line
+Perform alias expansion on the current line.
+See
+.SM
+.B ALIASES
+above for a description of alias expansion.
+.TP
+.B history\-and\-alias\-expand\-line
+Perform history and alias expansion on the current line.
+.TP
 .B insert\-last\-argument (M\-.\^, M\-_\^)
 A synonym for \fByank\-last\-arg\fP.
 .TP
@@ -3794,9 +3814,18 @@ Add this digit to the argument already accumulating, or start a new
 argument.  M\-\- starts a negative argument.
 .TP
 .B universal\-argument
-Each time this is executed, the argument count is multiplied by four.
+This is another way to specify an argument.
+If this command is followed by one or more digits, optionally with a
+leading minus sign, those digits define the argument.
+If the command is followed by digits, executing
+.B universal\-argument
+again ends the numeric argument, but is otherwise ignored.
+As a special case, if this command is immediately followed by a
+character that is neither a digit or minus sign, the argument count
+for the next command is multiplied by four.
 The argument count is initially one, so executing this function the
-first time makes the argument count four.
+first time makes the argument count four, a second time makes the
+argument count sixteen, and so on.
 .PD
 .SS Completing
 .PP
@@ -3980,7 +4009,7 @@ Display version information about the current instance of
 .PD
 .SH HISTORY
 When the
-.B -o history
+.B \-o history
 option to the
 .B set
 builtin is enabled, the shell provides access to the
@@ -5494,12 +5523,15 @@ Arguments, if supplied, have the following meanings:
 \fB+\fP\fIn\fP
 Rotates the stack so that the \fIn\fPth directory
 (counting from the left of the list shown by
-.BR dirs )
+.BR dirs ,
+starting with zero)
 is at the top.
 .TP
 \fB\-\fP\fIn\fP
 Rotates the stack so that the \fIn\fPth directory
-(counting from the right) is at the top.
+(counting from the right of the list shown by
+.BR dirs ,
+starting with zero) is at the top.
 .TP
 .B \-n
 Suppresses the normal change of directory when adding directories
@@ -6006,7 +6038,7 @@ The errors checked for are transposed characters,
 a missing character, and one character too many.
 If a correction is found, the corrected file name is printed,
 and the command proceeds.
-This option is enabled by default, but is only used by interactive shells.
+This option is only used by interactive shells.
 .TP 8
 .B checkhash
 If set, \fBbash\fP checks that a command found in the hash
@@ -6303,7 +6335,7 @@ may be positive or negative integers.
 Print the accumulated user and system times for the shell and
 for processes run from the shell.  The return status is 0.
 .TP
-\fBtrap\fP [\fB\-lp\fP] [\fIarg\fP] [\fIsigspec\fP]
+\fBtrap\fP [\fB\-lp\fP] [\fIarg\fP] [\fIsigspec\fP ...]
 The command
 .I arg
 is to be read and executed when the shell receives
@@ -6315,11 +6347,12 @@ is absent or
 .BR \- ,
 all specified signals are
 reset to their original values (the values they had
-upon entrance to the shell).  If 
+upon entrance to the shell).
+If 
 .I arg
-is the null string this
-signal is ignored by the shell and by the
-commands it invokes.
+is the null string the signal specified by each
+.I sigspec
+is ignored by the shell and by the commands it invokes.
 If
 .I arg
 is
@@ -6333,16 +6366,18 @@ only
 is given,
 .B trap
 prints the list of commands associated with each signal number.
+Each
 .I sigspec
 is either
-a signal name defined in <\fIsignal.h\fP>, or a signal number.  If
+a signal name defined in <\fIsignal.h\fP>, or a signal number.
+If a
 .I sigspec
 is
 .SM
 .B EXIT
 (0) the command
 .I arg
-is executed on exit from the shell.  If
+is executed on exit from the shell.  If a
 .I sigspec
 is
 .SM
@@ -6359,7 +6394,8 @@ option causes the shell to print a list of signal names and
 their corresponding numbers.
 Signals ignored upon entry to the shell cannot be trapped or reset.
 Trapped signals are reset to their original values in a child
-process when it is created.  The return status is false if any
+process when it is created.
+The return status is false if any
 .I sigspec
 is invalid; otherwise
 .B trap
@@ -6723,8 +6759,7 @@ that you have.
 Once you have determined that a bug actually exists, use the
 .I bashbug
 command to submit a bug report.
-If you have a fix, you are welcome to mail that
-as well!
+If you have a fix, you are encouraged to mail that as well!
 Suggestions and `philosophical' bug reports may be mailed
 to \fPbug-bash\fP@\fIprep.ai.MIT.Edu\fP or posted to the Usenet
 newsgroup
index 6e4ecc1..974c2ce 100644 (file)
@@ -4,9 +4,9 @@ input file ./bashref.texi.
 This text is a brief description of the features that are present in
 the Bash shell.
 
-This is Edition 2.0, last updated 25 November 1996,
+This is Edition 2.0, last updated 19 May 1997,
 of `The GNU Bash Reference Manual',
-for `Bash', Version 2.0.
+for `Bash', Version 2.01.
 
 Copyright (C) 1991, 1993, 1996 Free Software Foundation, Inc.
 
@@ -33,8 +33,8 @@ Bash Features
    This text is a brief description of the features that are present in
 the Bash shell.
 
-   This is Edition 2.0, last updated 25 November 1996, of `The GNU Bash
-Reference Manual', for `Bash', Version 2.0.
+   This is Edition 2.0, last updated 19 May 1997, of `The GNU Bash
+Reference Manual', for `Bash', Version 2.01.
 
    Copyright (C) 1991, 1993, 1996 Free Software Foundation, Inc.
 
@@ -205,8 +205,8 @@ Definitions
      descended from it, that are all in the same process group.
 
 `job control'
-     A mechanism by which users can selectively start and stop execution
-     of processes.
+     A mechanism by which users can selectively stop (suspend) and
+     restart (resume) execution of processes.
 
 `metacharacter'
      A character that, when unquoted, separates words.  A metacharacter
@@ -612,7 +612,7 @@ Conditional Constructs
 `case'
      The syntax of the `case' command is:
 
-          `case WORD in [PATTERN [| PATTERN]...) COMMANDS ;;]... esac'
+          `case WORD in [ ( PATTERN [| PATTERN]...) COMMANDS ;;]... esac'
 
      Selectively execute COMMANDS based upon WORD matching PATTERN.
      The `|' is used to separate multiple patterns.
@@ -634,7 +634,7 @@ Conditional Constructs
           (( EXPRESSION ))
 
      The EXPRESSION is evaluated according to the rules described below
-     ((*note Arithmetic Evaluation::.).  If the value of the expression
+     (*note Arithmetic Evaluation::.).  If the value of the expression
      is non-zero, the return status is 0; otherwise the return status
      is 1.  This is exactly equivalent to
           let "EXPRESSION"
@@ -673,8 +673,8 @@ the list may be redirected to a single stream.
 difference between these two constructs due to historical reasons.  The
 braces are `reserved words', so they must be separated from the LIST by
 `blank's.  The parentheses are `operators', and are recognized as
-separate tokens by the shell even if they are not separated from `list'
-by whitespace.
+separate tokens by the shell even if they are not separated from the
+LIST by whitespace.
 
    The exit status of both of these constructs is the exit status of
 LIST.
@@ -701,7 +701,7 @@ status of the last command executed in the body.
 
    When a function is executed, the arguments to the function become
 the positional parameters during its execution (*note Positional
-Parameters::.).  The special parameter `#' that gives the number of
+Parameters::.).  The special parameter `#' that expands to the number of
 positional parameters is updated to reflect the change.  Positional
 parameter `0' is unchanged.
 
@@ -783,8 +783,9 @@ only be referenced; assignment to them is not allowed.
      with the value of each parameter separated by the first character
      of the `IFS' special variable.  That is, `"$*"' is equivalent to
      `"$1C$2C..."', where C is the first character of the value of the
-     `IFS' variable.  If `IFS' is null or unset, the parameters are
-     separated by spaces.
+     `IFS' variable.  If `IFS' is unset, the parameters are separated
+     by spaces.  If `IFS' is null, the parameters are joined without
+     intervening separators.
 
 `@'
      Expands to the positional parameters, starting from one.  When the
@@ -880,7 +881,7 @@ parameter, variable, and arithemtic expansion and command substitution.
    Only brace expansion, word splitting, and filename expansion can
 change the number of words of the expansion; other expansions expand a
 single word to a single word.  The only exceptions to this are the
-expansions of `"$@"' (*note Special Parameters::.) and `"${[@]}"'
+expansions of `"$@"' (*note Special Parameters::.) and `"${NAME[@]}"'
 (*note Arrays::.).
 
    After all expansions, `quote removal' (*note Quote Removal::.) is
@@ -907,9 +908,9 @@ name.
    If the first character of PARAMETER is an exclamation point, a level
 of variable indirection is introduced.  Bash uses the value of the
 variable formed from the rest of PARAMETER as the name of the variable;
-this variable is then expanded and that value used in the rest of the
-substitution, rather than the value of PARAMETER itself.  This is known
-as `indirect expansion'.
+this variable is then expanded and that value is used in the rest of
+the substitution, rather than the value of PARAMETER itself.  This is
+known as `indirect expansion'.
 
    In each of the cases below, WORD is subject to tilde expansion,
 parameter expansion, command substitution, and arithmetic expansion.
@@ -1654,20 +1655,21 @@ standard.
      children.
 
 `trap'
-          trap [-lp] [ARG] [SIGSPEC]
+          trap [-lp] [ARG] [SIGSPEC ...]
      The commands in ARG are to be read and executed when the shell
      receives signal SIGSPEC.  If ARG is absent or equal to `-', all
      specified signals are reset to the values they had when the shell
-     was started.  If ARG is the null string, then SIGSPEC is ignored by
-     the shell and commands it invokes.  If ARG is `-p', the shell
-     displays the trap commands associated with each SIGSPEC.  If no
-     arguments are supplied, or only `-p' is given, `trap' prints the
-     list of commands associated with each signal number.  SIGSPEC is
-     either a signal name such as `SIGINT' or a signal number.  If
-     SIGSPEC is `0' or `EXIT', ARG is executed when the shell exits.
-     If SIGSPEC is `DEBUG', the command ARG is executed after every
-     simple command.  The `-l' option causes the shell to print a list
-     of signal names and their corresponding numbers.
+     was started.  If ARG is the null string, then the signal specified
+     by each SIGSPEC is ignored by the shell and commands it invokes.
+     If ARG is `-p', the shell displays the trap commands associated
+     with each SIGSPEC.  If no arguments are supplied, or only `-p' is
+     given, `trap' prints the list of commands associated with each
+     signal number.  Each SIGSPEC is either a signal name such as
+     `SIGINT' (with or without the `SIG' prefix) or a signal number.
+     If a SIGSPEC is `0' or `EXIT', ARG is executed when the shell
+     exits.  If a SIGSPEC is `DEBUG', the command ARG is executed after
+     every simple command.  The `-l' option causes the shell to print a
+     list of signal names and their corresponding numbers.
 
      Signals ignored upon entry to the shell cannot be trapped or reset.
      Trapped signals are reset to their original values in a child
@@ -1826,7 +1828,7 @@ translation of the characters between the double quotes.  The `-D' and
 `--dump-strings' invocation options list the translatable strings found
 in a script (*note Locale Translation::.).
 
-   The expansion `${var:'LENGTH`[:'OFFSET`]}', which expands to the
+   The expansion `${var:'OFFSET`[:'LENGTH`]}', which expands to the
 substring of `var''s value of length LENGTH, optionally beginning at
 OFFSET, is present (*note Shell Parameter Expansion::.).
 
@@ -1842,10 +1844,10 @@ Parameter Expansion::.).
    Bash has process substitution (*note Process Substitution::.).
 
    Bash automatically assigns variables that provide information about
-the current user (`UID' and `EUID'), the current host (`HOSTTYPE',
-`OSTYPE', `MACHTYPE', and `HOSTNAME'), and the instance of Bash that is
-running (`BASH', `BASH_VERSION', and `BASH_VERSINFO'.  *Note Bash
-Variables::, for details.
+the current user (`UID', `EUID', and `GROUPS'), the current host
+(`HOSTTYPE', `OSTYPE', `MACHTYPE', and `HOSTNAME'), and the instance of
+Bash that is running (`BASH', `BASH_VERSION', and `BASH_VERSINFO'.
+*Note Bash Variables::, for details.
 
    The `IFS' variable is used to split only the results of expansion,
 not all words (*note Word Splitting::.).  This closes a longstanding
@@ -1858,9 +1860,9 @@ shell security hole.
 `local' builtin, and thus useful recursive functions may be written.
 
    Variable assignments preceding commands affect only that command,
-even builtins and functions.  In `sh', all variable assignments
-preceding commands are global unless the command is executed from the
-file system.
+even builtins and functions (*note Environment::.).  In `sh', all
+variable assignments preceding commands are global unless the command
+is executed from the file system.
 
    Bash performs filename expansion on filenames specified as operands
 to output redirection operators.
@@ -1932,16 +1934,17 @@ shell input, a `-n' option to remove various variable attributes, and
 `name=value' arguments to set variable attributes and values
 simultaneously.
 
-   The Bash `cd' and `pwd' builtins each take `-L' and `-P' builtins to
-switch between logical and physical modes.
+   The Bash `cd' and `pwd' builtins (*note Bourne Shell Builtins::.)
+each take `-L' and `-P' builtins to switch between logical and physical
+modes.
 
    The Bash `type' builtin is more extensive and gives more information
-about the names it finds.
+about the names it finds (*note Bash Builtins::.).
 
    Bash implements a `csh'-like directory stack, and provides the
-`pushd', `popd', and `dirs' builtins to manipulate it.  Bash also makes
-the directory stack visible as the value of the `DIRSTACK' shell
-variable.
+`pushd', `popd', and `dirs' builtins to manipulate it (*note C Shell
+Builtins::.).  Bash also makes the directory stack visible as the value
+of the `DIRSTACK' shell variable.
 
    The Bash restricted mode is more useful (*note The Restricted
 Shell::.); the SVR4.2 shell restricted mode is too limited.
@@ -1979,10 +1982,10 @@ from many of the limitations of the SVR4.2 shell.  For instance:
      `SIGSEGV' blocked (e.g., by using the `system()' C library
      function call), the shell misbehaves badly.
 
-   * In a questionable attempt at security, the SVR4.2 shell will alter
-     its real and effective UID and GID if they are less than some
-     threshold value, commonly 100.  This can lead to unexpected
-     results.
+   * In a questionable attempt at security, the SVR4.2 shell, when
+     invoked without the `-p' option, will alter its real and effective
+     UID and GID if they are less than some magic threshold value,
+     commonly 100.  This can lead to unexpected results.
 
    * The SVR4.2 shell does not allow users to trap `SIGALRM' or
      `SIGCHLD'.
@@ -1999,7 +2002,7 @@ from many of the limitations of the SVR4.2 shell.  For instance:
 
    * The SVR4.2 shell exits a script if any builtin fails; Bash exits a
      script only if one of the POSIX.2 special builtins fails, and only
-     for certain failures, as enumerated in the `POSIX.2' standard.
+     for certain failures, as enumerated in the POSIX.2 standard.
 
    * The SVR4.2 shell behaves differently when invoked as `jsh' (it
      turns on job control).
@@ -2108,13 +2111,13 @@ to `csh'.
 
     `+N'
           Brings the Nth directory (counting from the left of the list
-          printed by `dirs') to the top of the list by rotating the
-          stack.
+          printed by `dirs', starting with zero) to the top of the list
+          by rotating the stack.
 
     `-N'
           Brings the Nth directory (counting from the right of the list
-          printed by `dirs') to the top of the list by rotating the
-          stack.
+          printed by `dirs', starting with zero) to the top of the list
+          by rotating the stack.
 
     `-n'
           Suppresses the normal change of directory when adding
@@ -2288,10 +2291,10 @@ saved in the variable `REPLY'.
 completes.
 
    Bash also has adopted command timing from the Korn shell.  If the
-`time' reserved word precedes a pipeline or simple command, timing
-statistics for the pipeline are displayed when it completes.  The
-statistics currently consist of elapsed (wall-clock) time and user and
-system time consumed by the command's execution.
+`time' reserved word precedes a pipeline, which may consist of a single
+command, timing statistics for the pipeline are displayed when it
+completes.  The statistics currently consist of elapsed (wall-clock)
+time and user and system time consumed by the command's execution.
 
    The use of `time' as a reserved word permits the timing of shell
 builtins, shell functions, and pipelines.  An external `time' command
@@ -2389,12 +2392,6 @@ Korn Shell Variables
      The line number in the script or shell function currently
      executing.
 
-`ENV'
-     If this variable is set when Bash is invoked to execute a shell
-     script, its value is expanded and used as the name of a startup
-     file to read before executing the script.  *Note Bash Startup
-     Files::.
-
 `FCEDIT'
      The editor used as a default by the `fc' builtin command.
 
@@ -2609,17 +2606,18 @@ File: bashref.info,  Node: Bash Startup Files,  Next: Is This Shell Interactive?
 Bash Startup Files
 ==================
 
-   This section describs how bash executes its startup files.  If any
-of the files exist but cannot be read, bash reports an error.  Tildes
+   This section describs how Bash executes its startup files.  If any
+of the files exist but cannot be read, Bash reports an error.  Tildes
 are expanded in file names as described above under Tilde Expansion
 (*note Tilde Expansion::.).
 
-   When Bash is invoked as a login shell, it first reads and executes
-commands from the file `/etc/profile', if that file exists.  After
-reading that file, it looks for `~/.bash_profile', `~/.bash_login', and
-`~/.profile', in that order, and reads and executes commands from the
-first one that exists and is readable.  The `--noprofile' option may be
-used when the shell is started to inhibit this behavior.
+   When Bash is invoked as an interactive login shell, it first reads
+and executes commands from the file `/etc/profile', if that file exists.
+After reading that file, it looks for `~/.bash_profile',
+`~/.bash_login', and `~/.profile', in that order, and reads and
+executes commands from the first one that exists and is readable.  The
+`--noprofile' option may be used when the shell is started to inhibit
+this behavior.
 
    When a login shell exits, Bash reads and executes commands from the
 file `~/.bash_logout', if it exists.
@@ -2667,7 +2665,7 @@ are read.
 line option, it follows the POSIX standard for startup files.  In this
 mode, the `ENV' variable is expanded and commands are read and executed
 from the file whose name is the expanded value.  No other startup files
-are read.  This is done by both interactive and non-interactive shells.
+are read.  This is done by interactive shells only.
 
    Bash attempts to determine when it is being run by the remote shell
 daemon, usually `rshd'.  If Bash determines it is being run by rshd, it
@@ -2699,6 +2697,14 @@ Thus:
              echo This shell is interactive
      fi
 
+   Alternatively, you may test the value of the `-' special parameter.
+It contains `i' when the shell is interactive.  For example:
+
+     case "$-" in
+     *i*)      echo This shell is interactive ;;
+     *)        echo This shell is not interactive ;;
+     esac
+
 \1f
 File: bashref.info,  Node: Bash Builtins,  Next: The Set Builtin,  Prev: Is This Shell Interactive?,  Up: Bash Features
 
@@ -2764,9 +2770,9 @@ been extended in Bash.
 
 `builtin'
           builtin [SHELL-BUILTIN [ARGS]]
-     Run a shell builtin.  This is useful when you wish to rename a
-     shell builtin to be a function, but need the functionality of the
-     builtin within the function itself.
+     Run a shell builtin.  This is useful when you wish to define a
+     shell function with the same name as a shell builtin, but need the
+     functionality of the builtin within the function itself.
 
 `command'
           command [-pVv] COMMAND [ARGS ...]
@@ -2974,7 +2980,7 @@ been extended in Bash.
           are transposed characters, a missing character, and a
           character too many.  If a correction is found, the corrected
           path is printed, and the command proceeds.  This option is
-          enabled by default, but is only used by interactive shells.
+          only used by interactive shells.
 
     `checkhash'
           If this is set, Bash checks that a command found in the hash
@@ -3018,7 +3024,8 @@ been extended in Bash.
     `hostcomplete'
           If set, and Readline is being used, Bash will attempt to
           perform hostname completion when a word beginning with `@' is
-          being completed (*note Commands For Completion::.).
+          being completed (*note Commands For Completion::.).  This
+          option is enabled by default.
 
     `interactive_comments'
           Allow a word beginning with `#' to cause that word and all
@@ -3249,10 +3256,10 @@ The Set Builtin
                same as `-x'.
 
     `-p'
-          Turn on privileged mode.  In this mode, the `$ENV' file is
-          not processed, and shell functions are not inherited from the
-          environment.  This is enabled automatically on startup if the
-          effective user (group) id is not equal to the real user
+          Turn on privileged mode.  In this mode, the `$BASH_ENV' file
+          is not processed, and shell functions are not inherited from
+          the environment.  This is enabled automatically on startup if
+          the effective user (group) id is not equal to the real user
           (group) id.  Turning this option off causes the effective user
           and group ids to be set to the real user and group ids.
 
@@ -3484,6 +3491,12 @@ Bash Variables
    These variables are set or used by Bash, but other shells do not
 normally treat them specially.
 
+`BASH_ENV'
+     If this variable is set when Bash is invoked to execute a shell
+     script, its value is expanded and used as the name of a startup
+     file to read before executing the script.  *Note Bash Startup
+     Files::.
+
 `TIMEFORMAT'
      The value of this parameter is used as a format string specifying
      how the timing information for pipelines prefixed with the `time'
@@ -3518,9 +3531,9 @@ normally treat them specially.
      fraction is included.
 
      If this variable is not set, bash acts as if it had the value
-     `$'\nreal\t%3lR\nuser\t%3lU\nsys\t%3lS''.  If the value is null,
-     no timing information is displayed.  A trailing newline is added
-     when the format string is displayed.
+          `$'\nreal\t%3lR\nuser\t%3lU\nsys\t%3lS''.
+     If the value is null, no timing information is displayed.  A
+     trailing newline is added when the format string is displayed.
 
 `HISTCONTROL'
      Set to a value of `ignorespace', it means don't enter lines which
@@ -3603,6 +3616,10 @@ normally treat them specially.
 `EUID'
      The numeric effective user id of the current user.
 
+`GROUPS'
+     An array variable containing the list of groups of which the
+     current user is a member.
+
 `PPID'
      The process id of the shell's parent process.
 
@@ -3691,8 +3708,8 @@ normally treat them specially.
 
 `SHLVL'
      Incremented by one each time a new instance of Bash is started.
-     This is intended to be an account of how deeply your Bash shells
-     are nested.
+     This is intended to be a count of how deeply your Bash shells are
+     nested.
 
 `OPTERR'
      If set to the value 1, Bash displays error messages generated by
@@ -3706,9 +3723,13 @@ normally treat them specially.
      This variable overrides the value of `LANG' and any other `LC_'
      variable specifying a locale category.
 
+`LC_COLLATE'
+     This variable determines the collation order used when sorting the
+     results of filename expansion (*note Filename Expansion::.).
+
 `LC_MESSAGES'
      This variable determines the locale used to translate double-quoted
-     strings preceded by a `$'.
+     strings preceded by a `$' (*note Locale Translation::.).
 
 `IGNOREEOF'
      Controls the action of the shell on receipt of an `EOF' character
@@ -4110,6 +4131,9 @@ specified by POSIX.2 in areas where the Bash default differs.
  20. Assignment statements preceding POSIX.2 `special' builtins persist
      in the shell environment after the builtin completes.
 
+ 21. The `export' and `readonly' builtin commands display their output
+     in the format required by POSIX.2.
+
 
    There is other POSIX.2 behavior that Bash does not implement.
 Specifically:
@@ -4264,10 +4288,11 @@ Job Control Builtins
           kill [-s SIGSPEC] [-n SIGNUM] [-SIGSPEC] JOBSPEC
           kill -l [SIGSPEC]
      Send a signal specified by SIGSPEC or SIGNUM to the process named
-     by JOBSPEC.  SIGSPEC is either a signal name such as `SIGINT' or a
-     signal number; SIGNUM is a signal number.  If SIGSPEC and SIGNUM
-     are not present, `SIGTERM' is used.  The `-l' option lists the
-     signal names, or the signal name corresponding to SIGSPEC.
+     by JOBSPEC.  SIGSPEC is either a signal name such as `SIGINT'
+     (with or without the `SIG' prefix) or a signal number; SIGNUM is a
+     signal number.  If SIGSPEC and SIGNUM are not present, `SIGTERM'
+     is used.  The `-l' option lists the signal names, or the signal
+     name corresponding to SIGSPEC.
 
 `wait'
           wait [JOBSPEC|PID]
@@ -4304,12 +4329,12 @@ Job Control Variables
      This variable controls how the shell interacts with the user and
      job control.  If this variable exists then single word simple
      commands without redirects are treated as candidates for resumption
-     of an existing job.  There is no ambiguity allowed; if you have
-     more than one job beginning with the string that you have typed,
-     then the most recently accessed job will be selected.  The name of
-     a stopped job, in this context, is the command line used to start
-     it.  If this variable is set to the value `exact', the string
-     supplied must match the name of a stopped job exactly; if set to
+     of an existing job.  There is no ambiguity allowed; if there is
+     more than one job beginning with the string typed, then the most
+     recently accessed job will be selected.  The name of a stopped
+     job, in this context, is the command line used to start it.  If
+     this variable is set to the value `exact', the string supplied
+     must match the name of a stopped job exactly; if set to
      `substring', the string supplied needs to match a substring of the
      name of a stopped job.  The `substring' value provides
      functionality analogous to the `%?' job ID (*note Job Control
@@ -5094,31 +5119,31 @@ binding, variable assignment, and conditional syntax.
      #
      # Arrow keys in keypad mode
      #
-     #"\M-OD"        backward-char
-     #"\M-OC"        forward-char
-     #"\M-OA"        previous-history
-     #"\M-OB"        next-history
+     #"\M-OD":        backward-char
+     #"\M-OC":        forward-char
+     #"\M-OA":        previous-history
+     #"\M-OB":        next-history
      #
      # Arrow keys in ANSI mode
      #
-     "\M-[D"        backward-char
-     "\M-[C"        forward-char
-     "\M-[A"        previous-history
-     "\M-[B"        next-history
+     "\M-[D":        backward-char
+     "\M-[C":        forward-char
+     "\M-[A":        previous-history
+     "\M-[B":        next-history
      #
      # Arrow keys in 8 bit keypad mode
      #
-     #"\M-\C-OD"       backward-char
-     #"\M-\C-OC"       forward-char
-     #"\M-\C-OA"       previous-history
-     #"\M-\C-OB"       next-history
+     #"\M-\C-OD":       backward-char
+     #"\M-\C-OC":       forward-char
+     #"\M-\C-OA":       previous-history
+     #"\M-\C-OB":       next-history
      #
      # Arrow keys in 8 bit ANSI mode
      #
-     #"\M-\C-[D"       backward-char
-     #"\M-\C-[C"       forward-char
-     #"\M-\C-[A"       previous-history
-     #"\M-\C-[B"       next-history
+     #"\M-\C-[D":       backward-char
+     #"\M-\C-[C":       forward-char
+     #"\M-\C-[A":       previous-history
+     #"\M-\C-[B":       next-history
      
      C-q: quoted-insert
      
@@ -5410,10 +5435,17 @@ Specifying Numeric Arguments
      argument.  M- starts a negative argument.
 
 `universal-argument ()'
-     Each time this is executed, the argument count is multiplied by
-     four.  The argument count is initially one, so executing this
-     function the first time makes the argument count four.  By
-     default, this is not bound to a key.
+     This is another way to specify an argument.  If this command is
+     followed by one or more digits, optionally with a leading minus
+     sign, those digits define the argument.  If the command is
+     followed by digits, executing `universal-argument' again ends the
+     numeric argument, but is otherwise ignored.  As a special case, if
+     this command is immediately followed by a character that is
+     neither a digit or minus sign, the argument count for the next
+     command is multiplied by four.  The argument count is initially
+     one, so executing this function the first time makes the argument
+     count four, a second time makes the argument count sixteen, and so
+     on.  By default, this is not bound to a key.
 
 \1f
 File: bashref.info,  Node: Commands For Completion,  Next: Keyboard Macros,  Prev: Numeric Arguments,  Up: Bindable Readline Commands
@@ -5606,6 +5638,12 @@ Some Miscellaneous Commands
 `history-expand-line (M-^)'
      Perform history expansion on the current line.
 
+`alias-expand-line'
+     Perform alias expansion on the current line (*note Aliases::.).
+
+`history-and-alias-expand-line'
+     Perform history and alias expansion on the current line.
+
 `insert-last-argument (M-., M-_)'
      A synonym for `yank-last-arg'.
 
@@ -5652,7 +5690,7 @@ OS/2, Windows 95, and Windows NT.
 
 * Menu:
 
-* Basic Installation:: Generic installation instructions.
+* Basic Installation:: Installation instructions.
 
 * Compilers and Options::      How to set special options for various
                                systems.
@@ -5679,7 +5717,7 @@ File: bashref.info,  Node: Basic Installation,  Next: Compilers and Options,  Up
 Basic Installation
 ==================
 
-   These are generic installation instructions for Bash.
+   These are installation instructions for Bash.
 
    The `configure' shell script attempts to guess correct values for
 various system-dependent variables used during compilation.  It uses
@@ -5702,7 +5740,15 @@ they can be considered for the next release.
    The file `configure.in' is used to create `configure' by a program
 called Autoconf.  You only need `configure.in' if you want to change it
 or regenerate `configure' using a newer version of Autoconf.  If you do
-this, make sure you are using Autoconf version 2.9 or newer.
+this, make sure you are using Autoconf version 2.10 or newer.
+
+   If you need to change `configure.in' or regenerate `configure', you
+will need to create two files: `_distribution' and `_patchlevel'.
+`_distribution' should contain the major and minor version numbers of
+the Bash distribution, for example `2.01'.  `_patchlevel' should
+contain the patch level of the Bash distribution, `0' for example.  The
+script `support/mkconffiles' has been provided to automate the creation
+of these files.
 
    The simplest way to compile Bash is:
 
@@ -5880,21 +5926,27 @@ configure Bash without a feature that is enabled by default, use
    Here is a complete list of the `--enable-' and `--with-' options
 that the Bash `configure' recognizes.
 
-`--with-gnu-malloc'
-     Use the GNU version of `malloc' in `lib/malloc/malloc.c'.  This is
-     not the same `malloc' that appears in GNU libc, but an older
-     version derived from the 4.2 BSD `malloc'.  This `malloc' is very
-     fast, but wastes a lot of space.  This option is enabled by
-     default.  The `NOTES' file contains a list of systems for which
-     this should be turned off.
+`--with-afs'
+     Define if you are using the Andrew File System from Transarc.
+
+`--with-curses'
+     Use the curses library instead of the termcap library.  This should
+     be supplied if your system has an inadequate or incomplete termcap
+     database.
 
 `--with-glibc-malloc'
      Use the GNU libc version of `malloc' in `lib/malloc/gmalloc.c'.
      This is somewhat slower than the default `malloc', but wastes
      considerably less space.
 
-`--with-afs'
-     Define if you are using the Andrew File System from Transarc.
+`--with-gnu-malloc'
+     Use the GNU version of `malloc' in `lib/malloc/malloc.c'.  This is
+     not the same `malloc' that appears in GNU libc, but an older
+     version derived from the 4.2 BSD `malloc'.  This `malloc' is very
+     fast, but wastes a lot of space.  This option is enabled by
+     default.  The `NOTES' file contains a list of systems for which
+     this should be turned off, and `configure' disables this option
+     automatically for a number of systems.
 
 `--with-purify'
      Define this to use the Purify memory allocation checker from Pure
@@ -5912,32 +5964,48 @@ enabled using `enable-FEATURE'.
 `usg-echo-default' are enabled by default, unless the operating system
 does not provide the necessary support.
 
-`--enable-job-control'
-     This enables job control features, if the OS supports them.
-
 `--enable-alias'
      Allow alias expansion and include the `alias' and `unalias'
      builtins.
 
-`--enable-readline'
-     Include support for command-line editing and history with the Bash
-     version of the Readline library.
-
-`--enable-history'
-     Include command history and the `fc' and `history' builtin
-     commands.
+`--enable-array-variables'
+     Include support for one-dimensional array shell variables.
 
 `--enable-bang-history'
      Include support for `csh'-like history substitution.
 
+`--enable-brace-expansion'
+     Include `csh'-like brace expansion ( `b{a,b}c' ==> `bac bbc' ).
+
+`--enable-command-timing'
+     Include support for recognizing `time' as a reserved word and for
+     displaying timing statistics for the pipeline following `time'.
+     This allows pipelines as well as shell builtins and functions to
+     be timed.
+
 `--enable-directory-stack'
      Include support for a `csh'-like directory stack and the `pushd',
      `popd', and `dirs' builtins.
 
-`--enable-restricted'
-     Include support for a "restricted shell".  If this is enabled,
-     Bash, when called as `rbash', enters a restricted mode.  See *Note
-     The Restricted Shell::, for a description of restricted mode.
+`--enable-disabled-builtins'
+     Allow builtin commands to be invoked via `builtin xxx' even after
+     `xxx' has been disabled using `enable -n xxx'.  See *Note Bash
+     Builtins::, for details of the `builtin' and `enable' builtin
+     commands.
+
+`--enable-dparen-arithmetic'
+     Include support for the `ksh' `((...))' command.
+
+`--enable-help-builtin'
+     Include the `help' builtin, which displays help on shell builtins
+     and variables.
+
+`--enable-history'
+     Include command history and the `fc' and `history' builtin
+     commands.
+
+`--enable-job-control'
+     This enables job control features, if the OS supports them.
 
 `--enable-process-substitution'
      This enables process substitution (*note Process Substitution::.)
@@ -5948,35 +6016,19 @@ does not provide the necessary support.
      characters in the `$PS1', `$PS2', `$PS3', and `$PS4' prompt
      strings.
 
+`--enable-readline'
+     Include support for command-line editing and history with the Bash
+     version of the Readline library.
+
+`--enable-restricted'
+     Include support for a "restricted shell".  If this is enabled,
+     Bash, when called as `rbash', enters a restricted mode.  See *Note
+     The Restricted Shell::, for a description of restricted mode.
+
 `--enable-select'
      Include the `ksh' `select' builtin, which allows the generation of
      simple menus.
 
-`--enable-help-builtin'
-     Include the `help' builtin, which displays help on shell builtins
-     and variables.
-
-`--enable-array-variables'
-     Include support for one-dimensional array shell variables.
-
-`--enable-dparen-arithmetic'
-     Include support for the `ksh' `((...))' command.
-
-`--enable-brace-expansion'
-     Include `csh'-like brace expansion ( `b{a,b}c' ==> `bac bbc' ).
-
-`--enable-disabled-builtins'
-     Allow builtin commands to be invoked via `builtin xxx' even after
-     `xxx' has been disabled using `enable -n xxx'.  See *Note Bash
-     Builtins::, for details of the `builtin' and `enable' builtin
-     commands.
-
-`--enable-command-timing'
-     Include support for recognizing `time' as a reserved word and for
-     displaying timing statistics for the pipeline following `time'.
-     This allows pipelines as well as shell builtins and functions to
-     be timed.
-
 `--enable-usg-echo-default'
      Make the `echo' builtin expand backslash-escaped characters by
      default, without requiring the `-e' option.  This makes the Bash
@@ -6000,7 +6052,7 @@ of Bash that you have.
 
    Once you have determined that a bug actually exists, use the
 `bashbug' command to submit a bug report.  If you have a fix, you are
-welcome to mail that as well!  Suggestions and `philosophical' bug
+encouraged to mail that as well!  Suggestions and `philosophical' bug
 reports may be mailed to `bug-bash@prep.ai.MIT.Edu' or posted to the
 Usenet newsgroup `gnu.bash.bug'.
 
@@ -6132,6 +6184,7 @@ Parameter and Variable Index
 * _:                                    Special Parameters.
 * auto_resume:                          Job Control Variables.
 * BASH:                                 Bash Variables.
+* BASH_ENV:                             Bash Variables.
 * BASH_VERSINFO:                        Bash Variables.
 * BASH_VERSION:                         Bash Variables.
 * bell-style:                           Readline Init File Syntax.
@@ -6143,12 +6196,12 @@ Parameter and Variable Index
 * disable-completion:                   Readline Init File Syntax.
 * editing-mode:                         Readline Init File Syntax.
 * enable-keypad:                        Readline Init File Syntax.
-* ENV:                                  Korn Shell Variables.
 * EUID:                                 Bash Variables.
 * expand-tilde:                         Readline Init File Syntax.
 * FCEDIT:                               Korn Shell Variables.
 * FIGNORE:                              Bash Variables.
 * GLOBIGNORE:                           Bash Variables.
+* GROUPS:                               Bash Variables.
 * histchars:                            Bash Variables.
 * HISTCMD:                              Bash Variables.
 * HISTCONTROL:                          Bash Variables.
@@ -6169,6 +6222,7 @@ Parameter and Variable Index
 * keymap:                               Readline Init File Syntax.
 * LANG:                                 Bash Variables.
 * LC_ALL:                               Bash Variables.
+* LC_COLLATE:                           Bash Variables.
 * LC_MESSAGES:                          Bash Variables.
 * LINENO:                               Korn Shell Variables.
 * MACHTYPE:                             Bash Variables.
@@ -6391,123 +6445,123 @@ Concept Index
 
 \1f
 Tag Table:
-Node: Top\7f1009
-Node: Introduction\7f3117
-Node: What is Bash?\7f3342
-Node: What is a shell?\7f4426
-Node: Definitions\7f6307
-Node: Basic Shell Features\7f8947
-Node: Shell Syntax\7f10468
-Node: Shell Operation\7f10758
-Node: Quoting\7f11992
-Node: Escape Character\7f13027
-Node: Single Quotes\7f13458
-Node: Double Quotes\7f13787
-Node: ANSI-C Quoting\7f14483
-Node: Locale Translation\7f15215
-Node: Comments\7f15636
-Node: Simple Commands\7f16160
-Node: Pipelines\7f16749
-Node: Lists\7f17820
-Node: Looping Constructs\7f19095
-Node: Conditional Constructs\7f20272
-Node: Command Grouping\7f22337
-Node: Shell Functions\7f23721
-Node: Shell Parameters\7f25489
-Node: Positional Parameters\7f26812
-Node: Special Parameters\7f27506
-Node: Shell Expansions\7f29998
-Node: Shell Parameter Expansion\7f31998
-Node: Command Substitution\7f38003
-Node: Process Substitution\7f39003
-Node: Word Splitting\7f39909
-Node: Filename Expansion\7f41361
-Node: Quote Removal\7f43727
-Node: Redirections\7f44013
-Node: Executing Commands\7f49754
-Node: Command Search and Execution\7f50209
-Node: Environment\7f51943
-Node: Exit Status\7f53579
-Node: Signals\7f54596
-Node: Shell Scripts\7f55807
-Node: Bourne Shell Features\7f57676
-Node: Bourne Shell Builtins\7f58346
-Node: Bourne Shell Variables\7f66619
-Node: Other Bourne Shell Features\7f68156
-Node: Major Differences From The Bourne Shell\7f68913
-Node: Csh Features\7f79111
-Node: Brace Expansion\7f80029
-Node: Tilde Expansion\7f81584
-Node: C Shell Builtins\7f82216
-Node: C Shell Variables\7f86732
-Node: Korn Shell Features\7f87140
-Node: Korn Shell Constructs\7f87868
-Node: Korn Shell Builtins\7f89562
-Node: Korn Shell Variables\7f91720
-Node: Aliases\7f93505
-Node: Alias Builtins\7f95969
-Node: Bash Features\7f96585
-Node: Invoking Bash\7f97576
-Node: Bash Startup Files\7f101441
-Node: Is This Shell Interactive?\7f105024
-Node: Bash Builtins\7f105755
-Node: The Set Builtin\7f121569
-Node: Bash Conditional Expressions\7f126939
-Node: Bash Variables\7f131590
-Node: Shell Arithmetic\7f141103
-Node: Arithmetic Evaluation\7f141571
-Node: Arithmetic Expansion\7f143601
-Node: Arithmetic Builtins\7f144405
-Node: Arrays\7f144876
-Node: Printing a Prompt\7f147903
-Node: The Restricted Shell\7f149501
-Node: Bash POSIX Mode\7f150731
-Node: Job Control\7f154303
-Node: Job Control Basics\7f154768
-Node: Job Control Builtins\7f158911
-Node: Job Control Variables\7f161794
-Node: Using History Interactively\7f162955
-Node: Bash History Facilities\7f163544
-Node: History Interaction\7f165942
-Node: Event Designators\7f168504
-Node: Word Designators\7f169427
-Node: Modifiers\7f170676
-Node: Command Line Editing\7f171993
-Node: Introduction and Notation\7f172653
-Node: Readline Interaction\7f173661
-Node: Readline Bare Essentials\7f174849
-Node: Readline Movement Commands\7f176378
-Node: Readline Killing Commands\7f177268
-Node: Readline Arguments\7f178970
-Node: Searching\7f179943
-Node: Readline Init File\7f181579
-Node: Readline Init File Syntax\7f182635
-Node: Conditional Init Constructs\7f190424
-Node: Sample Init File\7f192705
-Node: Bindable Readline Commands\7f195722
-Node: Commands For Moving\7f196472
-Node: Commands For History\7f197319
-Node: Commands For Text\7f199992
-Node: Commands For Killing\7f201734
-Node: Numeric Arguments\7f203760
-Node: Commands For Completion\7f204386
-Node: Keyboard Macros\7f207348
-Node: Miscellaneous Commands\7f207906
-Node: Readline vi Mode\7f211937
-Node: Installing Bash\7f212813
-Node: Basic Installation\7f213890
-Node: Compilers and Options\7f216389
-Node: Compiling For Multiple Architectures\7f217123
-Node: Installation Names\7f218780
-Node: Specifying the System Type\7f219502
-Node: Sharing Defaults\7f220213
-Node: Operation Controls\7f220878
-Node: Optional Features\7f221783
-Node: Reporting Bugs\7f226408
-Node: Builtin Index\7f227485
-Node: Reserved Word Index\7f230898
-Node: Variable Index\7f232206
-Node: Function Index\7f237285
-Node: Concept Index\7f241643
+Node: Top\7f1005
+Node: Introduction\7f3109
+Node: What is Bash?\7f3334
+Node: What is a shell?\7f4418
+Node: Definitions\7f6299
+Node: Basic Shell Features\7f8960
+Node: Shell Syntax\7f10481
+Node: Shell Operation\7f10771
+Node: Quoting\7f12005
+Node: Escape Character\7f13040
+Node: Single Quotes\7f13471
+Node: Double Quotes\7f13800
+Node: ANSI-C Quoting\7f14496
+Node: Locale Translation\7f15228
+Node: Comments\7f15649
+Node: Simple Commands\7f16173
+Node: Pipelines\7f16762
+Node: Lists\7f17833
+Node: Looping Constructs\7f19108
+Node: Conditional Constructs\7f20285
+Node: Command Grouping\7f22352
+Node: Shell Functions\7f23738
+Node: Shell Parameters\7f25511
+Node: Positional Parameters\7f26834
+Node: Special Parameters\7f27528
+Node: Shell Expansions\7f30094
+Node: Shell Parameter Expansion\7f32098
+Node: Command Substitution\7f38106
+Node: Process Substitution\7f39106
+Node: Word Splitting\7f40012
+Node: Filename Expansion\7f41464
+Node: Quote Removal\7f43830
+Node: Redirections\7f44116
+Node: Executing Commands\7f49857
+Node: Command Search and Execution\7f50312
+Node: Environment\7f52046
+Node: Exit Status\7f53682
+Node: Signals\7f54699
+Node: Shell Scripts\7f55910
+Node: Bourne Shell Features\7f57779
+Node: Bourne Shell Builtins\7f58449
+Node: Bourne Shell Variables\7f66803
+Node: Other Bourne Shell Features\7f68340
+Node: Major Differences From The Bourne Shell\7f69097
+Node: Csh Features\7f79457
+Node: Brace Expansion\7f80375
+Node: Tilde Expansion\7f81930
+Node: C Shell Builtins\7f82562
+Node: C Shell Variables\7f87118
+Node: Korn Shell Features\7f87526
+Node: Korn Shell Constructs\7f88254
+Node: Korn Shell Builtins\7f89969
+Node: Korn Shell Variables\7f92127
+Node: Aliases\7f93686
+Node: Alias Builtins\7f96150
+Node: Bash Features\7f96766
+Node: Invoking Bash\7f97757
+Node: Bash Startup Files\7f101622
+Node: Is This Shell Interactive?\7f105197
+Node: Bash Builtins\7f106180
+Node: The Set Builtin\7f122035
+Node: Bash Conditional Expressions\7f127410
+Node: Bash Variables\7f132061
+Node: Shell Arithmetic\7f142095
+Node: Arithmetic Evaluation\7f142563
+Node: Arithmetic Expansion\7f144593
+Node: Arithmetic Builtins\7f145397
+Node: Arrays\7f145868
+Node: Printing a Prompt\7f148895
+Node: The Restricted Shell\7f150493
+Node: Bash POSIX Mode\7f151723
+Node: Job Control\7f155407
+Node: Job Control Basics\7f155872
+Node: Job Control Builtins\7f160015
+Node: Job Control Variables\7f162938
+Node: Using History Interactively\7f164085
+Node: Bash History Facilities\7f164674
+Node: History Interaction\7f167072
+Node: Event Designators\7f169634
+Node: Word Designators\7f170557
+Node: Modifiers\7f171806
+Node: Command Line Editing\7f173123
+Node: Introduction and Notation\7f173783
+Node: Readline Interaction\7f174791
+Node: Readline Bare Essentials\7f175979
+Node: Readline Movement Commands\7f177508
+Node: Readline Killing Commands\7f178398
+Node: Readline Arguments\7f180100
+Node: Searching\7f181073
+Node: Readline Init File\7f182709
+Node: Readline Init File Syntax\7f183765
+Node: Conditional Init Constructs\7f191554
+Node: Sample Init File\7f193835
+Node: Bindable Readline Commands\7f196868
+Node: Commands For Moving\7f197618
+Node: Commands For History\7f198465
+Node: Commands For Text\7f201138
+Node: Commands For Killing\7f202880
+Node: Numeric Arguments\7f204906
+Node: Commands For Completion\7f206030
+Node: Keyboard Macros\7f208992
+Node: Miscellaneous Commands\7f209550
+Node: Readline vi Mode\7f213766
+Node: Installing Bash\7f214642
+Node: Basic Installation\7f215711
+Node: Compilers and Options\7f218636
+Node: Compiling For Multiple Architectures\7f219370
+Node: Installation Names\7f221027
+Node: Specifying the System Type\7f221749
+Node: Sharing Defaults\7f222460
+Node: Operation Controls\7f223125
+Node: Optional Features\7f224030
+Node: Reporting Bugs\7f228913
+Node: Builtin Index\7f229993
+Node: Reserved Word Index\7f233406
+Node: Variable Index\7f234714
+Node: Function Index\7f239899
+Node: Concept Index\7f244257
 \1f
 End Tag Table
index fe871c3..6d1719f 100644 (file)
@@ -5,13 +5,13 @@
 @c %**end of header
 
 @ignore
-last change: Mon Nov 25 11:47:06 EST 1996
+last change: Mon May 19 12:55:22 EDT 1997
 @end ignore
 
 @set EDITION 2.0
-@set VERSION 2.0
-@set UPDATED 25 November 1996
-@set UPDATE-MONTH November 1996
+@set VERSION 2.01
+@set UPDATED 19 May 1997
+@set UPDATE-MONTH May 1997
 
 @iftex
 @finalout
@@ -272,8 +272,8 @@ from it, that are all in the same process group.
 
 @item job control
 @cindex job control
-A mechanism by which users can selectively start and stop execution
-of processes.
+A mechanism by which users can selectively stop (suspend) and restart
+(resume) execution of processes.
 
 @item metacharacter
 @cindex metacharacter
@@ -717,7 +717,7 @@ has a non-zero exit status, then execute @var{alternate-consequents}.
 The syntax of the @code{case} command is:
 
 @example
-@code{case @var{word} in [@var{pattern} [| @var{pattern}]@dots{}) @var{commands} ;;]@dots{} esac}
+@code{case @var{word} in [ ( @var{pattern} [| @var{pattern}]@dots{}) @var{commands} ;;]@dots{} esac}
 @end example
 
 Selectively execute @var{commands} based upon @var{word} matching
@@ -744,7 +744,7 @@ echo " legs."
 @end example
 
 The @var{expression} is evaluated according to the rules described
-below ((@pxref{Arithmetic Evaluation}).
+below (@pxref{Arithmetic Evaluation}).
 If the value of the expression is non-zero, the return status is 0;
 otherwise the return status is 1.  This is exactly equivalent to
 @example
@@ -794,7 +794,7 @@ between these two constructs due to historical reasons.  The braces
 are @code{reserved words}, so they must be separated from the @var{list}
 by @code{blank}s.  The parentheses are @code{operators}, and are
 recognized as separate tokens by the shell even if they are not separated
-from @code{list} by whitespace.
+from the @var{list} by whitespace.
 
 The exit status of both of these constructs is the exit status of
 @var{list}.
@@ -825,10 +825,9 @@ the exit status of the last command executed in the body.
 When a function is executed, the arguments to the
 function become the positional parameters
 during its execution (@pxref{Positional Parameters}).
-The special parameter
-@samp{#} that gives the number of positional parameters
-is updated to reflect the change.  Positional parameter @code{0}
-is unchanged.
+The special parameter @samp{#} that expands to the number of
+positional parameters is updated to reflect the change.
+Positional parameter @code{0} is unchanged.
 
 If the builtin command @code{return}
 is executed in a function, the function completes and
@@ -919,8 +918,11 @@ of the @code{IFS}
 special variable.  That is, @code{"$*"} is equivalent
 to @code{"$1@var{c}$2@var{c}@dots{}"}, where @var{c}
 is the first character of the value of the @code{IFS}
-variable.  If @code{IFS}
-is null or unset, the parameters are separated by spaces.
+variable.
+If @code{IFS} is unset, the parameters are separated by spaces.
+If @code{IFS} is null, the parameters are joined without intervening
+separators.
+
 
 @item @@
 Expands to the positional parameters, starting from one.  When the
@@ -1020,7 +1022,7 @@ Only brace expansion, word splitting, and filename expansion
 can change the number of words of the expansion; other expansions
 expand a single word to a single word.
 The only exceptions to this are the expansions of
-@code{"$@@"} (@pxref{Special Parameters}) and @code{"$@{[@@]@}"}
+@code{"$@@"} (@pxref{Special Parameters}) and @code{"$@{@var{name}[@@]@}"}
 (@pxref{Arrays}).
 
 After all expansions, @code{quote removal} (@pxref{Quote Removal})
@@ -1050,7 +1052,7 @@ If the first character of @var{parameter} is an exclamation point,
 a level of variable indirection is introduced.
 Bash uses the value of the variable formed from the rest of
 @var{parameter} as the name of the variable; this variable is then
-expanded and that value used in the rest of the substitution, rather
+expanded and that value is used in the rest of the substitution, rather
 than the value of @var{parameter} itself.
 This is known as @code{indirect expansion}.
 
@@ -1953,21 +1955,23 @@ Print out the user and system times used by the shell and its children.
 @item trap
 @btindex trap
 @example
-trap [-lp] [@var{arg}] [@var{sigspec}]
+trap [-lp] [@var{arg}] [@var{sigspec} @dots{}]
 @end example
 The commands in @var{arg} are to be read and executed when the
 shell receives signal @var{sigspec}.  If @var{arg} is absent or
 equal to @samp{-}, all specified signals are reset to the values
 they had when the shell was started.
-If @var{arg} is the null string, then @var{sigspec} is ignored by
-the shell and commands it invokes.
+If @var{arg} is the null string, then the signal specified by
+each @var{sigspec} is ignored by the shell and commands it invokes.
 If @var{arg} is @samp{-p}, the shell displays the trap commands
 associated with each @var{sigspec}.  If no arguments are supplied, or
 only @samp{-p} is given, @code{trap} prints the list of commands
-associated with each signal number.  @var{sigspec} is either a signal
-name such as @code{SIGINT} or a signal number.  If @var{sigspec} is
-@code{0} or @code{EXIT}, @var{arg} is executed when the shell exits.
-If @var{sigspec} is @code{DEBUG}, the command @var{arg} is executed
+associated with each signal number.
+Each @var{sigspec} is either a signal name such as @code{SIGINT} (with
+or without the @code{SIG} prefix) or a signal number.
+If a @var{sigspec}
+is @code{0} or @code{EXIT}, @var{arg} is executed when the shell exits.
+If a @var{sigspec} is @code{DEBUG}, the command @var{arg} is executed
 after every simple command.
 The @samp{-l} option causes the shell to print a list of signal names
 and their corresponding numbers.
@@ -2136,7 +2140,7 @@ quotes.  The @samp{-D} and @samp{--dump-strings} invocation options
 list the translatable strings found in a script
 (@pxref{Locale Translation}).
 
-The expansion @code{$@{var:}@var{length}@code{[:}@var{offset}@code{]@}},
+The expansion @code{$@{var:}@var{offset}@code{[:}@var{length}@code{]@}},
 which expands to the substring of @code{var}'s value of length
 @var{length}, optionally beginning at @var{offset}, is present
 (@pxref{Shell Parameter Expansion}).
@@ -2155,7 +2159,7 @@ Bash can expand positional parameters beyond @code{$9} using
 Bash has process substitution (@pxref{Process Substitution}).
 
 Bash automatically assigns variables that provide information about the
-current user (@code{UID} and @code{EUID}), the current host
+current user (@code{UID}, @code{EUID}, and @code{GROUPS}), the current host
 (@code{HOSTTYPE}, @code{OSTYPE}, @code{MACHTYPE}, and @code{HOSTNAME}),
 and the instance of Bash that is running (@code{BASH},
 @code{BASH_VERSION}, and @code{BASH_VERSINFO}.  @xref{Bash Variables},
@@ -2172,7 +2176,8 @@ Bash functions are permitted to have local variables using the
 @code{local} builtin, and thus useful recursive functions may be written.
 
 Variable assignments preceding commands affect only that command, even
-builtins and functions.  In @code{sh}, all variable assignments 
+builtins and functions (@pxref{Environment}).
+In @code{sh}, all variable assignments 
 preceding commands are global unless the command is executed from the
 file system.
 
@@ -2249,14 +2254,16 @@ used as shell input, a @samp{-n} option to remove various variable
 attributes, and @samp{name=value} arguments to set variable attributes
 and values simultaneously.
 
-The Bash @code{cd} and @code{pwd} builtins each take @samp{-L} and
-@samp{-P} builtins to switch between logical and physical modes.
+The Bash @code{cd} and @code{pwd} builtins (@pxref{Bourne Shell Builtins})
+each take @samp{-L} and @samp{-P} builtins to switch between logical and
+physical modes.
 
 The Bash @code{type} builtin is more extensive and gives more information
-about the names it finds.
+about the names it finds (@pxref{Bash Builtins}).
 
 Bash implements a @code{csh}-like directory stack, and provides the
-@code{pushd}, @code{popd}, and @code{dirs} builtins to manipulate it.
+@code{pushd}, @code{popd}, and @code{dirs} builtins to manipulate it
+(@pxref{C Shell Builtins}).
 Bash also makes the directory stack visible as the value of the
 @code{DIRSTACK} shell variable.
 
@@ -2304,10 +2311,11 @@ trapping @code{SIGSEGV}.  If the shell is started from a process with
 function call), the shell misbehaves badly.
 
 @item
-In a questionable attempt at security, the @sc{SVR4.2} shell
-will alter its real
+In a questionable attempt at security, the @sc{SVR4.2} shell,
+when invoked without the @samp{-p} option, will alter its real
 and effective @sc{UID} and @sc{GID} if they are less than some
-threshold value, commonly 100.  This can lead to unexpected results.
+magic threshold value, commonly 100.
+This can lead to unexpected results.
 
 @item
 The @sc{SVR4.2} shell does not allow users to trap @code{SIGALRM} or
@@ -2330,7 +2338,7 @@ with a @samp{-}.
 @item
 The @sc{SVR4.2} shell exits a script if any builtin fails; Bash exits
 a script only if one of the @sc{POSIX.2} special builtins fails, and
-only for certain failures, as enumerated in the @code{POSIX.2} standard.
+only for certain failures, as enumerated in the @sc{POSIX.2} standard.
 
 @item 
 The @sc{SVR4.2} shell behaves differently when invoked as @code{jsh}
@@ -2454,12 +2462,12 @@ arguments, exchanges the top two directories.
 @table @code
 @item +@var{N}
 Brings the @var{N}th directory (counting from the left of the
-list printed by @code{dirs}) to the top of the list by rotating
-the stack.
+list printed by @code{dirs}, starting with zero) to the top of
+the list by rotating the stack.
 @item -@var{N}
 Brings the @var{N}th directory (counting from the right of the
-list printed by @code{dirs}) to the top of the list by rotating
-the stack.
+list printed by @code{dirs}, starting with zero) to the top of
+the list by rotating the stack.
 @item -n
 Suppresses the normal change of directory when adding directories
 to the stack, so that only the stack is manipulated.
@@ -2644,8 +2652,9 @@ The @var{commands} are executed after each selection until a
 point the @code{select} command completes.
 
 Bash also has adopted command timing from the Korn shell.  If the
-@code{time} reserved word precedes a pipeline or simple command,
-timing statistics for the pipeline are displayed when it completes.
+@code{time} reserved word precedes a pipeline, which may consist
+of a single command, timing statistics for the pipeline are displayed
+when it completes.
 The statistics currently consist of elapsed (wall-clock) time and
 user and system time consumed by the command's execution.
 
@@ -2751,11 +2760,6 @@ not arrive.
 @item LINENO
 The line number in the script or shell function currently executing.
 
-@item ENV
-If this variable is set when Bash is invoked to execute a shell
-script, its value is expanded and used as the name of a startup file
-to read before executing the script.  @xref{Bash Startup Files}.
-
 @item FCEDIT
 The editor used as a default by the @code{fc} builtin command.
 
@@ -2992,12 +2996,12 @@ in the script.  If no commands are executed, the exit status is 0.
 @section Bash Startup Files
 @cindex startup files
 
-This section describs how bash executes its startup files.
-If any of the files exist but cannot be read, bash reports an error.
+This section describs how Bash executes its startup files.
+If any of the files exist but cannot be read, Bash reports an error.
 Tildes are expanded in file names as described above under
 Tilde Expansion (@pxref{Tilde Expansion}).
 
-When Bash is invoked as a login shell, it first reads and
+When Bash is invoked as an interactive login shell, it first reads and
 executes commands from the file @file{/etc/profile}, if that file exists.
 After reading that file, it looks for @file{~/.bash_profile},
 @file{~/.bash_login}, and @file{~/.profile}, in that order, and reads
@@ -3059,7 +3063,7 @@ for startup files.
 In this mode, the @code{ENV} variable is expanded and commands are read
 and executed from the file whose name is the expanded value.
 No other startup files are read.
-This is done by both interactive and non-interactive shells.
+This is done by interactive shells only.
 
 Bash attempts to determine when it is being run by the remote shell
 daemon, usually @code{rshd}.  If Bash determines it is being run by
@@ -3093,6 +3097,16 @@ else
 fi
 @end example
 
+Alternatively, you may test the value of the @samp{-} special parameter.
+It contains @code{i} when the shell is interactive.  For example:
+
+@example
+case "$-" in
+*i*)   echo This shell is interactive ;;
+*)     echo This shell is not interactive ;;
+esac
+@end example
+
 @node Bash Builtins
 @section Bash Builtin Commands
 
@@ -3173,9 +3187,9 @@ Remove any current binding for @var{keyseq}
 @example
 builtin [@var{shell-builtin} [@var{args}]]
 @end example
-Run a shell builtin.  This is useful when you wish to rename a
-shell builtin to be a function, but need the functionality of the
-builtin within the function itself.
+Run a shell builtin.  This is useful when you wish to define a
+shell function with the same name as a shell builtin, but need the
+functionality of the builtin within the function itself.
 
 @item command
 @btindex command
@@ -3423,7 +3437,7 @@ The errors checked for are transposed characters,
 a missing character, and a character too many.
 If a correction is found, the corrected path is printed,
 and the command proceeds.
-This option is enabled by default, but is only used by interactive shells.
+This option is only used by interactive shells.
 
 @item checkhash
 If this is set, Bash checks that a command found in the hash
@@ -3470,7 +3484,8 @@ the Readline editing buffer, allowing further modification.
 @item hostcomplete
 If set, and Readline is being used, Bash will attempt to perform
 hostname completion when a word beginning with @samp{@@} is being
-completed (@pxref{Commands For Completion}).
+completed (@pxref{Commands For Completion}).  This option is enabled
+by default.
 
 @item interactive_comments
 Allow a word beginning with @samp{#}
@@ -3718,7 +3733,7 @@ same as @code{-x}.
 
 @item -p
 Turn on privileged mode.
-In this mode, the @code{$ENV}
+In this mode, the @code{$BASH_ENV}
 file is not processed, and shell functions
 are not inherited from the environment.  This is enabled automatically
 on startup if the effective user (group) id is not equal to the real
@@ -3962,6 +3977,11 @@ do not normally treat them specially.
 
 @vtable @code
 
+@item BASH_ENV
+If this variable is set when Bash is invoked to execute a shell
+script, its value is expanded and used as the name of a startup file
+to read before executing the script.  @xref{Bash Startup Files}.
+
 @item TIMEFORMAT
 The value of this parameter is used as a format string specifying
 how the timing information for pipelines prefixed with the @code{time}
@@ -4002,7 +4022,9 @@ the form @var{MM}m@var{SS}.@var{FF}s.
 The value of @var{p} determines whether or not the fraction is included. 
 
 If this variable is not set, bash acts as if it had the value
+@example
 @code{$'\nreal\t%3lR\nuser\t%3lU\nsys\t%3lS'}.
+@end example
 If the value is null, no timing information is displayed.
 A trailing newline is added when the format string is displayed.
 
@@ -4086,6 +4108,10 @@ The numeric real user id of the current user.
 @item EUID
 The numeric effective user id of the current user.
 
+@item GROUPS
+An array variable containing the list of groups of which the current    
+user is a member.
+
 @item PPID
 The process id of the shell's parent process.
 
@@ -4184,7 +4210,7 @@ The value of @code{MACHTYPE}.
 
 @item SHLVL
 Incremented by one each time a new instance of Bash is started.  This is
-intended to be an account of how deeply your Bash shells are nested.
+intended to be a count of how deeply your Bash shells are nested.
 
 @item OPTERR
 If set to the value 1, Bash displays error messages
@@ -4198,9 +4224,13 @@ selected with a variable starting with @code{LC_}.
 This variable overrides the value of @code{LANG} and any other
 @code{LC_} variable specifying a locale category.
 
+@item LC_COLLATE
+This variable determines the collation order used when sorting the
+results of filename expansion (@pxref{Filename Expansion}).
+
 @item LC_MESSAGES
 This variable determines the locale used to translate double-quoted
-strings preceded by a @samp{$}.
+strings preceded by a @samp{$} (@pxref{Locale Translation}).
 
 @item IGNOREEOF
 Controls the action of the shell on receipt of an @code{EOF} character
@@ -4608,14 +4638,6 @@ the POSIX.2 standard, and include things like passing incorrect options,
 redirection errors, variable assignment errors for assignments preceding
 the command name, and so on.
 
-@ignore
-@item
-The environment passed to executed commands is not sorted.  Neither is
-the output of @code{set}.  This is not strictly Posix.2 behavior, but
-@code{sh} does it this way.  @code{ksh} does not.  It's not necessary to
-sort the environment; no program should rely on it being sorted.
-@end ignore
-
 @item
 If the @code{cd} builtin finds a directory to change to
 using @code{$CDPATH}, the
@@ -4641,6 +4663,10 @@ Process substitution is not available.
 Assignment statements preceding @sc{POSIX.2} @code{special} builtins
 persist in the shell environment after the builtin completes.
 
+@item
+The @code{export} and @code{readonly} builtin commands display their
+output in the format required by @sc{POSIX.2}.
+
 @end enumerate
 
 There is other @sc{POSIX.2} behavior that Bash does not implement.
@@ -4826,9 +4852,10 @@ kill [-s @var{sigspec}] [-n @var{signum}] [-@var{sigspec}] @var{jobspec}
 kill -l [@var{sigspec}]
 @end example
 Send a signal specified by @var{sigspec} or @var{signum} to the process
-named by @var{jobspec}.  @var{sigspec} is either a signal name such as
-@code{SIGINT} or a signal number; @var{signum} is a signal number.  If
-@var{sigspec} and @var{signum} are not present, @code{SIGTERM} is used.
+named by @var{jobspec}.
+@var{sigspec} is either a signal name such as @code{SIGINT} (with or without
+the @code{SIG} prefix) or a signal number; @var{signum} is a signal number.
+If @var{sigspec} and @var{signum} are not present, @code{SIGTERM} is used.
 The @samp{-l} option lists the signal names, or the signal name
 corresponding to @var{sigspec}.
 
@@ -4878,8 +4905,8 @@ supplied process @sc{ID}s.
 This variable controls how the shell interacts with the user and
 job control.  If this variable exists then single word simple
 commands without redirects are treated as candidates for resumption
-of an existing job.  There is no ambiguity allowed; if you have
-more than one job beginning with the string that you have typed, then
+of an existing job.  There is no ambiguity allowed; if there is
+more than one job beginning with the string typed, then
 the most recently accessed job will be selected.
 The name of a stopped job, in this context, is the command line
 used to start it.  If this variable is set to the value @samp{exact},
@@ -4912,7 +4939,7 @@ version of Unix (and, someday, @sc{GNU}).  Other independent ports exist for
 @sc{OS/2}, Windows 95, and Windows @sc{NT}.
 
 @menu
-* Basic Installation:: Generic installation instructions.
+* Basic Installation:: Installation instructions.
 
 * Compilers and Options::      How to set special options for various
                                systems.
@@ -4941,7 +4968,7 @@ version of Unix (and, someday, @sc{GNU}).  Other independent ports exist for
 @cindex Bash installation
 @cindex Bash configuration
 
-These are generic installation instructions for Bash.
+These are installation instructions for Bash.
 
 The @code{configure} shell script attempts to guess correct
 values for various system-dependent variables used during
@@ -4969,8 +4996,17 @@ The file @file{configure.in} is used to create @code{configure}
 by a program called Autoconf.  You only need
 @file{configure.in} if you want to change it or regenerate
 @code{configure} using a newer version of Autoconf.  If
-you do this, make sure you are using Autoconf version 2.9 or
-newer. 
+you do this, make sure you are using Autoconf version 2.10 or
+newer.
+
+If you need to change @file{configure.in} or regenerate
+@code{configure}, you will need to create two files: 
+@file{_distribution} and @file{_patchlevel}.  @file{_distribution}
+should contain the major and minor version numbers of the Bash
+distribution, for example @samp{2.01}.  @file{_patchlevel} should
+contain the patch level of the Bash distribution, @samp{0} for
+example.  The script @file{support/mkconffiles} has been provided
+to automate the creation of these files.
 
 The simplest way to compile Bash is:
 
@@ -5153,6 +5189,19 @@ Here is a complete list of the @samp{--enable-} and
 @samp{--with-} options that the Bash @code{configure} recognizes. 
 
 @table @code
+@item --with-afs
+Define if you are using the Andrew File System from Transarc.
+
+@item --with-curses
+Use the curses library instead of the termcap library.  This should
+be supplied if your system has an inadequate or incomplete termcap
+database.
+
+@item --with-glibc-malloc
+Use the @sc{GNU} libc version of @code{malloc} in
+@file{lib/malloc/gmalloc.c}.  This is somewhat slower than the
+default @code{malloc}, but wastes considerably less space. 
+
 @item --with-gnu-malloc
 Use the @sc{GNU} version of
 @code{malloc} in @file{lib/malloc/malloc.c}.  This is not the same
@@ -5160,15 +5209,8 @@ Use the @sc{GNU} version of
 derived from the 4.2 @sc{BSD} @code{malloc}.  This @code{malloc} is
 very fast, but wastes a lot of space.  This option is enabled by
 default.  The @file{NOTES} file contains a list of systems for
-which this should be turned off. 
-
-@item --with-glibc-malloc
-Use the @sc{GNU} libc version of @code{malloc} in
-@file{lib/malloc/gmalloc.c}.  This is somewhat slower than the
-default @code{malloc}, but wastes considerably less space. 
-
-@item --with-afs
-Define if you are using the Andrew File System from Transarc.
+which this should be turned off, and @code{configure} disables this
+option automatically for a number of systems.
 
 @item --with-purify
 Define this to use the Purify memory allocation checker from Pure
@@ -5190,32 +5232,48 @@ enabled by default, unless the operating system does not provide the
 necessary support.
 
 @table @code
-@item --enable-job-control
-This enables job control features, if the @sc{OS} supports them.
-
 @item --enable-alias
 Allow alias expansion and include the @code{alias} and @code{unalias}
 builtins.
 
-@item --enable-readline
-Include support for command-line editing and history with the Bash
-version of the Readline library.
-
-@item --enable-history
-Include command history and the @code{fc} and @code{history}
-builtin commands.
+@item --enable-array-variables
+Include support for one-dimensional array shell variables.
 
 @item --enable-bang-history
 Include support for @code{csh}-like history substitution.
 
+@item --enable-brace-expansion
+Include @code{csh}-like brace expansion
+( @code{b@{a,b@}c} @expansion{} @code{bac bbc} ).
+
+@item --enable-command-timing
+Include support for recognizing @code{time} as a reserved word and for
+displaying timing statistics for the pipeline following @code{time}.  This
+allows pipelines as well as shell builtins and functions to be timed.
+
 @item --enable-directory-stack
 Include support for a @code{csh}-like directory stack and the
 @code{pushd}, @code{popd}, and @code{dirs} builtins.
 
-@item --enable-restricted
-Include support for a @dfn{restricted shell}.  If this is enabled, Bash,
-when called as @code{rbash}, enters a restricted mode.  See
-@ref{The Restricted Shell}, for a description of restricted mode.
+@item --enable-disabled-builtins
+Allow builtin commands to be invoked via @samp{builtin xxx}
+even after @code{xxx} has been disabled using @samp{enable -n xxx}.
+See @ref{Bash Builtins}, for details of the @code{builtin} and
+@code{enable} builtin commands.
+
+@item --enable-dparen-arithmetic
+Include support for the @code{ksh} @code{((@dots{}))} command.
+
+@item --enable-help-builtin
+Include the @code{help} builtin, which displays help on shell builtins and
+variables.
+
+@item --enable-history
+Include command history and the @code{fc} and @code{history}
+builtin commands.
+
+@item --enable-job-control
+This enables job control features, if the @sc{OS} supports them.
 
 @item --enable-process-substitution
 This enables process substitution (@pxref{Process Substitution}) if
@@ -5226,35 +5284,19 @@ Turn on the interpretation of a number of backslash-escaped characters
 in the @code{$PS1}, @code{$PS2}, @code{$PS3}, and @code{$PS4} prompt
 strings.
 
+@item --enable-readline
+Include support for command-line editing and history with the Bash
+version of the Readline library.
+
+@item --enable-restricted
+Include support for a @dfn{restricted shell}.  If this is enabled, Bash,
+when called as @code{rbash}, enters a restricted mode.  See
+@ref{The Restricted Shell}, for a description of restricted mode.
+
 @item --enable-select
 Include the @code{ksh} @code{select} builtin, which allows the
 generation of simple menus.
 
-@item --enable-help-builtin
-Include the @code{help} builtin, which displays help on shell builtins and
-variables.
-
-@item --enable-array-variables
-Include support for one-dimensional array shell variables.
-
-@item --enable-dparen-arithmetic
-Include support for the @code{ksh} @code{((@dots{}))} command.
-
-@item --enable-brace-expansion
-Include @code{csh}-like brace expansion
-( @code{b@{a,b@}c} @expansion{} @code{bac bbc} ).
-
-@item --enable-disabled-builtins
-Allow builtin commands to be invoked via @samp{builtin xxx}
-even after @code{xxx} has been disabled using @samp{enable -n xxx}.
-See @ref{Bash Builtins}, for details of the @code{builtin} and
-@code{enable} builtin commands.
-
-@item --enable-command-timing
-Include support for recognizing @code{time} as a reserved word and for
-displaying timing statistics for the pipeline following @code{time}.  This
-allows pipelines as well as shell builtins and functions to be timed.
-
 @item --enable-usg-echo-default
 Make the @code{echo} builtin expand backslash-escaped characters by default,
 without requiring the @samp{-e} option.  This makes the Bash @code{echo}
@@ -5280,7 +5322,7 @@ version of Bash that you have.
 
 Once you have determined that a bug actually exists, use the
 @code{bashbug} command to submit a bug report.
-If you have a fix, you are welcome to mail that as well!
+If you have a fix, you are encouraged to mail that as well!
 Suggestions and `philosophical' bug reports may be mailed
 to @code{bug-bash@@prep.ai.MIT.Edu} or posted to the Usenet
 newsgroup @code{gnu.bash.bug}.
index e122cb7..3d16168 100644 (file)
@@ -6,9 +6,9 @@
 .\"    Case Western Reserve University
 .\"    chet@ins.CWRU.Edu
 .\"
-.\"    Last Change: Mon Jul  8 13:07:48 EDT 1996
+.\"    Last Change: Wed Feb  5 14:13:22 EST 1997
 .\"
-.TH READLINE 3 "1996 July 8" GNU
+.TH READLINE 3 "1997 Feb 5" GNU
 .\"
 .\" File Name macro.  This used to be `.PN', for Path Name,
 .\" but Sun doesn't seem to like that very much.
@@ -682,9 +682,18 @@ Add this digit to the argument already accumulating, or start a new
 argument.  M\-\- starts a negative argument.
 .TP
 .B universal\-argument
-Each time this is executed, the argument count is multiplied by four.
+This is another way to specify an argument.
+If this command is followed by one or more digits, optionally with a
+leading minus sign, those digits define the argument.
+If the command is followed by digits, executing
+.B universal\-argument
+again ends the numeric argument, but is otherwise ignored.
+As a special case, if this command is immediately followed by a
+character that is neither a digit or minus sign, the argument count
+for the next command is multiplied by four.
 The argument count is initially one, so executing this function the
-first time makes the argument count four.
+first time makes the argument count four, a second time makes the
+argument count sixteen, and so on.
 .PD
 .SS Completing
 .PP
diff --git a/error.c b/error.c
index a80810f..4f5339b 100644 (file)
--- a/error.c
+++ b/error.c
@@ -19,8 +19,7 @@
 
 #include "config.h"
 
-#include <stdio.h>
-#include <sys/types.h>
+#include "bashtypes.h"
 #include <fcntl.h>
 
 #if defined (HAVE_UNISTD_H)
@@ -35,6 +34,8 @@
 #  endif
 #endif
 
+#include <stdio.h>
+
 #include <errno.h>
 #if !defined (errno)
 extern int errno;
@@ -234,7 +235,7 @@ programming_error (format, va_alist)
     }
 #endif
 
-  fprintf (stderr, "Tell %s to fix this someday.\n", the_current_maintainer);
+  fprintf (stderr, "Report this to %s\n", the_current_maintainer);
   fprintf (stderr, "Stopping myself...");
   fflush (stderr);
 
diff --git a/eval.c b/eval.c
index 36083be..1203394 100644 (file)
--- a/eval.c
+++ b/eval.c
@@ -43,7 +43,7 @@ extern int yyparse ();
 extern int EOF_reached;
 extern int indirection_level, interactive, interactive_shell;
 extern int subshell_environment, running_under_emacs;
-extern int last_command_exit_value;
+extern int last_command_exit_value, stdin_redir;
 extern int need_here_doc;
 extern int current_command_number, current_command_line_count, line_number;
 extern char *ps1_prompt, **prompt_string_pointer;
@@ -128,6 +128,7 @@ reader_loop ()
              current_command_number++;
 
              executing = 1;
+             stdin_redir = 0;
              execute_command (current_command);
 
            exec_done:
index 9e79d71..97d287d 100644 (file)
@@ -25,5 +25,9 @@ _libdir=.
 _dbgfile=$_tmpdir/bashdb$$             #temp file for script being debugged
 
 cat $_libdir/bashdb.pre $_guineapig > $_dbgfile
-exec bash $_dbgfile $_guineapig $_tmpdir $_libdir "$@"
+if [ -f "$BASH" ]; then
+       exec $BASH $_dbgfile $_guineapig $_tmpdir $_libdir "$@"
+else
+       exec bash $_dbgfile $_guineapig $_tmpdir $_libdir "$@"
+fi
 # end of bashdb
index 9a9aa49..79d9737 100644 (file)
@@ -13,6 +13,7 @@ _steptrap() {
        let " $_trace" &&
                _msg "$PS4, line $_curline: ${_lines[$(($_curline-$_firstline+1))]}"
 
+
        # if in step mode, decrement counter
        let " $_steps >= 0" && let _steps="$_steps - 1"
 
@@ -87,7 +88,7 @@ _at_linenumbp() {
        if [ -z "${_linebp}" ]; then
                return 1
        fi
-       echo "${curline}" | egrep -s "(${linebp%\|})" >/dev/null 2>&1
+       echo "${_curline}" | egrep "(${_linebp%\|})" >/dev/null 2>&1
        return $?
 }
 
@@ -95,11 +96,12 @@ _at_linenumbp() {
 # search string brkpts to see if next line in script matches.
 _at_stringbp() {
        local l;
+
        if [ -z "$_stringbp" ]; then
                return 1;
        fi
        l=${_lines[$_curline-$_firstline+1]}
-       echo "${l} | egrep -s "*(${stringbp%\|})*" >/dev/null 2>&1
+       echo "${l}" | egrep "*(${_stringbp%\|})*" >/dev/null 2>&1
        return $?
 }
 
@@ -132,9 +134,9 @@ _setbp() {
 # list brkpts and break condition.
 _listbp() {
        _msg "Breakpoints at lines:"
-       _msg "$(echo $_linebp | tr '|' ' ')"
+       _msg "${_linebp//\|/ }"
        _msg "Breakpoints at strings:"
-       _msg "$(echo $_stringbp | tr '|' ' ')"
+       _msg "${_stringbp//\|/ }"
        _msg "Break on condition:"
        _msg "$_brcond"
 }
index e692727..c9cdb72 100644 (file)
@@ -11,7 +11,7 @@ set -o history
 set +H
 
 # prompt for trace line
-PS4=$1
+PS4="${1}"
 
 _dbgfile=$0
 _guineapig=$1
diff --git a/examples/functions/xalias.bash b/examples/functions/xalias.bash
new file mode 100644 (file)
index 0000000..29e8bfb
--- /dev/null
@@ -0,0 +1,21 @@
+# xalias - convert csh alias commands to bash functions
+# from Mohit Aron <aron@cs.rice.edu>
+# posted to usenet as <4i5p17$bnu@larry.rice.edu>
+function xalias ()
+{
+       if [ "x$2" = "x" ] 
+       then
+               declare -f $1
+       else
+               echo $2 | egrep -q '(\!|#)'
+               if [ $? -eq 0 ]
+               then
+                       comm=$(echo $2 | sed  's/\\!\*/\"$\@\"/g
+                                              s/\\!:\([1-9]\)/\"$\1\"/g
+                                              s/#/\\#/g')
+               else
+                       comm="$2 \"\$@\""
+               fi
+               eval function $1 \(\) "{" command "$comm"  "; }"
+       fi
+}
index 75cd627..2ecbcbb 100644 (file)
@@ -166,6 +166,8 @@ pushd_builtin (list)
     {
       add_dirstack_element ((flags & NOCD) ? savestring (list->word->word) : current_directory);
       dirs_builtin ((WORD_LIST *)NULL);
+      if (flags & NOCD)
+       free (current_directory);
       return (EXECUTION_SUCCESS);
     }
   else
@@ -186,7 +188,9 @@ popd_builtin (list)
   long which;
   int flags;
   char direction;
+  char *which_word;
 
+  which_word = (char *)NULL;
   for (flags = 0, which = 0L, direction = '+'; list; list = list->next)
     {
       if (ISOPTION (list->word->word, 'n'))
@@ -206,6 +210,7 @@ popd_builtin (list)
              builtin_usage ();
              return (EXECUTION_FAILURE);
            }
+         which_word = list->word->word;
        }
       else if (*list->word->word == '-')
        {
@@ -219,7 +224,7 @@ popd_builtin (list)
 
   if (which > directory_list_offset || (directory_list_offset == 0 && which == 0))
     {
-      pushd_error (directory_list_offset, list ? list->word->word : "");
+      pushd_error (directory_list_offset, which_word ? which_word : "");
       return (EXECUTION_FAILURE);
     }
 
@@ -538,10 +543,12 @@ static char *pushd_doc[] = {
   "directory.  With no arguments, exchanges the top two directories.",
   "",
   "+N   Rotates the stack so that the Nth directory (counting",
-  "     from the left of the list shown by `dirs') is at the top.",
+  "     from the left of the list shown by `dirs', starting with"
+  "     zero) is at the top.",
   "",
   "-N   Rotates the stack so that the Nth directory (counting",
-  "     from the right) is at the top.",
+  "     from the right of the list shown by `dirs', starting with" 
+  "     zero) is at the top.",
   "",
   "-n   suppress the normal change of directory when adding directories",
   "     to the stack, so only the stack is manipulated.",
diff --git a/examples/scripts/spin.bash b/examples/scripts/spin.bash
new file mode 100644 (file)
index 0000000..dc6a66a
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/bash
+#
+# spin.bash -- provide a `spinning wheel' to show progress
+#
+# Chet Ramey
+# chet@po.cwru.edu
+#
+bs=$'\b'
+chars="|${bs} \\${bs} -${bs} /${bs}"
+# Infinite loop for demo. purposes
+while :
+do
+    for letter in $chars
+    do
+        echo -n ${letter}
+    done
+done
+
+exit 0
index 27649a1..62aa948 100755 (executable)
@@ -6,6 +6,7 @@
 # usage: vtree [-a] [dir]
 #
 # Original posted to Usenet sometime in February, 1996
+# I believe that the original author is Brian S. Hiles <bsh29256@atc.fhda.edu>
 #
 usage()
 {
@@ -32,10 +33,10 @@ do
        echo -n "$PWD"
 
        du $andfiles | sort +1f | sed \
-               's/\([^ ]*\)    \(.*\)/\2  (\1)/
-               '"s#^$1##"'
-               s#[^/]*/\([^/]*\)$#|____\1#
-               s#[^/]*/#|    #g'
+               -e 's/\([^      ]*\)    \(.*\)/\2  (\1)/' \
+               -e "s#^$1##" \
+               -e 's#[^/]*/\([^/]*\)$#|____\1#' \
+               -e 's#[^/]*/#|    #g'
        
        [ $# -gt 1 ] && echo 
        shift
diff --git a/examples/scripts/vtree3 b/examples/scripts/vtree3
new file mode 100644 (file)
index 0000000..2059b9f
--- /dev/null
@@ -0,0 +1,99 @@
+#!/bin/ksh
+#
+# Name: dirtree
+# Programmer:
+#            Hemant T. Shah
+#            Life Insurance Data Processing
+#            July 12 1994
+#
+# Description:
+#  Print directory tree structure as follows:
+#   |___Mail
+#     |___scheduler
+#     |___cics_scripts
+#     |___tar_msdos
+#     |___awk
+#     |___attributes
+#   |___tmp
+#   |___News
+#     |___dosscsi
+#     |___FAQ_xterminal
+#     |___shell_history.Z
+#     |___FAQ_AIX
+#     |___aix_ftp_site
+#     |___hp_software
+#   |___dnload
+#     |___telnet.h
+#     |___msdos
+#     |___tnetd.tar.Z
+#     |___aix
+#     |___hp
+#   |___xkey.c
+#
+# Conversion to bash v2 syntax done by Chet Ramey
+#      - removed command substitutions calling `basename'
+#
+
+ProgramName=${0##*/}
+Path="."
+ShowAll=1
+ShowDir=0
+
+
+ExpandDirectory()
+{
+local object   # Local variable
+
+cd "$1"
+
+for object in $PWD/.??* $PWD/*
+do
+   if [ -d $object ];  # It is a directory
+   then
+      echo "${indent}|___${object##*/}/"
+      indent="${indent}!   "   # Add to indentation
+      if [ -x $object ];
+      then
+         ExpandDirectory $object
+      fi
+      indent=${indent%????}    # Remove from indentation
+   elif [ -e $object ]; then
+      if (( ShowAll == 1 ));
+      then
+         echo "${indent}|___${object##*/}"
+      fi
+   fi
+done
+
+}
+
+usage()
+{
+       echo -e "Usage: $ProgramName [-h] [-f] [-d] [path] "
+       echo -e "\t-h       ... display this help message."
+       echo -e "\t-f path  ... shows all files and directories below path (default)."
+       echo -e "\t-d path  ... shows all directories only below path."
+}
+
+while getopts "fd" opt
+do
+       case $opt in
+       f) ShowAll=1 ;;
+       d) ShowDir=1 ;;
+       *) usage ; exit 2;;
+       esac
+done
+
+shift $(( $OPTIND - 1 ))
+
+Path=${1:-.}
+
+if [ ! -d "$Path" ]; then
+       echo "$0: error: specified path is not a directory." >&2
+       exit 1
+fi
+
+
+
+echo "!$Path/"
+ExpandDirectory $Path
index ce154c3..5f57840 100644 (file)
 #  include <limits.h>
 #endif
 
-#if defined (HAVE_SYS_TIME_H)
+/* Some systems require this, mostly for the definition of `struct timezone'.
+   For example, Dynix/ptx has that definition in <time.h> rather than
+   sys/time.h */
+#if defined (TIME_WITH_SYS_TIME)
 #  include <sys/time.h>
+#  include <time.h>
+#else
+#  if defined (HAVE_SYS_TIME_H)
+#    include <sys/time.h>
+#  else 
+#    include <time.h>
+#  endif
 #endif
 
 #if defined (HAVE_SYS_RESOURCE_H)
@@ -62,7 +72,7 @@ extern int errno;
 
 #include "memalloc.h"
 #include "shell.h"
-#include "y.tab.h"
+#include <y.tab.h>     /* use <...> so we pick it up from the build directory */
 #include "flags.h"
 #include "builtins.h"
 #include "hashlib.h"
@@ -70,6 +80,7 @@ extern int errno;
 #include "execute_cmd.h"
 #include "trap.h"
 #include "pathexp.h"
+#include "hashcmd.h"
 
 #include "builtins/common.h"
 #include "builtins/builtext.h" /* list of builtins */
@@ -92,7 +103,7 @@ extern int errno;
 extern int posixly_correct;
 extern int executing, breaking, continuing, loop_level;
 extern int interactive, interactive_shell, login_shell, expand_aliases;
-extern int parse_and_execute_level, running_trap;
+extern int parse_and_execute_level, running_trap, trap_line_number;
 extern int command_string_index, variable_context, line_number;
 extern int dot_found_in_search;
 extern int already_making_children;
@@ -121,7 +132,9 @@ static int execute_for_command ();
 #if defined (SELECT_COMMAND)
 static int execute_select_command ();
 #endif
+#if defined (COMMAND_TIMING)
 static int time_command ();
+#endif
 static int execute_case_command ();
 static int execute_while_command (), execute_until_command ();
 static int execute_while_or_until ();
@@ -138,8 +151,9 @@ static int execute_intern_function ();
 /* The line number that the currently executing function starts on. */
 static int function_line_number;
 
-/* Set to 1 if fd 0 was the subject of redirection to a subshell. */
-static int stdin_redir;
+/* Set to 1 if fd 0 was the subject of redirection to a subshell.  Global
+   so that reader_loop can set it to zero before executing a command. */
+int stdin_redir;
 
 /* The name of the command that is currently being executed.
    `test' needs this, for example. */
@@ -150,8 +164,15 @@ static COMMAND *currently_executing_command;
 struct stat SB;                /* used for debugging */
 
 static int special_builtin_failed;
+
+/* Spare redirector used when translating [N]>&WORD or [N]<&WORD to a new
+   redirection and when creating the redirection undo list. */
 static REDIRECTEE rd;
 
+/* Set to errno when a here document cannot be created for some reason.
+   Used to print a reasonable error message. */
+static int heredoc_errno;
+
 /* The file name which we would try to execute, except that it isn't
    possible to execute it.  This is the first file that matches the
    name that we are looking for while we are searching $PATH for a
@@ -186,7 +207,8 @@ int check_hashed_filenames;
 
 struct fd_bitmap *current_fds_to_close = (struct fd_bitmap *)NULL;
 
-#define FD_BITMAP_DEFAULT_SIZE 32
+#define FD_BITMAP_DEFAULT_SIZE 32L
+
 /* Functions to allocate and deallocate the structures used to pass
    information from the shell to its children about file descriptors
    to close. */
@@ -242,7 +264,10 @@ executing_line_number ()
   if (executing && variable_context == 0 && currently_executing_command &&
        currently_executing_command->type == cm_simple)
     return currently_executing_command->value.Simple->line;
-  return line_number;
+  else if (running_trap)
+    return trap_line_number;
+  else
+    return line_number;
 }
 
 /* Execute the command passed in COMMAND.  COMMAND is exactly what
@@ -359,6 +384,56 @@ open_files ()
   fprintf (stderr, "\n");
 }
 
+static int
+stdin_redirects (redirs)
+     REDIRECT *redirs;
+{
+  REDIRECT *rp;
+  int n;
+
+  for (n = 0, rp = redirs; rp; rp = rp->next)
+    switch (rp->instruction)
+      {
+      case r_input_direction:
+      case r_inputa_direction:
+      case r_input_output:
+      case r_reading_until:
+      case r_deblank_reading_until:
+       n++;
+        break;
+      case r_duplicating_input:
+      case r_duplicating_input_word:
+      case r_close_this:
+       n += (rp->redirector == 0);
+        break;
+      case r_output_direction:
+      case r_appending_to:
+      case r_duplicating_output:
+      case r_err_and_out:
+      case r_output_force:
+      case r_duplicating_output_word:
+       break;
+      }
+
+  return n;
+}
+
+
+static void
+async_redirect_stdin ()
+{
+  int fd;
+
+  fd = open ("/dev/null", O_RDONLY);
+  if (fd > 0)
+    {
+      dup2 (fd, 0);
+      close (fd);
+    }
+  else if (fd < 0)
+    internal_error ("cannot redirect standard input from /dev/null: %s", strerror (errno));
+}
+
 #define DESCRIBE_PID(pid) do { if (interactive) describe_pid (pid); } while (0)
 
 /* Execute the command passed in COMMAND, perhaps doing it asynchrounously.
@@ -382,7 +457,7 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
      struct fd_bitmap *fds_to_close;
 {
   int exec_result, invert, ignore_return, was_debug_trap;
-  REDIRECT *my_undo_list, *exec_undo_list, *rp;
+  REDIRECT *my_undo_list, *exec_undo_list;
   pid_t last_pid;
 
   if (command == 0 || breaking || continuing || read_but_dont_execute)
@@ -393,17 +468,14 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
   if (running_trap == 0)
     currently_executing_command = command;
 
-#if defined (COMMAND_TIMING)
-  if (command->flags & CMD_TIME_PIPELINE)
-    {
-      exec_result = time_command (command, asynchronous, pipe_in, pipe_out, fds_to_close);
-      if (running_trap == 0)
-       currently_executing_command = (COMMAND *)NULL;
-      return (exec_result);
-    }
-#endif /* COMMAND_TIMING */
-
   invert = (command->flags & CMD_INVERT_RETURN) != 0;
+
+  /* If we're inverting the return value and `set -e' has been executed,
+     we don't want a failing command to inadvertently cause the shell
+     to exit. */
+  if (exit_immediately_on_error && invert)     /* XXX */
+    command->flags |= CMD_IGNORE_RETURN;       /* XXX */
+
   exec_result = EXECUTION_SUCCESS;
 
   /* If a command was being explicitly run in a subshell, or if it is
@@ -422,7 +494,11 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
                              asynchronous);
       if (paren_pid == 0)
        {
-         int user_subshell, return_code, function_value;
+         int user_subshell, return_code, function_value, should_redir_stdin;
+
+         should_redir_stdin = (asynchronous && (command->flags & CMD_STDIN_REDIR) &&
+                                 pipe_in == NO_PIPE &&
+                                 stdin_redirects (command->redirects) == 0);
 
          user_subshell = (command->flags & CMD_WANT_SUBSHELL) != 0;
          command->flags &= ~(CMD_FORCE_SUBSHELL | CMD_WANT_SUBSHELL | CMD_INVERT_RETURN);
@@ -485,29 +561,19 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
             sh compatibility, but I'm not sure it's the right thing to do. */
          if (user_subshell)
            {
-             for (rp = command->redirects; rp; rp = rp->next)
-               switch (rp->instruction)
-                 {
-                 case r_input_direction:
-                 case r_inputa_direction:
-                 case r_input_output:
-                 case r_reading_until:
-                 case r_deblank_reading_until:
-                   stdin_redir++;
-                   break;
-                 case r_duplicating_input:
-                 case r_duplicating_input_word:
-                 case r_close_this:
-                   stdin_redir += (rp->redirector == 0);
-                   break;
-                 }
-
+             stdin_redir = stdin_redirects (command->redirects);
              restore_default_signal (0);
            }
 
          if (fds_to_close)
            close_fd_bitmap (fds_to_close);
 
+         /* If this is an asynchronous command (command &), we want to
+            redirect the standard input from /dev/null in the absence of
+            any specific redirection involving stdin. */
+         if (should_redir_stdin && stdin_redir == 0)
+           async_redirect_stdin ();
+
          /* Do redirections, then dispose of them before recursive call. */
          if (command->redirects)
            {
@@ -589,6 +655,27 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
        }
     }
 
+#if defined (COMMAND_TIMING)
+  if (command->flags & CMD_TIME_PIPELINE)
+    {
+      if (asynchronous)
+       {
+         command->flags |= CMD_FORCE_SUBSHELL;
+         exec_result = execute_command_internal (command, 1, pipe_in, pipe_out, fds_to_close);
+       }
+      else
+       {
+         exec_result = time_command (command, asynchronous, pipe_in, pipe_out, fds_to_close);
+         if (running_trap == 0)
+           currently_executing_command = (COMMAND *)NULL;
+       }
+      return (exec_result);
+    }
+#endif /* COMMAND_TIMING */
+
+  if (shell_control_structure (command->type) && command->redirects)
+    stdin_redir = stdin_redirects (command->redirects);
+
   /* Handle WHILE FOR CASE etc. with redirections.  (Also '&' input
      redirection.)  */
   if (do_redirections (command->redirects, 1, 1, 0) != 0)
@@ -642,6 +729,8 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
 
        if (ignore_return && command->value.Simple)
          command->value.Simple->flags |= CMD_IGNORE_RETURN;
+       if (command->flags & CMD_STDIN_REDIR)
+         command->value.Simple->flags |= CMD_STDIN_REDIR;
        exec_result =
          execute_simple_command (command->value.Simple, pipe_in, pipe_out,
                                  asynchronous, fds_to_close);
@@ -885,7 +974,7 @@ timeval_to_cpu (rt, ut, st)
         t2.tv_sec /= 10;
     }
 
-  return (t1.tv_sec / t2.tv_sec);
+  return ((t2.tv_sec == 0) ? 0 : t1.tv_sec / t2.tv_sec);
 }  
 #endif /* HAVE_GETRUSAGE && HAVE_GETTIMEOFDAY */
 
@@ -1058,7 +1147,7 @@ time_command (command, asynchronous, pipe_in, pipe_out, fds_to_close)
      int asynchronous, pipe_in, pipe_out;
      struct fd_bitmap *fds_to_close;
 {
-  int rv, posix_time;
+  int rv, posix_time, old_flags;
   long rs, us, ss;
   int rsf, usf, ssf;
   int cpu;
@@ -1088,8 +1177,10 @@ time_command (command, asynchronous, pipe_in, pipe_out, fds_to_close)
 
   posix_time = (command->flags & CMD_TIME_POSIX);
 
+  old_flags = command->flags;
   command->flags &= ~(CMD_TIME_PIPELINE|CMD_TIME_POSIX);
   rv = execute_command_internal (command, asynchronous, pipe_in, pipe_out, fds_to_close);
+  command->flags = old_flags;
 
 #if defined (HAVE_GETRUSAGE) && defined (HAVE_GETTIMEOFDAY)
   gettimeofday (&after, &dtz);
@@ -1121,7 +1212,7 @@ time_command (command, asynchronous, pipe_in, pipe_out, fds_to_close)
   sys = (after.tms_stime - before.tms_stime) + (after.tms_cstime - before.tms_cstime);
   clock_t_to_secs (sys, &ss, &ssf);
 
-  cpu = ((user + sys) * 10000) / real;
+  cpu = (real == 0) ? 0 : ((user + sys) * 10000) / real;
 
 #  else
   rs = us = ss = 0L;
@@ -1259,7 +1350,10 @@ execute_connection (command, asynchronous, pipe_in, pipe_out, fds_to_close)
      int asynchronous, pipe_in, pipe_out;
      struct fd_bitmap *fds_to_close;
 {
-  REDIRECT *tr, *tl, *rp;
+#if 0
+  REDIRECT *tr, *tl;
+#endif
+  REDIRECT *rp;
   COMMAND *tc, *second;
   int ignore_return, exec_result;
 
@@ -1275,8 +1369,9 @@ execute_connection (command, asynchronous, pipe_in, pipe_out, fds_to_close)
 
       rp = tc->redirects;
 
-      if (ignore_return && tc)
+      if (ignore_return)
        tc->flags |= CMD_IGNORE_RETURN;
+      tc->flags |= CMD_AMPERSAND;
 
       /* If this shell was compiled without job control support, if
         the shell is not running interactively, if we are currently
@@ -1289,20 +1384,20 @@ execute_connection (command, asynchronous, pipe_in, pipe_out, fds_to_close)
       if (!stdin_redir)
 #endif /* JOB_CONTROL */
        {
+#if 0
          rd.filename = make_bare_word ("/dev/null");
          tr = make_redirection (0, r_inputa_direction, rd);
          tr->next = tc->redirects;
          tc->redirects = tr;
+#endif
+         tc->flags |= CMD_STDIN_REDIR;
        }
 
       exec_result = execute_command_internal (tc, 1, pipe_in, pipe_out, fds_to_close);
 
-#if defined (JOB_CONTROL)
-      if ((!interactive_shell || subshell_environment || !job_control) && !stdin_redir)
-#else
-      if (!stdin_redir)
-#endif /* JOB_CONTROL */
+      if (tc->flags & CMD_STDIN_REDIR)
        {
+#if 0
          /* Remove the redirection we added above.  It matters,
             especially for loops, which call execute_command ()
             multiple times with the same command. */
@@ -1316,6 +1411,8 @@ execute_connection (command, asynchronous, pipe_in, pipe_out, fds_to_close)
 
          tl->next = (REDIRECT *)NULL;
          dispose_redirects (tr);
+#endif
+         tc->flags &= ~CMD_STDIN_REDIR;
        }
 
       second = command->value.Connection->second;
@@ -1473,6 +1570,7 @@ execute_for_command (for_command)
          else
            {
              run_unwind_frame ("for");
+             loop_level--;
              return (EXECUTION_FAILURE);
            }
        }
@@ -2076,7 +2174,7 @@ execute_simple_command (simple_command, pipe_in, pipe_out, async, fds_to_close)
   command_string_index = 0;
   print_simple_command (simple_command);
   command_line = xmalloc (1 + strlen (the_printed_command));
-  strcpy (command_line, the_printed_command);
+  strcpy (command_line, the_printed_command);  /* XXX memory leak on errors */
 
   first_word_quoted =
     simple_command->words ? (simple_command->words->word->flags & W_QUOTED): 0;
@@ -2239,7 +2337,13 @@ execute_simple_command (simple_command, pipe_in, pipe_out, async, fds_to_close)
              restore_original_signals ();
 
              if (async)
-               setup_async_signals ();
+               {
+                 if ((simple_command->flags & CMD_STDIN_REDIR) &&
+                       pipe_in == NO_PIPE &&
+                       (stdin_redirects (simple_command->redirects) == 0))
+                   async_redirect_stdin ();
+                 setup_async_signals ();
+               }
 
              execute_subshell_builtin_or_function
                (words, simple_command->redirects, builtin, func,
@@ -2289,7 +2393,7 @@ execute_simple_command (simple_command, pipe_in, pipe_out, async, fds_to_close)
 
   execute_disk_command (words, simple_command->redirects, command_line,
                        pipe_in, pipe_out, async, fds_to_close,
-                       (simple_command->flags & CMD_NO_FORK));
+                       simple_command->flags);
 
  return_result:
   bind_lastarg (lastarg);
@@ -2330,7 +2434,7 @@ execute_builtin (builtin, words, flags, subshell)
      WORD_LIST *words;
      int flags, subshell;
 {
-  int old_e_flag, result;
+  int old_e_flag, result, eval_unwind;
 
   old_e_flag = exit_immediately_on_error;
   /* The eval builtin calls parse_and_execute, which does not know about
@@ -2344,12 +2448,15 @@ execute_builtin (builtin, words, flags, subshell)
       begin_unwind_frame ("eval_builtin");
       unwind_protect_int (exit_immediately_on_error);
       exit_immediately_on_error = 0;
+      eval_unwind = 1;
     }
+  else
+    eval_unwind = 0;
 
   /* The temporary environment for a builtin is supposed to apply to
      all commands executed by that builtin.  Currently, this is a
-     problem only with the `source' builtin. */
-  if (builtin == source_builtin)
+     problem only with the `source' and `eval' builtins. */
+  if (builtin == source_builtin || builtin == eval_builtin)
     {
       if (subshell == 0)
        begin_unwind_frame ("builtin_env");
@@ -2369,18 +2476,18 @@ execute_builtin (builtin, words, flags, subshell)
 
   result = ((*builtin) (words->next));
 
-  if (subshell == 0 && builtin == source_builtin)
+  if (subshell == 0 && (builtin == source_builtin || builtin == eval_builtin))
     {
-      /* In POSIX mode, if any variable assignments precede the `.' builtin,
-        they persist after the builtin completes, since `.' is a special
-        builtin. */
+      /* In POSIX mode, if any variable assignments precede the `.' or
+        `eval' builtin, they persist after the builtin completes, since `.'
+        and `eval' are special builtins. */
       if (posixly_correct && builtin_env)
        merge_builtin_env ();
       dispose_builtin_env ();
       discard_unwind_frame ("builtin_env");
     }
 
-  if (subshell == 0 && builtin == eval_builtin && (flags & CMD_IGNORE_RETURN))
+  if (eval_unwind)
     {
       exit_immediately_on_error += old_e_flag;
       discard_unwind_frame ("eval_builtin");
@@ -2425,6 +2532,7 @@ execute_function (var, words, flags, fds_to_close, async, subshell)
        {
          debug_trap = savestring (debug_trap);
          add_unwind_protect (set_debug_trap, debug_trap);
+         /* XXX - small memory leak here -- hard to fix */
        }
       restore_default_signal (DEBUG_TRAP);
     }
@@ -2652,17 +2760,19 @@ setup_async_signals ()
    this gnarly hair, for no good reason.  */
 static void
 execute_disk_command (words, redirects, command_line, pipe_in, pipe_out,
-                     async, fds_to_close, nofork)
+                     async, fds_to_close, cmdflags)
      WORD_LIST *words;
      REDIRECT *redirects;
      char *command_line;
      int pipe_in, pipe_out, async;
      struct fd_bitmap *fds_to_close;
-     int nofork;       /* Don't fork, just exec, if no pipes */
+     int cmdflags;
 {
   char *pathname, *command, **args;
+  int nofork;
   int pid;
 
+  nofork = (cmdflags & CMD_NO_FORK);  /* Don't fork, just exec, if no pipes */
   pathname = words->word->word;
 
 #if defined (RESTRICTED_SHELL)
@@ -2696,10 +2806,13 @@ execute_disk_command (words, redirects, command_line, pipe_in, pipe_out,
     {
       int old_interactive;
 
+#if 0
+      /* This has been disabled for the time being. */
 #if !defined (ARG_MAX) || ARG_MAX >= 10240
       if (posixly_correct == 0)
        put_gnu_argv_flags_into_env ((int)getpid (), glob_argv_flags);
 #endif
+#endif
 
       /* Cancel traps, in trap.c. */
       restore_original_signals ();
@@ -2708,7 +2821,13 @@ execute_disk_command (words, redirects, command_line, pipe_in, pipe_out,
          by make_child to ensure that SIGINT and SIGQUIT are ignored
          in asynchronous children. */
       if (async)
-       setup_async_signals ();
+       {
+         if ((cmdflags & CMD_STDIN_REDIR) &&
+               pipe_in == NO_PIPE &&
+               (stdin_redirects (redirects) == 0))
+           async_redirect_stdin ();
+         setup_async_signals ();
+       }
 
       do_piping (pipe_in, pipe_out);
 
@@ -2845,6 +2964,48 @@ execute_shell_script (sample, sample_len, command, args, env)
 }
 #endif /* !HAVE_HASH_BANG_EXEC */
 
+static void
+initialize_subshell ()
+{
+#if defined (ALIAS)
+  /* Forget about any aliases that we knew of.  We are in a subshell. */
+  delete_all_aliases ();
+#endif /* ALIAS */
+
+#if defined (HISTORY)
+  /* Forget about the history lines we have read.  This is a non-interactive
+     subshell. */
+  history_lines_this_session = 0;
+#endif
+
+#if defined (JOB_CONTROL)
+  /* Forget about the way job control was working. We are in a subshell. */
+  without_job_control ();
+  set_sigchld_handler ();
+#endif /* JOB_CONTROL */
+
+  /* Reset the values of the shell flags and options. */
+  reset_shell_flags ();
+  reset_shell_options ();
+  reset_shopt_options ();
+
+  /* If we're not interactive, close the file descriptor from which we're
+     reading the current shell script. */
+#if defined (BUFFERED_INPUT)
+  if (interactive_shell == 0 && default_buffered_input >= 0)
+    {
+      close_buffered_fd (default_buffered_input);
+      default_buffered_input = bash_input.location.buffered_fd = -1;
+    }
+#else
+  if (interactive_shell == 0 && default_input)
+    {
+      fclose (default_input);
+      default_input = (FILE *)NULL;
+    }
+#endif
+}
+
 #if defined (HAVE_SETOSTYPE) && defined (_POSIX_SOURCE)
 #  define SETOSTYPE(x) __setostype(x)
 #else
@@ -2877,7 +3038,7 @@ shell_execve (command, args, env)
          errno = i;
          file_error (command);
        }
-      return (EX_NOEXEC);      /* XXX Posix.2 says that exit status is 126 */
+      return ((i == ENOENT) ? EX_NOTFOUND : EX_NOEXEC);        /* XXX Posix.2 says that exit status is 126 */
     }
 
   /* This file is executable.
@@ -2918,44 +3079,12 @@ shell_execve (command, args, env)
        }
     }
 
-  larray = array_len (args) + 1;
-
-#if defined (ALIAS)
-  /* Forget about any aliases that we knew of.  We are in a subshell. */
-  delete_all_aliases ();
-#endif /* ALIAS */
-
-#if defined (HISTORY)
-  /* Forget about the history lines we have read.  This is a non-interactive
-     subshell. */
-  history_lines_this_session = 0;
-#endif
-
-#if defined (JOB_CONTROL)
-  /* Forget about the way job control was working. We are in a subshell. */
-  without_job_control ();
-  set_sigchld_handler ();
-#endif /* JOB_CONTROL */
-
-  /* If we're not interactive, close the file descriptor from which we're
-     reading the current shell script. */
-#if defined (BUFFERED_INPUT)
-  if (interactive_shell == 0 && default_buffered_input >= 0)
-    {
-      close_buffered_fd (default_buffered_input);
-      default_buffered_input = bash_input.location.buffered_fd = -1;
-    }
-#else
-  if (interactive_shell == 0 && default_input)
-    {
-      fclose (default_input);
-      default_input = (FILE *)NULL;
-    }
-#endif
+  initialize_subshell ();
 
   set_sigint_handler ();
 
   /* Insert the name of this shell into the argument list. */
+  larray = array_len (args) + 1;
   args = (char **)xrealloc ((char *)args, (1 + larray) * sizeof (char *));
 
   for (i = larray - 1; i; i--)
@@ -3021,6 +3150,7 @@ execute_intern_function (name, function)
   return (EXECUTION_SUCCESS);
 }
 
+#if defined (INCLUDE_UNUSED)
 #if defined (PROCESS_SUBSTITUTION)
 void
 close_all_files ()
@@ -3035,6 +3165,7 @@ close_all_files ()
     close (i);
 }
 #endif /* PROCESS_SUBSTITUTION */
+#endif
 
 static void
 close_pipes (in, out)
@@ -3115,6 +3246,10 @@ redirection_error (temp, error)
       break;
 #endif /* RESTRICTED_SHELL */
 
+    case HEREDOC_REDIRECT:
+      internal_error ("cannot create temp file for here document: %s", strerror (heredoc_errno));
+      break;
+
     default:
       internal_error ("%s: %s", filename, strerror (error));
       break;
@@ -3210,6 +3345,9 @@ redirection_expand (word)
   return (result);
 }
 
+/* Write the text of the here document pointed to by REDIRECTEE to the file
+   descriptor FD, which is already open to a temp file.  Return 0 if the
+   write is successful, otherwise return errno. */
 static int
 write_here_document (fd, redirectee)
      int fd;
@@ -3279,7 +3417,117 @@ write_here_document (fd, redirectee)
   return 0;
 }
 
-/* Do the specific redirection requested.  Returns errno in case of error.
+/* Create a temporary file holding the text of the here document pointed to
+   by REDIRECTEE, and return a file descriptor open for reading to the temp
+   file.  Return -1 on any error, and make sure errno is set appropriately. */
+static int
+here_document_to_fd (redirectee)
+     WORD_DESC *redirectee;
+{
+  char filename[24];
+  int r, fd;
+
+  /* Make the filename for the temp file. */
+  sprintf (filename, "/tmp/t%d-sh", (int)time ((time_t *) 0) + (int)getpid ());
+
+  /* Make sure we open it exclusively. */
+  fd = open (filename, O_TRUNC | O_WRONLY | O_CREAT | O_EXCL, 0600);
+  if (fd < 0)
+    return (fd);
+
+  errno = r = 0;               /* XXX */
+  /* write_here_document returns 0 on success, errno on failure. */
+  if (redirectee->word)
+    r = write_here_document (fd, redirectee);
+
+  close (fd);
+  if (r)
+    {
+      unlink (filename);
+      errno = r;
+      return (-1);
+    }
+
+  /* XXX - this is raceable */
+  /* Make the document really temporary.  Also make it the input. */
+  fd = open (filename, O_RDONLY, 0600);
+
+  if (fd < 0)
+    {
+      r = errno;
+      unlink (filename);
+      errno = r;
+      return -1;
+    }
+
+  if (unlink (filename) < 0)
+    {
+      r = errno;
+      close (fd);
+      errno = r;
+      return (-1);
+    }
+
+  return (fd);
+}
+
+/* Open FILENAME with FLAGS in noclobber mode, hopefully avoiding most
+   race conditions and avoiding the problem where the file is replaced
+   between the stat(2) and open(2). */
+static int
+noclobber_open (filename, flags, ri)
+     char *filename;
+     int flags;
+     enum r_instruction ri;
+{
+  int r, fd;
+  struct stat finfo, finfo2;
+
+  /* If the file exists and is a regular file, return an error
+     immediately. */
+  r = stat (filename, &finfo);
+  if (r == 0 && (S_ISREG (finfo.st_mode)))
+    return (NOCLOBBER_REDIRECT);
+
+  /* If the file was not present (r != 0), make sure we open it
+     exclusively so that if it is created before we open it, our open
+     will fail.  Make sure that we do not truncate an existing file.
+     Note that we don't turn on O_EXCL unless the stat failed -- if
+     the file was not a regular file, we leave O_EXCL off. */
+  flags &= ~O_TRUNC;
+  if (r != 0)
+    {
+      fd = open (filename, flags|O_EXCL, 0666);
+      return ((fd < 0 && errno == EEXIST) ? NOCLOBBER_REDIRECT : fd);
+    }
+  fd = open (filename, flags, 0666);
+
+  /* If the open failed, return the file descriptor right away. */
+  if (fd < 0)
+    return (errno == EEXIST ? NOCLOBBER_REDIRECT : fd);
+
+  /* OK, the open succeeded, but the file may have been changed from a
+     non-regular file to a regular file between the stat and the open.
+     We are assuming that the O_EXCL open handles the case where FILENAME
+     did not exist and is symlinked to an existing file between the stat
+     and open. */
+
+  /* If we can open it and fstat the file descriptor, and neither check
+     revealed that it was a regular file, and the file has not been replaced,
+     return the file descriptor. */
+  if ((fstat (fd, &finfo2) == 0) && (S_ISREG (finfo2.st_mode) == 0) &&
+      r == 0 && (S_ISREG (finfo.st_mode) == 0) &&
+      same_file (filename, filename, &finfo, &finfo2))
+    return fd;
+
+  /* The file has been replaced.  badness. */
+  close (fd);  
+  errno = EEXIST;
+  return (NOCLOBBER_REDIRECT);
+}
+
+/* Do the specific redirection requested.  Returns errno or one of the
+   special redirection errors (*_REDIRECT) in case of error, 0 on success.
    If FOR_REAL is zero, then just do whatever is neccessary to produce the
    appropriate side effects.   REMEMBERING, if non-zero, says to remember
    how to undo each redirection.  If SET_CLEXEC is non-zero, then
@@ -3294,7 +3542,6 @@ do_redirection_internal (redirect, for_real, remembering, set_clexec)
   char *redirectee_word;
   enum r_instruction ri;
   REDIRECT *new_redirect;
-  struct stat finfo;
 
   redirectee = redirect->redirectee.filename;
   redir_fd = redirect->redirectee.dest;
@@ -3402,25 +3649,11 @@ do_redirection_internal (redirect, for_real, remembering, set_clexec)
 #endif /* RESTRICTED_SHELL */
 
       /* If we are in noclobber mode, you are not allowed to overwrite
-        existing files.  Check first. */
+        existing files.  Check before opening. */
       if (noclobber && OUTPUT_REDIRECT (ri))
        {
-         r = stat (redirectee_word, &finfo);
-
-         if (r == 0 && (S_ISREG (finfo.st_mode)))
-           {
-             free (redirectee_word);
-             return (NOCLOBBER_REDIRECT);
-           }
-
-         /* If the file was not present, make sure we open it exclusively
-            so that if it is created before we open it, our open will fail. */
-         if (r != 0)
-           redirect->flags |= O_EXCL;
-
-         fd = open (redirectee_word, redirect->flags, 0666);
-
-         if (fd < 0 && errno == EEXIST)
+         fd = noclobber_open (redirectee_word, redirect->flags, ri);
+         if (fd == NOCLOBBER_REDIRECT)
            {
              free (redirectee_word);
              return (NOCLOBBER_REDIRECT);
@@ -3507,34 +3740,12 @@ do_redirection_internal (redirect, for_real, remembering, set_clexec)
         the new input.  Place it in a temporary file. */
       if (redirectee)
        {
-         char filename[24];
-
-         /* Make the filename for the temp file. */
-         sprintf (filename, "/tmp/t%d-sh", (int)getpid ());
+         fd = here_document_to_fd (redirectee);
 
-         fd = open (filename, O_TRUNC | O_WRONLY | O_CREAT, 0666);
          if (fd < 0)
-           return (errno);
-
-         errno = r = 0;                /* XXX */
-         if (redirectee->word)
-           r = write_here_document (fd, redirectee);
-
-         close (fd);
-         if (r)
-           return (r);
-
-         /* Make the document really temporary.  Also make it the input. */
-         fd = open (filename, O_RDONLY, 0666);
-
-         if (fd < 0)
-           return (errno);
-
-         if (unlink (filename) < 0)
            {
-             r = errno;
-             close (fd);
-             return (r);
+             heredoc_errno = errno;
+             return (HEREDOC_REDIRECT);
            }
 
          if (for_real)
@@ -3622,6 +3833,10 @@ do_redirection_internal (redirect, for_real, remembering, set_clexec)
 #endif /* !BUFFERED_INPUT */
        }
       break;
+
+    case r_duplicating_input_word:
+    case r_duplicating_output_word:
+      break;
     }
   return (0);
 }
@@ -3715,7 +3930,6 @@ file_status (name)
      char *name;
 {
   struct stat finfo;
-  static int user_id = -1;
 
   /* Determine whether this file exists or not. */
   if (stat (name, &finfo) < 0)
@@ -3739,12 +3953,10 @@ file_status (name)
   /* Find out if the file is actually executable.  By definition, the
      only other criteria is that the file has an execute bit set that
      we can use. */
-  if (user_id == -1)
-    user_id = current_user.euid;
 
   /* Root only requires execute permission for any of owner, group or
      others to be able to exec a file. */
-  if (user_id == 0)
+  if (current_user.euid == (uid_t)0)
     {
       int bits;
 
@@ -3757,7 +3969,7 @@ file_status (name)
     }
 
   /* If we are the owner of the file, the owner execute bit applies. */
-  if (user_id == finfo.st_uid && X_BIT (u_mode_bits (finfo.st_mode)))
+  if (current_user.euid == finfo.st_uid && X_BIT (u_mode_bits (finfo.st_mode)))
     return (FS_EXISTS | FS_EXECABLE);
 
   /* If we are in the owning group, the group permissions apply. */
@@ -3890,6 +4102,9 @@ get_next_path_element (path_list, path_index_pointer)
   return (path);
 }
 
+/* Look for PATHNAME in $PATH.  Returns either the hashed command
+   corresponding to PATHNAME or the first instance of PATHNAME found
+   in $PATH.  Returns a newly-allocated string. */
 char *
 search_for_command (pathname)
      char *pathname;
@@ -3921,12 +4136,13 @@ search_for_command (pathname)
       if ((st ^ (FS_EXISTS | FS_EXECABLE)) != 0)
        {
          remove_hashed_filename (pathname);
+         free (hashed_file);
          hashed_file = (char *)NULL;
        }
     }
 
   if (hashed_file)
-    command = savestring (hashed_file);
+    command = hashed_file;
   else if (absolute_program (pathname))
     /* A command containing a slash is not looked up in PATH or saved in
        the hash table. */
diff --git a/expr.c b/expr.c
index eb08054..0930789 100644 (file)
--- a/expr.c
+++ b/expr.c
@@ -130,7 +130,7 @@ static int  noeval;         /* set to 1 if no assignment to be done */
 static procenv_t evalbuf;
 
 static void    readtok ();     /* lexical analyzer */
-static long    expassign (), exp0 (), exp1 (), exp2 (), exp3 (),
+static long    subexpr (), expassign (), exp0 (), exp1 (), exp2 (), exp3 (),
                exp4 (), exp5 (), expshift (), expland (), explor (),
                expband (), expbor (), expbxor (), expcond ();
 static long    strlong ();
@@ -158,8 +158,6 @@ pushexp ()
 {
   EXPR_CONTEXT *context;
 
-  context = (EXPR_CONTEXT *)xmalloc (sizeof (EXPR_CONTEXT));
-
   if (expr_depth >= MAX_EXPR_RECURSION_LEVEL)
     evalerror ("expression recursion level exceeded");
 
@@ -170,6 +168,8 @@ pushexp ()
                  * sizeof (EXPR_CONTEXT *));
     }
 
+  context = (EXPR_CONTEXT *)xmalloc (sizeof (EXPR_CONTEXT));
+
   context->curtok = curtok;
   context->lasttok = lasttok;
   context->expression = expression;
@@ -199,7 +199,11 @@ popexp ()
   free (context);
 }
 
-/* Evaluate EXPR, and return the arithmetic result.
+/* Evaluate EXPR, and return the arithmetic result.  If VALIDP is
+   non-null, a zero is stored into the location to which it points
+   if the expression is invalid, non-zero otherwise.  If a non-zero
+   value is returned in *VALIDP, the return value of evalexp() may
+   be used.
 
    The `while' loop after the longjmp is caught relies on the above
    implementation of pushexp and popexp leaving in expr_stack[0] the
@@ -209,49 +213,80 @@ popexp ()
    safe to let the loop terminate when expr_depth == 0, without freeing up
    any of the expr_depth[0] stuff. */
 long
-evalexp (expr)
+evalexp (expr, validp)
      char *expr;
+     int *validp;
 {
-  long val = 0L;
+  long val;
+#if 0
   procenv_t old_evalbuf;
-  char *p;
-
-  for (p = expr; p && *p && cr_whitespace (*p); p++)
-    ;
+#endif
 
-  if (p == NULL || *p == '\0')
-    return (0);
+  val = 0L;
 
+#if 0
   /* Save the value of evalbuf to protect it around possible recursive
      calls to evalexp (). */
   COPY_PROCENV (evalbuf, old_evalbuf);
+#endif
 
   if (setjmp (evalbuf))
     {
-      if (tokstr)              /* Clean up local allocation. */
-       free (tokstr);
-
-      if (expression)
-       free (expression);
+      FREE (tokstr);
+      FREE (expression);
+      tokstr = expression = (char *)NULL;
 
-      while (--expr_depth)
+      while (--expr_depth > 0)
        {
          if (expr_stack[expr_depth]->tokstr)
            free (expr_stack[expr_depth]->tokstr);
 
          if (expr_stack[expr_depth]->expression)
            free (expr_stack[expr_depth]->expression);
+
+         free (expr_stack[expr_depth]);
        }
-      jump_to_top_level (DISCARD);
+      free (expr_stack[expr_depth]);   /* free the allocated EXPR_CONTEXT */
+
+      if (validp)
+       *validp = 0;
+      return (0L);
     }
 
+  val = subexpr (expr);
+
+#if 0
+  /* Restore the value of evalbuf so that any subsequent longjmp calls
+     will have a valid location to jump to. */
+  COPY_PROCENV (old_evalbuf, evalbuf);
+#endif
+
+  if (validp)
+    *validp = 1;
+
+  return (val);
+}
+
+static long
+subexpr (expr)
+     char *expr;
+{
+  long val;
+  char *p;
+
+  for (p = expr; p && *p && cr_whitespace (*p); p++)
+    ;
+
+  if (p == NULL || *p == '\0')
+    return (0L);
+
   pushexp ();
   curtok = lasttok = 0;
   expression = savestring (expr);
   tp = expression;
 
   tokstr = (char *)NULL;
-  tokval = 0l;
+  tokval = 0L;
 
   readtok ();
 
@@ -260,18 +295,12 @@ evalexp (expr)
   if (curtok != 0)
     evalerror ("syntax error in expression");
 
-  if (tokstr)
-    free (tokstr);
-  if (expression)
-    free (expression);
+  FREE (tokstr);
+  FREE (expression);
 
   popexp ();
 
-  /* Restore the value of evalbuf so that any subsequent longjmp calls
-     will have a valid location to jump to. */
-  COPY_PROCENV (old_evalbuf, evalbuf);
-
-  return (val);
+  return val;
 }
 
 /* Bind/create a shell variable with the name LHS to the RHS.
@@ -362,6 +391,7 @@ expassign ()
              lvalue |= value;
              break;
            default:
+             free (lhs);
              evalerror ("bug: bad expassign token");
              break;
            }
@@ -373,7 +403,7 @@ expassign ()
        bind_int_variable (lhs, rhs);
       free (rhs);
       free (lhs);
-      free (tokstr);
+      FREE (tokstr);
       tokstr = (char *)NULL;           /* For freeing on errors. */
     }
   return (value);
@@ -384,6 +414,9 @@ static long
 expcond ()
 {
   long cval, val1, val2, rval;
+  int set_noeval;
+
+  set_noeval = 0;
   rval = cval = explor ();
   if (curtok == QUES)          /* found conditional expr */
     {
@@ -391,23 +424,30 @@ expcond ()
       if (curtok == 0 || curtok == COL)
        evalerror ("expression expected");
       if (cval == 0)
-       noeval++;
+       {
+         set_noeval = 1;
+         noeval++;
+       }
 #if 0
       val1 = explor ();
 #else
       val1 = expassign ();
 #endif
-      if (cval == 0)
+      if (set_noeval)
         noeval--;
       if (curtok != COL)
         evalerror ("`:' expected for conditional expression");
       readtok ();
       if (curtok == 0)
        evalerror ("expression expected");
+      set_noeval = 0;
       if (cval)
-        noeval++;
+       {
+         set_noeval = 1;
+         noeval++;
+       }
       val2 = explor ();
-      if (cval)
+      if (set_noeval)
         noeval--;
       rval = cval ? val1 : val2;
       lasttok = COND;
@@ -420,18 +460,24 @@ static long
 explor ()
 {
   register long val1, val2;
+  int set_noeval;
 
   val1 = expland ();
 
   while (curtok == LOR)
     {
-      readtok ();
+      set_noeval = 0;
       if (val1 != 0)
-       noeval++;
+       {
+         noeval++;
+         set_noeval = 1;
+       }
+      readtok ();
       val2 = expland ();
-      if (val1 != 0)
+      if (set_noeval)
        noeval--;
       val1 = val1 || val2;
+      lasttok = LOR;
     }
 
   return (val1);
@@ -442,18 +488,24 @@ static long
 expland ()
 {
   register long val1, val2;
+  int set_noeval;
 
   val1 = expbor ();
 
   while (curtok == LAND)
     {
-      readtok ();
+      set_noeval = 0;
       if (val1 == 0)
-       noeval++;
+       {
+         set_noeval = 1;
+         noeval++;
+       }
+      readtok ();
       val2 = expbor ();
-      if (val1 == 0)
+      if (set_noeval)
        noeval--;
       val1 = val1 && val2;
+      lasttok = LAND;
     }
 
   return (val1);
@@ -556,7 +608,7 @@ exp4 ()
        val1 = val1 >= val2;
       else if (op == LT)
        val1 = val1 < val2;
-      else if (op == GT)
+      else                     /* (op == GT) */
        val1 = val1 > val2;
     }
   return (val1);
@@ -762,7 +814,12 @@ readtok ()
       value = get_string_value (tokstr);
 #endif
 
-      tokval = (value && *value) ? evalexp (value) : 0;
+      tokval = (value && *value) ? subexpr (value) : 0;
+
+#if defined (ARRAY_VARS)
+      if (e == ']')
+       FREE (value);   /* get_array_value returns newly-allocated memory */
+#endif
 
       *cp = c;
       lasttok = curtok;
@@ -960,14 +1017,18 @@ main (argc, argv)
 {
   register int i;
   long v;
+  int expok;
 
   if (setjmp (top_level))
     exit (0);
 
   for (i = 1; i < argc; i++)
     {
-      v = evalexp (argv[i]);
-      printf ("'%s' -> %ld\n", argv[i], v);
+      v = evalexp (argv[i], &expok);
+      if (expok == 0)
+        fprintf (stderr, "%s: expression error\n", argv[i]);
+      else
+        printf ("'%s' -> %ld\n", argv[i], v);
     }
   exit (0);
 }
index e965b02..b44cb76 100644 (file)
--- a/externs.h
+++ b/externs.h
 #include "stdc.h"
 
 /* Functions from expr.c. */
-extern long evalexp __P((char *));
+extern long evalexp __P((char *, int *));
 
 /* Functions from getcwd.c */
 #if !defined (HAVE_GETCWD)
-extern char *getcwd ();
+extern char *getcwd __P((char *, size_t));
 #endif
 
 /* Functions from print_cmd.c. */
@@ -45,18 +45,20 @@ extern void xtrace_print_word_list __P((WORD_LIST *));
 /* Functions from shell.c. */
 extern int exit_shell __P((int));
 extern void disable_priv_mode __P((void));
+extern void unbind_args __P((void));
 
 #if defined (RESTRICTED_SHELL)
 extern int maybe_make_restricted __P((char *));
 #endif
 
+extern void get_current_user_info __P((void));
+
 /* Functions from eval.c. */
 extern int reader_loop __P((void));
 extern int parse_command __P((void));
 extern int read_command __P((void));
 
 /* Functions from test.c. */
-extern int group_member ();
 extern int test_command ();
 
 /* Functions from braces.c. */
@@ -115,7 +117,7 @@ extern int setlinebuf ();
 #endif
 
 /* Declarations for functions defined in stringlib.c */
-extern char *ansicstr __P((char *, int, int *));
+extern char *ansicstr __P((char *, int, int *, int *));
 extern int find_name_in_array __P((char *, char **));
 extern int array_len __P((char **));
 extern void free_array_members __P((char **));
@@ -128,7 +130,7 @@ extern WORD_LIST *argv_to_word_list __P((char **, int, int));
 
 extern char *strsub __P((char *, char *, char *, int));
 extern void strip_leading __P((char *));
-extern void strip_trailing __P((char *, int));
+extern void strip_trailing __P((char *, int, int));
 extern char *strindex __P((char *, char *));
 extern void xbcopy __P((char *, char *, int));
 
diff --git a/flags.c b/flags.c
index 856698d..80561e5 100644 (file)
--- a/flags.c
+++ b/flags.c
@@ -32,6 +32,10 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
 extern int set_job_control ();
 #endif
 
+#if defined (RESTRICTED_SHELL)
+extern char *shell_name;
+#endif
+
 /* **************************************************************** */
 /*                                                                 */
 /*                     The Standard Sh Flags.                      */
@@ -238,12 +242,26 @@ change_flag (flag, on_or_off)
     {
 #if defined (JOB_CONTROL)
     case 'm':
-      set_job_control (on_or_off == '-');
+      set_job_control (on_or_off == FLAG_ON);
       break;
 #endif /* JOB_CONTROL */
 
+#if defined (RESTRICTED_SHELL)
+    case 'r':
+      if (on_or_off == FLAG_ON)
+        maybe_make_restricted (shell_name);
+      break;
+#endif
+
+#if defined (BANG_HISTORY)
+    case 'H':
+      if (on_or_off == FLAG_ON)
+       bash_initialize_history ();
+      break;
+#endif
+
     case 'p':
-      if (on_or_off == '+')
+      if (on_or_off == FLAG_OFF)
        disable_priv_mode ();
 
       break;
@@ -268,3 +286,31 @@ which_set_flags ()
   temp[string_index] = '\0';
   return (temp);
 }
+
+void
+reset_shell_flags ()
+{
+  mark_modified_vars = exit_immediately_on_error = disallow_filename_globbing = 0;
+  place_keywords_in_env = read_but_dont_execute = just_one_command = 0;
+  noclobber = unbound_vars_is_error = echo_input_at_read = 0;
+  echo_command_at_execute = jobs_m_flag = forced_interactive = 0;
+  no_symbolic_links = no_invisible_vars = privileged_mode = 0;
+
+  hashing_enabled = interactive_comments = 1;
+
+#if defined (JOB_CONTROL)
+  asynchronous_notification = 0;
+#endif
+
+#if defined (BANG_HISTORY)
+  history_expansion = 1;
+#endif
+
+#if defined (BRACE_EXPANSION)
+  brace_expansion = 1;
+#endif
+
+#if defined (RESTRICTED_SHELL)
+  restricted = 0;
+#endif
+}
diff --git a/flags.h b/flags.h
index d971cb8..7d26799 100644 (file)
--- a/flags.h
+++ b/flags.h
@@ -66,6 +66,7 @@ extern int restricted;
 extern int *find_flag __P((int));
 extern int change_flag __P((int, int));
 extern char *which_set_flags __P((void));
+extern void reset_shell_flags __P((void));
 
 /* A macro for efficiency. */
 #define change_flag_char(flag, on_or_off)  change_flag (flag, on_or_off)
index 9623df0..eae99ab 100644 (file)
--- a/general.c
+++ b/general.c
@@ -89,12 +89,10 @@ char *
 itos (i)
      int i;
 {
-  char *buf, *p, *ret;
+  char buf[MAX_INT_LEN], *p, *ret;
   int negative = 0;
   unsigned int ui;
 
-  buf = xmalloc (MAX_INT_LEN);
-
   if (i < 0)
     {
       negative++;
@@ -114,7 +112,6 @@ itos (i)
     *p-- = '-';
 
   ret = savestring (p + 1);
-  free (buf);
   return (ret);
 }
 
@@ -439,14 +436,14 @@ check_dev_tty ()
   int tty_fd;
   char *tty;
 
-  tty_fd = open ("/dev/tty", O_RDWR);
+  tty_fd = open ("/dev/tty", O_RDWR|O_NONBLOCK);
 
   if (tty_fd < 0)
     {
       tty = (char *)ttyname (fileno (stdin));
       if (tty == 0)
        return;
-      tty_fd = open (tty, O_RDWR);
+      tty_fd = open (tty, O_RDWR|O_NONBLOCK);
     }
   close (tty_fd);
 }
@@ -482,18 +479,25 @@ same_file (path1, path2, stp1, stp2)
    allowed in the shell process, to avoid the user stepping on it with
    redirection and causing us extra work.  If CHECK_NEW is non-zero,
    we check whether or not the file descriptors are in use before
-   duplicating FD onto them. */
+   duplicating FD onto them.  MAXFD says where to start checking the
+   file descriptors.  If it's less than 20, we get the maximum value
+   available from getdtablesize(2). */
 int
-move_to_high_fd (fd, check_new)
-     int fd, check_new;
+move_to_high_fd (fd, check_new, maxfd)
+     int fd, check_new, maxfd;
 {
   int script_fd, nfds, ignore;
 
-  nfds = getdtablesize ();
-  if (nfds <= 0)
-    nfds = 20;
-  if (nfds > 256)
-    nfds = 256;
+  if (maxfd < 20)
+    {
+      nfds = getdtablesize ();
+      if (nfds <= 0)
+       nfds = 20;
+      if (nfds > 256)
+       nfds = 256;
+    }
+  else
+    nfds = maxfd;
 
   for (nfds--; check_new && nfds > 3; nfds--)
     if (fcntl (nfds, F_GETFD, &ignore) == -1)
@@ -607,11 +611,12 @@ canonicalize_pathname (path)
       while (result[i] == '/')
        i++;
 
-#if !defined (apollo)
+#if 0
       if ((start + 1) != i)
 #else
+      /* Leave a leading `//' alone, as POSIX requires. */
       if ((start + 1) != i && (start != 0 || i != 2))
-#endif /* apollo */
+#endif
        {
          strcpy (result + start + 1, result + i);
          i = start + 1;
@@ -709,11 +714,11 @@ make_absolute (string, dot_path)
   char *result;
   int result_len;
 
-  if (!dot_path || *string == '/')
+  if (dot_path == 0 || *string == '/')
     result = savestring (string);
   else
     {
-      if (dot_path && dot_path[0])
+      if (dot_path[0])
        {
          result_len = strlen (dot_path);
          result = xmalloc (2 + result_len + strlen (string));
@@ -801,6 +806,7 @@ full_pathname (file)
 
   disposer = file;
 
+  /* XXX - this should probably be just PATH_MAX or PATH_MAX + 1 */
   current_dir = xmalloc (2 + PATH_MAX + strlen (file));
   if (getcwd (current_dir, PATH_MAX) == 0)
     {
@@ -906,9 +912,9 @@ extract_colon_unit (string, p_index)
 
 /* If tilde_expand hasn't been able to expand the text, perhaps it
    is a special shell expansion.  This function is installed as the
-   tilde_expansion_failure_hook.  It knows how to expand ~- and ~+. */
+   tilde_expansion_preexpansion_hook.  It knows how to expand ~- and ~+. */
 static char *
-bash_tilde_expansion_failure_hook (text)
+bash_special_tilde_expansions (text)
      char *text;
 {
   char *result;
@@ -917,9 +923,9 @@ bash_tilde_expansion_failure_hook (text)
   if (text[1] == '\0')
     {
       if (*text == '+')
-        result = get_string_value ("PWD");
+       result = get_string_value ("PWD");
       else if (*text == '-')
-        result = get_string_value ("OLDPWD");
+       result = get_string_value ("OLDPWD");
     }
 
   return (result ? savestring (result) : (char *)NULL);
@@ -933,8 +939,8 @@ tilde_initialize ()
 {
   static int times_called = 0;
 
-  /* Tell the tilde expander that we want a crack if it fails. */
-  tilde_expansion_failure_hook = (CPFunction *)bash_tilde_expansion_failure_hook;
+  /* Tell the tilde expander that we want a crack first. */
+  tilde_expansion_preexpansion_hook = (CPFunction *)bash_special_tilde_expansions;
 
   /* Tell the tilde expander about special strings which start a tilde
      expansion, and the special strings that end one.  Only do this once.
@@ -967,3 +973,135 @@ bash_tilde_expand (s)
   interrupt_immediately = old_immed;
   return (ret);
 }
+
+/* **************************************************************** */
+/*                                                                 */
+/*       Functions to manipulate and search the group list         */
+/*                                                                 */
+/* **************************************************************** */
+
+static int ngroups, maxgroups;
+
+/* The set of groups that this user is a member of. */
+static GETGROUPS_T *group_array = (GETGROUPS_T *)NULL;
+
+#if !defined (NOGROUP)
+#  define NOGROUP (gid_t) -1
+#endif
+
+#if defined (HAVE_SYSCONF) && defined (_SC_NGROUPS_MAX)
+#  define getmaxgroups() sysconf(_SC_NGROUPS_MAX)
+#else
+#  if defined (NGROUPS_MAX)
+#    define getmaxgroups() NGROUPS_MAX
+#  else /* !NGROUPS_MAX */
+#    if defined (NGROUPS)
+#      define getmaxgroups() NGROUPS
+#    else /* !NGROUPS */
+#      define getmaxgroups() 64
+#    endif /* !NGROUPS */
+#  endif /* !NGROUPS_MAX */
+#endif /* !HAVE_SYSCONF || !SC_NGROUPS_MAX */
+
+static void
+initialize_group_array ()
+{
+  register int i;
+
+  if (maxgroups == 0)
+    maxgroups = getmaxgroups ();
+
+  ngroups = 0;
+  group_array = (GETGROUPS_T *)xrealloc (group_array, maxgroups * sizeof (GETGROUPS_T));
+
+#if defined (HAVE_GETGROUPS)
+  ngroups = getgroups (maxgroups, group_array);
+#endif
+
+  /* If getgroups returns nothing, or the OS does not support getgroups(),
+     make sure the groups array includes at least the current gid. */
+  if (ngroups == 0)
+    {
+      group_array[0] = current_user.gid;
+      ngroups = 1;
+    }
+
+  /* If the primary group is not in the groups array, add it as group_array[0]
+     and shuffle everything else up 1, if there's room. */
+  for (i = 0; i < ngroups; i++)
+    if (current_user.gid == (gid_t)group_array[i])
+      break;
+  if (i == ngroups && ngroups < maxgroups)
+    {
+      for (i = ngroups; i > 0; i--)
+        group_array[i] = group_array[i - 1];
+      group_array[0] = current_user.gid;
+      ngroups++;
+    }
+}
+
+/* Return non-zero if GID is one that we have in our groups list. */
+int
+group_member (gid)
+     gid_t gid;
+{
+#if defined (HAVE_GETGROUPS)
+  register int i;
+#endif
+
+  /* Short-circuit if possible, maybe saving a call to getgroups(). */
+  if (gid == current_user.gid || gid == current_user.egid)
+    return (1);
+
+#if defined (HAVE_GETGROUPS)
+  if (ngroups == 0)
+    initialize_group_array ();
+
+  /* In case of error, the user loses. */
+  if (ngroups <= 0)
+    return (0);
+
+  /* Search through the list looking for GID. */
+  for (i = 0; i < ngroups; i++)
+    if (gid == (gid_t)group_array[i])
+      return (1);
+#endif
+
+  return (0);
+}
+
+char **
+get_group_list (ngp)
+     int *ngp;
+{
+  static char **group_vector = (char **)NULL;
+  register int i;
+  char *nbuf;
+
+  if (group_vector)
+    {
+      if (ngp)
+       *ngp = ngroups;
+      return group_vector;
+    }
+
+  if (ngroups == 0)
+    initialize_group_array ();
+
+  if (ngroups <= 0)
+    {
+      if (ngp)
+       *ngp = 0;
+      return (char **)NULL;
+    }
+
+  group_vector = (char **)xmalloc (ngroups * sizeof (char *));
+  for (i = 0; i < ngroups; i++)
+    {
+      nbuf = itos ((int)group_array[i]);
+      group_vector[i] = nbuf;
+    }
+  if (ngp)
+    *ngp = ngroups;
+  return group_vector;
+}
index b520c1d..3cc70e2 100644 (file)
--- a/general.h
+++ b/general.h
 
 #include "stdc.h"
 
+#include "bashtypes.h"
+
+#if defined (HAVE_STRING_H)
+#  include <string.h>
+#else
+#  include <strings.h>
+#endif /* !HAVE_STRING_H */
+
 /* Generic pointer type. */
 #if defined (__STDC__)
 #  define PTR_T        void *
 #  endif /* !__STDC__ */
 #endif /* !NULL */
 
-#if defined (HAVE_STRING_H)
-#  include <string.h>
-#else
-#  include <strings.h>
-#endif /* !HAVE_STRING_H */
-
 #define pointer_to_int(x) (int)((long)(x))
 
 extern char *xmalloc (), *xrealloc ();
@@ -197,7 +199,7 @@ extern int check_identifier __P((WORD_DESC *, int));
 extern void unset_nodelay_mode __P((int));
 extern void check_dev_tty __P((void));
 extern int same_file ();       /* too many problems with prototype */
-extern int move_to_high_fd __P((int, int));
+extern int move_to_high_fd __P((int, int, int));
 extern int check_binary_file __P((unsigned char *, int));
 
 extern char *canonicalize_pathname __P((char *));
@@ -213,4 +215,11 @@ extern char *extract_colon_unit __P((char *, int *));
 extern void tilde_initialize __P((void));
 extern char *bash_tilde_expand __P((char *));
 
+#if defined (__STDC__) && defined (gid_t)
+extern int group_member __P((int));
+#else
+extern int group_member __P((gid_t));
+#endif
+extern char **get_group_list __P((int *));
+
 #endif /* _GENERAL_H_ */
index 40ae586..529b57d 100644 (file)
--- a/getcwd.c
+++ b/getcwd.c
 #include "maxpath.h"
 #include "memalloc.h"
 
-#if defined (HAVE_STDLIB_H)
-#  include <stdlib.h>
-#else
-#  include "ansi_stdlib.h"
-#endif /* !HAVE_STDLIB_H */
-
-#if defined (HAVE_STRING_H)
-#  include <string.h>
-#else
-#  include <strings.h>
-#endif /* !HAVE_STRING_H */
+#include "bashansi.h"
 
 #if !defined (errno)
 extern int errno;
diff --git a/hashcmd.c b/hashcmd.c
new file mode 100644 (file)
index 0000000..381c475
--- /dev/null
+++ b/hashcmd.c
@@ -0,0 +1,191 @@
+/* hashcmd.c - functions for managing a hash table mapping command names to
+              full pathnames. */
+
+/* Copyright (C) 1997 Free Software Foundation, Inc.
+
+   This file is part of GNU Bash, the Bourne Again SHell.
+
+    Bash is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License as published by the Free
+    Software Foundation; either version 1, or (at your option) any later
+    version.
+
+    Bash is distributed in the hope that it will be useful, but WITHOUT ANY
+    WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License along
+    with Bash; see the file COPYING.  If not, write to the Free Software
+    Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#include <config.h>
+
+#include "bashtypes.h"
+#include "posixstat.h"
+
+#if defined (HAVE_UNISTD_H)
+#  include <unistd.h>
+#endif
+
+#include "bashansi.h"
+
+#include "shell.h"
+#include "execute_cmd.h"
+#include "hashcmd.h"
+
+extern int hashing_enabled;
+
+static int hashing_initialized = 0;
+
+HASH_TABLE *hashed_filenames;
+
+void
+initialize_filename_hashing ()
+{
+  if (hashing_initialized == 0)
+    {
+      hashed_filenames = make_hash_table (FILENAME_HASH_BUCKETS);
+      hashing_initialized = 1;
+    }
+}
+
+static void
+free_filename_data (data)
+     char *data;
+{
+  free (((PATH_DATA *)data)->path);
+  free (data);
+}
+
+void
+flush_hashed_filenames ()
+{
+  if (hashed_filenames)
+    flush_hash_table (hashed_filenames, free_filename_data);
+}
+
+/* Remove FILENAME from the table of hashed commands. */
+void
+remove_hashed_filename (filename)
+     char *filename;
+{
+  register BUCKET_CONTENTS *item;
+
+  if (hashing_enabled == 0 || hashed_filenames == 0)
+    return;
+
+  item = remove_hash_item (filename, hashed_filenames);
+  if (item)
+    {
+      if (item->data)
+       free_filename_data (item->data);
+      free (item->key);
+      free (item);
+    }
+}
+
+/* Place FILENAME (key) and FULL_PATHNAME (data->path) into the
+   hash table.  CHECK_DOT if non-null is for future calls to
+   find_hashed_filename (); it means that this file was found
+   in a directory in $PATH that is not an absolute pathname.
+   FOUND is the initial value for times_found. */
+void
+remember_filename (filename, full_pathname, check_dot, found)
+     char *filename, *full_pathname;
+     int check_dot, found;
+{
+  register BUCKET_CONTENTS *item;
+
+  if (hashing_enabled == 0)
+    return;
+
+  if (hashed_filenames == 0 || hashing_initialized == 0)
+    initialize_filename_hashing ();
+
+  item = add_hash_item (filename, hashed_filenames);
+  if (item->data)
+    free (pathdata(item)->path);
+  else
+    {
+      item->key = savestring (filename);
+      item->data = xmalloc (sizeof (PATH_DATA));
+    }
+  pathdata(item)->path = savestring (full_pathname);
+  pathdata(item)->flags = 0;
+  if (check_dot)
+    pathdata(item)->flags |= HASH_CHKDOT;
+  if (*full_pathname != '/')
+    pathdata(item)->flags |= HASH_RELPATH;
+  item->times_found = found;
+}
+
+/* Return the full pathname that FILENAME hashes to.  If FILENAME
+   is hashed, but (data->flags & HASH_CHKDOT) is non-zero, check
+   ./FILENAME and return that if it is executable.  This always
+   returns a newly-allocated string; the caller is responsible
+   for freeing it. */
+char *
+find_hashed_filename (filename)
+     char *filename;
+{
+  register BUCKET_CONTENTS *item;
+  char *path, *dotted_filename, *tail;
+  int same;
+
+  if (hashing_enabled == 0 || hashed_filenames == 0)
+    return ((char *)NULL);
+
+  item = find_hash_item (filename, hashed_filenames);
+
+  if (item == NULL)
+    return ((char *)NULL);
+
+  /* If this filename is hashed, but `.' comes before it in the path,
+     see if ./filename is executable.  If the hashed value is not an
+     absolute pathname, see if ./`hashed-value' exists. */
+  path = pathdata(item)->path;
+  if (pathdata(item)->flags & (HASH_CHKDOT|HASH_RELPATH))
+    {
+      tail = (pathdata(item)->flags & HASH_RELPATH) ? path : filename;
+      dotted_filename = xmalloc (3 + strlen (tail));
+      dotted_filename[0] = '.'; dotted_filename[1] = '/';
+      strcpy (dotted_filename + 2, tail);
+
+      if (executable_file (dotted_filename))
+       return (dotted_filename);
+
+      free (dotted_filename);
+
+#if 0
+      if (pathdata(item)->flags & HASH_RELPATH)
+       return ((char *)NULL);
+#endif
+
+      /* Watch out.  If this file was hashed to "./filename", and
+        "./filename" is not executable, then return NULL. */
+
+      /* Since we already know "./filename" is not executable, what
+        we're really interested in is whether or not the `path'
+        portion of the hashed filename is equivalent to the current
+        directory, but only if it starts with a `.'.  (This catches
+        ./. and so on.)  same_file () tests general Unix file
+        equivalence -- same device and inode. */
+      if (*path == '.')
+       {
+         same = 0;
+         tail = (char *)strrchr (path, '/');
+
+         if (tail)
+           {
+             *tail = '\0';
+             same = same_file (".", path, (struct stat *)NULL, (struct stat *)NULL);
+             *tail = '/';
+           }
+
+         return same ? (char *)NULL : savestring (path);
+       }
+    }
+
+  return (savestring (path));
+}
similarity index 80%
rename from builtins/hashcom.h
rename to hashcmd.h
index 5943b5b..a875166 100644 (file)
+++ b/hashcmd.h
@@ -1,4 +1,4 @@
-/* hashcom.h - Common defines for hashing filenames. */
+/* hashcmd.h - Common defines for hashing filenames. */
 
 /* Copyright (C) 1993 Free Software Foundation, Inc.
 
@@ -18,7 +18,7 @@
    with Bash; see the file COPYING.  If not, write to the Free Software
    Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
 
-#include "../hashlib.h"
+#include "hashlib.h"
 
 #define FILENAME_HASH_BUCKETS 631
 
@@ -33,3 +33,9 @@ typedef struct {
 #define HASH_CHKDOT    0x02    /* check `.' since it was earlier in $PATH */
 
 #define pathdata(x) ((PATH_DATA *)(x)->data)
+
+extern void initialize_filename_hashing ();
+extern void flush_hashed_filenames ();
+extern void remove_hashed_filename ();
+extern void remember_filename ();
+extern char *find_hashed_filename ();
index 37e4dc9..703fcfa 100644 (file)
--- a/hashlib.c
+++ b/hashlib.c
@@ -20,22 +20,14 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 #include "config.h"
 
-#if defined (HAVE_STRING_H)
-#  include <string.h>
-#else /* !HAVE_STRING_H */
-#  include <strings.h>
-#endif /* !HAVE_STRING_H */
-
-#if defined (HAVE_STDLIB_H)
-#  include <stdlib.h>
-#else
-#  include "ansi_stdlib.h"
-#endif /* HAVE_STDLIB_H */
+#include "bashansi.h"
 
 #if defined (HAVE_UNISTD_H)
 #  include <unistd.h>
 #endif
 
+#include <stdio.h>
+
 #include "shell.h"
 #include "hashlib.h"
 
@@ -201,6 +193,9 @@ flush_hash_table (table, free_data)
   int i;
   register BUCKET_CONTENTS *bucket, *item;
 
+  if (table == 0)
+    return;
+
   for (i = 0; i < table->nbuckets; i++)
     {
       bucket = table->bucket_array[i];
@@ -221,6 +216,15 @@ flush_hash_table (table, free_data)
     }
 }
 
+/* Free the hash table pointed to by TABLE. */
+void
+dispose_hash_table (table)
+     HASH_TABLE *table;
+{
+  free (table->bucket_array);
+  free (table);
+}
+
 /* Return the bucket_contents list of bucket BUCKET in TABLE.  If
    TABLE doesn't have BUCKET buckets, return NULL. */
 #undef get_hash_bucket
@@ -235,6 +239,34 @@ get_hash_bucket (bucket, table)
     return (BUCKET_CONTENTS *)NULL;
 }
 
+/* #ifdef DEBUG */
+print_table_stats (table, name)
+     HASH_TABLE *table;
+     char *name;
+{
+  register int slot, bcount;
+  register BUCKET_CONTENTS *bc;
+
+  if (name == 0)
+    name = "unknown hash table";
+
+  fprintf (stderr, "%s: %d buckets; %d items\n", name, table->nbuckets, table->nentries);
+
+  /* Print out a count of how many strings hashed to each bucket, so we can
+     see how even the distribution is. */
+  for (slot = 0; slot < table->nbuckets; slot++)
+    {
+      bc = get_hash_bucket (slot, table);
+
+      fprintf (stderr, "\tslot %3d: ", slot);
+      for (bcount = 0; bc; bc = bc->next)
+        bcount++;
+
+      fprintf (stderr, "%d\n", bcount);
+    }
+}
+/* #endif */
+
 #ifdef TEST_HASHING
 
 #undef NULL
@@ -284,25 +316,8 @@ main ()
        }
     }
 
-  printf ("You have entered %d (%d) items.  The distribution is:\n",
-         table->nentries, count);
-
-  /* Print out a count of how many strings hashed to each bucket, so we can
-     see how even the distribution is. */
-  for (count = 0; count < table->nbuckets; count++)
-    {
-      int bcount;
-      register BUCKET_CONTENTS *list = get_hash_bucket (count, table);
-
-      printf ("slot %3d: ", count);
-      bcount = 0;
-
-      for (bcount = 0; list; list = list->next)
-        bcount++;
-
-      printf ("%d\n", bcount);
-    }
-    exit (0);
+  print_table_stats (table, "hash test");
+  exit (0);
 }
 
 #endif /* TEST_HASHING */
index 95a9164..d7432bd 100644 (file)
--- a/hashlib.h
+++ b/hashlib.h
@@ -41,6 +41,7 @@ extern BUCKET_CONTENTS *remove_hash_item ();
 extern BUCKET_CONTENTS *add_hash_item ();
 extern BUCKET_CONTENTS *get_hash_bucket ();
 extern void flush_hash_table ();
+extern void dispose_hash_table ();
 
 /* Redefine the function as a macro for speed. */
 #define get_hash_bucket(bucket, table) \
@@ -49,7 +50,7 @@ extern void flush_hash_table ();
                (BUCKET_CONTENTS *)NULL)
 
 /* Default number of buckets in the hash table. */
-#define DEFAULT_HASH_BUCKETS 107
+#define DEFAULT_HASH_BUCKETS 53        /* was 107 */
 
 #if !defined (NULL)
 #  if defined (__STDC__)
diff --git a/input.h b/input.h
index 64f66be..d174af2 100644 (file)
--- a/input.h
+++ b/input.h
@@ -80,7 +80,7 @@ extern BASH_INPUT bash_input;
 
 /* Functions from parse.y. */
 extern void initialize_bash_input __P((void));
-extern void init_yy_io __P((Function *, Function *, int, char *, INPUT_STREAM));
+extern void init_yy_io __P((Function *, Function *, enum stream_type, char *, INPUT_STREAM));
 extern void with_input_from_stdin __P((void));
 extern void with_input_from_string __P((char *, char *));
 extern void with_input_from_stream __P((FILE *, char *));
diff --git a/jobs.c b/jobs.c
index 28e4548..bd10cd0 100644 (file)
--- a/jobs.c
+++ b/jobs.c
 #  include <bsdtty.h>
 #endif /* hpux && !TERMIOS_TTY_DRIVER */
 
+#if !defined (STRUCT_WINSIZE_IN_SYS_IOCTL)
 /* For struct winsize on SCO */
 /*   sys/ptem.h has winsize but needs mblk_t from sys/stream.h */
-#if defined (HAVE_SYS_PTEM_H) && defined (TIOCGWINSZ) && defined (SIGWINCH)
-#  if defined (HAVE_SYS_STREAM_H)
-#    include <sys/stream.h>
-#  endif
-#  include <sys/ptem.h>
-#endif
+#  if defined (HAVE_SYS_PTEM_H) && defined (TIOCGWINSZ) && defined (SIGWINCH)
+#    if defined (HAVE_SYS_STREAM_H)
+#      include <sys/stream.h>
+#    endif
+#    include <sys/ptem.h>
+#  endif /* HAVE_SYS_PTEM_H && TIOCGWINSZ && SIGWINCH */
+#endif /* !STRUCT_WINSIZE_IN_SYS_IOCTL */
 
 #include "bashansi.h"
 #include "shell.h"
@@ -146,6 +148,10 @@ extern int errno;
 /* The number of additional slots to allocate when we run out. */
 #define JOB_SLOTS 8
 
+#if defined (READLINE)
+extern void _rl_set_screen_size ();
+#endif
+
 /* Variables used here but defined in other files. */
 extern int interactive, interactive_shell, asynchronous_notification;
 extern int startup_state, subshell_environment, line_number;
@@ -577,8 +583,7 @@ nohup_job (job_index)
 {
   register JOB *temp;
 
-  temp = jobs[job_index];
-  if (temp)
+  if (temp = jobs[job_index])
     temp->flags |= J_NOHUP;
 }
 
@@ -808,6 +813,25 @@ find_job (pid)
   return (NO_JOB);
 }
 
+/* Find a job given a PID.  If BLOCK is non-zero, block SIGCHLD as
+   required by find_job. */
+int
+get_job_by_pid (pid, block)
+     pid_t pid;
+     int block;
+{
+  int job;
+  sigset_t set, oset;
+
+  if (block)
+    BLOCK_CHILD (set, oset);
+  job = find_job (pid);
+  if (block)
+    UNBLOCK_CHILD (oset);
+
+  return job;
+}
+
 /* Print descriptive information about the job with leader pid PID. */
 void
 describe_pid (pid)
@@ -1346,8 +1370,9 @@ get_tty_state ()
 int
 set_tty_state ()
 {
-  int tty = input_tty ();
+  int tty;
 
+  tty = input_tty ();
   if (tty != -1)
     {
 #if defined (NEW_TTY_DRIVER)
@@ -1894,6 +1919,29 @@ reset_current ()
     current_job = previous_job = NO_JOB;
 }
 
+/* Set up the job structures so we know the job and its processes are
+   all running. */
+static void
+set_job_running (job)
+     int job;
+{
+  register PROCESS *p;
+
+  /* Each member of the pipeline is now running. */
+  p = jobs[job]->pipe;
+
+  do
+    {
+      if (WIFSTOPPED (p->status))
+       p->running = 1;
+      p = p->next;
+    }
+  while (p != jobs[job]->pipe);
+
+  /* This means that the job is running. */
+  JOBSTATE (job) = JRUNNING;
+}
+
 /* Start a job.  FOREGROUND if non-zero says to do that.  Otherwise,
    start the job in the background.  JOB is a zero-based index into
    JOBS.  Returns -1 if it is unable to start a job, and the return
@@ -1971,21 +2019,7 @@ start_job (job, foreground)
 
   /* Run the job. */
   if (already_running == 0)
-    {
-      /* Each member of the pipeline is now running. */
-      p = jobs[job]->pipe;
-
-      do
-       {
-         if (WIFSTOPPED (p->status))
-           p->running = 1;
-         p = p->next;
-       }
-      while (p != jobs[job]->pipe);
-
-      /* This means that the job is running. */
-      JOBSTATE (job) = JRUNNING;
-    }
+    set_job_running (job);
 
   /* Save the tty settings before we start the job in the foreground. */
   if (foreground)
@@ -2071,6 +2105,14 @@ kill_pid (pid, sig, group)
              result = killpg (jobs[job]->pgrp, sig);
              if (p && STOPPED (job) && (sig == SIGTERM || sig == SIGHUP))
                killpg (jobs[job]->pgrp, SIGCONT);
+             /* If we're continuing a stopped job via kill rather than bg or
+                fg, emulate the `bg' behavior. */
+             if (p && STOPPED (job) && (sig == SIGCONT))
+               {
+                 set_job_running (job);
+                 jobs[job]->flags &= ~J_FOREGROUND;
+                 jobs[job]->flags |= J_NOTIFIED;
+               }
            }
        }
       else
@@ -2119,9 +2161,9 @@ waitchld (wpid, block)
 
   do
     {
-      /* We don't want to be notified about jobs stopping if we're not
-         interactive. */
-      waitpid_flags = (interactive_shell && subshell_environment == 0)
+      /* We don't want to be notified about jobs stopping if job control
+         is not active.  XXX - was interactive_shell instead of job_control */
+      waitpid_flags = (job_control && subshell_environment == 0)
                        ? WUNTRACED
                        : 0;
       if (sigchld || block == 0)
@@ -2156,6 +2198,7 @@ waitchld (wpid, block)
       child->running = 0;
 
       job = find_job (pid);
+  
       if (job == NO_JOB)
         continue;
 
@@ -2270,11 +2313,15 @@ waitchld (wpid, block)
                {
                  /* wait_sigint_handler () has already seen SIGINT and
                     allowed the wait builtin to jump out.  We need to
-                    call the original SIGINT handler. */
+                    call the original SIGINT handler, if necessary.  If
+                    the original handler is SIG_DFL, we need to resend
+                    the signal to ourselves. */
                  SigHandler *temp_handler;
                  temp_handler = old_sigint_handler;
                  restore_sigint_handler ();
-                 if (temp_handler != SIG_IGN)
+                 if (temp_handler == SIG_DFL)
+                   termination_unwind_protect (SIGINT);
+                 else if (temp_handler != SIG_IGN)
                    (*temp_handler) (SIGINT);
                }
            }
@@ -2325,7 +2372,7 @@ waitchld (wpid, block)
       for (i = 0; i < children_exited; i++)
        {
          interrupt_immediately = 1;
-         parse_and_execute (savestring (trap_command), "trap", -1);
+         parse_and_execute (savestring (trap_command), "trap", SEVAL_NOHIST);
        }
 
       run_unwind_frame ("SIGCHLD trap");
@@ -2381,7 +2428,7 @@ notify_of_job_status ()
 
          /* Print info on jobs that are running in the background,
             and on foreground jobs that were killed by anything
-            except SIGINT. */
+            except SIGINT (and possibly SIGPIPE). */
          switch (JOBSTATE (job))
            {
            case JDEAD:
@@ -2393,7 +2440,11 @@ notify_of_job_status ()
                }
              else if (IS_FOREGROUND (job))
                {
+#if !defined (DONT_REPORT_SIGPIPE)
                  if (termsig && WIFSIGNALED (s) && termsig != SIGINT)
+#else
+                 if (termsig && WIFSIGNALED (s) && termsig != SIGINT && termsig != SIGPIPE)
+#endif
                    {
                      fprintf (stderr, "%s", strsignal (termsig));
 
@@ -2441,13 +2492,14 @@ notify_of_job_status ()
 
 /* Initialize the job control mechanism, and set up the tty stuff. */
 int
-initialize_jobs ()
+initialize_job_control (force)
+     int force;
 {
   shell_pgrp = getpgid (0);
 
   if (shell_pgrp == -1)
     {
-      sys_error ("initialize_jobs: getpgrp failed");
+      sys_error ("initialize_job_control: getpgrp failed");
       exit (1);
     }
 
@@ -2456,6 +2508,7 @@ initialize_jobs ()
     {
       job_control = 0;
       original_pgrp = NO_PID;
+      shell_tty = fileno (stderr);
     }
   else
     {
@@ -2464,7 +2517,7 @@ initialize_jobs ()
         matter where fd 2 is directed. */
       shell_tty = dup (fileno (stderr));       /* fd 2 */
 
-      shell_tty = move_to_high_fd (shell_tty, 1);
+      shell_tty = move_to_high_fd (shell_tty, 1, -1);
 
       /* Compensate for a bug in systems that compiled the BSD
         rlogind with DEBUG defined, like NeXT and Alliant. */
@@ -2492,7 +2545,7 @@ initialize_jobs ()
       /* Make sure that we are using the new line discipline. */
       if (set_new_line_discipline (shell_tty) < 0)
        {
-         sys_error ("initialize_jobs: line discipline");
+         sys_error ("initialize_job_control: line discipline");
          job_control = 0;
        }
       else
@@ -2502,7 +2555,7 @@ initialize_jobs ()
 
          if ((original_pgrp != shell_pgrp) && (setpgid (0, shell_pgrp) < 0))
            {
-             sys_error ("initialize_jobs: setpgid");
+             sys_error ("initialize_job_control: setpgid");
              shell_pgrp = original_pgrp;
            }
 
@@ -2633,6 +2686,7 @@ sigwinch_sighandler (sig)
   set_signal_handler (SIGWINCH, sigwinch_sighandler);
 #endif /* MUST_REINSTALL_SIGHANDLERS */
   get_new_window_size (1);
+  SIGRETURN (0);
 }
 #else
 static void
@@ -2750,7 +2804,7 @@ give_terminal_to (pgrp)
    children of the shell, who should not have any job structures as baggage
    when they start executing (forking subshells for parenthesized execution
    and functions with pipes are the two that spring to mind). */
-static void
+void
 delete_all_jobs ()
 {
   register int i;
@@ -2773,6 +2827,26 @@ delete_all_jobs ()
   UNBLOCK_CHILD (oset);
 }
 
+/* Mark all jobs in the job array so that they don't get a SIGHUP when the
+   shell gets one. */
+void
+nohup_all_jobs ()
+{
+  register int i;
+  sigset_t set, oset;
+
+  BLOCK_CHILD (set, oset);
+
+  if (job_slots)
+    {
+      for (i = 0; i < job_slots; i++)
+       if (jobs[i])
+         nohup_job (i);
+    }
+
+  UNBLOCK_CHILD (oset);
+}
+
 /* Mark all dead jobs as notified, so delete_job () cleans them out
    of the job table properly. */
 static void
@@ -2850,7 +2924,7 @@ restart_job_control ()
 {
   if (shell_tty != -1)
     close (shell_tty);
-  initialize_jobs ();
+  initialize_job_control (0);
 }
 
 /* Set the handler to run when the shell receives a SIGCHLD signal. */
diff --git a/jobs.h b/jobs.h
index f80047e..9ab180f 100644 (file)
--- a/jobs.h
+++ b/jobs.h
@@ -26,6 +26,8 @@
 
 #include "stdc.h"
 
+#include "posixwait.h"
+
 /* Defines controlling the fashion in which jobs are listed. */
 #define JLIST_STANDARD       0
 #define JLIST_LONG          1
 #define JLIST_CHANGED_ONLY   3
 #define JLIST_NONINTERACTIVE 4
 
-/* If _POSIX_VERSION is not defined, we assume that <sys/wait.h> defines
-   a `union wait' and various macros used to manipulate it.  Look in
-   bashwait.h for the things we expect to find. */
-#if defined (HAVE_SYS_WAIT_H)
-#  include <sys/wait.h>
-#else /* !HAVE_SYS_WAIT_H */
-#  if !defined (_POSIX_VERSION)
-#    include "bashwait.h"
-#  endif
-#endif  /* !HAVE_SYS_WAIT_H */
-
-/* How to get the status of a job.  For Posix, this is just an
-   int, but for other systems we have to crack the union wait. */
-#if !defined (_POSIX_VERSION)
-typedef union wait WAIT;
-#  define WSTATUS(t)  (t.w_status)
-#else /* _POSIX_VERSION */
-typedef int WAIT;
-#  define WSTATUS(t)  (t)
-#endif /* _POSIX_VERSION */
-
-/* Make sure that parameters to wait3 are defined. */
-#if !defined (WNOHANG)
-#  define WNOHANG 1
-#  define WUNTRACED 2
-#endif /* WNOHANG */
-
-/* More Posix P1003.1 definitions.  In the POSIX versions, the parameter is
-   passed as an `int', in the non-POSIX version, as `union wait'. */
-#if defined (_POSIX_VERSION)
-
-#  if !defined (WSTOPSIG)
-#    define WSTOPSIG(s)       ((s) >> 8)
-#  endif /* !WSTOPSIG */
-
-#  if !defined (WTERMSIG)
-#    define WTERMSIG(s)              ((s) & 0177)
-#  endif /* !WTERMSIG */
-
-#  if !defined (WEXITSTATUS)
-#    define WEXITSTATUS(s)    ((s) >> 8)
-#  endif /* !WEXITSTATUS */
-
-#  if !defined (WIFSTOPPED)
-#    define WIFSTOPPED(s)     (((s) & 0177) == 0177)
-#  endif /* !WIFSTOPPED */
-
-#  if !defined (WIFEXITED)
-#    define WIFEXITED(s)      (((s) & 0377) == 0)
-#  endif /* !WIFEXITED */
-
-#  if !defined (WIFSIGNALED)
-#    define WIFSIGNALED(s)    (!WIFSTOPPED(s) && !WIFEXITED(s))
-#  endif /* !WIFSIGNALED */
-
-#  if !defined (WIFCORED)
-#    define WIFCORED(s)       ((s) & 0200)
-#  endif /* !WIFCORED */
-
-#else /* !_POSIX_VERSION */
-
-#  if !defined (WSTOPSIG)
-#    define WSTOPSIG(s)              ((s).w_stopsig)
-#  endif /* !WSTOPSIG */
-
-#  if !defined (WTERMSIG)
-#    define WTERMSIG(s)              ((s).w_termsig)
-#  endif /* !WTERMSIG */
-
-#  if !defined (WEXITSTATUS)
-#    define WEXITSTATUS(s)    ((s).w_retcode)
-#  endif /* !WEXITSTATUS */
-
-#  if !defined (WIFCORED)
-#    define WIFCORED(s)       ((s).w_coredump)
-#  endif /* !WIFCORED */
-
-#endif /* !_POSIX_VERSION */
-
 /* I looked it up.  For pretty_print_job ().  The real answer is 24. */
 #define LONGEST_SIGNAL_DESC 24
 
@@ -186,8 +109,11 @@ extern void save_pipeline __P((int));
 extern void restore_pipeline __P((int));
 extern void start_pipeline __P((void));
 extern int stop_pipeline __P((int, COMMAND *));
+
 extern void delete_job __P((int));
 extern void nohup_job __P((int));
+extern void delete_all_jobs __P((void));
+extern void nohup_all_jobs __P((void));
 
 extern void terminate_current_pipeline __P((void));
 extern void terminate_stopped_jobs __P((void));
@@ -195,8 +121,10 @@ extern void hangup_all_jobs __P((void));
 extern void kill_current_pipeline __P((void));
 
 #if defined (__STDC__) && defined (pid_t)
+extern int get_job_by_pid __P((int, int));
 extern void describe_pid __P((int));
 #else
+extern int get_job_by_pid __P((pid_t, int));
 extern void describe_pid __P((pid_t));
 #endif
 
@@ -218,7 +146,7 @@ extern void notify_and_cleanup __P((void));
 extern void reap_dead_jobs __P((void));
 extern int start_job __P((int, int));
 extern int kill_pid __P((pid_t, int, int));
-extern int initialize_jobs __P((void));
+extern int initialize_job_control __P((int));
 extern void initialize_job_signals __P((void));
 extern int give_terminal_to __P((pid_t));
 
index 4471c18..2a6bf63 100644 (file)
@@ -26,10 +26,11 @@ CPPFLAGS = @CPPFLAGS@
 LDFLAGS = @LDFLAGS@ @LOCAL_LDFLAGS@
 
 DEFS = @DEFS@
+LOCAL_DEFS = @LOCAL_DEFS@
 
 INCLUDES = -I. -I../.. -I$(topdir) -I$(topdir)/lib
 
-CCFLAGS = $(DEFS) $(CPPFLAGS) ${INCLUDES} $(LOCAL_CFLAGS) $(CFLAGS)
+CCFLAGS = $(DEFS) $(LOCAL_DEFS) $(CPPFLAGS) ${INCLUDES} $(LOCAL_CFLAGS) $(CFLAGS)
 
 # Here is a rule for making .o files from .c files that doesn't force
 # the type of the machine (like -sun3) into the flags.
@@ -99,7 +100,10 @@ mostlyclean: clean
 #                                                                   #
 ######################################################################
 
-fnmatch.o: fnmatch.c fnmatch.h
-
+fnmatch.o: fnmatch.h
 fnmatch.o: $(BUILD_DIR)/config.h
+
 glob.o: $(BUILD_DIR)/config.h
+glob.o: $(topdir)/bashtypes.h $(topdir)/ansi_stdlib.h $(topdir)/bashansi.h
+glob.o: $(topdir)/posixstat.h $(topdir)/memalloc.h
+glob.o: fnmatch.h
index 0763609..2f8eb24 100644 (file)
@@ -50,15 +50,23 @@ fnmatch (pattern, string, flags)
          if (*n == '\0')
            return (FNM_NOMATCH);
          else if ((flags & FNM_PATHNAME) && *n == '/')
+           /* If we are matching a pathname, `?' can never match a `/'. */
            return (FNM_NOMATCH);
          else if ((flags & FNM_PERIOD) && *n == '.' &&
                   (n == string || ((flags & FNM_PATHNAME) && n[-1] == '/')))
+           /* `?' cannot match a `.' if it is the first character of the
+              string or if it is the first character following a slash and
+              we are matching a pathname. */
            return (FNM_NOMATCH);
          break;
 
        case '\\':
          if (!(flags & FNM_NOESCAPE))
-           c = *p++;
+           {
+             c = *p++;
+             if (c == '\0')
+               return (FNM_NOMATCH);
+           }
          if (*n != c)
            return (FNM_NOMATCH);
          break;
@@ -66,23 +74,38 @@ fnmatch (pattern, string, flags)
        case '*':
          if ((flags & FNM_PERIOD) && *n == '.' &&
              (n == string || ((flags & FNM_PATHNAME) && n[-1] == '/')))
+           /* `*' cannot match a `.' if it is the first character of the
+              string or if it is the first character following a slash and
+              we are matching a pathname. */
            return (FNM_NOMATCH);
 
+         /* Collapse multiple consecutive, `*' and `?', but make sure that
+            one character of the string is consumed for each `?'. */
          for (c = *p++; c == '?' || c == '*'; c = *p++)
            {
-             if (((flags & FNM_PATHNAME) && *n == '/') ||
-                 (c == '?' && *n == '\0'))
+             if ((flags & FNM_PATHNAME) && *n == '/')
+               /* A slash does not match a wildcard under FNM_PATHNAME. */
                return (FNM_NOMATCH);
-             if (c == '?')
-               n++;
+             else if (c == '?')
+               {
+                 if (*n == '\0')
+                   return (FNM_NOMATCH);
+                 /* One character of the string is consumed in matching
+                    this ? wildcard, so *??? won't match if there are
+                    fewer than three characters. */
+                 n++;
+               }
            }
 
          if (c == '\0')
            return (0);
 
+         /* General case, use recursion. */
          {
            char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c;
            for (--p; *n != '\0'; ++n)
+             /* Only call fnmatch if the first character indicates a
+                possible match. */
              if ((c == '[' || *n == c1) &&
                  fnmatch (p, n, flags & ~FNM_PERIOD) == 0)
                return (0);
@@ -97,22 +120,30 @@ fnmatch (pattern, string, flags)
            if (*n == '\0')
              return (FNM_NOMATCH);
 
+           /* A character class cannot match a `.' if it is the first
+              character of the string or if it is the first character
+              following a slash and we are matching a pathname. */
            if ((flags & FNM_PERIOD) && *n == '.' &&
                (n == string || ((flags & FNM_PATHNAME) && n[-1] == '/')))
              return (FNM_NOMATCH);
 
-           /* Make sure there is a closing `]'.  If there isn't, the `['
-              is just a character to be matched. */
+           /* POSIX.2 2.8.3.1.2 says: `An expression containing a `[' that
+              is not preceded by a backslash and is not part of a bracket
+              expression produces undefined results.'  This implementation
+              treats the `[' as just a character to be matched if there is
+              not a closing `]'.  This code will have to be changed when
+              POSIX.2 character classes are implemented. */
            {
              register char *np;
 
-             for (np = p; np && *np && *np != ']'; np++);
+             for (np = p; np && *np && *np != ']'; np++)
+               ;
 
              if (np && !*np)
                {
                  if (*n != '[')
                    return (FNM_NOMATCH);
-                 goto next_char;
+                 break;
                }
            }
              
@@ -123,10 +154,18 @@ fnmatch (pattern, string, flags)
            c = *p++;
            for (;;)
              {
-               register char cstart = c, cend = c;
+               register char cstart, cend;
+
+               /* Initialize cstart and cend in case `-' is the last
+                  character of the pattern. */
+               cstart = cend = c;
 
                if (!(flags & FNM_NOESCAPE) && c == '\\')
-                 cstart = cend = *p++;
+                 {
+                   if (*p == '\0')
+                     return FNM_NOMATCH;
+                   cstart = cend = *p++;
+                 }
 
                if (c == '\0')
                  /* [ (unterminated) loses.  */
@@ -138,6 +177,9 @@ fnmatch (pattern, string, flags)
                  /* [/] can never match.  */
                  return (FNM_NOMATCH);
 
+               /* This introduces a range, unless the `-' is the last
+                  character of the class.  Find the end of the range
+                  and move past it. */
                if (c == '-' && *p != ']')
                  {
                    cend = *p++;
@@ -145,6 +187,7 @@ fnmatch (pattern, string, flags)
                      cend = *p++;
                    if (cend == '\0')
                      return (FNM_NOMATCH);
+
                    c = *p++;
                  }
 
@@ -156,8 +199,6 @@ fnmatch (pattern, string, flags)
              }
            if (!not)
              return (FNM_NOMATCH);
-
-         next_char:
            break;
 
          matched:
@@ -170,8 +211,12 @@ fnmatch (pattern, string, flags)
 
                c = *p++;
                if (!(flags & FNM_NOESCAPE) && c == '\\')
-                 /* 1003.2d11 is unclear if this is right.  %%% */
-                 ++p;
+                 {
+                   if (*p == '\0')
+                     return FNM_NOMATCH;
+                   /* XXX 1003.2d11 is unclear if this is right. */
+                   ++p;
+                 }
              }
            if (not)
              return (FNM_NOMATCH);
index 412e15c..6d2f58f 100644 (file)
@@ -103,6 +103,8 @@ extern void free ();
 #endif /* !NULL */
 
 #if defined (SHELL)
+extern void throw_to_top_level ();
+
 extern int interrupt_state;
 #endif /* SHELL */
 
@@ -265,7 +267,8 @@ glob_vector (pat, dir)
        continue;
 
       /* If a dot must be explicity matched, check to see if they do. */
-      if (noglob_dot_filenames && dp->d_name[0] == '.' && pat[0] != '.')
+      if (noglob_dot_filenames && dp->d_name[0] == '.' && pat[0] != '.' &&
+           (pat[0] != '\\' || pat[1] != '.'))
        continue;
 
       flags = (noglob_dot_filenames ? FNM_PERIOD : 0) | FNM_PATHNAME;
@@ -295,7 +298,9 @@ glob_vector (pat, dir)
     }
 
   /* Have we run out of memory?         */
+#if defined (SHELL)
  lost:
+#endif
   if (lose)
     {
       /* Here free the strings we have got.  */
index 6bba7d1..0842f92 100644 (file)
@@ -17,16 +17,20 @@ RM = rm -f
 CP = cp
 MV = mv
 
+PROFILE_FLAGS = 
+
 CFLAGS = @CFLAGS@
 LOCAL_CFLAGS = @LOCAL_CFLAGS@
 CPPFLAGS = @CPPFLAGS@
 LDFLAGS = @LDFLAGS@
 
 DEFS = @DEFS@
+LOCAL_DEFS = @LOCAL_DEFS@
 
 INCLUDES = -I. -I../.. -I$(topdir) -I$(topdir)/lib
 
-CCFLAGS = ${INCLUDES} $(DEFS) $(LOCAL_CFLAGS) $(CFLAGS) $(MALLOC_CFLAGS) $(CPPFLAGS)
+CCFLAGS = ${PROFILE_FLAGS} ${INCLUDES} $(DEFS) $(LOCAL_DEFS) $(LOCAL_CFLAGS) \
+         $(CFLAGS) $(MALLOC_CFLAGS) $(CPPFLAGS)
 
 .c.o:
        $(CC) $(CCFLAGS) -c $<
@@ -35,6 +39,9 @@ CCFLAGS = ${INCLUDES} $(DEFS) $(LOCAL_CFLAGS) $(CFLAGS) $(MALLOC_CFLAGS) $(CPPFL
        $(CC) $(CCFLAGS) -c $<
 
 MALLOC_SOURCE = malloc.c
+GMALLOC_SOURCE = gmalloc.c
+NMALLOC_SOURCE = nmalloc.c
+STUB_SOURCE = stub.c
 
 ALLOCA_SOURCE = alloca.c
 ALLOCA_OBJECT = alloca.o
@@ -43,12 +50,46 @@ MALLOC_SRC = @MALLOC_SRC@
 MALLOC = @MALLOC@
 ALLOCA = @ALLOCA@
 
-libmalloc.a:   $(MALLOC) $(ALLOCA) stub.o
-       $(RM) $@
-       $(AR) cr $@ $(MALLOC) $(ALLOCA) stub.o
-       -test -n "$(RANLIB)" && $(RANLIB) $@
+MALLOC_OBJS = malloc.o $(ALLOCA) stub.o
+GMALLOC_OBJS = gmalloc.o $(ALLOCA) stub.o
+NMALLOC_OBJS = nmalloc.o $(ALLOCA) stub.o
+NMALLOC2_OBJS = nmalloc2.o $(ALLOCA) stub.o
+NGMALLOC_OBJS = ngmalloc.o $(ALLOCA) stub.o
+STUB_OBJS = $(ALLOCA) stub.o
+
+.PHONY:                malloc gmalloc stubmalloc nmalloc ngmalloc nmalloc2
+
+all:           malloc
+
+malloc: ${MALLOC_OBJS}
+       ${RM} libmalloc.a
+       ${AR} cr libmalloc.a ${MALLOC_OBJS}
+       -test -n "$(RANLIB)" && $(RANLIB) libmalloc.a
+
+nmalloc: ${NMALLOC_OBJS}
+       ${RM} libmalloc.a
+       ${AR} cr libmalloc.a ${NMALLOC_OBJS}
+       -test -n "$(RANLIB)" && $(RANLIB) libmalloc.a
 
-malloc.o: malloc.c getpagesize.h
+nmalloc2: ${NMALLOC2_OBJS}
+       ${RM} libmalloc.a
+       ${AR} cr libmalloc.a ${NMALLOC2_OBJS}
+       -test -n "$(RANLIB)" && $(RANLIB) libmalloc.a
+
+gmalloc: ${GMALLOC_OBJS}
+       ${RM} libmalloc.a
+       ${AR} cr libmalloc.a ${GMALLOC_OBJS}
+       -test -n "$(RANLIB)" && $(RANLIB) libmalloc.a
+
+ngmalloc: ${NGMALLOC_OBJS}
+       ${RM} libmalloc.a
+       ${AR} cr libmalloc.a ${NGMALLOC_OBJS}
+       -test -n "$(RANLIB)" && $(RANLIB) libmalloc.a
+
+stubmalloc: ${STUB_OBJS}
+       ${RM} libmalloc.a
+       ${AR} cr libmalloc.a ${STUB_OBJS}
+       -test -n "$(RANLIB)" && $(RANLIB) libmalloc.a
 
 alloca.o:      $(ALLOCA_SOURCE)
        $(CC) $(CCFLAGS) -c $(ALLOCA_SOURCE)
@@ -62,7 +103,12 @@ mostlyclean clean:
 distclean realclean maintainer-clean: clean
        $(RM) Makefile
 
+malloc.o: malloc.c
+gmalloc.o: gmalloc.c
+
 alloca.o: $(BUILD_DIR)/config.h
-malloc.o: $(BUILD_DIR)/config.h
-xmalloc.o: $(BUILD_DIR)/config.h
+malloc.o: $(BUILD_DIR)/config.h $(topdir)/bashtypes.h getpagesize.h
+nmalloc.o: $(BUILD_DIR)/config.h $(topdir)/bashtypes.h getpagesize.h
+nmalloc2.o: $(BUILD_DIR)/config.h $(topdir)/bashtypes.h getpagesize.h
+xmalloc.o: $(BUILD_DIR)/config.h $(topdir)/ansi_stdlib.h
 gmalloc.o: $(BUILD_DIR)/config.h
index 0cb4416..0b75b89 100644 (file)
@@ -19,6 +19,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #  include <unistd.h>
 #  if defined (_SC_PAGESIZE)
 #    define getpagesize() sysconf(_SC_PAGESIZE)
+#  else
+#    if defined (_SC_PAGE_SIZE)
+#      define getpagesize() sysconf(_SC_PAGE_SIZE)
+#    endif /* _SC_PAGE_SIZE */
 #  endif /* _SC_PAGESIZE */
 #endif
 
index 88217db..a8b232a 100644 (file)
@@ -74,7 +74,11 @@ what you give them.   Help stamp out software-hoarding!  */
 #endif
 
 /* Determine which kind of system this is.  */
-#include <sys/types.h>
+#if defined (SHELL)
+#  include "bashtypes.h"
+#else
+#  include <sys/types.h>
+#endif
 #include <signal.h>
 
 /* Define getpagesize () if the system does not.  */
@@ -93,6 +97,20 @@ what you give them.   Help stamp out software-hoarding!  */
 #  undef HAVE_RESOURCE
 #endif
 
+#if __GNUC__ > 1
+#  define FASTCOPY(s, d, n)  __builtin_memcpy (d, s, n)
+#else /* !__GNUC__ */
+#  if !defined (HAVE_BCOPY)
+#    if !defined (HAVE_MEMMOVE)
+#      define FASTCOPY(s, d, n)  memcpy (d, s, n)
+#    else
+#      define FASTCOPY(s, d, n)  memmove (d, s, n)
+#    endif /* !HAVE_MEMMOVE */
+#  else /* HAVE_BCOPY */
+#    define FASTCOPY(s, d, n)  bcopy (s, d, n)
+#  endif /* HAVE_BCOPY */
+#endif /* !__GNUC__ */
+
 #if !defined (NULL)
 #  define NULL 0
 #endif
@@ -138,10 +156,10 @@ struct mhead {
        char     mh_index;      /* index in nextf[] */
 /* Remainder are valid only when block is allocated */
        unsigned short mh_size; /* size, if < 0x10000 */
-#ifdef rcheck
+#ifdef RCHECK
        unsigned int mh_nbytes; /* number of bytes allocated */
        int      mh_magic4;     /* should be == MAGIC4 */
-#endif /* rcheck */
+#endif /* RCHECK */
 };
 
 /* Access free-list pointer of a block.
@@ -154,10 +172,12 @@ struct mhead {
 #define CHAIN(a) \
   (*(struct mhead **) (sizeof (char *) + (char *) (a)))
 
-#ifdef rcheck
+#ifdef RCHECK
 #  include <stdio.h>
 #  if !defined (botch)
 #    define botch(x) abort ()
+#  else
+extern void botch();
 #  endif /* botch */
 
 #  if !defined (__STRING)
@@ -178,10 +198,10 @@ struct mhead {
 #  define MAGIC4 0x55555555
 #  define ASSERT(p) if (!(p)) botch(__STRING(p)); else
 #  define EXTRA  4             /* 4 bytes extra for MAGIC1s */
-#else /* !rcheck */
+#else /* !RCHECK */
 #  define ASSERT(p)
 #  define EXTRA  0
-#endif /* rcheck */
+#endif /* RCHECK */
 
 /* nextf[i] is free list of blocks of size 2**(i + 3)  */
 
@@ -441,15 +461,15 @@ malloc (n)                /* get a block */
   /* If not for this check, we would gobble a clobbered free chain ptr */
   /* and bomb out on the NEXT allocate of this size block */
   if (p -> mh_alloc != ISFREE || p -> mh_index != nunits)
-#ifdef rcheck
+#ifdef RCHECK
     botch ("block on free list clobbered");
-#else /* not rcheck */
+#else /* not RCHECK */
     abort ();
-#endif /* not rcheck */
+#endif /* not RCHECK */
 
   /* Fill in the info, and if range checking, set up the magic numbers */
   p -> mh_alloc = ISALLOC;
-#ifdef rcheck
+#ifdef RCHECK
   p -> mh_nbytes = n;
   p -> mh_magic4 = MAGIC4;
   {
@@ -457,9 +477,9 @@ malloc (n)          /* get a block */
 
     *m++ = MAGIC1, *m++ = MAGIC1, *m++ = MAGIC1, *m = MAGIC1;
   }
-#else /* not rcheck */
+#else /* not RCHECK */
   p -> mh_size = n;
-#endif /* not rcheck */
+#endif /* not RCHECK */
 #ifdef MEMSCRAMBLE
   zmemset ((char *)(p + 1), 0xdf, n);  /* scramble previous contents */
 #endif
@@ -485,17 +505,19 @@ free (mem)
 
     if (p -> mh_alloc == ISMEMALIGN)
       {
-#ifdef rcheck
+#ifdef RCHECK
        ap -= p->mh_nbytes;
+#else
+       ap -= p->mh_size;       /* XXX */
 #endif
        p = (struct mhead *) ap - 1;
       }
 
-#ifndef rcheck
+#ifndef RCHECK
     if (p -> mh_alloc != ISALLOC)
       abort ();
 
-#else /* rcheck */
+#else /* RCHECK */
     if (p -> mh_alloc != ISALLOC)
       {
        if (p -> mh_alloc == ISFREE)
@@ -508,17 +530,17 @@ free (mem)
     ap += p -> mh_nbytes;
     ASSERT (*ap++ == MAGIC1); ASSERT (*ap++ == MAGIC1);
     ASSERT (*ap++ == MAGIC1); ASSERT (*ap   == MAGIC1);
-#endif /* rcheck */
+#endif /* RCHECK */
   }
 #ifdef MEMSCRAMBLE
   {
     register int n;
     
-#ifdef rcheck
+#ifdef RCHECK
     n = p->mh_nbytes;
-#else /* not rcheck */
+#else /* not RCHECK */
     n = p->mh_size;
-#endif /* not rcheck */
+#endif /* not RCHECK */
     zmemset (mem, 0xcf, n);
   }
 #endif
@@ -557,19 +579,19 @@ realloc (mem, n)
   p--;
   nunits = p -> mh_index;
   ASSERT (p -> mh_alloc == ISALLOC);
-#ifdef rcheck
+#ifdef RCHECK
   ASSERT (p -> mh_magic4 == MAGIC4);
   {
     register char *m = mem + (tocopy = p -> mh_nbytes);
     ASSERT (*m++ == MAGIC1); ASSERT (*m++ == MAGIC1);
     ASSERT (*m++ == MAGIC1); ASSERT (*m   == MAGIC1);
   }
-#else /* not rcheck */
+#else /* not RCHECK */
   if (p -> mh_index >= 13)
     tocopy = (1 << (p -> mh_index + 3)) - sizeof *p;
   else
     tocopy = p -> mh_size;
-#endif /* not rcheck */
+#endif /* not RCHECK */
 
   /* See if desired size rounds to same power of 2 as actual size. */
   nbytes = (n + sizeof *p + EXTRA + 7) & ~7;
@@ -577,15 +599,15 @@ realloc (mem, n)
   /* If ok, use the same block, just marking its size as changed.  */
   if (nbytes > (4 << nunits) && nbytes <= (8 << nunits))
     {
-#ifdef rcheck
+#ifdef RCHECK
       register char *m = mem + tocopy;
       *m++ = 0;  *m++ = 0;  *m++ = 0;  *m++ = 0;
       p-> mh_nbytes = n;
       m = mem + n;
       *m++ = MAGIC1;  *m++ = MAGIC1;  *m++ = MAGIC1;  *m++ = MAGIC1;
-#else /* not rcheck */
+#else /* not RCHECK */
       p -> mh_size = n;
-#endif /* not rcheck */
+#endif /* not RCHECK */
       return mem;
     }
 
@@ -596,7 +618,7 @@ realloc (mem, n)
 
     if ((new = malloc (n)) == 0)
       return 0;
-    bcopy (mem, new, tocopy);
+    FASTCOPY (mem, new, tocopy);
     free (mem);
     return new;
   }
index ba210bb..442ed1a 100644 (file)
 #      include <alloca.h>
 #    endif /* !IBMESA */
 #  else  /* !HAVE_ALLOCA_H */
-#    if defined (hpux_9) && defined (__STDC__) && !defined (alloca)
+#    if defined (__hpux) && defined (__STDC__) && !defined (alloca)
 extern void *alloca ();
 #    else
 #      if !defined (alloca)
 extern char *alloca ();
 #      endif /* !alloca */
-#    endif /* !hpux_9 || !__STDC__ && !alloca */
+#    endif /* !__hpux || !__STDC__ && !alloca */
 #  endif /* !HAVE_ALLOCA_H */
 #endif /* !__GNUC__ */
 
index 8b0e5bc..7480a93 100644 (file)
@@ -42,7 +42,7 @@
 #  define D_NAMLEN(d)   ((d)->d_namlen)
 #endif /* !HAVE_DIRENT_H */
 
-#if defined (STRUCT_DIRENT_HAS_D_INO)
+#if defined (STRUCT_DIRENT_HAS_D_INO) && !defined (STRUCT_DIRENT_HAS_D_FILENO)
 #  define d_fileno d_ino
 #endif
 
diff --git a/lib/posixheaders/posixjmp.h b/lib/posixheaders/posixjmp.h
new file mode 100644 (file)
index 0000000..8703d17
--- /dev/null
@@ -0,0 +1,20 @@
+/* posixjmp.h -- wrapper for setjmp.h with changes for POSIX systems. */
+
+#ifndef _POSIXJMP_H_
+#define _POSIXJMP_H_
+
+#include <setjmp.h>
+
+/* This *must* be included *after* config.h */
+
+#if defined (HAVE_POSIX_SIGSETJMP)
+#  define procenv_t    sigjmp_buf
+#  undef setjmp
+#  define setjmp(x)    sigsetjmp((x), 1)
+#  undef longjmp
+#  define longjmp(x, n)        siglongjmp((x), (n))
+#else
+#  define procenv_t    jmp_buf
+#endif
+
+#endif /* _POSIXJMP_H_ */
index c5ac183..90e3756 100644 (file)
@@ -1,8 +1,8 @@
-## -*- text -*- ####################################################
-#                                                                 #
-# Makefile for the GNU Readline and History Libraries.            #
-#                                                                 #
-####################################################################
+## -*- text -*- #############################################################
+#                                                                          #
+# Makefile for the Bash versions of the GNU Readline and History Libraries. #
+#                                                                          #
+#############################################################################
 
 srcdir = @srcdir@
 VPATH = .:@srcdir@
@@ -20,7 +20,11 @@ RM = rm -f
 CP = cp
 MV = mv
 
-# See the file STANDALONE for the -D defines that readline understands
+SHELL = /bin/sh
+
+# Programs to make tags files.
+ETAGS = etags -tw
+CTAGS = ctags -tw
 
 CFLAGS = @CFLAGS@
 LOCAL_CFLAGS = @LOCAL_CFLAGS@
@@ -28,13 +32,12 @@ CPPFLAGS = @CPPFLAGS@
 LDFLAGS = @LDFLAGS@
 
 DEFS = @DEFS@
+LOCAL_DEFS = @LOCAL_DEFS@
 
 INCLUDES = -I. -I$(BUILD_DIR) -I$(topdir) -I$(topdir)/lib
 
-CCFLAGS = $(DEFS) $(APP_CFLAGS) $(CPPFLAGS) ${INCLUDES} $(LOCAL_CFLAGS) $(CFLAGS)
+CCFLAGS = $(DEFS) $(LOCAL_DEFS) $(APP_CFLAGS) $(CPPFLAGS) ${INCLUDES} $(LOCAL_CFLAGS) $(CFLAGS)
 
-# Here is a rule for making .o files from .c files that doesn't force
-# the type of the machine (like -sun3) into the flags.
 .c.o:
        $(CC) -c $(CCFLAGS) $<
 
@@ -50,20 +53,20 @@ CSOURCES = $(srcdir)/readline.c $(srcdir)/funmap.c $(srcdir)/keymaps.c \
           $(srcdir)/undo.c $(srcdir)/macro.c $(srcdir)/input.c \
           $(srcdir)/callback.c $(srcdir)/terminal.c $(srcdir)/xmalloc.c \
           $(srcdir)/history.c $(srcdir)/histsearch.c $(srcdir)/histexpand.c \
-          $(srcdir)/histfile.c $(srcdir)/nls.c \
-          $(srcdir)/tilde.c \
+          $(srcdir)/histfile.c $(srcdir)/nls.c $(srcdir)/search.c \
+          $(srcdir)/shell.c $(srcdir)/tilde.c
 
 # The header files for this library.
 HSOURCES = readline.h rldefs.h chardefs.h keymaps.h history.h histlib.h \
-          posixstat.h tilde.h rlconf.h tcap.h
+          posixstat.h posixdir.h posixjmp.h tilde.h rlconf.h rltty.h \
+          ansi_stdlib.h tcap.h
 
-HISTOBJ = history.o histexpand.o histfile.o histsearch.o
-TILDEOBJ= tilde.o
+HISTOBJ = history.o histexpand.o histfile.o histsearch.o shell.o
+TILDEOBJ = tilde.o
 OBJECTS = readline.o vi_mode.o funmap.o keymaps.o parens.o search.o \
          rltty.o complete.o bind.o isearch.o display.o signals.o \
          util.o kill.o undo.o macro.o input.o callback.o terminal.o \
-         nls.o xmalloc.o \
-         $(HISTOBJ) $(TILDEOBJ)
+         nls.o $(HISTOBJ) $(TILDEOBJ) xmalloc.o
 
 # The texinfo files which document this library.
 DOCSOURCE = doc/rlman.texinfo doc/rltech.texinfo doc/rluser.texinfo
@@ -84,12 +87,12 @@ INSTALLED_HEADERS = readline.h chardefs.h keymaps.h history.h tilde.h
 all: libreadline.a libhistory.a
 
 libreadline.a: $(OBJECTS)
-       $(RM) -f $@
+       $(RM) $@
        $(AR) cr $@ $(OBJECTS)
        -test -n "$(RANLIB)" && $(RANLIB) $@
 
 libhistory.a: $(HISTOBJ) xmalloc.o
-       $(RM) -f $@
+       $(RM) $@
        $(AR) cr $@ $(HISTOBJ) xmalloc.o
        -test -n "$(RANLIB)" && $(RANLIB) $@
 
@@ -99,94 +102,113 @@ documentation: force
 
 force:
 
-# The rule for 'includes' is written funny so that the if statement
-# always returns TRUE unless there really was an error installing the
-# include files.
-install: installdirs libreadline.a
-       for file in $(INSTALLED_HEADERS) ; do \
-               $(INSTALL_DATA) $(srcdir)/$$file $(includedir)/readline ; \
-       done
-       -${MV} $(libdir)/libreadline.a $(libdir)/libreadline.old
-       ${INSTALL_DATA} libreadline.a $(libdir)/libreadline.a
-       -test -n "$(RANLIB)" && $(RANLIB) -t $(bindir)/libreadline.a
-
-installdirs:   $(topdir)/support/mkdirs
-       $(SHELL) $(topdir)/support/mkdirs $(includedir) \
-               $(includedir)/readline $(libdir) $(infodir) $(man3dir)
+install:
+       @echo "This version of the readline library should not be installed."
 
 uninstall:
-       cd $(includedir)/readline && ${RM} -f ${INSTALLED_HEADERS}
-       cd $(libdir) && ${RM} -f libreadline.a libreadline.old
-
-tags:  force
-       etags $(CSOURCES) $(HSOURCES)
+       @echo "This version of the readline library should not be installed."
 
 TAGS:  force
-       ctags -x $(CSOURCES) $(HSOURCES) > $@
+       $(ETAGS) $(CSOURCES) $(HSOURCES)
 
-readline: readline.h rldefs.h chardefs.h
-readline: $(OBJECTS)
-       $(CC) $(CFLAGS) $(CPPFLAGS) $(READLINE_DEFINES) \
-         $(LOCAL_INCLUDES) -DTEST -o readline readline.c vi_mode.o funmap.o \
-         keymaps.o -ltermcap
+tags:  force
+       $(CTAGS) $(CSOURCES) $(HSOURCES)
 
 clean: force
        $(RM) $(OBJECTS) *.a
        -( cd doc && $(MAKE) $(MFLAGS) $@ )
 
-distclean realclean maintainer-clean: clean
+mostlyclean: clean
        -( cd doc && $(MAKE) $(MFLAGS) $@ )
-       $(RM) Makefile
 
-mostlyclean: clean
+distclean maintainer-clean: clean
        -( cd doc && $(MAKE) $(MFLAGS) $@ )
+       $(RM) Makefile
+       $(RM) TAGS tags
 
 # Dependencies
-readline.o: readline.c readline.h rldefs.h rlconf.h chardefs.h tcap.h
-readline.o: keymaps.h history.h
-vi_mode.o: rldefs.h rlconf.h readline.h history.h
-funmap.o: funmap.c readline.h rlconf.h
-keymaps.o: keymaps.c emacs_keymap.c vi_keymap.c keymaps.h chardefs.h rlconf.h
-history.o: history.h histlib.h
+bind.o: ansi_stdlib.h posixstat.h
+bind.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+bind.o: readline.h keymaps.h chardefs.h tilde.h
+bind.o: history.h
+callback.o: rlconf.h
+callback.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+callback.o: readline.h keymaps.h chardefs.h tilde.h
+complete.o: ansi_stdlib.h posixdir.h posixstat.h
+complete.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+complete.o: readline.h keymaps.h chardefs.h tilde.h
+display.o: ansi_stdlib.h posixstat.h
+display.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+display.o: tcap.h
+display.o: readline.h keymaps.h chardefs.h tilde.h
+display.o: history.h
+funmap.o: readline.h keymaps.h chardefs.h tilde.h
+funmap.o: rlconf.h ansi_stdlib.h
+funmap.o: ${BUILD_DIR}/config.h
+histexpand.o: ansi_stdlib.h
 histexpand.o: history.h histlib.h
-histsearch.o: history.h histlib.h
+histexpand.o: ${BUILD_DIR}/config.h
+histfile.o: ansi_stdlib.h
 histfile.o: history.h histlib.h
-isearch.o: readline.h history.h
-search.o: readline.h history.h
-display.o: readline.h history.h rldefs.h rlconf.h tcap.h
-complete.o: readline.h rldefs.h rlconf.h posixdir.h posixstat.h
-rltty.o: rldefs.h rlconf.h readline.h rltty.h
-bind.o: rldefs.h rlconf.h readline.h history.h
-signals.o: rldefs.h rlconf.h readline.h history.h
-parens.o: readline.h
-kill.o: rldefs.h rlconf.h readline.h history.h
-macro.o: rldefs.h rlconf.h readline.h history.h
-undo.o: rldefs.h rlconf.h readline.h history.h
-input.o: rldefs.h rlconf.h readline.h history.h
-callback.o: rlconf.h rldefs.h readline.h
-terminal.o: rlconf.h rldefs.h readline.h tcap.h history.h
-
-bind.o: $(BUILD_DIR)/config.h
-callback.o: $(BUILD_DIR)/config.h
-complete.o: $(BUILD_DIR)/config.h
-display.o: $(BUILD_DIR)/config.h
-funmap.o: $(BUILD_DIR)/config.h
-histexpand.o: $(BUILD_DIR)/config.h
-histfile.o: $(BUILD_DIR)/config.h
-history.o: $(BUILD_DIR)/config.h
-histsearch.o: $(BUILD_DIR)/config.h
-input.o: $(BUILD_DIR)/config.h
-isearch.o: $(BUILD_DIR)/config.h
-keymaps.o: $(BUILD_DIR)/config.h
-kill.o: $(BUILD_DIR)/config.h
-macro.o: $(BUILD_DIR)/config.h
-parens.o: $(BUILD_DIR)/config.h
-readline.o: $(BUILD_DIR)/config.h
-rltty.o: $(BUILD_DIR)/config.h
-search.o: $(BUILD_DIR)/config.h
-signals.o: $(BUILD_DIR)/config.h
-tilde.o: $(BUILD_DIR)/config.h
-undo.o: $(BUILD_DIR)/config.h
-util.o: $(BUILD_DIR)/config.h
-vi_mode.o: $(BUILD_DIR)/config.h
-xmalloc.o: $(BUILD_DIR)/config.h
+histfile.o: ${BUILD_DIR}/config.h
+history.o: ansi_stdlib.h
+history.o: history.h histlib.h
+history.o: ${BUILD_DIR}/config.h
+histsearch.o: ansi_stdlib.h
+histsearch.o: history.h histlib.h
+histsearch.o: ${BUILD_DIR}/config.h
+input.o: ansi_stdlib.h
+input.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+input.o: readline.h keymaps.h chardefs.h tilde.h
+isearch.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+isearch.o: readline.h keymaps.h chardefs.h tilde.h
+isearch.o: ansi_stdlib.h history.h
+keymaps.o: emacs_keymap.c vi_keymap.c
+keymaps.o: keymaps.h chardefs.h rlconf.h ansi_stdlib.h
+keymaps.o: readline.h keymaps.h chardefs.h tilde.h
+keymaps.o: ${BUILD_DIR}/config.h
+kill.o: ansi_stdlib.h
+kill.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+kill.o: readline.h keymaps.h chardefs.h tilde.h
+kill.o: history.h
+macro.o: ansi_stdlib.h
+macro.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+macro.o: readline.h keymaps.h chardefs.h tilde.h
+macro.o: history.h
+nls.o: ansi_stdlib.h
+nls.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+parens.o: rlconf.h
+parens.o: ${BUILD_DIR}/config.h
+parens.o: readline.h keymaps.h chardefs.h tilde.h
+readline.o: readline.h keymaps.h chardefs.h tilde.h
+readline.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+readline.o: history.h
+readline.o: posixstat.h ansi_stdlib.h posixjmp.h
+rltty.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+rltty.o: rltty.h
+rltty.o: readline.h keymaps.h chardefs.h tilde.h
+search.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+search.o: readline.h keymaps.h chardefs.h tilde.h
+search.o: ansi_stdlib.h history.h
+signals.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+signals.o: readline.h keymaps.h chardefs.h tilde.h
+signals.o: history.h
+terminal.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+terminal.o: tcap.h
+terminal.o: readline.h keymaps.h chardefs.h tilde.h
+terminal.o: history.h
+tilde.o: ansi_stdlib.h
+tilde.o: ${BUILD_DIR}/config.h
+tilde.o: tilde.h
+undo.o: ansi_stdlib.h
+undo.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+undo.o: readline.h keymaps.h chardefs.h tilde.h
+undo.o: history.h
+util.o: posixjmp.h ansi_stdlib.h
+util.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+util.o: readline.h keymaps.h chardefs.h tilde.h
+vi_mode.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+vi_mode.o: readline.h keymaps.h chardefs.h tilde.h
+vi_mode.o: history.h ansi_stdlib.h
+xmalloc.o: ${BUILD_DIR}/config.h
+xmalloc.o: ansi_stdlib.h
index bd899ca..24c8c48 100644 (file)
@@ -89,11 +89,16 @@ extern Keymap _rl_keymap;
 
 extern char *possible_control_prefixes[], *possible_meta_prefixes[];
 
+/* Functions imported from funmap.c */
 extern char **rl_funmap_names ();
 extern int rl_add_funmap_entry ();
 
+/* Functions imported from util.c */
 extern char *_rl_strindex ();
 
+/* Functions imported from shell.c */
+extern char *get_env_value ();
+
 /* Variables exported by this file. */
 Keymap rl_binding_keymap;
 
@@ -202,7 +207,7 @@ rl_set_key (keyseq, function, map)
      Function *function;
      Keymap map;
 {
-  return (rl_generic_bind (ISFUNC, keyseq, function, map));
+  return (rl_generic_bind (ISFUNC, keyseq, (char *)function, map));
 }
 
 /* Bind the key sequence represented by the string KEYSEQ to
@@ -381,7 +386,7 @@ rl_untranslate_keyseq (seq)
       kseq[i++] = '\\';
       kseq[i++] = 'C';
       kseq[i++] = '-';
-      c = UNCTRL (c);
+      c = _rl_to_lower (UNCTRL (c));
     }
   else if (c == RUBOUT)
     {
@@ -394,7 +399,7 @@ rl_untranslate_keyseq (seq)
   if (c == ESC)
     {
       kseq[i++] = '\\';
-      kseq[i++] = 'e';
+      c = 'e';
     }
   else if (c == '\\' || c == '"')
     {
@@ -406,6 +411,53 @@ rl_untranslate_keyseq (seq)
   return kseq;
 }
 
+static char *
+_rl_untranslate_macro_value (seq)
+     char *seq;
+{
+  char *ret, *r, *s;
+  int c;
+
+  r = ret = xmalloc (7 * strlen (seq) + 1);
+  for (s = seq; *s; s++)
+    {
+      c = *s;
+      if (META_CHAR (c))
+       {
+         *r++ = '\\';
+         *r++ = 'M';
+         *r++ = '-';
+         c = UNMETA (c);
+       }
+      else if (CTRL_CHAR (c) && c != ESC)
+       {
+         *r++ = '\\';
+         *r++ = 'C';
+         *r++ = '-';
+         c = _rl_to_lower (UNCTRL (c));
+       }
+      else if (c == RUBOUT)
+       {
+         *r++ = '\\';
+         *r++ = 'C';
+         *r++ = '-';
+         c = '?';
+       }
+
+      if (c == ESC)
+       {
+         *r++ = '\\';
+         c = 'e';
+       }
+      else if (c == '\\' || c == '"')
+       *r++ = '\\';
+
+      *r++ = (unsigned char)c;
+    }
+  *r = '\0';
+  return ret;
+}
+
 /* Return a pointer to the function that STRING represents.
    If STRING doesn't have a matching function, then a NULL pointer
    is returned. */
@@ -523,7 +575,7 @@ rl_read_init_file (filename)
     {
       filename = last_readline_init_file;
       if (filename == 0)
-        filename = getenv ("INPUTRC");
+        filename = get_env_value ("INPUTRC");
       if (filename == 0)
        filename = DEFAULT_INPUTRC;
     }
@@ -990,14 +1042,14 @@ rl_parse_and_bind (string)
   /* Temporary.  Handle old-style keyname with macro-binding. */
   if (*funname == '\'' || *funname == '"')
     {
-      char seq[2];
+      unsigned char useq[2];
       int fl = strlen (funname);
 
-      seq[0] = key; seq[1] = '\0';
+      useq[0] = key; useq[1] = '\0';
       if (fl && funname[fl - 1] == *funname)
        funname[fl - 1] = '\0';
 
-      rl_macro_bind (seq, &funname[1], _rl_keymap);
+      rl_macro_bind (useq, &funname[1], _rl_keymap);
     }
 #if defined (PREFIX_META_HACK)
   /* Ugly, but working hack to keep prefix-meta around. */
@@ -1528,6 +1580,8 @@ int
 rl_dump_functions (count, key)
      int count, key;
 {
+  if (rl_dispatching)
+    fprintf (rl_outstream, "\r\n");
   rl_function_dumper (rl_explicit_arg);
   rl_on_new_line ();
   return (0);
@@ -1549,7 +1603,11 @@ _rl_macro_dumper_internal (print_readably, map, prefix)
        {
        case ISMACR:
          keyname = _rl_get_keyname (key);
+#if 0
          out = (char *)map[key].function;
+#else
+         out = _rl_untranslate_macro_value ((char *)map[key].function);
+#endif
          if (print_readably)
            fprintf (rl_outstream, "\"%s%s\": \"%s\"\n", prefix ? prefix : "",
                                                         keyname,
@@ -1559,6 +1617,9 @@ _rl_macro_dumper_internal (print_readably, map, prefix)
                                                        keyname,
                                                        out ? out : "");
          free (keyname);
+#if 1
+         free (out);
+#endif
          break;
        case ISFUNC:
          break;
@@ -1604,6 +1665,8 @@ int
 rl_dump_macros (count, key)
      int count, key;
 {
+  if (rl_dispatching)
+    fprintf (rl_outstream, "\r\n");
   rl_macro_dumper (rl_explicit_arg);
   rl_on_new_line ();
   return (0);
@@ -1674,6 +1737,8 @@ int
 rl_dump_variables (count, key)
      int count, key;
 {
+  if (rl_dispatching)
+    fprintf (rl_outstream, "\r\n");
   rl_variable_dumper (rl_explicit_arg);
   rl_on_new_line ();
   return (0);
index ad57f75..04c5bbd 100644 (file)
@@ -39,6 +39,7 @@
 extern void readline_internal_startup ();
 extern char *readline_internal_teardown ();
 extern int readline_internal_char ();
+extern void _rl_init_line_state ();
 
 extern int _rl_meta_flag;
 extern char *rl_prompt;
@@ -120,6 +121,10 @@ rl_callback_read_char ()
       in_handler = 0;
       (*rl_linefunc) (line);
 
+    /* If the user did not clear out the line, do it for him. */
+    if (rl_line_buffer[0])
+      _rl_init_line_state ();
+
     /* Redisplay the prompt if readline_handler_{install,remove} not called. */
       if (in_handler == 0 && rl_linefunc)
        _rl_callback_newline ();
index f9e27eb..b17c63e 100644 (file)
@@ -25,7 +25,6 @@
 #  include <config.h>
 #endif
 
-#include <stdio.h>
 #include <sys/types.h>
 #include <fcntl.h>
 #if defined (HAVE_SYS_FILE_H)
@@ -42,6 +41,8 @@
 #  include "ansi_stdlib.h"
 #endif /* HAVE_STDLIB_H */
 
+#include <stdio.h>
+
 #include <errno.h>
 #if !defined (errno)
 extern int errno;
@@ -137,7 +138,7 @@ int rl_visible_stats = 0;
 static int completion_changed_buffer;
 
 /* Pointer to the generator function for completion_matches ().
-   NULL means to use filename_entry_function (), the default filename
+   NULL means to use filename_completion_function (), the default filename
    completer. */
 Function *rl_completion_entry_function = (Function *)NULL;
 
@@ -761,12 +762,13 @@ insert_text (text, start, end)
 }
 
 static char *
-make_quoted_replacement (match, mtype, quote_char)
+make_quoted_replacement (match, mtype, qc)
      char *match;
-     int mtype, quote_char;
+     int mtype;
+     char *qc; /* Pointer to quoting character, if any */
 {
   int should_quote, do_replace;
-  char *replacement, qc;
+  char *replacement;
 
   /* If we are doing completion on quoted substrings, and any matches
      contain any of the completer_word_break_characters, then auto-
@@ -784,10 +786,10 @@ make_quoted_replacement (match, mtype, quote_char)
 
   if (should_quote)
 #if defined (SHELL)
-    should_quote = should_quote && (!quote_char || quote_char == '"' || quote_char == '\'');
-#else
-    should_quote = should_quote && !quote_char;
-#endif
+    should_quote = should_quote && (!qc || !*qc || *qc == '"' || *qc == '\'');
+#else /* !SHELL */
+    should_quote = should_quote && (!qc || !*qc);
+#endif /* !SHELL */
 
   if (should_quote)
     {
@@ -797,37 +799,37 @@ make_quoted_replacement (match, mtype, quote_char)
       should_quote = rl_strpbrk (match, rl_filename_quote_characters) != 0;
 
       do_replace = should_quote ? mtype : NO_MATCH;
-      if (do_replace != NO_MATCH)
-       {
-         /* Quote the replacement, since we found an embedded
-            word break character in a potential match. */
-         if (rl_filename_quoting_function)
-           {
-             qc = quote_char;  /* must pass a (char *) to quoting function */
-             replacement = (*rl_filename_quoting_function)
-                               (match, do_replace, &qc);
-             quote_char = qc;
-           }
-       }
+      /* Quote the replacement, since we found an embedded
+        word break character in a potential match. */
+      if (do_replace != NO_MATCH && rl_filename_quoting_function)
+       replacement = (*rl_filename_quoting_function) (match, do_replace, qc);
     }
   return (replacement);
 }
 
 static void
-insert_match (match, start, mtype, quote_char)
+insert_match (match, start, mtype, qc)
      char *match;
-     int start, mtype, quote_char;
+     int start, mtype;
+     char *qc;
 {
   char *replacement;
+  char oqc;
 
-  replacement = make_quoted_replacement (match, mtype, quote_char);
+  oqc = qc ? *qc : '\0';
+  replacement = make_quoted_replacement (match, mtype, qc);
 
   /* Now insert the match. */
   if (replacement)
     {
       /* Don't double an opening quote character. */
-      if (quote_char && start && rl_line_buffer[start - 1] == quote_char &&
-           replacement[0] == quote_char)
+      if (qc && *qc && start && rl_line_buffer[start - 1] == *qc &&
+           replacement[0] == *qc)
+       start--;
+      /* If make_quoted_replacement changed the quoting character, remove
+        the opening quote and insert the (fully-quoted) replacement. */
+      else if (qc && (*qc != oqc) && start && rl_line_buffer[start - 1] == oqc &&
+           replacement[0] != oqc)
        start--;
       insert_text (replacement, start, rl_point - 1);
       if (replacement != match)
@@ -882,9 +884,10 @@ append_to_match (text, delimiter, quote_char)
 }
 
 static void
-insert_all_matches (matches, point, quote_char)
+insert_all_matches (matches, point, qc)
      char **matches;
-     int point, quote_char;
+     int point;
+     char *qc;
 {
   int i;
   char *rp;
@@ -892,7 +895,7 @@ insert_all_matches (matches, point, quote_char)
   rl_begin_undo_group ();
   /* remove any opening quote character; make_quoted_replacement will add
      it back. */
-  if (quote_char && point && rl_line_buffer[point - 1] == quote_char)
+  if (qc && *qc && point && rl_line_buffer[point - 1] == *qc)
     point--;
   rl_delete_text (point, rl_point);
   rl_point = point;
@@ -901,7 +904,7 @@ insert_all_matches (matches, point, quote_char)
     {
       for (i = 1; matches[i]; i++)
        {
-         rp = make_quoted_replacement (matches[i], SINGLE_MATCH, quote_char);
+         rp = make_quoted_replacement (matches[i], SINGLE_MATCH, qc);
          rl_insert_text (rp);
          rl_insert_text (" ");
          if (rp != matches[i])
@@ -910,7 +913,7 @@ insert_all_matches (matches, point, quote_char)
     }
   else
     {
-      rp = make_quoted_replacement (matches[0], SINGLE_MATCH, quote_char);
+      rp = make_quoted_replacement (matches[0], SINGLE_MATCH, qc);
       rl_insert_text (rp);
       rl_insert_text (" ");
       if (rp != matches[0])
@@ -964,12 +967,12 @@ rl_complete_internal (what_to_do)
 
   text = rl_copy_text (start, end);
   matches = gen_completion_matches (text, start, end, our_func, found_quote, quote_char);
-  free (text);
 
   if (matches == 0)
     {
       ding ();
       FREE (saved_line_buffer);
+      free (text);
       return 0;
     }
     
@@ -998,6 +1001,7 @@ rl_complete_internal (what_to_do)
          FREE (matches);
          ding ();
          FREE (saved_line_buffer);
+         FREE (text);
          return 0;
         }
       else
@@ -1013,6 +1017,7 @@ rl_complete_internal (what_to_do)
            }
        }
     }
+  free (text);
 
   switch (what_to_do)
     {
@@ -1020,7 +1025,7 @@ rl_complete_internal (what_to_do)
     case '!':
       /* Insert the first match with proper quoting. */
       if (*matches[0])
-       insert_match (matches[0], start, matches[1] ? MULT_MATCH : SINGLE_MATCH, quote_char);
+       insert_match (matches[0], start, matches[1] ? MULT_MATCH : SINGLE_MATCH, &quote_char);
 
       /* If there are more matches, ring the bell to indicate.
         If we are in vi mode, Posix.2 says to not ring the bell.
@@ -1046,7 +1051,7 @@ rl_complete_internal (what_to_do)
       break;
 
     case '*':
-      insert_all_matches (matches, start, quote_char);
+      insert_all_matches (matches, start, &quote_char);
       break;
 
     case '?':
@@ -1102,10 +1107,14 @@ stat_char (filename)
   character = 0;
   if (S_ISDIR (finfo.st_mode))
     character = '/';
+#if defined (S_ISCHR)
   else if (S_ISCHR (finfo.st_mode))
     character = '%';
+#endif /* S_ISCHR */
+#if defined (S_ISBLK)
   else if (S_ISBLK (finfo.st_mode))
     character = '#';
+#endif /* S_ISBLK */
 #if defined (S_ISLNK)
   else if (S_ISLNK (finfo.st_mode))
     character = '@';
@@ -1321,7 +1330,7 @@ filename_completion_function (text, state)
      int state;
      char *text;
 {
-  static DIR *directory;
+  static DIR *directory = (DIR *)NULL;
   static char *filename = (char *)NULL;
   static char *dirname = (char *)NULL;
   static char *users_dirname = (char *)NULL;
@@ -1333,6 +1342,13 @@ filename_completion_function (text, state)
   /* If we don't have any state, then do some initialization. */
   if (state == 0)
     {
+      /* If we were interrupted before closing the directory or reading
+        all of its contents, close it. */
+      if (directory)
+       {
+         closedir (directory);
+         directory = (DIR *)NULL;
+       }
       FREE (dirname);
       FREE (filename);
       FREE (users_dirname);
index c0dff1f..c283f9a 100644 (file)
 #  include <config.h>
 #endif
 
-#include <stdio.h>
 #include <sys/types.h>
 
 #if defined (HAVE_UNISTD_H)
 #  include <unistd.h>
 #endif /* HAVE_UNISTD_H */
 
+#include "posixstat.h"
+
 #if defined (HAVE_STDLIB_H)
 #  include <stdlib.h>
 #else
 #  include "ansi_stdlib.h"
 #endif /* HAVE_STDLIB_H */
 
-#include "posixstat.h"
+#include <stdio.h>
+
+#if defined (__GO32__)
+#  include <go32.h>
+#  include <pc.h>
+#endif /* __GO32__ */
 
 /* System-specific feature definitions and include files. */
 #include "rldefs.h"
@@ -69,7 +75,8 @@ extern void _rl_output_some_chars ();
 extern int _rl_output_character_function ();
 extern int _rl_backspace ();
 
-extern char *term_clreol, *term_im, *term_ic,  *term_ei, *term_DC;
+extern char *term_clreol, *term_clrpag;
+extern char *term_im, *term_ic,  *term_ei, *term_DC;
 extern char *term_up, *term_dc, *term_cr, *term_IC;
 extern int screenheight, screenwidth, screenchars;
 extern int terminal_can_insert, _rl_term_autowrap;
@@ -78,8 +85,9 @@ extern int terminal_can_insert, _rl_term_autowrap;
    by this file. */
 void _rl_move_cursor_relative (), _rl_output_some_chars ();
 void _rl_move_vert ();
+void _rl_clear_to_eol (), _rl_clear_screen ();
 
-static void update_line (), clear_to_eol (), space_to_eol ();
+static void update_line (), space_to_eol ();
 static void delete_chars (), insert_some_chars ();
 static void cr ();
 
@@ -302,7 +310,7 @@ rl_redisplay ()
   register int in, out, c, linenum, cursor_linenum;
   register char *line;
   int c_pos, inv_botlin, lb_botlin, lb_linenum;
-  int newlines, lpos;
+  int newlines, lpos, temp;
   char *prompt_this_line;
 
   if (!readline_echoing_p)
@@ -405,8 +413,19 @@ rl_redisplay ()
 
   /* inv_lbreaks[i] is where line i starts in the buffer. */
   inv_lbreaks[newlines = 0] = 0;
+  lpos = out - wrap_offset;
+
+  /* XXX - what if lpos is already >= screenwidth before we start drawing the
+     contents of the command line? */
+  while (lpos >= screenwidth)
+    {
+      temp = ((newlines + 1) * screenwidth) - ((newlines == 0) ? wrap_offset : 0);
+      inv_lbreaks[++newlines] = temp;
+      lpos -= screenwidth;
+    }
 
-  for (in = 0, lpos = out - wrap_offset; in < rl_end; in++)
+  lb_linenum = 0;
+  for (in = 0; in < rl_end; in++)
     {
       c = (unsigned char)rl_line_buffer[in];
 
@@ -432,8 +451,6 @@ rl_redisplay ()
 
              if (lpos + 4 >= screenwidth)
                {
-                 register int temp;
-
                  temp = screenwidth - lpos;
                  inv_lbreaks[++newlines] = out + temp;
                  lpos = 4 - temp;
@@ -557,7 +574,7 @@ rl_redisplay ()
                {
                  nleft = screenwidth + wrap_offset - _rl_last_c_pos;
                  if (nleft)
-                   clear_to_eol (nleft);
+                   _rl_clear_to_eol (nleft);
                }
 
              /* Since the new first line is now visible, save its length. */
@@ -575,7 +592,7 @@ rl_redisplay ()
                  tt = VIS_CHARS (linenum);
                  _rl_move_vert (linenum);
                  _rl_move_cursor_relative (0, tt);
-                 clear_to_eol
+                 _rl_clear_to_eol
                    ((linenum == _rl_vis_botlin) ? strlen (tt) : screenwidth);
                }
            }
@@ -710,7 +727,7 @@ rl_redisplay ()
              t < visible_first_line_len)
            {
              nleft = screenwidth - t;
-             clear_to_eol (nleft);
+             _rl_clear_to_eol (nleft);
            }
          visible_first_line_len = out - lmargin - M_OFFSET (lmargin, wrap_offset);
          if (visible_first_line_len > screenwidth)
@@ -962,7 +979,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
          if (_rl_term_autowrap && current_line < inv_botlin)
            space_to_eol (lendiff);
          else
-           clear_to_eol (lendiff);
+           _rl_clear_to_eol (lendiff);
        }
     }
 }
@@ -1293,16 +1310,14 @@ _rl_erase_at_end_of_line (l)
 
 /* Clear to the end of the line.  COUNT is the minimum
    number of character spaces to clear, */
-static void
-clear_to_eol (count)
+void
+_rl_clear_to_eol (count)
      int count;
 {
 #if !defined (__GO32__)
   if (term_clreol)
-    {
-      tputs (term_clreol, 1, _rl_output_character_function);
-    }
-  else
+    tputs (term_clreol, 1, _rl_output_character_function);
+  else if (count)
 #endif /* !__GO32__ */
     space_to_eol (count);
 }
@@ -1321,6 +1336,17 @@ space_to_eol (count)
   _rl_last_c_pos += count;
 }
 
+void
+_rl_clear_screen ()
+{
+#if !defined (__GO32__)
+  if (term_clrpag)
+    tputs (term_clrpag, 1, _rl_output_character_function);
+  else
+#endif /* !__GO32__ */
+    crlf ();
+}
+
 /* Insert COUNT characters from STRING to the output stream. */
 static void
 insert_some_chars (string, count)
@@ -1420,7 +1446,7 @@ _rl_update_final ()
   /* If the cursor is the only thing on an otherwise-blank last line,
      compensate so we don't print an extra CRLF. */
   if (_rl_vis_botlin && _rl_last_c_pos == 0 &&
-       visible_line[inv_lbreaks[_rl_vis_botlin]+1] == 0)
+       visible_line[vis_lbreaks[_rl_vis_botlin]] == 0)
     {
       _rl_vis_botlin--;
       full_lines = 1;
@@ -1432,7 +1458,7 @@ _rl_update_final ()
       char *last_line;
       last_line = &visible_line[inv_lbreaks[_rl_vis_botlin]];
       _rl_move_cursor_relative (screenwidth - 1, last_line);
-      clear_to_eol (0);
+      _rl_clear_to_eol (0);
       putc (last_line[screenwidth - 1], rl_outstream);
     }
   _rl_vis_botlin = 0;
index 9dbab24..58d4dd7 100644 (file)
@@ -1,9 +1,13 @@
 # This makefile for Readline library documentation is in -*- text -*- mode.
 # Emacs likes it that way.
-TEXI2DVI = texi2dvi
-
 RM = rm -f
 
+MAKEINFO    = makeinfo
+TEXI2DVI    = texi2dvi
+TEXI2HTML   = texi2html
+QUIETPS     = #set this to -q to shut up dvips
+DVIPS       = dvips -D 300 $(QUIETPS) -o $@     # tricky
+
 INSTALL_DATA = cp
 infodir = /usr/local/info
 
@@ -15,39 +19,42 @@ INFOOBJ = readline.info history.info
 PSOBJ = readline.ps history.ps
 HTMLOBJ = readline.html history.html
 
-all: info dvi html
+all: info dvi html ps
+nodvi: info html
 
 readline.dvi: $(RLSRC)
        $(TEXI2DVI) rlman.texinfo
        mv rlman.dvi readline.dvi
 
 readline.info: $(RLSRC)
-       makeinfo --no-split -o $@ rlman.texinfo
+       $(MAKEINFO) --no-split -o $@ rlman.texinfo
 
 history.dvi: ${HISTSRC}
        $(TEXI2DVI) hist.texinfo
        mv hist.dvi history.dvi
 
 history.info: ${HISTSRC}
-       makeinfo --no-split -o $@ hist.texinfo
+       $(MAKEINFO) --no-split -o $@ hist.texinfo
 
 readline.ps:   readline.dvi
-       dvips -D 300 -o $@ readline.dvi
+       $(RM) $@
+       $(DVIPS) readline.dvi
 
 history.ps:    history.dvi
-       dvips -D 300 -o $@ history.dvi
+       $(RM) $@
+       $(DVIPS) history.dvi
 
 readline.html: ${RLSRC}
-       texi2html rlman.texinfo
+       $(TEXI2HTML) rlman.texinfo
        sed -e 's:rlman.html:readline.html:' -e 's:rlman_toc.html:readline_toc.html:' rlman.html > readline.html
        sed -e 's:rlman.html:readline.html:' -e 's:rlman_toc.html:readline_toc.html:' rlman_toc.html > readline_toc.html
-       rm -f rlman.html rlman_toc.html
+       $(RM) rlman.html rlman_toc.html
 
 history.html:  ${HISTSRC}
-       texi2html hist.texinfo
+       $(TEXI2HTML) hist.texinfo
        sed -e 's:hist.html:history.html:' -e 's:hist_toc.html:history_toc.html:' hist.html > history.html
        sed -e 's:hist.html:history.html:' -e 's:hist_toc.html:history_toc.html:' hist_toc.html > history_toc.html
-       rm -f hist.html hist_toc.html
+       $(RM) hist.html hist_toc.html
 
 info:  $(INFOOBJ)
 dvi:   $(DVIOBJ)
index be41318..5410090 100644 (file)
@@ -415,6 +415,17 @@ If non-zero, single-quoted words are not scanned for the history expansion
 character.  The default value is 0.
 @end deftypevar
 
+@deftypevar {Function *} history_inhibit_expansion_function
+This should be set to the address of a function that takes two arguments:
+a @code{char *} (@var{string}) and an integer index into that string (@var{i}).
+It should return a non-zero value if the history expansion starting at
+@var{string[i]} should not be performed; zero if the expansion should
+be done.
+It is intended for use by applications like Bash that use the history
+expansion character for additional purposes.
+By default, this variable is set to NULL.
+@end deftypevar
+
 @node History Programming Example
 @section History Programming Example
 
index 6704d0e..ea0d317 100644 (file)
@@ -312,7 +312,7 @@ to get a character from the input stream.  By default, it is set to
 (@pxref{Utility Functions}).
 @end deftypevar
 
-@deftypevar {Function *} rl_redisplay_function
+@deftypevar {VFunction *} rl_redisplay_function
 If non-zero, @code{readline} will call indirectly through this pointer
 to update the display with the current contents of the editing buffer.
 By default, it is set to @code{rl_redisplay}, the default @code{readline}
@@ -417,6 +417,11 @@ Return the keymap matching @var{name}.  @var{name} is one which would
 be supplied in a @code{set keymap} inputrc line (@pxref{Readline Init File}).
 @end deftypefun
 
+@deftypefun {char *} rl_get_keymap_name (Keymap keymap)
+Return the name matching @var{keymap}.  @var{name} is one which would
+be supplied in a @code{set keymap} inputrc line (@pxref{Readline Init File}).
+@end deftypefun
+
 @node Binding Keys
 @subsection Binding Keys
 
@@ -576,7 +581,7 @@ that text.
 @node Redisplay
 @subsection Redisplay
 
-@deftypefun int rl_redisplay ()
+@deftypefun void rl_redisplay ()
 Change what's displayed on the screen to reflect the current contents
 of @code{rl_line_buffer}.
 @end deftypefun
@@ -650,6 +655,11 @@ before Readline attempts to read characters from the terminal with
 @code{rl_read_key ()}.
 @end deftypefun
 
+@deftypefun rl_extend_line_buffer (int len)
+Ensure that @code{rl_line_buffer} has enough space to hold @var{len}
+characters, possibly reallocating it if necessary.
+@end deftypefun
+
 @deftypefun int rl_initialize ()
 Initialize or re-initialize Readline's internal state.
 @end deftypefun
@@ -870,7 +880,7 @@ that does the initial simple matching selection algorithm (see
 This is a pointer to the generator function for @code{completion_matches
 ()}.  If the value of @code{rl_completion_entry_function} is
 @code{(Function *)NULL} then the default filename generator function,
-@code{filename_entry_function ()}, is used.
+@code{filename_completion_function ()}, is used.
 @end deftypevar
 
 @node Completion Functions
@@ -1069,7 +1079,7 @@ by @code{rl_filename_quoting_function}.
 @end deftypevar
 
 @deftypevar int rl_inhibit_completion
-If this variable is non-zero, completion is inhibited.  The completion
+If this variable is non-zero, completion is inhibit<ed.  The completion
 character will be inserted as any other bound to @code{self-insert}.
 @end deftypevar
 
index 65111f3..f7d6fd8 100644 (file)
@@ -605,31 +605,31 @@ Meta-Control-h:   backward-kill-word      Text after the function name is ignored
 #
 # Arrow keys in keypad mode
 #
-#"\M-OD"        backward-char
-#"\M-OC"        forward-char
-#"\M-OA"        previous-history
-#"\M-OB"        next-history
+#"\M-OD":        backward-char
+#"\M-OC":        forward-char
+#"\M-OA":        previous-history
+#"\M-OB":        next-history
 #
 # Arrow keys in ANSI mode
 #
-"\M-[D"        backward-char
-"\M-[C"        forward-char
-"\M-[A"        previous-history
-"\M-[B"        next-history
+"\M-[D":        backward-char
+"\M-[C":        forward-char
+"\M-[A":        previous-history
+"\M-[B":        next-history
 #
 # Arrow keys in 8 bit keypad mode
 #
-#"\M-\C-OD"       backward-char
-#"\M-\C-OC"       forward-char
-#"\M-\C-OA"       previous-history
-#"\M-\C-OB"       next-history
+#"\M-\C-OD":       backward-char
+#"\M-\C-OC":       forward-char
+#"\M-\C-OA":       previous-history
+#"\M-\C-OB":       next-history
 #
 # Arrow keys in 8 bit ANSI mode
 #
-#"\M-\C-[D"       backward-char
-#"\M-\C-[C"       forward-char
-#"\M-\C-[A"       previous-history
-#"\M-\C-[B"       next-history
+#"\M-\C-[D":       backward-char
+#"\M-\C-[C":       forward-char
+#"\M-\C-[A":       previous-history
+#"\M-\C-[B":       next-history
 
 C-q: quoted-insert
 
@@ -921,10 +921,18 @@ Add this digit to the argument already accumulating, or start a new
 argument.  @key{M--} starts a negative argument.
 
 @item universal-argument ()
-Each time this is executed, the argument count is multiplied by four.
+This is another way to specify an argument.
+If this command is followed by one or more digits, optionally with a
+leading minus sign, those digits define the argument.
+If the command is followed by digits, executing @code{universal-argument}
+again ends the numeric argument, but is otherwise ignored.
+As a special case, if this command is immediately followed by a
+character that is neither a digit or minus sign, the argument count
+for the next command is multiplied by four.
 The argument count is initially one, so executing this function the
-first time makes the argument count four.  By default, this is not
-bound to a key.
+first time makes the argument count four, a second time makes the
+argument count sixteen, and so on.
+By default, this is not bound to a key.
 @end ftable
 
 @node Commands For Completion
@@ -1122,6 +1130,12 @@ word expansions.
 @item history-expand-line (M-^)
 Perform history expansion on the current line.
 
+@item alias-expand-line
+Perform alias expansion on the current line (@pxref{Aliases}).
+
+@item history-and-alias-expand-line
+Perform history and alias expansion on the current line.
+
 @item insert-last-argument (M-., M-_)
 A synonym for @code{yank-last-arg}.
 
index cfa7745..d72a15d 100644 (file)
@@ -1,6 +1,6 @@
 # This is the Makefile for the examples subdirectory of readline. -*- text -*-
 #
-EXECUTABLES = fileman rltest
+EXECUTABLES = fileman rltest rl
 CFLAGS  = -g -I../.. -I..
 LDFLAGS = -g -L..
 
@@ -9,6 +9,10 @@ LDFLAGS = -g -L..
 
 all: $(EXECUTABLES)
 
+
+rl: rl.o
+       $(CC) $(LDFLAGS) -o $@ rl.o -lreadline -ltermcap
+
 fileman: fileman.o
        $(CC) $(LDFLAGS) -o $@ fileman.o -lreadline -ltermcap
 
@@ -17,3 +21,4 @@ rltest: rltest.o
 
 fileman.o: fileman.c
 rltest.o: rltest.c
+rl.o: rl.c
index 8709120..0702a5b 100644 (file)
@@ -1,15 +1,38 @@
 /* fileman.c -- A tiny application which demonstrates how to use the
    GNU Readline library.  This application interactively allows users
    to manipulate files and their modes. */
+/*
+ * Remove the next line if you're compiling this against an installed
+ * libreadline.a
+ */
+#define READLINE_LIBRARY
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
-#include <stdio.h>
 #include <sys/types.h>
+#ifdef HAVE_SYS_FILE_H
 #include <sys/file.h>
+#endif
 #include <sys/stat.h>
-#include <sys/errno.h>
 
-#include <readline/readline.h>
-#include <readline/history.h>
+#include <stdio.h>
+#include <errno.h>
+
+#if defined (HAVE_STRING_H)
+#  include <string.h>
+#else /* !HAVE_STRING_H */
+#  include <strings.h>
+#endif /* !HAVE_STRING_H */
+
+#ifdef READLINE_LIBRARY
+#  include "readline.h"
+#  include "history.h"
+#else
+#  include <readline/readline.h>
+#  include <readline/history.h>
+#endif
 
 extern char *getwd ();
 extern char *xmalloc ();
@@ -54,7 +77,7 @@ int done;
 
 char *
 dupstr (s)
-     int s;
+     char *s;
 {
   char *r;
 
@@ -304,7 +327,8 @@ com_stat (arg)
 
   printf ("Statistics for `%s':\n", arg);
 
-  printf ("%s has %d link%s, and is %d byte%s in length.\n", arg,
+  printf ("%s has %d link%s, and is %d byte%s in length.\n",
+         arg,
           finfo.st_nlink,
           (finfo.st_nlink == 1) ? "" : "s",
           finfo.st_size,
diff --git a/lib/readline/examples/rl.c b/lib/readline/examples/rl.c
new file mode 100644 (file)
index 0000000..6c2f343
--- /dev/null
@@ -0,0 +1,115 @@
+/*
+ * rl - command-line interface to read a line from the standard input
+ *      (or another fd) using readline.
+ *
+ * usage: rl [-p prompt] [-u unit] [-d default]
+ */
+
+/*
+ * Remove the next line if you're compiling this against an installed
+ * libreadline.a
+ */
+#define READLINE_LIBRARY
+
+#if defined (HAVE_CONFIG_H)
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <sys/types.h>
+#include "posixstat.h"
+#include "readline.h"
+#include "history.h"
+
+extern int optind;
+extern char *optarg;
+
+extern char *strrchr();
+
+static char *progname;
+static char *deftext;
+
+static int
+set_deftext ()
+{
+  if (deftext)
+    {
+      rl_insert_text (deftext);
+      deftext = (char *)NULL;
+      rl_startup_hook = (Function *)NULL;
+    }
+}
+
+usage()
+{
+  fprintf (stderr, "%s: usage: %s [-p prompt] [-u unit] [-d default]\n",
+               progname, progname);
+}
+
+main (argc, argv)
+     int argc;
+     char **argv;
+{
+  char *temp, *prompt;
+  struct stat sb;
+  int done, opt, fd;
+  FILE *ifp;
+
+  progname = strrchr(argv[0], '/');
+  if (progname == 0)
+    progname = argv[0];
+  else
+    progname++;
+
+  /* defaults */
+  prompt = "readline$ ";
+  fd = 0;
+  deftext = (char *)0;
+
+  while ((opt = getopt(argc, argv, "p:u:d:")) != EOF)
+    {
+      switch (opt)
+       {
+       case 'p':
+         prompt = optarg;
+         break;
+       case 'u':
+         fd = atoi(optarg);
+         if (fd < 0)
+           {
+             fprintf (stderr, "%s: bad file descriptor `%s'\n", progname, optarg);
+             exit (2);
+           }
+         break;
+       case 'd':
+         deftext = optarg;
+         break;
+       default:
+         usage ();
+         exit (2);
+       }
+    }
+
+  if (fd != 0)
+    {
+      if (fstat (fd, &sb) < 0)
+       {
+         fprintf (stderr, "%s: %d: bad file descriptor\n", progname, fd);
+         exit (1);
+       }
+      ifp = fdopen (fd, "r");
+      rl_instream = ifp;
+    }
+
+  if (deftext && *deftext)
+    rl_startup_hook = set_deftext;
+
+  temp = readline (prompt);
+
+  /* Test for EOF. */
+  if (temp == 0)
+    exit (1);
+
+  puts (temp);
+  exit (0);
+}
index 311629f..ff3ad5c 100644 (file)
@@ -4,10 +4,20 @@
 /*                                                                 */
 /* **************************************************************** */
 
+/*
+ * Remove the next line if you're compiling this against an installed
+ * libreadline.a
+ */
+#define READLINE_LIBRARY
+
+#if defined (HAVE_CONFIG_H)
+#include <config.h>
+#endif
+
 #include <stdio.h>
 #include <sys/types.h>
-#include "../readline.h"
-#include "../history.h"
+#include "readline.h"
+#include "history.h"
 
 main ()
 {
index 6b7d351..702fabd 100644 (file)
@@ -76,6 +76,7 @@ static FUNMAP default_funmap[] = {
   { "do-lowercase-version", rl_do_lowercase_version },
   { "downcase-word", rl_downcase_word },
   { "dump-functions", rl_dump_functions },
+  { "dump-macros", rl_dump_macros },
   { "dump-variables", rl_dump_variables },
   { "emacs-editing-mode", rl_emacs_editing_mode },
   { "end-kbd-macro", rl_end_kbd_macro },
index d916c74..de71d78 100644 (file)
@@ -59,11 +59,7 @@ static char *history_find_word ();
 
 extern int history_offset;
 
-#if defined (SHELL)
 extern char *single_quote ();
-#else
-static char *single_quote ();
-#endif /* !SHELL */
 static char *quote_breaks ();
 
 extern char *xmalloc (), *xrealloc ();
@@ -91,6 +87,10 @@ char *history_no_expand_chars = " \t\n\r=";
    The default is 0. */
 int history_quotes_inhibit_expansion = 0;
 
+/* If set, this points to a function that is called to verify that a
+   particular history expansion should be performed. */
+Function *history_inhibit_expansion_function;
+
 /* **************************************************************** */
 /*                                                                 */
 /*                     History Expansion                           */
@@ -289,38 +289,6 @@ hist_string_extract_single_quoted (string, sindex)
   *sindex = i;
 }
 
-#if !defined (SHELL)
-/* Does shell-like quoting using single quotes. */
-static char *
-single_quote (string)
-     char *string;
-{
-  register int c;
-  char *result, *r, *s;
-
-  result = (char *)xmalloc (3 + (3 * strlen (string)));
-  r = result;
-  *r++ = '\'';
-
-  for (s = string; s && (c = *s); s++)
-    {
-      *r++ = c;
-
-      if (c == '\'')
-       {
-         *r++ = '\\';  /* insert escaped single quote */
-         *r++ = '\'';
-         *r++ = '\'';  /* start new quoted string */
-       }
-    }
-
-  *r++ = '\'';
-  *r = '\0';
-
-  return (result);
-}
-#endif /* !SHELL */
-
 static char *
 quote_breaks (s)
      char *s;
@@ -888,19 +856,14 @@ history_expand (hstring, output)
            {
              if (!cc || member (cc, history_no_expand_chars))
                continue;
-#if defined (SHELL)
-             /* The shell uses ! as a pattern negation character
-                in globbing [...] expressions, so let those pass
-                without expansion. */
-             else if (i > 0 && (string[i - 1] == '[') &&
-                      member (']', string + i + 1))
-               continue;
-             /* The shell uses ! as the indirect expansion character, so
-                let those expansions pass as well. */
-             else if (i > 1 && string[i - 1] == '{' && string[i - 2] == '$' &&
-                      member ('}', string + i + 1))
+             /* If the calling application has set
+                history_inhibit_expansion_function to a function that checks
+                for special cases that should not be history expanded,
+                call the function and skip the expansion if it returns a
+                non-zero value. */
+             else if (history_inhibit_expansion_function &&
+                       (*history_inhibit_expansion_function) (string, i))
                continue;
-#endif /* SHELL */
              else
                break;
            }
index 355d46e..c3de134 100644 (file)
 #  include <strings.h>
 #endif /* !HAVE_STRING_H */
 
+#if defined (__EMX__)
+#  ifndef O_BINARY
+#    define O_BINARY 0
+#  endif
+#else /* !__EMX__ */
+   /* If we're not compiling for __EMX__, we don't want this at all.  Ever. */
+#  undef O_BINARY
+#  define O_BINARY 0
+#endif /* !__EMX__ */
+
 #include <errno.h>
 #if !defined (errno)
 extern int errno;
@@ -60,6 +70,9 @@ extern int errno;
 #include "history.h"
 #include "histlib.h"
 
+/* Functions imported from shell.c */
+extern char *get_env_value ();
+
 extern char *xmalloc (), *xrealloc ();
 
 /* Return the string that should be used in the place of this
@@ -77,7 +90,7 @@ history_filename (filename)
   if (return_val)
     return (return_val);
   
-  home = getenv ("HOME");
+  home = get_env_value ("HOME");
 
   if (home == 0)
     {
@@ -121,7 +134,7 @@ read_history_range (filename, from, to)
   struct stat finfo;
 
   input = history_filename (filename);
-  file = open (input, O_RDONLY, 0666);
+  file = open (input, O_RDONLY|O_BINARY, 0666);
 
   if ((file < 0) || (fstat (file, &finfo) == -1))
     goto error_and_exit;
@@ -194,11 +207,12 @@ history_truncate_file (fname, lines)
 {
   register int i;
   int file, chars_read;
-  char *buffer = (char *)NULL, *filename;
+  char *buffer, *filename;
   struct stat finfo;
 
+  buffer = (char *)NULL;
   filename = history_filename (fname);
-  file = open (filename, O_RDONLY, 0666);
+  file = open (filename, O_RDONLY|O_BINARY, 0666);
 
   if (file == -1 || fstat (file, &finfo) == -1)
     goto truncate_exit;
@@ -232,7 +246,7 @@ history_truncate_file (fname, lines)
 
   /* Write only if there are more lines in the file than we want to
      truncate to. */
-  if (i && ((file = open (filename, O_WRONLY|O_TRUNC, 0666)) != -1))
+  if (i && ((file = open (filename, O_WRONLY|O_TRUNC|O_BINARY, 0666)) != -1))
     {
       write (file, buffer + i, finfo.st_size - i);
       close (file);
@@ -255,10 +269,11 @@ history_do_write (filename, nelements, overwrite)
      int nelements, overwrite;
 {
   register int i;
-  char *output = history_filename (filename);
+  char *output;
   int file, mode;
 
-  mode = overwrite ? O_WRONLY | O_CREAT | O_TRUNC : O_WRONLY | O_APPEND;
+  mode = overwrite ? O_WRONLY|O_CREAT|O_TRUNC|O_BINARY : O_WRONLY|O_APPEND|O_BINARY;
+  output = history_filename (filename);
 
   if ((file = open (output, mode, 0666)) == -1)
     {
index 17ec877..e49a341 100644 (file)
 #ifndef _HISTORY_H_
 #define _HISTORY_H_
 
+#if !defined (_FUNCTION_DEF)
+#  define _FUNCTION_DEF
+typedef int Function ();
+typedef void VFunction ();
+typedef char *CPFunction ();
+typedef char **CPPFunction ();
+#endif
+
 /* The structure used to store a history entry. */
 typedef struct _hist_entry {
   char *line;
@@ -207,4 +215,9 @@ extern char *history_no_expand_chars;
 extern char *history_search_delimiter_chars;
 extern int history_quotes_inhibit_expansion;
 
+/* If set, this function is called to decide whether or not a particular
+   history expansion should be treated as a special case for the calling
+   application and not expanded. */
+extern Function *history_inhibit_expansion_function;
+
 #endif /* !_HISTORY_H_ */
index fa60fa4..9639a63 100644 (file)
 #  include <config.h>
 #endif
 
+#include <sys/types.h>
+
 #include <stdio.h>
 
 #if defined (HAVE_UNISTD_H)
 #  include <unistd.h>
 #endif
 
-#include <sys/types.h>
+#if defined (HAVE_STDLIB_H)
+#  include <stdlib.h>
+#else
+#  include "ansi_stdlib.h"
+#endif
 
 #include "rldefs.h"
 #include "readline.h"
@@ -287,7 +293,8 @@ rl_search_history (direction, invoking_key)
          rl_end = strlen (rl_line_buffer);
          _rl_restore_prompt();
          rl_clear_message ();
-         free (allocated_line);
+         if (allocated_line)
+           free (allocated_line);
          free (lines);
          return 0;
 
@@ -403,7 +410,8 @@ rl_search_history (direction, invoking_key)
   rl_point = line_index;
   rl_clear_message ();
 
-  free (allocated_line);
+  if (allocated_line)
+    free (allocated_line);
   free (lines);
 
   return 0;
index 89f6b55..352f37d 100644 (file)
@@ -53,6 +53,7 @@ extern Function *rl_last_func;
 
 extern void _rl_init_argument ();
 extern int _rl_set_mark_at_pos ();
+extern void _rl_fix_point ();
 extern void _rl_abort_internal ();
 
 extern char *xmalloc (), *xrealloc ();
@@ -384,7 +385,11 @@ int
 rl_kill_region (count, ignore)
      int count, ignore;
 {
-  return (region_kill_internal (1));
+  int r;
+
+  r = region_kill_internal (1);
+  _rl_fix_point (1);
+  return r;
 }
 
 /* Copy COUNT words to the kill ring.  DIR says which direction we look
@@ -521,7 +526,7 @@ rl_yank_nth_arg (count, ignore)
      inserts it right *after* rl_point. */
   if (rl_editing_mode == vi_mode)
     {
-      rl_vi_append_mode ();
+      rl_vi_append_mode (1, ignore);
       rl_insert_text (" ");
     }
 #endif /* VI_MODE */
index fad5201..7a00a5f 100644 (file)
@@ -25,6 +25,8 @@
 #  include <config.h>
 #endif
 
+#include <sys/types.h>
+
 #if defined (HAVE_UNISTD_H)
 #  include <unistd.h>
 #endif /* HAVE_UNISTD_H */
 extern int _rl_convert_meta_chars_to_ascii;
 extern int _rl_output_meta_chars;
 extern int _rl_meta_flag;
-    
+
+/* Functions imported from shell.c */
+extern char *get_env_value ();
+
+#if !defined (HAVE_SETLOCALE)    
 /* A list of legal values for the LANG or LC_CTYPE environment variables.
    If a locale name in this list is the value for the LC_ALL, LC_CTYPE,
    or LANG environment variable (using the first of those with a value),
@@ -69,6 +75,7 @@ static char *legal_lang_values[] =
 
 static char *normalize_codeset ();
 static char *find_codeset ();
+#endif /* !HAVE_SETLOCALE */
 
 /* Check for LC_ALL, LC_CTYPE, and LANG and use the first with a value
    to decide the defaults for 8-bit character input and output.  Returns
@@ -76,12 +83,33 @@ static char *find_codeset ();
 int
 _rl_init_eightbit ()
 {
+/* If we have setlocale(3), just check the current LC_CTYPE category
+   value, and go into eight-bit mode if it's not C or POSIX. */
+#if defined (HAVE_SETLOCALE)
+  char *t;
+
+  /* Set the LC_CTYPE locale category from environment variables. */
+  t = setlocale (LC_CTYPE, "");
+  if (t && *t && (t[0] != 'C' || t[1]) && (STREQ (t, "POSIX") == 0))
+    {
+      _rl_meta_flag = 1;
+      _rl_convert_meta_chars_to_ascii = 0;
+      _rl_output_meta_chars = 1;
+      return (1);
+    }
+  else
+    return (0);
+
+#else /* !HAVE_SETLOCALE */
   char *lspec, *t;
   int i;
 
-  lspec = getenv ("LC_ALL");
-  if (lspec == 0) lspec = getenv ("LC_CTYPE");
-  if (lspec == 0) lspec = getenv ("LANG");
+  /* We don't have setlocale.  Finesse it.  Check the environment for the
+     appropriate variables and set eight-bit mode if they have the right
+     values. */
+  lspec = get_env_value ("LC_ALL");
+  if (lspec == 0) lspec = get_env_value ("LC_CTYPE");
+  if (lspec == 0) lspec = get_env_value ("LANG");
   if (lspec == 0 || (t = normalize_codeset (lspec)) == 0)
     return (0);
   for (i = 0; t && legal_lang_values[i]; i++)
@@ -90,15 +118,15 @@ _rl_init_eightbit ()
        _rl_meta_flag = 1;
        _rl_convert_meta_chars_to_ascii = 0;
        _rl_output_meta_chars = 1;
-#if defined (HAVE_SETLOCALE)
-       setlocale (LC_CTYPE, lspec);
-#endif
        break;
       }
   free (t);
   return (legal_lang_values[i] ? 1 : 0);
+
+#endif /* !HAVE_SETLOCALE */
 }
 
+#if !defined (HAVE_SETLOCALE)
 static char *
 normalize_codeset (codeset)
      char *codeset;
@@ -196,3 +224,4 @@ find_codeset (name, lenp)
 
   return result;
 }
+#endif /* !HAVE_SETLOCALE */
index 8b0e5bc..7480a93 100644 (file)
@@ -42,7 +42,7 @@
 #  define D_NAMLEN(d)   ((d)->d_namlen)
 #endif /* !HAVE_DIRENT_H */
 
-#if defined (STRUCT_DIRENT_HAS_D_INO)
+#if defined (STRUCT_DIRENT_HAS_D_INO) && !defined (STRUCT_DIRENT_HAS_D_FILENO)
 #  define d_fileno d_ino
 #endif
 
diff --git a/lib/readline/posixjmp.h b/lib/readline/posixjmp.h
new file mode 100644 (file)
index 0000000..8703d17
--- /dev/null
@@ -0,0 +1,20 @@
+/* posixjmp.h -- wrapper for setjmp.h with changes for POSIX systems. */
+
+#ifndef _POSIXJMP_H_
+#define _POSIXJMP_H_
+
+#include <setjmp.h>
+
+/* This *must* be included *after* config.h */
+
+#if defined (HAVE_POSIX_SIGSETJMP)
+#  define procenv_t    sigjmp_buf
+#  undef setjmp
+#  define setjmp(x)    sigsetjmp((x), 1)
+#  undef longjmp
+#  define longjmp(x, n)        siglongjmp((x), (n))
+#else
+#  define procenv_t    jmp_buf
+#endif
+
+#endif /* _POSIXJMP_H_ */
index d85789d..dcd8f81 100644 (file)
 
 #include <signal.h>
 #include <stdio.h>
-#include <setjmp.h>
+#include "posixjmp.h"
 
 /* System-specific feature definitions and include files. */
 #include "rldefs.h"
 
-#include "tcap.h"
+#if defined (__EMX__)
+#  define INCL_DOSPROCESS
+#  include <os2.h>
+#endif /* __EMX__ */
 
 /* Some standard library routines. */
 #include "readline.h"
 #include "history.h"
 
+#ifndef RL_LIBRARY_VERSION
+#  define RL_LIBRARY_VERSION "2.1-bash"
+#endif
+
+/* Evaluates its arguments multiple times. */
 #define SWAP(s, e)  do { int t; t = s; s = e; e = t; } while (0)
 
 /* NOTE: Functions and variables prefixed with `_rl_' are
@@ -75,7 +83,6 @@ extern void _rl_get_screen_size ();
 
 extern int _rl_enable_meta;
 extern int _rl_term_autowrap;
-extern char *term_backspace, *term_clreol, *term_clrpag;
 extern int screenwidth, screenheight, screenchars;
 
 /* Variables and functions imported from rltty.c. */
@@ -99,9 +106,17 @@ extern int rl_read_key ();
 /* Functions imported from nls.c */
 extern int _rl_init_eightbit ();
 
+/* Functions imported from shell.c */
+extern char *get_env_value ();
+
 /* External redisplay functions and variables from display.c */
 extern void _rl_move_vert ();
 extern void _rl_update_final ();
+extern void _rl_clear_to_eol ();
+extern void _rl_clear_screen ();
+
+extern void _rl_save_prompt ();
+extern void _rl_restore_prompt ();
 
 extern void _rl_erase_at_end_of_line ();
 extern void _rl_move_cursor_relative ();
@@ -153,6 +168,7 @@ static void readline_default_bindings ();
 #endif /* !__GO32__ */
 
 #if defined (__GO32__)
+#  include <go32.h>
 #  include <pc.h>
 #  undef HANDLE_SIGNALS
 #endif /* __GO32__ */
@@ -165,7 +181,7 @@ extern char *xmalloc (), *xrealloc ();
 /*                                                                 */
 /* **************************************************************** */
 
-char *rl_library_version = "2.1";
+char *rl_library_version = RL_LIBRARY_VERSION;
 
 /* A pointer to the keymap that is currently in use.
    By default, it is the standard emacs keymap. */
@@ -174,6 +190,11 @@ Keymap _rl_keymap = emacs_standard_keymap;
 /* The current style of editing. */
 int rl_editing_mode = emacs_mode;
 
+/* Non-zero if we called this function from _rl_dispatch().  It's present
+   so functions can find out whether they were called from a key binding
+   or directly from an application. */
+int rl_dispatching;
+
 /* Non-zero if the previous command was a kill command. */
 int _rl_last_command_was_kill = 0;
 
@@ -208,7 +229,7 @@ int rl_done;
 Function *rl_last_func = (Function *)NULL;
 
 /* Top level environment for readline_internal (). */
-jmp_buf readline_top_level;
+procenv_t readline_top_level;
 
 /* The streams we interact with. */
 FILE *_rl_in_stream, *_rl_out_stream;
@@ -360,7 +381,7 @@ readline_internal_setup ()
       (*rl_redisplay_function) ();
 #if defined (VI_MODE)
       if (rl_editing_mode == vi_mode)
-       rl_vi_insertion_mode ();
+       rl_vi_insertion_mode (1, 0);
 #endif /* VI_MODE */
     }
 }
@@ -498,6 +519,14 @@ readline_internal ()
 }
 
 void
+_rl_init_line_state ()
+{
+  rl_point = rl_end = 0;
+  the_line = rl_line_buffer;
+  the_line[0] = 0;
+}
+
+void
 _rl_set_the_line ()
 {
   the_line = rl_line_buffer;
@@ -551,12 +580,14 @@ _rl_dispatch (key, map)
          _rl_suppress_redisplay = (map[key].function == rl_insert) && _rl_input_available ();
 #endif
 
+         rl_dispatching = 1;
          r = (*map[key].function)(rl_numeric_arg * rl_arg_sign, key);
+         rl_dispatching = 0;
 
          /* If we have input pending, then the last command was a prefix
             command.  Don't change the state of rl_last_func.  Otherwise,
             remember the last command executed in this variable. */
-         if (!rl_pending_input)
+         if (!rl_pending_input && map[key].function != rl_digit_argument)
            rl_last_func = map[key].function;
        }
       else
@@ -603,7 +634,7 @@ _rl_dispatch (key, map)
 /*                                                                 */
 /* **************************************************************** */
 
-/* Initliaze readline (and terminal if not already). */
+/* Initialize readline (and terminal if not already). */
 int
 rl_initialize ()
 {
@@ -616,9 +647,7 @@ rl_initialize ()
     }
 
   /* Initalize the current line information. */
-  rl_point = rl_end = 0;
-  the_line = rl_line_buffer;
-  the_line[0] = 0;
+  _rl_init_line_state ();
 
   /* We aren't done yet.  We haven't even gotten started yet! */
   rl_done = 0;
@@ -643,12 +672,41 @@ rl_initialize ()
   return 0;
 }
 
+#if defined (__EMX__)
+static void
+_emx_build_environ ()
+{
+  TIB *tibp;
+  PIB *pibp;
+  char *t, **tp;
+  int c;
+
+  DosGetInfoBlocks (&tibp, &pibp);
+  t = pibp->pib_pchenv;
+  for (c = 1; *t; c++)
+    t += strlen (t) + 1;
+  tp = environ = (char **)xmalloc ((c + 1) * sizeof (char *));
+  t = pibp->pib_pchenv;
+  while (*t)
+    {
+      *tp++ = t;
+      t += strlen (t) + 1;
+    }
+  *tp = 0;
+}
+#endif /* __EMX__ */
+
 /* Initialize the entire state of the world. */
 static void
 readline_initialize_everything ()
 {
+#if defined (__EMX__)
+  if (environ == 0)
+    _emx_build_environ ();
+#endif
+
   /* Find out if we are running in Emacs. */
-  running_in_emacs = getenv ("EMACS") != (char *)0;
+  running_in_emacs = get_env_value ("EMACS") != (char *)0;
 
   /* Set up input and output if they are not already set up. */
   if (!rl_instream)
@@ -664,7 +722,7 @@ readline_initialize_everything ()
   _rl_out_stream = rl_outstream;
 
   /* Allocate data structures. */
-  if (!rl_line_buffer)
+  if (rl_line_buffer == 0)
     rl_line_buffer = xmalloc (rl_line_buffer_len = DEFAULT_BUFFER_SIZE);
 
   /* Initialize the terminal interface. */
@@ -773,45 +831,56 @@ bind_arrow_keys ()
 static int
 rl_digit_loop ()
 {
-  int key, c, sawminus;
+  int key, c, sawminus, sawdigits;
 
   _rl_save_prompt ();
 
-  sawminus = 0;
+  sawminus = sawdigits = 0;
   while (1)
     {
       rl_message ("(arg: %d) ", rl_arg_sign * rl_numeric_arg);
       key = c = rl_read_key ();
 
+      /* If we see a key bound to `universal-argument' after seeing digits,
+        it ends the argument but is otherwise ignored. */
       if (_rl_keymap[c].type == ISFUNC &&
          _rl_keymap[c].function == rl_universal_argument)
        {
-         rl_numeric_arg *= 4;
-         continue;
-       }
-      c = UNMETA (c);
-      if (_rl_digit_p (c))
-       {
-         rl_numeric_arg = rl_explicit_arg ? (rl_numeric_arg * 10) + c - '0' : c - '0';
-         rl_explicit_arg = 1;
-       }
-      else
-       {
-         if (c == '-' && rl_explicit_arg == 0)
+         if (sawdigits == 0)
            {
-             rl_numeric_arg = sawminus = 1;
-             rl_arg_sign = -1;
+             rl_numeric_arg *= 4;
+             continue;
            }
          else
            {
-             /* Make M-- command equivalent to M--1 command. */
-             if (sawminus && rl_numeric_arg == 1 && rl_explicit_arg == 0)
-               rl_explicit_arg = 1;
+             key = rl_read_key ();
              _rl_restore_prompt ();
              rl_clear_message ();
              return (_rl_dispatch (key, _rl_keymap));
            }
        }
+
+      c = UNMETA (c);
+
+      if (_rl_digit_p (c))
+       {
+         rl_numeric_arg = rl_explicit_arg ? (rl_numeric_arg * 10) + c - '0' : c - '0';
+         sawdigits = rl_explicit_arg = 1;
+       }
+      else if (c == '-' && rl_explicit_arg == 0)
+       {
+         rl_numeric_arg = sawminus = 1;
+         rl_arg_sign = -1;
+       }
+      else
+       {
+         /* Make M-- command equivalent to M--1 command. */
+         if (sawminus && rl_numeric_arg == 1 && rl_explicit_arg == 0)
+           rl_explicit_arg = 1;
+         _rl_restore_prompt ();
+         rl_clear_message ();
+         return (_rl_dispatch (key, _rl_keymap));
+       }
     }
 
   return 0;
@@ -936,6 +1005,28 @@ rl_delete_text (from, to)
   return (diff);
 }
 
+/* Fix up point so that it is within the line boundaries after killing
+   text.  If FIX_MARK_TOO is non-zero, the mark is forced within line
+   boundaries also. */
+
+#define _RL_FIX_POINT(x) \
+       do { \
+       if (x > rl_end) \
+         x = rl_end; \
+       else if (x < 0) \
+         x = 0; \
+       } while (0)
+
+void
+_rl_fix_point (fix_mark_too)
+     int fix_mark_too;
+{
+  _RL_FIX_POINT (rl_point);
+  if (fix_mark_too)
+    _RL_FIX_POINT (rl_mark);
+}
+#undef _RL_FIX_POINT
+
 /* **************************************************************** */
 /*                                                                 */
 /*                     Readline character functions                */
@@ -1153,8 +1244,7 @@ rl_refresh_line ()
     memset (row_start + col, 0, (width - col) * 2);
   }
 #else /* !__GO32__ */
-  if (term_clreol)
-    tputs (term_clreol, 1, _rl_output_character_function);
+  _rl_clear_to_eol (0);                /* arg of 0 means to not use spaces */
 #endif /* !__GO32__ */
 
   rl_forced_update_display ();
@@ -1176,13 +1266,7 @@ rl_clear_screen (count, key)
       return 0;
     }
 
-#if !defined (__GO32__)
-  if (term_clrpag)
-    tputs (term_clrpag, 1, _rl_output_character_function);
-  else
-#endif /* !__GO32__ */
-    crlf ();
-
+  _rl_clear_screen ();         /* calls termcap function to clear screen */
   rl_forced_update_display ();
   rl_display_fixed = 1;
 
@@ -1321,8 +1405,11 @@ rl_newline (count, key)
   rl_done = 1;
 
 #if defined (VI_MODE)
-  _rl_vi_done_inserting ();
-  _rl_vi_reset_last ();
+  if (rl_editing_mode == vi_mode)
+    {
+      _rl_vi_done_inserting ();
+      _rl_vi_reset_last ();
+    }
 #endif /* VI_MODE */
 
   if (readline_echoing_p)
@@ -1632,10 +1719,7 @@ rl_transpose_chars (count, key)
   rl_delete_text (rl_point, rl_point + 1);
 
   rl_point += count;
-  if (rl_point > rl_end)
-    rl_point = rl_end;
-  else if (rl_point < 0)
-    rl_point = 0;
+  _rl_fix_point (0);
   rl_insert_text (dummy);
 
   rl_end_undo_group ();
@@ -1988,7 +2072,7 @@ rl_vi_editing_mode (count, key)
 {
 #if defined (VI_MODE)
   rl_editing_mode = vi_mode;
-  rl_vi_insertion_mode ();
+  rl_vi_insertion_mode (1, key);
 #endif /* VI_MODE */
   return 0;
 }
index 4f7d498..d6c1a5c 100644 (file)
@@ -102,7 +102,7 @@ extern int
   rl_noninc_forward_search_again (), rl_noninc_reverse_search_again ();
 
 /* Things for vi mode. Not available unless readline is compiled -DVI_MODE. */
-extern int rl_vi_check (), rl_vi_textmod_command ();
+extern int rl_vi_check ();
 extern int
   rl_vi_undo (), rl_vi_redo (), rl_vi_tilde_expand (),
   rl_vi_movement_mode (), rl_vi_insertion_mode (), rl_vi_arg_digit (),
@@ -236,6 +236,10 @@ extern char *rl_library_version;
    whatever was in argv[0].  It is used when parsing conditionals. */
 extern char *rl_readline_name;
 
+/* The prompt readline uses.  This is set from the argument to
+   readline (), and should not be assigned to directly. */
+extern char *rl_prompt;
+
 /* The line buffer that is in use. */
 extern char *rl_line_buffer;
 
@@ -248,6 +252,11 @@ extern int rl_done;
 
 extern int rl_pending_input;
 
+/* Non-zero if we called this function from _rl_dispatch().  It's present
+   so functions can find out whether they were called from a key binding
+   or directly from an application. */
+int rl_dispatching;
+
 /* The name of the terminal to use. */
 extern char *rl_terminal_name;
 
@@ -370,6 +379,14 @@ extern int rl_completion_type;
    default is a space.  Nothing is added if this is '\0'. */
 extern int rl_completion_append_character;
 
+/* Up to this many items will be displayed in response to a
+   possible-completions call.  After that, we ask the user if she
+   is sure she wants to see them all.  The default value is 100. */
+extern int rl_completion_query_items;
+
+/* If non-zero, then disallow duplicates in the matches. */
+extern int rl_ignore_completion_duplicates;
+
 /* If this is non-zero, completion is (temporarily) inhibited, and the
    completion character will be inserted as any other. */
 extern int rl_inhibit_completion;
index 5a9e62a..d4aced4 100644 (file)
 #  endif
 #endif
 
-#if defined (HAVE_SYS_STREAM_H)
-#  include <sys/stream.h>
-#endif /* HAVE_SYS_STREAM_H */
-#if defined (HAVE_SYS_PTEM_H)
-#  include <sys/ptem.h>
-#  define _IO_PTEM_H           /* work around SVR4.2 1.1.4 bug */
-#endif /* HAVE_SYS_PTEM_H */
-#if defined (HAVE_SYS_PTE_H)
-#  include <sys/pte.h>
-#endif /* HAVE_SYS_PTE_H */
-
 /* Posix macro to check file in statbuf for directory-ness.
    This requires that <sys/stat.h> be included before this test. */
 #if defined (S_IFDIR) && !defined (S_ISDIR)
index d35eb6a..8312963 100644 (file)
@@ -53,6 +53,8 @@ extern int _rl_eof_char;
 
 extern int _rl_enable_keypad, _rl_enable_meta;
 
+extern void _rl_control_keypad ();
+
 #if defined (__GO32__)
 #  include <pc.h>
 #  undef HANDLE_SIGNALS
index 3ee6b3f..3e13704 100644 (file)
 #  include <sgtty.h>
 #endif
 
+/* Stuff for `struct winsize' on various systems. */
+#if defined (HAVE_SYS_STREAM_H)
+#  include <sys/stream.h>
+#endif /* HAVE_SYS_STREAM_H */
+#if defined (HAVE_SYS_PTEM_H)
+#  include <sys/ptem.h>
+#  define _IO_PTEM_H           /* work around SVR4.2 1.1.4 bug */
+#endif /* HAVE_SYS_PTEM_H */
+#if defined (HAVE_SYS_PTE_H)
+#  include <sys/pte.h>
+#endif /* HAVE_SYS_PTE_H */
+
 /* Define _POSIX_VDISABLE if we are not using the `new' tty driver and
    it is not already defined.  It is used both to determine if a
    special character is disabled and to disable certain special
index 05641a1..3024ee5 100644 (file)
 #  include <unistd.h>
 #endif
 
+#if defined (HAVE_STDLIB_H)
+#  include <stdlib.h>
+#else
+#  include "ansi_stdlib.h"
+#endif
+
 #include "rldefs.h"
 #include "readline.h"
 #include "history.h"
 
-#define abs(x)         (((x) > 0) ? (x) : -(x))
+#ifdef abs
+#  undef abs
+#endif
+#define abs(x)         (((x) >= 0) ? (x) : -(x))
 
 extern char *xmalloc (), *xrealloc ();
 
diff --git a/lib/readline/shell.c b/lib/readline/shell.c
new file mode 100644 (file)
index 0000000..eb99c72
--- /dev/null
@@ -0,0 +1,129 @@
+/* shell.c -- readline utility functions that are normally provided by
+             bash when readline is linked as part of the shell. */
+
+/* Copyright (C) 1997 Free Software Foundation, Inc.
+
+   This file is part of the GNU Readline Library, a library for
+   reading lines of text with interactive input and history editing.
+
+   The GNU Readline Library is free software; you can redistribute it
+   and/or modify it under the terms of the GNU General Public License
+   as published by the Free Software Foundation; either version 1, or
+   (at your option) any later version.
+
+   The GNU Readline Library is distributed in the hope that it will be
+   useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   The GNU General Public License is often shipped with GNU software, and
+   is generally kept in a file called COPYING or LICENSE.  If you do not
+   have a copy of the license, write to the Free Software Foundation,
+   675 Mass Ave, Cambridge, MA 02139, USA. */
+#define READLINE_LIBRARY
+
+#if defined (HAVE_CONFIG_H)
+#  include <config.h>
+#endif
+
+#if defined (HAVE_UNISTD_H)
+#  include <unistd.h>
+#endif /* HAVE_UNISTD_H */
+
+#if defined (HAVE_STDLIB_H)
+#  include <stdlib.h>
+#else
+#  include "ansi_stdlib.h"
+#endif /* HAVE_STDLIB_H */
+
+extern char *xmalloc (), *xrealloc ();
+
+#if !defined (SHELL)
+
+#ifdef savestring
+#undef savestring
+#endif
+
+/* Backwards compatibility, now that savestring has been removed from
+   all `public' readline header files. */
+char *
+savestring (s)
+     char *s;
+{
+  return ((char *)strcpy (xmalloc (1 + (int)strlen (s)), (s)));
+}
+
+/* Does shell-like quoting using single quotes. */
+char *
+single_quote (string)
+     char *string;
+{
+  register int c;
+  char *result, *r, *s;
+
+  result = (char *)xmalloc (3 + (3 * strlen (string)));
+  r = result;
+  *r++ = '\'';
+
+  for (s = string; s && (c = *s); s++)
+    {
+      *r++ = c;
+
+      if (c == '\'')
+       {
+         *r++ = '\\';  /* insert escaped single quote */
+         *r++ = '\'';
+         *r++ = '\'';  /* start new quoted string */
+       }
+    }
+
+  *r++ = '\'';
+  *r = '\0';
+
+  return (result);
+}
+
+/* Set the environment variables LINES and COLUMNS to lines and cols,
+   respectively. */
+void
+set_lines_and_columns (lines, cols)
+     int lines, cols;
+{
+  char *b;
+
+#if defined (HAVE_PUTENV)
+  b = xmalloc (24);
+  sprintf (b, "LINES=%d", lines);
+  putenv (b);
+  b = xmalloc (24);
+  sprintf (b, "COLUMNS=%d", cols);
+  putenv (b);
+#else /* !HAVE_PUTENV */
+#  if defined (HAVE_SETENV)
+  b = xmalloc (8);
+  sprintf (b, "%d", lines);
+  setenv ("LINES", b, 1);
+  b = xmalloc (8);
+  sprintf (b, "%d", cols);
+  setenv ("COLUMNS", b, 1);
+#  endif /* HAVE_SETENV */
+#endif /* !HAVE_PUTENV */
+}
+
+char *
+get_env_value (varname)
+     char *varname;
+{
+  return ((char *)getenv (varname));
+}
+
+#else /* SHELL */
+extern char *get_string_value ();
+
+char *
+get_env_value (varname)
+     char *varname;
+{
+  return get_string_value (varname);
+}      
+#endif /* SHELL */
index 2fe7953..e19c22d 100644 (file)
@@ -87,6 +87,14 @@ static SigHandler *rl_set_sighandler ();
 /*                                                                 */
 /* **************************************************************** */
 
+/* If we're not being compiled as part of bash, initialize handlers for
+   and catch the job control signals (SIGTTIN, SIGTTOU, SIGTSTP) and
+   SIGTERM. */
+#if !defined (SHELL)
+#  define HANDLE_JOB_SIGNALS
+#  define HANDLE_SIGTERM
+#endif /* !SHELL */
+
 #if defined (HAVE_POSIX_SIGNALS)
 typedef struct sigaction sighandler_cxt;
 #  define rl_sigaction(s, nh, oh)      sigaction(s, nh, oh)
@@ -97,9 +105,13 @@ typedef struct { SigHandler *sa_handler; } sighandler_cxt;
 
 static sighandler_cxt old_int, old_alrm;
 
-#if !defined (SHELL)
-static sighandler_cxt old_tstp, old_ttou, old_ttin, old_term;
-#endif /* !SHELL */
+#if defined (HANDLE_JOB_SIGNALS)
+static sighandler_cxt old_tstp, old_ttou, old_ttin;
+#endif /* HANDLE_JOB_SIGNALS */
+
+#if defined (HANDLE_SIGTERM)
+static sighandler_cxt old_term;
+#endif
 
 #if defined (SIGWINCH)
 static sighandler_cxt old_winch;
@@ -116,14 +128,16 @@ rl_signal_handler (sig)
 #else /* !HAVE_POSIX_SIGNALS */
 #  if defined (HAVE_BSD_SIGNALS)
   long omask;
-#  endif /* HAVE_BSD_SIGNALS */
+#  else /* !HAVE_BSD_SIGNALS */
+  sighandler_cxt dummy_cxt;    /* needed for rl_set_sighandler call */
+#  endif /* !HAVE_BSD_SIGNALS */
 #endif /* !HAVE_POSIX_SIGNALS */
 
 #if !defined (HAVE_BSD_SIGNALS) && !defined (HAVE_POSIX_SIGNALS)
   /* Since the signal will not be blocked while we are in the signal
      handler, ignore it until rl_clear_signals resets the catcher. */
   if (sig == SIGINT || sig == SIGALRM)
-    rl_set_sighandler (sig, SIG_IGN, (sighandler_cxt *)NULL);
+    rl_set_sighandler (sig, SIG_IGN, &dummy_cxt);
 #endif /* !HAVE_BSD_SIGNALS && !HAVE_POSIX_SIGNALS */
 
   switch (sig)
@@ -188,6 +202,16 @@ rl_handle_sigwinch (sig)
 {
   SigHandler *oh;
 
+#if defined (MUST_REINSTALL_SIGHANDLERS)
+  sighandler_cxt dummy_winch;
+
+  /* We don't want to change old_winch -- it holds the state of SIGWINCH
+     disposition set by the calling application.  We need this state
+     because we call the application's SIGWINCH handler after updating
+     our own idea of the screen size. */
+  rl_set_sighandler (SIGWINCH, rl_handle_sigwinch, &dummy_winch);
+#endif
+
   if (readline_echoing_p)
     {
       _rl_get_screen_size (fileno (rl_instream), 1);
@@ -265,7 +289,7 @@ rl_set_signals ()
     rl_sigaction (SIGALRM, &old_alrm, &dummy);
 #endif /* HAVE_POSIX_SIGNALS */
 
-#if !defined (SHELL)
+#if defined (HANDLE_JOB_SIGNALS)
 
 #if defined (SIGTSTP)
   oh = rl_set_sighandler (SIGTSTP, rl_signal_handler, &old_tstp);
@@ -286,9 +310,12 @@ rl_set_signals ()
     }
 #endif /* SIGTTOU */
 
+#endif /* HANDLE_JOB_SIGNALS */
+
+#if defined (HANDLE_SIGTERM)
   /* Handle SIGTERM if we're not being compiled as part of bash. */
   rl_set_sighandler (SIGTERM, rl_signal_handler, &old_term);
-#endif /* !SHELL */
+#endif /* HANDLE_SIGTERM */
 
 #if defined (SIGWINCH)
   rl_set_sighandler (SIGWINCH, rl_handle_sigwinch, &old_winch);
@@ -309,7 +336,7 @@ rl_clear_signals ()
   rl_sigaction (SIGINT, &old_int, &dummy);
   rl_sigaction (SIGALRM, &old_alrm, &dummy);
 
-#if !defined (SHELL)
+#if defined (HANDLE_JOB_SIGNALS)
 
 #if defined (SIGTSTP)
   rl_sigaction (SIGTSTP, &old_tstp, &dummy);
@@ -320,9 +347,11 @@ rl_clear_signals ()
   rl_sigaction (SIGTTIN, &old_ttin, &dummy);
 #endif /* SIGTTOU */
 
-  rl_sigaction (SIGTERM, &old_term, &dummy);
+#endif /* HANDLE_JOB_SIGNALS */
 
-#endif /* !SHELL */
+#if defined (HANDLE_SIGTERM)
+  rl_sigaction (SIGTERM, &old_term, &dummy);
+#endif /* HANDLE_SIGTERM */
 
 #if defined (SIGWINCH)
   sigemptyset (&dummy.sa_mask);
index 0673288..acb2d76 100644 (file)
@@ -29,6 +29,9 @@
 #endif
 
 #if defined (HAVE_TERMCAP_H)
+#  if defined (__linux__) && !defined (SPEED_T_IN_SYS_TYPES)
+#    include "rltty.h"
+#  endif
 #  include <termcap.h>
 #else
 
index 9ca9bc6..5a8df89 100644 (file)
 /* System-specific feature definitions and include files. */
 #include "rldefs.h"
 
-#include "tcap.h"
-
-#if defined (GWINSZ_IN_SYS_IOCTL)
+#if defined (GWINSZ_IN_SYS_IOCTL) && !defined (TIOCGWINSZ)
 #  include <sys/ioctl.h>
-#endif /* GWINSZ_IN_SYS_IOCTL */
+#endif /* GWINSZ_IN_SYS_IOCTL && !TIOCGWINSZ */
+
+#include "rltty.h"
+#include "tcap.h"
 
 /* Some standard library routines. */
 #include "readline.h"
@@ -69,6 +70,13 @@ extern int readline_echoing_p;
 extern int _rl_bell_preference;
 extern Keymap _rl_keymap;
 
+/* Functions imported from bind.c */
+extern void _rl_bind_if_unbound ();
+
+/* Functions imported from shell.c */
+extern void set_lines_and_columns ();
+extern char *get_env_value ();
+
 /* **************************************************************** */
 /*                                                                 */
 /*                     Terminal and Termcap                        */
@@ -84,8 +92,10 @@ static int tcap_initialized;
 static int dumb_term;
 
 #if !defined (__linux__)
-/* If this causes problems, add back the `extern'. */
-/*extern*/ char PC, *BC, *UP;
+#  if defined (__EMX__) || defined (NEED_EXTERN_PC)
+extern 
+#  endif /* __EMX__ || NEED_EXTERN_PC */
+char PC, *BC, *UP;
 #endif /* __linux__ */
 
 /* Some strings to control terminal actions.  These are output by tputs (). */
@@ -139,45 +149,6 @@ int _rl_enable_keypad;
 /* Non-zero means the user wants to enable a meta key. */
 int _rl_enable_meta = 1;
 
-/* Re-initialize the terminal considering that the TERM/TERMCAP variable
-   has changed. */
-int
-rl_reset_terminal (terminal_name)
-     char *terminal_name;
-{
-  _rl_init_terminal_io (terminal_name);
-  return 0;
-}
-
-#if !defined (SHELL)
-static void
-set_lines_and_columns (lines, cols)
-     int lines, cols;
-{
-  char *b;
-
-#if defined (HAVE_PUTENV)
-  b = xmalloc (24);
-  sprintf (b, "LINES=%d", lines);
-  putenv (b);
-  b = xmalloc (24);
-  sprintf (b, "COLUMNS=%d", cols);
-  putenv (b);
-#else /* !HAVE_PUTENV */
-#  if defined (HAVE_SETENV)
-  b = xmalloc (8);
-  sprintf (b, "%d", lines);
-  setenv ("LINES", b, 1);
-  b = xmalloc (8);
-  sprintf (b, "%d", cols);
-  setenv ("COLUMNS", b, 1);
-#  endif /* HAVE_SETENV */
-#endif /* !HAVE_PUTENV */
-}
-#else /* SHELL */
-extern void set_lines_and_columns ();
-#endif /* SHELL */
-
 /* Get readline's idea of the screen size.  TTY is a file descriptor open
    to the terminal.  If IGNORE_ENV is true, we do not pay attention to the
    values of $LINES and $COLUMNS.  The tests for TERM_STRING_BUFFER being
@@ -190,6 +161,9 @@ _rl_get_screen_size (tty, ignore_env)
 #if defined (TIOCGWINSZ)
   struct winsize window_size;
 #endif /* TIOCGWINSZ */
+#if defined (__EMX__)
+  int sz[2];
+#endif
 
 #if defined (TIOCGWINSZ)
   if (ioctl (tty, TIOCGWINSZ, &window_size) == 0)
@@ -199,11 +173,17 @@ _rl_get_screen_size (tty, ignore_env)
     }
 #endif /* TIOCGWINSZ */
 
+#if defined (__EMX__)
+  _scrsize (sz);
+  screenwidth = sz[0];
+  screenheight = sz[1];
+#endif
+
   /* Environment variable COLUMNS overrides setting of "co" if IGNORE_ENV
      is unset. */
   if (screenwidth <= 0)
     {
-      if (ignore_env == 0 && (ss = getenv ("COLUMNS")))
+      if (ignore_env == 0 && (ss = get_env_value ("COLUMNS")))
        screenwidth = atoi (ss);
 
       if (screenwidth <= 0 && term_string_buffer)
@@ -214,7 +194,7 @@ _rl_get_screen_size (tty, ignore_env)
      is unset. */
   if (screenheight <= 0)
     {
-      if (ignore_env == 0 && (ss = getenv ("LINES")))
+      if (ignore_env == 0 && (ss = get_env_value ("LINES")))
        screenheight = atoi (ss);
 
       if (screenheight <= 0 && term_string_buffer)
@@ -334,7 +314,7 @@ _rl_init_terminal_io (terminal_name)
   int tty;
   Keymap xkeymap;
 
-  term = terminal_name ? terminal_name : getenv ("TERM");
+  term = terminal_name ? terminal_name : get_env_value ("TERM");
 
   if (term_string_buffer == 0)
     term_string_buffer = xmalloc (2032);
@@ -443,6 +423,16 @@ rl_get_termcap (cap)
   return ((char *)NULL);
 }
 
+/* Re-initialize the terminal considering that the TERM/TERMCAP variable
+   has changed. */
+int
+rl_reset_terminal (terminal_name)
+     char *terminal_name;
+{
+  _rl_init_terminal_io (terminal_name);
+  return 0;
+}
+
 /* A function for the use of tputs () */
 int
 _rl_output_character_function (c)
@@ -536,7 +526,7 @@ outchar (c)
   return putc (c, rl_outstream);
 }
 
-int
+void
 _rl_enable_meta_key ()
 {
   if (term_has_meta && term_mm)
index 69f5768..1d38d9d 100644 (file)
 #  include <config.h>
 #endif
 
+#if defined (HAVE_UNISTD_H)
+#  include <unistd.h>
+#endif
+
 #if defined (HAVE_STRING_H)
 #  include <string.h>
 #else /* !HAVE_STRING_H */
 
 #include "tilde.h"
 
+#ifdef SHELL
+#include "shell.h"
+#endif
+
 #if !defined (HAVE_GETPW_DECLS)
 extern struct passwd *getpwuid (), *getpwnam ();
 #endif /* !HAVE_GETPW_DECLS */
@@ -78,6 +86,12 @@ static char *default_prefixes[] =
 static char *default_suffixes[] =
   { " ", "\n", (char *)NULL };
 
+/* If non-null, this contains the address of a function that the application
+   wants called before trying the standard tilde expansions.  The function
+   is called with the text sans tilde, and returns a malloc()'ed string
+   which is the expansion, or a NULL pointer if the expansion fails. */
+CPFunction *tilde_expansion_preexpansion_hook = (CPFunction *)NULL;
+
 /* If non-null, this contains the address of a function to call if the
    standard meaning for expanding a tilde fails.  The function is called
    with the text (sans tilde, as in "foo"), and returns a malloc()'ed string
@@ -108,7 +122,7 @@ tilde_find_prefix (string, len)
   string_len = strlen (string);
   *len = 0;
 
-  if (!*string || *string == '~')
+  if (*string == '\0' || *string == '~')
     return (0);
 
   if (prefixes)
@@ -135,13 +149,14 @@ tilde_find_suffix (string)
      char *string;
 {
   register int i, j, string_len;
-  register char **suffixes = tilde_additional_suffixes;
+  register char **suffixes;
 
+  suffixes = tilde_additional_suffixes;
   string_len = strlen (string);
 
   for (i = 0; i < string_len; i++)
     {
-      if (string[i] == '/' || !string[i])
+      if (string[i] == '/' /* || !string[i] */)
        break;
 
       for (j = 0; suffixes && suffixes[j]; j++)
@@ -153,16 +168,28 @@ tilde_find_suffix (string)
   return (i);
 }
 
+#if !defined (SHELL)
+static char *
+get_string_value (varname)
+     char *varname;
+{
+  return ((char *)getenv (varname));
+}
+#endif
+
 /* Return a new string which is the result of tilde expanding STRING. */
 char *
 tilde_expand (string)
      char *string;
 {
-  char *result, *tilde_expand_word ();
+  char *result;
   int result_size, result_index;
 
-  result_size = result_index = 0;
-  result = (char *)NULL;
+  result_index = result_size = 0;
+  if (result = strchr (string, '~'))
+    result = xmalloc (result_size = (strlen (string) + 16));
+  else
+    result = xmalloc (result_size = strlen (string));
 
   /* Scan through STRING expanding tildes as we come to them. */
   while (1)
@@ -215,97 +242,143 @@ tilde_expand (string)
   return (result);
 }
 
+/* Take FNAME and return the tilde prefix we want expanded.  If LENP is
+   non-null, the index of the end of the prefix into FNAME is returned in
+   the location it points to. */
+static char *
+isolate_tilde_prefix (fname, lenp)
+     char *fname;
+     int *lenp;
+{
+  char *ret;
+  int i;
+
+  ret = xmalloc (strlen (fname));
+  for (i = 1; fname[i] && fname[i] != '/'; i++)
+    ret[i - 1] = fname[i];
+  ret[i - 1] = '\0';
+  if (lenp)
+    *lenp = i;
+  return ret;
+}
+
+/* Return a string that is PREFIX concatenated with SUFFIX starting at
+   SUFFIND. */
+static char *
+glue_prefix_and_suffix (prefix, suffix, suffind)
+     char *prefix, *suffix;
+     int suffind;
+{
+  char *ret;
+  int plen, slen;
+
+  plen = (prefix && *prefix) ? strlen (prefix) : 0;
+  slen = strlen (suffix + suffind);
+  ret = xmalloc (plen + slen + 1);
+  if (prefix && *prefix)
+    strcpy (ret, prefix);
+  strcpy (ret + plen, suffix + suffind);
+  return ret;
+}
+
+static char *
+get_home_dir ()
+{
+  char *home_dir;
+
+#ifdef SHELL
+  home_dir = (char *)NULL;
+  if (current_user.home_dir == 0)
+    get_current_user_info ();
+  home_dir = current_user.home_dir;
+#else
+  struct passwd *entry;
+
+  home_dir = (char *)NULL;
+  entry = getpwuid (getuid ());
+  if (entry)
+    home_dir = entry->pw_dir;
+#endif
+  return (home_dir);
+}
+
 /* Do the work of tilde expansion on FILENAME.  FILENAME starts with a
-   tilde.  If there is no expansion, call tilde_expansion_failure_hook. */
+   tilde.  If there is no expansion, call tilde_expansion_failure_hook.
+   This always returns a newly-allocated string, never static storage. */
 char *
 tilde_expand_word (filename)
      char *filename;
 {
-  char *dirname;
-  char *temp_name;
+  char *dirname, *expansion, *username;
+  int user_len;
+  struct passwd *user_entry;
 
-  if (filename == (char *)0)
+  if (filename == 0)
     return ((char *)NULL);
 
-  dirname = savestring (filename);
-
-  if (*dirname != '~')
-    return (dirname);
+  if (*filename != '~')
+    return (savestring (filename));
 
-  if (!dirname[1] || dirname[1] == '/')
+  /* A leading `~/' or a bare `~' is *always* translated to the value of
+     $HOME or the home directory of the current user, regardless of any
+     preexpansion hook. */
+  if (filename[1] == '\0' || filename[1] == '/')
     {
-      /* Prepend $HOME to the rest of the string. */
-      char *temp_home = (char *)getenv ("HOME");
-      int home_len;
+      /* Prefix $HOME to the rest of the string. */
+      expansion = get_string_value ("HOME");
 
       /* If there is no HOME variable, look up the directory in
         the password database. */
-      if (!temp_home)
-       {
-         struct passwd *entry;
-
-         entry = getpwuid (getuid ());
-         if (entry)
-           temp_home = entry->pw_dir;
-       }
+      if (expansion == 0)
+       expansion = get_home_dir ();
 
-      home_len = temp_home ? strlen (temp_home) : 0;
-      temp_name = xmalloc (1 + strlen (dirname + 1) + home_len);
-                            
-      if (temp_home)
-       strcpy (temp_name, temp_home);
-      strcpy (temp_name + home_len, dirname + 1);
-      free (dirname);
-      dirname = temp_name;
+      return (glue_prefix_and_suffix (expansion, filename, 1));
     }
-  else
-    {
-      char *username;
-      struct passwd *user_entry;
-      int i, len;
 
-      username = xmalloc (strlen (dirname));
-      for (i = 1; dirname[i] && dirname[i] != '/'; i++)
-       username[i - 1] = dirname[i];
-      username[i - 1] = '\0';
+  username = isolate_tilde_prefix (filename, &user_len);
 
-      if ((user_entry = getpwnam (username)) == (struct passwd *)0)
+  if (tilde_expansion_preexpansion_hook)
+    {
+      expansion = (*tilde_expansion_preexpansion_hook) (username);
+      if (expansion)
        {
-         /* If the calling program has a special syntax for
-            expanding tildes, and we couldn't find a standard
-            expansion, then let them try. */
-         if (tilde_expansion_failure_hook)
-           {
-             char *expansion;
-
-             expansion = (*tilde_expansion_failure_hook) (username);
-
-             if (expansion)
-               {
-                 len = strlen (expansion);
-                 temp_name = xmalloc (1 + len + strlen (dirname + i));
-                 strcpy (temp_name, expansion);
-                 strcpy (temp_name + len, dirname + i);
-                 free (expansion);
-                 free (dirname);
-                 dirname = temp_name;
-               }
-           }
-         /* We shouldn't report errors. */
+         dirname = glue_prefix_and_suffix (expansion, filename, user_len);
+         free (username);
+         free (expansion);
+         return (dirname);
        }
-      else
+    }
+
+  /* No preexpansion hook, or the preexpansion hook failed.  Look in the
+     password database. */
+  dirname = (char *)NULL;
+  user_entry = getpwnam (username);
+  if (user_entry == 0)
+    {
+      /* If the calling program has a special syntax for expanding tildes,
+        and we couldn't find a standard expansion, then let them try. */
+      if (tilde_expansion_failure_hook)
        {
-         len = strlen (user_entry->pw_dir);
-         temp_name = xmalloc (1 + len + strlen (dirname + i));
-         strcpy (temp_name, user_entry->pw_dir);
-         strcpy (temp_name + len, dirname + i);
-         free (dirname);
-         dirname = temp_name;
+         expansion = (*tilde_expansion_failure_hook) (username);
+         if (expansion)
+           {
+             dirname = glue_prefix_and_suffix (expansion, filename, user_len);
+             free (expansion);
+           }
        }
-      endpwent ();
       free (username);
+      /* If we don't have a failure hook, or if the failure hook did not
+        expand the tilde, return a copy of what we were passed. */
+      if (dirname == 0)
+       dirname = savestring (filename);
+    }
+  else
+    {
+      free (username);
+      dirname = glue_prefix_and_suffix (user_entry->pw_dir, filename, user_len);
     }
 
+  endpwent ();
   return (dirname);
 }
 
index 6f0898c..634b954 100644 (file)
@@ -33,6 +33,12 @@ typedef char *CPFunction ();
 typedef char **CPPFunction ();
 #endif /* _FUNCTION_DEF */
 
+/* If non-null, this contains the address of a function that the application
+   wants called before trying the standard tilde expansions.  The function
+   is called with the text sans tilde, and returns a malloc()'ed string
+   which is the expansion, or a NULL pointer if the expansion fails. */
+extern CPFunction *tilde_expansion_preexpansion_hook;
+
 /* If non-null, this contains the address of a function to call if the
    standard meaning for expanding a tilde fails.  The function is called
    with the text (sans tilde, as in "foo"), and returns a malloc()'ed string
index af7ccc3..28ebcc8 100644 (file)
@@ -38,7 +38,6 @@
 #  include "ansi_stdlib.h"
 #endif /* HAVE_STDLIB_H */
 
-#include <setjmp.h>
 #include <stdio.h>
 
 /* System-specific feature definitions and include files. */
index f63293a..d96b29e 100644 (file)
 #  include <config.h>
 #endif
 
-#include <stdio.h>
 #include <sys/types.h>
 #include <fcntl.h>
-#include <setjmp.h>
-#include <ctype.h>
+#include "posixjmp.h"
 
 #if defined (HAVE_UNISTD_H)
 #  include <unistd.h>           /* for _POSIX_VERSION */
@@ -41,6 +39,9 @@
 #  include "ansi_stdlib.h"
 #endif /* HAVE_STDLIB_H */
 
+#include <stdio.h>
+#include <ctype.h>
+
 /* System-specific feature definitions and include files. */
 #include "rldefs.h"
 
@@ -55,7 +56,7 @@
 
 /* Pseudo-globals imported from readline.c */
 extern int readline_echoing_p;
-extern jmp_buf readline_top_level;
+extern procenv_t readline_top_level;
 extern int rl_line_buffer_len;
 extern Function *rl_last_func;
 
@@ -243,20 +244,6 @@ _rl_qsort_string_compare (s1, s2)
 #endif
 }
 
-#if !defined (SHELL)
-#ifdef savestring
-#undef savestring
-#endif
-/* Backwards compatibility, now that savestring has been removed from
-   all `public' readline header files. */
-char *
-savestring (s)
-     char *s;
-{
-  return ((char *)strcpy (xmalloc (1 + (int)strlen (s)), (s)));
-}
-#endif /* !SHELL */
-
 /* Function equivalents for the macros defined in chartypes.h. */
 #undef _rl_uppercase_p
 int
index acecee3..c151036 100644 (file)
@@ -20,15 +20,17 @@ RM = rm
 CP = cp
 MV = mv
 
-CFLAGS = @CFLAGS@ @LOCAL_CFLAGS@
+CFLAGS = @CFLAGS@
+LOCAL_CFLAGS = @LOCAL_CFLAGS@
 CPPFLAGS = @CPPFLAGS@
 LDFLAGS = @LDFLAGS@ @LOCAL_LDFLAGS@
 
 DEFS = @DEFS@
+LOCAL_DEFS = @LOCAL_DEFS@
 
 INCLUDES = -I. -I../.. -I$(topdir) -I$(topdir)/lib
 
-CCFLAGS = $(CFLAGS) $(DEFS) $(CPPFLAGS) ${INCLUDES}
+CCFLAGS = $(DEFS) $(LOCAL_DEFS) $(CPPFLAGS) ${INCLUDES} $(LOCAL_CFLAGS) $(CFLAGS)
 
 .c.o:
        $(CC) -c $(CCFLAGS) $<
@@ -94,5 +96,5 @@ mostlyclean: clean
 #                                                                   #
 ######################################################################
 
-tilde.o: tilde.h tilde.c
+tilde.o: tilde.h $(topdir)/ansi_stdlib.h
 tilde.o: $(BUILD_DIR)/config.h
index 69f5768..1d38d9d 100644 (file)
 #  include <config.h>
 #endif
 
+#if defined (HAVE_UNISTD_H)
+#  include <unistd.h>
+#endif
+
 #if defined (HAVE_STRING_H)
 #  include <string.h>
 #else /* !HAVE_STRING_H */
 
 #include "tilde.h"
 
+#ifdef SHELL
+#include "shell.h"
+#endif
+
 #if !defined (HAVE_GETPW_DECLS)
 extern struct passwd *getpwuid (), *getpwnam ();
 #endif /* !HAVE_GETPW_DECLS */
@@ -78,6 +86,12 @@ static char *default_prefixes[] =
 static char *default_suffixes[] =
   { " ", "\n", (char *)NULL };
 
+/* If non-null, this contains the address of a function that the application
+   wants called before trying the standard tilde expansions.  The function
+   is called with the text sans tilde, and returns a malloc()'ed string
+   which is the expansion, or a NULL pointer if the expansion fails. */
+CPFunction *tilde_expansion_preexpansion_hook = (CPFunction *)NULL;
+
 /* If non-null, this contains the address of a function to call if the
    standard meaning for expanding a tilde fails.  The function is called
    with the text (sans tilde, as in "foo"), and returns a malloc()'ed string
@@ -108,7 +122,7 @@ tilde_find_prefix (string, len)
   string_len = strlen (string);
   *len = 0;
 
-  if (!*string || *string == '~')
+  if (*string == '\0' || *string == '~')
     return (0);
 
   if (prefixes)
@@ -135,13 +149,14 @@ tilde_find_suffix (string)
      char *string;
 {
   register int i, j, string_len;
-  register char **suffixes = tilde_additional_suffixes;
+  register char **suffixes;
 
+  suffixes = tilde_additional_suffixes;
   string_len = strlen (string);
 
   for (i = 0; i < string_len; i++)
     {
-      if (string[i] == '/' || !string[i])
+      if (string[i] == '/' /* || !string[i] */)
        break;
 
       for (j = 0; suffixes && suffixes[j]; j++)
@@ -153,16 +168,28 @@ tilde_find_suffix (string)
   return (i);
 }
 
+#if !defined (SHELL)
+static char *
+get_string_value (varname)
+     char *varname;
+{
+  return ((char *)getenv (varname));
+}
+#endif
+
 /* Return a new string which is the result of tilde expanding STRING. */
 char *
 tilde_expand (string)
      char *string;
 {
-  char *result, *tilde_expand_word ();
+  char *result;
   int result_size, result_index;
 
-  result_size = result_index = 0;
-  result = (char *)NULL;
+  result_index = result_size = 0;
+  if (result = strchr (string, '~'))
+    result = xmalloc (result_size = (strlen (string) + 16));
+  else
+    result = xmalloc (result_size = strlen (string));
 
   /* Scan through STRING expanding tildes as we come to them. */
   while (1)
@@ -215,97 +242,143 @@ tilde_expand (string)
   return (result);
 }
 
+/* Take FNAME and return the tilde prefix we want expanded.  If LENP is
+   non-null, the index of the end of the prefix into FNAME is returned in
+   the location it points to. */
+static char *
+isolate_tilde_prefix (fname, lenp)
+     char *fname;
+     int *lenp;
+{
+  char *ret;
+  int i;
+
+  ret = xmalloc (strlen (fname));
+  for (i = 1; fname[i] && fname[i] != '/'; i++)
+    ret[i - 1] = fname[i];
+  ret[i - 1] = '\0';
+  if (lenp)
+    *lenp = i;
+  return ret;
+}
+
+/* Return a string that is PREFIX concatenated with SUFFIX starting at
+   SUFFIND. */
+static char *
+glue_prefix_and_suffix (prefix, suffix, suffind)
+     char *prefix, *suffix;
+     int suffind;
+{
+  char *ret;
+  int plen, slen;
+
+  plen = (prefix && *prefix) ? strlen (prefix) : 0;
+  slen = strlen (suffix + suffind);
+  ret = xmalloc (plen + slen + 1);
+  if (prefix && *prefix)
+    strcpy (ret, prefix);
+  strcpy (ret + plen, suffix + suffind);
+  return ret;
+}
+
+static char *
+get_home_dir ()
+{
+  char *home_dir;
+
+#ifdef SHELL
+  home_dir = (char *)NULL;
+  if (current_user.home_dir == 0)
+    get_current_user_info ();
+  home_dir = current_user.home_dir;
+#else
+  struct passwd *entry;
+
+  home_dir = (char *)NULL;
+  entry = getpwuid (getuid ());
+  if (entry)
+    home_dir = entry->pw_dir;
+#endif
+  return (home_dir);
+}
+
 /* Do the work of tilde expansion on FILENAME.  FILENAME starts with a
-   tilde.  If there is no expansion, call tilde_expansion_failure_hook. */
+   tilde.  If there is no expansion, call tilde_expansion_failure_hook.
+   This always returns a newly-allocated string, never static storage. */
 char *
 tilde_expand_word (filename)
      char *filename;
 {
-  char *dirname;
-  char *temp_name;
+  char *dirname, *expansion, *username;
+  int user_len;
+  struct passwd *user_entry;
 
-  if (filename == (char *)0)
+  if (filename == 0)
     return ((char *)NULL);
 
-  dirname = savestring (filename);
-
-  if (*dirname != '~')
-    return (dirname);
+  if (*filename != '~')
+    return (savestring (filename));
 
-  if (!dirname[1] || dirname[1] == '/')
+  /* A leading `~/' or a bare `~' is *always* translated to the value of
+     $HOME or the home directory of the current user, regardless of any
+     preexpansion hook. */
+  if (filename[1] == '\0' || filename[1] == '/')
     {
-      /* Prepend $HOME to the rest of the string. */
-      char *temp_home = (char *)getenv ("HOME");
-      int home_len;
+      /* Prefix $HOME to the rest of the string. */
+      expansion = get_string_value ("HOME");
 
       /* If there is no HOME variable, look up the directory in
         the password database. */
-      if (!temp_home)
-       {
-         struct passwd *entry;
-
-         entry = getpwuid (getuid ());
-         if (entry)
-           temp_home = entry->pw_dir;
-       }
+      if (expansion == 0)
+       expansion = get_home_dir ();
 
-      home_len = temp_home ? strlen (temp_home) : 0;
-      temp_name = xmalloc (1 + strlen (dirname + 1) + home_len);
-                            
-      if (temp_home)
-       strcpy (temp_name, temp_home);
-      strcpy (temp_name + home_len, dirname + 1);
-      free (dirname);
-      dirname = temp_name;
+      return (glue_prefix_and_suffix (expansion, filename, 1));
     }
-  else
-    {
-      char *username;
-      struct passwd *user_entry;
-      int i, len;
 
-      username = xmalloc (strlen (dirname));
-      for (i = 1; dirname[i] && dirname[i] != '/'; i++)
-       username[i - 1] = dirname[i];
-      username[i - 1] = '\0';
+  username = isolate_tilde_prefix (filename, &user_len);
 
-      if ((user_entry = getpwnam (username)) == (struct passwd *)0)
+  if (tilde_expansion_preexpansion_hook)
+    {
+      expansion = (*tilde_expansion_preexpansion_hook) (username);
+      if (expansion)
        {
-         /* If the calling program has a special syntax for
-            expanding tildes, and we couldn't find a standard
-            expansion, then let them try. */
-         if (tilde_expansion_failure_hook)
-           {
-             char *expansion;
-
-             expansion = (*tilde_expansion_failure_hook) (username);
-
-             if (expansion)
-               {
-                 len = strlen (expansion);
-                 temp_name = xmalloc (1 + len + strlen (dirname + i));
-                 strcpy (temp_name, expansion);
-                 strcpy (temp_name + len, dirname + i);
-                 free (expansion);
-                 free (dirname);
-                 dirname = temp_name;
-               }
-           }
-         /* We shouldn't report errors. */
+         dirname = glue_prefix_and_suffix (expansion, filename, user_len);
+         free (username);
+         free (expansion);
+         return (dirname);
        }
-      else
+    }
+
+  /* No preexpansion hook, or the preexpansion hook failed.  Look in the
+     password database. */
+  dirname = (char *)NULL;
+  user_entry = getpwnam (username);
+  if (user_entry == 0)
+    {
+      /* If the calling program has a special syntax for expanding tildes,
+        and we couldn't find a standard expansion, then let them try. */
+      if (tilde_expansion_failure_hook)
        {
-         len = strlen (user_entry->pw_dir);
-         temp_name = xmalloc (1 + len + strlen (dirname + i));
-         strcpy (temp_name, user_entry->pw_dir);
-         strcpy (temp_name + len, dirname + i);
-         free (dirname);
-         dirname = temp_name;
+         expansion = (*tilde_expansion_failure_hook) (username);
+         if (expansion)
+           {
+             dirname = glue_prefix_and_suffix (expansion, filename, user_len);
+             free (expansion);
+           }
        }
-      endpwent ();
       free (username);
+      /* If we don't have a failure hook, or if the failure hook did not
+        expand the tilde, return a copy of what we were passed. */
+      if (dirname == 0)
+       dirname = savestring (filename);
+    }
+  else
+    {
+      free (username);
+      dirname = glue_prefix_and_suffix (user_entry->pw_dir, filename, user_len);
     }
 
+  endpwent ();
   return (dirname);
 }
 
index 6f0898c..634b954 100644 (file)
@@ -33,6 +33,12 @@ typedef char *CPFunction ();
 typedef char **CPPFunction ();
 #endif /* _FUNCTION_DEF */
 
+/* If non-null, this contains the address of a function that the application
+   wants called before trying the standard tilde expansions.  The function
+   is called with the text sans tilde, and returns a malloc()'ed string
+   which is the expansion, or a NULL pointer if the expansion fails. */
+extern CPFunction *tilde_expansion_preexpansion_hook;
+
 /* If non-null, this contains the address of a function to call if the
    standard meaning for expanding a tilde fails.  The function is called
    with the text (sans tilde, as in "foo"), and returns a malloc()'ed string
diff --git a/list.c b/list.c
index d70a67b..794b664 100644 (file)
--- a/list.c
+++ b/list.c
@@ -96,6 +96,7 @@ list_append (head, tail)
   return (head);
 }
 
+#ifdef INCLUDE_UNUSED
 /* Delete the element of LIST which satisfies the predicate function COMPARER.
    Returns the element that was deleted, so you can dispose of it, or -1 if
    the element wasn't found.  COMPARER is called with the list element and
@@ -126,3 +127,4 @@ delete_element (list, comparer, arg)
     }
   return ((GENERIC_LIST *)&global_error_list);
 }
+#endif
index 1589012..8d3f833 100644 (file)
@@ -291,9 +291,10 @@ make_default_mailpath ()
 {
   char *mp;
 
-  mp = xmalloc (1 + sizeof (DEFAULT_MAIL_DIRECTORY) + strlen (current_user.user_name));
+  mp = xmalloc (2 + sizeof (DEFAULT_MAIL_DIRECTORY) + strlen (current_user.user_name));
   strcpy (mp, DEFAULT_MAIL_DIRECTORY);
-  strcpy (mp + sizeof (DEFAULT_MAIL_DIRECTORY) - 1, current_user.user_name);
+  mp[sizeof(DEFAULT_MAIL_DIRECTORY) - 1] = '/';
+  strcpy (mp + sizeof (DEFAULT_MAIL_DIRECTORY), current_user.user_name);
   return (mp);
 }
 
index d17b4d8..c0da8bf 100644 (file)
@@ -100,6 +100,7 @@ make_word (string)
   return (make_word_flags (temp, string));
 }
 
+#ifdef INCLUDE_UNUSED
 WORD_DESC *
 make_word_from_token (token)
      int token;
@@ -111,6 +112,7 @@ make_word_from_token (token)
 
   return (make_word (tokenizer));
 }
+#endif
 
 WORD_LIST *
 make_word_list (word, link)
@@ -466,24 +468,27 @@ make_redirection (source, instruction, dest_and_filename)
   switch (instruction)
     {
 
-    case r_output_direction:   /* >foo */
-    case r_output_force:       /* >| foo */
+    case r_output_direction:           /* >foo */
+    case r_output_force:               /* >| foo */
+    case r_err_and_out:                        /* command &>filename */
       temp->flags = O_TRUNC | O_WRONLY | O_CREAT;
       break;
 
-    case r_input_direction:    /* <foo */
-    case r_inputa_direction:   /* foo & makes this. */
-      temp->flags = O_RDONLY;
+    case r_appending_to:               /* >>foo */
+      temp->flags = O_APPEND | O_WRONLY | O_CREAT;
       break;
 
-    case r_appending_to:       /* >>foo */
-      temp->flags = O_APPEND | O_WRONLY | O_CREAT;
+    case r_input_direction:            /* <foo */
+    case r_inputa_direction:           /* foo & makes this. */
+      temp->flags = O_RDONLY;
       break;
 
-    case r_deblank_reading_until: /* <<-foo */
-    case r_reading_until:      /* << foo */
+    case r_input_output:               /* <>foo */
+      temp->flags = O_RDWR | O_CREAT;
       break;
 
+    case r_deblank_reading_until:      /* <<-foo */
+    case r_reading_until:              /* << foo */
     case r_close_this:                 /* <&- */
     case r_duplicating_input:          /* 1<&2 */
     case r_duplicating_output:         /* 1>&2 */
@@ -491,14 +496,6 @@ make_redirection (source, instruction, dest_and_filename)
     case r_duplicating_output_word:    /* 1>&$foo */
       break;
 
-    case r_err_and_out:                /* command &>filename */
-      temp->flags = O_TRUNC | O_WRONLY | O_CREAT;
-      break;
-
-    case r_input_output:
-      temp->flags = O_RDWR | O_CREAT;
-      break;
-
     default:
       programming_error ("make_redirection: redirection instruction `%d' out of range", instruction);
       abort ();
index ba210bb..442ed1a 100644 (file)
 #      include <alloca.h>
 #    endif /* !IBMESA */
 #  else  /* !HAVE_ALLOCA_H */
-#    if defined (hpux_9) && defined (__STDC__) && !defined (alloca)
+#    if defined (__hpux) && defined (__STDC__) && !defined (alloca)
 extern void *alloca ();
 #    else
 #      if !defined (alloca)
 extern char *alloca ();
 #      endif /* !alloca */
-#    endif /* !hpux_9 || !__STDC__ && !alloca */
+#    endif /* !__hpux || !__STDC__ && !alloca */
 #  endif /* !HAVE_ALLOCA_H */
 #endif /* !__GNUC__ */
 
index c203ce8..e5f2838 100644 (file)
--- a/nojobs.c
+++ b/nojobs.c
 #  endif /* !TERMIO_TTY_DRIVER */
 #endif /* TERMIOS_TTY_DRIVER */
 
+#if !defined (STRUCT_WINSIZE_IN_SYS_IOCTL)
 /* For struct winsize on SCO */
 /*   sys/ptem.h has winsize but needs mblk_t from sys/stream.h */
-#if defined (HAVE_SYS_PTEM_H) && defined (TIOCGWINSZ) && defined (SIGWINCH)
-#  if defined (HAVE_SYS_STREAM_H)
-#    include <sys/stream.h>
-#  endif
-#  include <sys/ptem.h>
-#endif
+#  if defined (HAVE_SYS_PTEM_H) && defined (TIOCGWINSZ) && defined (SIGWINCH)
+#    if defined (HAVE_SYS_STREAM_H)
+#      include <sys/stream.h>
+#    endif
+#    include <sys/ptem.h>
+#  endif /* HAVE_SYS_PTEM_H && TIOCGWINSZ && SIGWINCH */
+#endif /* !STRUCT_WINSIZE_IN_SYS_IOCTL */
 
 #if defined (_POSIX_VERSION) || !defined (HAVE_KILLPG)
 #  define killpg(pg, sig)              kill(-(pg),(sig))
 #  define WAITPID(pid, statusp, options) wait (statusp)
 #endif /* !HAVE_WAITPID */
 
+/* Return the fd from which we are actually getting input. */
+#define input_tty() (shell_tty != -1) ? shell_tty : fileno (stderr)
+
 #if !defined (errno)
 extern int errno;
 #endif /* !errno */
 
+#if defined (READLINE)
+extern void _rl_set_screen_size (); 
+#endif    
+
 extern int interactive, interactive_shell, login_shell;
 extern int subshell_environment;
 extern int last_command_exit_value;
@@ -98,6 +107,9 @@ pid_t last_asynchronous_pid = NO_PID;
 /* Call this when you start making children. */
 int already_making_children = 0;
 
+/* The controlling tty for this shell. */
+int shell_tty = -1;
+
 /* If this is non-zero, $LINES and $COLUMNS are reset after every process
    exits from get_tty_state(). */
 int check_window_size;
@@ -223,9 +235,13 @@ cleanup_dead_jobs ()
 }
 
 /* Initialize the job control mechanism, and set up the tty stuff. */
-initialize_jobs ()
+initialize_job_control (force)
+     int force;
 {
-  get_tty_state ();
+  shell_tty = fileno (stderr);
+
+  if (interactive)
+    get_tty_state ();
 }
 
 #if defined (TIOCGWINSZ) && defined (SIGWINCH)
@@ -238,7 +254,7 @@ get_new_window_size (from_sig)
   struct winsize win;
   int tty;
 
-  tty = open ("/dev/tty", O_RDONLY);
+  tty = input_tty ();
   if (tty >= 0 && (ioctl (tty, TIOCGWINSZ, &win) == 0) &&
       win.ws_row > 0 && win.ws_col > 0)
     {
@@ -250,7 +266,6 @@ get_new_window_size (from_sig)
       _rl_set_screen_size (win.ws_row, win.ws_col);
 #endif
     }
-  close (tty);
 }
 
 static sighandler
@@ -578,8 +593,13 @@ wait_for (pid)
   else
     return_val = WEXITSTATUS (status);
 
-  if (!WIFSTOPPED (status) && WIFSIGNALED (status) &&
-      (WTERMSIG (status) != SIGINT))
+#if !defined (DONT_REPORT_SIGPIPE)
+  if ((WIFSTOPPED (status) == 0) && WIFSIGNALED (status) &&
+       (WTERMSIG (status) != SIGINT))
+#else
+  if ((WIFSTOPPED (status) == 0) && WIFSIGNALED (status) &&
+       (WTERMSIG (status) != SIGINT) && (WTERMSIG (status) != SIGPIPE))
+#endif
     {
       fprintf (stderr, "%s", strsignal (WTERMSIG (status)));
       if (WIFCORED (status))
@@ -634,7 +654,7 @@ get_tty_state ()
 {
   int tty;
 
-  tty = open ("/dev/tty", O_RDONLY);
+  tty = input_tty ();
   if (tty != -1)
     {
 #if defined (TERMIOS_TTY_DRIVER)
@@ -646,7 +666,6 @@ get_tty_state ()
       ioctl (tty, TIOCGETP, &shell_tty_info);
 #  endif
 #endif
-      close (tty);
       got_tty_state = 1;
       if (check_window_size)
        get_new_window_size (0);
@@ -658,14 +677,12 @@ set_tty_state ()
 {
   int tty;
 
-  tty = open ("/dev/tty", O_RDONLY);
+  tty = input_tty ();
   if (tty != -1)
     {
       if (got_tty_state == 0)
-       {
-         close (tty);
-         return;
-       }
+       return;
+
 #if defined (TERMIOS_TTY_DRIVER)
       tcsetattr (tty, TCSADRAIN, &shell_tty_info);
 #else
@@ -675,7 +692,6 @@ set_tty_state ()
       ioctl (tty, TIOCSETN, &shell_tty_info);
 #  endif
 #endif
-      close (tty);
     }
 }
 
@@ -699,6 +715,17 @@ start_pipeline ()
   already_making_children = 1;
 }
 
+int
+get_job_by_pid (pid, block)
+     pid_t pid;
+     int block;
+{
+  int i;
+
+  i = find_index_by_pid (pid);
+  return ((i == NO_PID) ? PROC_BAD : i);
+}
+
 /* Print descriptive information about the job with leader pid PID. */
 void
 describe_pid (pid)
diff --git a/oslib.c b/oslib.c
index ef643ff..b17a731 100644 (file)
--- a/oslib.c
+++ b/oslib.c
@@ -105,7 +105,7 @@ strrchr (string, c)
 #if !defined (HAVE_STRCASECMP)
 
 #if !defined (to_lower)
-#  define to_lower(c) (islower(c) ? (c) : toupper(c))
+#  define to_lower(c) (islower(c) ? (c) : tolower(c))
 #endif /* to_lower */
 
 /* Compare at most COUNT characters from string1 to string2.  Case
@@ -280,9 +280,10 @@ bzero (s, n)
      int n;
 {
   register int i;
+  register char *r;
 
-  for (i = 0; i < n; i++)
-    s[i] = '\0';
+  for (i = 0, r = s; i < n; i++)
+    *r++ = '\0';
 }
 #endif
 
diff --git a/parse.y b/parse.y
index 1a949b0..f0e7659 100644 (file)
--- a/parse.y
+++ b/parse.y
@@ -102,15 +102,20 @@ static char *localeexpand ();
 static int reserved_word_acceptable ();
 static int read_token ();
 static int yylex ();
+static int parse_arith_cmd ();
 static int read_token_word ();
 static void discard_parser_constructs ();
 
 static void report_syntax_error ();
 static void handle_eof_input_unit ();
 static void prompt_again ();
+#if 0
 static void reset_readline_prompt ();
+#endif
 static void print_prompt ();
 
+extern int yyerror ();
+
 /* Default prompt strings */
 char *primary_prompt = PPROMPT;
 char *secondary_prompt = SPROMPT;
@@ -478,17 +483,17 @@ shell_command:    for_command
                        { $$ = $1; }
        ;
 
-for_command:   FOR WORD newline_list DO list DONE
+for_command:   FOR WORD newline_list DO compound_list DONE
                        { $$ = make_for_command ($2, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), $5); }
-       |       FOR WORD newline_list '{' list '}'
+       |       FOR WORD newline_list '{' compound_list '}'
                        { $$ = make_for_command ($2, add_string_to_list ("$@", (WORD_LIST *)NULL), $5); }
-       |       FOR WORD ';' newline_list DO list DONE
+       |       FOR WORD ';' newline_list DO compound_list DONE
                        { $$ = make_for_command ($2, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), $6); }
-       |       FOR WORD ';' newline_list '{' list '}'
+       |       FOR WORD ';' newline_list '{' compound_list '}'
                        { $$ = make_for_command ($2, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), $6); }
-       |       FOR WORD newline_list IN word_list list_terminator newline_list DO list DONE
+       |       FOR WORD newline_list IN word_list list_terminator newline_list DO compound_list DONE
                        { $$ = make_for_command ($2, REVERSE_LIST ($5, WORD_LIST *), $9); }
-       |       FOR WORD newline_list IN word_list list_terminator newline_list '{' list '}'
+       |       FOR WORD newline_list IN word_list list_terminator newline_list '{' compound_list '}'
                        { $$ = make_for_command ($2, REVERSE_LIST ($5, WORD_LIST *), $9); }
        ;
 
@@ -745,6 +750,7 @@ timespec:   TIME
 
 /* Initial size to allocate for tokens, and the
    amount to grow them by. */
+#define TOKEN_DEFAULT_INITIAL_SIZE 496
 #define TOKEN_DEFAULT_GROW_SIZE 512
 
 /* Shell meta-characters that, when unquoted, separate words. */
@@ -826,7 +832,7 @@ initialize_bash_input ()
 void
 init_yy_io (get, unget, type, name, location)
      Function *get, *unget;
-     int type;
+     enum stream_type type;
      char *name;
      INPUT_STREAM location;
 {
@@ -1222,7 +1228,8 @@ push_string (s, expand, ap)
   temp->next = pushed_string_list;
   pushed_string_list = temp;
 
-  ap->flags |= AL_BEINGEXPANDED;
+  if (ap)
+    ap->flags |= AL_BEINGEXPANDED;
 
   shell_input_line = s;
   shell_input_line_size = strlen (s);
@@ -1256,7 +1263,8 @@ pop_string ()
   t = pushed_string_list;
   pushed_string_list = pushed_string_list->next;
 
-  t->expander->flags &= ~AL_BEINGEXPANDED;
+  if (t->expander)
+    t->expander->flags &= ~AL_BEINGEXPANDED;
 
   free ((char *)t);
 }
@@ -1539,18 +1547,19 @@ shell_getc (remove_quoted_newline)
 #  if defined (BANG_HISTORY)
          history_expansion_inhibited = old_hist;
 #  endif
-
-         free (shell_input_line);
-         shell_input_line = expansions;
-         shell_input_line_len = shell_input_line ?
-                                strlen (shell_input_line) :
-                                0;
-         if (!shell_input_line_len)
-           current_command_line_count--;
-
-         /* We have to force the xrealloc below because we don't know the
-            true allocated size of shell_input_line anymore. */
-         shell_input_line_size = shell_input_line_len;
+         if (expansions != shell_input_line)
+           {
+             free (shell_input_line);
+             shell_input_line = expansions;
+             shell_input_line_len = shell_input_line ?
+                                       strlen (shell_input_line) : 0;
+             if (!shell_input_line_len)
+               current_command_line_count--;
+
+             /* We have to force the xrealloc below because we don't know
+                the true allocated size of shell_input_line anymore. */
+             shell_input_line_size = shell_input_line_len;
+           }
        }
       /* XXX - this is grotesque */
       else if (remember_on_history && shell_input_line &&
@@ -1685,7 +1694,7 @@ execute_prompt_command (command)
   if (last_lastarg)
     last_lastarg = savestring (last_lastarg);
 
-  parse_and_execute (savestring (command), "PROMPT_COMMAND", 0);
+  parse_and_execute (savestring (command), "PROMPT_COMMAND", SEVAL_NONINT|SEVAL_NOHIST);
 
   last_shell_builtin = temp_last;
   this_shell_builtin = temp_this;
@@ -1976,7 +1985,10 @@ read_token (command)
     {
       result = token_to_read;
       if (token_to_read == WORD || token_to_read == ASSIGNMENT_WORD)
-       yylval.word = word_desc_to_read;
+       {
+         yylval.word = word_desc_to_read;
+         word_desc_to_read = (WORD_DESC *)NULL;
+       }
       token_to_read = 0;
       return (result);
     }
@@ -2066,9 +2078,29 @@ read_token (command)
            case '(':           /* ) */
              if (reserved_word_acceptable (last_read_token))
                {
-                 parser_state |= PST_DBLPAREN;
-                 yylval.word = make_word ("let");
-                 return (WORD);          
+                 int cmdtyp, sline;
+                 char *wval;
+
+                 sline = line_number;
+                 cmdtyp = parse_arith_cmd (&wval);
+                 if (cmdtyp == 1)      /* arithmetic command */
+                   {
+                     word_desc_to_read = make_word (wval);
+                     word_desc_to_read->flags = W_QUOTED;
+                     token_to_read = WORD;
+                     free (wval);
+                     yylval.word = make_word ("let");
+                     return (WORD);
+                   }
+                 else if (cmdtyp == 0) /* nested subshell */
+                   {
+                     push_string (wval, 0, (alias_t *)NULL);
+                     if ((parser_state & PST_CASEPAT) == 0)
+                       parser_state |= PST_SUBSHELL;
+                     return (character);
+                   }
+                 else                  /* ERROR */
+                   return -1;
                }
              break;
 #endif
@@ -2284,6 +2316,52 @@ parse_matched_pair (qc, open, close, lenp, flags)
   return ret;
 }
 
+#if defined (DPAREN_ARITHMETIC)
+/* We've seen a `(('.  Look for the matching `))'.  If we get it, return 1.
+   If not, assume it's a nested subshell for backwards compatibility and
+   return 0.  In any case, put the characters we've consumed into a locally-
+   allocated buffer and make *ep point to that buffer.  Return -1 on an
+   error, for example EOF. */
+static int
+parse_arith_cmd (ep)
+     char **ep;
+{
+  int exp_lineno, rval, c;
+  char *ttok, *token;
+  int ttoklen;
+
+  exp_lineno = line_number;
+  ttok = parse_matched_pair (0, '(', ')', &ttoklen, 0);
+  rval = 1;
+  if (ttok == &matched_pair_error)
+    return -1;
+  /* Check that the next character is the closing right paren.  If
+     not, this is a syntax error. ( */
+  if ((c = shell_getc (0)) != ')')
+    rval = 0;
+
+  token = xmalloc(ttoklen + 4);
+
+  /* (( ... )) -> "..." */
+  token[0] = (rval == 1) ? '"' : '(';
+  strncpy (token + 1, ttok, ttoklen - 1);      /* don't copy the final `)' */
+  if (rval == 1)
+    {
+      token[ttoklen] = '"';
+      token[ttoklen+1] = '\0';
+    }
+  else
+    {
+      token[ttoklen] = ')';
+      token[ttoklen+1] = c;
+      token[ttoklen+2] = '\0';
+    }
+  *ep = token;
+  FREE (ttok);
+  return rval;
+}
+#endif /* DPAREN_ARITHMETIC */
+
 static int
 read_token_word (character)
      int character;
@@ -2313,11 +2391,8 @@ read_token_word (character)
   char *ttok, *ttrans;
   int ttoklen, ttranslen;
 
-  if (token_buffer_size < TOKEN_DEFAULT_GROW_SIZE)
-    {
-      FREE (token);
-      token = xmalloc (token_buffer_size = TOKEN_DEFAULT_GROW_SIZE);
-    }
+  if (token_buffer_size < TOKEN_DEFAULT_INITIAL_SIZE)
+    token = xrealloc (token, token_buffer_size = TOKEN_DEFAULT_INITIAL_SIZE);
 
   token_index = 0;
   all_digits = digit (character);
@@ -2363,45 +2438,6 @@ read_token_word (character)
            }
        }
 
-#if defined (DPAREN_ARITHMETIC)
-      /* Parse a ksh-style ((...)) expression. */
-      if (parser_state & PST_DBLPAREN)
-       {
-         int exp_lineno;
-
-         /* If we've already consumed a right paren that should be part of
-            the expression, push it back so the paren matching code won't
-            return prematurely. */
-         if (character == '(')         /* ) */
-           shell_ungetc (character);
-         exp_lineno = line_number;
-         ttok = parse_matched_pair (0, '(', ')', &ttoklen, 0);
-         parser_state &= ~PST_DBLPAREN;
-         if (ttok == &matched_pair_error)
-           return -1;
-         /* Check that the next character is the closing right paren.  If
-            not, this is a syntax error. ( */
-         if (shell_getc (0) != ')')
-           {
-             FREE (ttok);      /* ( */
-             parser_error (exp_lineno, "missing closing `)' for arithmetic expression");
-             return -1;
-           }
-         RESIZE_MALLOCED_BUFFER (token, token_index, ttoklen + 4,
-                                 token_buffer_size, TOKEN_DEFAULT_GROW_SIZE);
-         token[token_index++] = '"';
-         if (character != '(')         /* ) */
-           token[token_index++] = character;
-         strncpy (token + token_index, ttok, ttoklen - 1);
-         token_index += ttoklen - 1;
-         token[token_index++] = '"';
-         FREE (ttok);
-         dollar_present = all_digits = 0;
-         quoted = 1;
-         goto got_token;
-       }
-#endif /* DPAREN_ARITHMETIC */
-
       /* Parse a matched pair of quote characters. */
       if (shellquote (character))
        {
@@ -2438,7 +2474,16 @@ read_token_word (character)
              if (peek_char == '{')             /* } */
                ttok = parse_matched_pair (cd, '{', '}', &ttoklen, 0);
              else if (peek_char == '(')                /* ) */
-               ttok = parse_matched_pair (cd, '(', ')', &ttoklen, 0);
+               {
+                 /* XXX - push and pop the `(' as a delimiter for use by
+                    the command-oriented-history code.  This way newlines
+                    appearing in the $(...) string get added to the
+                    history literally rather than causing a possibly-
+                    incorrect `;' to be added. */
+                 push_delimiter (dstack, peek_char);
+                 ttok = parse_matched_pair (cd, '(', ')', &ttoklen, 0);
+                 pop_delimiter (dstack);
+               }
              else
                ttok = parse_matched_pair (cd, '[', ']', &ttoklen, 0);
              if (ttok == &matched_pair_error)
@@ -2636,10 +2681,8 @@ ansiexpand (string, start, end, lenp)
 
   if (*temp)
     {
-      t = ansicstr (temp, tlen, (int *)NULL);
+      t = ansicstr (temp, tlen, (int *)NULL, lenp);
       free (temp);
-      if (lenp)
-       *lenp = strlen (t);
       return (t);
     }
   else
@@ -2893,7 +2936,7 @@ print_prompt ()
        \[      begin a sequence of non-printing chars
        \]      end a sequence of non-printing chars
 */
-#define PROMPT_GROWTH 50
+#define PROMPT_GROWTH 48
 char *
 decode_prompt_string (string)
      char *string;
index e69de29..2acc11c 100644 (file)
@@ -0,0 +1,45 @@
+typedef union {
+  WORD_DESC *word;             /* the word that we read. */
+  int number;                  /* the number that we read. */
+  WORD_LIST *word_list;
+  COMMAND *command;
+  REDIRECT *redirect;
+  ELEMENT element;
+  PATTERN_LIST *pattern;
+} YYSTYPE;
+#define        IF      258
+#define        THEN    259
+#define        ELSE    260
+#define        ELIF    261
+#define        FI      262
+#define        CASE    263
+#define        ESAC    264
+#define        FOR     265
+#define        SELECT  266
+#define        WHILE   267
+#define        UNTIL   268
+#define        DO      269
+#define        DONE    270
+#define        FUNCTION        271
+#define        IN      272
+#define        BANG    273
+#define        TIME    274
+#define        TIMEOPT 275
+#define        WORD    276
+#define        ASSIGNMENT_WORD 277
+#define        NUMBER  278
+#define        AND_AND 279
+#define        OR_OR   280
+#define        GREATER_GREATER 281
+#define        LESS_LESS       282
+#define        LESS_AND        283
+#define        GREATER_AND     284
+#define        SEMI_SEMI       285
+#define        LESS_LESS_MINUS 286
+#define        AND_GREATER     287
+#define        LESS_GREATER    288
+#define        GREATER_BAR     289
+#define        yacc_EOF        290
+
+
+extern YYSTYPE yylval;
index 6404514..138f9d6 100644 (file)
--- a/pathexp.c
+++ b/pathexp.c
@@ -285,6 +285,7 @@ ignore_globbed_names (names, name_func)
   for (n = 0; newnames[n]; n++)
     names[n] = newnames[n];
   names[n] = (char *)NULL;
+  free (newnames);
 }
 
 void
index 8b0e5bc..7480a93 100644 (file)
@@ -42,7 +42,7 @@
 #  define D_NAMLEN(d)   ((d)->d_namlen)
 #endif /* !HAVE_DIRENT_H */
 
-#if defined (STRUCT_DIRENT_HAS_D_INO)
+#if defined (STRUCT_DIRENT_HAS_D_INO) && !defined (STRUCT_DIRENT_HAS_D_FILENO)
 #  define d_fileno d_ino
 #endif
 
diff --git a/posixjmp.h b/posixjmp.h
new file mode 100644 (file)
index 0000000..8703d17
--- /dev/null
@@ -0,0 +1,20 @@
+/* posixjmp.h -- wrapper for setjmp.h with changes for POSIX systems. */
+
+#ifndef _POSIXJMP_H_
+#define _POSIXJMP_H_
+
+#include <setjmp.h>
+
+/* This *must* be included *after* config.h */
+
+#if defined (HAVE_POSIX_SIGSETJMP)
+#  define procenv_t    sigjmp_buf
+#  undef setjmp
+#  define setjmp(x)    sigsetjmp((x), 1)
+#  undef longjmp
+#  define longjmp(x, n)        siglongjmp((x), (n))
+#else
+#  define procenv_t    jmp_buf
+#endif
+
+#endif /* _POSIXJMP_H_ */
diff --git a/posixwait.h b/posixwait.h
new file mode 100644 (file)
index 0000000..65d6c14
--- /dev/null
@@ -0,0 +1,103 @@
+/* posixwait.h -- job control definitions from POSIX 1003.1 */
+
+/* Copyright (C) 1997 Free Software Foundation, Inc.
+
+   This file is part of GNU Bash, the Bourne Again SHell.
+
+   Bash is free software; you can redistribute it and/or modify it under
+   the terms of the GNU General Public License as published by the Free
+   Software Foundation; either version 2, or (at your option) any later
+   version.
+
+   Bash is distributed in the hope that it will be useful, but WITHOUT ANY
+   WARRANTY; without even the implied warranty of MERCHANTABILITY or
+   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+   for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with Bash; see the file COPYING.  If not, write to the Free Software
+   Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#if !defined (_POSIXWAIT_H_)
+#  define _POSIXWAIT_H_
+
+/* If _POSIX_VERSION is not defined, we assume that <sys/wait.h> defines
+   a `union wait' and various macros used to manipulate it.  Look in
+   unionwait.h for the things we expect to find. */
+#if defined (HAVE_SYS_WAIT_H)
+#  include <sys/wait.h>
+#else /* !HAVE_SYS_WAIT_H */
+#  if !defined (_POSIX_VERSION)
+#    include "unionwait.h"
+#  endif
+#endif  /* !HAVE_SYS_WAIT_H */
+
+/* How to get the status of a job.  For Posix, this is just an
+   int, but for other systems we have to crack the union wait. */
+#if !defined (_POSIX_VERSION)
+typedef union wait WAIT;
+#  define WSTATUS(t)  (t.w_status)
+#else /* _POSIX_VERSION */
+typedef int WAIT;
+#  define WSTATUS(t)  (t)
+#endif /* _POSIX_VERSION */
+
+/* Make sure that parameters to wait3 are defined. */
+#if !defined (WNOHANG)
+#  define WNOHANG 1
+#  define WUNTRACED 2
+#endif /* WNOHANG */
+
+/* More Posix P1003.1 definitions.  In the POSIX versions, the parameter is
+   passed as an `int', in the non-POSIX version, as `union wait'. */
+#if defined (_POSIX_VERSION)
+
+#  if !defined (WSTOPSIG)
+#    define WSTOPSIG(s)       ((s) >> 8)
+#  endif /* !WSTOPSIG */
+
+#  if !defined (WTERMSIG)
+#    define WTERMSIG(s)              ((s) & 0177)
+#  endif /* !WTERMSIG */
+
+#  if !defined (WEXITSTATUS)
+#    define WEXITSTATUS(s)    ((s) >> 8)
+#  endif /* !WEXITSTATUS */
+
+#  if !defined (WIFSTOPPED)
+#    define WIFSTOPPED(s)     (((s) & 0177) == 0177)
+#  endif /* !WIFSTOPPED */
+
+#  if !defined (WIFEXITED)
+#    define WIFEXITED(s)      (((s) & 0377) == 0)
+#  endif /* !WIFEXITED */
+
+#  if !defined (WIFSIGNALED)
+#    define WIFSIGNALED(s)    (!WIFSTOPPED(s) && !WIFEXITED(s))
+#  endif /* !WIFSIGNALED */
+
+#  if !defined (WIFCORED)
+#    define WIFCORED(s)       ((s) & 0200)
+#  endif /* !WIFCORED */
+
+#else /* !_POSIX_VERSION */
+
+#  if !defined (WSTOPSIG)
+#    define WSTOPSIG(s)              ((s).w_stopsig)
+#  endif /* !WSTOPSIG */
+
+#  if !defined (WTERMSIG)
+#    define WTERMSIG(s)              ((s).w_termsig)
+#  endif /* !WTERMSIG */
+
+#  if !defined (WEXITSTATUS)
+#    define WEXITSTATUS(s)    ((s).w_retcode)
+#  endif /* !WEXITSTATUS */
+
+#  if !defined (WIFCORED)
+#    define WIFCORED(s)       ((s).w_coredump)
+#  endif /* !WIFCORED */
+
+#endif /* !_POSIX_VERSION */
+
+#endif /* !_POSIXWAIT_H_ */
index 4b95d8f..642d3cd 100644 (file)
@@ -36,7 +36,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
 #include "bashansi.h"
 
 #include "shell.h"
-#include "y.tab.h"
+#include <y.tab.h>     /* use <...> so we pick it up from the build directory */
 #include "stdc.h"
 #include "builtins/common.h"
 
@@ -47,7 +47,11 @@ extern int printf __P((const char *, ...));  /* Yuck.  Double yuck. */
 static int indentation;
 static int indentation_amount = 4;
 
+#if defined (PREFER_STDARG)
 static void cprintf __P((char *, ...));
+#else
+static void cprintf ();
+#endif
 
 static void newline (), indent (), the_printed_command_resize ();
 static void semicolon ();
@@ -71,7 +75,8 @@ static void print_until_or_while ();
 static void print_if_command ();
 static void print_function_def ();
 
-#define PRINTED_COMMAND_GROW_SIZE 1024
+#define PRINTED_COMMAND_INITIAL_SIZE 64
+#define PRINTED_COMMAND_GROW_SIZE 128
 
 char *the_printed_command = (char *)NULL;
 int the_printed_command_size = 0;
@@ -80,6 +85,7 @@ int command_string_index = 0;
 /* Non-zero means the stuff being printed is inside of a function def. */
 static int inside_function_def;
 static int skip_this_indent;
+static int was_heredoc;
 
 /* The depth of the group commands that we are currently printing.  This
    includes the group command that is a function body. */
@@ -102,7 +108,7 @@ char *
 make_command_string (command)
      COMMAND *command;
 {
-  command_string_index = 0;
+  command_string_index = was_heredoc = 0;
   make_command_string_internal (command);
   return (the_printed_command);
 }
@@ -125,7 +131,11 @@ make_command_string_internal (command)
        cprintf ("( ");
 
       if (command->flags & CMD_TIME_PIPELINE)
-       cprintf ("time ");
+       {
+         cprintf ("time ");
+         if (command->flags & CMD_TIME_POSIX)
+           cprintf ("-p ");
+       }
 
       if (command->flags & CMD_INVERT_RETURN)
        cprintf ("! ");
@@ -195,7 +205,10 @@ make_command_string_internal (command)
              break;
 
            case ';':
-             cprintf (";");
+             if (was_heredoc == 0)
+               cprintf (";");
+             else
+               was_heredoc = 0;
 
              if (inside_function_def)
                cprintf ("\n");
@@ -458,23 +471,62 @@ static void
 print_redirection_list (redirects)
      REDIRECT *redirects;
 {
+  REDIRECT *heredocs, *hdtail, *newredir;
+
+  heredocs = (REDIRECT *)NULL;
+  hdtail = heredocs;
+
+  was_heredoc = 0;
   while (redirects)
     {
-      print_redirection (redirects);
+      /* Defer printing the here documents until we've printed the
+        rest of the redirections. */
+      if (redirects->instruction == r_reading_until || redirects->instruction == r_deblank_reading_until)
+       {
+         newredir = copy_redirect (redirects);
+         newredir->next = (REDIRECT *)NULL;
+         if (heredocs)
+           {
+             hdtail->next = newredir;
+             hdtail = newredir;
+           }
+         else
+           hdtail = heredocs = newredir;
+       }
+      else
+       print_redirection (redirects);
+
       redirects = redirects->next;
       if (redirects)
        cprintf (" ");
     }
+
+  /* Now that we've printed all the other redirections (on one line),
+     print the here documents. */
+  if (heredocs)
+    {
+      cprintf (" "); 
+      for (hdtail = heredocs; hdtail; hdtail = hdtail->next)
+        {
+         print_redirection (hdtail);
+         cprintf ("\n");
+        }
+      dispose_redirects (heredocs);
+      was_heredoc = 1;
+    }
 }
 
 static void
 print_redirection (redirect)
      REDIRECT *redirect;
 {
-  int kill_leading = 0;
-  int redirector = redirect->redirector;
-  WORD_DESC *redirectee = redirect->redirectee.filename;
-  int redir_fd = redirect->redirectee.dest;
+  int kill_leading, redirector, redir_fd;
+  WORD_DESC *redirectee;
+
+  kill_leading = 0;
+  redirectee = redirect->redirectee.filename;
+  redirector = redirect->redirector;
+  redir_fd = redirect->redirectee.dest;
 
   switch (redirect->instruction)
     {
@@ -605,7 +657,7 @@ named_function_string (name, command, multi_line)
 
   old_indent = indentation;
   old_amount = indentation_amount;
-  command_string_index = 0;
+  command_string_index = was_heredoc = 0;
 
   if (name && *name)
     cprintf ("%s ", name);
@@ -861,9 +913,9 @@ static void
 the_printed_command_resize (length)
      int length;
 {
-  if (!the_printed_command)
+  if (the_printed_command == 0)
     {
-      the_printed_command_size = length + 1;
+      the_printed_command_size = (length + PRINTED_COMMAND_INITIAL_SIZE - 1) & ~(PRINTED_COMMAND_INITIAL_SIZE - 1);
       the_printed_command = xmalloc (the_printed_command_size);
       command_string_index = 0;
     }
@@ -871,8 +923,13 @@ the_printed_command_resize (length)
     {
       int new;
       new = command_string_index + length + 1;
+#if 1
+      /* Round up to the next multiple of PRINTED_COMMAND_GROW_SIZE. */
+      new = (new + PRINTED_COMMAND_GROW_SIZE - 1) & ~(PRINTED_COMMAND_GROW_SIZE - 1);
+#else
       new = new + 2 * PRINTED_COMMAND_GROW_SIZE - 1;
       new -= new % PRINTED_COMMAND_GROW_SIZE;
+#endif
       the_printed_command_size = new;
       the_printed_command = xrealloc (the_printed_command, the_printed_command_size);
     }
@@ -881,14 +938,22 @@ the_printed_command_resize (length)
 #if defined (HAVE_VFPRINTF)
 
 static void
-xprintf (va_alist)
+#if defined (PREFER_STDARG)
+xprintf (const char *format, ...)
+#else
+xprintf (format, va_alist)
+     const char *format;
      va_dcl
+#endif
 {
   va_list args;
-  char *format;
 
+#if defined (PREFER_STDARG)
+  va_start (args, format);
+#else
   va_start (args);
-  format = va_arg (args, char *);
+#endif
+
   vfprintf (stdout, format, args);
   va_end (args);
 }
diff --git a/shell.c b/shell.c
index 84932ee..1ec100c 100644 (file)
--- a/shell.c
+++ b/shell.c
@@ -318,7 +318,7 @@ main (argc, argv, env)
 
   if (want_initial_help)
     {
-      show_shell_usage (stdout);
+      show_shell_usage (stdout, 1);
       exit (EXECUTION_SUCCESS);
     }
 
@@ -342,11 +342,6 @@ main (argc, argv, env)
   if (dump_translatable_strings)
     read_but_dont_execute = 1;
 
-  /* If we're in a strict Posix.2 mode, turn on interactive comments and
-     other Posix.2 things. */
-  if (posixly_correct)
-    posix_initialize (posixly_correct);
-
   if (running_setuid && privileged_mode == 0)
     disable_priv_mode ();
 
@@ -400,6 +395,17 @@ main (argc, argv, env)
     }
 #endif /* CLOSE_FDS_AT_LOGIN */
 
+  /* If we're in a strict Posix.2 mode, turn on interactive comments and
+     other Posix.2 things. */
+  if (posixly_correct)
+    {
+      posix_initialize (posixly_correct);
+#if defined (READLINE)
+      if (interactive_shell)
+       posix_readline_initialize (posixly_correct);
+#endif
+    }
+
   /* From here on in, the shell must be a normal functioning shell.
      Variables from the environment are expected to be set, etc. */
   shell_initialize ();
@@ -428,7 +434,13 @@ main (argc, argv, env)
       if (code == EXITPROG)
        exit_shell (last_command_exit_value);
       else
-       locally_skip_execution++;
+       {
+#if defined (JOB_CONTROL)
+         /* Reset job control, since run_startup_files turned it off. */
+         set_job_control (interactive_shell);
+#endif
+         locally_skip_execution++;
+       }
     }
 
   arg_index = top_level_arg_index;
@@ -452,7 +464,13 @@ main (argc, argv, env)
 
   /* If we are invoked as `sh', turn on Posix mode. */
   if (act_like_sh)
-    posix_initialize (posixly_correct = 1);
+    {
+      posix_initialize (posixly_correct = 1);
+#if defined (READLINE)
+      if (interactive_shell)
+        posix_readline_initialize (posixly_correct);
+#endif
+    }
 
 #if defined (RESTRICTED_SHELL)
   /* Turn on the restrictions after parsing the startup files. */
@@ -568,6 +586,7 @@ parse_long_options (argv, arg_start, arg_end)
          if (longarg)
            {
              report_error ("%s: unrecognized option", argv[arg_index]);
+             show_shell_usage (stderr, 0);
              exit (EX_USAGE);
            }
          break;                /* No such argument.  Maybe flag arg. */
@@ -621,7 +640,7 @@ parse_shell_options (argv, arg_start, arg_end)
              o_option = argv[next_arg];
              if (o_option == 0)
                {
-                 list_minus_o_opts ();
+                 list_minus_o_opts (-1);
                  break;
                }
              if (set_minus_o_option (on_or_off, o_option) != EXECUTION_SUCCESS)
@@ -637,6 +656,7 @@ parse_shell_options (argv, arg_start, arg_end)
              if (change_flag (arg_character, on_or_off) == FLAG_ERROR)
                {
                  report_error ("%c%c: unrecognized option", on_or_off, arg_character);
+                 show_shell_usage (stderr, 0);
                  exit (EX_USAGE);
                }
            }
@@ -730,6 +750,10 @@ execute_env_file (env_file)
 static void
 run_startup_files ()
 {
+#if defined (JOB_CONTROL)
+  int old_job_control;
+#endif
+
   /* get the rshd case out of the way first. */
   if (interactive_shell == 0 && no_rc == 0 && login_shell == 0 &&
       act_like_sh == 0 && local_pending_command && isnetconn (fileno (stdin)))
@@ -753,6 +777,11 @@ run_startup_files ()
       return;
     }
 
+#if defined (JOB_CONTROL)
+  /* Startup files should be run without job control enabled. */
+  old_job_control = set_job_control (0);
+#endif
+
   /* Interactive shell or `-su' shell. */
   if (posixly_correct == 0)              /* bash, sh */
     {
@@ -791,6 +820,10 @@ run_startup_files ()
       if (interactive_shell && privileged_mode == 0 && sourced_env++ == 0)
         execute_env_file (get_string_value ("ENV"));
     }
+
+#if defined (JOB_CONTROL)
+  set_job_control (old_job_control);
+#endif
 }
 
 #if defined (RESTRICTED_SHELL)
@@ -880,7 +913,7 @@ run_one_command (command)
          programming_error ("run_one_command: bad jump: code %d", code);
        }
     }
-   return (parse_and_execute (savestring (command), "-c", -1));
+   return (parse_and_execute (savestring (command), "-c", SEVAL_NOHIST));
 }
 #endif /* ONESHOT */
 
@@ -902,6 +935,7 @@ bind_args (argv, arg_start, arg_end, start_index)
          /* Posix.2 4.56.3 says that the first argument after sh -c command
             becomes $0, and the rest of the arguments become $1...$n */
          shell_name = savestring (args->word->word);
+         FREE (dollar_vars[0]);
          dollar_vars[0] = savestring (args->word->word);
          remember_args (args->next, 1);
        }
@@ -924,10 +958,11 @@ static int
 open_shell_script (script_name)
      char *script_name;
 {
-  int fd;
+  int fd, e;
   char *filename, *path_filename;
   unsigned char sample[80];
   int sample_len;
+  struct stat sb;
 
   free (dollar_vars[0]);
   dollar_vars[0] = savestring (script_name);
@@ -936,6 +971,7 @@ open_shell_script (script_name)
   fd = open (filename, O_RDONLY);
   if ((fd < 0) && (errno == ENOENT) && (absolute_program (filename) == 0))
     {
+      e = errno;
       /* If it's not in the current directory, try looking through PATH
         for it. */
       path_filename = find_path_file (script_name);
@@ -945,11 +981,13 @@ open_shell_script (script_name)
          filename = path_filename;
          fd = open (filename, O_RDONLY);
        }
+      else
+       errno = e;
     }
 
   if (fd < 0)
     {
-      int e = errno;
+      e = errno;
       file_error (filename);
       exit ((e == ENOENT) ? EX_NOTFOUND : EX_NOINPUT);
     }
@@ -961,7 +999,19 @@ open_shell_script (script_name)
         according to the same tests done by execute_simple_command (),
         and report an error and exit if it is. */
       sample_len = read (fd, sample, sizeof (sample));
-      if (sample_len > 0 && (check_binary_file (sample, sample_len)))
+      if (sample_len < 0)
+       {
+         e = errno;
+         if ((fstat (fd, &sb) == 0) && S_ISDIR (sb.st_mode))
+           internal_error ("%s: is a directory", filename);
+          else
+           {
+             errno = e;
+             file_error (filename);
+           }
+         exit (EX_NOEXEC);
+       }
+      else if (sample_len > 0 && (check_binary_file (sample, sample_len)))
        {
          internal_error ("%s: cannot execute binary file", filename);
          exit (EX_BINARY_FILE);
@@ -972,17 +1022,20 @@ open_shell_script (script_name)
 
 #if defined (BUFFERED_INPUT)
   default_buffered_input = fd;
+#  if 0
+  /* This is never executed. */
   if (default_buffered_input == -1)
     {
       file_error (filename);
       exit (EX_NOTFOUND);
     }
+#  endif
   SET_CLOSE_ON_EXEC (default_buffered_input);
 #else /* !BUFFERED_INPUT */
   /* Open the script.  But try to move the file descriptor to a randomly
      large one, in the hopes that any descriptors used by the script will
       not match with ours. */
-  fd = move_to_high_fd (fd, 0);
+  fd = move_to_high_fd (fd, 0, -1);
 
   default_input = fdopen (fd, "r");
 
@@ -998,6 +1051,7 @@ open_shell_script (script_name)
 #endif /* !BUFFERED_INPUT */
 
   if (interactive_shell == 0 || isatty (fd) == 0)
+    /* XXX - does this really need to be called again here? */
     init_noninteractive ();
   else
     {
@@ -1102,12 +1156,38 @@ init_noninteractive ()
 #endif /* JOB_CONTROL */
 }
 
+void
+get_current_user_info ()
+{
+  struct passwd *entry;
+
+  /* Don't fetch this more than once. */
+  if (current_user.user_name == 0)
+    {
+      entry = getpwuid (current_user.uid);
+      if (entry)
+       {
+         current_user.user_name = savestring (entry->pw_name);
+         current_user.shell = (entry->pw_shell && entry->pw_shell[0])
+                               ? savestring (entry->pw_shell)
+                               : savestring ("/bin/sh");
+         current_user.home_dir = savestring (entry->pw_dir);
+       }
+      else
+       {
+         current_user.user_name = savestring ("I have no name!");
+         current_user.shell = savestring ("/bin/sh");
+         current_user.home_dir = savestring ("/");
+       }
+      endpwent ();
+    }
+}
+
 /* Do whatever is necessary to initialize the shell.
    Put new initializations in here. */
 static void
 shell_initialize ()
 {
-  struct passwd *entry;
   char hostname[256];
 
   /* Line buffer output for stderr and stdout. */
@@ -1128,33 +1208,18 @@ shell_initialize ()
   /* It's highly unlikely that this will change. */
   if (current_host_name == 0)
     {
-      /* Initialize current_user.name and current_host_name. */
+      /* Initialize current_host_name. */
       if (gethostname (hostname, 255) < 0)
        current_host_name = "??host??";
       else
        current_host_name = savestring (hostname);
     }
 
-  /* Don't fetch this more than once. */
-  if (current_user.user_name == 0)
-    {
-      entry = getpwuid (current_user.uid);
-      if (entry)
-       {
-         current_user.user_name = savestring (entry->pw_name);
-         current_user.shell = (entry->pw_shell && entry->pw_shell[0])
-                               ? savestring (entry->pw_shell)
-                               : savestring ("/bin/sh");
-         current_user.home_dir = savestring (entry->pw_dir);
-       }
-      else
-       {
-         current_user.user_name = savestring ("I have no name!");
-         current_user.shell = savestring ("/bin/sh");
-         current_user.home_dir = savestring ("/");
-       }
-      endpwent ();
-    }
+  /* Initialize the stuff in current_user that comes from the password
+     file.  We don't need to do this right away if the shell is not
+     interactive. */
+  if (interactive_shell)
+    get_current_user_info ();
 
   /* Initialize our interface to the tilde expander. */
   tilde_initialize ();
@@ -1168,11 +1233,13 @@ shell_initialize ()
   initialize_shell_variables (shell_environment, privileged_mode||running_setuid);
 #endif
 
+#if 0
   /* Initialize filename hash tables. */
   initialize_filename_hashing ();
+#endif
 
   /* Initialize the data structures for storing and running jobs. */
-  initialize_jobs ();
+  initialize_job_control (0);
 
   /* Initialize input streams to null. */
   initialize_bash_input ();
@@ -1230,13 +1297,15 @@ shell_reinitialize ()
 }
 
 static void
-show_shell_usage (fp)
+show_shell_usage (fp, extra)
      FILE *fp;
+     int extra;
 {
   int i;
   char *set_opts, *s, *t;
 
-  fprintf (fp, "GNU bash, version %s-(%s)\n", shell_version_string (), MACHTYPE);
+  if (extra)
+    fprintf (fp, "GNU bash, version %s-(%s)\n", shell_version_string (), MACHTYPE);
   fprintf (fp, "Usage:\t%s [GNU long option] [option] ...\n\t%s [GNU long option] [option] script-file ...\n",
             shell_name, shell_name);
   fputs ("GNU long options:\n", fp);
@@ -1263,9 +1332,12 @@ show_shell_usage (fp)
       free (set_opts);
     }
 
-  fprintf (fp, "Type `%s -c \"help set\"' for more information about shell options.\n", shell_name);
-  fprintf (fp, "Type `%s -c help' for more information about shell builtin commands.\n", shell_name);
-  fprintf (fp, "Use the `bashbug' command to report bugs.\n");
+  if (extra)
+    {
+      fprintf (fp, "Type `%s -c \"help set\"' for more information about shell options.\n", shell_name);
+      fprintf (fp, "Type `%s -c help' for more information about shell builtin commands.\n", shell_name);
+      fprintf (fp, "Use the `bashbug' command to report bugs.\n");
+    }
 }
 
 /* The second and subsequent conditions must match those used to decide
diff --git a/shell.h b/shell.h
index 0b1623e..681c64d 100644 (file)
--- a/shell.h
+++ b/shell.h
@@ -116,8 +116,8 @@ struct fd_bitmap {
 
 /* Information about the current user. */
 struct user_info {
-  int uid, euid;
-  int gid, egid;
+  uid_t uid, euid;
+  gid_t gid, egid;
   char *user_name;
   char *shell;         /* shell from the password file */
   char *home_dir;
diff --git a/sig.c b/sig.c
index d0243f7..025487f 100644 (file)
--- a/sig.c
+++ b/sig.c
@@ -68,12 +68,12 @@ sigset_t top_level_mask;
 /* When non-zero, we throw_to_top_level (). */
 int interrupt_immediately = 0;
 
-static void initialize_terminating_signals ();
+static void initialize_shell_signals ();
 
 void
 initialize_signals ()
 {
-  initialize_terminating_signals ();
+  initialize_shell_signals ();
   initialize_job_signals ();
 #if !defined (HAVE_SYS_SIGLIST) && !defined (HAVE_STRSIGNAL)
   initialize_siglist ();
@@ -83,7 +83,7 @@ initialize_signals ()
 void
 reinitialize_signals ()
 {
-  initialize_terminating_signals ();
+  initialize_shell_signals (1);
   initialize_job_signals ();
 }
 
@@ -191,20 +191,27 @@ static struct termsig terminating_signals[] = {
 #define XSIG(x) (terminating_signals[x].signum)
 #define XHANDLER(x) (terminating_signals[x].orig_handler)
 
+static int termsigs_initialized = 0;
+
 /* Initialize signals that will terminate the shell to do some
-   unwind protection. */
-static void
+   unwind protection.  For non-interactive shells, we only call
+   this when a trap is defined for EXIT (0). */
+void
 initialize_terminating_signals ()
 {
   register int i;
+#if defined (HAVE_POSIX_SIGNALS)
+  struct sigaction act, oact;
+#endif
+
+  if (termsigs_initialized)
+    return;
 
   /* The following code is to avoid an expensive call to
      set_signal_handler () for each terminating_signals.  Fortunately,
      this is possible in Posix.  Unfortunately, we have to call signal ()
      on non-Posix systems for each signal in terminating_signals. */
 #if defined (HAVE_POSIX_SIGNALS)
-  struct sigaction act, oact;
-
   act.sa_handler = termination_unwind_protect;
   act.sa_flags = 0;
   sigemptyset (&act.sa_mask);
@@ -214,33 +221,45 @@ initialize_terminating_signals ()
   for (i = 0; i < TERMSIGS_LENGTH; i++)
     {
       sigaction (XSIG (i), &act, &oact);
-      terminating_signals[i].orig_handler = oact.sa_handler;
+      XHANDLER(i) = oact.sa_handler;
       /* Don't do anything with signals that are ignored at shell entry
         if the shell is not interactive. */
-      if (!interactive_shell && oact.sa_handler == SIG_IGN)
+      if (!interactive_shell && XHANDLER (i) == SIG_IGN)
         {
          sigaction (XSIG (i), &oact, &act);
          set_signal_ignored (XSIG (i));
         }
+      if (XSIG (i) == SIGPROF && XHANDLER (i) != SIG_DFL && XHANDLER (i) != SIG_IGN)
+        sigaction (XSIG (i), &oact, (struct sigaction *)NULL);
     }
 
 #else /* !HAVE_POSIX_SIGNALS */
 
   for (i = 0; i < TERMSIGS_LENGTH; i++)
     {
-      terminating_signals[i].orig_handler =
-       signal (XSIG (i), termination_unwind_protect);
+      XHANDLER(i) = signal (XSIG (i), termination_unwind_protect);
       /* Don't do anything with signals that are ignored at shell entry
         if the shell is not interactive. */
-      if (!interactive_shell && terminating_signals[i].orig_handler == SIG_IGN)
+      if (!interactive_shell && XHANDLER (i) == SIG_IGN)
        {
           signal (XSIG (i), SIG_IGN);
           set_signal_ignored (XSIG (i));
        }
+      if (XSIG (i) == SIGPROF && XHANDLER (i) != SIG_DFL && XHANDLER (i) != SIG_IGN)
+        signal (XSIG (i), XHANDLER (i));
     }
 
 #endif /* !HAVE_POSIX_SIGNALS */
 
+  termsigs_initialized = 1;
+}
+
+static void
+initialize_shell_signals ()
+{
+  if (interactive)
+    initialize_terminating_signals ();
+
 #if defined (JOB_CONTROL) || defined (HAVE_POSIX_SIGNALS)
   /* All shells use the signal mask they inherit, and pass it along
      to child processes.  Children will never block SIGCHLD, though. */
@@ -263,10 +282,14 @@ void
 reset_terminating_signals ()
 {
   register int i;
-
 #if defined (HAVE_POSIX_SIGNALS)
   struct sigaction act;
+#endif
 
+  if (termsigs_initialized == 0)
+    return;
+
+#if defined (HAVE_POSIX_SIGNALS)
   act.sa_flags = 0;
   sigemptyset (&act.sa_mask);
   for (i = 0; i < TERMSIGS_LENGTH; i++)
diff --git a/sig.h b/sig.h
index 3819533..b878040 100644 (file)
--- a/sig.h
+++ b/sig.h
@@ -111,6 +111,7 @@ extern sighandler termination_unwind_protect __P((int));
 extern sighandler sigint_sighandler __P((int));
 extern void initialize_signals __P((void));
 extern void reinitialize_signals __P((void));
+extern void initialize_terminating_signals __P((void));
 extern void reset_terminating_signals __P((void));
 extern void throw_to_top_level __P((void));
 extern void jump_to_top_level __P((int));
index cb45205..6d6a93d 100644 (file)
--- a/siglist.c
+++ b/siglist.c
@@ -23,7 +23,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
 #if !defined (HAVE_SYS_SIGLIST) && !defined (HAVE_STRSIGNAL)
 
 #include <stdio.h>
-#include <sys/types.h>
+#include "bashtypes.h"
 #include <signal.h>
 
 #include "siglist.h"
@@ -210,6 +210,10 @@ initialize_siglist ()
   sys_siglist[SIGSOUND] = "HFT sound sequence has completed";
 #endif
 
+#if defined (SIGINFO)
+  sys_siglist[SIGINFO] = "Information request";
+#endif
+
   for (i = 0; i < NSIG; i++)
     {
       if (!sys_siglist[i])
index 7bc8b49..71d4268 100644 (file)
@@ -43,9 +43,9 @@
    as a string terminator.  If we see \c, set *SAWC to 1 before
    returning.  LEN is the length of STRING. */
 char *
-ansicstr (string, len, sawc)
+ansicstr (string, len, sawc, rlen)
      char *string;
-     int len, *sawc;
+     int len, *sawc, *rlen;
 {
   int c;
   char *ret, *r, *s;
@@ -93,6 +93,8 @@ ansicstr (string, len, sawc)
                {
                  *sawc = 1;
                  *r = '\0';
+                 if (rlen)
+                   *rlen = r - ret;
                  return ret;
                }
            default:  *r++ = '\\'; break;
@@ -101,6 +103,8 @@ ansicstr (string, len, sawc)
        }
     }
   *r = '\0';
+  if (rlen)
+    *rlen = r - ret;
   return ret;
 }
 
@@ -307,6 +311,7 @@ strsub (string, pat, rep, global)
   return (temp);
 }
 
+#ifdef INCLUDE_UNUSED
 /* Remove all leading whitespace from STRING.  This includes
    newlines.  STRING should be terminated with a zero. */
 void
@@ -325,17 +330,17 @@ strip_leading (string)
       start[len] = '\0';
     }
 }
+#endif
 
 /* Remove all trailing whitespace from STRING.  This includes
    newlines.  If NEWLINES_ONLY is non-zero, only trailing newlines
    are removed.  STRING should be terminated with a zero. */
 void
-strip_trailing (string, newlines_only)
+strip_trailing (string, len, newlines_only)
      char *string;
+     int len;
      int newlines_only;
 {
-  int len = strlen (string) - 1;
-
   while (len >= 0)
     {
       if ((newlines_only && string[len] == '\n') ||
diff --git a/subst.c b/subst.c
index 054258e..72d2314 100644 (file)
--- a/subst.c
+++ b/subst.c
 #include "pathexp.h"
 #include "mailcheck.h"
 
+#if !defined (HAVE_RESTARTABLE_SYSCALLS)       /* for getc_with_restart */
+#include "input.h"
+#endif
+
 #include "builtins/getopt.h"
 #include "builtins/common.h"
 
@@ -65,12 +69,14 @@ extern int errno;
 #endif /* !errno */
 
 /* The size that strings change by. */
+#define DEFAULT_INITIAL_ARRAY_SIZE 112
 #define DEFAULT_ARRAY_SIZE 128
 
 /* Variable types. */
 #define VT_VARIABLE    0
 #define VT_POSPARMS    1
 #define VT_ARRAYVAR    2
+#define VT_ARRAYMEMBER 3
 
 /* Flags for quoted_strchr */
 #define ST_BACKSL      0x01
@@ -274,6 +280,7 @@ quote_escapes (string)
   return (result);
 }
 
+#ifdef INCLUDE_UNUSED
 static char *
 dequote_escapes (string)
      char *string;
@@ -295,6 +302,7 @@ dequote_escapes (string)
   *t = '\0';
   return result;
 }
+#endif
 
 /* Extract a substring from STRING, starting at SINDEX and ending with
    one of the characters in CHARLIST.  Don't make the ending character
@@ -1473,6 +1481,30 @@ maybe_expand_string (string, quoted, func)
   return ret;
 }
 
+static inline char *
+expand_string_to_string (string, quoted, func)
+     char *string;
+     int quoted;
+     WORD_LIST *(*func)();
+{
+  WORD_LIST *list;
+  char *ret;
+
+  if (string == 0 || *string == '\0')
+    return ((char *)NULL);
+
+  list = (*func) (string, quoted);
+  if (list)
+    {
+      ret = string_list (list);
+      dispose_words (list);
+    }
+  else
+    ret = (char *)NULL;
+
+  return (ret);
+}
+
 #if defined (ARRAY_VARS)
 SHELL_VAR *
 do_array_element_assignment (name, value)
@@ -1559,7 +1591,10 @@ do_assignment_internal (string, expand)
     }
 
   if (value == 0)
-    value = savestring ("");
+    {
+      value = xmalloc (1);
+      value[0] = '\0';
+    }
 
   if (echo_command_at_execute)
 #if defined (ARRAY_VARS)
@@ -1569,7 +1604,7 @@ do_assignment_internal (string, expand)
 #endif
     fprintf (stderr, "%s%s=%s\n", indirection_level_string (), name, value);
 
-#define ASSIGN_RETURN(r)       FREE (value); free (name); return (r);
+#define ASSIGN_RETURN(r)       do { FREE (value); free (name); return (r); } while (0)
 
 #if defined (ARRAY_VARS)
   if (t = strchr (name, '['))
@@ -1734,9 +1769,16 @@ call_expand_word_internal (w, q, c, e)
 
   result = expand_word_internal (w, q, c, e);
   if (result == &expand_word_error)
-    jump_to_top_level (DISCARD);
+    {
+      /* By convention, each time this error is returned, w->word has
+        already been freed. */
+      w->word = (char *)NULL;
+      jump_to_top_level (DISCARD);
+      /* NOTREACHED */
+    }
   else if (result == &expand_word_fatal)
     jump_to_top_level (FORCE_EOF);
+    /* NOTREACHED */
   else
     return (result);
 }
@@ -1754,7 +1796,7 @@ expand_string_internal (string, quoted)
   if (string == 0 || *string == 0)
     return ((WORD_LIST *)NULL);
 
-  bzero (&td, sizeof (td));
+  bzero ((char *)&td, sizeof (td));
   td.word = string;
   tresult = call_expand_word_internal (&td, quoted, (int *)NULL, (int *)NULL);
   return (tresult);
@@ -1825,7 +1867,7 @@ expand_string_for_rhs (string, quoted, dollar_at_p, has_dollar_at)
   if (string == 0 || *string == '\0')
     return (WORD_LIST *)NULL;
 
-  bzero (&td, sizeof (td));
+  bzero ((char *)&td, sizeof (td));
   td.word = string;
   tresult = call_expand_word_internal (&td, quoted, dollar_at_p, has_dollar_at);
   return (tresult);
@@ -2079,9 +2121,12 @@ static int
 match_pattern_char (pat, string)
      char *pat, *string;
 {
+#if 0
   register char *np;
   int neg;
-  char c, c1;
+  char c1;
+#endif
+  char c;
 
   if (*string == 0)
     return (0);
@@ -2093,9 +2138,11 @@ match_pattern_char (pat, string)
     case '\\':
       return (*string == *pat);
     case '?':
+      return (*string != '\0');
     case '*':
       return (1);
     case '[':
+#if 0
       for (np = pat; *np != ']'; np++);
       if (*np == 0)
         return (*string == '[');
@@ -2113,6 +2160,9 @@ match_pattern_char (pat, string)
            return (1);
          pat += 2;
        }
+#else
+      return (*string != '\0');
+#endif
     }
 }
 
@@ -2398,7 +2448,7 @@ make_dev_fd_filename (fd)
 {
   char *ret;
 
-  ret = xmalloc (16);
+  ret = xmalloc (sizeof (DEV_FD_PREFIX) + 4);
   sprintf (ret, "%s%d", DEV_FD_PREFIX, fd);
   add_fifo_list (fd);
   return (ret);
@@ -2449,6 +2499,10 @@ process_substitute (string, open_for_read_in_child)
      the pipe in the parent, otherwise the read end. */
   parent_pipe_fd = fildes[open_for_read_in_child];
   child_pipe_fd = fildes[1 - open_for_read_in_child];
+  /* Move the parent end of the pipe to some high file descriptor, to
+     avoid clashes with FDs used by the script. */
+  parent_pipe_fd = move_to_high_fd (parent_pipe_fd, 1, 64);
+
   pathname = make_dev_fd_filename (parent_pipe_fd);
 #endif /* HAVE_DEV_FD */
 
@@ -2560,7 +2614,7 @@ process_substitute (string, open_for_read_in_child)
   dev_fd_list[parent_pipe_fd] = 0;
 #endif /* HAVE_DEV_FD */
 
-  result = parse_and_execute (string, "process substitution", 0);
+  result = parse_and_execute (string, "process substitution", (SEVAL_NONINT|SEVAL_NOHIST));
 
 #if !defined (HAVE_DEV_FD)
   /* Make sure we close the named pipe in the child before we exit. */
@@ -2572,6 +2626,75 @@ process_substitute (string, open_for_read_in_child)
 }
 #endif /* PROCESS_SUBSTITUTION */
 
+static char *
+read_comsub (fd, quoted)
+     int fd, quoted;
+{
+  char *istring, buf[128], *bufp;
+  int bufn, istring_index, istring_size, c;
+
+  istring = (char *)NULL;
+  istring_index = istring_size = bufn = 0;
+
+  /* Read the output of the command through the pipe. */
+  while (1)
+    {
+      if (fd < 0)
+        break;
+      if (--bufn <= 0)
+       {
+         while ((bufn = read (fd, buf, sizeof(buf))) < 0 && errno == EINTR)
+           ;
+         if (bufn <= 0) 
+           break;
+         bufp = buf;
+       }
+      c = *bufp++;
+
+      /* Add the character to ISTRING, possibly after resizing it. */
+      RESIZE_MALLOCED_BUFFER (istring, istring_index, 2, istring_size, DEFAULT_ARRAY_SIZE);
+
+      if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) || c == CTLESC || c == CTLNUL)
+       istring[istring_index++] = CTLESC;
+
+      istring[istring_index++] = c;
+    }
+
+  if (istring)
+    istring[istring_index] = '\0';
+
+  /* If we read no output, just return now and save ourselves some
+     trouble. */
+  if (istring_index == 0)
+    {
+      FREE (istring);
+      return (char *)NULL;
+    }
+
+  /* Strip trailing newlines from the output of the command. */
+  if (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES))
+    {
+      while (istring_index > 0)
+       {
+         if (istring[istring_index - 1] == '\n')
+           {
+             --istring_index;
+
+             /* If the newline was quoted, remove the quoting char. */
+             if (istring[istring_index - 1] == CTLESC)
+               --istring_index;
+           }
+         else
+           break;
+       }
+      istring[istring_index] = '\0';
+    }
+  else
+    strip_trailing (istring, istring_index - 1, 1);
+
+  return istring;
+}
+
 /* Perform command substitution on STRING.  This returns a string,
    possibly quoted. */
 static char *
@@ -2581,10 +2704,8 @@ command_substitute (string, quoted)
 {
   pid_t pid, old_pid, old_pipeline_pgrp;
   char *istring;
-  int istring_index, istring_size, c, result, fildes[2];
-  FILE *istream;
+  int result, fildes[2];
 
-  istring_index = istring_size = 0;
   istring = (char *)NULL;
 
   /* Don't fork () if there is no need to.  In the case of no command to
@@ -2678,49 +2799,18 @@ command_substitute (string, quoted)
       else if (result)
        exit (EXECUTION_FAILURE);
       else
-       exit (parse_and_execute (string, "command substitution", -1));
+       exit (parse_and_execute (string, "command substitution", SEVAL_NOHIST));
     }
   else
     {
-      istream = fdopen (fildes[0], "r");
-
 #if defined (JOB_CONTROL) && defined (PGRP_PIPE)
       close_pgrp_pipe ();
 #endif /* JOB_CONTROL && PGRP_PIPE */
 
       close (fildes[1]);
 
-      if (istream == 0)
-       {
-         sys_error ("cannot reopen pipe to command substitution (fd %d)", fildes[0]);
-         goto error_exit;
-       }
-
-      /* Read the output of the command through the pipe. */
-      while (1)
-       {
-#if !defined (HAVE_RESTARTABLE_SYSCALLS)
-         c = getc_with_restart (istream);
-#else
-         c = getc (istream);
-#endif /* HAVE_RESTARTABLE_SYSCALLS */
-
-         if (c == EOF)
-           break;
-
-         /* Add the character to ISTRING, possibly after resizing it. */
-         RESIZE_MALLOCED_BUFFER (istring, istring_index, 2, istring_size, DEFAULT_ARRAY_SIZE);
-
-         if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) || c == CTLESC || c == CTLNUL)
-           istring[istring_index++] = CTLESC;
-
-         istring[istring_index++] = c;
-       }
-
-      if (istring)
-       istring[istring_index] = '\0';
+      istring = read_comsub (fildes[0], quoted);
 
-      fclose (istream);
       close (fildes[0]);
 
       last_command_exit_value = wait_for (pid);
@@ -2740,32 +2830,6 @@ command_substitute (string, quoted)
        give_terminal_to (pipeline_pgrp);
 #endif /* JOB_CONTROL */
 
-      /* If we read no output, just return now and save ourselves some
-        trouble. */
-      if (istring_index == 0)
-       goto error_exit;
-
-      /* Strip trailing newlines from the output of the command. */
-      if (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES))
-       {
-         while (istring_index > 0)
-           {
-             if (istring[istring_index - 1] == '\n')
-               {
-                 --istring_index;
-
-                 /* If the newline was quoted, remove the quoting char. */
-                 if (istring[istring_index - 1] == CTLESC)
-                   --istring_index;
-               }
-             else
-               break;
-           }
-         istring[istring_index] = '\0';
-       }
-      else
-       strip_trailing (istring, 1);
-
       return (istring);
     }
 }
@@ -2874,6 +2938,7 @@ list_remove_pattern (list, pattern, patspec, type, quoted)
     {
       tword = remove_pattern (l->word->word, pattern, patspec);
       w = make_bare_word (tword);
+      free (tword);
       new = make_word_list (w, new);
     }
 
@@ -2893,7 +2958,8 @@ parameter_list_remove_pattern (value, type, c, quoted)
      int type, c, quoted;
 {
   int patspec;
-  char *pattern;
+  char *pattern, *ret;
+  WORD_LIST *list;
 
   patspec = getpatspec (c, value);
   if (patspec == RP_LONG_LEFT || patspec == RP_LONG_RIGHT)
@@ -2901,7 +2967,11 @@ parameter_list_remove_pattern (value, type, c, quoted)
 
   pattern = getpattern (value, quoted, 1);
 
-  return (list_remove_pattern (list_rest_of_args (), pattern, patspec, type, quoted));
+  list = list_rest_of_args ();
+  ret = list_remove_pattern (list, pattern, patspec, type, quoted);
+  dispose_words (list);
+  FREE (pattern);
+  return (ret);
 }
 
 #if defined (ARRAY_VARS)
@@ -2933,6 +3003,7 @@ array_remove_pattern (value, aspec, aval, c, quoted)
       if (array_p (var) == 0)
         {
           report_error ("%s: bad array subscript", aspec);
+          FREE (pattern);
           return ((char *)NULL);
         }
       l = array_to_word_list (array_cell (var));
@@ -2948,6 +3019,7 @@ array_remove_pattern (value, aspec, aval, c, quoted)
       if (ind < 0)
        {
          report_error ("%s: bad array subscript", aspec);
+         FREE (pattern);
          return ((char *)NULL);
        }
       if (array_p (var) == 0 && ind != 0)
@@ -2959,8 +3031,14 @@ array_remove_pattern (value, aspec, aval, c, quoted)
       ret = remove_pattern (aval, pattern, patspec);
 #endif
       if (ret)
-       quote_escapes (ret);
+       {
+         t = quote_escapes (ret);
+         free (ret);
+         ret = t;
+       }
     }
+
+  FREE (pattern);
   return ret;
 }
 
@@ -2998,16 +3076,18 @@ array_expand_index (s, len)
      int len;
 {
   char *exp, *t;
-  int val;
+  int val, expok;
 
   exp = xmalloc (len);
   strncpy (exp, s, len - 1);
   exp[len - 1] = '\0';
   t = maybe_expand_string (exp, 0, expand_string);
   this_command_name = (char *)NULL;
-  val = evalexp (t);
+  val = evalexp (t, &expok);
   free (t);
   free (exp);
+  if (expok == 0)
+    jump_to_top_level (DISCARD);
   return val;
 }
 
@@ -3085,7 +3165,7 @@ array_value_internal (s, quoted, allow_all)
          return ((char *)NULL);
        }
       if (array_p (var) == 0)
-        return (ind == 0 ? value_cell (var) : (char *)NULL);
+        return (ind == 0 ? savestring (value_cell (var)) : (char *)NULL);
       retval = array_reference (array_cell (var), ind);
       if (retval)
        retval = quote_escapes (retval);
@@ -3433,7 +3513,7 @@ verify_substring_values (value, substr, vtype, e1p, e2p)
      int vtype, *e1p, *e2p;
 {
   char *t, *temp1;
-  int len;
+  int len, expok;
 #if defined (ARRAY_VARS)
  ARRAY *a;
 #endif
@@ -3441,13 +3521,16 @@ verify_substring_values (value, substr, vtype, e1p, e2p)
   t = strchr (substr, ':');
   if (t)
     *t = '\0';
-  temp1 = maybe_expand_string (substr, 1, expand_string);
-  *e1p = evalexp (temp1);
+  temp1 = maybe_expand_string (substr, Q_DOUBLE_QUOTES, expand_string);
+  *e1p = evalexp (temp1, &expok);
   free (temp1);
+  if (expok == 0)
+    return (0);
 
   switch (vtype)
     {
     case VT_VARIABLE:
+    case VT_ARRAYMEMBER:
       len = strlen (value);
       break;
     case VT_POSPARMS:
@@ -3464,13 +3547,18 @@ verify_substring_values (value, substr, vtype, e1p, e2p)
   if (*e1p < 0)                /* negative offsets count from end */
     *e1p += len;
 
+  if (*e1p >= len || *e1p < 0)
+    return (0);
+
   if (t)
     {
       t++;
-      temp1 = maybe_expand_string (t, 1, expand_string);
+      temp1 = maybe_expand_string (t, Q_DOUBLE_QUOTES, expand_string);
       t[-1] = ':';
-      *e2p = evalexp (temp1);
+      *e2p = evalexp (temp1, &expok);
       free (temp1);
+      if (expok == 0)
+        return (0);
       if (*e2p < 0)
         {
           internal_error ("%s: substring expression < 0", t);
@@ -3547,14 +3635,14 @@ get_var_and_type (varname, value, varp, valp)
       v = array_variable_part (varname, &temp, (int *)0);
       if (v && array_p (v))
        {
-         if (temp[0] == '@' && temp[1] == ']')
+         if ((temp[0] == '@' || temp[0] == '*') && temp[1] == ']')
            {
              vtype = VT_ARRAYVAR;
              *valp = (char *)array_cell (v);
            }
          else
            {
-             vtype = VT_VARIABLE;
+             vtype = VT_ARRAYMEMBER;
              *valp = array_value (varname, 1);
            }
          *varp = v;
@@ -3598,11 +3686,16 @@ parameter_brace_substring (varname, value, substr, quoted)
     return ((char *)NULL);
 
   if (verify_substring_values (val, substr, vtype, &e1, &e2) == 0)
-    return (&expand_param_error);
+    {
+      if (val && vtype == VT_ARRAYMEMBER)
+       free (val);
+      return (&expand_param_error);
+    }
 
   switch (vtype)
     {
     case VT_VARIABLE:
+    case VT_ARRAYMEMBER:
       temp = quoted ? quoted_substring (value, e1, e2) : substring (value, e1, e2);
       break;
     case VT_POSPARMS:
@@ -3659,7 +3752,10 @@ pat_subst (string, pat, rep, mflags)
 
   /* Now copy the unmatched portion of the input string */
   if (*str)
-    strcpy (ret + rptr, str);
+    {
+      RESIZE_MALLOCED_BUFFER (ret, rptr, STRLEN(str) + 1, rsize, 64);
+      strcpy (ret + rptr, str);
+    }
   else
     ret[rptr] = '\0';
 
@@ -3736,15 +3832,20 @@ parameter_brace_patsub (varname, value, patsub, quoted)
      perform word splitting or filename generation. */
   pat = maybe_expand_string (patsub, quoted, expand_string_unsplit);
   if (rep)
-    rep = maybe_expand_string (rep, quoted, expand_string_unsplit);
+    {
+      if ((mflags & MATCH_QUOTED) == 0)
+       rep = maybe_expand_string (rep, quoted, expand_string_unsplit);
+      else
+        rep = expand_string_to_string (rep, quoted, expand_string_unsplit);
+    }
 
   p = pat;
-  if (pat[0] == '#')
+  if (pat && pat[0] == '#')
     {
       mflags |= MATCH_BEG;
       p++;
     }
-  else if (pat[0] == '%')
+  else if (pat && pat[0] == '%')
     {
       mflags |= MATCH_END;
       p++;
@@ -3758,6 +3859,7 @@ parameter_brace_patsub (varname, value, patsub, quoted)
   switch (vtype)
     {
     case VT_VARIABLE:
+    case VT_ARRAYMEMBER:
       temp = pat_subst (val, p, rep, mflags);
       break;
     case VT_POSPARMS:
@@ -3770,6 +3872,9 @@ parameter_brace_patsub (varname, value, patsub, quoted)
 #endif
     }
 
+  if (val && v && array_p (v) && vtype == VT_ARRAYMEMBER)
+    free (val);
+
   FREE (pat);
   FREE (rep);
 
@@ -4006,7 +4111,7 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll
          FREE (temp);
          free (name);
          last_command_exit_value = EXECUTION_FAILURE;
-         return &expand_param_error;
+         return (interactive_shell ? &expand_param_error : &expand_param_fatal);
        }
       break;
 
@@ -4147,11 +4252,13 @@ expand_word_internal (word, quoted, contains_dollar_at, expanded_something)
 
   int had_quoted_null;
 
+  int expok;
+
   register int c;              /* Current character. */
   int number;                  /* Temporary number value. */
   int t_index;                 /* For calls to string_extract_xxx. */
 
-  istring = xmalloc (istring_size = DEFAULT_ARRAY_SIZE);
+  istring = xmalloc (istring_size = DEFAULT_INITIAL_ARRAY_SIZE);
   istring[istring_index = 0] = '\0';
 
   quoted_dollar_at = had_quoted_null = 0;
@@ -4251,7 +4358,7 @@ expand_word_internal (word, quoted, contains_dollar_at, expanded_something)
                  free (string);
                  free (istring);
                  last_command_exit_value = EXECUTION_FAILURE;
-                 return (&expand_word_error);
+                 return (interactive_shell ? &expand_word_error : &expand_word_fatal);
                }
              temp = temp1 ? savestring (temp1) : (char *)NULL;
              goto dollar_add_string;
@@ -4404,28 +4511,38 @@ expand_word_internal (word, quoted, contains_dollar_at, expanded_something)
 
                  if (temp1[t_index] != ')')
                    {
+#if 0
                      report_error ("%s: bad arithmetic substitution", temp);
                      free (temp);
                      free (string);
                      free (istring);
-                     return &expand_word_error;
+                     return (&expand_word_error);
+#else
+                     goto comsub;
+#endif
                    }
 
                  /* Cut off ending `)' */
                  temp1[t_index] = '\0';
 
                  /* Expand variables found inside the expression. */
-                 temp1 = maybe_expand_string (temp1, 1, expand_string);
+                 temp1 = maybe_expand_string (temp1, Q_DOUBLE_QUOTES, expand_string);
 
                  /* No error messages. */
                  this_command_name = (char *)NULL;
-                 number = evalexp (temp1);
+                 number = evalexp (temp1, &expok);
                  free (temp);
                  free (temp1);
-
+                 if (expok == 0)
+                   {
+                     free (string);
+                     free (istring);
+                     return (&expand_word_error);
+                   }
                  goto add_number;
                }
 
+       comsub:
              temp1 = command_substitute (temp, quoted);
              FREE (temp);
              temp = temp1;
@@ -4440,14 +4557,19 @@ expand_word_internal (word, quoted, contains_dollar_at, expanded_something)
              sindex = t_index;
 
               /* Do initial variable expansion. */
-             temp1 = maybe_expand_string (temp, 1, expand_string);
+             temp1 = maybe_expand_string (temp, Q_DOUBLE_QUOTES, expand_string);
 
              /* No error messages. */
              this_command_name = (char *)NULL;
-             number = evalexp (temp1);
+             number = evalexp (temp1, &expok);
              free (temp1);
              free (temp);
-
+             if (expok == 0)
+               {
+                 free (string);
+                 free (istring);
+                 return (&expand_word_error);
+               }
              goto add_number;
 
            default:
@@ -4504,7 +4626,9 @@ expand_word_internal (word, quoted, contains_dollar_at, expanded_something)
              free (string);
              last_command_exit_value = EXECUTION_FAILURE;
              free (istring);
-             return &expand_word_error;
+             return ((unbound_vars_is_error && interactive_shell == 0)
+                       ? &expand_word_fatal
+                       : &expand_word_error);
            }
          break;                /* End case '$': */
 
@@ -4895,6 +5019,7 @@ word_quote_removal (word, quoted)
 
   t = string_quote_removal (word->word, quoted);
   w = make_bare_word (t);
+  free (t);
   return (w);
 }
 
@@ -5228,6 +5353,7 @@ expand_word_list_internal (list, do_vars)
     {
       register char **expansions;
       WORD_LIST *braces;
+      WORD_DESC *w;
       int eindex;
 
       for (braces = disposables = (WORD_LIST *)NULL; tlist; tlist = next)
@@ -5247,7 +5373,13 @@ expand_word_list_internal (list, do_vars)
 
              for (eindex = 0; temp_string = expansions[eindex]; eindex++)
                {
-                 braces = make_word_list (make_word (temp_string), braces);
+                 w = make_word (temp_string);
+                 /* If brace expansion didn't change the word, preserve
+                    the flags.  We may want to preserve the flags
+                    unconditionally someday -- XXX */
+                 if (STREQ (temp_string, tlist->word->word))
+                   w->flags = tlist->word->flags;
+                 braces = make_word_list (w, braces);
                  free (expansions[eindex]);
                }
              free (expansions);
@@ -5306,7 +5438,7 @@ expand_word_list_internal (list, do_vars)
 
          /* Dispose our copy of the original list. */
          dispose_words (orig_list);
-         /* Dispose the  new list we're building. */
+         /* Dispose the new list we're building. */
          dispose_words (new_list);
 
          if (expanded == &expand_word_error)
@@ -5372,9 +5504,13 @@ expand_word_list_internal (list, do_vars)
                 words are freed. */
              next = tlist->next;
 
-             /* If the word isn't quoted and there is an unquoted pattern
-                matching character in the word, then glob it. */
+             /* If the word isn't an assignment and contains an unquoted
+                pattern matching character, then glob it. */
+#if 0
              if ((tlist->word->flags & (W_QUOTED|W_ASSIGNMENT)) == 0 &&
+#else
+             if ((tlist->word->flags & W_ASSIGNMENT) == 0 &&
+#endif
                  unquoted_glob_pattern_p (tlist->word->word))
                {
                  glob_array = shell_glob_filename (tlist->word->word);
@@ -5758,6 +5894,7 @@ sv_ignoreeof (name)
   temp = tmp_var ? value_cell (tmp_var) : (char *)NULL;
   if (temp)
     eof_encountered_limit = (*temp && all_digits (temp)) ? atoi (temp) : 10;
+  set_shellopts ();    /* make sure `ignoreeof' is/is not in $SHELLOPTS */
 }
 
 void
@@ -5799,8 +5936,10 @@ sv_strict_posix (name)
   SET_INT_VAR (name, posixly_correct);
   posix_initialize (posixly_correct);
 #if defined (READLINE)
-  posix_readline_initialize (posixly_correct);
+  if (interactive_shell)
+    posix_readline_initialize (posixly_correct);
 #endif /* READLINE */
+  set_shellopts ();    /* make sure `posix' is/is not in $SHELLOPTS */
 }
 
 void
index ec2a5c6..c69b77e 100644 (file)
@@ -5,16 +5,19 @@
 #
 lib/readline/tilde.c           ../tilde/tilde.c
 lib/readline/tilde.h           ../tilde/tilde.h
+#
+lib/readline/ansi_stdlib.h     ../posixheaders/ansi_stdlib.h
 lib/readline/posixdir.h                ../posixheaders/posixdir.h
+lib/readline/posixjmp.h                ../posixheaders/posixjmp.h
 lib/readline/posixstat.h       ../posixheaders/posixstat.h
-lib/readline/ansi_stdlib.h     ../posixheaders/ansi_stdlib.h
 lib/readline/xmalloc.c         ../malloc/xmalloc.c
 #
 #lib/tilde/memalloc.h          ../posixheaders/memalloc.h
 #
+ansi_stdlib.h                  lib/posixheaders/ansi_stdlib.h
+filecntl.h                     lib/posixheaders/filecntl.h
+memalloc.h                     lib/posixheaders/memalloc.h
 posixdir.h                     lib/posixheaders/posixdir.h
+posixjmp.h                     lib/posixheaders/posixjmp.h
 posixstat.h                    lib/posixheaders/posixstat.h
-ansi_stdlib.h                  lib/posixheaders/ansi_stdlib.h
 stdc.h                         lib/posixheaders/stdc.h
-memalloc.h                     lib/posixheaders/memalloc.h
-filecntl.h                     lib/posixheaders/filecntl.h
index 6a2a47b..e12fdac 100644 (file)
@@ -21,14 +21,33 @@ MACHTYPE="!MACHTYPE!"
 PATH=/bin:/usr/bin:/usr/local/bin:$PATH
 export PATH
 
-TEMP=/tmp/bashbug.$$
+TEMP=/tmp/bbug.$$
+
+# Figure out how to echo a string without a trailing newline
+N=`echo 'hi there\c'`
+case "$N" in
+*c)    n=-n c= ;;
+*)     n= c='\c' ;;
+esac
+
+BASHTESTERS="bash-testers@po.cwru.edu"
 
 case "$RELSTATUS" in
 alpha*|beta*)  BUGBASH=chet@po.cwru.edu ;;
 *)             BUGBASH=bug-bash@prep.ai.mit.edu ;;
 esac
 
-BUGADDR=${1-$BUGBASH}
+case "$RELSTATUS" in
+alpha*|beta*)  echo "$0: This is a testing release.  Would you like your bug report"
+               echo "$0: to be sent to the bash-testers mailing list?"
+               echo $n "$0: Send to bash-testers? $c"
+               read ans
+               case "$ans" in
+               y*|Y*)  BUGBASH="${BUGBASH},${BASHTESTERS}" ;;
+               esac ;;
+esac
+
+BUGADDR="${1-$BUGBASH}"
 
 : ${EDITOR=emacs}
 
@@ -82,25 +101,18 @@ EOF
 chmod u+w $TEMP
 cp $TEMP $TEMP.x
 
-# Figure out how to echo a string without a trailing newline
-N=`echo 'hi there\c'`
-case "$N" in
-*c)    n=-n c= ;;
-*)     n= c='\c' ;;
-esac
-
 trap '' 2              # ignore interrupts while in editor
 
 until $EDITOR $TEMP; do
        echo "$0: editor \`$EDITOR' exited with nonzero status."
        echo "$0: Perhaps it was interrupted."
-       echo "$0: Type `y' to give up, and lose your bug report;"
-       echo "$0: type `n' to re-enter the editor."
+       echo "$0: Type \`y' to give up, and lose your bug report;"
+       echo "$0: type \`n' to re-enter the editor."
        echo $n "$0: Do you want to give up? $c"
 
        read ans
        case "$ans" in
-       Yy]*) exit 1 ;;
+       [Yy]*) exit 1 ;;
        esac
 done
 
@@ -112,6 +124,12 @@ then
        exit
 fi
 
+echo $n "Send bug report? [y/n] $c"
+read ans
+case "$ans" in
+[Nn]*) exit 0 ;;
+esac
+
 ${RMAIL} $BUGADDR < $TEMP || {
        cat $TEMP >> $HOME/dead.bashbug
        echo "$0: mail failed: report saved in $HOME/dead.bashbug" >&2
index 5f8b4bf..69e6169 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
 #
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -43,11 +43,11 @@ elif (test -f /usr/5bin/uname) >/dev/null 2>&1 ; then
        PATH=$PATH:/usr/5bin
 fi
 
-UNAME=`(uname) 2>/dev/null` || UNAME=unknown                   # SunOS
-UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown        # sun4m
-UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown # 4.1.2
-UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown  # SunOS
-UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown        # 13
+UNAME=`(uname) 2>/dev/null` || UNAME=unknown
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
 
 RELEASE=`expr "$UNAME_RELEASE" : '[^0-9]*\([0-9]*\)'` # 4
 case "$RELEASE" in
@@ -68,87 +68,114 @@ fi
 # Note: order is significant - the case branches are not exclusive.
 
 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
-    alpha:OSF1:V*:*)
-       # After 1.2, OSF1 uses "V1.3" for uname -r.
-       echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^V//'`
-       exit 0 ;;
-    alpha:OSF1:*:*)
-       # 1.2 uses "1.2" for uname -r.
-       echo alpha-dec-osf${UNAME_RELEASE}
-        exit 0 ;;
-    i[3456]86:NetBSD:*:*)
-       echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
-       exit 0 ;;
+    # Begin cases added for Bash
     alpha:NetBSD:*:*)
        echo alpha-dec-netbsd${UNAME_RELEASE}
        exit 0 ;;
-    sparc:NetBSD:*:*)
-       echo sparc-sun-netbsd${UNAME_RELEASE}
+    alpha:OpenBSD:*:*)
+       echo alpha-dec-openbsd${UNAME_RELEASE}
        exit 0 ;;
-    sun3*:NetBSD:*:*)
-       echo m68k-sun-netbsd${UNAME_RELEASE}
+    i?86:NetBSD:*:*)
+       echo ${UNAME_MACHINE}-pc-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
        exit 0 ;;
-    atari*:NetBSD:*:*)
-       echo m68k-atari-netbsd${UNAME_RELEASE}
+    i?86:OpenBSD:*:*)
+       echo ${UNAME_MACHINE}-pc-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
        exit 0 ;;
-    mac68k:NetBSD:*:*)
-       echo m68k-apple-netbsd${UNAME_RELEASE}
+    i?86:FreeBSD:*:*)
+       echo ${UNAME_MACHINE}-pc-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
        exit 0 ;;
-    hp3[0-9][05]:NetBSD:*:*)
-       echo m68k-hp-netbsd${UNAME_RELEASE}
+    sparc:NetBSD:*:*)
+       echo sparc-unknown-netbsd${UNAME_RELEASE}
        exit 0 ;;
-    amiga:NetBSD:*:*)
-       echo m68k-cbm-netbsd${UNAME_RELEASE}
+    sparc:OpenBSD:*:*)
+       echo sparc-unknown-openbsd${UNAME_RELEASE}
        exit 0 ;;
     vax:NetBSD:*:*)
        echo vax-dec-netbsd${UNAME_RELEASE}
        exit 0 ;;
-    i[3456]86:OpenBSD:*:*)
-       echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+    vax:OpenBSD:*:*)
+       echo vax-dec-openbsd${UNAME_RELEASE}
        exit 0 ;;
-    alpha:OpenBSD:*:*)
-       echo alpha-dec-openbsd${UNAME_RELEASE}
+    mac68k:machten:*:*)
+       echo mac68k-apple-machten${UNAME_RELEASE}
        exit 0 ;;
-    sparc:OpenBSD:*:*)
-       echo sparc-sun-openbsd${UNAME_RELEASE}
+    concurrent*:*:*:*)
+       if test "`(/bin/universe) 2>/dev/null`" = att ; then
+               echo concurrent-concurrent-sysv3
+       else
+               echo concurrent-concurrent-bsd
+       fi
        exit 0 ;;
-    sun3*:OpenBSD:*:*)
-       echo m68k-sun-openbsd${UNAME_RELEASE}
+    ppc*:SunOS:5.*:*)
+       echo ppc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
        exit 0 ;;
-    atari*:OpenBSD:*:*)
-       echo m68k-atari-openbsd${UNAME_RELEASE}
+    sparc:UNIX_SV:4.*:*)
+       echo sparc-unknown-sysv${UNAME_RELEASE}
        exit 0 ;;
-    mac68k:OpenBSD:*:*)
-       echo m68k-apple-openbsd${UNAME_RELEASE}
+    mips:UNIX_SV:4.*:*)
+       echo mips-mips-sysv${UNAME_RELEASE}
        exit 0 ;;
-    hp3[0-9][05]:OpenBSD:*:*)
-       echo m68k-hp-openbsd${UNAME_RELEASE}
+    mips:OSF*1:*:*)
+       echo mips-mips-osf1
        exit 0 ;;
-    amiga:OpenBSD:*:*)
-       echo m68k-cbm-openbsd${UNAME_RELEASE}
+    mips:4.4BSD:*:*)
+       echo mips-mips-bsd4.4
        exit 0 ;;
-    vax:OpenBSD:*:*)
-       echo vax-dec-openbsd${UNAME_RELEASE}
+    MIServer-S:SMP_DC.OSx:*:dcosx)
+       echo mips-pyramid-sysv4
        exit 0 ;;
-    powerpc:machten:*:*)
-       echo powerpc-apple-machten${UNAME_RELEASE}
+    news*:NEWS*:*:*)
+       echo mips-sony-newsos${UNAME_RELEASE}
        exit 0 ;;
-    mac68k:machten:*:*)
-       echo mac68k-apple-machten${UNAME_RELEASE}
+    i?86:NEXTSTEP:*:*)
+       echo i386-next-nextstep${RELEASE}
+       exit 0 ;;
+    *680?0:NEXTSTEP:*:*)
+       echo m68k-next-nextstep${RELEASE}
+       exit 0 ;;    
+    *370:AIX:*:*)
+       echo ibm370-ibm-aix
+       exit 0 ;;
+    ksr1:OSF*1:*:*)
+       echo ksr1-ksr-osf1
+       exit 0 ;;
+    esa:OSF*1:*:* | ESA:OSF*:*:*)
+       echo esa-ibm-osf1
+       exit 0 ;;
+    DNP*:DNIX:*:*)
+       echo m68k-dnix-sysv
+       exit 0 ;;
+    *3b2*:*:*:*)
+       echo we32k-att-sysv3
+       exit 0 ;;
+    *:QNX:*:42*)
+       echo i386-qssl-qnx`echo ${UNAME_VERSION}`
+       exit 0 ;;
+    # end cases added for Bash
+    alpha:OSF1:*:*)
+       # A Vn.n version is a released version.
+       # A Tn.n version is a released field test version.
+       # A Xn.n version is an unreleased experimental baselevel.
+       # 1.2 uses "1.2" for uname -r.
+       echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//'`
        exit 0 ;;
-    RISC*:Mach:*:*)
-        echo mips-dec-mach_bsd4.3
-        exit 0 ;;
     21064:Windows_NT:50:3)
        echo alpha-dec-winnt3.5
        exit 0 ;;
-    Amiga*:UNIX_System_V:4.*:*)
-       echo m68k-cbm-sysv${UNAME_RELEASE}
+    Amiga*:UNIX_System_V:4.0:*)
+       echo m68k-cbm-sysv4
+       exit 0;;
+    amiga:NetBSD:*:*)
+       echo m68k-cbm-netbsd${UNAME_RELEASE}
+       exit 0 ;;
+    amiga:OpenBSD:*:*)
+       echo m68k-cbm-openbsd${UNAME_RELEASE}
        exit 0 ;;
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
        echo arm-acorn-riscix${UNAME_RELEASE}
        exit 0;;
     Pyramid*:OSx*:*:*|MIS*:OSx*:*:*)
+       # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
        if test "`(/bin/universe) 2>/dev/null`" = att ; then
                echo pyramid-pyramid-sysv3
        else
@@ -156,27 +183,14 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
        fi
        exit 0 ;;
     NILE:*:*:dcosx)
-        echo pyramid-pyramid-svr4
-        exit 0 ;;
-    concurrent*:*:*:*)
-       if test "`(/bin/universe) 2>/dev/null`" = att ; then
-               echo concurrent-concurrent-sysv3
-       else
-               echo concurrent-concurrent-bsd
-       fi
-       exit 0 ;;
-    ppc*:SunOS:5.*:*)
-       echo ppc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-       exit 0 ;;
-    prep*:SunOS:5.*:*)
-       echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-       exit 0 ;;
-    i86pc:SunOS:5.*:*)
-       echo i386-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       echo pyramid-pyramid-svr4
        exit 0 ;;
     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
        echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
        exit 0 ;;
+    i86pc:SunOS:5.*:*)
+       echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit 0 ;;
     sun4*:SunOS:6*:*)
        # According to config.sub, this is the proper way to canonicalize
        # SunOS6.  Hard to guess exactly what SunOS6 will be like, but
@@ -196,57 +210,63 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
        echo m68k-sun-sunos${UNAME_RELEASE}
        exit 0 ;;
     aushp:SunOS:*:*)
-        echo sparc-auspex-sunos${UNAME_RELEASE}
-        exit 0 ;;
-    RISC*:ULTRIX:*:*)
-       echo mips-dec-ultrix${UNAME_RELEASE}
+       echo sparc-auspex-sunos${UNAME_RELEASE}
        exit 0 ;;
-    VAX*:ULTRIX*:*:*)
-       echo vax-dec-ultrix${UNAME_RELEASE}
+    atari*:NetBSD:*:*)
+       echo m68k-atari-netbsd${UNAME_RELEASE}
        exit 0 ;;
-    sparc:UNIX_SV:4.*:*)
-       echo sparc-unknown-sysv${UNAME_RELEASE}
+    atari*:OpenBSD:*:*)
+       echo m68k-atari-openbsd${UNAME_RELEASE}
        exit 0 ;;
-    mips:UNIX_SV:4.*:*)
-       echo mips-mips-sysv${UNAME_RELEASE}
+    sun3*:NetBSD:*:*)
+       echo m68k-sun-netbsd${UNAME_RELEASE}
        exit 0 ;;
-    mips:OSF*1:*:*)
-       echo mips-mips-osf1
+    sun3*:OpenBSD:*:*)
+       echo m68k-sun-openbsd${UNAME_RELEASE}
        exit 0 ;;
-    mips:4.4BSD:*:*)
-       echo mips-mips-bsd4.4
+    mac68k:NetBSD:*:*)
+       echo m68k-apple-netbsd${UNAME_RELEASE}
+       exit 0 ;;
+    mac68k:OpenBSD:*:*)
+       echo m68k-apple-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    powerpc:machten:*:*)
+       echo powerpc-apple-machten${UNAME_RELEASE}
+       exit 0 ;;
+    RISC*:Mach:*:*)
+       echo mips-dec-mach_bsd4.3
+       exit 0 ;;
+    RISC*:ULTRIX:*:*)
+       echo mips-dec-ultrix${UNAME_RELEASE}
+       exit 0 ;;
+    VAX*:ULTRIX*:*:*)
+       echo vax-dec-ultrix${UNAME_RELEASE}
        exit 0 ;;
     mips:*:*:UMIPS | mips:*:*:RISCos)
-        sed 's/^        //' << EOF >dummy.c
-        int main (argc, argv) int argc; char **argv; {
-        #if defined (host_mips) && defined (MIPSEB)
-        #if defined (SYSTYPE_SYSV)
-          printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
-        #endif
-        #if defined (SYSTYPE_SVR4)
-          printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
-        #endif
-        #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
-          printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
-        #endif
-        #endif
-          exit (-1);
-        }
+       sed 's/^        //' << EOF >dummy.c
+       int main (argc, argv) int argc; char **argv; {
+       #if defined (host_mips) && defined (MIPSEB)
+       #if defined (SYSTYPE_SYSV)
+         printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+       #endif
+       #if defined (SYSTYPE_SVR4)
+         printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+       #endif
+       #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+         printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+       #endif
+       #endif
+         exit (-1);
+       }
 EOF
-        ${CC-cc} dummy.c -o dummy \
-          && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
-          && rm dummy.c dummy && exit 0
-        rm -f dummy.c dummy
-        echo mips-mips-riscos${UNAME_RELEASE}
-        exit 0 ;;
-    MIServer-S:SMP_DC.OSx:*:dcosx)
-       echo mips-pyramid-sysv4
+       ${CC-cc} dummy.c -o dummy \
+         && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+         && rm dummy.c dummy && exit 0
+       rm -f dummy.c dummy
+       echo mips-mips-riscos${UNAME_RELEASE}
        exit 0 ;;
     Night_Hawk:Power_UNIX:*:*)
-       echo powerpc-harris-powerunix
-       exit 0 ;;
-    news*:NEWS*:*:*)
-       echo mips-sony-newsos${UNAME_RELEASE}
+       echo powerpc-harris-powerux
        exit 0 ;;
     m88k:CX/UX:7*:*)
        echo m88k-harris-cxux7
@@ -258,17 +278,17 @@ EOF
        echo m88k-motorola-sysv3
        exit 0 ;;
     AViiON:dgux:*:*)
-        # DG/UX returns AViiON for all architectures
-        UNAME_PROCESSOR=`uname -p`
-        if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
+       # DG/UX returns AViiON for all architectures
+       UNAME_PROCESSOR=`/usr/bin/uname -p`
+       if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
        if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
             -o ${TARGET_BINARY_INTERFACE}x = x ] ; then
                echo m88k-dg-dgux${UNAME_RELEASE}
        else
                echo m88k-dg-dguxbcs${UNAME_RELEASE}
        fi
-        else echo i586-dg-dgux${UNAME_RELEASE}
-        fi
+       else echo i586-dg-dgux${UNAME_RELEASE}
+       fi
        exit 0 ;;
     M88*:DolphinOS:*:*)        # DolphinOS (SVR3)
        echo m88k-dolphin-sysv3
@@ -283,12 +303,6 @@ EOF
     Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
        echo m68k-tektronix-bsd
        exit 0 ;;
-    i?86:NEXTSTEP:*:*)
-       echo i386-next-nextstep${RELEASE}
-       exit 0 ;;
-    *680?0:NEXTSTEP:*:*)
-       echo m68k-next-nextstep${RELEASE}
-       exit 0 ;;    
     *:IRIX*:*:*)
        echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
        exit 0 ;;
@@ -298,9 +312,6 @@ EOF
     i?86:AIX:*:*)
        echo i386-ibm-aix
        exit 0 ;;
-    *370:AIX:*:*)
-       echo ibm370-ibm-aix
-       exit 0 ;;
     *:AIX:2:3)
        if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
                sed 's/^                //' << EOF >dummy.c
@@ -347,7 +358,7 @@ EOF
        echo romp-ibm-bsd4.4
        exit 0 ;;
     ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC NetBSD and
-       echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to 
+       echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
        exit 0 ;;                           # report: romp-ibm BSD 4.3
     *:BOSX:*:*)
        echo rs6000-bull-bosx
@@ -365,7 +376,7 @@ EOF
        case "${UNAME_MACHINE}" in
            9000/31? )            HP_ARCH=m68000 ;;
            9000/[34]?? )         HP_ARCH=m68k ;;
-           9000/7?? | 9000/8?[679] ) HP_ARCH=hppa1.1 ;;
+           9000/7?? | 9000/8?[1679] ) HP_ARCH=hppa1.1 ;;
            9000/8?? )            HP_ARCH=hppa1.0 ;;
        esac
        HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
@@ -413,6 +424,13 @@ EOF
     hp8??:OSF1:*:*)
        echo hppa1.0-hp-osf
        exit 0 ;;
+    i?86:OSF1:*:*)
+       if [ -x /usr/sbin/sysversion ] ; then
+           echo ${UNAME_MACHINE}-pc-osf1mk
+       else
+           echo ${UNAME_MACHINE}-pc-osf1
+       fi
+       exit 0 ;;
     parisc*:Lites*:*:*)
        echo hppa1.1-hp-lites
        exit 0 ;;
@@ -459,8 +477,14 @@ EOF
     F301:UNIX_System_V:*:*)
        echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
        exit 0 ;;
+    hp3[0-9][05]:NetBSD:*:*)
+       echo m68k-hp-netbsd${UNAME_RELEASE}
+       exit 0 ;;
+    hp3[0-9][05]:OpenBSD:*:*)
+       echo m68k-hp-openbsd${UNAME_RELEASE}
+       exit 0 ;;
     i?86:BSD/386:*:* | *:BSD/OS:*:*)
-       echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+       echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
        exit 0 ;;
     *:FreeBSD:*:*)
        echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
@@ -473,10 +497,13 @@ EOF
        exit 0 ;;
     i*:CYGWIN*:*)
        echo i386-pc-cygwin32
-        exit 0 ;;
+       exit 0 ;;
     p*:CYGWIN*:*)
-        echo powerpcle-unknown-cygwin32
-        exit 0 ;;
+       echo powerpcle-unknown-cygwin32
+       exit 0 ;;
+    prep*:SunOS:5.*:*)
+       echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit 0 ;;
     *:GNU:*:*)
        echo `echo ${UNAME_MACHINE}|sed -e 's,/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
        exit 0 ;;
@@ -484,21 +511,27 @@ EOF
        # The BFD linker knows what the default object file format is, so
        # first see if it will tell us.
        ld_help_string=`ld --help 2>&1`
-       if echo $ld_help_string | grep >/dev/null 2>&1 "supported emulations: elf_i[345]86"; then
-         echo "${UNAME_MACHINE}-unknown-linux" ; exit 0
-       elif echo $ld_help_string | grep >/dev/null 2>&1 "supported emulations: i[345]86linux"; then
-         echo "${UNAME_MACHINE}-unknown-linuxaout" ; exit 0
-       elif echo $ld_help_string | grep >/dev/null 2>&1 "supported emulations: i[345]86coff"; then
-         echo "${UNAME_MACHINE}-unknown-linuxcoff" ; exit 0
+       if echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf_i.86"; then
+         echo "${UNAME_MACHINE}-pc-linux-gnu" ; exit 0
+       elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86linux"; then
+         echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0
+       elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86coff"; then
+         echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0
+       elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68kelf"; then
+         echo "${UNAME_MACHINE}-unknown-linux-gnu" ; exit 0
+       elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68klinux"; then
+         echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0
+       elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf32ppc"; then
+         echo "powerpc-unknown-linux-gnu" ; exit 0
        elif test "${UNAME_MACHINE}" = "alpha" ; then
-         echo alpha-unknown-linux ; exit 0
+         echo alpha-unknown-linux-gnu ; exit 0
        elif test "${UNAME_MACHINE}" = "sparc" ; then
-         echo sparc-unknown-linux ; exit 0
+         echo sparc-unknown-linux-gnu ; exit 0
        else
-         # Either a pre-BFD a.out linker (linuxoldld) or one that does not give us
-         # useful --help.  Gcc wants to distinguish between linuxoldld and linuxaout.
+         # Either a pre-BFD a.out linker (linux-gnuoldld) or one that does not give us
+         # useful --help.  Gcc wants to distinguish between linux-gnuoldld and linux-gnuaout.
          test ! -d /usr/lib/ldscripts/. \
-           && echo "${UNAME_MACHINE}-unknown-linuxoldld" && exit 0
+           && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
          # Determine whether the default compiler is a.out or elf
          cat >dummy.c <<EOF
 main(argc, argv)
@@ -506,9 +539,9 @@ int argc;
 char *argv[];
 {
 #ifdef __ELF__
-  printf ("%s-unknown-linux\n", argv[1]);
+  printf ("%s-pc-linux-gnu\n", argv[1]);
 #else
-  printf ("%s-unknown-linuxaout\n", argv[1]);
+  printf ("%s-pc-linux-gnuaout\n", argv[1]);
 #endif
   return 0;
 }
@@ -521,32 +554,29 @@ EOF
     i?86:DYNIX/ptx:4*:*)
        echo i386-sequent-sysv4
        exit 0 ;;
-    i?86:OSF1:*:*)
-       echo i386-unknown-osf1
-       exit 0 ;;
     i?86:*:4.*:* | i?86:SYSTEM_V:4.*:* | i[34]86:UNIX_SV:4.*:*)
        if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
                echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
        else
-               echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}
+               echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
        fi
        exit 0 ;;
     i?86:*:3.2:*)
        if test -f /usr/options/cb.name; then
                UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
-               echo ${UNAME_MACHINE}-unknown-isc$UNAME_REL
+               echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
        elif /bin/uname -X 2>/dev/null >/dev/null ; then
                UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
                (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
                (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
                        && UNAME_MACHINE=i586
-               echo ${UNAME_MACHINE}-unknown-sco$UNAME_REL
+               echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
        else
-               echo ${UNAME_MACHINE}-unknown-sysv32
+               echo ${UNAME_MACHINE}-pc-sysv32
        fi
        exit 0 ;;
     Intel:Mach:3*:*)
-       echo i386-unknown-mach3
+       echo i386-pc-mach3
        exit 0 ;;
     paragon:*:*:*)
        echo i860-intel-osf1
@@ -558,12 +588,6 @@ EOF
          echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
        fi
        exit 0 ;;
-    ksr1:OSF*1:*:*)
-       echo ksr1-ksr-osf1
-       exit 0 ;;
-    esa:OSF*1:*:* | ESA:OSF*:*:*)
-       echo esa-ibm-osf1
-       exit 0 ;;
     mini*:CTIX:SYS*5:*)
        # "miniframe"
        echo m68010-convergent-sysv
@@ -575,9 +599,9 @@ EOF
        test -r /etc/.relid \
        && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-          && echo i486-ncr-sysv4.3${OS_REL} && exit 0
-        /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
-          && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+         && echo i486-ncr-sysv4.3${OS_REL} && exit 0
+       /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+         && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
          && echo i486-ncr-sysv4 && exit 0 ;;
@@ -585,25 +609,22 @@ EOF
        echo m68k-atari-sysv4
        exit 0 ;;
     m68*:LynxOS:2.*:*)
-       echo m68k-lynx-lynxos${UNAME_RELEASE}
+       echo m68k-unknown-lynxos${UNAME_RELEASE}
        exit 0 ;;
     i?86:LynxOS:2.*:*)
-       echo i386-lynx-lynxos${UNAME_RELEASE}
+       echo i386-pc-lynxos${UNAME_RELEASE}
        exit 0 ;;
     TSUNAMI:LynxOS:2.*:*)
-       echo sparc-lynx-lynxos${UNAME_RELEASE}
+       echo sparc-unknown-lynxos${UNAME_RELEASE}
        exit 0 ;;
     rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
-       echo rs6000-lynx-lynxos${UNAME_RELEASE}
+       echo rs6000-unknown-lynxos${UNAME_RELEASE}
        exit 0 ;;
     *:LynxOS:*:*)
        echo ${UNAME_MACHINE}-unknown-lynxos${UNAME_RELEASE}
        exit 0 ;;
     SM[BE]S:UNIX_SV:*:*)
-        echo mips-dde-sysv${UNAME_RELEASE}
-        exit 0 ;;
-    DNP*:DNIX:*:*)
-       echo m68k-dnix-sysv
+       echo mips-dde-sysv${UNAME_RELEASE}
        exit 0 ;;
     RM*:SINIX-*:*:*)
        echo mips-sni-sysv4
@@ -617,14 +638,14 @@ EOF
        fi
        exit 0 ;;
     *:UNIX_System_V:4*:FTX*)
-        # From Gerald Hewes <hewes@openmarket.com>.
-        # How about differentiating between stratus architectures? -djm
-        echo hppa1.1-stratus-sysv4
-        exit 0 ;;
+       # From Gerald Hewes <hewes@openmarket.com>.
+       # How about differentiating between stratus architectures? -djm
+       echo hppa1.1-stratus-sysv4
+       exit 0 ;;
     *:*:*:FTX*)
-        # From seanf@swdc.stratus.com.
-        echo i860-stratus-sysv4
-        exit 0 ;;              
+       # From seanf@swdc.stratus.com.
+       echo i860-stratus-sysv4
+       exit 0 ;;              
     mc68*:A/UX:*:*)
        echo m68k-apple-aux${UNAME_RELEASE}
        exit 0 ;;
@@ -637,11 +658,8 @@ EOF
        exit 0 ;;
     PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
                            # says <Richard.M.Bartel@ccMail.Census.GOV>
-        echo i586-unisys-sysv4 
-        exit 0 ;;              
-    *3b2*:*:*:*)
-       echo we32k-att-sysv3
-       exit 0 ;;
+       echo i586-unisys-sysv4 
+       exit 0 ;;              
 esac
 
 #echo '(No uname command or uname output not recognized.)' 1>&2
@@ -689,7 +707,7 @@ main ()
 #endif
   int version;
   version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
-  printf ("%s-next-nextstep%s\n", __ARCHITECTURE__,  version==2 ? "2" : "3");
+  printf ("%s-next-nextstep%d\n", __ARCHITECTURE__,  version);
   exit (0);
 #endif
 
@@ -706,7 +724,7 @@ main ()
 #endif
 
 #if defined (__386BSD__)
-  printf ("i386-unknown-bsd\n"); exit (0);
+  printf ("i386-pc-bsd\n"); exit (0);
 #endif
 
 #if defined (sequent)
@@ -745,6 +763,7 @@ main ()
   printf ("i860-alliant-bsd\n"); exit (0);
 #endif
 
+/* Begin cases added for Bash */
 #if defined (tahoe)
   printf ("tahoe-cci-bsd\n"); exit (0);
 #endif
@@ -782,7 +801,7 @@ main ()
 #endif
 
 #if defined (qnx) && defined (i386)
-  printf ("i386-unknown-qnx\n"); exit (0);
+  printf ("i386-pc-qnx\n"); exit (0);
 #endif
 
 #if defined (gould)
@@ -849,6 +868,8 @@ main ()
   printf ("hbullx20-bull-sysv3\n"); exit (0);
 #endif
 
+/* End cases added for Bash */
+
   exit (1);
 }
 EOF
@@ -886,6 +907,7 @@ then
     esac
 fi
 
+# Begin cases added for Bash
 case "$UNAME" in
 uts) echo uts-amdahl-sysv${UNAME_RELEASE}; exit 0 ;;
 esac
@@ -898,6 +920,7 @@ if [ -f /bin/fxc.info ]; then
        echo fxc-alliant-concentrix
        exit 0
 fi
+# end cases added for Bash
 
 #echo '(Unable to guess system type)' 1>&2
 
index cd1299a..e800bb6 100755 (executable)
@@ -3,7 +3,7 @@
 #   Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
-# can handle that machine.  It does not imply ALL GNU software can. 
+# can handle that machine.  It does not imply ALL GNU software can.
 #
 # This file is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -41,6 +41,8 @@
 # The goal of this file is to map all the various variations of a given
 # machine specification into a single specification in the form:
 #      CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#      CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
 # It is wrong to echo any other type of specification.
 
 if [ x$1 = x ]
@@ -62,11 +64,21 @@ case $1 in
        ;;
 esac
 
-# Separate what the user gave into CPU-COMPANY and OS (if any).
-basic_machine=`echo $1 | sed 's/-[^-]*$//'`
-if [ $basic_machine != $1 ]
-then os=`echo $1 | sed 's/.*-/-/'`
-else os=; fi
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+  linux-gnu*)
+    os=-$maybe_os
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    ;;
+  *)
+    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+    if [ $basic_machine != $1 ]
+    then os=`echo $1 | sed 's/.*-/-/'`
+    else os=; fi
+    ;;
+esac
 
 ### Let's recognize common machines as not being operating systems so
 ### that things like config.sub decstation-3100 work.  We also
@@ -81,7 +93,8 @@ case $os in
        -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
        -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
        -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-       -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp )
+       -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+       -apple)
                os=
                basic_machine=$1
                ;;
@@ -90,33 +103,33 @@ case $os in
                ;;
        -sco5)
                os=sco3.2v5
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
                ;;
        -sco4)
                os=-sco3.2v4
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
                ;;
        -sco3.2.[4-9]*)
                os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
                ;;
        -sco3.2v[4-9]*)
                # Don't forget version if it is 3.2v4 or newer.
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
                ;;
        -sco*)
                os=-sco3.2v2
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
                ;;
        -isc)
                os=-isc2.2
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
                ;;
        -clix*)
                basic_machine=clipper-intergraph
                ;;
        -isc*)
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
                ;;
        -lynx*)
                os=-lynxos
@@ -127,21 +140,30 @@ case $os in
        -windowsnt*)
                os=`echo $os | sed -e 's/windowsnt/winnt/'`
                ;;
+       -psos*)
+               os=-psos
+               ;;
 esac
 
 # Decode aliases for certain CPU-COMPANY combinations.
 case $basic_machine in
        # Recognize the basic CPU types without company name.
        # Some are omitted here because they have special meanings below.
-       tahoe | i[3456]86 | i860 | m68k | m68000 | m88k | ns32k | arm \
+       tahoe | i860 | m68k | m68000 | m88k | ns32k | arm \
                | arme[lb] | pyramid \
-               | tron | a29k | 580 | i960 | h8300 | hppa1.0 | hppa1.1 \
-               | alpha | we32k | ns16k | clipper | sparclite | i370 | sh \
-               | powerpc | powerpcle | sparc64 | 1750a | dsp16xx | mips64 | mipsel \
+               | tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
+               | alpha | we32k | ns16k | clipper | i370 | sh \
+               | powerpc | powerpcle | 1750a | dsp16xx | mips64 | mipsel \
                | pdp11 | mips64el | mips64orion | mips64orionel \
-               | sparc)
+               | sparc | sparclet | sparclite | sparc64)
                basic_machine=$basic_machine-unknown
                ;;
+       # We use `pc' rather than `unknown'
+       # because (1) that's what they normally are, and
+       # (2) the word "unknown" tends to confuse beginning users.
+       i[3456]86)
+         basic_machine=$basic_machine-pc
+         ;;
        # Object if more than one company name word.
        *-*-*)
                echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
@@ -152,11 +174,11 @@ case $basic_machine in
              | sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \
              | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \
              | none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
-             | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \
+             | hppa-* | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \
              | pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \
-             | c90-* | t90-* \
              | pdp11-* | sh-* | powerpc-* | powerpcle-* | sparc64-* | mips64-* | mipsel-* \
-             | mips64el-* | mips64orion-* | mips64orionel-* | butterfly-bbn* \
+             | mips64el-* | mips64orion-* | mips64orionel-* | f301-* \
+             | butterfly-bbn* \
              | cadmus-* | ews*-nec | ibmrt-ibm* | masscomp-masscomp \
              | tandem-* | symmetric-* | drs6000-icl | *-*ardent | gould-gould \
              | concurrent-* | ksr1-* | esa-ibm | fxc-alliant | *370-amdahl \
@@ -164,7 +186,7 @@ case $basic_machine in
                ;;
        # Recognize the various machine names and aliases which stand
        # for a CPU type and a company and sometimes even an OS.
-       3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc*)
+       3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
                basic_machine=m68000-att
                ;;
        3b*)
@@ -199,6 +221,10 @@ case $basic_machine in
                basic_machine=m68k-apollo
                os=-sysv
                ;;
+       aux)
+               basic_machine=m68k-apple
+               os=-aux
+               ;;
        balance)
                basic_machine=ns32k-sequent
                os=-dynix
@@ -223,14 +249,6 @@ case $basic_machine in
                basic_machine=c38-convex
                os=-bsd
                ;;
-       c90)
-               basic_machine=c90-cray
-               os=-unicos
-               ;;
-       t90)
-               basic_machine=t90-cray
-               os=-unicos
-               ;;
        cray | ymp)
                basic_machine=ymp-cray
                os=-unicos
@@ -239,6 +257,10 @@ case $basic_machine in
                basic_machine=cray2-cray
                os=-unicos
                ;;
+       [ctj]90-cray)
+               basic_machine=c90-cray
+               os=-unicos
+               ;;
        crds | unos)
                basic_machine=m68k-crds
                ;;
@@ -323,6 +345,9 @@ case $basic_machine in
        hp9k8[0-9][0-9] | hp8[0-9][0-9])
                basic_machine=hppa1.0-hp
                ;;
+       hppa-next)
+               os=-nextstep3
+               ;;
        ibm032-*)
                basic_machine=ibmrt-ibm
                ;;
@@ -332,19 +357,19 @@ case $basic_machine in
                ;;
 # I'm not sure what "Sysv32" means.  Should this be sysv3.2?
        i[3456]86v32)
-               basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
                os=-sysv32
                ;;
        i[3456]86v4*)
-               basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
                os=-sysv4
                ;;
        i[3456]86v)
-               basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
                os=-sysv
                ;;
        i[3456]86sol2)
-               basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
                os=-solaris2
                ;;
        iris | iris4d)
@@ -566,6 +591,9 @@ case $basic_machine in
                basic_machine=vax-dec
                os=-vms
                ;;
+       vpp*|vx|vx-*)
+               basic_machine=f301-fujitsu
+               ;;
        vxworks960)
                basic_machine=i960-wrs
                os=-vxworks
@@ -645,6 +673,8 @@ esac
 if [ x"$os" != x"" ]
 then
 case $os in
+       # First match some system type aliases
+       # that might get confused with valid system types.
        # -solaris* is a basic system type, with this one exception.
        -solaris1 | -solaris1.*)
                os=`echo $os | sed -e 's|solaris1|sunos4|'`
@@ -656,24 +686,29 @@ case $os in
                os=-sysv4
                ;;
        -gnu/linux*)
-               os=`echo $os | sed -e 's|gnu/linux|linux|'`
+               os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
                ;;
        # First accept the basic system types.
        # The portable systems comes first.
        # Each alternative MUST END IN A *, to match a version number.
        # -sysv* is not here because it comes later, after sysvr4.
        -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
-             | -vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[3456]* \
+             | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
              | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
              | -amigados* | -msdos* | -newsos* | -unicos* | -aof* | -aos* \
-             | -nindy* | -vxworks* | -ebmon* | -hms* | -mvs* | -clix* \
-             | -riscos* | -linux* | -uniplus* | -iris* | -rtu* | -xenix* \
-             | -hiux* | -386bsd* | -netbsd* | -freebsd* | -riscix* \
+             | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+             | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+             | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
              | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
              | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
-             | -udi* | -eabi* | -lites* | -ieee* | -go32* | -qnx*)
+             | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+             | -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+             | -linux-gnu* | -uxpv* | -qnx* | -powerux)
        # Remember, each alternative MUST END IN *, to match a version number.
                ;;
+       -linux*)
+               os=`echo $os | sed -e 's|linux|linux-gnu|'`
+               ;;
        -sunos5*)
                os=`echo $os | sed -e 's|sunos5|solaris2|'`
                ;;
@@ -844,6 +879,9 @@ case $basic_machine in
        *-masscomp)
                os=-rtu
                ;;
+       f301-fujitsu)
+               os=-uxpv
+               ;;
        *)
                os=-none
                ;;
@@ -892,9 +930,12 @@ case $basic_machine in
                        -ptx*)
                                vendor=sequent
                                ;;
-                       -vxworks*)
+                       -vxsim* | -vxworks*)
                                vendor=wrs
                                ;;
+                       -aux*)
+                               vendor=apple
+                               ;;
                esac
                basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
                ;;
diff --git a/support/mkconffiles b/support/mkconffiles
new file mode 100755 (executable)
index 0000000..0da4288
--- /dev/null
@@ -0,0 +1,65 @@
+#! /bin/sh
+#
+# mkconffiles - create _distribution and _patchlevel files in preparation
+#              for recreating `configure' from `configure.in'
+#
+# options:
+#      -s srcdir       directory where `configure' resides (defaults to `.')
+#      -d outdir       directory where the files should be written (defaults
+#                      to "$srcdir")
+#      -v              verbose
+#      -n              nocreate - don't create the output files
+#
+# Chet Ramey
+# chet@po.cwru.edu
+
+PROG=`basename $0`
+
+# defaults
+srcdir=.
+
+distname="_distribution"
+patchname="_patchlevel"
+
+while [ $# -gt 0 ]; do
+       case "$1" in
+       -s)     shift; srcdir="$1"; shift;;
+       -d)     shift; outdir="$1"; shift;;
+       -v)     shift; verbose=yes ;;
+       -n)     shift; nocreate=yes;;
+       --)     shift; break;;
+       *)      echo "${PROG}: usage: ${PROG} [-s srcdir] [-d outdir] [-nv]" >&2; exit 2;;
+       esac
+done
+
+if [ ! -f ${srcdir}/configure ]; then
+       echo "${PROG}: ${srcdir}/configure not found" >&2
+       exit 1
+fi
+
+# default output directory to source directory
+if [ -z "$outdir" ]; then
+       outdir=${srcdir}
+fi
+
+DISTRIB=`grep '^BASHVERS' ${srcdir}/configure | sed 's:.*=::'`
+PATCH=`grep '^BASHPATCH' ${srcdir}/configure | sed 's:.*=::'`
+
+if [ -n "$verbose" ]; then
+       echo "${PROG}: creating new distribution files for bash-${DISTRIB}.${PATCH} in ${outdir}"
+fi
+
+distout=${outdir}/${distname}
+patchout=${outdir}/${patchname}
+
+if [ -z "$nocreate" ]; then
+       echo "$DISTRIB" > $distout
+       echo "$PATCH"   > $patchout
+fi
+
+if [ -n "$verbose" ]; then
+       echo "${PROG}: created $distout and $patchout"
+fi
+
+exit 0
+
index 655485b..19fd3f2 100644 (file)
@@ -48,15 +48,101 @@ initialize_signames ()
   signal_names[0] = "EXIT";
 
   /* Place signal names which can be aliases for more common signal
-     names first.  This allows (for example) SIGEMT to overwrite SIGGRANT. */
+     names first.  This allows (for example) SIGABRT to overwrite SIGLOST. */
+/* AIX */
+#if defined (SIGLOST)  /* resource lost (eg, record-lock lost) */
+  signal_names[SIGLOST] = "SIGLOST";
+#endif
+
+#if defined (SIGMSG)   /* HFT input data pending */
+  signal_names[SIGMSG] = "SIGMSG";
+#endif
+
+#if defined (SIGDANGER)        /* system crash imminent */
+  signal_names[SIGDANGER] = "SIGDANGER";
+#endif
+
+#if defined (SIGMIGRATE) /* migrate process to another CPU */
+  signal_names[SIGMIGRATE] = "SIGMIGRATE";
+#endif
+
+#if defined (SIGPRE)   /* programming error */
+  signal_names[SIGPRE] = "SIGPRE";
+#endif
+
+#if defined (SIGVIRT)  /* AIX virtual time alarm */
+  signal_names[SIGVIRT] = "SIGVIRT";
+#endif
+
+#if defined (SIGALRM1) /* m:n condition variables */
+  signal_names[SIGALRM1] = "SIGALRM1";
+#endif
+
+#if defined (SIGWAITING)       /* m:n scheduling */
+  signal_names[SIGWAITING] = "SIGWAITING";
+#endif
+
 #if defined (SIGGRANT) /* HFT monitor mode granted */
   signal_names[SIGGRANT] = "SIGGRANT";
 #endif
 
+#if defined (SIGKAP)   /* keep alive poll from native keyboard */
+  signal_names[SIGKAP] = "SIGKAP";
+#endif
+
 #if defined (SIGRETRACT) /* HFT monitor mode retracted */
   signal_names[SIGRETRACT] = "SIGRETRACT";
 #endif
 
+#if defined (SIGSOUND) /* HFT sound sequence has completed */
+  signal_names[SIGSOUND] = "SIGSOUND";
+#endif
+
+#if defined (SIGSAK)   /* Secure Attention Key */
+  signal_names[SIGSAK] = "SIGSAK";
+#endif
+
+/* SunOS5 */
+#if defined (SIGLWP)   /* special signal used by thread library */
+  signal_names[SIGLWP] = "SIGLWP";
+#endif
+
+#if defined (SIGFREEZE)        /* special signal used by CPR */
+  signal_names[SIGFREEZE] = "SIGFREEZE";
+#endif
+
+#if defined (SIGTHAW)  /* special signal used by CPR */
+  signal_names[SIGTHAW] = "SIGTHAW";
+#endif
+
+#if defined (SIGCANCEL)        /* thread cancellation signal used by libthread */
+  signal_names[SIGCANCEL] = "SIGCANCEL";
+#endif
+
+/* HP-UX */
+#if defined (SIGDIL)   /* DIL signal (?) */
+  signal_names[SIGDIL] = "SIGDIL";
+#endif
+
+/* System V */
+#if defined (SIGCLD)   /* Like SIGCHLD.  */
+  signal_names[SIGCLD] = "SIGCLD";
+#endif
+
+#if defined (SIGPWR)   /* power state indication */
+  signal_names[SIGPWR] = "SIGPWR";
+#endif
+
+#if defined (SIGPOLL)  /* Pollable event (for streams)  */
+  signal_names[SIGPOLL] = "SIGPOLL";
+#endif
+
+/* Unknown */
+#if defined (SIGWINDOW)
+  signal_names[SIGWINDOW] = "SIGWINDOW";
+#endif
+
+/* Common */
 #if defined (SIGHUP)   /* hangup */
   signal_names[SIGHUP] = "SIGHUP";
 #endif
@@ -77,14 +163,14 @@ initialize_signames ()
   signal_names[SIGTRAP] = "SIGTRAP";
 #endif
 
-#if defined (SIGABRT)  /* Cause current process to dump core. */
-  signal_names[SIGABRT] = "SIGABRT";
-#endif
-
 #if defined (SIGIOT)   /* IOT instruction */
   signal_names[SIGIOT] = "SIGIOT";
 #endif
 
+#if defined (SIGABRT)  /* Cause current process to dump core. */
+  signal_names[SIGABRT] = "SIGABRT";
+#endif
+
 #if defined (SIGEMT)   /* EMT instruction */
   signal_names[SIGEMT] = "SIGEMT";
 #endif
@@ -121,18 +207,6 @@ initialize_signames ()
   signal_names[SIGTERM] = "SIGTERM";
 #endif
 
-#if defined (SIGCLD)   /* Like SIGCHLD.  */
-  signal_names[SIGCLD] = "SIGCLD";
-#endif
-
-#if defined (SIGPWR)   /* Magic thing for some machines. */
-  signal_names[SIGPWR] = "SIGPWR";
-#endif
-
-#if defined (SIGPOLL)  /* For keyboard input?  */
-  signal_names[SIGPOLL] = "SIGPOLL";
-#endif
-
 #if defined (SIGURG)   /* urgent condition on IO channel */
   signal_names[SIGURG] = "SIGURG";
 #endif
@@ -185,8 +259,9 @@ initialize_signames ()
   signal_names[SIGWINCH] = "SIGWINCH";
 #endif
 
-#if defined (SIGLOST)  /* resource lost (eg, record-lock lost) */
-  signal_names[SIGLOST] = "SIGLOST";
+/* 4.4 BSD */
+#if defined (SIGINFO)  /* information request */
+  signal_names[SIGINFO] = "SIGINFO";
 #endif
 
 #if defined (SIGUSR1)  /* user defined signal 1 */
@@ -197,42 +272,6 @@ initialize_signames ()
   signal_names[SIGUSR2] = "SIGUSR2";
 #endif
 
-#if defined (SIGMSG)   /* HFT input data pending */
-  signal_names[SIGMSG] = "SIGMSG";
-#endif
-
-#if defined (SIGPWR)   /* power failure imminent (save your data) */
-  signal_names[SIGPWR] = "SIGPWR";
-#endif
-
-#if defined (SIGDANGER)        /* system crash imminent */
-  signal_names[SIGDANGER] = "SIGDANGER";
-#endif
-
-#if defined (SIGMIGRATE) /* migrate process to another CPU */
-  signal_names[SIGMIGRATE] = "SIGMIGRATE";
-#endif
-
-#if defined (SIGPRE)   /* programming error */
-  signal_names[SIGPRE] = "SIGPRE";
-#endif
-
-#if defined (SIGSOUND) /* HFT sound sequence has completed */
-  signal_names[SIGSOUND] = "SIGSOUND";
-#endif
-
-#if defined (SIGWINDOW)
-  signal_names[SIGWINDOW] = "SIGWINDOW";
-#endif
-
-#if defined (SIGDIL)
-  signal_names[SIGDIL] = "SIGDIL";
-#endif
-
-#if defined (SIGSAK)   /* Secure Attention Key */
-  signal_names[SIGSAK] = "SIGSAK";
-#endif
-
   for (i = 0; i < NSIG; i++)
     if (signal_names[i] == (char *)NULL)
       {
diff --git a/support/mkversion.c b/support/mkversion.c
deleted file mode 100644 (file)
index 8164a8f..0000000
+++ /dev/null
@@ -1,305 +0,0 @@
-/* Simple program to make new version numbers for the shell.
-   Big deal, but it was getting out of hand to do everything
-   in the makefile. */
-
-/* Copyright (C) 1989 Free Software Foundation, Inc.
-
-This file is part of GNU Bash, the Bourne Again SHell.
-
-Bash is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 1, or (at your option) any later
-version.
-
-Bash is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License along
-with Bash; see the file COPYING.  If not, write to the Free Software
-Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include "config.h"
-
-#include <sys/types.h>
-#include "posixstat.h"
-#include <stdio.h>
-#include "bashansi.h"
-
-char *progname;
-char *dir;
-char *status;
-
-FILE *must_open ();
-
-main (argc, argv)
-     int argc;
-     char **argv;
-{
-  FILE *file;
-  float distver = 0.0;
-  int buildver = 0, patchlevel = 0;
-  int dist = 0, build = 0, patch = 0;
-  int dist_inc = 0, build_inc = 0, patch_inc = 0;
-  int dot_dist_needs_making = 0;
-  int arg_index = 1;
-  struct stat sb;
-
-  progname = argv[0];
-
-  status = dir = (char *)0;
-  while (arg_index < argc && argv[arg_index][0] == '-')
-    {
-      if (strcmp (argv[arg_index], "-dist") == 0)
-        {
-         dist++;
-         dist_inc++;
-        }
-      else if (strcmp (argv[arg_index], "-build") == 0)
-        {
-         build++;
-         build_inc++;
-        }
-      else if (strcmp (argv[arg_index], "-patch") == 0)
-        {
-          patch++;
-         patch_inc++;
-        }
-      else if (strcmp (argv[arg_index], "-dir") == 0)
-       {
-         dir = argv[++arg_index];
-         if (dir == 0)
-           {
-             fprintf (stderr, "%s: `-dir' requires an argument\n", progname);
-             exit (1);
-           }
-         if (stat (dir, &sb) < 0)
-           {
-             fprintf (stderr, "%s: cannot stat %s\n", progname, dir);
-             exit (1);
-           }
-         if ((sb.st_mode & S_IFMT) != S_IFDIR)
-           {
-             fprintf (stderr, "%s: not a directory\n", progname);
-             exit (1);
-           }
-       }
-      else if (strcmp (argv[arg_index], "-status") == 0)
-        {
-          status = argv[++arg_index];
-         if (status == 0)
-           {
-             fprintf (stderr, "%s: `-status' requires an argument\n", progname);
-             exit (1);
-           }
-        }
-      else
-       {
-         fprintf (stderr, "%s: unknown option: %s\n", progname, argv[arg_index]);
-         fprintf (stderr, "usage: %s [-dist|-patch|-build] [-dir directory]\n", progname);
-         exit (1);
-       }
-      arg_index++;
-    }
-
-  if (get_float_from_file (".distribution", &distver, 1) == 0)
-    dot_dist_needs_making++;
-
-  if (get_int_from_file (".patchlevel", &patchlevel, 1) == 0)
-    {
-      patchlevel = 0;
-      patch_inc = 0;
-    }
-
-  if (get_int_from_file (".build", &buildver, 0) == 0)
-    buildver = 0;
-
-  /* Setting distribution version. */
-  if (dist && arg_index < argc)
-    if (sscanf (argv[arg_index], "%f", &distver) != 1)
-      {
-       fprintf (stderr, "%s: Bad input `%s'.  Expected float value for -dist.\n",
-                progname, argv[arg_index]);
-       exit (1);
-      }
-    else
-      {
-       arg_index++;
-       dist_inc = 0;
-      }
-
-  /* Setting patchlevel via argument. */
-  if (patch && arg_index < argc)
-    if (sscanf (argv[arg_index], "%d", &patchlevel) != 1)
-      {
-       fprintf (stderr, "%s: Bad input `%s'.  Expected int value for -patch.\n",
-                progname, argv[arg_index]);
-       exit (1);
-      }
-    else
-      {
-       arg_index++;
-       patch_inc = 0;
-      }
-    
-  if (build && arg_index < argc)
-    if (sscanf (argv[arg_index], "%d", &buildver) != 1)
-      {
-       fprintf (stderr, "%s: Bad input `%s'.  Expected int value for -build.\n",
-                progname, argv[arg_index]);
-       exit (1);
-      }
-    else
-      {
-       arg_index++;
-       build_inc = 0;
-      }
-
-  if (dot_dist_needs_making && !distver)
-    {
-      fprintf (stderr, "%s: There is no `.distribution' file to infer from.\n", progname);
-      exit (1);
-    }
-
-  if (dist_inc)
-    distver = distver + 0.01;
-
-  if (patch_inc)
-    patchlevel++;
-
-  if (build_inc)
-    buildver++;
-
-  file = must_open ("newversion.h", "w");
-
-  /* Output the leading comment. */
-  fprintf (file, 
-"/* Version control for the shell.  This file gets changed when you say\n\
-   `make newversion' to the Makefile.  It is created by mkversion. */\n");
-
-  fprintf (file, "\n/* The distribution version number of this shell. */\n");
-  fprintf (file, "#define DISTVERSION \"%.2f\"\n", distver);
-
-  fprintf (file, "\n/* The patch level of this version of the shell. */\n");
-  fprintf (file, "#define PATCHLEVEL %d\n", patchlevel);
-
-  fprintf (file, "\n/* The last built version of this shell. */\n");
-  fprintf (file, "#define BUILDVERSION %d\n", buildver);
-
-  if (status)
-    {
-      fprintf (file, "\n/* The release status of this shell. */\n");
-      fprintf (file, "#define RELSTATUS \"%s\"\n", status);
-    }
-
-  fprintf (file, "\n/* A version string for use by sccs and the what command. */\n\n");
-  if (status)
-    fprintf (file, "#define SCCSVERSION \"@(#)Bash version %.2f.%d(%d) %s GNU\"\n\n",
-      distver, patchlevel, buildver, status);
-  else
-    fprintf (file, "#define SCCSVERSION \"@(#)Bash version %.2f.%d(%d) GNU\"\n\n",
-      distver, patchlevel, buildver);
-
-  fclose (file);
-
-  file = must_open (".build", "w");
-  fprintf (file, "%d\n", buildver);
-  fclose (file);
-
-  /* Making a new distribution. */
-  if (dist)
-    {
-      file = must_open (".distribution", "w");
-      fprintf (file, "%.2f\n", distver);
-      fclose (file);
-    }
-
-  /* Releasing a new patch level. */
-  if (patch)
-    {
-      file = must_open (".patchlevel", "w");
-      fprintf (file, "%d\n", patchlevel);
-      fclose (file);
-    }
-
-  exit (0);
-}
-
-char *
-makename (fn, from_srcdir)
-     char *fn;
-{
-  char *ret;
-  int dlen;
-
-  dlen = (from_srcdir && dir) ? strlen (dir) + 1 : 0;
-  ret = (char *)malloc (dlen + strlen (fn) + 1);
-  if (ret == 0)
-    {
-      fprintf (stderr, "%s: malloc failed\n", progname);
-      exit (1);
-    }
-  if (from_srcdir && dir)
-    sprintf (ret, "%s/%s", dir, fn);
-  else
-    (void)strcpy (ret, fn);
-
-  return ret;
-}
-
-get_float_from_file (filename, var, from_srcdir)
-     char *filename;
-     float *var;
-     int from_srcdir;
-{
-  FILE *stream;
-  int result;
-  char *name;
-
-  name = makename (filename, from_srcdir);
-  stream = fopen (name, "r");
-  free (name);
-  if (stream == (FILE *)NULL)
-    return (0);
-  result = fscanf (stream, "%f\n", var);
-  fclose (stream);
-  return (result == 1);
-}
-
-get_int_from_file (filename, var, from_srcdir)
-     char *filename;
-     int *var, from_srcdir;
-{
-  FILE *stream;
-  int result;
-  char *name;
-
-  name = makename (filename, from_srcdir);
-  stream = fopen (name, "r");
-  free (name);
-  if (stream == (FILE *)NULL)
-    return (0);
-  result = fscanf (stream, "%d\n", var);
-  fclose (stream);
-  return (result == 1);
-}
-
-FILE *
-must_open (name, mode)
-     char *name, *mode;
-{
-  FILE *temp = fopen (name, mode);
-
-  if (!temp)
-    {
-      fprintf (stderr, "%s: Cannot open `%s' for mode `%s'.\n",
-              progname, name, mode);
-      fprintf
-       (stderr,
-        "Perhaps you don't have %s permission to the file or directory.\n",
-        (strcmp (mode, "w") == 0) ? "write" : "read");
-      exit (3);
-    }
-  return (temp);
-}
diff --git a/support/mkversion.sh b/support/mkversion.sh
new file mode 100755 (executable)
index 0000000..6adbe4c
--- /dev/null
@@ -0,0 +1,105 @@
+#! /bin/sh
+
+# Simple program to make new version numbers for the shell.
+# Big deal, but it was getting out of hand to do everything
+# in the makefile.  This creates a file named by the -o option,
+# otherwise everything is echoed to the standard output.
+
+PROGNAME=`basename $0`
+USAGE="$PROGNAME [-b] -d version -p patchlevel [-s status]"
+
+while [ $# -gt 0 ]; do
+       case "$1" in
+       -o)     shift; OUTFILE=$1; shift ;;
+       -b)     shift; inc_build=yes ;;
+       -s)     shift; rel_status=$1; shift ;;
+       -p)     shift; patch_level=$1; shift ;;
+       -d)     shift; dist_version=$1; shift ;;
+       *)      echo "$PROGNAME: usage: $USAGE" >&2 ; exit 2 ;;
+       esac
+done
+
+# Required arguments
+if [ -z "$dist_version" ]; then
+       echo "${PROGNAME}: required argument -d missing" >&2
+       echo "$PROGNAME: usage: $USAGE" >&2
+       exit 1
+fi
+
+if [ -z "$patch_level" ]; then
+       echo "${PROGNAME}: required argument -p missing" >&2
+       echo "$PROGNAME: usage: $USAGE" >&2
+       exit 1
+fi
+
+# Defaults
+if [ -z "$rel_status" ]; then
+       rel_status="release"
+fi
+
+build_ver=
+if [ -r .build ]; then
+       build_ver=`cat .build`
+fi
+if [ -z "$build_ver" ]; then
+       build_ver=0
+fi
+
+# increment the build version if that's what's required
+
+if [ -n "$inc_build" ]; then
+       build_ver=`expr $build_ver + 1`
+fi
+
+# If we have an output file specified, make it the standard output
+if [ -n "$OUTFILE" ]; then
+       if exec >$OUTFILE; then
+               :
+       else
+               echo "${PROGNAME}: cannot redirect standard output to $OUTFILE" >&2
+               exit 1
+       fi
+fi
+
+# Output the leading comment.
+echo "/* Version control for the shell.  This file gets changed when you say"
+echo "   \`make version.h' to the Makefile.  It is created by mkversion. */"
+
+# Output the distribution version
+float_dist=`echo $dist_version | awk '{printf "%.2f\n", $1}'`
+
+echo
+echo "/* The distribution version number of this shell. */"
+echo "#define DISTVERSION \"${float_dist}\""
+
+# Output the patch level
+echo
+echo "/* The patch level of this version of the shell. */"
+echo "#define PATCHLEVEL ${patch_level}"
+
+# Output the build version
+echo
+echo "/* The last built version of this shell. */"
+echo "#define BUILDVERSION ${build_ver}"
+
+# Output the release status
+echo
+echo "/* The release status of this shell. */"
+echo "#define RELSTATUS \"${rel_status}\""
+
+# Output the SCCS version string
+sccs_string="${float_dist}.${patch_level}(${build_ver}) ${rel_status} GNU"
+echo
+echo "/* A version string for use by sccs and the what command. */"
+echo "#define SCCSVERSION \"@(#)Bash version ${sccs_string}\""
+
+if [ -n "$inc_build" ]; then
+       # Make sure we can write to .build
+       if [ -f .build ] && [ ! -w .build ]; then
+               echo "$PROGNAME: cannot write to .build, not incrementing build version" >&2
+       else
+               echo "$build_ver" > .build
+       fi
+fi
+       
+exit 0
diff --git a/support/printenv.c b/support/printenv.c
new file mode 100644 (file)
index 0000000..0355f85
--- /dev/null
@@ -0,0 +1,47 @@
+/* printenv -- minimal clone of BSD printenv(1).
+
+   usage: printenv [varname]
+
+   Chet Ramey
+   chet@po.cwru.edu
+*/
+
+extern char **environ;
+
+int
+main (argc, argv) 
+     int argc;
+     char **argv;
+{
+  register char **envp, *eval;
+  int len;
+
+  argv++;
+  argc--;
+
+  /* printenv */
+  if (argc == 0)
+    {
+      for (envp = environ; *envp; envp++)
+       puts (*envp);
+      exit (0);
+    }
+
+  /* printenv varname */
+  len = strlen (*argv);
+  for (envp = environ; *envp; envp++)
+    {
+      if (**argv == **envp && strncmp (*envp, *argv, len) == 0)
+       {
+         eval = *envp + len;
+         /* If the environment variable doesn't have an `=', ignore it. */
+         if (*eval == '=')
+           {
+             puts (eval + 1);
+             exit (0);
+           }
+       }
+    }
+  exit (1);
+}
+  
similarity index 100%
rename from support/printenv
rename to support/printenv.sh
index 847fa2c..141c763 100644 (file)
@@ -1,5 +1,8 @@
 #include <stdio.h>
 
+void strprint();
+
+int
 main(argc, argv)
 int    argc;
 char   **argv;
@@ -11,13 +14,14 @@ char        **argv;
                strprint(argv[i]);
                printf(">\n");
        }
+       exit(0);
 }
 
+void
 strprint(str)
 char   *str;
 {
        register char *s;
-       int     c;
 
        for (s = str; s && *s; s++) {
                if (*s < ' ') {
@@ -29,5 +33,4 @@ char  *str;
                } else
                        putchar(*s);
        }
-       return(0);
 }
diff --git a/support/xenix-link.sh b/support/xenix-link.sh
new file mode 100755 (executable)
index 0000000..8565563
--- /dev/null
@@ -0,0 +1,68 @@
+:
+# link bash for Xenix under SCO Unix
+#
+# For xenix 2.2:
+#      CC="cc -xenix -lx" ./configure
+#      edit config.h:
+#              comment out the define for HAVE_DIRENT_H
+#              enable the define for HAVE_SYS_NDIR_H to 1
+#      make
+#      CC="cc -xenix -lx" ./link.sh
+#
+# For xenix 2.3:
+#      CC="cc -x2.3" ./configure
+#      make
+#      CC="cc -x2.3" ./link.sh
+
+set -x
+
+rm -f bash
+
+if [ -z "$CC" ]
+then
+       if [ -f /unix -a ! -f /xenix ]
+       then
+               CC="cc -xenix"
+       else
+               CC=gcc
+       fi
+fi
+
+try_dir=no
+try_23=no
+try_x=yes
+
+case "$CC" in
+*-ldir*) try_dir=yes ;;
+esac
+
+case "$CC" in
+*-lx*) try_23=no ; try_x=yes ;;
+esac
+
+case "$CC" in
+*-x2.3*|*-l2.3*) try_23=yes ; try_dir=yes ;;
+esac
+
+libs=
+try="socket"
+if [ $try_dir = yes ] ; then try="$try dir" ; fi
+if [ $try_23 = yes ] ; then try="$try 2.3" ; fi
+if [ $try_x = yes ] ; then try="$try x" ; fi
+for name in $try
+do
+       if [ -r "/lib/386/Slib${name}.a" ] ; then libs="$libs -l$name" ; fi
+done
+
+$CC -o bash shell.o eval.o y.tab.o \
+general.o make_cmd.o print_cmd.o dispose_cmd.o execute_cmd.o variables.o \
+copy_cmd.o error.o expr.o flags.o nojobs.o subst.o hashcmd.o hashlib.o \
+mailcheck.o trap.o input.o unwind_prot.o pathexp.o sig.o test.o \
+version.o alias.o array.o braces.o bracecomp.o bashhist.o bashline.o \
+getcwd.o siglist.o vprint.o oslib.o list.o stringlib.o locale.o \
+xmalloc.o builtins/libbuiltins.a \
+lib/readline/libreadline.a lib/readline/libhistory.a \
+-ltermcap lib/glob/libglob.a lib/tilde/libtilde.a lib/malloc/libmalloc.a \
+$libs
+
+ls -l bash
diff --git a/test.c b/test.c
index dae19ac..4b7c829 100644 (file)
--- a/test.c
+++ b/test.c
    with Bash; see the file COPYING.  If not, write to the Free Software
    Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
 
-/* Define STANDALONE to get the /bin/test version.  Otherwise, you get
-   the shell builtin version. */
-/* #define STANDALONE */
-
 /* Define PATTERN_MATCHING to get the csh-like =~ and !~ pattern-matching
    binary operators. */
 /* #define PATTERN_MATCHING */
 
 #include <stdio.h>
 
-#if defined (STANDALONE)
-#  include <sys/types.h>
-#else
-#  include "bashtypes.h"
-#endif
+#include "bashtypes.h"
 
 #if defined (HAVE_LIMITS_H)
 #  include <limits.h>
 #include "posixstat.h"
 #include "filecntl.h"
 
-#if !defined (STANDALONE)
-#  include "shell.h"
-#  include "builtins/common.h"
-#  define main test_command
-#  define isint legal_number
-#  define getuid() current_user.uid
-#  define geteuid() current_user.euid
-#  define getgid() current_user.gid
-#  define getegid() current_user.egid
-#else /* STANDALONE */
-#  if !defined (S_IXUGO)
-#    define S_IXUGO 0111
-#  endif
-#  if defined (HAVE_UNISTD_H)
-#    include <unistd.h>
-#  endif /* HAVE_UNISTD_H */
-#  define whitespace(c) (((c) == ' ') || ((c) == '\t'))
-#  define digit(c)  ((c) >= '0' && (c) <= '9')
-#  define digit_value(c) ((c) - '0')
-#endif /* STANDALONE */
+#include "shell.h"
+#include "builtins/common.h"
 
 #if !defined (STRLEN)
 #  define STRLEN(s) ((s)[0] ? ((s)[1] ? ((s)[2] ? strlen(s) : 2) : 1) : 0)
@@ -94,16 +68,6 @@ extern int errno;
 #  define member(c, s) (int)((c) ? (char *)strchr ((s), (c)) : 0)
 #endif /* !member */
 
-/* Make gid_t and uid_t mean something for non-posix systems. */
-#if defined (STANDALONE) && !defined (_POSIX_VERSION) && !defined (HAVE_UID_T)
-#  if !defined (gid_t)
-#    define gid_t int
-#  endif
-#  if !defined (uid_t)
-#    define uid_t int
-#  endif
-#endif /* STANDALONE && !_POSIX_VERSION && !HAVE_UID_T */
-
 #if !defined (R_OK)
 #define R_OK 4
 #define W_OK 2
@@ -130,14 +94,10 @@ extern int errno;
 #define FALSE 0
 #define SHELL_BOOLEAN(value) (!(value))
 
-#if defined (STANDALONE)
-#  define test_exit(val) exit (val)
-#else
 static procenv_t test_exit_buf;
 static int test_error_return;
-#  define test_exit(val) \
+#define test_exit(val) \
        do { test_error_return = val; longjmp (test_exit_buf, 1); } while (0)
-#endif /* STANDALONE */
 
 #if defined (AFS)
   /* We have to use access(2) for machines running AFS, because it's
@@ -153,9 +113,6 @@ static int argc;    /* The number of arguments present in ARGV. */
 static char **argv;    /* The argument list. */
 static int noeval;
 
-#if defined (STANDALONE)
-static int isint ();
-#endif
 static int unop ();
 static int binop ();
 static int unary_operator ();
@@ -175,12 +132,10 @@ static void
 test_syntax_error (format, arg)
      char *format, *arg;
 {
-#if !defined (STANDALONE)
   extern int interactive_shell;
   extern char *get_name_for_error ();
   if (interactive_shell == 0)
     fprintf (stderr, "%s: ", get_name_for_error ());
-#endif
   fprintf (stderr, "%s: ", argv[0]);
   fprintf (stderr, format, arg);
   fprintf (stderr, "\n");
@@ -204,7 +159,7 @@ test_stat (path, finfo)
     {
 #if !defined (HAVE_DEV_FD)
       long fd;
-      if (isint (path + 8, &fd))
+      if (legal_number (path + 8, &fd))
        return (fstat ((int)fd, finfo));
       else
        {
@@ -234,15 +189,11 @@ test_eaccess (path, mode)
      int mode;
 {
   struct stat st;
-  static int euid = -1;
 
   if (test_stat (path, &st) < 0)
     return (-1);
 
-  if (euid == -1)
-    euid = geteuid ();
-
-  if (euid == 0)
+  if (current_user.euid == 0)
     {
       /* Root can read or write any file. */
       if (mode != X_OK)
@@ -254,7 +205,7 @@ test_eaccess (path, mode)
        return (0);
     }
 
-  if (st.st_uid == euid)        /* owner */
+  if (st.st_uid == current_user.euid)        /* owner */
     mode <<= 6;
   else if (group_member (st.st_gid))
     mode <<= 3;
@@ -265,74 +216,6 @@ test_eaccess (path, mode)
   return (-1);
 }
 
-#if defined (HAVE_GETGROUPS)
-/* The number of groups that this user is a member of. */
-static int ngroups, maxgroups;
-static GETGROUPS_T *group_array = (GETGROUPS_T *)NULL;
-#endif /* HAVE_GETGROUPS */
-
-#if !defined (NOGROUP)
-#  define NOGROUP (gid_t) -1
-#endif
-
-#if defined (HAVE_GETGROUPS)
-
-#  if defined (NGROUPS_MAX)
-#    define getmaxgroups() NGROUPS_MAX
-#  else /* !NGROUPS_MAX */
-#    if defined (NGROUPS)
-#      define getmaxgroups() NGROUPS
-#    else /* !NGROUPS */
-#      define getmaxgroups() 64
-#    endif /* !NGROUPS */
-#  endif /* !NGROUPS_MAX */
-
-#endif /* HAVE_GETGROUPS */
-
-/* Return non-zero if GID is one that we have in our groups list. */
-int
-group_member (gid)
-     gid_t gid;
-{
-  static gid_t pgid = (gid_t)NOGROUP;
-  static gid_t egid = (gid_t)NOGROUP;
-#if defined (HAVE_GETGROUPS)
-  register int i;
-#endif
-
-  if (pgid == (gid_t)NOGROUP)
-    pgid = (gid_t) getgid ();
-
-  if (egid == (gid_t)NOGROUP)
-    egid = (gid_t) getegid ();
-
-  if (gid == pgid || gid == egid)
-    return (1);
-
-#if defined (HAVE_GETGROUPS)
-  /* getgroups () returns the number of elements that it was able to
-     place into the array. */
-  if (ngroups == 0)
-    {
-      if (maxgroups == 0)
-       maxgroups = getmaxgroups ();
-      group_array = (GETGROUPS_T *)xrealloc (group_array, maxgroups * sizeof (GETGROUPS_T));
-      ngroups = getgroups (maxgroups, group_array);
-    }
-
-  /* In case of error, the user loses. */
-  if (ngroups <= 0)
-    return (0);
-
-  /* Search through the list looking for GID. */
-  for (i = 0; i < ngroups; i++)
-    if (gid == (gid_t)group_array[i])
-      return (1);
-#endif /* HAVE_GETGROUPS */
-
-  return (0);
-}
-
 /* Increment our position in the argument list.  Check that we're not
    past the end of the argument list.  This check is supressed if the
    argument is FALSE.  Made a macro for efficiency. */
@@ -358,68 +241,6 @@ integer_expected_error (pch)
   test_syntax_error ("%s: integer expression expected", pch);
 }
 
-#if defined (STANDALONE)
-/* Return non-zero if the characters pointed to by STRING constitute a
-   valid number.  Stuff the converted number into RESULT if RESULT is
-   a non-null pointer to a long. */
-static int
-isint (string, result)
-     register char *string;
-     long *result;
-{
-  int sign;
-  long value;
-
-  sign = 1;
-  value = 0;
-
-  if (result)
-    *result = 0;
-
-  /* Skip leading whitespace characters. */
-  while (whitespace (*string))
-    string++;
-
-  if (!*string)
-    return (0);
-
-  /* We allow leading `-' or `+'. */
-  if (*string == '-' || *string == '+')
-    {
-      if (!digit (string[1]))
-       return (0);
-
-      if (*string == '-')
-       sign = -1;
-
-      string++;
-    }
-
-  while (digit (*string))
-    {
-      if (result)
-       value = (value * 10) + digit_value (*string);
-      string++;
-    }
-
-  /* Skip trailing whitespace, if any. */
-  while (whitespace (*string))
-    string++;
-
-  /* Error if not at end of string. */
-  if (*string)
-    return (0);
-
-  if (result)
-    {
-      value *= sign;
-      *result = value;
-    }
-
-  return (1);
-}
-#endif /* STANDALONE */
-
 /*
  * term - parse a term and return 1 or 0 depending on whether the term
  *     evaluates to true or false, respectively.
@@ -471,9 +292,21 @@ term ()
       return (value);
     }
 
+#if 1
   /* are there enough arguments left that this could be dyadic? */
   if ((pos + 3 <= argc) && binop (argv[pos + 1]))
     value = binary_operator ();
+#else
+  /* If this is supposed to be a binary operator, make sure there are
+     enough arguments and fail if there are not. */
+  if ((pos + 1 < argc) && binop (argv[pos+1]))
+    {
+      if (pos + 3 <= argc)
+        value = binary_operator ();
+      else
+        beyond ();
+    }
+#endif
 
   /* Might be a switch type argument */
   else if (argv[pos][0] == '-' && argv[pos][2] == '\0')
@@ -517,9 +350,9 @@ arithcomp (s, t, op)
 {
   long l, r;
 
-  if (isint (s, &l) == 0)
+  if (legal_number (s, &l) == 0)
     integer_expected_error (s);
-  if (isint (t, &r) == 0)
+  if (legal_number (t, &r) == 0)
     integer_expected_error (t);
   switch (op)
     {
@@ -666,12 +499,12 @@ unary_operator ()
     case 'O':                  /* File is owned by you? */
       unary_advance ();
       return (test_stat (argv[pos - 1], &stat_buf) == 0 &&
-             (uid_t) geteuid () == (uid_t) stat_buf.st_uid);
+             (uid_t) current_user.euid == (uid_t) stat_buf.st_uid);
 
     case 'G':                  /* File is owned by your group? */
       unary_advance ();
       return (test_stat (argv[pos - 1], &stat_buf) == 0 &&
-             (gid_t) getegid () == (gid_t) stat_buf.st_gid);
+             (gid_t) current_user.egid == (gid_t) stat_buf.st_gid);
 
     case 'f':                  /* File is a file? */
       unary_advance ();
@@ -756,7 +589,7 @@ unary_operator ()
 
     case 't':  /* File fd is a terminal?  fd defaults to stdout. */
       advance (0);
-      if (pos < argc && isint (argv[pos], &r))
+      if (pos < argc && legal_number (argv[pos], &r))
        {
          advance (0);
          return (isatty ((int)r));
@@ -771,11 +604,9 @@ unary_operator ()
       unary_advance ();
       return (argv[pos - 1][0] == '\0');
 
-#if !defined (STANDALONE)
     case 'o':
       unary_advance ();
       return (minus_o_option_value (argv[pos - 1]) == 1);
-#endif /* !STANDALONE */
     }
 }
 
@@ -842,9 +673,9 @@ binop (s)
 
   if (s[0] == '=' && s[1] == '\0')
     return (1);                /* '=' */
-  else if (s[1] == '\0' && (s[0] == '<' || s[0] == '>'))  /* string <, > */
+  else if ((s[0] == '<' || s[0] == '>') && s[1] == '\0')  /* string <, > */
     return (1);
-  else if (s[2] == '\0' && s[1] == '=' && (s[0] == '=' || s[0] == '!'))
+  else if ((s[0] == '=' || s[0] == '!') && s[1] == '=' && s[2] == '\0')
     return (1);                /* `==' and `!=' */
 #if defined (PATTERN_MATCHING)
   else if (s[2] == '\0' && s[1] == '~' && (s[0] == '=' || s[0] == '!'))
@@ -902,9 +733,7 @@ unop (op)
     case 'p': case 'r': case 's': case 't': case 'u':
     case 'w': case 'x': case 'z':
     case 'G': case 'L': case 'O': case 'S':
-#if !defined (STANDALONE)
     case 'o':
-#endif
       return (1);
     }
   return (0);
@@ -1015,20 +844,18 @@ posixtest ()
  *     test expr
  */
 int
-main (margc, margv)
+test_command (margc, margv)
      int margc;
      char **margv;
 {
   int value;
 
-#if !defined (STANDALONE)
   int code;
 
   code = setjmp (test_exit_buf);
 
   if (code)
     return (test_error_return);
-#endif /* !STANDALONE */
 
   argv = margv;
 
index a369bd8..54c087d 100644 (file)
 ./arith.tests: let: rv = 7 + (43 * 6: missing `)' (error token is "6")
 ./arith.tests: 0#4: bad number (error token is "0#4")
 ./arith.tests: 2#110#11: bad number (error token is "2#110#11")
+abc
+def
+ghi
+ok
+6
+1
+0
+./arith.tests: 4 + : syntax error: operand expected (error token is " ")
+16
+./arith.tests: 4 ? : 3 + 5 : expression expected (error token is ": 3 + 5 ")
+./arith.tests: 1 ? 20 : `:' expected for conditional expression (error token is " ")
+./arith.tests: 4 ? 20 : : expression expected (error token is " ")
+9
+./arith.tests: 0 && B=42 : attempted assignment to non-variable (error token is "=42 ")
+9
+./arith.tests: 1 || B=88 : attempted assignment to non-variable (error token is "=88 ")
+9
+0
+9
+0
+9
+1
+9
+7
+7
+4
index 6bad312..5f6298c 100644 (file)
@@ -1,3 +1,4 @@
+set +o posix
 declare -i iv jv
 
 iv=$(( 3 + 5 * 32 ))
@@ -156,3 +157,59 @@ let 'rv = 7 + (43 * 6'
 declare -i i
 i=0#4
 i=2#110#11
+
+((echo abc; echo def;); echo ghi)
+
+if (((4+4) + (4 + 7))); then
+       echo ok
+fi
+
+(())   # make sure the null expression works OK
+
+a=(0 2 4 6)
+echo $(( a[1] + a[2] ))
+echo $(( (a[1] + a[2]) == a[3] ))
+(( (a[1] + a[2]) == a[3] )) ; echo $?
+
+# test pushing and popping the expression stack
+unset A
+A="4 + "
+echo $(( ( 4 + A ) + 4 ))
+A="3 + 5"
+echo $(( ( 4 + A ) + 4 ))
+
+# badly-formed conditional expressions
+echo $(( 4 ? : $A ))
+echo $(( 1 ? 20 ))
+echo $(( 4 ? 20 : ))
+
+# precedence and short-circuit evaluation
+B=9
+echo $B
+
+echo $(( 0 && B=42 ))
+echo $B
+
+echo $(( 1 || B=88 ))
+echo $B
+
+echo $(( 0 && (B=42) ))
+echo $B
+
+echo $(( (${$} - $$) && (B=42) ))
+echo $B
+
+echo $(( 1 || (B=88) ))
+echo $B
+
+# until command with (( )) command
+x=7
+
+echo $x
+until (( x == 4 ))
+do
+       echo $x
+       x=4
+done
+
+echo $x
index d4a3398..e142fdb 100644 (file)
@@ -1,4 +1,5 @@
 abcde
+abcde
 abcde bdef
 abcde bdef
 declare -a DIRSTACK='()'
@@ -52,12 +53,12 @@ declare -a f='([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element
 this of
 this is a test of read using arrays
 declare -a DIRSTACK='()'
-declare -a rv='([0]="this" [1]="is" [2]="a" [3]="test" [4]="of" [5]="read" [6]="using" [7]="arrays")'
 declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
 declare -a b='([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")'
 declare -ar c='()'
 declare -a d='([1]="test test" [2]="bdef" [5]="hello world" [6]="test" [9]="ninth element")'
 declare -a f='([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")'
+declare -a rv='([0]="this" [1]="is" [2]="a" [3]="test" [4]="of" [5]="read" [6]="using" [7]="arrays")'
 abde
 abde
 bbb
@@ -76,3 +77,21 @@ b c
 d
 e f g
 h
+/bin /usr/bin /usr/ucb /usr/local/bin . /sbin /usr/sbin
+bin bin ucb bin . sbin sbin
+bin
+/ / / / / /
+/
+\bin \usr/bin \usr/ucb \usr/local/bin . \sbin \usr/sbin
+\bin \usr\bin \usr\ucb \usr\local\bin . \sbin \usr\sbin
+\bin \usr\bin \usr\ucb \usr\local\bin . \sbin \usr\sbin
+4 -- 4
+7 -- 7
+55
+49
+6 -- 6
+42 14 44
+grep [ 123 ] *
+6 7 9
+6 7 9 5
+./array.tests: narray: unbound variable
index 2ee376b..0b03080 100644 (file)
@@ -1,6 +1,17 @@
+# this is needed so that the bad assignments (b[]=bcde, for example) do not
+# cause fatal shell errors when in posix mode
+set +o posix
+
 set +a
 # The calls to egrep -v are to filter out builtin array variables that are
 # automatically set and possibly contain values that vary.
+
+# make sure declare -a converts an existing variable to an array
+unset a
+a=abcde
+declare -a a
+echo ${a[0]}
+
 unset a
 a=abcde
 a[2]=bdef
@@ -23,7 +34,7 @@ echo ${a[@]}
 echo ${a[*]}
 
 # this should print out values, too
-declare -a | egrep -v '(BASH_VERSINFO|PIPESTATUS)'
+declare -a | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)'
 
 unset a[7]
 echo ${a[*]}
@@ -51,8 +62,8 @@ echo ${a[@]}
 
 readonly a[5]
 readonly a
-readonly -a | egrep -v '(BASH_VERSINFO|PIPESTATUS)'
-declare -ar | egrep -v '(BASH_VERSINFO|PIPESTATUS)'
+readonly -a | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)'
+declare -ar | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)'
 
 declare -a d='([1]="" [2]="bdef" [5]="hello world" "test")'
 d[9]="ninth element"
@@ -66,7 +77,7 @@ b=([0]=this [1]=is [2]=a [3]=test [4]="$PS1" [5]=$pass)
 
 echo ${b[@]:2:3}
 
-declare -a | egrep -v '(BASH_VERSINFO|PIPESTATUS)'
+declare -pa | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)'
 
 a[3]="this is a test"
 
@@ -84,7 +95,7 @@ d=([]=abcde [1]="test test" [*]=last [-65]=negative )
 unset d[12]
 unset e[*]
 
-declare -a | egrep -v '(BASH_VERSINFO|PIPESTATUS)'
+declare -a | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)'
 
 ps1='hello'
 unset ps1[2]
@@ -101,7 +112,7 @@ this is a test of read using arrays
 echo ${rv[0]} ${rv[4]}
 echo ${rv[@]}
 
-declare -a | egrep -v '(BASH_VERSINFO|PIPESTATUS)'
+declare -a | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)'
 
 export rv
 #set
@@ -129,3 +140,62 @@ for z in "$@"
 do
        echo "$z"
 done
+
+# do various pattern removal and length tests
+XPATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:.:/sbin:/usr/sbin
+
+xpath=( $( IFS=: ; echo $XPATH ) )
+
+echo ${xpath[@]}
+echo ${xpath[@]##*/}
+echo ${xpath[0]##*/}
+echo ${xpath[@]%%[!/]*}
+echo ${xpath[0]%%[!/]*}
+
+# let's try to make it a DOS-style path
+
+zecho "${xpath[@]/\//\\}"
+zecho "${xpath[@]//\//\\}"
+zecho "${xpath[@]//[\/]/\\}"
+
+# length of the first element of the array, since array without subscript
+# is equivalent to referencing first element
+echo ${#xpath} -- ${#xpath[0]}
+
+# number of elements in the array
+nelem=${#xpath[@]}
+echo ${#xpath[@]} -- $nelem
+
+# total length of all elements in the array, including space separators
+xx="${xpath[*]}"
+echo ${#xx}
+
+# total length of all elements in the array
+xx=$( IFS='' ; echo "${xpath[*]}" )
+echo ${#xx}
+
+unset xpath[nelem-1]
+
+nelem=${#xpath[@]}
+echo ${#xpath[@]} -- $nelem
+
+# arrays and things that look like index assignments
+array=(42 [1]=14 [2]=44)
+
+array2=(grep [ 123 ] \*)
+
+echo ${array[@]}
+echo "${array2[@]}"
+
+# arrays and implicit arithmetic evaluation
+declare -i -a iarray
+
+iarray=( 2+4 1+6 7+2 )
+echo ${iarray[@]}
+
+iarray[4]=4+1
+echo ${iarray[@]}
+
+# make sure the array code behaves correctly with respect to unset variables
+set -u
+( echo ${#narray[4]} )
index bd8ff82..d31a5e3 100644 (file)
@@ -18,3 +18,7 @@ echo { }
 echo }
 echo {
 echo abcd{efgh
+
+echo foo {1,2} bar
+echo `zecho foo {1,2} bar`
+echo $(zecho foo {1,2} bar)
index 52cc638..d35e08d 100644 (file)
@@ -14,3 +14,6 @@ XXXXa XXXXb XXXXc
 }
 {
 abcd{efgh
+foo 1 2 bar
+foo 1 2 bar
+foo 1 2 bar
diff --git a/tests/builtins.right b/tests/builtins.right
new file mode 100644 (file)
index 0000000..5cf5875
--- /dev/null
@@ -0,0 +1,113 @@
+a
+end-1
+a
+end-2
+a:x
+end-a
+b:x
+end-b
+c:x
+end-c
+end-3
+a:x
+end
+a
+b
+c
+end-1
+a
+b
+c
+end-2
+a:x
+a:y
+a:z
+end-a
+b:x
+b:y
+b:z
+end-b
+c:x
+c:y
+c:z
+end-c
+end-3
+a:x
+b:x
+c:x
+end
+$BVAR
+$BVAR
+$BVAR
+$BVAR
+foo
+bar
+xxx
+022
+u=rwx,g=rx,o=rx
+002
+u=rwx,g=rwx,o=rx
+u=rwx,g=rwx,o=rwx
+enable .
+enable :
+enable break
+enable continue
+enable eval
+enable exec
+enable exit
+enable export
+enable readonly
+enable return
+enable set
+enable shift
+enable source
+enable trap
+enable unset
+enable .
+enable :
+enable break
+enable continue
+enable eval
+enable exec
+enable exit
+enable export
+enable readonly
+enable return
+enable set
+enable shift
+enable source
+enable trap
+enable unset
+enable -n test worked
+enable test worked
+specialname
+FOO=BAR
+FOO=BAR
+hash: hash table empty
+AVAR
+foo
+in source.sub2, calling return
+5
+a b c
+a b c
+x y z
+a b c
+a b c
+m n o p
+a b c
+m n o p
+/tmp/bash-dir-a
+/tmp/bash-dir-a
+/tmp/bash-dir-a
+AVAR
+foo
+foo
+AVAR
+foo
+foo
+AVAR
+foo
+ok
+ok
+./builtins.tests: kill: bad signal number: 4096
+1
diff --git a/tests/builtins.sub1 b/tests/builtins.sub1
new file mode 100644 (file)
index 0000000..5b79711
--- /dev/null
@@ -0,0 +1,14 @@
+unset CDPATH
+
+MYDIR=$(pwd -P)
+FULLDIR=/tmp/bash-dir-a
+DIR=${FULLDIR##*/}
+
+mkdir $FULLDIR
+CDPATH=.:/tmp
+cd $DIR
+pwd
+echo $PWD
+
+cd $MYDIR
+rmdir $FULLDIR
diff --git a/tests/builtins.tests b/tests/builtins.tests
new file mode 100644 (file)
index 0000000..0d80239
--- /dev/null
@@ -0,0 +1,201 @@
+# tests for miscellaneous builtins not tested elsewhere
+set +p
+set +o posix
+
+ulimit -c 0 2>/dev/null
+
+# check that break breaks loops
+for i in a b c; do echo $i; break; echo bad-$i; done
+echo end-1
+for i in a b c; do echo $i; break 1; echo bad-$i; done
+echo end-2
+for i in a b c; do
+       for j in x y z; do
+               echo $i:$j
+               break
+               echo bad-$i
+       done
+       echo end-$i
+done
+echo end-3
+
+# check that break breaks nested loops
+for i in a b c; do
+       for j in x y z; do
+               echo $i:$j
+               break 2
+               echo bad-$i
+       done
+       echo end-$i
+done
+echo end
+
+# check that continue continues loops
+for i in a b c; do echo $i; continue; echo bad-$i ; done
+echo end-1
+for i in a b c; do echo $i; continue 1; echo bad-$i; done
+echo end-2
+for i in a b c; do
+       for j in x y z; do
+               echo $i:$j
+               continue
+               echo bad-$i-$j
+       done
+       echo end-$i
+done
+echo end-3
+
+# check that continue breaks out of nested loops
+for i in a b c; do
+       for j in x y z; do
+               echo $i:$j
+               continue 2
+               echo bad-$i-$j
+       done
+       echo end-$i
+done
+echo end
+
+# check that `eval' re-evaluates arguments, but `builtin' and `command' do not
+AVAR='$BVAR'
+BVAR=foo
+
+echo $AVAR
+builtin echo $AVAR
+command echo $AVAR
+eval echo \$AVAR
+eval echo $AVAR
+
+# test out eval with a temp environment
+AVAR=bar eval echo \$AVAR
+BVAR=xxx eval echo $AVAR
+
+unset -v AVAR BVAR
+
+# test umask
+mask=$(umask)
+umask 022
+umask
+umask -S
+umask -S u=rwx,g=rwx,o=rx >/dev/null # 002
+umask
+umask -S
+umask 0
+umask -S
+umask ${mask}  # restore original mask
+
+# builtin/command without arguments should do nothing.  maybe someday they will
+builtin
+command
+
+# test enable
+enable -ps
+
+enable -aps ; enable -nps
+
+enable -n test
+case "$(type -t test)" in
+builtin)       echo oops -- enable -n test failed ;;
+*)     echo enable -n test worked ;;
+esac
+
+enable test
+case "$(type -t test)" in
+builtin)       echo enable test worked ;;
+*)     echo oops -- enable test failed ;;
+esac
+
+# test options to exec
+(exec -a specialname ${THIS_SH} -c 'echo $0' )
+# test `clean' environment.  if /bin/sh is bash, and the script version of
+# printenv is run, there will be variables in the environment that bash
+# sets on startup.
+(export FOO=BAR ; exec -c printenv ) | grep FOO
+(FOO=BAR exec -c printenv ) | grep FOO
+
+(export FOO=BAR ; exec printenv ) | grep FOO
+(FOO=BAR exec printenv ) | grep FOO
+
+# ok, forget everything about hashed commands
+hash -r
+hash
+
+# check out source/.
+
+AVAR=AVAR
+
+. ./source.sub1
+AVAR=foo . ./source.sub1
+
+. ./source.sub2
+echo $?
+
+set -- a b c
+. ./source.sub3
+
+# make sure source with arguments does not change the shell's positional
+# parameters, but that the sourced file sees the arguments as its
+# positional parameters
+echo "$@"
+. ./source.sub3 x y z
+echo "$@"
+
+# but if the sourced script sets the positional parameters explicitly, they
+# should be reflected in the calling shell's positional parameters.  this
+# also tests one of the shopt options that controls source using $PATH to
+# find the script
+echo "$@"
+shopt -u sourcepath
+. source.sub4
+echo "$@"
+
+# this is complicated when the sourced scripts gets its own positional
+# parameters from arguments to `.'
+set -- a b c
+echo "$@"
+. source.sub4 x y z
+echo "$@"
+
+# test out cd and $CDPATH
+${THIS_SH} ./builtins.sub1
+
+# in posix mode, assignment statements preceding special builtins are
+# reflected in the shell environment.  `.' and `eval' need special-case
+# code.
+set -o posix
+echo $AVAR
+AVAR=foo . ./source.sub1
+echo $AVAR
+
+AVAR=AVAR
+echo $AVAR
+AVAR=foo eval echo \$AVAR
+echo $AVAR
+
+AVAR=AVAR
+echo $AVAR
+AVAR=foo :
+echo $AVAR
+
+# test out kill -l.  bash versions prior to 2.01 did `kill -l num' wrong
+set +o posix
+sigone=$(kill -l | sed -n 's:^ 1) *\([^        ]*\)[   ].*$:\1:p')
+
+case "$(kill -l 1)" in
+${sigone/SIG/})        echo ok;;
+*)     echo oops -- kill -l failure;;
+esac
+
+# POSIX.2 says that exit statuses > 128 are mapped to signal names by
+# subtracting 128 so you can find out what signal killed a process
+case "$(kill -l $(( 128 + 1)) )" in
+${sigone/SIG/})        echo ok;;
+*)     echo oops -- kill -l 129 failure;;
+esac
+
+# out-of-range signal numbers should report the argument in the error
+# message, not 128 less than the argument
+kill -l 4096
+
+# kill -l NAME should return the signal number
+kill -l ${sigone/SIG/}
diff --git a/tests/dirstack.right b/tests/dirstack.right
new file mode 100644 (file)
index 0000000..b5803d5
--- /dev/null
@@ -0,0 +1,51 @@
+./dirstack.tests: pushd: no other directory
+./dirstack.tests: popd: directory stack empty
+./dirstack.tests: pushd: -m: bad argument
+pushd: usage: pushd [dir | +N | -N] [-n]
+./dirstack.tests: popd: -m: bad argument
+popd: usage: popd [+N | -N] [-n]
+./dirstack.tests: dirs: -m: bad argument
+dirs: usage: dirs [-clpv] [+N] [-N]
+ok
+/usr /
+/usr /
+/usr /
+/usr /
+/usr /
+/
+/usr /
+/etc /usr /
+/etc /usr /
+/etc /usr /
+ 0  /etc
+ 1  /usr
+ 2  /
+/usr /etc /
+/etc /usr /
+/tmp /etc /usr /
+/tmp
+/tmp
+/usr
+/usr
+./dirstack.tests: dirs: 9: bad directory stack index
+./dirstack.tests: dirs: 9: bad directory stack index
+./dirstack.tests: pushd: +9: bad directory stack index
+./dirstack.tests: pushd: -9: bad directory stack index
+./dirstack.tests: popd: +9: bad directory stack index
+./dirstack.tests: popd: -9: bad directory stack index
+/tmp /etc /
+/tmp /etc /
+/tmp /etc /
+/tmp /usr /etc /
+/tmp
+/tmp /usr /etc /
+/tmp /usr /etc /
+/tmp
+/tmp /bin /etc /
+/tmp
+/tmp /bin /
+/tmp
+/bin / /tmp
+/bin / /tmp
+/bin
+/bin
diff --git a/tests/dirstack.tests b/tests/dirstack.tests
new file mode 100644 (file)
index 0000000..e384615
--- /dev/null
@@ -0,0 +1,79 @@
+dirs -c
+# errors -- empty stack
+pushd
+popd
+
+# errors -- bad numeric arguments -- should not cause the script to exit
+pushd -m
+popd -m
+dirs -m
+
+MYDIR=$PWD
+unalias cd 2>/dev/null
+
+unalias -a
+
+command cd -P /
+
+case "$OLDPWD" in
+$MYDIR)        echo ok ;;
+*)     echo oops -- bad \$OLDPWD ;;
+esac
+
+pushd /usr
+echo $PWD $OLDPWD
+dirs
+echo ${DIRSTACK[@]}
+
+# this should not change the directory stack at all
+pushd -n +0
+dirs
+
+popd
+pushd /usr
+
+pushd /etc
+dirs
+dirs -l
+dirs -v
+
+# two consecutive `pushd's should swap the top two stack elements, then
+# swap them back, leaving the stack intact
+pushd
+pushd
+
+pushd /tmp
+echo ${DIRSTACK[0]} ; dirs +0
+echo ${DIRSTACK[2]} ; dirs +2
+
+# these should be errors, but not affect the directory stack
+dirs +9; dirs -9
+pushd +9 ; pushd -9
+popd +9 ; popd -9
+
+popd -n +2
+dirs
+echo ${DIRSTACK[@]}
+
+pushd -n /usr
+echo $PWD
+dirs
+echo ${DIRSTACK[@]}
+
+builtin pwd
+
+DIRSTACK[1]=/bin
+dirs
+
+builtin pwd
+popd +2
+builtin pwd -L
+pushd -1
+dirs
+echo ${DIRSTACK[0]}
+
+dirs -c
+dirs
+
+# this is for the benefit of pure coverage
+cd $MYDIR
index 982f04c..8f8372e 100755 (executable)
@@ -1 +1,9 @@
 recho "$*"
+
+# If IFS is null, the parameters are joined without separators
+IFS=''
+recho "$*"
+
+# If IFS is unset, the parameters are separated by spaces
+unset IFS
+recho "${*}"
index 4d9b746..84609ec 100644 (file)
@@ -1,3 +1,5 @@
 argv[1] = <a b>
+argv[1] = <ab>
+argv[1] = <a b>
 argv[1] = <a>
 argv[2] = <b>
diff --git a/tests/errors.right b/tests/errors.right
new file mode 100644 (file)
index 0000000..41da642
--- /dev/null
@@ -0,0 +1,73 @@
+./errors.tests: `1': not a valid identifier
+declare -fr func
+./errors.tests: func: readonly function
+./errors.tests: unset: func: cannot unset: readonly function
+./errors.tests: declare: func: readonly function
+./errors.tests: unset: XPATH: cannot unset: readonly variable
+./errors.tests: unset: `/bin/sh': not a valid identifier
+./errors.tests: declare: unknown option: `-z'
+declare: usage: declare [-afFrxi] [-p] name[=value] ...
+./errors.tests: declare: `-z': not a valid identifier
+./errors.tests: declare: `/bin/sh': not a valid identifier
+./errors.tests: declare: cannot use `-f' to make functions
+./errors.tests: export: XPATH: not a function
+./errors.tests: break: only meaningful in a `for', `while', or `until' loop
+./errors.tests: continue: only meaningful in a `for', `while', or `until' loop
+./errors.tests: shift: bad non-numeric arg `label'
+./errors.tests: shift: too many arguments
+./errors.tests: let: expression expected
+./errors.tests: local: can only be used in a function
+./errors.tests: hash: notthere: not found
+./errors.tests: hash: hashing disabled
+./errors.tests: export: `AA[4]': not a valid identifier
+./errors.tests: readonly: `AA[4]': not a valid identifier
+./errors.tests: [-2]: bad array subscript
+./errors.tests: AA: readonly variable
+./errors.tests: shift: shift count must be <= $#
+./errors.tests: shift: shift count must be >= 0
+./errors.tests: shopt: no_such_option: unknown shell option name
+./errors.tests: shopt: no_such_option: unknown shell option name
+./errors.tests: umask: `09' is not an octal number from 000 to 777
+./errors.tests: umask: bad character in symbolic mode: :
+./errors.tests: umask: bad symbolic mode operator: :
+./errors.tests: umask: illegal option: -p
+umask: usage: umask [-S] [mode]
+./errors.tests: VAR: readonly variable
+./errors.tests: declare: VAR: readonly variable
+./errors.tests: declare: VAR: readonly variable
+./errors.tests: declare: unset: not found
+./errors.tests: VAR: readonly variable
+./errors.tests: command substitution: line 2: syntax error: unexpected end of file
+./errors.tests: command substitution: line 1: syntax error near unexpected token `done'
+./errors.tests: command substitution: line 1: ` for z in 1 2 3; done '
+./errors.tests: cd: HOME not set
+./errors.tests: cd: OLDPWD not set
+./errors.tests: .: filename argument required
+.: usage: . filename
+./errors.tests: source: filename argument required
+source: usage: source filename
+./errors.tests: .: illegal option: -i
+.: usage: . filename
+./errors.tests: set: unknown option: q
+./errors.tests: enable: sh: not a shell builtin
+./errors.tests: enable: bash: not a shell builtin
+./errors.tests: shopt: cannot set and unset shell options simultaneously
+./errors.tests: read: `/bin/sh': not a valid identifier
+./errors.tests: VAR: readonly variable
+./errors.tests: eval: illegal option: -i
+eval: usage: eval [arg ...]
+./errors.tests: command: illegal option: -i
+command: usage: command [-pVv] command [arg ...]
+./errors.tests: trap: NOSIG: not a signal specification
+./errors.tests: trap: illegal option: -s
+trap: usage: trap [arg] [signal_spec ...] or trap -l
+./errors.tests: trap: ERR: not a signal specification
+./errors.tests: return: can only `return' from a function or sourced script
+./errors.tests: break: loop count must be > 0
+./errors.tests: continue: loop count must be > 0
+./errors.tests: builtin: bash: not a shell builtin
+./errors.tests: bg: no job control
+./errors.tests: fg: no job control
+./errors.tests: kill: -s requires an argument
+./errors.tests: kill: bad signal spec `S'
+./errors.tests: `!!': not a valid identifier
diff --git a/tests/errors.tests b/tests/errors.tests
new file mode 100644 (file)
index 0000000..61751f5
--- /dev/null
@@ -0,0 +1,203 @@
+# These should all be safe
+LC_ALL=C
+LC_CTYPE=C
+LC_COLLATE=C
+LC_MESSAGES=C
+
+# these tests should all generate errors
+
+# make sure we don't exit prematurely
+set +e
+set +o posix
+
+# the iteration variable must be a valid identifier
+for 1 in a b c; do echo $1; done
+
+# try to rebind a read-only function
+func()
+{
+       echo func
+}
+readonly -f func
+# make sure `readonly' and `declare' play well together
+declare -Fr
+func()
+{
+       echo bar
+}
+
+# cannot unset readonly functions or variables
+unset -f func
+# or make them not readonly
+declare -fr func
+declare -f +r func
+
+XPATH=$PATH
+declare -r XPATH
+unset -v XPATH
+
+# cannot unset invalid identifiers
+unset /bin/sh
+
+# bad option
+declare -z
+# cannot declare invalid identifiers
+declare -- -z 
+declare /bin/sh
+
+# this is the syntax used to export functions in the environment, but
+# it cannot be used with `declare'
+declare -f func='() { echo "this is func"; }'
+
+# try to export -f something that is not a function -- this should be
+# an error, not create an `invisible function'
+export -f XPATH
+
+# this depends on the setting of BREAK_COMPLAINS in config.h.in
+break
+continue
+
+# this should not exit the shell; it did in versions before 2.01
+shift label
+
+# other shells do not complain about the extra arguments; maybe someday
+# we won't either
+set -- a b c
+shift $# label
+# and get rid of the positional parameters
+shift $#
+
+# let without an expression is an error, though maybe it should just return
+# success
+let
+
+# local outside a function is an error
+local
+
+# try to hash a non-existant command
+hash notthere
+
+# turn off hashing, then try to hash something
+set +o hashall
+hash -p ${THIS_SH} ${THIS_SH##*/}
+
+# bad identifiers to declare/readonly/export
+export AA[4]
+readonly AA[4]
+
+declare -a AA
+unset AA[-2]
+
+# try to assign to a readonly array
+declare -r AA
+AA=( one two three )
+
+# bad counts to `shift'
+shopt -s shift_verbose
+shift $(( $# + 5 ))
+shift -2
+
+# bad shell options
+shopt -s no_such_option
+shopt no_such_option
+
+# non-octal digits for umask and other errors
+umask 09
+umask -S u=rwx:g=rwx:o=rx >/dev/null # 002
+umask -S u:rwx,g:rwx,o:rx >/dev/null # 002
+# this may behave identically to umask without arguments in the future,
+# but for now it is an error
+umask -p
+
+# assignment to a readonly variable in environment
+VAR=4
+readonly VAR
+VAR=7 :
+
+# more readonly variable tests
+declare VAR=88
+declare +r VAR
+
+declare -p unset
+
+# iteration variable in a for statement being readonly
+for VAR in 1 2 3 ; do echo $VAR; done
+
+# parser errors
+: $( for z in 1 2 3; do )
+: $( for z in 1 2 3; done )
+
+# various `cd' errors
+( unset HOME ; cd )
+( unset OLDPWD ; cd - )
+
+# various `source/.' errors
+.
+source
+
+# maybe someday this will work like in rc
+. -i /dev/tty
+
+# make sure that this gives an error rather than setting $1
+set -q
+
+# enable non-builtins
+enable sh bash
+
+# try to set and unset shell options simultaneously
+shopt -s -u checkhash
+
+# try to read into an invalid identifier
+read /bin/sh < /dev/null
+
+# try to read into a readonly variable
+read VAR < /dev/null
+
+# someday these may mean something, but for now they're errors
+eval -i "echo $-"
+command -i "echo $-"
+
+# error to list trap for an unknown signal
+trap -p NOSIG
+
+# maybe someday trap will take a -s argument like kill, but not now
+trap -p -s NOSIG
+
+# maybe someday we will have a ksh-like ERR trap, but not yet
+trap 'echo [$LINENO] -- error' ERR
+
+# can only return from a function or sourced script
+return 2
+
+# break and continue with arguments <= 0
+for z in 1 2 3; do
+       break 0
+       echo $x
+done
+for z in 1 2 3; do
+       continue 0
+       echo $x
+done
+
+# builtin with non-builtin
+builtin bash
+
+# maybe someday you will be able to use fg/bg when job control is not really
+# active, but for now they are errors
+bg
+fg
+
+# argument required
+kill -s
+# bad argument
+kill -S
+
+# this must be last!
+# in posix mode, a function name must be a valid identifier
+# this can't go in posix2.tests, since it causes the shell to exit
+# immediately
+set -o posix
+function !! () { fc -s "$@" ; }
+set +o posix
+
+echo end
diff --git a/tests/execscript b/tests/execscript
new file mode 100644 (file)
index 0000000..49c4c33
--- /dev/null
@@ -0,0 +1,78 @@
+export LC_ALL=C
+export LANG=C
+
+set -- one two three
+echo before execscript.sub: "$@"
+echo calling execscript.sub
+./execscript.sub aa bb cc dd ee
+echo after execscript.sub with args: $?
+./execscript.sub
+echo after execscript.sub without args: $?
+
+# set up a fixed path so we know notthere will not be found
+PATH=/usr/bin:/bin:/usr/local/bin:
+export PATH
+
+notthere
+echo $?
+
+# this is iffy, since the error messages may vary from system to system
+${THIS_SH} notthere
+echo $?
+
+# /bin/sh should be there on all systems
+${THIS_SH} /bin/sh
+echo $?
+
+# try executing a directory
+/
+echo $?
+
+${THIS_SH} /
+echo $?
+
+# try sourcing a directory
+. /
+echo $?
+
+. ${THIS_SH} 2>/dev/null
+echo $?
+
+. /dev/null
+echo $?
+
+# kill two birds with one test -- test out the BASH_ENV code
+echo echo this is bashenv > /tmp/bashenv
+export BASH_ENV=/tmp/bashenv
+${THIS_SH} ./execscript.sub3
+rm -f /tmp/bashenv
+unset BASH_ENV
+
+# we're resetting the $PATH to empty, so this should be last
+PATH=
+
+notthere
+echo $?
+
+command notthere
+echo $?
+
+command -p notthere
+echo $?
+
+# but -p should guarantee that we find all the standard utilities, even
+# with an empty or unset $PATH
+command -p sh -c 'echo this is $0'
+unset PATH
+command -p sh -c 'echo this is $0'
+
+# a bug in bash before bash-2.01 caused PATH to be set to the empty string
+# when command -p was run with PATH unset
+echo ${PATH-unset}
+
+echo "echo ok" | ${THIS_SH} -t
+
+${THIS_SH} ./execscript.sub2
+echo $?
+
+${THIS_SH} ./execscript.sub4
diff --git a/tests/execscript.right b/tests/execscript.right
new file mode 100644 (file)
index 0000000..1b64033
--- /dev/null
@@ -0,0 +1,36 @@
+before execscript.sub: one two three
+calling execscript.sub
+aa bb cc dd ee
+after execscript.sub with args: 0
+
+after execscript.sub without args: 0
+./execscript: notthere: command not found
+127
+notthere: notthere: No such file or directory
+127
+/bin/sh: /bin/sh: cannot execute binary file
+126
+./execscript: /: is a directory
+126
+/: /: cannot execute binary file
+126
+./execscript: .: /: is a directory
+1
+126
+./execscript: .: /dev/null: not a regular file
+1
+this is bashenv
+./execscript.sub3: /tmp/bash-notthere: No such file or directory
+./execscript.sub3: exec: /tmp/bash-notthere: cannot execute: No such file or directory
+126
+./execscript: notthere: No such file or directory
+127
+./execscript: notthere: No such file or directory
+127
+./execscript: notthere: No such file or directory
+127
+this is sh
+this is sh
+unset
+ok
+5
diff --git a/tests/execscript.sub b/tests/execscript.sub
new file mode 100755 (executable)
index 0000000..4a12501
--- /dev/null
@@ -0,0 +1 @@
+echo "$@"
diff --git a/tests/execscript.sub2 b/tests/execscript.sub2
new file mode 100644 (file)
index 0000000..c1caaea
--- /dev/null
@@ -0,0 +1,5 @@
+# make sure an exit command in an exit trap sets the shell's exit status
+trap - 0
+trap 'exit 5' 0
+
+exit 0
diff --git a/tests/execscript.sub3 b/tests/execscript.sub3
new file mode 100644 (file)
index 0000000..4f2f8e2
--- /dev/null
@@ -0,0 +1,6 @@
+shopt -s execfail
+
+exec /tmp/bash-notthere
+# make sure we're still around
+echo $?
+
diff --git a/tests/execscript.sub4 b/tests/execscript.sub4
new file mode 100644 (file)
index 0000000..a60d8b3
--- /dev/null
@@ -0,0 +1,8 @@
+# let's test out the noexec code
+set -n
+
+fail
+whoops
+wow
+
+set +n
index 45fe87c..f8512c3 100644 (file)
@@ -232,6 +232,19 @@ x=/one/two/three
 expect '<three>'
 recho ${x##*/}
 
+# pattern removal of patterns that don't match
+z=abcdef
+
+expect '<abcdef>'
+recho ${z#xyz}
+expect '<abcdef>'
+recho ${z##xyz}
+
+expect '<abcdef>'
+recho ${z%xyz}
+expect '<abcdef>'
+recho ${z%%xyz}
+
 # Command substitution and the quirky differences between `` and $()
 
 expect '<\$x>'
@@ -318,8 +331,25 @@ esac
 set one two three four five
 expect '<one> <three> <five>'
 recho $1 $3 ${5} $8 ${9}
+
+# length tests on positional parameters and some special parameters
+
 expect '<5> <5>'
 recho $# ${#}
+expect '<3>'
+recho ${#1}
+expect '<1>'
+recho ${##}
+expect '<1>'
+recho ${#?}
+expect '<5>'
+recho ${#@}
+expect '<5>'
+recho ${#*}
+expect '<5>'
+recho "${#@}"
+expect '<5>'
+recho "${#*}"
 
 expect '<42>'
 recho $((28 + 14))
@@ -334,6 +364,8 @@ recho '~'
 
 expect nothing
 recho $!
+expect nothing
+recho ${!}
 
 # test word splitting of assignment statements not preceding a command
 a="a b c d e"
index b1b1c2d..747c80e 100644 (file)
@@ -87,6 +87,10 @@ argv[1] = <file.o>
 argv[1] = <posix>
 argv[1] = </src/cmd>
 argv[1] = <three>
+argv[1] = <abcdef>
+argv[1] = <abcdef>
+argv[1] = <abcdef>
+argv[1] = <abcdef>
 argv[1] = <\$x>
 argv[1] = <$x>
 argv[1] = <\$x>
@@ -123,6 +127,13 @@ argv[2] = <three>
 argv[3] = <five>
 argv[1] = <5>
 argv[2] = <5>
+argv[1] = <3>
+argv[1] = <1>
+argv[1] = <1>
+argv[1] = <5>
+argv[1] = <5>
+argv[1] = <5>
+argv[1] = <5>
 argv[1] = <42>
 argv[1] = <26>
 argv[1] = <\>
diff --git a/tests/func.right b/tests/func.right
new file mode 100644 (file)
index 0000000..fcdfe92
--- /dev/null
@@ -0,0 +1,28 @@
+a returns 5
+b returns 4
+c returns 3
+d returns 2
+in e
+e returned 25
+x is 25
+ZZ
+abcde
+defghi
+ZZ
+5
+0
+AVAR
+AVAR
+foo
+foo
+AVAR
+5
+5
+f1
+f1 () 
+{ 
+    ( return 5 );
+    status=$?;
+    echo $status;
+    return $status
+}
diff --git a/tests/func.tests b/tests/func.tests
new file mode 100644 (file)
index 0000000..8abf4ce
--- /dev/null
@@ -0,0 +1,119 @@
+a()
+{
+       x=$((x - 1))
+       return 5
+}
+
+b()
+{
+       x=$((x - 1))
+       a
+       echo a returns $?
+       return 4
+}
+
+c()
+{
+       x=$((x - 1))
+       b
+       echo b returns $?
+       return 3
+}
+
+d()
+{
+       x=$((x - 1))
+       c
+       echo c returns $?
+       return 2
+}
+
+e()
+{
+       d
+       echo d returns $?
+       echo in e
+       x=$((x - 1))
+       return $x
+}
+
+f()
+{
+       e
+       echo e returned $?
+       echo x is $x
+       return 0
+}
+
+x=30
+f
+
+# make sure unsetting a local variable preserves the `local' attribute
+f1()
+{
+       local zz
+       zz=abcde
+       echo $zz
+       unset zz
+       zz=defghi
+       echo $zz
+}
+
+zz=ZZ
+echo $zz
+f1
+echo $zz
+
+unset -f f1
+f1()
+{
+       return 5
+}
+
+( f1 )
+echo $?
+
+unset -f f1
+f1()
+{
+       sleep 5
+       return 5
+}
+
+f1 &
+wait
+echo $?
+
+unset -f f1
+
+f1()
+{
+       echo $AVAR
+       printenv AVAR
+}
+
+AVAR=AVAR
+echo $AVAR
+f1
+AVAR=foo f1
+echo $AVAR
+
+unset -f f1
+# make sure subshells can do a `return' if we're executing in a function
+f1()
+{
+       ( return 5 )
+       status=$?
+       echo $status
+       return $status
+}
+
+f1
+echo $?
+
+declare -F f1  # should print just the name
+declare -f f1  # should print the definition, too
+
+# no functions should be exported, right?
+declare -xF
+declare -xf
diff --git a/tests/getopts.right b/tests/getopts.right
new file mode 100644 (file)
index 0000000..b90b655
--- /dev/null
@@ -0,0 +1,56 @@
+getopts: usage: getopts optstring name [arg]
+2
+getopts: usage: getopts optstring name [arg]
+2
+./getopts.tests: getopts: illegal option: -a
+getopts: usage: getopts optstring name [arg]
+-a specified
+-b bval specified
+remaining args: one two three
+-a specified
+-b bval specified
+remaining args: one two three four five six seven eight nine ten eleven twelve
+./getopts.sub1: option requires an argument -- b
+Usage: ./getopts.sub1 [-a] [-b value] args
+-a specified
+-c cval specified
+-d specified
+-a specified
+-b 3 specified
+remaining args: one two three four five
+-a specified
+-b bval specified
+remaining args: one two three
+-a specified
+-b bval specified
+remaining args: one two three
+./getopts.sub4: error: option `b' requires an argument
+Usage: ./getopts.sub4 [-a] [-b value] args
+./getopts.sub4: error: illegal option character `c'
+Usage: ./getopts.sub4 [-a] [-b value] args
+-a specified
+remaining args: -b bval one two three
+OPTERR=0
+a here
+something else here
+OPTIND=3
+getop: OPTERR=1
+a here
+./getopts.sub5: illegal option -- c
+something else here
+./getopts.sub5: illegal option -- d
+something else here
+./getopts.sub5: illegal option -- e
+something else here
+getop: OPTIND=5
+OPTIND=3
+OPTERR=0
+-a specified
+remaining args: 
+-a specified
+remaining args: 
+-a specified
+remaining args: 
+0
+./getopts.sub7: getopts: `opt-var': not a valid identifier
+remaining args: 
similarity index 100%
rename from tests/misc/gotest
rename to tests/getopts.sub1
diff --git a/tests/getopts.sub2 b/tests/getopts.sub2
new file mode 100644 (file)
index 0000000..d91fd26
--- /dev/null
@@ -0,0 +1,26 @@
+aflag=
+bflag=
+
+while getopts ab:c:de name "$@"
+do
+       case $name in
+       a)      aflag=1 ;;
+       b)      bflag=1
+               bval=$OPTARG;;
+       c)      cflag=1
+               cval=$OPTARG ;;
+       d)      dflag=1 ;;
+       e)      eflag=1;;
+       ?)      echo Usage: $0 [-a] [-b value] [-c value] -[de] args
+               exit 2;;
+       esac
+
+done
+
+[ ! -z "$aflag" ] && echo -a specified
+[ ! -z "$bflag" ] && echo -b $bval specified
+[ ! -z "$cflag" ] && echo -c $cval specified
+[ ! -z "$dflag" ] && echo -d specified
+[ ! -z "$eflag" ] && { echo -n - ; echo e specified; }
+
+exit 0
diff --git a/tests/getopts.sub3 b/tests/getopts.sub3
new file mode 100644 (file)
index 0000000..2d8b316
--- /dev/null
@@ -0,0 +1,27 @@
+aflag=
+bflag=
+
+while getopts ab: name -a -b 1 -a -a -a -b 5 -b 3 -a one two three four five
+do
+       case $name in
+       a)      aflag=1 ;;
+       b)      bflag=1
+               bval=$OPTARG;;
+       ?)      echo Usage: $0 [-a] [-b value] args
+               exit 2;;
+       esac
+
+done
+
+if [ ! -z "$aflag" ] ; then echo -a specified ; fi
+if [ ! -z "$bflag" ] ; then echo -b $bval specified ; fi
+
+set -- -a -b 1 -a -a -a -b 5 -b 3 -a one two three four five
+if [ "$OPTIND" -gt 1 ]
+then
+       shift $(( $OPTIND - 1 ))
+fi
+
+echo remaining args: "$*"
+
+exit 0
diff --git a/tests/getopts.sub4 b/tests/getopts.sub4
new file mode 100644 (file)
index 0000000..9cd5aef
--- /dev/null
@@ -0,0 +1,30 @@
+aflag=
+bflag=
+
+while getopts :ab: name "$@"
+do
+       case $name in
+       a)      aflag=1 ;;
+       b)      bflag=1
+               bval=$OPTARG;;
+       :)      echo $0: error: option \`$OPTARG\' requires an argument
+               echo Usage: $0 [-a] [-b value] args
+               exit 2;;
+       ?)      echo $0: error: illegal option character \`$OPTARG\'
+               echo Usage: $0 [-a] [-b value] args
+               exit 2;;
+       esac
+
+done
+
+if [ ! -z "$aflag" ] ; then echo -a specified ; fi
+if [ ! -z "$bflag" ] ; then echo -b $bval specified ; fi
+
+if [ "$OPTIND" -gt 1 ]
+then
+       shift $(( $OPTIND - 1 ))
+fi
+
+echo remaining args: "$*"
+
+exit 0
diff --git a/tests/getopts.sub5 b/tests/getopts.sub5
new file mode 100644 (file)
index 0000000..c6e3888
--- /dev/null
@@ -0,0 +1,50 @@
+#!/local/bin/bash
+#Time-stamp: <95/06/07 07:40:40 hrue@imf.unit.no>
+
+getop () {
+
+    local OPTIND
+    local OPTERR=1
+
+    echo getop: OPTERR=$OPTERR    
+    while getopts ab arg "$@"; do
+       case $arg in
+           a)
+               echo a here
+               ;;
+           b)
+               echo b here
+               ;;
+           :|?|*)
+               echo something else here
+               ;;
+       esac
+    done
+    echo getop: OPTIND=$OPTIND
+}
+
+OPTIND=
+OPTERR=0
+
+echo OPTERR=$OPTERR
+while getopts ab arg; do
+    case $arg in
+       a)
+           echo a here
+           ;;
+       b)
+           echo b here
+           ;;
+       :|?|*)
+           
+           echo something else here
+           ;;
+    esac
+done
+
+echo OPTIND=$OPTIND
+
+getop "$@" -d -e
+
+echo OPTIND=$OPTIND
+echo OPTERR=$OPTERR
diff --git a/tests/getopts.sub6 b/tests/getopts.sub6
new file mode 100644 (file)
index 0000000..75d768c
--- /dev/null
@@ -0,0 +1,27 @@
+aflag=
+bflag=
+
+while getopts :ac name "$@"
+do
+       case $name in
+       a)      aflag=1 ;;
+       c)      cflag=1 ;;
+       ?)      exit 2;;
+       esac
+
+       # this came in in a bug report -- it's really a usage error
+       # but it shouldn't cause the shell to crash
+       shift
+done
+
+if [ ! -z "$aflag" ] ; then echo -a specified ; fi
+if [ ! -z "$cflag" ] ; then echo -c specified ; fi
+
+if [ "$OPTIND" -gt 1 ]
+then
+       shift $(( $OPTIND - 1 ))
+fi
+
+echo remaining args: "$*"
+
+exit 0
diff --git a/tests/getopts.sub7 b/tests/getopts.sub7
new file mode 100644 (file)
index 0000000..a20a6df
--- /dev/null
@@ -0,0 +1,30 @@
+aflag=
+bflag=
+
+while getopts :ab: opt-var "$@"
+do
+       case $name in
+       a)      aflag=1 ;;
+       b)      bflag=1
+               bval=$OPTARG;;
+       :)      echo $0: error: option \`$OPTARG\' requires an argument
+               echo Usage: $0 [-a] [-b value] args
+               exit 2;;
+       ?)      echo $0: error: illegal option character \`$OPTARG\'
+               echo Usage: $0 [-a] [-b value] args
+               exit 2;;
+       esac
+
+done
+
+if [ ! -z "$aflag" ] ; then echo -a specified ; fi
+if [ ! -z "$bflag" ] ; then echo -b $bval specified ; fi
+
+if [ "$OPTIND" -gt 1 ]
+then
+       shift $(( $OPTIND - 1 ))
+fi
+
+echo remaining args: "$*"
+
+exit 0
diff --git a/tests/getopts.tests b/tests/getopts.tests
new file mode 100644 (file)
index 0000000..af1ee4f
--- /dev/null
@@ -0,0 +1,38 @@
+# getopts tests
+# this should fail
+getopts
+echo $?
+getopts opts
+echo $?
+
+# maybe someday we will have a ksh93-like -a argument to set the name
+# used in error messages, but not yet
+getopts -a opts name
+
+${THIS_SH} ./getopts.sub1 -a -b bval one two three
+# make sure getopts works when there are more than 9 positional parameters
+${THIS_SH} ./getopts.sub1 -a -b bval one two three four five six seven eight nine ten eleven twelve
+${THIS_SH} ./getopts.sub1 -a -b 
+
+${THIS_SH} ./getopts.sub2 -ad -c cval three four five
+
+${THIS_SH} ./getopts.sub3
+
+# make sure that `-b bval' and `-bbval' are equivalent
+${THIS_SH} ./getopts.sub4 -a -b bval one two three
+${THIS_SH} ./getopts.sub4 -a -bbval one two three
+# this tests `silent' error reporting
+${THIS_SH} ./getopts.sub4 -a -b
+${THIS_SH} ./getopts.sub4 -a -c
+
+# make sure that `--' can be used to end the list of options
+${THIS_SH} ./getopts.sub4 -a -- -b bval one two three
+
+${THIS_SH} ./getopts.sub5 -a -c
+
+${THIS_SH} ./getopts.sub6 -a
+${THIS_SH} ./getopts.sub6 -a -c
+${THIS_SH} ./getopts.sub6 -ac
+echo $? # this should be 2
+
+${THIS_SH} ./getopts.sub7 -a
index 00227a6..492cfb8 100644 (file)
@@ -1,3 +1,4 @@
+LC_COLLATE=C
 #
 # test the shell globbing
 #
@@ -6,6 +7,8 @@ expect()
        echo expect "$@"
 }
 
+MYDIR=$PWD     # save where we are
+
 TESTDIR=/tmp/glob-test
 mkdir $TESTDIR
 builtin cd $TESTDIR || { echo $0: cannot cd to $TESTDIR >&2 ; exit 1; }
@@ -119,59 +122,47 @@ recho a[\b]c
 expect '<abc>'
 recho a?c
 
-expect '<match>'
+expect '<match 1>'
 case abc in
-a"b"c) echo match
-       ;;
-*)     echo BAD
-       ;;
+a"b"c) echo 'match 1' ;;
+*)     echo 'BAD match 1' ;;
 esac
 
-expect '<match>'
+expect '<match 2>'
 case abc in
-a*c)   echo match
-       ;;
-*)     echo BAD
-       ;;
+a*c)   echo 'match 2' ;;
+*)     echo 'BAD match 2' ;;
 esac
 
-expect '<ok>'
+expect '<ok 1>'
 case abc in
-"a?c") echo bad
-       ;;
-*)     echo ok
-       ;;
+"a?c") echo 'bad 1' ;;
+*)     echo 'ok 1' ;;
 esac
 
-expect '<ok>'
+expect '<ok 2>'
 case abc in
-a\*c)  echo bad
-       ;;
-*)     echo ok
-       ;;
+a\*c)  echo 'bad 2' ;;
+*)     echo 'ok 2' ;;
 esac
 
-expect '<ok>'
+expect '<ok 3>'
 case abc in
-a\[b]c)        echo bad
-       ;;
-*)     echo ok
-       ;;
+a\[b]c)        echo 'bad 3' ;;
+*)     echo 'ok 3' ;;
 esac
 
-expect '<ok>'
+expect '<ok 4>'
 case "$nosuchvar" in
-"")    echo ok ;;
-*)     echo bad ;;
+"")    echo 'ok 4' ;;
+*)     echo 'bad 4' ;;
 esac
 
 # This is very odd, but sh and ksh seem to agree
-expect '<ok>'
+expect '<ok 5>'
 case abc in
-a["\b"]c) echo ok
-       ;;
-*)     echo bad
-       ;;
+a["\b"]c) echo 'ok 5' ;;
+*)     echo 'bad 5' ;;
 esac
 
 mkdir man
@@ -253,32 +244,115 @@ case abcdecdhjk in
 a****c**?**??*****)    echo ok 25;;
 esac
 
+case '-' in
+[-abc])        echo ok 26 ;;
+esac
+
+case '-' in
+[abc-]) echo ok 27 ;;
+esac
+
+case '\' in
+\\)    echo ok 28 ;;
+esac
+
+case '\' in
+[\\])  echo ok 29 ;;
+esac
+
+case '\' in
+'\')   echo ok 30 ;;
+esac
+
+case '[' in
+[[])   echo ok 31 ;;
+esac
+
+# a `[' without a closing `]' is just another character to match, in the
+# bash implementation
+case '[' in
+[)     echo ok 32 ;;
+esac
+
+case '[abc' in
+[*)    echo 'ok 33';;
+esac
+
+# a right bracket shall lose its special meaning and represent itself in
+# a bracket expression if it occurs first in the list.  -- POSIX.2 2.8.3.2
+case ']' in
+[]])   echo ok 34 ;;
+esac
+
+case '-' in
+[]-])  echo ok 35 ;;
+esac
+
 # none of these should output anything
 
 case abc in
-??**********?****?)    echo bad ;;
+??**********?****?)    echo bad 1;;
 esac
 
 case abc in
-??**********?****c)    echo bad ;;
+??**********?****c)    echo bad 2;;
 esac
 
 case abc in
-?************c****?****)       echo bad;;
+?************c****?****)       echo bad 3;;
 esac
 
 case abc in
-*c*?**)        echo bad;;
+*c*?**)        echo bad 4;;
 esac
 
 case abc in
-a*****c*?**)   echo bad;;
+a*****c*?**)   echo bad 5;;
 esac
 
 case abc in
-a********???*******)   echo bad;;
+a********???*******)   echo bad 6;;
+esac
+
+case 'a' in
+[])    echo bad 7 ;;
+esac
+
+case '[' in
+[abc)  echo bad 8;;
 esac
 
+
+# make sure set -f works right
+set -f
+recho *
+set +f
+
+# test out the GLOBIGNORE code
+GLOBIGNORE='.*:*c:*e:?'
+recho *
+
+GLOBIGNORE='.*:*b:*d:?'
+recho *
+
+# see if GLOBIGNORE can substitute for `set -f'
+GLOBIGNORE='.*:*'
+recho *
+
+unset GLOBIGNORE
+expect '<man/man1/bash.1>'
+recho */man*/bash.*
+
+# make sure null values for GLOBIGNORE have no effect
+GLOBIGNORE=
+expect '<man/man1/bash.1>'
+recho */man*/bash.*
+
 builtin cd /
 rm -rf $TESTDIR
+
+# this is for the benefit of pure coverage, so it writes the pcv file
+# in the right place
+builtin cd $MYDIR
+
 exit 0
index 2f1dac2..2fcace1 100644 (file)
@@ -54,13 +54,13 @@ argv[1] = <abc>
 argv[1] = <abc>
 argv[1] = <abc>
 argv[1] = <abc>
-match
-match
-ok
-ok
-ok
-ok
-ok
+match 1
+match 2
+ok 1
+ok 2
+ok 3
+ok 4
+ok 5
 argv[1] = <man/man1/bash.1>
 argv[1] = <man/man1/bash.1>
 argv[1] = <man/man1/bash.1>
@@ -81,3 +81,34 @@ ok 22
 ok 23
 ok 24
 ok 25
+ok 26
+ok 27
+ok 28
+ok 29
+ok 30
+ok 31
+ok 32
+ok 33
+ok 34
+ok 35
+argv[1] = <*>
+argv[1] = <a*b>
+argv[2] = <a-b>
+argv[3] = <aXb>
+argv[4] = <abd>
+argv[5] = <bb>
+argv[6] = <bcd>
+argv[7] = <bdir>
+argv[8] = <ca>
+argv[9] = <cb>
+argv[10] = <dd>
+argv[11] = <man>
+argv[1] = <abc>
+argv[2] = <abe>
+argv[3] = <bdir>
+argv[4] = <ca>
+argv[5] = <de>
+argv[6] = <man>
+argv[1] = <*>
+argv[1] = <man/man1/bash.1>
+argv[1] = <man/man1/bash.1>
index bf02e2b..d71781e 100644 (file)
@@ -1,4 +1,7 @@
 there
+one - alpha
+two - beta
+three - gamma
 hi\
 there$a
 stuff
@@ -8,5 +11,33 @@ EO\
 F
 hi
 hi
+tab 1
+tab 2
+tab 3
+abc
+def ghi
+jkl mno
+fff is a function
+fff () 
+{ 
+    ed /tmp/foo  >/dev/null <<ENDOFINPUT
+/^name/d
+w
+q
+ENDOFINPUT
+
+    aa=1
+}
+fff is a function
+fff () 
+{ 
+    ed /tmp/foo >/dev/null  <<ENDOFINPUT
+/^name/d
+w
+q
+ENDOFINPUT
+
+    aa=1
+}
 hi
 there
index aa69496..c07ef64 100644 (file)
@@ -6,6 +6,20 @@ EOF1
 there
 EOF2
 
+while read line1; do
+       read line2 <&3
+       echo $line1 - $line2
+done <<EOF1 3<<EOF2
+one
+two
+three
+EOF1
+alpha
+beta
+gamma
+EOF2
+
+
 # check quoted here-doc is protected
 
 a=foo
@@ -37,6 +51,41 @@ hi
 EO\
 F
 
+# check operation of tab removal in here documents
+cat <<- EOF
+       tab 1
+       tab 2
+       tab 3
+       EOF
+
+# check appending of text to file from here document
+rm -f /tmp/bash-zzz
+cat > /tmp/bash-zzz << EOF
+abc
+EOF
+cat >> /tmp/bash-zzz << EOF
+def ghi
+jkl mno
+EOF
+cat /tmp/bash-zzz
+rm -f /tmp/bash-zzz
+
+# make sure command printing puts the here-document as the last redirection
+# on the line, and the function export code preserves syntactic correctness
+fff()
+{
+  ed /tmp/foo <<ENDOFINPUT >/dev/null
+/^name/d
+w
+q
+ENDOFINPUT
+aa=1
+}
+
+type fff
+export -f fff
+${THIS_SH} -c 'type fff'
+
 # check that end of file delimits a here-document
 # THIS MUST BE LAST!
 
diff --git a/tests/histexpand.right b/tests/histexpand.right
new file mode 100644 (file)
index 0000000..3c20d1c
--- /dev/null
@@ -0,0 +1,127 @@
+echo $BASH_VERSION
+    1  for i in one two three; do echo $i; done
+    2  /bin/sh -c 'echo this is $0'
+    3  ls
+    4  echo $BASH_VERSION
+    1  for i in one two three; do echo $i; done
+    2  /bin/sh -c 'echo this is $0'
+    3  ls
+    4  echo $BASH_VERSION
+    5  HISTFILE=/tmp/newhistory
+    6  echo line 2 for history
+echo line 2 for history
+echo line 2 for history
+set -H
+echo line 2 for history
+line 2 for history
+    1  for i in one two three; do echo $i; done
+    2  /bin/sh -c 'echo this is $0'
+    3  ls
+    4  echo $BASH_VERSION
+    5  HISTFILE=/tmp/newhistory
+    6  echo line 2 for history
+    7  set -H
+    8  echo line 2 for history
+a b c d e
+echo a b c d e
+a b c d e
+echo line 2 for history
+line 2 for history
+echo line 8 for history
+line 8 for history
+/bin/sh -c 'echo this is $0'
+this is /bin/sh
+echo sh
+sh
+echo /bin
+/bin
+echo e
+e
+a b c d e
+echo b c d e
+b c d e
+echo b c d
+b c d
+echo d e
+d e
+echo d e
+d e
+echo b c d
+b c d
+file.c
+echo file
+file
+echo .c
+.c
+echo 'file'
+file
+bax.c
+echo $file
+bax
+echo .c
+.c
+echo '$file'
+$file
+a b c d e
+echo 'a' 'b' 'c' 'd' 'e'
+a b c d e
+echo 'a b c d e'
+a b c d e
+foo.c foo.o foo.html foo.h
+echo bar.c foo.o foo.html foo.h
+bar.c foo.o foo.html foo.h
+echo bar.c bar.o bar.html bar.h
+bar.c bar.o bar.html bar.h
+echo xbar.c xbar.o xbar.html xbar.h
+xbar.c xbar.o xbar.html xbar.h
+echo xbar.c xbar.o xbar.html xbar.h
+xbar.c xbar.o xbar.html xbar.h
+echo xwhix.c xwhix.o xwhix.html xwhix.h
+xwhix.c xwhix.o xwhix.html xwhix.h
+echo xwhix.c xwhix.o xwhix.html xwhix.h
+echo 'xwhix'
+xwhix
+echo 'xwhix.h'
+xwhix.h
+echo 'xwhix.h'
+xwhix.h
+echo 'xwhix.h'
+xwhix.h
+    8  echo line 2 for history
+    9  echo a b c d e
+   10  echo line 2 for history
+   11  echo line 8 for history
+   12  /bin/sh -c 'echo this is $0'
+   13  echo sh
+   14  echo /bin
+   15  echo e
+   16  echo a b c d e
+   17  echo b c d e
+   18  echo b c d
+   19  echo d e
+   20  echo b c d
+   21  echo file.c
+   22  echo file
+   23  echo .c
+   24  echo 'file'
+   25  echo $file.c
+   26  echo $file
+   27  echo .c
+   28  echo '$file'
+   29  echo a b c d e
+   30  echo 'a' 'b' 'c' 'd' 'e'
+   31  echo 'a b c d e'
+   32  echo foo.c foo.o foo.html foo.h
+   33  echo bar.c foo.o foo.html foo.h
+   34  echo bar.c bar.o bar.html bar.h
+   35  echo xbar.c xbar.o xbar.html xbar.h
+   36  echo xwhix.c xwhix.o xwhix.html xwhix.h
+   37  echo xwhix.c xwhix.o xwhix.html xwhix.h
+   38  echo 'xwhix'
+   39  echo 'xwhix.h'
+!!
+!!
+echo '!!' \!\!
+!! !!
+ok 1
+ok 2
diff --git a/tests/histexpand.tests b/tests/histexpand.tests
new file mode 100644 (file)
index 0000000..f48c00f
--- /dev/null
@@ -0,0 +1,112 @@
+trap 'rm /tmp/newhistory' 0
+
+file=bax
+
+history -c
+
+HISTFILE=history.list
+HISTCONTROL=ignoreboth
+HISTIGNORE='&:#*:history*:fc*'
+# we will end up exercising the history stifling code as a result
+HISTSIZE=32
+
+shopt -s cmdhist
+set -o history
+
+history -p '!!'
+
+history
+
+HISTFILE=/tmp/newhistory
+history -a
+
+history -w
+
+history -s "echo line 2 for history"
+history
+history -p '!e'
+history -p '!!'
+
+set -H
+!!
+!e
+
+history
+
+echo a b c d e
+!?ch?
+!-2
+^2^8
+
+!2
+
+# we're selecting /bin/sh -c ...; we want `sh'
+echo !-1:0:t
+# we're selecting /bin/sh -c ...; we want `/bin'
+echo !-2:0:h
+# we're selecting `echo a b c d e'; we want `e'
+echo !?d?:5
+
+echo a b c d e
+echo !-1:2-$
+echo !-2:2-4
+echo !-2:3*
+echo !!:*
+
+echo !?a?:2-
+
+echo file.c
+echo !!:$:r
+echo !-2:$:e
+echo !-3:$:r:q
+
+echo $file.c
+echo !!:$:r
+echo !-2:^:e
+echo !-3:$:r:q
+
+echo a b c d e
+echo !!:1-$:x
+echo !-2:1-$:q
+
+echo foo.c foo.o foo.html foo.h
+!!:s/foo/bar/
+!-2:gs/foo/bar/
+!!:gs/bar/x&/
+!-2:g&
+
+# make sure we can use any delimiter in the substitution, not just `/'
+!!:gs+bar+whix+
+
+!!:p
+
+# wow
+echo !?.o?:%:r:q
+
+!!:0 !?.h?:%:q
+!!:-$
+!:-$
+
+history
+
+# make sure single quotes inhibit history expansion
+echo '!!'
+
+# make sure backslashes can quote the history expansion character
+echo \!\!
+
+# but other expansions on the line should still be processed
+
+echo '!!' !!:*
+history -c
+unset HISTFILE
+
+# make sure that the special bash cases are not history expanded
+case p in
+[!A-Z])        echo ok 1;;
+esac
+
+var1='ok 2'
+var2=var1
+
+echo ${!var2}
diff --git a/tests/history.list b/tests/history.list
new file mode 100644 (file)
index 0000000..2a4c222
--- /dev/null
@@ -0,0 +1,4 @@
+for i in one two three; do echo $i; done
+/bin/sh -c 'echo this is $0'
+ls
+echo $BASH_VERSION
diff --git a/tests/history.right b/tests/history.right
new file mode 100644 (file)
index 0000000..331cc03
--- /dev/null
@@ -0,0 +1,104 @@
+    1  for i in one two three; do echo $i; done
+    2  /bin/sh -c 'echo this is $0'
+    3  ls
+    4  echo $BASH_VERSION
+1       for i in one two three; do echo $i; done
+2       /bin/sh -c 'echo this is $0'
+3       ls
+4       echo $BASH_VERSION
+        for i in one two three; do echo $i; done
+        /bin/sh -c 'echo this is $0'
+        ls
+        echo $BASH_VERSION
+4       echo $BASH_VERSION
+3       ls
+2       /bin/sh -c 'echo this is $0'
+1       for i in one two three; do echo $i; done
+        echo $BASH_VERSION
+        ls
+        /bin/sh -c 'echo this is $0'
+        for i in one two three; do echo $i; done
+    1  for i in one two three; do echo $i; done
+    2  /bin/sh -c 'echo this is $0'
+    3  ls
+    4  echo $BASH_VERSION
+    5  echo line for history
+echo line for history
+        for i in one two three; do echo $i; done
+        /bin/sh -c 'echo this is $0'
+        ls
+        echo $BASH_VERSION
+        echo line for history
+displaying $HISTFILE after history -a
+echo line for history
+HISTFILE=/tmp/newhistory
+    1  for i in one two three; do echo $i; done
+    2  /bin/sh -c 'echo this is $0'
+    3  ls
+    4  echo $BASH_VERSION
+    5  echo line for history
+    6  HISTFILE=/tmp/newhistory
+    7  echo displaying \$HISTFILE after history -a
+    8  cat $HISTFILE
+for i in one two three; do echo $i; done
+/bin/sh -c 'echo this is $0'
+ls
+echo $BASH_VERSION
+echo line for history
+HISTFILE=/tmp/newhistory
+echo displaying \$HISTFILE after history -a
+cat $HISTFILE
+    1  for i in one two three; do echo $i; done
+    2  /bin/sh -c 'echo this is $0'
+    3  ls
+    4  echo $BASH_VERSION
+    5  echo line for history
+    6  HISTFILE=/tmp/newhistory
+    7  echo displaying \$HISTFILE after history -a
+    8  cat $HISTFILE
+    9  echo line 2 for history
+echo line 2 for history
+echo line 2 for history
+    1  for i in one two three; do echo $i; done
+    2  /bin/sh -c 'echo this is $0'
+    3  ls
+    4  echo $BASH_VERSION
+    5  echo line for history
+    6  HISTFILE=/tmp/newhistory
+    7  echo displaying \$HISTFILE after history -a
+    8  cat $HISTFILE
+    9  echo line 2 for history
+   10  # this should show up as one history entry
+   11  for x in one two three; do      :; done
+set -H
+echo line 2 for history
+line 2 for history
+4       echo $BASH_VERSION
+5       echo line for history
+6       HISTFILE=/tmp/newhistory
+7       echo displaying \$HISTFILE after history -a
+8       cat $HISTFILE
+9       echo line 2 for history
+10      # this should show up as one history entry
+11      for x in one two three; do     :; done
+12      # just a basic test.  a full test suite for history expansion should be
+13      # created
+14      set -H
+15      echo line 2 for history
+16      unset HISTSIZE
+17      unset HISTFILE
+4       echo $BASH_VERSION
+5       echo line for history
+6       HISTFILE=/tmp/newhistory
+7       echo displaying \$HISTFILE after history -a
+8       cat $HISTFILE
+./history.tests: fc: history specification out of range
+   14  set -H
+   15  echo line 2 for history
+   16  unset HISTSIZE
+   17  unset HISTFILE
+aa ab ac
+echo xx xb xc
+xx xb xc
+./history.tests: fc: no command found
+1
diff --git a/tests/history.tests b/tests/history.tests
new file mode 100644 (file)
index 0000000..2bc09b4
--- /dev/null
@@ -0,0 +1,83 @@
+trap 'rm /tmp/newhistory' 0
+
+history -c
+
+HISTFILE=history.list
+HISTCONTROL=ignoreboth
+HISTIGNORE='&:history*:fc*'
+HISTSIZE=32
+
+shopt -s cmdhist
+set -o history
+
+history
+
+fc -l
+fc -nl
+
+fc -lr
+fc -nlr
+
+history -s "echo line for history"
+history
+
+history -p '!!'
+
+fc -nl
+
+HISTFILE=/tmp/newhistory
+history -a
+echo displaying \$HISTFILE after history -a
+cat $HISTFILE
+
+history
+history -w
+cat $HISTFILE
+
+history -s "echo line 2 for history"
+history
+history -p '!e'
+history -p '!!'
+
+# this should show up as one history entry
+for x in one two three
+do
+       :
+done
+history
+
+# just a basic test.  a full test suite for history expansion should be
+# created
+set -H
+!!
+!e
+
+unset HISTSIZE
+unset HISTFILE
+
+fc -l 4
+fc -l 4 8
+
+fc -l 502
+
+history 4
+
+shopt -so history
+shopt -s expand_aliases
+
+alias r="fc -s"
+
+echo aa ab ac
+
+r a=x
+
+# this had better fail with `no command found'
+r cc
+
+unalias -a
+alias
+
+set +o history
+
+shopt -q -o history
+echo $?
diff --git a/tests/jobs.right b/tests/jobs.right
new file mode 100644 (file)
index 0000000..f67579d
--- /dev/null
@@ -0,0 +1,71 @@
+0
+wait-for-pid
+wait-errors
+./jobs.tests: wait: `1-1' is not a pid or valid job spec
+./jobs.tests: wait: `-4' is not a pid or valid job spec
+wait-for-background-pids
+async list wait-for-background-pids
+async list wait for child
+forked
+wait-when-no-children
+wait-for-job
+./jobs.tests: wait: %2: no such job
+127
+async list wait-for-job
+forked
+fg-bg 1
+sleep 5
+fg-bg 2
+sleep 5
+fg-bg 3
+sleep 5
+fg-bg 4
+sleep 5
+fg-bg 5
+./jobs.tests: fg: %2: no such job
+./jobs.tests: bg: bg background job?
+fg-bg 6
+./jobs.tests: fg: illegal option: -s
+fg: usage: fg [job_spec]
+./jobs.tests: bg: illegal option: -s
+bg: usage: bg [job_spec]
+./jobs.tests: disown: illegal option: -r
+disown: usage: disown [-h] [jobspec ...]
+./jobs.tests: disown: %1: no such job
+wait-for-non-child
+./jobs.tests: wait: pid 1 is not a child of this shell
+127
+3 -- 1 2 3 -- 1 - 2 - 3
+[1]   Running                 sleep 300 &\r
+[2]-  Running                 sleep 350 &\r
+[3]+  Running                 sleep 400 &\r
+running jobs:
+[1]   Running                 sleep 300 &\r
+[2]-  Running                 sleep 350 &\r
+[3]+  Running                 sleep 400 &\r
+./jobs.tests: kill: %4: no such job
+after kill -STOP
+running jobs:
+[1]   Running                 sleep 300 &\r
+[3]-  Running                 sleep 400 &\r
+stopped jobs:
+[2]+  Stopped                 sleep 350\r
+after disown
+[2]+  Stopped                 sleep 350\r
+[3]-  Running                 sleep 400 &\r
+running jobs:
+[3]-  Running                 sleep 400 &\r
+stopped jobs:
+[2]+  Stopped                 sleep 350\r
+after kill -s CONT
+running jobs:
+[2]+  Running                 sleep 350 &\r
+[3]-  Running                 sleep 400 &\r
+stopped jobs:
+after kill -STOP, backgrounding %3:
+[3]+ sleep 400 &
+killing...
+done
+after KILL -STOP, foregrounding %1
+sleep 10
+done
diff --git a/tests/jobs.tests b/tests/jobs.tests
new file mode 100644 (file)
index 0000000..cd044f1
--- /dev/null
@@ -0,0 +1,145 @@
+jobs
+echo $?
+
+echo wait-for-pid
+sleep 10 &
+wait $!
+
+echo wait-errors
+wait 1-1
+wait -- -4
+
+echo wait-for-background-pids
+sleep 5 &
+sleep 8 &
+wait
+
+echo async list wait-for-background-pids
+sleep 5 & sleep 8 &
+wait
+
+echo async list wait for child
+sleep 5 & echo forked
+wait
+
+echo wait-when-no-children
+wait
+
+set -m
+
+echo wait-for-job
+sleep 5 &
+wait %2                # this should be a no-such-job error
+echo $?
+wait %1
+
+echo async list wait-for-job
+sleep 5 & echo forked
+wait %1
+
+echo fg-bg 1
+sleep 5 &
+%1
+
+echo fg-bg 2
+sleep 5 &
+fg %%
+
+echo fg-bg 3
+sleep 5 &
+fg %s
+
+echo fg-bg 4
+sleep 5 &
+fg %?ee
+
+# these next two are error cases
+echo fg-bg 5
+sleep 15 &
+fg %2          # this should be a no-such-job error
+bg %1          # this should be a `bg background job?' error
+wait
+
+# these may someday mean to start the jobs, but not print the line
+# describing the status, but for now they are errors
+echo fg-bg 6
+sleep 5 &
+fg -s %1
+bg -s %1
+wait
+
+# someday this may mean to disown all running jobs, but for now it is
+# an error
+disown -r
+
+# this is an error
+disown %1
+
+echo wait-for-non-child
+wait 1
+echo $?
+
+exit 1 | exit 2 | exit 3
+echo $? -- ${PIPESTATUS[@]} -- ${PIPESTATUS[0]} - ${PIPESTATUS[1]} - ${PIPESTATUS[2]}
+
+sleep 300 &
+sleep 350 &
+sleep 400 &
+
+jobs
+
+echo running jobs:
+jobs -r
+
+# should be an error
+kill -n 1 %4
+
+kill -STOP %2
+sleep 5        # give time for the shell to get the stop notification
+echo after kill -STOP
+echo running jobs:
+jobs -r
+echo stopped jobs:
+jobs -s
+
+disown %1
+
+echo after disown
+jobs
+echo running jobs:
+jobs -r
+echo stopped jobs:
+jobs -s
+
+kill -s CONT %2
+echo after kill -s CONT
+echo running jobs:
+jobs -r
+echo stopped jobs:
+jobs -s
+
+kill -STOP %3
+sleep 5        # give time for the shell to get the stop notification
+echo after kill -STOP, backgrounding %3:
+bg %3
+
+disown -h %2
+
+# make sure the killed processes don't cause a message
+exec 5>&2
+exec 2>/dev/null
+
+echo killing...
+kill -n 9 %2 %3
+wait   # make sure we reap the processes while stderr is still redirected
+echo done
+
+exec 2>&5
+
+sleep 10 &
+kill -STOP %1
+sleep 5        # give time for the shell to get the stop notification
+echo after KILL -STOP, foregrounding %1
+fg %1
+
+echo done
diff --git a/tests/minus-e b/tests/minus-e
deleted file mode 100644 (file)
index be67ec5..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-set -e
-if set +e
-then
-       false
-fi
-echo hi
diff --git a/tests/minus-e.right b/tests/minus-e.right
deleted file mode 100644 (file)
index 45b983b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-hi
diff --git a/tests/misc/chld-trap.sh b/tests/misc/chld-trap.sh
deleted file mode 100755 (executable)
index 89b342d..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#! /bin/sh
-#
-# show that setting a trap on SIGCHLD is not disastrous.
-#
-
-trap 'echo caught a child death' SIGCHLD
-
-sleep 5 &
-sleep 5 &
-sleep 5 &
-
-wait
-
-exit 0
diff --git a/tests/misc/dot-test-1.sh b/tests/misc/dot-test-1.sh
deleted file mode 100644 (file)
index eab465e..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-echo this is $0
-. ./dot-test-1.sub
-echo after . dot-test-1.sub
diff --git a/tests/misc/dot-test-1.sub b/tests/misc/dot-test-1.sub
deleted file mode 100644 (file)
index 58df5f4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-echo this is dot-test-1.sub
diff --git a/tests/misc/haertel.perftest b/tests/misc/haertel.perftest
new file mode 100644 (file)
index 0000000..04910c8
--- /dev/null
@@ -0,0 +1,9 @@
+foo() { case $1 in a*) ;; *) ;; esac ;}
+bar() { case $1 in [abc]*) ;; *);; esac ;}
+baz() { case $1 in xyzzy) ;; *) ;; esac ;}
+for x in /usr/lib/*/*
+do
+        foo $x
+        bar $x
+        baz $x
+done
diff --git a/tests/misc/redir.t3.sh b/tests/misc/redir.t3.sh
deleted file mode 100755 (executable)
index 9fd42c7..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-# Test the effect of input buffering on the shell's input
-#
-echo this is redir.t3.sh
-
-exec 0< redir.t3.sub
-
-echo after exec in redir.t3.sh
diff --git a/tests/misc/redir.t3.sub b/tests/misc/redir.t3.sub
deleted file mode 100644 (file)
index b32fbaa..0000000
+++ /dev/null
@@ -1 +0,0 @@
-echo this is redir-test-3.sub
diff --git a/tests/misc/redir.t4.sh b/tests/misc/redir.t4.sh
deleted file mode 100644 (file)
index 78633dc..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-echo "Point 1"
-exec 3</etc/passwd
-exec 4>/tmp/a
-exec 5>/tmp/b
-echo "Point 2"
-echo to a 1>&4
-echo to b 1>&5
-exec 11</etc/printcap
-echo "Point 3"
-echo to a 1>&4
-echo to b 1>&5
-exit 0
diff --git a/tests/misc/run.r1.sh b/tests/misc/run.r1.sh
deleted file mode 100755 (executable)
index bf22fe3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../bash redir.t1.sh
diff --git a/tests/misc/run.r3.sh b/tests/misc/run.r3.sh
deleted file mode 100755 (executable)
index b413674..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#
-# the `after exec in ...' should not be echoed
-../../bash < redir.t3.sh
index 03d7ecf..77cc3f2 100644 (file)
@@ -7,6 +7,3 @@ while set -e ; test -r .file ; do
        esac
        set +e
 done
-
-       
-       
index ad6a0c8..f66966e 100644 (file)
@@ -9,6 +9,3 @@ while set +e ; test -r .file ; do
        set -e
 done
 rm -f .file
-
-       
-       
index ea4d327..f7d9b63 100644 (file)
@@ -28,9 +28,12 @@ bar foo
 bar foo
 barfoo
 barfoo
+\x
 argv[1] = <abcd>
 argv[1] = <efg>
 argv[2] = <nop>
+argv[1] = <efg>
+argv[2] = <nop>
 argv[1] = <hijklmnop>
 argv[1] = <abcdefghijklmnop>
 argv[1] = <abcdefghijklmnop>
@@ -216,4 +219,169 @@ argv[1] = <oneonetwo>
 argv[1] = <onetwo>
 argv[1] = <two>
 argv[1] = <oneonetwo>
+./new-exp.tests: -2: substring expression < 0
+argv[1] = <defghi>
+argv[1] = <efghi>
+argv[1] = <e*docrine>
+argv[1] = <e*docri*e>
+argv[1] = <endocrine>
+argv[1] = <endocrine>
+argv[1] = </usr/bin>
+argv[2] = </bin>
+argv[3] = </usr/local/bin>
+argv[4] = </usr/gnu/bin>
+argv[5] = </usr/bin/X11>
+argv[6] = </sbin>
+argv[7] = </usr/sbin>
+argv[1] = <r>
+argv[2] = <s>
+argv[3] = <t>
+argv[4] = <u>
+argv[5] = <v>
+argv[6] = <w>
+argv[7] = <x>
+argv[8] = <y>
+argv[9] = <z>
+argv[1] = <r>
+argv[2] = <s>
+argv[3] = <t>
+argv[4] = <u>
+argv[5] = <v>
+argv[6] = <w>
+argv[7] = <x>
+argv[8] = <y>
+argv[9] = <z>
+argv[1] = <r>
+argv[2] = <s>
+argv[3] = <t>
+argv[4] = <u>
+argv[5] = <v>
+argv[6] = <w>
+argv[7] = <x>
+argv[8] = <y>
+argv[9] = <z>
+argv[1] = <r>
+argv[2] = <s>
+argv[3] = <t>
+argv[4] = <u>
+argv[5] = <v>
+argv[6] = <w>
+argv[7] = <x>
+argv[8] = <y>
+argv[9] = <z>
+argv[1] = <a>
+argv[2] = <a>
+argv[3] = <a>
+argv[4] = <a>
+argv[5] = <a>
+argv[6] = <a>
+argv[7] = <a>
+argv[8] = <a>
+argv[9] = <a>
+argv[1] = <a>
+argv[2] = <a>
+argv[3] = <a>
+argv[4] = <a>
+argv[5] = <a>
+argv[6] = <a>
+argv[7] = <a>
+argv[8] = <a>
+argv[9] = <a>
+argv[1] = <r>
+argv[2] = <s>
+argv[3] = <t>
+argv[4] = <u>
+argv[5] = <v>
+argv[6] = <w>
+argv[7] = <x>
+argv[8] = <y>
+argv[9] = <z>
+argv[1] = <r>
+argv[2] = <s>
+argv[3] = <t>
+argv[4] = <u>
+argv[5] = <v>
+argv[6] = <w>
+argv[7] = <x>
+argv[8] = <y>
+argv[9] = <z>
+argv[1] = <r>
+argv[2] = <s>
+argv[3] = <t>
+argv[4] = <u>
+argv[5] = <v>
+argv[6] = <w>
+argv[7] = <x>
+argv[8] = <y>
+argv[9] = <z>
+argv[1] = <r>
+argv[2] = <s>
+argv[3] = <t>
+argv[4] = <u>
+argv[5] = <v>
+argv[6] = <w>
+argv[7] = <x>
+argv[8] = <y>
+argv[9] = <z>
+argv[1] = <r>
+argv[2] = <s>
+argv[3] = <t>
+argv[4] = <u>
+argv[5] = <v>
+argv[6] = <w>
+argv[7] = <x>
+argv[8] = <y>
+argv[9] = <z>
+argv[1] = <r>
+argv[2] = <s>
+argv[3] = <t>
+argv[4] = <u>
+argv[5] = <v>
+argv[6] = <w>
+argv[7] = <x>
+argv[8] = <y>
+argv[9] = <z>
+argv[1] = <a>
+argv[2] = <a>
+argv[3] = <a>
+argv[4] = <a>
+argv[5] = <a>
+argv[6] = <a>
+argv[7] = <a>
+argv[8] = <a>
+argv[9] = <a>
+argv[1] = <a>
+argv[2] = <a>
+argv[3] = <a>
+argv[4] = <a>
+argv[5] = <a>
+argv[6] = <a>
+argv[7] = <a>
+argv[8] = <a>
+argv[9] = <a>
+argv[1] = <r>
+argv[2] = <s>
+argv[3] = <t>
+argv[4] = <u>
+argv[5] = <v>
+argv[6] = <w>
+argv[7] = <x>
+argv[8] = <y>
+argv[9] = <z>
+argv[1] = <r>
+argv[2] = <s>
+argv[3] = <t>
+argv[4] = <u>
+argv[5] = <v>
+argv[6] = <w>
+argv[7] = <x>
+argv[8] = <y>
+argv[9] = <z>
+./new-exp.tests: $9: unbound variable
+./new-exp.tests: 9: unbound variable
+./new-exp.tests: UNSET: unbound variable
+./new-exp.tests: UNSET: unbound variable
+./new-exp.tests: UNSET: unbound variable
+./new-exp.tests: UNSET: unbound variable
+./new-exp.tests: UNSET: unbound variable
 ./new-exp.tests: ABXD: parameter unset
diff --git a/tests/new-exp.sub1 b/tests/new-exp.sub1
new file mode 100644 (file)
index 0000000..c015c22
--- /dev/null
@@ -0,0 +1,11 @@
+expect()
+{
+        echo expect "$@"
+}
+
+expect this is a test of proc subst
+cat <(echo this is a test of proc subst)
+echo this is test 2 > /tmp/x
+expect this is test 2
+cat <(cat /tmp/x)
+rm -f /tmp/x
index 4ac36d0..cae732e 100644 (file)
@@ -1,3 +1,7 @@
+# must do this because posix mode causes process substitution to be disabled
+# and flagged as a syntax error, which causes the shell to exit
+set +o posix
+
 expect()
 {
         echo expect "$@"
@@ -83,6 +87,11 @@ echo -e "$foo\c " ; echo foo
 expect '<barfoo>'
 echo -e $foo"\c " ; echo foo
 
+# make sure backslashes are preserved in front of characters that are not
+# valid backslash escapes
+expect '<\x>'
+echo -e '\x'
+
 # substring tests
 z=abcdefghijklmnop
 expect '<abcd>'
@@ -91,6 +100,9 @@ recho ${z:0:4}
 expect '<efg> <nop>'
 recho ${z:4:3} ${z:${#z}-3:3}
 
+expect '<efg> <nop>'
+recho ${z:4:3} ${z: -3:3}
+
 expect '<hijklmnop>'
 recho ${z:7:30}
 
@@ -138,7 +150,7 @@ recho ${!1-$z}
 
 set -u
 expect $0: ABX: unbound variable
-recho ${ABX}
+( recho ${ABX} )
 set +u
 
 expect $0: '$6: cannot assign in this way'
@@ -222,12 +234,10 @@ recho ${@//%x*/yyy}
 expect a newline
 echo $abmcde
 
-expect this is a test of proc subst
-cat <(echo this is a test of proc subst)
-echo this is test 2 > /tmp/x
-expect this is test 2
-cat <(cat /tmp/x)
-rm -f /tmp/x
+# run process substitution tests in a subshell so that syntax errors
+# caused by a shell not implementing process substitution (e.g., one
+# built on a NeXT) will not cause the whole test to exit prematurely
+${THIS_SH} ./new-exp.sub1
 
 expect $0: '${#:-foo}: bad substitution'
 echo ${#:-foo}
@@ -367,6 +377,78 @@ recho ${xx/one}
 recho ${xx//one}
 recho ${xx/\/one}
 
+# out-of-range substrings
+var=abc
+c=${var:3}
+expect nothing
+recho $c
+c=${var:4}
+expect nothing
+recho $c
+expect '<./new-exp.tests: -2: substring expression < 0>'
+c=${var:0:-2}
+
+var=abcdefghi
+c=${var:3:12}
+recho $c
+c=${var:4:20}
+recho $c
+
+# make sure null patterns work
+xxx=endocrine
+yyy=n
+unset zzz
+
+recho ${xxx/$yyy/*}
+recho ${xxx//$yyy/*}
+
+recho ${xxx/$zzz/*}
+recho ${xxx//$zzz/*}
+
+# another case that caused a core dump in bash-2.0
+XPATH=/usr/bin:/bin:/usr/local/bin:/usr/gnu/bin::/usr/bin/X11:/sbin:/usr/sbin
+
+recho ${XPATH//:/ }
+
+xx=(ar as at au av aw ax ay az)
+
+recho ${xx[@]/a/}
+recho ${xx[@]//a/}
+
+recho ${xx[*]/a/}
+recho ${xx[*]//a/}
+
+recho ${xx[@]%?}
+recho ${xx[*]%?}
+
+recho ${xx[@]#?}
+recho ${xx[*]#?}
+
+set -- ar as at au av aw ax ay az
+
+recho ${@/a/}
+recho ${@//a/}
+
+recho ${*/a/}
+recho ${*//a/}
+
+recho ${@%?}
+recho ${*%?}
+
+recho ${@#?}
+recho ${*#?}
+
+shift $#
+set -u
+( recho $9 ; echo after 1)
+( recho ${9} ; echo after 2)
+( recho $UNSET ; echo after 3)
+( recho ${UNSET} ; echo after 4)
+( recho "$UNSET" ; echo after 5)
+( recho "${UNSET}" ; echo after 6)
+( recho "${#UNSET}" ; echo after 7)
+set +u
+
 # this must be last!
 expect $0: 'ABXD: parameter unset'
 recho ${ABXD:?"parameter unset"}
index 3a0fc53..9651f31 100644 (file)
@@ -14,3 +14,4 @@ argv[1] = <hello, $"world">
 argv[1] = <hello, $"world">
 argv[1] = <$hello, chet>
 argv[1] = <hello, chet>
+ok
index a2e596b..6ce8907 100644 (file)
@@ -55,3 +55,9 @@ recho \$"hello, $world"
 
 expect '<hello, chet>'
 recho $"hello, $world"
+
+z=$'\v\f\a\b'
+case "$z" in
+$'\v\f\a\b')   echo ok;;
+*)             echo bad;;
+esac
index 68ce898..5a7be60 100644 (file)
@@ -12,3 +12,15 @@ a.
 1: x[A] y[B] z[]
 1a:
 2: x[A B]
+[A B ]
+[ A B ]
+==aa==
+====
+====
+argv[1] = < foo>
+argv[1] = < foo>
+argv[1] = <foo>
+argv[1] = < foo>
+argv[1] = <foo>
+argv[1] = <foo>
+argv[1] = < foo>
index ad814d6..fd59284 100644 (file)
@@ -22,3 +22,48 @@ read x < /tmp/IN
 echo 2: "x[$x]"
 rm /tmp/IN
 
+# this is where the bash `read' behavior with respect to $REPLY differs
+# from ksh93
+echo "A B " > /tmp/IN
+
+read < /tmp/IN
+echo "[$REPLY]"
+
+rm /tmp/IN
+
+echo " A B " > /tmp/IN
+
+read < /tmp/IN
+echo "[$REPLY]"
+
+rm /tmp/IN
+
+# make sure that read with more variables than words sets the extra
+# variables to the empty string
+
+bvar=bvar
+cvar=cvar
+echo aa > /tmp/IN
+read avar bvar cvar < /tmp/IN
+echo =="$avar"==
+echo =="$bvar"==
+echo =="$cvar"==
+
+rm /tmp/IN
+
+# test behavior of read with various settings of IFS
+
+echo " foo" | { IFS= read line; recho "$line"; }
+
+echo " foo" | { IFS= ; read line; recho "$line"; }
+
+echo " foo" | { unset IFS ; read line; recho "$line"; }
+
+echo " foo" | { IFS=$'\n' ; read line; recho "$line"; }
+
+echo " foo" | { IFS=$' \n' ; read line; recho "$line"; }
+
+echo " foo" | { IFS=$' \t\n' ; read line; recho "$line"; }
+
+echo " foo" | { IFS=$':' ; read line; recho "$line"; }
+
diff --git a/tests/redir.right b/tests/redir.right
new file mode 100644 (file)
index 0000000..09272fe
--- /dev/null
@@ -0,0 +1,47 @@
+abc
+./redir.tests: /tmp/redir-test: cannot overwrite existing file
+abc
+def
+def
+./redir.tests: $z: ambiguous redirect
+Point 1
+Point 2
+to a
+to b
+Point 3
+to a
+to a
+to b
+to b
+Point 4
+to c
+Point 5
+this is redir1.sub
+this is redir2.sub
+read line1 "ab"
+read line2 "root"
+read line3 "cd"
+read line4 "daemon"
+from stdin: aa
+to stdout
+./redir4.sub: $fd: ambiguous redirect
+./redir4.sub: $fd: ambiguous redirect
+/tmp/err-and-out:
+to stdout
+to stderr
+/tmp/err-and-out:
+to stdout
+to stderr
+0 -- 3 0
+0 -- 4 0
+ab
+cd
+ef
+gh
+ij
+kl
+0
+ab
+cd
+cd
+./redir.tests: redir1.*: No such file or directory
diff --git a/tests/redir.tests b/tests/redir.tests
new file mode 100644 (file)
index 0000000..4e58754
--- /dev/null
@@ -0,0 +1,147 @@
+export LC_ALL=C
+export LANG=C
+
+# catch-all for remaining untested redirection stuff
+set +o posix
+
+echo abc > /tmp/redir-test
+cat /tmp/redir-test
+
+set -o noclobber
+
+#this should be an error
+echo def > /tmp/redir-test
+cat /tmp/redir-test
+
+# but this should succeed
+echo def > /tmp/redir-test-2
+cat /tmp/redir-test-2
+
+# and so should this
+echo def >| /tmp/redir-test
+cat /tmp/redir-test
+
+set +o noclobber
+rm /tmp/redir-test /tmp/redir-test-2
+
+# this should be an error
+z="a b"
+cat < $z
+
+echo "Point 1"
+
+exec 3</etc/passwd
+exec 4>/tmp/bash-a
+exec 5>/tmp/bash-b
+echo "Point 2"
+
+echo to a 1>&4
+echo to b 1>&5
+cat /tmp/bash-a
+cat /tmp/bash-b
+exec 11</dev/null
+echo "Point 3"
+
+echo to a 1>&4
+echo to b 1>&5
+cat /tmp/bash-a
+cat /tmp/bash-b
+
+exec 11<&-
+echo "Point 4"
+
+exec 6<>/tmp/bash-c
+echo to c 1>&6
+cat /tmp/bash-c
+echo "Point 5"
+
+rm -f /tmp/bash-a /tmp/bash-b /tmp/bash-c
+
+#
+# Test the effect of input buffering on the shell's input
+#
+${THIS_SH} < redir1.sub
+
+# more open, close, duplicate file descriptors
+${THIS_SH} ./redir3.sub < ./redir3.in1
+
+# still more redirections
+${THIS_SH} ./redir4.sub < redir4.in1
+
+# various forms of null redirection
+testf()
+{
+       if [ -f "$1" ]; then
+               rm -f "$1"
+       else
+               echo oops -- $1 not found
+       fi
+}
+
+> /tmp/null-redir-a
+testf /tmp/null-redir-a
+
+$EXIT > /tmp/null-redir-b
+testf /tmp/null-redir-b
+
+( > /tmp/null-redir-c )
+testf /tmp/null-redir-c
+
+$EXIT > /tmp/null-redir-d &
+wait
+testf /tmp/null-redir-d
+
+exit 3 | $EXIT > /tmp/null-redir-e
+echo $? -- ${PIPESTATUS[@]}
+testf /tmp/null-redir-e
+
+exit 4 | > /tmp/null-redir-f
+echo $? -- ${PIPESTATUS[@]}
+testf /tmp/null-redir-f
+
+> /tmp/null-redir-g &
+wait
+testf /tmp/null-redir-g
+
+exec >/tmp/null-redir-h &
+wait
+testf /tmp/null-redir-h
+
+# make sure async commands don't get /dev/null as stdin when an explicit
+# input redirection is supplied
+for x in 1 2 3; do
+       { read line ; echo $line ; } &
+       wait
+       { read line ; echo $line ; } &
+       wait
+done << EOF
+ab
+cd
+ef
+gh
+ij
+kl
+EOF
+
+# make sure async commands get /dev/null as stdin in the absence of any
+# input redirection
+/bin/cat &
+wait
+echo $?
+
+# make sure that loops work OK with here documents and are not run in
+# subshells
+while read line; do
+       echo $line
+       l2=$line
+done << EOF
+ab
+cd
+EOF
+echo $l2
+
+# in posix mode, non-interactive shells are not allowed to perform
+# filename expansion on input redirections, even if they expand to
+# a single filename
+set -o posix
+cat < redir1.*
diff --git a/tests/redir1.sub b/tests/redir1.sub
new file mode 100644 (file)
index 0000000..f1082e9
--- /dev/null
@@ -0,0 +1,8 @@
+#
+# Test the effect of input buffering on the shell's input
+#
+echo this is redir1.sub
+
+exec 0< redir2.sub
+
+echo BUG: after exec in redir1.sub
diff --git a/tests/redir2.sub b/tests/redir2.sub
new file mode 100644 (file)
index 0000000..0820f70
--- /dev/null
@@ -0,0 +1 @@
+echo this is redir2.sub
diff --git a/tests/redir3.in1 b/tests/redir3.in1
new file mode 100644 (file)
index 0000000..dbd1fc3
--- /dev/null
@@ -0,0 +1,2 @@
+ab
+cd
diff --git a/tests/redir3.in2 b/tests/redir3.in2
new file mode 100644 (file)
index 0000000..5a1c32b
--- /dev/null
@@ -0,0 +1,2 @@
+root
+daemon
similarity index 91%
rename from tests/misc/redir.t1.sh
rename to tests/redir3.sub
index 0ea00f9..c486253 100644 (file)
@@ -2,7 +2,7 @@ read line1
 
 echo read line1 \"$line1\"
 
-exec 4</etc/passwd
+exec 4<./redir3.in2
 
 exec 5<&0
 exec 0<&4
diff --git a/tests/redir4.in1 b/tests/redir4.in1
new file mode 100644 (file)
index 0000000..e61ef7b
--- /dev/null
@@ -0,0 +1 @@
+aa
diff --git a/tests/redir4.sub b/tests/redir4.sub
new file mode 100644 (file)
index 0000000..4734455
--- /dev/null
@@ -0,0 +1,56 @@
+minus=-
+
+# standard input
+fd=0
+
+exec 3<&$fd
+
+read line <&3
+echo from stdin: $line
+
+# close fd 3
+exec 3<&${minus}
+
+# should give `bad fd', but exact error messages vary
+# read line <&3
+
+# standard output
+fd=1
+
+exec 4>&$fd
+
+echo to stdout >&4
+
+exec 4>&$minus
+
+# should give `bad fd', but exact error messages vary
+# echo to stdout >&4
+
+unset fd
+
+# these are ambiguous redirects
+exec 3<&$fd
+exec 4>&$fd
+
+exec 3>&1 4>&2
+
+exec >&/tmp/err-and-out
+echo to stdout
+echo to stderr >&2
+
+exec 1>&3 2>&4
+echo /tmp/err-and-out:
+cat /tmp/err-and-out
+
+rm /tmp/err-and-out
+
+fd=/tmp/err-and-out
+exec >&$fd
+echo to stdout
+echo to stderr >&2
+
+exec 1>&3 2>&4
+echo /tmp/err-and-out:
+cat /tmp/err-and-out
+
+rm /tmp/err-and-out
diff --git a/tests/rsh.right b/tests/rsh.right
new file mode 100644 (file)
index 0000000..2c48ef4
--- /dev/null
@@ -0,0 +1,12 @@
+./rsh.tests: cd: restricted
+./rsh.tests: PATH: readonly variable
+./rsh.tests: SHELL: readonly variable
+./rsh.tests: /bin/sh: restricted: cannot specify `/' in command names
+./rsh.tests: .: ./source.sub3: restricted
+./rsh.tests: /tmp/restricted: restricted: cannot redirect output
+./rsh.tests: /tmp/restricted: restricted: cannot redirect output
+./rsh.tests: command: restricted: cannot use -p
+./rsh.tests: set: unknown option: +r
+set: usage: set [--abefhkmnptuvxBCHP] [-o option] [arg ...]
+./rsh.tests: exec: restricted
+./rsh.tests: after exec
diff --git a/tests/rsh.tests b/tests/rsh.tests
new file mode 100644 (file)
index 0000000..bd22e9f
--- /dev/null
@@ -0,0 +1,32 @@
+# test restricted shell mode -- these should all be errors
+#
+# things not tested for:
+#      adding builtins dynamically with enable -f
+#      importing function definitions from environment
+
+set -r
+
+cd /
+PATH=$PATH:/usr/local/bin
+SHELL=/bin/sh
+/bin/sh -c 'echo /bin/sh executed'
+
+. ./source.sub3
+
+rm -f /tmp/restricted
+echo abc > /tmp/restricted
+if [ -f /tmp/restricted ]; then
+       echo oops 1 -- output
+fi
+echo abc >> /tmp/restricted
+if [ -f /tmp/restricted ]; then
+       echo oops 2 -- append
+fi
+
+command -p date
+
+set +r
+
+exec /bin/date
+
+echo $0: after exec
index c4badc6..8a959a1 100644 (file)
@@ -1,16 +1,20 @@
 #! /bin/sh
 
-PATH=.:$PATH   # just to get the right version of printenv
+PATH=.:$PATH   # just to get recho/zecho/printenv if not run via `make tests'
 export PATH
 
-# unset ENV only if it is set
-[ "${ENV+set}" = "set" ] && unset ENV
+# unset BASH_ENV only if it is set
+[ "${BASH_ENV+set}" = "set" ] && unset BASH_ENV
+# ditto for SHELLOPTS
+#[ "${SHELLOPTS+set}" = "set" ] && unset SHELLOPTS
 
 : ${THIS_SH:=../bash}
 export THIS_SH
 
-echo Testing ${THIS_SH}
-echo Any output from any test indicates an anomaly worth investigating
+${THIS_SH} ./version
+
+echo Any output from any test, unless otherwise noted, indicates a possible anomaly
+
 for x in run-*
 do
        case $x in
diff --git a/tests/run-builtins b/tests/run-builtins
new file mode 100644 (file)
index 0000000..53d963e
--- /dev/null
@@ -0,0 +1,2 @@
+${THIS_SH} ./builtins.tests > /tmp/xx 2>&1
+diff /tmp/xx builtins.right && rm -f /tmp/xx
diff --git a/tests/run-dirstack b/tests/run-dirstack
new file mode 100644 (file)
index 0000000..a2f2761
--- /dev/null
@@ -0,0 +1,2 @@
+${THIS_SH} ./dirstack.tests > /tmp/xx 2>&1
+diff /tmp/xx dirstack.right && rm -f /tmp/xx
diff --git a/tests/run-errors b/tests/run-errors
new file mode 100644 (file)
index 0000000..6be4e0c
--- /dev/null
@@ -0,0 +1,2 @@
+${THIS_SH} ./errors.tests > /tmp/xx 2>&1
+diff /tmp/xx errors.right && rm -f /tmp/xx
diff --git a/tests/run-execscript b/tests/run-execscript
new file mode 100644 (file)
index 0000000..fdac1eb
--- /dev/null
@@ -0,0 +1,7 @@
+echo "warning: the text of a system error message may vary between systems and" >&2
+echo "warning: produce diff output." >&2
+echo "warning: if the text of the error messages concerning \`notthere' or" >&2
+echo "warning: \`/tmp/bash-notthere' not being found or \`/' being a directory" >&2
+echo "warning: produce diff output, please do not consider this a test failure" >&2
+${THIS_SH} ./execscript > /tmp/xx 2>&1
+diff /tmp/xx execscript.right && rm -f /tmp/xx
diff --git a/tests/run-func b/tests/run-func
new file mode 100644 (file)
index 0000000..f449eb8
--- /dev/null
@@ -0,0 +1,5 @@
+echo "warning: if you have exported functions defined in your environment," >&2
+echo "warning: they may show up as diff output." >&2
+echo "warning: if so, please do not consider this a test failure" >&2
+${THIS_SH} ./func.tests > /tmp/xx 2>&1
+diff /tmp/xx func.right && rm -f /tmp/xx
diff --git a/tests/run-getopts b/tests/run-getopts
new file mode 100644 (file)
index 0000000..1e8b5fb
--- /dev/null
@@ -0,0 +1,2 @@
+${THIS_SH} ./getopts.tests > /tmp/xx 2>&1
+diff /tmp/xx getopts.right && rm -f /tmp/xx
diff --git a/tests/run-histexpand b/tests/run-histexpand
new file mode 100644 (file)
index 0000000..a9d0bce
--- /dev/null
@@ -0,0 +1,4 @@
+echo "warning: all of these tests will fail if history has not been compiled" >&2
+echo "warning: into the shell" >&2
+${THIS_SH} ./histexpand.tests > /tmp/xx 2>&1
+diff /tmp/xx histexpand.right && rm -f /tmp/xx
diff --git a/tests/run-history b/tests/run-history
new file mode 100644 (file)
index 0000000..ea356b1
--- /dev/null
@@ -0,0 +1,4 @@
+echo "warning: all of these tests will fail if history has not been compiled" >&2
+echo "warning: into the shell" >&2
+${THIS_SH} ./history.tests > /tmp/xx 2>&1
+diff /tmp/xx history.right && rm -f /tmp/xx
diff --git a/tests/run-jobs b/tests/run-jobs
new file mode 100644 (file)
index 0000000..e53ecd5
--- /dev/null
@@ -0,0 +1,5 @@
+echo "warning: some of these tests may fail if job control has not been compiled" >&2
+echo "warning: into the shell" >&2
+
+${THIS_SH} ./jobs.tests > /tmp/xx 2>&1
+diff /tmp/xx jobs.right && rm -f /tmp/xx
diff --git a/tests/run-minimal b/tests/run-minimal
new file mode 100644 (file)
index 0000000..dfe392f
--- /dev/null
@@ -0,0 +1,33 @@
+#! /bin/sh
+#
+# run-minimal - a version of run-all for shells configured with
+#              --enable-minimal-config
+#
+PATH=.:$PATH   # just to get the right version of printenv
+export PATH
+
+# unset BASH_ENV only if it is set
+[ "${BASH_ENV+set}" = "set" ] && unset BASH_ENV
+# ditto for SHELLOPTS
+#[ "${SHELLOPTS+set}" = "set" ] && unset SHELLOPTS
+
+: ${THIS_SH:=../bash}
+export THIS_SH
+
+${THIS_SH} ./version.mini
+
+echo Testing ${THIS_SH}
+echo Any output from any test, unless otherwise noted, indicates a possible anomaly
+for x in run-*
+do
+       case $x in
+       $0)     ;;
+       *.orig|*~) ;;
+       run-dollars|run-execscript|run-func|run-getopts|run-heredoc) echo $x ; sh $x ;;
+       run-ifs-tests|run-input-test|run-more-exp|run-nquote|run-posix2) echo $x ; sh $x ;;
+       run-precedence|run-quote|run-read|run-rhs-exp|run-strip|run-tilde) echo $x ; sh $x ;;
+       *)      ;;
+       esac
+done
+
+exit 0
diff --git a/tests/run-minus-e b/tests/run-minus-e
deleted file mode 100644 (file)
index 2a91a3d..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-${THIS_SH} ./minus-e > /tmp/xx
-diff /tmp/xx minus-e.right && rm -f /tmp/xx
diff --git a/tests/run-redir b/tests/run-redir
new file mode 100644 (file)
index 0000000..c7a5475
--- /dev/null
@@ -0,0 +1,6 @@
+echo "warning: the text of a system error message may vary between systems and" >&2
+echo "warning: produce diff output." >&2
+echo "warning: if the text of an error message concerning \`redir1.*' not being" >&2
+echo "warning: found produces diff output, please do not consider it a test failure" >&2
+${THIS_SH} ./redir.tests > /tmp/xx 2>&1
+diff /tmp/xx redir.right && rm -f /tmp/xx
diff --git a/tests/run-rsh b/tests/run-rsh
new file mode 100644 (file)
index 0000000..ef23583
--- /dev/null
@@ -0,0 +1,2 @@
+${THIS_SH} ./rsh.tests > /tmp/xx 2>&1
+diff /tmp/xx rsh.right && rm -f /tmp/xx
index ab13380..645693f 100644 (file)
@@ -1,2 +1,2 @@
-${THIS_SH} ./test-tests 2>&1 > /tmp/xx
+${THIS_SH} ./test-tests >/tmp/xx 2>&1
 diff /tmp/xx test.right && rm -f /tmp/xx
diff --git a/tests/run-trap b/tests/run-trap
new file mode 100644 (file)
index 0000000..78a164e
--- /dev/null
@@ -0,0 +1,2 @@
+${THIS_SH} ./trap.tests > /tmp/xx 2>&1
+diff /tmp/xx trap.right && rm -f /tmp/xx
diff --git a/tests/run-type b/tests/run-type
new file mode 100644 (file)
index 0000000..4d195b0
--- /dev/null
@@ -0,0 +1,2 @@
+${THIS_SH} ./type.tests > /tmp/xx 2>&1
+diff /tmp/xx type.right && rm -f /tmp/xx
index 214ff88..895aff7 100644 (file)
@@ -17,3 +17,53 @@ fi
 # command subst should not inherit -e
 set -e
 echo $(false; echo ok)
+
+if set +e
+then
+       false
+fi
+echo hi
+
+set -e
+
+# a failing command in the compound list following a while, until, or
+# if should not cause the shell to exit
+
+while false; do
+       echo hi
+done
+echo while succeeded
+
+x=1
+until (( x == 4 )); do
+       x=4
+done
+echo until succeeded: $x
+
+if false; then
+       echo oops
+fi
+echo if succeeded
+
+# failing commands that are part of an AND or OR list should not
+# cause the shell to exit
+false && echo AND list failed
+echo AND list succeeded
+
+false || echo OR list succeeded
+
+! false
+echo ! succeeded
+
+# make sure eval preserves the state of the -e flag and `!' reserved word
+set -e
+if eval false; then
+       echo oops
+fi
+echo eval succeeded
+
+! eval false
+echo ! eval succeeded -- 1
+
+! eval '(exit 5)'
+echo ! eval succeeded -- 2
index 61f13b2..aa98063 100644 (file)
 8
 9
 ok
+hi
+while succeeded
+until succeeded: 4
+if succeeded
+AND list succeeded
+OR list succeeded
+! succeeded
+eval succeeded
+! eval succeeded -- 1
+! eval succeeded -- 2
diff --git a/tests/source.sub1 b/tests/source.sub1
new file mode 100644 (file)
index 0000000..8b8586f
--- /dev/null
@@ -0,0 +1 @@
+echo $AVAR
diff --git a/tests/source.sub2 b/tests/source.sub2
new file mode 100644 (file)
index 0000000..7a031a1
--- /dev/null
@@ -0,0 +1,5 @@
+echo in source.sub2, calling return
+
+return 5
+
+echo oops -- return in source.sub2 failed
diff --git a/tests/source.sub3 b/tests/source.sub3
new file mode 100644 (file)
index 0000000..4a12501
--- /dev/null
@@ -0,0 +1 @@
+echo "$@"
diff --git a/tests/source.sub4 b/tests/source.sub4
new file mode 100644 (file)
index 0000000..717c1ab
--- /dev/null
@@ -0,0 +1 @@
+set -- m n o p
index 1fb0dc8..9b81359 100644 (file)
@@ -1,3 +1,13 @@
+if (( $UID == 0 )); then
+       echo "test-tests: the test suite should not be run as root" >&2
+fi
+
+b()
+{
+       [ "$@" ]
+       echo $?
+}
+
 t()
 {
        test "$@"
@@ -23,6 +33,10 @@ echo 't -d run-all'
 t -d run-all
 echo 't -d /etc'
 t -d /etc
+echo 't -d ""'
+t -d ""
+echo 'b -d ""'
+b -d ""
 
 echo 't -e noexist'
 t -e noexist
@@ -40,6 +54,7 @@ echo 't -g run-all'
 t -g run-all
 
 touch /tmp/test.setgid
+chgrp ${GROUPS[0]} /tmp/test.setgid
 chmod ug+x /tmp/test.setgid
 chmod g+s /tmp/test.setgid
 echo 't -g /tmp/test.setgid'
@@ -60,11 +75,16 @@ t -p run-all
 echo 't -r noexist'
 t -r noexist
 
-touch /tmp/test.noread
-chmod a-r /tmp/test.noread
-echo 't -r /tmp/test.noread'
-t -r /tmp/test.noread
-rm -f /tmp/test.noread
+if (( $UID != 0 )); then
+       touch /tmp/test.noread
+       chmod a-r /tmp/test.noread
+       echo 't -r /tmp/test.noread'
+       t -r /tmp/test.noread
+       rm -f /tmp/test.noread
+else
+       echo 't -r /tmp/test.noread'
+       echo 1
+fi
 
 echo 't -r run-all'
 t -r run-all
@@ -97,11 +117,16 @@ rm -f /tmp/test.setuid
 echo 't -w noexist'
 t -w noexist
 
-touch /tmp/test.nowrite
-chmod a-w /tmp/test.nowrite
-echo 't -w /tmp/test.nowrite'
-t -w /tmp/test.nowrite
-rm -f /tmp/test.nowrite
+if (( $UID != 0 )); then
+       touch /tmp/test.nowrite
+       chmod a-w /tmp/test.nowrite
+       echo 't -w /tmp/test.nowrite'
+       t -w /tmp/test.nowrite
+       rm -f /tmp/test.nowrite
+else
+       echo 't -w /tmp/test.nowrite'
+       echo 1
+fi
 
 echo 't -w /dev/null'
 t -w /dev/null
@@ -163,6 +188,8 @@ echo 't 200 -eq 200'
 t 200 -eq 200
 echo 't 34 -eq 222'
 t 34 -eq 222
+echo 't -32 -eq 32'
+t -32 -eq 32
 
 echo 't 200 -ne 200'
 t 200 -ne 200
@@ -221,8 +248,11 @@ echo 't -w /dev/fd/1'
 t -w /dev/fd/1
 echo 't -w /dev/fd/2'
 t -w /dev/fd/2
+
 echo 't'
 t
+echo 'b'
+b
 
 echo 't 12 -eq 34'
 t 12 -eq 34
@@ -277,3 +307,86 @@ echo 't ( -E )'
 t \( -E \)
 echo 't ( "" )'
 t \( "" \)
+
+z=42
+
+echo 't ! -z "$z"'
+t ! -z "$z"
+
+echo 't ! -n "$z"'
+t ! -n "$z"
+
+zero=
+echo 't "$zero"'
+t "$zero"
+echo 't ! "$zero"'
+t ! "$zero"
+echo 'b "$zero"'
+b "$zero"
+echo 'b ! "$zero"'
+b ! "$zero"
+
+touch /tmp/test.group
+chgrp ${GROUPS[0]} /tmp/test.group
+echo 't -G /tmp/test.group'
+t -G /tmp/test.group
+rm /tmp/test.group
+
+case "${THIS_SH}" in
+/*)    SHNAME=${THIS_SH} ;;
+*)     SHNAME=${PWD}/${THIS_SH} ;;
+esac
+
+if ln -s ${SHNAME} /tmp/test.symlink 2>/dev/null; then
+       chgrp ${GROUPS[0]} /tmp/test.symlink
+       echo 't -h /tmp/test.symlink'
+       t -h /tmp/test.symlink
+       # some systems don't let you remove this
+       rm -f /tmp/test.symlink 2>/dev/null
+else
+       echo 't -h /tmp/test.symlink'
+       echo 0
+fi
+
+# arithmetic constant errors
+echo "t 4+3 -eq 7"
+t 4+3 -eq 7
+echo "b 4-5 -eq 7"
+b 4+3 -eq 7
+
+echo "t 9 -eq 4+5"
+t 9 -eq 4+5
+echo "b 9 -eq 4+5"
+b 9 -eq 4+5
+
+A=7
+echo "t A -eq 7"
+t A -eq 7
+echo "b A -eq 7"
+b A -eq 7
+
+B=9
+echo "t 9 -eq B"
+t 9 -eq B
+echo "b 9 -eq B"
+b 9 -eq B
+
+# badly formed expressions
+echo 't ( 1 = 2'
+t \( 1 = 2
+echo 'b ( 1 = 2'
+b \( 1 = 2
+
+# more errors
+t a b
+t a b c
+t -A v
+# too many arguments -- argument expected is also reasonable
+t 4 -eq 4 -a 2 -ne 5 -a 4 -ne
+# too many arguments
+t 4 -eq 4 -a 3 4
+
+[
+echo $?
+
+t \( \)
index 9acf6c8..4a1fcab 100644 (file)
@@ -14,6 +14,10 @@ t -d run-all
 1
 t -d /etc
 0
+t -d ""
+1
+b -d ""
+1
 t -e noexist
 1
 t -e run-all
@@ -102,6 +106,8 @@ t 200 -eq 200
 0
 t 34 -eq 222
 1
+t -32 -eq 32
+1
 t 200 -ne 200
 1
 t 34 -ne 222
@@ -146,6 +152,8 @@ t -w /dev/fd/2
 0
 t
 1
+b
+1
 t 12 -eq 34
 1
 t ! 12 -eq 34
@@ -192,3 +200,63 @@ t ( -E )
 0
 t ( "" )
 1
+t ! -z "$z"
+0
+t ! -n "$z"
+1
+t "$zero"
+1
+t ! "$zero"
+0
+b "$zero"
+1
+b ! "$zero"
+0
+t -G /tmp/test.group
+0
+t -h /tmp/test.symlink
+0
+t 4+3 -eq 7
+./test-tests: test: 4+3: integer expression expected
+1
+b 4-5 -eq 7
+./test-tests: [: 4+3: integer expression expected
+1
+t 9 -eq 4+5
+./test-tests: test: 4+5: integer expression expected
+1
+b 9 -eq 4+5
+./test-tests: [: 4+5: integer expression expected
+1
+t A -eq 7
+./test-tests: test: A: integer expression expected
+1
+b A -eq 7
+./test-tests: [: A: integer expression expected
+1
+t 9 -eq B
+./test-tests: test: B: integer expression expected
+1
+b 9 -eq B
+./test-tests: [: B: integer expression expected
+1
+t ( 1 = 2
+./test-tests: test: `)' expected
+1
+b ( 1 = 2
+./test-tests: [: `)' expected, found ]
+1
+./test-tests: test: a: unary operator expected
+1
+./test-tests: test: b: binary operator expected
+1
+./test-tests: test: -A: unary operator expected
+1
+./test-tests: test: too many arguments
+1
+./test-tests: test: too many arguments
+1
+./test-tests: [: missing `]'
+1
+./test-tests: test: (: unary operator expected
+1
index f0acd55..f5f5309 100644 (file)
@@ -1,3 +1,9 @@
+# this is needed because posix mode restricts tilde expansion to assignment
+# statements preceding a command, instead of the default of expanding all
+# assignment statements on the line (e.g., after `export').  Without this,
+# the next-to-last test fails
+set +o posix
+
 HOME=/usr/xyz
 SHELL=~/bash
 echo ~ch\et
@@ -33,7 +39,28 @@ echo "$PPATH"
 # yes tilde expansion
 export PPATH=$XPATH:~/bin
 echo "$PPATH"
+declare -x PPATH=$XPATH:~/bin
+echo "$PPATH"
 
 # no tilde expansion
 export PPATH="$XPATH:~/bin"
 echo "$PPATH"
+declare -x PPATH="$XPATH:~/bin"
+echo "$PPATH"
+
+# more tests of tilde expansion when executing case commands
+case ~ in
+$HOME) echo ok 1;;
+*) echo bad 1 ;;
+esac
+
+case ~ in
+~)     echo ok 2 ;;
+\~)    echo bad 2a ;;
+*)     echo bad 2b ;;
+esac
+
+case $unset in
+"")    echo ok 3 ;;
+*)     echo bad 3 ;;
+esac
index c07ade1..b22dabf 100644 (file)
@@ -16,4 +16,9 @@ abcd:~chet
 /bin:/usr/bin:.:/usr/xyz/bin
 /bin:/usr/bin:.:~/bin
 /bin:/usr/bin:.:/usr/xyz/bin
+/bin:/usr/bin:.:/usr/xyz/bin
+/bin:/usr/bin:.:~/bin
 /bin:/usr/bin:.:~/bin
+ok 1
+ok 2
+ok 3
diff --git a/tests/trap.right b/tests/trap.right
new file mode 100644 (file)
index 0000000..442a864
--- /dev/null
@@ -0,0 +1,51 @@
+subshell exit
+trap -- 'echo exiting' EXIT
+trap -- 'echo aborting' SIGHUP
+trap -- 'echo aborting' SIGINT
+trap -- 'echo aborting' SIGQUIT
+trap -- 'echo aborting' SIGABRT
+trap -- 'echo aborting' SIGTERM
+debug line
+[20] debug
+trap -- 'echo exiting' EXIT
+trap -- 'echo aborting' SIGHUP
+trap -- 'echo aborting' SIGINT
+trap -- 'echo aborting' SIGQUIT
+trap -- 'echo aborting' SIGABRT
+trap -- 'echo aborting' SIGTERM
+trap -- 'echo [$LINENO] debug' DEBUG
+[22] debug
+funcdebug line
+[2] funcdebug
+[24] debug
+trap -- 'echo exiting' EXIT
+trap -- 'echo aborting' SIGHUP
+trap -- 'echo aborting' SIGINT
+trap -- 'echo aborting' SIGQUIT
+trap -- 'echo aborting' SIGABRT
+trap -- 'echo aborting' SIGTERM
+trap -- 'echo [$LINENO] debug' DEBUG
+[26] debug
+trap -- 'echo exiting' EXIT
+trap -- 'echo aborting' SIGHUP
+trap -- 'echo aborting' SIGINT
+trap -- 'echo aborting' SIGQUIT
+trap -- 'echo aborting' SIGABRT
+trap -- 'echo aborting' SIGTERM
+trap -- '' DEBUG
+trap -- 'echo exiting' EXIT
+trap -- 'echo aborting' SIGHUP
+trap -- 'echo aborting' SIGINT
+trap -- 'echo aborting' SIGQUIT
+trap -- 'echo aborting' SIGABRT
+trap -- 'echo aborting' SIGTERM
+trap -- 'echo exiting' EXIT
+trap -- '' SIGINT
+trap -- 'echo aborting' SIGQUIT
+trap -- 'echo aborting' SIGABRT
+trap -- 'echo aborting' SIGTERM
+caught a child death
+caught a child death
+caught a child death
+trap -- 'echo caught a child death' SIGCHLD
+exiting
diff --git a/tests/trap.sub1 b/tests/trap.sub1
new file mode 100755 (executable)
index 0000000..48f8530
--- /dev/null
@@ -0,0 +1,4 @@
+# signals ignored at shell startup cannot be trapped or reset
+trap 'echo USR2' USR2
+
+trap -p USR2
diff --git a/tests/trap.tests b/tests/trap.tests
new file mode 100644 (file)
index 0000000..66337ba
--- /dev/null
@@ -0,0 +1,58 @@
+# test the trap code
+
+trap 'echo exiting' 0
+trap 'echo aborting' 1 2 3 6 15
+
+# make sure a user-specified subshell runs the exit trap, but does not
+# inherit the exit trap from a parent shell
+( trap 'echo subshell exit' 0; exit 0 )
+( exit 0 )
+
+trap
+
+func()
+{
+       trap 'echo [$LINENO] funcdebug' DEBUG
+       echo funcdebug line
+}
+
+trap 'echo [$LINENO] debug' DEBUG
+echo debug line
+
+trap
+
+func
+
+trap
+
+trap '' DEBUG
+
+trap
+
+trap - debug
+
+trap
+
+trap - HUP
+trap hup
+trap '' INT
+trap '' int
+
+trap
+
+# hmmm...should this set the handling to SIG_IGN for children, too?
+trap '' USR2
+./trap.sub1
+
+#
+# show that setting a trap on SIGCHLD is not disastrous.
+#
+set -o monitor
+
+trap 'echo caught a child death' SIGCHLD
+
+sleep 7 & sleep 6 & sleep 5 &
+
+wait
+
+trap -p SIGCHLD
diff --git a/tests/type.right b/tests/type.right
new file mode 100644 (file)
index 0000000..f1c1bcf
--- /dev/null
@@ -0,0 +1,41 @@
+./type.tests: type: unknown option: f
+type: usage: type [-apt] name [name ...]
+./type.tests: type: notthere: not found
+./type.tests: command: notthere: not found
+function
+keyword
+alias
+builtin
+file
+file
+func is a function
+func () 
+{ 
+    echo this is func
+}
+while is a shell keyword
+while is a shell keyword
+m is aliased to `more'
+builtin is a shell builtin
+/bin/sh is /bin/sh
+func
+func is a function
+func () 
+{ 
+    echo this is func
+}
+while
+while is a shell keyword
+alias m='more'
+alias m='more'
+alias m='more'
+m is aliased to `more'
+builtin
+builtin is a shell builtin
+/bin/sh
+/bin/sh is /bin/sh
+./type.tests: type: func: not found
+./type.tests: type: m: not found
+/bin/sh
+/tmp/bash
+bash is hashed (/tmp/bash)
diff --git a/tests/type.tests b/tests/type.tests
new file mode 100644 (file)
index 0000000..360f9ef
--- /dev/null
@@ -0,0 +1,60 @@
+set +o posix
+
+hash -r
+unalias -a
+
+# this should echo nothing
+type
+# this should be a usage error
+type -f ${THIS_SH}
+
+# these should behave identically
+type notthere
+command -v notthere
+
+alias m=more
+
+unset -f func 2>/dev/null
+func() { echo this is func; }
+
+type -t func
+type -t while
+type -t m
+type -t builtin
+type -t /bin/sh
+type -t ${THIS_SH}
+
+type func
+# the following two should produce identical output
+type while
+type -a while
+type m
+type builtin
+type /bin/sh
+
+command -v func
+command -V func
+command -v while
+command -V while
+# the following three lines should produce the same output
+command -v m
+alias -p
+alias m
+command -V m
+command -v builtin
+command -V builtin
+command -v /bin/sh
+command -V /bin/sh
+
+unset -f func
+type func
+unalias m
+type m
+
+hash -p /bin/sh sh
+type -p sh
+
+SHBASE=${THIS_SH##*/}
+hash -p /tmp/$SHBASE $SHBASE
+type -p $SHBASE
+type $SHBASE
index 35972b7..aa730cf 100644 (file)
 1 2
 1 1
 unset
+toronto airport
+AVAR
+song by rush
+BVAR
+toronto airport
+AVAR
+AVAR
+42
+/bin:/usr/bin:/usr/local/bin:.
+avar=([0]="/bin:/usr/bin:/usr/local/bin:.")
+z=yy
+42
+declare -i ivar="10"
+unset
+declare -x ivar="42"
+hB
+braceexpand:hashall
+hPB
+braceexpand:hashall:physical
index 9938cba..e7736a7 100644 (file)
@@ -103,3 +103,67 @@ export a
 a=bcde
 export a
 /bin/true 2>/dev/null
+
+func()
+{
+       local YYZ
+
+       YYZ="song by rush"
+       echo $YYZ
+       echo $A
+}
+
+YYZ="toronto airport"
+A="AVAR"
+echo $YYZ
+echo $A
+A=BVAR func
+echo $YYZ
+echo $A
+
+export A
+# Make sure expansion doesn't use assignment statements preceding a builtin
+A=ZVAR echo $A
+
+PATH=/bin:/usr/bin:/usr/local/bin:.
+func2()
+{
+       local z=yy
+       local -a avar=( ${PATH//: } )
+       echo ${avar[@]}
+       local
+}
+
+avar=42
+echo $avar
+func2
+echo $avar
+
+# try to set an attribute for an unset variable; make sure it persists
+# when the variable is assigned a value
+declare -i ivar
+
+ivar=10
+
+declare -p ivar
+unset ivar
+
+# export an unset variable, make sure it is not suddenly set, but make
+# sure the export attribute persists when the variable is assigned a
+# value
+export ivar
+echo ${ivar-unset}
+
+ivar=42
+declare -p ivar
+
+# make sure that shopt -o is reflected in $SHELLOPTS
+# first, get rid of things that might be set automatically via shell
+# variables
+set +o posix
+set +o ignoreeof
+echo $-
+echo ${SHELLOPTS}
+shopt -so physical
+echo $-
+echo ${SHELLOPTS}
diff --git a/tests/version b/tests/version
new file mode 100644 (file)
index 0000000..bd74020
--- /dev/null
@@ -0,0 +1,8 @@
+echo Testing ${THIS_SH}
+
+echo version: $BASH_VERSION
+echo versinfo: ${BASH_VERSINFO[@]}
+
+echo HOSTTYPE = $HOSTTYPE
+echo OSTYPE = $OSTYPE
+echo MACHTYPE = $MACHTYPE
diff --git a/tests/version.mini b/tests/version.mini
new file mode 100644 (file)
index 0000000..72e4bf9
--- /dev/null
@@ -0,0 +1,8 @@
+echo Testing ${THIS_SH}
+
+echo version: $BASH_VERSION
+#echo versinfo: ${BASH_VERSINFO[@]}
+
+echo HOSTTYPE = $HOSTTYPE
+echo OSTYPE = $OSTYPE
+echo MACHTYPE = $MACHTYPE
diff --git a/trap.c b/trap.c
index 139dc2a..ac4d6eb 100644 (file)
--- a/trap.c
+++ b/trap.c
 #include "bashtypes.h"
 #include "trap.h"
 
-#if defined (HAVE_STRING_H)
-#  include <string.h>
-#else /* !HAVE_STRING_H */
-#  include <strings.h>
-#endif /* !HAVE_STRING_H */
+#include "bashansi.h"
 
 #if defined (HAVE_UNISTD_H)
 #  include <unistd.h>
@@ -61,6 +57,7 @@ static void change_signal (), restore_signal ();
 extern int interactive_shell, interactive;
 extern int interrupt_immediately;
 extern int last_command_exit_value;
+extern int line_number;
 
 /* The list of things to do originally, before we started trapping. */
 SigHandler *original_signals[NSIG];
@@ -81,6 +78,11 @@ int pending_traps[NSIG];
    trap command (e.g., when `return' is executed in the trap command). */
 int running_trap;
 
+/* The value of line_number when the trap started executing, since
+   parse_and_execute resets it to 1 and the trap command might want
+   it. */
+int trap_line_number;
+
 /* A value which can never be the target of a trap handler. */
 #define IMPOSSIBLE_TRAP_HANDLER (SigHandler *)initialize_traps
 
@@ -200,7 +202,7 @@ run_pending_traps ()
              CLRINTERRUPT;
            }
          else
-           parse_and_execute (savestring (trap_list[sig]), "trap", 0);
+           parse_and_execute (savestring (trap_list[sig]), "trap", SEVAL_NONINT|SEVAL_NOHIST);
 
          pending_traps[sig] = 0;
 
@@ -307,6 +309,8 @@ set_signal (sig, string)
   if (sig == DEBUG_TRAP || sig == EXIT_TRAP)
     {
       change_signal (sig, savestring (string));
+      if (sig == EXIT_TRAP && interactive == 0)
+       initialize_terminating_signals ();
       return;
     }
 
@@ -366,7 +370,8 @@ change_signal (sig, value)
      int sig;
      char *value;
 {
-  free_trap_command (sig);
+  if ((sigmodes[sig] & SIG_INPROGRESS) == 0)
+    free_trap_command (sig);
   trap_list[sig] = value;
 
   sigmodes[sig] |= SIG_TRAPPED;
@@ -409,9 +414,12 @@ restore_default_signal (sig)
 {
   if (sig == DEBUG_TRAP || sig == EXIT_TRAP)
     {
-      free_trap_command (sig);
+      if ((sig != DEBUG_TRAP) || (sigmodes[sig] & SIG_INPROGRESS) == 0)
+       free_trap_command (sig);
       trap_list[sig] = (char *)NULL;
       sigmodes[sig] &= ~SIG_TRAPPED;
+      if (sigmodes[sig] & SIG_INPROGRESS)
+       sigmodes[sig] |= SIG_CHANGED;
       return;
     }
 
@@ -491,7 +499,7 @@ run_exit_trap ()
       code = setjmp (top_level);
 
       if (code == 0)
-       parse_and_execute (trap_command, "exit trap", 0);
+       parse_and_execute (trap_command, "exit trap", SEVAL_NONINT|SEVAL_NOHIST);
       else if (code == EXITPROG)
         return (last_command_exit_value);
       else
@@ -516,7 +524,7 @@ _run_trap_internal (sig, tag)
      char *tag;
 {
   char *trap_command, *old_trap;
-  int old_exit_value;
+  int old_exit_value, old_line_number;
 
   /* Run the trap only if SIG is trapped and not ignored, and we are not
      currently executing in the trap handler. */
@@ -531,7 +539,10 @@ _run_trap_internal (sig, tag)
 
       running_trap = sig + 1;
       old_exit_value = last_command_exit_value;
-      parse_and_execute (trap_command, tag, 0);
+      /* Need to copy the value of line_number because parse_and_execute
+        resets it to 1, and the trap command might want it. */
+      trap_line_number = line_number;
+      parse_and_execute (trap_command, tag, SEVAL_NONINT|SEVAL_NOHIST);
       last_command_exit_value = old_exit_value;
       running_trap = 0;
 
diff --git a/trap.h b/trap.h
index 1983a47..b39d5e9 100644 (file)
--- a/trap.h
+++ b/trap.h
@@ -24,7 +24,7 @@
 #include "stdc.h"
 
 #if !defined (SIG_DFL)
-#include <sys/types.h>
+#include "bashtypes.h"
 #include <signal.h>
 #endif /* SIG_DFL */
 
similarity index 95%
rename from bashwait.h
rename to unionwait.h
index 97f62db..eb795ac 100644 (file)
@@ -1,4 +1,4 @@
-/* bashwait.h -- definitions for using a `union wait' on systems without
+/* unionwait.h -- definitions for using a `union wait' on systems without
    one. */
 
 /* Copyright (C) 1996 Free Software Foundation, Inc.
@@ -19,8 +19,8 @@
    with Bash; see the file COPYING.  If not, write to the Free Software
    Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
 
-#ifndef _BASH_WAIT_H
-#define _BASH_WAIT_H
+#ifndef _UNIONWAIT_H
+#define _UNIONWAIT_H
 
 #if !defined (WORDS_BIGENDIAN)
 union wait
@@ -95,4 +95,4 @@ union wait
 #define WEXITSTATUS(x) ((x).w_retcode)
 #define WIFCORED(x)    ((x).w_coredump)
 
-#endif /* _BASH_WAIT_H */
+#endif /* _UNIONWAIT_H */
index dac5e04..17144dc 100644 (file)
@@ -27,6 +27,8 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
 #include "config.h"
 
 #include "bashtypes.h"
+#include "bashansi.h"
+
 #if defined (HAVE_UNISTD_H)
 #  include <unistd.h>
 #endif
@@ -44,10 +46,21 @@ typedef struct _uwp {
   char *arg;
 } UNWIND_ELT;
 
-static void
-  unwind_frame_discard_internal (), unwind_frame_run_internal (),
-  add_unwind_protect_internal (), remove_unwind_protect_internal (),
-  run_unwind_protects_internal (), without_interrupts ();
+/* Structure describing a saved variable and the value to restore it to.
+   If a cleanup function is set to restore_variable, the `arg' pointer
+   points to this. */
+typedef struct {
+  int *variable;
+  char *desired_setting;
+  int size;
+} SAVED_VAR;
+
+static void unwind_frame_discard_internal (), unwind_frame_run_internal ();
+static void add_unwind_protect_internal (), remove_unwind_protect_internal ();
+static void run_unwind_protects_internal (), without_interrupts ();
+
+static void restore_variable ();
+static void discard_saved_var ();
 
 static UNWIND_ELT *unwind_protect_list = (UNWIND_ELT *)NULL;
 
@@ -147,11 +160,14 @@ add_unwind_protect_internal (cleanup, arg)
 static void
 remove_unwind_protect_internal ()
 {
-  UNWIND_ELT *elt = unwind_protect_list;
+  UNWIND_ELT *elt;
 
+  elt = unwind_protect_list;
   if (elt)
     {
       unwind_protect_list = unwind_protect_list->next;
+      if (elt->cleanup && elt->cleanup == (Function *)restore_variable)
+       discard_saved_var ((SAVED_VAR *)elt->arg);
       free (elt);
     }
 }
@@ -164,7 +180,7 @@ run_unwind_protects_internal ()
   while (elt)
    {
       /* This function can be run at strange times, like when unwinding
-       the entire world of unwind protects.  Thus, we may come across
+        the entire world of unwind protects.  Thus, we may come across
         an element which is simply a label for a catch frame.  Don't call
         the non-existant function. */
       if (elt->cleanup)
@@ -186,11 +202,16 @@ unwind_frame_discard_internal (tag)
   while (elt = unwind_protect_list)
     {
       unwind_protect_list = unwind_protect_list->next;
-      if (!elt->cleanup && (STREQ (elt->arg, tag)))
+      if (elt->cleanup == 0 && (STREQ (elt->arg, tag)))
        {
          free (elt);
          break;
        }
+      else if (elt->cleanup && elt->cleanup == (Function *)restore_variable)
+        {
+          discard_saved_var ((SAVED_VAR *)elt->arg);
+          free (elt);
+        }
       else
        free (elt);
     }
@@ -225,12 +246,14 @@ unwind_frame_run_internal (tag)
     }
 }
 
-/* Structure describing a saved variable and the value to restore it to. */
-typedef struct {
-  int *variable;
-  char *desired_setting;
-  int size;
-} SAVED_VAR;
+static void
+discard_saved_var (sv)
+     SAVED_VAR *sv;
+{
+  if (sv->size != sizeof (int))
+    free (sv->desired_setting);
+  free (sv);
+}
 
 /* Restore the value of a variable, based on the contents of SV.  If
    sv->size is greater than sizeof (int), sv->desired_setting points to
@@ -242,7 +265,7 @@ restore_variable (sv)
 {
   if (sv->size != sizeof (int))
     {
-      bcopy ((char *)sv->desired_setting, (char *)sv->variable, sv->size);
+      FASTCOPY ((char *)sv->desired_setting, (char *)sv->variable, sv->size);
       free (sv->desired_setting);
     }
   else
@@ -267,8 +290,17 @@ unwind_protect_var (var, value, size)
   s->variable = var;
   if (size != sizeof (int))
     {
+      /* There is a problem here when VALUE is 0.  This tries to copy the
+         first SIZE bytes starting at memory location 0 into
+         s->desired_setting.  There is no guarantee that these bytes are
+         0, or make a valid null pointer.  We can try to bzero the space,
+         or just save it as 0 (or (void *)0).  If we do the latter, make
+         sure restore_variable is changed to understand it. */
       s->desired_setting = (char *)xmalloc (size);
-      bcopy (value, (char *)s->desired_setting, size);
+      if (value == 0)
+       bzero ((char *)s->desired_setting, size);
+      else
+       FASTCOPY (value, (char *)s->desired_setting, size);
     }
   else
     s->desired_setting = value;
index 2c8b939..fad37af 100644 (file)
 #include "bashtypes.h"
 #include "posixstat.h"
 
+#if defined (qnx)
+#  include <sys/vc.h>
+#endif
+
 #if defined (HAVE_UNISTD_H)
 #  include <unistd.h>
 #endif
@@ -38,6 +42,7 @@
 #include "mailcheck.h"
 #include "input.h"
 
+#include "builtins/getopt.h"
 #include "builtins/common.h"
 #include <tilde/tilde.h>
 
@@ -93,9 +98,11 @@ WORD_LIST *rest_of_args = (WORD_LIST *)NULL;
 int dollar_dollar_pid;
 
 /* An array which is passed to commands as their environment.  It is
-   manufactured from the overlap of the initial environment and the
+   manufactured from the union of the initial environment and the
    shell variables that are marked for export. */
 char **export_env = (char **)NULL;
+static int export_env_index;
+static int export_env_size;
 
 /* Non-zero means that we have to remake EXPORT_ENV. */
 int array_needs_making = 1;
@@ -108,6 +115,10 @@ static char *have_local_variables;
 static int local_variable_stack_size;
 
 /* Some forward declarations. */
+static void set_home_var ();
+static void set_shell_var ();
+static char *get_bash_name ();
+static void initialize_shell_level ();
 static void uidset ();
 static void initialize_dynamic_variables ();
 static void make_vers_array ();
@@ -137,24 +148,40 @@ initialize_shell_variables (env, no_functions)
   for (string_index = 0; string = env[string_index++]; )
     {
       char_index = 0;
-
-      string_length = strlen (string);
-      name = xmalloc (1 + string_length);
-
+      name = string;
       while ((c = *string++) && c != '=')
-       name[char_index++] = c;
+       ;
+      if (string[-1] == '=')
+        char_index = string - name - 1;
 
+      /* If there are weird things in the environment, like `=xxx' or a
+        string without an `=', just skip them. */
+      if (char_index == 0)
+        continue;
+
+      /* ASSERT(name[char_index] == '=') */
       name[char_index] = '\0';
+      /* Now, name = env variable name, string = env variable value, and
+         char_index == strlen (name) */
 
       /* If exported function, define it now. */
       if (no_functions == 0 && STREQN ("() {", string, 4))
        {
-         temp_string = xmalloc (3 + string_length + strlen (name));
+         string_length = strlen (string);
+         temp_string = xmalloc (3 + string_length + char_index);
+#if 1
+         strcpy (temp_string, name);
+         temp_string[char_index] = ' ';
+         strcpy (temp_string + char_index + 1, string);
+#else
          sprintf (temp_string, "%s %s", name, string);
+#endif
 
-         parse_and_execute (temp_string, name, 0);
+         parse_and_execute (temp_string, name, SEVAL_NONINT|SEVAL_NOHIST);
 
-         if (name[char_index - 1] == ')')
+         /* Ancient backwards compatibility.  Old versions of bash exported
+            functions like name()=() {...} */
+         if (name[char_index - 1] == ')' && name[char_index - 2] == '(')
            name[char_index - 2] = '\0';
 
          if (temp_var = find_function (name))
@@ -164,6 +191,9 @@ initialize_shell_variables (env, no_functions)
            }
          else
            report_error ("error importing function definition for `%s'", name);
+
+         if (name[char_index - 1] == ')' && name[char_index - 2] == '\0')
+           name[char_index - 2] = '(';
        }
 #if defined (ARRAY_VARS)
 #  if 0
@@ -185,7 +215,8 @@ initialize_shell_variables (env, no_functions)
          temp_var->attributes |= (att_exported | att_imported);
          array_needs_making = 1;
        }
-      free (name);
+
+      name[char_index] = '=';
     }
 
   /* If we got PWD from the environment, update our idea of the current
@@ -221,6 +252,16 @@ initialize_shell_variables (env, no_functions)
   temp_var = set_if_not ("TERM", "dumb");
   set_auto_export (temp_var);
 
+#if defined (qnx)
+  /* set node id -- don't import it from the environment */
+  {
+    char node_name[22];
+    qnx_nidtostr (getnid (), node_name, sizeof (node_name));
+    temp_var = bind_variable ("NODE", node_name);
+    set_auto_export (temp_var);
+  }
+#endif
+
   /* set up the prompts. */
   if (interactive_shell)
     {
@@ -250,9 +291,7 @@ initialize_shell_variables (env, no_functions)
     set_if_not ("MAILCHECK", "60");
 
   /* Do some things with shell level. */
-  temp_var = set_if_not ("SHLVL", "0");
-  set_auto_export (temp_var);
-  adjust_shell_level (1);
+  initialize_shell_level ();
 
   /* Make a variable $PPID, which holds the pid of the shell's parent.  */
   name = itos ((int) getppid ());
@@ -265,57 +304,16 @@ initialize_shell_variables (env, no_functions)
 
   /* Initialize the `getopts' stuff. */
   bind_variable ("OPTIND", "1");
-  sv_optind ("OPTIND");
+  getopts_reset (0);
   bind_variable ("OPTERR", "1");
-  sv_opterr ("OPTERR");
+  sh_opterr = 1;
+
+  if (login_shell == 1)
+    set_home_var ();
 
   /* Get the full pathname to THIS shell, and set the BASH variable
      to it. */
-  if ((login_shell == 1) && (*shell_name != '/'))
-    {
-      /* If HOME doesn't exist, set it. */
-      temp_var = set_if_not ("HOME", current_user.home_dir);
-      temp_var->attributes |= att_exported;
-
-      name = savestring (current_user.shell);
-    }
-  else if (*shell_name == '/')
-    name = savestring (shell_name);
-  else
-    {
-      char *tname;
-      int s;
-
-      tname = find_user_command (shell_name);
-
-      if (tname == 0)
-       {
-         /* Try the current directory.  If there is not an executable
-            there, just punt and use the login shell. */
-         s = file_status (shell_name);
-         if (s & FS_EXECABLE)
-           {
-             tname = make_absolute (shell_name, get_string_value ("PWD"));
-             if (*shell_name == '.')
-               {
-                 name = canonicalize_pathname (tname);
-                 if (name == 0)
-                   name = tname;
-                 else
-                   free (tname);
-               }
-            else
-               name = tname;
-           }
-         else
-           name = savestring (current_user.shell);
-       }
-      else
-       {
-         name = full_pathname (tname);
-         free (tname);
-       }
-    }
+  name = get_bash_name ();
   temp_var = bind_variable ("BASH", name);
   free (name);
 
@@ -323,8 +321,7 @@ initialize_shell_variables (env, no_functions)
      shell.  Note that the `tset' command looks at this variable
      to determine what style of commands to output; if it ends in "csh",
      then C-shell commands are output, else Bourne shell commands. */
-  temp_var = set_if_not ("SHELL", current_user.shell);
-  set_auto_export (temp_var);
+  set_shell_var ();
 
   /* Make a variable called BASH_VERSION which contains the version info. */
   bind_variable ("BASH_VERSION", shell_version_string ());
@@ -361,12 +358,14 @@ initialize_shell_variables (env, no_functions)
 
   /* Handle some "special" variables that we may have inherited from a
      parent shell. */
-
-  temp_var = find_variable ("IGNOREEOF");
-  if (!temp_var)
-    temp_var = find_variable ("ignoreeof");
-  if (temp_var && imported_p (temp_var))
-    sv_ignoreeof (temp_var->name);
+  if (interactive_shell)
+    {
+      temp_var = find_variable ("IGNOREEOF");
+      if (!temp_var)
+       temp_var = find_variable ("ignoreeof");
+      if (temp_var && imported_p (temp_var))
+       sv_ignoreeof (temp_var->name);
+    }
 
 #if defined (HISTORY)
   if (interactive_shell && remember_on_history)
@@ -383,25 +382,163 @@ initialize_shell_variables (env, no_functions)
   initialize_dynamic_variables ();
 }
 
+/* Set $HOME to the information in the password file if we didn't get
+   it from the environment. */
+static void
+set_home_var ()
+{
+  SHELL_VAR *temp_var;
+
+  temp_var = find_variable ("HOME");
+  if (temp_var == 0)
+    {
+      if (current_user.home_dir == 0)
+       get_current_user_info ();
+      temp_var = bind_variable ("HOME", current_user.home_dir);
+    }
+  temp_var->attributes |= att_exported;
+}
+
+/* Set $SHELL to the user's login shell if it is not already set.  Call
+   get_current_user_info if we haven't already fetched the shell. */
+static void
+set_shell_var ()
+{
+  SHELL_VAR *temp_var;
+
+  temp_var = find_variable ("SHELL");
+  if (temp_var == 0)
+    {
+      if (current_user.shell == 0)
+       get_current_user_info ();
+      temp_var = bind_variable ("SHELL", current_user.shell);
+    }
+  temp_var->attributes |= att_exported;
+}
+
+static char *
+get_bash_name ()
+{
+  char *name;
+
+  if ((login_shell == 1) && (*shell_name != '/'))
+    {
+      if (current_user.shell == 0)
+        get_current_user_info ();
+      name = savestring (current_user.shell);
+    }
+  else if (*shell_name == '/')
+    name = savestring (shell_name);
+  else if (shell_name[0] == '.' && shell_name[1] == '/')
+    {
+      /* Fast path for common case. */
+      char *cdir;
+      int len;
+
+      cdir = get_string_value ("PWD");
+      len = strlen (cdir);
+      name = xmalloc (len + strlen (shell_name) + 1);
+      strcpy (name, cdir);
+      strcpy (name + len, shell_name + 1);
+    }
+  else
+    {
+      char *tname;
+      int s;
+
+      tname = find_user_command (shell_name);
+
+      if (tname == 0)
+       {
+         /* Try the current directory.  If there is not an executable
+            there, just punt and use the login shell. */
+         s = file_status (shell_name);
+         if (s & FS_EXECABLE)
+           {
+             tname = make_absolute (shell_name, get_string_value ("PWD"));
+             if (*shell_name == '.')
+               {
+                 name = canonicalize_pathname (tname);
+                 if (name == 0)
+                   name = tname;
+                 else
+                   free (tname);
+               }
+            else
+               name = tname;
+           }
+         else
+           {
+             if (current_user.shell == 0)
+               get_current_user_info ();
+             name = savestring (current_user.shell);
+           }
+       }
+      else
+       {
+         name = full_pathname (tname);
+         free (tname);
+       }
+    }
+
+  return (name);
+}
+
 void
 adjust_shell_level (change)
      int change;
 {
-  char *new_level, *old_SHLVL;
+  char new_level[5], *old_SHLVL;
   int old_level;
+  SHELL_VAR *temp_var;
 
   old_SHLVL = get_string_value ("SHLVL");
-  if (old_SHLVL)
-    old_level = atoi (old_SHLVL);
-  else
-    old_level = 0;
+  old_level = old_SHLVL ? atoi (old_SHLVL) : 0;
 
   shell_level = old_level + change;
   if (shell_level < 0)
     shell_level = 0;
-  new_level = itos (shell_level);
-  bind_variable ("SHLVL", new_level);
-  free (new_level);
+  else if (shell_level > 1000)
+    {
+      internal_error ("warning: shell level (%d) too high, resetting to 1", shell_level);
+      shell_level = 1;
+    }
+
+  /* We don't need the full generality of itos here. */
+  if (shell_level < 10)
+    {
+      new_level[0] = shell_level + '0';
+      new_level[1] = '\0';
+    }
+  else if (shell_level < 100)
+    {
+      new_level[0] = (shell_level / 10) + '0';
+      new_level[1] = (shell_level % 10) + '0';
+      new_level[2] = '\0';
+    }
+  else if (shell_level < 1000)
+    {
+      new_level[0] = (shell_level / 100) + '0';
+      old_level = shell_level % 100;
+      new_level[1] = (old_level / 10) + '0';
+      new_level[2] = (old_level % 10) + '0';
+      new_level[3] = '\0';
+    }
+
+  temp_var = bind_variable ("SHLVL", new_level);
+  set_auto_export (temp_var);
+}
+
+static void
+initialize_shell_level ()
+{
+#if 0
+  SHELL_VAR *temp_var;
+
+  temp_var = set_if_not ("SHLVL", "0");
+  set_auto_export (temp_var);
+#endif
+  adjust_shell_level (1);
 }
 
 static void
@@ -495,9 +632,8 @@ set_if_not (name, value)
 }
 
 /* Map FUNCTION over the variables in VARIABLES.  Return an array of the
-   variables that satisfy FUNCTION.  Satisfy means that FUNCTION returns
-   a non-zero value for.  A NULL value for FUNCTION means to use all
-   variables. */
+   variables for which FUNCTION returns a non-zero value.  A NULL value
+   for FUNCTION means to use all variables. */
 SHELL_VAR **
 map_over (function, var_hash_table)
      Function *function;
@@ -505,10 +641,11 @@ map_over (function, var_hash_table)
 {
   register int i;
   register BUCKET_CONTENTS *tlist;
-  SHELL_VAR *var, **list = (SHELL_VAR **)NULL;
-  int list_index = 0, list_size = 0;
+  SHELL_VAR *var, **list;
+  int list_index, list_size;
 
-  for (i = 0; i < var_hash_table->nbuckets; i++)
+  list = (SHELL_VAR **)NULL;
+  for (i = list_index = list_size = 0; i < var_hash_table->nbuckets; i++)
     {
       tlist = get_hash_bucket (i, var_hash_table);
 
@@ -558,7 +695,7 @@ all_vars (table)
   SHELL_VAR **list;
 
   list = map_over ((Function *)NULL, table);
-  if (list && posixly_correct)
+  if (list /* && posixly_correct */)
     sort_variables (list);
   return (list);
 }
@@ -864,6 +1001,7 @@ get_dirstack (self)
   l = get_directory_stack ();
   a = word_list_to_array (l);
   dispose_array (array_cell (self));
+  dispose_words (l);
   self->value = (char *)a;
   return self;
 }
@@ -879,6 +1017,29 @@ assign_dirstack (self, ind, value)
 }
 #endif /* PUSHD AND POPD && ARRAY_VARS */
 
+#if defined (ARRAY_VARS)
+/* We don't want to initialize the group set with a call to getgroups()
+   unless we're asked to, but we only want to do it once. */
+static SHELL_VAR *
+get_groupset (self)
+     SHELL_VAR *self;
+{
+  register int i;
+  int ng;
+  ARRAY *a;
+  static char **group_set = (char **)NULL;
+
+  if (group_set == 0)
+    {
+      group_set = get_group_list (&ng);
+      a = array_cell (self);
+      for (i = 0; i < ng; i++)
+       array_add_element (a, i, group_set[i]);
+    }
+  return (self);
+}
+#endif /* ARRAY_VARS */
+  
 static void
 initialize_dynamic_variables ()
 {
@@ -907,6 +1068,13 @@ initialize_dynamic_variables ()
   v->dynamic_value = get_dirstack;
   v->assign_func = assign_dirstack;
 #endif /* PUSHD_AND_POPD && ARRAY_VARS */
+
+#if defined (ARRAY_VARS)
+  v = make_new_array_variable ("GROUPS");
+  v->dynamic_value = get_groupset;
+  v->assign_func = (DYNAMIC_FUNC *)NULL;
+  v->attributes |= att_readonly;
+#endif
 }
 
 /* How to get a pointer to the shell variable or function named NAME.
@@ -975,7 +1143,9 @@ char *
 get_string_value (var_name)
      char *var_name;
 {
-  SHELL_VAR *var = find_variable (var_name);
+  SHELL_VAR *var;
+
+  var = find_variable (var_name);
 
   if (!var)
     return (char *)NULL;
@@ -1012,10 +1182,8 @@ make_local_variable (name)
 
   /* If a variable does not already exist with this name, then
      just make a new one. */
-  if (!old_var)
-    {
-      new_var = bind_variable (name, "");
-    }
+  if (old_var == 0)
+    new_var = bind_variable (name, "");
   else
     {
       new_var = (SHELL_VAR *)xmalloc (sizeof (SHELL_VAR));
@@ -1123,6 +1291,7 @@ make_variable_value (var, value)
 {
   char *retval;
   long lval;
+  int expok;
 
   /* If this variable has had its type set to integer (via `declare -i'),
      then do expression evaluation on it and store the result.  The
@@ -1131,7 +1300,9 @@ make_variable_value (var, value)
      evaluation done. */
   if (integer_p (var))
     {
-      lval = evalexp (value);
+      lval = evalexp (value, &expok);
+      if (expok == 0)
+       jump_to_top_level (DISCARD);
       retval = itos (lval);
     }
   else if (value)
@@ -1191,7 +1362,10 @@ bind_variable (name, value)
         `read x' or something of that nature, silently convert it to
         x[0]=b or `read x[0]'. */
       if (array_p (entry))
-        array_add_element (array_cell (entry), 0, newval);
+       {
+         array_add_element (array_cell (entry), 0, newval);
+         free (newval);
+       }
       else
        {
          FREE (entry->value);
@@ -1281,6 +1455,11 @@ assign_array_from_string (name, value)
   var = find_variable (name);
   if (var == 0)
     var = make_new_array_variable (name);
+  else if (readonly_p (var))
+    {
+      report_error ("%s: readonly variable", name);
+      return ((SHELL_VAR *)NULL);
+    }
   else if (array_p (var) == 0)
     var = convert_var_to_array (var);
 
@@ -1446,7 +1625,7 @@ unbind_array_element (var, sub)
   ind = array_expand_index (sub, len+1);
   if (ind < 0)
     {
-      builtin_error ("[%s: bad array subscript", sub);
+      builtin_error ("[%s]: bad array subscript", sub);
       return -1;
     }
   ae = array_delete_element (array_cell (var), ind);
@@ -1491,13 +1670,13 @@ makunbound (name, hash_list)
      char *name;
      HASH_TABLE *hash_list;
 {
-  BUCKET_CONTENTS *elt;
+  BUCKET_CONTENTS *elt, *new_elt;
   SHELL_VAR *old_var, *new_var;
   char *t;
 
   elt = remove_hash_item (name, hash_list);
 
-  if (!elt)
+  if (elt == 0)
     return (-1);
 
   old_var = (SHELL_VAR *)elt->data;
@@ -1515,17 +1694,17 @@ makunbound (name, hash_list)
   if (old_var && local_p (old_var) && variable_context == old_var->context)
     {
       old_var->attributes |= att_invisible;
-      elt = add_hash_item (savestring (old_var->name), hash_list);
-      elt->data = (char *)old_var;
+      new_elt = add_hash_item (savestring (old_var->name), hash_list);
+      new_elt->data = (char *)old_var;
       stupidly_hack_special_variables (old_var->name);
+      free (elt->key);
+      free (elt);
       return (0);
     }
 
   if (new_var)
     {
       /* Has to be a variable, functions don't have previous contexts. */
-      BUCKET_CONTENTS *new_elt;
-
       new_elt = add_hash_item (savestring (new_var->name), hash_list);
       new_elt->data = (char *)new_var;
 
@@ -1547,14 +1726,16 @@ makunbound (name, hash_list)
   return (0);
 }
 
+#ifdef INCLUDE_UNUSED
 /* Remove the variable with NAME if it is a local variable in the
    current context. */
 int
 kill_local_variable (name)
      char *name;
 {
-  SHELL_VAR *temp = find_variable (name);
+  SHELL_VAR *temp;
 
+  temp = find_variable (name);
   if (temp && temp->context == variable_context)
     {
       makunbound (name, shell_variables);
@@ -1562,6 +1743,7 @@ kill_local_variable (name)
     }
   return (-1);
 }
+#endif
 
 /* Get rid of all of the variables in the current context. */
 int
@@ -1687,6 +1869,7 @@ bind_function (name, value)
   return (entry);
 }
 
+#ifdef INCLUDE_UNUSED
 /* Copy VAR to a new data structure and return that structure. */
 SHELL_VAR *
 copy_variable (var)
@@ -1722,6 +1905,7 @@ copy_variable (var)
     }
   return (copy);
 }
+#endif
 
 #define FIND_OR_MAKE_VARIABLE(name, entry) \
   do \
@@ -1753,8 +1937,9 @@ void
 set_func_read_only (name)
      char *name;
 {
-  SHELL_VAR *entry = find_function (name);
+  SHELL_VAR *entry;
 
+  entry = find_function (name);
   if (entry)
     entry->attributes |= att_readonly;
 }
@@ -1859,7 +2044,7 @@ _visible_names (table)
 
   list = map_over (visible_var, table);
 
-  if (list && posixly_correct)
+  if (list /* && posixly_correct */)
     sort_variables (list);
 
   return (list);
@@ -1898,10 +2083,9 @@ make_var_array (hashed_vars)
   char **list, *value;
   SHELL_VAR **vars;
 
-  list = (char **)NULL;
   vars = map_over (visible_and_exported, hashed_vars);
 
-  if (!vars)
+  if (vars == 0)
     return (char **)NULL;
 
   list = (char **)xmalloc ((1 + array_len ((char **)vars)) * sizeof (char *));
@@ -1970,6 +2154,7 @@ assign_in_env (string)
       if (var && readonly_p (var))
        {
          report_error ("%s: readonly variable", name);
+         free (name);
          return (0);
        }
       temp = name + offset + 1;
@@ -2047,7 +2232,7 @@ find_name_in_env_array (name, array)
          SHELL_VAR *temp;
          char *w;
 
-         temp = new_shell_variable (name);
+         temp = new_shell_variable (name);     /* XXX memory leak here */
          w = array[i] + l + 1;
 
          temp->value = *w ? savestring (w) : (char *)NULL;
@@ -2137,7 +2322,7 @@ merge_env_array (env_array)
 {
   register int i, l;
   SHELL_VAR *temp;
-  char *w, *name;
+  char *val, *name;
 
   if (env_array == 0)
     return;
@@ -2146,9 +2331,9 @@ merge_env_array (env_array)
     {
       l = assignment (env_array[i]);
       name = env_array[i];
-      w = env_array[i] + l + 1;
+      val = env_array[i] + l + 1;
       name[l] = '\0';
-      temp = bind_variable (name, w);
+      temp = bind_variable (name, val);
       name[l] = '=';
     }
 }
@@ -2165,42 +2350,54 @@ merge_builtin_env ()
   merge_env_array (builtin_env);
 }
 
+/* Add ENVSTR to the end of the exported environment, EXPORT_ENV. */
+#define add_to_export_env(envstr,do_alloc) \
+do \
+  { \
+    if (export_env_index >= (export_env_size - 1)) \
+      { \
+       export_env_size += 16; \
+       export_env = (char **)xrealloc (export_env, export_env_size * sizeof (char *)); \
+      } \
+    export_env[export_env_index++] = (do_alloc) ? savestring (envstr) : envstr; \
+    export_env[export_env_index] = (char *)NULL; \
+  } while (0)
+
 #define ISFUNC(s, o) ((s[o + 1] == '(')  && (s[o + 2] == ')'))
 
-/* Add ASSIGN to ARRAY, or supercede a previous assignment in the
-   array with the same left-hand side.  Return the new array. */
+/* Add ASSIGN to EXPORT_ENV, or supercede a previous assignment in the
+   array with the same left-hand side.  Return the new EXPORT_ENV. */
 char **
-add_or_supercede (assign, array)
+add_or_supercede_exported_var (assign, do_alloc)
      char *assign;
-     register char **array;
+     int do_alloc;
 {
   register int i;
-  int equal_offset = assignment (assign);
+  int equal_offset;
 
-  if (!equal_offset)
-    return (array);
+  equal_offset = assignment (assign);
+  if (equal_offset == 0)
+    return (export_env);
 
   /* If this is a function, then only supercede the function definition.
      We do this by including the `=(' in the comparison.  */
   if (assign[equal_offset + 1] == '(')
     equal_offset++;
 
-  for (i = 0; array && array[i]; i++)
+  for (i = 0; i < export_env_index; i++)
     {
-      if (STREQN (assign, array[i], equal_offset + 1))
+      if (STREQN (assign, export_env[i], equal_offset + 1))
        {
-         free (array[i]);
-         array[i] = savestring (assign);
-         return (array);
+         free (export_env[i]);
+         export_env[i] = do_alloc ? savestring (assign) : assign;
+         return (export_env);
        }
     }
-  array = (char **)xrealloc (array, ((2 + i) * sizeof (char *)));
-  array[i++] = savestring (assign);
-  array[i] = (char *)NULL;
-  return (array);
+  add_to_export_env (assign, do_alloc);
+  return (export_env);
 }
 
-/* Make the environment array for the command about to be executed.  If the
+/* Make the environment array for the command about to be executed, if the
    array needs making.  Otherwise, do nothing.  If a shell action could
    change the array that commands receive for their environment, then the
    code should `array_needs_making++'. */
@@ -2209,32 +2406,49 @@ maybe_make_export_env ()
 {
   register int i;
   register char **temp_array;
+  int new_size;
 
   if (array_needs_making)
     {
       if (export_env)
-       free_array (export_env);
-
-      export_env = (char **)xmalloc (sizeof (char *));
-      export_env[0] = (char *)NULL;
+       free_array_members (export_env);
+
+      /* Make a guess based on how many shell variables and functions we
+        have.  Since there will always be array variables, and array
+        variables are not (yet) exported, this will always be big enough
+        for the exported variables and functions, without any temporary
+        or function environments. */
+      new_size = shell_variables->nentries + shell_functions->nentries + 1;
+      if (new_size > export_env_size)
+       {
+         export_env_size = new_size;
+          export_env = (char **)xrealloc (export_env, export_env_size * sizeof (char *));
+       }
+      export_env[export_env_index = 0] = (char *)NULL;
 
       temp_array = make_var_array (shell_variables);
-      for (i = 0; temp_array && temp_array[i]; i++)
-       export_env = add_or_supercede (temp_array[i], export_env);
-      free_array (temp_array);
+      if (temp_array)
+       {
+         for (i = 0; temp_array[i]; i++)
+           add_to_export_env (temp_array[i], 0);
+         free (temp_array);
+       }
 
       temp_array = make_var_array (shell_functions);
-      for (i = 0; temp_array && temp_array[i]; i++)
-       export_env = add_or_supercede (temp_array[i], export_env);
-      free_array (temp_array);
+      if (temp_array)
+       {
+         for (i = 0; temp_array[i]; i++)
+           add_to_export_env (temp_array[i], 0);
+         free (temp_array);
+       }
 
       if (function_env)
        for (i = 0; function_env[i]; i++)
-         export_env = add_or_supercede (function_env[i], export_env);
+         export_env = add_or_supercede_exported_var (function_env[i], 1);
 
       if (temporary_env)
        for (i = 0; temporary_env[i]; i++)
-         export_env = add_or_supercede (temporary_env[i], export_env);
+         export_env = add_or_supercede_exported_var (temporary_env[i], 1);
 
 #if 0
       /* If we changed the array, then sort it alphabetically. */
@@ -2259,8 +2473,7 @@ put_command_name_into_env (command_name)
   dummy[0] = '_';
   dummy[1] = '=';
   strcpy (dummy + 2, command_name);
-  export_env = add_or_supercede (dummy, export_env);
-  free (dummy);
+  export_env = add_or_supercede_exported_var (dummy, 0);
 }
 
 void
@@ -2285,8 +2498,7 @@ put_gnu_argv_flags_into_env (pid, flags_string)
 
   free (pbuf);
 
-  export_env = add_or_supercede (dummy, export_env);
-  free (dummy);
+  export_env = add_or_supercede_exported_var (dummy, 0);
 }
 
 /* Return a string denoting what our indirection level is. */
index cdeed92..b142c3c 100644 (file)
@@ -83,7 +83,7 @@ extern SHELL_VAR **all_visible_variables __P((void));
 extern SHELL_VAR **all_visible_functions __P((void));
 
 extern char **make_var_array __P((HASH_TABLE *));
-extern char **add_or_supercede __P((char *, char **));
+extern char **add_or_supercede_exported_var __P((char *, int));
 
 extern char *get_string_value __P((char *));
 extern char *make_variable_value __P((SHELL_VAR *, char *));
index 743d4b3..4c962a1 100644 (file)
--- a/xmalloc.c
+++ b/xmalloc.c
@@ -23,7 +23,7 @@
 #include <config.h>
 #endif
 
-#include <sys/types.h>
+#include "bashtypes.h"
 #include <stdio.h>
 
 #if defined (HAVE_UNISTD_H)
diff --git a/y.tab.c b/y.tab.c
index 406b32e..ad707d7 100644 (file)
--- a/y.tab.c
+++ b/y.tab.c
@@ -124,15 +124,20 @@ static char *localeexpand ();
 static int reserved_word_acceptable ();
 static int read_token ();
 static int yylex ();
+static int parse_arith_cmd ();
 static int read_token_word ();
 static void discard_parser_constructs ();
 
 static void report_syntax_error ();
 static void handle_eof_input_unit ();
 static void prompt_again ();
+#if 0
 static void reset_readline_prompt ();
+#endif
 static void print_prompt ();
 
+extern int yyerror ();
+
 /* Default prompt strings */
 char *primary_prompt = PPROMPT;
 char *secondary_prompt = SPROMPT;
@@ -184,7 +189,7 @@ static int function_bstart;
 
 static REDIRECTEE redir;
 
-#line 166 "./parse.y"
+#line 171 "./parse.y"
 typedef union {
   WORD_DESC *word;             /* the word that we read. */
   int number;                  /* the number that we read. */
@@ -276,11 +281,11 @@ static const short yyrhs[] = {    73,
      0,    55,     0,    57,     0,    12,    68,    14,    68,    15,
      0,    13,    68,    14,    68,    15,     0,    56,     0,    60,
      0,    59,     0,    61,     0,    58,     0,    10,    21,    72,
-    14,    67,    15,     0,    10,    21,    72,    43,    67,    44,
-     0,    10,    21,    36,    72,    14,    67,    15,     0,    10,
-    21,    36,    72,    43,    67,    44,     0,    10,    21,    72,
-    17,    48,    71,    72,    14,    67,    15,     0,    10,    21,
-    72,    17,    48,    71,    72,    43,    67,    44,     0,    11,
+    14,    68,    15,     0,    10,    21,    72,    43,    68,    44,
+     0,    10,    21,    36,    72,    14,    68,    15,     0,    10,
+    21,    36,    72,    43,    68,    44,     0,    10,    21,    72,
+    17,    48,    71,    72,    14,    68,    15,     0,    10,    21,
+    72,    17,    48,    71,    72,    43,    68,    44,     0,    11,
     21,    72,    14,    67,    15,     0,    11,    21,    72,    43,
     67,    44,     0,    11,    21,    36,    72,    14,    67,    15,
      0,    11,    21,    36,    72,    43,    67,    44,     0,    11,
@@ -317,19 +322,19 @@ static const short yyrhs[] = {    73,
 
 #if YYDEBUG != 0
 static const short yyrline[] = { 0,
-   209,   218,   225,   240,   250,   252,   256,   261,   266,   271,
-   276,   281,   286,   292,   298,   303,   308,   313,   318,   323,
-   328,   333,   338,   345,   352,   357,   362,   367,   372,   377,
-   382,   387,   392,   399,   401,   403,   407,   411,   422,   424,
-   428,   430,   432,   461,   463,   465,   467,   469,   471,   473,
-   475,   477,   481,   483,   485,   487,   489,   491,   495,   499,
-   503,   507,   511,   515,   521,   523,   525,   529,   533,   536,
-   540,   544,   546,   548,   553,   557,   559,   561,   565,   566,
-   570,   572,   574,   576,   580,   581,   585,   587,   596,   604,
-   605,   611,   612,   619,   623,   625,   627,   634,   636,   638,
-   642,   643,   644,   647,   648,   657,   663,   672,   680,   682,
-   684,   691,   694,   698,   700,   705,   710,   715,   722,   725,
-   729,   731
+   214,   223,   230,   245,   255,   257,   261,   266,   271,   276,
+   281,   286,   291,   297,   303,   308,   313,   318,   323,   328,
+   333,   338,   343,   350,   357,   362,   367,   372,   377,   382,
+   387,   392,   397,   404,   406,   408,   412,   416,   427,   429,
+   433,   435,   437,   466,   468,   470,   472,   474,   476,   478,
+   480,   482,   486,   488,   490,   492,   494,   496,   500,   504,
+   508,   512,   516,   520,   526,   528,   530,   534,   538,   541,
+   545,   549,   551,   553,   558,   562,   564,   566,   570,   571,
+   575,   577,   579,   581,   585,   586,   590,   592,   601,   609,
+   610,   616,   617,   624,   628,   630,   632,   639,   641,   643,
+   647,   648,   649,   652,   653,   662,   668,   677,   685,   687,
+   689,   696,   699,   703,   705,   710,   715,   720,   727,   730,
+   734,   736
 };
 #endif
 
@@ -415,161 +420,157 @@ static const short yydefact[] = {     0,
 static const short yydefgoto[] = {   261,
    178,    28,    29,    88,    30,    31,    32,    33,    34,    35,
     36,    37,    38,    39,   164,   170,   171,   172,   204,    46,
-    47,    99,   100,   212,    83,    40,   132,   101,    43,    44
+    47,    99,   100,   212,    48,    40,   132,   101,    43,    44
 };
 
-static const short yypact[] = {   246,
-   -19,-32768,     8,    25,    29,-32768,-32768,    33,   354,     4,
-    34,-32768,   499,    46,    51,    32,    38,    56,    70,    72,
-    90,-32768,-32768,    97,   101,-32768,-32768,-32768,-32768,   161,
--32768,   483,-32768,-32768,-32768,-32768,-32768,-32768,-32768,     6,
-   139,-32768,    84,   390,-32768,-32768,   120,   282,-32768,    89,
-    94,   112,   117,    87,    84,   462,-32768,    96,   123,   127,
-    52,    55,   128,   129,   133,   137,   140,-32768,-32768,-32768,
+static const short yypact[] = {   240,
+   -25,-32768,    -4,    41,    44,-32768,-32768,    49,   348,     0,
+   -31,-32768,   476,    53,    55,     3,    29,    61,    63,    66,
+    71,-32768,-32768,    76,    79,-32768,-32768,-32768,-32768,   165,
+-32768,   120,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   -12,
+    89,-32768,    12,   384,-32768,-32768,    99,   276,-32768,    93,
+   103,    98,   143,   126,    12,   456,-32768,   127,   151,   153,
+    35,    43,   154,   155,   159,   160,   161,-32768,-32768,-32768,
 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
--32768,   121,   282,   122,-32768,-32768,-32768,   483,-32768,-32768,
--32768,   318,   318,-32768,   462,    84,-32768,-32768,-32768,    92,
--32768,   -10,-32768,     2,-32768,    14,-32768,-32768,   130,   -28,
-    84,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
--32768,-32768,-32768,-32768,-32768,-32768,    92,-32768,-32768,   282,
-   282,    10,    10,   426,    84,    93,-32768,-32768,-32768,-32768,
--32768,-32768,    23,-32768,   148,-32768,    26,-32768,   148,-32768,
-   158,   164,-32768,-32768,   -28,-32768,-32768,   318,   318,    84,
--32768,-32768,-32768,   178,   282,   282,   282,   282,   282,   177,
-   166,-32768,    -7,-32768,-32768,   176,-32768,    83,   153,-32768,
--32768,   183,    83,   155,-32768,-32768,   -28,-32768,   193,   199,
--32768,-32768,-32768,    57,    57,    57,-32768,-32768,   174,    -1,
--32768,-32768,   184,   -29,   191,   163,-32768,-32768,-32768,-32768,
--32768,-32768,-32768,   194,   167,-32768,-32768,-32768,-32768,-32768,
--32768,-32768,-32768,-32768,-32768,-32768,   -13,   187,-32768,-32768,
--32768,    27,-32768,-32768,    28,   103,   282,   282,   282,-32768,
--32768,-32768,   282,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-   282,   197,   169,   201,   170,-32768,-32768,-32768,-32768,-32768,
-   217,   218,-32768
+-32768,   140,   276,   137,-32768,-32768,-32768,   120,-32768,-32768,
+-32768,   312,   312,-32768,   456,    12,-32768,-32768,-32768,    86,
+-32768,    38,-32768,    -1,-32768,    16,-32768,-32768,   157,   -28,
+    12,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
+-32768,-32768,-32768,-32768,-32768,-32768,    86,-32768,-32768,   276,
+   276,    15,    15,   420,    12,   128,-32768,-32768,-32768,-32768,
+-32768,-32768,     4,-32768,   164,-32768,    17,-32768,   164,-32768,
+   174,   189,-32768,-32768,   -28,-32768,-32768,   312,   312,    12,
+-32768,-32768,-32768,   201,   276,   276,   276,   276,   276,   200,
+   180,-32768,    -2,-32768,-32768,   196,-32768,    57,   168,-32768,
+-32768,   198,    57,   170,-32768,-32768,   -28,-32768,   209,   213,
+-32768,-32768,-32768,   142,   142,   142,-32768,-32768,   190,     1,
+-32768,-32768,   205,    40,   204,   177,-32768,-32768,-32768,-32768,
+-32768,-32768,-32768,   207,   183,-32768,-32768,-32768,-32768,-32768,
+-32768,-32768,-32768,-32768,-32768,-32768,    50,   210,-32768,-32768,
+-32768,    20,-32768,-32768,    30,   139,   276,   276,   276,-32768,
+-32768,-32768,   276,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
+   276,   215,   188,   218,   191,-32768,-32768,-32768,-32768,-32768,
+   236,   237,-32768
 };
 
 static const short yypgoto[] = {-32768,
-    74,   -26,   195,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
--32768,-32768,-32768,   -97,   -12,-32768,    58,-32768,    30,    -3,
-     5,-32768,   -82,    45,    -2,-32768,     3,    22,    12,   220
+    91,   -27,   214,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
+-32768,-32768,-32768,  -107,     9,-32768,    74,-32768,    46,   -18,
+    -6,-32768,   -60,    64,   -22,-32768,    11,     6,    -7,   245
 };
 
 
-#define        YYLAST          540
-
-
-static const short yytable[] = {    48,
-   127,   201,    41,    48,    48,    87,   142,   226,    98,   228,
-    52,    53,   154,   202,    26,   144,   229,    45,   145,   202,
-    55,    42,    82,    57,    48,   228,    98,   148,    49,    98,
-   149,    84,   240,    90,    91,    98,   174,   203,    98,   180,
-   244,   246,    89,   203,   146,    50,   102,   104,   106,    51,
-    98,   110,    70,    54,    71,    96,   150,   188,    73,    98,
-    74,   129,    98,    98,    98,   175,    68,   111,   181,   245,
-   247,    69,   115,    72,   116,   118,    76,   119,    58,    75,
-   137,   138,   192,   193,   194,   195,   196,   130,   131,   219,
-    77,   134,    78,   117,    48,   133,   120,   161,   162,   163,
-   143,   136,   147,   208,    48,    48,   135,   248,   162,   155,
-    79,   151,   152,    42,    42,   137,   138,    80,   209,   210,
-   211,    81,    94,    97,   103,   107,   139,   140,   141,   105,
-   108,   109,   156,   157,   165,   166,   167,   168,   169,   173,
-   176,   112,   179,   113,   182,   160,   184,   114,   121,   122,
-   187,    42,    42,   123,   194,   195,   196,   124,    48,    48,
-   125,   133,    90,    91,   126,   189,   190,   128,   177,   200,
-   205,   206,   185,    92,    93,   153,   214,   215,   186,    42,
-    42,    85,    12,    13,   191,   197,    14,    15,    16,    17,
-   207,    18,    19,    20,    21,   198,   213,   216,   218,   220,
-    24,    25,   221,   225,   202,   230,   231,   241,   233,   232,
-   234,   257,   258,   260,   235,   259,   262,   263,    48,   237,
-   238,   239,   183,   249,    86,   236,   243,   217,    56,   199,
-     0,     0,   227,   242,     0,     0,     0,   251,     0,     0,
-   252,   253,   254,   255,   250,    48,     1,     0,     2,     0,
-     0,     0,   256,     3,     0,     4,     5,     6,     7,     0,
+#define        YYLAST          517
+
+
+static const short yytable[] = {    52,
+    53,    55,   154,    83,    87,    42,   201,    82,    98,   226,
+    41,    45,   144,    58,    26,   145,    49,   174,   202,    57,
+    84,   202,   127,    70,    89,    71,   102,   104,   106,   148,
+   180,   110,   149,   244,    98,    98,    96,    98,    90,    91,
+    98,   146,   203,   246,    72,   203,   175,   188,   111,    73,
+    94,    74,    98,    98,   142,   115,    98,   116,   150,   181,
+   129,    50,   245,   118,    51,   119,    98,   130,   131,    54,
+    75,   134,   247,    68,    98,    69,   117,   208,   228,   219,
+   143,    76,   147,    77,   120,   229,    78,   135,   228,   155,
+   136,    79,   209,   210,   211,   240,    80,    42,    42,    81,
+   151,   152,    97,   133,   192,   193,   194,   195,   196,   137,
+   138,   107,    90,    91,   165,   166,   167,   168,   169,   173,
+   139,   140,   141,    92,    93,    83,   160,    83,   103,   182,
+   187,   184,   161,   162,   163,    42,    42,   176,   105,   179,
+   156,   157,    13,   248,   162,    14,    15,    16,    17,   200,
+    18,    19,    20,    21,   189,   190,   108,    83,    83,    24,
+    25,   214,   215,    42,    42,   137,   138,   205,   206,   133,
+   109,   113,   112,   114,   121,   122,   194,   195,   196,   123,
+   124,   125,   128,   126,   177,    85,    12,    13,   185,   232,
+    14,    15,    16,    17,   235,    18,    19,    20,    21,   237,
+   238,   239,   153,   186,    24,    25,   243,   191,   197,   198,
+   207,   213,   216,   218,   236,   220,   221,   251,   230,   225,
+   231,   233,   242,    83,    83,   202,   234,   254,   255,   257,
+   241,   258,   259,   250,   260,   262,   263,   252,   253,   183,
+     1,   256,     2,    86,   249,   199,   217,     3,   227,     4,
+     5,     6,     7,    56,     0,     8,     0,     9,    10,     0,
+    11,    12,    13,     0,     0,    14,    15,    16,    17,     0,
+    18,    19,    20,    21,     0,     0,    22,    23,     2,    24,
+    25,     0,    26,     3,    27,     4,     5,     6,     7,     0,
      0,     8,     0,     9,    10,     0,    11,    12,    13,     0,
      0,    14,    15,    16,    17,     0,    18,    19,    20,    21,
-     0,     0,    22,    23,     2,    24,    25,     0,    26,     3,
+     0,     0,    98,     0,     2,    24,    25,     0,    26,     3,
     27,     4,     5,     6,     7,     0,     0,     8,     0,     9,
     10,     0,    11,    12,    13,     0,     0,    14,    15,    16,
-    17,     0,    18,    19,    20,    21,     0,     0,    98,     0,
+    17,     0,    18,    19,    20,    21,     0,     0,     0,     0,
      2,    24,    25,     0,    26,     3,    27,     4,     5,     6,
-     7,     0,     0,     8,     0,     9,    10,     0,    11,    12,
+     7,     0,     0,     8,     0,     0,    10,     0,    11,    12,
     13,     0,     0,    14,    15,    16,    17,     0,    18,    19,
     20,    21,     0,     0,     0,     0,     2,    24,    25,     0,
     26,     3,    27,     4,     5,     6,     7,     0,     0,     8,
-     0,     0,    10,     0,    11,    12,    13,     0,     0,    14,
+     0,    95,     0,     0,    11,    12,    13,     0,     0,    14,
     15,    16,    17,     0,    18,    19,    20,    21,     0,     0,
      0,     0,     2,    24,    25,     0,    26,     3,    27,     4,
-     5,     6,     7,     0,     0,     8,     0,    95,     0,     0,
+     5,     6,     7,     0,     0,     8,     0,     0,     0,     0,
     11,    12,    13,     0,     0,    14,    15,    16,    17,     0,
-    18,    19,    20,    21,     0,     0,     0,     0,     2,    24,
+    18,    19,    20,    21,     0,     0,    98,     0,     2,    24,
     25,     0,    26,     3,    27,     4,     5,     6,     7,     0,
      0,     8,     0,     0,     0,     0,    11,    12,    13,     0,
      0,    14,    15,    16,    17,     0,    18,    19,    20,    21,
-     0,     0,    98,     0,     2,    24,    25,     0,    26,     3,
-    27,     4,     5,     6,     7,     0,     0,     8,     0,     0,
-     0,     0,    11,    12,    13,     0,     0,    14,    15,    16,
-    17,     0,    18,    19,    20,    21,     0,     0,     0,     0,
-     0,    24,    25,     0,    26,    13,    27,     0,    14,    15,
-    16,    17,     0,    18,    19,    20,    21,     0,     0,     0,
-     0,     0,    24,    25,    59,    60,    61,    62,     0,    63,
-     0,    64,    65,     0,     0,     0,     0,     0,    66,    67
+     0,     0,     0,     0,     0,    24,    25,     0,    26,     0,
+    27,    59,    60,    61,    62,     0,    63,     0,    64,    65,
+     0,     0,     0,     0,     0,    66,    67
 };
 
-static const short yycheck[] = {     2,
-    83,     9,     0,     6,     7,    32,    17,     9,    37,    39,
-     6,     7,   110,    21,    43,    14,    46,    37,    17,    21,
-     9,     0,    26,    20,    27,    39,    37,    14,    21,    37,
-    17,    27,    46,    24,    25,    37,    14,    45,    37,    14,
-    14,    14,    37,    45,    43,    21,    49,    50,    51,    21,
-    37,    54,    21,    21,    23,    44,    43,   155,    21,    37,
-    23,    88,    37,    37,    37,    43,    21,    56,    43,    43,
-    43,    21,    21,    42,    23,    21,    21,    23,    45,    42,
-    24,    25,   165,   166,   167,   168,   169,    90,    91,   187,
-    21,    94,    21,    42,    97,    93,    42,     5,     6,     7,
-   103,    97,   105,    21,   107,   108,    95,     5,     6,   112,
-    21,   107,   108,    92,    93,    24,    25,    21,    36,    37,
-    38,    21,    39,     4,    36,    14,    35,    36,    37,    36,
-    14,    45,   130,   131,   137,   138,   139,   140,   141,   142,
-   144,    46,   146,    21,   148,   134,   150,    21,    21,    21,
-   153,   130,   131,    21,   237,   238,   239,    21,   161,   162,
-    21,   159,    24,    25,    44,   161,   162,    46,    21,   172,
-   174,   175,    15,    35,    36,    46,   180,   181,    15,   158,
-   159,    21,    22,    23,     7,     9,    26,    27,    28,    29,
-    15,    31,    32,    33,    34,    30,    44,    15,    44,     7,
-    40,    41,     4,    30,    21,    15,    44,    21,    15,   212,
-    44,    15,    44,    44,   217,    15,     0,     0,   221,   222,
-   223,   224,   149,   236,    30,   221,   229,   183,     9,   172,
-    -1,    -1,   203,   229,    -1,    -1,    -1,   240,    -1,    -1,
-   244,   245,   246,   247,   240,   248,     1,    -1,     3,    -1,
-    -1,    -1,   248,     8,    -1,    10,    11,    12,    13,    -1,
+static const short yycheck[] = {     6,
+     7,     9,   110,    26,    32,     0,     9,    26,    37,     9,
+     0,    37,    14,    45,    43,    17,    21,    14,    21,    20,
+    27,    21,    83,    21,    37,    23,    49,    50,    51,    14,
+    14,    54,    17,    14,    37,    37,    44,    37,    24,    25,
+    37,    43,    45,    14,    42,    45,    43,   155,    56,    21,
+    39,    23,    37,    37,    17,    21,    37,    23,    43,    43,
+    88,    21,    43,    21,    21,    23,    37,    90,    91,    21,
+    42,    94,    43,    21,    37,    21,    42,    21,    39,   187,
+   103,    21,   105,    21,    42,    46,    21,    95,    39,   112,
+    97,    21,    36,    37,    38,    46,    21,    92,    93,    21,
+   107,   108,     4,    93,   165,   166,   167,   168,   169,    24,
+    25,    14,    24,    25,   137,   138,   139,   140,   141,   142,
+    35,    36,    37,    35,    36,   148,   134,   150,    36,   148,
+   153,   150,     5,     6,     7,   130,   131,   144,    36,   146,
+   130,   131,    23,     5,     6,    26,    27,    28,    29,   172,
+    31,    32,    33,    34,   161,   162,    14,   180,   181,    40,
+    41,   180,   181,   158,   159,    24,    25,   174,   175,   159,
+    45,    21,    46,    21,    21,    21,   237,   238,   239,    21,
+    21,    21,    46,    44,    21,    21,    22,    23,    15,   212,
+    26,    27,    28,    29,   217,    31,    32,    33,    34,   222,
+   223,   224,    46,    15,    40,    41,   229,     7,     9,    30,
+    15,    44,    15,    44,   221,     7,     4,   240,    15,    30,
+    44,    15,   229,   246,   247,    21,    44,   246,   247,    15,
+    21,    44,    15,   240,    44,     0,     0,   244,   245,   149,
+     1,   248,     3,    30,   236,   172,   183,     8,   203,    10,
+    11,    12,    13,     9,    -1,    16,    -1,    18,    19,    -1,
+    21,    22,    23,    -1,    -1,    26,    27,    28,    29,    -1,
+    31,    32,    33,    34,    -1,    -1,    37,    38,     3,    40,
+    41,    -1,    43,     8,    45,    10,    11,    12,    13,    -1,
     -1,    16,    -1,    18,    19,    -1,    21,    22,    23,    -1,
     -1,    26,    27,    28,    29,    -1,    31,    32,    33,    34,
-    -1,    -1,    37,    38,     3,    40,    41,    -1,    43,     8,
+    -1,    -1,    37,    -1,     3,    40,    41,    -1,    43,     8,
     45,    10,    11,    12,    13,    -1,    -1,    16,    -1,    18,
     19,    -1,    21,    22,    23,    -1,    -1,    26,    27,    28,
-    29,    -1,    31,    32,    33,    34,    -1,    -1,    37,    -1,
+    29,    -1,    31,    32,    33,    34,    -1,    -1,    -1,    -1,
      3,    40,    41,    -1,    43,     8,    45,    10,    11,    12,
-    13,    -1,    -1,    16,    -1,    18,    19,    -1,    21,    22,
+    13,    -1,    -1,    16,    -1,    -1,    19,    -1,    21,    22,
     23,    -1,    -1,    26,    27,    28,    29,    -1,    31,    32,
     33,    34,    -1,    -1,    -1,    -1,     3,    40,    41,    -1,
     43,     8,    45,    10,    11,    12,    13,    -1,    -1,    16,
-    -1,    -1,    19,    -1,    21,    22,    23,    -1,    -1,    26,
+    -1,    18,    -1,    -1,    21,    22,    23,    -1,    -1,    26,
     27,    28,    29,    -1,    31,    32,    33,    34,    -1,    -1,
     -1,    -1,     3,    40,    41,    -1,    43,     8,    45,    10,
-    11,    12,    13,    -1,    -1,    16,    -1,    18,    -1,    -1,
+    11,    12,    13,    -1,    -1,    16,    -1,    -1,    -1,    -1,
     21,    22,    23,    -1,    -1,    26,    27,    28,    29,    -1,
-    31,    32,    33,    34,    -1,    -1,    -1,    -1,     3,    40,
+    31,    32,    33,    34,    -1,    -1,    37,    -1,     3,    40,
     41,    -1,    43,     8,    45,    10,    11,    12,    13,    -1,
     -1,    16,    -1,    -1,    -1,    -1,    21,    22,    23,    -1,
     -1,    26,    27,    28,    29,    -1,    31,    32,    33,    34,
-    -1,    -1,    37,    -1,     3,    40,    41,    -1,    43,     8,
-    45,    10,    11,    12,    13,    -1,    -1,    16,    -1,    -1,
-    -1,    -1,    21,    22,    23,    -1,    -1,    26,    27,    28,
-    29,    -1,    31,    32,    33,    34,    -1,    -1,    -1,    -1,
-    -1,    40,    41,    -1,    43,    23,    45,    -1,    26,    27,
-    28,    29,    -1,    31,    32,    33,    34,    -1,    -1,    -1,
-    -1,    -1,    40,    41,    26,    27,    28,    29,    -1,    31,
-    -1,    33,    34,    -1,    -1,    -1,    -1,    -1,    40,    41
+    -1,    -1,    -1,    -1,    -1,    40,    41,    -1,    43,    -1,
+    45,    26,    27,    28,    29,    -1,    31,    -1,    33,    34,
+    -1,    -1,    -1,    -1,    -1,    40,    41
 };
 /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
 #line 3 "/usr/local/lib/bison.simple"
@@ -1070,7 +1071,7 @@ yyreduce:
   switch (yyn) {
 
 case 1:
-#line 210 "./parse.y"
+#line 215 "./parse.y"
 {
                          /* Case of regular command.  Discard the error
                             safety net,and return the command just parsed. */
@@ -1081,7 +1082,7 @@ case 1:
                        ;
     break;}
 case 2:
-#line 219 "./parse.y"
+#line 224 "./parse.y"
 {
                          /* Case of regular command, but not a very
                             interesting one.  Return a NULL command. */
@@ -1090,7 +1091,7 @@ case 2:
                        ;
     break;}
 case 3:
-#line 226 "./parse.y"
+#line 231 "./parse.y"
 {
                          /* Error during parsing.  Return NULL command. */
                          global_command = (COMMAND *)NULL;
@@ -1107,7 +1108,7 @@ case 3:
                        ;
     break;}
 case 4:
-#line 241 "./parse.y"
+#line 246 "./parse.y"
 {
                          /* Case of EOF seen by itself.  Do ignoreeof or
                             not. */
@@ -1117,57 +1118,57 @@ case 4:
                        ;
     break;}
 case 5:
-#line 251 "./parse.y"
+#line 256 "./parse.y"
 { yyval.word_list = make_word_list (yyvsp[0].word, (WORD_LIST *)NULL); ;
     break;}
 case 6:
-#line 253 "./parse.y"
+#line 258 "./parse.y"
 { yyval.word_list = make_word_list (yyvsp[0].word, yyvsp[-1].word_list); ;
     break;}
 case 7:
-#line 257 "./parse.y"
+#line 262 "./parse.y"
 {
                          redir.filename = yyvsp[0].word;
                          yyval.redirect = make_redirection (1, r_output_direction, redir);
                        ;
     break;}
 case 8:
-#line 262 "./parse.y"
+#line 267 "./parse.y"
 {
                          redir.filename = yyvsp[0].word;
                          yyval.redirect = make_redirection (0, r_input_direction, redir);
                        ;
     break;}
 case 9:
-#line 267 "./parse.y"
+#line 272 "./parse.y"
 {
                          redir.filename = yyvsp[0].word;
                          yyval.redirect = make_redirection (yyvsp[-2].number, r_output_direction, redir);
                        ;
     break;}
 case 10:
-#line 272 "./parse.y"
+#line 277 "./parse.y"
 {
                          redir.filename = yyvsp[0].word;
                          yyval.redirect = make_redirection (yyvsp[-2].number, r_input_direction, redir);
                        ;
     break;}
 case 11:
-#line 277 "./parse.y"
+#line 282 "./parse.y"
 {
                          redir.filename = yyvsp[0].word;
                          yyval.redirect = make_redirection (1, r_appending_to, redir);
                        ;
     break;}
 case 12:
-#line 282 "./parse.y"
+#line 287 "./parse.y"
 {
                          redir.filename = yyvsp[0].word;
                          yyval.redirect = make_redirection (yyvsp[-2].number, r_appending_to, redir);
                        ;
     break;}
 case 13:
-#line 287 "./parse.y"
+#line 292 "./parse.y"
 {
                          redir.filename = yyvsp[0].word;
                          yyval.redirect = make_redirection (0, r_reading_until, redir);
@@ -1175,7 +1176,7 @@ case 13:
                        ;
     break;}
 case 14:
-#line 293 "./parse.y"
+#line 298 "./parse.y"
 {
                          redir.filename = yyvsp[0].word;
                          yyval.redirect = make_redirection (yyvsp[-2].number, r_reading_until, redir);
@@ -1183,63 +1184,63 @@ case 14:
                        ;
     break;}
 case 15:
-#line 299 "./parse.y"
+#line 304 "./parse.y"
 {
                          redir.dest = yyvsp[0].number;
                          yyval.redirect = make_redirection (0, r_duplicating_input, redir);
                        ;
     break;}
 case 16:
-#line 304 "./parse.y"
+#line 309 "./parse.y"
 {
                          redir.dest = yyvsp[0].number;
                          yyval.redirect = make_redirection (yyvsp[-2].number, r_duplicating_input, redir);
                        ;
     break;}
 case 17:
-#line 309 "./parse.y"
+#line 314 "./parse.y"
 {
                          redir.dest = yyvsp[0].number;
                          yyval.redirect = make_redirection (1, r_duplicating_output, redir);
                        ;
     break;}
 case 18:
-#line 314 "./parse.y"
+#line 319 "./parse.y"
 {
                          redir.dest = yyvsp[0].number;
                          yyval.redirect = make_redirection (yyvsp[-2].number, r_duplicating_output, redir);
                        ;
     break;}
 case 19:
-#line 319 "./parse.y"
+#line 324 "./parse.y"
 {
                          redir.filename = yyvsp[0].word;
                          yyval.redirect = make_redirection (0, r_duplicating_input_word, redir);
                        ;
     break;}
 case 20:
-#line 324 "./parse.y"
+#line 329 "./parse.y"
 {
                          redir.filename = yyvsp[0].word;
                          yyval.redirect = make_redirection (yyvsp[-2].number, r_duplicating_input_word, redir);
                        ;
     break;}
 case 21:
-#line 329 "./parse.y"
+#line 334 "./parse.y"
 {
                          redir.filename = yyvsp[0].word;
                          yyval.redirect = make_redirection (1, r_duplicating_output_word, redir);
                        ;
     break;}
 case 22:
-#line 334 "./parse.y"
+#line 339 "./parse.y"
 {
                          redir.filename = yyvsp[0].word;
                          yyval.redirect = make_redirection (yyvsp[-2].number, r_duplicating_output_word, redir);
                        ;
     break;}
 case 23:
-#line 339 "./parse.y"
+#line 344 "./parse.y"
 {
                          redir.filename = yyvsp[0].word;
                          yyval.redirect = make_redirection
@@ -1248,7 +1249,7 @@ case 23:
                        ;
     break;}
 case 24:
-#line 346 "./parse.y"
+#line 351 "./parse.y"
 {
                          redir.filename = yyvsp[0].word;
                          yyval.redirect = make_redirection
@@ -1257,88 +1258,88 @@ case 24:
                        ;
     break;}
 case 25:
-#line 353 "./parse.y"
+#line 358 "./parse.y"
 {
                          redir.dest = 0L;
                          yyval.redirect = make_redirection (1, r_close_this, redir);
                        ;
     break;}
 case 26:
-#line 358 "./parse.y"
+#line 363 "./parse.y"
 {
                          redir.dest = 0L;
                          yyval.redirect = make_redirection (yyvsp[-2].number, r_close_this, redir);
                        ;
     break;}
 case 27:
-#line 363 "./parse.y"
+#line 368 "./parse.y"
 {
                          redir.dest = 0L;
                          yyval.redirect = make_redirection (0, r_close_this, redir);
                        ;
     break;}
 case 28:
-#line 368 "./parse.y"
+#line 373 "./parse.y"
 {
                          redir.dest = 0L;
                          yyval.redirect = make_redirection (yyvsp[-2].number, r_close_this, redir);
                        ;
     break;}
 case 29:
-#line 373 "./parse.y"
+#line 378 "./parse.y"
 {
                          redir.filename = yyvsp[0].word;
                          yyval.redirect = make_redirection (1, r_err_and_out, redir);
                        ;
     break;}
 case 30:
-#line 378 "./parse.y"
+#line 383 "./parse.y"
 {
                          redir.filename = yyvsp[0].word;
                          yyval.redirect = make_redirection (yyvsp[-2].number, r_input_output, redir);
                        ;
     break;}
 case 31:
-#line 383 "./parse.y"
+#line 388 "./parse.y"
 {
                          redir.filename = yyvsp[0].word;
                          yyval.redirect = make_redirection (0, r_input_output, redir);
                        ;
     break;}
 case 32:
-#line 388 "./parse.y"
+#line 393 "./parse.y"
 {
                          redir.filename = yyvsp[0].word;
                          yyval.redirect = make_redirection (1, r_output_force, redir);
                        ;
     break;}
 case 33:
-#line 393 "./parse.y"
+#line 398 "./parse.y"
 {
                          redir.filename = yyvsp[0].word;
                          yyval.redirect = make_redirection (yyvsp[-2].number, r_output_force, redir);
                        ;
     break;}
 case 34:
-#line 400 "./parse.y"
+#line 405 "./parse.y"
 { yyval.element.word = yyvsp[0].word; yyval.element.redirect = 0; ;
     break;}
 case 35:
-#line 402 "./parse.y"
+#line 407 "./parse.y"
 { yyval.element.word = yyvsp[0].word; yyval.element.redirect = 0; ;
     break;}
 case 36:
-#line 404 "./parse.y"
+#line 409 "./parse.y"
 { yyval.element.redirect = yyvsp[0].redirect; yyval.element.word = 0; ;
     break;}
 case 37:
-#line 408 "./parse.y"
+#line 413 "./parse.y"
 {
                          yyval.redirect = yyvsp[0].redirect;
                        ;
     break;}
 case 38:
-#line 412 "./parse.y"
+#line 417 "./parse.y"
 {
                          register REDIRECT *t;
 
@@ -1349,23 +1350,23 @@ case 38:
                        ;
     break;}
 case 39:
-#line 423 "./parse.y"
+#line 428 "./parse.y"
 { yyval.command = make_simple_command (yyvsp[0].element, (COMMAND *)NULL); ;
     break;}
 case 40:
-#line 425 "./parse.y"
+#line 430 "./parse.y"
 { yyval.command = make_simple_command (yyvsp[0].element, yyvsp[-1].command); ;
     break;}
 case 41:
-#line 429 "./parse.y"
+#line 434 "./parse.y"
 { yyval.command = clean_simple_command (yyvsp[0].command); ;
     break;}
 case 42:
-#line 431 "./parse.y"
+#line 436 "./parse.y"
 { yyval.command = yyvsp[0].command; ;
     break;}
 case 43:
-#line 433 "./parse.y"
+#line 438 "./parse.y"
 {
                          COMMAND *tc;
 
@@ -1394,191 +1395,191 @@ case 43:
                        ;
     break;}
 case 44:
-#line 462 "./parse.y"
+#line 467 "./parse.y"
 { yyval.command = yyvsp[0].command; ;
     break;}
 case 45:
-#line 464 "./parse.y"
+#line 469 "./parse.y"
 { yyval.command = yyvsp[0].command; ;
     break;}
 case 46:
-#line 466 "./parse.y"
+#line 471 "./parse.y"
 { yyval.command = make_while_command (yyvsp[-3].command, yyvsp[-1].command); ;
     break;}
 case 47:
-#line 468 "./parse.y"
+#line 473 "./parse.y"
 { yyval.command = make_until_command (yyvsp[-3].command, yyvsp[-1].command); ;
     break;}
 case 48:
-#line 470 "./parse.y"
+#line 475 "./parse.y"
 { yyval.command = yyvsp[0].command; ;
     break;}
 case 49:
-#line 472 "./parse.y"
+#line 477 "./parse.y"
 { yyval.command = yyvsp[0].command; ;
     break;}
 case 50:
-#line 474 "./parse.y"
+#line 479 "./parse.y"
 { yyval.command = yyvsp[0].command; ;
     break;}
 case 51:
-#line 476 "./parse.y"
+#line 481 "./parse.y"
 { yyval.command = yyvsp[0].command; ;
     break;}
 case 52:
-#line 478 "./parse.y"
+#line 483 "./parse.y"
 { yyval.command = yyvsp[0].command; ;
     break;}
 case 53:
-#line 482 "./parse.y"
+#line 487 "./parse.y"
 { yyval.command = make_for_command (yyvsp[-4].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command); ;
     break;}
 case 54:
-#line 484 "./parse.y"
+#line 489 "./parse.y"
 { yyval.command = make_for_command (yyvsp[-4].word, add_string_to_list ("$@", (WORD_LIST *)NULL), yyvsp[-1].command); ;
     break;}
 case 55:
-#line 486 "./parse.y"
+#line 491 "./parse.y"
 { yyval.command = make_for_command (yyvsp[-5].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command); ;
     break;}
 case 56:
-#line 488 "./parse.y"
+#line 493 "./parse.y"
 { yyval.command = make_for_command (yyvsp[-5].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command); ;
     break;}
 case 57:
-#line 490 "./parse.y"
+#line 495 "./parse.y"
 { yyval.command = make_for_command (yyvsp[-8].word, REVERSE_LIST (yyvsp[-5].word_list, WORD_LIST *), yyvsp[-1].command); ;
     break;}
 case 58:
-#line 492 "./parse.y"
+#line 497 "./parse.y"
 { yyval.command = make_for_command (yyvsp[-8].word, REVERSE_LIST (yyvsp[-5].word_list, WORD_LIST *), yyvsp[-1].command); ;
     break;}
 case 59:
-#line 496 "./parse.y"
+#line 501 "./parse.y"
 {
                          yyval.command = make_select_command (yyvsp[-4].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command);
                        ;
     break;}
 case 60:
-#line 500 "./parse.y"
+#line 505 "./parse.y"
 {
                          yyval.command = make_select_command (yyvsp[-4].word, add_string_to_list ("$@", (WORD_LIST *)NULL), yyvsp[-1].command);
                        ;
     break;}
 case 61:
-#line 504 "./parse.y"
+#line 509 "./parse.y"
 {
                          yyval.command = make_select_command (yyvsp[-5].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command);
                        ;
     break;}
 case 62:
-#line 508 "./parse.y"
+#line 513 "./parse.y"
 {
                          yyval.command = make_select_command (yyvsp[-5].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command);
                        ;
     break;}
 case 63:
-#line 512 "./parse.y"
+#line 517 "./parse.y"
 {
                          yyval.command = make_select_command (yyvsp[-8].word, (WORD_LIST *)reverse_list (yyvsp[-5].word_list), yyvsp[-1].command);
                        ;
     break;}
 case 64:
-#line 516 "./parse.y"
+#line 521 "./parse.y"
 {
                          yyval.command = make_select_command (yyvsp[-8].word, (WORD_LIST *)reverse_list (yyvsp[-5].word_list), yyvsp[-1].command);
                        ;
     break;}
 case 65:
-#line 522 "./parse.y"
+#line 527 "./parse.y"
 { yyval.command = make_case_command (yyvsp[-4].word, (PATTERN_LIST *)NULL); ;
     break;}
 case 66:
-#line 524 "./parse.y"
+#line 529 "./parse.y"
 { yyval.command = make_case_command (yyvsp[-5].word, yyvsp[-2].pattern); ;
     break;}
 case 67:
-#line 526 "./parse.y"
+#line 531 "./parse.y"
 { yyval.command = make_case_command (yyvsp[-4].word, yyvsp[-1].pattern); ;
     break;}
 case 68:
-#line 530 "./parse.y"
+#line 535 "./parse.y"
 { yyval.command = make_function_def (yyvsp[-4].word, yyvsp[0].command, function_dstart, function_bstart); ;
     break;}
 case 69:
-#line 534 "./parse.y"
+#line 539 "./parse.y"
 { yyval.command = make_function_def (yyvsp[-4].word, yyvsp[0].command, function_dstart, function_bstart); ;
     break;}
 case 70:
-#line 537 "./parse.y"
+#line 542 "./parse.y"
 { yyval.command = make_function_def (yyvsp[-2].word, yyvsp[0].command, function_dstart, function_bstart); ;
     break;}
 case 71:
-#line 541 "./parse.y"
+#line 546 "./parse.y"
 { yyvsp[-1].command->flags |= CMD_WANT_SUBSHELL; yyval.command = yyvsp[-1].command; ;
     break;}
 case 72:
-#line 545 "./parse.y"
+#line 550 "./parse.y"
 { yyval.command = make_if_command (yyvsp[-3].command, yyvsp[-1].command, (COMMAND *)NULL); ;
     break;}
 case 73:
-#line 547 "./parse.y"
+#line 552 "./parse.y"
 { yyval.command = make_if_command (yyvsp[-5].command, yyvsp[-3].command, yyvsp[-1].command); ;
     break;}
 case 74:
-#line 549 "./parse.y"
+#line 554 "./parse.y"
 { yyval.command = make_if_command (yyvsp[-4].command, yyvsp[-2].command, yyvsp[-1].command); ;
     break;}
 case 75:
-#line 554 "./parse.y"
+#line 559 "./parse.y"
 { yyval.command = make_group_command (yyvsp[-1].command); ;
     break;}
 case 76:
-#line 558 "./parse.y"
+#line 563 "./parse.y"
 { yyval.command = make_if_command (yyvsp[-2].command, yyvsp[0].command, (COMMAND *)NULL); ;
     break;}
 case 77:
-#line 560 "./parse.y"
+#line 565 "./parse.y"
 { yyval.command = make_if_command (yyvsp[-4].command, yyvsp[-2].command, yyvsp[0].command); ;
     break;}
 case 78:
-#line 562 "./parse.y"
+#line 567 "./parse.y"
 { yyval.command = make_if_command (yyvsp[-3].command, yyvsp[-1].command, yyvsp[0].command); ;
     break;}
 case 80:
-#line 567 "./parse.y"
+#line 572 "./parse.y"
 { yyvsp[0].pattern->next = yyvsp[-1].pattern; yyval.pattern = yyvsp[0].pattern; ;
     break;}
 case 81:
-#line 571 "./parse.y"
+#line 576 "./parse.y"
 { yyval.pattern = make_pattern_list (yyvsp[-2].word_list, yyvsp[0].command); ;
     break;}
 case 82:
-#line 573 "./parse.y"
+#line 578 "./parse.y"
 { yyval.pattern = make_pattern_list (yyvsp[-2].word_list, (COMMAND *)NULL); ;
     break;}
 case 83:
-#line 575 "./parse.y"
+#line 580 "./parse.y"
 { yyval.pattern = make_pattern_list (yyvsp[-2].word_list, yyvsp[0].command); ;
     break;}
 case 84:
-#line 577 "./parse.y"
+#line 582 "./parse.y"
 { yyval.pattern = make_pattern_list (yyvsp[-2].word_list, (COMMAND *)NULL); ;
     break;}
 case 86:
-#line 582 "./parse.y"
+#line 587 "./parse.y"
 { yyvsp[-1].pattern->next = yyvsp[-2].pattern; yyval.pattern = yyvsp[-1].pattern; ;
     break;}
 case 87:
-#line 586 "./parse.y"
+#line 591 "./parse.y"
 { yyval.word_list = make_word_list (yyvsp[0].word, (WORD_LIST *)NULL); ;
     break;}
 case 88:
-#line 588 "./parse.y"
+#line 593 "./parse.y"
 { yyval.word_list = make_word_list (yyvsp[0].word, yyvsp[-2].word_list); ;
     break;}
 case 89:
-#line 597 "./parse.y"
+#line 602 "./parse.y"
 {
                          yyval.command = yyvsp[0].command;
                          if (need_here_doc)
@@ -1586,13 +1587,13 @@ case 89:
                         ;
     break;}
 case 91:
-#line 606 "./parse.y"
+#line 611 "./parse.y"
 {
                          yyval.command = yyvsp[0].command;
                        ;
     break;}
 case 93:
-#line 613 "./parse.y"
+#line 618 "./parse.y"
 {
                          if (yyvsp[-2].command->type == cm_connection)
                            yyval.command = connect_async_list (yyvsp[-2].command, (COMMAND *)NULL, '&');
@@ -1601,15 +1602,15 @@ case 93:
                        ;
     break;}
 case 95:
-#line 624 "./parse.y"
+#line 629 "./parse.y"
 { yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, AND_AND); ;
     break;}
 case 96:
-#line 626 "./parse.y"
+#line 631 "./parse.y"
 { yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, OR_OR); ;
     break;}
 case 97:
-#line 628 "./parse.y"
+#line 633 "./parse.y"
 {
                          if (yyvsp[-3].command->type == cm_connection)
                            yyval.command = connect_async_list (yyvsp[-3].command, yyvsp[0].command, '&');
@@ -1618,19 +1619,19 @@ case 97:
                        ;
     break;}
 case 98:
-#line 635 "./parse.y"
+#line 640 "./parse.y"
 { yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, ';'); ;
     break;}
 case 99:
-#line 637 "./parse.y"
+#line 642 "./parse.y"
 { yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, ';'); ;
     break;}
 case 100:
-#line 639 "./parse.y"
+#line 644 "./parse.y"
 { yyval.command = yyvsp[0].command; ;
     break;}
 case 106:
-#line 658 "./parse.y"
+#line 663 "./parse.y"
 {
                          yyval.command = yyvsp[0].command;
                          if (need_here_doc)
@@ -1638,7 +1639,7 @@ case 106:
                        ;
     break;}
 case 107:
-#line 664 "./parse.y"
+#line 669 "./parse.y"
 {
                          if (yyvsp[-1].command->type == cm_connection)
                            yyval.command = connect_async_list (yyvsp[-1].command, (COMMAND *)NULL, '&');
@@ -1649,7 +1650,7 @@ case 107:
                        ;
     break;}
 case 108:
-#line 673 "./parse.y"
+#line 678 "./parse.y"
 {
                          yyval.command = yyvsp[-1].command;
                          if (need_here_doc)
@@ -1657,15 +1658,15 @@ case 108:
                        ;
     break;}
 case 109:
-#line 681 "./parse.y"
+#line 686 "./parse.y"
 { yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, AND_AND); ;
     break;}
 case 110:
-#line 683 "./parse.y"
+#line 688 "./parse.y"
 { yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, OR_OR); ;
     break;}
 case 111:
-#line 685 "./parse.y"
+#line 690 "./parse.y"
 {
                          if (yyvsp[-2].command->type == cm_connection)
                            yyval.command = connect_async_list (yyvsp[-2].command, yyvsp[0].command, '&');
@@ -1674,59 +1675,59 @@ case 111:
                        ;
     break;}
 case 112:
-#line 692 "./parse.y"
+#line 697 "./parse.y"
 { yyval.command = command_connect (yyvsp[-2].command, yyvsp[0].command, ';'); ;
     break;}
 case 113:
-#line 695 "./parse.y"
+#line 700 "./parse.y"
 { yyval.command = yyvsp[0].command; ;
     break;}
 case 114:
-#line 699 "./parse.y"
+#line 704 "./parse.y"
 { yyval.command = yyvsp[0].command; ;
     break;}
 case 115:
-#line 701 "./parse.y"
+#line 706 "./parse.y"
 {
                          yyvsp[0].command->flags |= CMD_INVERT_RETURN;
                          yyval.command = yyvsp[0].command;
                        ;
     break;}
 case 116:
-#line 706 "./parse.y"
+#line 711 "./parse.y"
 {
                          yyvsp[0].command->flags |= yyvsp[-1].number;
                          yyval.command = yyvsp[0].command;
                        ;
     break;}
 case 117:
-#line 711 "./parse.y"
+#line 716 "./parse.y"
 {
                          yyvsp[0].command->flags |= yyvsp[-2].number;
                          yyval.command = yyvsp[0].command;
                        ;
     break;}
 case 118:
-#line 716 "./parse.y"
+#line 721 "./parse.y"
 {
                          yyvsp[0].command->flags |= yyvsp[-1].number|CMD_INVERT_RETURN;
                          yyval.command = yyvsp[0].command;
                        ;
     break;}
 case 119:
-#line 724 "./parse.y"
+#line 729 "./parse.y"
 { yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, '|'); ;
     break;}
 case 120:
-#line 726 "./parse.y"
+#line 731 "./parse.y"
 { yyval.command = yyvsp[0].command; ;
     break;}
 case 121:
-#line 730 "./parse.y"
+#line 735 "./parse.y"
 { yyval.number = CMD_TIME_PIPELINE; ;
     break;}
 case 122:
-#line 732 "./parse.y"
+#line 737 "./parse.y"
 { yyval.number = CMD_TIME_PIPELINE|CMD_TIME_POSIX; ;
     break;}
 }
@@ -1927,7 +1928,7 @@ yyerrhandle:
   yystate = yyn;
   goto yynewstate;
 }
-#line 734 "./parse.y"
+#line 739 "./parse.y"
 
 
 /* Possible states for the parser that require it to do special things. */
@@ -1942,6 +1943,7 @@ yyerrhandle:
 
 /* Initial size to allocate for tokens, and the
    amount to grow them by. */
+#define TOKEN_DEFAULT_INITIAL_SIZE 496
 #define TOKEN_DEFAULT_GROW_SIZE 512
 
 /* Shell meta-characters that, when unquoted, separate words. */
@@ -2023,7 +2025,7 @@ initialize_bash_input ()
 void
 init_yy_io (get, unget, type, name, location)
      Function *get, *unget;
-     int type;
+     enum stream_type type;
      char *name;
      INPUT_STREAM location;
 {
@@ -2419,7 +2421,8 @@ push_string (s, expand, ap)
   temp->next = pushed_string_list;
   pushed_string_list = temp;
 
-  ap->flags |= AL_BEINGEXPANDED;
+  if (ap)
+    ap->flags |= AL_BEINGEXPANDED;
 
   shell_input_line = s;
   shell_input_line_size = strlen (s);
@@ -2453,7 +2456,8 @@ pop_string ()
   t = pushed_string_list;
   pushed_string_list = pushed_string_list->next;
 
-  t->expander->flags &= ~AL_BEINGEXPANDED;
+  if (t->expander)
+    t->expander->flags &= ~AL_BEINGEXPANDED;
 
   free ((char *)t);
 }
@@ -2736,18 +2740,19 @@ shell_getc (remove_quoted_newline)
 #  if defined (BANG_HISTORY)
          history_expansion_inhibited = old_hist;
 #  endif
-
-         free (shell_input_line);
-         shell_input_line = expansions;
-         shell_input_line_len = shell_input_line ?
-                                strlen (shell_input_line) :
-                                0;
-         if (!shell_input_line_len)
-           current_command_line_count--;
-
-         /* We have to force the xrealloc below because we don't know the
-            true allocated size of shell_input_line anymore. */
-         shell_input_line_size = shell_input_line_len;
+         if (expansions != shell_input_line)
+           {
+             free (shell_input_line);
+             shell_input_line = expansions;
+             shell_input_line_len = shell_input_line ?
+                                       strlen (shell_input_line) : 0;
+             if (!shell_input_line_len)
+               current_command_line_count--;
+
+             /* We have to force the xrealloc below because we don't know
+                the true allocated size of shell_input_line anymore. */
+             shell_input_line_size = shell_input_line_len;
+           }
        }
       /* XXX - this is grotesque */
       else if (remember_on_history && shell_input_line &&
@@ -2882,7 +2887,7 @@ execute_prompt_command (command)
   if (last_lastarg)
     last_lastarg = savestring (last_lastarg);
 
-  parse_and_execute (savestring (command), "PROMPT_COMMAND", 0);
+  parse_and_execute (savestring (command), "PROMPT_COMMAND", SEVAL_NONINT|SEVAL_NOHIST);
 
   last_shell_builtin = temp_last;
   this_shell_builtin = temp_this;
@@ -3173,7 +3178,10 @@ read_token (command)
     {
       result = token_to_read;
       if (token_to_read == WORD || token_to_read == ASSIGNMENT_WORD)
-       yylval.word = word_desc_to_read;
+       {
+         yylval.word = word_desc_to_read;
+         word_desc_to_read = (WORD_DESC *)NULL;
+       }
       token_to_read = 0;
       return (result);
     }
@@ -3263,9 +3271,29 @@ read_token (command)
            case '(':           /* ) */
              if (reserved_word_acceptable (last_read_token))
                {
-                 parser_state |= PST_DBLPAREN;
-                 yylval.word = make_word ("let");
-                 return (WORD);          
+                 int cmdtyp, sline;
+                 char *wval;
+
+                 sline = line_number;
+                 cmdtyp = parse_arith_cmd (&wval);
+                 if (cmdtyp == 1)      /* arithmetic command */
+                   {
+                     word_desc_to_read = make_word (wval);
+                     word_desc_to_read->flags = W_QUOTED;
+                     token_to_read = WORD;
+                     free (wval);
+                     yylval.word = make_word ("let");
+                     return (WORD);
+                   }
+                 else if (cmdtyp == 0) /* nested subshell */
+                   {
+                     push_string (wval, 0, (alias_t *)NULL);
+                     if ((parser_state & PST_CASEPAT) == 0)
+                       parser_state |= PST_SUBSHELL;
+                     return (character);
+                   }
+                 else                  /* ERROR */
+                   return -1;
                }
              break;
 #endif
@@ -3481,6 +3509,52 @@ parse_matched_pair (qc, open, close, lenp, flags)
   return ret;
 }
 
+#if defined (DPAREN_ARITHMETIC)
+/* We've seen a `(('.  Look for the matching `))'.  If we get it, return 1.
+   If not, assume it's a nested subshell for backwards compatibility and
+   return 0.  In any case, put the characters we've consumed into a locally-
+   allocated buffer and make *ep point to that buffer.  Return -1 on an
+   error, for example EOF. */
+static int
+parse_arith_cmd (ep)
+     char **ep;
+{
+  int exp_lineno, rval, c;
+  char *ttok, *token;
+  int ttoklen;
+
+  exp_lineno = line_number;
+  ttok = parse_matched_pair (0, '(', ')', &ttoklen, 0);
+  rval = 1;
+  if (ttok == &matched_pair_error)
+    return -1;
+  /* Check that the next character is the closing right paren.  If
+     not, this is a syntax error. ( */
+  if ((c = shell_getc (0)) != ')')
+    rval = 0;
+
+  token = xmalloc(ttoklen + 4);
+
+  /* (( ... )) -> "..." */
+  token[0] = (rval == 1) ? '"' : '(';
+  strncpy (token + 1, ttok, ttoklen - 1);      /* don't copy the final `)' */
+  if (rval == 1)
+    {
+      token[ttoklen] = '"';
+      token[ttoklen+1] = '\0';
+    }
+  else
+    {
+      token[ttoklen] = ')';
+      token[ttoklen+1] = c;
+      token[ttoklen+2] = '\0';
+    }
+  *ep = token;
+  FREE (ttok);
+  return rval;
+}
+#endif /* DPAREN_ARITHMETIC */
+
 static int
 read_token_word (character)
      int character;
@@ -3510,11 +3584,8 @@ read_token_word (character)
   char *ttok, *ttrans;
   int ttoklen, ttranslen;
 
-  if (token_buffer_size < TOKEN_DEFAULT_GROW_SIZE)
-    {
-      FREE (token);
-      token = xmalloc (token_buffer_size = TOKEN_DEFAULT_GROW_SIZE);
-    }
+  if (token_buffer_size < TOKEN_DEFAULT_INITIAL_SIZE)
+    token = xrealloc (token, token_buffer_size = TOKEN_DEFAULT_INITIAL_SIZE);
 
   token_index = 0;
   all_digits = digit (character);
@@ -3560,45 +3631,6 @@ read_token_word (character)
            }
        }
 
-#if defined (DPAREN_ARITHMETIC)
-      /* Parse a ksh-style ((...)) expression. */
-      if (parser_state & PST_DBLPAREN)
-       {
-         int exp_lineno;
-
-         /* If we've already consumed a right paren that should be part of
-            the expression, push it back so the paren matching code won't
-            return prematurely. */
-         if (character == '(')         /* ) */
-           shell_ungetc (character);
-         exp_lineno = line_number;
-         ttok = parse_matched_pair (0, '(', ')', &ttoklen, 0);
-         parser_state &= ~PST_DBLPAREN;
-         if (ttok == &matched_pair_error)
-           return -1;
-         /* Check that the next character is the closing right paren.  If
-            not, this is a syntax error. ( */
-         if (shell_getc (0) != ')')
-           {
-             FREE (ttok);      /* ( */
-             parser_error (exp_lineno, "missing closing `)' for arithmetic expression");
-             return -1;
-           }
-         RESIZE_MALLOCED_BUFFER (token, token_index, ttoklen + 4,
-                                 token_buffer_size, TOKEN_DEFAULT_GROW_SIZE);
-         token[token_index++] = '"';
-         if (character != '(')         /* ) */
-           token[token_index++] = character;
-         strncpy (token + token_index, ttok, ttoklen - 1);
-         token_index += ttoklen - 1;
-         token[token_index++] = '"';
-         FREE (ttok);
-         dollar_present = all_digits = 0;
-         quoted = 1;
-         goto got_token;
-       }
-#endif /* DPAREN_ARITHMETIC */
-
       /* Parse a matched pair of quote characters. */
       if (shellquote (character))
        {
@@ -3635,7 +3667,16 @@ read_token_word (character)
              if (peek_char == '{')             /* } */
                ttok = parse_matched_pair (cd, '{', '}', &ttoklen, 0);
              else if (peek_char == '(')                /* ) */
-               ttok = parse_matched_pair (cd, '(', ')', &ttoklen, 0);
+               {
+                 /* XXX - push and pop the `(' as a delimiter for use by
+                    the command-oriented-history code.  This way newlines
+                    appearing in the $(...) string get added to the
+                    history literally rather than causing a possibly-
+                    incorrect `;' to be added. */
+                 push_delimiter (dstack, peek_char);
+                 ttok = parse_matched_pair (cd, '(', ')', &ttoklen, 0);
+                 pop_delimiter (dstack);
+               }
              else
                ttok = parse_matched_pair (cd, '[', ']', &ttoklen, 0);
              if (ttok == &matched_pair_error)
@@ -3833,10 +3874,8 @@ ansiexpand (string, start, end, lenp)
 
   if (*temp)
     {
-      t = ansicstr (temp, tlen, (int *)NULL);
+      t = ansicstr (temp, tlen, (int *)NULL, lenp);
       free (temp);
-      if (lenp)
-       *lenp = strlen (t);
       return (t);
     }
   else
@@ -4090,7 +4129,7 @@ print_prompt ()
        \[      begin a sequence of non-printing chars
        \]      end a sequence of non-printing chars
 */
-#define PROMPT_GROWTH 50
+#define PROMPT_GROWTH 48
 char *
 decode_prompt_string (string)
      char *string;