]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
Imported from ../bash-2.03.tar.gz.
authorJari Aalto <jari.aalto@cante.net>
Fri, 19 Feb 1999 17:11:39 +0000 (17:11 +0000)
committerJari Aalto <jari.aalto@cante.net>
Sat, 12 Sep 2009 16:46:52 +0000 (16:46 +0000)
191 files changed:
CHANGES
COMPAT
CWRU/POSIX.NOTES
CWRU/README
CWRU/changelog
CWRU/empty-for-wordlist [new file with mode: 0644]
CWRU/misc/errlist.c [new file with mode: 0644]
CWRU/misc/hpux10-dlfcn.h [new file with mode: 0644]
INSTALL
MANIFEST
Makefile.in
NEWS
NOTES
README
Y2K [new file with mode: 0644]
aclocal.m4
bashhist.c
bashline.c
builtins/Makefile.in
builtins/cd.def
builtins/enable.def
builtins/evalstring.c
builtins/fc.def
builtins/getopt.c
builtins/getopts.def
builtins/mkbuiltins.c
builtins/printf.def
builtins/pushd.def
builtins/read.def
builtins/reserved.def
builtins/set.def
builtins/shopt.def
builtins/test.def
builtins/type.def
builtins/ulimit.def
builtins/umask.def
command.h
config-bot.h [moved from config.h.bot with 96% similarity]
config-top.h [moved from config.h.top with 100% similarity]
config.h.in
configure
configure.in
cross-build/beos-sig.h [new file with mode: 0644]
cross-build/cygwin32.cache
cross-build/opennt.cache [new file with mode: 0644]
cross-build/x86-beos.cache [new file with mode: 0644]
dispose_cmd.c
doc/FAQ
doc/INTRO
doc/Makefile.in
doc/README
doc/bash.1
doc/bashbug.1
doc/bashref.info
doc/bashref.texi
doc/readline.3
error.c
error.h
eval.c
examples/functions/autoload.v3 [new file with mode: 0644]
examples/functions/inetaddr
examples/functions/lowercase
examples/functions/repeat3 [new file with mode: 0644]
examples/functions/seq2 [new file with mode: 0644]
examples/functions/which [new file with mode: 0644]
examples/loadables/Makefile.in
examples/loadables/README
examples/loadables/dirname.c
examples/loadables/finfo.c
examples/loadables/hello.c
examples/loadables/id.c [new file with mode: 0644]
examples/loadables/ln.c [new file with mode: 0644]
examples/loadables/mkdir.c [new file with mode: 0644]
examples/loadables/necho.c
examples/loadables/pathchk.c
examples/loadables/printenv.c [new file with mode: 0644]
examples/loadables/pushd.c [deleted file]
examples/loadables/sleep.c
examples/loadables/sync.c [new file with mode: 0644]
examples/loadables/template.c [new file with mode: 0644]
examples/loadables/uname.c [new file with mode: 0644]
examples/loadables/unlink.c [new file with mode: 0644]
examples/loadables/whoami.c [new file with mode: 0644]
examples/misc/aliasconv.bash
examples/misc/aliasconv.sh
examples/scripts/adventure.sh
execute_cmd.c
externs.h
flags.c
flags.h
general.c
general.h
hashlib.c
jobs.c
lib/glob/Makefile.in
lib/glob/fnmatch.c
lib/glob/fnmatch.h
lib/glob/glob.c
lib/malloc/Makefile.in
lib/malloc/malloc.c
lib/posixheaders/memalloc.h
lib/posixheaders/posixjmp.h
lib/readline/Makefile.in
lib/readline/STANDALONE
lib/readline/bind.c
lib/readline/callback.c
lib/readline/complete.c
lib/readline/display.c
lib/readline/doc/Makefile
lib/readline/doc/hist.texinfo
lib/readline/doc/manvers.texinfo [new file with mode: 0644]
lib/readline/doc/rlman.texinfo
lib/readline/doc/rltech.texinfo
lib/readline/doc/rluser.texinfo
lib/readline/examples/rl.c
lib/readline/funmap.c
lib/readline/histexpand.c
lib/readline/histfile.c
lib/readline/histlib.h
lib/readline/history.c
lib/readline/history.h
lib/readline/input.c
lib/readline/isearch.c
lib/readline/keymaps.c
lib/readline/keymaps.h
lib/readline/kill.c
lib/readline/parens.c
lib/readline/posixjmp.h
lib/readline/readline.c
lib/readline/readline.h
lib/readline/rlconf.h
lib/readline/rlstdc.h [new file with mode: 0644]
lib/readline/rltty.c
lib/readline/savestring.c [new file with mode: 0644]
lib/readline/search.c
lib/readline/shell.c
lib/readline/signals.c
lib/readline/terminal.c
lib/readline/tilde.c
lib/readline/util.c
lib/readline/vi_mode.c
lib/sh/Makefile.in
lib/sh/itos.c
lib/sh/oslib.c
lib/sh/rename.c [new file with mode: 0644]
lib/sh/strtol.c
lib/termcap/Makefile.in
lib/tilde/Makefile.in
lib/tilde/README [new file with mode: 0644]
lib/tilde/shell.c [new file with mode: 0644]
lib/tilde/tilde.c
locale.c
make_cmd.c
memalloc.h
nojobs.c
parse.y
pathexp.c
posixjmp.h
print_cmd.c
shell.c
subst.c
support/Makefile.in
support/SYMLINKS
support/config.guess
support/config.sub
support/missing [new file with mode: 0755]
support/mksignames.c
support/rlvers.sh [new file with mode: 0755]
support/shobj-conf [new file with mode: 0755]
support/texi2dvi
support/texi2html
test.c
tests/cprint.right [new file with mode: 0644]
tests/cprint.tests [new file with mode: 0644]
tests/extglob.right
tests/extglob.tests
tests/more-exp.right
tests/more-exp.tests
tests/printf.right
tests/printf.tests
tests/run-cprint [new file with mode: 0644]
tests/run-printf
tests/shopt.right
tests/test.right
tests/type.right
trap.c
variables.c
variables.h
version.c
xmalloc.c
y.tab.c

diff --git a/CHANGES b/CHANGES
index 5f293092ee704565681c7376d0a5813bbd65eb59..d510f6fb73b32436862b72f05f8961fa04c43f5e 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,322 @@
+This document details the changes between this version, bash-2.03-release,
+and the previous version, bash-2.03-beta2.
+
+1.  Changes to Bash
+
+a.  A file descriptor leak in the `fc' builtin was fixed.
+
+b.  A bug was fixed in the `read' builtin that caused occasional spurious
+    failures when using `read -e'.
+
+c.  The version code needed to use the value of the cpp variable
+    CONF_MACHTYPE rather than MACHTYPE.
+
+d.  A new test was added to exercise the command printing and copying code.
+
+e.  A bug was fixed that caused `time' to be recognized as a reserved word
+    if it was the first pattern in a `case' statement pattern list.
+
+------------------------------------------------------------------------------
+This document details the changes between this version, bash-2.03-beta2,
+and the previous version, bash-2.03-beta1.
+
+1.  Changes to Bash
+
+a.  Slight additions to support/shobj-conf, mostly for the benefit of AIX 4.2.
+
+b.  config.{guess,sub} support added for the NEC SX4.
+
+c.  Changed some of the cross-compiling sections of the configure macros in
+    aclocal.m4 so that configure won't abort.
+
+d.  Slight changes to how the HTML versions of the bash and readline manuals
+    are generated.
+
+e.  Fixed conditional command printing to avoid interpreting printf `%'-escapes
+    in arguments to [[.
+
+f.  Don't include the bash malloc on all variants of the alpha processor.
+
+g.  Changes to configure to make --enable-profiling work on Solaris 2.x.
+
+h.  Fixed a bug that manifested itself when shell functions were called
+    between calls to `getopts'.
+
+i.  Fixed pattern substitution so that a bare `#'as a pattern causes the
+    replacement string to be prefixed to the search string, and a bare
+    `%' causes the replacement string to be appended to the search string.
+
+j.  Fixed a bug in the command execution code that caused child processes
+    to occasionally have the wrong value for $!.
+
+2.  Changes to Readline
+
+a.  Added code to the history library to catch history substitutions using
+    `&' without a previous history substitution or search having been
+    performed.
+
+3.  New Features in Bash
+
+4.  New Features in Readline
+
+a.  New bindable variable: `isearch-terminators'.
+
+b.  New bindable function: `forward-backward-delete-char' (unbound by default).
+
+------------------------------------------------------------------------------
+This document details the changes between this version, bash-2.03-beta1,
+and the previous version, bash-2.03-alpha.
+    
+1.  Changes to Bash
+
+a.  A change was made to the help text for `{...}' to make it clear that a
+    semicolon is required before the closing brace.
+
+b.  A fix was made to the `test' builtin so that syntax errors cause test
+    to return an exit status > 1.
+
+c.  Globbing is no longer performed on assignment statements that appear as
+    arguments to `assignment builtins' such as `export'.
+
+d.  System-specific configuration changes were made for:  Rhapsody,
+    AIX 4.2/gcc, BSD/OS 4.0.
+
+e.  New loadable builtins: ln, unlink.
+
+f.  Some fixes were made to the globbing code to handle extended glob patterns
+    which immediately follow a `*'.
+
+g.  A fix was made to the command printing code to ensure that redirections
+    following compound commands have a space separating them from the rest
+    of the command.
+
+h.  The pathname canonicalization code was changed to produce fewer leading
+    `//' sequences, since those are interpreted as network file system
+    pathnames on some systems.
+
+i.  A fix was made so that loops containing `eval' commands in commands passed
+    to `bash -c' would not exit prematurely.
+
+j.  Some changes were made to the job reaping code when the shell is not
+    interactive, so the shell will retain exit statuses longer for examination
+    by `wait'.
+
+k.  A fix was made so that `jobs | command' works again.
+
+l.  The erroneous compound array assignment var=((...)) is now a syntax error.
+
+m.  A change was made to the dynamic loading code in `enable' to support
+    Tenon's MachTen.
+
+n.  A fix was made to the globbing code so that extended globbing patterns
+    will correctly match `.' in a bracket expression.
+
+2.  Changes to Readline
+
+a.  A fix was made to the completion code in which a typo caused the wrong
+    value to be passed to the function that computed the longest common
+    prefix of the list of matches.
+
+b.  The completion code now checks the value of rl_filename_completion_desired,
+    which is set by application-supplied completion functions to indicate
+    that filename completion is being performed, to decide whether or not to
+    call an application-supplied `ignore completions' function.
+
+3.  New Features in Bash
+
+a.  A change was made to the startup file code so that any shell begun with
+    the `--login' option, even non-interactive shells, will source the login
+    shell startup files.
+
+4.  New Features in Readline
+
+a.  A new variable, rl_erase_empty_line, which, if set by an application using
+    readline, will cause readline to erase, prompt and all, lines on which the
+    only thing typed was a newline.
+
+------------------------------------------------------------------------------
+This document details the changes between this version, bash-2.03-alpha,
+and the previous version, bash-2.02.1-release.
+
+1.  Changes to Bash
+
+a.  System-specific configuration changes were made for: Irix 6.x, Unixware 7.
+
+b.  The texi2dvi and texi2html scripts were updated to the latest versions
+    from the net.
+
+c.  The configure tests that determine which native type is 32 bits were
+    changed to not require a compiled program.
+
+d.  Fixed a bug in shell_execve that could cause memory to be freed twice
+    after a failed exec.
+
+e.  The `printf' test uses `diff -a' if it's available to prevent confusion
+    due to the non-ascii output.
+
+f.  Shared object configuration is now performed by a shell script,
+    support/shobj-conf, which generates values to be substituted into
+    makefiles by configure.
+
+g.  Some changes were made to `ulimit' to avoid the use of RLIM_INVALID as a
+    return value.
+
+h.  Changes were made to `ulimit' to work around HPUX 9.x's peculiar
+    handling of RLIMIT_FILESIZE.
+
+i.  Some new loadable builtins were added: id, printenv, sync, whoami, push,
+    mkdir.  `pushd', `popd', and `dirs' can now be built as regular or
+    loadable builtins from the same source file.
+
+j.  Changes were made to `printf' to handle NUL bytes in the expanded format
+    string.
+
+k.  The various `make clean' Makefile targets now descend into lib/sh.
+
+l.  The `type' builtin was changed to use the internal `getopt' so that things
+    like `type -ap' work as expected.
+
+m.  There is a new configuration option, --with-installed-readline, to link
+    bash with a locally-installed version of readline.  Only readline version
+    4.0 and later releases can support this.  Shared and static libraries
+    are supported.  The installed include files are used.
+
+n.  There is a new autoconf macro used to find which basic type is 64 bits.
+
+o.  Dynamic linking and loadable builtins should now work on SCO 3.2v5*,
+    AIX 4.2 with gcc, Unixware 7, and many other systems using gcc, where
+    the `-shared' options works correctly.
+
+p.  A bug was fixed in the bash filename completion code that caused memory to
+    be freed twice if a directory name containing an unset variable was
+    completed and the -u option was set.
+
+q.  The prompt expansion code now quotes the `$' in the `\$' expansion so it
+    is not processed by subsequent parameter expansion.
+
+r.  Fixed a parsing bug that caused a single or double quote after a `$$' to
+    trigger ANSI C expansion or locale translation.
+
+s.  Fixed a bug in the globbing code that caused quoted filenames containing
+    no globbing characters to sometimes be incorrectly expanded.
+
+t.  Changes to the default prompt strings if prompt string decoding is not
+    compiled into the shell.
+
+u.  Added `do', `then', `else', `{', and `(' to the list of keywords that may
+    precede the `time' reserved word.
+
+v.  The shell may now be cross-built for BeOS as well as cygwin32.
+
+w.  The conditional command execution code now treats `=' the same as `=='
+    for deciding when to perform pattern matching.
+
+x.  The `-e' option no longer causes the shell to exit if a command exits
+    with a non-zero status while running the startup files.
+
+y.  The `printf' builtin no longer dumps core if a modifier is supplied in
+    the format string without a conversion character (e.g. `%h').
+
+z.  Array assignments of the form a=(...) no longer show up in the history
+    list.
+
+aa. The parser was fixed to obey the POSIX.2 rules for finding the closing
+    `}' in a ${...} expression.
+
+bb. The history file is now opened with mode 0600 rather than 0666, so bash
+    no longer relies on the user's umask being set appropriately.
+
+cc. Setting LANG no longer causes LC_ALL to be assigned a value; bash now
+    relies on proper behavior from the C library.
+
+dd. Minor changes were made to allow quoted variable expansions using
+    ${...} to be completed correctly if there is no closing `"'.
+
+ee. Changes were made to builtins/Makefile.in so that configuring the shell
+    with `--enable-profiling' works right and builtins/mkbuiltins is
+    generated.
+
+2.  Changes to Readline
+
+a.  The version number is now 4.0.
+
+b.  There is no longer any #ifdef SHELL code in the source files.
+
+c.  Some changes were made to the key binding code to fix memory leaks and
+    better support Win32 systems.
+
+d.  Fixed a silly typo in the paren matching code -- it's microseconds, not
+    milliseconds.
+
+e.  The readline library should be compilable by C++ compilers.
+
+f.  The readline.h public header file now includes function prototypes for
+    all readline functions, and some changes were made to fix errors in the
+    source files uncovered by the use of prototypes.
+
+g.  The maximum numeric argument is now clamped at 1000000.
+
+h.  Fixes to rl_yank_last_arg to make it behave better.
+
+i.  Fixed a bug in the display code that caused core dumps if the prompt
+    string length exceeded 1024 characters.
+
+j.  The menu completion code was fixed to properly insert a single completion
+    if there is only one match.
+
+k.  A bug was fixed that caused the display code to improperly display tabs
+    after newlines.
+
+3.  New Features in Bash
+
+a.  New `shopt' option, `restricted_shell', indicating whether or not the
+    shell was started in restricted mode, for use in startup files.
+
+b.  Filename generation is now performed on the words between ( and ) in
+    array assignments (which it probably should have done all along).
+
+c.  OLDPWD is now auto-exported, as POSIX.2 seems to require.
+
+d.  ENV and BASH_ENV are read-only variables in a restricted shell.
+
+4.  New Features in Readline
+
+a.  Many changes to the signal handling:
+       o Readline now catches SIGQUIT and cleans up the tty before returning;
+       o A new variable, rl_catch_signals, is available to application writers 
+         to indicate to readline whether or not it should install its own
+         signal handlers for SIGINT, SIGTERM, SIGQUIT, SIGALRM, SIGTSTP,
+         SIGTTIN, and SIGTTOU;
+       o A new variable, rl_catch_sigwinch, is available to application
+         writers to indicate to readline whether or not it should install its
+         own signal handler for SIGWINCH, which will chain to the calling
+         applications's SIGWINCH handler, if one is installed;
+       o There is a new function, rl_free_line_state, for application signal
+         handlers to call to free up the state associated with the current
+         line after receiving a signal;
+       o There is a new function, rl_cleanup_after_signal, to clean up the
+         display and terminal state after receiving a signal;
+       o There is a new function, rl_reset_after_signal, to reinitialize the
+         terminal and display state after an application signal handler
+         returns and readline continues
+
+b.  There is a new function, rl_resize_terminal, to reset readline's idea of
+    the screen size after a SIGWINCH.
+
+c.  New public functions: rl_save_prompt and rl_restore_prompt.  These were
+    previously private functions with a `_' prefix.
+
+d.  New function hook: rl_pre_input_hook, called just before readline starts
+    reading input, after initialization.
+
+e.  New function hook: rl_display_matches_hook, called when readline would
+    display the list of completion matches.  The new function
+    rl_display_match_list is what readline uses internally, and is available
+    for use by application functions called via this hook.
+
+f.  New bindable function, delete-char-or-list, like tcsh.
+
+------------------------------------------------------------------------------
 This document details the changes between this version, bash-2.02.1-release,
 and the previous version, bash-2.02-release.
 
@@ -795,7 +1114,7 @@ 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
+    a nested subshell rather than strictly as an (erroneous) arithmetic
     command.
 
 z.  A fix was made to the globbing code so that it correctly matches quoted
diff --git a/COMPAT b/COMPAT
index edb2ef3bd2fd7b0aaefcaba1eab3e0bd4ee83f84..79bc8cca6c12eebb58dafefbd3cc27f74860f2a3 100644 (file)
--- a/COMPAT
+++ b/COMPAT
@@ -1,7 +1,7 @@
 This document details the incompatibilites between this version of bash,
-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. 
+bash-2.03, and the previous widely-available version, bash-1.14 (which
+is still the `standard' version for many Linux distributions).  These
+were discovered by users of bash-2.x, so this list is not comprehensive.
 
 1.  Bash now uses a new quoting syntax, $"...", to do locale-specific
     string translation.  Users who have relied on the (undocumented)
@@ -63,9 +63,11 @@ encountered by a significant number of users.
        "\C-\\": self-insert
 
 6.  A number of people complained above having to use ESC to terminate an
-    incremental search, and asked for an alternate mechanism.  Bash-2.0
-    allows ^J to terminate the search without accepting the line.  Use
-    ^M to terminate the search and accept the line, as in bash-1.14.
+    incremental search, and asked for an alternate mechanism.  Bash-2.03
+    uses the value of the settable readline variable `isearch-terminators'
+    to decide which characters should terminate an incremental search.  If
+    that variable has not been set, ESC and Control-J will terminate a
+    search.
 
 7.  Some variables have been removed:  MAIL_WARNING, notify, history_control,
     command_oriented_history, glob_dot_filenames, allow_null_glob_expansion,
@@ -115,3 +117,10 @@ encountered by a significant number of users.
 
     An interactive shell started in posix mode reads and executes commands
     from the file named by $ENV.
+
+11. The <> redirection operator was changed to conform to the POSIX.2 spec.
+    In the absence of any file descriptor specification preceding the `<>',
+    file descriptor 0 is used.  In bash-1.14, this was the behavior only
+    when in POSIX mode.  The bash-1.14 behavior may be obtained with
+
+       <>filename 1>&0
index f33d1e60bc04f08543c2f60f6aae86c715ce3dfd..03c6156614c0422790b4165292d468b7cf9f9971 100644 (file)
@@ -24,8 +24,8 @@ The following list is what's changed when `POSIX mode' is in effect:
      performed on the values of `PS1' and `PS2' regardless of the
      setting of the `promptvars' option.
 
-  6. Interactive comments are enabled by default.  (Note that Bash has
-     them on by default anyway.)
+  6. Interactive comments are enabled by default.  (Bash has them on by
+     default anyway.)
 
   7. The POSIX.2 startup files are executed (`$ENV') rather than the
      normal Bash files.
index 01c721a3c2ad616239ed3db5b532e10048327743..7d7ca1ab39e1b06b4cd7e34d444c282a81b6c06e 100644 (file)
@@ -14,4 +14,7 @@ modification.
 sh-redir-hack          - diff to parse.y to get redirections before
                          compound commands
 
+empty-for-wordlist     - diff to parse.y to allow an empty wordlist after
+                         the `in' keyword in a `for' statement
+
 mh-folder-comp         - diffs that reportedly add MH folder completion
index 460f6e6317062cdef9c000bd619fc1ff47464109..cd683aafaf5bc44b07dd9d4199049236032c8d6a 100644 (file)
@@ -3732,3 +3732,1481 @@ subst.c
          process group to a background job
 
 [bash-2.02 frozen]
+
+                                  4/18
+                                  ----
+[bash-2.02 released]
+
+                                  4/20
+                                  ----
+bashline.c
+       - make sure that rl_defun is not called for
+         history-and-alias-expand-line unless both ALIAS and BANG_HISTORY
+         are defined
+         [in bash-2.02.1]
+
+                                  4/22
+                                  ----
+make_cmd.c
+       - make sure that make_here_document allocates enough space for the
+         first line of the here document, by using the line length +2
+         (instead of 1000, which is what the old code did, and breaks if
+         the first line of the here document is enough longer than 1000
+         characters to cause other memory to be scribbled on)
+         [in bash-2.02.1]
+
+builtins/cd.def
+       - when in posix mode, a value of "" for CDPATH should be treated the
+         same as the current directory, not result in an error
+         [in bash-2.02.1]
+
+lib/malloc/malloc.c
+       - change the mh_align member of `union mhead' to be of type double
+         rather than a pointer, so that malloc will return (hopefully)
+         8-byte aligned memory
+         [in bash-2.02.1]
+
+                                  4/23
+                                  ----
+aclocal.m4
+       - add a new macro to check whether or not off_t is 64 bits 
+
+                                  4/24
+                                  ----
+configure.in
+       - fixed a typo so the bash malloc is not compiled in on mips-sgi-irix6
+
+lib/readline/display.c
+       - fix for readline redisplay if the prompt string is longer than the
+         screen width and includes invisible characters
+         [in bash-2.02.1]
+
+jobs.c
+       - make_child should not set the terminal's process group to
+         pipeline_pgrp if pipeline_pgrp == shell_pgrp (indicating that we
+         are forking a child for a command substitution)
+         [in bash-2.02.1]
+
+subst.c
+       - in execute_simple_command, in the child forked if there is a pipe
+         or the command is asynchronous, set subshell_environment to
+         SUBSHELL_ASYNC only if the command is asynchronous, SUBSHELL_FORK
+         if there is a pipe in or out
+         [in bash-2.02.1]
+
+                                  4/27
+                                  ----
+support/texi2dvi
+       - upgraded to version 0.8 (from 0.5)
+
+support/texi2html
+       - upgraded to version 1.52 (from 1.51)
+
+support/config.sub
+       - config.sub now recognizes all the permutations of the system name
+         that config.guess produces for alphas
+         [in bash-2.02.1]
+
+aclocal.m4
+       - changed BASH_TYPE_INT32_T, BASH_TYPE_U_INT32_T, and
+         BASH_TYPE_PTRDIFF_T to avoid compiling a program; instead use
+         the values determined by the AC_CHECK_SIZEOF tests to determine
+         the default values to supply to AC_CHECK_TYPE
+
+configure.in
+       - don't call AC_CHECK_TYPE({int32_t,u_int32_t,ptrdiff_t}) from
+         configure.in; use the updated BASH_TYPE macros instead
+
+builtins/exec.def
+       - if shell_execve fails, set ARGS to null because the realloc() call
+         by shell_execve may have caused it to be reallocated and freed --
+         we don't want to free the memory twice
+
+lib/glob/fnmatch.c
+       - fixes from ache@nagual.pp.ru to make fnmatch work for eight-bit
+         characters when `isupper' and `islower' are used -- they were
+         restricted to ASCII characters before, probably to work around
+         some ancient, broken C libraries in which is{low,upp}er are valid
+         only for ASCII characters and return bogus values otherwise
+         [in bash-2.02.1]
+
+                                  4/29
+                                  ----
+builtins/cd.def
+       - fixed a problem with the shell displaying the old working directory
+         instead of the new one after changing to a directory found via
+         $CDPATH when in physical mode (set -o physical)
+         [in bash-2.02.1]
+
+make_cmd.c
+       - make make_cond_command initialize the line number from the cond_node
+         that's passed as an argument (not that it's used right now)
+
+copy_cmd.c
+       - make sure that copy_cond_command copies the type of the cond command,
+         since execute_cond_command uses that to decide what kind of test
+         to perform
+         [in bash-2.02.1]
+
+builtins/printf.def
+       - make sure the for loop that processes the format string actually
+         consumes arguments; otherwise process it only once to avoid
+         infinite loops (e.g., `printf " " abc def ghi')
+         [in bash-2.02.1]
+       - if the format string is empty after preprocessing by ansicstr,
+         return immediately
+         [in bash-2.02.1]
+
+tests/run-printf
+       - use `diff -a' so the presence of a non-printing character in the
+         output doesn't confuse diff into thinking the files are binary
+         (test whether or not `diff' supports `-a' first)
+
+Makefile.in
+       - keep $(LOCAL_LIBS) from being specified twice
+
+                                  4/30
+                                  ----
+support/shobj-conf
+       - a script to generate variables to do shared object configuration
+         for the loadable builtin stuff
+
+configure.in
+       - added a section for shared object configuration using an `eval'
+         of the output of shobj-conf and substituting the generated values
+         with AC_SUBST
+
+examples/loadables/Makefile.in
+       - the system-specific shared object configuration variables are now
+         substituted by configure
+
+                                   5/4
+                                   ---
+builtins/ulimit.def
+       - some changes for HPUX 9.x's peculiar handling of RLIMIT_FILESIZE
+       - changed the limit retrieval functions to return an error code
+         and the value in a reference argument to avoid use of RLIM_INVALID
+
+general.c
+       - new function, get_group_array(), which returns an array of
+         gids
+
+examples/loadables/{id,printenv,sync,uname,whoami,push}.c
+       - new loadable builtins
+
+variables.c
+       - moved code that initializes $PPID into a new function, set_ppid()
+
+variables.h
+       - extern declaration for set_ppid()
+
+                                   5/6
+                                   ---
+subst.c
+       - make sure that the `"' (double-quoted string) case of
+         expand_word_internal calls string_list_dollar_at if we've expanded
+         a double-quoted $@ so correct splitting on $IFS is done when
+         the expansion is complete.  We can't simply call string_list
+         because that forces a space separator, and $IFS may not contain
+         a space
+         [in bash-2.02.1]
+
+                                   5/7
+                                   ---
+builtins/umask.def
+       - broke the code that parses a symbolic mode out of symbolic_umask
+         into a separate function that takes a symbolic mode and an initial
+         set of bits to modify
+
+examples/loadables/mkdir.c
+       - new loadable builtin
+
+                                  5/11
+                                  ----
+builtins/printf.def
+       - use the format string length provided by ansicstr() to process the
+         format string, rather than testing for nullness, to handle NUL
+         bytes in the expanded format string
+
+builtins/pushd.def
+       - changes so it can be built as both a regular builtin and a loadable
+         builtin from the same source
+
+examples/loadables/Makefile.in
+       - changes to build pushd.c from ${topdir}/builtins/pushd.def and then
+         compile it with the correct flags to make it a loadable builtin,
+         even if PUSHD_AND_POPD is not defined in config.h
+
+                                  5/12
+                                  ----
+lib/readline/complete.c
+       - use rl_completer_quote_characters instead of #ifdef SHELL/#endif
+         code in make_quoted_replacement.  This means complete.c no longer
+         has any #ifdef SHELL code
+
+                                  5/13
+                                  ----
+builtins/Makefile.in
+       - `make clean' should remove mkbuiltins.o
+
+Makefile.in
+       - all of the various `clean' targets need to descend into lib/sh
+         and run the appropriate target there
+
+builtins/type.def
+       - changed to use the builtin getopt.  The old long options are
+         handled by prescanning the argument list looking for the long
+         options, processing them, and taking them out of the list before
+         passing it to internal_getopt()
+
+lib/readline/signals.c
+       - removed #ifdef SHELL code -- job control signals and SIGTERM are
+         always set in rl_set_signals, but are set to SIG_IGN if the old
+         handler was SIG_IGN (as bash sets it)
+       - new function rl_maybe_set_sighandler, which sets the signal
+         disposition back to SIG_IGN if the old handler was SIG_IGN
+       - removed #ifdef HANDLE_JOB_SIGNALS and #ifdef HANDLE_SIGTERM code
+
+lib/readline/rltty.c
+       - removed #ifdef SHELL code -- set_winsize is always called
+         to force the application to stop if it's not in the foreground
+         before getting the tty attributes
+
+                                  5/14
+                                  ----
+lib/readline/signals.c
+       - readline now catches SIGQUIT and cleans up the tty before resending
+         it to its container application (unless the calling application has
+         set the disposition of SIGQUIT to be SIG_IGN)
+       - rl_handle_sigwinch is now called rl_sigwinch_handler
+       - rl_sigwinch_handler now calls rl_resize_terminal to fetch the
+         screen size after a SIGWINCH
+       - the sighandler_cxt struct for non-posix systems now includes
+         sa_flags and sa_mask variables, for future use
+       - new variable, rl_catch_signals, indicating that readline should
+         install its own signal handlers for SIGINT, SIGTERM, SIGQUIT,
+         SIGALRM, SIGTSTP, SIGTTIN, and SIGTTOU
+       - new variable, rl_catch_sigwinch, indicating that readline should
+         install its own SIGWINCH handler, which will chain to a calling
+         application's SIGWINCH handler
+       - new function, rl_free_line_state(), to free up variable state
+         associated with the current line after receiving a signal
+       - new function, rl_cleanup_after_signal(), to clean up the display
+         and terminal state after receiving a signal
+       - new function, rl_reset_after_signal(), to reinitialize the
+         terminal state after a signal handler returns and readline
+         continues
+       - rl_set_signals and rl_clear_signals now look at the values of
+         rl_catch_signals and rl_catch_sigwinch
+
+lib/readline/terminal.c
+       - new function rl_resize_terminal (), to reset readline's idea of
+         the screen size after a SIGWINCH
+
+lib/readline/readline.h
+       - extern declarations for rl_resize_terminal(), rl_free_line_state(),
+         rl_cleanup_after_signal(), rl_reset_after_signal()
+       - extern declarations for rl_catch_signals and rl_catch_sigwinch
+
+variables.c
+       - new functions, get_env_value(char *) and get_home_dir(void) to
+         satisfy references from the tilde and readline libraries when
+         they are compiled as part of bash
+
+lib/tilde/tilde.c
+       - rely on extern declarations of get_env_value and get_home_dir;
+         there is no more #ifdef SHELL code
+
+lib/readline/shell.c
+       - implementation of get_home_dir that uses getpwuid() to satisfy
+         references from tilde.c when not compiled as part of bash
+       - removed savestring()
+       - removed #ifdef SHELL/#endif pair -- all of these functions will be
+         resolved from bash when readline is linked into bash
+
+lib/readline/savestring.c
+       - new file, with function definition for savestring() for backwards
+         compatibility
+
+Makefile.in, _distribution
+       - bumped things up to bash-2.03-alpha
+
+                                  5/15
+                                  ----
+lib/readline/rlconf.h
+       - removed #ifdef SHELL/#endif pair, so the callback stuff will be
+         compiled into libreadline, but never linked into bash (since it's
+         not referenced)
+
+configure.in
+       - added new `--with-installed-readline' option to allow readline to
+         be linked with an already-installed version -- this will probably
+         not work with versions of readline prior to 2.3 (libreadline.so.4)
+         [THIS IS STILL UNDOCUMENTED]
+
+Makefile.in
+       - changed necessary variables to allow the `--with-installed-readline'
+         option to work; shared and static libraries are supported
+
+                                  5/18
+                                  ----
+lib/readline/display.c
+       - _rl_save_prompt is now rl_save_prompt; _rl_restore_prompt is now
+         rl_restore_prompt
+
+lib/readline/readline.h
+       - extern declarations for rl_save_prompt and rl_restore_prompt
+
+lib/readline/{search,isearch,readline,display}.c
+       - converted calls to _rl_{save,restore}_prompt () to use new public
+         versions
+
+lib/readline/doc/rltech.texinfo
+       - documented new public functions rl_{save,restore}_prompt
+
+                                  5/19
+                                  ----
+lib/readline/readline.c
+       - new hook function variable, rl_pre_input_hook.  If non-zero, it's
+         called from readline_internal_setup just before it returns and
+         readline starts reading input
+
+lib/readline/readline.h
+       - extern declaration for rl_pre_input_hook
+
+lib/readline/doc/rltech.texinfo
+       - documented new variable rl_pre_input_hook
+
+                                  5/20
+                                  ----
+lib/readline/complete.c
+       - new hook function variable, rl_completion_display_matches_hook.
+         If non-null, this function is called when readline would normally
+         display the list of completion matches
+
+lib/readline/readline.h
+       - extern declaration for rl_completion_display_matches_hook
+
+lib/readline/doc/rltech.texinfo
+       - documented rl_completion_display_matches_hook
+
+lib/readline/readline.c
+       - if RL_LIBRARY_VERSION is not defined, define it to 4.0 to match
+         the version number of the shared libraries
+
+lib/readline/doc/{hist,rlman}.texinfo
+       - changed the version and edition to 4.0 to match the library version
+
+support/config.guess
+       - added case clause for matching UnixWare 7 from SCO (SVR5) -- further
+         work may be needed 
+         [These fixes were in a usenet posting from hops@sco.com]
+
+support/config.sub
+       - added case clauses to recognize various aliases for SCO Open Server
+         and Open Desktop
+         [in bash-2.02.1]
+       - broke the code that canonicalizes unixware into unixware2 and
+         unixware7 clauses (multiple places)
+         [in bash-2.02.1]
+       - added clause to recognize `sysv5' for SVR5
+         [These fixes were in a usenet posting from hops@sco.com]
+         [in bash-2.02.1]
+
+configure.in
+       - add `-b elf' to LOCAL_CFLAGS for sco3.2v5* to allow dynamic linking
+         (and loadable builtins)
+       - add AC_DEFINE(SVR5) on SVR5 (unixware 7)
+
+config.h.in
+       - add #undef SVR5, set by configure
+
+                                  5/21
+                                  ----
+shell.c
+       - line-buffer stdout and stderr in shell_initialize only if
+         shell_initialized is 0 on all systems, not just SunOS 5
+         [in bash-2.02.1]
+
+support/rlvers.sh
+       - script to print out the version number of any installed
+         readline library
+
+configure.in
+       - only allow --with-installed-readline if the version of the
+         installed readline library is 4.0 or greater
+
+                                  5/22
+                                  ----
+lib/readline/complete.c
+       - broke the code that actually displays a list of completion
+         matches on the output stream into a separate public function,
+         rl_display_match_list, so it can be called from the hook
+         function rl_completion_display_matches_hook.
+
+lib/readline/readline.h
+       - new extern declaration for rl_display_match_list
+
+lib/readline/rltech.texinfo
+       - documented rl_display_match_list
+
+configure.in,Makefile.in
+       - --enable-static-link now creates a STATIC_LD variable in Makefile
+         rather than adding to LDFLAGS directly.  LDFLAGS now includes
+         $(STATIC_LD)
+
+                                   6/2
+                                   ---
+builtins/cd.def
+       - OLDPWD is now auto-exported
+       - broke the code out of bindpwd() that updated the value of PWD in
+         the export environment in-place and made it general, so it can
+         be used for OLDPWD, too (this should be made *more* general, and
+         moved to variables.c)
+
+                                   6/3
+                                   ---
+variables.c
+       - moved builtins/cd.def:export_pwd_var to here, renamed it to
+         update_export_env_inplace
+       - converted put_command_name_into_env to just call
+         update_export_env_inplace
+       - made dummy variable for OLDPWD, marked as invisible and exported,
+         in initialize_shell_variables
+
+variables.h
+       - extern declaration for update_export_env_inplace
+
+builtins/cd.def
+       - changed calls to export_pwd_var to update_export_env_inplace
+
+lib/readline/bind.c
+       - added missing return in rl_unbind_function_in_map
+       - changed _rl_read_file to check whether or not `read' returns
+         < 0 rather than < file_size
+       - _rl_read_init_file needs to free `openname' after calling
+         _rl_read_file, since it's not used again
+
+lib/readline/callback.c
+       - bogus extern declaration for `readline_internal_startup', should
+         be readline_internal_setup
+
+lib/readline/histfile.c
+       - read_history_range now checks whether read(2) returns < 0 rather
+         than checking the return value against the file size
+
+lib/readline/parens.c
+       - whoops -- timer.tv_usec is *micro* seconds, not milliseconds
+
+lib/readline/readline.c
+       - initialize `eof' to 1 in readline_internal_charloop
+
+                                   6/5
+                                   ---
+configure.in
+       - if we're configuring with an installed version of readline, set and
+         have configure substitute RL_INCLUDE to `-I$(includedir)', so the
+         build process uses the installed readline include files as well as
+         the libraries
+
+Makefile.in, builtins/Makefile.in
+       - add @RL_INCLUDE@ in the appropriate places, substituted by configure
+
+lib/readline/{history,readline}.h
+       - add `extern "C"' wrapper if `__cplusplus' is defined
+
+lib/glob/fnmatch.h
+       - include stdc.h
+       - add prototypes to extern declaration for fnmatch()
+
+lib/readline/rlstdc.h
+       - link to ../posixheaders/stdc.h (in readline lib with different name
+         for benefit of standalone readline library installation)
+
+lib/readline/{history,keymaps}.h
+       - include rlstdc.h
+       - add prototypes to all of the extern function declarations
+
+lib/readline/history.h
+       - the `data' member of a HIST_ENTRY is now a histdata_t, which is
+         either a void * (ansi c) or a char * (k&r c)
+
+lib/readline/readline.c
+       - changed calls to replace_history_entry to pass a histdata_t as the
+         third parameter
+
+                                   6/8
+                                   ---
+copy_cmd.c
+       - make sure that copy_cond_command doesn't blindly try to copy
+         com->op, since that will be null for AND and OR nodes, at least
+         [in bash-2.02.1]
+
+lib/readline/vi_mode.c
+       - added missing second argument to rl_vi_[fbe][Ww]ord(), since
+         they're used as pseudo-bindable commands (they appear in the
+         default funmap) as well as utility functions
+
+lib/readline/readline.h
+       - include rlstdc.h
+       - added prototypes for functions from vi_mode.c, util.c, terminal.c,
+         search.c, util.c, undo.c, readline.c, parens.c, macro.c, kill.c,
+         keymaps.c, isearch.c, input.c, funmap.c, display.c, complete.c,
+         callback.c, 
+       - added extern declarations for functions from rltty.c
+
+lib/readline/{readline,util}.c
+       - rl_refresh_line now takes the standard two arguments for bindable
+         commands; changed callers
+
+lib/readline/*.c
+       - small cleanups for incorrect arguments, etc. uncovered by use of
+         function prototypes
+
+bashline.c
+       - small cleanups for incorrect arguments, etc. uncovered by use of
+         function prototypes
+
+                                  6/11
+                                  ----
+jobs.c
+       - cast result of strsignal() to (char *) for the benefit of broken
+         Cray UNICOS machines
+         [in bash-2.02.1]
+
+configure.in,aclocal.m4
+       - new test, BASH_TYPE_BITS64_T, used to find out what basic type is
+         64 bits long; defaults to `double'
+       - call AC_CHECK_SIZEOF(double)
+
+config.h.in
+       - #define for bits64_t, undef by default
+
+                                  6/24
+                                  ----
+aclocal.m4
+       - changed BASH_TYPE_BITS64_T so that it checks the size of a char *
+         first, before trying sizeof(double)
+
+lib/readline/doc/rluser.texinfo,doc/{bash.1,readline.3}
+       - changed default binding for tilde-expand to M-&, since bash
+         overrides M-~ to force username completion
+
+bashline.c
+       - fixed an off-by-one error in hostnames_matching that exhibited
+         itself when an exact multiple of 16 hostnames matched (fix
+         from <davidg@nikhef.nl>)
+         [in bash-2.02.1]
+
+                                  6/30
+                                  ----
+lib/readline/readline.c
+       - the maximum numeric argument is now 1000000
+
+bashline.c
+       - fixed a bug in bash_directory_completion_hook that caused memory
+         to be freed twice if a directory name containing an unset
+         variable was completed and `set -u' had been set
+
+configure.in
+       - on LynxOS, add a -DRECYCLES_PIDS to LOCAL_CFLAGS
+
+execute_cmd.c
+       - make sure that the changes to make the shell fork early when
+         run in the background do not cause commands such as `%1 &'
+         to fork
+         [in bash-2.02.1]
+       - if RECYCLES_PIDS is defined, execute_command_internal sets
+         last_made_pid to NO_PID after waiting for a foreground process,
+         if the return status is 0 (fix from plai@Lynx.COM (Paul Lai))
+
+lib/readline/kill.c
+       - fixes from Andreas Schwab to rl_yank_last_arg that make it
+         behave better
+
+lib/readline/input.c
+       - fixes from Donald Beaudry <donb@sgi.com> to make the input buffering
+         and rl_stuff_char work right when the input buffer is nearly full
+         (probably not a problem with keyboard input, but maybe a problem
+         with programmers attempting to use rl_stuff_char to preload the
+         input buffer)
+
+                                  7/14
+                                  ----
+parse.y
+       - fix to decode_prompt_string so that the \$ expansion quotes the `$'
+         so it won't be processed by subsequent parameter expansion
+       - change read_token_word so a $$ appearing in a token is recognized
+         and parsed immediately, so a single or double quote after the
+         second `$' doesn't cause ANSI-C expansion or locale translation
+         (bug report from haertel@ichips.intel.com)
+
+                                  7/16
+                                  ----
+lib/readline/display.c
+       - fixed a bug that caused core dumps in xrealloc if the prompt was
+         longer than 1024 characters
+
+                                  7/21
+                                  ----
+builtins/mkbuiltins.c
+       - if the number of characters read from the .def file is less than
+         the file size reported by `stat', and the read completed without
+         errors, reset the file size to avoid writing garbage at the end
+         of the generated .c file (needed on WIN32 systems, doesn't hurt
+         on Unix)
+
+                                  7/22
+                                  ----
+CWRU/empty-for-wordlist
+       - patch from Brian Fox for parse.y to allow bash to accept an empty
+         `wordlist' after the `in' keyword in a for statement
+
+                                  7/23
+                                  ----
+doc/bash.1
+       - corrected the synopsis of the `for' and `select' statements to
+         indicate that the semicolon (or newline) after the optional
+         `in words' is required
+
+[bash-2.02.1 released]
+
+                                  7/28
+                                  ----
+lib/readline/display.c
+       - make sure visible_length is initialized to 0 in rl_expand_prompt.
+         Fix from Gerhard Niklasch <nikl@mathematik.tu-muenchen.de>.
+
+lib/glob/glob.c
+       - make sure that quotes are removed from the filename being globbed
+         in glob_vector() before calling the GLOB_TESTNAME macro if there
+         are no globbing characters in the pattern
+
+doc/Makefile.in
+       - make sure that builtins.1 is looked for in $(srcdir) when running
+         `make install' (it's still commented out, though)
+
+                                  7/30
+                                  ----
+config.h.bot
+       - if PROMPT_STRING_DECODE is not defined, define PPROMPT (the primary
+         prompt string) as "$ "
+
+variables.c
+       - if PROMPT_STRING_DECODE is not defined, and current_user.euid == 0,
+         PS1 defaults to "# ", otherwise it defaults to `primary_prompt'
+
+doc/bashbug.1
+       - fixed email address prep.ai.mit.edu -> gnu.org
+
+                                   8/3
+                                   ---
+support/shobj-conf
+       - add `solaris2' as a possible OS name, treated the same as sunos5
+
+                                   8/4
+                                   ---
+shell.c
+       - changed maybe_make_restricted() so that $ENV and $BASH_ENV are
+         read-only variables in a restricted shell
+
+doc/{bash.1,bashref.texi}
+       - added ENV and BASH_ENV to the list of readonly variables in
+         restricted mode
+
+parse.y
+       - added `do', `then', `else', `{', and `(' to the list of keywords
+         that may precede the `time' reserved word
+
+general.c
+       - added sanity checks to timeval_to_secs and clock_t_to_secs so
+         that if the fractional part is >= 1000, 1 is added to the
+         seconds and 1000 is subtracted from the fractional seconds
+
+                                   8/6
+                                   ---
+Makefile.in
+       - use $(CC_FOR_BUILD) to build mksignames
+
+configure.in
+       - changes to allow cross-building for BeOS as well as cygwin32
+
+cross-build/{beos-sig.h,x86-beos.cache}
+       - new files for cross-compiling for BeOS
+
+                                   8/7
+                                   ---
+Makefile.in
+       - changed rule for version.h to use && instead of if-then-else-fi to
+         make sure the recipe fails if mkversion.sh fails
+
+configure.in
+       - beos does not use the GNU malloc
+
+lib/sh/itos.c
+       - broke itos into inttostr(i, buf, len) and itos(i), which calls
+         inttostr and returns a newly-allocated string with the result
+
+support/mksignames.c
+       - define `SIGKILLTHR' if system include files define it
+
+externs.h
+       - extern declaration for inttostr(int, char *, int)
+
+                                  8/13
+                                  ----
+lib/sh/strtol.c
+       - include stdc.h before bashansi.h
+
+execute_cmd.c
+       - make sure that execute_cond_node treats `=' the same as `=='
+
+                                  8/25
+                                  ----
+variables.c, print_cmd.c
+       - changed some calls to itos to use inttostr instead
+
+cross-build/x86-beos.cache, {execute_cmd,general,shell,trap}.c
+       - some changes for BeOS (from fnf@ninemoons.com)
+
+lib/posixheaders/memalloc.h
+       - changes to handle case where we're using both gcc and the C
+         version of alloca(), or if we have alloca.h and we're using
+         the C version of alloca() (from fnf@ninemoons.com)
+
+lib/sh/oslib.c
+       - if bcopy or bzero are #defines, #undef them before defining
+         replacement functions
+
+support/config.guess
+       - recognize AmigaOS (from fnf@ninemoons.com)
+       - recognize BeOS running on various machines
+         (from fnf@ninemoons.com)
+
+support/config.sub
+       - change basic_machine definition for amiga; added amigaos
+         (from fnf@ninemoons.com)
+       - changed definitions for MIPS machines running Linux (from
+         fnf@ninemoons.com)
+       - recognize `beos' as a valid operating system
+         (from fnf@ninemoons.com)
+       - changed OS for *-cbm to `amigaos' rather than `amigados'
+         (from fnf@ninemoons.com)
+
+examples/functions/autoload.v3
+       - a new version, from Mark Kennedy <mtk@ny.ubs.com>
+
+lib/readline/readline.c
+       - new function, rl_delete_or_show_completions, like tcsh editing
+         function delete-char-or-list
+
+lib/readline/readline.h
+       - new extern declaration for rl_delete_or_show_completions
+
+lib/readline/funmap.c
+       - new bindable name `delete-char-or-list', like tcsh
+
+lib/readline/doc/rluser.texinfo, doc/{bash.1,readline.3}
+       - documented new delete-char-or-list command
+
+general.c
+       - fix full_pathname to keep it from generating things like
+         //foo when the current directory is /
+
+                                  8/27
+                                  ----
+builtins/fc.def
+       - fixed the help text for the -e option
+
+                                  8/28
+                                  ----
+support/shobj-conf
+       - added a clause for AIX 4.2 systems running gcc -- just the
+         standard gcc stuff for shared objects, but it has to come
+         before the other AIX 4.2 clause
+
+                                  8/31
+                                  ----
+shell.c
+       - some changes so that `set -e' is turned off while executing
+         the startup files
+
+                                   9/3
+                                   ---
+flags.c
+       - new variable, `restricted_shell', non-zero if the shell was
+         started in restricted mode
+
+flags.h
+       - extern declaration for restricted_shell
+
+shell.c
+       - new function, shell_is_restricted, returns 1 if the shell is
+         supposed to be restricted based on the basename of $0 or the
+         -r option
+       - set restricted_shell to the value returned by shell_is_restricted
+         before executing the startup files
+
+externs.h
+       - extern declaration for shell_is_restricted
+
+builtins/shopt.def
+       - new shopt variable, restricted_shell, indicates whether the shell
+         was restricted at startup -- useful in startup files
+
+doc/{bash.1,bashref.texi}
+       - documented new restricted_shell shopt option
+
+                                  9/15
+                                  ----
+lib/sh/rename.c
+       - new file, replacement for rename(2) if the OS doesn't provide it
+
+configure.in,config.h.in,Makefile.in,lib/sh/Makefile.in
+       - machinery for including rename.o in libsh.a
+
+nojobs.c
+       - make sure that set_tty_state returns a value
+
+builtins/mkbuiltins.c
+       - use a call to rename(2) instead of a link/unlink pair
+
+lib/glob/glob.c
+       - don't #define bcopy if bcopy is already defined
+
+lib/readline/histfile.c
+       - add a call to ftruncate for BeOS, which ignores the O_TRUNC flag
+         to open
+
+lib/readline/input.c
+       - make rl_getc loop if read returns -1/EINTR on BeOS
+
+configure.in
+       - set ARFLAGS and substitute it into the Makefiles
+
+{,builtins,lib/{glob,malloc,readline,sh,termcap,tilde}}/Makefile.in
+       - ARFLAGS is now substituted by configure
+       - use ARFLAGS in rules that create libraries using $(AR)
+
+builtins/printf.def
+       - fixed bug that caused a core dump when a modifier was supplied
+         in the format string without a conversion character (e.g. `%h')
+
+                                  9/17
+                                  ----
+lib/glob/glob.c
+       - if filenames starting with a dot don't have to be matched
+         explicitly (e.g., after a `shopt -s dotglob'), don't match
+         `.' or `..' in any case
+
+eval.c
+       - make sure that array assignments don't show up in the history list
+         (fix from Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>)
+
+lib/readline/complete.c
+       - fix to rl_menu_complete so it inserts a single completion properly
+         when a word matches only one filename
+
+                                  9/24
+                                  ----
+execute_cmd.c
+       - difftimeval should zero out the tv_usec field if the tv_sec field
+         is < 0
+       - addtimeval should check for tv_usec being == 1000000 and add one
+         to tv_sec if it is
+
+                                  9/25
+                                  ----
+subst.c
+       - fix to expand_word_internal to prevent non-whitespace IFS characters
+         from causing word splitting if they are not the results of an
+         expansion (not exactly right yet, but I think it's the result of a
+         problem with the ${...} end-brace-matching code in the parser)
+
+                                  9/28
+                                  ----
+parse.y
+       - new flag for parse_matched_pair -- P_FIRSTCLOSE -- which makes it not
+         count and match additional construct open characters
+       - change calls to parse_matched_pair when matching braces in
+         ${...} constructs (both unquoted and within double quotes) to
+         specify the P_FIRSTCLOSE flag to match POSIX.2 requirements
+
+subst.c
+       - changed fix from 9/25, now that the parser problem is fixed
+
+                                  9/30
+                                  ----
+variables.c
+       - change expansion of list of words between (...) in array assignments
+         to include pathname generation in assign_array_var_from_string
+
+doc/{bash.1,bashref.texi}
+       - clarified behavior of the shell at startup if running setuid, with
+         and without the -p option supplied
+
+                                  10/7
+                                  ----
+bashhist.c
+       - change default open(2) mode to 0600 instead of 0666 for `privacy
+         concerns'
+
+                                  10/13
+                                  -----
+lib/readline/display.c
+       - fixed a problem with displaying tabs after newlines, from
+         <qrczak@knm.org.pl>
+       - in update_line, if we are printing over existing material,
+         only call space_to_eol or _rl_clear_to_eol if lendiff is non-zero
+       - when moving the cursor in _rl_move_cursor_relative, only call
+         _rl_backspace if the current cursor position is strictly greater
+         than the desired cursor position
+
+                                  10/14
+                                  -----
+locale.c
+       - LC_ALL is no longer set automatically when LANG is assigned a value
+
+config.h.{top,bot}
+       - renamed to config-{top,bot}.h, respectively
+
+config.h.in
+       - include config-top.h and config-bot.h
+
+Makefile.in
+       - things now depend on config-top.h and config-bot.h
+
+subst.c
+       - minor changes to extract_dollar_brace_string and char_is_quoted to
+         allow things like "${PIP[TAB] to perform correct variable completion
+
+                                  10/15
+                                  -----
+builtins/Makefile.in
+       - add $(PROFILE_FLAGS) to the make recipe that creates `mkbuiltins',
+         so configuring with --enable-profiling works right
+
+                                  10/20
+                                  -----
+doc/bashref.texi
+       - documented the new --with-installed-readline option
+
+[bash-2.03-alpha1 frozen]
+
+                                  10/21
+                                  -----
+builtins/reserved.def
+       - fixed help text for { ... } to make it clear that a semicolon is
+         required before the closing brace
+
+                                  10/22
+                                  -----
+trap.c
+       - in decode_signal, don't bother calling strcasecmp if
+         signal_names[sig] is null or empty
+
+                                  11/2
+                                  ----
+configure.in
+       - make sure RL_LIBDIR and HIST_LIBDIR are assigned values even if
+         readline or history is configured out of the shell, so the -L
+         options have arguments in the link command
+
+test.c
+       - make test_syntax_error cause test to return a status > 1, to
+         conform to POSIX.2 4.62.8
+
+doc/readline.3
+       - make sure the SYNOPSIS section indicates that programmers should
+         include <stdio.h> before <readline.h>
+
+                                  11/9
+                                  ----
+Makefile.in
+       - install with explicit mode of 0755
+
+                                  11/10
+                                  -----
+builtins/test.def
+       - make sure that a missing `]' makes `[' exit with status 2, to
+         conform to POSIX.2 4.62.8
+
+command.h
+       - new word flag: W_NOGLOB, meaning to not perform globbing
+
+execute_cmd.c
+       - fix_assignment_statements now turns on the W_NOGLOB flag for
+         arguments to `assignment builtins' that have W_ASSIGNMENT set
+
+subst.c
+       - expand_word_internal needs to preserve the W_NOGLOB flag from
+         the word being expanded to the word being returned
+       - glob_expand_word_list does not call shell_glob_filename for a
+         word with W_NOGLOB set
+
+builtins/shopt.def
+       - print_shopt is now void
+
+configure.in
+       - machines running Rhapsody don't use the bash malloc
+       - pass host_vendor to the Makefiles with AC_SUBST
+
+support/config.guess
+       - Rhapsody is really rhapsody, not nextstep
+
+support/config.sub
+       - add rhapsody to the list of supported configurations
+
+Makefile.in
+       - pass CONF_HOSTTYPE, CONF_OSTYPE, and CONF_MACHTYPE as -D options
+         in SYSTEM_FLAGS, to indicate that they came from the configuration
+         process
+       - set VENDOR variable from host_vendor configuration variable
+       - pass CONF_VENDOR as part of SYSTEM_FLAGS
+
+variables.c
+       - define HOSTTYPE, OSTYPE, and MACHTYPE as CONF_HOSTTYPE, CONF_OSTYPE,
+         and CONF_MACHTYPE, respectively
+
+                                  11/11
+                                  -----
+doc/{bashref.texi,bash.1}
+       - updated description of `read' to clarify the -r option and its
+         effect on backslash escaping
+
+                                  11/13
+                                  -----
+examples/loadables/{ln,unlink}.c
+       - new loadable builtins
+
+                                  11/23
+                                  -----
+lib/glob/fnmatch.c
+       - some fixes to handle extended glob patterns immediately following
+         a `*'
+
+tests/extglob.tests
+       - updated with cases from bug report fixed today
+
+support/shobj-conf
+       - udpated stanza for aix 4.2 with gcc, based on information from
+         jik@cisco.com
+
+configure.in
+       - changes to add the correct linker options to allow dynamic linking
+         when using gcc on AIX 4.2, instead of insisting on the AIX C
+         compiler
+
+examples/misc/aliasconv.{bash,sh}
+       - changes to handle aliases with embedded single quotes
+
+                                  11/25
+                                  -----
+lib/readline/complete.c
+       - postprocess_matches should call compute_lcd_of_matches with an
+         argument of `t' instead of `text'
+       - postprocess_matches should never call ding(); leave that for the
+         callers
+       - postprocess_matches no longer needs `text' as the first argument
+       - rl_complete_internal needs to call ding() if postprocess_matches
+         returns 0, since postprocess_matches no longer does it
+       - rl_complete_internal can now free `text' immediately after calling
+         gen_completion_matches, since it's no longer used
+
+                                  11/30
+                                  -----
+print_cmd.c
+       - make sure redirections following compound commands have a space
+         separating them from the command
+
+                                  12/1
+                                  ----
+general.c
+       - changed canonicalize_pathname so that if the result path begins
+         with `//', it will be changed to `/' if and only if the original
+         path did not begin with `//' (there has to be a non-slash after
+         the leading `///' in the original path)
+
+                                  12/2
+                                  ----
+builtins/evalstring.c
+       - augment the test for turning on CMD_NO_FORK to make sure that
+         parse_and_execute_level == 1.  That takes care of things like
+
+               bash -c 'for f in 1 2 3; do eval "/bin/echo \"$f\"" ; done'
+
+         only printing one line of output
+
+                                  12/8
+                                  ----
+config-top.h
+       - add commented-out #define for NON_INTERACTIVE_LOGIN_SHELLS so
+         that users may, if they choose, make things like
+
+               #! /bin/bash --login
+
+         work in shell scripts
+
+                                  12/10
+                                  -----
+jobs.c
+       - changes to the way jobs are reaped when the shell is not
+         interactive:
+
+               o notify_of_job_status no longer marks dead jobs as
+                 notified if they did not exit due to a signal;
+               o changed mark_background_jobs_as_notified to take an
+                 argument `force':  if zero, we only mark enough
+                 dead jobs as notified to keep CHILD_MAX jobs in the
+                 jobs list, as POSIX.2 specifies.  If non-zero, mark
+                 all dead jobs as notified;
+               o wait_for_background_pids marks all dead jobs as
+                 notified when it has finished waiting for everything,
+                 since the only thing that calls it is the `wait' builtin;
+               o wait_for_single_pid marks a job as notified after it
+                 has completed, since the only things that call it are
+                 wait_for_background_pids and the `wait' builtin
+               o wait_for_job marks the job as notified after the last
+                 pid completes
+
+execute_cmd.c
+       - change execute_subshell_builtin_or_function to check
+         subshell_environment and pipe_out to decide whether or not to fork
+         if builtin == jobs_builtin, since the early-forking code added in
+         bash-2.02 means that the piping has probably already been done
+
+                                  12/15
+                                  -----
+parse.y
+       - changes to make avar=((...)) a syntax error instead of ignoring
+         the nested parens and treating it as an array assignment
+
+shell.c
+       - changed run_startup_files so that any shell, whether or not it is
+         interactive, will run the login shell startup files when given the
+         --login option.  This happens only when not in posix mode.
+
+builtins/enable.def
+       - changes to handle Tenon's MachTen, whose dlclose() does not return
+         a value
+
+lib/glob/fnmatch.c
+       - changed gmatch so that when it calls extmatch, it removes FNM_PERIOD
+         from the flags if it's not matching at the start of the string.
+         This fixes the problem of `@' and `+' extended-glob subpatterns
+         containing bracket expressions treating `.' specially when matching
+         a portion of the string starting with `.'
+
+config-top.h
+       - removed define for NON_INTERACTIVE_LOGIN_SHELLS, since it's no longer
+         necessary
+
+                                  12/17
+                                  -----
+lib/readline/complete.c
+       - change rl_complete_internal and rl_menu_complete to check
+         rl_filename_completion_desired to decide whether or not we're
+         completing filenames instead of checking whether the attempted
+         completion function is filename_completion_function.
+         filename_completion_function sets rl_filename_completion_desired,
+         so this shouldn't break anything -- just allow postprocessing of
+         matches for user-supplied filename completion functions that don't
+         call filename_completion_function
+
+lib/readline/display.c
+       - new function, _rl_erase_entire_line, which erases the entire line,
+         no matter where the cursor is, and puts the cursor at the beginning
+         of the (newly-empty) line
+
+lib/readline/readline.c
+       - new application-level variable, rl_erase_empty_line, which, if
+         non-zero, tells readline to erase the contents of the current line,
+         prompt and all, if the only character typed to an otherwise-blank
+         line is bound to rl_newline.  Requested by the Cygnus GDB folks.
+       - change to rl_newline to suppress the call to _rl_update_final if
+         rl_erase_empty_line is non-zero, and rl_point == rl_end == 0, since
+         _rl_update_final calls crlf()
+       - change to readline_internal_charloop to call _rl_erase_entire_line
+         if newline was the only thing typed on an otherwise-empty line
+
+lib/readline/readline.h
+       - extern declaration for rl_erase_empty_line
+
+lib/readline/doc/rltech.texinfo
+       - documented new rl_erase_empty_line variable
+
+                                  12/18
+                                  -----
+Makefile.in
+       - changed RELSTATUS to `beta1'
+
+[bash-2.03-beta1 frozen]
+
+                                  12/21
+                                  -----
+doc/{bash.1,bashref.texi}
+       - added description of `test -h'; equivalent to `test -L'
+
+                                  12/22
+                                  -----
+support/shobj-conf
+       - SHOBJ_LDFLAGS should be those options to ld which are common
+         between building dynamically loadable shared objects and shared
+         libraries
+       - added two new variables: SHOBJ_XLDFLAGS, which are ld options
+         specific to building dynamically loaded shared objects, and
+         SHLIB_LIBS, which are other libraries against which shared libraries
+         should be linked.  These are for the benefit of AIX 4.2; other
+         stanzas do not need to be changed.
+
+configure.in
+       - add call to AC_SUBST for SHOBJ_XLDFLAGS
+
+examples/loadables/Makefile.in
+       - SHOBJ_XLDFLAGS is now substituted by configure
+       - $(SHOBJ_LDFLAGS) -> $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) in all
+         recipes that build loadable builtins
+
+                                  12/29
+                                  -----
+support/config.{guess,sub}
+       - changes for NEC SX4 machines running SUPER-UX (?).  Info from
+         Nicholas Clark <nick@flirble.org>
+
+lib/readline/bind.c
+       - new bindable variable, `isearch-terminators', which is the list of
+         characters that will terminate an incremental search without
+         subsequently executing the character as a command
+
+lib/readline/isearch.c
+       - changes to incorporate the new isearch-terminators bindable variable;
+         uses new private readline variable _rl_isearch_terminators
+         (suggested by Brian Fox)
+
+doc/{bash.1,readline.3}, lib/readline/doc/rluser.texinfo
+       - documented new `isearch-terminators' settable variable
+
+lib/readline/complete.c
+       - new convenience function, free_match_list, called from
+         rl_complete_internal
+
+                                  12/30
+                                  -----
+aclocal.m4
+       - changed the calls to AC_MSG_ERROR in the cross-compiling sections
+         to AC_MSG_WARN, since AC_MSG_ERROR can cause configure to abort
+
+examples/functions/which
+       - new function, emulation of `which' as it appears in FreeBSD
+
+                                  12/31
+                                  -----
+lib/readline/readline.c
+       - new bindable function: rl_rubout_or_delete.  Does rl_rubout if
+         rl_point is at the end of the line, or rl_delete if not.  This
+         is intended to mimic the Motif/Netscape/GNOME behavior of the
+         DEL character, and can be bound to delete to get that behavior
+
+lib/readline/readline.h
+       - new extern declaration for rl_rubout_or_delete
+
+lib/readline/funmap.c
+       - bound the name `forward-backward-delete-char' to
+         rl_rubout_or_delete (currently not bound to any keys)
+
+lib/readline/doc/manvers.texinfo
+       - new file with readline manual version information, to mantain
+         consistent numbering between readline and history manuals
+
+lib/readline/doc/{rlman,hist}.texinfo
+       - @include manvers.texinfo for version information
+       - moved the @dircategory and and @direntry directives inside
+         the @ifinfo block
+       - changed copyrights to 1988-1999
+
+doc/Makefile.in, lib/readline/doc/Makefile.in
+       - texi2html is now called with -menu (to handle the texinfo menus)
+         and -monolithic (to include the table of contents in the generated
+         HTML file instead of putting it in a separate file
+       - changed recipes to remove references to TOC html files
+
+lib/glob/fnmatch.c
+       - include <string.h> or <strings.h> as appropriate for strchr()
+         declaration
+
+                                 1/4/99
+                                 ------
+print_cmd.c
+       - don't print bare words when printing conditional expressions in
+         print_cond_node, use cprintf("%s", cond->op->word)
+
+subst.c
+       - in separate_out_assignments, if VARLIST is non-null on function
+         entry, free it up to clean up after a previous error longjmp
+
+                                   1/5
+                                   ---
+configure.in
+       - make sure the case clause that disables the bash malloc on alpha
+         machines catches things like `alphaev56' as well as `alpha'
+
+                                  1/12
+                                  ----
+lib/readline/histlib.h
+       - new error message code: NO_PREV_SUBST
+
+lib/readline/histexpand.c
+       - handle NO_PREV_SUBST with appropriate error message in hist_error
+       - in history_expand_internal, if the `s' or `&' case results in a
+         null or empty LHS, return NO_PREV_SUBST
+
+error.c
+       - new interface: command_error(func, code, e, flags); intended to
+         collect command-related errors in one place
+       - new interface: command_errstr(code); returns a string describing
+         command error CODE
+
+error.h
+       - extern declarations for command_error and command_errstr
+
+command.h
+       - possible values for CODE in calls to command_error and command_errstr
+
+{shell,print_cmd,make_cmd,execute_cmd,dispose_cmd,eval}.c ,builtins/evalstring.c
+       - changed some calls to programming_error to use command_error
+
+                                  1/13
+                                  ----
+configure.in
+       - if --enable-profiling is specified on a solaris2 machine, don't
+         turn on enable-static-link, since it's very hard to build a
+         static binary on solaris2 and gprof does not (apparently) require it
+
+builtins/getopts.def
+       - add calls to sh_getopt_restore_state so the state is restored each
+         time getopts is called.  This protects us against the behavior of
+         some mallocs, which causes `nextchar' to be set to garbage in
+         getopt.c when a function is called between calls to getopts
+
+                                  1/14
+                                  ----
+lib/readline/complete.c
+       - if postprocess_matches returns 0 in rl_complete_internal, reset
+         completion_changed_buffer to 0 before returning, since nothing
+         has been changed
+
+                                  1/20
+                                  ----
+subst.c
+       - fixed pat_subst so that null patterns with a `#' specifier prefix
+         the string to be substituted on with the replacement, and null
+         patterns with a `%' specifier append the replacement to the string
+         to be substituted on
+
+doc/{bash.1,bashref.texi}
+       - corrected a small error in the description of parameter pattern
+         substitution
+
+support/mksignames.c
+       - SIGINFO means something else on sequent systems
+
+                                  1/26
+                                  ----
+execute_cmd.c
+       - fix to execute_simple_command to keep a child process from getting
+         a bad value of last_asynchronous_pid when the shell forks early
+
+                                   2/1
+                                   ---
+Makefile.in
+       - changed RELSTATUS to `beta2'
+
+                                   2/2
+                                   ---
+[bash-2.03-beta2 released]
+
+                                   2/3
+                                   ---
+tests/{cprint.{tests,right},run-cprint}
+       - new test to exercise the command printing and copying code --
+         hopefully this will avoid things like the `conditional commands
+         in functions make the shell abort' problem
+
+                                   2/4
+                                   ---
+version.c
+       - if MACHTYPE is not defined, use CONF_MACHTYPE if it's defined
+
+                                   2/5
+                                   ---
+builtins/read.def
+       - if READLINE is defined, we need an extra pair of braces around
+         the `while' loop that reads from fd 0 if the -e option is
+         supplied, otherwise the code erroneously tests the value of
+         `retval', which is not set when using readline
+
+                                  2/15
+                                  ----
+builtins/fc.def
+       - make sure that fc closes `stream' before calling fc_execute_file
+
+                                  2/17
+                                  ----
+builtins/fc.def
+       - don't bother opening and closing the file of commands before
+         calling fc_execute_file, since parse_and_execute will write the
+         commands to the history file for us
+
+Makefile.in
+       - changed release status to `release'
+
+                                  2/18
+                                  ----
+parse.y
+       - change to special_case_tokens so that `time' is not recognized
+         as a reserved word while the parser is parsing a case statement
+         pattern list (if `time' is the first pattern, the last read
+         token will be newline, which time_command_acceptable says is OK
+         to start a pipeline)
+
+pathexp.c
+       - some changes to the POSIX_GLOB_LIBRARY code (often unused)
+
+shell.c
+       - a couple of changes for Interix (nee OPENNT)
+       - added code that handles systems without a third argument to main();
+         initializing `env' from `environ', conditionalized on a cpp define
+         NO_MAIN_ENV_ARG
+
+configure.in, config.h.in
+       - check for the presence of sbrk(2); define HAVE_SBRK if found
+
+xmalloc.c
+       - don't do the space allocated computation when malloc or realloc
+         fails if HAVE_SBRK is not defined
+
+configure.in
+       - new configure variable, MAKE_SHELL, defaults to /bin/sh
+
+Makefile.in,{builtins,doc,support,lib/{glob,malloc,readline,sh,termcap,tilde},examples/loadables}/Makefile.in
+       - set SHELL from @MAKE_SHELL@
+
+lib/posixheaders/posixjmp.h
+       - Don't override defines for setjmp and longjmp in <setjmp.h> on
+         Internix (nee OPENNT)
+
+lib/readline/complete.c
+       - Interix (OPENNT) doesn't do username completion
+
+configure.in
+       - on Interix/OPENNT ($host_os == interix* or opennt*), add
+         -DNO_MAIN_ENV_ARG to LOCAL_CFLAGS
+       - on Interix/OPENNT, set MAKE_SHELL to $OPENNT_ROOT/bin/sh rather
+         than a straight /bin/sh
+
+cross-build/opennt.cache
+       - a `configure' cache file for Interix/OPENNT; not necessarily
+         for cross-compiling, but this is where the other system cache
+         files are
+
+[bash-2.03 released]
diff --git a/CWRU/empty-for-wordlist b/CWRU/empty-for-wordlist
new file mode 100644 (file)
index 0000000..2dd21d6
--- /dev/null
@@ -0,0 +1,25 @@
+This patch is from Brian Fox, in reply to an email message from
+"Marcin 'Qrczak' Kowalczyk" <qrczak@knm.org.pl>, who wrote:
+
+   I think that bash should accept such a syntax:
+
+   for var in ; do command; done
+
+   Of course it should do nothing. It would simplify some scripts.
+
+Here is a patch for those who wish it:
+
+*** parse.y.~1~ Wed Mar  4 09:39:46 1998
+--- parse.y     Mon Jul 13 14:40:23 1998
+***************
+*** 495,500 ****
+--- 495,504 ----
+                        { $$ = make_for_command ($2, REVERSE_LIST ($5, WORD_LIST *), $9); }
+        |       FOR WORD newline_list IN word_list list_terminator newline_list '{' compound_list '}'
+                        { $$ = make_for_command ($2, REVERSE_LIST ($5, WORD_LIST *), $9); }
++       |       FOR WORD newline_list IN list_terminator newline_list DO compound_list DONE
++                       { $$ = make_for_command ($2, (WORD_LIST *)NULL, $8); }
++       |       FOR WORD newline_list IN  list_terminator newline_list '{' compound_list '}'
++                       { $$ = make_for_command ($2, (WORD_LIST *)NULL, $8); }
+        ;
+  
diff --git a/CWRU/misc/errlist.c b/CWRU/misc/errlist.c
new file mode 100644 (file)
index 0000000..19ca622
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * If necessary, link with lib/sh/libsh.a
+ */
+
+#include <stdio.h>
+#include <errno.h>
+
+extern char *strerror();
+
+extern int sys_nerr;
+
+int
+main(c, v)
+int    c;
+char   **v;
+{
+       int     i, n;
+
+       if (c == 1) {
+               for (i = 1; i < sys_nerr; i++)
+                       printf("%d --> %s\n", i, strerror(i));
+       } else {
+               for (i = 1; i < c; i++) {
+                       n = atoi(v[i]);
+                       printf("%d --> %s\n", n, strerror(n));
+               }
+       }
+       exit (0);
+}
+
+programming_error(a, b)
+char   *a;
+int    b;
+{
+}
+
+fatal_error()
+{
+}
diff --git a/CWRU/misc/hpux10-dlfcn.h b/CWRU/misc/hpux10-dlfcn.h
new file mode 100644 (file)
index 0000000..9014c20
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * HPUX 10.x stubs to implement dl* in terms of shl*
+ *
+ * Not needed for later versions; HPUX 11.x has dlopen() and friends.
+ *
+ * configure also needs to be faked out.  You can create a dummy libdl.a
+ * with stub entries for dlopen, dlclose, dlsym, and dlerror:
+ *
+ *     int dlopen() { return(0);}
+ *     int dlclose() { return(0);}
+ *     int dlsym() { return(0);}
+ *     int dlerror() { return(0);}
+ *
+ * This has not been tested; I just read the manual page and coded this up.
+ *
+ * According to the ld manual page, you need to link bash with -dld and add
+ * the -E flag to LOCAL_LDFLAGS.
+ */
+
+#if !defined (__HPUX10_DLFCN_H__)
+
+#define __HPUX10_DLFCN_H__
+
+#include <dl.h>
+#include <errno.h>
+
+#ifndef errno
+extern int errno;
+#endif
+
+#define RTLD_LAZY BIND_DEFERRED
+#define RTLD_NOW BIND_IMMEDIATE
+#define RTLD_GLOBAL DYNAMIC_PATH
+
+char *bash_global_sym_addr;
+
+#define dlopen(file,mode) (void *)shl_load((file), (mode), 0L)
+
+#define dlclose(handle) shl_unload((shl_t)(handle))
+
+#define dlsym(handle,name) (bash_global_sym_addr=0,shl_findsym((shl_t *)&(handle),name,TYPE_UNDEFINED,&bash_global_sym_addr), (void *)bash_global_sym_addr)
+
+#define dlerror() strerror(errno)
+
+#endif /*  __HPUX10_DLFCN_H__ */
diff --git a/INSTALL b/INSTALL
index b3e1f4f221a78a044e40bfde5ed65cb89626c1cf..1211e359f04d04e34f53e78bf93be32fdf336ccb 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -16,10 +16,10 @@ compiler output (useful mainly for debugging `configure').  If at some
 point `config.cache' contains results you don't want to keep, you may
 remove or edit it.
 
-If you need to do unusual things to compile the package, please try to
-figure out how `configure' could check whether or not to do them, and
-mail diffs or instructions to `bash-maintainers@prep.ai.mit.edu' so
-they can be considered for the next release.
+If you need to do unusual things to compile Bash, please try to figure
+out how `configure' could check whether or not to do them, and mail
+diffs or instructions to <bash-maintainers@gnu.org> so 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
@@ -29,8 +29,8 @@ 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.02'.  `_patchlevel' should
-contain the patch level of the Bash distribution, `1' for example.  The
+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.
 
@@ -115,17 +115,17 @@ than `/usr/local' by giving `configure' the option `--prefix=PATH'.
 
 You can specify separate installation prefixes for
 architecture-specific files and architecture-independent files.  If you
-give `configure' the option `--exec-prefix=PATH', the package will use
-`PATH' as the prefix for installing programs and libraries.
+give `configure' the option `--exec-prefix=PATH', `make install' will
+use `PATH' as the prefix for installing programs and libraries.
 Documentation and other data files will still use the regular prefix.
 
 Specifying the System Type
 ==========================
 
 There may be some features `configure' can not figure out
-automatically, but needs to determine by the type of host the package
-will run on.  Usually `configure' can figure that out, but if it prints
-message saying it can not guess the host type, give it the
+automatically, but needs to determine by the type of host Bash will run
+on.  Usually `configure' can figure that out, but if it prints a
+message saying it can not guess the host type, give it the
 `--host=TYPE' option.  `TYPE' can either be a short name for the system
 type, such as `sun4', or a canonical name with three fields:
 `CPU-COMPANY-SYSTEM' (e.g., `sparc-sun-sunos4.1.2').
@@ -177,12 +177,11 @@ Optional Features
 =================
 
 The Bash `configure' has a number of `--enable-FEATURE' options, where
-FEATURE indicates an optional part of the package.  There are also
-several `--with-PACKAGE' options, where PACKAGE is something like
-`gnu-malloc' or `purify' (for the Purify memory allocation checker).  To
-turn off the default use of a package, use `--without-PACKAGE'.  To
-configure Bash without a feature that is enabled by default, use
-`--disable-FEATURE'.
+FEATURE indicates an optional part of Bash.  There are also several
+`--with-PACKAGE' options, where PACKAGE is something like `gnu-malloc'
+or `purify'.  To turn off the default use of a package, use
+`--without-PACKAGE'.  To configure Bash without a feature that is
+enabled by default, use `--disable-FEATURE'.
 
 Here is a complete list of the `--enable-' and `--with-' options that
 the Bash `configure' recognizes.
@@ -212,6 +211,11 @@ the Bash `configure' recognizes.
      for which this should be turned off, and `configure' disables this
      option automatically for a number of systems.
 
+`--with-installed-readline'
+     Define this to make bash link with a locally-installed version of
+     Readline rather than the version in lib/readline.  This works only
+     with readline 4.0 and later versions.
+
 `--with-purify'
      Define this to use the Purify memory allocation checker from Pure
      Software.
@@ -241,16 +245,19 @@ does not provide the necessary support.
 
 `--enable-alias'
      Allow alias expansion and include the `alias' and `unalias'
-     builtins.
+     builtins (*note Aliases::.).
 
 `--enable-array-variables'
-     Include support for one-dimensional array shell variables.
+     Include support for one-dimensional array shell variables (*note
+     Arrays::.).
 
 `--enable-bang-history'
-     Include support for `csh'-like history substitution.
+     Include support for `csh'-like history substitution (*note History
+     Interaction::.).
 
 `--enable-brace-expansion'
      Include `csh'-like brace expansion ( `b{a,b}c' ==> `bac bbc' ).
+     See *Note Brace Expansion::, for a complete description.
 
 `--enable-command-timing'
      Include support for recognizing `time' as a reserved word and for
@@ -259,11 +266,12 @@ does not provide the necessary support.
      be timed.
 
 `--enable-cond-command'
-     Include support for the `[[' conditional command.
+     Include support for the `[[' conditional command (*note
+     Conditional Constructs::.).
 
 `--enable-directory-stack'
      Include support for a `csh'-like directory stack and the `pushd',
-     `popd', and `dirs' builtins.
+     `popd', and `dirs' builtins (*note The Directory Stack::.).
 
 `--enable-disabled-builtins'
      Allow builtin commands to be invoked via `builtin xxx' even after
@@ -272,7 +280,8 @@ does not provide the necessary support.
      commands.
 
 `--enable-dparen-arithmetic'
-     Include support for the `ksh' `((...))' command.
+     Include support for the `((...))' command (*note Conditional
+     Constructs::.).
 
 `--enable-extended-glob'
      Include support for the extended pattern matching features
@@ -287,20 +296,22 @@ does not provide the necessary support.
      commands.
 
 `--enable-job-control'
-     This enables job control features, if the OS supports them.
+     This enables the job control features (*note Job Control::.), if
+     the operating system supports them.
 
 `--enable-process-substitution'
      This enables process substitution (*note Process Substitution::.)
-     if the OS provides the necessary support.
+     if the operating system provides the necessary support.
 
 `--enable-prompt-string-decoding'
      Turn on the interpretation of a number of backslash-escaped
      characters in the `$PS1', `$PS2', `$PS3', and `$PS4' prompt
-     strings.
+     strings.  See *Note Printing a Prompt::, for a complete list of
+     prompt string escape sequences.
 
 `--enable-readline'
      Include support for command-line editing and history with the Bash
-     version of the Readline library.
+     version of the Readline library (*note Command Line Editing::.).
 
 `--enable-restricted'
      Include support for a "restricted shell".  If this is enabled,
@@ -308,8 +319,8 @@ does not provide the necessary support.
      The Restricted Shell::, for a description of restricted mode.
 
 `--enable-select'
-     Include the `ksh' `select' builtin, which allows the generation of
-     simple menus.
+     Include the `select' builtin, which allows the generation of simple
+     menus (*note Conditional Constructs::.).
 
 `--enable-usg-echo-default'
      Make the `echo' builtin expand backslash-escaped characters by
index a3e95c090156ad566c3aa1dd3051b74e5de45ffb..c15211946981cf90bd3641f474cac21859279909 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -43,11 +43,12 @@ NEWS                f
 NOTES          f
 README         f
 AUTHORS                f
+Y2K            f
 configure.in   f
 configure      f
 Makefile.in    f
-config.h.top   f
-config.h.bot   f
+config-top.h   f
+config-bot.h   f
 config.h.in    f
 aclocal.m4     f
 array.c                f
@@ -195,6 +196,9 @@ builtins/common.h   f
 builtins/bashgetopt.h  f
 cross-build/cygwin32.cache     f
 cross-build/win32sig.h f
+cross-build/x86-beos.cache     f
+cross-build/beos-sig.h f
+cross-build/opennt.cache       f
 lib/glob/ChangeLog     f
 lib/glob/Makefile.in   f
 lib/glob/fnmatch.c     f
@@ -256,6 +260,7 @@ lib/readline/input.c        f
 lib/readline/callback.c        f
 lib/readline/nls.c     f
 lib/readline/shell.c   f
+lib/readline/savestring.c      f
 lib/readline/tilde.c   f
 lib/readline/tilde.h   f
 lib/readline/rldefs.h  f
@@ -272,7 +277,9 @@ lib/readline/posixdir.h     f
 lib/readline/posixjmp.h        f
 lib/readline/posixstat.h       f
 lib/readline/ansi_stdlib.h     f
+lib/readline/rlstdc.h  f
 lib/readline/doc/Makefile      f
+lib/readline/doc/manvers.texinfo       f
 lib/readline/doc/rlman.texinfo f
 lib/readline/doc/rltech.texinfo        f
 lib/readline/doc/rluser.texinfo        f
@@ -292,6 +299,7 @@ lib/sh/getcwd.c             f
 lib/sh/getenv.c                f
 lib/sh/itos.c          f
 lib/sh/oslib.c         f
+lib/sh/rename.c                f
 lib/sh/setlinebuf.c    f
 lib/sh/strcasecmp.c    f
 lib/sh/strerror.c      f
@@ -319,22 +327,27 @@ lib/termcap/grot/configure        f
 lib/termcap/grot/configure.in  f
 lib/termcap/grot/COPYING       f
 lib/termcap/grot/README        f
+lib/tilde/README       f
 lib/tilde/ChangeLog    f
 lib/tilde/Makefile.in  f
 lib/tilde/doc/tilde.texi       f
 lib/tilde/doc/Makefile f
 lib/tilde/tilde.c      f
 lib/tilde/tilde.h      f
+lib/tilde/shell.c      f
 CWRU/misc/open-files.c f
 CWRU/misc/sigs.c       f
 CWRU/misc/pid.c                f
 CWRU/misc/sigstat.c    f
 CWRU/misc/bison                f
+CWRU/misc/errlist.c    f
+CWRU/misc/hpux10-dlfcn.h       f
 CWRU/PLATFORMS         f
 CWRU/README            f
 CWRU/POSIX.NOTES       f
 CWRU/changelog         f
 CWRU/sh-redir-hack     f
+CWRU/empty-for-wordlist        f
 CWRU/mh-folder-comp    f
 doc/FAQ                f
 doc/Makefile.in        f
@@ -355,6 +368,7 @@ support/config.sub  f
 support/printenv.sh    f       755
 support/printenv.c     f
 support/bash.xbm       f
+support/missing                f       755
 support/mkclone                f       755
 support/mkconffiles    f       755
 support/mkdirs         f       755
@@ -368,14 +382,17 @@ support/SYMLINKS  f
 support/fixlinks       f       755
 support/install.sh     f       755
 support/texi2dvi       f
-support/texi2html      f
+support/texi2html      f       755
 support/xenix-link.sh  f       755
+support/shobj-conf     f       755
+support/rlvers.sh      f       755
 examples/bashdb/PERMISSION     f
 examples/bashdb/README f
 examples/bashdb/bashdb f
 examples/bashdb/bashdb.fns     f
 examples/bashdb/bashdb.pre     f
 examples/loadables/README      f
+examples/loadables/template.c  f
 examples/loadables/Makefile.in f
 examples/loadables/necho.c     f
 examples/loadables/hello.c     f
@@ -384,7 +401,6 @@ examples/loadables/sprintf.c        f
 examples/loadables/sleep.c     f
 examples/loadables/truefalse.c f
 examples/loadables/getconf.c   f
-examples/loadables/pushd.c     f
 examples/loadables/finfo.c     f
 examples/loadables/cat.c       f
 examples/loadables/logname.c   f
@@ -395,8 +411,17 @@ examples/loadables/pathchk.c       f
 examples/loadables/tee.c       f
 examples/loadables/rmdir.c     f
 examples/loadables/head.c      f
+examples/loadables/printenv.c  f
+examples/loadables/id.c                f
+examples/loadables/whoami.c    f
+examples/loadables/uname.c     f
+examples/loadables/sync.c      f
+examples/loadables/mkdir.c     f
+examples/loadables/ln.c                f
+examples/loadables/unlink.c    f
 examples/functions/autoload    f
 examples/functions/autoload.v2 f
+examples/functions/autoload.v3 f
 examples/functions/basename    f
 examples/functions/basename2   f
 examples/functions/csh-compat  f
@@ -423,7 +448,9 @@ examples/functions/mhfold   f
 examples/functions/notify.bash f
 examples/functions/pathfuncs   f
 examples/functions/repeat2     f
+examples/functions/repeat3     f
 examples/functions/seq         f
+examples/functions/seq2                f
 examples/functions/shcat       f
 examples/functions/shcat2      f
 examples/functions/substr      f
@@ -431,6 +458,7 @@ examples/functions/substr2  f
 examples/functions/term                f
 examples/functions/whatis      f
 examples/functions/whence      f
+examples/functions/which       f
 examples/functions/xalias.bash f
 examples/scripts/adventure.sh  f
 examples/scripts/bcsh.sh       f
@@ -479,6 +507,8 @@ tests/source4.sub   f
 tests/source5.sub      f
 tests/cond.tests       f
 tests/cond.right       f
+tests/cprint.tests     f
+tests/cprint.right     f
 tests/dollar-at-star   f
 tests/dollar.right     f
 tests/dstack.tests     f
@@ -573,6 +603,7 @@ tests/run-array2    f
 tests/run-braces       f
 tests/run-builtins     f
 tests/run-cond         f
+tests/run-cprint       f
 tests/run-dirstack     f
 tests/run-dollars      f
 tests/run-errors       f
index 5462426e6039c92c6a57927f7205c0982706c8da..8f288bbe228c71aff99e846aa265435820c11d88 100644 (file)
@@ -1,4 +1,4 @@
-# Makefile for bash-2.02, version 2.84
+# Makefile for bash-2.03, version 2.103
 #
 # Make sure the first target in the makefile is the right one
 all: .made
@@ -29,15 +29,17 @@ VPATH = .:@srcdir@
 CC = @CC@
 CC_FOR_BUILD = @CC_FOR_BUILD@
 YACC = @YACC@
-SHELL=/bin/sh
+SHELL = @MAKE_SHELL@
 CP = cp
 RM = rm -f
 AR = @AR@
+ARFLAGS = @ARFLAGS@
 RANLIB = @RANLIB@
 
 INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
+INSTALLMODE= -m 0755
 
 COMPRESS = gzip
 COMPRESS_EXT = .gz
@@ -63,6 +65,7 @@ RELSTATUS = release
 
 Machine = @host_cpu@
 OS = @host_os@
+VENDOR = @host_vendor@
 MACHTYPE = @host@
 
 THIS_SH = $(BUILD_DIR)/$(Program)
@@ -80,20 +83,21 @@ 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)
+LIBS = $(BUILTINS_LIB) $(LIBRARIES) @LIBS@
+LDFLAGS = @LDFLAGS@ $(STATIC_LD) $(LOCAL_LDFLAGS) $(PROFILE_FLAGS) $(CFLAGS)
+STATIC_LD = @STATIC_LD@
 LOCAL_LDFLAGS = @LOCAL_LDFLAGS@
 
-SYSTEM_FLAGS = -DPROGRAM='"$(Program)"' -DHOSTTYPE='"$(Machine)"' -DOSTYPE='"$(OS)"' -DMACHTYPE='"$(MACHTYPE)"'
+SYSTEM_FLAGS = -DPROGRAM='"$(Program)"' -DCONF_HOSTTYPE='"$(Machine)"' -DCONF_OSTYPE='"$(OS)"' -DCONF_MACHTYPE='"$(MACHTYPE)"' -DCONF_VENDOR='"$(VENDOR)"'
 
 CCFLAGS        = $(PROFILE_FLAGS) $(SYSTEM_FLAGS) $(LOCAL_DEFS) \
          $(DEFS) $(LOCAL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(CFLAGS)
 
-INCLUDES = -I. -I$(srcdir) -I$(LIBSRC)
+INCLUDES = -I. @RL_INCLUDE@ -I$(srcdir) -I$(LIBSRC) -I$(includedir)
 
 GCC_LINT_FLAGS = -ansi -Wall -Wshadow -Wpointer-arith -Wcast-qual \
                 -Wwrite-strings -Werror -Wstrict-prototypes \
-                -Wmissing-prototypes
+                -Wmissing-prototypes -Wno-implicit
 GCC_LINT_CFLAGS = $(CCFLAGS) $(GCC_LINT_FLAGS)
 
 #
@@ -105,7 +109,7 @@ dot = .
 LIBSUBDIR = lib
 LIBSRC = $(srcdir)/$(LIBSUBDIR)
 
-SUBDIR_INCLUDES = -I. -I$(topdir) -I$(topdir)/$(LIBSUBDIR) -I$(includedir)
+SUBDIR_INCLUDES = -I. @RL_INCLUDE@ -I$(topdir) -I$(topdir)/$(LIBSUBDIR) -I$(includedir)
 
 # the bash library
 # the library is a mix of functions that the C library does not provide on
@@ -120,7 +124,7 @@ SHLIB_SOURCE = ${SH_LIBSRC}/clktck.c ${SH_LIBSRC}/getcwd.c \
               ${SH_LIBSRC}/strcasecmp.c ${SH_LIBSRC}/strerror.c \
               ${SH_LIBSRC}/strtod.c ${SH_LIBSRC}/strtol.c \
               ${SH_LIBSRC}/strtoul.c ${SH_LIBSRC}/vprint.c \
-              ${SH_LIBSRC}/itos.c
+              ${SH_LIBSRC}/itos.c ${SH_LIBSRC}/rename.c
 
 SHLIB_LIB = -lsh
 SHLIB_LIBNAME = libsh.a
@@ -131,7 +135,7 @@ SHLIB_DEP = ${SHLIB_LIBRARY}
 # we assume for now that readline source is being shipped with bash
 RL_LIBSRC = $(LIBSRC)/readline
 RL_LIBDOC = $(RL_LIBSRC)/doc
-RL_LIBDIR = $(dot)/$(LIBSUBDIR)/readline
+RL_LIBDIR = @RL_LIBDIR@
 RL_ABSSRC = ${topdir}/$(RL_LIBDIR)
 
 READLINE_LIB = @READLINE_LIB@
@@ -145,6 +149,7 @@ READLINE_SOURCE     = $(RL_LIBSRC)/rldefs.h $(RL_LIBSRC)/rlconf.h \
                  $(RL_LIBSRC)/chardefs.h $(RL_LIBSRC)/keymaps.h \
                  $(RL_LIBSRC)/history.h $(RL_LIBSRC)/histlib.h \
                  $(RL_LIBSRC)/posixstat.h $(RL_LIBSRC)/tilde.h \
+                 $(RL_LIBSRC)/rlstdc.h \
                  $(RL_LIBSRC)/funmap.c $(RL_LIBSRC)/emacs_keymap.c \
                  $(RL_LIBSRC)/search.c $(RL_LIBSRC)/vi_keymap.c \
                  $(RL_LIBSRC)/keymaps.c $(RL_LIBSRC)/parens.c \
@@ -157,7 +162,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)/shell.c $(RL_LIBSRC)/savestring.c \
                  $(RL_LIBSRC)/histexpand.c $(RL_LIBSRC)/history.c \
                  $(RL_LIBSRC)/histsearch.c $(RL_LIBSRC)/histfile.c
 
@@ -171,12 +176,12 @@ 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)/shell.o $(RL_LIBDIR)/savestring.o \
                  $(RL_LIBDIR)/history.o $(RL_LIBDIR)/histexpand.o \
                  $(RL_LIBDIR)/histsearch.o $(RL_LIBDIR)/histfile.o
 
 HIST_LIBSRC = $(LIBSRC)/readline
-HIST_LIBDIR = $(dot)/$(LIBSUBDIR)/readline
+HIST_LIBDIR = @HIST_LIBDIR@
 HIST_ABSSRC = ${topdir}/$(HIST_LIBDIR)
 
 HISTORY_LIB = @HISTORY_LIB@
@@ -265,11 +270,11 @@ BASHPOSIX_SUPPORT = $(BASHPOSIX_LIB)/posixstat.h $(BASHPOSIX_LIB)/ansi_stdlib.h
 LIBRARIES = $(READLINE_LIB) $(HISTORY_LIB) $(TERMCAP_LIB) $(GLOB_LIB) \
            $(TILDE_LIB) $(MALLOC_LIB) $(SHLIB_LIB) $(LOCAL_LIBS)
 
-LIBDEP = $(READLINE_DEP) $(TERMCAP_DEP) $(GLOB_DEP) $(HISTORY_DEP) \
+LIBDEP = $(READLINE_DEP) $(HISTORY_DEP) $(TERMCAP_DEP) $(GLOB_DEP) \
         $(TILDE_DEP) $(MALLOC_DEP) $(SHLIB_DEP)
 
-LIBRARY_LDFLAGS = $(READLINE_LDFLAGS) $(HISTORY_LDFLAGS) $(TILDE_LDFLAGS) \
-                 $(GLOB_LDFLAGS) $(MALLOC_LDFLAGS) $(SHLIB_LDFLAGS)
+LIBRARY_LDFLAGS = $(READLINE_LDFLAGS) $(HISTORY_LDFLAGS) $(GLOB_LDFLAGS) \
+                 $(TILDE_LDFLAGS) $(MALLOC_LDFLAGS) $(SHLIB_LDFLAGS)
 
 #
 # The shell itself
@@ -411,8 +416,8 @@ strip:      $(Program) .made
        size $(Program)
 
 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;
+       $(SHELL) $(SUPPORT_SRC)mkversion.sh -b -s $(RELSTATUS) -d $(Version) -p $(PatchLevel) -o newversion.h \
+               && mv newversion.h version.h
 
 # old rules
 GRAM_H = parser-built
@@ -435,13 +440,13 @@ y.tab.c y.tab.h: parse.y
 
 $(READLINE_LIBRARY): config.h $(READLINE_SOURCE)
        @echo making $@ in ${RL_LIBDIR}
-       @(cd ${RL_LIBDIR} && \
-               $(MAKE) $(MFLAGS) libreadline.a) || exit 1
+       @( { test "${RL_LIBDIR}" = "${libdir}" && exit 0; } || \
+               cd ${RL_LIBDIR} && $(MAKE) $(MFLAGS) libreadline.a) || exit 1
 
 $(HISTORY_LIBRARY): config.h $(HISTORY_SOURCE)
        @echo making $@ in ${HIST_LIBDIR}
-       @(cd ${HIST_LIBDIR} && \
-               $(MAKE) $(MFLAGS) libhistory.a) || exit 1
+       @( { test "${HIST_LIBDIR}" = "${libdir}" && exit 0; } || \
+               cd ${HIST_LIBDIR} && $(MAKE) $(MFLAGS) libhistory.a) || exit 1
 
 $(GLOB_LIBRARY): config.h $(GLOB_SOURCE)
        @echo making $@ in ${GLOB_LIBDIR}
@@ -464,7 +469,7 @@ $(SHLIB_LIBRARY): config.h ${SHLIB_SOURCE}
                $(MAKE) $(MFLAGS) ${SHLIB_LIBNAME}) || exit 1
 
 mksignames:    $(SUPPORT_SRC)mksignames.c
-       $(CC) $(CCFLAGS) $(CPPFLAGS) -o $@ $(SUPPORT_SRC)mksignames.c
+       $(CC_FOR_BUILD) $(CCFLAGS) $(CPPFLAGS) -o $@ $(SUPPORT_SRC)mksignames.c
 
 # make a list of signals for the local system -- this is done when we're
 # *not* cross-compiling
@@ -502,15 +507,19 @@ Makefiles makefiles:      config.status $(srcdir)/Makefile.in
 
 config.h:      stamp-h 
 
-stamp-h:       config.status $(srcdir)/config.h.in $(srcdir)/config.h.top $(srcdir)/config.h.bot
+stamp-h:       config.status $(srcdir)/config.h.in $(srcdir)/config-top.h $(srcdir)/config-bot.h
        CONFIG_FILES= CONFIG_HEADERS=config.h $(SHELL) ./config.status
 
 config.status: $(srcdir)/configure
        $(SHELL) ./config.status --recheck
 
 # comment out for distribution
-#$(srcdir)/configure:  $(srcdir)/configure.in $(srcdir)/aclocal.m4
-#      cd $(srcdir) && autoconf
+$(srcdir)/configure:   $(srcdir)/configure.in $(srcdir)/aclocal.m4 $(srcdir)/config.h.in
+       cd $(srcdir) && autoconf
+
+# for chet
+reconfig: force
+       sh $(srcdir)/configure
 
 #newversion:   mkversion
 #      $(RM) .build
@@ -540,8 +549,8 @@ installdirs:
        @${SHELL} $(SUPPORT_SRC)mkdirs $(infodir)
 
 install:       .made installdirs
-       $(INSTALL_PROGRAM) $(Program) $(bindir)/$(Program)
-       $(INSTALL_PROGRAM) bashbug $(bindir)/bashbug
+       $(INSTALL_PROGRAM) $(INSTALLMODE) $(Program) $(bindir)/$(Program)
+       $(INSTALL_PROGRAM) $(INSTALLMODE) bashbug $(bindir)/bashbug
        -( cd $(DOCDIR) ; $(MAKE) $(MFLAGS) \
                man1dir=$(man1dir) man1ext=$(man1ext) \
                man3dir=$(man3dir) man3ext=$(man3ext) \
@@ -572,6 +581,7 @@ clean:      basic-clean
        -(cd $(GLOB_LIBDIR) && $(MAKE) $(MFLAGS) $@)
        -(cd $(TILDE_LIBDIR) && $(MAKE) $(MFLAGS) $@)
        -(cd $(ALLOC_LIBDIR) && $(MAKE) $(MFLAGS) $@)
+       -(cd $(SH_LIBDIR) && $(MAKE) $(MFLAGS) $@)
        $(RM) $(CREATED_SUPPORT)
 
 mostlyclean: basic-clean
@@ -583,6 +593,7 @@ mostlyclean: basic-clean
        -(cd $(GLOB_LIBDIR) && $(MAKE) $(MFLAGS) $@)
        -(cd $(TILDE_LIBDIR) && $(MAKE) $(MFLAGS) $@)
        -(cd $(ALLOC_LIBDIR) && $(MAKE) $(MFLAGS) $@)
+       -(cd $(SH_LIBDIR) && $(MAKE) $(MFLAGS) $@)
 
 distclean:     basic-clean
        ( cd $(DOCDIR) && $(MAKE) $(MFLAGS) $@ )
@@ -593,6 +604,7 @@ distclean:  basic-clean
        -(cd $(GLOB_LIBDIR) && $(MAKE) $(MFLAGS) $@)
        -(cd $(TILDE_LIBDIR) && $(MAKE) $(MFLAGS) $@)
        -(cd $(ALLOC_LIBDIR) && $(MAKE) $(MFLAGS) $@)
+       -(cd $(SH_LIBDIR) && $(MAKE) $(MFLAGS) $@)
        $(RM) $(CREATED_CONFIGURE) tags TAGS 
        $(RM) $(CREATED_SUPPORT) Makefile $(CREATED_MAKEFILES)
 
@@ -608,6 +620,7 @@ maintainer-clean:   basic-clean
        -(cd $(GLOB_LIBDIR) && $(MAKE) $(MFLAGS) $@)
        -(cd $(TILDE_LIBDIR) && $(MAKE) $(MFLAGS) $@)
        -(cd $(ALLOC_LIBDIR) && $(MAKE) $(MFLAGS) $@)
+       -(cd $(SH_LIBDIR) && $(MAKE) $(MFLAGS) $@)
        $(RM) $(CREATED_CONFIGURE) $(CREATED_MAKEFILES)
        $(RM) $(CREATED_SUPPORT) Makefile
 
@@ -643,22 +656,22 @@ sdepend: force
 
 ############################ DEPENDENCIES ###############################
 
-# Files that depend on the definitions in config.h.top, which are not meant
+# Files that depend on the definitions in config-top.h, which are not meant
 # to be changed
-shell.o: config.h.top
-input.o: config.h.top
-y.tab.o: config.h.top
-jobs.o: config.h.top
-nojobs.o: config.h.top
-execute_cmd.o: config.h.top
-variables.o: config.h.top
-builtins/command.o: config.h.top
-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.o: config-top.h
+input.o: config-top.h
+y.tab.o: config-top.h
+jobs.o: config-top.h
+nojobs.o: config-top.h
+execute_cmd.o: config-top.h
+variables.o: config-top.h
+builtins/command.o: config-top.h
+builtins/common.o: config-top.h
+builtins/break.o: config-top.h
+builtins/echo.o: config-top.h
+builtins/evalstring.o: config-top.h
+builtins/exit.o: config-top.h
+builtins/kill.o: config-top.h
 
 # shell basics
 copy_cmd.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
@@ -872,18 +885,20 @@ bracecomp.o: dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
 # library dependencies
 
 bashline.o: $(RL_LIBSRC)/rlconf.h
-bashline.o: $(RL_LIBSRC)/keymaps.h
+bashline.o: $(RL_LIBSRC)/keymaps.h $(RL_LIBSRC)/rlstdc.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
+bracecomp.o: $(RL_LIBSRC)/readline.h $(RL_LIBSRC)/rlstdc.h
+y.tab.o: $(RL_LIBSRC)/keymaps.h $(RL_LIBSRC)/chardefs.h
+y.tab.o: $(RL_LIBSRC)/readline.h $(RL_LIBSRC)/rlstdc.h
+subst.o: $(RL_LIBSRC)/keymaps.h $(RL_LIBSRC)/chardefs.h
+subst.o: $(RL_LIBSRC)/readline.h $(RL_LIBSRC)/rlstdc.h
+
+shell.o: $(HIST_LIBSRC)/history.h $(HIST_LIBSRC)/rlstdc.h
+subst.o: $(HIST_LIBSRC)/history.h $(HIST_LIBSRC)/rlstdc.h
+bashline.o: $(HIST_LIBSRC)/history.h $(HIST_LIBSRC)/rlstdc.h
+bashhist.o: $(HIST_LIBSRC)/history.h $(HIST_LIBSRC)/rlstdc.h
+y.tab.o: $(HIST_LIBSRC)/history.h $(HIST_LIBSRC)/rlstdc.h
 
 execute_cmd.o: $(TILDE_LIBSRC)/tilde.h
 general.o: $(TILDE_LIBSRC)/tilde.h
@@ -1075,11 +1090,11 @@ 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
+builtins/bind.o: $(RL_LIBSRC)/keymaps.h $(RL_LIBSRC)/rlstdc.h
 
-builtins/bind.o: $(HIST_LIBSRC)/history.h
-builtins/fc.o: $(HIST_LIBSRC)/history.h
-builtins/history.o: $(HIST_LIBSRC)/history.h
+builtins/bind.o: $(HIST_LIBSRC)/history.h $(RL_LIBSRC)/rlstdc.h
+builtins/fc.o: $(HIST_LIBSRC)/history.h $(RL_LIBSRC)/rlstdc.h
+builtins/history.o: $(HIST_LIBSRC)/history.h $(RL_LIBSRC)/rlstdc.h
 
 builtins/common.o: $(TILDE_LIBSRC)/tilde.h
 builtins/cd.o: $(TILDE_LIBSRC)/tilde.h 
diff --git a/NEWS b/NEWS
index eb22abe05e8d7921169ce2e356e8472314a0f579..9999ab775a0ac1416b6959da84d379d3b7c9ebe7 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,69 @@
+This is a terse description of the new features added to bash-2.03 since
+the release of bash-2.02.  As always, the manual page (doc/bash.1) is
+the place to look for complete descriptions.
+
+1.  New Features in Bash
+
+a.  New `shopt' option, `restricted_shell', indicating whether or not the
+    shell was started in restricted mode, for use in startup files.
+
+b.  Filename generation is now performed on the words between ( and ) in
+    array assignments (which it probably should have done all along).
+
+c.  OLDPWD is now auto-exported, as POSIX.2 seems to require.
+
+d.  ENV and BASH_ENV are read-only variables in a restricted shell.
+
+e.  A change was made to the startup file code so that any shell begun with
+    the `--login' option, even non-interactive shells, will source the login
+    shell startup files.
+
+2.  New Features in Readline
+
+a.  Many changes to the signal handling:
+        o Readline now catches SIGQUIT and cleans up the tty before returning;
+        o A new variable, rl_catch_signals, is available to application writers 
+          to indicate to readline whether or not it should install its own
+          signal handlers for SIGINT, SIGTERM, SIGQUIT, SIGALRM, SIGTSTP,
+          SIGTTIN, and SIGTTOU;
+        o A new variable, rl_catch_sigwinch, is available to application
+          writers to indicate to readline whether or not it should install its
+          own signal handler for SIGWINCH, which will chain to the calling
+          applications's SIGWINCH handler, if one is installed;
+        o There is a new function, rl_free_line_state, for application signal
+          handlers to call to free up the state associated with the current
+          line after receiving a signal;
+        o There is a new function, rl_cleanup_after_signal, to clean up the
+          display and terminal state after receiving a signal;
+        o There is a new function, rl_reset_after_signal, to reinitialize the
+          terminal and display state after an application signal handler
+          returns and readline continues
+
+b.  There is a new function, rl_resize_terminal, to reset readline's idea of
+    the screen size after a SIGWINCH.
+
+c.  New public functions: rl_save_prompt and rl_restore_prompt.  These were
+    previously private functions with a `_' prefix.
+
+d.  New function hook: rl_pre_input_hook, called just before readline starts
+    reading input, after initialization.
+
+e.  New function hook: rl_display_matches_hook, called when readline would
+    display the list of completion matches.  The new function
+    rl_display_match_list is what readline uses internally, and is available
+    for use by application functions called via this hook.
+
+f.  New bindable function, delete-char-or-list, like tcsh.
+
+g.  A new variable, rl_erase_empty_line, which, if set by an application using
+    readline, will cause readline to erase, prompt and all, lines on which the
+    only thing typed was a newline.
+
+h.  New bindable variable: `isearch-terminators'.
+
+i.  New bindable function: `forward-backward-delete-char' (unbound by default).
+
+-------------------------------------------------------------------------------
 This is a terse description of the new features added to bash-2.02 since
 the release of bash-2.01.1.  As always, the manual page (doc/bash.1) is
 the place to look for complete descriptions.
diff --git a/NOTES b/NOTES
index 9a7c36ab7596a1cf6c5d3df30b7f31a0af86ea8d..1e4d5611d789d5f52ec0392bef354347fbacd2f9 100644 (file)
--- a/NOTES
+++ b/NOTES
@@ -198,3 +198,58 @@ being built and linked against, but there is only a stub file in the archive.)
    You will see many warnings of the form:
    warning: unknown s_type: 98
    I have no idea what this means, but it doesn't seem to matter.
+
+10. If you do not have /usr/ccs/bin in your PATH when building on SunOS 5.x
+    (Solaris 2), the configure script will be unable to find `ar' and
+    `ranlib' (of course, ranlib is unnecessary).  Make sure your $PATH
+    includes /usr/ccs/bin on SunOS 5.x.
+
+11. Building a statically-linked bash on Solaris 2.5.x or 2.6 is complicated.
+    It's not possible to build a completely statically-linked binary, since
+    part of the C library depends on dynamic linking.  The following recipe
+    assumes that you're using gcc and the Solaris ld (/usr/ccs/bin/ld).
+
+       configure --enable-static-link
+       make STATIC_LD= LOCAL_LIBS='-Wl,-B,dynamic -ldl -Wl,-B,static'
+
+    This should result in a bash binary that depends only on libdl.so:
+
+       thor(2)$ ldd bash
+               libdl.so.1 =>    /usr/lib/libdl.so.1
+
+    If you're using the Sun C Compiler (Sun WorkShop C Compiler version
+    4.2 was what I used), you should be able to get away with using
+
+       configure --enable-static-link
+       make STATIC_LD=  LOCAL_LIBS='-B dynamic -ldl -B static'
+
+    If you want to completely remove any dependence on /usr, perhaps
+    to put a copy of bash in /sbin and have it available when /usr is
+    not mounted, force the build process to use the shared ld.so library
+    in /etc/lib.
+
+    For gcc, this would be something like
+
+       configure --enable-static-link
+       make STATIC_LD= LOCAL_LIBS='-Wl,-B,dynamic -Wl,-R/etc/lib -ldl -Wl,-B,static'
+
+    For Sun's WS4.2 cc
+
+       configure --enable-static-link
+       make STATIC_LD=  LOCAL_LIBS='-B dynamic -R/etc/lib -ldl -B static'
+
+    seems to work, at least on Solaris 2.5.1:
+
+       thor(2)$ ldd bash
+               libdl.so.1 =>    /etc/lib/libdl.so.1
+
+12. Configuring bash to build it in a cross environment.  Currently only
+    two native versions can be compiled this way, cygwin32 and x86 BeOS.
+    For BeOS, you would configure it like this:
+
+       export RANLIB=i586-beos-ranlib
+       export AR=i586-beos-ar
+       export CC=i586-beos-gcc
+       configure i586-beos
+
+    Similarly for cygwin32.
diff --git a/README b/README
index 57a705915c46c7f631c4d7fdb15ff0c300207eab..086890856ea771aafc4ad9cc6a75338570fa1bbb 100644 (file)
--- a/README
+++ b/README
@@ -1,7 +1,7 @@
 Introduction
 ============
 
-This is GNU Bash, version 2.02.1.  Bash is the GNU Project's Bourne
+This is GNU Bash, version 2.03.  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
@@ -49,7 +49,7 @@ more ambitious script that attempts to do a more complete job.
 Reporting Bugs
 ==============
 
-Bug reports for bash-2.02.1 should be sent to:
+Bug reports for bash should be sent to:
 
        bug-bash@prep.ai.mit.edu
 
@@ -67,7 +67,7 @@ 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.02.1-release)
+       * 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
diff --git a/Y2K b/Y2K
new file mode 100644 (file)
index 0000000..aa7ac31
--- /dev/null
+++ b/Y2K
@@ -0,0 +1,5 @@
+Since Bash does not manipulate date strings, it is Y2K-safe.
+
+The only thing that Bash does with date strings is manipulate the string
+returned by ctime(3) in the prompt customization code.  In all cases,
+it discards the year.
index 822ead0ee84aa6b4188c3df0697d0ad334d0c48c..c277a0c61054b45867fb8c53248100677d6e5a45 100644 (file)
@@ -26,7 +26,7 @@ main()
   exit(fl != 1);
 }
 ], bash_cv_dup2_broken=yes, bash_cv_dup2_broken=no,
-    [AC_MSG_ERROR(cannot check dup2 if cross compiling -- defaulting to no)
+    [AC_MSG_WARN(cannot check dup2 if cross compiling -- defaulting to no)
      bash_cv_dup2_broken=no])
 ])
 AC_MSG_RESULT($bash_cv_dup2_broken)
@@ -129,7 +129,7 @@ main()
        exit(ok ? 0 : 5);
 }
 ], bash_cv_pgrp_pipe=no,bash_cv_pgrp_pipe=yes,
-   [AC_MSG_ERROR(cannot check pgrp synchronization if cross compiling -- defaulting to no)
+   [AC_MSG_WARN(cannot check pgrp synchronization if cross compiling -- defaulting to no)
     bash_cv_pgrp_pipe=no])
 ])
 AC_MSG_RESULT($bash_cv_pgrp_pipe)
@@ -187,7 +187,7 @@ main()
 #endif
   exit(1);
 }], bash_cv_type_rlimit=quad_t, bash_cv_type_rlimit=long,
-        [AC_MSG_ERROR(cannot check quad_t if cross compiling -- defaulting to long)
+        [AC_MSG_WARN(cannot check quad_t if cross compiling -- defaulting to long)
          bash_cv_type_rlimit=long])])
 ])
 AC_MSG_RESULT($bash_cv_type_rlimit)
@@ -211,7 +211,7 @@ AC_CACHE_VAL(bash_cv_decl_under_sys_siglist,
 #include <unistd.h>
 #endif], [ char *msg = _sys_siglist[2]; ],
   bash_cv_decl_under_sys_siglist=yes, bash_cv_decl_under_sys_siglist=no,
-  [AC_MSG_ERROR(cannot check for _sys_siglist[] if cross compiling -- defaulting to no)])])dnl
+  [AC_MSG_WARN(cannot check for _sys_siglist[] if cross compiling -- defaulting to no)])])dnl
 AC_MSG_RESULT($bash_cv_decl_under_sys_siglist)
 if test $bash_cv_decl_under_sys_siglist = yes; then
 AC_DEFINE(UNDER_SYS_SIGLIST_DECLARED)
@@ -237,7 +237,7 @@ char *msg = (char *)_sys_siglist[2];
 exit(msg == 0);
 }],
        bash_cv_under_sys_siglist=yes, bash_cv_under_sys_siglist=no,
-       [AC_MSG_ERROR(cannot check for _sys_siglist[] if cross compiling -- defaulting to no)
+       [AC_MSG_WARN(cannot check for _sys_siglist[] if cross compiling -- defaulting to no)
         bash_cv_under_sys_siglist=no])])
 AC_MSG_RESULT($bash_cv_under_sys_siglist)
 if test $bash_cv_under_sys_siglist = yes; then
@@ -264,7 +264,7 @@ char *msg = sys_siglist[2];
 exit(msg == 0);
 }],
        bash_cv_sys_siglist=yes, bash_cv_sys_siglist=no,
-       [AC_MSG_ERROR(cannot check for sys_siglist if cross compiling -- defaulting to no)
+       [AC_MSG_WARN(cannot check for sys_siglist if cross compiling -- defaulting to no)
         bash_cv_sys_siglist=no])])
 AC_MSG_RESULT($bash_cv_sys_siglist)
 if test $bash_cv_sys_siglist = yes; then
@@ -325,7 +325,7 @@ dir = opendir("/tmp/not_a_directory");
 unlink("/tmp/not_a_directory");
 exit (dir == 0);
 }], bash_cv_opendir_not_robust=yes,bash_cv_opendir_not_robust=no,
-    [AC_MSG_ERROR(cannot check opendir if cross compiling -- defaulting to no)
+    [AC_MSG_WARN(cannot check opendir if cross compiling -- defaulting to no)
      bash_cv_opendir_not_robust=no]
 )])
 AC_MSG_RESULT($bash_cv_opendir_not_robust)
@@ -356,109 +356,47 @@ fi
 
 AC_DEFUN(BASH_TYPE_INT32_T,
 [
-if test "X$bash_cv_type_int32_t" = "X"; then
-_bash_needmsg=yes
+if test "$ac_cv_sizeof_int" = 4; then
+  AC_CHECK_TYPE(int32_t, int)
+elif test "$ac_cv_sizeof_long" = 4; then
+  AC_CHECK_TYPE(int32_t, long)
 else
-AC_MSG_CHECKING(which builtin C type is 32 bits wide)
-_bash_needmsg=
-fi
-AC_CACHE_VAL(bash_cv_type_int32_t,
-[AC_TRY_RUN([
-main()
-{
-#if SIZEOF_INT == 4
-exit (0);
-#else
-#  if SIZEOF_LONG == 4
-exit (1);
-#  else
-#    error cannot find 32 bit type...
-#  endif
-#endif
-}], bash_cv_type_int32_t=int, bash_cv_type_int32_t=long,
-    [AC_MSG_ERROR(cannot check type sizes if cross-compiling -- defaulting to int)
-     bash_cv_type_int32_t=int]
-)])
-if test "X$_bash_needmsg" = "Xyes"; then
-AC_MSG_CHECKING(which builtin C type is 32 bits wide)
-fi
-AC_MSG_RESULT($bash_cv_type_int32_t);
-if test "$bash_cv_type_int32_t" = "int"; then
-AC_DEFINE(int32_t, int)
-else
-AC_DEFINE(int32_t, long)
+  AC_CHECK_TYPE(int32_t, int)
 fi
 ])
 
 AC_DEFUN(BASH_TYPE_U_INT32_T,
 [
-if test "X$bash_cv_type_u_int32_t" = "X"; then
-_bash_needmsg=yes
-else
-AC_MSG_CHECKING(which unsigned builtin C type is 32 bits wide)
-_bash_needmsg=
-fi
-AC_CACHE_VAL(bash_cv_type_u_int32_t,
-[AC_TRY_RUN([
-main()
-{
-#if SIZEOF_INT == 4
-exit (0);
-#else
-#  if SIZEOF_LONG == 4
-exit (1);
-#  else
-#    error cannot find 32 bit type...
-#  endif
-#endif
-}], bash_cv_type_u_int32_t=int, bash_cv_type_u_int32_t=long,
-    [AC_MSG_ERROR(cannot check type sizes if cross-compiling -- defaulting to int)
-     bash_cv_type_u_int32_t=int]
-)])
-if test "X$_bash_needmsg" = "Xyes"; then
-AC_MSG_CHECKING(which unsigned builtin C type is 32 bits wide)
-fi
-AC_MSG_RESULT($bash_cv_type_u_int32_t);
-if test "$bash_cv_type_u_int32_t" = "int"; then
-AC_DEFINE(u_int32_t, unsigned int)
+if test "$ac_cv_sizeof_int" = 4; then
+  AC_CHECK_TYPE(u_int32_t, unsigned int)
+elif test "$ac_cv_sizeof_long" = 4; then
+  AC_CHECK_TYPE(u_int32_t, unsigned long)
 else
-AC_DEFINE(u_int32_t, unsigned long)
+  AC_CHECK_TYPE(u_int32_t, unsigned int)
 fi
 ])
 
 AC_DEFUN(BASH_TYPE_PTRDIFF_T,
 [
-if test "X$bash_cv_type_ptrdiff_t" = "X"; then
-_bash_needmsg=yes
+if test "$ac_cv_sizeof_int" = "$ac_cv_sizeof_char_p"; then
+  AC_CHECK_TYPE(ptrdiff_t, int)
+elif test "$ac_cv_sizeof_long" = "$ac_cv_sizeof_char_p"; then
+  AC_CHECK_TYPE(ptrdiff_t, long)
 else
-AC_MSG_CHECKING(which builtin C type is correct for ptrdiff_t)
-_bash_needmsg=
+  AC_CHECK_TYPE(ptrdiff_t, int)
 fi
-AC_CACHE_VAL(bash_cv_type_ptrdiff_t,
-[AC_TRY_RUN([
-main()
-{
-#if SIZEOF_CHAR_P == SIZEOF_INT
-exit (0);
-#else
-#  if SIZEOF_CHAR_P == SIZEOF_LONG
-exit (1);
-#  else
-#    error cannot find type for pointer arithmetic...
-#  endif
-#endif
-}], bash_cv_type_ptrdiff_t=int, bash_cv_type_ptrdiff_t=long,
-    [AC_MSG_ERROR(cannot check type sizes if cross-compiling -- defaulting to int)
-     bash_cv_type_ptrdiff_t=int]
-)])
-if test "X$_bash_needmsg" = "Xyes"; then
-AC_MSG_CHECKING(which builtin C type is correct for ptrdiff_t)
-fi
-AC_MSG_RESULT($bash_cv_type_ptrdiff_t);
-if test "$bash_cv_type_ptrdiff_t" = "int"; then
-AC_DEFINE(ptrdiff_t, int)
+])
+
+AC_DEFUN(BASH_TYPE_BITS64_T,
+[
+if test "$ac_sv_sizeof_char_p" = 8; then
+  AC_CHECK_TYPE(bits64_t, char *)
+elif test "$ac_cv_sizeof_double" = 8; then
+  AC_CHECK_TYPE(bits64_t, double)
+elif test "$ac_cv_sizeof_long" = 8; then
+  AC_CHECK_TYPE(bits64_t, long)
 else
-AC_DEFINE(ptrdiff_t, long)
+  AC_CHECK_TYPE(bits64_t, double)
 fi
 ])
 
@@ -548,7 +486,7 @@ s = getenv("ABCDE");
 exit(s == 0);  /* force optimizer to leave getenv in */
 }
 ], bash_cv_getenv_redef=yes, bash_cv_getenv_redef=no,
-   [AC_MSG_ERROR(cannot check getenv redefinition if cross compiling -- defaulting to yes)
+   [AC_MSG_WARN(cannot check getenv redefinition if cross compiling -- defaulting to yes)
     bash_cv_getenv_redef=yes]
 )])
 AC_MSG_RESULT($bash_cv_getenv_redef)
@@ -574,7 +512,7 @@ pf = (_bashfunc) printf;
 exit(pf == 0);
 }
 ], bash_cv_printf_declared=yes, bash_cv_printf_declared=no,
-   [AC_MSG_ERROR(cannot check printf declaration if cross compiling -- defaulting to yes)
+   [AC_MSG_WARN(cannot check printf declaration if cross compiling -- defaulting to yes)
     bash_cv_printf_declared=yes]
 )])
 AC_MSG_RESULT($bash_cv_printf_declared)
@@ -593,7 +531,7 @@ long maxfds = ulimit(4, 0L);
 exit (maxfds == -1L);
 }
 ], bash_cv_ulimit_maxfds=yes, bash_cv_ulimit_maxfds=no,
-   [AC_MSG_ERROR(cannot check ulimit if cross compiling -- defaulting to no)
+   [AC_MSG_WARN(cannot check ulimit if cross compiling -- defaulting to no)
     bash_cv_ulimit_maxfds=no]
 )])
 AC_MSG_RESULT($bash_cv_ulimit_maxfds)
@@ -690,7 +628,7 @@ main()
        exit (popen_called);
 }
 ], bash_cv_getcwd_calls_popen=no, bash_cv_getcwd_calls_popen=yes,
-   [AC_MSG_ERROR(cannot check whether getcwd calls popen if cross compiling -- defaulting to no)
+   [AC_MSG_WARN(cannot check whether getcwd calls popen if cross compiling -- defaulting to no)
     bash_cv_getcwd_calls_popen=no]
 )])
 AC_MSG_RESULT($bash_cv_getcwd_calls_popen)
@@ -814,7 +752,7 @@ main()
        exit(nsigint != 2);
 }
 ], bash_cv_must_reinstall_sighandlers=no, bash_cv_must_reinstall_sighandlers=yes,
-   [AC_MSG_ERROR(cannot check signal handling if cross compiling -- defaulting to no)
+   [AC_MSG_WARN(cannot check signal handling if cross compiling -- defaulting to no)
     bash_cv_must_reinstall_sighandlers=no]
 )])
 AC_MSG_RESULT($bash_cv_must_reinstall_sighandlers)
@@ -883,7 +821,7 @@ exit(1);
 
 exit(0);
 }], bash_cv_job_control_missing=present, bash_cv_job_control_missing=missing,
-    [AC_MSG_ERROR(cannot check job control if cross-compiling -- defaulting to missing)
+    [AC_MSG_WARN(cannot check job control if cross-compiling -- defaulting to missing)
      bash_cv_job_control_missing=missing]
 )])
 AC_MSG_RESULT($bash_cv_job_control_missing)
@@ -928,7 +866,7 @@ close(fd);
 unlink ("/tmp/sh-np-autoconf");
 exit(0);
 }], bash_cv_sys_named_pipes=present, bash_cv_sys_named_pipes=missing,
-    [AC_MSG_ERROR(cannot check for named pipes if cross-compiling -- defaulting to missing)
+    [AC_MSG_WARN(cannot check for named pipes if cross-compiling -- defaulting to missing)
      bash_cv_sys_named_pipes=missing]
 )])
 AC_MSG_RESULT($bash_cv_sys_named_pipes)
@@ -979,7 +917,7 @@ siglongjmp(xx, 10);
 exit(1);
 #endif
 }], bash_cv_func_sigsetjmp=present, bash_cv_func_sigsetjmp=missing,
-    [AC_MSG_ERROR(cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to missing)
+    [AC_MSG_WARN(cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to missing)
      bash_cv_func_sigsetjmp=missing]
 )])
 AC_MSG_RESULT($bash_cv_func_sigsetjmp)
@@ -1246,7 +1184,7 @@ char    *v[];
        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 -- defaulting to no)
+   [AC_MSG_WARN(cannot check strcoll if cross compiling -- defaulting to no)
     bash_cv_func_strcoll_broken=no]
 )])
 AC_MSG_RESULT($bash_cv_func_strcoll_broken)
@@ -1336,9 +1274,28 @@ main ()
 #endif
 }
 ], bash_cv_sys_restartable_syscalls=yes, bash_cv_sys_restartable_syscalls=no,
-   AC_MSG_ERROR(cannot check restartable syscalls if cross compiling))
+   AC_MSG_WARN(cannot check restartable syscalls if cross compiling))
 ])
 if test $bash_cv_sys_restartable_syscalls = yes; then
   AC_DEFINE(HAVE_RESTARTABLE_SYSCALLS)
 fi
 ])
+dnl
+dnl Check for 64-bit off_t -- used for malloc alignment
+dnl
+dnl C does not allow duplicate case labels, so the compile will fail if
+dnl sizeof(off_t) is > 4.
+dnl
+AC_DEFUN(BASH_CHECK_OFF_T_64,
+[AC_CACHE_CHECK(for 64-bit off_t, bash_cv_off_t_64,
+AC_TRY_COMPILE([
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <sys/types.h>
+],[
+switch (0) case 0: case (sizeof (off_t) <= 4):;
+], bash_cv_off_t_64=no, bash_cv_off_t_64=yes))
+if test $bash_cv_off_t_64 = yes; then
+        AC_DEFINE(HAVE_OFF_T_64)
+fi])
index 744c8fa012bd74b5d79d5e001b63d291fa1aee21..ed88b2ccfd134f837614f327624b8d2e708f3cf1 100644 (file)
@@ -289,7 +289,7 @@ maybe_append_history (filename)
       /* If the filename was supplied, then create it if necessary. */
       if (stat (filename, &buf) == -1 && errno == ENOENT)
        {
-         fd = open (filename, O_WRONLY|O_CREAT, 0666);
+         fd = open (filename, O_WRONLY|O_CREAT, 0600);
          if (fd < 0)
            {
              builtin_error ("%s: cannot create: %s", filename, strerror (errno));
@@ -324,7 +324,7 @@ maybe_save_shell_history ()
          if (stat (hf, &buf) == -1)
            {
              int file;
-             file = open (hf, O_CREAT | O_TRUNC | O_WRONLY, 0666);
+             file = open (hf, O_CREAT | O_TRUNC | O_WRONLY, 0600);
              if (file != -1)
                close (file);
            }
index 3709050e2b3cfa35259aed1aa61b768c66074dc1..03af185a394b18ef72a4a61db81b9381432ee32d 100644 (file)
@@ -239,50 +239,50 @@ initialize_readline ()
 #endif
 
 #if defined (BRACE_COMPLETION)
-  rl_add_defun ("complete-into-braces", bash_brace_completion, -1);
-  rl_bind_key_in_map ('{', bash_brace_completion, emacs_meta_keymap);
+  rl_add_defun ("complete-into-braces", (Function *)bash_brace_completion, -1);
+  rl_bind_key_in_map ('{', (Function *)bash_brace_completion, emacs_meta_keymap);
 #endif /* BRACE_COMPLETION */
 
 #if defined (SPECIFIC_COMPLETION_FUNCTIONS)
-  rl_add_defun ("complete-filename", bash_complete_filename, -1);
-  rl_bind_key_in_map ('/', bash_complete_filename, emacs_meta_keymap);
+  rl_add_defun ("complete-filename", (Function *)bash_complete_filename, -1);
+  rl_bind_key_in_map ('/', (Function *)bash_complete_filename, emacs_meta_keymap);
   rl_add_defun ("possible-filename-completions",
-               bash_possible_filename_completions, -1);
-  rl_bind_key_in_map ('/', bash_possible_filename_completions, emacs_ctlx_keymap);
+               (Function *)bash_possible_filename_completions, -1);
+  rl_bind_key_in_map ('/', (Function *)bash_possible_filename_completions, emacs_ctlx_keymap);
 
-  rl_add_defun ("complete-username", bash_complete_username, -1);
-  rl_bind_key_in_map ('~', bash_complete_username, emacs_meta_keymap);
+  rl_add_defun ("complete-username", (Function *)bash_complete_username, -1);
+  rl_bind_key_in_map ('~', (Function *)bash_complete_username, emacs_meta_keymap);
   rl_add_defun ("possible-username-completions",
-               bash_possible_username_completions, -1);
-  rl_bind_key_in_map ('~', bash_possible_username_completions, emacs_ctlx_keymap);
+               (Function *)bash_possible_username_completions, -1);
+  rl_bind_key_in_map ('~', (Function *)bash_possible_username_completions, emacs_ctlx_keymap);
 
-  rl_add_defun ("complete-hostname", bash_complete_hostname, -1);
-  rl_bind_key_in_map ('@', bash_complete_hostname, emacs_meta_keymap);
+  rl_add_defun ("complete-hostname", (Function *)bash_complete_hostname, -1);
+  rl_bind_key_in_map ('@', (Function *)bash_complete_hostname, emacs_meta_keymap);
   rl_add_defun ("possible-hostname-completions",
-               bash_possible_hostname_completions, -1);
-  rl_bind_key_in_map ('@', bash_possible_hostname_completions, emacs_ctlx_keymap);
+               (Function *)bash_possible_hostname_completions, -1);
+  rl_bind_key_in_map ('@', (Function *)bash_possible_hostname_completions, emacs_ctlx_keymap);
 
-  rl_add_defun ("complete-variable", bash_complete_variable, -1);
-  rl_bind_key_in_map ('$', bash_complete_variable, emacs_meta_keymap);
+  rl_add_defun ("complete-variable", (Function *)bash_complete_variable, -1);
+  rl_bind_key_in_map ('$', (Function *)bash_complete_variable, emacs_meta_keymap);
   rl_add_defun ("possible-variable-completions",
-               bash_possible_variable_completions, -1);
-  rl_bind_key_in_map ('$', bash_possible_variable_completions, emacs_ctlx_keymap);
+               (Function *)bash_possible_variable_completions, -1);
+  rl_bind_key_in_map ('$', (Function *)bash_possible_variable_completions, emacs_ctlx_keymap);
 
-  rl_add_defun ("complete-command", bash_complete_command, -1);
-  rl_bind_key_in_map ('!', bash_complete_command, emacs_meta_keymap);
+  rl_add_defun ("complete-command", (Function *)bash_complete_command, -1);
+  rl_bind_key_in_map ('!', (Function *)bash_complete_command, emacs_meta_keymap);
   rl_add_defun ("possible-command-completions",
-               bash_possible_command_completions, -1);
-  rl_bind_key_in_map ('!', bash_possible_command_completions, emacs_ctlx_keymap);
+               (Function *)bash_possible_command_completions, -1);
+  rl_bind_key_in_map ('!', (Function *)bash_possible_command_completions, emacs_ctlx_keymap);
 
-  rl_add_defun ("glob-expand-word", bash_glob_expand_word, -1);
-  rl_add_defun ("glob-list-expansions", bash_glob_list_expansions, -1);
-  rl_bind_key_in_map ('*', bash_glob_expand_word, emacs_ctlx_keymap);
-  rl_bind_key_in_map ('g', bash_glob_list_expansions, emacs_ctlx_keymap);
+  rl_add_defun ("glob-expand-word", (Function *)bash_glob_expand_word, -1);
+  rl_add_defun ("glob-list-expansions", (Function *)bash_glob_list_expansions, -1);
+  rl_bind_key_in_map ('*', (Function *)bash_glob_expand_word, emacs_ctlx_keymap);
+  rl_bind_key_in_map ('g', (Function *)bash_glob_list_expansions, emacs_ctlx_keymap);
 
 #endif /* SPECIFIC_COMPLETION_FUNCTIONS */
 
-  rl_add_defun ("dynamic-complete-history", dynamic_complete_history, -1);
-  rl_bind_key_in_map (TAB, dynamic_complete_history, emacs_meta_keymap);
+  rl_add_defun ("dynamic-complete-history", (Function *)dynamic_complete_history, -1);
+  rl_bind_key_in_map (TAB, (Function *)dynamic_complete_history, emacs_meta_keymap);
 
   /* Tell the completer that we want a crack first. */
   rl_attempted_completion_function = (CPPFunction *)attempt_shell_completion;
@@ -295,9 +295,9 @@ initialize_readline ()
   rl_ignore_some_completions_function = (Function *)filename_completion_ignore;
 
 #if defined (VI_MODE)
-  rl_bind_key_in_map ('v', vi_edit_and_execute_command, vi_movement_keymap);
+  rl_bind_key_in_map ('v', (Function *)vi_edit_and_execute_command, vi_movement_keymap);
 #  if defined (ALIAS)
-  rl_bind_key_in_map ('@', posix_edit_macros, vi_movement_keymap);
+  rl_bind_key_in_map ('@', (Function *)posix_edit_macros, vi_movement_keymap);
 #  endif
 #endif
 
@@ -561,7 +561,7 @@ static void
 set_saved_history ()
 {
   if (saved_history_line_to_use >= 0)
-    rl_get_previous_history (history_length - saved_history_line_to_use);
+    rl_get_previous_history (history_length - saved_history_line_to_use, 0);
   saved_history_line_to_use = -1;
   rl_startup_hook = old_rl_startup_hook;
 }
@@ -573,7 +573,7 @@ operate_and_get_next (count, c)
   int where;
 
   /* Accept the current line. */
-  rl_newline ();
+  rl_newline (1, c);
 
   /* Find the current line, and find the next line to use. */
   where = where_history ();
@@ -602,7 +602,7 @@ vi_edit_and_execute_command (count, c)
   char *command;
 
   /* Accept the current line. */
-  rl_newline ();
+  rl_newline (1, c);
 
   if (rl_explicit_arg)
     {
@@ -1258,7 +1258,7 @@ set_up_new_line (new_line)
     {
       rl_point = old_point;
       if (!whitespace (rl_line_buffer[rl_point]))
-       rl_forward_word (1);
+       rl_forward_word (1, 0);
     }
 }
 
@@ -1419,7 +1419,7 @@ shell_expand_line (ignore)
        {
          rl_point = old_point;
          if (!whitespace (rl_line_buffer[rl_point]))
-           rl_forward_word (1);
+           rl_forward_word (1, 0);
        }
     }
   else
@@ -1553,10 +1553,24 @@ name_is_acceptable (name)
   return (1);
 }
 
+#if 0
+static int
+ignore_dot_names (name)
+     char *name;
+{
+  return (name[0] != '.');
+}
+#endif
+
 static void
 filename_completion_ignore (names)
      char **names;
 {
+#if 0
+  if (glob_dot_filenames == 0)
+    _ignore_completion_names (names, ignore_dot_names);
+#endif
+
   setup_ignore_patterns (&fignore);
 
   if (fignore.num_ignores == 0)
@@ -1597,14 +1611,15 @@ static int
 bash_directory_completion_hook (dirname)
      char **dirname;
 {
-  char *local_dirname, *t;
+  char *local_dirname, *new_dirname, *t;
   int return_value = 0;
   WORD_LIST *wl;
 
   local_dirname = *dirname;
+  new_dirname = savestring (local_dirname);
   if (strchr (local_dirname, '$') || strchr (local_dirname, '`'))
     {
-      wl = expand_string (local_dirname, 0);
+      wl = expand_string (new_dirname, 0);
       if (wl)
        {
          *dirname = string_list (wl);
@@ -1612,11 +1627,13 @@ bash_directory_completion_hook (dirname)
             actually expanded something. */
          return_value = STREQ (local_dirname, *dirname) == 0;
          free (local_dirname);
+         free (new_dirname);
          dispose_words (wl);
          local_dirname = *dirname;
        }
       else
        {
+         free (new_dirname);
          free (local_dirname);
          *dirname = xmalloc (1);
          **dirname = '\0';
index 2cf5d68216c3ab0eb046fdcd016f28f0fc11a9d2..1c546c969f9b7ebc821862625c844ea4a51add70 100644 (file)
@@ -1,10 +1,11 @@
 # This Makefile for building libbuiltins.a is in -*- text -*- for Emacs.
 #
-SHELL = /bin/sh
+SHELL = @MAKE_SHELL@
 RANLIB = @RANLIB@
 CC = @CC@
 CC_FOR_BUILD = @CC_FOR_BUILD@
 AR = @AR@
+ARFLAGS = @ARFLAGS@
 RM = rm -f
 CP = cp
 
@@ -24,7 +25,7 @@ LDFLAGS = @LDFLAGS@ $(LOCAL_LDFLAGS) $(CFLAGS)
 LOCAL_LDFLAGS = @LOCAL_LDFLAGS@
 LIBS = @LIBS@
 
-INCLUDES = -I. -I.. -I$(topdir) -I$(topdir)/lib -I$(srcdir)
+INCLUDES = -I. -I.. @RL_INCLUDE@ -I$(topdir) -I$(topdir)/lib -I$(srcdir)
 
 CCFLAGS = ${PROFILE_FLAGS} $(DEFS) $(LOCAL_DEFS) $(SYSTEM_FLAGS) $(CPPFLAGS) \
          ${INCLUDES} $(LOCAL_CFLAGS) $(CFLAGS)
@@ -87,7 +88,7 @@ all: $(MKBUILTINS) libbuiltins.a
 
 libbuiltins.a: $(MKBUILTINS) $(OFILES) builtins.o
        $(RM) $@
-       $(AR) cr $@ $(OFILES)
+       $(AR) $(ARFLAGS) $@ $(OFILES)
        -$(RANLIB) $@
 
 builtext.h builtins.c: $(MKBUILTINS) $(DEFSRC)
@@ -95,12 +96,12 @@ builtext.h builtins.c: $(MKBUILTINS) $(DEFSRC)
        @-if test -f builtext.h; then mv -f builtext.h old-builtext.h; fi
        ./$(MKBUILTINS) -externfile builtext.h -structfile builtins.c \
            -noproduction $(DIRECTDEFINE) $(DEFSRC)
-       @-if cmp -s old-builtext.h builtext.h; then \
+       @-if cmp -s old-builtext.h builtext.h 2>/dev/null; then \
                mv old-builtext.h builtext.h; \
         else \
                $(RM) old-builtext.h; \
         fi
-       @-if cmp -s old-builtins.c builtins.c; then \
+       @-if cmp -s old-builtins.c builtins.c 2>/dev/null; then \
                mv old-builtins.c builtins.c; \
         else \
                $(RM) old-builtins.c; \
@@ -112,7 +113,7 @@ mkbuiltins.o: mkbuiltins.c
        $(CC_FOR_BUILD) -c $(CCFLAGS) $<
 
 mkbuiltins: mkbuiltins.o
-       $(CC_FOR_BUILD) $(LDFLAGS) -o $(MKBUILTINS) mkbuiltins.o $(LIBS)
+       $(CC_FOR_BUILD) $(PROFILE_FLAGS) $(LDFLAGS) -o $(MKBUILTINS) mkbuiltins.o $(LIBS)
 
 # rules for deficient makes, like SunOS
 mkbuiltins.o: mkbuiltins.c
@@ -126,7 +127,7 @@ evalfile.o: evalfile.c
 ulimit.o: pipesize.h
 
 pipesize.h:    psize.aux
-       $(SHELL) $(srcdir)/psize.sh > pipesize.h
+       $(SHELL) $(srcdir)/psize.sh > $@
 
 psize.aux:     psize.c
        $(CC_FOR_BUILD) $(CCFLAGS) -o $@ $(srcdir)/psize.c
@@ -139,7 +140,7 @@ builtins.texi: $(MKBUILTINS)
        ./$(MKBUILTINS) -documentonly $(DEFSRC)
 
 clean:
-       $(RM) $(OFILES) $(CREATED_FILES) $(MKBUILTINS) libbuiltins.a
+       $(RM) $(OFILES) $(CREATED_FILES) $(MKBUILTINS) mkbuiltins.o libbuiltins.a
 
 mostlyclean: 
        $(RM) $(OFILES) libbuiltins.a
index 76ef14ba3ec77f72a082d7077e6193f80b8a427b..b6bf692f7c1aded5c3e3bbd3569e74a688d70134 100644 (file)
@@ -140,22 +140,20 @@ bindpwd (no_symlinks)
   else
     dirname = get_working_directory ("cd");
 
-  bind_variable ("OLDPWD", get_string_value ("PWD"));
-
   old_anm = array_needs_making;
+  pwdvar = get_string_value ("PWD");
+
+  tvar = bind_variable ("OLDPWD", pwdvar);
+  if (old_anm == 0 && array_needs_making && exported_p (tvar))
+    {
+      update_export_env_inplace ("OLDPWD=", 7, pwdvar);
+      array_needs_making = 0;
+    }
+
   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=");
-      if (dirname)
-       strcpy (pwdvar + 4, dirname);
-      add_or_supercede_exported_var (pwdvar, 0);
+      update_export_env_inplace ("PWD=", 4, dirname);
       array_needs_making = 0;
     }
 
@@ -243,7 +241,7 @@ cd_builtin (list)
        {
          /* Find directory in $CDPATH. */
          path_index = 0;
-         while ((path = extract_colon_unit (cdpath, &path_index)))
+         while (path = extract_colon_unit (cdpath, &path_index))
            {
              /* OPT is 1 if the path element is non-empty */
              opt = path[0] != '\0';
index 61ea1095692ae324c37d219de6526b508959fe84..20842d5a6b17ce072233a6fab6007044bbbfeeda 100644 (file)
@@ -26,17 +26,17 @@ $FUNCTION enable_builtin
 $SHORT_DOC enable [-pnds] [-a] [-f filename] [name ...]
 Enable and disable builtin shell commands.  This allows
 you to use a disk command which has the same name as a shell
-builtin.  If -n is used, the NAMEs become disabled; otherwise
-NAMEs are enabled.  For example, to use the `test' found on your
-path instead of the shell builtin version, type `enable -n test'.
-On systems supporting dynamic loading, the -f option may be used
-to load new builtins from the shared object FILENAME.  The -d
-option will delete a builtin previously loaded with -f.  If no
-non-option names are given, or the -p option is supplied, a list
-of builtins is printed.  The -a option means to print every builtin
-with an indication of whether or not it is enabled.  The -s option
-restricts the output to the Posix.2 `special' builtins.  The -n
-option displays a list of all disabled builtins.
+builtin without specifying a full pathname.  If -n is used, the
+NAMEs become disabled; otherwise NAMEs are enabled.  For example,
+to use the `test' found in $PATH instead of the shell builtin
+version, type `enable -n test'.  On systems supporting dynamic
+loading, the -f option may be used to load new builtins from the
+shared object FILENAME.  The -d option will delete a builtin
+previously loaded with -f.  If no non-option names are given, or
+the -p option is supplied, a list of builtins is printed.  The
+-a option means to print every builtin with an indication of whether
+or not it is enabled.  The -s option restricts the output to the POSIX.2
+`special' builtins.  The -n option displays a list of all disabled builtins.
 $END
 
 #include <config.h>
@@ -391,6 +391,20 @@ delete_builtin (b)
   shell_builtins = new_shell_builtins;
 }
 
+/* Tenon's MachTen has a dlclose that doesn't return a value, so we
+   finesse it with a local wrapper. */
+static int
+local_dlclose (handle)
+     void *handle;
+{
+#if !defined (__MACHTEN__)
+  return (dlclose (handle));
+#else /* __MACHTEN__ */
+  dlclose (handle);
+  return ((dlerror () != NULL) ? -1 : 0);    
+#endif /* __MACHTEN__ */
+}
+
 static int
 dyn_unload_builtin (name)
      char *name;
@@ -398,6 +412,7 @@ dyn_unload_builtin (name)
   struct builtin *b;
   void *handle;
   int ref, i;
+  char *uerror;
 
   b = builtin_address_internal (name, 1);
   if (b == 0)
@@ -420,7 +435,7 @@ dyn_unload_builtin (name)
 
   /* Don't remove the shared object unless the reference count of builtins
      using it drops to zero. */
-  if (ref == 1 && dlclose (handle) != 0)
+  if (ref == 1 && local_dlclose (handle) != 0)
     {
       builtin_error ("cannot delete %s: %s", name, dlerror ());
       return (EXECUTION_FAILURE);
index 0063b711ed85755c66394195f0de0728475de76c..56d2e1bc0aa03aaf040bd3403ac09b4ffd9eaa35 100644 (file)
@@ -51,6 +51,8 @@
 extern int errno;
 #endif
 
+#define IS_BUILTIN(s)  (builtin_address_internal(s, 0) != (struct builtin *)NULL)
+
 extern void run_trap_cleanup ();
 
 extern int interactive, interactive_shell;
@@ -181,7 +183,7 @@ parse_and_execute (string, from_file, flags)
                }
 
            default:
-             programming_error ("parse_and_execute: bad jump: code %d", code);
+             command_error ("parse_and_execute", CMDERR_BADJUMP, code, 0);
              break;
            }
        }
@@ -206,9 +208,20 @@ parse_and_execute (string, from_file, flags)
              global_command = (COMMAND *)NULL;
 
 #if defined (ONESHOT)
-             if (startup_state == 2 && *bash_input.location.string == '\0' &&
-                 command->type == cm_simple && !command->redirects &&
-                 !command->value.Simple->redirects &&
+             /*
+              * IF
+              *   we were invoked as `bash -c' (startup_state == 2) AND
+              *   parse_and_execute has not been called recursively AND
+              *   we have parsed the full command (string == '\0') AND
+              *   we have a simple command without redirections AND
+              *   the command is not being timed
+              * THEN
+              *   tell the execution code that we don't need to fork
+              */
+             if (startup_state == 2 && parse_and_execute_level == 1 &&
+                 *bash_input.location.string == '\0' &&
+                 command->type == cm_simple &&
+                 !command->redirects && !command->value.Simple->redirects &&
                  ((command->flags & CMD_TIME_PIPELINE) == 0))
                {
                  command->flags |= CMD_NO_FORK;
index 587d7edd1b3d7fb9e2e9511316183cea743e6b30..064420baf792910c1ab0808c69bf57bd133257fc 100644 (file)
@@ -26,13 +26,13 @@ $FUNCTION fc_builtin
 $DEPENDS_ON HISTORY
 $SHORT_DOC fc [-e ename] [-nlr] [first] [last] or fc -s [pat=rep] [cmd]
 
+fc is used to list or edit and re-execute commands from the history list.
 FIRST and LAST can be numbers specifying the range, or FIRST can be a
 string, which means the most recent command beginning with that
 string.
 
    -e ENAME selects which editor to use.  Default is FCEDIT, then EDITOR,
-      then the editor which corresponds to the current readline editing
-      mode, then vi.
+      then vi.
 
    -l means list lines instead of editing.
    -n means no line numbers listed.
@@ -156,7 +156,7 @@ fc_builtin (list)
   register int i;
   register char *sep;
   int numbering, reverse, listing, execute;
-  int histbeg, histend, last_hist, retval, first, opt;
+  int histbeg, histend, last_hist, retval, opt;
   FILE *stream;
   REPL *rlist, *rl;
   char *ename, *command, *newcom, *line;
@@ -372,64 +372,11 @@ fc_builtin (list)
       return (EXECUTION_FAILURE);
     }
 
-  /* Now reopen the file and execute the edited commands. */
-
-  stream = fopen (fn, "r");
-
-  if (stream == NULL)
-    {
-      builtin_error ("cannot reopen temp file %s", fn);
-      unlink (fn);
-      return (EXECUTION_FAILURE);
-    }
-
-  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')
-       {
-         free (line);
-         continue;             /* Skip blank lines. */
-       }
-
-      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
-       {
-         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 fc_execute_file runs so the commands
      will be echoed as they are read by the parser. */
index 2fbcac73ea13ce183a5394caf6e3cd45fd667dc3..ff44340a368fef7a0aecb077dbb0dcac47df4e21 100644 (file)
@@ -232,6 +232,19 @@ sh_getopt_restore_state (argv)
     nextchar = argv[sh_curopt] + sh_charindex;
 }
 
+#if 0
+void
+sh_getopt_debug_restore_state (argv)
+     char **argv;
+{
+  if (nextchar && nextchar != argv[sh_curopt] + sh_charindex)
+    {
+      itrace("sh_getopt_debug_restore_state: resetting nextchar");
+      nextchar = argv[sh_curopt] + sh_charindex;
+    }
+}
+#endif
 #ifdef TEST
 
 /* Compile with -DTEST to make an executable for use in testing
index 533775af60bddd478a42cd6232f681c2337767da..941b666fbdd0792d7b188272e9e74975844abbc6 100644 (file)
@@ -181,6 +181,8 @@ dogetopts (argc, argv)
     {
       for (i = 0; i < 10 && dollar_vars[i]; i++)
        ;
+
+      sh_getopt_restore_state (dollar_vars);
       ret = sh_getopt (i, dollar_vars, optstr);
     }
   else
@@ -198,6 +200,7 @@ dogetopts (argc, argv)
       for (words = rest_of_args; words; words = words->next, i++)
         v[i] = words->word->word;
       v[i] = (char *)NULL;
+      sh_getopt_restore_state (v);
       ret = sh_getopt (i, v, optstr);
       free (v);
     }
index 8cd2703986c2dd4bf0642be696a7cab2053d0aa3..2151eb44183cc1359fdd66d89c6d8e204c88468b 100644 (file)
@@ -130,6 +130,10 @@ char *assignment_builtins[] =
 static int is_special_builtin ();
 static int is_assignment_builtin ();
 
+#if !defined (HAVE_RENAME)
+static int rename ();
+#endif
+
 void extract_info ();
 
 void file_error ();
@@ -265,8 +269,7 @@ main (argc, argv)
        {
          write_longdocs (structfile, saved_builtins);
          fclose (structfile);
-         link (temp_struct_filename, struct_filename);
-         unlink (temp_struct_filename);
+         rename (temp_struct_filename, struct_filename);
        }
 
       if (externfile)
@@ -457,6 +460,10 @@ extract_info (filename, structfile, externfile)
   if ((nr = read (fd, buffer, file_size)) < 0)
     file_error (filename);
 
+  /* This is needed on WIN32, and does not hurt on Unix. */
+  if (nr < file_size)
+    file_size = nr;
+
   close (fd);
 
   if (nr == 0)
@@ -1395,3 +1402,16 @@ is_assignment_builtin (name)
 {
   return (_find_in_table (name, assignment_builtins));
 }
+
+#if !defined (HAVE_RENAME)
+static int
+rename (from, to)
+     char *from, *to;
+{
+  unlink (to);
+  if (link (from, to) < 0)
+    return (-1);
+  unlink (from);
+  return (0);
+}
+#endif /* !HAVE_RENAME */
index 9d1493bc40c952596eb93a8fd3faa00702ebaa56..b573ecec4b80886cad24d41ce62f1ec582f535ef 100644 (file)
@@ -99,7 +99,7 @@ int
 printf_builtin (list)
      WORD_LIST *list;
 {
-  int ch, end, fieldwidth, precision, foundmod;
+  int ch, end, fieldwidth, precision, foundmod, fmtlen;
   char convch, nextch, *format, *fmt, *start;
 
   retval = EXECUTION_SUCCESS;
@@ -125,12 +125,12 @@ printf_builtin (list)
   if (list->word->word == 0 || list->word->word[0] == '\0')
     return (EXECUTION_SUCCESS);
 
-  format = ansicstr (list->word->word, strlen (list->word->word), (int *)NULL, (int *)NULL);
+  format = ansicstr (list->word->word, strlen (list->word->word), (int *)NULL, &fmtlen);
 
   garglist = list->next;
 
   /* If the format string is empty after preprocessing, return immediately. */
-  if (format == 0 || *format == 0)
+  if ((format == 0 || *format == 0) && fmtlen == 0)
     return (EXECUTION_SUCCESS);
          
   /* Basic algorithm is to scan the format string for conversion
@@ -139,11 +139,12 @@ printf_builtin (list)
      format strings are reused as necessary to use up the provided
      arguments, arguments of zero/null string are provided to use
      up the format string. */
+#define FMTIND (fmt - format)
 
   do
     {
       /* find next format specification */
-      for (fmt = format; *fmt; fmt++)
+      for (fmt = format; FMTIND < fmtlen; fmt++)
        {
          precision = fieldwidth = foundmod = 0;
 
@@ -179,11 +180,6 @@ printf_builtin (list)
          /* skip to conversion char */
          for (; *fmt && strchr(SKIP2, *fmt); ++fmt)
            ;
-         if (*fmt == 0)
-           {
-             builtin_error ("`%s': missing format character", start);
-             PRETURN (EXECUTION_FAILURE);
-           }
 
          /* skip possible format modifiers */
          if (*fmt == 'l' || *fmt == 'L' || *fmt == 'h')
@@ -192,6 +188,12 @@ printf_builtin (list)
              foundmod = 1;
            }
            
+         if (*fmt == 0)
+           {
+             builtin_error ("`%s': missing format character", start);
+             PRETURN (EXECUTION_FAILURE);
+           }
+
          convch = *fmt;
          nextch = fmt[1];
          fmt[1] = '\0';
index 7226ab20fcffbfb01f78c33c82a4b8563fbd0062..c80271ffa663c7088d48d3c5eee35aceb1db079b 100644 (file)
@@ -117,6 +117,10 @@ $END
 #include "common.h"
 #include "builtext.h"
 
+#ifdef LOADABLE_BUILTIN
+#  include "builtins.h"
+#endif
+
 #if !defined (errno)
 extern int errno;
 #endif /* !errno */
@@ -642,4 +646,98 @@ get_directory_stack ()
     free (d);
   return ret;  /* was (REVERSE_LIST (ret, (WORD_LIST *)); */
 }
+
+#ifdef LOADABLE_BUILTIN
+static char *dirs_doc[] = {
+  "Display the list of currently remembered directories.  Directories",
+  "find their way onto the list with the `pushd' command; you can get",
+  "back up through the list with the `popd' command.",
+  "",
+  "The -l flag specifies that `dirs' should not print shorthand versions",
+  "of directories which are relative to your home directory.  This means",
+  "that `~/bin' might be displayed as `/homes/bfox/bin'.  The -v flag",
+  "causes `dirs' to print the directory stack with one entry per line,",
+  "prepending the directory name with its position in the stack.  The -p",
+  "flag does the same thing, but the stack position is not prepended.",
+  "The -c flag clears the directory stack by deleting all of the elements.",
+  "",
+  "+N   displays the Nth entry counting from the left of the list shown by",
+  "     dirs when invoked without options, starting with zero.",
+  "",
+  "-N   displays the Nth entry counting from the right of the list shown by",
+  "     dirs when invoked without options, starting with zero.",
+  (char *)NULL
+};
+
+static char *pushd_doc[] = {
+  "Adds a directory to the top of the directory stack, or rotates",
+  "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', starting with",
+  "     zero) is at the top.",
+  "",
+  "-N   Rotates the stack so that the Nth directory (counting",
+  "     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.",
+  "",
+  "dir  adds DIR to the directory stack at the top, making it the",
+  "     new current working directory.",
+  "",
+  "You can see the directory stack with the `dirs' command.",
+  (char *)NULL
+};
+
+static char *popd_doc[] = {
+  "Removes entries from the directory stack.  With no arguments,",
+  "removes the top directory from the stack, and cd's to the new",
+  "top directory.",
+  "",
+  "+N   removes the Nth entry counting from the left of the list",
+  "     shown by `dirs', starting with zero.  For example: `popd +0'",
+  "     removes the first directory, `popd +1' the second.",
+  "",
+  "-N   removes the Nth entry counting from the right of the list",
+  "     shown by `dirs', starting with zero.  For example: `popd -0'",
+  "     removes the last directory, `popd -1' the next to last.",
+  "",
+  "-n   suppress the normal change of directory when removing directories",
+  "     from the stack, so only the stack is manipulated.",
+  "",
+  "You can see the directory stack with the `dirs' command.",
+  (char *)NULL
+};
+
+struct builtin pushd_struct = {
+       "pushd",
+       pushd_builtin,
+       BUILTIN_ENABLED,
+       pushd_doc,
+       "pushd [+N | -N] [-n] [dir]",
+       0
+};
+
+struct builtin popd_struct = {
+       "popd",
+       popd_builtin,
+       BUILTIN_ENABLED,
+       popd_doc,
+       "popd [+N | -N] [-n]",
+       0
+};
+
+struct builtin dirs_struct = {
+       "dirs",
+       dirs_builtin,
+       BUILTIN_ENABLED,
+       dirs_doc,
+       "dirs [-clpv] [+N] [-N]",
+       0
+};
+#endif /* LOADABLE_BUILTIN */
+
 #endif /* PUSHD_AND_POPD */
index 6d161f63170079c62b953f153bcfc61c8f8b1dcd..61288afda239ce17192f530a072105f3fe9b6c90 100644 (file)
@@ -189,6 +189,7 @@ read_builtin (list)
          c = rlbuf[rlind++];
        }
       else
+       {
 #endif
 
       while (((retval = read (0, &c, 1)) < 0) && errno == EINTR)
@@ -199,6 +200,10 @@ read_builtin (list)
          break;
        }
 
+#if defined (READLINE)
+       }
+#endif
+
       if (i + 2 >= size)
        input_string = xrealloc (input_string, size += 128);
 
index da59050b435ffa35386d23c1ba5ff0c156f17ed3..527fc1561591a7292056ea62f5fa55b36b9e746d 100644 (file)
@@ -89,7 +89,7 @@ $END
 
 $BUILTIN { ... }
 $DOCNAME grouping_braces
-$SHORT_DOC { COMMANDS }
+$SHORT_DOC { COMMANDS }
 Run a set of commands in a group.  This is one way to redirect an
 entire set of commands.
 $END
index b5ac83b4018ec0c26fcd202075b7eb9052096916..423a0671294c590a0d5abf90c6e6ecdadd81e33b 100644 (file)
@@ -92,7 +92,7 @@ $SHORT_DOC set [--abefhkmnptuvxBCHP] [-o option] [arg ...]
             noclobber    same as -C
             noexec       same as -n
             noglob       same as -f
-            notify       save as -b
+            notify       same as -b
             nounset      same as -u
             onecmd       same as -t
             physical     same as -P
index 762bb420044b4875798672dddad740069a1275ac..1ee5b5416cb908c1a5c52a769528a5834ae61656 100644 (file)
@@ -79,10 +79,19 @@ extern int hist_verify, history_reediting, perform_hostname_completion;
 extern void enable_hostname_completion ();
 #endif
 
+#if defined (RESTRICTED_SHELL)
+extern int restricted_shell;
+extern char *shell_name;
+#endif
+
 extern void set_shellopts ();
 
 static int set_interactive_comments ();
 
+#if defined (RESTRICTED_SHELL)
+static int set_restricted_shell ();
+#endif
+
 static struct {
   char *name;
   int  *value;
@@ -120,6 +129,9 @@ static struct {
   { "nocaseglob", &glob_ignore_case, (Function *)NULL },
   { "nullglob",        &allow_null_glob_expansion, (Function *)NULL },
   { "promptvars", &promptvars, (Function *)NULL },
+#if defined (RESTRICTED_SHELL)
+  { "restricted_shell", &restricted_shell, set_restricted_shell },
+#endif
   { "shift_verbose", &print_shift_error, (Function *)NULL },
   { "sourcepath", &source_uses_path, (Function *)NULL },
   { (char *)0, (int *)0, (Function *)NULL }
@@ -262,7 +274,7 @@ toggle_shopts (mode, list, quiet)
   return (rval);
 }
 
-static int
+static void
 print_shopt (name, val, flags)
      char *name;
      int val, flags;
@@ -400,3 +412,20 @@ set_interactive_comments (mode)
   set_shellopts ();
   return (0);
 }
+
+#if defined (RESTRICTED_SHELL)
+/* Don't allow the value of restricted_shell to be modified. */
+
+static int
+set_restricted_shell (mode)
+     int mode;
+{
+  static int save_restricted = -1;
+
+  if (save_restricted == -1)
+    save_restricted = shell_is_restricted (shell_name);
+
+  restricted_shell = save_restricted;
+  return (0);
+}
+#endif /* RESTRICTED_SHELL */
index eded0faed1fb58a45333b12dd0a18a682da099c1..abae8b4a26d7b1e1628a13fde62818fd03c4dfeb 100644 (file)
@@ -129,7 +129,10 @@ test_builtin (list)
   if (list == 0)
     {
       if (this_command_name[0] == '[' && !this_command_name[1])
-       builtin_error ("missing `]'");
+       {
+         builtin_error ("missing `]'");
+         return (EX_BADUSAGE);
+       }
 
       return (EXECUTION_FAILURE);
     }
index 93c8ff808409119594320fee34fc958f292faeb6..c9338ba9db2a3685302e9aedf6f02d9fc9a398fb 100644 (file)
@@ -62,6 +62,7 @@ $END
 #endif /* ALIAS */
 
 #include "common.h"
+#include "bashgetopt.h"
 
 extern int find_reserved_word ();
 
@@ -69,14 +70,14 @@ extern int find_reserved_word ();
    it as a simple command. i.e., which file would this shell use to
    execve, or if it is a builtin command, or an alias.  Possible flag
    arguments:
-       -type           Returns the "type" of the object, one of
+       -t              Returns the "type" of the object, one of
                        `alias', `keyword', `function', `builtin',
                        or `file'.
 
-       -path           Returns the pathname of the file if -type is
+       -p              Returns the pathname of the file if -type is
                        a file.
 
-       -all            Returns all occurrences of words, whether they
+       -a              Returns all occurrences of words, whether they
                        be a filename in the path, alias, function,
                        or builtin.
    Order of evaluation:
@@ -86,12 +87,14 @@ extern int find_reserved_word ();
        builtin
        file
  */
+
 int
 type_builtin (list)
      WORD_LIST *list;
 {
   int path_only, type_only, all, verbose;
-  int successful_finds;
+  int successful_finds, opt;
+  WORD_LIST *prev, *this;
 
   if (list == 0)
     return (EXECUTION_SUCCESS);
@@ -99,32 +102,69 @@ type_builtin (list)
   path_only = type_only = all = 0;
   successful_finds = 0;
 
-  while (list && *(list->word->word) == '-')
+  /* Handle the obsolescent `-type', `-path', and `-all' by prescanning
+     the arguments and removing those options from the list before calling
+     internal_getopt.  Recognize `--type', `--path', and `--all' also.
+     THIS SHOULD REALLY GO AWAY. */
+  for (this = list; this && this->word->word[0] == '-'; )
     {
-      char *flag = &(list->word->word[1]);
+      char *flag = &(this->word->word[1]);
 
-      if (flag[0] == 't' && (!flag[1] || strcmp (flag + 1, "ype") == 0))
+      if (STREQ (flag, "type") || STREQ (flag, "-type"))
        {
          type_only = 1;
          path_only = 0;
        }
-      else if (flag[0] == 'p' && (!flag[1] || strcmp (flag + 1, "ath") == 0))
+      else if (STREQ (flag, "path") || STREQ (flag, "-path"))
        {
          path_only = 1;
          type_only = 0;
        }
-      else if (flag[0] == 'a' && (!flag[1] || strcmp (flag + 1, "ll") == 0))
+      else if (STREQ (flag, "all") || STREQ (flag, "-all"))
+        all = 1;
+      else
        {
-         all = 1;
+          prev = this;
+          this = this->next;
+          continue;
        }
+
+      /* We found a long option; remove it from the argument list.  Don't
+        free it if it's the head of the argument list, though -- the
+        argument list will be freed by the caller. */
+      if (this == list)
+       this = list = list->next;
       else
        {
-         bad_option (flag);
+         prev->next = this->next;
+         this->next = (WORD_LIST *)NULL;
+         dispose_words (this);
+         this = prev->next;
+       }
+    }
+
+  reset_internal_getopt ();
+  while ((opt = internal_getopt (list, "apt")) != -1)
+    {
+      switch (opt)
+       {
+       case 't':
+         type_only = 1;
+         path_only = 0;
+         break;
+       case 'p':
+         path_only = 1;
+         type_only = 0;
+         break;
+       case 'a':
+         all = 1;
+         break;
+       default:
          builtin_usage ();
          return (EX_USAGE);
        }
-      list = list->next;
     }
+  list = loptend;
 
   if (type_only)
     verbose = 1;
@@ -150,10 +190,7 @@ type_builtin (list)
 
   fflush (stdout);
 
-  if (successful_finds != 0)
-    return (EXECUTION_SUCCESS);
-  else
-    return (EXECUTION_FAILURE);
+  return ((successful_finds != 0) ? EXECUTION_SUCCESS : EXECUTION_FAILURE);
 }
 
 /*
@@ -202,7 +239,7 @@ describe_command (command, verbose, all)
 
       found = 1;
 
-      if (!all)
+      if (all == 0)
        return (1);
     }
 #endif /* ALIAS */
@@ -220,7 +257,7 @@ describe_command (command, verbose, all)
 
       found = 1;
 
-      if (!all)
+      if (all == 0)
        return (1);
     }
 
@@ -251,7 +288,7 @@ describe_command (command, verbose, all)
 
       found = 1;
 
-      if (!all)
+      if (all == 0)
        return (1);
     }
 
@@ -267,7 +304,7 @@ describe_command (command, verbose, all)
 
       found = 1;
 
-      if (!all)
+      if (all == 0)
        return (1);
     }
 
@@ -293,9 +330,9 @@ describe_command (command, verbose, all)
         }
     }
 
-  /* If the user isn't doing "-all", then we might care about
+  /* If the user isn't doing "-a", then we might care about
      whether the file is present in our hash table. */
-  if (!all)
+  if (all == 0)
     {
       if ((full_path = find_hashed_filename (command)) != (char *)NULL)
        {
@@ -314,7 +351,7 @@ describe_command (command, verbose, all)
   /* Now search through $PATH. */
   while (1)
     {
-      if (!all)
+      if (all == 0)
        full_path = find_user_command (command);
       else
        full_path =
@@ -337,7 +374,7 @@ describe_command (command, verbose, all)
       free (full_path);
       full_path = (char *)NULL;
 
-      if (!all)
+      if (all == 0)
        break;
     }
 
index bbeb7c920a31352dd6c4d469afb8483474566bf7..f3d0c8e563be6d120185093cd4e0e7cff886a93b 100644 (file)
@@ -154,24 +154,20 @@ extern int errno;
 #  define RLIM_INFINITY 0x7fffffff
 #endif
 
-#if !defined (RLIM_INVALID)
-#  define RLIM_INVALID (RLIMTYPE)-1
-#endif
-
 #define LIMIT_HARD 0x01
 #define LIMIT_SOFT 0x02
 
-static int ulimit_internal ();
-static void printone ();
-static void print_all_limits ();
+static int ulimit_internal __P((int, char *, int, int));
+static void printone __P((int, RLIMTYPE, int));
+static void print_all_limits __P((int));
 
-static int get_limit ();
-static int set_limit ();
+static int get_limit __P((int, int, RLIMTYPE *));
+static int set_limit __P((int, RLIMTYPE, int));
 
-static RLIMTYPE filesize ();
-static RLIMTYPE pipesize ();
-static RLIMTYPE getmaxuprc ();
-static RLIMTYPE getmaxvm ();
+static int filesize __P((RLIMTYPE *));
+static int pipesize __P((RLIMTYPE *));
+static int getmaxuprc __P((int, RLIMTYPE *));
+static int getmaxvm __P((int, RLIMTYPE *));
 
 typedef struct {
   int  option;                 /* The ulimit option for this limit. */
@@ -351,7 +347,6 @@ ulimit_internal (cmd, cmdarg, mode, multiple)
   long block_factor;
   RLIMTYPE current_limit, real_limit, limit;
 
-  limit = RLIM_INVALID;
   setting = cmdarg != 0;
   limind = _findlim (cmd);
   if (mode == 0)
@@ -412,26 +407,30 @@ get_limit (ind, mode, limptr)
       switch (limits[ind].parameter)
        {
        case RLIMIT_FILESIZE:
-         value = filesize ();
+         if (filesize (&value) < 0)
+           return -1;
          break;
        case RLIMIT_PIPESIZE:
-         value = pipesize ();
+         if (pipesize (&value) < 0)
+           return -1;
          break;
        case RLIMIT_OPENFILES:
          value = (RLIMTYPE)getdtablesize ();
          break;
        case RLIMIT_VIRTMEM:
-         value = getmaxvm (mode);
+         if (getmaxvm (mode, &value) < 0)
+           return -1;
          break;
        case RLIMIT_MAXUPROC:
-         value = getmaxuprc (mode);
+         if (getmaxuprc (mode, &value) < 0)
+           return -1;
          break;
        default:
          errno = EINVAL;
          return -1;
        }
       *limptr = value;
-      return ((value == RLIM_INVALID) ? -1 : 0);
+      return (0);
     }
   else
     {
@@ -439,6 +438,11 @@ get_limit (ind, mode, limptr)
       if (getrlimit (limits[ind].parameter, &limit) < 0)
        return -1;
       value = (mode & LIMIT_SOFT) ? limit.rlim_cur : limit.rlim_max;
+#  if defined (HPUX9)
+      if (limits[ind].parameter == RLIMIT_FILESIZE)
+       *limptr = value * 512;                  /* Ugh. */
+      else
+#  endif /* HPUX9 */
       *limptr = value;
       return 0;
 #else
@@ -486,6 +490,10 @@ set_limit (ind, newlim, mode)
 #if defined (HAVE_RESOURCE)
       if (getrlimit (limits[ind].parameter, &limit) < 0)
        return -1;
+#  if defined (HPUX9)
+      if (limits[ind].parameter == RLIMIT_FILESIZE)
+       newlim /= 512;                          /* Ugh. */
+#  endif /* HPUX9 */
       val = (current_user.euid != 0 && newlim == RLIM_INFINITY &&
               (limit.rlim_cur <= limit.rlim_max))
                 ? limit.rlim_max : newlim;
@@ -502,72 +510,91 @@ set_limit (ind, newlim, mode)
     }
 }
 
-static RLIMTYPE
-getmaxvm (mode)
+static int
+getmaxvm (mode, valuep)
      int mode;
+     RLIMTYPE *valuep;
 {
 #if defined (HAVE_RESOURCE)
   struct rlimit rl;
   RLIMTYPE maxdata, maxstack;
 
   if (getrlimit (RLIMIT_DATA, &rl) < 0)
-    return (RLIM_INVALID);
+    return -1;
   else
     maxdata = (mode & LIMIT_SOFT) ? rl.rlim_cur : rl.rlim_max;
 
   if (getrlimit (RLIMIT_STACK, &rl) < 0)
-    return (RLIM_INVALID);
+    return -1;
   else
     maxstack = (mode & LIMIT_SOFT) ? rl.rlim_cur : rl.rlim_max;
 
   /* Protect against overflow. */
-  return ((maxdata / 1024L) + (maxstack / 1024L));
+  *valuep = (maxdata / 1024L) + (maxstack / 1024L);
+  return 0;
 #else
   errno = EINVAL;
-  return RLIM_INVALID;
+  return -1;
 #endif /* HAVE_RESOURCE */
 }
 
-static RLIMTYPE
-filesize()
+static int
+filesize(valuep)
+     RLIMTYPE *valuep;
 {
 #if !defined (HAVE_RESOURCE)
-  return ((RLIMTYPE)ulimit (1, 0L));
+  long result;
+  if ((result = ulimit (1, 0L)) < 0)
+    return -1;
+  else
+    *valuep = (RLIMTYPE) result;
+  return 0;
 #else
   errno = EINVAL;
-  return RLIM_INVALID;
+  return -1;
 #endif
 }
 
-static RLIMTYPE
-pipesize ()
+static int
+pipesize (valuep)
+     RLIMTYPE *valuep;
 {
 #if defined (PIPE_BUF)
   /* This is defined on Posix systems. */
-  return ((RLIMTYPE) PIPE_BUF);
+  *valuep = (RLIMTYPE) PIPE_BUF;
+  return 0;
 #else
 #  if defined (PIPESIZE)
   /* This is defined by running a program from the Makefile. */
-  return ((RLIMTYPE) PIPESIZE);
+  *valuep = (RLIMTYPE) PIPESIZE;
+  return 0;
 #  else
   errno = EINVAL;
-  return RLIM_INVALID;  
+  return -1;  
 #  endif /* PIPESIZE */
 #endif /* PIPE_BUF */
 }
 
-static RLIMTYPE
-getmaxuprc (mode)
+static int
+getmaxuprc (mode, valuep)
      int mode;
+     RLIMTYPE *valuep;
 {
 #  if defined (HAVE_SYSCONF) && defined (_SC_CHILD_MAX)
-  return ((RLIMTYPE)sysconf (_SC_CHILD_MAX));
+  long maxchild;
+  maxchild = sysconf (_SC_CHILD_MAX);
+  if (maxchild < 0)
+    return -1;
+  else
+    *valuep = (RLIMTYPE) maxchild;
+  return 0;
 #  else /* !HAVE_SYSCONF || !_SC_CHILD_MAX */
 #    if defined (MAXUPRC)
-  return ((RLIMTYPE)MAXUPRC);
+  *valuep = (RLIMTYPE) MAXUPRC;
+  return 0;
 #    else /* MAXUPRC */
   errno = EINVAL;
-  return RLIM_INVALID;
+  return -1;
 #    endif /* !MAXUPRC */
 #  endif /* !HAVE_SYSCONF || !_SC_CHILD_MAX */
 }
@@ -585,8 +612,12 @@ print_all_limits (mode)
   for (i = 0; limits[i].option > 0; i++)
     {
       if (get_limit (i, mode, &value) < 0)
-       value = RLIM_INVALID;
-      printone (i, value, 1);     
+       {
+         fprintf (stderr, DESCFMT, limits[i].description);
+         builtin_error ("cannot get limit: %s", strerror (errno));
+       }
+      else
+       printone (i, value, 1);     
     }
 }
 
@@ -600,8 +631,6 @@ printone (limind, curlim, pdesc)
     printf (DESCFMT, limits[limind].description);
   if (curlim == RLIM_INFINITY)
     puts ("unlimited");
-  else if (curlim == RLIM_INVALID)
-    builtin_error ("cannot get limit: %s\n", strerror (errno));
   else
     print_rlimtype ((curlim / limits[limind].block_factor), 1);
 }
index f73411303c8b31fcbbbfbae2fbb2eafd5d587933..5b98c0c8bb0b867952d56431bd91cf71f14967cc 100644 (file)
@@ -174,29 +174,15 @@ print_symbolic_umask (um)
   printf ("u=%s,g=%s,o=%s\n", ubits, gbits, obits);
 }
 
-/* Set the umask from a symbolic mode string similar to that accepted
-   by chmod.  If the -S argument is given, then print the umask in a
-   symbolic form. */
-static int
-symbolic_umask (list)
-     WORD_LIST *list;
+int
+parse_symbolic_mode (mode, initial_bits)
+     char *mode;
+     int initial_bits;
 {
-  int um, umc, c;
-  int who, op, perm, mask;
+  int who, op, perm, mask, bits, c;
   char *s;
 
-  /* Get the initial umask.  Don't change it yet. */
-  um = umask (022);
-  umask (um);
-
-  /* All work below is done with the complement of the umask -- it's
-     more intuitive and easier to deal with.  It is complemented
-     again before being returned. */
-  umc = ~um;
-
-  s = list->word->word;
-
-  for (;;)
+  for (s = mode, bits = initial_bits;;)
     {
       who = op = perm = mask = 0;
 
@@ -205,20 +191,20 @@ symbolic_umask (list)
         {
          switch (c = *s++)
            {
-             case 'u':
-               who |= S_IRWXU;
-               continue;
-             case 'g':
-               who |= S_IRWXG;
-               continue;
-             case 'o':
-               who |= S_IRWXO;
-               continue;
-             case 'a':
-               who |= S_IRWXU | S_IRWXG | S_IRWXO;
-               continue;
-             default:
-               break;
+           case 'u':
+             who |= S_IRWXU;
+             continue;
+           case 'g':
+             who |= S_IRWXG;
+             continue;
+           case 'o':
+             who |= S_IRWXO;
+             continue;
+           case 'a':
+             who |= S_IRWXU | S_IRWXG | S_IRWXO;
+             continue;
+           default:
+             break;
            }
        }
 
@@ -226,13 +212,13 @@ symbolic_umask (list)
       op = *s++;
       switch (op)
        {
-         case '+':
-         case '-':
-         case '=':
-           break;
-         default:
-           builtin_error ("bad symbolic mode operator: %c", op);
-           return (-1);
+       case '+':
+       case '-':
+       case '=':
+         break;
+       default:
+         builtin_error ("bad symbolic mode operator: %c", op);
+         return (-1);
        }
 
       /* Parse out the `perm' section of the symbolic mode clause. */
@@ -242,17 +228,15 @@ symbolic_umask (list)
 
          switch (c)
            {
-             case 'r':
-               perm |= S_IRUGO;
-               break;
-
-             case 'w':
-               perm |= S_IWUGO;
-               break;
-
-             case 'x':
-               perm |= S_IXUGO;
-               break;
+           case 'r':
+             perm |= S_IRUGO;
+             break;
+           case 'w':
+             perm |= S_IWUGO;
+             break;
+           case 'x':
+             perm |= S_IXUGO;
+             break;
            }
        }
 
@@ -265,32 +249,22 @@ symbolic_umask (list)
 
          switch (op)
            {
-             case '+':
-               umc |= perm;
-               break;
-
-             case '-':
-               umc &= ~perm;
-               break;
-
-             case '=':
-               umc &= ~who;
-               umc |= perm;
-               break;
-
-#if 0
-             /* No other values are possible. */
-             default:
-               builtin_error ("bad symbolic mode operator: %c", op);
-               return (-1);
-#endif
-           }
-
-         if (!*s)
-           {
-             um = ~umc & 0777;
+           case '+':
+             bits |= perm;
+             break;
+           case '-':
+             bits &= ~perm;
              break;
+           case '=':
+             bits &= ~who;
+             bits |= perm;
+             break;
+
+           /* No other values are possible. */
            }
+
+         if (*s == '\0')
+           break;
          else
            s++;        /* skip past ',' */
        }
@@ -300,5 +274,28 @@ symbolic_umask (list)
          return (-1);
        }
     }
+
+  return (bits);
+}
+
+/* Set the umask from a symbolic mode string similar to that accepted
+   by chmod.  If the -S argument is given, then print the umask in a
+   symbolic form. */
+static int
+symbolic_umask (list)
+     WORD_LIST *list;
+{
+  int um, bits;
+
+  /* Get the initial umask.  Don't change it yet. */
+  um = umask (022);
+  umask (um);
+
+  /* All work is done with the complement of the umask -- it's
+     more intuitive and easier to deal with.  It is complemented
+     again before being returned. */
+  bits = parse_symbolic_mode (list->word->word, ~um);
+
+  um = ~bits & 0777;
   return (um);
 }
index 8278aac5d68c733be79d0181ecd360643004a557..f91171e509e500e6540ea8bfbb9cfa585dbd432a 100644 (file)
--- a/command.h
+++ b/command.h
@@ -63,6 +63,7 @@ enum command_type { cm_for, cm_case, cm_while, cm_if, cm_simple, cm_select,
 #define W_ASSIGNMENT   0x04    /* This word is a variable assignment. */
 #define W_GLOBEXP      0x08    /* This word is the result of a glob expansion. */
 #define W_NOSPLIT      0x10    /* Do not perform word splitting on this word. */
+#define W_NOGLOB       0x20    /* Do not perform globbing on this word. */
 
 /* Possible values for subshell_environment */
 #define SUBSHELL_ASYNC 0x01    /* subshell caused by `command &' */
@@ -268,6 +269,14 @@ typedef struct group_com {
 
 extern COMMAND *global_command;
 
+/* Possible command errors */
+#define CMDERR_DEFAULT 0
+#define CMDERR_BADTYPE 1
+#define CMDERR_BADCONN 2
+#define CMDERR_BADJUMP 3
+
+#define CMDERR_LAST    3
+
 /* Forward declarations of functions declared in copy_cmd.c. */
 
 extern WORD_DESC *copy_word __P((WORD_DESC *));
similarity index 96%
rename from config.h.bot
rename to config-bot.h
index 270e80d19cc893f9570df839acfda451fd2849a0..b4635ed0dcd56ed12b951f3014d23e8b1671a89f 100644 (file)
@@ -65,3 +65,7 @@
 #if defined (STRCOLL_BROKEN)
 #  undef HAVE_STRCOLL
 #endif
+
+#if !defined (PROMPT_STRING_DECODE)
+#  define PPROMPT "$ "
+#endif
similarity index 100%
rename from config.h.top
rename to config-top.h
index 39bcbd58c01843bea2f47674f3e316b99d3abb82..e1ff9a1df4142a287292867d60047ab3dedeb34a 100644 (file)
 #undef AFS
 
 /* End of configuration settings controllable by autoconf. */
-/* Other settable options appear in config.h.top. */
+/* Other settable options appear in config-top.h. */
 
-#include "config.h.top"
+#include "config-top.h"
 
 /* Beginning of autoconf additions. */
 
 /* The number of bytes in a pointer to char.  */
 #undef SIZEOF_CHAR_P
 
+/* The number of bytes in a double (hopefully 8). */
+#undef SIZEOF_DOUBLE
+
 /* Define to `long' if <sys/types.h> doesn't define.  */
 #undef off_t
 
 /* Define to `int' if <sys/types.h> doesn't define. */
 #undef ptrdiff_t
 
+/* Define to `double' if <sys/types.h> doesn't define. */
+#undef bits64_t
+
 /* Define to `unsigned' if <sys/types.h> doesn't define.  */
 #undef size_t
 
 /* Define if you have the killpg function.  */
 #undef HAVE_KILLPG
 
+/* Define if you have the lstat function. */
 #undef HAVE_LSTAT
 
 /* Define if you have the putenv function.  */
 #undef HAVE_PUTENV
 
+/* Define if you have the rename function. */
+#undef HAVE_RENAME
+
+/* Define if you have the sbrk function. */
+#undef HAVE_SBRK
+
 /* Define if you have the select function.  */
 #undef HAVE_SELECT
 
 
 #undef HAVE_LIBSOCKET
 
+/* Are we running SVR5 (UnixWare 7)? */
+#undef SVR5
+
 /* Are we running SVR4.2? */
 #undef SVR4_2
 
 /* Do strcoll(3) and strcmp(3) give different results in the default locale? */
 #undef STRCOLL_BROKEN
 
-#include "config.h.bot"
+#include "config-bot.h"
 
 #endif /* _CONFIG_H_ */
index 3a27c426821db311deff4446396d4640a74194a7..d6e29f4415edc05c8d3b5c9b5a63f7e0e75a9a4c 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,6 +1,9 @@
 #! /bin/sh
 
-# From configure.in for Bash 2.02, version 2.19, from autoconf version 2.12
+# From configure.in for Bash 2.03, version 2.49, from autoconf version 2.12
+
+
+
 
 
 
@@ -106,6 +109,8 @@ ac_help="$ac_help
 ac_help="$ac_help
 --with-gnu-malloc      use the GNU version of malloc"
 ac_help="$ac_help
+--with-installed-readline      use a version of the readline library that is already installed"
+ac_help="$ac_help
 --with-purecov         configure to postprocess with pure coverage"
 ac_help="$ac_help
 --with-purify          configure to postprocess with purify"
@@ -691,7 +696,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:695: checking host system type" >&5
+echo "configure:700: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
@@ -718,22 +723,25 @@ opt_purify=no
 opt_purecov=no
 opt_afs=no
 opt_curses=no
+opt_with_installed_readline=no
 
 case "${host_cpu}-${host_os}" in
-alpha-*)       opt_gnu_malloc=no ;;    # alpha running osf/1 or linux
+alpha*-*)      opt_gnu_malloc=no ;;    # alpha running osf/1 or linux
 *Ccray*-*)     opt_gnu_malloc=no ;;    # Crays
 *-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
-#mips-irix6*)  opt_gnu_malloc=no ;;    # needs 8-byte alignment
+mips-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
+*-rhapsody*)   opt_gnu_malloc=no ;;    # Apple Rhapsody
 *-dgux*)       opt_gnu_malloc=no ;;    # DG/UX machines
 *-qnx*)                opt_gnu_malloc=no ;;    # QNX 4.2
 *-machten4)    opt_gnu_malloc=no ;;    # MachTen 4.x
 *-bsdi2.1|*-bsdi3.?)   opt_gnu_malloc=no ; : ${CC:=shlicc2} ;; # for loadable builtins
+*-beos*)       opt_gnu_malloc=no ;;    # they say it's suitable
 *-cygwin32*)   opt_gnu_malloc=no ;;    # Cygnus's CYGWIN32 environment
 esac
 
@@ -761,6 +769,12 @@ if test "${with_gnu_malloc+set}" = set; then
   opt_gnu_malloc=$withval
 fi
 
+# Check whether --with-installed-readline or --without-installed-readline was given.
+if test "${with_installed_readline+set}" = set; then
+  withval="$with_installed_readline"
+  opt_with_installed_readline=$withval
+fi
+
 # Check whether --with-purecov or --without-purecov was given.
 if test "${with_purecov+set}" = set; then
   withval="$with_purecov"
@@ -976,41 +990,12 @@ fi
 
 
 
+
 if test $opt_alias = yes; then
 cat >> confdefs.h <<\EOF
 #define ALIAS 1
 EOF
 
-fi
-if test $opt_readline = yes; then
-cat >> confdefs.h <<\EOF
-#define READLINE 1
-EOF
-
-READLINE_LIB=-lreadline
-READLINE_DEP='$(READLINE_LIBRARY)'
-else
-READLINE_LIB= READLINE_DEP=
-fi
-if test $opt_history = yes; then
-cat >> confdefs.h <<\EOF
-#define HISTORY 1
-EOF
-
-HISTORY_LIB=-lhistory
-HISTORY_DEP='$(HISTORY_LIBRARY)'
-else
-HISTORY_LIB= HISTORY_DEP=
-fi
-if test $opt_bang_history = yes; then
-cat >> confdefs.h <<\EOF
-#define BANG_HISTORY 1
-EOF
-
-HISTORY_LIB=-lhistory
-HISTORY_DEP='$(HISTORY_LIBRARY)'
-else
-HISTORY_LIB= HISTORY_DEP=
 fi
 if test $opt_dirstack = yes; then
 cat >> confdefs.h <<\EOF
@@ -1108,19 +1093,15 @@ fi
 
 
 
-
-
-
-
-BASHVERS=2.02
-BASHPATCH=1
+BASHVERS=2.03
+BASHPATCH=0
 
 echo "Beginning configuration for bash-$BASHVERS for ${host_cpu}-${host_vendor}-${host_os}"
 
 # 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:1124: checking for $ac_word" >&5
+echo "configure:1105: 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
@@ -1149,7 +1130,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:1153: checking for $ac_word" >&5
+echo "configure:1134: 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
@@ -1197,7 +1178,7 @@ fi
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1201: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1182: 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.
@@ -1207,11 +1188,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 1211 "configure"
+#line 1192 "configure"
 #include "confdefs.h"
 main(){return(0);}
 EOF
-if { (eval echo configure:1215: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1196: \"$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
@@ -1231,12 +1212,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:1235: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1216: 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:1240: checking whether we are using GNU C" >&5
+echo "configure:1221: 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
@@ -1245,7 +1226,7 @@ else
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1249: \"$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:1230: \"$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
@@ -1260,7 +1241,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:1264: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1245: 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
@@ -1288,7 +1269,7 @@ else
 fi
 
 echo $ac_n "checking whether large file support needs explicit enabling""... $ac_c" 1>&6
-echo "configure:1292: checking whether large file support needs explicit enabling" >&5
+echo "configure:1273: checking whether large file support needs explicit enabling" >&5
 ac_getconfs=''
 ac_result=yes
 ac_set=''
@@ -1320,7 +1301,7 @@ yes)
 esac
 
 echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
-echo "configure:1324: checking for POSIXized ISC" >&5
+echo "configure:1305: 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
@@ -1341,7 +1322,7 @@ else
 fi
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1345: checking how to run the C preprocessor" >&5
+echo "configure:1326: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -1356,13 +1337,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 1360 "configure"
+#line 1341 "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:1366: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1347: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -1373,13 +1354,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 1377 "configure"
+#line 1358 "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:1383: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1364: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -1403,17 +1384,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:1407: checking for minix/config.h" >&5
+echo "configure:1388: 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 1412 "configure"
+#line 1393 "configure"
 #include "confdefs.h"
 #include <minix/config.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1417: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1398: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1452,21 +1433,31 @@ fi
 
 
 
+SIGNAMES_H=lsignames.h
+
+
+
 if test "x$cross_compiling" = "xyes"; then
     case "${host}" in
     *-cygwin32*)
        cross_cache=${srcdir}/cross-build/cygwin32.cache
-       if test -r "${cross_cache}"; then
-           echo "loading cross-build cache file ${cross_cache}"
-           . ${cross_cache}
-       fi
-       unset cross_cache
+       SIGNAMES_H='$(srcdir)/cross-build/win32sig.h'
        ;;
-    *) echo "configure: cross-compiling for a non-cygwin32 target is not supported" >&2
+    i[3456]86-*-beos*)
+       cross_cache=${srcdir}/cross-build/x86-beos.cache
+       SIGNAMES_H='${srcdir}/cross-build/beos-sig.h'
+       ;;
+    *) echo "configure: cross-compiling for $host is not supported" >&2
        ;;
     esac
+    if test -n "${cross_cache}" && test -r "${cross_cache}"; then
+       echo "loading cross-build cache file ${cross_cache}"
+       . ${cross_cache}
+    fi
+    unset cross_cache
 fi
 
+
 if test -z "$CC_FOR_BUILD"; then
     if test "x$cross_compiling" = "xno"; then
        CC_FOR_BUILD='$(CC)'
@@ -1476,13 +1467,6 @@ if test -z "$CC_FOR_BUILD"; then
 fi
 
 
-if test "x$cross_compiling" = "xno"; then
-       SIGNAMES_H=lsignames.h
-else
-       SIGNAMES_H='$(srcdir)/cross-build/win32sig.h'
-fi
-
-
 
 test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1
 
@@ -1490,13 +1474,16 @@ test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O2"
 
 if test "$opt_profiling" = "yes"; then
        PROFILE_FLAGS=-pg
-       opt_static_link=yes
+       case "$host_os" in
+       solaris2*)      ;;
+       *)              opt_static_link=yes ;;
+       esac
 fi
 
 if test "$opt_static_link" = yes; then
        # if we're using gcc, add `-static' to LDFLAGS
        if test -n "$GCC" || test "$ac_cv_prog_gcc" = "yes"; then
-               LDFLAGS="$LDFLAGS -static"
+               STATIC_LD="-static"
        fi
 fi
 
@@ -1504,15 +1491,16 @@ fi
 
 
 
+
 if test $ac_cv_prog_gcc = yes; then
     echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:1510: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:1498: 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 1516 "configure"
+#line 1504 "configure"
 #include "confdefs.h"
 #include <sgtty.h>
 Autoconf TIOCGETP
@@ -1530,7 +1518,7 @@ rm -f conftest*
 
   if test $ac_cv_prog_gcc_traditional = no; then
     cat > conftest.$ac_ext <<EOF
-#line 1534 "configure"
+#line 1522 "configure"
 #include "confdefs.h"
 #include <termio.h>
 Autoconf TCGETA
@@ -1552,6 +1540,82 @@ echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6
 fi
 
 
+
+if test "$opt_readline" = yes && test "$opt_with_installed_readline" = "yes"
+then
+
+
+       test "x$prefix" = xNONE && _rl_prefix=$ac_default_prefix || _rl_prefix=${prefix}
+       test "x$exec_prefix" = xNONE && _rl_exec_prefix=${_rl_prefix} || _rl_exec_prefix=${exec_prefix}
+
+       echo $ac_n "checking version of installed readline library""... $ac_c" 1>&6
+echo "configure:1553: checking version of installed readline library" >&5
+       _rl_version=`exec_prefix=${_rl_exec_prefix} ${CONFIG_SHELL-/bin/sh} ${srcdir}/support/rlvers.sh -C "${CC}" -L ${libdir}`
+       echo "$ac_t""$_rl_version" 1>&6
+
+       case "$_rl_version" in
+       3*|4*|5*|6*|7*|8*|9*)   ;;
+       *)      opt_with_installed_readline=no 
+               echo "configure: warning: installed readline library is too old to be linked with bash" 1>&2
+               echo "configure: warning: using private bash version" 1>&2
+               ;;
+       esac
+       unset _rl_version _rl_prefix _rl_exec_prefix
+fi
+
+if test $opt_readline = yes; then
+       cat >> confdefs.h <<\EOF
+#define READLINE 1
+EOF
+
+       READLINE_LIB=-lreadline
+       if test "$opt_with_installed_readline" = "yes" ; then
+               RL_LIBDIR='$(libdir)'
+               READLINE_DEP=
+               RL_INCLUDE='-I$(includedir)'
+       else
+               RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
+               READLINE_DEP='$(READLINE_LIBRARY)'
+       fi
+else
+       RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
+       READLINE_LIB= READLINE_DEP=
+fi
+if test $opt_history = yes || test $opt_bang_history = yes; then
+       if test $opt_history = yes; then
+               cat >> confdefs.h <<\EOF
+#define HISTORY 1
+EOF
+
+       fi
+       if test $opt_bang_history = yes; then
+               cat >> confdefs.h <<\EOF
+#define BANG_HISTORY 1
+EOF
+
+       fi
+       HISTORY_LIB=-lhistory
+       if test "$opt_with_installed_readline" = "yes"; then
+               HIST_LIBDIR='$(libdir)'
+               HISTORY_DEP=
+               RL_INCLUDE='-I$(includedir)'
+       else
+               HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
+               HISTORY_DEP='$(HISTORY_LIBRARY)'
+       fi
+else
+       HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
+       HISTORY_LIB= HISTORY_DEP=
+fi
+
+
+
+
+
+
+
+
+
 # Find a good install program.  We prefer a C program (faster),
 # so one script is as good as another.  But avoid the broken or
 # incompatible versions:
@@ -1563,7 +1627,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:1567: checking for a BSD compatible install" >&5
+echo "configure:1631: 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
@@ -1615,7 +1679,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:1619: checking for $ac_word" >&5
+echo "configure:1683: 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
@@ -1640,10 +1704,11 @@ else
   echo "$ac_t""no" 1>&6
 fi
 
+test -n "$ARFLAGS" || ARFLAGS="cr"
 # 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:1647: checking for $ac_word" >&5
+echo "configure:1712: 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
@@ -1674,7 +1739,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:1678: checking for $ac_word" >&5
+echo "configure:1743: 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
@@ -1704,7 +1769,7 @@ done
 test -n "$YACC" || YACC="yacc"
 
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:1708: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:1773: 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
@@ -1731,22 +1796,28 @@ else
 fi
 
 
+case "$host_os" in
+opennt*|interix*)      MAKE_SHELL="$OPENNT_ROOT/bin/sh" ;;
+*)                     MAKE_SHELL=/bin/sh ;;
+esac
+
+
 # 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:1738: checking for working alloca.h" >&5
+echo "configure:1809: 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 1743 "configure"
+#line 1814 "configure"
 #include "confdefs.h"
 #include <alloca.h>
 int main() {
 char *p = alloca(2 * sizeof(int));
 ; return 0; }
 EOF
-if { (eval echo configure:1750: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1821: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ac_cv_header_alloca_h=yes
 else
@@ -1767,12 +1838,12 @@ EOF
 fi
 
 echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:1771: checking for alloca" >&5
+echo "configure:1842: 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 1776 "configure"
+#line 1847 "configure"
 #include "confdefs.h"
 
 #ifdef __GNUC__
@@ -1795,7 +1866,7 @@ int main() {
 char *p = (char *) alloca(1);
 ; return 0; }
 EOF
-if { (eval echo configure:1799: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1870: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ac_cv_func_alloca_works=yes
 else
@@ -1827,12 +1898,12 @@ EOF
 
 
 echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:1831: checking whether alloca needs Cray hooks" >&5
+echo "configure:1902: 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 1836 "configure"
+#line 1907 "configure"
 #include "confdefs.h"
 #if defined(CRAY) && ! defined(CRAY2)
 webecray
@@ -1857,12 +1928,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:1861: checking for $ac_func" >&5
+echo "configure:1932: 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 1866 "configure"
+#line 1937 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1885,7 +1956,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1889: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1960: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -1912,7 +1983,7 @@ done
 fi
 
 echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:1916: checking stack direction for C alloca" >&5
+echo "configure:1987: 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
@@ -1920,7 +1991,7 @@ else
   ac_cv_c_stack_direction=0
 else
   cat > conftest.$ac_ext <<EOF
-#line 1924 "configure"
+#line 1995 "configure"
 #include "confdefs.h"
 find_stack_direction ()
 {
@@ -1939,7 +2010,7 @@ main ()
   exit (find_stack_direction() < 0);
 }
 EOF
-if { (eval echo configure:1943: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2014: \"$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
@@ -1961,7 +2032,7 @@ EOF
 fi
 
 echo $ac_n "checking whether getpgrp takes no argument""... $ac_c" 1>&6
-echo "configure:1965: checking whether getpgrp takes no argument" >&5
+echo "configure:2036: 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
@@ -1969,7 +2040,7 @@ else
   { echo "configure: error: cannot check getpgrp if cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 1973 "configure"
+#line 2044 "configure"
 #include "confdefs.h"
 
 /*
@@ -2024,7 +2095,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:2028: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2099: \"$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
@@ -2048,7 +2119,7 @@ EOF
 fi
 
 echo $ac_n "checking whether setvbuf arguments are reversed""... $ac_c" 1>&6
-echo "configure:2052: checking whether setvbuf arguments are reversed" >&5
+echo "configure:2123: 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
@@ -2056,7 +2127,7 @@ else
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 2060 "configure"
+#line 2131 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 /* If setvbuf has the reversed format, exit 0. */
@@ -2070,7 +2141,7 @@ main () {
   exit(0);                     /* Non-reversed systems segv here.  */
 }
 EOF
-if { (eval echo configure:2074: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2145: \"$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
@@ -2094,12 +2165,12 @@ EOF
 fi
 
 echo $ac_n "checking for vprintf""... $ac_c" 1>&6
-echo "configure:2098: checking for vprintf" >&5
+echo "configure:2169: 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 2103 "configure"
+#line 2174 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char vprintf(); below.  */
@@ -2122,7 +2193,7 @@ vprintf();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2126: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2197: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_vprintf=yes"
 else
@@ -2146,12 +2217,12 @@ fi
 
 if test "$ac_cv_func_vprintf" != yes; then
 echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
-echo "configure:2150: checking for _doprnt" >&5
+echo "configure:2221: 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 2155 "configure"
+#line 2226 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char _doprnt(); below.  */
@@ -2174,7 +2245,7 @@ _doprnt();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2178: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2249: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func__doprnt=yes"
 else
@@ -2199,7 +2270,7 @@ fi
 fi
 
 echo $ac_n "checking for wait3 that fills in rusage""... $ac_c" 1>&6
-echo "configure:2203: checking for wait3 that fills in rusage" >&5
+echo "configure:2274: 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
@@ -2207,7 +2278,7 @@ else
   ac_cv_func_wait3_rusage=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 2211 "configure"
+#line 2282 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -2238,7 +2309,7 @@ main() {
   }
 }
 EOF
-if { (eval echo configure:2242: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2313: \"$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
@@ -2261,7 +2332,7 @@ EOF
 fi
 
 echo $ac_n "checking for working strcoll""... $ac_c" 1>&6
-echo "configure:2265: checking for working strcoll" >&5
+echo "configure:2336: 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
@@ -2269,7 +2340,7 @@ else
   ac_cv_func_strcoll_works=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 2273 "configure"
+#line 2344 "configure"
 #include "confdefs.h"
 #include <string.h>
 main ()
@@ -2279,7 +2350,7 @@ main ()
        strcoll ("123", "456") >= 0);
 }
 EOF
-if { (eval echo configure:2283: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2354: \"$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
@@ -2304,9 +2375,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:2308: checking for declaration of vprintf in stdio.h" >&5
+echo "configure:2379: checking for declaration of vprintf in stdio.h" >&5
     cat > conftest.$ac_ext <<EOF
-#line 2310 "configure"
+#line 2381 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 EOF
@@ -2327,12 +2398,12 @@ EOF
 fi
 
 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:2331: checking return type of signal handlers" >&5
+echo "configure:2402: 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 2336 "configure"
+#line 2407 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -2349,7 +2420,7 @@ int main() {
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:2353: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2424: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_type_signal=void
 else
@@ -2369,12 +2440,12 @@ EOF
 
 
 echo $ac_n "checking for __setostype""... $ac_c" 1>&6
-echo "configure:2373: checking for __setostype" >&5
+echo "configure:2444: 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 2378 "configure"
+#line 2449 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char __setostype(); below.  */
@@ -2397,7 +2468,7 @@ __setostype();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2401: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2472: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func___setostype=yes"
 else
@@ -2420,12 +2491,12 @@ else
 fi
 
 echo $ac_n "checking for wait3""... $ac_c" 1>&6
-echo "configure:2424: checking for wait3" >&5
+echo "configure:2495: 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 2429 "configure"
+#line 2500 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char wait3(); below.  */
@@ -2448,7 +2519,7 @@ wait3();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2452: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2523: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_wait3=yes"
 else
@@ -2472,12 +2543,12 @@ fi
 
 
 echo $ac_n "checking for mkfifo""... $ac_c" 1>&6
-echo "configure:2476: checking for mkfifo" >&5
+echo "configure:2547: 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 2481 "configure"
+#line 2552 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char mkfifo(); below.  */
@@ -2500,7 +2571,7 @@ mkfifo();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2504: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2575: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_mkfifo=yes"
 else
@@ -2528,16 +2599,16 @@ fi
 
 
 for ac_func in dup2 select getdtablesize getgroups gethostname \
-               setdtablesize getpagesize killpg lstat getpeername \
-               getrlimit getrusage gettimeofday waitpid tcgetpgrp
+               setdtablesize getpagesize killpg lstat getpeername sbrk \
+               getrlimit getrusage gettimeofday waitpid tcgetpgrp rename
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2536: checking for $ac_func" >&5
+echo "configure:2607: 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 2612 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2560,7 +2631,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:2635: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -2591,12 +2662,12 @@ for ac_func in bcopy bzero confstr getcwd strcasecmp setenv putenv \
                siginterrupt memmove
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2595: checking for $ac_func" >&5
+echo "configure:2666: 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 2600 "configure"
+#line 2671 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2619,7 +2690,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2623: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2694: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -2648,17 +2719,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:2652: checking for $ac_hdr" >&5
+echo "configure:2723: 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 2657 "configure"
+#line 2728 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2662: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2733: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2687,12 +2758,12 @@ done
 for ac_func in gettext textdomain bindtextdomain
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2691: checking for $ac_func" >&5
+echo "configure:2762: 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 2696 "configure"
+#line 2767 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2715,7 +2786,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2719: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2790: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -2742,7 +2813,7 @@ done
 
 if test "$ac_cv_func_bindtextdomain" = "no"; then
     echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6
-echo "configure:2746: checking for bindtextdomain in -lintl" >&5
+echo "configure:2817: 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
@@ -2750,7 +2821,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lintl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2754 "configure"
+#line 2825 "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
@@ -2761,7 +2832,7 @@ int main() {
 bindtextdomain()
 ; return 0; }
 EOF
-if { (eval echo configure:2765: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2836: \"$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
@@ -2792,12 +2863,12 @@ fi
        for ac_func in gettext textdomain bindtextdomain
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2796: checking for $ac_func" >&5
+echo "configure:2867: 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 2801 "configure"
+#line 2872 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2820,7 +2891,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2824: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2895: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -2849,7 +2920,7 @@ fi
 
 if test "$opt_static_link" != yes; then
 echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:2853: checking for dlopen in -ldl" >&5
+echo "configure:2924: 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
@@ -2857,7 +2928,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2861 "configure"
+#line 2932 "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
@@ -2868,7 +2939,7 @@ int main() {
 dlopen()
 ; return 0; }
 EOF
-if { (eval echo configure:2872: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2943: \"$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
@@ -2898,12 +2969,12 @@ fi
 for ac_func in dlopen dlclose dlsym
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2902: checking for $ac_func" >&5
+echo "configure:2973: 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 2907 "configure"
+#line 2978 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2926,7 +2997,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2930: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3001: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -2953,12 +3024,12 @@ done
 fi
 
 echo $ac_n "checking for sys_siglist declaration in signal.h or unistd.h""... $ac_c" 1>&6
-echo "configure:2957: checking for sys_siglist declaration in signal.h or unistd.h" >&5
+echo "configure:3028: 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 2962 "configure"
+#line 3033 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -2970,7 +3041,7 @@ int main() {
 char *msg = *(sys_siglist + 1);
 ; return 0; }
 EOF
-if { (eval echo configure:2974: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3045: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_decl_sys_siglist=yes
 else
@@ -2996,12 +3067,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:3000: checking for $ac_hdr that defines DIR" >&5
+echo "configure:3071: 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 3005 "configure"
+#line 3076 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <$ac_hdr>
@@ -3009,7 +3080,7 @@ int main() {
 DIR *dirp = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:3013: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3084: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   eval "ac_cv_header_dirent_$ac_safe=yes"
 else
@@ -3034,7 +3105,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:3038: checking for opendir in -ldir" >&5
+echo "configure:3109: 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
@@ -3042,7 +3113,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldir  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3046 "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
@@ -3053,7 +3124,7 @@ int main() {
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:3057: \"$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
@@ -3075,7 +3146,7 @@ fi
 
 else
 echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:3079: checking for opendir in -lx" >&5
+echo "configure:3150: 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
@@ -3083,7 +3154,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lx  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3087 "configure"
+#line 3158 "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
@@ -3094,7 +3165,7 @@ int main() {
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:3098: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3169: \"$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
@@ -3117,12 +3188,12 @@ fi
 fi
 
 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:3121: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:3192: 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 3126 "configure"
+#line 3197 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -3131,7 +3202,7 @@ int main() {
 struct tm *tp;
 ; return 0; }
 EOF
-if { (eval echo configure:3135: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3206: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_time=yes
 else
@@ -3158,17 +3229,17 @@ for ac_hdr in unistd.h stdlib.h stdarg.h varargs.h limits.h string.h \
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3162: checking for $ac_hdr" >&5
+echo "configure:3233: 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 3167 "configure"
+#line 3238 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3172: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3243: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3200,17 +3271,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:3204: checking for $ac_hdr" >&5
+echo "configure:3275: 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 3209 "configure"
+#line 3280 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3214: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3285: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3243,14 +3314,14 @@ 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:3247: checking for socket library" >&5
+echo "configure:3318: 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:3254: checking for getpeername in -lsocket" >&5
+echo "configure:3325: 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
@@ -3258,7 +3329,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket -lnsl $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3262 "configure"
+#line 3333 "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
@@ -3269,7 +3340,7 @@ int main() {
 getpeername()
 ; return 0; }
 EOF
-if { (eval echo configure:3273: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3344: \"$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
@@ -3302,14 +3373,14 @@ if test $bash_cv_have_socklib = yes; then
     _bash_needmsg=
   else
     echo $ac_n "checking for libnsl""... $ac_c" 1>&6
-echo "configure:3306: checking for libnsl" >&5
+echo "configure:3377: 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:3313: checking for t_open in -lnsl" >&5
+echo "configure:3384: 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
@@ -3317,7 +3388,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3321 "configure"
+#line 3392 "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
@@ -3328,7 +3399,7 @@ int main() {
 t_open()
 ; return 0; }
 EOF
-if { (eval echo configure:3332: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3403: \"$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
@@ -3373,12 +3444,12 @@ fi
 fi
 
 echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:3377: checking for uid_t in sys/types.h" >&5
+echo "configure:3448: 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 3382 "configure"
+#line 3453 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 EOF
@@ -3407,7 +3478,7 @@ EOF
 fi
 
 echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6
-echo "configure:3411: checking type of array argument to getgroups" >&5
+echo "configure:3482: 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
@@ -3415,7 +3486,7 @@ else
   ac_cv_type_getgroups=cross
 else
   cat > conftest.$ac_ext <<EOF
-#line 3419 "configure"
+#line 3490 "configure"
 #include "confdefs.h"
 
 /* Thanks to Mike Rendell for this test.  */
@@ -3440,7 +3511,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:3444: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3515: \"$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
@@ -3454,7 +3525,7 @@ fi
 
 if test $ac_cv_type_getgroups = cross; then
         cat > conftest.$ac_ext <<EOF
-#line 3458 "configure"
+#line 3529 "configure"
 #include "confdefs.h"
 #include <unistd.h>
 EOF
@@ -3478,12 +3549,12 @@ EOF
 
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:3482: checking for ANSI C header files" >&5
+echo "configure:3553: 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 3487 "configure"
+#line 3558 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -3491,7 +3562,7 @@ else
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3495: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3566: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3508,7 +3579,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 3512 "configure"
+#line 3583 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -3526,7 +3597,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 3530 "configure"
+#line 3601 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -3547,7 +3618,7 @@ if test "$cross_compiling" = yes; then
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 3551 "configure"
+#line 3622 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -3558,7 +3629,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
 exit (0); }
 
 EOF
-if { (eval echo configure:3562: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3633: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -3582,12 +3653,12 @@ EOF
 fi
 
 echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:3586: checking for off_t" >&5
+echo "configure:3657: 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 3591 "configure"
+#line 3662 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -3615,12 +3686,12 @@ EOF
 fi
 
 echo $ac_n "checking for mode_t""... $ac_c" 1>&6
-echo "configure:3619: checking for mode_t" >&5
+echo "configure:3690: 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 3624 "configure"
+#line 3695 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -3648,12 +3719,12 @@ EOF
 fi
 
 echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:3652: checking for uid_t in sys/types.h" >&5
+echo "configure:3723: 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 3657 "configure"
+#line 3728 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 EOF
@@ -3682,12 +3753,12 @@ EOF
 fi
 
 echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:3686: checking for pid_t" >&5
+echo "configure:3757: 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 3691 "configure"
+#line 3762 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -3715,12 +3786,12 @@ EOF
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:3719: checking for size_t" >&5
+echo "configure:3790: 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 3724 "configure"
+#line 3795 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -3748,12 +3819,12 @@ EOF
 fi
 
 echo $ac_n "checking for time_t""... $ac_c" 1>&6
-echo "configure:3752: checking for time_t" >&5
+echo "configure:3823: 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 3757 "configure"
+#line 3828 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -3782,12 +3853,12 @@ fi
 
 
 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:3786: checking return type of signal handlers" >&5
+echo "configure:3857: 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 3791 "configure"
+#line 3862 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -3804,7 +3875,7 @@ int main() {
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:3808: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3879: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_type_signal=void
 else
@@ -3824,15 +3895,15 @@ EOF
 
 
 echo $ac_n "checking size of int""... $ac_c" 1>&6
-echo "configure:3828: checking size of int" >&5
+echo "configure:3899: checking size of int" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test "$cross_compiling" = yes; then
-    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+  ac_cv_sizeof_int=4
 else
   cat > conftest.$ac_ext <<EOF
-#line 3836 "configure"
+#line 3907 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -3843,7 +3914,7 @@ main()
   exit(0);
 }
 EOF
-if { (eval echo configure:3847: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3918: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_int=`cat conftestval`
 else
@@ -3863,15 +3934,15 @@ EOF
 
 
 echo $ac_n "checking size of long""... $ac_c" 1>&6
-echo "configure:3867: checking size of long" >&5
+echo "configure:3938: checking size of long" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test "$cross_compiling" = yes; then
-    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+  ac_cv_sizeof_long=4
 else
   cat > conftest.$ac_ext <<EOF
-#line 3875 "configure"
+#line 3946 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -3882,7 +3953,7 @@ main()
   exit(0);
 }
 EOF
-if { (eval echo configure:3886: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3957: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_long=`cat conftestval`
 else
@@ -3902,15 +3973,15 @@ EOF
 
 
 echo $ac_n "checking size of char *""... $ac_c" 1>&6
-echo "configure:3906: checking size of char *" >&5
+echo "configure:3977: checking size of char *" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_char_p'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test "$cross_compiling" = yes; then
-    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+  ac_cv_sizeof_char_p=4
 else
   cat > conftest.$ac_ext <<EOF
-#line 3914 "configure"
+#line 3985 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -3921,7 +3992,7 @@ main()
   exit(0);
 }
 EOF
-if { (eval echo configure:3925: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3996: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_char_p=`cat conftestval`
 else
@@ -3940,14 +4011,55 @@ cat >> confdefs.h <<EOF
 EOF
 
 
+echo $ac_n "checking size of double""... $ac_c" 1>&6
+echo "configure:4016: checking size of double" >&5
+if eval "test \"`echo '$''{'ac_cv_sizeof_double'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_sizeof_double=8
+else
+  cat > conftest.$ac_ext <<EOF
+#line 4024 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+main()
+{
+  FILE *f=fopen("conftestval", "w");
+  if (!f) exit(1);
+  fprintf(f, "%d\n", sizeof(double));
+  exit(0);
+}
+EOF
+if { (eval echo configure:4035: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+  ac_cv_sizeof_double=`cat conftestval`
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_sizeof_double=0
+fi
+rm -fr conftest*
+fi
+
+fi
+echo "$ac_t""$ac_cv_sizeof_double" 1>&6
+cat >> confdefs.h <<EOF
+#define SIZEOF_DOUBLE $ac_cv_sizeof_double
+EOF
+
+
+
 
-echo $ac_n "checking for int32_t""... $ac_c" 1>&6
-echo "configure:3946: checking for int32_t" >&5
+if test "$ac_cv_sizeof_int" = 4; then
+  echo $ac_n "checking for int32_t""... $ac_c" 1>&6
+echo "configure:4058: checking for int32_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_int32_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3951 "configure"
+#line 4063 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
 echo "$ac_t""$ac_cv_type_int32_t" 1>&6
 if test $ac_cv_type_int32_t = no; then
   cat >> confdefs.h <<\EOF
-#define int32_t 
+#define int32_t int
 EOF
 
 fi
 
-if test "$ac_cv_type_int32_t" = "no"; then
-        
-if test "X$bash_cv_type_int32_t" = "X"; then
-_bash_needmsg=yes
-else
-echo $ac_n "checking which builtin C type is 32 bits wide""... $ac_c" 1>&6
-echo "configure:3984: checking which builtin C type is 32 bits wide" >&5
-_bash_needmsg=
-fi
-if eval "test \"`echo '$''{'bash_cv_type_int32_t'+set}'`\" = set"; then
+elif test "$ac_cv_sizeof_long" = 4; then
+  echo $ac_n "checking for int32_t""... $ac_c" 1>&6
+echo "configure:4092: checking for int32_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_int32_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test "$cross_compiling" = yes; then
-  { echo "configure: error: cannot check type sizes if cross-compiling -- defaulting to int" 1>&2; exit 1; }
-     bash_cv_type_int32_t=int
-
 else
   cat > conftest.$ac_ext <<EOF
-#line 3996 "configure"
+#line 4097 "configure"
 #include "confdefs.h"
-
-main()
-{
-#if SIZEOF_INT == 4
-exit (0);
-#else
-#  if SIZEOF_LONG == 4
-exit (1);
-#  else
-#    error cannot find 32 bit type...
-#  endif
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
 #endif
-}
 EOF
-if { (eval echo configure:4012: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
-then
-  bash_cv_type_int32_t=int
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "int32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_type_int32_t=yes
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -fr conftest*
-  bash_cv_type_int32_t=long
+  rm -rf conftest*
+  ac_cv_type_int32_t=no
 fi
-rm -fr conftest*
+rm -f conftest*
+
 fi
+echo "$ac_t""$ac_cv_type_int32_t" 1>&6
+if test $ac_cv_type_int32_t = no; then
+  cat >> confdefs.h <<\EOF
+#define int32_t long
+EOF
 
 fi
 
-if test "X$_bash_needmsg" = "Xyes"; then
-echo $ac_n "checking which builtin C type is 32 bits wide""... $ac_c" 1>&6
-echo "configure:4028: checking which builtin C type is 32 bits wide" >&5
+else
+  echo $ac_n "checking for int32_t""... $ac_c" 1>&6
+echo "configure:4126: checking for int32_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_int32_t'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 4131 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "int32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_type_int32_t=yes
+else
+  rm -rf conftest*
+  ac_cv_type_int32_t=no
 fi
-echo "$ac_t""$bash_cv_type_int32_t" 1>&6;
-if test "$bash_cv_type_int32_t" = "int"; then
-cat >> confdefs.h <<\EOF
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_int32_t" 1>&6
+if test $ac_cv_type_int32_t = no; then
+  cat >> confdefs.h <<\EOF
 #define int32_t int
 EOF
 
+fi
+
+fi
+
+
+if test "$ac_cv_sizeof_int" = 4; then
+  echo $ac_n "checking for u_int32_t""... $ac_c" 1>&6
+echo "configure:4163: checking for u_int32_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_u_int32_t'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
-cat >> confdefs.h <<\EOF
-#define int32_t long
+  cat > conftest.$ac_ext <<EOF
+#line 4168 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
 EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "u_int32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_type_u_int32_t=yes
+else
+  rm -rf conftest*
+  ac_cv_type_u_int32_t=no
+fi
+rm -f conftest*
 
 fi
+echo "$ac_t""$ac_cv_type_u_int32_t" 1>&6
+if test $ac_cv_type_u_int32_t = no; then
+  cat >> confdefs.h <<\EOF
+#define u_int32_t unsigned int
+EOF
 
 fi
-echo $ac_n "checking for u_int32_t""... $ac_c" 1>&6
-echo "configure:4045: checking for u_int32_t" >&5
+
+elif test "$ac_cv_sizeof_long" = 4; then
+  echo $ac_n "checking for u_int32_t""... $ac_c" 1>&6
+echo "configure:4197: checking for u_int32_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_u_int32_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4050 "configure"
+#line 4202 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -4068,85 +4220,90 @@ fi
 echo "$ac_t""$ac_cv_type_u_int32_t" 1>&6
 if test $ac_cv_type_u_int32_t = no; then
   cat >> confdefs.h <<\EOF
-#define u_int32_t 
+#define u_int32_t unsigned long
 EOF
 
 fi
 
-if test "$ac_cv_type_u_int32_t" = "no"; then
-        
-if test "X$bash_cv_type_u_int32_t" = "X"; then
-_bash_needmsg=yes
 else
-echo $ac_n "checking which unsigned builtin C type is 32 bits wide""... $ac_c" 1>&6
-echo "configure:4083: checking which unsigned builtin C type is 32 bits wide" >&5
-_bash_needmsg=
-fi
-if eval "test \"`echo '$''{'bash_cv_type_u_int32_t'+set}'`\" = set"; then
+  echo $ac_n "checking for u_int32_t""... $ac_c" 1>&6
+echo "configure:4231: checking for u_int32_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_u_int32_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test "$cross_compiling" = yes; then
-  { echo "configure: error: cannot check type sizes if cross-compiling -- defaulting to int" 1>&2; exit 1; }
-     bash_cv_type_u_int32_t=int
-
 else
   cat > conftest.$ac_ext <<EOF
-#line 4095 "configure"
+#line 4236 "configure"
 #include "confdefs.h"
-
-main()
-{
-#if SIZEOF_INT == 4
-exit (0);
-#else
-#  if SIZEOF_LONG == 4
-exit (1);
-#  else
-#    error cannot find 32 bit type...
-#  endif
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
 #endif
-}
 EOF
-if { (eval echo configure:4111: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
-then
-  bash_cv_type_u_int32_t=int
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "u_int32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_type_u_int32_t=yes
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -fr conftest*
-  bash_cv_type_u_int32_t=long
+  rm -rf conftest*
+  ac_cv_type_u_int32_t=no
 fi
-rm -fr conftest*
+rm -f conftest*
+
 fi
+echo "$ac_t""$ac_cv_type_u_int32_t" 1>&6
+if test $ac_cv_type_u_int32_t = no; then
+  cat >> confdefs.h <<\EOF
+#define u_int32_t unsigned int
+EOF
 
 fi
 
-if test "X$_bash_needmsg" = "Xyes"; then
-echo $ac_n "checking which unsigned builtin C type is 32 bits wide""... $ac_c" 1>&6
-echo "configure:4127: checking which unsigned builtin C type is 32 bits wide" >&5
 fi
-echo "$ac_t""$bash_cv_type_u_int32_t" 1>&6;
-if test "$bash_cv_type_u_int32_t" = "int"; then
-cat >> confdefs.h <<\EOF
-#define u_int32_t unsigned int
-EOF
 
+
+if test "$ac_cv_sizeof_int" = "$ac_cv_sizeof_char_p"; then
+  echo $ac_n "checking for ptrdiff_t""... $ac_c" 1>&6
+echo "configure:4268: checking for ptrdiff_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_ptrdiff_t'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
-cat >> confdefs.h <<\EOF
-#define u_int32_t unsigned long
+  cat > conftest.$ac_ext <<EOF
+#line 4273 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
 EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "ptrdiff_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_type_ptrdiff_t=yes
+else
+  rm -rf conftest*
+  ac_cv_type_ptrdiff_t=no
+fi
+rm -f conftest*
 
 fi
+echo "$ac_t""$ac_cv_type_ptrdiff_t" 1>&6
+if test $ac_cv_type_ptrdiff_t = no; then
+  cat >> confdefs.h <<\EOF
+#define ptrdiff_t int
+EOF
 
 fi
 
-echo $ac_n "checking for ptrdiff_t""... $ac_c" 1>&6
-echo "configure:4145: checking for ptrdiff_t" >&5
+elif test "$ac_cv_sizeof_long" = "$ac_cv_sizeof_char_p"; then
+  echo $ac_n "checking for ptrdiff_t""... $ac_c" 1>&6
+echo "configure:4302: checking for ptrdiff_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_ptrdiff_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4150 "configure"
+#line 4307 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
 echo "$ac_t""$ac_cv_type_ptrdiff_t" 1>&6
 if test $ac_cv_type_ptrdiff_t = no; then
   cat >> confdefs.h <<\EOF
-#define ptrdiff_t 
+#define ptrdiff_t long
 EOF
 
 fi
 
-if test "$ac_cv_type_ptrdiff_t" = "no"; then
-        
-if test "X$bash_cv_type_ptrdiff_t" = "X"; then
-_bash_needmsg=yes
 else
-echo $ac_n "checking which builtin C type is correct for ptrdiff_t""... $ac_c" 1>&6
-echo "configure:4183: checking which builtin C type is correct for ptrdiff_t" >&5
-_bash_needmsg=
-fi
-if eval "test \"`echo '$''{'bash_cv_type_ptrdiff_t'+set}'`\" = set"; then
+  echo $ac_n "checking for ptrdiff_t""... $ac_c" 1>&6
+echo "configure:4336: checking for ptrdiff_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_ptrdiff_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  if test "$cross_compiling" = yes; then
-  { echo "configure: error: cannot check type sizes if cross-compiling -- defaulting to int" 1>&2; exit 1; }
-     bash_cv_type_ptrdiff_t=int
+  cat > conftest.$ac_ext <<EOF
+#line 4341 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "ptrdiff_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_type_ptrdiff_t=yes
+else
+  rm -rf conftest*
+  ac_cv_type_ptrdiff_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_ptrdiff_t" 1>&6
+if test $ac_cv_type_ptrdiff_t = no; then
+  cat >> confdefs.h <<\EOF
+#define ptrdiff_t int
+EOF
+
+fi
 
+fi
+
+
+if test "$ac_sv_sizeof_char_p" = 8; then
+  echo $ac_n "checking for bits64_t""... $ac_c" 1>&6
+echo "configure:4373: checking for bits64_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_bits64_t'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4195 "configure"
+#line 4378 "configure"
 #include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "bits64_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_type_bits64_t=yes
+else
+  rm -rf conftest*
+  ac_cv_type_bits64_t=no
+fi
+rm -f conftest*
 
-main()
-{
-#if SIZEOF_CHAR_P == SIZEOF_INT
-exit (0);
-#else
-#  if SIZEOF_CHAR_P == SIZEOF_LONG
-exit (1);
-#  else
-#    error cannot find type for pointer arithmetic...
-#  endif
+fi
+echo "$ac_t""$ac_cv_type_bits64_t" 1>&6
+if test $ac_cv_type_bits64_t = no; then
+  cat >> confdefs.h <<\EOF
+#define bits64_t char *
+EOF
+
+fi
+
+elif test "$ac_cv_sizeof_double" = 8; then
+  echo $ac_n "checking for bits64_t""... $ac_c" 1>&6
+echo "configure:4407: checking for bits64_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_bits64_t'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 4412 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
 #endif
-}
 EOF
-if { (eval echo configure:4211: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
-then
-  bash_cv_type_ptrdiff_t=int
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "bits64_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_type_bits64_t=yes
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -fr conftest*
-  bash_cv_type_ptrdiff_t=long
+  rm -rf conftest*
+  ac_cv_type_bits64_t=no
 fi
-rm -fr conftest*
+rm -f conftest*
+
 fi
+echo "$ac_t""$ac_cv_type_bits64_t" 1>&6
+if test $ac_cv_type_bits64_t = no; then
+  cat >> confdefs.h <<\EOF
+#define bits64_t double
+EOF
 
 fi
 
-if test "X$_bash_needmsg" = "Xyes"; then
-echo $ac_n "checking which builtin C type is correct for ptrdiff_t""... $ac_c" 1>&6
-echo "configure:4227: checking which builtin C type is correct for ptrdiff_t" >&5
+elif test "$ac_cv_sizeof_long" = 8; then
+  echo $ac_n "checking for bits64_t""... $ac_c" 1>&6
+echo "configure:4441: checking for bits64_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_bits64_t'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 4446 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "bits64_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_type_bits64_t=yes
+else
+  rm -rf conftest*
+  ac_cv_type_bits64_t=no
 fi
-echo "$ac_t""$bash_cv_type_ptrdiff_t" 1>&6;
-if test "$bash_cv_type_ptrdiff_t" = "int"; then
-cat >> confdefs.h <<\EOF
-#define ptrdiff_t int
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_bits64_t" 1>&6
+if test $ac_cv_type_bits64_t = no; then
+  cat >> confdefs.h <<\EOF
+#define bits64_t long
 EOF
 
+fi
+
 else
-cat >> confdefs.h <<\EOF
-#define ptrdiff_t long
+  echo $ac_n "checking for bits64_t""... $ac_c" 1>&6
+echo "configure:4475: checking for bits64_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_bits64_t'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 4480 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "bits64_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_type_bits64_t=yes
+else
+  rm -rf conftest*
+  ac_cv_type_bits64_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_bits64_t" 1>&6
+if test $ac_cv_type_bits64_t = no; then
+  cat >> confdefs.h <<\EOF
+#define bits64_t double
 EOF
 
 fi
 
 fi
 
+
 echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6
-echo "configure:4245: checking whether stat file-mode macros are broken" >&5
+echo "configure:4511: 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 4250 "configure"
+#line 4516 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -4297,7 +4563,7 @@ EOF
 fi
 
 cat > conftest.$ac_ext <<EOF
-#line 4301 "configure"
+#line 4567 "configure"
 #include "confdefs.h"
 #include <sys/time.h>
 EOF
@@ -4310,7 +4576,7 @@ rm -f conftest*
 
 if test -z "$bash_cv_struct_timeval"; then
 cat > conftest.$ac_ext <<EOF
-#line 4314 "configure"
+#line 4580 "configure"
 #include "confdefs.h"
 #include <time.h>
 EOF
@@ -4333,14 +4599,14 @@ EOF
 fi
 
 echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:4337: checking whether byte ordering is bigendian" >&5
+echo "configure:4603: 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 4344 "configure"
+#line 4610 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/param.h>
@@ -4351,11 +4617,11 @@ int main() {
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:4355: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4621: \"$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 4359 "configure"
+#line 4625 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/param.h>
@@ -4366,7 +4632,7 @@ int main() {
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:4370: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4636: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_bigendian=yes
 else
@@ -4386,7 +4652,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 4390 "configure"
+#line 4656 "configure"
 #include "confdefs.h"
 main () {
   /* Are we little or big endian?  From Harbison&Steele.  */
@@ -4399,7 +4665,7 @@ main () {
   exit (u.c[sizeof (long) - 1] == 1);
 }
 EOF
-if { (eval echo configure:4403: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4669: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   ac_cv_c_bigendian=no
 else
@@ -4426,7 +4692,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:4430: checking $ac_msg" >&5
+echo "configure:4696: checking $ac_msg" >&5
 if eval "test \"`echo '$''{'ac_cv_sys_interpreter'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4452,7 +4718,7 @@ EOF
 
 fi
 echo $ac_n "checking for restartable system calls""... $ac_c" 1>&6
-echo "configure:4456: checking for restartable system calls" >&5
+echo "configure:4722: 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
@@ -4460,7 +4726,7 @@ else
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 4464 "configure"
+#line 4730 "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
@@ -4478,7 +4744,7 @@ main () {
 }
 
 EOF
-if { (eval echo configure:4482: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4748: \"$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
@@ -4503,12 +4769,12 @@ fi
 
 if test "$ac_cv_func_lstat" = "no"; then
 echo $ac_n "checking for lstat""... $ac_c" 1>&6
-echo "configure:4507: checking for lstat" >&5
+echo "configure:4773: 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 4512 "configure"
+#line 4778 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -4518,7 +4784,7 @@ int main() {
  lstat(".",(struct stat *)0); 
 ; return 0; }
 EOF
-if { (eval echo configure:4522: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4788: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   bash_cv_func_lstat=yes
 else
@@ -4541,16 +4807,16 @@ fi
 fi
 
 echo $ac_n "checking if dup2 fails to clear the close-on-exec flag""... $ac_c" 1>&6
-echo "configure:4545: checking if dup2 fails to clear the close-on-exec flag" >&5
+echo "configure:4811: 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
   if test "$cross_compiling" = yes; then
-  { echo "configure: error: cannot check dup2 if cross compiling -- defaulting to no" 1>&2; exit 1; }
+  echo "configure: warning: cannot check dup2 if cross compiling -- defaulting to no" 1>&2
      bash_cv_dup2_broken=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 4554 "configure"
+#line 4820 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -4570,7 +4836,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:4574: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4840: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   bash_cv_dup2_broken=yes
 else
@@ -4595,16 +4861,16 @@ fi
 
 
 echo $ac_n "checking whether pgrps need synchronization""... $ac_c" 1>&6
-echo "configure:4599: checking whether pgrps need synchronization" >&5
+echo "configure:4865: 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
   if test "$cross_compiling" = yes; then
-  { echo "configure: error: cannot check pgrp synchronization if cross compiling -- defaulting to no" 1>&2; exit 1; }
+  echo "configure: warning: cannot check pgrp synchronization if cross compiling -- defaulting to no" 1>&2
     bash_cv_pgrp_pipe=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 4608 "configure"
+#line 4874 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_UNISTD_H
@@ -4656,7 +4922,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:4660: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4926: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   bash_cv_pgrp_pipe=no
 else
@@ -4681,13 +4947,13 @@ fi
 
 
 echo $ac_n "checking for type of signal functions""... $ac_c" 1>&6
-echo "configure:4685: checking for type of signal functions" >&5
+echo "configure:4951: 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 4691 "configure"
+#line 4957 "configure"
 #include "confdefs.h"
 #include <signal.h>
 int main() {
@@ -4700,7 +4966,7 @@ int main() {
   
 ; return 0; }
 EOF
-if { (eval echo configure:4704: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4970: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   bash_cv_signal_vintage=posix
 else
@@ -4709,7 +4975,7 @@ else
   rm -rf conftest*
   
     cat > conftest.$ac_ext <<EOF
-#line 4713 "configure"
+#line 4979 "configure"
 #include "confdefs.h"
 #include <signal.h>
 int main() {
@@ -4719,7 +4985,7 @@ int main() {
     
 ; return 0; }
 EOF
-if { (eval echo configure:4723: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4989: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   bash_cv_signal_vintage=4.2bsd
 else
@@ -4728,7 +4994,7 @@ else
   rm -rf conftest*
   
       cat > conftest.$ac_ext <<EOF
-#line 4732 "configure"
+#line 4998 "configure"
 #include "confdefs.h"
 
        #include <signal.h>
@@ -4741,7 +5007,7 @@ int main() {
         
 ; return 0; }
 EOF
-if { (eval echo configure:4745: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5011: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   bash_cv_signal_vintage=svr3
 else
@@ -4783,15 +5049,15 @@ fi
 if test "$ac_cv_sys_restartable_syscalls" = "no"; then
 
 echo $ac_n "checking for restartable system calls with posix sigaction""... $ac_c" 1>&6
-echo "configure:4787: checking for restartable system calls with posix sigaction" >&5
+echo "configure:5053: checking for restartable system calls with posix sigaction" >&5
 if eval "test \"`echo '$''{'bash_cv_sys_restartable_syscalls'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test "$cross_compiling" = yes; then
-  { echo "configure: error: cannot check restartable syscalls if cross compiling" 1>&2; exit 1; }
+  echo "configure: warning: cannot check restartable syscalls if cross compiling" 1>&2
 else
   cat > conftest.$ac_ext <<EOF
-#line 4795 "configure"
+#line 5061 "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
@@ -4825,7 +5091,7 @@ main ()
 }
 
 EOF
-if { (eval echo configure:4829: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5095: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   bash_cv_sys_restartable_syscalls=yes
 else
@@ -4851,12 +5117,12 @@ fi
 fi
 
 echo $ac_n "checking for sys_errlist and sys_nerr""... $ac_c" 1>&6
-echo "configure:4855: checking for sys_errlist and sys_nerr" >&5
+echo "configure:5121: 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 4860 "configure"
+#line 5126 "configure"
 #include "confdefs.h"
 #include <errno.h>
 int main() {
@@ -4865,7 +5131,7 @@ extern char *sys_errlist[];
  char *msg = sys_errlist[sys_nerr - 1];
 ; return 0; }
 EOF
-if { (eval echo configure:4869: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5135: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   bash_cv_sys_errlist=yes
 else
@@ -4886,16 +5152,16 @@ fi
 
 
 echo $ac_n "checking for sys_siglist in system C library""... $ac_c" 1>&6
-echo "configure:4890: checking for sys_siglist in system C library" >&5
+echo "configure:5156: 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
   if test "$cross_compiling" = yes; then
-  { echo "configure: error: cannot check for sys_siglist if cross compiling -- defaulting to no" 1>&2; exit 1; }
+  echo "configure: warning: cannot check for sys_siglist if cross compiling -- defaulting to no" 1>&2
         bash_cv_sys_siglist=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 4899 "configure"
+#line 5165 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -4912,7 +5178,7 @@ char *msg = sys_siglist[2];
 exit(msg == 0);
 }
 EOF
-if { (eval echo configure:4916: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5182: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   bash_cv_sys_siglist=yes
 else
@@ -4935,12 +5201,12 @@ EOF
 fi
 
 echo $ac_n "checking for _sys_siglist in signal.h or unistd.h""... $ac_c" 1>&6
-echo "configure:4939: checking for _sys_siglist in signal.h or unistd.h" >&5
+echo "configure:5205: checking for _sys_siglist in signal.h or unistd.h" >&5
 if eval "test \"`echo '$''{'bash_cv_decl_under_sys_siglist'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4944 "configure"
+#line 5210 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -4952,7 +5218,7 @@ int main() {
  char *msg = _sys_siglist[2]; 
 ; return 0; }
 EOF
-if { (eval echo configure:4956: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5222: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_decl_under_sys_siglist=yes
 else
@@ -4973,16 +5239,16 @@ fi
 
 
 echo $ac_n "checking for _sys_siglist in system C library""... $ac_c" 1>&6
-echo "configure:4977: checking for _sys_siglist in system C library" >&5
+echo "configure:5243: 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
   if test "$cross_compiling" = yes; then
-  { echo "configure: error: cannot check for _sys_siglist if cross compiling -- defaulting to no" 1>&2; exit 1; }
+  echo "configure: warning: cannot check for _sys_siglist if cross compiling -- defaulting to no" 1>&2
         bash_cv_under_sys_siglist=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 4986 "configure"
+#line 5252 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -4999,7 +5265,7 @@ char *msg = (char *)_sys_siglist[2];
 exit(msg == 0);
 }
 EOF
-if { (eval echo configure:5003: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5269: \"$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
@@ -5023,12 +5289,12 @@ fi
 
 
 echo $ac_n "checking whether signal handlers are of type void""... $ac_c" 1>&6
-echo "configure:5027: checking whether signal handlers are of type void" >&5
+echo "configure:5293: 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 5032 "configure"
+#line 5298 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -5043,7 +5309,7 @@ int main() {
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:5047: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5313: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_void_sighandler=yes
 else
@@ -5063,12 +5329,12 @@ EOF
 fi
 
 echo $ac_n "checking for clock_t""... $ac_c" 1>&6
-echo "configure:5067: checking for clock_t" >&5
+echo "configure:5333: 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 5072 "configure"
+#line 5338 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -5099,12 +5365,12 @@ EOF
 fi
 
 echo $ac_n "checking for sigset_t""... $ac_c" 1>&6
-echo "configure:5103: checking for sigset_t" >&5
+echo "configure:5369: 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 5108 "configure"
+#line 5374 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -5135,12 +5401,12 @@ EOF
 fi
 
 echo $ac_n "checking for quad_t""... $ac_c" 1>&6
-echo "configure:5139: checking for quad_t" >&5
+echo "configure:5405: 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 5144 "configure"
+#line 5410 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -5176,12 +5442,12 @@ EOF
 fi
 
 echo $ac_n "checking for size and type of struct rlimit fields""... $ac_c" 1>&6
-echo "configure:5180: checking for size and type of struct rlimit fields" >&5
+echo "configure:5446: 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 5185 "configure"
+#line 5451 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/resource.h>
@@ -5189,7 +5455,7 @@ int main() {
 rlim_t xxx;
 ; return 0; }
 EOF
-if { (eval echo configure:5193: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5459: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_type_rlimit=rlim_t
 else
@@ -5198,11 +5464,11 @@ else
   rm -rf conftest*
   
 if test "$cross_compiling" = yes; then
-  { echo "configure: error: cannot check quad_t if cross compiling -- defaulting to long" 1>&2; exit 1; }
+  echo "configure: warning: cannot check quad_t if cross compiling -- defaulting to long" 1>&2
          bash_cv_type_rlimit=long
 else
   cat > conftest.$ac_ext <<EOF
-#line 5206 "configure"
+#line 5472 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -5218,7 +5484,7 @@ main()
   exit(1);
 }
 EOF
-if { (eval echo configure:5222: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5488: \"$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
@@ -5250,12 +5516,12 @@ fi
 
 
 echo $ac_n "checking for a c_line member of struct termios""... $ac_c" 1>&6
-echo "configure:5254: checking for a c_line member of struct termios" >&5
+echo "configure:5520: 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 5259 "configure"
+#line 5525 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <termios.h>
@@ -5263,7 +5529,7 @@ int main() {
 struct termios t; int i; i = t.c_line;
 ; return 0; }
 EOF
-if { (eval echo configure:5267: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5533: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_termios_ldisc=yes
 else
@@ -5283,12 +5549,12 @@ EOF
 fi
 
 echo $ac_n "checking for a c_line member of struct termio""... $ac_c" 1>&6
-echo "configure:5287: checking for a c_line member of struct termio" >&5
+echo "configure:5553: 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 5292 "configure"
+#line 5558 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <termio.h>
@@ -5296,7 +5562,7 @@ int main() {
 struct termio t; int i; i = t.c_line;
 ; return 0; }
 EOF
-if { (eval echo configure:5300: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5566: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_termio_ldisc=yes
 else
@@ -5317,12 +5583,12 @@ fi
 
 
 echo $ac_n "checking if struct dirent has a d_ino member""... $ac_c" 1>&6
-echo "configure:5321: checking if struct dirent has a d_ino member" >&5
+echo "configure:5587: 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 5326 "configure"
+#line 5592 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -5351,7 +5617,7 @@ struct dirent d; int z; z = d.d_ino;
 
 ; return 0; }
 EOF
-if { (eval echo configure:5355: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5621: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_dirent_has_dino=yes
 else
@@ -5373,12 +5639,12 @@ fi
 
 
 echo $ac_n "checking if struct dirent has a d_fileno member""... $ac_c" 1>&6
-echo "configure:5377: checking if struct dirent has a d_fileno member" >&5
+echo "configure:5643: 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 5382 "configure"
+#line 5648 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -5407,7 +5673,7 @@ struct dirent d; int z; z = d.d_fileno;
 
 ; return 0; }
 EOF
-if { (eval echo configure:5411: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5677: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_dirent_has_d_fileno=yes
 else
@@ -5428,12 +5694,12 @@ EOF
 fi
 
 echo $ac_n "checking for struct winsize in sys/ioctl.h and termios.h""... $ac_c" 1>&6
-echo "configure:5432: checking for struct winsize in sys/ioctl.h and termios.h" >&5
+echo "configure:5698: checking for struct winsize in sys/ioctl.h and termios.h" >&5
 if eval "test \"`echo '$''{'bash_cv_struct_winsize_header'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5437 "configure"
+#line 5703 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/ioctl.h>
@@ -5441,7 +5707,7 @@ int main() {
 struct winsize x;
 ; return 0; }
 EOF
-if { (eval echo configure:5445: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5711: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_struct_winsize_header=ioctl_h
 else
@@ -5449,7 +5715,7 @@ else
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   cat > conftest.$ac_ext <<EOF
-#line 5453 "configure"
+#line 5719 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <termios.h>
@@ -5457,7 +5723,7 @@ int main() {
 struct winsize x;
 ; return 0; }
 EOF
-if { (eval echo configure:5461: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5727: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_struct_winsize_header=termios_h
 else
@@ -5490,12 +5756,12 @@ fi
 
 
 echo $ac_n "checking for the existence of strsignal""... $ac_c" 1>&6
-echo "configure:5494: checking for the existence of strsignal" >&5
+echo "configure:5760: checking for the existence 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 5499 "configure"
+#line 5765 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -5503,7 +5769,7 @@ int main() {
 char *s = (char *)strsignal(2);
 ; return 0; }
 EOF
-if { (eval echo configure:5507: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5773: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   bash_cv_have_strsignal=yes
 else
@@ -5524,17 +5790,17 @@ EOF
 fi
 
 echo $ac_n "checking if opendir() opens non-directories""... $ac_c" 1>&6
-echo "configure:5528: checking if opendir() opens non-directories" >&5
+echo "configure:5794: 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
   if test "$cross_compiling" = yes; then
-  { echo "configure: error: cannot check opendir if cross compiling -- defaulting to no" 1>&2; exit 1; }
+  echo "configure: warning: cannot check opendir if cross compiling -- defaulting to no" 1>&2
      bash_cv_opendir_not_robust=no
 
 else
   cat > conftest.$ac_ext <<EOF
-#line 5538 "configure"
+#line 5804 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -5570,7 +5836,7 @@ unlink("/tmp/not_a_directory");
 exit (dir == 0);
 }
 EOF
-if { (eval echo configure:5574: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5840: \"$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
@@ -5593,17 +5859,17 @@ EOF
 fi
 
 echo $ac_n "checking for declaration of printf in <stdio.h>""... $ac_c" 1>&6
-echo "configure:5597: checking for declaration of printf in <stdio.h>" >&5
+echo "configure:5863: 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
   if test "$cross_compiling" = yes; then
-  { echo "configure: error: cannot check printf declaration if cross compiling -- defaulting to yes" 1>&2; exit 1; }
+  echo "configure: warning: cannot check printf declaration if cross compiling -- defaulting to yes" 1>&2
     bash_cv_printf_declared=yes
 
 else
   cat > conftest.$ac_ext <<EOF
-#line 5607 "configure"
+#line 5873 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -5620,7 +5886,7 @@ exit(pf == 0);
 }
 
 EOF
-if { (eval echo configure:5624: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5890: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   bash_cv_printf_declared=yes
 else
@@ -5643,17 +5909,17 @@ EOF
 fi
 
 echo $ac_n "checking whether ulimit can substitute for getdtablesize""... $ac_c" 1>&6
-echo "configure:5647: checking whether ulimit can substitute for getdtablesize" >&5
+echo "configure:5913: 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
   if test "$cross_compiling" = yes; then
-  { echo "configure: error: cannot check ulimit if cross compiling -- defaulting to no" 1>&2; exit 1; }
+  echo "configure: warning: cannot check ulimit if cross compiling -- defaulting to no" 1>&2
     bash_cv_ulimit_maxfds=no
 
 else
   cat > conftest.$ac_ext <<EOF
-#line 5657 "configure"
+#line 5923 "configure"
 #include "confdefs.h"
 
 main()
@@ -5663,7 +5929,7 @@ exit (maxfds == -1L);
 }
 
 EOF
-if { (eval echo configure:5667: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5933: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   bash_cv_ulimit_maxfds=yes
 else
@@ -5686,17 +5952,17 @@ EOF
 fi
 
 echo $ac_n "checking to see if getenv can be redefined""... $ac_c" 1>&6
-echo "configure:5690: checking to see if getenv can be redefined" >&5
+echo "configure:5956: 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
   if test "$cross_compiling" = yes; then
-  { echo "configure: error: cannot check getenv redefinition if cross compiling -- defaulting to yes" 1>&2; exit 1; }
+  echo "configure: warning: cannot check getenv redefinition if cross compiling -- defaulting to yes" 1>&2
     bash_cv_getenv_redef=yes
 
 else
   cat > conftest.$ac_ext <<EOF
-#line 5700 "configure"
+#line 5966 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_UNISTD_H
@@ -5731,7 +5997,7 @@ exit(s == 0);     /* force optimizer to leave getenv in */
 }
 
 EOF
-if { (eval echo configure:5735: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6001: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   bash_cv_getenv_redef=yes
 else
@@ -5754,17 +6020,17 @@ EOF
 fi
 
 echo $ac_n "checking if getcwd() calls popen()""... $ac_c" 1>&6
-echo "configure:5758: checking if getcwd() calls popen()" >&5
+echo "configure:6024: 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
   if test "$cross_compiling" = yes; then
-  { echo "configure: error: cannot check whether getcwd calls popen if cross compiling -- defaulting to no" 1>&2; exit 1; }
+  echo "configure: warning: cannot check whether getcwd calls popen if cross compiling -- defaulting to no" 1>&2
     bash_cv_getcwd_calls_popen=no
 
 else
   cat > conftest.$ac_ext <<EOF
-#line 5768 "configure"
+#line 6034 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -5819,7 +6085,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:5823: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6089: \"$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
@@ -5842,12 +6108,12 @@ EOF
 fi
 
 echo $ac_n "checking for declaration of sbrk in <unistd.h>""... $ac_c" 1>&6
-echo "configure:5846: checking for declaration of sbrk in <unistd.h>" >&5
+echo "configure:6112: 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 5851 "configure"
+#line 6117 "configure"
 #include "confdefs.h"
 #include <unistd.h>
 EOF
@@ -5873,17 +6139,17 @@ fi
 
 
 echo $ac_n "checking for presence of POSIX-style sigsetjmp/siglongjmp""... $ac_c" 1>&6
-echo "configure:5877: checking for presence of POSIX-style sigsetjmp/siglongjmp" >&5
+echo "configure:6143: 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
   if test "$cross_compiling" = yes; then
-  { echo "configure: error: cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to missing" 1>&2; exit 1; }
+  echo "configure: warning: cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to missing" 1>&2
      bash_cv_func_sigsetjmp=missing
 
 else
   cat > conftest.$ac_ext <<EOF
-#line 5887 "configure"
+#line 6153 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_UNISTD_H
@@ -5924,7 +6190,7 @@ exit(1);
 #endif
 }
 EOF
-if { (eval echo configure:5928: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6194: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   bash_cv_func_sigsetjmp=present
 else
@@ -5948,17 +6214,17 @@ fi
 
 
 echo $ac_n "checking whether or not strcoll and strcmp differ""... $ac_c" 1>&6
-echo "configure:5952: checking whether or not strcoll and strcmp differ" >&5
+echo "configure:6218: 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 -- defaulting to no" 1>&2; exit 1; }
+  echo "configure: warning: cannot check strcoll if cross compiling -- defaulting to no" 1>&2
     bash_cv_func_strcoll_broken=no
 
 else
   cat > conftest.$ac_ext <<EOF
-#line 5962 "configure"
+#line 6228 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -5997,7 +6263,7 @@ char    *v[];
 }
 
 EOF
-if { (eval echo configure:6001: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6267: \"$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
@@ -6023,17 +6289,17 @@ fi
 
 
 echo $ac_n "checking if signal handlers must be reinstalled when invoked""... $ac_c" 1>&6
-echo "configure:6027: checking if signal handlers must be reinstalled when invoked" >&5
+echo "configure:6293: 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
   if test "$cross_compiling" = yes; then
-  { echo "configure: error: cannot check signal handling if cross compiling -- defaulting to no" 1>&2; exit 1; }
+  echo "configure: warning: cannot check signal handling if cross compiling -- defaulting to no" 1>&2
     bash_cv_must_reinstall_sighandlers=no
 
 else
   cat > conftest.$ac_ext <<EOF
-#line 6037 "configure"
+#line 6303 "configure"
 #include "confdefs.h"
 
 #include <signal.h>
@@ -6080,7 +6346,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:6084: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6350: \"$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
@@ -6104,17 +6370,17 @@ fi
 
 
 echo $ac_n "checking for presence of necessary job control definitions""... $ac_c" 1>&6
-echo "configure:6108: checking for presence of necessary job control definitions" >&5
+echo "configure:6374: 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
   if test "$cross_compiling" = yes; then
-  { echo "configure: error: cannot check job control if cross-compiling -- defaulting to missing" 1>&2; exit 1; }
+  echo "configure: warning: cannot check job control if cross-compiling -- defaulting to missing" 1>&2
      bash_cv_job_control_missing=missing
 
 else
   cat > conftest.$ac_ext <<EOF
-#line 6118 "configure"
+#line 6384 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -6161,7 +6427,7 @@ exit(1);
 exit(0);
 }
 EOF
-if { (eval echo configure:6165: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6431: \"$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
@@ -6184,17 +6450,17 @@ EOF
 fi
 
 echo $ac_n "checking for presence of named pipes""... $ac_c" 1>&6
-echo "configure:6188: checking for presence of named pipes" >&5
+echo "configure:6454: 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
   if test "$cross_compiling" = yes; then
-  { echo "configure: error: cannot check for named pipes if cross-compiling -- defaulting to missing" 1>&2; exit 1; }
+  echo "configure: warning: cannot check for named pipes if cross-compiling -- defaulting to missing" 1>&2
      bash_cv_sys_named_pipes=missing
 
 else
   cat > conftest.$ac_ext <<EOF
-#line 6198 "configure"
+#line 6464 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -6228,7 +6494,7 @@ unlink ("/tmp/sh-np-autoconf");
 exit(0);
 }
 EOF
-if { (eval echo configure:6232: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6498: \"$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
@@ -6252,12 +6518,12 @@ fi
 
 
 echo $ac_n "checking for TIOCGWINSZ in sys/ioctl.h""... $ac_c" 1>&6
-echo "configure:6256: checking for TIOCGWINSZ in sys/ioctl.h" >&5
+echo "configure:6522: 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 6261 "configure"
+#line 6527 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/ioctl.h>
@@ -6265,7 +6531,7 @@ int main() {
 int x = TIOCGWINSZ;
 ; return 0; }
 EOF
-if { (eval echo configure:6269: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6535: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_tiocgwinsz_in_ioctl=yes
 else
@@ -6286,12 +6552,12 @@ EOF
 fi
 
 echo $ac_n "checking for TIOCSTAT in sys/ioctl.h""... $ac_c" 1>&6
-echo "configure:6290: checking for TIOCSTAT in sys/ioctl.h" >&5
+echo "configure:6556: 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 6295 "configure"
+#line 6561 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/ioctl.h>
@@ -6299,7 +6565,7 @@ int main() {
 int x = TIOCSTAT;
 ; return 0; }
 EOF
-if { (eval echo configure:6303: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6569: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_tiocstat_in_ioctl=yes
 else
@@ -6320,12 +6586,12 @@ EOF
 fi
 
 echo $ac_n "checking for FIONREAD in sys/ioctl.h""... $ac_c" 1>&6
-echo "configure:6324: checking for FIONREAD in sys/ioctl.h" >&5
+echo "configure:6590: 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 6329 "configure"
+#line 6595 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/ioctl.h>
@@ -6333,7 +6599,7 @@ int main() {
 int x = FIONREAD;
 ; return 0; }
 EOF
-if { (eval echo configure:6337: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6603: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_fionread_in_ioctl=yes
 else
@@ -6355,19 +6621,19 @@ fi
 
 
 echo $ac_n "checking for speed_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:6359: checking for speed_t in sys/types.h" >&5
+echo "configure:6625: 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 6364 "configure"
+#line 6630 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 int main() {
 speed_t x;
 ; return 0; }
 EOF
-if { (eval echo configure:6371: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6637: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_speed_t_in_sys_types=yes
 else
@@ -6388,12 +6654,12 @@ EOF
 fi
 
 echo $ac_n "checking whether programs are able to redeclare getpw functions""... $ac_c" 1>&6
-echo "configure:6392: checking whether programs are able to redeclare getpw functions" >&5
+echo "configure:6658: 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 6397 "configure"
+#line 6663 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <pwd.h>
@@ -6404,7 +6670,7 @@ int main() {
 struct passwd *z; z = getpwent(); z = getpwuid(0); z = getpwnam("root");
 ; return 0; }
 EOF
-if { (eval echo configure:6408: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6674: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_can_redecl_getpw=yes
 else
@@ -6427,12 +6693,12 @@ fi
 
 case "$host_os" in
 hpux*) echo $ac_n "checking whether $host_os needs _KERNEL for RLIMIT defines""... $ac_c" 1>&6
-echo "configure:6431: checking whether $host_os needs _KERNEL for RLIMIT defines" >&5
+echo "configure:6697: 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 6436 "configure"
+#line 6702 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -6445,7 +6711,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:6449: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6715: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_kernel_rlimit=no
 else
@@ -6453,7 +6719,7 @@ else
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   cat > conftest.$ac_ext <<EOF
-#line 6457 "configure"
+#line 6723 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -6468,7 +6734,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:6472: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6738: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_kernel_rlimit=yes
 else
@@ -6502,14 +6768,14 @@ 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:6506: checking which library has the termcap functions" >&5
+echo "configure:6772: 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:6513: checking for tgetent in -ltermcap" >&5
+echo "configure:6779: 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
@@ -6517,7 +6783,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ltermcap  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6521 "configure"
+#line 6787 "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
@@ -6528,7 +6794,7 @@ int main() {
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:6532: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6798: \"$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
@@ -6547,7 +6813,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:6551: checking for tgetent in -lcurses" >&5
+echo "configure:6817: 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
@@ -6555,7 +6821,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lcurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6559 "configure"
+#line 6825 "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
@@ -6566,7 +6832,7 @@ int main() {
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:6570: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6836: \"$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
@@ -6585,7 +6851,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:6589: checking for tgetent in -lncurses" >&5
+echo "configure:6855: 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
@@ -6593,7 +6859,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lncurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6597 "configure"
+#line 6863 "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
@@ -6604,7 +6870,7 @@ int main() {
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:6608: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6874: \"$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
@@ -6633,7 +6899,7 @@ fi
 
 if test "X$_bash_needmsg" = "Xyes"; then
 echo $ac_n "checking which library has the termcap functions""... $ac_c" 1>&6
-echo "configure:6637: checking which library has the termcap functions" >&5
+echo "configure:6903: 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 && test -z "$prefer_curses"; then
@@ -6656,7 +6922,7 @@ fi
 
 
 echo $ac_n "checking whether /dev/fd is available""... $ac_c" 1>&6
-echo "configure:6660: checking whether /dev/fd is available" >&5
+echo "configure:6926: 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
@@ -6692,7 +6958,7 @@ EOF
 fi
 
 echo $ac_n "checking for default mail directory""... $ac_c" 1>&6
-echo "configure:6696: checking for default mail directory" >&5
+echo "configure:6962: 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
@@ -6759,7 +7025,7 @@ fi
 LOCAL_DEFS=-DSHELL
 
 
-case "$host_os" in
+case "${host_os}" in
 sysv4.2*)      cat >> confdefs.h <<\EOF
 #define SVR4_2 1
 EOF
@@ -6772,19 +7038,31 @@ sysv4*)         cat >> confdefs.h <<\EOF
 #define SVR4 1
 EOF
  ;;
+sysv5*)                cat >> confdefs.h <<\EOF
+#define SVR5 1
+EOF
+ ;;
+hpux9*)                LOCAL_CFLAGS="-DHPUX9 -DHPUX" ;;
 hpux*)         LOCAL_CFLAGS=-DHPUX ;;
 dgux*)         LOCAL_CFLAGS=-D_DGUX_SOURCE; LOCAL_LIBS=-ldgc ;;
 isc*)          LOCAL_CFLAGS=-Disc386;;
-sco3.2v5*)     LOCAL_CFLAGS="-DWAITPID_BROKEN -DNO_MEMSCRAMBLE -DPATH_MAX=1024" ;;
+sco3.2v5*)     LOCAL_CFLAGS="-b elf -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 ;;
 solaris2.5*)   LOCAL_CFLAGS=-DSunOS5 ;;
+lynxos*)       LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
 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" ;;
+powerux*)      LOCAL_LIBS="-lgen" ;;
 cygwin32*)     LOCAL_LIBS="-luser32" ;;
+opennt*|interix*) LOCAL_CFLAGS="-DNO_MAIN_ENV_ARG" ;;
+esac
+
+case "${host_os}-${CC}" in
+aix4.2*-*gcc*) LOCAL_LDFLAGS="-Xlinker -bexpall -Xlinker -brtl" ;;
+aix4.2*)       LOCAL_LDFLAGS="-bexpall -brtl" ;;
+bsdi4*-*gcc*)  LOCAL_LDFLAGS="-rdynamic" ;;    # allow dynamic loading, like Linux
 esac
 
 case "$host_cpu" in
@@ -6800,6 +7078,25 @@ m88k-motorola-sysv3)     LOCAL_CFLAGS=-DWAITPID_BROKEN ;;
 mips-pyramid-sysv4)    LOCAL_CFLAGS=-Xa ;;
 esac
 
+#
+# Shared object configuration section.  These values are generated by
+# ${srcdir}/support/shobj-conf
+#
+if test "$ac_cv_func_dlopen" = "yes" && test -f ${srcdir}/support/shobj-conf
+then
+       echo $ac_n "checking shared object configuration for loadable builtins""... $ac_c" 1>&6
+echo "configure:7089: checking shared object configuration for loadable builtins" >&5
+       eval `${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C ${CC} -c ${host_cpu} -o ${host_os} -v ${host_vendor}`
+       
+       
+       
+       
+       
+       
+       
+       echo "$ac_t""$SHOBJ_STATUS" 1>&6
+fi
+
 # try to create a directory tree if the source is elsewhere
 # this should be packaged into a script accessible via ${srcdir}/support
 case "$srcdir" in
@@ -6833,6 +7130,8 @@ BUILD_DIR=`pwd`
 
 
 
+
+
 
 
 #AC_SUBST(ALLOCA_SOURCE)
@@ -6981,27 +7280,40 @@ s%@TESTSCRIPT@%$TESTSCRIPT%g
 s%@PURIFY@%$PURIFY%g
 s%@MALLOC_TARGET@%$MALLOC_TARGET%g
 s%@MALLOC_SRC@%$MALLOC_SRC%g
+s%@CC@%$CC%g
+s%@CPP@%$CPP%g
+s%@SIGNAMES_H@%$SIGNAMES_H%g
+s%@CC_FOR_BUILD@%$CC_FOR_BUILD%g
+s%@STATIC_LD@%$STATIC_LD%g
 s%@READLINE_LIB@%$READLINE_LIB%g
 s%@READLINE_DEP@%$READLINE_DEP%g
+s%@RL_LIBDIR@%$RL_LIBDIR%g
+s%@RL_INCLUDE@%$RL_INCLUDE%g
 s%@HISTORY_LIB@%$HISTORY_LIB%g
 s%@HISTORY_DEP@%$HISTORY_DEP%g
-s%@CC@%$CC%g
-s%@CPP@%$CPP%g
-s%@CC_FOR_BUILD@%$CC_FOR_BUILD%g
-s%@SIGNAMES_H@%$SIGNAMES_H%g
+s%@HIST_LIBDIR@%$HIST_LIBDIR%g
 s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
 s%@INSTALL_DATA@%$INSTALL_DATA%g
 s%@AR@%$AR%g
 s%@RANLIB@%$RANLIB%g
 s%@YACC@%$YACC%g
 s%@SET_MAKE@%$SET_MAKE%g
+s%@MAKE_SHELL@%$MAKE_SHELL%g
 s%@ALLOCA@%$ALLOCA%g
 s%@TERMCAP_LIB@%$TERMCAP_LIB%g
 s%@TERMCAP_DEP@%$TERMCAP_DEP%g
 s%@JOBS_O@%$JOBS_O%g
+s%@SHOBJ_CC@%$SHOBJ_CC%g
+s%@SHOBJ_CFLAGS@%$SHOBJ_CFLAGS%g
+s%@SHOBJ_LD@%$SHOBJ_LD%g
+s%@SHOBJ_LDFLAGS@%$SHOBJ_LDFLAGS%g
+s%@SHOBJ_XLDFLAGS@%$SHOBJ_XLDFLAGS%g
+s%@SHOBJ_LIBS@%$SHOBJ_LIBS%g
+s%@SHOBJ_STATUS@%$SHOBJ_STATUS%g
 s%@PROFILE_FLAGS@%$PROFILE_FLAGS%g
 s%@incdir@%$incdir%g
 s%@BUILD_DIR@%$BUILD_DIR%g
+s%@ARFLAGS@%$ARFLAGS%g
 s%@BASHVERS@%$BASHVERS%g
 s%@BASHPATCH@%$BASHPATCH%g
 s%@LOCAL_LIBS@%$LOCAL_LIBS%g
index 240eb4da8fa2425166a712c01572adc10e337cbf..fe5d820142acd4dfe022139295de6853aabd1264 100644 (file)
@@ -1,12 +1,12 @@
 dnl
-dnl Configure script for bash-2.02
+dnl Configure script for bash-2.03
 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.02, version 2.19, from autoconf version] AC_ACVERSION)dnl
+AC_REVISION([for Bash 2.03, version 2.49, from autoconf version] AC_ACVERSION)dnl
 
 AC_INIT(shell.h)
 AC_CONFIG_HEADER(config.h)
@@ -28,25 +28,28 @@ opt_purify=no
 opt_purecov=no
 opt_afs=no
 opt_curses=no
+opt_with_installed_readline=no
 
 dnl some systems should be configured without gnu malloc by default
 dnl and some need a special compiler or loader
 dnl look in the NOTES file for more
 case "${host_cpu}-${host_os}" in
-alpha-*)       opt_gnu_malloc=no ;;    # alpha running osf/1 or linux
+alpha*-*)      opt_gnu_malloc=no ;;    # alpha running osf/1 or linux
 *[Cc]ray*-*)   opt_gnu_malloc=no ;;    # Crays
 *-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
-#mips-irix6*)  opt_gnu_malloc=no ;;    # needs 8-byte alignment
+mips-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
+*-rhapsody*)   opt_gnu_malloc=no ;;    # Apple Rhapsody
 *-dgux*)       opt_gnu_malloc=no ;;    # DG/UX machines
 *-qnx*)                opt_gnu_malloc=no ;;    # QNX 4.2
 *-machten4)    opt_gnu_malloc=no ;;    # MachTen 4.x
 *-bsdi2.1|*-bsdi3.?)   opt_gnu_malloc=no ; : ${CC:=shlicc2} ;; # for loadable builtins
+*-beos*)       opt_gnu_malloc=no ;;    # they say it's suitable
 *-cygwin32*)   opt_gnu_malloc=no ;;    # Cygnus's CYGWIN32 environment
 esac
 
@@ -56,6 +59,7 @@ 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(installed-readline, --with-installed-readline      use a version of the readline library that is already installed, opt_with_installed_readline=$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)
 
@@ -156,30 +160,13 @@ AC_ARG_ENABLE(static-link, --enable-static-link           [link bash statically, for use
 
 dnl opt_job_control is handled later, after BASH_JOB_CONTROL_MISSING runs
 
+dnl opt_readline and opt_history are handled later, because AC_PROG_CC needs
+dnl to be run before we can check the version of an already-installed readline
+dnl library
+
 if test $opt_alias = yes; then
 AC_DEFINE(ALIAS)
 fi
-if test $opt_readline = yes; then
-AC_DEFINE(READLINE)
-READLINE_LIB=-lreadline
-READLINE_DEP='$(READLINE_LIBRARY)'
-else
-READLINE_LIB= READLINE_DEP=
-fi
-if test $opt_history = yes; then
-AC_DEFINE(HISTORY)
-HISTORY_LIB=-lhistory
-HISTORY_DEP='$(HISTORY_LIBRARY)'
-else
-HISTORY_LIB= HISTORY_DEP=
-fi
-if test $opt_bang_history = yes; then
-AC_DEFINE(BANG_HISTORY)
-HISTORY_LIB=-lhistory
-HISTORY_DEP='$(HISTORY_LIBRARY)'
-else
-HISTORY_LIB= HISTORY_DEP=
-fi
 if test $opt_dirstack = yes; then
 AC_DEFINE(PUSHD_AND_POPD)
 fi
@@ -234,10 +221,6 @@ AC_SUBST(TESTSCRIPT)
 AC_SUBST(PURIFY)
 AC_SUBST(MALLOC_TARGET)
 AC_SUBST(MALLOC_SRC)
-AC_SUBST(READLINE_LIB)
-AC_SUBST(READLINE_DEP)
-AC_SUBST(HISTORY_LIB)
-AC_SUBST(HISTORY_DEP)
 
 dnl Use GNU m4 macros to get the distribution and patchlevel information
 dnl into configure without requiring the files to be distributed
@@ -256,24 +239,37 @@ BASH_LARGE_FILE_SUPPORT
 AC_ISC_POSIX
 AC_MINIX
 
-dnl BEGIN changes for CYGNUS cross-building for cygwin32
+dnl BEGIN changes for cross-building for cygwin32 and BeOS
+
+SIGNAMES_H=lsignames.h
 
 dnl load up the cross-building cache file -- add more cases and cache
 dnl files as necessary
+
+dnl Note that host and target machine are the same, and different than the
+dnl build machine.
+dnl Set SIGNAMES_H based on whether or not we're cross-compiling.
+
 if test "x$cross_compiling" = "xyes"; then
     case "${host}" in
     *-cygwin32*)
        cross_cache=${srcdir}/cross-build/cygwin32.cache
-       if test -r "${cross_cache}"; then
-           echo "loading cross-build cache file ${cross_cache}"
-           . ${cross_cache}
-       fi
-       unset cross_cache
+       SIGNAMES_H='$(srcdir)/cross-build/win32sig.h'
        ;;
-    *) echo "configure: cross-compiling for a non-cygwin32 target is not supported" >&2
+    i[[3456]]86-*-beos*)
+       cross_cache=${srcdir}/cross-build/x86-beos.cache
+       SIGNAMES_H='${srcdir}/cross-build/beos-sig.h'
+       ;;
+    *) echo "configure: cross-compiling for $host is not supported" >&2
        ;;
     esac
+    if test -n "${cross_cache}" && test -r "${cross_cache}"; then
+       echo "loading cross-build cache file ${cross_cache}"
+       . ${cross_cache}
+    fi
+    unset cross_cache
 fi
+AC_SUBST(SIGNAMES_H)
 
 if test -z "$CC_FOR_BUILD"; then
     if test "x$cross_compiling" = "xno"; then
@@ -284,15 +280,7 @@ if test -z "$CC_FOR_BUILD"; then
 fi
 AC_SUBST(CC_FOR_BUILD)
 
-dnl Set SIGNAMES_H based on whether or not we're cross-compiling
-if test "x$cross_compiling" = "xno"; then
-       SIGNAMES_H=lsignames.h
-else
-       SIGNAMES_H='$(srcdir)/cross-build/win32sig.h'
-fi
-AC_SUBST(SIGNAMES_H)
-
-dnl END changes for CYGNUS cross-building for cygwin32
+dnl END changes for cross-building
 
 dnl We want these before the checks, so the checks can modify their values.
 test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1
@@ -304,29 +292,114 @@ dnl handle options that alter how bash is compiled and linked
 dnl these must come after the test for cc/gcc
 if test "$opt_profiling" = "yes"; then
        PROFILE_FLAGS=-pg
-       opt_static_link=yes
+       case "$host_os" in
+       solaris2*)      ;;
+       *)              opt_static_link=yes ;;
+       esac
 fi
 
 if test "$opt_static_link" = yes; then
        # if we're using gcc, add `-static' to LDFLAGS
        if test -n "$GCC" || test "$ac_cv_prog_gcc" = "yes"; then
-               LDFLAGS="$LDFLAGS -static"
+               STATIC_LD="-static"
        fi
 fi
 
 AC_SUBST(CFLAGS)
 AC_SUBST(CPPFLAGS)
 AC_SUBST(LDFLAGS)
+AC_SUBST(STATIC_LD)
 
 AC_PROG_GCC_TRADITIONAL
 
+dnl BEGIN READLINE and HISTORY LIBRARY SECTION
+dnl prepare to allow bash to be linked against an already-installed readline
+
+dnl first test that the readline version is new enough to link bash against
+if test "$opt_readline" = yes && test "$opt_with_installed_readline" = "yes"
+then
+
+dnl    we duplicate some work that's done later here so we can look in
+dnl    the correct directory for the readline library
+
+       test "x$prefix" = xNONE && _rl_prefix=$ac_default_prefix || _rl_prefix=${prefix}
+       test "x$exec_prefix" = xNONE && _rl_exec_prefix=${_rl_prefix} || _rl_exec_prefix=${exec_prefix}
+
+       AC_MSG_CHECKING(version of installed readline library)
+       _rl_version=`exec_prefix=${_rl_exec_prefix} ${CONFIG_SHELL-/bin/sh} ${srcdir}/support/rlvers.sh -C "${CC}" -L ${libdir}`
+       AC_MSG_RESULT($_rl_version)
+
+       case "$_rl_version" in
+       3*|4*|5*|6*|7*|8*|9*)   ;;
+       *)      opt_with_installed_readline=no 
+               AC_MSG_WARN(installed readline library is too old to be linked with bash)
+               AC_MSG_WARN(using private bash version)
+               ;;
+       esac
+       unset _rl_version _rl_prefix _rl_exec_prefix
+fi
+
+if test $opt_readline = yes; then
+       AC_DEFINE(READLINE)
+       READLINE_LIB=-lreadline
+       if test "$opt_with_installed_readline" = "yes" ; then
+               RL_LIBDIR='$(libdir)'
+               READLINE_DEP=
+               RL_INCLUDE='-I$(includedir)'
+       else
+               RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
+               READLINE_DEP='$(READLINE_LIBRARY)'
+       fi
+else
+       RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
+       READLINE_LIB= READLINE_DEP=
+fi
+if test $opt_history = yes || test $opt_bang_history = yes; then
+       if test $opt_history = yes; then
+               AC_DEFINE(HISTORY)
+       fi
+       if test $opt_bang_history = yes; then
+               AC_DEFINE(BANG_HISTORY)
+       fi
+       HISTORY_LIB=-lhistory
+       if test "$opt_with_installed_readline" = "yes"; then
+               HIST_LIBDIR='$(libdir)'
+               HISTORY_DEP=
+               RL_INCLUDE='-I$(includedir)'
+       else
+               HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
+               HISTORY_DEP='$(HISTORY_LIBRARY)'
+       fi
+else
+       HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
+       HISTORY_LIB= HISTORY_DEP=
+fi
+AC_SUBST(READLINE_LIB)
+AC_SUBST(READLINE_DEP)
+AC_SUBST(RL_LIBDIR)
+AC_SUBST(RL_INCLUDE)
+AC_SUBST(HISTORY_LIB)
+AC_SUBST(HISTORY_DEP)
+AC_SUBST(HIST_LIBDIR)
+
+dnl END READLINE and HISTORY LIBRARY SECTION
+
 dnl programs needed by the build and install process
 AC_PROG_INSTALL
 AC_CHECK_PROG(AR, ar, ar)
+dnl Set default for ARFLAGS, since autoconf does not have a macro for it.
+dnl This allows people to set it when running configure or make
+test -n "$ARFLAGS" || ARFLAGS="cr"
 AC_PROG_RANLIB
 AC_PROG_YACC
 AC_PROG_MAKE_SET
 
+case "$host_os" in
+opennt*|interix*)      MAKE_SHELL="$OPENNT_ROOT/bin/sh" ;;
+*)                     MAKE_SHELL=/bin/sh ;;
+esac
+AC_SUBST(MAKE_SHELL)
+
 dnl special checks for libc functions
 AC_FUNC_ALLOCA
 AC_FUNC_GETPGRP
@@ -357,8 +430,8 @@ AC_CHECK_FUNC(mkfifo,AC_DEFINE(HAVE_MKFIFO),AC_DEFINE(MKFIFO_MISSING))
 
 dnl checks for system calls
 AC_CHECK_FUNCS(dup2 select getdtablesize getgroups gethostname \
-               setdtablesize getpagesize killpg lstat getpeername \
-               getrlimit getrusage gettimeofday waitpid tcgetpgrp)
+               setdtablesize getpagesize killpg lstat getpeername sbrk \
+               getrlimit getrusage gettimeofday waitpid tcgetpgrp rename)
 
 dnl checks for c library functions
 AC_CHECK_FUNCS(bcopy bzero confstr getcwd strcasecmp setenv putenv \
@@ -418,23 +491,15 @@ AC_CHECK_TYPE(time_t, long)
 
 AC_TYPE_SIGNAL
 
-AC_CHECK_SIZEOF(int)
-AC_CHECK_SIZEOF(long)
-AC_CHECK_SIZEOF(char *)
-
-AC_CHECK_TYPE(int32_t)
-if test "$ac_cv_type_int32_t" = "no"; then
-        BASH_TYPE_INT32_T
-fi
-AC_CHECK_TYPE(u_int32_t)
-if test "$ac_cv_type_u_int32_t" = "no"; then
-        BASH_TYPE_U_INT32_T
-fi
+AC_CHECK_SIZEOF(int, 4)
+AC_CHECK_SIZEOF(long, 4)
+AC_CHECK_SIZEOF(char *, 4)
+AC_CHECK_SIZEOF(double, 8)
 
-AC_CHECK_TYPE(ptrdiff_t)
-if test "$ac_cv_type_ptrdiff_t" = "no"; then
-        BASH_TYPE_PTRDIFF_T
-fi
+BASH_TYPE_INT32_T
+BASH_TYPE_U_INT32_T
+BASH_TYPE_PTRDIFF_T
+BASH_TYPE_BITS64_T
 
 dnl structures
 AC_HEADER_STAT
@@ -556,23 +621,33 @@ dnl libraries, and specify any additional local cc flags
 dnl
 dnl this should really go away someday
 
-case "$host_os" in
+case "${host_os}" in
 sysv4.2*)      AC_DEFINE(SVR4_2)
                AC_DEFINE(SVR4) ;;
 sysv4*)                AC_DEFINE(SVR4) ;;
+sysv5*)                AC_DEFINE(SVR5) ;;
+hpux9*)                LOCAL_CFLAGS="-DHPUX9 -DHPUX" ;;
 hpux*)         LOCAL_CFLAGS=-DHPUX ;;
 dgux*)         LOCAL_CFLAGS=-D_DGUX_SOURCE; LOCAL_LIBS=-ldgc ;;
 isc*)          LOCAL_CFLAGS=-Disc386;;
-sco3.2v5*)     LOCAL_CFLAGS="-DWAITPID_BROKEN -DNO_MEMSCRAMBLE -DPATH_MAX=1024" ;;
+sco3.2v5*)     LOCAL_CFLAGS="-b elf -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 ;;
 solaris2.5*)   LOCAL_CFLAGS=-DSunOS5 ;;
+lynxos*)       LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
 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" ;;
+powerux*)      LOCAL_LIBS="-lgen" ;;
 cygwin32*)     LOCAL_LIBS="-luser32" ;;
+opennt*|interix*) LOCAL_CFLAGS="-DNO_MAIN_ENV_ARG" ;;
+esac
+
+dnl Stanza for OS/compiler pair-specific flags
+case "${host_os}-${CC}" in
+aix4.2*-*gcc*) LOCAL_LDFLAGS="-Xlinker -bexpall -Xlinker -brtl" ;;
+aix4.2*)       LOCAL_LDFLAGS="-bexpall -brtl" ;;
+bsdi4*-*gcc*)  LOCAL_LDFLAGS="-rdynamic" ;;    # allow dynamic loading, like Linux
 esac
 
 case "$host_cpu" in
@@ -588,6 +663,24 @@ m88k-motorola-sysv3)       LOCAL_CFLAGS=-DWAITPID_BROKEN ;;
 mips-pyramid-sysv4)    LOCAL_CFLAGS=-Xa ;;
 esac
 
+#
+# Shared object configuration section.  These values are generated by
+# ${srcdir}/support/shobj-conf
+#
+if test "$ac_cv_func_dlopen" = "yes" && test -f ${srcdir}/support/shobj-conf
+then
+       AC_MSG_CHECKING(shared object configuration for loadable builtins)
+       eval `${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C ${CC} -c ${host_cpu} -o ${host_os} -v ${host_vendor}`
+       AC_SUBST(SHOBJ_CC)
+       AC_SUBST(SHOBJ_CFLAGS)
+       AC_SUBST(SHOBJ_LD)
+       AC_SUBST(SHOBJ_LDFLAGS)
+       AC_SUBST(SHOBJ_XLDFLAGS)
+       AC_SUBST(SHOBJ_LIBS)
+       AC_SUBST(SHOBJ_STATUS)
+       AC_MSG_RESULT($SHOBJ_STATUS)
+fi
+
 # try to create a directory tree if the source is elsewhere
 # this should be packaged into a script accessible via ${srcdir}/support
 case "$srcdir" in
@@ -611,11 +704,13 @@ AC_SUBST(BUILD_DIR)
 
 AC_SUBST(YACC)
 AC_SUBST(AR)
+AC_SUBST(ARFLAGS)
 
 AC_SUBST(BASHVERS)
 AC_SUBST(BASHPATCH)
 
 AC_SUBST(host_cpu)
+AC_SUBST(host_vendor)
 AC_SUBST(host_os)
 
 AC_SUBST(LOCAL_LIBS)
diff --git a/cross-build/beos-sig.h b/cross-build/beos-sig.h
new file mode 100644 (file)
index 0000000..7553c7f
--- /dev/null
@@ -0,0 +1,36 @@
+/* This file is used when cross compiling bash to run native on BeOS. */
+
+#ifndef __GNUC__
+# error cross compiling requires gcc
+#endif
+
+/* A translation list so we can be polite to our users.
+   Use gcc labelled initializers to set up the array.  Note that
+   some entries might wind up being NULL. */
+
+char *signal_names[NSIG + 2] = {
+  [0]         "EXIT",
+  [SIGHUP]    "SIGHUP",
+  [SIGINT]    "SIGINT",
+  [SIGQUIT]   "SIGQUIT",
+  [SIGILL]    "SIGILL",
+  [SIGCHLD]   "SIGCHLD",
+  [SIGABRT]   "SIGABRT",
+  [SIGPIPE]   "SIGPIPE",
+  [SIGFPE]    "SIGFPE",
+  [SIGKILL]   "SIGKILL",
+  [SIGSTOP]   "SIGSTOP",
+  [SIGSEGV]   "SIGSEGV",
+  [SIGCONT]   "SIGCONT",
+  [SIGTSTP]   "SIGTSTP",
+  [SIGALRM]   "SIGALRM",
+  [SIGTERM]   "SIGTERM",
+  [SIGTTIN]   "SIGTTIN",
+  [SIGTTOU]   "SIGTTOU",
+  [SIGUSR1]   "SIGUSR1",
+  [SIGUSR2]   "SIGUSR2",
+  [SIGWINCH]  "SIGWINCH",
+  [SIGKILLTHR]        "SIGKILLTHR",
+  [NSIG]      "DEBUG",
+  [NSIG + 1]  (char *)0x0,
+};
index 346a310dfafefb87f99eafdd06989f8d55968c76..640390fbf24244009e0698e1c30cae168956e885 100644 (file)
@@ -14,6 +14,7 @@ bash_cv_sys_restartable_syscalls=${bash_cv_sys_restartable_syscalls='no'}
 ac_cv_sizeof_char_p=${ac_cv_sizeof_char_p='4'}
 ac_cv_sizeof_int=${ac_cv_sizeof_int='4'}
 ac_cv_sizeof_long=${ac_cv_sizeof_long='4'}
+ac_cv_sizeof_double=${ac_cv_sizeof_double='8'}
 
 bash_cv_dup2_broken=${bash_cv_dup2_broken='no'}
 bash_cv_pgrp_pipe=${bash_cv_pgrp_pipe='no'}
@@ -36,4 +37,6 @@ bash_cv_func_strcoll_broken=${bash_cv_func_strcoll_broken='no'}
 bash_cv_type_int32_t=${bash_cv_type_int32_t='int'}
 bash_cv_type_u_int32_t=${bash_cv_type_u_int32_t='int'}
 
+ac_cv_type_bits64_t=${ac_cv_type_bits64_t='no'}
+
 # end of cross-build/cygwin32.cache
diff --git a/cross-build/opennt.cache b/cross-build/opennt.cache
new file mode 100644 (file)
index 0000000..dea8aac
--- /dev/null
@@ -0,0 +1,169 @@
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs.  It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already.  You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+ac_cv_c_bigendian=${ac_cv_c_bigendian=no}
+ac_cv_decl_sys_siglist=${ac_cv_decl_sys_siglist=no}
+ac_cv_func___setostype=${ac_cv_func___setostype=no}
+ac_cv_func_alloca_works=${ac_cv_func_alloca_works=yes}
+ac_cv_func_bcopy=${ac_cv_func_bcopy=yes}
+ac_cv_func_bindtextdomain=${ac_cv_func_bindtextdomain=no}
+ac_cv_func_bzero=${ac_cv_func_bzero=yes}
+ac_cv_func_confstr=${ac_cv_func_confstr=yes}
+ac_cv_func_dlclose=${ac_cv_func_dlclose=no}
+ac_cv_func_dlopen=${ac_cv_func_dlopen=no}
+ac_cv_func_dlsym=${ac_cv_func_dlsym=no}
+ac_cv_func_dup2=${ac_cv_func_dup2=yes}
+ac_cv_func_getcwd=${ac_cv_func_getcwd=yes}
+ac_cv_func_getdtablesize=${ac_cv_func_getdtablesize=no}
+ac_cv_func_getgroups=${ac_cv_func_getgroups=yes}
+ac_cv_func_gethostname=${ac_cv_func_gethostname=yes}
+ac_cv_func_getpagesize=${ac_cv_func_getpagesize=yes}
+ac_cv_func_getpeername=${ac_cv_func_getpeername=yes}
+ac_cv_func_getpgrp_void=${ac_cv_func_getpgrp_void=yes}
+ac_cv_func_getrlimit=${ac_cv_func_getrlimit=no}
+ac_cv_func_getrusage=${ac_cv_func_getrusage=no}
+ac_cv_func_gettext=${ac_cv_func_gettext=no}
+ac_cv_func_gettimeofday=${ac_cv_func_gettimeofday=yes}
+ac_cv_func_killpg=${ac_cv_func_killpg=yes}
+ac_cv_func_lstat=${ac_cv_func_lstat=no}
+ac_cv_func_memmove=${ac_cv_func_memmove=yes}
+ac_cv_func_mkfifo=${ac_cv_func_mkfifo=yes}
+ac_cv_func_putenv=${ac_cv_func_putenv=yes}
+ac_cv_func_rename=${ac_cv_func_rename=yes}
+ac_cv_func_sbrk=${ac_cv_func_sbrk=no}
+ac_cv_func_select=${ac_cv_func_select=yes}
+ac_cv_func_setdtablesize=${ac_cv_func_setdtablesize=no}
+ac_cv_func_setenv=${ac_cv_func_setenv=yes}
+ac_cv_func_setlinebuf=${ac_cv_func_setlinebuf=yes}
+ac_cv_func_setlocale=${ac_cv_func_setlocale=yes}
+ac_cv_func_setvbuf_reversed=${ac_cv_func_setvbuf_reversed=no}
+ac_cv_func_siginterrupt=${ac_cv_func_siginterrupt=no}
+ac_cv_func_strcasecmp=${ac_cv_func_strcasecmp=yes}
+ac_cv_func_strchr=${ac_cv_func_strchr=yes}
+ac_cv_func_strcoll_works=${ac_cv_func_strcoll_works=yes}
+ac_cv_func_strerror=${ac_cv_func_strerror=yes}
+ac_cv_func_strtod=${ac_cv_func_strtod=yes}
+ac_cv_func_strtol=${ac_cv_func_strtol=yes}
+ac_cv_func_strtoul=${ac_cv_func_strtoul=yes}
+ac_cv_func_sysconf=${ac_cv_func_sysconf=yes}
+ac_cv_func_tcgetattr=${ac_cv_func_tcgetattr=yes}
+ac_cv_func_tcgetpgrp=${ac_cv_func_tcgetpgrp=yes}
+ac_cv_func_textdomain=${ac_cv_func_textdomain=no}
+ac_cv_func_times=${ac_cv_func_times=yes}
+ac_cv_func_tzset=${ac_cv_func_tzset=yes}
+ac_cv_func_ulimit=${ac_cv_func_ulimit=no}
+ac_cv_func_uname=${ac_cv_func_uname=yes}
+ac_cv_func_vprintf=${ac_cv_func_vprintf=yes}
+ac_cv_func_wait3=${ac_cv_func_wait3=no}
+ac_cv_func_wait3_rusage=${ac_cv_func_wait3_rusage=no}
+ac_cv_func_waitpid=${ac_cv_func_waitpid=yes}
+ac_cv_header_alloca_h=${ac_cv_header_alloca_h=no}
+ac_cv_header_dirent_dirent_h=${ac_cv_header_dirent_dirent_h=yes}
+ac_cv_header_dlfcn_h=${ac_cv_header_dlfcn_h=no}
+ac_cv_header_libintl_h=${ac_cv_header_libintl_h=no}
+ac_cv_header_limits_h=${ac_cv_header_limits_h=yes}
+ac_cv_header_locale_h=${ac_cv_header_locale_h=yes}
+ac_cv_header_memory_h=${ac_cv_header_memory_h=yes}
+ac_cv_header_minix_config_h=${ac_cv_header_minix_config_h=no}
+ac_cv_header_stat_broken=${ac_cv_header_stat_broken=no}
+ac_cv_header_stdarg_h=${ac_cv_header_stdarg_h=yes}
+ac_cv_header_stdc=${ac_cv_header_stdc=yes}
+ac_cv_header_stdlib_h=${ac_cv_header_stdlib_h=yes}
+ac_cv_header_string_h=${ac_cv_header_string_h=yes}
+ac_cv_header_sys_file_h=${ac_cv_header_sys_file_h=yes}
+ac_cv_header_sys_param_h=${ac_cv_header_sys_param_h=yes}
+ac_cv_header_sys_pte_h=${ac_cv_header_sys_pte_h=no}
+ac_cv_header_sys_ptem_h=${ac_cv_header_sys_ptem_h=no}
+ac_cv_header_sys_resource_h=${ac_cv_header_sys_resource_h=no}
+ac_cv_header_sys_select_h=${ac_cv_header_sys_select_h=no}
+ac_cv_header_sys_socket_h=${ac_cv_header_sys_socket_h=yes}
+ac_cv_header_sys_stream_h=${ac_cv_header_sys_stream_h=no}
+ac_cv_header_sys_time_h=${ac_cv_header_sys_time_h=yes}
+ac_cv_header_sys_times_h=${ac_cv_header_sys_times_h=yes}
+ac_cv_header_sys_wait_h=${ac_cv_header_sys_wait_h=yes}
+ac_cv_header_termcap_h=${ac_cv_header_termcap_h=no}
+ac_cv_header_termio_h=${ac_cv_header_termio_h=no}
+ac_cv_header_termios_h=${ac_cv_header_termios_h=yes}
+ac_cv_header_time=${ac_cv_header_time=yes}
+ac_cv_header_unistd_h=${ac_cv_header_unistd_h=yes}
+ac_cv_header_varargs_h=${ac_cv_header_varargs_h=no}
+ac_cv_lib_dir_opendir=${ac_cv_lib_dir_opendir=no}
+ac_cv_lib_dl_dlopen=${ac_cv_lib_dl_dlopen=no}
+ac_cv_lib_intl_bindtextdomain=${ac_cv_lib_intl_bindtextdomain=no}
+ac_cv_lib_termcap_tgetent=${ac_cv_lib_termcap_tgetent=yes}
+ac_cv_path_install=${ac_cv_path_install='//C/OpenNT21b3/bin/install -c'}
+ac_cv_prog_AR=${ac_cv_prog_AR=ar}
+ac_cv_prog_CC=${ac_cv_prog_CC=gcc}
+ac_cv_prog_CPP=${ac_cv_prog_CPP='cc -E'}
+ac_cv_prog_RANLIB=${ac_cv_prog_RANLIB=:}
+ac_cv_prog_cc_cross=${ac_cv_prog_cc_cross=no}
+ac_cv_prog_cc_g=${ac_cv_prog_cc_g=yes}
+ac_cv_prog_cc_works=${ac_cv_prog_cc_works=yes}
+ac_cv_prog_gcc=${ac_cv_prog_gcc=yes}
+ac_cv_prog_gcc_traditional=${ac_cv_prog_gcc_traditional=no}
+ac_cv_prog_make_make_set=${ac_cv_prog_make_make_set=yes}
+ac_cv_sizeof_char_p=${ac_cv_sizeof_char_p=4}
+ac_cv_sizeof_double=${ac_cv_sizeof_double=8}
+ac_cv_sizeof_int=${ac_cv_sizeof_int=4}
+ac_cv_sizeof_long=${ac_cv_sizeof_long=4}
+ac_cv_sys_interpreter=${ac_cv_sys_interpreter=yes}
+ac_cv_sys_restartable_syscalls=${ac_cv_sys_restartable_syscalls=no}
+ac_cv_type_getgroups=${ac_cv_type_getgroups=gid_t}
+ac_cv_type_mode_t=${ac_cv_type_mode_t=yes}
+ac_cv_type_off_t=${ac_cv_type_off_t=yes}
+ac_cv_type_pid_t=${ac_cv_type_pid_t=yes}
+ac_cv_type_signal=${ac_cv_type_signal=void}
+ac_cv_type_size_t=${ac_cv_type_size_t=yes}
+ac_cv_type_time_t=${ac_cv_type_time_t=yes}
+ac_cv_type_uid_t=${ac_cv_type_uid_t=yes}
+bash_cv_can_redecl_getpw=${bash_cv_can_redecl_getpw=yes}
+bash_cv_decl_under_sys_siglist=${bash_cv_decl_under_sys_siglist=no}
+bash_cv_dev_fd=${bash_cv_dev_fd=absent}
+bash_cv_dirent_has_d_fileno=${bash_cv_dirent_has_d_fileno=no}
+bash_cv_dirent_has_dino=${bash_cv_dirent_has_dino=yes}
+bash_cv_dup2_broken=${bash_cv_dup2_broken=no}
+bash_cv_fionread_in_ioctl=${bash_cv_fionread_in_ioctl=yes}
+bash_cv_func_lstat=${bash_cv_func_lstat=no}
+bash_cv_func_sigsetjmp=${bash_cv_func_sigsetjmp=present}
+bash_cv_func_strcoll_broken=${bash_cv_func_strcoll_broken=no}
+bash_cv_getcwd_calls_popen=${bash_cv_getcwd_calls_popen=no}
+bash_cv_getenv_redef=${bash_cv_getenv_redef=yes}
+bash_cv_have_strsignal=${bash_cv_have_strsignal=yes}
+bash_cv_job_control_missing=${bash_cv_job_control_missing=present}
+bash_cv_mail_dir=${bash_cv_mail_dir=/usr/spool/mail}
+bash_cv_must_reinstall_sighandlers=${bash_cv_must_reinstall_sighandlers=no}
+bash_cv_opendir_not_robust=${bash_cv_opendir_not_robust=no}
+bash_cv_pgrp_pipe=${bash_cv_pgrp_pipe=no}
+bash_cv_printf_declared=${bash_cv_printf_declared=yes}
+bash_cv_sbrk_declared=${bash_cv_sbrk_declared=no}
+bash_cv_signal_vintage=${bash_cv_signal_vintage=posix}
+bash_cv_speed_t_in_sys_types=${bash_cv_speed_t_in_sys_types=no}
+bash_cv_struct_timeval=${bash_cv_struct_timeval=yes}
+bash_cv_struct_winsize_header=${bash_cv_struct_winsize_header=ioctl_h}
+bash_cv_struct_winsize_in_ioctl=${bash_cv_struct_winsize_in_ioctl=yes}
+bash_cv_sys_errlist=${bash_cv_sys_errlist=yes}
+bash_cv_sys_named_pipes=${bash_cv_sys_named_pipes=present}
+bash_cv_sys_siglist=${bash_cv_sys_siglist=yes}
+bash_cv_termcap_lib=${bash_cv_termcap_lib=libtermcap}
+bash_cv_termio_ldisc=${bash_cv_termio_ldisc=no}
+bash_cv_termios_ldisc=${bash_cv_termios_ldisc=no}
+bash_cv_tiocgwinsz_in_ioctl=${bash_cv_tiocgwinsz_in_ioctl=yes}
+bash_cv_tiocstat_in_ioctl=${bash_cv_tiocstat_in_ioctl=no}
+bash_cv_type_clock_t=${bash_cv_type_clock_t=yes}
+bash_cv_type_quad_t=${bash_cv_type_quad_t=yes}
+bash_cv_type_rlimit=${bash_cv_type_rlimit=long}
+bash_cv_type_sigset_t=${bash_cv_type_sigset_t=yes}
+bash_cv_ulimit_maxfds=${bash_cv_ulimit_maxfds=no}
+bash_cv_under_sys_siglist=${bash_cv_under_sys_siglist=no}
+bash_cv_void_sighandler=${bash_cv_void_sighandler=yes}
diff --git a/cross-build/x86-beos.cache b/cross-build/x86-beos.cache
new file mode 100644 (file)
index 0000000..351aa21
--- /dev/null
@@ -0,0 +1,45 @@
+# This file is a shell script that caches the results of configure
+# tests for x86 BeOS so they don't need to be done when cross-compiling.
+
+# AC_FUNC_GETPGRP should also define GETPGRP_VOID
+ac_cv_func_getpgrp_void=${ac_cv_func_getpgrp_void='yes'}
+# AC_FUNC_SETVBUF_REVERSED should not define anything else
+ac_cv_func_setvbuf_reversed=${ac_cv_func_setvbuf_reversed='no'}
+# on BeOS, system calls do not restart
+ac_cv_sys_restartable_syscalls=${ac_cv_sys_restartable_syscalls='no'}
+bash_cv_sys_restartable_syscalls=${bash_cv_sys_restartable_syscalls='no'}
+
+ac_cv_func_tcgetattr=${ac_cv_func_tcgetattr='yes'}
+
+# x86 BeOS is little endian
+ac_cv_c_bigendian=${ac_cv_c_bigendian='no'}
+ac_cv_sizeof_char_p=${ac_cv_sizeof_char_p='4'}
+ac_cv_sizeof_int=${ac_cv_sizeof_int='4'}
+ac_cv_sizeof_long=${ac_cv_sizeof_long='4'}
+ac_cv_sizeof_double=${ac_cv_sizeof_double='8'}
+
+bash_cv_dev_fd=${bash_cv_dev_fd='absent'}
+bash_cv_dup2_broken=${bash_cv_dup2_broken='no'}
+bash_cv_pgrp_pipe=${bash_cv_pgrp_pipe='no'}
+bash_cv_type_rlimit=${bash_cv_type_rlimit='long'}
+bash_cv_decl_under_sys_siglist=${bash_cv_decl_under_sys_siglist='no'}
+bash_cv_under_sys_siglist=${bash_cv_under_sys_siglist='no'}
+bash_cv_sys_siglist=${bash_cv_sys_siglist='yes'}
+bash_cv_opendir_not_robust=${bash_cv_opendir_not_robust='no'}
+bash_cv_getenv_redef=${bash_cv_getenv_redef='yes'}
+bash_cv_printf_declared=${bash_cv_printf_declared='yes'}
+bash_cv_ulimit_maxfds=${bash_cv_ulimit_maxfds='no'}
+bash_cv_getcwd_calls_popen=${bash_cv_getcwd_calls_popen='no'}
+bash_cv_must_reinstall_sighandlers=${bash_cv_must_reinstall_sighandlers='no'}
+bash_cv_job_control_missing=${bash_cv_job_control_missing='present'}
+bash_cv_sys_named_pipes=${bash_cv_sys_named_pipes='present'}
+bash_cv_func_sigsetjmp=${bash_cv_func_sigsetjmp='missing'}
+bash_cv_mail_dir=${bash_cv_mail_dir='unknown'}
+bash_cv_func_strcoll_broken=${bash_cv_func_strcoll_broken='no'}
+
+bash_cv_type_int32_t=${bash_cv_type_int32_t='int'}
+bash_cv_type_u_int32_t=${bash_cv_type_u_int32_t='int'}
+
+ac_cv_type_bits64_t=${ac_cv_type_bits64_t='no'}
+
+# end of cross-build/x86-beos.cache
index 4bf2c04295b32a095a7310ee9c64e2c033ae3d6d..10670235ee225afb53bb745069f76a1e3f110221 100644 (file)
@@ -169,7 +169,7 @@ dispose_command (command)
       }
 
     default:
-      programming_error ("dispose_command: bad command type `%d'", command->type);
+      command_error ("dispose_command", CMDERR_BADTYPE, command->type, 0);
       break;
     }
   free (command);
diff --git a/doc/FAQ b/doc/FAQ
index d191cb4e16b738085f5252e26cd1d85a4e853b30..08037d80e933b0a20ce3d6abbf0beb4b0bbde03c 100644 (file)
--- a/doc/FAQ
+++ b/doc/FAQ
@@ -1,4 +1,4 @@
-This is the Bash FAQ, version 2.13, for Bash version 2.02.
+This is the Bash FAQ, version 3.0, for Bash version 2.03.
 
 This document contains a set of frequently-asked questions concerning
 Bash, the GNU Bourne-Again Shell.  Bash is a freely-available command
@@ -20,87 +20,87 @@ Contents:
 
 Section A:  The Basics
 
-1) What is it?
-2) What's the latest version?
-3) Where can I get it?
-4) On what machines will bash run?
-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?
-9) What's the `POSIX 1003.2 standard'?
-10) What is the bash `posix mode'?
+A1) What is it?
+A2) What's the latest version?
+A3) Where can I get it?
+A4) On what machines will bash run?
+A5) Will bash run on operating systems other than Unix?
+A6) How can I build bash with gcc?
+A7) How can I make bash my login shell?
+A8) I just changed my login shell to bash, and now I can't FTP into my
+    machine.  Why not?
+A9) What's the `POSIX 1003.2 standard'?
+A10) What is the bash `posix mode'?
 
 Section B:  The latest version
 
-11) What's new in version 2.02?
-12) Are there any user-visible incompatibilities between bash-2.02 and
+B1) What's new in version 2.03?
+B2) Are there any user-visible incompatibilities between bash-2.03 and
     bash-1.14.7?
 
 Section C:  Differences from other Unix shells
 
-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?
+C1) How does bash differ from sh, the Bourne shell?
+C2) How does bash differ from the Korn shell, version ksh88?
+C3) 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?
 
-16) Why does bash run a different version of `command' than
+D1) Why does bash run a different version of `command' than
     `which command' says it will?
-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
+D2) Why doesn't bash treat brace expansions exactly like csh?
+D3) Why doesn't bash have csh variable modifiers?
+D4) How can I make my csh aliases work when I convert to bash?
+D5) How can I pipe standard output and standard error from one command to
     another, like csh does with `|&'?
-21) Now that I've converted from ksh to bash, are there equivalents to
+D6) 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?
 
-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
+E1) Why is the bash builtin `test' slightly different from /bin/test?
+E2) Why does bash sometimes say `Broken pipe'?
+E3) How can I get bash to read and display eight-bit characters?
+E4) How do I write a function `x' to replace builtin command `x', but
     still invoke the command from within the function?
-26) When I have terminal escape sequences in my prompt, why does bash
+E5) When I have terminal escape sequences in my prompt, why does bash
     wrap lines at the wrong column?
-27) How can I find the value of a shell variable whose name is the value
+E6) How can I find the value of a shell variable whose name is the value
     of another shell variable?
-28) If I pipe the output of a command into `read variable', why doesn't
+E7) 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?
-29) I have a bunch of shell scripts that use backslash-escaped characters
+E8) 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?
-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?
+E9) Why doesn't a while or for loop get suspended when I type ^Z?
+E10) 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
 
-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
+F1) Why can't I use command line editing in my `cmdtool'?
+F2) I built bash on Solaris 2.  Why do globbing expansions and filename
     completion chop off the first few characters of each filename?
-34) Why does bash dump core after I interrupt username completion or
+F3) Why does bash dump core after I interrupt username completion or
     `~user' tilde expansion on a machine running NIS?
-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
+F4) I'm running SVR4.2.  Why is the line erased every time I type `@'?
+F5) 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?
 
-37) How do I report bugs in bash, and where should I look for fixes and
+G1) How do I report bugs in bash, and where should I look for fixes and
     advice?
-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?
+G2) What kind of bash documentation is there?
+G3) What's coming in future versions?
+G4) What's on the bash `wish list'?
+G5) When will the next release appear?
 
 ----------
 Section A:  The Basics
 
-1)  What is it?
+A1)  What is it?
 
 Bash is a Unix command interpreter (shell).  It is an implementation of
 the Posix 1003.2 shell standard, and resembles the Korn and System V
@@ -118,26 +118,26 @@ Bash was originally written by Brian Fox of the Free Software
 Foundation.  The current developer and maintainer is Chet Ramey
 of Case Western Reserve University.
 
-2)  What's the latest version?
+A2)  What's the latest version?
 
-The latest version is 2.02, first made available on Monday, 20 April, 1998.
+The latest version is 2.03, first made available on Friday, 19 Feburary 1999.
 
-3)  Where can I get it?
+A3)  Where can I get it?
 
 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
+master GNU archive site, ftp.gnu.org, and its mirrors.  The
 latest version is also available for FTP from ftp.cwru.edu.
-The following URLs tell how to get version 2.02:
+The following URLs tell how to get version 2.03:
 
-ftp://prep.ai.mit.edu/pub/gnu/bash-2.02.tar.gz
-ftp://ftp.cwru.edu/pub/bash/bash-2.02.tar.gz
+ftp://ftp.gnu.org/pub/gnu/bash-2.03.tar.gz
+ftp://ftp.cwru.edu/pub/bash/bash-2.03.tar.gz
 
 Formatted versions of the documentation are available with the URLs:
 
-ftp://prep.ai.mit.edu/pub/gnu/bash-doc-2.02.tar.gz
-ftp://ftp.cwru.edu/pub/bash/bash-doc-2.02.tar.gz
+ftp://ftp.gnu.org/pub/gnu/bash-doc-2.03.tar.gz
+ftp://ftp.cwru.edu/pub/bash/bash-doc-2.03.tar.gz
 
-4)  On what machines will bash run?
+A4)  On what machines will bash run?
 
 Bash has been ported to nearly every version of UNIX.  All you
 should have to do to build it on a machine for which a port
@@ -147,10 +147,10 @@ itself accordingly, using a script created by GNU autoconf.
 
 More information appears in the file `INSTALL' in the distribution.
 
-5) Will bash run on operating systems other than Unix?
+A5) 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.  Bash-2.02 should 
+LynxOS are included in the distribution.  Bash-2.03 should 
 compile and run on Minix 2.0 (patches were contributed), but I
 don't believe anyone has built bash-2.x on earlier Minix versions
 yet.
@@ -162,12 +162,12 @@ 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, and their port is part of the current
-gnu-win32 release.  Cygnus has also done a port of bash-2.01 to the
-GNU-Win32 environment, and it should be available as part of their next
-release.
+Cygnus originally ported bash-1.14.7, and that port was part of their
+early GNU-Win32 releases.  Cygnus has also done a port of bash-2.01 to the
+GNU-Win32 environment, and it is available as part of their current
+release.  (They may have upgraded by now.)
 
-Bash-2.02 should require no local Cygnus changes to build and run under
+Bash-2.03 should require no local Cygnus changes to build and run under
 GNU-WIN32.
 
 The Cygnus port works only on Intel machines.  There is a port of bash
@@ -175,9 +175,19 @@ The Cygnus port works only on Intel machines.  There is a port of bash
 
 ftp://ftp.gnustep.org//pub/win32/bash-alpha-nt-1.01.tar.gz
 
-Softway Systems has ported bash-2.01.1 to their Interix (nee OpenNT)
+Softway Systems has ported bash-2.01 to their Interix (nee OpenNT)
 system, a Unix subsystem for NT that replaces the Microsoft POSIX
 subsystem.  Check out http://www.interix.com for more information.
+Some support for Interix has been incorporated into bash, beginning
+with Bash-2.03.  It should be easier to build bash on Interix now,
+but Interix users should fetch
+
+ftp://ftp.interix.com/pub/tw/unsup/bash.diffs.tar.gz
+
+and read the README.OpenNT file in that archive.  It will detail the
+arguments configure needs to build on Interix.  A configure cache
+file for Interix is in the bash distribution in cross-build/opennt.cache;
+copy that to `config.cache' before starting configure.
 
 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
@@ -201,12 +211,12 @@ ftp://hobbes.nmsu.edu/pub/os2/util/shell/bash-2.0(253).zip
 I haven't looked at either, but the second appears to be a binary-only
 distribution.  Beware.
 
-6) How can I build bash with gcc? 
+A6) 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.
 
-7)  How can I make bash my login shell?
+A7)  How can I make bash my login shell?
 
 Some machines let you use `chsh' to change your login shell.  Other
 systems use `passwd -s' or `passwd -e'.  If one of these works for
@@ -252,7 +262,7 @@ 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
+A8) 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
@@ -262,7 +272,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. 
 
-9)  What's the `POSIX 1003.2 standard'?
+A9)  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
@@ -297,7 +307,7 @@ line editing.  Only vi-style line editing commands have been
 standardized; emacs editing commands were left out due to
 objections.
 
-10)  What is the bash `posix mode'?
+A10)  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
@@ -314,9 +324,29 @@ Reference Manual.
 
 Section B:  The latest version
 
-11) What's new in version 2.02?
+B1) What's new in version 2.03?
+
+Bash-2.03 has a very few new features, in keeping with the convention
+that odd-numbered releases provide mainly bug fixes.  A number of new
+features were added to Readline, mostly at the request of the Cygnus
+folks.
 
-Bash-2.02 has a number of new features.  Here's a short list:
+a new shopt option, `restricted_shell', so that startup files can test
+       whether or not the shell was started in restricted mode
+filename generation is now performed on the words between ( and ) in
+       compound array assignments (this is really a bug fix)
+OLDPWD is now auto-exported, as POSIX.2 requires
+ENV and BASH_ENV are read-only variables in a restricted shell
+Bash may now be linked against an already-installed Readline library,
+       as long as the Readline library is version 4 or newer
+All shells begun with the `--login' option will source the login shell
+       startup files, even if the shell is not interactive
+
+There are lots of changes to the version of the Readline library released
+along with Bash-2.03.  For a complete list of the changes, read the file
+CHANGES in the Bash-2.03 distribution.
+
+Bash-2.02 contained the following new features:
 
 a new version of malloc (based on the old GNU malloc code in previous
        bash versions) that is more page-oriented, more conservative
@@ -382,15 +412,15 @@ grammar tighter and smaller (66 reduce-reduce conflicts gone)
 lots of code now smaller and faster
 test suite greatly expanded
 
-12) Are there any user-visible incompatibilities between bash-2.02 and
+B2) Are there any user-visible incompatibilities between bash-2.03 and
     bash-1.14.7?
 
-There are a few incompatibilities between version 1.14.7 and version 2.02.
-They are detailed in the file COMPAT in the bash-2.02 distribution.
+There are a few incompatibilities between version 1.14.7 and version 2.03.
+They are detailed in the file COMPAT in the bash-2.03 distribution.
 
 Section C:  Differences from other Unix shells
 
-13) How does bash differ from sh, the Bourne shell?
+C1) 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
@@ -481,11 +511,12 @@ Implementation differences:
        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.
-               On Solaris 2, sh goes into an infinite loop.)
+               On Solaris 2.4 and earlier versions, 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
 
-14)  How does bash differ from the Korn shell, version ksh88?
+C2)  How does bash differ from the Korn shell, version ksh88?
 
 Things bash has or uses that ksh88 does not:
        long invocation options
@@ -541,9 +572,9 @@ Implementation differences:
        bash has exported functions
        bash command search finds functions before builtins
 
-15)  Which new features in ksh-93 are not in bash, and which are?
+C3)  Which new features in ksh-93 are not in bash, and which are?
 
-New things in ksh-93 not in bash-2.02:
+New things in ksh-93 not in bash-2.03:
        associative arrays
        floating point arithmetic
        ++, --, comma arithmetic operators
@@ -564,7 +595,7 @@ New things in ksh-93 not in bash-2.02:
        read -t/-d
        `.' can execute shell functions
 
-New things in ksh-93 present in bash-2.02:
+New things in ksh-93 present in bash-2.03:
        ?: arithmetic operator
        expansions: ${!param}, ${param:offset[:len]}, ${param/pat[/str]}
        compound array assignment
@@ -588,16 +619,37 @@ New things in ksh-93 present in bash-2.02:
 
 Section D:  Why does bash do some things differently than other Unix shells?
 
-16) Why does bash run a different version of `command' than
+D1) 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. 
-It reads the csh startup files from your home directory and uses
-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. 
+On many systems, `which' is actually a csh script that assumes
+you're running csh.  In tcsh, `which' and its cousin `where'
+are builtins.  On other Unix systems, `which' is a perl script
+that uses the PATH environment variable.
+
+The csh script version reads the csh startup files from your
+home directory and uses 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.  The bash `type' builtin does everything
+`which' does, and will report correct results for the running
+shell.  If you're really wedded to the name `which', try adding
+the following function definition to your .bashrc:
+
+       which()
+       {
+               builtin type -p "$@"
+       }
+
+If you're moving from tcsh and would like to bring `where' along
+as well, use this function:
+
+       where()
+       {
+               builtin type -a "$@"
+       }
 
-17) Why doesn't bash treat brace expansions exactly like csh?
+D2) 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
@@ -608,7 +660,7 @@ compatibility.
 
 Bash, ksh, zsh, and pd-ksh all implement brace expansion this way. 
 
-18) Why doesn't bash have csh variable modifiers?
+D3) 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.
@@ -663,7 +715,7 @@ Given
        $b:e                    ${b##*.}           xxx
 
 
-19) How can I make my csh aliases work when I convert to bash?
+D4) 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
@@ -706,7 +758,7 @@ simply `cshtobash' to convert your normal interactive
 environment, or as `cshtobash ~/.login' to convert your login
 environment. 
 
-20) How can I pipe standard output and standard error from one command to
+D5) How can I pipe standard output and standard error from one command to
     another, like csh does with `|&'?
 
 Use
@@ -716,7 +768,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.
 
-21) Now that I've converted from ksh to bash, are there equivalents to
+D6) 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.
@@ -735,7 +787,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?
 
-22) Why is the bash builtin `test' slightly different from /bin/test?
+E1) Why is the bash builtin `test' slightly different from /bin/test?
 
 The specific example used here is [ ! x -o x ], which is false.
 
@@ -764,7 +816,7 @@ of the 3 Arg case.
    
 As you can see, the test becomes (not (x or x)), which is false.
 
-23) Why does bash sometimes say `Broken pipe'?
+E2) 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
@@ -779,7 +831,11 @@ 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. 
 
-24) How can I get bash to read and display eight-bit characters?
+You can build a version of bash that will not report SIGPIPE errors
+by uncommenting the definition of DONT_REPORT_SIGPIPE in the file
+config-top.h.
+
+E3) How can I get bash to read and display eight-bit characters?
 
 This is a process requiring several steps.
 
@@ -813,7 +869,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.
 
-25) How do I write a function `x' to replace builtin command `x', but
+E4) 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
@@ -834,7 +890,7 @@ something like the following:
 This could also be written using `command' instead of `builtin';
 the version above is marginally more efficient. 
 
-26) When I have terminal escape sequences in my prompt, why does bash
+E5) 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
@@ -850,10 +906,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. 
 
-27) How can I find the value of a shell variable whose name is the value
+E6) How can I find the value of a shell variable whose name is the value
     of another shell variable?
 
-Bash-2.02 supports this directly.  You can use 
+Versions of Bash newer than Bash-2.0 support this directly.  You can use 
 
        ${!var}
 
@@ -875,13 +931,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.02,
+before `eval' is executed.  In versions of bash later than bash-2.0,
 
        echo ${!#}
 
 does the same thing.
 
-28) If I pipe the output of a command into `read variable', why doesn't
+E7) 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
@@ -937,7 +993,7 @@ this.
 This is the general approach -- in most cases you will not need to
 set $IFS to a different value.
 
-29) I have a bunch of shell scripts that use backslash-escaped characters
+E8) 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?
 
@@ -957,7 +1013,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.
 
-30) Why doesn't a while or for loop get suspended when I type ^Z?
+E9) 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
@@ -972,8 +1028,8 @@ 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.
 
-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?
+E10) 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
 uses its value as a format string to decide how to display the
@@ -1006,7 +1062,7 @@ The ksh format can be emulated with:
 
 Section F:  Things to watch out for on certain Unix versions
 
-32) Why can't I use command line editing in my `cmdtool'?
+F1) 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
@@ -1034,7 +1090,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.
 
-33) I built bash on Solaris 2.  Why do globbing expansions and filename
+F2) 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
@@ -1054,7 +1110,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.
 
-34) Why does bash dump core after I interrupt username completion or
+F3) 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)
@@ -1077,7 +1133,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.
 
-35) I'm running SVR4.2.  Why is the line erased every time I type `@'?
+F4) 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
@@ -1088,7 +1144,7 @@ change the line kill character to control-u, type
 
 where the `^' and `U' can be two separate characters.
 
-36) Why does bash report syntax errors when my C News scripts use a
+F5) 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
@@ -1100,7 +1156,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.02 distribution is an
+The file CWRU/sh-redir-hack in the bash-2.03 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
@@ -1109,7 +1165,7 @@ number of reduce/reduce conflicts into the shell grammar.
 
 Section G:  Where do I go from here?
 
-37) How do I report bugs in bash, and where should I look for fixes and
+G1) 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
@@ -1117,7 +1173,7 @@ installed at the same time as bash.  It provides a standard
 template for reporting a problem and automatically includes
 information about your configuration and build environment. 
 
-`bashbug' sends its reports to bug-bash@prep.ai.mit.edu, which
+`bashbug' sends its reports to bug-bash@gnu.org, which
 is a large mailing list gatewayed to the usenet newsgroup gnu.bash.bug. 
 
 Bug fixes, answers to questions, and announcements of new releases
@@ -1125,24 +1181,23 @@ are all posted to gnu.bash.bug.  Discussions concerning bash features
 and problems also take place there.
 
 To reach the bash maintainers directly, send mail to
-bash-maintainers@prep.ai.mit.edu.
+bash-maintainers@gnu.org.
 
-38) What kind of bash documentation is there?
+G2) 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:
 
 bash.1         an extensive, thorough Unix-style manual page
 builtins.1     a manual page covering just bash builtin commands
-bashref.texi   a reference manual in GNU info format
-bash.html      an HTML version of the manual page
-bashref.html   an HTML version of the reference manual
+bashref.texi   a reference manual in GNU tex`info format
+bashref.info   an info version of the reference manual
 FAQ            this file
 article.ms     text of an article written for The Linux Journal
 readline.3     a man page describing readline
 
-Postscript files created from the above source are available in
-the documentation distribution.
+Postscript, HTML, and ASCII files created from the above source are
+available in the documentation distribution.
 
 There is additional documentation available for anonymous FTP from host
 ftp.cwru.edu in the `pub/bash' directory.
@@ -1158,14 +1213,14 @@ A second edition of this book is available, published in January, 1998.
 The ISBN number is 1-56592-347-2.  Look for it in the same fine bookstores
 or on the web.
 
-39) What's coming in future versions?
+G3) What's coming in future versions?
 
 These are features I plan to include in a future version of bash.
 
 a bash debugger (a minimally-tested version is included with bash-2.02)
-Programmable completion a la zsh
+Programmable completion a la zsh/tcsh
 
-40) What's on the bash `wish list' for future versions?
+G4) 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.
 
@@ -1177,14 +1232,17 @@ timeouts for the `read' builtin
 the ksh-93 ${!prefix*} and ${!prefix@} operators
 arithmetic ++ and -- prefix and postfix operators
 date-stamped command history
+a way to bind readline editing key sequences to shell commands
+a mechanism to open network connections and assign them to file descriptors
+       using redirection (like ksh /dev/{tcp,udp})
 
-41) When will the next release appear?
+G5) When will the next release appear?
 
-The next version will appear sometime in 1998.  Never make
+The next version will appear sometime in 1999.  Never make
 predictions. 
 
 
-This document is Copyright 1995, 1996, 1998 by Chester Ramey.
+This document is Copyright 1995-1999 by Chester Ramey.
 
 Permission is hereby granted, without written agreement and
 without license or royalty fees, to use, copy, and distribute
index fc6bce6edf9fa16c52f17d1e7f2880efcce8779e..29f208ace0e060e485bc932630069c905ea9b976 100644 (file)
--- a/doc/INTRO
+++ b/doc/INTRO
@@ -134,7 +134,7 @@ have access to all of the shell facilities.
 
 Help
 
-Bash includes a built-in help factility.
+Bash includes a built-in help facility.
 
 Shell Optional Behavior
 
index 62e041d2640ca550deda79363bfaa1293e815919..f0794daa2be6f5a26a51891e2ee40b6931375521 100644 (file)
@@ -1,5 +1,6 @@
 # This Makefile is for the Bash/documentation directory -*- text -*-.
 #
+SHELL = @MAKE_SHELL@
 RM         = rm -f
 
 topdir = @top_srcdir@
@@ -84,11 +85,17 @@ RLUSER      = $(RL_LIBDIR)/doc/rluser.texinfo
 all: ps info dvi text html
 nodvi: ps info text html
 
-ps: bash.ps bashbug.ps readline.ps article.ps builtins.ps
-dvi: bashref.dvi bashref.ps 
-info: bashref.info
-text: bash.0 bashbug.0 builtins.0 readline.0
-html: bashref.html bash.html
+PSFILES = bash.ps bashbug.ps readline.ps article.ps builtins.ps
+DVIFILES = bashref.dvi bashref.ps
+INFOFILES = bashref.info
+MAN0FILES = bash.0 bashbug.0 builtins.0 readline.0
+HTMLFILES = bashref.html bash.html
+
+ps: ${PSFILES}
+dvi: ${DVIFILES}
+info: ${INFOFILES}
+text: ${MAN0FILES}
+html: ${HTMLFILES}
 
 bashref.dvi: $(srcdir)/bashref.texi $(HSUSER) $(RLUSER)
        TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/bashref.texi
@@ -101,7 +108,7 @@ bashref.info: $(srcdir)/bashref.texi $(HSUSER) $(RLUSER)
        $(MAKEINFO) --no-split -I$(TEXINPUTDIR) $(srcdir)/bashref.texi
 
 bashref.html: bashref.texi $(HSUSER) $(RLUSER)
-       $(TEXI2HTML) -I $(TEXINPUTDIR) $(srcdir)/bashref.texi
+       $(TEXI2HTML) -menu -monolithic -I $(TEXINPUTDIR) $(srcdir)/bashref.texi
 
 bash.dvi: bash.texinfo $(HSUSER) $(RLUSER)
        TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2DVI) bash.texinfo
@@ -125,7 +132,9 @@ article.ps: article.ms
 $(MAN2HTML):   ${topdir}/support/man2html.c
        -( cd ${BUILD_DIR}/support ; ${MAKE} ${MFLAGS} man2html)
 
-faq:   faq.news faq.news2 faq.mail faq.version
+CREATED_FAQ = faq.news faq.news2 faq.mail faq.version
+
+faq:   ${CREATED_FAQ}
 
 faq.version:   FAQ.version FAQ
        sh mkfaqvers FAQ.version > $@
@@ -143,15 +152,16 @@ faq.mail: FAQ FAQ.headers.mail faq.version
        cat FAQ.headers.mail faq.version FAQ > $@
 
 clean:
-       $(RM) *.aux *.cp *.fn *.ky *.log *.pg *.toc *.tp *.vr *.cps \
-               *.pgs *.bt *.bts *.rw *.rws *.fns *.kys *.tps *.vrs *.o \
-               core rluser.texinfo hsuser.texinfo
+       $(RM) *.aux *.bak *.cp *.fn *.ky *.log *.pg *.toc *.tp *.vr *.cps \
+               *.pgs *.bt *.bts *.rw *.rws *.fns *.kys *.tps *.vrs *.o
+       ${RM} core *.core
 
 distclean mostlyclean: clean
        $(RM) Makefile
 
 maintainer-clean:      clean
-       $(RM) *.0 *.ps *.dvi *.info *.txt
+       ${RM} ${PSFILES} ${DVIFILES} ${INFOFILES} ${MAN0FILES} ${HTMLFILES}
+       ${RM} ${CREATED_FAQ}
        $(RM) Makefile
 
 installdirs:
@@ -166,7 +176,7 @@ install: info installdirs
 # 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)/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 \
index 932bf7ff87979655c4b98a1d5f4d88d7e0b2cd42..e3a1d248f375983b2023218445378d97a82db240 100644 (file)
@@ -1,11 +1,12 @@
 This directory contains the bash documentation.
 
 FAQ            - a set of frequently-asked questions about Bash with answers
+INTRO          - a short introduction to bash
 article.ms     - an article I wrote about bash for The Linux Journal
 bash.1         - the bash man page
 builtins.1     - a man page that documents the builtins, extracted from bash.1
-features.texi  - the `bash reference manual'
-features.info  - the `bash reference manual' processed by `makeinfo'
+bashref.texi   - the `bash reference manual'
+bashref.info   - the `bash reference manual' processed by `makeinfo'
 readline.3     - the readline man page
 
 The `.ps' files are postscript versions of the above.  The `.html'
index 9e6060772b1d84cda03586de2946bf407228addf..739d34d64879215f2dba7cff3feb8c97787c95cc 100644 (file)
@@ -6,11 +6,11 @@
 .\"    Case Western Reserve University
 .\"    chet@ins.CWRU.Edu
 .\"
-.\"    Last Change: Wed Apr  1 12:16:09 EST 1998
+.\"    Last Change: Wed Jan 20 16:47:14 EST 1999
 .\"
 .\" bash_builtins, strip all but Built-Ins section
 .if \n(zZ=1 .ig zZ
-.TH BASH 1 "1998 Apr 1" GNU
+.TH BASH 1 "1999 Jan 20" GNU
 .\"
 .\" There's some problem with having a `@'
 .\" in a tagged paragraph with the BSD man macros.
@@ -50,8 +50,8 @@ bash \- GNU Bourne-Again SHell
 [options]
 [file]
 .SH COPYRIGHT
-.if n Bash is Copyright (C) 1989, 1991, 1993, 1995, 1996 by the Free Software Foundation, Inc.
-.if t Bash is Copyright \(co 1989, 1991, 1993, 1995, 1996 by the Free Software Foundation, Inc.
+.if n Bash is Copyright (C) 1989-1999 by the Free Software Foundation, Inc.
+.if t Bash is Copyright \(co 1989-1999 by the Free Software Foundation, Inc.
 .SH DESCRIPTION
 .B Bash
 is an \fBsh\fR-compatible command language interpreter that
@@ -260,7 +260,8 @@ section.
 .PP
 When
 .B bash
-is invoked as an interactive login shell, it first reads and
+is invoked as an interactive login shell, or as a non-interactive shell
+with the \fB\-\-login\fP option, 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,
@@ -313,7 +314,8 @@ it tries to mimic the startup behavior of historical versions of
 .B sh
 as closely as possible,
 while conforming to the POSIX standard as well.
-When invoked as an interactive login shell, it first attempts to
+When invoked as an interactive login shell, or a non-interactive
+shell with the \fB\-\-login\fP option, it first attempts to
 read and execute commands from
 .I /etc/profile
 and
@@ -338,7 +340,7 @@ files, the
 option has no effect.
 A non-interactive shell invoked with the name
 .B sh
-does not attempt to read any startup files. 
+does not attempt to read any other startup files. 
 When invoked as
 .BR sh ,
 .B bash
@@ -375,6 +377,14 @@ option may be used to inhibit this behavior, and the
 option may be used to force another file to be read, but
 \fIrshd\fP does not generally invoke the shell with those options
 or allow them to be specified.
+.PP
+If the shell is started with the effective user (group) id not equal to the
+real user (group) id, and the \fB\-p\fP option is not supplied, no startup
+files are read, shell functions are not inherited from the environment,
+the \fBSHELLOPTS\fP variable, if it appears in the environment, is ignored,
+and the effective user id is set to the real user id.
+If the \fB\-p\fP option is supplied at invocation, the startup behavior is
+the same, but the effective user id is not reset.
 .SH DEFINITIONS
 .PP
 The following definitions are used throughout the rest of this
@@ -646,7 +656,7 @@ operators do not execute \fIexpression2\fP if the value of
 \fIexpression1\fP is sufficient to determine the return value of
 the entire conditional expression.
 .TP
-\fBfor\fP \fIname\fP [ \fBin\fP \fIword\fP; ] \fBdo\fP \fIlist\fP ; \fBdone\fP
+\fBfor\fP \fIname\fP [ \fBin\fP \fIword\fP ] ; \fBdo\fP \fIlist\fP ; \fBdone\fP
 The list of words following \fBin\fP is expanded, generating a list
 of items.  The variable \fIname\fP is set to each element of this list
 in turn, and \fIlist\fP is executed each time.  If the \fBin\fP
@@ -659,7 +669,7 @@ The return status is the exit status of the last command that executes.
 If the expansion of the items following \fBin\fP results in an empty
 list, no commands are executed, and the return status is 0.
 .TP
-\fBselect\fP \fIname\fP [ \fBin\fP \fIword\fP; ] \fBdo\fP \fIlist\fP ; \fBdone\fP
+\fBselect\fP \fIname\fP [ \fBin\fP \fIword\fP ] ; \fBdo\fP \fIlist\fP ; \fBdone\fP
 The list of words following \fBin\fP is expanded, generating a list
 of items.  The set of expanded words is printed on the standard
 error, each preceded by a number.  If the \fBin\fP
@@ -2095,9 +2105,9 @@ In the first form, only the first match is replaced.
 The second form causes all matches of \fIpattern\fP to be
 replaced with \fIstring\fP.
 If \fIpattern\fP begins with \fB#\fP, it must match at the beginning
-of \fIstring\fP.
+of the expanded value of \fIparameter\fP.
 If \fIpattern\fP begins with \fB%\fP, it must match at the end
-of \fIstring\fP.
+of the expanded value of \fIparameter\fP.
 If \fIstring\fP is null, matches of \fIpattern\fP are deleted
 and the \fB/\fP following \fIpattern\fP may be omitted.
 If
@@ -2985,6 +2995,9 @@ True if \fIfile\fP exists and is a regular file.
 .B \-g \fIfile\fP
 True if \fIfile\fP exists and is set-group-id.
 .TP
+.B \-h \fIfile\fP
+True if \fIfile\fP exists and is a symbolic link.
+.TP
 .B \-k \fIfile\fP
 True if \fIfile\fP exists and its ``sticky'' bit is set.
 .TP
@@ -4032,6 +4045,12 @@ regardless of what the terminal claims it can support.  The name
 .B meta\-flag
 is a synonym for this variable.
 .TP
+.B isearch\-terminators (``C\-[C\-J'')
+The string of characters that should terminate an incremental
+search without subsequently executing the character as a command.
+If this variable has not been given a value, the characters
+\fIESC\fP and \fIC\-J\fP will terminate an incremental search.
+.TP
 .B keymap (emacs)
 Set the current readline keymap.  The set of valid keymap names is
 \fIemacs, emacs\-standard, emacs\-meta, emacs\-ctlx, vi,
@@ -4159,8 +4178,10 @@ As each character of the search string is typed, readline displays
 the next entry from the history matching the string typed so far.
 An incremental search requires only as many characters as needed to
 find the desired history entry.
-The Escape character is used to terminate an incremental search.
-Control-J will also terminate the search.
+The characters present in the value of the \fIisearch-terminators\fP
+variable are used to terminate an incremental search.
+If that variable has not been assigned a value the Escape and
+Control-J characters will terminate an incremental search.
 Control-G will abort an incremental search and restore the original
 line.
 When the search is terminated, the history entry containing the
@@ -4341,6 +4362,11 @@ then return
 Delete the character behind the cursor.  When given a numeric argument,
 save the deleted text on the kill ring.
 .TP
+.B forward\-backward\-delete\-char
+Delete the character under the cursor, unless the cursor is at the
+end of the line, in which case the character behind the cursor is
+deleted.  By default, this is not bound to a key.
+.TP
 .B quoted\-insert (C\-q, C\-v)
 Add the next character typed to the line verbatim.  This is
 how to insert characters like \fBC\-q\fP, for example.
@@ -4487,6 +4513,13 @@ through the list.
 This command is intended to be bound to \fBTAB\fP, but is unbound
 by default.
 .TP
+.B delete\-char\-or\-list
+Deletes the character under the cursor if not at the beginning or
+end of the line (like \fBdelete-char\fP).
+If at the end of the line, behaves identically to
+\fBpossible-completions\fP.
+This command is unbound by default.
+.TP
 .B complete\-filename (M\-/)
 Attempt filename completion on the text before point.
 .TP
@@ -4588,7 +4621,7 @@ Undo all changes made to this line.  This is like executing the
 .B undo
 command enough times to return the line to its initial state.
 .TP
-.B tilde\-expand (M\-~)
+.B tilde\-expand (M\-&)
 Perform tilde expansion on the current word.
 .TP
 .B set\-mark (C\-@, M\-<space>)
@@ -6210,13 +6243,17 @@ The characters in
 .SM
 .B IFS
 are used to split the line into words.
+The backslash character (\fB\e\fP) may be used to remove any special
+meaning for the next character read and for line continuation.
 Options, if supplied, have the following meanings:
 .RS
 .PD 0
 .TP
 .B \-r
-A backslash-newline pair is not ignored, and
-the backslash is considered to be part of the line.
+Backslash does not act as an escape character.
+The backslash is considered to be part of the line.
+In particular, a backslash-newline pair may not be used as a line
+continuation.
 .TP
 .B \-p
 Display \fIprompt\fP, without a
@@ -6487,11 +6524,16 @@ Turn on
 .I privileged
 mode.  In this mode, the
 .B $ENV
-file is not processed, shell functions are not inherited from the
-environment, and the variable
-The \fBSHELLOPTS\fP variable, if it appears in the environment, is ignored.
-This is enabled automatically on startup if the effective user (group)
-id is not equal to the real user (group) id.
+and
+.B $BASH_ENV
+files are not processed, shell functions are not inherited from the
+environment, and the \fBSHELLOPTS\fP variable, if it appears in the
+environment, is ignored.
+If the shell is started with the effective user (group) id not equal to the
+real user (group) id, and the \fB\-p\fP option is not supplied, these actions
+are taken and the effective user id is set to the real user id.
+If the \fB\-p\fP option is supplied at startup, the effective user id is
+not reset.
 Turning this option off causes the effective user
 and group ids to be set to the real user and group ids.
 .TP 8
@@ -6794,6 +6836,15 @@ being expanded as described in
 .B PROMPTING
 above.  This option is enabled by default.
 .TP 8
+.B restricted_shell
+The shell sets this option if it is started in restricted mode (see
+.SM
+.B "RESTRICTED SHELL"
+below).
+The value may not be changed.
+This is not reset when the startup files are executed, allowing
+the startup files to discover whether or not a shell is restricted.
+.TP 8
 .B shift_verbose
 If set, the
 .B shift
@@ -7232,9 +7283,11 @@ with the exception that the following are disallowed or not performed:
 changing directories with \fBcd\fP
 .IP \(bu
 setting or unsetting the values of
-.B SHELL
+.BR SHELL ,
+.BR PATH ,
+.BR ENV ,
 or
-.B PATH
+.B BASH_ENV
 .IP \(bu
 specifying command names containing
 .B /
@@ -7313,6 +7366,9 @@ The personal initialization file, executed for login shells
 .FN ~/.bashrc
 The individual per-interactive-shell startup file
 .TP
+.FN ~/.bash_logout
+The individual login shell cleanup file, executed when a login shell exits
+.TP
 .FN ~/.inputrc
 Individual \fIreadline\fP initialization file
 .PD
index 39abaf2a84cef95acfef2dbdb94d9efe18083bc8..971e4c4c009fc10674b572ee7e0f9049f5f7473a 100644 (file)
@@ -1,4 +1,4 @@
-.TH BASHBUG 1 "1995 August 10" GNU
+.TH BASHBUG 1 "1998 July 30" GNU
 .SH NAME
 bashbug \- report a bug in bash
 .SH SYNOPSIS
@@ -14,7 +14,7 @@ invokes the editor specified by the environment variable
 on a temporary copy of the bug report format outline. The user must
 fill in the appropriate fields and exit the editor.
 .B bashbug
-then mails the completed report to \fIbug-bash@prep.ai.mit.edu\fP, or
+then mails the completed report to \fIbug-bash@gnu.org\fP, or
 \fIaddress\fP.  If the report cannot be mailed, it is saved in the
 file \fIdead.bashbug\fP in the invoking user's home directory.
 .PP
index 2ba11f05468c8da8080b725bbb30c9925601646b..01450d0869e0b2d2542ce0dfe9d7541a732d230c 100644 (file)
@@ -9,11 +9,11 @@ END-INFO-DIR-ENTRY
 This text is a brief description of the features that are present in
 the Bash shell.
 
-This is Edition 2.2, last updated 1 April 1998,
+This is Edition 2.3, last updated 20 January 1999,
 of `The GNU Bash Reference Manual',
-for `Bash', Version 2.02.
+for `Bash', Version 2.03.
 
-Copyright (C) 1991, 1993, 1996, 1997 Free Software Foundation, Inc.
+Copyright (C) 1991-1999 Free Software Foundation, Inc.
 
 Permission is granted to make and distribute verbatim copies of
 this manual provided the copyright notice and this permission notice
@@ -38,8 +38,8 @@ Bash Features
    This text is a brief description of the features that are present in
 the Bash shell.
 
-   This is Edition 2.2, last updated 1 April 1998, of `The GNU Bash
-Reference Manual', for `Bash', Version 2.02.
+   This is Edition 2.3, last updated 20 January 1999, of `The GNU Bash
+Reference Manual', for `Bash', Version 2.03.
 
    Copyright (C) 1991, 1993, 1996 Free Software Foundation, Inc.
 
@@ -1232,15 +1232,16 @@ parameter that is unset.
      against its value is replaced with STRING.  In the first form,
      only the first match is replaced.  The second form causes all
      matches of PATTERN to be replaced with STRING.  If PATTERN begins
-     with `#', it must match at the beginning of STRING.  If PATTERN
-     begins with `%', it must match at the end of STRING.  If STRING is
-     null, matches of PATTERN are deleted and the `/' following PATTERN
-     may be omitted.  If PARAMETER is `@' or `*', the substitution
-     operation is applied to each positional parameter in turn, and the
-     expansion is the resultant list.  If PARAMETER is an array
-     variable subscripted with `@' or `*', the substitution operation
-     is applied to each member of the array in turn, and the expansion
-     is the resultant list.
+     with `#', it must match at the beginning of the expanded value of
+     PARAMETER.  If PATTERN begins with `%', it must match at the end
+     of the expanded value of PARAMETER.  If STRING is null, matches of
+     PATTERN are deleted and the `/' following PATTERN may be omitted.
+     If PARAMETER is `@' or `*', the substitution operation is applied
+     to each positional parameter in turn, and the expansion is the
+     resultant list.  If PARAMETER is an array variable subscripted
+     with `@' or `*', the substitution operation is applied to each
+     member of the array in turn, and the expansion is the resultant
+     list.
 
 \1f
 File: bashref.info,  Node: Command Substitution,  Next: Arithmetic Expansion,  Prev: Shell Parameter Expansion,  Up: Shell Expansions
@@ -1982,14 +1983,16 @@ standard.
      The return status is zero.
 
 `.'
-          . FILENAME
+          . FILENAME [ARGUMENTS]
      Read and execute commands from the FILENAME argument in the
      current shell context.  If FILENAME does not contain a slash, the
      `$PATH' variable is used to find FILENAME.  The current directory
-     is searched if FILENAME is not found in `$PATH'.  The return
-     status is the exit status of the last command executed, or zero if
-     no commands are executed.  If FILENAME is not found, or cannot be
-     read, the return status is non-zero.
+     is searched if FILENAME is not found in `$PATH'.  If any ARGUMENTS
+     are supplied, they become the positional parameters when FILENAME
+     is executed.  Otherwise the positional parameters are unchanged.
+     The return status is the exit status of the last command executed,
+     or zero if no commands are executed.  If FILENAME is not found, or
+     cannot be read, the return status is non-zero.
 
 `break'
           break [N]
@@ -2762,8 +2765,9 @@ 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 an interactive login shell, it first reads
-and executes commands from the file `/etc/profile', if that file exists.
+   When Bash is invoked as an interactive login shell, or as a
+non-interactive shell with the `--login' option, 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
@@ -2798,16 +2802,17 @@ name.
 behavior of historical versions of `sh' as closely as possible, while
 conforming to the POSIX standard as well.
 
-   When invoked as an interactive login shell, it first attempts to read
-and execute commands from `/etc/profile' and `~/.profile', in that
-order.  The `--noprofile' option may be used to inhibit this behavior.
-When invoked as an interactive shell with the name `sh', Bash looks for
-the variable `ENV', expands its value if it is defined, and uses the
+   When invoked as an interactive login shell, or as a non-interactive
+shell with the `--login' option, it first attempts to read and execute
+commands from `/etc/profile' and `~/.profile', in that order.  The
+`--noprofile' option may be used to inhibit this behavior.  When
+invoked as an interactive shell with the name `sh', Bash looks for the
+variable `ENV', expands its value if it is defined, and uses the
 expanded value as the name of a file to read and execute.  Since a
 shell invoked as `sh' does not attempt to read and execute commands
 from any other startup files, the `--rcfile' option has no effect.  A
 non-interactive shell invoked with the name `sh' does not attempt to
-read any startup files.
+read any other startup files.
 
    When invoked as `sh', Bash enters POSIX mode after the startup files
 are read.
@@ -2827,6 +2832,14 @@ may be used to force another file to be read, but `rshd' does not
 generally invoke the shell with those options or allow them to be
 specified.
 
+   If Bash is started with the effective user (group) id not equal to
+the real user (group) id, and the `-p' option is not supplied, no
+startup files are read, shell functions are not inherited from the
+environment, the `SHELLOPTS' variable, if it appears in the
+environment, is ignored, and the effective user id is set to the real
+user id.  If the `-p' option is supplied at invocation, the startup
+behavior is the same, but the effective user id is not reset.
+
 \1f
 File: bashref.info,  Node: Is This Shell Interactive?,  Next: Bash Builtins,  Prev: Bash Startup Files,  Up: Bash Features
 
@@ -3126,15 +3139,18 @@ been extended in Bash.
      assigned to the last NAME.  If there are fewer words read from the
      standard input than names, the remaining names are assigned empty
      values.  The characters in the value of the `IFS' variable are
-     used to split the line into words.  If no names are supplied, the
+     used to split the line into words.  The backslash character `\'
+     may be used to remove any special meaning for the next character
+     read and for line continuation.  If no names are supplied, the
      line read is assigned to the variable `REPLY'.  The return code is
      zero, unless end-of-file is encountered.  Options, if supplied,
      have the following meanings:
 
     `-r'
-          If this option is given, a backslash-newline pair is not
-          ignored, and the backslash is considered to be part of the
-          line.
+          If this option is given, backslash does not act as an escape
+          character.  The backslash is considered to be part of the
+          line.  In particular, a backslash-newline pair may not be
+          used as a line continuation.
 
     `-p PROMPT'
           Display PROMPT, without a trailing newline, before attempting
@@ -3287,6 +3303,13 @@ been extended in Bash.
           expansion after being expanded (*note Printing a Prompt::.).
           This option is enabled by default.
 
+    `restricted_shell'
+          The shell sets this option if it is started in restricted mode
+          (*note The Restricted Shell::.).  The value may not be
+          changed.  This is not reset when the startup files are
+          executed, allowing the startup files to discover whether or
+          not a shell is restricted.
+
     `shift_verbose'
           If this is set, the `shift' builtin prints an error message
           when the shift count exceeds the number of positional
@@ -3527,11 +3550,14 @@ The Set Builtin
           Turn on privileged mode.  In this mode, the `$BASH_ENV' and
           `$ENV' files are not processed, shell functions are not
           inherited from the environment, and the `SHELLOPTS' variable,
-          if it appears in the environment, is ignored.  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.
+          if it appears in the environment, is ignored.  If the shell
+          is started with the effective user (group) id not equal to the
+          real user (group) id, and the `-p' option is not supplied,
+          these actions are taken and the effective user id is set to
+          the real user id.  If the `-p' option is supplied at startup,
+          the effective user id is not reset.  Turning this option off
+          causes the effective user and group ids to be set to the real
+          user and group ids.
 
     `-t'
           Exit after reading and executing one command.
@@ -3640,6 +3666,9 @@ checked.
 `-g FILE'
      True if FILE exists and its set-group-id bit is set.
 
+`-h FILE'
+     True if FILE exists and is a symbolic link.
+
 `-k FILE'
      True if FILE exists and its "sticky" bit is set.
 
@@ -4450,7 +4479,8 @@ the standard shell.  A restricted shell behaves identically to `bash'
 with the exception that the following are disallowed:
    * Changing directories with the `cd' builtin.
 
-   * Setting or unsetting the values of the `SHELL' or `PATH' variables.
+   * Setting or unsetting the values of the `SHELL', `PATH', `ENV', or
+     `BASH_ENV' variables.
 
    * Specifying command names containing slashes.
 
@@ -5346,18 +5376,19 @@ string.  There are two search modes:  INCREMENTAL and NON-INCREMENTAL.
 search string.  As each character of the search string is typed,
 Readline displays the next entry from the history matching the string
 typed so far.  An incremental search requires only as many characters
-as needed to find the desired history entry.  The <ESC> character is
-used to terminate an incremental search.  <C-j> will also terminate the
-search.  <C-g> will abort an incremental search and restore the
-original line.  When the search is terminated, the history entry
-containing the search string becomes the current line.  To find other
-matching entries in the history list, type <C-s> or <C-r> as
-appropriate.  This will search backward or forward in the history for
-the next entry matching the search string typed so far.  Any other key
-sequence bound to a Readline command will terminate the search and
-execute that command.  For instance, a <RET> will terminate the search
-and accept the line, thereby executing the command from the history
-list.
+as needed to find the desired history entry.  The characters present in
+the value of the ISEARCH-TERMINATORS variable are used to terminate an
+incremental search.  If that variable has not been assigned a value,
+the <ESC> and <C-J> characters will terminate an incremental search.
+<C-g> will abort an incremental search and restore the original line.
+When the search is terminated, the history entry containing the search
+string becomes the current line.  To find other matching entries in the
+history list, type <C-s> or <C-r> as appropriate.  This will search
+backward or forward in the history for the next entry matching the
+search string typed so far.  Any other key sequence bound to a Readline
+command will terminate the search and execute that command.  For
+instance, a <RET> will terminate the search and accept the line,
+thereby executing the command from the history list.
 
    Non-incremental searches read the entire search string before
 starting to search for matching history lines.  The search string may be
@@ -5471,6 +5502,20 @@ Variable Settings
           longer than the width of the screen, instead of wrapping onto
           a new screen line.  By default, this variable is set to `off'.
 
+    `input-meta'
+          If set to `on', Readline will enable eight-bit input (it will
+          not strip the eighth bit from the characters it reads),
+          regardless of what the terminal claims it can support.  The
+          default value is `off'.  The name `meta-flag' is a synonym
+          for this variable.
+
+    `isearch-terminators'
+          The string of characters that should terminate an incremental
+          search without subsequently executing the character as a
+          command (*note Searching::.).  If this variable has not been
+          given a value, the characters <ESC> and <C-J> will terminate
+          an incremental search.
+
     `keymap'
           Sets Readline's idea of the current keymap for key binding
           commands.  Acceptable `keymap' names are `emacs',
@@ -5489,13 +5534,6 @@ Variable Settings
           asterisk (`*') at the start of history lines which have been
           modified.  This variable is `off' by default.
 
-    `input-meta'
-          If set to `on', Readline will enable eight-bit input (it will
-          not strip the eighth bit from the characters it reads),
-          regardless of what the terminal claims it can support.  The
-          default value is `off'.  The name `meta-flag' is a synonym
-          for this variable.
-
     `output-meta'
           If set to `on', Readline will display characters with the
           eighth bit set directly rather than as a meta-prefixed escape
@@ -5929,6 +5967,11 @@ Commands For Changing Text
      Delete the character behind the cursor.  A numeric argument means
      to kill the characters instead of deleting them.
 
+`forward-backward-delete-char ()'
+     Delete the character under the cursor, unless the cursor is at the
+     end of the line, in which case the character behind the cursor is
+     deleted.  By default, this is not bound to a key.
+
 `quoted-insert (C-q, C-v)'
      Add the next character typed to the line verbatim.  This is how to
      insert key sequences like <C-q>, for example.
@@ -6083,6 +6126,12 @@ Letting Readline Type For You
      This command is intended to be bound to `TAB', but is unbound by
      default.
 
+`delete-char-or-list ()'
+     Deletes the character under the cursor if not at the beginning or
+     end of the line (like `delete-char').  If at the end of the line,
+     behaves identically to `possible-completions'.  This command is
+     unbound by default.
+
 `complete-filename (M-/)'
      Attempt filename completion on the text before point.
 
@@ -6180,7 +6229,7 @@ Some Miscellaneous Commands
      Undo all changes made to this line.  This is like executing the
      `undo' command enough times to get back to the beginning.
 
-`tilde-expand (M-~)'
+`tilde-expand (M-&)'
      Perform tilde expansion on the current word.
 
 `set-mark (C-@)'
@@ -6562,6 +6611,11 @@ that the Bash `configure' recognizes.
      for which this should be turned off, and `configure' disables this
      option automatically for a number of systems.
 
+`--with-installed-readline'
+     Define this to make bash link with a locally-installed version of
+     Readline rather than the version in lib/readline.  This works only
+     with readline 4.0 and later versions.
+
 `--with-purify'
      Define this to use the Purify memory allocation checker from Pure
      Software.
@@ -6857,6 +6911,7 @@ Parameter and Variable Index
 * IGNOREEOF:                             Bash Variables.
 * input-meta:                            Readline Init File Syntax.
 * INPUTRC:                               Bash Variables.
+* isearch-terminators:                   Readline Init File Syntax.
 * keymap:                                Readline Init File Syntax.
 * LANG:                                  Bash Variables.
 * LC_ALL:                                Bash Variables.
@@ -6923,6 +6978,7 @@ Function Index
 * copy-forward-word ():                  Commands For Killing.
 * copy-region-as-kill ():                Commands For Killing.
 * delete-char (C-d):                     Commands For Text.
+* delete-char-or-list ():                Commands For Completion.
 * delete-horizontal-space ():            Commands For Killing.
 * digit-argument (M-0, M-1, ... M--):    Numeric Arguments.
 * do-uppercase-version (M-a, M-b, M-X, ...): Miscellaneous Commands.
@@ -6934,6 +6990,7 @@ Function Index
 * end-of-history (M->):                  Commands For History.
 * end-of-line (C-e):                     Commands For Moving.
 * exchange-point-and-mark (C-x C-x):     Miscellaneous Commands.
+* forward-backward-delete-char ():       Commands For Text.
 * forward-char (C-f):                    Commands For Moving.
 * forward-search-history (C-s):          Commands For History.
 * forward-word (M-f):                    Commands For Moving.
@@ -6960,7 +7017,6 @@ Function Index
 * self-insert (a, b, A, 1, !, ...):      Commands For Text.
 * set-mark (C-@):                        Miscellaneous Commands.
 * start-kbd-macro (C-x ():               Keyboard Macros.
-* tilde-expand (M-~):                    Miscellaneous Commands.
 * transpose-chars (C-t):                 Commands For Text.
 * transpose-words (M-t):                 Commands For Text.
 * undo (C-_, C-x C-u):                   Miscellaneous Commands.
@@ -7092,120 +7148,120 @@ Concept Index
 
 \1f
 Tag Table:
-Node: Top\7f1197
-Node: Introduction\7f3153
-Node: What is Bash?\7f3378
-Node: What is a shell?\7f4472
-Node: Definitions\7f6494
-Node: Basic Shell Features\7f9155
-Node: Shell Syntax\7f10378
-Node: Shell Operation\7f10667
-Node: Quoting\7f11961
-Node: Escape Character\7f12986
-Node: Single Quotes\7f13458
-Node: Double Quotes\7f13787
-Node: ANSI-C Quoting\7f14685
-Node: Locale Translation\7f15554
-Node: Comments\7f15975
-Node: Shell Commands\7f16589
-Node: Simple Commands\7f17100
-Node: Pipelines\7f17659
-Node: Lists\7f19186
-Node: Looping Constructs\7f20641
-Node: Conditional Constructs\7f22246
-Node: Command Grouping\7f28184
-Node: Shell Functions\7f29561
-Node: Shell Parameters\7f31525
-Node: Positional Parameters\7f32851
-Node: Special Parameters\7f33600
-Node: Shell Expansions\7f36221
-Node: Brace Expansion\7f38144
-Node: Tilde Expansion\7f39705
-Node: Shell Parameter Expansion\7f42037
-Node: Command Substitution\7f48379
-Node: Arithmetic Expansion\7f49653
-Node: Process Substitution\7f50498
-Node: Word Splitting\7f51392
-Node: Filename Expansion\7f52844
-Node: Pattern Matching\7f54808
-Node: Quote Removal\7f57197
-Node: Redirections\7f57483
-Node: Executing Commands\7f63553
-Node: Simple Command Expansion\7f64220
-Node: Command Search and Execution\7f66143
-Node: Command Execution Environment\7f68146
-Node: Environment\7f70600
-Node: Exit Status\7f72257
-Node: Signals\7f73454
-Node: Shell Scripts\7f75349
-Node: Bourne Shell Features\7f77385
-Node: Bourne Shell Builtins\7f78115
-Node: Bourne Shell Variables\7f92056
-Node: Other Bourne Shell Features\7f93761
-Node: Major Differences From The Bourne Shell\7f94504
-Node: Bash Features\7f106693
-Node: Invoking Bash\7f107796
-Node: Bash Startup Files\7f111981
-Node: Is This Shell Interactive?\7f115540
-Node: Bash Builtins\7f116511
-Node: The Set Builtin\7f137351
-Node: Bash Conditional Expressions\7f143960
-Node: Bash Variables\7f147033
-Node: Shell Arithmetic\7f159463
-Node: Aliases\7f161511
-Node: Alias Builtins\7f164086
-Node: Arrays\7f164702
-Node: The Directory Stack\7f167723
-Node: Printing a Prompt\7f171073
-Node: The Restricted Shell\7f172736
-Node: Bash POSIX Mode\7f174072
-Node: Job Control\7f178233
-Node: Job Control Basics\7f178699
-Node: Job Control Builtins\7f182898
-Node: Job Control Variables\7f187190
-Node: Using History Interactively\7f188340
-Node: Bash History Facilities\7f189019
-Node: Bash History Builtins\7f191360
-Node: History Interaction\7f194728
-Node: Event Designators\7f197280
-Node: Word Designators\7f198207
-Node: Modifiers\7f199456
-Node: Command Line Editing\7f200773
-Node: Introduction and Notation\7f201433
-Node: Readline Interaction\7f202471
-Node: Readline Bare Essentials\7f203663
-Node: Readline Movement Commands\7f205203
-Node: Readline Killing Commands\7f206168
-Node: Readline Arguments\7f207883
-Node: Searching\7f208857
-Node: Readline Init File\7f210475
-Node: Readline Init File Syntax\7f211514
-Node: Conditional Init Constructs\7f220379
-Node: Sample Init File\7f222817
-Node: Bindable Readline Commands\7f225986
-Node: Commands For Moving\7f226736
-Node: Commands For History\7f227583
-Node: Commands For Text\7f230412
-Node: Commands For Killing\7f232146
-Node: Numeric Arguments\7f234295
-Node: Commands For Completion\7f235421
-Node: Keyboard Macros\7f238991
-Node: Miscellaneous Commands\7f239549
-Node: Readline vi Mode\7f243869
-Node: Installing Bash\7f244747
-Node: Basic Installation\7f245824
-Node: Compilers and Options\7f248734
-Node: Compiling For Multiple Architectures\7f249468
-Node: Installation Names\7f251125
-Node: Specifying the System Type\7f251850
-Node: Sharing Defaults\7f252554
-Node: Operation Controls\7f253219
-Node: Optional Features\7f254124
-Node: Reporting Bugs\7f260319
-Node: Builtin Index\7f261390
-Node: Reserved Word Index\7f264793
-Node: Variable Index\7f266251
-Node: Function Index\7f271456
-Node: Concept Index\7f275885
+Node: Top\7f1187
+Node: Introduction\7f3146
+Node: What is Bash?\7f3371
+Node: What is a shell?\7f4465
+Node: Definitions\7f6487
+Node: Basic Shell Features\7f9148
+Node: Shell Syntax\7f10371
+Node: Shell Operation\7f10660
+Node: Quoting\7f11954
+Node: Escape Character\7f12979
+Node: Single Quotes\7f13451
+Node: Double Quotes\7f13780
+Node: ANSI-C Quoting\7f14678
+Node: Locale Translation\7f15547
+Node: Comments\7f15968
+Node: Shell Commands\7f16582
+Node: Simple Commands\7f17093
+Node: Pipelines\7f17652
+Node: Lists\7f19179
+Node: Looping Constructs\7f20634
+Node: Conditional Constructs\7f22239
+Node: Command Grouping\7f28177
+Node: Shell Functions\7f29554
+Node: Shell Parameters\7f31518
+Node: Positional Parameters\7f32844
+Node: Special Parameters\7f33593
+Node: Shell Expansions\7f36214
+Node: Brace Expansion\7f38137
+Node: Tilde Expansion\7f39698
+Node: Shell Parameter Expansion\7f42030
+Node: Command Substitution\7f48426
+Node: Arithmetic Expansion\7f49700
+Node: Process Substitution\7f50545
+Node: Word Splitting\7f51439
+Node: Filename Expansion\7f52891
+Node: Pattern Matching\7f54855
+Node: Quote Removal\7f57244
+Node: Redirections\7f57530
+Node: Executing Commands\7f63600
+Node: Simple Command Expansion\7f64267
+Node: Command Search and Execution\7f66190
+Node: Command Execution Environment\7f68193
+Node: Environment\7f70647
+Node: Exit Status\7f72304
+Node: Signals\7f73501
+Node: Shell Scripts\7f75396
+Node: Bourne Shell Features\7f77432
+Node: Bourne Shell Builtins\7f78162
+Node: Bourne Shell Variables\7f92273
+Node: Other Bourne Shell Features\7f93978
+Node: Major Differences From The Bourne Shell\7f94721
+Node: Bash Features\7f106910
+Node: Invoking Bash\7f108013
+Node: Bash Startup Files\7f112198
+Node: Is This Shell Interactive?\7f116342
+Node: Bash Builtins\7f117313
+Node: The Set Builtin\7f138717
+Node: Bash Conditional Expressions\7f145533
+Node: Bash Variables\7f148666
+Node: Shell Arithmetic\7f161096
+Node: Aliases\7f163144
+Node: Alias Builtins\7f165719
+Node: Arrays\7f166335
+Node: The Directory Stack\7f169356
+Node: Printing a Prompt\7f172706
+Node: The Restricted Shell\7f174369
+Node: Bash POSIX Mode\7f175730
+Node: Job Control\7f179891
+Node: Job Control Basics\7f180357
+Node: Job Control Builtins\7f184556
+Node: Job Control Variables\7f188848
+Node: Using History Interactively\7f189998
+Node: Bash History Facilities\7f190677
+Node: Bash History Builtins\7f193018
+Node: History Interaction\7f196386
+Node: Event Designators\7f198938
+Node: Word Designators\7f199865
+Node: Modifiers\7f201114
+Node: Command Line Editing\7f202431
+Node: Introduction and Notation\7f203091
+Node: Readline Interaction\7f204129
+Node: Readline Bare Essentials\7f205321
+Node: Readline Movement Commands\7f206861
+Node: Readline Killing Commands\7f207826
+Node: Readline Arguments\7f209541
+Node: Searching\7f210515
+Node: Readline Init File\7f212263
+Node: Readline Init File Syntax\7f213302
+Node: Conditional Init Constructs\7f222508
+Node: Sample Init File\7f224946
+Node: Bindable Readline Commands\7f228115
+Node: Commands For Moving\7f228865
+Node: Commands For History\7f229712
+Node: Commands For Text\7f232541
+Node: Commands For Killing\7f234508
+Node: Numeric Arguments\7f236657
+Node: Commands For Completion\7f237783
+Node: Keyboard Macros\7f241615
+Node: Miscellaneous Commands\7f242173
+Node: Readline vi Mode\7f246493
+Node: Installing Bash\7f247371
+Node: Basic Installation\7f248448
+Node: Compilers and Options\7f251358
+Node: Compiling For Multiple Architectures\7f252092
+Node: Installation Names\7f253749
+Node: Specifying the System Type\7f254474
+Node: Sharing Defaults\7f255178
+Node: Operation Controls\7f255843
+Node: Optional Features\7f256748
+Node: Reporting Bugs\7f263158
+Node: Builtin Index\7f264229
+Node: Reserved Word Index\7f267632
+Node: Variable Index\7f269090
+Node: Function Index\7f274363
+Node: Concept Index\7f278853
 \1f
 End Tag Table
index 854090eca132dfc62ffd3a1d747934db18d94b24..4274005b86f622a565f193b241aedd940f3d77ff 100644 (file)
@@ -5,13 +5,13 @@
 @c %**end of header
 
 @ignore
-last change: Wed Mar 25 11:36:48 EST 1998
+Last Change: Wed Jan 20 16:46:26 EST 1999
 @end ignore
 
-@set EDITION 2.2
-@set VERSION 2.02
-@set UPDATED 1 April 1998
-@set UPDATE-MONTH April 1998
+@set EDITION 2.3
+@set VERSION 2.03
+@set UPDATED 20 January 1999
+@set UPDATE-MONTH January 1999
 
 @iftex
 @finalout
@@ -36,7 +36,7 @@ This is Edition @value{EDITION}, last updated @value{UPDATED},
 of @cite{The GNU Bash Reference Manual},
 for @code{Bash}, Version @value{VERSION}.
 
-Copyright (C) 1991, 1993, 1996, 1997 Free Software Foundation, Inc.
+Copyright (C) 1991-1999 Free Software Foundation, Inc.
 
 Permission is granted to make and distribute verbatim copies of
 this manual provided the copyright notice and this permission notice
@@ -64,13 +64,13 @@ by the Free Software Foundation.
 @titlepage
 @title Bash Reference Manual
 @subtitle Reference Documentation for Bash
-@subtitle Edition @value{EDITION}, for @code{bash} Version @value{VERSION}.
-@subtitle @value{UPDATED}
+@subtitle Edition @value{EDITION}, for @code{Bash} Version @value{VERSION}.
+@subtitle @value{UPDATE-MONTH}
 @author Chet Ramey, Case Western Reserve University
 @author Brian Fox, Free Software Foundation
 @page
 @vskip 0pt plus 1filll
-Copyright @copyright{} 1991, 1993, 1996 Free Software Foundation, Inc.
+Copyright @copyright{} 1991-1999 Free Software Foundation, Inc.
 
 Permission is granted to make and distribute verbatim copies of
 this manual provided the copyright notice and this permission notice
@@ -1428,9 +1428,9 @@ In the first form, only the first match is replaced.
 The second form causes all matches of @var{pattern} to be
 replaced with @var{string}.
 If @var{pattern} begins with @samp{#}, it must match at the beginning
-of @var{string}.
+of the expanded value of @var{parameter}.
 If @var{pattern} begins with @samp{%}, it must match at the end
-of @var{string}.
+of the expanded value of @var{parameter}.
 If @var{string} is null, matches of @var{pattern} are deleted
 and the @code{/} following @var{pattern} may be omitted.
 If @var{parameter} is @samp{@@} or @samp{*},
@@ -2285,13 +2285,16 @@ The return status is zero.
 @item .
 @btindex .
 @example
-. @var{filename}
+. @var{filename} [@var{arguments}]
 @end example
 Read and execute commands from the @var{filename} argument in the
 current shell context.  If @var{filename} does not contain a slash,
 the @code{$PATH} variable is used to find
 @var{filename}.  The current directory is searched if @var{filename}
 is not found in @code{$PATH}.
+If any @var{arguments} are supplied, they become the positional
+parameters when @var{filename} is executed.  Otherwise the positional
+parameters are unchanged.
 The return status is the exit status of the last command executed, or
 zero if no commands are executed.  If @var{filename} is not found, or
 cannot be read, the return status is non-zero.
@@ -3245,7 +3248,8 @@ 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 an interactive login shell, it first reads and
+When Bash is invoked as an interactive login shell, or as a
+non-interactive shell with the @samp{--login} option, 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
@@ -3285,7 +3289,8 @@ If Bash is invoked with the name @code{sh}, it tries to mimic the
 startup behavior of historical versions of @code{sh} as closely as
 possible, while conforming to the @sc{POSIX} standard as well.
 
-When invoked as an interactive login shell, it first attempts to read
+When invoked as an interactive login shell, or as a non-interactive
+shell with the @samp{--login} option, it first attempts to read
 and execute commands from @file{/etc/profile} and @file{~/.profile}, in
 that order.
 The @samp{--noprofile} option may be used to inhibit this behavior.
@@ -3296,7 +3301,7 @@ Since a shell invoked as @code{sh} does not attempt to read and execute
 commands from any other startup files, the @samp{--rcfile} option has
 no effect.
 A non-interactive shell invoked with the name @code{sh} does not attempt
-to read any startup files.
+to read any other startup files.
 
 When invoked as @code{sh}, Bash enters @sc{POSIX} mode after
 the startup files are read.
@@ -3319,6 +3324,14 @@ The @samp{--norc} option may be used to inhibit this behavior, and the
 @code{rshd} does not generally invoke the shell with those options or
 allow them to be specified.
 
+If Bash is started with the effective user (group) id not equal to the
+real user (group) id, and the @code{-p} option is not supplied, no startup
+files are read, shell functions are not inherited from the environment,
+the @code{SHELLOPTS} variable, if it appears in the environment, is ignored,
+and the effective user id is set to the real user id.
+If the @code{-p} option is supplied at invocation, the startup behavior is
+the same, but the effective user id is not reset.
+
 @node Is This Shell Interactive?
 @section Is This Shell Interactive?
 @cindex interactive shell
@@ -3676,6 +3689,8 @@ If there are fewer words read from the standard input than names,
 the remaining names are assigned empty values.
 The characters in the value of the @code{IFS} variable
 are used to split the line into words.
+The backslash character @samp{\} may be used to remove any special
+meaning for the next character read and for line continuation.
 If no names are supplied, the line read is assigned to the
 variable @code{REPLY}.
 The return code is zero, unless end-of-file is encountered.
@@ -3683,8 +3698,10 @@ Options, if supplied, have the following meanings:
 
 @table @code
 @item -r
-If this option is given, a backslash-newline pair is not ignored, and
-the backslash is considered to be part of the line.
+If this option is given, backslash does not act as an escape
+character.  The backslash is considered to be part of the line.
+In particular, a backslash-newline pair may not be used as a line
+continuation.
 
 @item -p @var{prompt}
 Display @var{prompt}, without a
@@ -3853,6 +3870,13 @@ If set, prompt strings undergo variable and parameter expansion after
 being expanded (@pxref{Printing a Prompt}).
 This option is enabled by default.
 
+@item restricted_shell
+The shell sets this option if it is started in restricted mode
+(@pxref{The Restricted Shell}).
+The value may not be changed.
+This is not reset when the startup files are executed, allowing
+the startup files to discover whether or not a shell is restricted.
+
 @item shift_verbose
 If this is set, the @code{shift}
 builtin prints an error message when the shift count exceeds the
@@ -4120,9 +4144,12 @@ In this mode, the @code{$BASH_ENV} and @code{$ENV} files are not
 processed, shell functions are not inherited from the environment,
 and the @code{SHELLOPTS} variable, if it appears in the environment,
 is ignored.
-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
+If the shell is started with the effective user (group) id not equal to the
+real user (group) id, and the @code{-p} option is not supplied, these actions
+are taken and the effective user id is set to the real user id.
+If the @code{-p} option is supplied at startup, the effective user id is
+not reset.
+Turning this option off causes the effective user
 and group ids to be set to the real user and group ids.
 
 @item -t
@@ -4235,6 +4262,9 @@ True if @var{file} exists and is a regular file.
 @item -g @var{file}
 True if @var{file} exists and its set-group-id bit is set.
 
+@item -h @var{file}
+True if @var{file} exists and is a symbolic link.
+
 @item -k @var{file}
 True if @var{file} exists and its "sticky" bit is set.
 
@@ -5101,8 +5131,8 @@ with the exception that the following are disallowed:
 @item
 Changing directories with the @code{cd} builtin.
 @item
-Setting or unsetting the values of the @code{SHELL} or @code{PATH}
-variables.
+Setting or unsetting the values of the @code{SHELL}, @code{PATH},
+@code{ENV}, or @code{BASH_ENV} variables.
 @item
 Specifying command names containing slashes.
 @item
@@ -5815,6 +5845,11 @@ The @file{NOTES} file contains a list of systems for
 which this should be turned off, and @code{configure} disables this
 option automatically for a number of systems.
 
+@item --with-installed-readline
+Define this to make bash link with a locally-installed version of Readline
+rather than the version in lib/readline.  This works only with readline 4.0
+and later versions.
+
 @item --with-purify
 Define this to use the Purify memory allocation checker from Pure
 Software.
index bb9f759025875ab62c1b7c6bcbaeccb09fde2eea..6b36f2f5695c432396fe76c82f3815a6d5704119 100644 (file)
@@ -6,9 +6,9 @@
 .\"    Case Western Reserve University
 .\"    chet@ins.CWRU.Edu
 .\"
-.\"    Last Change: Thu Feb 19 10:26:47 EST 1998
+.\"    Last Change: Thu Dec 31 10:16:30 EST 1998
 .\"
-.TH READLINE 3 "1998 Feb 19" GNU
+.TH READLINE 3 "1998 Dec 31" GNU
 .\"
 .\" File Name macro.  This used to be `.PN', for Path Name,
 .\" but Sun doesn't seem to like that very much.
@@ -22,6 +22,7 @@ readline \- get a line from a user with editing
 .LP
 .nf
 .ft B
+#include <stdio.h>
 #include <readline.h>
 #include <history.h>
 .ft
@@ -380,6 +381,19 @@ When set to \fBOn\fP, makes readline use a single line for display,
 scrolling the input horizontally on a single screen line when it
 becomes longer than the screen width rather than wrapping to a new line.
 .TP
+.B input\-meta (Off)
+If set to \fBOn\fP, readline will enable eight-bit input (that is,
+it will not strip the high bit from the characters it reads),
+regardless of what the terminal claims it can support.  The name
+.B meta\-flag
+is a synonym for this variable.
+.TP
+.B isearch\-terminators (``C\-[C\-J'')
+The string of characters that should terminate an incremental
+search without subsequently executing the character as a command.
+If this variable has not been given a value, the characters
+\fIESC\fP and \fIC\-J\fP will terminate an incremental search.
+.TP
 .B keymap (emacs)
 Set the current readline keymap.  The set of legal keymap names is
 \fIemacs, emacs-standard, emacs-meta, emacs-ctlx, vi, vi-move,
@@ -400,11 +414,6 @@ appended.
 If set to \fBOn\fP, history lines that have been modified are displayed
 with a preceding asterisk (\fB*\fP).
 .TP
-.B meta\-flag (Off)
-If set to \fBOn\fP, readline will enable eight-bit input (that is,
-it will not strip the high bit from the characters it reads),
-regardless of what the terminal claims it can support.
-.TP
 .B output\-meta (Off)
 If set to \fBOn\fP, readline will display characters with the
 eighth bit set directly rather than as a meta-prefixed escape
@@ -509,8 +518,10 @@ As each character of the search string is typed, readline displays
 the next entry from the history matching the string typed so far.
 An incremental search requires only as many characters as needed to
 find the desired history entry.
-The Escape character is used to terminate an incremental search.
-Control-J will also terminate the search.
+The characters present in the value of the \fIisearch-terminators\fP
+variable are used to terminate an incremental search.
+If that variable has not been assigned a value the Escape and
+Control-J characters will terminate an incremental search.
 Control-G will abort an incremental search and restore the original
 line.
 When the search is terminated, the history entry containing the
@@ -647,6 +658,11 @@ the last character typed was not bound to \fBBdelete\-char\fP, then return
 Delete the character behind the cursor.  When given a numeric argument,
 save the deleted text on the kill ring.
 .TP
+.B forward\-backward\-delete\-char   
+Delete the character under the cursor, unless the cursor is at the
+end of the line, in which case the character behind the cursor is
+deleted.  By default, this is not bound to a key.
+.TP
 .B quoted\-insert (C\-q, C\-v)
 Add the next character that you type to the line verbatim.  This is
 how to insert characters like \fBC\-q\fP, for example.
@@ -798,6 +814,13 @@ of matches; a negative argument may be used to move backward
 through the list.
 This command is intended to be bound to \fBTAB\fP, but is unbound
 by default.
+.TP
+.B delete\-char\-or\-list
+Deletes the character under the cursor if not at the beginning or
+end of the line (like \fBdelete-char\fP).
+If at the end of the line, behaves identically to
+\fBpossible-completions\fP.
+This command is unbound by default.
 .PD
 .SS Keyboard Macros
 .PP
@@ -847,7 +870,7 @@ Undo all changes made to this line.  This is like executing the
 .B undo
 command enough times to return the line to its initial state.
 .TP
-.B tilde\-expand (M\-~)
+.B tilde\-expand (M\-&)
 Perform tilde expansion on the current word.
 .TP
 .B set\-mark (C\-@, M-<space>)
diff --git a/error.c b/error.c
index 816546fce9f3232e1c36f6a27d5174161e0e08b1..0652efe83bfc5faa077f8e455387d3782f8edea0 100644 (file)
--- a/error.c
+++ b/error.c
@@ -496,3 +496,32 @@ trace (format, va_alist)
 #endif /* 0 */
 
 #endif /* USE_VARARGS */
+
+static char *cmd_error_table[] = {
+       "unknown command error",        /* CMDERR_DEFAULT */
+       "bad command type",             /* CMDERR_BADTYPE */
+       "bad connector",                /* CMDERR_BADCONN */
+       "bad jump",                     /* CMDERR_BADJUMP */
+       0
+};
+
+void
+command_error (func, code, e, flags)
+     const char *func;
+     int code, e, flags;       /* flags currently unused */
+{
+  if (code > CMDERR_LAST)
+    code = CMDERR_DEFAULT;
+
+  programming_error ("%s: %s: %d", func, cmd_error_table[code], e);
+}
+
+char *
+command_errstr (code)
+     int code;
+{
+  if (code > CMDERR_LAST)
+    code = CMDERR_DEFAULT;
+
+  return (cmd_error_table[code]);
+}
diff --git a/error.h b/error.h
index 8af7005f03e8eec8476f402109fea445aa6c5436..e0472f9768e801d5fd521c4de43727f37da44908 100644 (file)
--- a/error.h
+++ b/error.h
@@ -50,4 +50,9 @@ extern void internal_error __P((const char *, ...));
 /* Report an internal warning. */
 extern void internal_warning __P((const char *, ...));
 
+/* Report an error having to do with command parsing or execution. */
+extern void command_error __P((const char *, int, int, int));
+
+extern char *command_errstr __P((int));
+
 #endif /* !_ERROR_H_ */
diff --git a/eval.c b/eval.c
index 28d38e1d6fc50e16ebbb5ab6f8cd75d599f4fa22..3ca5141f857129730ed8e4954428fdf5004f7d78 100644 (file)
--- a/eval.c
+++ b/eval.c
 #include "input.h"
 #include "execute_cmd.h"
 
+#if defined (HISTORY)
+#  include "bashhist.h"
+#endif
+
 extern int yyparse ();
 
 extern int EOF_reached;
@@ -105,7 +109,7 @@ reader_loop ()
              break;
 
            default:
-             programming_error ("reader_loop: bad jump: code %d", code);
+             command_error ("reader_loop", CMDERR_BADJUMP, code, 0);
            }
        }
 
@@ -161,7 +165,7 @@ static sighandler
 alrm_catcher(i)
      int i;
 {
-  printf ("%ctimed out waiting for input: auto-logout\n", '\07');
+  printf ("\007timed out waiting for input: auto-logout\n");
   jump_to_top_level (EXITPROG);
   SIGRETURN (0);
 }
@@ -269,6 +273,17 @@ parse_string_to_word_list (s, whom)
 {
   WORD_LIST *wl;
   COMMAND *saved_global;
+#if defined (HISTORY)
+  int old_remember_on_history, old_history_expansion_inhibited;
+#endif
+
+#if defined (HISTORY)
+  old_remember_on_history = remember_on_history;
+#  if defined (BANG_HISTORY)
+  old_history_expansion_inhibited = history_expansion_inhibited;
+#  endif
+  bash_history_disable ();
+#endif
 
   push_stream (1);
 
@@ -293,5 +308,12 @@ parse_string_to_word_list (s, whom)
 
   pop_stream ();
 
+#if defined (HISTORY)
+  remember_on_history = old_remember_on_history;
+#  if defined (BANG_HISTORY)
+  history_expansion_inhibited = old_history_expansion_inhibited;
+#  endif /* BANG_HISTORY */
+#endif /* HISTORY */
+
   return (wl);
 }
diff --git a/examples/functions/autoload.v3 b/examples/functions/autoload.v3
new file mode 100644 (file)
index 0000000..a82ffe9
--- /dev/null
@@ -0,0 +1,125 @@
+#From: Mark Kennedy <mtk@ny.ubs.com>
+#Message-ID: <35E2B899.63A02DF5@ny.ubs.com>
+#Date: Tue, 25 Aug 1998 09:14:01 -0400
+#To: chet@nike.ins.cwru.edu
+#Subject: a newer version of the ksh-style 'autoload'
+
+#enclosed you'll find 'autoload.v3',  a version of the autoloader
+#that emulates the ksh semantics of delaying the resolution (and loading) of the function
+#until its first use.  i took the liberty of simplifying the code a bit although it still uses the
+#same functional breakdown.  i recently went through the exercise of converting
+#my ksh-based environment to bash (a very, very pleasant experience)
+#and this popped out.
+
+# the psuedo-ksh autoloader.
+
+# The first cut of this was by Bill Trost, trost@reed.bitnet.
+# The second cut came from Chet Ramey, chet@ins.CWRU.Edu
+# The third cut came from Mark Kennedy, mtk@ny.ubs.com.  1998/08/25
+
+unset _AUTOLOADS
+
+_aload()
+{
+    local func
+    for func; do
+       eval $func '()
+               {
+                   local f=$(_autoload_resolve '$func')
+                   if [[ $f ]]; then
+                       . $f
+                       '$func' "$@"
+                       return $?
+                   else
+                       return 1
+                   fi
+               }'
+       _autoload_addlist $func
+    done
+}
+
+_autoload_addlist()
+{
+       local func
+
+       for func in ${_AUTOLOADS[@]}; do
+           [[ $func = "$1" ]] && return
+       done
+
+       _AUTOLOADS[${#_AUTOLOADS[@]}]=$1
+}
+
+_autoload_dump()
+{
+    local func
+
+    for func in ${_AUTOLOADS[@]}; do
+       [[ $1 ]] && echo -n "autoload "
+       echo $func
+    done
+}
+
+_autoload_remove_one()
+{
+    local func
+    local -a NEW_AUTOLOADS
+
+    for func in ${_AUTOLOADS[@]}; do
+       [[ $func != "$1" ]] && NEW_AUTOLOADS[${#NEW_AUTOLOADS[@]}]=$func
+    done
+
+    _AUTOLOADS=( ${NEW_AUTOLOADS[@]} )
+}
+
+_autoload_remove()
+{
+    local victim func
+
+    for victim; do
+       for func in ${_AUTOLOADS[@]}; do
+           [[ $victim = "$func" ]] && unset -f $func && continue 2
+       done
+       echo "autoload: $func: not an autoloaded function" >&2
+    done
+
+    for func; do
+           _autoload_remove_one $func
+    done
+}
+
+_autoload_resolve()
+{
+    if [[ ! "$FPATH" ]]; then
+           echo "autoload: FPATH not set or null" >&2
+           return
+    fi
+
+    local p
+
+    for p in $( (IFS=':'; set -- ${FPATH}; echo "$@") ); do
+       p=${p:-.}
+       if [ -f $p/$1 ]; then echo $p/$1; return; fi
+    done
+
+    echo "autoload: $1: function source file not found" >&2
+}
+
+autoload()
+{
+    if (( $# == 0 )) ; then _autoload_dump; return; fi
+
+    local opt OPTIND
+
+    while getopts pu opt
+    do
+       case $opt in
+           p) _autoload_dump printable; return;;
+           u) shift $((OPTIND-1)); _autoload_remove "$@"; return;; 
+           *) echo "autoload: usage: autoload [-pu] [function ...]" >&2; return;;
+       esac
+    done
+
+    shift $(($OPTIND-1))
+
+    _aload "$@"
+}
index 776b204af89c8658bfca2f35eeb5b1ae76de4194..08086aea66af6519abffd15a1f76b8ed3adb948a 100644 (file)
@@ -23,6 +23,17 @@ inet2hex ()
 hex2inet ()
 {
        local x1 x2 x3 x4
+       local rev
+
+       OPTIND=1
+       while getopts "r" o
+       do
+               case "$o" in
+               r)      rev=true;;
+               *)      echo "hex2inet: usage: hex2inet [0x]XXXXXXXX" >&2 ; exit 2;;
+               esac
+       done
+       shift $(( $OPTIND - 1 ))
 
        case "$1" in
        0x*)    h=${1#??} ;;
@@ -40,5 +51,10 @@ hex2inet ()
        x3=$(( 0x${h:4:2} ))
        x4=$(( 0x${h:6:2} ))
 
-       printf "%d.%d.%d.%d\n" $x1 $x2 $x3 $x4 
+       if [ -z "$rev" ] ; then
+               printf "%d.%d.%d.%d\n" $x1 $x2 $x3 $x4 
+       else
+               printf "%d.%d.%d.%d\n" $x4 $x3 $x2 $x1 
+       fi
+       return 0
 }
index 5f4fc9d4ca9ddd44e9931980ecb8b6ef116eb736..a0649f840858861cf605c83b3b641e355a7e2296 100644 (file)
@@ -8,19 +8,19 @@
 
 lowercase()
 {
-for file; do
-    filename=${file##*/}
-    case "$filename" in
-    */*)    dirname=${file%/*} ;;
-    *) dirname=.;;
-    esac
-    nf=$(echo $filename | tr A-Z a-z)
-    newname="${dirname}/${nf}"
-    if [ "$nf" != "$filename" ]; then
-       mv "$file" "$newname"
-       echo "$0: $file -> $newname"
-    else
-       echo "$0: $file not changed."
-    fi
-done
+       for file; do
+               filename=${file##*/}
+               case "$filename" in
+               */*)    dirname=${file%/*} ;;
+               *) dirname=.;;
+               esac
+               nf=$(echo $filename | tr A-Z a-z)
+               newname="${dirname}/${nf}"
+               if [ "$nf" != "$filename" ]; then
+                       mv "$file" "$newname"
+                       echo "lowercase: $file -> $newname"
+               else
+                       echo "lowercase: $file not changed."
+               fi
+       done
 }
diff --git a/examples/functions/repeat3 b/examples/functions/repeat3
new file mode 100644 (file)
index 0000000..65048bf
--- /dev/null
@@ -0,0 +1,12 @@
+# From psamuels@jake.niar.twsu.edu (Peter Samuelson)
+# posted to usenet, Message-ID: <6rtp8j$2a0$1@jake.niar.twsu.edu>
+
+repeat ()
+{
+       local i max;     # note that you can use \$i in the command string
+       max=$1; shift;
+
+       i=1; while ((i <= max)); do
+               eval "$@"; ((i = i + 1));
+       done;
+}
diff --git a/examples/functions/seq2 b/examples/functions/seq2
new file mode 100644 (file)
index 0000000..c3ad95c
--- /dev/null
@@ -0,0 +1,37 @@
+# Generate a sequence from m to n, m defaults to 1.
+
+seq ()
+{
+       declare -i lo hi i      # makes local
+       local _SEQ INIT COMPARE STEP
+
+       case "$1" in
+       -r)     INIT='i=$hi _SEQ=""' COMPARE='let "i >= $lo"' STEP='let i-=1' ; shift ;;
+       *)      INIT='i=$lo _SEQ=""' COMPARE='let "i <= $hi"' STEP='let i+=1' ;;
+       esac
+
+       case $# in
+       1) lo=1 hi="$1" ;;
+       2) lo=$1 hi=$2 ;;
+       *) echo seq: usage: seq [-r] [low] high 1>&2 ; return 2 ;;
+       esac
+
+       # equivalent to the as-yet-unimplemented
+       # for (( "$INIT" ; "$COMPARE" ; "$STEP" )); do _SEQ="${_SEQ}$i "; done
+       eval "$INIT"
+       while eval "$COMPARE"; do
+               _SEQ="${_SEQ}$i "
+               eval "$STEP"
+       done
+       echo "${_SEQ# }"
+       return 0
+}
+
+# like the APL `iota' function (or at least how I remember it :-)
+iota()
+{
+       case $# in
+       1) seq 1 "$1"; return $?;;
+       *) echo "iota: usage: iota high" 1>&2; return 2;;
+       esac
+}
diff --git a/examples/functions/which b/examples/functions/which
new file mode 100644 (file)
index 0000000..54ace77
--- /dev/null
@@ -0,0 +1,44 @@
+#
+# which - emulation of `which' as it appears in FreeBSD
+#
+# usage: which [-as] command [command...]
+#
+
+which()
+{
+       local aflag sflag ES a
+
+       OPTIND=1
+       while builtin getopts as opt ; do
+               case "$opt" in
+               a)      aflag=-a ;;
+               s)      sflag=1 ;;
+               ?)      echo "which: usage: which [-as] command [command ...]" >&2
+                       exit 2 ;;
+               esac
+       done
+
+       (( $OPTIND > 1 )) && shift $(( $OPTIND - 1 ))
+
+       # without command arguments, exit with status 1
+       ES=1
+
+       # exit status is 0 if all commands are found, 1 if any are not found
+       for command; do
+               # if $command is a function, make sure we add -a so type
+               # will look in $PATH after finding the function
+               a=$aflag
+               case "$(builtin type -t $command)" in
+               "function")     a=-a;;
+               esac
+
+               if [ -n "$sflag" ]; then
+                       builtin type -p $a $command >/dev/null 2>&1
+               else
+                       builtin type -p $a $command
+               fi
+               ES=$?
+       done
+
+       return $ES
+}
index 9773144da63f1c39023a22556eccabd937661357..799b4cfcafc07873bb3d4edd804b4ee77409b792 100644 (file)
@@ -1,8 +1,6 @@
 #
 # Simple makefile for the sample loadable builtins
 #
-# This includes some boilerplate definitions added by configure, but will
-# still need hand-editing
 #
 # Include some boilerplate Gnu makefile definitions.
 prefix = @prefix@
@@ -22,123 +20,148 @@ VPATH = .:@srcdir@
 CC = @CC@
 RM = rm -f
 
-SHELL = /bin/sh
-
-# SunOS 4
-#PICFLAG = -pic
-# Some versions of gcc, esp. on NetBSD and FreeBSD
-PICFLAG = -fpic
-# Linux -- could also be -fpic
-#PICFLAG = -fPIC
-# SunOS 5
-#PICFLAG = -K pic
-# SVR4, SVR4.2, Irix
-#PICFLAG = -K PIC
-# BSD/OS 2.1, BSD/OS 3.x
-#PICFLAG =
-# AIX 4.2
-#PICFLAG = -K
-
-# SunOS 4, BSD/OS 2.1, BSD/OS 3.x, SVR4.2, SVR4, Linux, AIX 4.2, etc.
-LD = ld
-# SunOS 5, Linux
-#LD = ${CC}
-
-# SunOS 4
-#LDOPT = -assert pure-text
-# OSF/1, Digital UNIX
-#LDOPT = -shared -soname $@ -expect_unresolved '*'
-# SunOS 5 using sun cc
-#LDOPT = -dy -z text -G -i -h $@
-# SunOS 5 using gcc with Sun ld
-#LDOPT = -shared -Wl,-dy -Wl,-G -Wl,-i                      
-# SVR4, SVR4.2
-#LDOPT = -dy -z text -G -h $@
-# NetBSD, FreeBSD -- might also need -r
-LDOPT = -x -Bshareable
-# Linux
-#LDOPT = -shared
-# BSD/OS 2.1, BSD/OS 3.x
-#LDOPT = -r
-# AIX 4.2
-#LDOPT = -bdynamic -bnoentry -bexpall -G
-
-# other libraries to link the shared object against
-# BSD/OS 2.1
-#LDLIBS = -lc_s.2.1.0
-# BSD/OS 3.0, BSD/OS 3.1
-#LDLIBS = -lc_s.3.0.0
+SHELL = @MAKE_SHELL@
 
+host_os = @host_os@
+host_cpu = @host_cpu@
+host_vendor = @host_vendor@
+
+CFLAGS = @CFLAGS@
+
+#
+# These values are generated for configure by ${topdir}/support/shobj-conf.
+# If your system is not supported by that script, but includes facilities for
+# dynamic loading of shared objects, please update the script and send the
+# changes to bash-maintainers@gnu.org.
+#
+SHOBJ_CC = @SHOBJ_CC@
+SHOBJ_CFLAGS = @SHOBJ_CFLAGS@
+SHOBJ_LD = @SHOBJ_LD@
+SHOBJ_LDFLAGS = @SHOBJ_LDFLAGS@
+SHOBJ_XLDFLAGS = @SHOBJ_XLDFLAGS@
+SHOBJ_LIBS = @SHOBJ_LIBS@
+SHOBJ_STATUS = @SHOBJ_STATUS@
 
 INC = -I. -I.. -I$(topdir) -I$(topdir)/lib -I$(topdir)/builtins \
       -I$(BUILD_DIR) -I$(BUILD_DIR)/lib -I$(BUILD_DIR)/builtins
 
 .c.o:
-       $(CC) $(PICFLAG) $(CFLAGS) $(INC) -c -o $@ $<
+       $(SHOBJ_CC) $(SHOBJ_CFLAGS) $(CFLAGS) $(INC) -c -o $@ $<
 
 
 ALLPROG = print truefalse sleep pushd finfo logname basename dirname \
-         tty pathchk tee head rmdir sprintf
+         tty pathchk tee head mkdir rmdir sprintf printenv id whoami \
+         uname sync push ln unlink
 OTHERPROG = necho getconf hello cat
 
-all:   $(ALLPROG)
-others:        $(OTHERPROG)
+all:   $(SHOBJ_STATUS)
+
+supported:     $(ALLPROG)
+others:                $(OTHERPROG)
+
+unsupported:
+       @echo "Your system (${host_os}) is not supported by the"
+       @echo "${topdir}/support/shobj-conf script."
+       @echo "If your operating system provides facilities for dynamic"
+       @echo "loading of shared objects using the dlopen(3) interface,"
+       @echo "please update the script and re-run configure.
+       @echo "Please send the changes you made to bash-maintainers@gnu.org"
+       @echo "for inclusion in future bash releases."
 
-everything: all others
+everything: supported others
 
 sprintf: sprintf.o
-       $(LD) $(LDOPT) -o $@ sprintf.o $(LDLIBS)
+       $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ sprintf.o $(SHOBJ_LIBS)
 
 print: print.o
-       $(LD) $(LDOPT) -o $@ print.o $(LDLIBS)
+       $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ print.o $(SHOBJ_LIBS)
 
 necho: necho.o
-       $(LD) $(LDOPT) -o $@ necho.o $(LDLIBS)
+       $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ necho.o $(SHOBJ_LIBS)
 
 getconf: getconf.o
-       $(LD) $(LDOPT) -o $@ getconf.o $(LDLIBS)
+       $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ getconf.o $(SHOBJ_LIBS)
 
 hello: hello.o
-       $(LD) $(LDOPT) -o $@ hello.o $(LDLIBS)
+       $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ hello.o $(SHOBJ_LIBS)
 
 truefalse: truefalse.o
-       $(LD) $(LDOPT) -o $@ truefalse.o $(LDLIBS)
+       $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ truefalse.o $(SHOBJ_LIBS)
 
 sleep: sleep.o
-       $(LD) $(LDOPT) -o $@ sleep.o $(LDLIBS)
-
-pushd: pushd.o
-       $(LD) $(LDOPT) -o $@ pushd.o $(LDLIBS)
+       $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ sleep.o $(SHOBJ_LIBS)
 
 finfo: finfo.o
-       $(LD) $(LDOPT) -o $@ finfo.o $(LDLIBS)
+       $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ finfo.o $(SHOBJ_LIBS)
 
 cat:   cat.o
-       $(LD) $(LDOPT) -o $@ cat.o $(LDLIBS)
+       $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ cat.o $(SHOBJ_LIBS)
 
 logname:       logname.o
-       $(LD) $(LDOPT) -o $@ logname.o $(LDLIBS)
+       $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ logname.o $(SHOBJ_LIBS)
 
 basename:      basename.o
-       $(LD) $(LDOPT) -o $@ basename.o $(LDLIBS)
+       $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ basename.o $(SHOBJ_LIBS)
 
 dirname:       dirname.o
-       $(LD) $(LDOPT) -o $@ dirname.o $(LDLIBS)
+       $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ dirname.o $(SHOBJ_LIBS)
 
 tty:   tty.o
-       $(LD) $(LDOPT) -o $@ tty.o $(LDLIBS)
+       $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ tty.o $(SHOBJ_LIBS)
 
 pathchk:       pathchk.o
-       $(LD) $(LDOPT) -o $@ pathchk.o $(LDLIBS)
+       $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ pathchk.o $(SHOBJ_LIBS)
 
 tee:   tee.o
-       $(LD) $(LDOPT) -o $@ tee.o $(LDLIBS)
+       $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ tee.o $(SHOBJ_LIBS)
+
+mkdir: mkdir.o
+       $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ mkdir.o $(SHOBJ_LIBS)
 
 rmdir: rmdir.o
-       $(LD) $(LDOPT) -o $@ rmdir.o $(LDLIBS)
+       $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ rmdir.o $(SHOBJ_LIBS)
 
 head:  head.o
-       $(LD) $(LDOPT) -o $@ head.o $(LDLIBS)
+       $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ head.o $(SHOBJ_LIBS)
+
+printenv:      printenv.o
+       $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ printenv.o $(SHOBJ_LIBS)
+
+id:    id.o
+       $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ id.o $(SHOBJ_LIBS)
+
+whoami:        whoami.o
+       $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ whoami.o $(SHOBJ_LIBS)
+
+uname: uname.o
+       $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ uname.o $(SHOBJ_LIBS)
+
+sync:  sync.o
+       $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ sync.o $(SHOBJ_LIBS)
+
+push:  push.o
+       $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ push.o $(SHOBJ_LIBS)
+
+ln:    ln.o
+       $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ ln.o $(SHOBJ_LIBS)
+
+unlink:        unlink.o
+       $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ unlink.o $(SHOBJ_LIBS)
+
+
+# pushd is a special case.  We use the same source that the builtin version
+# uses, with special compilation options.
+#
+pushd.c:       ${topdir}/builtins/pushd.def
+       $(RM) $@
+       ${BUILD_DIR}/builtins/mkbuiltins -D ${topdir}/builtins ${topdir}/builtins/pushd.def
+
+pushd.o:       pushd.c
+       $(RM) $@
+       $(SHOBJ_CC) -DPUSHD_AND_POPD -DLOADABLE_BUILTIN $(SHOBJ_CFLAGS) $(CFLAGS) $(INC) -c -o $@ $<
+
+pushd: pushd.o
+       $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ pushd.o $(SHOBJ_LIBS)
 
 clean:
        $(RM) $(ALLPROG) $(OTHERPROG) *.o
@@ -146,12 +169,11 @@ clean:
 mostlyclean:   clean
 
 distclean maintainer-clean: clean
-       $(RM) Makefile
+       $(RM) Makefile pushd.c
 
 print.o: print.c
 truefalse.o: truefalse.c
 sleep.o: sleep.c
-pushd.o: pushd.c
 finfo.o: finfo.c
 logname.o: logname.c
 basename.o: basename.c
@@ -166,4 +188,10 @@ necho.o: necho.c
 getconf.o: getconf.c
 hello.o: hello.c
 cat.o: cat.c
-
+printenv.o: printenv.c
+id.o: id.c
+whoami.o: whoami.c
+uname.o: uname.c
+sync.o: sync.c
+push.o: push.c
+mkdir.o: mkdir.c
index 4c02f4720ed29dc2a6a6f8e25fae60c2e4ce230e..db6786098e419693930d72f406deb03e339acc20 100644 (file)
@@ -10,13 +10,18 @@ of the shell.
 All of the new builtins in ksh93 that bash didn't already have
 are included here, as is the ksh `print' builtin.
 
-Compile with cc and whatever pic options you need (look in the
-Makefile for a few common settings)
+The configure script in the top-level source directory uses the
+support/shobj-conf script to set the right values in the Makefile,
+so you should not need to change the Makefile.  If your system
+is not supported by support/shobj-conf, and it has the necessary
+facilities for building shared objects and support for the
+dlopen/dlsyn/dlclose/dlerror family of functions, please make
+the necessary changes to support/shobj-conf and send the changes
+to bash-maintainers@gnu.org.
 
-load with ld and whatever shared object options you need (again,
-look in the Makefile)
+Loadable builtins are loaded into a running shell with
 
-then enable -f filename builtin-name
+       enable -f filename builtin-name
 
 enable uses a simple reference-counting scheme to avoid unloading a
 shared object that implements more than one loadable builtin before
@@ -24,4 +29,5 @@ all loadable builtins implemented in the object are removed.
 
 Many of the details needed by builtin writers are found in hello.c,
 the canonical example.  There is no real `builtin writers' programming
-guide'.
+guide'.  The file template.c provides a template to use for creating
+new loadable builtins.
index e875865300554ea08a1f99aaa7c094da6d452749..6159560e54f1538fe8b2b730f4cf2280abe613b8 100644 (file)
@@ -58,7 +58,7 @@ dirname_builtin (list)
     if (string[slen] == '/')
       break;
 
-  if (slen >= 0)
+  if (slen < 0)
     {
       fputs (".\n", stdout);
       return (EXECUTION_SUCCESS);
index c0b03652a5056f0e02cc56874f745523c70cb61d..ab3c9a411b447dc23c54d3abd6f0f93a4858da76 100644 (file)
@@ -196,6 +196,13 @@ int        m;
                obits[i++] = 'x';
        obits[i] = '\0';
 
+       if (m & S_ISUID)
+               ubits[2] = (m & S_IXUSR) ? 's' : 'S';
+       if (m & S_ISGID)
+               gbits[2] = (m & S_IXGRP) ? 's' : 'S';
+       if (m & S_ISVTX)
+               obits[2] = (m & S_IXOTH) ? 't' : 'T';
+
        printf ("u=%s,g=%s,o=%s", ubits, gbits, obits);
 }
 
@@ -217,6 +224,10 @@ int        mode;
                printf("S_IFLNK ");
        if (S_ISSOCK(mode))
                printf("S_IFSOCK ");
+#ifdef S_ISWHT
+       if (S_ISWHT(mode))
+               printf("S_ISWHT ");
+#endif
        perms(getperm(mode));
        printf("\n");
 }
index 3f371e5587d093e8dac2f61207b3a35c5f352e0f..f4b4a8ea71644a992a9ec3aef1ab987bfe98bf59 100644 (file)
@@ -3,19 +3,21 @@
 
 /* See Makefile for compilation details. */
 
-#include "config.h"
+#include <config.h>
 
 #if defined (HAVE_UNISTD_H)
 #  include <unistd.h>
 #endif
 
 #include <stdio.h>
+
 #include "builtins.h"
 #include "shell.h"
+#include "bashgetopt.h"
 
 /* A builtin `xxx' is normally implemented with an `xxx_builtin' function.
    If you're converting a command that uses the normal Unix argc/argv
-   calling convention, use argv = word_list_to_argv (list, &argc) and call
+   calling convention, use argv = make_builtin_argv (list, &argc) and call
    the original `main' something like `xxx_main'.  Look at cat.c for an
    example.
 
@@ -41,7 +43,6 @@ hello_builtin (list)
    which is printed by `help xxx'.  It must end with a NULL. */
 char *hello_doc[] = {
        "this is the long doc for the sample hello builtin",
-       "which is a bare-bones echo",
        (char *)NULL
 };
 
@@ -53,7 +54,7 @@ struct builtin hello_struct = {
        hello_builtin,          /* function implementing the builtin */
        BUILTIN_ENABLED,        /* initial flags for builtin */
        hello_doc,              /* array of long documentation strings. */
-       "hello [args]",         /* usage synopsis; becomes short_doc */
+       "hello",                /* usage synopsis; becomes short_doc */
        0                       /* reserved for internal use */
 };
        
diff --git a/examples/loadables/id.c b/examples/loadables/id.c
new file mode 100644 (file)
index 0000000..945190d
--- /dev/null
@@ -0,0 +1,308 @@
+/*
+ * id - POSIX.2 user identity
+ *
+ * (INCOMPLETE -- supplementary groups for other users not yet done)
+ *
+ * usage: id [-Ggu] [-nr] [user]
+ *
+ * The default output format looks something like:
+ *     uid=xxx(chet) gid=xx groups=aa(aname), bb(bname), cc(cname)
+ */
+
+#include <config.h>
+#include <stdio.h>
+#include "bashtypes.h"
+#include <pwd.h>
+#include <grp.h>
+#include "bashansi.h"
+
+#ifdef HAVE_LIMITS_H
+#  include <limits.h>
+#else
+#  include <sys/param.h>
+#endif
+
+#if !defined (HAVE_GETPW_DECLS)
+extern struct passwd *getpwuid ();
+#endif
+extern struct group *getgrgid ();
+
+#include "shell.h"
+#include "builtins.h"
+#include "stdc.h"
+#include "common.h"
+#include "bashgetopt.h"
+
+#define ID_ALLGROUPS   0x001           /* -G */
+#define ID_GIDONLY     0x002           /* -g */
+#define ID_USENAME     0x004           /* -n */
+#define ID_USEREAL     0x008           /* -r */
+#define ID_USERONLY    0x010           /* -u */
+
+#define ID_FLAGSET(s)  ((id_flags & (s)) != 0)
+
+static int id_flags;
+
+static uid_t ruid, euid;
+static gid_t rgid, egid;
+
+static char *id_user;
+
+static int inituser ();
+
+static int id_pruser ();
+static int id_prgrp ();
+static int id_prgroups ();
+static int id_prall ();
+
+int
+id_builtin (list)
+     WORD_LIST *list;
+{
+  int opt;
+  char *user;
+
+  id_flags = 0;
+  reset_internal_getopt ();
+  while ((opt = internal_getopt (list, "Ggnru")) != -1)
+    {
+      switch (opt)
+       {
+       case 'G': id_flags |= ID_ALLGROUPS; break;
+       case 'g': id_flags |= ID_GIDONLY; break;
+       case 'n': id_flags |= ID_USENAME; break;
+       case 'r': id_flags |= ID_USEREAL; break;
+       case 'u': id_flags |= ID_USERONLY; break;
+       default:
+         builtin_usage ();
+         return (EX_USAGE);
+       }
+    }
+  list = loptend;
+
+  user = list ? list->word->word : (char *)NULL;
+
+  /* Check for some invalid option combinations */
+  opt = ID_FLAGSET (ID_ALLGROUPS) + ID_FLAGSET (ID_GIDONLY) + ID_FLAGSET (ID_USERONLY);
+  if (opt > 1 || (opt == 0 && ((id_flags & (ID_USEREAL|ID_USENAME)) != 0)))
+    {
+      builtin_usage ();
+      return (EX_USAGE);
+    }
+
+  if (list && list->next)
+    {
+      builtin_usage ();
+      return (EX_USAGE);
+    }
+
+  if (inituser (user) < 0)
+    return (EXECUTION_FAILURE);
+
+  opt = 0;
+  if (id_flags & ID_USERONLY)
+    opt += id_pruser ((id_flags & ID_USEREAL) ? ruid : euid);
+  else if (id_flags & ID_GIDONLY)
+    opt += id_prgrp ((id_flags & ID_USEREAL) ? rgid : egid);
+  else if (id_flags & ID_ALLGROUPS)
+    opt += id_prgroups (user);
+  else
+    opt += id_prall (user);
+  putchar ('\n');
+  fflush (stdout);
+
+  return (opt == 0 ? EXECUTION_SUCCESS : EXECUTION_FAILURE);
+}
+
+static int
+inituser (uname)
+     char *uname;
+{
+  struct passwd *pwd;
+
+  if (uname)
+    {
+      pwd = getpwnam (uname);
+      if (pwd == 0)
+       {
+         builtin_error ("%s: no such user", uname);
+         return -1;
+       }
+      ruid = euid = pwd->pw_uid;
+      rgid = egid = pwd->pw_gid;
+    }
+  else
+    {
+      ruid = current_user.uid;
+      euid = current_user.euid;
+      rgid = current_user.gid;
+      egid = current_user.egid;
+    }
+  return 0;
+}
+
+/* Print the name or value of user ID UID. */
+static int
+id_pruser (uid)
+     int uid;
+{
+  struct passwd *pwd = NULL;
+  int r;
+
+  r = 0;
+  if (id_flags & ID_USENAME)
+    {
+      pwd = getpwuid (uid);
+      if (pwd == NULL)
+        r = 1;
+    }
+  if (pwd)
+    printf ("%s", pwd->pw_name);
+  else
+    printf ("%u", (unsigned) uid);
+      
+  return r;
+}
+
+/* Print the name or value of group ID GID. */
+
+static int
+id_prgrp (gid)
+     int gid;
+{
+  struct group *grp = NULL;
+  int r;
+
+  r = 0;
+  if (id_flags & ID_USENAME)
+    {
+      grp = getgrgid (gid);
+      if (grp == NULL)
+       r = 1;
+    }
+
+  if (grp)
+    printf ("%s", grp->gr_name);
+  else
+    printf ("%u", (unsigned) gid);
+
+  return r;
+}
+
+static int
+id_prgroups (uname)
+     char *uname;
+{
+  int *glist, ng, i, r;
+
+  r = 0;
+  id_prgrp (rgid);
+  if (egid != rgid)
+    {
+      putchar (' ');
+      id_prgrp (egid);
+    }
+
+  if (uname)
+    {
+      builtin_error ("supplementary groups for other users not yet implemented");
+      glist = (int *)NULL;
+      ng = 0;
+      r = 1;
+    }
+  else
+    glist = get_group_array (&ng);
+
+  for (i = 0; i < ng; i++)
+    if (glist[i] != rgid && glist[i] != egid)
+      {
+       putchar (' ');
+       id_prgrp (glist[i]);
+      }
+  
+  return r;
+}
+
+static int
+id_prall (uname)
+     char *uname;
+{
+  int r, i, ng, *glist;
+  struct passwd *pwd;
+  struct group *grp;
+
+  r = 0;
+  printf ("uid=%u", (unsigned) ruid);
+  pwd = getpwuid (ruid);
+  if (pwd == NULL)
+    r = 1;
+  else
+    printf ("(%s)", pwd->pw_name);
+
+  printf (" gid=%u", (unsigned) rgid);
+  grp = getgrgid (rgid);
+  if (grp == NULL)
+    r = 1;
+  else
+    printf ("(%s)", grp->gr_name);
+
+  if (euid != ruid)
+    { 
+      printf (" euid=%u", (unsigned) euid);
+      pwd = getpwuid (euid);
+      if (pwd == NULL)
+       r = 1;
+      else 
+       printf ("(%s)", pwd->pw_name);
+    }
+
+  if (egid != rgid) 
+    {
+      printf (" egid=%u", (unsigned) egid);
+      grp = getgrgid (egid);
+      if (grp == NULL)
+       r = 1;
+      else
+       printf ("(%s)", grp->gr_name);
+    }
+
+  if (uname)
+    {
+      builtin_error ("supplementary groups for other users not yet implemented");
+      glist = (int *)NULL;
+      ng = 0;
+      r = 1;
+    }
+  else
+    glist = get_group_array (&ng);
+
+  if (ng > 0)
+    printf (" groups=");
+  for (i = 0; i < ng; i++)
+    {
+      if (i > 0)
+       printf (", ");
+      printf ("%u", (unsigned) glist[i]);
+      grp = getgrgid (glist[i]);
+      if (grp == NULL)
+       r = 1;
+      else
+       printf ("(%s)", grp->gr_name);
+    }
+
+  return r;
+}
+
+char *id_doc[] = {
+       "return information about user identity",
+       (char *)NULL
+};
+
+struct builtin id_struct = {
+       "id",
+       id_builtin,
+       BUILTIN_ENABLED,
+       id_doc,
+       "id [user]\n\tid -G [-n] [user]\n\tid -g [-nr] [user]\n\tid -u [-nr] [user]",
+       0
+};
diff --git a/examples/loadables/ln.c b/examples/loadables/ln.c
new file mode 100644 (file)
index 0000000..9c4c91b
--- /dev/null
@@ -0,0 +1,203 @@
+/* ln - make links */
+
+/* See Makefile for compilation details. */
+
+#include "config.h"
+
+#include "bashtypes.h"
+
+#if defined (HAVE_UNISTD_H)
+#  include <unistd.h>
+#endif
+
+#include "posixstat.h"
+
+#include <stdio.h>
+#include <errno.h>
+
+#include "builtins.h"
+#include "shell.h"
+#include "bashgetopt.h"
+
+#if !defined (errno)
+extern int errno;
+#endif
+
+#define LN_SYMLINK 0x01
+#define LN_UNLINK  0x02
+
+static Function *linkfn;
+static int dolink ();
+
+ln_builtin (list)
+     WORD_LIST *list;
+{
+  int rval, opt, flags;
+  WORD_LIST *l;
+  char *sdir;
+  struct stat sb;
+
+  flags = 0;
+  reset_internal_getopt ();
+  while ((opt = internal_getopt (list, "fs")) != -1)
+    {
+      switch (opt)
+       {
+       case 'f':
+         flags |= LN_UNLINK;
+         break;
+       case 's':
+         flags |= LN_SYMLINK;
+         break;
+       default:
+         builtin_usage ();
+         return (EX_USAGE);
+       }
+    }
+  list = loptend;
+
+  if (list == 0)
+    {
+      builtin_usage ();
+      return (EX_USAGE);
+    }
+    
+  linkfn = (flags & LN_SYMLINK) ? symlink : link;  
+
+  if (list->next == 0)                 /* ln target, equivalent to ln target . */
+    return (dolink (list->word->word, ".", flags));
+
+  if (list->next->next == 0)           /* ln target source */
+    return (dolink (list->word->word, list->next->word->word, flags));
+
+  /* ln target1 target2 ... directory */
+
+  /* find last argument: target directory, and make sure it's an existing
+     directory. */
+  for (l = list; l->next; l = l->next)  
+    ;
+  sdir = l->word->word;
+
+  if (stat(sdir, &sb) < 0)
+    {
+      builtin_error ("%s", sdir);
+      return (EXECUTION_FAILURE);
+    }
+
+  if (S_ISDIR (sb.st_mode) == 0)
+    {
+      builtin_usage ();
+      return (EX_USAGE);
+    }
+
+  for (rval = EXECUTION_SUCCESS; list != l; list = list->next)
+    rval += dolink (list->word->word, sdir, flags);
+  
+  return rval;
+}
+
+static char *
+mkdirpath (dir, file)
+     char *dir, *file;
+{
+  int dlen, flen;
+  char *ret;
+
+  dlen = strlen (dir);
+  flen = strlen (file);
+
+  ret = xmalloc (2 + dlen + flen);
+
+  strcpy (ret, dir);
+  if (ret[dlen - 1] != '/')
+    ret[dlen++] = '/';
+  strcpy (ret + dlen, file);
+  return ret;
+}
+
+#if defined (HAVE_LSTAT)
+#  define LSTAT lstat
+#else
+#  define LSTAT stat
+#endif
+
+static int
+dolink (src, dst, flags)
+     char *src, *dst;
+     int flags;
+{
+  struct stat ssb, dsb;
+  int exists;
+  char *dst_path, *p;
+
+  /* If we're not doing symlinks, the source must exist and not be a 
+     directory. */
+  if ((flags & LN_SYMLINK) == 0)
+    {
+      if (stat (src, &ssb) != 0)
+       {
+         builtin_error ("%s: %s", src, strerror (errno));
+         return (EXECUTION_FAILURE);
+       }
+      if (S_ISDIR (ssb.st_mode))
+       {
+         errno = EISDIR;
+         builtin_error ("%s: %s", src, strerror (errno));
+         return (EXECUTION_FAILURE);
+       }
+    }
+
+  /* If the destination is a directory, create the final filename by appending
+     the basename of the source to the destination. */
+  dst_path = 0;
+  if ((stat (dst, &dsb) == 0) && S_ISDIR (dsb.st_mode))
+    {
+      if ((p = strrchr (src, '/')) == 0)
+       p = src;
+      else
+       p++;
+
+      dst_path = mkdirpath (dst, p);
+      dst = dst_path;
+    }
+
+  exists = LSTAT (dst, &dsb) == 0;
+
+  /* If -f was specified, and the destination exists, unlink it. */
+  if ((flags & LN_UNLINK) && exists && unlink (dst) != 0)
+    {
+      builtin_error ("%s: cannot unlink: %s", dst, strerror (errno));
+      FREE (dst_path);
+      return (EXECUTION_FAILURE);
+    }
+
+  /* Perform the link. */
+  if ((*linkfn) (src, dst) != 0)
+    {
+      builtin_error ("cannot link %s to %s: %s", dst, src, strerror (errno));
+      FREE (dst_path);
+      return (EXECUTION_FAILURE);
+    }
+
+  FREE (dst_path);
+  return (EXECUTION_SUCCESS);
+}
+
+char *ln_doc[] = {
+       "Create a new directory entry with the same modes as the original",
+       "file.  The -f option means to unlink any existing file, permitting",
+       "the link to occur.  The -s option means to create a symbolic link.",
+       "By default, ln makes hard links.",
+       (char *)NULL
+};
+
+/* The standard structure describing a builtin command.  bash keeps an array
+   of these structures. */
+struct builtin ln_struct = {
+       "ln",           /* builtin name */
+       ln_builtin,             /* function implementing the builtin */
+       BUILTIN_ENABLED,        /* initial flags for builtin */
+       ln_doc,         /* array of long documentation strings. */
+       "ln [-fs] file1 [file2] OR ln [-fs] file ... directory",        /* usage synopsis; becomes short_doc */
+       0                       /* reserved for internal use */
+};
diff --git a/examples/loadables/mkdir.c b/examples/loadables/mkdir.c
new file mode 100644 (file)
index 0000000..cd6e5f9
--- /dev/null
@@ -0,0 +1,216 @@
+/* mkdir - make directories */
+
+/* See Makefile for compilation details. */
+
+#include <config.h>
+
+#include "bashtypes.h"
+#include "posixstat.h"
+#include <errno.h>
+#include <stdio.h>
+#include "bashansi.h"
+#if defined (HAVE_UNISTD_H)
+#  include <unistd.h>
+#endif
+
+#include "builtins.h"
+#include "shell.h"
+#include "bashgetopt.h"
+
+#if !defined (errno)
+extern int errno;
+#endif
+
+#define ISOCTAL(c)     ((c) >= '0' && (c) <= '7')
+
+extern int parse_symbolic_mode ();
+
+static int make_path ();
+
+static int original_umask;
+
+int
+mkdir_builtin (list)
+     WORD_LIST *list;
+{
+  int opt, pflag, omode, rval, octal, nmode, parent_mode, um;
+  char *mode;
+  WORD_LIST *l;
+
+  reset_internal_getopt ();
+  pflag = 0;
+  mode = (char *)NULL;
+  while ((opt = internal_getopt(list, "m:p")) != -1)
+    switch (opt)
+      {
+       case 'p':
+         pflag = 1;
+         break;
+       case 'm':
+         mode = list_optarg;
+         break;
+       default:
+         builtin_usage();
+         return (EX_USAGE);
+      }
+  list = loptend;
+
+  if (list == 0)
+    {
+      builtin_usage ();
+      return (EX_USAGE);
+    }
+
+  if (mode == NULL)
+    omode = S_IRWXU | S_IRWXG | S_IRWXO;       /* a=rwx */
+  else if (ISOCTAL (*mode))    /* octal number */
+    {
+      omode = read_octal (mode);
+      if (omode < 0)
+       {
+         builtin_error ("invalid file mode: %s", mode);
+         return (EXECUTION_FAILURE);
+       }
+      octal = 1;
+    }
+  else if (mode)
+    {
+      /* initial bits are a=rwx; the mode argument modifies them */
+      omode = parse_symbolic_mode (mode, S_IRWXU | S_IRWXG | S_IRWXO);
+      if (omode < 0)
+       {
+         builtin_error ("invalid file mode: %s", mode);
+         return (EXECUTION_FAILURE);
+       }
+      octal = 0;
+    }
+
+  /* Make the new mode */
+  original_umask = umask (0);
+  umask (original_umask);
+
+  nmode = (S_IRWXU | S_IRWXG | S_IRWXO) & ~original_umask;
+  parent_mode = nmode | (S_IWRITE|S_IEXEC);    /* u+wx */
+
+  /* Adjust new mode based on mode argument */
+  nmode &= omode;
+
+  for (rval = EXECUTION_SUCCESS, l = list; l; l = l->next)
+    {
+      if (pflag && make_path (l->word->word, nmode, parent_mode))
+       {
+         rval = EXECUTION_FAILURE;
+         continue;
+       }
+      else if (pflag == 0 && mkdir (l->word->word, nmode) < 0)
+        {
+          builtin_error ("cannot create directory `%s': %s", l->word->word, strerror (errno));
+          rval = EXECUTION_FAILURE;
+        }
+    }
+  return rval;
+}
+
+/* Make all the directories leading up to PATH, then create PATH.  Note that
+   this changes the process's umask; make sure that all paths leading to a
+   return reset it to ORIGINAL_UMASK */
+static int
+make_path (path, nmode, parent_mode)
+     char *path;
+     int nmode, parent_mode;
+{
+  int oumask;
+  struct stat sb;
+  char *p, *npath;
+
+  if (stat (path, &sb) == 0)
+    {
+      if (S_ISDIR (sb.st_mode) == 0)
+       {
+         builtin_error ("`%s': file exists but is not a directory", path);
+         return 1;
+       }
+       
+      if (chmod (path, nmode))
+        {
+          builtin_error ("%s: %s", path, strerror (errno));
+          return 1;
+        }
+
+      return 0;
+    }
+
+  oumask = umask (0);
+  npath = savestring (path);   /* So we can write to it. */
+    
+  /* Check whether or not we need to do anything with intermediate dirs. */
+
+  /* Skip leading slashes. */
+  p = npath;
+  while (*p == '/')
+    p++;
+
+  while (p = strchr (p, '/'))
+    {
+      *p = '\0';
+      if (stat (npath, &sb) != 0)
+       {
+         if (mkdir (npath, parent_mode))
+           {
+             builtin_error ("cannot create directory `%s': %s", npath, strerror (errno));
+             umask (original_umask);
+             free (npath);
+             return 1;
+           }
+       }
+      else if (S_ISDIR (sb.st_mode) == 0)
+        {
+          builtin_error ("`%s': file exists but is not a directory", npath);
+          umask (original_umask);
+          free (npath);
+          return 1;
+        }
+
+      *p++ = '/';      /* restore slash */
+      while (*p == '/')
+       p++;
+    }
+
+  /* Create the final directory component. */
+  if (stat (npath, &sb) && mkdir (npath, nmode))
+    {
+      builtin_error ("cannot create directory `%s': %s", npath, strerror (errno));
+      umask (original_umask);
+      free (npath);
+      return 1;
+    }
+
+  umask (original_umask);
+  free (npath);
+  return 0;
+}
+
+char *mkdir_doc[] = {
+       "Make directories.  Create the directories named as arguments, in",
+       "the order specified, using mode rwxrwxrwx as modified by the current",
+       "umask (see `help umask').  The -m option causes the file permission",
+       "bits of the final directory to be MODE.  The MODE argument may be",
+       "an octal number or a symbolic mode like that used by chmod(1).  If",
+       "a symbolic mode is used, the operations are interpreted relative to",
+       "an initial mode of \"a=rwx\".  The -p option causes any required",
+       "intermediate directories in PATH to be created.  The directories",
+       "are created with permssion bits of rwxrwxrwx as modified by the current",
+       "umask, plus write and search permissions for the owner.  mkdir",
+       "returns 0 if the directories are created successfully, and non-zero",
+       "if an error occurs.",
+       (char *)NULL
+};
+
+struct builtin mkdir_struct = {
+       "mkdir",
+       mkdir_builtin,
+       BUILTIN_ENABLED,
+       mkdir_doc,
+       "mkdir [-p] [-m mode] directory [directory ...]",
+       0
+};
index 695062a385c77778fef17c637c87fbcb81c6ca8b..521ee2c6df950f845e7c798db1b969cacfce3d15 100644 (file)
@@ -22,7 +22,7 @@ char *necho_doc[] = {
        (char *)NULL
 };
        
-struct builtin echo_struct = {
+struct builtin necho_struct = {
        "echo",
        necho_builtin,
        BUILTIN_ENABLED,
index dc02fce9c580e96542588a43eb4fd30e330d7b4e..2e36f8f6b69b3e3fd661a93cd5a9515deb2cfe32 100644 (file)
@@ -170,8 +170,7 @@ portable_chars_only (path)
   for (p = path; *p; ++p)
     if (portable_chars[(const unsigned char) *p] == 0)
       {
-       error (0, 0, "path `%s' contains nonportable character `%c'",
-              path, *p);
+       builtin_error ("path `%s' contains nonportable character `%c'", path, *p);
        return 0;
       }
   return 1;
@@ -212,7 +211,7 @@ dir_ok (path)
 
   if (!S_ISDIR (stats.st_mode))
     {
-      error (0, 0, "`%s' is not a directory", path);
+      builtin_error ("`%s' is not a directory", path);
       return 0;
     }
 
@@ -324,7 +323,7 @@ validate_path (path, portability)
        name_max = _POSIX_NAME_MAX;
       if (length > name_max)
        {
-         error (0, 0, "name `%s' has length %d; exceeds limit of %d",
+         builtin_error ("name `%s' has length %d; exceeds limit of %d",
                 start, length, name_max);
          free (parent);
          return 1;
@@ -350,7 +349,7 @@ validate_path (path, portability)
   free (parent);
   if (strlen (path) > path_max)
     {
-      error (0, 0, "path `%s' has length %d; exceeds limit of %d",
+      builtin_error ("path `%s' has length %d; exceeds limit of %d",
             path, strlen (path), path_max);
       return 1;
     }
diff --git a/examples/loadables/printenv.c b/examples/loadables/printenv.c
new file mode 100644 (file)
index 0000000..16f398f
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * printenv -- minimal builtin clone of BSD printenv(1).
+ *
+ * usage: printenv [varname]
+ *
+ */
+
+#include <config.h>
+#include <stdio.h>
+
+#include "builtins.h"
+#include "shell.h"
+#include "bashgetopt.h"
+
+extern char **export_env;
+
+int
+printenv_builtin (list) 
+     WORD_LIST *list;
+{
+  register char **envp;
+  int opt;
+  SHELL_VAR *var;
+
+  reset_internal_getopt ();
+  while ((opt = internal_getopt (list, "")) != -1)
+    {
+      switch (opt)
+       {
+       default:
+         builtin_usage ();
+         return (EX_USAGE);
+       }
+    }
+  list = loptend;
+
+  /* printenv */
+  if (list == 0)
+    {
+      maybe_make_export_env ();                /* this allows minimal code */
+      for (envp = export_env; *envp; envp++)
+       printf ("%s\n", *envp);
+      return (EXECUTION_SUCCESS);
+    }
+
+  /* printenv varname */
+  var = find_variable (list->word->word);
+  if (var == 0 || (exported_p (var) == 0))
+    return (EXECUTION_FAILURE);
+
+  if (function_p (var))
+    print_var_function (var);
+  else
+    print_var_value (var, 0);
+
+  return (EXECUTION_SUCCESS);
+}
+
+char *printenv_doc[] = {
+       "print values of environment variables",
+       (char *)NULL
+};
+
+struct builtin printenv_struct = {
+       "printenv",
+       printenv_builtin,
+       BUILTIN_ENABLED,
+       printenv_doc,
+       "printenv [varname]",
+       0
+};
diff --git a/examples/loadables/pushd.c b/examples/loadables/pushd.c
deleted file mode 100644 (file)
index 2ecbcbb..0000000
+++ /dev/null
@@ -1,608 +0,0 @@
-/* pushd.c, created from pushd.def. */
-#include <config.h>
-
-#include <stdio.h>
-#include <sys/param.h>
-
-#if defined (HAVE_UNISTD_H)
-#  include <unistd.h>
-#endif
-
-#include "bashansi.h"
-
-#include <errno.h>
-
-#include <tilde/tilde.h>
-
-#include "shell.h"
-#include "builtins.h"
-#include "maxpath.h"
-#include "common.h"
-
-#if !defined (errno)
-extern int errno;
-#endif /* !errno */
-
-static char *m_badarg = "%s: bad argument";
-
-/* The list of remembered directories. */
-static char **pushd_directory_list = (char **)NULL;
-
-/* Number of existing slots in this list. */
-static int directory_list_size;
-
-/* Offset to the end of the list. */
-static int directory_list_offset;
-
-static void pushd_error ();
-static void clear_directory_stack ();
-static int cd_to_string ();
-static int change_to_temp ();
-static int get_dirstack_index ();
-static void add_dirstack_element ();
-
-#define NOCD           0x01
-#define ROTATE         0x02
-#define LONGFORM       0x04
-#define CLEARSTAK      0x08
-
-int
-pushd_builtin (list)
-     WORD_LIST *list;
-{
-  char *temp, *current_directory, *top;
-  int j, flags;
-  long num;
-  char direction;
-
-  /* If there is no argument list then switch current and
-     top of list. */
-  if (list == 0)
-    {
-      if (directory_list_offset == 0)
-       {
-         builtin_error ("no other directory");
-         return (EXECUTION_FAILURE);
-       }
-
-      current_directory = get_working_directory ("pushd");
-      if (current_directory == 0)
-       return (EXECUTION_FAILURE);
-
-      j = directory_list_offset - 1;
-      temp = pushd_directory_list[j];
-      pushd_directory_list[j] = current_directory;
-      j = change_to_temp (temp);
-      free (temp);
-      return j;
-    }
-
-  for (flags = 0; list; list = list->next)
-    {
-      if (ISOPTION (list->word->word, 'n'))
-       {
-         flags |= NOCD;
-       }
-      else if (ISOPTION (list->word->word, '-'))
-        {
-          list = list->next;
-          break;
-        }
-      else if (list->word->word[0] == '-' && list->word->word[1] == '\0')
-       /* Let `pushd -' work like it used to. */
-       break;
-      else if (((direction = list->word->word[0]) == '+') || direction == '-')
-       {
-         if (legal_number (list->word->word + 1, &num) == 0)
-           {
-             builtin_error (m_badarg, list->word->word);
-             builtin_usage ();
-             return (EXECUTION_FAILURE);
-           }
-
-         if (direction == '-')
-           num = directory_list_offset - num;
-
-         if (num > directory_list_offset || num < 0)
-           {
-             pushd_error (directory_list_offset, list->word->word);
-             return (EXECUTION_FAILURE);
-           }
-         flags |= ROTATE;
-       }
-      else if (*list->word->word == '-')
-       {
-         bad_option (list->word->word);
-         builtin_usage ();
-         return (EXECUTION_FAILURE);
-       }
-      else
-       break;
-    }
-
-  if (flags & ROTATE)
-    {
-      /* Rotate the stack num times.  Remember, the current
-        directory acts like it is part of the stack. */
-      temp = get_working_directory ("pushd");
-
-      if (num == 0)
-       {
-         j = ((flags & NOCD) == 0) ? change_to_temp (temp) : EXECUTION_SUCCESS;
-         free (temp);
-         return j;
-       }
-
-      do
-       {
-         top = pushd_directory_list[directory_list_offset - 1];
-
-         for (j = directory_list_offset - 2; j > -1; j--)
-           pushd_directory_list[j + 1] = pushd_directory_list[j];
-
-         pushd_directory_list[j + 1] = temp;
-
-         temp = top;
-         num--;
-       }
-      while (num);
-
-      j = ((flags & NOCD) == 0) ? change_to_temp (temp) : EXECUTION_SUCCESS;
-      free (temp);
-      return j;
-    }
-
-  if (list == 0)
-    return (EXECUTION_SUCCESS);
-
-  /* Change to the directory in list->word->word.  Save the current
-     directory on the top of the stack. */
-  current_directory = get_working_directory ("pushd");
-  if (current_directory == 0)
-    return (EXECUTION_FAILURE);
-
-  j = ((flags & NOCD) == 0) ? cd_builtin (list) : EXECUTION_SUCCESS;
-  if (j == EXECUTION_SUCCESS)
-    {
-      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
-    {
-      free (current_directory);
-      return (EXECUTION_FAILURE);
-    }
-}
-
-/* Pop the directory stack, and then change to the new top of the stack.
-   If LIST is non-null it should consist of a word +N or -N, which says
-   what element to delete from the stack.  The default is the top one. */
-int
-popd_builtin (list)
-     WORD_LIST *list;
-{
-  register int i;
-  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'))
-        {
-          flags |= NOCD;
-        }
-      else if (ISOPTION (list->word->word, '-'))
-        {
-          list = list->next;
-          break;
-        }
-      else if (((direction = list->word->word[0]) == '+') || direction == '-')
-       {
-         if (legal_number (list->word->word + 1, &which) == 0)
-           {
-             builtin_error (m_badarg, list->word->word);
-             builtin_usage ();
-             return (EXECUTION_FAILURE);
-           }
-         which_word = list->word->word;
-       }
-      else if (*list->word->word == '-')
-       {
-         bad_option (list->word->word);
-         builtin_usage ();
-         return (EXECUTION_FAILURE);
-       }
-      else
-       break;
-    }
-
-  if (which > directory_list_offset || (directory_list_offset == 0 && which == 0))
-    {
-      pushd_error (directory_list_offset, which_word ? which_word : "");
-      return (EXECUTION_FAILURE);
-    }
-
-  /* Handle case of no specification, or top of stack specification. */
-  if ((direction == '+' && which == 0) ||
-      (direction == '-' && which == directory_list_offset))
-    {
-      i = ((flags & NOCD) == 0) ? cd_to_string (pushd_directory_list[directory_list_offset - 1])
-                               : EXECUTION_SUCCESS;
-      if (i != EXECUTION_SUCCESS)
-       return (i);
-      free (pushd_directory_list[--directory_list_offset]);
-    }
-  else
-    {
-      /* Since an offset other than the top directory was specified,
-        remove that directory from the list and shift the remainder
-        of the list into place. */
-      i = (direction == '+') ? directory_list_offset - which : which;
-      free (pushd_directory_list[i]);
-      directory_list_offset--;
-
-      /* Shift the remainder of the list into place. */
-      for (; i < directory_list_offset; i++)
-       pushd_directory_list[i] = pushd_directory_list[i + 1];
-    }
-
-  dirs_builtin ((WORD_LIST *)NULL);
-  return (EXECUTION_SUCCESS);
-}
-
-/* Print the current list of directories on the directory stack. */
-int
-dirs_builtin (list)
-     WORD_LIST *list;
-{
-  int flags, desired_index, index_flag, vflag;
-  long i;
-  char *temp, *w;
-
-  for (flags = vflag = index_flag = 0, desired_index = -1, w = ""; list; list = list->next)
-    {
-      if (ISOPTION (list->word->word, 'l'))
-       {
-         flags |= LONGFORM;
-       }
-      else if (ISOPTION (list->word->word, 'c'))
-       {
-         flags |= CLEARSTAK;
-       }
-      else if (ISOPTION (list->word->word, 'v'))
-       {
-         vflag |= 2;
-       }
-      else if (ISOPTION (list->word->word, 'p'))
-       {
-         vflag |= 1;
-       }
-      else if (ISOPTION (list->word->word, '-'))
-        {
-          list = list->next;
-          break;
-        }
-      else if (*list->word->word == '+' || *list->word->word == '-')
-        {
-          int sign;
-          if (legal_number (w = list->word->word + 1, &i) == 0)
-           {
-             builtin_error (m_badarg, list->word->word);
-             builtin_usage ();
-             return (EXECUTION_FAILURE);
-           }
-         sign = (*list->word->word == '+') ? 1 : -1;
-         desired_index = get_dirstack_index (i, sign, &index_flag);
-       }
-      else
-       {
-         bad_option (list->word->word);
-         builtin_usage ();
-         return (EXECUTION_FAILURE);
-       }
-    }
-
-  if (flags & CLEARSTAK)
-    {
-      clear_directory_stack ();
-      return (EXECUTION_SUCCESS);
-    }
-
-  if (index_flag && (desired_index < 0 || desired_index > directory_list_offset))
-    {
-      pushd_error (directory_list_offset, w);
-      return (EXECUTION_FAILURE);
-    }
-
-#define DIRSTACK_FORMAT(temp) \
-  (flags & LONGFORM) ? temp : polite_directory_format (temp)
-
-  /* The first directory printed is always the current working directory. */
-  if (index_flag == 0 || (index_flag == 1 && desired_index == 0))
-    {
-      temp = get_working_directory ("dirs");
-      if (temp == 0)
-       temp = savestring ("<no current directory>");
-      if (vflag & 2)
-       printf ("%2d  %s", 0, DIRSTACK_FORMAT (temp));
-      else
-       printf ("%s", DIRSTACK_FORMAT (temp));
-      free (temp);
-      if (index_flag)
-       {
-         putchar ('\n');
-         return EXECUTION_SUCCESS;
-       }
-    }
-
-#define DIRSTACK_ENTRY(i) \
-  (flags & LONGFORM) ? pushd_directory_list[i] \
-                    : polite_directory_format (pushd_directory_list[i])
-
-  /* Now print the requested directory stack entries. */
-  if (index_flag)
-    {
-      if (vflag & 2)
-       printf ("%2d  %s", directory_list_offset - desired_index,
-                          DIRSTACK_ENTRY (desired_index));
-      else
-       printf ("%s", DIRSTACK_ENTRY (desired_index));
-    }
-  else
-    for (i = directory_list_offset - 1; i >= 0; i--)
-      if (vflag >= 2)
-       printf ("\n%2d  %s", directory_list_offset - (int)i, DIRSTACK_ENTRY (i));
-      else
-       printf ("%s%s", (vflag & 1) ? "\n" : " ", DIRSTACK_ENTRY (i));
-
-  putchar ('\n');
-  fflush (stdout);
-  return (EXECUTION_SUCCESS);
-}
-
-static void
-pushd_error (offset, arg)
-     int offset;
-     char *arg;
-{
-  if (offset == 0)
-    builtin_error ("directory stack empty");
-  else if (arg)
-    builtin_error ("%s: bad directory stack index", arg);
-  else
-    builtin_error ("bad directory stack index");
-}
-
-static void
-clear_directory_stack ()
-{
-  register int i;
-
-  for (i = 0; i < directory_list_offset; i++)
-    free (pushd_directory_list[i]);
-  directory_list_offset = 0;
-}
-
-/* Switch to the directory in NAME.  This uses the cd_builtin to do the work,
-   so if the result is EXECUTION_FAILURE then an error message has already
-   been printed. */
-static int
-cd_to_string (name)
-     char *name;
-{
-  WORD_LIST *tlist;
-  int result;
-
-  tlist = make_word_list (make_word (name), NULL);
-  result = cd_builtin (tlist);
-  dispose_words (tlist);
-  return (result);
-}
-
-static int
-change_to_temp (temp)
-     char *temp;
-{
-  int tt;
-
-  tt = temp ? cd_to_string (temp) : EXECUTION_FAILURE;
-
-  if (tt == EXECUTION_SUCCESS)
-    dirs_builtin ((WORD_LIST *)NULL);
-
-  return (tt);
-}
-
-static void
-add_dirstack_element (dir)
-     char *dir;
-{
-  int j;
-
-  if (directory_list_offset == directory_list_size)
-    {
-      j = (directory_list_size += 10) * sizeof (char *);
-      pushd_directory_list = (char **)xrealloc (pushd_directory_list, j);
-    }
-  pushd_directory_list[directory_list_offset++] = dir;
-}
-
-static int
-get_dirstack_index (ind, sign, indexp)
-     int ind, sign, *indexp;
-{
-  if (indexp)
-    *indexp = sign > 0 ? 1 : 2;
-
-  /* dirs +0 prints the current working directory. */
-  /* dirs -0 prints last element in directory stack */
-  if (ind == 0 && sign > 0)
-    return 0;
-  else if (ind == directory_list_offset)
-    {
-      if (indexp)
-       *indexp = sign > 0 ? 2 : 1;
-      return 0;
-    }
-  else
-    return (sign > 0 ? directory_list_offset - ind : ind);
-}
-
-char *
-get_dirstack_element (ind, sign)
-     int ind, sign;
-{
-  int i;
-
-  i = get_dirstack_index (ind, sign, (int *)NULL);
-  return (i < 0 || i > directory_list_offset) ? (char *)NULL
-                                             : pushd_directory_list[i];
-}
-
-void
-set_dirstack_element (ind, sign, value)
-     int ind, sign;
-     char *value;
-{
-  int i;
-
-  i = get_dirstack_index (ind, sign, (int *)NULL);
-  if (ind == 0 || i < 0 || i > directory_list_offset)
-    return;
-  free (pushd_directory_list[i]);
-  pushd_directory_list[i] = savestring (value);
-}
-
-WORD_LIST *
-get_directory_stack ()
-{
-  register int i;
-  WORD_LIST *ret;
-  char *d, *t;
-
-  for (ret = (WORD_LIST *)NULL, i = 0; i < directory_list_offset; i++)
-    {
-      d = polite_directory_format (pushd_directory_list[i]);
-      ret = make_word_list (make_word (d), ret);
-    }
-  /* Now the current directory. */
-  d = get_working_directory ("dirstack");
-  i = 0;       /* sentinel to decide whether or not to free d */
-  if (d == 0)
-    d = ".";
-  else
-    {
-      t = polite_directory_format (d);
-      /* polite_directory_format sometimes returns its argument unchanged.
-        If it does not, we can free d right away.  If it does, we need to
-        mark d to be deleted later. */
-      if (t != d)
-       {
-         free (d);
-         d = t;
-       }
-      else /* t == d, so d is what we want */
-       i = 1;
-    }
-  ret = make_word_list (make_word (d), ret);
-  if (i)
-    free (d);
-  return ret;  /* was (REVERSE_LIST (ret, (WORD_LIST *)); */
-}
-
-static char *dirs_doc[] = {
-  "Display the list of currently remembered directories.  Directories",
-  "find their way onto the list with the `pushd' command; you can get",
-  "back up through the list with the `popd' command.",
-  "",
-  "The -l flag specifies that `dirs' should not print shorthand versions",
-  "of directories which are relative to your home directory.  This means",
-  "that `~/bin' might be displayed as `/homes/bfox/bin'.  The -v flag",
-  "causes `dirs' to print the directory stack with one entry per line,",
-  "prepending the directory name with its position in the stack.  The -p",
-  "flag does the same thing, but the stack position is not prepended.",
-  "The -c flag clears the directory stack by deleting all of the elements.",
-  "",
-  "+N   displays the Nth entry counting from the left of the list shown by",
-  "     dirs when invoked without options, starting with zero.",
-  "",
-  "-N   displays the Nth entry counting from the right of the list shown by",
-  "     dirs when invoked without options, starting with zero.",
-  (char *)NULL
-};
-
-static char *pushd_doc[] = {
-  "Adds a directory to the top of the directory stack, or rotates",
-  "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', starting with"
-  "     zero) is at the top.",
-  "",
-  "-N   Rotates the stack so that the Nth directory (counting",
-  "     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.",
-  "",
-  "dir  adds DIR to the directory stack at the top, making it the",
-  "     new current working directory.",
-  "",
-  "You can see the directory stack with the `dirs' command.",
-  (char *)NULL
-};
-
-static char *popd_doc[] = {
-  "Removes entries from the directory stack.  With no arguments,",
-  "removes the top directory from the stack, and cd's to the new",
-  "top directory.",
-  "",
-  "+N   removes the Nth entry counting from the left of the list",
-  "     shown by `dirs', starting with zero.  For example: `popd +0'",
-  "     removes the first directory, `popd +1' the second.",   
-  "",
-  "-N   removes the Nth entry counting from the right of the list",
-  "     shown by `dirs', starting with zero.  For example: `popd -0'",
-  "     removes the last directory, `popd -1' the next to last.",
-  "",
-  "-n   suppress the normal change of directory when removing directories",
-  "     from the stack, so only the stack is manipulated.",
-  "",
-  "You can see the directory stack with the `dirs' command.",
-  (char *)NULL
-};
-
-struct builtin pushd_struct = {
-       "pushd",
-       pushd_builtin,
-       BUILTIN_ENABLED,
-       pushd_doc,
-       "pushd [+N | -N] [-n] [dir]",
-       0
-};
-
-struct builtin popd_struct = {
-       "popd",
-       popd_builtin,
-       BUILTIN_ENABLED,
-       popd_doc,
-       "popd [+N | -N] [-n]",
-       0
-};
-
-struct builtin dirs_struct = {
-       "dirs",
-       dirs_builtin,
-       BUILTIN_ENABLED,
-       dirs_doc,
-       "dirs [-clpv] [+N] [-N]",
-       0
-};
index 57f2cb6053fa451531675d7b20cfdf795e28923c..8ae4bc9bb1d011b0b92704951b8e62376bb50551 100644 (file)
@@ -60,6 +60,8 @@ long  sec, usec;
 /*
  * An incredibly simplistic floating point converter.
  */
+static int multiplier[7] = { 1, 100000, 10000, 1000, 100, 10, 1 };
+
 static int
 convert(s, sp, usp)
 char   *s;
@@ -95,18 +97,11 @@ long        *sp, *usp;
        }
 
        /* Now convert to millionths */
-       if (n == 1)
-               usec *= 100000;
-       else if (n == 2)
-               usec *= 10000;
-       else if (n == 3)
-               usec *= 1000;
-       else if (n == 4)
-               usec *= 100;
-       else if (n == 5)
-               usec *= 10;
-       else if (n == 6 && p[6] && isdigit(p[6]) && p[6] >= '5')        
+       usec *= multiplier[n];
+
+       if (n == 6 && p[6] && isdigit(p[6]) && p[6] >= '5')     
                usec++;                 /* round up 1 */
+
        RETURN(1);
 }
 
diff --git a/examples/loadables/sync.c b/examples/loadables/sync.c
new file mode 100644 (file)
index 0000000..44d4e09
--- /dev/null
@@ -0,0 +1,32 @@
+/* sync - sync the disks by forcing pending filesystem writes to complete */
+
+#include <config.h>
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include "builtins.h"
+#include "shell.h"
+#include "bashgetopt.h"
+
+sync_builtin (list)
+     WORD_LIST *list;
+{
+  sync();
+  return (EXECUTION_SUCCESS);
+}
+
+char *sync_doc[] = {
+       "force completion of pending disk writes",
+       (char *)NULL
+};
+
+struct builtin sync_struct = {
+       "sync",                 /* builtin name */
+       sync_builtin,           /* function implementing the builtin */
+       BUILTIN_ENABLED,        /* initial flags for builtin */
+       sync_doc,               /* array of long documentation strings. */
+       "sync",                 /* usage synopsis; becomes short_doc */
+       0                       /* reserved for internal use */
+};
diff --git a/examples/loadables/template.c b/examples/loadables/template.c
new file mode 100644 (file)
index 0000000..7bb3f9f
--- /dev/null
@@ -0,0 +1,56 @@
+/* template - example template for loadable builtin */
+
+/* See Makefile for compilation details. */
+
+#include <config.h>
+
+#if defined (HAVE_UNISTD_H)
+#  include <unistd.h>
+#endif
+#include "bashansi.h"
+#include <stdio.h>
+#include <errno.h>
+
+#include "builtins.h"
+#include "shell.h"
+#include "bashgetopt.h"
+
+#if !defined (errno)
+extern int errno;
+#endif
+
+extern char *strerror ();
+
+template_builtin (list)
+     WORD_LIST *list;
+{
+  int opt, rval;
+
+  rval = EXECUTION_SUCCESS;
+  reset_internal_getopt ();
+  while ((opt = internal_getopt (list, "")) != -1)
+    {
+      switch (opt)
+       {
+       default:
+         builtin_usage ();
+         return (EX_USAGE);
+       }
+    }
+  list = loptend;
+
+  return (rval);
+}
+
+char *template_doc[] = {
+       (char *)NULL
+};
+
+struct builtin template_struct = {
+       "template",                     /* builtin name */
+       template_builtin,               /* function implementing the builtin */
+       BUILTIN_ENABLED,                /* initial flags for builtin */
+       template_doc,                   /* array of long documentation strings. */
+       "template",                     /* usage synopsis; becomes short_doc */
+       0                               /* reserved for internal use */
+};
diff --git a/examples/loadables/uname.c b/examples/loadables/uname.c
new file mode 100644 (file)
index 0000000..9f450cd
--- /dev/null
@@ -0,0 +1,139 @@
+/*
+ * uname - print system information
+ *
+ * usage: uname [-amnrsv]
+ *
+ */
+
+#include <config.h>
+#include <stdio.h>
+
+#include "bashtypes.h"
+
+#if defined (HAVE_UNAME)
+#  include <sys/utsname.h>
+#else
+struct utsname {
+       char    sysname[32];
+       char    nodename[32];
+       char    release[32];
+       char    version[32];
+       char    machine[32];
+};
+#endif
+
+#include <errno.h>
+
+#include "builtins.h"
+#include "shell.h"
+#include "bashgetopt.h"
+
+#define FLAG_SYSNAME   0x01    /* -s */
+#define FLAG_NODENAME  0x02    /* -n */
+#define FLAG_RELEASE   0x04    /* -r */
+#define FLAG_VERSION   0x08    /* -v */
+#define FLAG_MACHINE   0x10    /* -m, -p */
+
+#define FLAG_ALL       0x1f
+
+#ifndef errno
+extern int errno;
+#endif
+
+static void uprint();
+
+static int uname_flags;
+
+uname_builtin (list)
+     WORD_LIST *list;
+{
+  int opt, r;
+  struct utsname uninfo;
+
+  uname_flags = 0;
+  reset_internal_getopt ();
+  while ((opt = internal_getopt (list, "amnprsv")) != -1)
+    {
+      switch (opt)
+       {
+       case 'a':
+         uname_flags |= FLAG_ALL;
+         break;
+       case 'm':
+       case 'p':
+         uname_flags |= FLAG_MACHINE;
+         break;
+       case 'n':
+         uname_flags |= FLAG_NODENAME;
+         break;
+       case 'r':
+         uname_flags |= FLAG_RELEASE;
+         break;
+       case 's':
+         uname_flags |= FLAG_SYSNAME;
+         break;
+       case 'v':
+         uname_flags |= FLAG_VERSION;
+         break;
+       default:
+         builtin_usage ();
+         return (EX_USAGE);
+       }
+    }
+  list = loptend;
+
+  if (list)
+    {
+      builtin_usage ();
+      return (EX_USAGE);
+    }
+
+  if (uname_flags == 0)
+    uname_flags = FLAG_SYSNAME;
+
+  /* Only ancient systems will not have uname(2). */
+#ifdef HAVE_UNAME
+  if (uname (&uninfo) < 0)
+    {
+      builtin_error ("cannot get system name: %s", strerror (errno));
+      return (EXECUTION_FAILURE);
+    }
+#else
+  builtin_error ("cannot get system information: uname(2) not available");
+  return (EXECUTION_FAILURE);
+#endif
+
+  uprint (FLAG_SYSNAME, uninfo.sysname);
+  uprint (FLAG_NODENAME, uninfo.nodename);
+  uprint (FLAG_RELEASE, uninfo.release);
+  uprint (FLAG_VERSION, uninfo.version);
+  uprint (FLAG_MACHINE, uninfo.machine);
+
+  return (EXECUTION_SUCCESS);
+}
+
+static void
+uprint (flag, info)
+     int flag;
+     char *info;
+{
+  if (uname_flags & flag)
+    {
+      uname_flags &= ~flag;
+      printf ("%s%c", info, uname_flags ? ' ' : '\n');
+    }
+}
+
+char *uname_doc[] = {
+       "display information about the system",
+       (char *)NULL
+};
+
+struct builtin uname_struct = {
+       "uname",
+       uname_builtin,
+       BUILTIN_ENABLED,
+       uname_doc,
+       "uname [-amnrsv]",
+       0
+};
diff --git a/examples/loadables/unlink.c b/examples/loadables/unlink.c
new file mode 100644 (file)
index 0000000..8c81ad0
--- /dev/null
@@ -0,0 +1,52 @@
+/* unlink - remove a directory entry */
+
+/* Should only be used to remove directories by a superuser prepared to let
+   fsck clean up the file system. */
+
+#include <config.h>
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include <stdio.h>
+#include <errno.h>
+
+#include "builtins.h"
+#include "shell.h"
+
+#ifndef errno
+extern int errno;
+#endif
+
+unlink_builtin (list)
+     WORD_LIST *list;
+{
+  if (list == 0)
+    {
+      builtin_usage ();
+      return (EX_USAGE);
+    }
+
+  if (unlink (list->word->word) != 0)
+    {
+      builtin_error ("%s: cannot unlink: %s", list->word->word, strerror (errno));
+      return (EXECUTION_FAILURE);
+    }
+
+  return (EXECUTION_SUCCESS);
+}
+
+char *unlink_doc[] = {
+       "Remove a directory entry.",
+       (char *)NULL
+};
+
+struct builtin unlink_struct = {
+       "unlink",               /* builtin name */
+       unlink_builtin,         /* function implementing the builtin */
+       BUILTIN_ENABLED,        /* initial flags for builtin */
+       unlink_doc,             /* array of long documentation strings. */
+       "unlink name",          /* usage synopsis; becomes short_doc */
+       0                       /* reserved for internal use */
+};
diff --git a/examples/loadables/whoami.c b/examples/loadables/whoami.c
new file mode 100644 (file)
index 0000000..41fd5c4
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * whoami - print out username of current user
+ */
+
+#include <config.h>
+#include <stdio.h>
+
+#include "builtins.h"
+#include "shell.h"
+#include "bashgetopt.h"
+
+whoami_builtin (list)
+     WORD_LIST *list;
+{
+  int opt;
+
+  reset_internal_getopt ();
+  while ((opt = internal_getopt (list, "")) != -1)
+    {
+      switch (opt)
+       {
+       default:
+         builtin_usage ();
+         return (EX_USAGE);
+       }
+    }
+  list = loptend;
+  if (list)
+    {
+      builtin_usage ();
+      return (EX_USAGE);
+    }
+
+  if (current_user.user_name == 0)
+    get_current_user_info ();
+  printf ("%s\n", current_user.user_name);
+  return (EXECUTION_SUCCESS);
+}
+
+char *whoami_doc[] = {
+       "display name of current user",
+       (char *)NULL
+};
+
+struct builtin whoami_struct = {
+       "whoami",
+       whoami_builtin,
+       BUILTIN_ENABLED,
+       whoami_doc,
+       "whoami",
+       0
+};
index cb92ee0a16db7dceaa1b39d263c033bb30eb139f..3fbe877dbc52950cee1e008e773ca5b4432d9e21 100755 (executable)
@@ -1,8 +1,8 @@
 #! /bin/bash
 #
-# alias-conv.sh - convert csh aliases to bash aliases and functions
+# aliasconv.bash - convert csh aliases to bash aliases and functions
 #
-# usage: alias-conv.sh
+# usage: aliasconv.bash
 #
 # Chet Ramey
 # chet@po.cwru.edu
@@ -27,7 +27,11 @@ mkalias ()
 }
 EOF
 
-sed "s/^\([a-zA-Z0-9_-]*\)$T\(.*\)$/mkalias \1 '\2'/" >>/tmp/cb$$.1
+# the first thing we want to do is to protect single quotes in the alias,
+# since they whole thing is going to be surrounded by single quotes when
+# passed to mkalias
+
+sed -e "s:':\\'\\\'\\':" -e "s/^\([a-zA-Z0-9_-]*\)$T\(.*\)$/mkalias \1 '\2'/" >>/tmp/cb$$.1
 
 $BASH /tmp/cb$$.1 | sed -e 's/\$cwd/\$PWD/g' \
                     -e 's/\$term/\$TERM/g' \
index 4cbebfb44db2c48f7db263068d9a03b39fd384c4..29e1ead9c5a4cf8d1be23606a8f5b3319d65d230 100755 (executable)
@@ -1,8 +1,8 @@
 #! /bin/bash
 #
-# alias-conv.sh - convert csh aliases to bash aliases and functions
+# aliasconv.sh - convert csh aliases to bash aliases and functions
 #
-# usage: alias-conv.sh
+# usage: aliasconv.sh
 #
 # Chet Ramey
 # chet@po.cwru.edu
@@ -27,7 +27,11 @@ mkalias ()
 }
 EOF
 
-sed "s/^\([a-zA-Z0-9_-]*\)$T\(.*\)$/mkalias \1 '\2'/" >>/tmp/cb$$.1
+# the first thing we want to do is to protect single quotes in the alias,
+# since they whole thing is going to be surrounded by single quotes when
+# passed to mkalias
+
+sed -e "s:':\\'\\\'\\':" -e "s/^\([a-zA-Z0-9_-]*\)$T\(.*\)$/mkalias \1 '\2'/" >>/tmp/cb$$.1
 
 sh /tmp/cb$$.1 | sed -e 's/\$cwd/\$PWD/g' \
                     -e 's/\$term/\$TERM/g' \
index a6d2eaa3e35c1c02dde8fe0d8cb967de6b51665b..4e2239396a7e74285e9371157f2f2c721eb5d31f 100755 (executable)
@@ -90,6 +90,11 @@ ash_lk(){ echo " $1 " | fgrep " $2 " >&- 2>&-; }
 ash_pr(){ echo $* | tr ' ' '\012' | pr -5 -t -w75 -l$[ ( $# + 4 ) / 5 ]; }
 ash_rm(){ echo " $1 " | sed -e "s/ $2 / /" -e 's/^ //' -e 's/ $//'; }
 
+# enable history, bang history expansion, and emacs editing
+set -o history
+set -o histexpand
+set -o emacs
+
 cd
 LIM=.limbo                     # $HOME/$LIM contains "destroyed" objects
 mkdir $LIM >&- 2>&-
@@ -164,8 +169,7 @@ do  room=`pwd`
                prev=$room
        fi
 
-       echo -n '-advsh> '                      # prompt
-       read verb obj x
+       read -e -p '-advsh> ' verb obj x        # prompt is '-advsh> '
        if [ $? != 0 ]
        then    verb=quit               # EOF
        fi
index 8f9d9a7ec43b9927a1d1255fe3780774583dcbef..f2a2392814e0b1ee80e16065d03565da97c13a43 100644 (file)
@@ -737,6 +737,13 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
               commands, this causes the last simple command in
               the function to be waited for twice. */
              exec_result = wait_for (last_made_pid);
+#if defined (RECYCLES_PIDS)
+             /* LynxOS, for one, recycles pids very quickly -- so quickly
+                that a new process may have the same pid as the last one
+                created.  This has been reported to fix the problem. */
+             if (exec_result == 0)
+               last_made_pid = NO_PID;
+#endif
          }
       }
 
@@ -863,8 +870,7 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
       break;
 
     default:
-      programming_error
-       ("execute_command: bad command type `%d'", command->type);
+      command_error ("execute_command", CMDERR_BADTYPE, command->type, 0);
     }
 
   if (my_undo_list)
@@ -905,7 +911,10 @@ difftimeval (d, t1, t2)
       d->tv_usec += 1000000;
       d->tv_sec -= 1;
       if (d->tv_sec < 0)               /* ??? -- BSD/OS does this */
-       d->tv_sec = 0;
+       {
+         d->tv_sec = 0;
+         d->tv_usec = 0;
+       }
     }
   return d;
 }
@@ -916,7 +925,7 @@ addtimeval (d, t1, t2)
 {
   d->tv_sec = t1->tv_sec + t2->tv_sec;
   d->tv_usec = t1->tv_usec + t2->tv_usec;
-  if (d->tv_usec > 1000000)
+  if (d->tv_usec >= 1000000)
     {
       d->tv_usec -= 1000000;
       d->tv_sec += 1;
@@ -1472,7 +1481,7 @@ execute_connection (command, asynchronous, pipe_in, pipe_out, fds_to_close)
       break;
 
     default:
-      programming_error ("execute_connection: bad connector `%d'", command->value.Connection->connector);
+      command_error ("execute_connection", CMDERR_BADCONN, command->value.Connection->connector, 0);
       jump_to_top_level (DISCARD);
       exec_result = EXECUTION_FAILURE;
     }
@@ -2062,7 +2071,7 @@ execute_arith_command (arith_command)
 
   result = 0;
 
-  this_command_name = "((";
+  this_command_name = "((";    /* )) */
   /* If we're in a function, update the line number information. */
   if (variable_context)
     line_number = arith_command->line - function_line_number;
@@ -2092,7 +2101,7 @@ static int
 execute_cond_node (cond)
      COND_COM *cond;
 {
-  int result, invert, patmatch;
+  int result, invert, patmatch, flags;
   char *arg1, *arg2, *print2;
 
   invert = (cond->flags & CMD_INVERT_RETURN);
@@ -2124,8 +2133,9 @@ execute_cond_node (cond)
     }
   else if (cond->type == COND_BINARY)
     {
-      patmatch = (cond->op->word[1] == '=') && (cond->op->word[2] == '\0') &&
-                 (cond->op->word[0] == '!' || cond->op->word[0] == '=');
+      patmatch = ((cond->op->word[1] == '=') && (cond->op->word[2] == '\0') &&
+                 (cond->op->word[0] == '!' || cond->op->word[0] == '=') ||
+                 (cond->op->word[0] == '=' && cond->op->word[1] == '\0'));
 
       arg1 = cond_expand_word (cond->left->op, 0);
       if (arg1 == 0)
@@ -2147,7 +2157,7 @@ execute_cond_node (cond)
     }
   else
     {
-      programming_error ("execute_cond_node: %d: unknown conditional command type", cond->type);
+      command_error ("execute_cond_node", CMDERR_BADTYPE, cond->type, 0);
       jump_to_top_level (DISCARD);
       result = EXECUTION_FAILURE;
     }
@@ -2262,7 +2272,7 @@ fix_assignment_words (words)
 
   for (w = words; w; w = w->next)
     if (w->word->flags & W_ASSIGNMENT)
-      w->word->flags |= W_NOSPLIT;
+      w->word->flags |= (W_NOSPLIT|W_NOGLOB);
 }
 
 /* The meaty part of all the executions.  We have to start hacking the
@@ -2277,7 +2287,7 @@ execute_simple_command (simple_command, pipe_in, pipe_out, async, fds_to_close)
   WORD_LIST *words, *lastword;
   char *command_line, *lastarg, *temp;
   int first_word_quoted, result, builtin_is_special, already_forked, dofork;
-  pid_t old_last_command_subst_pid;
+  pid_t old_last_command_subst_pid, old_last_async_pid;
   Function *builtin;
   SHELL_VAR *func;
 
@@ -2297,6 +2307,7 @@ execute_simple_command (simple_command, pipe_in, pipe_out, async, fds_to_close)
     simple_command->words ? (simple_command->words->word->flags & W_QUOTED): 0;
 
   old_last_command_subst_pid = last_command_subst_pid;
+  old_last_async_pid = last_asynchronous_pid;
 
   already_forked = dofork = 0;
 
@@ -2327,6 +2338,7 @@ execute_simple_command (simple_command, pipe_in, pipe_out, async, fds_to_close)
          do_piping (pipe_in, pipe_out);
          pipe_in = pipe_out = -1;
 
+         last_asynchronous_pid = old_last_async_pid;
          subshell_environment = async ? SUBSHELL_ASYNC : SUBSHELL_FORK;
        }
       else
@@ -2770,11 +2782,14 @@ execute_subshell_builtin_or_function (words, redirects, builtin, var,
      struct fd_bitmap *fds_to_close;
      int flags;
 {
-  int result, r;
+  int result, r, jobs_hack;
 
   /* A subshell is neither a login shell nor interactive. */
   login_shell = interactive = 0;
 
+  jobs_hack = (builtin == jobs_builtin) &&
+               ((subshell_environment & SUBSHELL_ASYNC) == 0 || pipe_out != NO_PIPE);
+
   subshell_environment = SUBSHELL_ASYNC;
 
   maybe_make_export_env ();    /* XXX - is this needed? */
@@ -2785,8 +2800,7 @@ execute_subshell_builtin_or_function (words, redirects, builtin, var,
      the shell itself. */
 
   /* Allow the output of `jobs' to be piped. */
-  if (builtin == jobs_builtin && !async &&
-      (pipe_out != NO_PIPE || pipe_in != NO_PIPE))
+  if (jobs_hack)
     kill_current_pipeline ();
   else
     without_job_control ();
@@ -2898,6 +2912,10 @@ execute_builtin_or_function (words, builtin, var, redirects,
 void
 setup_async_signals ()
 {
+#if defined (__BEOS__)
+  set_signal_handler (SIGHUP, SIG_IGN);        /* they want csh-like behavior */
+#endif
+
 #if defined (JOB_CONTROL)
   if (job_control == 0)
 #endif
index 4a48432224bb8ae4f81b380fea6a22e5325c4ba4..4d56cbe3414ce775b567cc450539a1b4bf5541ac 100644 (file)
--- a/externs.h
+++ b/externs.h
@@ -49,6 +49,7 @@ extern void disable_priv_mode __P((void));
 extern void unbind_args __P((void));
 
 #if defined (RESTRICTED_SHELL)
+extern int shell_is_restricted __P((char *));
 extern int maybe_make_restricted __P((char *));
 #endif
 
@@ -116,6 +117,7 @@ extern char *getcwd __P((char *, size_t));
 #endif
 
 /* Declarations for functions defined in lib/sh/itos.c */
+extern char *inttostr __P((int, char *, int));
 extern char *itos __P((int));
 
 /* Declarations for  functions defined in lib/sh/oslib.c */
diff --git a/flags.c b/flags.c
index 34924b9b412a4857994552d6696f60a1c221aad0..19cd3b4eef3e4709058a6dd4b80806b0054bd99b 100644 (file)
--- a/flags.c
+++ b/flags.c
@@ -129,7 +129,8 @@ int interactive_comments = 1;
    disallows: changing directories, command or path names containing `/',
    unsetting or resetting the values of $PATH and $SHELL, and any type of
    output redirection. */
-int restricted = 0;
+int restricted = 0;            /* currently restricted */
+int restricted_shell = 0;      /* shell was started in restricted mode. */
 #endif /* RESTRICTED_SHELL */
 
 /* Non-zero means that this shell is running in `privileged' mode.  This
diff --git a/flags.h b/flags.h
index 7d267992e0a5922ada58fdc7f0afcd421508ce5d..dbab8ac333099cf758c6b30f1c3f5dc955e8e6ce 100644 (file)
--- a/flags.h
+++ b/flags.h
@@ -61,6 +61,7 @@ extern int history_expansion;
 
 #if defined (RESTRICTED_SHELL)
 extern int restricted;
+extern int restricted_shell;
 #endif /* RESTRICTED_SHELL */
 
 extern int *find_flag __P((int));
index 68685d6ca1856686ea51f2b3329577d7bd4b7b14..5b978dcf82fc565fc9fd03795c53d53045850541 100644 (file)
--- a/general.c
+++ b/general.c
@@ -152,6 +152,13 @@ timeval_to_secs (tvp, sp, sfp)
   *sfp = (*sfp * 1000) / 1000000;
   if (rest >= 500)
     *sfp += 1;
+
+  /* Sanity check */
+  if (*sfp >= 1000)
+    {
+      *sp += 1;
+      *sfp -= 1000;
+    }
 }
   
 /* Print the contents of a struct timeval * in a standard way to stdio
@@ -189,6 +196,13 @@ clock_t_to_secs (t, sp, sfp)
   *sfp = (*sfp * 1000) / clk_tck;
 
   *sp = t / clk_tck;
+
+  /* Sanity check */
+  if (*sfp >= 1000)
+    {
+      *sp += 1;
+      *sfp -= 1000;
+    }
 }
 
 /* Print the time defined by a time_t (returned by the `times' and `time'
@@ -347,8 +361,16 @@ unset_nodelay_mode (fd)
     fcntl (fd, F_SETFL, flags);
 }
 
-  /* There is a bug in the NeXT 2.1 rlogind that causes opens
-     of /dev/tty to fail. */
+/* There is a bug in the NeXT 2.1 rlogind that causes opens
+   of /dev/tty to fail. */
+
+#if defined (__BEOS__)
+/* On BeOS, opening in non-blocking mode exposes a bug in BeOS, so turn it
+   into a no-op.  This should probably go away in the future. */
+#  undef O_NONBLOCK
+#  define O_NONBLOCK 0
+#endif /* __BEOS__ */
+
 void
 check_dev_tty ()
 {
@@ -620,11 +642,21 @@ canonicalize_pathname (path)
       result[1] = '\0';
     }
 
-#if 1
-  /* Turn `//' into `/' -- XXX experimental */
-  if (result[0] == '/' && result[1] == '/' && result[2] == '\0')
-    result[1] = '\0';
-#endif
+  /* If the result starts with `//', but the original path does not, we
+     can turn the // into /. */
+  if ((result[0] == '/' && result[1] == '/' && result[2] != '/') &&
+      (path[0] != '/' || path[1] != '/' || path[2] == '/'))
+    {
+      char *r2;
+      if (result[2] == '\0')   /* short-circuit for bare `//' */
+       result[1] = '\0';
+      else
+       {
+         r2 = savestring (result + 1);
+         free (result);
+         result = r2;
+       }
+    }
 
   return (result);
 }
@@ -742,7 +774,8 @@ full_pathname (file)
       return ((char *)NULL);
     }
   dlen = strlen (current_dir);
-  current_dir[dlen++] = '/';
+  if (current_dir[0] == '/' && dlen > 1)
+    current_dir[dlen++] = '/';
 
   /* Turn /foo/./bar into /foo/bar. */
   if (file[0] == '.' && file[1] == '/')
@@ -1054,7 +1087,41 @@ get_group_list (ngp)
       nbuf = itos ((int)group_array[i]);
       group_vector[i] = nbuf;
     }
+
   if (ngp)
     *ngp = ngroups;
   return group_vector;
 }
+
+int *
+get_group_array (ngp)
+     int *ngp;
+{
+  int i;
+  static int *group_iarray = (int *)NULL;
+
+  if (group_iarray)
+    {
+      if (ngp)
+       *ngp = ngroups;
+      return (group_iarray);
+    }
+
+  if (ngroups == 0)
+    initialize_group_array ();    
+
+  if (ngroups <= 0)
+    {
+      if (ngp)
+       *ngp = 0;
+      return (int *)NULL;
+    }
+
+  group_iarray = (int *)xmalloc (ngroups * sizeof (int));
+  for (i = 0; i < ngroups; i++)
+    group_iarray[i] = (int)group_array[i];
+
+  if (ngp)
+    *ngp = ngroups;
+  return group_iarray;
+}
index a7d5bde7be89d2466107c3cb04740c83fee0b209..2bbd0c073c24ebdf3ee7f0a9bcc3e9b0b19e4dbc 100644 (file)
--- a/general.h
+++ b/general.h
@@ -221,5 +221,6 @@ extern char *bash_tilde_expand __P((char *));
 
 extern int group_member __P((gid_t));
 extern char **get_group_list __P((int *));
+extern int *get_group_array __P((int *));
 
 #endif /* _GENERAL_H_ */
index e370fbe02d937f8aab8f1880ad766b4eb9eb8efc..b9cf95babd58a6509b5071fe526d245cae900f3e 100644 (file)
--- a/hashlib.c
+++ b/hashlib.c
@@ -67,6 +67,9 @@ make_hash_table (buckets)
 /* Return the location of the bucket which should contain the data
    for STRING.  TABLE is a pointer to a HASH_TABLE. */
 
+/* A possibly better distribution may be obtained by initializing i to
+   ~0UL and using i = (i * 33) + *string++ as the step */
+
 #define ALL_ONES (~((unsigned long) 0))
 #define BITS(h, n) ((unsigned long)(h) & ~(ALL_ONES << (n)))
 
diff --git a/jobs.c b/jobs.c
index e1340c4dba0b26e359fc14c86c3c71a3c4e81ec7..b9ca743c0d554392ac7a2f76cfbc28a9019ff376 100644 (file)
--- a/jobs.c
+++ b/jobs.c
 extern int errno;
 #endif /* !errno */
 
+#if !defined (CHILD_MAX)
+#  define CHILD_MAX 32
+#endif
+
 /* Take care of system dependencies that must be handled when waiting for
    children.  The arguments to the WAITPID macro match those to the Posix.1
    waitpid() function. */
@@ -543,12 +547,7 @@ cleanup_dead_jobs ()
   BLOCK_CHILD (set, oset);
 
   for (i = 0; i < job_slots; i++)
-#if 0
-    if (jobs[i] && DEADJOB (i) && IS_NOTIFIED (i) &&
-         (interactive_shell || (find_last_pid (i) != last_asynchronous_pid)))
-#else
     if (jobs[i] && DEADJOB (i) && IS_NOTIFIED (i))
-#endif
       delete_job (i, 0);
 
   UNBLOCK_CHILD (oset);
@@ -1150,9 +1149,9 @@ make_child (command, async_p)
     {
       /* In the child.  Give this child the right process group, set the
         signals to the default state for a new process. */
-      pid_t mine;
+      pid_t mypid;
 
-      mine = getpid ();
+      mypid = getpid ();
 #if defined (BUFFERED_INPUT)
       /* Close default_buffered_input if it's > 0.  We don't close it if it's
         0 because that's the file descriptor used when redirecting input,
@@ -1169,7 +1168,7 @@ make_child (command, async_p)
             process group. */
 
          if (pipeline_pgrp == 0)       /* This is the first child. */
-           pipeline_pgrp = mine;
+           pipeline_pgrp = mypid;
 
          /* Check for running command in backquotes. */
          if (pipeline_pgrp == shell_pgrp)
@@ -1185,12 +1184,18 @@ make_child (command, async_p)
             this would have for the first child) is an error.  Section
             B.4.3.3, p. 237 also covers this, in the context of job control
             shells. */
-         if (setpgid (mine, pipeline_pgrp) < 0)
-           sys_error ("child setpgid (%d to %d)", mine, pipeline_pgrp);
+         if (setpgid (mypid, pipeline_pgrp) < 0)
+           sys_error ("child setpgid (%d to %d)", mypid, pipeline_pgrp);
 #if defined (PGRP_PIPE)
-         if (pipeline_pgrp == mine)
+         if (pipeline_pgrp == mypid)
            {
 #endif
+             /* XXX - By convention (and assumption above), if
+                pipeline_pgrp == shell_pgrp, we are making a child for
+                command substitution.
+                In this case, we don't want to give the terminal to the
+                shell's process group (we could be in the middle of a
+                pipeline, for example). */
              if (async_p == 0 && pipeline_pgrp != shell_pgrp)
                give_terminal_to (pipeline_pgrp);
 
@@ -1471,16 +1476,13 @@ wait_for_single_pid (pid)
 
   r = wait_for (pid);
 
-  /* POSIX.2: if we just waited for $!, we can remove the job from the
-     jobs table. */
-  if (pid == last_asynchronous_pid)
-    {
-      BLOCK_CHILD (set, oset);
-      job = find_job (pid);
-      if (job != NO_JOB && jobs[job] && DEADJOB (job))
-       jobs[job]->flags |= J_NOTIFIED;
-      UNBLOCK_CHILD (oset);
-    }
+  /* POSIX.2: if we just waited for a job, we can remove it from the jobs
+     table. */
+  BLOCK_CHILD (set, oset);
+  job = find_job (pid);
+  if (job != NO_JOB && jobs[job] && DEADJOB (job))
+    jobs[job]->flags |= J_NOTIFIED;
+  UNBLOCK_CHILD (oset);
 
   return r;
 }
@@ -1521,6 +1523,11 @@ wait_for_background_pids ()
            break;
          }
     }
+
+  /* POSIX.2 says the shell can discard the statuses of all completed jobs if
+     `wait' is called with no arguments. */
+  mark_dead_jobs_as_notified (1);
+  cleanup_dead_jobs ();
 }
 
 /* Make OLD_SIGINT_HANDLER the SIGINT signal handler. */
@@ -1722,7 +1729,27 @@ wait_for (pid)
     termination_state = process_exit_status (child->status);
 
   if (job == NO_JOB || IS_JOBCONTROL (job))
-    give_terminal_to (shell_pgrp);
+    {
+      /* XXX - under what circumstances is a job not present in the jobs
+        table (job == NO_JOB)?
+               1.  command substitution
+
+        In the case of command substitution, at least, it's probably not
+        the right thing to give the terminal to the shell's process group,
+        even though there is code in subst.c:command_substitute to work
+        around it.
+
+        Things that don't:
+               $PROMPT_COMMAND execution
+               process substitution
+       */
+#if 0
+if (job == NO_JOB)
+  itrace("wait_for: job == NO_JOB, giving the terminal to shell_pgrp (%d)", shell_pgrp);
+#endif
+
+      give_terminal_to (shell_pgrp);
+    }
 
   /* If the command did not exit cleanly, or the job is just
      being stopped, then reset the tty state back to what it
@@ -1775,13 +1802,7 @@ wait_for (pid)
             sure we turn on the notify bit so we don't get an unwanted
             message about the job's termination, and so delete_job really
             clears the slot in the jobs table. */
-#if 0
-         if (DEADJOB (job))
-           jobs[job]->flags |= J_NOTIFIED;
-         cleanup_dead_jobs ();
-#else
          notify_and_cleanup ();
-#endif
        }
     }
 
@@ -1810,15 +1831,12 @@ wait_for_job (job)
   pid = last_pid (job);
   r = wait_for (pid);
 
-  /* POSIX.2: if we just waited for $!, we can remove the job from the
-     jobs table. */
-  if (pid == last_asynchronous_pid)
-    {
-      BLOCK_CHILD (set, oset);
-      if (job != NO_JOB && jobs[job] && DEADJOB (job))
-       jobs[job]->flags |= J_NOTIFIED;
-      UNBLOCK_CHILD (oset);
-    }
+  /* POSIX.2: we can remove the job from the jobs table if we just waited
+     for it. */
+  BLOCK_CHILD (set, oset);
+  if (job != NO_JOB && jobs[job] && DEADJOB (job))
+    jobs[job]->flags |= J_NOTIFIED;
+  UNBLOCK_CHILD (oset);
 
   return r;
 }
@@ -1844,7 +1862,7 @@ notify_and_cleanup ()
 void
 reap_dead_jobs ()
 {
-  mark_dead_jobs_as_notified ();
+  mark_dead_jobs_as_notified (0);
   cleanup_dead_jobs ();
 }
 
@@ -2488,23 +2506,25 @@ notify_of_job_status ()
          s = jobs[job]->pipe->status;
          termsig = WTERMSIG (s);
 
+         /* POSIX.2 says we have to hang onto the statuses of at most the
+            last CHILD_MAX background processes if the shell is running a
+            script.  If the shell is not interactive, don't print anything
+            unless the job was killed by a signal. */
+         if (startup_state == 0 && WIFSIGNALED (s) == 0 &&
+               ((DEADJOB (job) && IS_FOREGROUND (job) == 0) || STOPPED (job)))
+           continue;
+         
          /* If job control is disabled, don't print the status messages.
             Mark dead jobs as notified so that they get cleaned up.  If
             startup_state == 2, we were started to run `-c command', so
-            don't print anything.  If the shell is not interactive, don't
-            print anything unless the job was killed by a signal. */
-         if ((job_control == 0 && interactive_shell) || startup_state == 2 ||
-               (startup_state == 0 && WIFSIGNALED (s) == 0))
+            don't print anything. */
+         if ((job_control == 0 && interactive_shell) || startup_state == 2)
            {
-#if 0
-             if (DEADJOB (job))
-#else
              /* POSIX.2 compatibility:  if the shell is not interactive,
                 hang onto the job corresponding to the last asynchronous
                 pid until the user has been notified of its status or does
                 a `wait'. */
              if (DEADJOB (job) && (interactive_shell || (find_last_pid (job) != last_asynchronous_pid)))
-#endif
                jobs[job]->flags |= J_NOTIFIED;
              continue;
            }
@@ -2516,9 +2536,7 @@ notify_of_job_status ()
            {
            case JDEAD:
              if (interactive_shell == 0 && termsig && WIFSIGNALED (s) &&
-#if 1
                  termsig != SIGINT &&
-#endif
 #if defined (DONT_REPORT_SIGPIPE)
                  termsig != SIGPIPE &&
 #endif
@@ -2943,24 +2961,48 @@ nohup_all_jobs (running_only)
 }
 
 /* Mark all dead jobs as notified, so delete_job () cleans them out
-   of the job table properly. */
+   of the job table properly.  POSIX.2 says we need to save the
+   status of the last CHILD_MAX jobs, so we count the number of dead
+   jobs and mark only enough as notified to save CHILD_MAX statuses. */
 static void
-mark_dead_jobs_as_notified ()
+mark_dead_jobs_as_notified (force)
+     int force;
 {
-  register int i;
+  register int i, ndead;
   sigset_t set, oset;
 
   if (job_slots)
     {
       BLOCK_CHILD (set, oset);
 
+      /* Count the number of dead jobs */
+      for (i = ndead = 0; force == 0 && i < job_slots; i++)
+        {
+          if (jobs[i] && DEADJOB (i))
+           ndead++;
+        }
+
+      /* Don't do anything if the number of jobs is less than CHILD_MAX and
+        we're not forcing a cleanup. */
+      if (force == 0 && ndead <= CHILD_MAX)
+        {
+          UNBLOCK_CHILD (oset);
+          return;
+        }
+
+      /* Mark enough dead jobs as notified that we keep CHILD_MAX jobs in
+         the list.  This isn't exactly right yet; changes need to be made
+         to stop_pipeline so we don't mark the newer jobs after we've
+         created CHILD_MAX slots in the jobs array. */
       for (i = 0; i < job_slots; i++)
-#if 0
-       if (jobs[i] && DEADJOB (i))
-#else
-       if (jobs[i] && DEADJOB (i) && (interactive_shell || (find_last_pid (i) != last_asynchronous_pid)))
-#endif
-         jobs[i]->flags |= J_NOTIFIED;
+        {
+         if (jobs[i] && DEADJOB (i) && (interactive_shell || (find_last_pid (i) != last_asynchronous_pid)))
+           {
+             jobs[i]->flags |= J_NOTIFIED;
+             if (force == 0 && --ndead <= CHILD_MAX)
+               break;
+           }
+        }
 
       UNBLOCK_CHILD (oset);
     }
index 0a4f456db3e49cfe0c9cc05d09ab9c4b11e83a7b..0a596d169f9fa27a59ff9460876068ba5042a3f2 100644 (file)
@@ -16,10 +16,13 @@ INSTALL_DATA = @INSTALL_DATA@
 CC = @CC@
 RANLIB = @RANLIB@
 AR = @AR@
+ARFLAGS = @ARFLAGS@
 RM = rm
 CP = cp
 MV = mv
 
+SHELL = @MAKE_SHELL@
+
 CFLAGS = @CFLAGS@
 LOCAL_CFLAGS = @LOCAL_CFLAGS@
 CPPFLAGS = @CPPFLAGS@
@@ -66,7 +69,7 @@ all: $(LIBRARY_NAME)
 
 $(LIBRARY_NAME): $(OBJECTS)
        $(RM) -f $@
-       $(AR) cr $@ $(OBJECTS)
+       $(AR) $(ARFLAGS) $@ $(OBJECTS)
        -test -n "$(RANLIB)" && $(RANLIB) $@
 
 what-tar:
index 134676ba8f382cbbb4186c9de4024bcc82150c58..b032a6904b35cd4b7148c49292092e311a2b6934 100644 (file)
 #include "collsyms.h"
 #include <ctype.h>
 
+#if defined (HAVE_STRING_H)
+#  include <string.h>
+#else
+#  include <strings.h>
+#endif /* HAVE_STRING_H */
+
 static int gmatch ();
 static char *brackmatch ();
 #ifdef EXTENDED_GLOB
 static int extmatch ();
+static char *patscan ();
 #endif
   
 #if !defined (isascii)
@@ -155,11 +162,17 @@ gmatch (string, se, pattern, pe, flags)
       sc = n < se ? *n : '\0';
 
 #ifdef EXTENDED_GLOB
+      /* extmatch () will handle recursively calling gmatch, so we can
+        just return what extmatch() returns. */
       if ((flags & FNM_EXTMATCH) && *p == '(' &&
          (c == '+' || c == '*' || c == '?' || c == '@' || c == '!')) /* ) */
-       /* extmatch () will handle recursively calling gmatch, so we can
-          just return what extmatch() returns. */
-       return (extmatch (c, n, se, p, pe, flags));
+       {
+         int lflags;
+         /* If we're not matching the start of the string, we're not
+            concerned about the special cases for matching `.' */
+         lflags = (n == string) ? flags : (flags & ~FNM_PERIOD);
+         return (extmatch (c, n, se, p, pe, lflags));
+       }
 #endif
 
       switch (c)
@@ -226,7 +239,23 @@ gmatch (string, se, pattern, pe, flags)
 #ifdef EXTENDED_GLOB
              /* Handle ******(patlist) */
              if ((flags & FNM_EXTMATCH) && c == '*' && *p == '(')  /*)*/
-               return (extmatch (c, n, se, p, pe, flags));
+               {
+                 char *newn;
+                 /* We need to check whether or not the extended glob
+                    pattern matches the remainder of the string.
+                    If it does, we match the entire pattern. */
+                 for (newn = n; newn < se; ++newn)
+                   {
+                     if (extmatch (c, newn, se, p, pe, flags) == 0)
+                       return (0);
+                   }
+                 /* We didn't match the extended glob pattern, but
+                    that's OK, since we can match 0 or more occurrences.
+                    We need to skip the glob pattern and see if we
+                    match the rest of the string. */
+                 newn = patscan (p, pe, 0);
+                 p = newn;
+               }
 #endif
              if (p == pe)
                break;
@@ -245,11 +274,24 @@ gmatch (string, se, pattern, pe, flags)
            c1 = (unsigned char)((flags & FNM_NOESCAPE) == 0 && c == '\\') ? *p : c;
            c1 = FOLD (c1);
            for (--p; n < se; ++n)
-             /* Only call fnmatch if the first character indicates a
-                possible match. */
-             if ((c == '[' || FOLD (*n) == c1) &&
-                 gmatch (n, se, p, pe, flags & ~FNM_PERIOD) == 0)
-               return (0);
+             {
+               /* Only call fnmatch if the first character indicates a
+                  possible match.  We can check the first character if
+                  we're not doing an extended glob match. */
+               if ((flags & FNM_EXTMATCH) == 0 && c != '[' && FOLD (*n) != c1)
+                 continue;
+
+               /* If we're doing an extended glob match and the pattern is not
+                  one of the extended glob patterns, we can check the first
+                  character. */
+               if ((flags & FNM_EXTMATCH) && p[1] != '(' && /*)*/
+                   strchr ("?*+@!", *p) == 0 && c != '[' && FOLD (*n) != c1)
+                 continue;
+
+               /* Otherwise, we just recurse. */
+               if (gmatch (n, se, p, pe, flags & ~FNM_PERIOD) == 0)
+                 return (0);
+             }
            return FNM_NOMATCH;
          }
 
index ac0ba202090122e0c6644cab222fb1083be08c47..5e2cfb1ee713b97ef22ed6f2219c6a315a64e1cb 100644 (file)
@@ -19,6 +19,8 @@ Cambridge, MA 02139, USA.  */
 #ifndef        _FNMATCH_H
 #define        _FNMATCH_H      1
 
+#include "stdc.h"
+
 /* We #undef these before defining them because some losing systems
    (HP-UX A.08.07 for example) define these in <unistd.h>.  */
 #undef  FNM_PATHNAME
@@ -41,6 +43,6 @@ Cambridge, MA 02139, USA.  */
 
 /* Match STRING against the filename pattern PATTERN,
    returning zero if it matches, FNM_NOMATCH if not.  */
-extern int fnmatch();
+extern int fnmatch __P((char *, char *, int));
 
 #endif /* _FNMATCH_H */
index 6a9679fc8365c57027d57eea4e89776752e10ef2..be4e9dc82a5a6b95d61d8f377ad7d99def60607c 100644 (file)
@@ -75,9 +75,9 @@
 #  define REAL_DIR_ENTRY(dp) (dp->d_ino != 0)
 #endif /* _POSIX_SOURCE */
 
-#if !defined (HAVE_BCOPY)
+#if !defined (HAVE_BCOPY) && !defined (bcopy)
 #  define bcopy(s, d, n) ((void) memcpy ((d), (s), (n)))
-#endif /* !HAVE_BCOPY */
+#endif /* !HAVE_BCOPY && !bcopy */
 
 #if defined (SHELL)
 #  include "posixstat.h"
@@ -251,7 +251,7 @@ glob_vector (pat, dir)
   register struct dirent *dp;
   struct globval *lastlink;
   register struct globval *nextlink;
-  register char *nextname;
+  register char *nextname, *npat;
   unsigned int count;
   int lose, skip;
   register char **name_vector;
@@ -297,32 +297,32 @@ glob_vector (pat, dir)
 
       dirlen = strlen (dir);
       nextname = (char *)malloc (dirlen + strlen (pat) + 2);
-      if (nextname == 0)
+      npat = (char *)malloc (strlen (pat) + 1);
+      if (nextname == 0 || npat == 0)
        lose = 1;
       else
        {
+         strcpy (npat, pat);
+         dequote_pathname (npat);
+
          strcpy (nextname, dir);
          nextname[dirlen++] = '/';
-         strcpy (nextname + dirlen, pat);
+         strcpy (nextname + dirlen, npat);
 
          if (GLOB_TESTNAME (nextname) >= 0)
            {
              free (nextname);
              nextlink = (struct globval *)alloca (sizeof (struct globval));
              nextlink->next = (struct globval *)0;
-             nextname = (char *) malloc (strlen (pat) + 1);
-             if (nextname == 0)
-               lose = 1;
-             else
-               {
-                 lastlink = nextlink;
-                 nextlink->name = nextname;
-                 strcpy (nextname, pat);
-                 count = 1;
-               }
+             lastlink = nextlink;
+             nextlink->name = npat;
+             count = 1;
            }
          else
-           free (nextname);
+           {
+             free (nextname);
+             free (npat);
+           }
        }
 
       skip = 1;
@@ -379,6 +379,16 @@ glob_vector (pat, dir)
          if (REAL_DIR_ENTRY (dp) == 0)
            continue;
 
+         /* If a leading dot need not be explicitly matched, and the pattern
+            doesn't start with a `.', don't match `.' or `..' */
+#define dname dp->d_name
+         if (noglob_dot_filenames == 0 && pat[0] != '.' &&
+               (pat[0] != '\\' || pat[1] != '.') &&
+               (dname[0] == '.' &&
+                 (dname[1] == '\0' || (dname[1] == '.' && dname[2] == '\0'))))
+#undef dname
+           continue;
+
          /* If a dot must be explicity matched, check to see if they do. */
          if (noglob_dot_filenames && dp->d_name[0] == '.' && pat[0] != '.' &&
                (pat[0] != '\\' || pat[1] != '.'))
index 92e12afd778d14956b497e876e87bc83438daf9e..0778b338af6df31395ce93d1a55c17f6fcb7a637 100644 (file)
@@ -13,10 +13,13 @@ INSTALL_DATA = @INSTALL_DATA@
 CC = @CC@
 RANLIB = @RANLIB@
 AR = @AR@
+ARFLAGS = @ARFLAGS@
 RM = rm -f
 CP = cp
 MV = mv
 
+SHELL = @MAKE_SHELL@
+
 PROFILE_FLAGS = 
 
 CFLAGS = @CFLAGS@
@@ -63,32 +66,32 @@ all:                malloc
 
 malloc: ${MALLOC_OBJS}
        ${RM} libmalloc.a
-       ${AR} cr libmalloc.a ${MALLOC_OBJS}
+       ${AR} ${ARFLAGS} libmalloc.a ${MALLOC_OBJS}
        -test -n "$(RANLIB)" && $(RANLIB) libmalloc.a
 
 nmalloc: ${NMALLOC_OBJS}
        ${RM} libmalloc.a
-       ${AR} cr libmalloc.a ${NMALLOC_OBJS}
+       ${AR} ${ARFLAGS} libmalloc.a ${NMALLOC_OBJS}
        -test -n "$(RANLIB)" && $(RANLIB) libmalloc.a
 
 nmalloc2: ${NMALLOC2_OBJS}
        ${RM} libmalloc.a
-       ${AR} cr libmalloc.a ${NMALLOC2_OBJS}
+       ${AR} ${ARFLAGS} libmalloc.a ${NMALLOC2_OBJS}
        -test -n "$(RANLIB)" && $(RANLIB) libmalloc.a
 
 gmalloc: ${GMALLOC_OBJS}
        ${RM} libmalloc.a
-       ${AR} cr libmalloc.a ${GMALLOC_OBJS}
+       ${AR} ${ARFLAGS} libmalloc.a ${GMALLOC_OBJS}
        -test -n "$(RANLIB)" && $(RANLIB) libmalloc.a
 
 ngmalloc: ${NGMALLOC_OBJS}
        ${RM} libmalloc.a
-       ${AR} cr libmalloc.a ${NGMALLOC_OBJS}
+       ${AR} ${ARFLAGS} libmalloc.a ${NGMALLOC_OBJS}
        -test -n "$(RANLIB)" && $(RANLIB) libmalloc.a
 
 stubmalloc: ${STUB_OBJS}
        ${RM} libmalloc.a
-       ${AR} cr libmalloc.a ${STUB_OBJS}
+       ${AR} ${ARFLAGS} libmalloc.a ${STUB_OBJS}
        -test -n "$(RANLIB)" && $(RANLIB) libmalloc.a
 
 alloca.o:      $(srcdir)/$(ALLOCA_SOURCE)
index ef57020456ee6403535b354e33cd35af9897dc6e..e96dd27df28ed9ce074e7b82c51010af662ec8f7 100644 (file)
@@ -184,7 +184,7 @@ struct bucket_stats {
    enough room in the block for the new size.  Range checking is always
    done. */
 union mhead {
-  double mh_align;
+  bits64_t mh_align;                                   /* 8 */
   struct {
     char     mi_alloc; /* ISALLOC or ISFREE */         /* 1 */
     char     mi_index; /* index in nextf[] */          /* 1 */
@@ -200,8 +200,8 @@ union mhead {
 
 /* Access free-list pointer of a block.
    It is stored at block + sizeof (char *).
-   This is not a field in the mhead structure
-   because we want sizeof (struct mhead)
+   This is not a field in the minfo structure member of union mhead
+   because we want sizeof (union mhead)
    to describe the overhead for when the block is in use,
    and we do not want the free-list pointer to count in that.  */
 
@@ -490,6 +490,8 @@ morecore_done:
 #else
 #  if defined (HAVE_POSIX_SIGNALS)
   sigprocmask (SIG_SETMASK, &oset, (sigset_t *)NULL);
+#  else
+  ; /* nothing to do, but need a null statement before the brace */
 #  endif
 #endif /* HAVE_BSD_SIGNALS */
 }
index 442ed1a158ac4138dbd4008eedd6fd9e5479927f..c68961f3293c14a198c133efb83f052115c856b5 100644 (file)
 #  define HAVE_ALLOCA
 #endif /* HAVE_ALLOCA_H && !HAVE_ALLOCA */
 
-#if defined (__GNUC__)
+#if defined (__GNUC__) && !defined (C_ALLOCA)
 #  undef alloca
 #  define alloca __builtin_alloca
-#else /* !__GNUC__ */
-#  if defined (HAVE_ALLOCA_H)
+#else /* !__GNUC__ || C_ALLOCA */
+#  if defined (HAVE_ALLOCA_H) && !defined (C_ALLOCA)
 #    if defined (IBMESA)
 #      include <malloc.h>
 #    else /* !IBMESA */
 #      include <alloca.h>
 #    endif /* !IBMESA */
-#  else  /* !HAVE_ALLOCA_H */
+#  else  /* !HAVE_ALLOCA_H || C_ALLOCA */
 #    if defined (__hpux) && defined (__STDC__) && !defined (alloca)
 extern void *alloca ();
 #    else
@@ -52,7 +52,7 @@ extern void *alloca ();
 extern char *alloca ();
 #      endif /* !alloca */
 #    endif /* !__hpux || !__STDC__ && !alloca */
-#  endif /* !HAVE_ALLOCA_H */
-#endif /* !__GNUC__ */
+#  endif /* !HAVE_ALLOCA_H || C_ALLOCA */
+#endif /* !__GNUC__ || C_ALLOCA */
 
 #endif /* _MEMALLOC_H_ */
index 8703d17e9fbd0354ea794d9223c7fe3ee32f9670..1347cc07ebc507bc31b2fbb1eec3f6d6c0865218 100644 (file)
@@ -9,10 +9,12 @@
 
 #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))
+#  if !defined (__OPENNT)
+#    undef setjmp
+#    define setjmp(x)  sigsetjmp((x), 1)
+#    undef longjmp
+#    define longjmp(x, n)      siglongjmp((x), (n))
+#  endif /* !__OPENNT */
 #else
 #  define procenv_t    jmp_buf
 #endif
index 31eddd61af4cb1d619dd79fad5eb5226db51b80e..c0439ae84706c8828696fafbdd46b7093982bb08 100644 (file)
@@ -16,11 +16,12 @@ INSTALL_DATA = @INSTALL_DATA@
 CC = @CC@
 RANLIB = @RANLIB@
 AR = @AR@
+ARFLAGS = @ARFLAGS@
 RM = rm -f
 CP = cp
 MV = mv
 
-SHELL = /bin/sh
+SHELL = @MAKE_SHELL@
 
 # Programs to make tags files.
 ETAGS = etags -tw
@@ -39,6 +40,7 @@ INCLUDES = -I. -I$(BUILD_DIR) -I$(topdir) -I$(topdir)/lib
 CCFLAGS = $(DEFS) $(LOCAL_DEFS) $(APP_CFLAGS) $(CPPFLAGS) ${INCLUDES} $(LOCAL_CFLAGS) $(CFLAGS)
 
 .c.o:
+       ${RM} $@
        $(CC) -c $(CCFLAGS) $<
 
 # The name of the main library target.
@@ -54,14 +56,14 @@ CSOURCES = $(srcdir)/readline.c $(srcdir)/funmap.c $(srcdir)/keymaps.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)/search.c \
-          $(srcdir)/shell.c $(srcdir)/tilde.c
+          $(srcdir)/shell.c $(srcdir)/tilde.c $(srcdir)/savestring.c
 
 # The header files for this library.
 HSOURCES = readline.h rldefs.h chardefs.h keymaps.h history.h histlib.h \
           posixstat.h posixdir.h posixjmp.h tilde.h rlconf.h rltty.h \
-          ansi_stdlib.h tcap.h
+          ansi_stdlib.h rlstdc.h tcap.h
 
-HISTOBJ = history.o histexpand.o histfile.o histsearch.o shell.o
+HISTOBJ = history.o histexpand.o histfile.o histsearch.o shell.o savestring.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 \
@@ -88,12 +90,12 @@ all: libreadline.a libhistory.a
 
 libreadline.a: $(OBJECTS)
        $(RM) $@
-       $(AR) cr $@ $(OBJECTS)
+       $(AR) $(ARFLAGS) $@ $(OBJECTS)
        -test -n "$(RANLIB)" && $(RANLIB) $@
 
 libhistory.a: $(HISTOBJ) xmalloc.o
        $(RM) $@
-       $(AR) cr $@ $(HISTOBJ) xmalloc.o
+       $(AR) $(ARFLAGS) $@ $(HISTOBJ) xmalloc.o
        -test -n "$(RANLIB)" && $(RANLIB) $@
 
 documentation: force
@@ -130,87 +132,87 @@ distclean maintainer-clean: clean
 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
+bind.o: history.h rlstdc.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
+callback.o: readline.h keymaps.h chardefs.h tilde.h rlstdc.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
+complete.o: readline.h keymaps.h chardefs.h tilde.h rlstdc.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
+display.o: history.h rlstdc.h
 funmap.o: readline.h keymaps.h chardefs.h tilde.h
-funmap.o: rlconf.h ansi_stdlib.h
+funmap.o: rlconf.h ansi_stdlib.h rlstdc.h
 funmap.o: ${BUILD_DIR}/config.h
 histexpand.o: ansi_stdlib.h
-histexpand.o: history.h histlib.h
+histexpand.o: history.h histlib.h rlstdc.h
 histexpand.o: ${BUILD_DIR}/config.h
 histfile.o: ansi_stdlib.h
-histfile.o: history.h histlib.h
+histfile.o: history.h histlib.h rlstdc.h
 histfile.o: ${BUILD_DIR}/config.h
 history.o: ansi_stdlib.h
-history.o: history.h histlib.h
+history.o: history.h histlib.h rlstdc.h
 history.o: ${BUILD_DIR}/config.h
 histsearch.o: ansi_stdlib.h
-histsearch.o: history.h histlib.h
+histsearch.o: history.h histlib.h rlstdc.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
+input.o: readline.h keymaps.h chardefs.h tilde.h rlstdc.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
+isearch.o: ansi_stdlib.h history.h rlstdc.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
+keymaps.o: ${BUILD_DIR}/config.h rlstdc.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
+kill.o: history.h rlstdc.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
+macro.o: history.h rlstdc.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
+parens.o: readline.h keymaps.h chardefs.h tilde.h rlstdc.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: history.h rlstdc.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
+rltty.o: readline.h keymaps.h chardefs.h tilde.h rlstdc.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
+search.o: ansi_stdlib.h history.h rlstdc.h
 shell.o: ${BUILD_DIR}/config.h ansi_stdlib.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
+signals.o: history.h rlstdc.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
+terminal.o: history.h rlstdc.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
+undo.o: history.h rlstdc.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
+util.o: readline.h keymaps.h chardefs.h tilde.h rlstdc.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
+vi_mode.o: history.h ansi_stdlib.h rlstdc.h
 xmalloc.o: ${BUILD_DIR}/config.h
 xmalloc.o: ansi_stdlib.h
 
@@ -233,6 +235,7 @@ nls.o: nls.c
 parens.o: parens.c
 readline.o: readline.c
 rltty.o: rltty.c
+savestring.o: savestring.c
 search.o: search.c
 shell.o: shell.c
 signals.o: signals.c
index f999e8d268a7b8e42215ba3b31b9d77c201e4116..c6b5cbd34a05a769bc415922643950a6860d42b3 100644 (file)
@@ -1,32 +1,2 @@
-This is a description of C preprocessor defines that readline accepts.
-Most are passed in from the parent `make'; e.g. from the bash source
-directory.
-
-NO_SYS_FILE            <sys/file.h> is not present
-HAVE_UNISTD_H          <unistd.h> exists
-HAVE_STDLIB_H          <stdlib.h> exists
-HAVE_VARARGS_H         <varargs.h> exists and is usable
-HAVE_STRING_H          <string.h> exists
-HAVE_ALLOCA_H          <alloca.h> exists and is needed for alloca()
-HAVE_ALLOCA            alloca(3) or a define for it exists
-PRAGMA_ALLOCA          use of alloca() requires a #pragma, as in AIX 3.x
-VOID_SIGHANDLER                signal handlers are void functions
-HAVE_DIRENT_H          <dirent.h> exists and is usable
-HAVE_SYS_PTEM_H                <sys/ptem.h> exists 
-HAVE_SYS_PTE_H         <sys/pte.h> exists 
-HAVE_SYS_STREAM_H      <sys/stream.h> exists
-HAVE_SYS_SELECT_H      <sys/select.h> exists
-
-System-specific options:
-
-GWINSZ_IN_SYS_IOCTL    need to include <sys/ioctl.h> for TIOCGWINSZ
-HAVE_GETPW_DECLS       the getpw* functions are declared in <pwd.h> and cannot
-                       be redeclared without compiler errors
-HAVE_STRCASECMP                the strcasecmp and strncasecmp functions are available
-
-USG                    Running a variant of System V
-USGr3                  Running System V.3
-XENIX_22               Xenix 2.2
-Linux                  Linux
-CRAY                   running a recent version of Cray UNICOS
-SunOS4                 Running SunOS 4.x
+This is not to be built as a standalone library to be installed in some
+public place; get the full readline distribution instead.
index 300530a0781fa1a2a5b1ca61b2f8c9b03a839794..f446dc8cd10c73c86ac46b869a71f8961cf43bbf 100644 (file)
@@ -83,6 +83,7 @@ extern int rl_complete_with_tilde_expansion;
 extern int rl_completion_query_items;
 extern int rl_inhibit_completion;
 extern char *_rl_comment_begin;
+extern unsigned char *_rl_isearch_terminators;
 
 extern int rl_explicit_arg;
 extern int rl_editing_mode;
@@ -207,13 +208,17 @@ rl_unbind_function_in_map (func, map)
      Function *func;
      Keymap map;
 {
-  register int i;
+  register int i, rval;
 
-  for (i = 0; i < KEYMAP_SIZE; i++)
+  for (i = rval = 0; i < KEYMAP_SIZE; i++)
     {
       if (map[i].type == ISFUNC && map[i].function == func)
-       map[i].function = (Function *)NULL;
+       {
+         map[i].function = (Function *)NULL;
+         rval = 1;
+       }
     }
+  return rval;
 }
 
 int
@@ -222,7 +227,6 @@ rl_unbind_command_in_map (command, map)
      Keymap map;
 {
   Function *func;
-  register int i;
 
   func = rl_named_function (command);
   if (func == 0)
@@ -663,7 +667,11 @@ _rl_read_file (filename, sizep)
   i = read (file, buffer, file_size);
   close (file);
 
+#if 0
   if (i < file_size)
+#else
+  if (i < 0)
+#endif
     {
       free (buffer);
       return ((char *)NULL);
@@ -727,6 +735,8 @@ _rl_read_init_file (filename, include_level)
 
   openname = tilde_expand (filename);
   buffer = _rl_read_file (openname, &file_size);
+  free (openname);
+
   if (buffer == 0)
     return (errno);
   
@@ -1338,7 +1348,34 @@ rl_variable_bind (name, value)
       else
         _rl_bell_preference = AUDIBLE_BELL;
     }
+  else if (_rl_stricmp (name, "isearch-terminators") == 0)
+    {
+      /* Isolate the value and translate it into a character string. */
+      int beg, end;
+      char *v;
 
+      v = savestring (value);
+      FREE (_rl_isearch_terminators);
+      if (v[0] == '"' || v[0] == '\'')
+       {
+         int delim = v[0];
+         for (beg = end = 1; v[end] && v[end] != delim; end++)
+           ;
+       }
+      else
+       {
+         for (beg = end = 0; whitespace (v[end]) == 0; end++)
+           ;
+       }
+
+      v[end] = '\0';
+      /* The value starts at v + beg.  Translate it into a character string. */
+      _rl_isearch_terminators = (unsigned char *)xmalloc (2 * strlen (v) + 1);
+      rl_translate_keyseq (v + beg, _rl_isearch_terminators, &end);
+      _rl_isearch_terminators[end] = '\0';
+      free (v);
+    }
+      
   /* For the time being, unknown variable names are simply ignored. */
   return 0;
 }
@@ -1492,7 +1529,7 @@ _rl_get_keyname (key)
      int key;
 {
   char *keyname;
-  int i, c, v;
+  int i, c;
 
   keyname = (char *)xmalloc (8);
 
@@ -1897,6 +1934,21 @@ rl_variable_dumper (print_readably)
     fprintf (rl_outstream, "set keymap %s\n", kname ? kname : "none");
   else
     fprintf (rl_outstream, "keymap is set to `%s'\n", kname ? kname : "none");
+
+  /* isearch-terminators */
+  if (_rl_isearch_terminators)
+    {
+      char *disp;
+
+      disp = _rl_untranslate_macro_value (_rl_isearch_terminators);
+
+      if (print_readably)
+       fprintf (rl_outstream, "set isearch-terminators \"%s\"\n", disp);
+      else
+       fprintf (rl_outstream, "isearch-terminators is set to \"%s\"\n", disp);
+
+      free (disp);
+    }
 }
 
 /* Print all of the current variables and their values to
index 34dbc724611a021efe23d56a2bbc0749d3fcde6d..6915be483a4293d4f7890fa30ae44a11433dd1ab 100644 (file)
@@ -36,7 +36,7 @@
 #include "rldefs.h"
 #include "readline.h"
 
-extern void readline_internal_startup ();
+extern void readline_internal_setup ();
 extern char *readline_internal_teardown ();
 extern int readline_internal_char ();
 extern void _rl_init_line_state ();
index 985e8981eee66fc9a5d3222af0e91fc9ae77a224..714a2bf49dc52cb475b35203279de1348bd2c544 100644 (file)
@@ -85,6 +85,15 @@ extern void _rl_move_vert ();
 extern int _rl_vis_botlin;
 extern int rl_display_fixed;
 
+/* If non-zero, then this is the address of a function to call when
+   completing a word would normally display the list of possible matches.
+   This function is called instead of actually doing the display.
+   It takes three arguments: (char **matches, int num_matches, int max_length)
+   where MATCHES is the array of strings that matched, NUM_MATCHES is the
+   number of strings in that array, and MAX_LENGTH is the length of the
+   longest string in that array. */
+VFunction *rl_completion_display_matches_hook = (VFunction *)NULL;
+
 /* Forward declarations for functions defined and used in this file. */
 char *filename_completion_function ();
 char **completion_matches ();
@@ -674,6 +683,7 @@ gen_completion_matches (text, start, end, our_func, found_quote, quote_char)
      we are doing filename completion and the application has defined a
      filename dequoting function. */
   temp = (char *)NULL;
+
   if (found_quote && our_func == (Function *)filename_completion_function &&
       rl_filename_dequoting_function)
     {
@@ -682,7 +692,7 @@ gen_completion_matches (text, start, end, our_func, found_quote, quote_char)
       text = temp;     /* not freeing text is not a memory leak */
     }
 
-  matches = completion_matches (text, our_func);
+  matches = completion_matches (text, (CPFunction *)our_func);
   FREE (temp);
   return matches;  
 }
@@ -813,8 +823,7 @@ compute_lcd_of_matches (match_list, matches, text)
 }
 
 static int
-postprocess_matches (text, matchesp, matching_filenames)
-     char *text;
+postprocess_matches (matchesp, matching_filenames)
      char ***matchesp;
      int matching_filenames;
 {
@@ -845,7 +854,6 @@ postprocess_matches (text, matchesp, matching_filenames)
       if (matches == 0 || matches[0] == 0)
        {
          FREE (matches);
-         ding ();
          *matchesp = (char **)0;
          return 0;
         }
@@ -857,7 +865,7 @@ postprocess_matches (text, matchesp, matching_filenames)
          if (i > 1 && i < nmatch)
            {
              t = matches[0];
-             compute_lcd_of_matches (matches, i - 1, text);
+             compute_lcd_of_matches (matches, i - 1, t);
              FREE (t);
            }
        }
@@ -867,66 +875,19 @@ postprocess_matches (text, matchesp, matching_filenames)
   return (1);
 }
 
-static void
-display_matches (matches)
+/* A convenience function for displaying a list of strings in
+   columnar format on readline's output stream.  MATCHES is the list
+   of strings, in argv format, LEN is the number of strings in MATCHES,
+   and MAX is the length of the longest string in MATCHES. */
+void
+rl_display_match_list (matches, len, max)
      char **matches;
+     int len, max;
 {
-  int len, count, limit, max, printed_len;
+  int count, limit, printed_len;
   int i, j, k, l;
   char *temp;
 
-  /* Move to the last visible line of a possibly-multiple-line command. */
-  _rl_move_vert (_rl_vis_botlin);
-
-  /* Handle simple case first.  What if there is only one answer? */
-  if (matches[1] == 0)
-    {
-      temp = printable_part (matches[0]);
-      crlf ();
-      print_filename (temp, matches[0]);
-      crlf ();
-#if 0
-      rl_on_new_line ();
-#else
-      rl_forced_update_display ();
-      rl_display_fixed = 1;
-#endif
-      return;
-    }
-
-  /* There is more than one answer.  Find out how many there are,
-     and find the maximum printed length of a single entry. */
-  for (max = 0, i = 1; matches[i]; i++)
-    {
-      temp = printable_part (matches[i]);
-      len = strlen (temp);
-
-      if (len > max)
-       max = len;
-    }
-
-  len = i - 1;
-
-  /* If there are many items, then ask the user if she really wants to
-     see them all. */
-  if (len >= rl_completion_query_items)
-    {
-      crlf ();
-      fprintf (rl_outstream, "Display all %d possibilities? (y or n)", len);
-      fflush (rl_outstream);
-      if (get_y_or_n () == 0)
-       {
-         crlf ();
-#if 0
-         rl_on_new_line ();
-#else
-         rl_forced_update_display ();
-         rl_display_fixed = 1;
-#endif
-         return;
-       }
-    }
-
   /* How many items of MAX length can we fit in the screen window? */
   max += 2;
   limit = screenwidth / max;
@@ -993,13 +954,85 @@ display_matches (matches)
        }
       crlf ();
     }
+}
+
+/* Display MATCHES, a list of matching filenames in argv format.  This
+   handles the simple case -- a single match -- first.  If there is more
+   than one match, we compute the number of strings in the list and the
+   length of the longest string, which will be needed by the display
+   function.  If the application wants to handle displaying the list of
+   matches itself, it sets RL_COMPLETION_DISPLAY_MATCHES_HOOK to the
+   address of a function, and we just call it.  If we're handling the
+   display ourselves, we just call rl_display_match_list.  We also check
+   that the list of matches doesn't exceed the user-settable threshold,
+   and ask the user if he wants to see the list if there are more matches
+   than RL_COMPLETION_QUERY_ITEMS. */
+static void
+display_matches (matches)
+     char **matches;
+{
+  int len, max, i;
+  char *temp;
+
+  /* Move to the last visible line of a possibly-multiple-line command. */
+  _rl_move_vert (_rl_vis_botlin);
+
+  /* Handle simple case first.  What if there is only one answer? */
+  if (matches[1] == 0)
+    {
+      temp = printable_part (matches[0]);
+      crlf ();
+      print_filename (temp, matches[0]);
+      crlf ();
+
+      rl_forced_update_display ();
+      rl_display_fixed = 1;
+
+      return;
+    }
+
+  /* There is more than one answer.  Find out how many there are,
+     and find the maximum printed length of a single entry. */
+  for (max = 0, i = 1; matches[i]; i++)
+    {
+      temp = printable_part (matches[i]);
+      len = strlen (temp);
+
+      if (len > max)
+       max = len;
+    }
+
+  len = i - 1;
+
+  /* If the caller has defined a display hook, then call that now. */
+  if (rl_completion_display_matches_hook)
+    {
+      (*rl_completion_display_matches_hook) (matches, len, max);
+      return;
+    }
+       
+  /* If there are many items, then ask the user if she really wants to
+     see them all. */
+  if (len >= rl_completion_query_items)
+    {
+      crlf ();
+      fprintf (rl_outstream, "Display all %d possibilities? (y or n)", len);
+      fflush (rl_outstream);
+      if (get_y_or_n () == 0)
+       {
+         crlf ();
+
+         rl_forced_update_display ();
+         rl_display_fixed = 1;
+
+         return;
+       }
+    }
+
+  rl_display_match_list (matches, len, max);
 
-#if 0
-  rl_on_new_line ();
-#else
   rl_forced_update_display ();
   rl_display_fixed = 1;
-#endif
 }
 
 static char *
@@ -1026,11 +1059,8 @@ make_quoted_replacement (match, mtype, qc)
                        rl_filename_quoting_desired;
 
   if (should_quote)
-#if defined (SHELL)
-    should_quote = should_quote && (!qc || !*qc || *qc == '"' || *qc == '\'');
-#else /* !SHELL */
-    should_quote = should_quote && (!qc || !*qc);
-#endif /* !SHELL */
+    should_quote = should_quote && (!qc || !*qc ||
+                    (rl_completer_quote_characters && strchr (rl_completer_quote_characters, *qc)));
 
   if (should_quote)
     {
@@ -1168,6 +1198,17 @@ insert_all_matches (matches, point, qc)
   rl_end_undo_group ();
 }
 
+static void
+free_match_list (matches)
+     char **matches;
+{
+  register int i;
+
+  for (i = 0; matches[i]; i++)
+    free (matches[i]);
+  free (matches);
+}
+
 /* Complete the word at or before point.
    WHAT_TO_DO says what to do with the completion.
    `?' means list the possible completions.
@@ -1210,27 +1251,34 @@ 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);
     }
 
+#if 0
   /* If we are matching filenames, our_func will have been set to
      filename_completion_function */
   i = our_func == (Function *)filename_completion_function;
-  if (postprocess_matches (text, &matches, i) == 0)
+#else
+  /* If we are matching filenames, the attempted completion function will
+     have set rl_filename_completion_desired to a non-zero value.  The basic
+     filename_completion_function does this. */
+  i = rl_filename_completion_desired;
+#endif
+
+  if (postprocess_matches (&matches, i) == 0)
     {
+      ding ();
       FREE (saved_line_buffer);
-      free (text);
+      completion_changed_buffer = 0;
       return (0);
     }
 
-  free (text);
-
   switch (what_to_do)
     {
     case TAB:
@@ -1277,9 +1325,7 @@ rl_complete_internal (what_to_do)
       return 1;
     }
 
-  for (i = 0; matches[i]; i++)
-    free (matches[i]);
-  free (matches);
+  free_match_list (matches);
 
   /* Check to see if the line has changed through all of this manipulation. */
   if (saved_line_buffer)
@@ -1358,10 +1404,10 @@ completion_matches (text, entry_function)
    character (usually `~').  */
 char *
 username_completion_function (text, state)
-     int state;
      char *text;
+     int state;
 {
-#if defined (__GO32__) || defined (__WIN32__)
+#if defined (__GO32__) || defined (__WIN32__) || defined (__OPENNT)
   return (char *)NULL;
 #else /* !__GO32__ */
   static char *username = (char *)NULL;
@@ -1415,8 +1461,8 @@ username_completion_function (text, state)
    completion for a command. */
 char *
 filename_completion_function (text, state)
-     int state;
      char *text;
+     int state;
 {
   static DIR *directory = (DIR *)NULL;
   static char *filename = (char *)NULL;
@@ -1574,7 +1620,7 @@ filename_completion_function (text, state)
              strcpy (temp, users_dirname);
            }
 
-         strcpy (temp + dirlen, entry->d_name); /* strcat (temp, entry->d_name); */
+         strcpy (temp + dirlen, entry->d_name);
        }
       else
        temp = savestring (entry->d_name);
@@ -1649,10 +1695,17 @@ rl_menu_complete (count, ignore)
       matches = gen_completion_matches (orig_text, orig_start, orig_end,
                                        our_func, found_quote, quote_char);
 
+#if 0
       /* If we are matching filenames, our_func will have been set to
         filename_completion_function */
       matching_filenames = our_func == (Function *)filename_completion_function;
-      if (matches == 0 || postprocess_matches (orig_text, &matches, matching_filenames) == 0)
+#else
+      /* If we are matching filenames, the attempted completion function will
+        have set rl_filename_completion_desired to a non-zero value.  The basic
+        filename_completion_function does this. */
+      matching_filenames = rl_filename_completion_desired;
+#endif
+      if (matches == 0 || postprocess_matches (&matches, matching_filenames) == 0)
        {
          ding ();
          FREE (matches);
@@ -1686,7 +1739,7 @@ rl_menu_complete (count, ignore)
   if (match_list_index < 0)
     match_list_index += match_list_size;
 
-  if (match_list_index == 0)
+  if (match_list_index == 0 && match_list_size > 1)
     {
       ding ();
       insert_match (orig_text, orig_start, MULT_MATCH, &quote_char);
index f7ec69b247c121054ca97c6cb6148b498ade8c2f..25aba64ca67de4154ee082bfc057f116994aa78f 100644 (file)
@@ -280,7 +280,7 @@ rl_expand_prompt (prompt)
   if (local_prompt_prefix)
     free (local_prompt_prefix);
   local_prompt = local_prompt_prefix = (char *)0;
-  last_invisible = 0;
+  last_invisible = visible_length = 0;
 
   if (prompt == 0 || *prompt == 0)
     return (0);
@@ -373,6 +373,13 @@ rl_redisplay ()
 
       if (local_len > 0)
        {
+         temp = local_len + out + 2;
+         if (temp >= line_size)
+           {
+             line_size = (temp + 1024) - (temp % 1024);
+             visible_line = xrealloc (visible_line, line_size);
+             line = invisible_line = xrealloc (invisible_line, line_size);
+           }
          strncpy (line + out, local_prompt, local_len);
          out += local_len;
        }
@@ -399,6 +406,13 @@ rl_redisplay ()
        }
 
       pmtlen = strlen (prompt_this_line);
+      temp = pmtlen + out + 2;
+      if (temp >= line_size)
+       {
+         line_size = (temp + 1024) - (temp % 1024);
+         visible_line = xrealloc (visible_line, line_size);
+         line = invisible_line = xrealloc (invisible_line, line_size);
+       }
       strncpy (line + out,  prompt_this_line, pmtlen);
       out += pmtlen;
       line[out] = '\0';
@@ -407,12 +421,12 @@ rl_redisplay ()
 
 #define CHECK_LPOS() \
       do { \
-        lpos++; \
-        if (lpos >= screenwidth) \
-          { \
-            inv_lbreaks[++newlines] = out; \
-            lpos = 0; \
-          } \
+       lpos++; \
+       if (lpos >= screenwidth) \
+         { \
+           inv_lbreaks[++newlines] = out; \
+           lpos = 0; \
+         } \
       } while (0)
 
   /* inv_lbreaks[i] is where line i starts in the buffer. */
@@ -481,7 +495,12 @@ rl_redisplay ()
       else if (c == '\t')
        {
          register int temp, newout;
+
+#if 0
          newout = (out | (int)7) + 1;
+#else
+         newout = out + 8 - lpos % 8;
+#endif
          temp = newout - out;
          if (lpos + temp >= screenwidth)
            {
@@ -501,11 +520,11 @@ rl_redisplay ()
        }
 #endif
       else if (c == '\n' && _rl_horizontal_scroll_mode == 0 && term_up && *term_up)
-        {
-          line[out++] = '\0';  /* XXX - sentinel */
-          inv_lbreaks[++newlines] = out;
-          lpos = 0;
-        }
+       {
+         line[out++] = '\0';   /* XXX - sentinel */
+         inv_lbreaks[++newlines] = out;
+         lpos = 0;
+       }
       else if (CTRL_CHAR (c) || c == RUBOUT)
        {
          line[out++] = '^';
@@ -616,11 +635,11 @@ rl_redisplay ()
            {
              _rl_move_vert (cursor_linenum);
              /* If we moved up to the line with the prompt using term_up,
-                the physical cursor position on the screen stays the same,
-                but the buffer position needs to be adjusted to account
-                for invisible characters. */
+                the physical cursor position on the screen stays the same,
+                but the buffer position needs to be adjusted to account
+                for invisible characters. */
              if (cursor_linenum == 0 && wrap_offset)
-               _rl_last_c_pos += wrap_offset;
+               _rl_last_c_pos += wrap_offset;
            }
 
          /* We have to reprint the prompt if it contains invisible
@@ -673,16 +692,16 @@ rl_redisplay ()
       ndisp = c_pos - wrap_offset;
       nleft  = visible_length + wrap_offset;
       /* Where the new cursor position will be on the screen.  This can be
-         longer than SCREENWIDTH; if it is, lmargin will be adjusted. */
+        longer than SCREENWIDTH; if it is, lmargin will be adjusted. */
       phys_c_pos = c_pos - (last_lmargin ? last_lmargin : wrap_offset);
       t = screenwidth / 3;
 
       /* If the number of characters had already exceeded the screenwidth,
-         last_lmargin will be > 0. */
+        last_lmargin will be > 0. */
 
       /* If the number of characters to be displayed is more than the screen
-         width, compute the starting offset so that the cursor is about
-         two-thirds of the way across the screen. */
+        width, compute the starting offset so that the cursor is about
+        two-thirds of the way across the screen. */
       if (phys_c_pos > screenwidth - 2)
        {
          lmargin = c_pos - (2 * t);
@@ -694,7 +713,7 @@ rl_redisplay ()
            lmargin = nleft;
        }
       else if (ndisp < screenwidth - 2)                /* XXX - was -1 */
-        lmargin = 0;
+       lmargin = 0;
       else if (phys_c_pos < 1)
        {
          /* If we are moving back towards the beginning of the line and
@@ -704,7 +723,7 @@ rl_redisplay ()
            lmargin = nleft;
        }
       else
-        lmargin = last_lmargin;
+       lmargin = last_lmargin;
 
       /* If the first character on the screen isn't the first character
         in the display line, indicate this with a special character. */
@@ -712,12 +731,12 @@ rl_redisplay ()
        line[lmargin] = '<';
 
       /* If SCREENWIDTH characters starting at LMARGIN do not encompass
-         the whole line, indicate that with a special characters at the
-         right edge of the screen.  If LMARGIN is 0, we need to take the
-         wrap offset into account. */
+        the whole line, indicate that with a special character at the
+        right edge of the screen.  If LMARGIN is 0, we need to take the
+        wrap offset into account. */
       t = lmargin + M_OFFSET (lmargin, wrap_offset) + screenwidth;
       if (t < out)
-        line[t - 1] = '>';
+       line[t - 1] = '>';
 
       if (!rl_display_fixed || forced_display || lmargin != last_lmargin)
        {
@@ -782,7 +801,7 @@ new:        eddie> Oh, my little buggy says to me, as lurgid as
                             \new first difference
 
    All are character pointers for the sake of speed.  Special cases for
-   no differences, as well as for end of line additions must be handeled.
+   no differences, as well as for end of line additions must be handled.
 
    Could be made even smarter, but this works well enough */
 static void
@@ -810,7 +829,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
       _rl_last_c_pos = 1;              /* XXX */
       _rl_last_v_pos++;
       if (old[0] && new[0])
-        old[0] = new[0];
+       old[0] = new[0];
     }
       
   /* Find first difference. */
@@ -895,10 +914,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
      lendiff needs to be adjusted. */
   if (current_line == 0 && !_rl_horizontal_scroll_mode &&
       current_invis_chars != visible_wrap_offset)
-    {
-      temp = visible_wrap_offset - current_invis_chars;
-      lendiff += temp;
-    }
+    lendiff += visible_wrap_offset - current_invis_chars;
 
   /* Insert (diff (len (old), len (new)) ch. */
   temp = ne - nfd;
@@ -927,7 +943,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
              /* At the end of a line the characters do not have to
                 be "inserted".  They can just be placed on the screen. */
              /* However, this screws up the rest of this block, which
-                assumes you've done the insert because you can. */
+                assumes you've done the insert because you can. */
              _rl_output_some_chars (nfd, lendiff);
              _rl_last_c_pos += lendiff;
            }
@@ -987,10 +1003,13 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
              _rl_last_c_pos += temp;
            }
          lendiff = (oe - old) - (ne - new);
-         if (_rl_term_autowrap && current_line < inv_botlin)
-           space_to_eol (lendiff);
-         else
-           _rl_clear_to_eol (lendiff);
+         if (lendiff)
+           {     
+             if (_rl_term_autowrap && current_line < inv_botlin)
+               space_to_eol (lendiff);
+             else
+               _rl_clear_to_eol (lendiff);
+           }
        }
     }
 }
@@ -1019,7 +1038,7 @@ rl_forced_update_display ()
       register char *temp = visible_line;
 
       while (*temp)
-        *temp++ = '\0';
+       *temp++ = '\0';
     }
   rl_on_new_line ();
   forced_display++;
@@ -1080,7 +1099,7 @@ _rl_move_cursor_relative (new, data)
        putc (data[i], rl_outstream);
 #endif /* HACK_TERMCAP_MOTION */
     }
-  else if (_rl_last_c_pos != new)
+  else if (_rl_last_c_pos > new)
     _rl_backspace (_rl_last_c_pos - new);
   _rl_last_c_pos = new;
 }
@@ -1245,7 +1264,7 @@ static int saved_last_invisible;
 static int saved_visible_length;
 
 void
-_rl_save_prompt ()
+rl_save_prompt ()
 {
   saved_local_prompt = local_prompt;
   saved_local_prefix = local_prompt_prefix;
@@ -1257,7 +1276,7 @@ _rl_save_prompt ()
 }
 
 void
-_rl_restore_prompt ()
+rl_restore_prompt ()
 {
   if (local_prompt)
     free (local_prompt);
@@ -1277,14 +1296,14 @@ _rl_make_prompt_for_search (pchar)
   int len;
   char *pmt;
 
-  _rl_save_prompt ();
+  rl_save_prompt ();
 
   if (saved_local_prompt == 0)
     {
       len = (rl_prompt && *rl_prompt) ? strlen (rl_prompt) : 0;
       pmt = xmalloc (len + 2);
       if (len)
-        strcpy (pmt, rl_prompt);
+       strcpy (pmt, rl_prompt);
       pmt[len] = pchar;
       pmt[len+1] = '\0';
     }
@@ -1293,7 +1312,7 @@ _rl_make_prompt_for_search (pchar)
       len = *saved_local_prompt ? strlen (saved_local_prompt) : 0;
       pmt = xmalloc (len + 2);
       if (len)
-        strcpy (pmt, saved_local_prompt);
+       strcpy (pmt, saved_local_prompt);
       pmt[len] = pchar;
       pmt[len+1] = '\0';
       local_prompt = savestring (pmt);
@@ -1540,6 +1559,15 @@ _rl_clean_up_for_exit ()
       _rl_move_vert (_rl_vis_botlin);
       _rl_vis_botlin = 0;
       fflush (rl_outstream);
-      rl_restart_output ();
+      rl_restart_output (1, 0);
     }
 }
+
+void
+_rl_erase_entire_line ()
+{
+  cr ();
+  _rl_clear_to_eol (0);
+  cr ();
+  fflush (rl_outstream);
+}
index 58d4dd762ac2a7163567d08fbf68d6a2cfdca415..b58ab566909dbb77e73df9a7661a82bdbf8e6cd4 100644 (file)
@@ -1,40 +1,75 @@
+# Generated automatically from Makefile.in by configure.
 # This makefile for Readline library documentation is in -*- text -*- mode.
 # Emacs likes it that way.
+top_srcdir = .
+srcdir = .
+VPATH = .
+
+prefix = /usr/local
+infodir = ${prefix}/info
+
+mandir = ${prefix}/man
+man3dir = $(mandir)/man3
+
+SHELL = /bin/sh
 RM = rm -f
 
+TEXINPUTDIR = $(srcdir)
+
 MAKEINFO    = makeinfo
-TEXI2DVI    = texi2dvi
-TEXI2HTML   = texi2html
+TEXI2DVI    = $(srcdir)/texi2dvi
+TEXI2HTML   = $(srcdir)/texi2html
 QUIETPS     = #set this to -q to shut up dvips
 DVIPS       = dvips -D 300 $(QUIETPS) -o $@     # tricky
 
-INSTALL_DATA = cp
-infodir = /usr/local/info
+INSTALL = /usr/bin/install -c
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_DATA = ${INSTALL} -m 644
 
-RLSRC = rlman.texinfo rluser.texinfo rltech.texinfo
-HISTSRC = hist.texinfo hsuser.texinfo hstech.texinfo
+RLSRC = $(srcdir)/rlman.texinfo $(srcdir)/rluser.texinfo \
+       $(srcdir)/rltech.texinfo $(srcdir)/manvers.texinfo
+HISTSRC = $(srcdir)/hist.texinfo $(srcdir)/hsuser.texinfo \
+         $(srcdir)/hstech.texinfo $(srcdir)/manvers.texinfo
+
+# This should be a program that converts troff to an ascii-readable format
+NROFF       = groff -Tascii
+
+# This should be a program that converts troff to postscript
+GROFF       = groff
 
 DVIOBJ = readline.dvi history.dvi
 INFOOBJ = readline.info history.info
 PSOBJ = readline.ps history.ps
 HTMLOBJ = readline.html history.html
+HTMLTOC = readline_toc.html history_toc.html
+TEXTOBJ = readline.0
+
+INTERMEDIATE_OBJ = rlman.dvi hist.dvi
 
-all: info dvi html ps
-nodvi: info html
+CREATED_DOCS = $(DVIOBJ) $(INFOOBJ) $(PSOBJ) $(HTMLOBJ) $(HTMLTOC) $(TEXTOBJ)
+
+.SUFFIXES:      .0 .3 .ps .txt .dvi
+
+.3.0:
+       $(RM) $@
+       -${NROFF} -man $< > $@
+
+all: info dvi html ps #text
+nodvi: info html #text
 
 readline.dvi: $(RLSRC)
-       $(TEXI2DVI) rlman.texinfo
+       TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/rlman.texinfo
        mv rlman.dvi readline.dvi
 
 readline.info: $(RLSRC)
-       $(MAKEINFO) --no-split -o $@ rlman.texinfo
+       $(MAKEINFO) --no-split -I $(TEXINPUTDIR) -o $@ $(srcdir)/rlman.texinfo
 
 history.dvi: ${HISTSRC}
-       $(TEXI2DVI) hist.texinfo
+       TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/hist.texinfo
        mv hist.dvi history.dvi
 
 history.info: ${HISTSRC}
-       $(MAKEINFO) --no-split -o $@ hist.texinfo
+       $(MAKEINFO) --no-split -I $(TEXINPUTDIR) -o $@ $(srcdir)/hist.texinfo
 
 readline.ps:   readline.dvi
        $(RM) $@
@@ -45,32 +80,60 @@ history.ps: history.dvi
        $(DVIPS) history.dvi
 
 readline.html: ${RLSRC}
-       $(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) rlman.html rlman_toc.html
+       $(TEXI2HTML) -menu -monolithic -I $(TEXINPUTDIR) $(srcdir)/rlman.texinfo
+       sed -e 's:rlman.html:readline.html:' rlman.html > readline.html
+       $(RM) rlman.html
 
 history.html:  ${HISTSRC}
-       $(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) hist.html hist_toc.html
+       $(TEXI2HTML) -menu -monolithic -I $(TEXINPUTDIR) $(srcdir)/hist.texinfo
+       sed -e 's:hist.html:history.html:' hist.html > history.html
+       $(RM) hist.html
 
 info:  $(INFOOBJ)
 dvi:   $(DVIOBJ)
 ps:    $(PSOBJ)
 html:  $(HTMLOBJ)
+text:  $(TEXTOBJ)
+
+readline.0: readline.3
 
 clean:
        $(RM) *.aux *.cp *.fn *.ky *.log *.pg *.toc *.tp *.vr *.cps *.pgs \
              *.fns *.kys *.tps *.vrs *.o core
 
 distclean: clean
+       $(RM) $(CREATED_DOCS)
+       $(RM) $(INTERMEDIATE_OBJ)
+       $(RM) Makefile
+
 mostlyclean: clean
 
 maintainer-clean: clean
-       $(RM) *.dvi *.info *.info-* *.ps *.html
-
-install:       info
-       ${INSTALL_DATA} readline.info $(infodir)/readline.info
-       ${INSTALL_DATA} history.info $(infodir)/history.info
+       $(RM) $(CREATED_DOCS)
+       $(RM) $(INTERMEDIATE_OBJ)
+       $(RM) Makefile
+
+installdirs:   $(top_srcdir)/support/mkdirs
+       -$(SHELL) $(top_srcdir)/support/mkdirs $(infodir) $(man3dir)
+
+install:       installdirs
+       if test -f readline.info; then \
+               ${INSTALL_DATA} readline.info $(infodir)/readline.info; \
+       else \
+               ${INSTALL_DATA} $(srcdir)/readline.info $(infodir)/readline.info; \
+       fi
+       if test -f history.info; then \
+               ${INSTALL_DATA} history.info $(infodir)/history.info; \
+       else \
+               ${INSTALL_DATA} $(srcdir)/history.info $(infodir)/history.info; \
+       fi
+       if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
+               install-info --dir-file=$(infodir)/dir $(infodir)/readline.info ; \
+               install-info --dir-file=$(infodir)/dir $(infodir)/history.info ; \
+       else true; fi
+       -${INSTALL_DATA} $(srcdir)/readline.3 $(man3dir)/readline.3
+
+uninstall:
+       $(RM) $(infodir)/readline.info
+       $(RM) $(infodir)/history.info
+       $(RM) $(man3dir)/readline.3
index be8742f5e66abd1706a71ee521c2c33ba21a63fe..31a0ba0ae72223c07a8e77d301125f0a5dbd830b 100644 (file)
@@ -6,26 +6,19 @@
 
 @setchapternewpage odd
 
-@ignore
-last change: Thu Apr  2 14:38:22 EST 1998
-@end ignore
-
-@set EDITION 2.2
-@set VERSION 2.2
-@set UPDATED 2 April 1998
-@set UPDATE-MONTH April 1998
+@include manvers.texinfo
 
+@ifinfo
 @dircategory Libraries
 @direntry
 * History: (history).       The GNU history library API
 @end direntry
 
-@ifinfo
 This document describes the GNU History library, a programming tool that
 provides a consistent user interface for recalling lines of previously
 typed input.
 
-Copyright (C) 1988, 1991, 1993, 1995, 1996, 1998 Free Software Foundation, Inc.
+Copyright (C) 1988-1999 Free Software Foundation, Inc.
 
 Permission is granted to make and distribute verbatim copies of
 this manual provided the copyright notice and this permission notice
@@ -46,7 +39,7 @@ notice identical to this one.
 Permission is granted to copy and distribute translations of this manual
 into another language, under the above conditions for modified versions,
 except that this permission notice may be stated in a translation approved
-by the Foundation.
+by the Free Software Foundation.
 @end ifinfo
 
 @titlepage
@@ -77,10 +70,10 @@ notice identical to this one.
 Permission is granted to copy and distribute translations of this manual
 into another language, under the above conditions for modified versions,
 except that this permission notice may be stated in a translation approved
-by the Foundation.
+by the Free Software Foundation.
 
 @vskip 0pt plus 1filll
-Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc.
+Copyright @copyright{} 1988-1999 Free Software Foundation, Inc.
 @end titlepage
 
 @ifinfo
diff --git a/lib/readline/doc/manvers.texinfo b/lib/readline/doc/manvers.texinfo
new file mode 100644 (file)
index 0000000..63924e3
--- /dev/null
@@ -0,0 +1,6 @@
+@set EDITION 4.0
+@set VERSION 4.0
+@set UPDATED 31 December 1998
+@set UPDATE-MONTH December 1998
+
+@set LASTCHANGE Thu Dec 31 10:17:05 EST 1998
index dd6478af5a2831ecad1201f428da85f94c795211..41bafbf501b63e14937ea65a607081310994341a 100644 (file)
@@ -6,26 +6,19 @@
 @synindex vr fn
 @setchapternewpage odd
 
-@ignore
-last change: Thu Apr  2 14:39:03 EST 1998
-@end ignore
-
-@set EDITION 2.2
-@set VERSION 2.2
-@set UPDATED 2 April 1998
-@set UPDATE-MONTH April 1998
+@include manvers.texinfo
 
+@ifinfo
 @dircategory Libraries
 @direntry
 * Readline: (readline).       The GNU readline library API
 @end direntry
 
-@ifinfo
 This document describes the GNU Readline Library, a utility which aids
 in the consistency of user interface across discrete programs that need
 to provide a command line interface.
 
-Copyright (C) 1988, 1991, 1993, 1996, 1998 Free Software Foundation, Inc.
+Copyright (C) 1988-1999 Free Software Foundation, Inc.
 
 Permission is granted to make and distribute verbatim copies of
 this manual provided the copyright notice and this permission notice
@@ -46,7 +39,7 @@ notice identical to this one.
 Permission is granted to copy and distribute translations of this manual
 into another language, under the above conditions for modified versions,
 except that this permission notice may be stated in a translation approved
-by the Foundation.
+by the Free Software Foundation.
 @end ifinfo
 
 @titlepage  
@@ -77,10 +70,10 @@ notice identical to this one.
 Permission is granted to copy and distribute translations of this manual
 into another language, under the above conditions for modified versions,
 except that this permission notice may be stated in a translation approved
-by the Foundation.
+by the Free Software Foundation.
 
 @vskip 0pt plus 1filll
-Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc.
+Copyright @copyright{} 1988-1999 Free Software Foundation, Inc.
 @end titlepage
 
 @ifinfo
index bce508717ac3408fb5210053b298bd01a257e3c3..ea8d7f8c5e5e8cc05502a66136be2e6ccdee4a97 100644 (file)
@@ -8,7 +8,7 @@ This document describes the GNU Readline Library, a utility for aiding
 in the consitency of user interface across discrete programs that need
 to provide a command line interface.
 
-Copyright (C) 1988, 1994, 1996 Free Software Foundation, Inc.
+Copyright (C) 1988, 1994, 1996, 1998, 1999 Free Software Foundation, Inc.
 
 Permission is granted to make and distribute verbatim copies of
 this manual provided the copyright notice and this permission notice
@@ -47,7 +47,9 @@ in your own programs, this section is for you.
 * Readline Variables::                 Variables accessible to custom
                                        functions.
 * Readline Convenience Functions::     Functions which Readline supplies to
-                                       aid in writing your own
+                                       aid in writing your own custom
+                                       functions.
+* Readline Signal Handling::   How Readline behaves when it receives signals.
 * Custom Completers::  Supplanting or supplementing Readline's
                        completion functions.
 @end menu
@@ -268,6 +270,13 @@ Setting this to a value makes it the next keystroke read.  This is a
 way to stuff a single character into the input stream.
 @end deftypevar
 
+@deftypevar int rl_erase_empty_line
+Setting this to a non-zero value causes Readline to completely erase
+the current line, including any prompt, any time a newline is typed as
+the only character on an otherwise-empty line.  The cursor is moved to
+the beginning of the newly-blank line.
+@end deftypevar
+
 @deftypevar {char *} rl_prompt
 The prompt Readline uses.  This is set from the argument to
 @code{readline ()}, and should not be assigned to directly.
@@ -300,6 +309,12 @@ If non-zero, this is the address of a function to call just
 before @code{readline} prints the first prompt.
 @end deftypevar
 
+@deftypevar {Function *} rl_pre_input_hook
+If non-zero, this is the address of a function to call after
+the first prompt has been printed and just before @code{readline}
+starts reading input characters.
+@end deftypevar
+
 @deftypevar {Function *} rl_event_hook
 If non-zero, this is the address of a function to call periodically
 when readline is waiting for terminal input.
@@ -619,6 +634,16 @@ is also used to display numeric arguments and search strings.
 Clear the message in the echo area.
 @end deftypefun
 
+@deftypefun void rl_save_prompt ()
+Save the local Readline prompt display state in preparation for
+displaying a new message in the message area with @code{rl_message}.
+@end deftypefun
+
+@deftypefun void rl_restore_prompt ()
+Restore the local Readline prompt display state saved by the most
+recent call to @code{rl_save_prompt}.
+@end deftypefun
+
 @node Modifying Text
 @subsection Modifying Text
 
@@ -689,6 +714,16 @@ Return 1 if @var{c} is a numeric character.
 Ring the terminal bell, obeying the setting of @code{bell-style}.
 @end deftypefun
 
+@deftypefun void rl_display_match_list (char **matches, int len, int max)
+A convenience function for displaying a list of strings in
+columnar format on Readline's output stream.  @code{matches} is the list
+of strings, in argv format, such as a list of completion matches.
+@code{len} is the number of strings in @code{matches}, and @code{max}
+is the length of the longest string in @code{matches}.  This function uses
+the setting of @code{print-completions-horizontally} to select how the
+matches are displayed (@pxref{Readline Init File Syntax}).
+@end deftypefun
+
 The following are implemented as macros, defined in @code{chartypes.h}.
 
 @deftypefun int uppercase_p (int c)
@@ -814,6 +849,116 @@ invert_case_line (count, key)
 @}
 @end example
 
+@node Readline Signal Handling
+@section Readline Signal Handling
+
+Signals are asynchronous events sent to a process by the Unix kernel,
+sometimes on behalf of another process.  They are intended to indicate
+exceptional events, like a user pressing the interrupt key on his
+terminal, or a network connection being broken.  There is a class of
+signals that can be sent to the process currently reading input from
+the keyboard.  Since Readline changes the terminal attributes when it
+is called, it needs to perform special processing when a signal is
+received to restore the terminal to a sane state, or provide application
+writers with functions to do so manually.
+
+Readline contains an internal signal handler that is installed for a
+number of signals (@code{SIGINT}, @code{SIGQUIT}, @code{SIGTERM},
+@code{SIGALRM}, @code{SIGTSTP}, @code{SIGTTIN}, and @code{SIGTTOU}).
+When one of these signals is received, the signal handler
+will reset the terminal attributes to those that were in effect before
+@code{readline ()} was called, reset the signal handling to what it was
+before @code{readline ()} was called, and resend the signal to the calling
+application.
+If and when the calling application's signal handler returns, Readline
+will reinitialize the terminal and continue to accept input.
+When a @code{SIGINT} is received, the Readline signal handler performs
+some additional work, which will cause any partially-entered line to be
+aborted (see the description of @code{rl_free_line_state ()}).
+
+There is an additional Readline signal handler, for @code{SIGWINCH}, which
+the kernel sends to a process whenever the terminal's size changes (for
+example, if a user resizes an @code{xterm}).  The Readline @code{SIGWINCH}
+handler updates Readline's internal screen size state, and then calls any
+@code{SIGWINCH} signal handler the calling application has installed. 
+Readline calls the application's @code{SIGWINCH} signal handler without
+resetting the terminal to its original state.  If the application's signal
+handler does more than update its idea of the terminal size and return (for
+example, a @code{longjmp} back to a main processing loop), it @emph{must}
+call @code{rl_cleanup_after_signal ()} (described below), to restore the
+terminal state. 
+
+Readline provides two variables that allow application writers to
+control whether or not it will catch certain signals and act on them
+when they are received.  It is important that applications change the
+values of these variables only when calling @code{readline ()}, not in
+a signal handler, so Readline's internal signal state is not corrupted.
+
+@deftypevar int rl_catch_signals
+If this variable is non-zero, Readline will install signal handlers for
+@code{SIGINT}, @code{SIGQUIT}, @code{SIGTERM}, @code{SIGALRM},
+@code{SIGTSTP}, @code{SIGTTIN}, and @code{SIGTTOU}.
+
+The default value of @code{rl_catch_signals} is 1.
+@end deftypevar
+
+@deftypevar int rl_catch_sigwinch
+If this variable is non-zero, Readline will install a signal handler for
+@code{SIGWINCH}.
+
+The default value of @code{rl_catch_sigwinch} is 1.
+@end deftypevar
+
+If an application does not wish to have Readline catch any signals, or
+to handle signals other than those Readline catches (@code{SIGHUP},
+for example), 
+Readline provides convenience functions to do the necessary terminal
+and internal state cleanup upon receipt of a signal.
+
+@deftypefun void rl_cleanup_after_signal (void)
+This function will reset the state of the terminal to what it was before
+@code{readline ()} was called, and remove the Readline signal handlers for
+all signals, depending on the values of @code{rl_catch_signals} and
+@code{rl_catch_sigwinch}.
+@end deftypefun
+
+@deftypefun void rl_free_line_state (void)
+This will free any partial state associated with the current input line
+(undo information, any partial history entry, any partially-entered
+keyboard macro, and any partially-entered numeric argument).  This
+should be called before @code{rl_cleanup_after_signal ()}.  The
+Readline signal handler for @code{SIGINT} calls this to abort the
+current input line.
+@end deftypefun
+
+@deftypefun void rl_reset_after_signal (void)
+This will reinitialize the terminal and reinstall any Readline signal
+handlers, depending on the values of @code{rl_catch_signals} and
+@code{rl_catch_sigwinch}.
+@end deftypefun
+
+If an application does not wish Readline to catch @code{SIGWINCH}, it may
+call @code{rl_resize_terminal ()} to force Readline to update its idea of
+the terminal size when a @code{SIGWINCH} is received.
+
+@deftypefun void rl_resize_terminal (void)
+Update Readline's internal screen size.
+@end deftypefun
+
+The following functions install and remove Readline's signal handlers.
+
+@deftypefun int rl_set_signals (void)
+Install Readline's signal handler for @code{SIGINT}, @code{SIGQUIT},
+@code{SIGTERM}, @code{SIGALRM}, @code{SIGTSTP}, @code{SIGTTIN},
+@code{SIGTTOU}, and @code{SIGWINCH}, depending on the values of
+@code{rl_catch_signals} and @code{rl_catch_sigwinch}.
+@end deftypefun
+
+@deftypefun int rl_clear_signals (void)
+Remove all of the Readline signal handlers installed by
+@code{rl_set_signals ()}.
+@end deftypefun
+
 @node Custom Completers
 @section Custom Completers
 
@@ -1108,6 +1253,20 @@ string (the current directory name) as an argument.  It could be used
 to expand symbolic links or shell variables in pathnames.
 @end deftypevar
 
+@deftypevar {VFunction *} rl_completion_display_matches_hook
+If non-zero, then this is the address of a function to call when
+completing a word would normally display the list of possible matches.
+This function is called in lieu of Readline displaying the list.
+It takes three arguments:
+(@code{char **}@var{matches}, @code{int} @var{num_matches}, @code{int} @var{max_length})
+where @var{matches} is the array of matching strings,
+@var{num_matches} is the number of strings in that array, and
+@var{max_length} is the length of the longest string in that array.
+Readline provides a convenience function, @code{rl_display_match_list},
+that takes care of doing the display to Readline's output stream.  That
+function may be called from this hook.
+@end deftypevar
+
 @node A Short Completion Example
 @subsection A Short Completion Example
 
index b2fd060366a284cd3575fc3ed2875db9d8fce0ad..755f7ca3a3552bf6237637d6cf3bd5f9933079db 100644 (file)
@@ -97,7 +97,7 @@ regardless of the location of the cursor within the line.
 * Readline Killing Commands::  How to delete text, and how to get it back!
 * Readline Arguments::         Giving numeric arguments to commands.
 * Searching::                  Searching through previous lines.
- @end menu
+@end menu
 
 @node Readline Bare Essentials
 @subsection Readline Bare Essentials
@@ -252,8 +252,10 @@ As each character of the search string is typed, Readline displays
 the next entry from the history matching the string typed so far.
 An incremental search requires only as many characters as needed to
 find the desired history entry.
-The @key{ESC} character is used to terminate an incremental search.
-@key{C-j} will also terminate the search.
+The characters present in the value of the @var{isearch-terminators} variable
+are used to terminate an incremental search.
+If that variable has not been assigned a value, the @key{ESC} and
+@key{C-J} characters will terminate an incremental search.
 @key{C-g} will abort an incremental search and restore the original line.
 When the search is terminated, the history entry containing the
 search string becomes the current line.
@@ -396,6 +398,22 @@ horizontally on a single screen line when they are longer than the width
 of the screen, instead of wrapping onto a new screen line.  By default,
 this variable is set to @samp{off}.
 
+@item input-meta
+@vindex input-meta
+@vindex meta-flag
+If set to @samp{on}, Readline will enable eight-bit input (it
+will not strip the eighth bit from the characters it reads),
+regardless of what the terminal claims it can support.  The
+default value is @samp{off}.  The name @code{meta-flag} is a
+synonym for this variable.
+
+@item isearch-terminators
+@vindex isearch-terminators
+The string of characters that should terminate an incremental search without
+subsequently executing the character as a command (@pxref{Searching}).
+If this variable has not been given a value, the characters @key{ESC} and
+@key{C-J} will terminate an incremental search.
+
 @item keymap
 @vindex keymap
 Sets Readline's idea of the current keymap for key binding commands.
@@ -422,15 +440,6 @@ This variable, when set to @samp{on}, causes Readline to display an
 asterisk (@samp{*}) at the start of history lines which have been modified.
 This variable is @samp{off} by default.
 
-@item input-meta
-@vindex input-meta
-@vindex meta-flag
-If set to @samp{on}, Readline will enable eight-bit input (it
-will not strip the eighth bit from the characters it reads),
-regardless of what the terminal claims it can support.  The
-default value is @samp{off}.  The name @code{meta-flag} is a
-synonym for this variable.
-
 @item output-meta
 @vindex output-meta
 If set to @samp{on}, Readline will display characters with the
@@ -876,6 +885,11 @@ return @code{EOF}.
 Delete the character behind the cursor.  A numeric argument means
 to kill the characters instead of deleting them.
 
+@item forward-backward-delete-char ()
+Delete the character under the cursor, unless the cursor is at the
+end of the line, in which case the character behind the cursor is
+deleted.  By default, this is not bound to a key.
+
 @item quoted-insert (C-q, C-v)
 Add the next character typed to the line verbatim.  This is
 how to insert key sequences like @key{C-q}, for example.
@@ -1039,6 +1053,13 @@ through the list.
 This command is intended to be bound to @code{TAB}, but is unbound
 by default.
 
+@item delete-char-or-list ()
+Deletes the character under the cursor if not at the beginning or
+end of the line (like @code{delete-char}).
+If at the end of the line, behaves identically to
+@code{possible-completions}.
+This command is unbound by default.
+
 @ifset BashFeatures
 @item complete-filename (M-/)
 Attempt filename completion on the text before point.
@@ -1141,7 +1162,12 @@ Incremental undo, separately remembered for each line.
 Undo all changes made to this line.  This is like executing the @code{undo}
 command enough times to get back to the beginning.
 
+@ifset BashFeatures
+@item tilde-expand (M-&)
+@end ifset
+@ifclear BashFeatures
 @item tilde-expand (M-~)
+@end ifclear
 Perform tilde expansion on the current word.
 
 @item set-mark (C-@@)
index 6c2f34313ffd8561f0d7a7bc3652a678ce7ff86e..17a63434f24f38ba404fc5a015bb05aca85d329e 100644 (file)
@@ -12,7 +12,7 @@
 #define READLINE_LIBRARY
 
 #if defined (HAVE_CONFIG_H)
-#include <config.h>
+#  include <config.h>
 #endif
 
 #include <stdio.h>
@@ -24,7 +24,9 @@
 extern int optind;
 extern char *optarg;
 
+#if !defined (strchr) && !defined (__STDC__)
 extern char *strrchr();
+#endif
 
 static char *progname;
 static char *deftext;
@@ -40,6 +42,7 @@ set_deftext ()
     }
 }
 
+static void
 usage()
 {
   fprintf (stderr, "%s: usage: %s [-p prompt] [-u unit] [-d default]\n",
@@ -52,7 +55,7 @@ main (argc, argv)
 {
   char *temp, *prompt;
   struct stat sb;
-  int done, opt, fd;
+  int opt, fd;
   FILE *ifp;
 
   progname = strrchr(argv[0], '/');
index 3946e0fc26ebb125ef274a4d17b4121d9aaa91e3..f6b86286fe0791d739224eeb15012ff2bbf92880 100644 (file)
@@ -71,6 +71,7 @@ static FUNMAP default_funmap[] = {
   { "copy-forward-word", rl_copy_forward_word },
   { "copy-region-as-kill", rl_copy_region_to_kill },
   { "delete-char", rl_delete },
+  { "delete-char-or-list", rl_delete_or_show_completions },
   { "delete-horizontal-space", rl_delete_horizontal_space },
   { "digit-argument", rl_digit_argument },
   { "do-lowercase-version", rl_do_lowercase_version },
@@ -83,6 +84,7 @@ static FUNMAP default_funmap[] = {
   { "end-of-history", rl_end_of_history },
   { "end-of-line", rl_end_of_line },
   { "exchange-point-and-mark", rl_exchange_point_and_mark },
+  { "forward-backward-delete-char", rl_rubout_or_delete },
   { "forward-char", rl_forward },
   { "forward-search-history", rl_forward_search_history },
   { "forward-word", rl_forward_word },
index 0dc179ac7f6590cd9557793610998d194d1b3c4d..392e6d38d9ec771b77019df9272fa42c62d9f22f 100644 (file)
@@ -365,6 +365,10 @@ hist_error(s, start, current, errtype)
       emsg = "unrecognized history modifier";
       elen = 29;
       break;
+    case NO_PREV_SUBST:
+      emsg = "no previous substitution";
+      elen = 24;
+      break;
     default:
       emsg = "unknown expansion error";
       elen = 23;
@@ -654,15 +658,6 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
                      }
                  }
 
-               /* If there is no lhs, the substitution can't succeed. */
-               if (subst_lhs_len == 0)
-                 {
-                   *ret_string = hist_error (string, starting_index, i, SUBST_FAILED);
-                   free (result);
-                   free (temp);
-                   return -1;
-                 }
-
                FREE (subst_rhs);
                subst_rhs = get_subst_pattern (string, &i, delimiter, 1, &subst_rhs_len);
 
@@ -674,6 +669,15 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
            else
              i += 2;
 
+           /* If there is no lhs, the substitution can't succeed. */
+           if (subst_lhs_len == 0)
+             {
+               *ret_string = hist_error (string, starting_index, i, NO_PREV_SUBST);
+               free (result);
+               free (temp);
+               return -1;
+             }
+
            l_temp = strlen (temp);
            /* Ignore impossible cases. */
            if (subst_lhs_len > l_temp)
index 81dda57d0fe6aa1417d356127578aff98533f29a..3325b7fc1f7193c4dbea6c32026db3b95c035582 100644 (file)
@@ -155,7 +155,11 @@ read_history_range (filename, from, to)
     }
 
   buffer = xmalloc (file_size + 1);
+#if 0
   if (read (file, buffer, file_size) != file_size)
+#else
+  if (read (file, buffer, file_size) < 0)
+#endif
     {
   error_and_exit:
       if (file >= 0)
@@ -217,7 +221,7 @@ read_history_range (filename, from, to)
 int
 history_truncate_file (fname, lines)
      char *fname;
-     register int lines;
+     int lines;
 {
   register int i;
   int file, chars_read;
@@ -276,6 +280,12 @@ history_truncate_file (fname, lines)
   if (i && ((file = open (filename, O_WRONLY|O_TRUNC|O_BINARY, 0600)) != -1))
     {
       write (file, buffer + i, file_size - i);
+
+#if defined (__BEOS__)
+      /* BeOS ignores O_TRUNC. */
+      ftruncate (file, file_size - i);
+#endif
+
       close (file);
     }
 
index 10a40d7919b9c90e1d61e7349f3db7c143d181e6..422cf5974db323b613f408e56e792c2b20b5dba9 100644 (file)
@@ -69,6 +69,7 @@ extern char *strchr ();
 #define BAD_WORD_SPEC  1
 #define SUBST_FAILED   2
 #define BAD_MODIFIER   3
+#define NO_PREV_SUBST  4
 
 /* Possible definitions for history starting point specification. */
 #define ANCHORED_SEARCH 1
index 24c5a49c359660727bd9bdbb9fa1baaece047f18..d56ffacc6a003a7e94edc9f057c8b8a1768f996f 100644 (file)
@@ -278,7 +278,7 @@ HIST_ENTRY *
 replace_history_entry (which, line, data)
      int which;
      char *line;
-     char *data;
+     histdata_t data;
 {
   HIST_ENTRY *temp = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY));
   HIST_ENTRY *old_value;
index e49a341492f18565c961453c21e89b0f18b842b2..8ecce726779e70ac9671dc834f510bb41da03840 100644 (file)
 #ifndef _HISTORY_H_
 #define _HISTORY_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined READLINE_LIBRARY
+#  include "rlstdc.h"
+#else
+#  include <readline/rlstdc.h>
+#endif
+
 #if !defined (_FUNCTION_DEF)
 #  define _FUNCTION_DEF
 typedef int Function ();
@@ -30,10 +40,16 @@ typedef char *CPFunction ();
 typedef char **CPPFunction ();
 #endif
 
+#ifdef __STDC__
+typedef void *histdata_t;
+#else
+typedef char *histdata_t;
+#endif
+
 /* The structure used to store a history entry. */
 typedef struct _hist_entry {
   char *line;
-  char *data;
+  histdata_t data;
 } HIST_ENTRY;
 
 /* A structure used to pass the current state of the history stuff around. */
@@ -52,81 +68,81 @@ typedef struct _hist_state {
 
 /* Begin a session in which the history functions might be used.  This
    just initializes the interactive variables. */
-extern void using_history ();
+extern void using_history __P((void));
 
 /* Return the current HISTORY_STATE of the history. */
-extern HISTORY_STATE *history_get_history_state ();
+extern HISTORY_STATE *history_get_history_state __P((void));
 
 /* Set the state of the current history array to STATE. */
-extern void history_set_history_state ();
+extern void history_set_history_state __P((HISTORY_STATE *));
 
 /* Manage the history list. */
 
 /* Place STRING at the end of the history list.
    The associated data field (if any) is set to NULL. */
-extern void add_history ();
+extern void add_history __P((char *));
 
 /* A reasonably useless function, only here for completeness.  WHICH
    is the magic number that tells us which element to delete.  The
    elements are numbered from 0. */
-extern HIST_ENTRY *remove_history ();
+extern HIST_ENTRY *remove_history __P((int));
 
 /* Make the history entry at WHICH have LINE and DATA.  This returns
    the old entry so you can dispose of the data.  In the case of an
    invalid WHICH, a NULL pointer is returned. */
-extern HIST_ENTRY *replace_history_entry ();
+extern HIST_ENTRY *replace_history_entry __P((int, char *, histdata_t));
 
 /* Clear the history list and start over. */
-extern void clear_history ();
+extern void clear_history __P((void));
 
 /* Stifle the history list, remembering only MAX number of entries. */
-extern void stifle_history ();
+extern void stifle_history __P((int));
 
 /* Stop stifling the history.  This returns the previous amount the
    history was stifled by.  The value is positive if the history was
    stifled, negative if it wasn't. */
-extern int unstifle_history ();
+extern int unstifle_history __P((void));
 
 /* Return 1 if the history is stifled, 0 if it is not. */
-extern int history_is_stifled ();
+extern int history_is_stifled __P((void));
 
 /* Information about the history list. */
 
 /* Return a NULL terminated array of HIST_ENTRY which is the current input
    history.  Element 0 of this list is the beginning of time.  If there
    is no history, return NULL. */
-extern HIST_ENTRY **history_list ();
+extern HIST_ENTRY **history_list __P((void));
 
 /* Returns the number which says what history element we are now
    looking at.  */
-extern int where_history ();
+extern int where_history __P((void));
   
 /* Return the history entry at the current position, as determined by
    history_offset.  If there is no entry there, return a NULL pointer. */
-HIST_ENTRY *current_history ();
+HIST_ENTRY *current_history __P((void));
 
 /* Return the history entry which is logically at OFFSET in the history
    array.  OFFSET is relative to history_base. */
-extern HIST_ENTRY *history_get ();
+extern HIST_ENTRY *history_get __P((int));
 
 /* Return the number of bytes that the primary history entries are using.
    This just adds up the lengths of the_history->lines. */
-extern int history_total_bytes ();
+extern int history_total_bytes __P((void));
 
 /* Moving around the history list. */
 
 /* Set the position in the history list to POS. */
-int history_set_pos ();
+int history_set_pos __P((int));
 
 /* Back up history_offset to the previous history entry, and return
    a pointer to that entry.  If there is no previous entry, return
    a NULL pointer. */
-extern HIST_ENTRY *previous_history ();
+extern HIST_ENTRY *previous_history __P((void));
 
 /* Move history_offset forward to the next item in the input_history,
    and return the a pointer to that entry.  If there is no next entry,
    return a NULL pointer. */
-extern HIST_ENTRY *next_history ();
+extern HIST_ENTRY *next_history __P((void));
 
 /* Searching the history list. */
 
@@ -136,44 +152,45 @@ extern HIST_ENTRY *next_history ();
    current_history () is the history entry, and the value of this function
    is the offset in the line of that history entry that the string was
    found in.  Otherwise, nothing is changed, and a -1 is returned. */
-extern int history_search ();
+extern int history_search __P((char *, int));
 
 /* Search the history for STRING, starting at history_offset.
-   The search is anchored: matching lines must begin with string. */
-extern int history_search_prefix ();
+   The search is anchored: matching lines must begin with string.
+   DIRECTION is as in history_search(). */
+extern int history_search_prefix __P((char *, int));
 
 /* Search for STRING in the history list, starting at POS, an
    absolute index into the list.  DIR, if negative, says to search
    backwards from POS, else forwards.
    Returns the absolute index of the history element where STRING
    was found, or -1 otherwise. */
-extern int history_search_pos ();
+extern int history_search_pos __P((char *, int, int));
 
 /* Managing the history file. */
 
 /* Add the contents of FILENAME to the history list, a line at a time.
    If FILENAME is NULL, then read from ~/.history.  Returns 0 if
    successful, or errno if not. */
-extern int read_history ();
+extern int read_history __P((char *));
 
 /* Read a range of lines from FILENAME, adding them to the history list.
    Start reading at the FROM'th line and end at the TO'th.  If FROM
    is zero, start at the beginning.  If TO is less than FROM, read
    until the end of the file.  If FILENAME is NULL, then read from
    ~/.history.  Returns 0 if successful, or errno if not. */
-extern int read_history_range ();
+extern int read_history_range __P((char *, int, int));
 
 /* Write the current history to FILENAME.  If FILENAME is NULL,
    then write the history list to ~/.history.  Values returned
    are as in read_history ().  */
-extern int write_history ();
+extern int write_history __P((char *));
 
 /* Append NELEMENT entries to FILENAME.  The entries appended are from
    the end of the list minus NELEMENTs up to the end of the list. */
-int append_history ();
+int append_history __P((int, char *));
 
 /* Truncate the history file, leaving only the last NLINES lines. */
-extern int history_truncate_file ();
+extern int history_truncate_file __P((char *, int));
 
 /* History expansion. */
 
@@ -189,20 +206,24 @@ extern int history_truncate_file ();
 
   If an error ocurred in expansion, then OUTPUT contains a descriptive
   error message. */
-extern int history_expand ();
+extern int history_expand __P((char *, char **));
 
 /* Extract a string segment consisting of the FIRST through LAST
    arguments present in STRING.  Arguments are broken up as in
    the shell. */
-extern char *history_arg_extract ();
+extern char *history_arg_extract __P((int, int, char *));
 
 /* Return the text of the history event beginning at the current
-   offset into STRING. */
-extern char *get_history_event ();
+   offset into STRING.  Pass STRING with *INDEX equal to the
+   history_expansion_char that begins this specification.
+   DELIMITING_QUOTE is a character that is allowed to end the string
+   specification for what to search for in addition to the normal
+   characters `:', ` ', `\t', `\n', and sometimes `?'. */
+extern char *get_history_event __P((char *, int *, int));
 
 /* Return an array of tokens, much as the shell might.  The tokens are
    parsed out of STRING. */
-extern char **history_tokenize ();
+extern char **history_tokenize __P((char *));
 
 /* Exported history variables. */
 extern int history_base;
@@ -220,4 +241,8 @@ extern int history_quotes_inhibit_expansion;
    application and not expanded. */
 extern Function *history_inhibit_expansion_function;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* !_HISTORY_H_ */
index 7e3c0feb5ce8b0a7f6a4d053794e058d3cdd661a..3b48483d2625a705d8ddd1c8186cdcc6f48b34fd 100644 (file)
@@ -124,38 +124,13 @@ _rl_any_typein ()
   return any_typein;
 }
 
-/* Add KEY to the buffer of characters to be read. */
-int
-rl_stuff_char (key)
-     int key;
-{
-  if (key == EOF)
-    {
-      key = NEWLINE;
-      rl_pending_input = EOF;
-    }
-  ibuffer[push_index++] = key;
-  if (push_index >= ibuffer_len)
-    push_index = 0;
-  return push_index;
-}
-
-/* Make C be the next command to be executed. */
-int
-rl_execute_next (c)
-     int c;
-{
-  rl_pending_input = c;
-  return 0;
-}
-
-/* Return the amount of space available in the
-   buffer for stuffing characters. */
+/* Return the amount of space available in the buffer for stuffing
+   characters. */
 static int
 ibuffer_space ()
 {
   if (pop_index > push_index)
-    return (pop_index - push_index);
+    return (pop_index - push_index - 1);
   else
     return (ibuffer_len - (push_index - pop_index));
 }
@@ -341,6 +316,36 @@ _rl_insert_typein (c)
   free (string);
 }
 
+/* Add KEY to the buffer of characters to be read.  Returns 1 if the
+   character was stuffed correctly; 0 otherwise. */
+int
+rl_stuff_char (key)
+     int key;
+{
+  if (ibuffer_space () == 0)
+    return 0;
+
+  if (key == EOF)
+    {
+      key = NEWLINE;
+      rl_pending_input = EOF;
+    }
+  ibuffer[push_index++] = key;
+  if (push_index >= ibuffer_len)
+    push_index = 0;
+
+  return 1;
+}
+
+/* Make C be the next command to be executed. */
+int
+rl_execute_next (c)
+     int c;
+{
+  rl_pending_input = c;
+  return 0;
+}
+
 /* **************************************************************** */
 /*                                                                 */
 /*                          Character Input                        */
@@ -409,6 +414,11 @@ rl_getc (stream)
       if (result == 0)
        return (EOF);
 
+#if defined (__BEOS__)
+      if (errno == EINTR)
+       continue;
+#endif
+
 #if defined (EWOULDBLOCK)
       if (errno == EWOULDBLOCK)
        {
index 7decf9595b0f5aed3a50c7d95ae4882b57dc9aef..67279e18924ae9a9e15d7ced402476a7a7957f66 100644 (file)
@@ -48,6 +48,9 @@
 #include "readline.h"
 #include "history.h"
 
+/* Variables exported to other files in the readline library. */
+unsigned char *_rl_isearch_terminators = (unsigned char *)NULL;
+
 /* Variables imported from other files in the readline library. */
 extern Keymap _rl_keymap;
 extern HIST_ENTRY *saved_line_for_history;
@@ -55,9 +58,6 @@ extern int rl_line_buffer_len;
 extern int rl_point, rl_end;
 extern char *rl_line_buffer;
 
-extern void _rl_save_prompt ();
-extern void _rl_restore_prompt ();
-
 extern int rl_execute_next ();
 extern void rl_extend_line_buffer ();
 
@@ -178,12 +178,20 @@ rl_search_history (direction, invoking_key)
   /* Non-zero if we are doing a reverse search. */
   int reverse;
 
+  /* The list of characters which terminate the search, but are not
+     subsequently executed.  If the variable isearch-terminators has
+     been set, we use that value, otherwise we use ESC and C-J. */
+  unsigned char *isearch_terminators;
+
   orig_point = rl_point;
   last_found_line = orig_line = where_history ();
   reverse = direction < 0;
   hlist = history_list ();
   allocated_line = (char *)NULL;
 
+  isearch_terminators = _rl_isearch_terminators ? _rl_isearch_terminators
+                                               : (unsigned char *)"\033\012";
+
   /* Create an arrary of pointers to the lines that we want to search. */
   maybe_replace_line ();
   i = 0;
@@ -211,7 +219,7 @@ rl_search_history (direction, invoking_key)
   /* The line where we start the search. */
   i = orig_line;
 
-  _rl_save_prompt ();
+  rl_save_prompt ();
 
   /* Initialize search parameters. */
   search_string = xmalloc (search_string_size = 128);
@@ -246,10 +254,18 @@ rl_search_history (direction, invoking_key)
            c =  !reverse ? -1 : -2;
        }
 
+#if 0
       /* Let NEWLINE (^J) terminate the search for people who don't like
         using ESC.  ^M can still be used to terminate the search and
         immediately execute the command. */
       if (c == ESC || c == NEWLINE)
+#else
+      /* The characters in isearch_terminators (set from the user-settable
+        variable isearch-terminators) are used to terminate the search but
+        not subsequently execute the character as a command.  The default
+        value is "\033\012" (ESC and C-J). */
+      if (strchr (isearch_terminators, c))
+#endif
        {
          /* ESC still terminates the search, but if there is pending
             input or if input arrives within 0.1 seconds (on systems
@@ -291,7 +307,7 @@ rl_search_history (direction, invoking_key)
          strcpy (rl_line_buffer, lines[orig_line]);
          rl_point = orig_point;
          rl_end = strlen (rl_line_buffer);
-         _rl_restore_prompt();
+         rl_restore_prompt();
          rl_clear_message ();
          if (allocated_line)
            free (allocated_line);
@@ -409,15 +425,15 @@ rl_search_history (direction, invoking_key)
   /* First put back the original state. */
   strcpy (rl_line_buffer, lines[orig_line]);
 
-  _rl_restore_prompt ();
+  rl_restore_prompt ();
 
   /* Free the search string. */
   free (search_string);
 
   if (last_found_line < orig_line)
-    rl_get_previous_history (orig_line - last_found_line);
+    rl_get_previous_history (orig_line - last_found_line, 0);
   else
-    rl_get_next_history (last_found_line - orig_line);
+    rl_get_next_history (last_found_line - orig_line, 0);
 
   /* If the string was not found, put point at the end of the line. */
   if (line_index < 0)
index 9359749ddc0c1ff13b0ddcf7de04a0e7c51427d5..c73666bf273af65a449cbf5d86d58d3950047be4 100644 (file)
@@ -124,7 +124,7 @@ rl_make_keymap ()
 /* Free the storage associated with MAP. */
 void
 rl_discard_keymap (map)
-     Keymap (map);
+     Keymap map;
 {
   int i;
 
index f6143f86f2627bf595d4d61a5ba4e7feca76a918..5dff46f56c2dc006d3fd749cf7ca99a2d430e451 100644 (file)
 #define _KEYMAPS_H_
 
 #if defined (READLINE_LIBRARY)
+#  include "rlstdc.h"
 #  include "chardefs.h"
 #else
+#  include <readline/rlstdc.h>
 #  include <readline/chardefs.h>
 #endif
 
@@ -70,26 +72,29 @@ extern KEYMAP_ENTRY_ARRAY vi_insertion_keymap, vi_movement_keymap;
 
 /* Return a new, empty keymap.
    Free it with free() when you are done. */
-extern Keymap rl_make_bare_keymap ();
+extern Keymap rl_make_bare_keymap __P((void));
 
 /* Return a new keymap which is a copy of MAP. */
-extern Keymap rl_copy_keymap ();
+extern Keymap rl_copy_keymap __P((Keymap));
 
 /* Return a new keymap with the printing characters bound to rl_insert,
    the lowercase Meta characters bound to run their equivalents, and
    the Meta digits bound to produce numeric arguments. */
-extern Keymap rl_make_keymap ();
+extern Keymap rl_make_keymap __P((void));
 
-extern void rl_discard_keymap ();
+/* Free the storage associated with a keymap. */
+extern void rl_discard_keymap __P((Keymap));
+
+/* These functions actually appear in bind.c */
 
 /* Return the keymap corresponding to a given name.  Names look like
-   `emacs' or `emacs-meta' or `vi-insert'. */
-extern Keymap rl_get_keymap_by_name ();
+   `emacs' or `emacs-meta' or `vi-insert'.  */
+extern Keymap rl_get_keymap_by_name __P((char *));
 
 /* Return the current keymap. */
-extern Keymap rl_get_keymap ();
+extern Keymap rl_get_keymap __P((void));
 
 /* Set the current keymap to MAP. */
-extern void rl_set_keymap ();
+extern void rl_set_keymap __P((Keymap));
 
 #endif /* _KEYMAPS_H_ */
index a150e3c28d245c2c9ba0632c35038395cae39046..0b4714fafa802ff2eb788788597b03aca2077eac 100644 (file)
@@ -572,6 +572,8 @@ rl_yank_last_arg (count, key)
   static int explicit_arg_p = 0;
   static int count_passed = 1;
   static int direction = 1;
+  static int undo_needed = 0;
+  int retval;
 
   if (rl_last_func != rl_yank_last_arg)
     {
@@ -582,19 +584,22 @@ rl_yank_last_arg (count, key)
     }
   else
     {
-      rl_do_undo ();
+      if (undo_needed)
+       rl_do_undo ();
       if (count < 1)
         direction = -direction;
       history_skip += direction;
       if (history_skip < 0)
        history_skip = 0;
-      count_passed = count;
     }
  
   if (explicit_arg_p)
-    return (rl_yank_nth_arg_internal (count, key, history_skip));
+    retval = rl_yank_nth_arg_internal (count_passed, key, history_skip);
   else
-    return (rl_yank_nth_arg_internal ('$', key, history_skip));
+    retval = rl_yank_nth_arg_internal ('$', key, history_skip);
+
+  undo_needed = retval == 0;
+  return retval;
 }
 
 /* A special paste command for users of Cygnus's cygwin32. */
index 2c7251fd9804ede8f5645f1f47da0aff48adbe2a..a500c0afac717c6ef17c39cb6194cea758ed0c70 100644 (file)
@@ -102,7 +102,7 @@ rl_insert_close (count, invoking_key)
       FD_ZERO (&readfds);
       FD_SET (fileno (rl_instream), &readfds);
       timer.tv_sec = 0;
-      timer.tv_usec = 500;
+      timer.tv_usec = 500000;
 
       orig_point = rl_point;
       rl_point = match_point;
index 8703d17e9fbd0354ea794d9223c7fe3ee32f9670..1347cc07ebc507bc31b2fbb1eec3f6d6c0865218 100644 (file)
@@ -9,10 +9,12 @@
 
 #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))
+#  if !defined (__OPENNT)
+#    undef setjmp
+#    define setjmp(x)  sigsetjmp((x), 1)
+#    undef longjmp
+#    define longjmp(x, n)      siglongjmp((x), (n))
+#  endif /* !__OPENNT */
 #else
 #  define procenv_t    jmp_buf
 #endif
index 8ff6e98929fd8337ec9c31d374582a385698af8d..622811fc11e3e8cef03de968e9978fff0e2953f0 100644 (file)
@@ -64,7 +64,7 @@
 #include "history.h"
 
 #ifndef RL_LIBRARY_VERSION
-#  define RL_LIBRARY_VERSION "2.2-bash"
+#  define RL_LIBRARY_VERSION "4.0"
 #endif
 
 /* Evaluates its arguments multiple times. */
@@ -83,7 +83,6 @@ extern void _rl_output_character_function ();
 #else
 extern int _rl_output_character_function ();
 #endif
-extern void _rl_get_screen_size ();
 
 extern int _rl_enable_meta;
 extern int _rl_term_autowrap;
@@ -100,7 +99,6 @@ extern int alphabetic ();
 
 /* Functions imported from bind.c. */
 extern void _rl_bind_if_unbound ();
-extern int rl_set_keymap_from_edit_mode ();
 
 /* Functions imported from input.c. */
 extern int _rl_any_typein ();
@@ -118,9 +116,7 @@ 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_entire_line ();
 
 extern void _rl_erase_at_end_of_line ();
 extern void _rl_move_cursor_relative ();
@@ -253,9 +249,14 @@ int rl_visible_prompt_length = 0;
 int rl_key_sequence_length = 0;
 
 /* If non-zero, then this is the address of a function to call just
-   before readline_internal () prints the first prompt. */
+   before readline_internal_setup () prints the first prompt. */
 Function *rl_startup_hook = (Function *)NULL;
 
+/* If non-zero, this is the address of a function to call just before
+   readline_internal_setup () returns and readline_internal starts
+   reading input characters. */
+Function *rl_pre_input_hook = (Function *)NULL;
+
 /* What we use internally.  You should always refer to RL_LINE_BUFFER. */
 static char *the_line;
 
@@ -286,6 +287,9 @@ char *_rl_comment_begin;
 /* Keymap holding the function currently being executed. */
 Keymap rl_executing_keymap;
 
+/* Non-zero means to erase entire line, including prompt, on empty input lines. */
+int rl_erase_empty_line = 0;
+
 /* Line buffer and maintenence. */
 char *rl_line_buffer = (char *)NULL;
 int rl_line_buffer_len = 0;
@@ -388,6 +392,9 @@ readline_internal_setup ()
        rl_vi_insertion_mode (1, 0);
 #endif /* VI_MODE */
     }
+
+  if (rl_pre_input_hook)
+    (*rl_pre_input_hook) ();
 }
 
 STATIC_CALLBACK char *
@@ -405,7 +412,7 @@ readline_internal_teardown (eof)
     {
       temp = savestring (the_line);
       rl_revert_line (1, 0);
-      entry = replace_history_entry (where_history (), the_line, (HIST_ENTRY *)NULL);
+      entry = replace_history_entry (where_history (), the_line, (histdata_t)NULL);
       _rl_free_history_entry (entry);
 
       strcpy (the_line, temp);
@@ -488,6 +495,12 @@ readline_internal_charloop ()
       if (rl_done == 0)
        (*rl_redisplay_function) ();
 
+      /* If the application writer has told us to erase the entire line if
+         the only character typed was something bound to rl_newline, do so. */
+      if (rl_erase_empty_line && rl_done && rl_last_func == rl_newline &&
+         rl_point == 0 && rl_end == 0)
+       _rl_erase_entire_line ();
+
 #if defined (READLINE_CALLBACKS)
       return 0;
 #else
@@ -501,7 +514,7 @@ readline_internal_charloop ()
 static int
 readline_internal_charloop ()
 {
-  int eof;
+  int eof = 1;
 
   while (rl_done == 0)
     eof = readline_internal_char ();
@@ -837,11 +850,19 @@ rl_digit_loop ()
 {
   int key, c, sawminus, sawdigits;
 
-  _rl_save_prompt ();
+  rl_save_prompt ();
 
   sawminus = sawdigits = 0;
   while (1)
     {
+      if (rl_numeric_arg > 1000000)
+       {
+         sawdigits = rl_explicit_arg = rl_numeric_arg = 0;
+         ding ();
+         rl_restore_prompt ();
+         rl_clear_message ();
+         return 1;
+       }
       rl_message ("(arg: %d) ", rl_arg_sign * rl_numeric_arg);
       key = c = rl_read_key ();
 
@@ -858,7 +879,7 @@ rl_digit_loop ()
          else
            {
              key = rl_read_key ();
-             _rl_restore_prompt ();
+             rl_restore_prompt ();
              rl_clear_message ();
              return (_rl_dispatch (key, _rl_keymap));
            }
@@ -881,7 +902,7 @@ rl_digit_loop ()
          /* 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_restore_prompt ();
          rl_clear_message ();
          return (_rl_dispatch (key, _rl_keymap));
        }
@@ -1231,7 +1252,8 @@ rl_backward_word (count, key)
 
 /* Clear the current line.  Numeric argument to C-l does this. */
 int
-rl_refresh_line ()
+rl_refresh_line (ignore1, ignore2)
+     int ignore1, ignore2;
 {
   int curr_line, nleft;
 
@@ -1278,7 +1300,7 @@ rl_clear_screen (count, key)
 {
   if (rl_explicit_arg)
     {
-      rl_refresh_line ();
+      rl_refresh_line (count, key);
       return 0;
     }
 
@@ -1428,6 +1450,11 @@ rl_newline (count, key)
     }
 #endif /* VI_MODE */
 
+  /* If we've been asked to erase empty lines, suppress the final update,
+     since _rl_update_final calls crlf(). */
+  if (rl_erase_empty_line && rl_point == 0 && rl_end == 0)
+    return 0;
+
   if (readline_echoing_p)
     _rl_update_final ();
   return 0;
@@ -1507,9 +1534,22 @@ rl_delete (count, key)
     }
   else
     return (rl_delete_text (rl_point, rl_point + 1));
-  
 }
 
+/* Delete the character under the cursor, unless the insertion
+   point is at the end of the line, in which case the character
+   behind the cursor is deleted.  COUNT is obeyed and may be used
+   to delete forward or backward that many characters. */      
+int
+rl_rubout_or_delete (count, key)
+     int count, key;
+{
+  if (rl_end != 0 && rl_point == rl_end)
+    return (rl_rubout (count, key));
+  else
+    return (rl_delete (count, key));
+}  
+
 /* Delete all spaces and tabs around point. */
 int
 rl_delete_horizontal_space (count, ignore)
@@ -1533,6 +1573,19 @@ rl_delete_horizontal_space (count, ignore)
   return 0;
 }
 
+/* Like the tcsh editing function delete-char-or-list.  The eof character
+   is caught before this is invoked, so this really does the same thing as
+   delete-char-or-list-or-eof, as long as it's bound to the eof character. */
+int
+rl_delete_or_show_completions (count, key)
+     int count, key;
+{
+  if (rl_end != 0 && rl_point == rl_end)
+    return (rl_possible_completions (count, key));
+  else
+    return (rl_delete (count, key));
+}
+
 #ifndef RL_COMMENT_BEGIN_DEFAULT
 #define RL_COMMENT_BEGIN_DEFAULT "#"
 #endif
@@ -1859,7 +1912,7 @@ maybe_replace_line ()
   /* If the current line has changed, save the changes. */
   if (temp && ((UNDO_LIST *)(temp->data) != rl_undo_list))
     {
-      temp = replace_history_entry (where_history (), the_line, rl_undo_list);
+      temp = replace_history_entry (where_history (), the_line, (histdata_t)rl_undo_list);
       free (temp->line);
       free (temp);
     }
index 280ec32f13ff49e060f30136509cfe36168ecd37..dba1a0fdde95fee935d51f5d2df5b4abb74aab77 100644 (file)
 #if !defined (_READLINE_H_)
 #define _READLINE_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #if defined (READLINE_LIBRARY)
+#  include "rlstdc.h"
 #  include "keymaps.h"
 #  include "tilde.h"
 #else
+#  include <readline/rlstdc.h>
 #  include <readline/keymaps.h>
 #  include <readline/tilde.h>
 #endif
@@ -60,78 +66,191 @@ typedef struct _funmap {
 
 extern FUNMAP **funmap;
 
-/* Functions available to bind to key sequences. */
-extern int
-  rl_tilde_expand (), rl_set_mark (), rl_exchange_point_and_mark (),
-  rl_beg_of_line (), rl_backward (), rl_delete (), rl_end_of_line (),
-  rl_forward (), ding (), rl_newline (), rl_kill_line (),
-  rl_copy_region_to_kill (), rl_kill_region (), rl_char_search (),
-  rl_clear_screen (), rl_get_next_history (), rl_get_previous_history (),
-  rl_quoted_insert (), rl_reverse_search_history (), rl_transpose_chars (),
-  rl_unix_line_discard (), rl_unix_word_rubout (),
-  rl_yank (), rl_rubout (), rl_backward_word (), rl_kill_word (),
-  rl_forward_word (), rl_tab_insert (), rl_yank_pop (), rl_yank_nth_arg (),
-  rl_backward_kill_word (), rl_backward_kill_line (), rl_transpose_words (),
-  rl_complete (), rl_possible_completions (), rl_insert_completions (),
-  rl_menu_complete (),
-  rl_do_lowercase_version (), rl_kill_full_line (),
-  rl_digit_argument (), rl_universal_argument (), rl_abort (),
-  rl_undo_command (), rl_revert_line (), rl_beginning_of_history (),
-  rl_end_of_history (), rl_forward_search_history (), rl_insert (),
-  rl_upcase_word (), rl_downcase_word (), rl_capitalize_word (),
-  rl_restart_output (), rl_re_read_init_file (),
-  rl_dump_functions (), rl_dump_variables (), rl_dump_macros (),
-  rl_delete_horizontal_space (), rl_history_search_forward (),
-  rl_history_search_backward (), rl_tty_status (), rl_yank_last_arg (),
-  rl_insert_comment (), rl_backward_char_search (),
-  rl_copy_forward_word (), rl_copy_backward_word ();
-
-/* Not available unless readline is compiled -DPAREN_MATCHING. */
-extern int rl_insert_close ();
-
-/* Not available unless READLINE_CALLBACKS is defined. */
-extern void rl_callback_handler_install ();
-extern void rl_callback_read_char ();
-extern void rl_callback_handler_remove ();
+/* **************************************************************** */
+/*                                                                 */
+/*          Functions available to bind to key sequences           */
+/*                                                                 */
+/* **************************************************************** */
 
+/* Bindable commands for numeric arguments. */
+extern int rl_digit_argument __P((int, int));
+extern int rl_universal_argument __P((int, int));
+
+/* Bindable commands for moving the cursor. */
+extern int rl_forward __P((int, int));
+extern int rl_backward __P((int, int));
+extern int rl_beg_of_line __P((int, int));
+extern int rl_end_of_line __P((int, int));
+extern int rl_forward_word __P((int, int));
+extern int rl_backward_word __P((int, int));
+extern int rl_refresh_line __P((int, int));
+extern int rl_clear_screen __P((int, int));
+extern int rl_arrow_keys __P((int, int));
+
+/* Bindable commands for inserting and deleting text. */
+extern int rl_insert __P((int, int));
+extern int rl_quoted_insert __P((int, int));
+extern int rl_tab_insert __P((int, int));
+extern int rl_newline __P((int, int));
+extern int rl_do_lowercase_version __P((int, int));
+extern int rl_rubout __P((int, int));
+extern int rl_delete __P((int, int));
+extern int rl_rubout_or_delete __P((int, int));
+extern int rl_delete_horizontal_space __P((int, int));
+extern int rl_delete_or_show_completions __P((int, int));
+extern int rl_insert_comment __P((int, int));
+
+/* Bindable commands for changing case. */
+extern int rl_upcase_word __P((int, int));
+extern int rl_downcase_word __P((int, int));
+extern int rl_capitalize_word __P((int, int));
+
+/* Bindable commands for transposing characters and words. */
+extern int rl_transpose_words __P((int, int));
+extern int rl_transpose_chars __P((int, int));
+
+/* Bindable commands for searching within a line. */
+extern int rl_char_search __P((int, int));
+extern int rl_backward_char_search __P((int, int));
+
+/* Bindable commands for readline's interface to the command history. */
+extern int rl_beginning_of_history __P((int, int));
+extern int rl_end_of_history __P((int, int));
+extern int rl_get_next_history __P((int, int));
+extern int rl_get_previous_history __P((int, int));
+
+/* Bindable commands for managing the mark and region. */
+extern int rl_set_mark __P((int, int));
+extern int rl_exchange_point_and_mark __P((int, int));
+
+/* Bindable commands to set the editing mode (emacs or vi). */
+extern int rl_vi_editing_mode __P((int, int));
+extern int rl_emacs_editing_mode __P((int, int));
+
+/* Bindable commands for managing key bindings. */
+extern int rl_re_read_init_file __P((int, int));
+extern int rl_dump_functions __P((int, int));
+extern int rl_dump_macros __P((int, int));
+extern int rl_dump_variables __P((int, int));
+
+/* Bindable commands for word completion. */
+extern int rl_complete __P((int, int));
+extern int rl_possible_completions __P((int, int));
+extern int rl_insert_completions __P((int, int));
+extern int rl_menu_complete __P((int, int));
+
+/* Bindable commands for killing and yanking text, and managing the kill ring. */
+extern int rl_kill_word __P((int, int));
+extern int rl_backward_kill_word __P((int, int));
+extern int rl_kill_line __P((int, int));
+extern int rl_backward_kill_line __P((int, int));
+extern int rl_kill_full_line __P((int, int));
+extern int rl_unix_word_rubout __P((int, int));
+extern int rl_unix_line_discard __P((int, int));
+extern int rl_copy_region_to_kill __P((int, int));
+extern int rl_kill_region __P((int, int));
+extern int rl_copy_forward_word __P((int, int));
+extern int rl_copy_backward_word __P((int, int));
+extern int rl_yank __P((int, int));
+extern int rl_yank_pop __P((int, int));
+extern int rl_yank_nth_arg __P((int, int));
+extern int rl_yank_last_arg __P((int, int));
 /* Not available unless __CYGWIN32__ is defined. */
 #ifdef __CYGWIN32__
-extern int rl_paste_from_clipboard ();
+extern int rl_paste_from_clipboard __P((int, int));
 #endif
 
-/* These are *both* defined even when VI_MODE is not. */
-extern int rl_vi_editing_mode (), rl_emacs_editing_mode ();
+/* Bindable commands for incremental searching. */
+extern int rl_reverse_search_history __P((int, int));
+extern int rl_forward_search_history __P((int, int));
+
+/* Bindable keyboard macro commands. */
+extern int rl_start_kbd_macro __P((int, int));
+extern int rl_end_kbd_macro __P((int, int));
+extern int rl_call_last_kbd_macro __P((int, int));
+
+/* Bindable undo commands. */
+extern int rl_revert_line __P((int, int));
+extern int rl_undo_command __P((int, int));
+
+/* Bindable tilde expansion commands. */
+extern int rl_tilde_expand __P((int, int));
+
+/* Bindable terminal control commands. */
+extern int rl_restart_output __P((int, int));
+extern int rl_stop_output __P((int, int));
+
+/* Miscellaneous bindable commands. */
+extern int rl_abort __P((int, int));
+extern int rl_tty_status __P((int, int));
+
+/* Bindable commands for incremental and non-incremental history searching. */
+extern int rl_history_search_forward __P((int, int));
+extern int rl_history_search_backward __P((int, int));
+extern int rl_noninc_forward_search __P((int, int));
+extern int rl_noninc_reverse_search __P((int, int));
+extern int rl_noninc_forward_search_again __P((int, int));
+extern int rl_noninc_reverse_search_again __P((int, int));
+
+/* Not available unless readline is compiled -DPAREN_MATCHING. */
+extern int rl_insert_close __P((int, int));
 
-/* Non incremental history searching. */
-extern int rl_noninc_forward_search ();
-extern int rl_noninc_reverse_search ();
-extern int rl_noninc_forward_search_again ();
-extern int rl_noninc_reverse_search_again ();
+/* Not available unless READLINE_CALLBACKS is defined. */
+extern void rl_callback_handler_install __P((char *, VFunction *));
+extern void rl_callback_read_char __P((void));
+extern void rl_callback_handler_remove __P((void));
 
 /* Things for vi mode. Not available unless readline is compiled -DVI_MODE. */
-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 (),
-  rl_vi_prev_word (), rl_vi_next_word (), rl_vi_char_search (),
-  rl_vi_eof_maybe (), rl_vi_append_mode (), rl_vi_put (),
-  rl_vi_append_eol (), rl_vi_insert_beg (), rl_vi_delete (),
-  rl_vi_first_print (), rl_vi_fword (), rl_vi_fWord (), rl_vi_bword (),
-  rl_vi_bWord (), rl_vi_eword (), rl_vi_eWord (), rl_vi_end_word (),
-  rl_vi_change_case (), rl_vi_match (), rl_vi_bracktype (),
-  rl_vi_change_char (), rl_vi_yank_arg (), rl_vi_search (),
-  rl_vi_search_again (),  rl_vi_subst (), rl_vi_overstrike (),
-  rl_vi_overstrike_delete (), rl_vi_replace(), rl_vi_column (),
-  rl_vi_delete_to (), rl_vi_change_to (), rl_vi_yank_to (),
-  rl_vi_complete (), rl_vi_fetch_history (), rl_vi_set_mark (),
-  rl_vi_goto_mark (), rl_vi_back_to_indent ();
-
-/* Keyboard macro commands. */
-extern int rl_start_kbd_macro (), rl_end_kbd_macro ();
-extern int rl_call_last_kbd_macro ();
-extern void rl_push_macro_input ();
-
-extern int rl_arrow_keys(), rl_refresh_line ();
+/* VI-mode bindable commands. */
+extern int rl_vi_redo __P((int, int));
+extern int rl_vi_undo __P((int, int));
+extern int rl_vi_yank_arg __P((int, int));
+extern int rl_vi_fetch_history __P((int, int));
+extern int rl_vi_search_again __P((int, int));
+extern int rl_vi_search __P((int, int));
+extern int rl_vi_complete __P((int, int));
+extern int rl_vi_tilde_expand __P((int, int));
+extern int rl_vi_prev_word __P((int, int));
+extern int rl_vi_next_word __P((int, int));
+extern int rl_vi_end_word __P((int, int));
+extern int rl_vi_insert_beg __P((int, int));
+extern int rl_vi_append_mode __P((int, int));
+extern int rl_vi_append_eol __P((int, int));
+extern int rl_vi_eof_maybe __P((int, int));
+extern int rl_vi_insertion_mode __P((int, int));
+extern int rl_vi_movement_mode __P((int, int));
+extern int rl_vi_arg_digit __P((int, int));
+extern int rl_vi_change_case __P((int, int));
+extern int rl_vi_put __P((int, int));
+extern int rl_vi_column __P((int, int));
+extern int rl_vi_delete_to __P((int, int));
+extern int rl_vi_change_to __P((int, int));
+extern int rl_vi_yank_to __P((int, int));
+extern int rl_vi_delete __P((int, int));
+extern int rl_vi_back_to_indent __P((int, int));
+extern int rl_vi_first_print __P((int, int));
+extern int rl_vi_char_search __P((int, int));
+extern int rl_vi_match __P((int, int));
+extern int rl_vi_change_char __P((int, int));
+extern int rl_vi_subst __P((int, int));
+extern int rl_vi_overstrike __P((int, int));
+extern int rl_vi_overstrike_delete __P((int, int));
+extern int rl_vi_replace __P((int, int));
+extern int rl_vi_set_mark __P((int, int));
+extern int rl_vi_goto_mark __P((int, int));
+
+/* VI-mode utility functions. */
+extern int rl_vi_check __P((void));
+extern int rl_vi_domove __P((int, int *));
+extern int rl_vi_bracktype __P((int));
+
+/* VI-mode pseudo-bindable commands, used as utility functions. */
+extern int rl_vi_fWord __P((int, int));
+extern int rl_vi_bWord __P((int, int));
+extern int rl_vi_eWord __P((int, int));
+extern int rl_vi_fword __P((int, int));
+extern int rl_vi_bword __P((int, int));
+extern int rl_vi_eword __P((int, int));
 
 /* **************************************************************** */
 /*                                                                 */
@@ -141,57 +260,80 @@ extern int rl_arrow_keys(), rl_refresh_line ();
 
 /* Readline functions. */
 /* Read a line of input.  Prompt with PROMPT.  A NULL PROMPT means none. */
-extern char *readline ();
-
-/* These functions are from bind.c. */
-/* rl_add_defun (char *name, Function *function, int key)
-   Add NAME to the list of named functions.  Make FUNCTION
-   be the function that gets called.
-   If KEY is not -1, then bind it. */
-extern int rl_add_defun ();
-
-extern Keymap rl_make_bare_keymap ();
-extern Keymap rl_copy_keymap ();
-extern Keymap rl_make_keymap ();
-extern void rl_discard_keymap ();
-extern Keymap rl_get_keymap (), rl_get_keymap_by_name ();
-extern void rl_set_keymap ();
-extern char *rl_get_keymap_name ();
-
-extern int rl_bind_key (), rl_bind_key_in_map ();
-extern int rl_unbind_key (), rl_unbind_key_in_map ();
-extern int rl_unbind_function_in_map (), rl_unbind_command_in_map ();
-extern int rl_set_key ();
-extern int rl_generic_bind ();
-extern int rl_parse_and_bind ();
-/* Backwards compatibility, use rl_generic_bind instead. */
-extern int rl_macro_bind (), rl_variable_bind ();
+extern char *readline __P((char *));
 
-extern int rl_read_init_file ();
+extern int rl_initialize __P((void));
 
-extern Function *rl_named_function (), *rl_function_of_keyseq ();
-extern char **rl_invoking_keyseqs (), **rl_invoking_keyseqs_in_map ();
-extern void rl_function_dumper ();
-extern void rl_variable_dumper ();
-extern void rl_macro_dumper ();
-extern void rl_list_funmap_names ();
+extern int rl_discard_argument __P((void));
 
-/* Undocumented in the texinfo manual; not really useful to programs. */
-extern int rl_translate_keyseq ();
-extern void rl_initialize_funmap ();
+/* Utility functions to bind keys to readline commands. */
+extern int rl_add_defun __P((char *, Function *, int));
+extern int rl_bind_key __P((int, Function *));
+extern int rl_bind_key_in_map __P((int, Function *, Keymap));
+extern int rl_unbind_key __P((int));
+extern int rl_unbind_key_in_map __P((int, Keymap));
+extern int rl_unbind_function_in_map __P((Function *, Keymap));
+extern int rl_unbind_command_in_map __P((char *, Keymap));
+extern int rl_set_key __P((char *, Function *, Keymap));
+extern int rl_generic_bind __P((int, char *, char *, Keymap));
+extern int rl_variable_bind __P((char *, char *));
 
-/* Functions for undoing. */
-extern int rl_begin_undo_group (), rl_end_undo_group ();
-extern void rl_add_undo (), free_undo_list ();
-extern int rl_do_undo ();
-extern int rl_modifying ();
+/* Backwards compatibility, use rl_generic_bind instead. */
+extern int rl_macro_bind __P((char *, char *, Keymap));
+
+/* Undocumented in the texinfo manual; not really useful to programs. */
+extern int rl_translate_keyseq __P((char *, char *, int *));
+extern char *rl_untranslate_keyseq __P((int));
+
+extern Function *rl_named_function __P((char *));
+extern Function *rl_function_of_keyseq __P((char *, Keymap, int *));
+
+extern void rl_list_funmap_names __P((void));
+extern char **rl_invoking_keyseqs_in_map __P((Function *, Keymap));
+extern char **rl_invoking_keyseqs __P((Function *));
+extern void rl_function_dumper __P((int));
+extern void rl_macro_dumper __P((int));
+extern void rl_variable_dumper __P((int));
+
+extern int rl_read_init_file __P((char *));
+extern int rl_parse_and_bind __P((char *));
+
+/* Functions for manipulating keymaps. */
+extern Keymap rl_make_bare_keymap __P((void));
+extern Keymap rl_copy_keymap __P((Keymap));
+extern Keymap rl_make_keymap __P((void));
+extern void rl_discard_keymap __P((Keymap));
+
+extern Keymap rl_get_keymap_by_name __P((char *));
+extern char *rl_get_keymap_name __P((Keymap));
+extern void rl_set_keymap __P((Keymap));
+extern Keymap rl_get_keymap __P((void));
+extern void rl_set_keymap_from_edit_mode __P((void));
+extern char *rl_get_keymap_name_from_edit_mode __P((void));
+
+/* Functions for manipulating the funmap, which maps command names to functions. */
+extern int rl_add_funmap_entry __P((char *, Function *));
+extern void rl_initialize_funmap __P((void));
+extern char **rl_funmap_names __P((void));
+
+/* Utility functions for managing keyboard macros. */
+extern void rl_push_macro_input __P((char *));
+
+/* Functions for undoing, from undo.c */
+extern void rl_add_undo __P((enum undo_code, int, int, char *));
+extern void free_undo_list __P((void));
+extern int rl_do_undo __P((void));
+extern int rl_begin_undo_group __P((void));
+extern int rl_end_undo_group __P((void));
+extern int rl_modifying __P((int, int));
 
 /* Functions for redisplay. */
-extern void rl_redisplay ();
-extern int rl_forced_update_display ();
-extern int rl_clear_message ();
-extern int rl_reset_line_state ();
-extern int rl_on_new_line ();
+extern void rl_redisplay __P((void));
+extern int rl_on_new_line __P((void));
+extern int rl_forced_update_display __P((void));
+extern int rl_clear_message __P((void));
+extern int rl_reset_line_state __P((void));
 
 #if defined (__STDC__) && defined (USE_VARARGS) && defined (PREFER_STDARG)
 extern int rl_message (const char *, ...);
@@ -200,36 +342,59 @@ extern int rl_message ();
 #endif
 
 /* Undocumented in texinfo manual. */
-extern int rl_character_len ();
-extern int rl_show_char ();
-extern int crlf ();
-
-/* Modifying text. */
-extern int rl_insert_text (), rl_delete_text ();
-extern int rl_kill_text ();
-extern char *rl_copy_text ();
-
-/* `Public' utility functions. */
-extern int rl_reset_terminal ();
-extern int rl_stuff_char ();
-extern int rl_read_key (), rl_getc ();
+extern int rl_show_char __P((int));
+extern int rl_character_len __P((int, int));
+extern int crlf __P((void));
 
-extern int rl_initialize ();
+/* Save and restore internal prompt redisplay information. */
+extern void rl_save_prompt __P((void));
+extern void rl_restore_prompt __P((void));
 
+/* Modifying text. */
+extern int rl_insert_text __P((char *));
+extern int rl_delete_text __P((int, int));
+extern int rl_kill_text __P((int, int));
+extern char *rl_copy_text __P((int, int));
+
+/* Terminal and tty mode management. */
+extern void rl_prep_terminal __P((int));
+extern void rl_deprep_terminal __P((void));
+extern void rltty_set_default_bindings __P((Keymap));
+
+extern int rl_reset_terminal __P((char *));
+extern void rl_resize_terminal __P((void));
+
+/* `Public' utility functions . */
+extern void rl_extend_line_buffer __P((int));
+extern int ding __P((void));
+
+/* Functions for character input. */
+extern int rl_stuff_char __P((int));
+extern int rl_execute_next __P((int));
+extern int rl_read_key __P((void));
+extern int rl_getc __P((FILE *));
+
+/* Readline signal handling, from signals.c */
+extern int rl_set_signals __P((void));
+extern int rl_clear_signals __P((void));
+extern void rl_cleanup_after_signal __P((void));
+extern void rl_reset_after_signal __P((void));
+extern void rl_free_line_state __P((void));
 /* Undocumented. */
-extern int rl_expand_prompt ();
-extern int rl_set_signals (), rl_clear_signals ();
-extern int maybe_save_line (), maybe_unsave_line (), maybe_replace_line ();
+extern int rl_expand_prompt __P((char *));
+
+extern int maybe_save_line __P((void));
+extern int maybe_unsave_line __P((void));
+extern int maybe_replace_line __P((void));
 
 /* Completion functions. */
-/* These functions are from complete.c. */
-extern int rl_complete_internal ();
+extern int rl_complete_internal __P((int));
+extern void rl_display_match_list __P((char **, int, int));
 
-/* Return an array of strings which are the result of repeatadly calling
-   FUNC with TEXT. */
-extern char **completion_matches ();
-extern char *username_completion_function ();
-extern char *filename_completion_function ();
+extern char **completion_matches __P((char *, CPFunction *));
+extern char *username_completion_function __P((char *, int));
+extern char *filename_completion_function __P((char *, int));
 
 /* **************************************************************** */
 /*                                                                 */
@@ -254,10 +419,14 @@ extern char *rl_line_buffer;
 /* The location of point, and end. */
 extern int rl_point, rl_end;
 
+/* The mark, or saved cursor position. */
 extern int rl_mark;
 
+/* Flag to indicate that readline has finished with the current input
+   line and should return it. */
 extern int rl_done;
 
+/* If set to a character value, that will be the next keystroke read. */
 extern int rl_pending_input;
 
 /* Non-zero if we called this function from _rl_dispatch().  It's present
@@ -275,6 +444,11 @@ extern FILE *rl_instream, *rl_outstream;
    before readline_internal () prints the first prompt. */
 extern Function *rl_startup_hook;
 
+/* If non-zero, this is the address of a function to call just before
+   readline_internal_setup () returns and readline_internal starts
+   reading input characters. */
+extern Function *rl_pre_input_hook;
+      
 /* The address of a function to call periodically while Readline is
    awaiting character input, or NULL, for no event handling. */
 extern Function *rl_event_hook;
@@ -288,6 +462,24 @@ extern VFunction *rl_deprep_term_function;
 extern Keymap rl_executing_keymap;
 extern Keymap rl_binding_keymap;
 
+/* Display variables. */
+/* If non-zero, readline will erase the entire line, including any prompt,
+   if the only thing typed on an otherwise-blank line is something bound to
+   rl_newline. */
+extern int rl_erase_empty_line;
+
+/* Variables to control readline signal handling. */
+/* If non-zero, readline will install its own signal handlers for
+   SIGINT, SIGTERM, SIGQUIT, SIGALRM, SIGTSTP, SIGTTIN, and SIGTTOU. */
+extern int rl_catch_signals;
+
+/* If non-zero, readline will install a signal handler for SIGWINCH
+   that also attempts to call any calling application's SIGWINCH signal
+   handler.  Note that the terminal is not cleaned up before the
+   application's signal handler is called; use rl_cleanup_after_signal()
+   to do that. */
+extern int rl_catch_sigwinch;
+
 /* Completion variables. */
 /* Pointer to the generator function for completion_matches ().
    NULL means to use filename_entry_function (), the default filename
@@ -346,6 +538,15 @@ extern Function *rl_directory_completion_hook;
 /* Backwards compatibility with previous versions of readline. */
 #define rl_symbolic_link_hook rl_directory_completion_hook
 
+/* If non-zero, then this is the address of a function to call when
+   completing a word would normally display the list of possible matches.
+   This function is called instead of actually doing the display.
+   It takes three arguments: (char **matches, int num_matches, int max_length)
+   where MATCHES is the array of strings that matched, NUM_MATCHES is the
+   number of strings in that array, and MAX_LENGTH is the length of the
+   longest string in that array. */
+extern VFunction *rl_completion_display_matches_hook;
+
 /* Non-zero means that the results of the matches are to be treated
    as filenames.  This is ALWAYS zero on entry, and can only be changed
    within a completion entry finder function. */
@@ -413,4 +614,8 @@ extern int rl_inhibit_completion;
 extern char *savestring ();    /* XXX backwards compatibility */
 #endif
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _READLINE_H_ */
index 8f07db155df1690f84622f18c69c929e911ae749..1356fd87924e374e40b978ffd25c3bc19e831ce5 100644 (file)
@@ -56,8 +56,6 @@
 
 /* Define this if you want code that allows readline to be used in an
    X `callback' style. */
-#if !defined (SHELL)
-#  define READLINE_CALLBACKS
-#endif
+#define READLINE_CALLBACKS
 
 #endif /* _RLCONF_H_ */
diff --git a/lib/readline/rlstdc.h b/lib/readline/rlstdc.h
new file mode 100644 (file)
index 0000000..f1590c6
--- /dev/null
@@ -0,0 +1,79 @@
+/* stdc.h -- macros to make source compile on both ANSI C and K&R C
+   compilers. */
+
+/* Copyright (C) 1993 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. */
+
+#if !defined (_STDC_H_)
+#define _STDC_H_
+
+/* Adapted from BSD /usr/include/sys/cdefs.h. */
+
+/* A function can be defined using prototypes and compile on both ANSI C
+   and traditional C compilers with something like this:
+       extern char *func __P((char *, char *, int)); */
+
+#if defined (__STDC__)
+
+#  if !defined (__P)
+#    define __P(protos) protos
+#  endif
+#  define __STRING(x) #x
+
+#  if !defined (__GNUC__)
+#    define inline
+#  endif
+
+#else /* !__STDC__ */
+
+#  if !defined (__P)
+#    define __P(protos) ()
+#  endif
+#  define __STRING(x) "x"
+
+#if defined (__GNUC__)         /* gcc with -traditional */
+#  if !defined (const)
+#    define const  __const
+#  endif
+#  if !defined (inline)
+#    define inline __inline
+#  endif
+#  if !defined (signed)
+#    define signed __signed
+#  endif
+#  if !defined (volatile)
+#    define volatile __volatile
+#  endif
+#else /* !__GNUC__ */
+#  if !defined (const)
+#    define const
+#  endif
+#  if !defined (inline)
+#    define inline
+#  endif
+#  if !defined (signed)
+#    define signed
+#  endif
+#  if !defined (volatile)
+#    define volatile
+#  endif
+#endif /* !__GNUC__ */
+
+#endif /* !__STDC__ */
+
+#endif /* !_STDC_H_ */
index 8312963abcbf85d00d2b8166679b9e464a543dd7..a5ef938b5c06e16a118c9a663d3f7aa51056b2f5 100644 (file)
@@ -37,9 +37,9 @@
 
 #include "rldefs.h"
 
-#if !defined (SHELL) && defined (GWINSZ_IN_SYS_IOCTL)
+#if defined (GWINSZ_IN_SYS_IOCTL)
 #  include <sys/ioctl.h>
-#endif /* !SHELL && GWINSZ_IN_SYS_IOCTL */
+#endif /* GWINSZ_IN_SYS_IOCTL */
 
 #include "rltty.h"
 #include "readline.h"
@@ -144,7 +144,7 @@ static int terminal_prepped;
 static int ksrflow;
 #endif
 
-#if !defined (SHELL) && defined (TIOCGWINSZ)
+#if defined (TIOCGWINSZ)
 /* Dummy call to force a backgrounded readline to stop before it tries
    to get the tty settings. */
 static void
@@ -156,9 +156,7 @@ set_winsize (tty)
   if (ioctl (tty, TIOCGWINSZ, &w) == 0)
       (void) ioctl (tty, TIOCSWINSZ, &w);
 }
-#else /* SHELL || !TIOCGWINSZ */
-#  define set_winsize(tty)
-#endif /* SHELL || !TIOCGWINSZ */
+#endif /* TIOCGWINSZ */
 
 #if defined (NEW_TTY_DRIVER)
 
@@ -389,6 +387,7 @@ get_tty_settings (tty, tiop)
      TIOTYPE *tiop;
 {
   int ioctl_ret;
+
   set_winsize (tty);
 
   while (1)
diff --git a/lib/readline/savestring.c b/lib/readline/savestring.c
new file mode 100644 (file)
index 0000000..3f53a87
--- /dev/null
@@ -0,0 +1,33 @@
+/* savestring.c  */
+
+/* Copyright (C) 1998 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. */
+
+extern char *strcpy ();
+extern char *xmalloc ();
+
+/* 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)));
+}
index 3024ee596772c5d66baff15a9bf2a889da4bb8aa..6c76e1a1c966cd598f740c54b148dc1e95b65be8 100644 (file)
@@ -61,7 +61,6 @@ extern Function *rl_last_func;
 /* Functions imported from the rest of the library. */
 extern int _rl_free_history_entry ();
 extern char *_rl_make_prompt_for_search ();
-extern void _rl_restore_prompt ();
 extern void rl_extend_line_buffer ();
 
 static char *noninc_search_string = (char *) NULL;
@@ -172,7 +171,7 @@ noninc_search (dir, pchar)
   rl_message (p, 0, 0);
   free (p);
 
-#define SEARCH_RETURN _rl_restore_prompt (); return
+#define SEARCH_RETURN rl_restore_prompt (); return
 
   /* Read the search string. */
   while (c = rl_read_key ())
@@ -241,7 +240,7 @@ noninc_search (dir, pchar)
       noninc_search_string = savestring (rl_line_buffer);
     }
 
-  _rl_restore_prompt ();
+  rl_restore_prompt ();
   noninc_dosearch (noninc_search_string, dir);
 }
 
index 553f3c1cc902b2162872d8f393468cee6b376fff..091ec08f645715f13b12bf53459e6f0b5e0deffb 100644 (file)
 #  include <config.h>
 #endif
 
+#include <sys/types.h>
+
 #if defined (HAVE_UNISTD_H)
-#  ifdef _MINIX
-#    include <sys/types.h>
-#  endif
 #  include <unistd.h>
 #endif /* HAVE_UNISTD_H */
 
 #  include <strings.h>
 #endif /* !HAVE_STRING_H */
 
-extern char *xmalloc (), *xrealloc ();
+#include <pwd.h>
 
-#if !defined (SHELL)
+#if !defined (HAVE_GETPW_DECLS)
+extern struct passwd *getpwuid ();
+#endif /* !HAVE_GETPW_DECLS */
 
-#ifdef savestring
-#undef savestring
-#endif
+extern char *xmalloc ();
 
-/* 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)));
-}
+/* All of these functions are resolved from bash if we are linking readline
+   as part of bash. */
 
 /* Does shell-like quoting using single quotes. */
 char *
@@ -126,13 +119,15 @@ get_env_value (varname)
   return ((char *)getenv (varname));
 }
 
-#else /* SHELL */
-extern char *get_string_value ();
-
 char *
-get_env_value (varname)
-     char *varname;
+get_home_dir ()
 {
-  return get_string_value (varname);
-}      
-#endif /* SHELL */
+  char *home_dir;
+  struct passwd *entry;
+
+  home_dir = (char *)NULL;
+  entry = getpwuid (getuid ());
+  if (entry)
+    home_dir = entry->pw_dir;
+  return (home_dir);
+}
index e19c22d36415d3ab96d2c005e4f9fd452dc3f231..3a34432f14317fcbc0297b5abab29ed82f0911f7 100644 (file)
 #include "readline.h"
 #include "history.h"
 
-extern int readline_echoing_p;
-extern int rl_pending_input;
-extern int _rl_meta_flag;
-
-extern void free_undo_list ();
-extern void _rl_get_screen_size ();
-extern void _rl_redisplay_after_sigwinch ();
-extern void _rl_clean_up_for_exit ();
-extern void _rl_kill_kbd_macro ();
-extern void _rl_init_argument ();
-extern void rl_deprep_terminal (), rl_prep_terminal ();
-
 #if !defined (RETSIGTYPE)
 #  if defined (VOID_SIGHANDLER)
 #    define RETSIGTYPE void
@@ -79,40 +67,52 @@ extern void rl_deprep_terminal (), rl_prep_terminal ();
    to say SigHandler *foo = signal (SIGKILL, SIG_IGN); */
 typedef RETSIGTYPE SigHandler ();
 
+extern int readline_echoing_p;
+extern int rl_pending_input;
+extern int _rl_meta_flag;
+
+extern void free_undo_list ();
+extern void _rl_get_screen_size ();
+extern void _rl_redisplay_after_sigwinch ();
+extern void _rl_clean_up_for_exit ();
+extern void _rl_kill_kbd_macro ();
+extern void _rl_init_argument ();
+extern void rl_deprep_terminal (), rl_prep_terminal ();
+
 static SigHandler *rl_set_sighandler ();
 
+/* Exported variables for use by applications. */
+
+/* If non-zero, readline will install its own signal handlers for
+   SIGINT, SIGTERM, SIGQUIT, SIGALRM, SIGTSTP, SIGTTIN, and SIGTTOU. */
+int rl_catch_signals = 1;
+
+/* If non-zero, readline will install a signal handler for SIGWINCH. */
+#ifdef SIGWINCH
+int rl_catch_sigwinch = 1;
+#endif
+
+static int signals_set_flag;
+static int sigwinch_set_flag;
+
 /* **************************************************************** */
 /*                                                                 */
 /*                        Signal Handling                          */
 /*                                                                 */
 /* **************************************************************** */
 
-/* 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)
 #else
-typedef struct { SigHandler *sa_handler; } sighandler_cxt;
+typedef struct { SigHandler *sa_handler; int sa_mask, sa_flags; } sighandler_cxt;
 #  define sigemptyset(m)
 #endif /* !HAVE_POSIX_SIGNALS */
 
-static sighandler_cxt old_int, old_alrm;
-
-#if defined (HANDLE_JOB_SIGNALS)
+static sighandler_cxt old_int, old_term, old_alrm, old_quit;
+#if defined (SIGTSTP)
 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;
 #endif
@@ -143,18 +143,8 @@ rl_signal_handler (sig)
   switch (sig)
     {
     case SIGINT:
-      {
-       register HIST_ENTRY *entry;
-
-       free_undo_list ();
-
-       entry = current_history ();
-       if (entry)
-         entry->data = (char *)NULL;
-      }
-      _rl_kill_kbd_macro ();
-      rl_clear_message ();
-      _rl_init_argument ();
+      rl_free_line_state ();
+      /* FALLTHROUGH */
 
 #if defined (SIGTSTP)
     case SIGTSTP:
@@ -163,10 +153,8 @@ rl_signal_handler (sig)
 #endif /* SIGTSTP */
     case SIGALRM:
     case SIGTERM:
-      _rl_clean_up_for_exit ();
-      (*rl_deprep_term_function) ();
-      rl_clear_signals ();
-      rl_pending_input = 0;
+    case SIGQUIT:
+      rl_cleanup_after_signal ();
 
 #if defined (HAVE_POSIX_SIGNALS)
       sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &set);
@@ -188,8 +176,7 @@ rl_signal_handler (sig)
 #  endif /* HAVE_BSD_SIGNALS */
 #endif /* !HAVE_POSIX_SIGNALS */
 
-      (*rl_prep_term_function) (_rl_meta_flag);
-      rl_set_signals ();
+      rl_reset_after_signal ();
     }
 
   SIGHANDLER_RETURN;
@@ -197,7 +184,7 @@ rl_signal_handler (sig)
 
 #if defined (SIGWINCH)
 static RETSIGTYPE
-rl_handle_sigwinch (sig)
+rl_sigwinch_handler (sig)
      int sig;
 {
   SigHandler *oh;
@@ -209,14 +196,10 @@ rl_handle_sigwinch (sig)
      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);
+  rl_set_sighandler (SIGWINCH, rl_sigwinch_handler, &dummy_winch);
 #endif
 
-  if (readline_echoing_p)
-    {
-      _rl_get_screen_size (fileno (rl_instream), 1);
-      _rl_redisplay_after_sigwinch ();
-    }
+  rl_resize_terminal ();
 
   /* If another sigwinch handler has been installed, call it. */
   oh = (SigHandler *)old_winch.sa_handler;
@@ -263,62 +246,66 @@ rl_set_sighandler (sig, handler, ohandler)
   return (ohandler->sa_handler);
 }
 
-int
-rl_set_signals ()
+static void
+rl_maybe_set_sighandler (sig, handler, ohandler)
+     int sig;
+     SigHandler *handler;
+     sighandler_cxt *ohandler;
 {
   sighandler_cxt dummy;
   SigHandler *oh;
 
-#if defined (HAVE_POSIX_SIGNALS)
   sigemptyset (&dummy.sa_mask);
-#endif
-
-  oh = rl_set_sighandler (SIGINT, rl_signal_handler, &old_int);
+  oh = rl_set_sighandler (sig, handler, ohandler);
   if (oh == (SigHandler *)SIG_IGN)
-    rl_sigaction (SIGINT, &old_int, &dummy);
+    rl_sigaction (sig, ohandler, &dummy);
+}
 
-  oh = rl_set_sighandler (SIGALRM, rl_signal_handler, &old_alrm);
-  if (oh == (SigHandler *)SIG_IGN)
-    rl_sigaction (SIGALRM, &old_alrm, &dummy);
+int
+rl_set_signals ()
+{
+  sighandler_cxt dummy;
+  SigHandler *oh;
+
+  if (rl_catch_signals && signals_set_flag == 0)
+    {
+      rl_maybe_set_sighandler (SIGINT, rl_signal_handler, &old_int);
+      rl_maybe_set_sighandler (SIGTERM, rl_signal_handler, &old_term);
+      rl_maybe_set_sighandler (SIGQUIT, rl_signal_handler, &old_quit);
+
+      oh = rl_set_sighandler (SIGALRM, rl_signal_handler, &old_alrm);
+      if (oh == (SigHandler *)SIG_IGN)
+       rl_sigaction (SIGALRM, &old_alrm, &dummy);
 #if defined (HAVE_POSIX_SIGNALS) && defined (SA_RESTART)
-  /* If the application using readline has already installed a signal
-     handler with SA_RESTART, SIGALRM will cause reads to be restarted
-     automatically, so readline should just get out of the way.  Since
-     we tested for SIG_IGN above, we can just test for SIG_DFL here. */
-  if (oh != (SigHandler *)SIG_DFL && (old_alrm.sa_flags & SA_RESTART))
-    rl_sigaction (SIGALRM, &old_alrm, &dummy);
+      /* If the application using readline has already installed a signal
+        handler with SA_RESTART, SIGALRM will cause reads to be restarted
+        automatically, so readline should just get out of the way.  Since
+        we tested for SIG_IGN above, we can just test for SIG_DFL here. */
+      if (oh != (SigHandler *)SIG_DFL && (old_alrm.sa_flags & SA_RESTART))
+       rl_sigaction (SIGALRM, &old_alrm, &dummy);
 #endif /* HAVE_POSIX_SIGNALS */
 
-#if defined (HANDLE_JOB_SIGNALS)
-
 #if defined (SIGTSTP)
-  oh = rl_set_sighandler (SIGTSTP, rl_signal_handler, &old_tstp);
-  if (oh == (SigHandler *)SIG_IGN)
-    rl_sigaction (SIGTSTP, &old_tstp, &dummy);
-#else
-  oh = (SigHandler *)NULL;
+      rl_maybe_set_sighandler (SIGTSTP, rl_signal_handler, &old_tstp);
 #endif /* SIGTSTP */
 
 #if defined (SIGTTOU)
-  rl_set_sighandler (SIGTTOU, rl_signal_handler, &old_ttou);
-  rl_set_sighandler (SIGTTIN, rl_signal_handler, &old_ttin);
-
-  if (oh == (SigHandler *)SIG_IGN)
-    {
-      rl_set_sighandler (SIGTTOU, SIG_IGN, &dummy);
-      rl_set_sighandler (SIGTTIN, SIG_IGN, &dummy);
-    }
+      rl_maybe_set_sighandler (SIGTTOU, rl_signal_handler, &old_ttou);
 #endif /* SIGTTOU */
 
-#endif /* HANDLE_JOB_SIGNALS */
+#if defined (SIGTTIN)
+      rl_maybe_set_sighandler (SIGTTIN, rl_signal_handler, &old_ttin);
+#endif /* SIGTTIN */
 
-#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 /* HANDLE_SIGTERM */
+      signals_set_flag = 1;
+    }
 
 #if defined (SIGWINCH)
-  rl_set_sighandler (SIGWINCH, rl_handle_sigwinch, &old_winch);
+  if (rl_catch_sigwinch && sigwinch_set_flag == 0)
+    {
+      rl_maybe_set_sighandler (SIGWINCH, rl_sigwinch_handler, &old_winch);
+      sigwinch_set_flag = 1;
+    }
 #endif /* SIGWINCH */
 
   return 0;
@@ -329,35 +316,79 @@ rl_clear_signals ()
 {
   sighandler_cxt dummy;
 
-#if defined (HAVE_POSIX_SIGNALS)
-  sigemptyset (&dummy.sa_mask);
-#endif
-
-  rl_sigaction (SIGINT, &old_int, &dummy);
-  rl_sigaction (SIGALRM, &old_alrm, &dummy);
+  if (rl_catch_signals && signals_set_flag == 1)
+    {
+      sigemptyset (&dummy.sa_mask);
 
-#if defined (HANDLE_JOB_SIGNALS)
+      rl_sigaction (SIGINT, &old_int, &dummy);
+      rl_sigaction (SIGTERM, &old_term, &dummy);
+      rl_sigaction (SIGQUIT, &old_quit, &dummy);
+      rl_sigaction (SIGALRM, &old_alrm, &dummy);
 
 #if defined (SIGTSTP)
-  rl_sigaction (SIGTSTP, &old_tstp, &dummy);
-#endif
+      rl_sigaction (SIGTSTP, &old_tstp, &dummy);
+#endif /* SIGTSTP */
 
 #if defined (SIGTTOU)
-  rl_sigaction (SIGTTOU, &old_ttou, &dummy);
-  rl_sigaction (SIGTTIN, &old_ttin, &dummy);
+      rl_sigaction (SIGTTOU, &old_ttou, &dummy);
 #endif /* SIGTTOU */
 
-#endif /* HANDLE_JOB_SIGNALS */
+#if defined (SIGTTIN)
+      rl_sigaction (SIGTTIN, &old_ttin, &dummy);
+#endif /* SIGTTIN */
 
-#if defined (HANDLE_SIGTERM)
-  rl_sigaction (SIGTERM, &old_term, &dummy);
-#endif /* HANDLE_SIGTERM */
+      signals_set_flag = 0;
+    }
 
 #if defined (SIGWINCH)
-  sigemptyset (&dummy.sa_mask);
-  rl_sigaction (SIGWINCH, &old_winch, &dummy);
+  if (rl_catch_sigwinch && sigwinch_set_flag == 1)
+    {
+      sigemptyset (&dummy.sa_mask);
+      rl_sigaction (SIGWINCH, &old_winch, &dummy);
+      sigwinch_set_flag = 0;
+    }
 #endif
 
   return 0;
 }
+
+/* Clean up the terminal and readline state after catching a signal, before
+   resending it to the calling application. */
+void
+rl_cleanup_after_signal ()
+{
+  _rl_clean_up_for_exit ();
+  (*rl_deprep_term_function) ();
+  rl_clear_signals ();
+  rl_pending_input = 0;
+}
+
+/* Reset the terminal and readline state after a signal handler returns. */
+void
+rl_reset_after_signal ()
+{
+  (*rl_prep_term_function) (_rl_meta_flag);
+  rl_set_signals ();
+}
+
+/* Free up the readline variable line state for the current line (undo list,
+   any partial history entry, any keyboard macros in progress, and any
+   numeric arguments in process) after catching a signal, before calling
+   rl_cleanup_after_signal(). */ 
+void
+rl_free_line_state ()
+{
+  register HIST_ENTRY *entry;
+
+  free_undo_list ();
+
+  entry = current_history ();
+  if (entry)
+    entry->data = (char *)NULL;
+
+  _rl_kill_kbd_macro ();
+  rl_clear_message ();
+  _rl_init_argument ();
+}
+
 #endif  /* HANDLE_SIGNALS */
index c28669659b02fd3ec7362ad505651e2bc8727597..c22ec5170bd6668e2e158f7f786dc98e9a624523 100644 (file)
@@ -232,6 +232,16 @@ _rl_set_screen_size (rows, cols)
   screenchars = screenwidth * screenheight;
 }
 
+void
+rl_resize_terminal ()
+{
+  if (readline_echoing_p)
+    {
+      _rl_get_screen_size (fileno (rl_instream), 1);
+      _rl_redisplay_after_sigwinch ();
+    }
+}
+
 struct _tc_string {
      char *tc_var;
      char **tc_value;
index 3741f9767b23652c5514acd7dd0ce12daf682cb2..d1853bd63d62326fb82724264ff72a807821aeff 100644 (file)
 
 #include "tilde.h"
 
-#ifdef SHELL
-#include "shell.h"
-#endif
-
 #if !defined (HAVE_GETPW_DECLS)
 extern struct passwd *getpwuid (), *getpwnam ();
 #endif /* !HAVE_GETPW_DECLS */
@@ -77,6 +73,12 @@ static char *xmalloc (), *xrealloc ();
 extern char *xmalloc (), *xrealloc ();
 #endif /* TEST || STATIC_MALLOC */
 
+/* If being compiled as part of bash, these will be satisfied from
+   variables.o.  If being compiled as part of readline, they will
+   be satisfied from shell.o. */
+extern char *get_home_dir ();
+extern char *get_env_value ();
+
 /* The default value of tilde_additional_prefixes.  This is set to
    whitespace preceding a tilde so that simple programs which do not
    perform any word separation get desired behaviour. */
@@ -171,15 +173,6 @@ 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)
@@ -284,27 +277,6 @@ glue_prefix_and_suffix (prefix, 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.
    This always returns a newly-allocated string, never static storage. */
@@ -328,7 +300,7 @@ tilde_expand_word (filename)
   if (filename[1] == '\0' || filename[1] == '/')
     {
       /* Prefix $HOME to the rest of the string. */
-      expansion = get_string_value ("HOME");
+      expansion = get_env_value ("HOME");
 
       /* If there is no HOME variable, look up the directory in
         the password database. */
index fde012edb61729a31aa7cbfff1333b28893ae8ec..1dc3b664f1cde0c08340ab784801c42f2798093f 100644 (file)
@@ -64,6 +64,7 @@ extern int _rl_defining_kbd_macro;
 extern char *_rl_executing_macro;
 
 /* Pseudo-global functions imported from other library files. */
+extern void _rl_replace_text ();
 extern void _rl_pop_executing_macro ();
 extern void _rl_set_the_line ();
 extern void _rl_init_argument ();
@@ -124,7 +125,7 @@ rl_tty_status (count, key)
 {
 #if defined (TIOCSTAT)
   ioctl (1, TIOCSTAT, (char *)0);
-  rl_refresh_line ();
+  rl_refresh_line (count, key);
 #else
   ding ();
 #endif
index 2f62ec3d480a8439489d32a477a0494336c3dc0b..d4868bf3b130728b977f62229880c135071dc683 100644 (file)
@@ -77,7 +77,7 @@
 extern char *xmalloc (), *xrealloc ();
 
 /* Variables imported from readline.c */
-extern int rl_point, rl_end, rl_mark, rl_done;
+extern int rl_point, rl_end, rl_mark;
 extern FILE *rl_instream;
 extern int rl_line_buffer_len, rl_explicit_arg, rl_numeric_arg;
 extern Keymap _rl_keymap;
@@ -352,9 +352,9 @@ rl_vi_prev_word (count, key)
     }
 
   if (_rl_uppercase_p (key))
-    rl_vi_bWord (count);
+    rl_vi_bWord (count, key);
   else
-    rl_vi_bword (count);
+    rl_vi_bword (count, key);
 
   return (0);
 }
@@ -374,9 +374,9 @@ rl_vi_next_word (count, key)
     }
 
   if (_rl_uppercase_p (key))
-    rl_vi_fWord (count);
+    rl_vi_fWord (count, key);
   else
-    rl_vi_fword (count);
+    rl_vi_fword (count, key);
   return (0);
 }
 
@@ -392,16 +392,16 @@ rl_vi_end_word (count, key)
     }
 
   if (_rl_uppercase_p (key))
-    rl_vi_eWord (count);
+    rl_vi_eWord (count, key);
   else
-    rl_vi_eword (count);
+    rl_vi_eword (count, key);
   return (0);
 }
 
 /* Move forward a word the way that 'W' does. */
 int
-rl_vi_fWord (count)
-     int count;
+rl_vi_fWord (count, ignore)
+     int count, ignore;
 {
   while (count-- && rl_point < (rl_end - 1))
     {
@@ -417,8 +417,8 @@ rl_vi_fWord (count)
 }
 
 int
-rl_vi_bWord (count)
-     int count;
+rl_vi_bWord (count, ignore)
+     int count, ignore;
 {
   while (count-- && rl_point > 0)
     {
@@ -441,8 +441,8 @@ rl_vi_bWord (count)
 }
 
 int
-rl_vi_eWord (count)
-     int count;
+rl_vi_eWord (count, ignore)
+     int count, ignore;
 {
   while (count-- && rl_point < (rl_end - 1))
     {
@@ -471,8 +471,8 @@ rl_vi_eWord (count)
 }
 
 int
-rl_vi_fword (count)
-     int count;
+rl_vi_fword (count, ignore)
+     int count, ignore;
 {
   while (count-- && rl_point < (rl_end - 1))
     {
@@ -497,8 +497,8 @@ rl_vi_fword (count)
 }
 
 int
-rl_vi_bword (count)
-     int count;
+rl_vi_bword (count, ignore)
+     int count, ignore;
 {
   while (count-- && rl_point > 0)
     {
@@ -536,8 +536,8 @@ rl_vi_bword (count)
 }
 
 int
-rl_vi_eword (count)
-     int count;
+rl_vi_eword (count, ignore)
+     int count, ignore;
 {
   while (count-- && rl_point < rl_end - 1)
     {
@@ -729,7 +729,7 @@ rl_vi_put (count, key)
   if (!_rl_uppercase_p (key) && (rl_point + 1 <= rl_end))
     rl_point++;
 
-  rl_yank ();
+  rl_yank (1, key);
   rl_backward (1, key);
   return (0);
 }
index d98f9c5e0197fa6267cb9c05d0c0b4fba047e0c1..439595c1d4508d7e6d104fd70e2e522b5e6fab4e 100644 (file)
@@ -16,10 +16,13 @@ INSTALL_DATA = @INSTALL_DATA@
 CC = @CC@
 RANLIB = @RANLIB@
 AR = @AR@
+ARFLAGS = @ARFLAGS@
 RM = rm -f
 CP = cp
 MV = mv
 
+SHELL = @MAKE_SHELL@
+
 CFLAGS = @CFLAGS@
 LOCAL_CFLAGS = @LOCAL_CFLAGS@
 CPPFLAGS = @CPPFLAGS@
@@ -44,7 +47,7 @@ LIBRARY_NAME = libsh.a
 # The C code source files for this library.
 CSOURCES = clktck.c getcwd.c getenv.c oslib.c setlinebuf.c \
           strcasecmp.c strerror.c strtod.c strtol.c strtoul.c \
-          vprint.c itos.c
+          vprint.c itos.c rename.c
 
 # The header files for this library.
 HSOURCES = 
@@ -52,7 +55,7 @@ HSOURCES =
 # The object files contained in $(LIBRARY_NAME)
 OBJECTS = clktck.o getcwd.o getenv.o oslib.o setlinebuf.o \
          strcasecmp.o strerror.o strtod.o strtol.o strtoul.o \
-         vprint.o itos.o
+         vprint.o itos.o rename.o
 
 SUPPORT = Makefile
 
@@ -60,7 +63,7 @@ all: $(LIBRARY_NAME)
 
 $(LIBRARY_NAME): $(OBJECTS)
        $(RM) $@
-       $(AR) cr $@ $(OBJECTS)
+       $(AR) $(ARFLAGS) $@ $(OBJECTS)
        -test -n "$(RANLIB)" && $(RANLIB) $@
 
 force:
@@ -86,6 +89,7 @@ getcwd.o: getcwd.c
 getenv.o: getenv.c
 itos.o: itos.c
 oslib.o: oslib.c
+rename.o: rename.c
 setlinebuf.o: setlinebuf.c
 strcasecmp.o: strcasecmp.c
 strerror.o: strerror.c
@@ -100,6 +104,7 @@ getcwd.o: ${BUILD_DIR}/config.h
 getenv.o: ${BUILD_DIR}/config.h
 itos.o: ${BUILD_DIR}/config.h
 oslib.o: ${BUILD_DIR}/config.h
+rename.o: ${BUILD_DIR}/config.h
 setlinebuf.o: ${BUILD_DIR}/config.h
 strcasecmp.o: ${BUILD_DIR}/config.h
 strerror.o: ${BUILD_DIR}/config.h
@@ -143,6 +148,8 @@ oslib.o: ${topdir}/pathnames.h ${topdir}/externs.h
 oslib.o: ${POSIX_INC}/posixstat.h ${POSIX_INC}/filecntl.h
 oslib.o: ${POSIX_INC}/ansi_stdlib.h
 
+rename.o: ${topdir}/bashtypes.h ${topdir}/stdc.h
+
 strcasecmp.o: ${topdir}/stdc.h ${topdir}/bashansi.h ${topdir}/ansi_stdlib.h
 
 strerror.o: ${topdir}/bashtypes.h
index 720e4100b83b286d9bf8cb6ed6053659ae8a9850..5105cb729f459ca1253bd61320ec09c2f201d411 100644 (file)
    of an integer.  32 is larger than the string rep of 2^^31 - 1. */
 #define MAX_INT_LEN 32
 
-/* Integer to string conversion.  This conses the string; the
-   caller should free it. */
+/* Integer to string conversion.  The caller passes the buffer and
+   the size.  This should check for buffer underflow, but currently
+   does not. */
 char *
-itos (i)
+inttostr (i, buf, len)
      int i;
+     char *buf;
+     int len;
 {
-  char buf[MAX_INT_LEN], *p, *ret;
+  char *p;
   int negative = 0;
   unsigned int ui;
 
@@ -49,7 +52,7 @@ itos (i)
 
   ui = (unsigned int) i;
 
-  p = buf + MAX_INT_LEN - 2;
+  p = buf + len - 2;
   p[1] = '\0';
 
   do
@@ -59,6 +62,17 @@ itos (i)
   if (negative)
     *p-- = '-';
 
-  ret = savestring (p + 1);
-  return (ret);
+  return (p + 1);
+}
+
+/* Integer to string conversion.  This conses the string; the
+   caller should free it. */
+char *
+itos (i)
+     int i;
+{
+  char *p, lbuf[MAX_INT_LEN];
+
+  p = inttostr (i, lbuf, sizeof(lbuf));
+  return (savestring (p));
 }
index d92c32e9756dc6e03c71091a625ee5e6695ffc55..3d58711156bb12b70e207b4ff57f0b6182d925ef 100644 (file)
@@ -154,6 +154,9 @@ getdtablesize ()
 #endif /* !HAVE_GETDTABLESIZE */
 
 #if !defined (HAVE_BCOPY)
+#  if defined (bcopy)
+#    undef bcopy
+#  endif
 void
 bcopy (s,d,n)
      char *d, *s;
@@ -164,6 +167,9 @@ bcopy (s,d,n)
 #endif /* !HAVE_BCOPY */
 
 #if !defined (HAVE_BZERO)
+#  if defined (bzero)
+#    undef bzero
+#  endif
 void
 bzero (s, n)
      char *s;
diff --git a/lib/sh/rename.c b/lib/sh/rename.c
new file mode 100644 (file)
index 0000000..799cb69
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * rename - rename a file
+ */
+
+#include <config.h>
+
+#if !defined (HAVE_RENAME)
+
+#include <bashtypes.h>
+
+#if defined (HAVE_UNISTD_H)
+#  include <unistd.h>
+#endif
+
+#include <stdc.h>
+
+int
+rename (from, to)
+     const char *from, *to;
+{
+  unlink (to);
+  if (link (from, to) < 0)
+    return (-1);
+  unlink (from);
+  return (0);
+}
+#endif /* !HAVE_RENAME */
index aed233fd8fc91ac55d684a77c5b5b6d718aa3366..8e3aa39fc36d3dee37975cedd10360d5394ee0d9 100644 (file)
@@ -34,6 +34,7 @@ extern int errno;
 #  include <limits.h>
 #endif
 
+#include <stdc.h>
 #include <bashansi.h>
 
 #ifndef NULL
index 64635f8d5ac47fb1253d1efa5dfda57b0fe46734..d5d33bc0489ce247f00ab4c3427568f99c7b1fed 100644 (file)
@@ -16,10 +16,13 @@ INSTALL_DATA = @INSTALL_DATA@
 CC = @CC@
 RANLIB = @RANLIB@
 AR = @AR@
+ARFLAGS = @ARFLAGS@
 RM = rm -f
 CP = cp
 MV = mv
 
+SHELL = @MAKE_SHELL@
+
 CFLAGS = @CFLAGS@
 CPPFLAGS = @CPPFLAGS@
 LDFLAGS = @LDFLAGS@
@@ -35,8 +38,6 @@ CCFLAGS = $(CFLAGS) $(DEFS) $(CPPFLAGS) ${INCLUDES}
 .c.o:
        $(CC) -c $(CCFLAGS) $<
 
-SHELL = /bin/sh
-
 SOURCES = termcap.c tparam.c
 OBJECTS = termcap.o tparam.o
 
@@ -50,7 +51,7 @@ all: libtermcap.a
 
 libtermcap.a:  $(OBJECTS)
        $(RM) -f $@
-       $(AR) cr $@ $(OBJECTS)
+       $(AR) $(ARFLAGS) $@ $(OBJECTS)
        -test -n "$(RANLIB)" && $(RANLIB) $@
 
 install:       
index 02138fc5d3007ced2eb8aebacf03fb1cd6b261d6..55b8d5acf247be0a0c93d788660bb2e2d6f27a20 100644 (file)
@@ -16,10 +16,13 @@ INSTALL_DATA = @INSTALL_DATA@
 CC = @CC@
 RANLIB = @RANLIB@
 AR = @AR@
+ARFLAGS = @ARFLAGS@
 RM = rm
 CP = cp
 MV = mv
 
+SHELL = @MAKE_SHELL@
+
 CFLAGS = @CFLAGS@
 LOCAL_CFLAGS = @LOCAL_CFLAGS@
 CPPFLAGS = @CPPFLAGS@
@@ -64,7 +67,7 @@ all: $(LIBRARY_NAME)
 
 $(LIBRARY_NAME): $(OBJECTS)
        $(RM) -f $@
-       $(AR) cr $@ $(OBJECTS)
+       $(AR) $(ARFLAGS) $@ $(OBJECTS)
        -test -n "$(RANLIB)" && $(RANLIB) $@
 
 documentation: force
diff --git a/lib/tilde/README b/lib/tilde/README
new file mode 100644 (file)
index 0000000..a8772f3
--- /dev/null
@@ -0,0 +1,5 @@
+If you're building this separately from bash or the readline library, add
+$(srcdir)/shell.c to the CSOURCES variable and shell.o to the OBJECTS
+variable in Makefile.in.  (Not that this is very useful without readline
+or bash.)
+
diff --git a/lib/tilde/shell.c b/lib/tilde/shell.c
new file mode 100644 (file)
index 0000000..91b1aaf
--- /dev/null
@@ -0,0 +1,70 @@
+/* shell.c -- tilde utility functions that are normally provided by
+             bash when readline is linked as part of the shell. */
+
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+
+   This file is part of the GNU Tilde Library.
+
+   The GNU Tilde 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 Tilde 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. */
+
+#if defined (HAVE_CONFIG_H)
+#  include <config.h>
+#endif
+
+#if defined (HAVE_UNISTD_H)
+#  ifdef _MINIX
+#    include <sys/types.h>
+#  endif
+#  include <unistd.h>
+#endif /* HAVE_UNISTD_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 <pwd.h>
+
+#if !defined (HAVE_GETPW_DECLS)
+extern struct passwd *getpwuid ();
+#endif /* !HAVE_GETPW_DECLS */
+
+char *
+get_env_value (varname)
+     char *varname;
+{
+  return ((char *)getenv (varname));
+}
+
+char *
+get_home_dir ()
+{
+  char *home_dir;
+  struct passwd *entry;
+
+  home_dir = (char *)NULL;
+  entry = getpwuid (getuid ());
+  if (entry)
+    home_dir = entry->pw_dir;
+  return (home_dir);
+}
index 3741f9767b23652c5514acd7dd0ce12daf682cb2..d1853bd63d62326fb82724264ff72a807821aeff 100644 (file)
 
 #include "tilde.h"
 
-#ifdef SHELL
-#include "shell.h"
-#endif
-
 #if !defined (HAVE_GETPW_DECLS)
 extern struct passwd *getpwuid (), *getpwnam ();
 #endif /* !HAVE_GETPW_DECLS */
@@ -77,6 +73,12 @@ static char *xmalloc (), *xrealloc ();
 extern char *xmalloc (), *xrealloc ();
 #endif /* TEST || STATIC_MALLOC */
 
+/* If being compiled as part of bash, these will be satisfied from
+   variables.o.  If being compiled as part of readline, they will
+   be satisfied from shell.o. */
+extern char *get_home_dir ();
+extern char *get_env_value ();
+
 /* The default value of tilde_additional_prefixes.  This is set to
    whitespace preceding a tilde so that simple programs which do not
    perform any word separation get desired behaviour. */
@@ -171,15 +173,6 @@ 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)
@@ -284,27 +277,6 @@ glue_prefix_and_suffix (prefix, 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.
    This always returns a newly-allocated string, never static storage. */
@@ -328,7 +300,7 @@ tilde_expand_word (filename)
   if (filename[1] == '\0' || filename[1] == '/')
     {
       /* Prefix $HOME to the rest of the string. */
-      expansion = get_string_value ("HOME");
+      expansion = get_env_value ("HOME");
 
       /* If there is no HOME variable, look up the directory in
         the password database. */
index 15738842d510db1da99c1d66c0ffeb96602a5e2b..24c30c7860dcbf85cbf4d472d59714667809616e 100644 (file)
--- a/locale.c
+++ b/locale.c
@@ -167,13 +167,22 @@ set_locale_var (var, value)
   return (0);
 }
 
+#if 0
 /* Called when LANG is assigned a value.  Sets LC_ALL if that has not
    already been set. */
+#else
+/* This no longer does anything; we rely on the C library for correct
+   behavior. */
+#endif
 int
 set_lang (var, value)
      char *var, *value;
 {
+#if 0
   return ((lc_all == 0) ? set_locale_var ("LC_ALL", value) : 0);
+#else
+  return 0;
+#endif
 }
 
 /* Get the value of one of the locale variables (LC_MESSAGES, LC_CTYPE) */
index d0991ca09772897a6115fb0f8e47fe949892295c..654895f7b88709b19b68f5be72f919f28ae2b77a 100644 (file)
@@ -346,6 +346,7 @@ make_cond_command (cond_node)
   command->type = cm_cond;
   command->redirects = (REDIRECT *)NULL;
   command->flags = 0;
+  command->line = cond_node ? cond_node->line : 0;
 
   return (command);
 #else
@@ -595,7 +596,7 @@ clean_simple_command (command)
      COMMAND *command;
 {
   if (command->type != cm_simple)
-    programming_error ("clean_simple_command: bad command type `%d'", command->type);
+    command_error ("clean_simple_command", CMDERR_BADTYPE, command->type, 0);
   else
     {
       command->value.Simple->words =
index 442ed1a158ac4138dbd4008eedd6fd9e5479927f..c68961f3293c14a198c133efb83f052115c856b5 100644 (file)
 #  define HAVE_ALLOCA
 #endif /* HAVE_ALLOCA_H && !HAVE_ALLOCA */
 
-#if defined (__GNUC__)
+#if defined (__GNUC__) && !defined (C_ALLOCA)
 #  undef alloca
 #  define alloca __builtin_alloca
-#else /* !__GNUC__ */
-#  if defined (HAVE_ALLOCA_H)
+#else /* !__GNUC__ || C_ALLOCA */
+#  if defined (HAVE_ALLOCA_H) && !defined (C_ALLOCA)
 #    if defined (IBMESA)
 #      include <malloc.h>
 #    else /* !IBMESA */
 #      include <alloca.h>
 #    endif /* !IBMESA */
-#  else  /* !HAVE_ALLOCA_H */
+#  else  /* !HAVE_ALLOCA_H || C_ALLOCA */
 #    if defined (__hpux) && defined (__STDC__) && !defined (alloca)
 extern void *alloca ();
 #    else
@@ -52,7 +52,7 @@ extern void *alloca ();
 extern char *alloca ();
 #      endif /* !alloca */
 #    endif /* !__hpux || !__STDC__ && !alloca */
-#  endif /* !HAVE_ALLOCA_H */
-#endif /* !__GNUC__ */
+#  endif /* !HAVE_ALLOCA_H || C_ALLOCA */
+#endif /* !__GNUC__ || C_ALLOCA */
 
 #endif /* _MEMALLOC_H_ */
index de43c357321635564eff199aee200091cc3b7c2b..e1116845aa153715f7bb617cb6a5c5a698e31a3f 100644 (file)
--- a/nojobs.c
+++ b/nojobs.c
@@ -668,6 +668,7 @@ get_tty_state ()
 }
 
 /* Make the current tty use the state in shell_tty_info. */
+int
 set_tty_state ()
 {
   int tty;
@@ -676,7 +677,7 @@ set_tty_state ()
   if (tty != -1)
     {
       if (got_tty_state == 0)
-       return;
+       return 0;
 
 #if defined (TERMIOS_TTY_DRIVER)
       tcsetattr (tty, TCSADRAIN, &shell_tty_info);
@@ -688,6 +689,7 @@ set_tty_state ()
 #  endif
 #endif
     }
+  return 0;
 }
 
 /* Give the terminal to PGRP.  */
diff --git a/parse.y b/parse.y
index eca168e25fb2a00e5ad4cdb6a1dcdf836078c8c5..24f709c5a6d301d10ef72ae70c2f68624c740509 100644 (file)
--- a/parse.y
+++ b/parse.y
@@ -786,11 +786,14 @@ timespec: TIME
 #define TOKEN_DEFAULT_GROW_SIZE 512
 
 /* Shell meta-characters that, when unquoted, separate words. */
-#define shellmeta(c)   (strchr ("()<>;&|", (c)) != 0)
-#define shellbreak(c)  (strchr ("()<>;&| \t\n", (c)) != 0)
+#define shellmeta(c)   (strchr (shell_meta_chars, (c)) != 0)
+#define shellbreak(c)  (strchr (shell_break_chars, (c)) != 0)
 #define shellquote(c)  ((c) == '"' || (c) == '`' || (c) == '\'')
 #define shellexp(c)    ((c) == '$' || (c) == '<' || (c) == '>')
 
+char *shell_meta_chars = "()<>;&|";
+char *shell_break_chars = "()<>;&| \t\n";
+
 /* The token currently being read. */
 static int current_token;
 
@@ -1467,6 +1470,10 @@ STRING_INT_ALIST word_token_alist[] = {
   { (char *)NULL, 0}
 };
 
+/* XXX - we should also have an alist with strings for other tokens, so we
+         can give more descriptive error messages.  Look at y.tab.h for the
+         other tokens. */
+
 /* These are used by read_token_word, but appear up here so that shell_getc
    can use them to decide when to add otherwise blank lines to the history. */
 
@@ -1919,6 +1926,11 @@ time_command_acceptable ()
     case AND_AND:
     case OR_OR:
     case '&':
+    case DO:
+    case THEN:
+    case ELSE:
+    case '{':
+    case '(':
       return 1;
     default:
       return 0;
@@ -2022,7 +2034,7 @@ special_case_tokens (token)
 #endif
 
 #if defined (COMMAND_TIMING)
-  if (STREQ (token, "time") && time_command_acceptable ())
+  if (STREQ (token, "time") && ((parser_state & PST_CASEPAT) == 0) && time_command_acceptable ())
     return (TIME);
 #endif /* COMMAND_TIMING */
 
@@ -2288,6 +2300,9 @@ read_token (command)
    quoted strings ('', ``, "") and nested constructs.  It also must handle
    reprompting the user, if necessary, after reading a newline, and returning
    correct error values if it reads EOF. */
+
+#define P_FIRSTCLOSE   0x01
+
 static char matched_pair_error;
 static char *
 parse_matched_pair (qc, open, close, lenp, flags)
@@ -2347,7 +2362,7 @@ parse_matched_pair (qc, open, close, lenp, flags)
        }
       else if (ch == close)            /* ending delimiter */
        count--;
-      else if (ch == open)             /* nested begin */
+      else if (((flags & P_FIRSTCLOSE) == 0) && ch == open)            /* nested begin */
        count++;
 
       /* Add this character. */
@@ -2409,7 +2424,7 @@ parse_matched_pair (qc, open, close, lenp, flags)
          if (ch == '(')                /* ) */
            nestret = parse_matched_pair (0, '(', ')', &nestlen, 0);
          else if (ch == '{')           /* } */
-           nestret = parse_matched_pair (0, '{', '}', &nestlen, 0);
+           nestret = parse_matched_pair (0, '{', '}', &nestlen, P_FIRSTCLOSE);
          else if (ch == '[')           /* ] */
            nestret = parse_matched_pair (0, '[', ']', &nestlen, 0);
          if (nestret == &matched_pair_error)
@@ -2787,7 +2802,7 @@ read_token_word (character)
                ((peek_char == '{' || peek_char == '[') && character == '$'))   /* ) ] } */
            {
              if (peek_char == '{')             /* } */
-               ttok = parse_matched_pair (cd, '{', '}', &ttoklen, 0);
+               ttok = parse_matched_pair (cd, '{', '}', &ttoklen, P_FIRSTCLOSE);
              else if (peek_char == '(')                /* ) */
                {
                  /* XXX - push and pop the `(' as a delimiter for use by
@@ -2841,6 +2856,23 @@ read_token_word (character)
              all_digits = 0;
              goto next_character;
            }
+         /* This could eventually be extended to recognize all of the
+            shell's single-character parameter expansions, and set flags.*/
+         else if (character == '$' && peek_char == '$')
+           {
+             ttok = xmalloc (3);
+             ttok[0] = ttok[1] = '$';
+             ttok[2] = '\0';
+             RESIZE_MALLOCED_BUFFER (token, token_index, 3,
+                                     token_buffer_size,
+                                     TOKEN_DEFAULT_GROW_SIZE);
+             strcpy (token + token_index, ttok);
+             token_index += 2;
+             dollar_present = 1;
+             all_digits = 0;
+             FREE (ttok);
+             goto next_character;
+           }
          else
            shell_ungetc (peek_char);
        }
@@ -2855,6 +2887,11 @@ read_token_word (character)
              ttok = parse_matched_pair (cd, '(', ')', &ttoklen, 0);
              if (ttok == &matched_pair_error)
                return -1;              /* Bail immediately. */
+             if (ttok[0] == '(')       /* ) */
+               {
+                 FREE (ttok);
+                 return -1;
+               }
              RESIZE_MALLOCED_BUFFER (token, token_index, ttoklen + 2,
                                      token_buffer_size,
                                      TOKEN_DEFAULT_GROW_SIZE);
@@ -3473,9 +3510,11 @@ decode_prompt_string (string)
              goto add_string;
 
            case '$':
-             temp = xmalloc (2);
-             temp[0] = current_user.euid == 0 ? '#' : '$';
-             temp[1] = '\0';
+             t = temp = xmalloc (3);
+             if ((promptvars || posixly_correct) && (current_user.euid != 0))
+               *t++ = '\\';
+             *t++ = current_user.euid == 0 ? '#' : '$';
+             *t = '\0';
              goto add_string;
 
 #if defined (READLINE)
index a7b69c1e7b801c655f5164bcf266d55a44b207c9..3c02effc66943f2d53faeaa12a20828825ef40b9 100644 (file)
--- a/pathexp.c
+++ b/pathexp.c
 #include "flags.h"
 
 #include <glob/fnmatch.h>
-#include <glob/glob.h>
+
+#if defined (USE_POSIX_GLOB_LIBRARY)
+#  include <glob.h>
+#else
+#  include <glob/glob.h>
+#endif
 
 /* Control whether * matches .files in globbing. */
 int glob_dot_filenames;
@@ -172,7 +177,12 @@ shell_glob_filename (pathname)
 
   filenames.gl_offs = 0;
 
+#  if defined (GLOB_PERIOD)
   glob_flags = glob_dot_filenames ? GLOB_PERIOD : 0;
+#  else
+  glob_flags = 0;
+#  endif /* !GLOB_PERIOD */
+
   glob_flags |= (GLOB_ERR | GLOB_DOOFFS);
 
   i = glob (temp, glob_flags, (Function *)NULL, &filenames);
@@ -181,8 +191,9 @@ shell_glob_filename (pathname)
 
   if (i == GLOB_NOSPACE || i == GLOB_ABEND)
     return ((char **)NULL);
-
-  if (i == GLOB_NOMATCH)
+  else if (i == GLOB_NOMATCH)
+    filenames.gl_pathv = (char **)NULL;
+  else if (i != 0)             /* other error codes not in POSIX.2 */
     filenames.gl_pathv = (char **)NULL;
 
   return (filenames.gl_pathv);
index 8703d17e9fbd0354ea794d9223c7fe3ee32f9670..1347cc07ebc507bc31b2fbb1eec3f6d6c0865218 100644 (file)
@@ -9,10 +9,12 @@
 
 #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))
+#  if !defined (__OPENNT)
+#    undef setjmp
+#    define setjmp(x)  sigsetjmp((x), 1)
+#    undef longjmp
+#    define longjmp(x, n)      siglongjmp((x), (n))
+#  endif /* !__OPENNT */
 #else
 #  define procenv_t    jmp_buf
 #endif
index 44460e93d43d0b1df4106c338c113425ff1597c8..472470156e66836bcf87c195540f99f9e989ba29 100644 (file)
@@ -260,7 +260,7 @@ make_command_string_internal (command)
          break;
 
        default:
-         programming_error ("print_command: bad command type `%d'", command->type);
+         command_error ("print_command", CMDERR_BADTYPE, command->type, 0);
          break;
        }
 
@@ -268,7 +268,10 @@ make_command_string_internal (command)
        cprintf (" )");
 
       if (command->redirects)
-       print_redirection_list (command->redirects);
+       {
+         cprintf (" ");
+         print_redirection_list (command->redirects);
+       }
     }
 }
 
@@ -518,7 +521,7 @@ print_cond_node (cond)
     }
   else if (cond->type == COND_UNARY)
     {
-      cprintf (cond->op->word);
+      cprintf ("%s", cond->op->word);
       cprintf (" ");
       print_cond_node (cond->left);
     }
@@ -526,13 +529,13 @@ print_cond_node (cond)
     {
       print_cond_node (cond->left);
       cprintf (" ");
-      cprintf (cond->op->word);
+      cprintf ("%s", cond->op->word);
       cprintf (" ");
       print_cond_node (cond->right);
     }
   else if (cond->type == COND_TERM)
     {
-      cprintf (cond->op->word);                /* need to add quoting here */
+      cprintf ("%s", cond->op->word);          /* need to add quoting here */
     }
 }
 
@@ -896,7 +899,7 @@ cprintf (format, arg1, arg2)
      char *format, *arg1, *arg2;
 {
   register char *s;
-  char char_arg[2], *argp, *args[2];
+  char char_arg[2], *argp, *args[2], intbuf[32];
   int arg_len, c, arg_index;
 
   args[arg_index = 0] = arg1;
@@ -933,10 +936,9 @@ cprintf (format, arg1, arg2)
              break;
 
            case 'd':
-             argp = itos (pointer_to_int (args[arg_index]));
+             argp = inttostr (pointer_to_int (args[arg_index]), intbuf, sizeof (intbuf));
              arg_index++;
              arg_len = strlen (argp);
-             free_argp = 1;
              break;
 
            case 'c':
@@ -976,7 +978,7 @@ cprintf (control, va_alist)
 #endif
 {
   register char *s;
-  char char_arg[2], *argp;
+  char char_arg[2], *argp, intbuf[32];
   int digit_arg, arg_len, c;
   va_list args;
 
@@ -1020,9 +1022,8 @@ cprintf (control, va_alist)
 
            case 'd':
              digit_arg = va_arg (args, int);
-             argp = itos (digit_arg);
+             argp = inttostr (digit_arg, intbuf, sizeof (intbuf));
              arg_len = strlen (argp);
-             free_argp = 1;
              break;
 
            case 'c':
diff --git a/shell.c b/shell.c
index e4f649c6737bfc6d6ac7180ea57cf477f33db1f4..d41aea03f7338975996970b4309ff77a1e31e45a 100644 (file)
--- a/shell.c
+++ b/shell.c
 #include <tilde/tilde.h>
 #include <glob/fnmatch.h>
 
+#if defined (__OPENNT)
+#  include <opennt/opennt.h>
+#endif
+
 #if !defined (HAVE_GETPW_DECLS)
 extern struct passwd *getpwuid ();
 #endif /* !HAVE_GETPW_DECLS */
@@ -81,6 +85,10 @@ extern struct passwd *getpwuid ();
 extern int errno;
 #endif
 
+#if defined (NO_MAIN_ENV_ARG)
+extern char **environ; /* used if no third argument to main() */
+#endif
+
 extern char *dist_version, *release_status;
 extern int patch_level, build_version;
 extern int subshell_environment;
@@ -110,7 +118,7 @@ char *current_host_name = (char *)NULL;
    Specifically:
    0 = not login shell.
    1 = login shell from getty (or equivalent fake out)
-  -1 = login shell from "-login" flag.
+  -1 = login shell from "--login" flag.
   -2 = both from getty, and from flag.
  */
 int login_shell = 0;
@@ -271,15 +279,28 @@ _cygwin32_check_tmp ()
 }
 #endif /* __CYGWIN32__ */
 
+#if defined (NO_MAIN_ENV_ARG)
+/* systems without third argument to main() */
+int
+main (argc, argv)
+     int argc;
+     char **argv;
+#else /* !NO_MAIN_ENV_ARG */
 int
 main (argc, argv, env)
      int argc;
      char **argv, **env;
+#endif /* !NO_MAIN_ENV_ARG */
 {
   register int i;
-  int code, saverst;
+  int code, saverst, old_errexit_flag;
   volatile int locally_skip_execution;
   volatile int arg_index, top_level_arg_index;
+#ifdef __OPENNT
+  char **env;
+
+  env = environ;
+#endif /* __OPENNT */
 
   /* Catch early SIGINTs. */
   code = setjmp (top_level);
@@ -461,6 +482,7 @@ main (argc, argv, env)
     }
 
   top_level_arg_index = arg_index;
+  old_errexit_flag = exit_immediately_on_error;
 
   /* Give this shell a place to longjmp to before executing the
      startup files.  This allows users to press C-c to abort the
@@ -476,6 +498,9 @@ main (argc, argv, env)
          /* Reset job control, since run_startup_files turned it off. */
          set_job_control (interactive_shell);
 #endif
+         /* Reset value of `set -e', since it's turned off before running
+            the startup files. */
+         exit_immediately_on_error += old_errexit_flag;
          locally_skip_execution++;
        }
     }
@@ -497,14 +522,27 @@ main (argc, argv, env)
     }
 
 #if defined (RESTRICTED_SHELL)
+  /* Set restricted_shell based on whether the basename of $0 indicates that
+     the shell should be restricted or if the `-r' option was supplied at
+     startup. */
+  restricted_shell = shell_is_restricted (shell_name);
+
   /* If the `-r' option is supplied at invocation, make sure that the shell
      is not in restricted mode when running the startup files. */
-    saverst = restricted;
-    restricted = 0;
+  saverst = restricted;
+  restricted = 0;
 #endif
 
+  /* The startup files are run with `set -e' temporarily disabled. */
   if (locally_skip_execution == 0 && running_setuid == 0)
-    run_startup_files ();
+    {
+      old_errexit_flag = exit_immediately_on_error;
+      exit_immediately_on_error = 0;
+
+      run_startup_files ();
+
+      exit_immediately_on_error += old_errexit_flag;
+    }
 
   /* If we are invoked as `sh', turn on Posix mode. */
   if (act_like_sh)
@@ -836,7 +874,11 @@ run_startup_files ()
       if (run_by_ssh || isnetconn (fileno (stdin)))
        {
 #ifdef SYS_BASHRC
+#  if defined (__OPENNT)
+         maybe_execute_file (_prefixInstallPath(SYS_BASHRC, NULL, 0), 1);
+#  else
          maybe_execute_file (SYS_BASHRC, 1);
+#  endif
 #endif
          maybe_execute_file (bashrc_file, 1);
          return;
@@ -850,8 +892,7 @@ run_startup_files ()
 
   sourced_login = 0;
 
-#if defined (NON_INTERACTIVE_LOGIN_SHELLS)
-  if (login_shell)
+  if (login_shell < 0 && posixly_correct == 0) /* --login flag and not posix */
     {
       /* We don't execute .bashrc for login shells. */
       no_rc++;
@@ -871,7 +912,6 @@ run_startup_files ()
 
       sourced_login = 1;
     }
-#endif /* NON_INTERACTIVE_LOGIN_SHELLS */
 
   /* A non-interactive shell not named `sh' and not in posix mode reads and
      executes commands from $BASH_ENV.  If `su' starts a shell with `-c cmd'
@@ -911,7 +951,11 @@ run_startup_files ()
       if (act_like_sh == 0 && no_rc == 0)
        {
 #ifdef SYS_BASHRC
+#  if defined (__OPENNT)
+         maybe_execute_file (_prefixInstallPath(SYS_BASHRC, NULL, 0), 1);
+#  else
          maybe_execute_file (SYS_BASHRC, 1);
+#  endif`
 #endif
           maybe_execute_file (bashrc_file, 1);
        }
@@ -932,10 +976,26 @@ run_startup_files ()
 }
 
 #if defined (RESTRICTED_SHELL)
+/* Return 1 if the shell should be a restricted one based on NAME or the
+   value of `restricted'.  Don't actually do anything, just return a
+   boolean value. */
+int
+shell_is_restricted (name)
+     char *name;
+{
+  char *temp;
+
+  if (restricted)
+    return 1;
+  temp = base_pathname (name);
+  return (STREQ (temp, RESTRICTED_SHELL_NAME));
+}
+
 /* Perhaps make this shell a `restricted' one, based on NAME.  If the
    basename of NAME is "rbash", then this shell is restricted.  The
    name of the restricted shell is a configurable option, see config.h.
-   In a restricted shell, PATH and SHELL are read-only and non-unsettable.
+   In a restricted shell, PATH, SHELL, ENV, and BASH_ENV are read-only
+   and non-unsettable.
    Do this also if `restricted' is already set to 1; maybe the shell was
    started with -r. */
 int
@@ -949,6 +1009,8 @@ maybe_make_restricted (name)
     {
       set_var_read_only ("PATH");
       set_var_read_only ("SHELL");
+      set_var_read_only ("ENV");
+      set_var_read_only ("BASH_ENV");
       restricted++;
     }
   return (restricted);
@@ -1011,7 +1073,7 @@ run_wordexp (words)
        case DISCARD:
          return last_command_exit_value = 1;
        default:
-         programming_error ("run_wordexp: bad jump: code %d", code);
+         command_error ("run_wordexp", CMDERR_BADJUMP, code, 0);
        }
     }
 
@@ -1084,7 +1146,7 @@ run_one_command (command)
        case DISCARD:
          return last_command_exit_value = 1;
        default:
-         programming_error ("run_one_command: bad jump: code %d", code);
+         command_error ("run_one_command", CMDERR_BADJUMP, code, 0);
        }
     }
    return (parse_and_execute (savestring (command), "-c", SEVAL_NOHIST));
@@ -1208,7 +1270,7 @@ open_shell_script (script_name)
 #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. */
+     not match with ours. */
   fd = move_to_high_fd (fd, 0, -1);
 
   default_input = fdopen (fd, "r");
@@ -1559,7 +1621,7 @@ static int
 isnetconn (fd)
      int fd;
 {
-#if defined (HAVE_GETPEERNAME) && !defined (SVR4_2)
+#if defined (HAVE_GETPEERNAME) && !defined (SVR4_2) && !defined (__BEOS__)
   int rv, l;
   struct sockaddr sa;
 
@@ -1567,7 +1629,7 @@ isnetconn (fd)
   rv = getpeername(fd, &sa, &l);
   /* Solaris 2.5 getpeername() returns EINVAL if the fd is not a socket. */
   return ((rv < 0 && (errno == ENOTSOCK || errno == EINVAL)) ? 0 : 1);
-#else /* !HAVE_GETPEERNAME || SVR4_2 */
+#else /* !HAVE_GETPEERNAME || SVR4_2 || __BEOS__ */
 #  if defined (SVR4) || defined (SVR4_2)
   /* Sockets on SVR4 and SVR4.2 are character special (streams) devices. */
   struct stat sb;
@@ -1582,15 +1644,15 @@ isnetconn (fd)
 #    endif /* S_ISFIFO */
   return (S_ISCHR (sb.st_mode));
 #  else /* !SVR4 && !SVR4_2 */
-#    if defined (S_ISSOCK)
+#    if defined (S_ISSOCK) && !defined (__BEOS__)
   struct stat sb;
 
   if (fstat (fd, &sb) < 0)
     return (0);
   return (S_ISSOCK (sb.st_mode));
-#    else /* !S_ISSOCK */
+#    else /* !S_ISSOCK || __BEOS__ */
   return (0);
-#    endif /* !S_ISSOCK */
+#    endif /* !S_ISSOCK || __BEOS__ */
 #  endif /* !SVR4 && !SVR4_2 */
-#endif /* !HAVE_GETPEERNAME || SVR4_2 */
+#endif /* !HAVE_GETPEERNAME || SVR4_2 || __BEOS__ */
 }
diff --git a/subst.c b/subst.c
index 94c230f79cb11c80f098ac4d6a2f7f5cec8fb8ba..5e0eb870682b1d7111d77ce08f7d061ee535b885 100644 (file)
--- a/subst.c
+++ b/subst.c
@@ -79,6 +79,7 @@ extern int errno;
 
 /* Process ID of the last command executed within command substitution. */
 pid_t last_command_subst_pid = NO_PID;
+pid_t current_command_subst_pid = NO_PID;
 
 /* Extern functions and variables from different files. */
 extern int last_command_exit_value, interactive, interactive_shell;
@@ -104,6 +105,8 @@ static int glob_argv_flags_size;
 static WORD_LIST expand_word_error, expand_word_fatal;
 static char expand_param_error, expand_param_fatal;
 
+static int doing_completion = 0;
+
 static char *make_quoted_char ();
 static void remove_quoted_nulls ();
 static char *param_expand ();
@@ -113,6 +116,7 @@ static WORD_LIST *expand_string_internal ();
 static WORD_LIST *expand_word_internal (), *expand_word_list_internal ();
 static WORD_LIST *expand_string_leave_quoted ();
 static WORD_LIST *expand_string_for_rhs ();
+static char *getifs ();
 static WORD_LIST *word_list_split ();
 static WORD_LIST *quote_list (), *dequote_list ();
 static char *quote_escapes ();
@@ -929,7 +933,7 @@ extract_dollar_brace_string (string, sindex, quoted)
        }
     }
 
-  if (c == 0 && nesting_level)
+  if (c == 0 && nesting_level && doing_completion == 0)
     {
       report_error ("bad substitution: no ending `}' in %s", string);
       jump_to_top_level (DISCARD);
@@ -987,7 +991,12 @@ unquote_bang (string)
 #if defined (READLINE)
 /* Return 1 if the portion of STRING ending at EINDEX is quoted (there is
    an unclosed quoted string), or if the character at EINDEX is quoted
-   by a backslash. */
+   by a backslash. DOING_COMPLETION is used to flag that the various
+   single and double-quoted string parsing functions should not return an
+   error if there are unclosed quotes or braces. */
+
+#define CQ_RETURN(x) do { doing_completion = 0; return (x); } while (0)
+
 int
 char_is_quoted (string, eindex)
      char *string;
@@ -995,13 +1004,14 @@ char_is_quoted (string, eindex)
 {
   int i, pass_next, quoted;
 
+  doing_completion = 1;
   for (i = pass_next = quoted = 0; i <= eindex; i++)
     {
       if (pass_next)
        {
          pass_next = 0;
          if (i >= eindex)      /* XXX was if (i >= eindex - 1) */
-           return 1;
+           CQ_RETURN(1);
          continue;
        }
       else if (string[i] == '\'' || string[i] == '"')
@@ -1009,7 +1019,7 @@ char_is_quoted (string, eindex)
          i = (string[i] == '\'') ? skip_single_quoted (string, ++i)
                                  : skip_double_quoted (string, ++i);
          if (i > eindex)
-           return 1;
+           CQ_RETURN(1);
          i--;  /* the skip functions increment past the closing quote. */
        }
       else if (string[i] == '\\')
@@ -1018,7 +1028,7 @@ char_is_quoted (string, eindex)
          continue;
        }
     }
-  return (0);
+  CQ_RETURN(0);
 }
 
 int
@@ -1829,7 +1839,7 @@ cond_expand_word (w, special)
   if (w->word == 0 || w->word[0] == '\0')
     return ((char *)NULL);
 
-  l = call_expand_word_internal (w, 0, (int *)0, (int *)0);
+  l = call_expand_word_internal (w, 0, 0, (int *)0, (int *)0);
   if (l)
     {
       if (special == 0)
@@ -1856,13 +1866,13 @@ cond_expand_word (w, special)
    A convenience function for functions that don't want to handle
    any errors or free any memory before aborting. */
 static WORD_LIST *
-call_expand_word_internal (w, q, c, e)
+call_expand_word_internal (w, q, i, c, e)
      WORD_DESC *w;
-     int q, *c, *e;
+     int q, i, *c, *e;
 {
   WORD_LIST *result;
 
-  result = expand_word_internal (w, q, c, e);
+  result = expand_word_internal (w, q, i, c, e);
   if (result == &expand_word_error)
     {
       /* By convention, each time this error is returned, w->word has
@@ -1893,7 +1903,7 @@ expand_string_internal (string, quoted)
 
   bzero ((char *)&td, sizeof (td));
   td.word = string;
-  tresult = call_expand_word_internal (&td, quoted, (int *)NULL, (int *)NULL);
+  tresult = call_expand_word_internal (&td, quoted, 0, (int *)NULL, (int *)NULL);
   return (tresult);
 }
 
@@ -1926,7 +1936,7 @@ expand_string_unsplit (string, quoted)
    the resultant WORD_LIST.  This is called only from within this file,
    and is used to correctly preserve quoted characters when expanding
    things like ${1+"$@"}.  This does parameter expansion, command
-   subsitution, arithmetic expansion, and word splitting. */
+   substitution, arithmetic expansion, and word splitting. */
 static WORD_LIST *
 expand_string_leave_quoted (string, quoted)
      char *string;
@@ -1964,7 +1974,7 @@ expand_string_for_rhs (string, quoted, dollar_at_p, has_dollar_at)
 
   bzero ((char *)&td, sizeof (td));
   td.word = string;
-  tresult = call_expand_word_internal (&td, quoted, dollar_at_p, has_dollar_at);
+  tresult = call_expand_word_internal (&td, quoted, 1, dollar_at_p, has_dollar_at);
   return (tresult);
 }
 
@@ -2665,7 +2675,7 @@ expand_word (word, quoted)
 {
   WORD_LIST *result, *tresult;
 
-  tresult = call_expand_word_internal (word, quoted, (int *)NULL, (int *)NULL);
+  tresult = call_expand_word_internal (word, quoted, 0, (int *)NULL, (int *)NULL);
   result = word_list_split (tresult);
   dispose_words (tresult);
   return (result ? dequote_list (result) : result);
@@ -2681,7 +2691,7 @@ expand_word_no_split (word, quoted)
 {
   WORD_LIST *result;
 
-  result = call_expand_word_internal (word, quoted, (int *)NULL, (int *)NULL);
+  result = call_expand_word_internal (word, quoted, 0, (int *)NULL, (int *)NULL);
   return (result ? dequote_list (result) : result);
 }
 
@@ -2692,7 +2702,7 @@ expand_word_leave_quoted (word, quoted)
      WORD_DESC *word;
      int quoted;
 {
-  return (call_expand_word_internal (word, quoted, (int *)NULL, (int *)NULL));
+  return (call_expand_word_internal (word, quoted, 0, (int *)NULL, (int *)NULL));
 }
 
 #if defined (PROCESS_SUBSTITUTION)
@@ -3212,6 +3222,7 @@ command_substitute (string, quoted)
 
       close (fildes[0]);
 
+      current_command_subst_pid = pid;
       last_command_exit_value = wait_for (pid);
       last_command_subst_pid = pid;
       last_made_pid = old_pid;
@@ -3954,11 +3965,35 @@ pat_subst (string, pat, rep, mflags)
   char *ret, *s, *e, *str;
   int rsize, rptr, l, replen, mtype;
 
+  mtype = mflags & MATCH_TYPEMASK;
+
+  /* Special cases:
+   *   1.  A null pattern with mtype == MATCH_BEG means to prefix STRING
+   *       with REP and return the result.
+   *   2.  A null pattern with mtype == MATCH_END means to append REP to
+   *       STRING and return the result.
+   */
+  if ((pat == 0 || *pat == 0) && (mtype == MATCH_BEG || mtype == MATCH_END))
+    {
+      replen = STRLEN (rep);
+      l = strlen (string);
+      ret = xmalloc (replen + l + 2);
+      if (mtype == MATCH_BEG)
+       {
+         strcpy (ret, rep);
+         strcpy (ret + replen, string);
+       }
+      else
+       {
+         strcpy (ret, string);
+         strcpy (ret + l, rep);
+       }
+      return (ret);
+    }
+
   ret = xmalloc (rsize = 64);
   ret[0] = '\0';
 
-  mtype = mflags & MATCH_TYPEMASK;
-
   for (replen = STRLEN (rep), rptr = 0, str = string;;)
     {
       if (match_pattern (str, pat, mtype, &s, &e) == 0)
@@ -4754,6 +4789,10 @@ return0:
 
    QUOTED contains flag values defined in shell.h.
 
+   ISEXP is used to tell expand_word_internal that the word should be
+   treated as the result of an expansion.  This has implications for
+   how IFS characters in the word are treated.
+
    CONTAINS_DOLLAR_AT and EXPANDED_SOMETHING are return values; when non-null
    they point to an integer value which receives information about expansion.
    CONTAINS_DOLLAR_AT gets non-zero if WORD contained "$@", else zero.
@@ -4769,9 +4808,9 @@ return0:
 #define WHOLLY_QUOTED    2
 
 static WORD_LIST *
-expand_word_internal (word, quoted, contains_dollar_at, expanded_something)
+expand_word_internal (word, quoted, isexp, contains_dollar_at, expanded_something)
      WORD_DESC *word;
-     int quoted;
+     int quoted, isexp;
      int *contains_dollar_at;
      int *expanded_something;
 {
@@ -4808,12 +4847,12 @@ expand_word_internal (word, quoted, contains_dollar_at, expanded_something)
   int had_quoted_null;
   int has_dollar_at;
 
-  int expok;
-
   register int c;              /* Current character. */
   int number;                  /* Temporary number value. */
   int t_index;                 /* For calls to string_extract_xxx. */
 
+  char ifscmap[256];
+
   istring = xmalloc (istring_size = DEFAULT_INITIAL_ARRAY_SIZE);
   istring[istring_index = 0] = '\0';
   quoted_dollar_at = had_quoted_null = has_dollar_at = 0;
@@ -4826,6 +4865,20 @@ expand_word_internal (word, quoted, contains_dollar_at, expanded_something)
   if (contains_dollar_at)
     *contains_dollar_at = 0;
 
+  /* Cache a bitmap of characters in IFS for quoting IFS characters that are
+     not part of an expansion.  POSIX.2 says this is a must. */
+  temp = getifs ();
+  bzero (ifscmap, sizeof (ifscmap));
+  for (temp1 = temp; temp1 && *temp1; temp1++)
+#if 0
+    /* This check compensates for what I think is a parsing problem -- the
+       end brace matching algorithms for ${...} expressions differ between
+       parse.y and subst.c.  For instance, the parser passes
+       ${abc:-G { I } K } as one word when it should be three. */
+    if (*temp1 != ' ' && *temp1 != '\t' && *temp1 != '\n')
+#endif
+      ifscmap[*temp1] = 1;
+
   /* Begin the expansion. */
 
   for (sindex = 0; ;)
@@ -4970,7 +5023,7 @@ add_string:
              temp = (char *)NULL;
 
              has_dollar_at = 0;
-             list = expand_word_internal (tword, Q_DOUBLE_QUOTES, &has_dollar_at, (int *)NULL);
+             list = expand_word_internal (tword, Q_DOUBLE_QUOTES, 0, &has_dollar_at, (int *)NULL);
 
              if (list == &expand_word_error || list == &expand_word_fatal)
                {
@@ -5117,7 +5170,7 @@ add_string:
 
        default:
          /* This is the fix for " $@ " */
-         if (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES))
+         if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) || (isexp == 0 && ifscmap[c]))
            {
              temp = make_quoted_char (c);
              goto dollar_add_string;
@@ -5193,6 +5246,8 @@ finished_with_string:
       list = make_word_list (tword, (WORD_LIST *)NULL);
       if (word->flags & W_ASSIGNMENT)
        tword->flags |= W_ASSIGNMENT;   /* XXX */
+      if (word->flags & W_NOGLOB)
+       tword->flags |= W_NOGLOB;       /* XXX */
       if (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES))
         tword->flags |= W_QUOTED;
     }
@@ -5200,13 +5255,7 @@ finished_with_string:
     {
       char *ifs_chars;
 
-      if (quoted_dollar_at || has_dollar_at)
-       {
-         var = find_variable ("IFS");
-         ifs_chars = var ? value_cell (var) : " \t\n";
-       }
-      else
-       ifs_chars = (char *)NULL;
+      ifs_chars = (quoted_dollar_at || has_dollar_at) ? getifs () : (char *)NULL;
 
       /* If we have $@, we need to split the results no matter what.  If
         IFS is unset or NULL, string_list_dollar_at has separated the
@@ -5224,6 +5273,8 @@ finished_with_string:
            tword->flags |= W_QUOTED;
          if (word->flags & W_ASSIGNMENT)
            tword->flags |= W_ASSIGNMENT;
+         if (word->flags & W_NOGLOB)
+           tword->flags |= W_NOGLOB;
        }
     }
 
@@ -5338,6 +5389,16 @@ word_list_quote_removal (list, quoted)
  *                                        *
  *******************************************/
 
+static char *
+getifs ()
+{
+  SHELL_VAR *ifs;
+
+  ifs = find_variable ("IFS");
+  /* If IFS is unset, it defaults to " \t\n". */
+  return (ifs ? value_cell (ifs) : " \t\n");
+}
+
 /* This splits a single word into a WORD LIST on $IFS, but only if the word
    is not quoted.  list_string () performs quote removal for us, even if we
    don't do any splitting. */
@@ -5411,6 +5472,9 @@ separate_out_assignments (tlist)
   if (!tlist)
     return ((WORD_LIST *)NULL);
 
+  if (varlist)
+    dispose_words (varlist);   /* Clean up after previous error */
+
   varlist = (WORD_LIST *)NULL;
   vp = lp = tlist;
 
@@ -5562,7 +5626,11 @@ glob_expand_word_list (tlist, eflags)
 
       /* If the word isn't an assignment and contains an unquoted
          pattern matching character, then glob it. */
+#if 0
       if ((tlist->word->flags & W_ASSIGNMENT) == 0 &&
+#else
+      if ((tlist->word->flags & W_NOGLOB) == 0 &&
+#endif
          unquoted_glob_pattern_p (tlist->word->word))
        {
          glob_array = shell_glob_filename (tlist->word->word);
@@ -5727,7 +5795,7 @@ shell_expand_word_list (tlist, eflags)
 
       expanded_something = 0;
       expanded = expand_word_internal
-       (tlist->word, 0, &has_dollar_at, &expanded_something);
+       (tlist->word, 0, 0, &has_dollar_at, &expanded_something);
 
       if (expanded == &expand_word_error || expanded == &expand_word_fatal)
        {
@@ -5777,15 +5845,15 @@ shell_expand_word_list (tlist, eflags)
 
 /* The workhorse for expand_words () and expand_words_no_vars ().
    First arg is LIST, a WORD_LIST of words.
-   Second arg DO_VARS is non-zero if you want to do environment and
-   variable assignments, else zero.
+   Second arg EFLAGS is a flags word controlling which expansions are
+   performed.
 
    This does all of the substitutions: brace expansion, tilde expansion,
    parameter expansion, command substitution, arithmetic expansion,
    process substitution, word splitting, and pathname expansion, according
    to the bits set in EFLAGS.  Words with the W_QUOTED or W_NOSPLIT bits
    set, or for which no expansion is done, do not undergo word splitting.
-   Words with the W_ASSIGNMENT bit set do not undergo pathname expansion. */
+   Words with the W_NOGLOB bit set do not undergo pathname expansion. */
 static WORD_LIST *
 expand_word_list_internal (list, eflags)
      WORD_LIST *list;
index 8daea28a629e1e1073dd733fb975daffbe445844..6c9e9abdea007fd076734b6a61554bea2c562596 100644 (file)
@@ -18,7 +18,7 @@ VPATH = .:@srcdir@
 BUILD_DIR = @BUILD_DIR@
 
 RM     = rm -f
-SHELL  = /bin/sh
+SHELL  = @MAKE_SHELL@
 CC = @CC@
 
 #
index c69b77e164743fb563a6554fc6d165c755bc65b8..93bde6fbc993303ec4685d970a651a345ba5e752 100644 (file)
@@ -10,6 +10,7 @@ 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/rlstdc.h          ../posixheaders/stdc.h
 lib/readline/xmalloc.c         ../malloc/xmalloc.c
 #
 #lib/tilde/memalloc.h          ../posixheaders/memalloc.h
index 2f152ff8f864a2ea8e201fffd8fc723cd8456172..66a24282a4706b7bec4eec724cfd1a80ea252b45 100755 (executable)
@@ -151,6 +151,18 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     *:QNX:*:42*)
        echo i386-qssl-qnx`echo ${UNAME_VERSION}`
        exit 0 ;;
+    BeBox:BeOS:*:*)
+       echo powerpc-be-beos
+       exit 0 ;;
+    BeMac:BeOS:*:*)
+       echo powerpc-apple-beos
+       exit 0 ;;
+    BePC:BeOS:*:*)
+       echo i586-pc-beos
+       exit 0 ;;
+    SX-4:SUPER-UX:*:*)
+       echo sx4-nec-superux${UNAME_RELEASE}
+       exit 0 ;;
     # end cases added for Bash
     alpha:OSF1:*:*)
        if test $UNAME_RELEASE = "V4.0"; then
@@ -213,6 +225,9 @@ EOF
     amiga:OpenBSD:*:*)
        echo m68k-cbm-openbsd${UNAME_RELEASE}
        exit 0 ;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+       echo ${UNAME_MACHINE}-unknown-amigaos
+       exit 0 ;;
     arc64:OpenBSD:*:*)
        echo mips64el-unknown-openbsd${UNAME_RELEASE}
        exit 0 ;;
@@ -315,10 +330,10 @@ EOF
        echo m88k-unknown-openbsd${UNAME_RELEASE}
        exit 0 ;;
     Power?Macintosh:Rhapsody:*:*)
-      echo powerpc-apple-nextstep${UNAME_RELEASE}
+      echo powerpc-apple-rhapsody${UNAME_RELEASE}
       exit 0 ;;
     *:Rhapsody:*:*)
-      echo ${UNAME_MACHINE}-unknown-nextstep${UNAME_RELEASE}
+      echo ${UNAME_MACHINE}-unknown-rhapsody${UNAME_RELEASE}
       exit 0 ;;
     powerpc:machten:*:*)
        echo powerpc-apple-machten${UNAME_RELEASE}
@@ -867,7 +882,7 @@ EOF
     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 ;;              
+       exit 0 ;;
 esac
 
 #echo '(No uname command or uname output not recognized.)' 1>&2
index 419d33269f857885a28681c547d2f90835bdb337..c1ec2df8f0bb9401463772b2292f8347741e76b4 100755 (executable)
@@ -94,7 +94,7 @@ case $os in
        -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
        -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
        -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-       -apple)
+       -apple )
                os=
                basic_machine=$1
                ;;
@@ -184,7 +184,7 @@ case $basic_machine in
              | cadmus-* | ews*-nec | ibmrt-ibm* | masscomp-masscomp \
              | tandem-* | symmetric-* | drs6000-icl | *-*ardent | gould-gould \
              | concurrent-* | ksr1-* | esa-ibm | fxc-alliant | *370-amdahl \
-             | *-convex)
+             | *-convex | sx4*-nec)
                ;;
        # Recognize the various machine names and aliases which stand
        # for a CPU type and a company and sometimes even an OS.
@@ -209,7 +209,12 @@ case $basic_machine in
                os=-sysv
                ;;
        amiga | amiga-*)
-               basic_machine=m68k-cbm
+#              basic_machine=m68k-cbm
+               basic_machine=m68k-unknown
+               ;;
+       amigaos)
+               basic_machine=m68k-unknown
+               os=-amigaos
                ;;
        amigados)
                basic_machine=m68k-cbm
@@ -405,6 +410,14 @@ case $basic_machine in
        miniframe)
                basic_machine=m68000-convergent
                ;;
+       mipsel*-linux*)
+               basic_machine=mipsel-unknown
+               os=-linux
+               ;;
+       mips*-linux*)
+               basic_machine=mips-unknown
+               os=-linux
+               ;;
        mips3*-*)
                basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
                ;;
@@ -639,7 +652,11 @@ case $basic_machine in
 # Here we handle the default manufacturer of certain CPU types.  It is in
 # some cases the only manufacturer, in others, it is the most popular.
        mips)
-               basic_machine=mips-mips
+               if test "x$os" = "x-linux" ; then
+                       basic_machine=mips-unknown
+               else
+                       basic_machine=mips-mips
+               fi
                ;;
        romp)
                basic_machine=romp-ibm
@@ -719,7 +736,7 @@ case $os in
        -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
              | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
              | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
-             | -amigados* | -msdos* | -newsos* | -unicos* | -aof* | -aos* \
+             | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* | -aos* \
              | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
              | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
              | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
@@ -727,7 +744,8 @@ case $os in
              | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
              | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
              | -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-             | -linux-gnu* | -uxpv* | -qnx* | -powerux)
+             | -linux-gnu* | -uxpv* | -qnx* | -powerux* | -beos* | -rhapsody* \
+             | -superux* )
        # Remember, each alternative MUST END IN *, to match a version number.
                ;;
        -linux*)
@@ -843,6 +861,9 @@ case $basic_machine in
        sparc-* | *-sun)
                os=-sunos4.1.1
                ;;
+       *-be)
+               os=-beos
+               ;;
        *-ibm)
                os=-aix
                ;;
@@ -856,7 +877,7 @@ case $basic_machine in
                os=-sysv
                ;;
        *-cbm)
-               os=-amigados
+               os=-amigaos
                ;;
        *-dg)
                os=-dgux
diff --git a/support/missing b/support/missing
new file mode 100755 (executable)
index 0000000..cbe2b0e
--- /dev/null
@@ -0,0 +1,188 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+# Franc,ois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# This program 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.
+
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+if test $# -eq 0; then
+  echo 1>&2 "Try \`$0 --help' for more information"
+  exit 1
+fi
+
+case "$1" in
+
+  -h|--h|--he|--hel|--help)
+    echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+  -h, --help      display this help and exit
+  -v, --version   output version information and exit
+
+Supported PROGRAM values:
+  aclocal      touch file \`aclocal.m4'
+  autoconf     touch file \`configure'
+  autoheader   touch file \`config.h.in'
+  automake     touch all \`Makefile.in' files
+  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
+  flex         create \`lex.yy.c', if possible, from existing .c
+  lex          create \`lex.yy.c', if possible, from existing .c
+  makeinfo     touch the output file
+  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]"
+    ;;
+
+  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+    echo "missing - GNU libit 0.0"
+    ;;
+
+  -*)
+    echo 1>&2 "$0: Unknown \`$1' option"
+    echo 1>&2 "Try \`$0 --help' for more information"
+    exit 1
+    ;;
+
+  aclocal)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`acinclude.m4' or \`configure.in'.  You might want
+         to install the \`Automake' and \`Perl' packages.  Grab them from
+         any GNU archive site."
+    touch aclocal.m4
+    ;;
+
+  autoconf)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`configure.in'.  You might want to install the
+         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
+         archive site."
+    touch configure
+    ;;
+
+  autoheader)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`acconfig.h' or \`configure.in'.  You might want
+         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
+         from any GNU archive site."
+    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER([^):]*:\([^)]*\)).*/\1/p' configure.in`
+    if test -z "$files"; then
+      files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^):]*\)).*/\1/p' configure.in`
+      test -z "$files" || files="$files.in"
+    else
+      files=`echo "$files" | sed -e 's/:/ /g'`
+    fi
+    test -z "$files" && files="config.h.in"
+    touch $files
+    ;;
+
+  automake)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'.
+         You might want to install the \`Automake' and \`Perl' packages.
+         Grab them from any GNU archive site."
+    find . -type f -name Makefile.am -print \
+      | sed 's/^\(.*\).am$/touch \1.in/' \
+      | sh
+    ;;
+
+  bison|yacc)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified a \`.y' file.  You may need the \`Bison' package
+         in order for those modifications to take effect.  You can get
+         \`Bison' from any GNU archive site."
+    rm -f y.tab.c y.tab.h
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+       case "$LASTARG" in
+       *.y)
+           SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+           if [ -f "$SRCFILE" ]; then
+                cp "$SRCFILE" y.tab.c
+           fi
+           SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+           if [ -f "$SRCFILE" ]; then
+                cp "$SRCFILE" y.tab.h
+           fi
+         ;;
+       esac
+    fi
+    if [ ! -f y.tab.h ]; then
+       echo >y.tab.h
+    fi
+    if [ ! -f y.tab.c ]; then
+       echo 'main() { return 0; }' >y.tab.c
+    fi
+    ;;
+
+  lex|flex)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified a \`.l' file.  You may need the \`Flex' package
+         in order for those modifications to take effect.  You can get
+         \`Flex' from any GNU archive site."
+    rm -f lex.yy.c
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+       case "$LASTARG" in
+       *.l)
+           SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+           if [ -f "$SRCFILE" ]; then
+                cp "$SRCFILE" lex.yy.c
+           fi
+         ;;
+       esac
+    fi
+    if [ ! -f lex.yy.c ]; then
+       echo 'main() { return 0; }' >lex.yy.c
+    fi
+    ;;
+
+  makeinfo)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified a \`.texi' or \`.texinfo' file, or any other file
+         indirectly affecting the aspect of the manual.  The spurious
+         call might also be the consequence of using a buggy \`make' (AIX,
+         DU, IRIX).  You might want to install the \`Texinfo' package or
+         the \`GNU make' package.  Grab either from any GNU archive site."
+    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    if test -z "$file"; then
+      file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
+    fi
+    touch $file
+    ;;
+
+  *)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, and you do not seem to have it handy on your
+         system.  You might have modified some files without having the
+         proper tools for further handling them.  Check the \`README' file,
+         it often tells you about the needed prerequirements for installing
+         this package.  You may also peek at any GNU archive site, in case
+         some other package would contain this missing \`$1' program."
+    exit 1
+    ;;
+esac
+
+exit 0
index 19fd3f2ae79211367ce3918ac40a2083feeed950..634263edadb792f5fe728d76641dfad6fd2d667c 100644 (file)
@@ -260,7 +260,7 @@ initialize_signames ()
 #endif
 
 /* 4.4 BSD */
-#if defined (SIGINFO)  /* information request */
+#if defined (SIGINFO) && !defined (_SEQUENT_)  /* information request */
   signal_names[SIGINFO] = "SIGINFO";
 #endif
 
@@ -272,6 +272,10 @@ initialize_signames ()
   signal_names[SIGUSR2] = "SIGUSR2";
 #endif
 
+#if defined (SIGKILLTHR)       /* BeOS: Kill Thread */
+  signal_names[SIGKILLTHR] = "SIGKILLTHR";
+#endif
+
   for (i = 0; i < NSIG; i++)
     if (signal_names[i] == (char *)NULL)
       {
diff --git a/support/rlvers.sh b/support/rlvers.sh
new file mode 100755 (executable)
index 0000000..12abeda
--- /dev/null
@@ -0,0 +1,71 @@
+#! /bin/sh
+#
+# rlvers.sh -- run a program that prints out the readline version number
+#             using locally-installed readline libraries
+#
+
+PROGNAME=`basename $0`
+
+trap 'rm -f /tmp/rlvers /tmp/rlvers.?' 0 1 2 3 6 15
+
+# defaults
+CC=cc
+RL_LIBDIR=/usr/local/lib
+
+while [ $# -gt 0 ]; do
+       case "$1" in
+       -C)     shift ; CC="$1"; shift ;;
+       -L)     shift ; RL_LIBDIR="$1" ; shift ;;
+       -v)     shift ; verbose=y ;;
+       --)     shift ; break ;;
+       *)      echo "${PROGNAME}: usage: $PROGNAME [-C compiler] [-L libdir] [-v]" >&2 ; exit 2;;
+       esac
+done
+
+# if someone happened to install examples/rlversion, use it (it's not
+# installed by default)
+if test -f ${RL_LIBDIR}/rlversion ; then
+       if [ -n "$verbose" ]; then
+               echo "${PROGNAME}: using installed rlversion from ${RL_LIBDIR}/rlversion"
+       fi
+       v=`${RL_LIBDIR}/rlversion 2>/dev/null`
+       case "$v" in
+       unknown | "")   echo 0 ;;
+       *)              echo "$v" ;;
+       esac
+       exit 0
+fi
+
+if [ -n "$verbose" ]; then
+       echo "${PROGNAME}: using ${RL_LIBDIR} to find libreadline"
+       echo "${PROGNAME}: attempting program compilation"
+fi
+
+cat > /tmp/rlvers.c << EOF
+#include <stdio.h>
+extern char *rl_library_version;
+
+main()
+{
+       printf("%s\n", rl_library_version ? rl_library_version : "0");
+       exit(0);
+}
+EOF
+
+if eval ${CC} -L${RL_LIBDIR} -o /tmp/rlvers /tmp/rlvers.c -lreadline -ltermcap -lcurses;
+then
+       v=`/tmp/rlvers`
+else
+       if [ -n "$verbose" ] ; then
+               echo "${PROGNAME}: compilation failed: status $?"
+               echo "${PROGNAME}: using version 0"
+       fi
+       v=0
+fi
+
+case "$v" in
+unknown | "")  echo 0 ;;
+*)             echo "$v" ;;
+esac
+
+exit 0
diff --git a/support/shobj-conf b/support/shobj-conf
new file mode 100755 (executable)
index 0000000..cbd3d1b
--- /dev/null
@@ -0,0 +1,341 @@
+#! /bin/sh
+#
+# shobj-conf -- output a series of variable assignments to be substituted
+#              into a Makefile by configure which specify system-dependent
+#              information for creating shared objects that may be loaded
+#              into bash with `enable -f'
+#
+# usage: shobj-conf [-C compiler] -c host_cpu -o host_os -v host_vendor
+#
+# Chet Ramey
+# chet@po.cwru.edu
+
+#
+# defaults
+#
+SHOBJ_STATUS=supported
+SHLIB_STATUS=supported
+
+SHOBJ_CC=cc
+SHOBJ_CFLAGS=
+SHOBJ_LD=
+SHOBJ_LDFLAGS=
+SHOBJ_XLDFLAGS=
+SHOBJ_LIBS=
+
+SHLIB_XLDFLAGS=
+SHLIB_LIBS=
+SHLIB_LIBSUFF='so'
+
+SHLIB_LIBVERSION='$(SHLIB_LIBSUFF)'
+
+PROGNAME=`basename $0`
+USAGE="$PROGNAME [-C compiler] -c host_cpu -o host_os -v host_vendor"
+
+while [ $# -gt 0 ]; do
+       case "$1" in
+       -C)     shift; SHOBJ_CC="$1"; shift ;;
+       -c)     shift; host_cpu="$1"; shift ;;
+       -o)     shift; host_os="$1"; shift ;;
+       -v)     shift; host_vendor="$1"; shift ;;
+       *)      echo "$USAGE" >&2 ; exit 2;;
+       esac
+done
+
+case "${host_os}-${SHOBJ_CC}" in
+sunos4*-gcc*)
+       SHOBJ_CFLAGS=-fpic
+       SHOBJ_LD=/usr/bin/ld
+       SHOBJ_LDFLAGS='-assert pure-text'
+
+       SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
+       ;;
+
+sunos4*)
+       SHOBJ_CFLAGS=-pic
+       SHOBJ_LD=/usr/bin/ld
+       SHOBJ_LDFLAGS='-assert pure-text'
+
+       SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
+       ;;
+
+sunos5*-gcc*|solaris2*-gcc*)
+       SHOBJ_CFLAGS=-fpic
+       SHOBJ_LD='${CC}'
+       SHOBJ_LDFLAGS='-shared -Wl,-i'
+
+       SHLIB_XLDFLAGS='-R $(libdir)'
+       SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+       ;;
+
+sunos5*|solaris2*)
+       SHOBJ_CFLAGS='-K pic'
+       SHOBJ_LD=/usr/ccs/bin/ld
+       SHOBJ_LDFLAGS='-G -dy -z text -i -h $@'
+
+       SHLIB_XLDFLAGS='-R $(libdir)'
+       SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+       ;;
+
+freebsd2* | netbsd* | openbsd*)
+       SHOBJ_CFLAGS=-fpic
+       SHOBJ_LD=ld
+       SHOBJ_LDFLAGS='-x -Bshareable'
+
+       SHLIB_XLDFLAGS='-R$(libdir)'
+       SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
+       ;;
+
+freebsd3*)
+       SHOBJ_CFLAGS=-fpic
+       SHOBJ_LD='${CC}'
+       SHOBJ_LDFLAGS='-shared'
+
+       SHLIB_XLDFLAGS='-R$(libdir)'
+       SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
+       ;;
+
+linux*)
+       SHOBJ_CFLAGS=-fPIC
+       SHOBJ_LD='${CC}'
+       SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
+
+       SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir)'
+       SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
+       ;;
+
+bsdi2*)
+       SHOBJ_CC=shlicc2
+       SHOBJ_CFLAGS=
+       SHOBJ_LD=ld
+       SHOBJ_LDFLAGS=-r
+       SHOBJ_LIBS=-lc_s.2.1.0
+
+       # BSD/OS 2.x and 3.x `shared libraries' are too much of a pain in
+       # the ass -- they require changing {/usr/lib,etc}/shlib.map on
+       # each system, and the library creation process is byzantine
+       SHLIB_STATUS=unsupported
+       ;;
+
+bsdi3*)
+       SHOBJ_CC=shlicc2
+       SHOBJ_CFLAGS=
+       SHOBJ_LD=ld
+       SHOBJ_LDFLAGS=-r
+       SHOBJ_LIBS=-lc_s.3.0.0
+
+       # BSD/OS 2.x and 3.x `shared libraries' are too much of a pain in
+       # the ass -- they require changing {/usr/lib,etc}/shlib.map on
+       # each system, and the library creation process is byzantine
+       SHLIB_STATUS=unsupported
+       ;;
+
+bsdi4*)
+       # BSD/OS 4.x now supports ELF and SunOS-style dynamically-linked
+       # shared libraries.  gcc 2.x is the standard compiler, and the
+       # `normal' gcc options should work as they do in Linux.
+
+       SHOBJ_CFLAGS=-fPIC
+       SHOBJ_LD='${CC}'
+       SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
+
+       SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
+       ;;
+
+osf*)
+       SHOBJ_LD=ld
+       SHOBJ_LDFLAGS='-shared -soname $@ -expect_unresolved "*"'
+
+       SHLIB_XLDFLAGS='-rpath $(libdir)'
+       SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+       ;;
+
+aix4.[2-9]*-gcc*)              # lightly tested by jik@cisco.com
+       SHOBJ_CFLAGS=-fpic
+       SHOBJ_LD='ld'
+       SHOBJ_LDFLAGS='-bdynamic -bnoentry -bexpall'
+       SHOBJ_XLDFLAGS='-G'
+
+       SHLIB_XLDFLAGS='-bM:SRE'
+       SHLIB_LIBS='-lcurses -lc'
+       SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+       ;;
+
+aix4.[2-9]*)
+       SHOBJ_CFLAGS=-K
+       SHOBJ_LD='ld'
+       SHOBJ_LDFLAGS='-bdynamic -bnoentry -bexpall'
+       SHOBJ_XLDFLAGS='-G'
+
+       SHLIB_XLDFLAGS='-bM:SRE'
+       SHLIB_LIBS='-lcurses -lc'
+       SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+       ;;
+
+#
+# THE FOLLOWING ARE UNTESTED -- and some may not support the dlopen interface
+#
+irix[56]*-gcc*)
+       SHOBJ_CFLAGS='-fpic'
+       SHOBJ_LD='${CC}'
+       SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
+
+       SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir)'
+       SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+       ;;
+
+irix[56]*)
+       SHOBJ_CFLAGS='-K PIC'
+       SHOBJ_LD=ld
+       SHOBJ_LDFLAGS='-call_shared -hidden_symbol -no_unresolved -soname $@'
+
+       SHLIB_XLDFLAGS='-rpath $(libdir)'
+       SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+       ;;
+
+hpux9*-gcc*)
+       # must use gcc; the bundled cc cannot compile PIC code
+       SHOBJ_CFLAGS='-fpic'
+       SHOBJ_LD='${CC}'
+       SHOBJ_LDFLAGS='-shared -Wl,-b -Wl,+s'
+
+       SHLIB_XLDFLAGS='-Wl,+b,$(libdir)'
+       SHLIB_LIBSUFF='sl'
+       SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+       ;;
+
+hpux9*)
+       SHOBJ_STATUS=unsupported
+       SHLIB_STATUS=unsupported
+       ;;
+
+hpux10*-gcc*)
+       # must use gcc; the bundled cc cannot compile PIC code
+       SHOBJ_CFLAGS='-fpic'
+       SHOBJ_LD='${CC}'
+       SHOBJ_LDFLAGS='-shared -Wl,-b -Wl,+s'
+
+       SHLIB_XLDFLAGS='-Wl,+h,$@ -Wl,+b,$(libdir)'
+       SHLIB_LIBSUFF='sl'
+       SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+       ;;
+
+hpux10*)
+       SHOBJ_STATUS=unsupported
+       SHLIB_STATUS=unsupported
+       ;;
+
+hpux11*-gcc*)
+       # must use gcc; the bundled cc cannot compile PIC code
+       SHOBJ_CFLAGS='-fpic'
+       SHOBJ_LD='${CC}'
+#      SHOBJ_LDFLAGS='-shared -Wl,-b -Wl,-B,symbolic -Wl,+s -Wl,+std -Wl,+h,$@'
+       SHOBJ_LDFLAGS='-shared -Wl,-b -Wl,+s -Wl,+h,$@'
+
+       SHLIB_XLDFLAGS='-Wl,+b,$(libdir)'
+       SHLIB_LIBSUFF='sl'
+       SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+       ;;
+
+hpux11*)
+       SHOBJ_STATUS=unsupported
+       SHLIB_STATUS=unsupported
+       ;;
+
+sysv4*-gcc*)
+       SHOBJ_CFLAGS=-shared
+       SHOBJ_LDFLAGS='-shared -h $@'
+       SHOBJ_LD='${CC}'
+
+       SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+       ;;
+
+sysv4*)
+       SHOBJ_CFLAGS='-K PIC'
+       SHOBJ_LD=ld
+       SHOBJ_LDFLAGS='-dy -z text -G -h $@'
+
+       SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+       ;;
+
+sco3.2v5*-gcc*)
+       SHOBJ_CFLAGS='-fpic'            # DEFAULTS TO ELF
+       SHOBJ_LD='${CC}'
+       SHOBJ_LDFLAGS='-shared'
+
+       SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+       ;;
+
+sco3.2v5*)
+       SHOBJ_CFLAGS='-K pic -b elf'
+       SHOBJ_LD=ld
+       SHOBJ_LDFLAGS='-G -b elf -dy -z text -h $@'
+
+       SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+       ;;
+
+sysv5uw7*-gcc*)
+       SHOBJ_CFLAGS='-fpic'
+       SHOBJ_LD='${CC}'
+       SHOBJ_LDFLAGS='-shared'
+
+       SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+       ;;
+
+sysv5uw7*)
+       SHOBJ_CFLAGS='-K PIC'
+       SHOBJ_LD=ld
+       SHOBJ_LDFLAGS='-G -dy -z text -h $@'
+
+       SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+       ;;
+       
+dgux*-gcc*)
+       SHOBJ_CFLAGS=-fpic
+       SHOBJ_LD='${CC}'
+       SHOBJ_LDFLAGS='-shared'
+
+       SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+       ;;
+
+dgux*)
+       SHOBJ_CFLAGS='-K pic'
+       SHOBJ_LD=ld
+       SHOBJ_LDFLAGS='-G -dy -h $@'
+
+       SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+       ;;
+#
+# Rely on correct gcc configuration for everything else
+#
+*-gcc*)
+       SHOBJ_CFLAGS=-fpic
+       SHOBJ_LD='${CC}'
+       SHOBJ_LDFLAGS='-shared'
+
+       SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+       ;;
+
+*)
+       SHOBJ_STATUS=unsupported
+       SHLIB_STATUS=unsupported
+       ;;
+
+esac
+
+echo SHOBJ_CC=\'"$SHOBJ_CC"\'
+echo SHOBJ_CFLAGS=\'"$SHOBJ_CFLAGS"\'
+echo SHOBJ_LD=\'"$SHOBJ_LD"\'
+echo SHOBJ_LDFLAGS=\'"$SHOBJ_LDFLAGS"\'
+echo SHOBJ_XLDFLAGS=\'"$SHOBJ_XLDFLAGS"\'
+echo SHOBJ_LIBS=\'"$SHOBJ_LIBS"\'
+
+echo SHLIB_XLDFLAGS=\'"$SHLIB_XLDFLAGS"\'
+echo SHLIB_LIBS=\'"$SHLIB_LIBS"\'
+echo SHLIB_LIBSUFF=\'"$SHLIB_LIBSUFF"\'
+echo SHLIB_LIBVERSION=\'"$SHLIB_LIBVERSION"\'
+
+echo SHOBJ_STATUS=\'"$SHOBJ_STATUS"\'
+echo SHLIB_STATUS=\'"$SHLIB_STATUS"\'
+
+exit 0
index 8fb2f908771cf376acf9c892171bd70c6b507a8c..43f652d00f190919ea8d1d17b8916c835d629e96 100755 (executable)
@@ -1,10 +1,9 @@
 #! /bin/sh
 # texi2dvi --- smartly produce DVI files from texinfo sources
-
-# Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
-
-# $Id: texi2dvi,v 0.5 1995/06/20 02:21:36 friedman Exp $
-
+# $Id: texi2dvi,v 0.8 1998/02/26 21:13:13 karl Exp $
+#
+# Copyright (C) 1992, 93, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
+#
 # This program 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)
 # along with this program; if not, you can either send email to this
 # program's maintainer or write to: The Free Software Foundation,
 # Inc.; 59 Temple Place, Suite 330; Boston, MA 02111-1307, USA.
-
+#
 # Commentary:
-
-# Author: Noah Friedman <friedman@prep.ai.mit.edu>
-
-# Please send bug reports, etc. to bug-texinfo@prep.ai.mit.edu
+#
+# Author: Noah Friedman <friedman@gnu.org>
+#
+# Please send bug reports, etc. to bug-texinfo@gnu.org.
 # If possible, please send a copy of the output of the script called with
 # the `--debug' option when making a bug report.
-
+#
 # In the interest of general portability, some common bourne shell
 # constructs were avoided because they weren't guaranteed to be available
 # in some earlier implementations.  I've tried to make this program as
 # portable as possible.  Welcome to unix, where the lowest common
 # denominator is rapidly diminishing.
 #
-# Among the more interesting lossages I noticed with some bourne shells
-# are:
+# Among the more interesting lossages I noticed among Bourne shells:
 #     * No shell functions.
 #     * No `unset' builtin.
 #     * `shift' cannot take a numeric argument, and signals an error if
 #       there are no arguments to shift.
-
+#
 # Code:
 
 # Name by which this script was invoked.
 progname=`echo "$0" | sed -e 's/[^\/]*\///g'`
 
 # This string is expanded by rcs automatically when this file is checked out.
-rcs_revision='$Revision: 0.5 $'
+rcs_revision='$Revision: 0.8 $'
 version=`set - $rcs_revision; echo $2`
 
 # To prevent hairy quoting and escaping later.
 bq='`'
 eq="'"
 
-usage="Usage: $progname {options} [file1] {file2 {...}}
-(version $version)
+usage="Usage: $0 [OPTION]... FILE...
+Run a Texinfo document through TeX.
 
-Options are:
+Options:
+-b, --batch          No interaction (\nonstopmode in TeX).
+-c, --clean          Remove all auxiliary files.
 -D, --debug          Turn on shell debugging ($bq${bq}set -x$eq$eq).
--h, --help           You're looking at it.
--v, --version        Print version number.
+-t, --texinfo CMD    Insert CMD after @setfilename before running TeX.
+--verbose            Report on what is done.
+-h, --help           Display this help and exit.
+-v, --version        Display version information and exit.
 
-Arguments in brackets are required.  Those in braces are optional.
-"
+The values of the TEX, TEXINDEX, and MAKEINFO environment variables are
+used to run those commands, if they are set.
+
+Email bug reports to bug-texinfo@gnu.org."
 
 # Initialize variables.
 # Don't use `unset' since old bourne shells don't have this command.
 # Instead, assign them an empty value.
-# Some of these, like TEX and TEXINDEX, may be inherited from the environment
-backup_extension=.bak
+# Some of these, like TEX and TEXINDEX, may be inherited from the environment.
+backup_extension=.bak # these files get deleted if all goes well.
+batch=
+clean=
 debug=
 orig_pwd="`pwd`"
-verbose=
+textra=
+verbose=false
+makeinfo="${MAKEINFO-makeinfo}"
 texindex="${TEXINDEX-texindex}"
 tex="${TEX-tex}"
 
-# Save this so we can construct a new TEXINPUTS path for each file to be
-# processed.
+# Save this so we can construct a new TEXINPUTS path for each file.
 TEXINPUTS_orig="$TEXINPUTS"
 export TEXINPUTS
 
@@ -86,190 +93,270 @@ export TEXINPUTS
 # It's a good idea to document the full long option name in each case.
 # Long options which take arguments will need a `*' appended to the
 # canonical name to match the value appended after the `=' character.
-while : ; do
-  case $# in 0) break ;; esac
+while :; do
+  test $# -eq 0 && break
+  
   case "$1" in
-    -D | --debug | --d* )
-      debug=t
-      shift
-     ;;
-    -h | --help | --h* )
-      echo "$usage" 1>&2
-      exit 0
-     ;;
-    -v | --version | --v* )
-      echo "texi2dvi version $version" 1>&2
-      exit 0
-     ;;
+    -b | --batch | --b* ) batch=t; shift ;;
+    -c | --clean | --c* ) clean=t; shift ;;
+    -D | --debug | --d* ) debug=t; shift ;;
+    -h | --help | --h* )   echo "$usage"; exit 0 ;;
+    # OK, we should do real option parsing here, but be lazy for now.
+    -t | --texinfo | --t*) shift; textra="$textra $1"; shift ;; 
+    -v | --vers* )
+      echo "$progname (GNU Texinfo 3.12) $version"
+      echo "Copyright (C) 1998 Free Software Foundation, Inc.
+There is NO warranty.  You may redistribute this software
+under the terms of the GNU General Public License.
+For more information about these matters, see the files named COPYING."
+      exit 0 ;;
+    --verb* )            verbose=echo; shift ;;
     -- )     # Stop option processing
       shift
-      break
-     ;;
+      break ;;
     -* )
       case "$1" in
         --*=* ) arg=`echo "$1" | sed -e 's/=.*//'` ;;
         * )     arg="$1" ;;
       esac
       exec 1>&2
-      echo "$progname: unknown or ambiguous option $bq$arg$eq"
-      echo "$progname: Use $bq--help$eq for a list of options."
-      exit 1
-     ;;
-    * )
-      break
-     ;;
+      echo "$progname: Unknown or ambiguous option $bq$arg$eq."
+      echo "$progname: Try $bq--help$eq for more information."
+      exit 1 ;;
+    * ) break ;;
    esac
 done
 
 # See if there are any command line args left (which will be interpreted as
-# filename arguments)
-case $# in
-  0 )
-    exec 1>&2
-    echo "$progname: at least one file name is required as an argument."
-    echo "$progname: Use $bq--help$eq for a description of command syntax."
-    exit 2
-   ;;
-esac
-
-case "$debug" in t ) set -x ;; esac
+# filename arguments).
+if test $# -eq 0; then
+  exec 1>&2
+  echo "$progname: At least one file name is required as an argument."
+  echo "$progname: Try $bq--help$eq for more information."
+  exit 2
+fi
+
+test "$debug" = t && set -x
 
 # Texify files
-for command_line_filename in ${1+"$@"} ; do
-   # Roughly equivalent to `dirname ...`, but more portable
-   directory="`echo ${command_line_filename} | sed 's/\/[^\/]*$//'`"
-   filename_texi="`basename ${command_line_filename}`"
-   # Strip off the last extension part (probably .texinfo or .texi)
-   filename_noext="`echo ${filename_texi} | sed 's/\.[^.]*$//'`"
-
-   # If directory and file are the same, then it's probably because there's
-   # no pathname component.  Set dirname to `.', the current directory.
-   if test "z${directory}" = "z${command_line_filename}" ; then
-      directory="."
-   fi
-
-   # Source file might @include additional texinfo sources.  Put `.' and
-   # directory where source file(s) reside in TEXINPUTS before anything
-   # else.  `.' goes first to ensure that any old .aux, .cps, etc. files in
-   # ${directory} don't get used in preference to fresher files in `.'.
-   TEXINPUTS=".:${directory}:${TEXINPUTS_orig}"
-
-   # "Unset" variables that might have values from previous iterations and
-   # which won't be completely reset later.
-   definite_index_files=""
-
-   # See if file exists here.  If it doesn't we're in trouble since, even
-   # though the user may be able to reenter a valid filename at the tex
-   # prompt (assuming they're attending the terminal), this script won't be
-   # able to find the right index files and so forth.
-   if test ! -r "${command_line_filename}" ; then
-      echo "${progname}: ${command_line_filename}: No such file or permission denied." 1>&2
-      continue;
-   fi
-
-   # Find all files having root filename with a two-letter extension,
-   # determine whether they're really index files, and save them.  Foo.aux
-   # is actually the cross-references file, but we need to keep track of
-   # that too.
-   possible_index_files="`eval echo ${filename_noext}.?? ${filename_noext}.aux`"
-   for this_file in ${possible_index_files} ; do
+for command_line_filename in ${1+"$@"}; do
+  $verbose "Processing $command_line_filename ..."
+
+  # See if file exists.  If it doesn't we're in trouble since, even
+  # though the user may be able to reenter a valid filename at the tex
+  # prompt (assuming they're attending the terminal), this script won't
+  # be able to find the right index files and so forth.
+  if test ! -r "${command_line_filename}"; then
+    echo "$0: Could not read ${command_line_filename}." >&2
+    continue
+  fi
+
+  # Roughly equivalent to `dirname ...`, but more portable
+  directory="`echo ${command_line_filename} | sed 's/\/[^\/]*$//'`"
+  filename_texi="`basename ${command_line_filename}`"
+  # Strip off the last extension part (probably .texinfo or .texi)
+  filename_noext="`echo ${filename_texi} | sed 's/\.[^.]*$//'`"
+
+  # Use same basename since we want to generate aux files with the same
+  # basename as the manual.  Use extension .texi for the temp file so
+  # that TeX will ignore it.  Thus, we must use a subdirectory.
+  #
+  # Output the macro-expanded file to here.  The vastly abbreviated
+  # temporary directory name is so we don't have collisions on 8.3 or
+  # 14-character filesystems.
+  tmp_dir=${TMPDIR-/tmp}/txi2d.$$
+  filename_tmp=$tmp_dir/$filename_noext.texi
+  # Output the file with the user's extra commands to here.
+  tmp_dir2=${tmp_dir}.2
+  filename_tmp2=$tmp_dir2/$filename_noext.texi
+  mkdir $tmp_dir $tmp_dir2
+  # Always remove the temporary directories.
+  trap "rm -rf $tmp_dir $tmp_dir2" 1 2 15
+
+  # If directory and file are the same, then it's probably because there's
+  # no pathname component.  Set dirname to `.', the current directory.
+  if test "z${directory}" = "z${command_line_filename}"; then
+    directory=.
+  fi
+
+  # Source file might @include additional texinfo sources.  Put `.' and
+  # directory where source file(s) reside in TEXINPUTS before anything
+  # else.  `.' goes first to ensure that any old .aux, .cps, etc. files in
+  # ${directory} don't get used in preference to fresher files in `.'.
+  TEXINPUTS=".:${directory}:${TEXINPUTS_orig}"
+
+  # Expand macro commands in the original source file using Makeinfo;
+  #   the macro syntax bfox implemented is impossible to implement in TeX.
+  # Always use `end' footnote style, since the `separate' style
+  #   generates different output (arguably this is a bug in -E).
+  # Discard main info output, the user asked to run TeX, not makeinfo.
+  # Redirect output to /dev/null to throw away `Making info file...' msg.
+  $verbose "Macro-expanding $command_line_filename to $filename_tmp ..."
+  $makeinfo --footnote-style=end -E $filename_tmp -o /dev/null \
+    $command_line_filename >/dev/null
+
+  # But if there were no macros, or makeinfo failed for some reason,
+  # just use the original file.  (It shouldn't make any difference, but
+  # let's be safe.)
+  if test $? -ne 0 || cmp -s $filename_tmp $command_line_filename; then
+    $verbose "Reverting to $command_line_filename ..."
+    cp -p $command_line_filename $filename_tmp
+  fi
+  filename_input=$filename_tmp
+  dirname_input=$tmp_dir
+
+  # Used most commonly for @finalout, @smallbook, etc.
+  if test -n "$textra"; then
+    $verbose "Inserting extra commands: $textra."
+    sed '/^@setfilename/a\
+'"$textra" $filename_input >$filename_tmp2
+   filename_input=$filename_tmp2
+   dirname_input=$tmp_dir2
+  fi
+
+  # If clean mode was specified, then move to the temporary directory.
+  if test "$clean" = t; then
+    $verbose "cd $dirname_input"
+    cd $dirname_input || exit 1
+    filename_input=`basename $filename_input`
+  fi
+
+  while true; do # will break out of loop below
+    # "Unset" variables that might have values from previous iterations and
+    # which won't be completely reset later.
+    definite_index_files=
+
+    # Find all files having root filename with a two-letter extension,
+    # determine whether they're really index files, and save them.  Foo.aux
+    # is actually the cross-references file, but we need to keep track of
+    # that too.
+    possible_index_files="`eval echo ${filename_noext}.?? ${filename_noext}.aux`"
+    for this_file in ${possible_index_files}; do
       # If file is empty, forget it.
-      if test ! -s "${this_file}" ; then
-         continue;
-      fi
+      test -s "${this_file}" || continue
 
-      # Examine first character of file.  If it's not a backslash or
-      # single quote, then it's definitely not an index or xref file.
+      # Examine first character of file.  If it's not suitable to be an
+      # index or xref file, don't process it.
       first_character="`sed -n '1s/^\(.\).*$/\1/p;q' ${this_file}`"
-      if test "${first_character}" = "\\" -o "${first_character}" = "'" ; then
-         definite_index_files="${definite_index_files} ${this_file}"
+      if test "x${first_character}" = "x\\" \
+         || test "x${first_character}" = "x'"; then
+        definite_index_files="${definite_index_files} ${this_file}"
       fi
-   done
-   orig_index_files="${definite_index_files}"
-   orig_index_files_sans_aux="`echo ${definite_index_files} \
-                                | sed 's/'${filename_noext}'\.aux//;
-                                       s/^[ ]*//;s/[ ]*$//;'`"
-
-   # Now save copies of original index files so we have some means of
-   # comparison later.
-   for index_file_to_save in ${orig_index_files} ; do
-       cp "${index_file_to_save}" "${index_file_to_save}${backup_extension}"
-   done
-
-   # Run texindex on current index files.  If they already exist, and
-   # after running TeX a first time the index files don't change, then
-   # there's no reason to run TeX again.  But we won't know that if the
-   # index files are out of date or nonexistent.
-   if test "${orig_index_files_sans_aux}" ; then
+    done
+    orig_index_files="${definite_index_files}"
+    orig_index_files_sans_aux="`echo ${definite_index_files} \
+                                 | sed 's/'${filename_noext}'\.aux//;
+                                        s/^[ ]*//;s/[ ]*$//;'`"
+
+    # Now save copies of original index files so we have some means of
+    # comparison later.
+    $verbose "Backing up current index files: $orig_index_files ..."  
+    for index_file_to_save in ${orig_index_files}; do
+      cp "${index_file_to_save}" "${index_file_to_save}${backup_extension}"
+    done
+
+    # Run texindex on current index files.  If they already exist, and
+    # after running TeX a first time the index files don't change, then
+    # there's no reason to run TeX again.  But we won't know that if the
+    # index files are out of date or nonexistent.
+    if test -n "${orig_index_files_sans_aux}"; then
+      $verbose "Running $texindex $orig_index_files_sans_aux ..."
       ${texindex} ${orig_index_files_sans_aux}
-   fi
-
-   if ${tex} ${command_line_filename} ; then           # TeX run first time
-      definite_index_files=""
-      # Get list of new index files
-      possible_index_files="`eval echo ${filename_noext}.?? ${filename_noext}.aux`"
-      for this_file in ${possible_index_files} ; do
-         # If file is empty, forget it.
-         if test ! -s ${this_file} ; then
-            continue;
-         fi
-
-         # Examine first character of file.  If it's not a backslash or
-         # single quote, then it's definitely not an index or xref file.
-         first_character="`sed -n '1s/^\(.\).*$/\1/p;q' ${this_file}`"
-         if test "${first_character}" = "\\" -o "${first_character}" = "'" ; then
-            definite_index_files="${definite_index_files} ${this_file}"
-         fi
+    fi
+
+    # Finally, run TeX.
+    if test "$batch" = t; then
+      tex_mode='\nonstopmode'
+    else
+      tex_mode=
+    fi
+    $verbose "Running $tex $filename_input ..."
+    cmd="$tex $tex_mode \\input $filename_input"
+    $cmd
+
+    # Check if index files changed.
+    # 
+    definite_index_files=
+    # Get list of new index files.
+    possible_index_files="`eval echo ${filename_noext}.?? ${filename_noext}.aux`"
+    for this_file in ${possible_index_files}; do
+       # If file is empty, forget it.
+       test -s "${this_file}" || continue
+
+       # Examine first character of file.  If it's not a backslash or
+       # single quote, then it's definitely not an index or xref file.
+       # (Will have to check for @ when we switch to Texinfo syntax in
+       # all these files...)
+       first_character="`sed -n '1s/^\(.\).*$/\1/p;q' ${this_file}`"
+       if test "x${first_character}" = "x\\" \
+          || test "x${first_character}" = "x'"; then
+         definite_index_files="${definite_index_files} ${this_file}"
+       fi
+    done
+    new_index_files="${definite_index_files}"
+    new_index_files_sans_aux="`echo ${definite_index_files} \
+                               | sed 's/'${filename_noext}'\.aux//;
+                                      s/^[ ]*//;s/[ ]*$//;'`"
+
+    # If old and new list don't at least have the same file list, then one
+    # file or another has definitely changed.
+    $verbose "Original index files =$orig_index_files"
+    $verbose "New index files =$new_index_files"
+    if test "z${orig_index_files}" != "z${new_index_files}"; then
+      index_files_changed_p=t
+    else
+      # File list is the same.  We must compare each file until we find a
+      # difference.
+      index_files_changed_p=
+      for this_file in ${new_index_files}; do
+        $verbose "Comparing index file $this_file ..."
+        # cmp -s will return nonzero exit status if files differ.
+        cmp -s "${this_file}" "${this_file}${backup_extension}"
+        if test $? -ne 0; then
+          # We only need to keep comparing until we find *one* that
+          # differs, because we'll have to run texindex & tex no
+          # matter what.
+          index_files_changed_p=t
+          $verbose "Index file $this_file differed:"
+          test $verbose = echo \
+          && diff -c "${this_file}${backup_extension}" "${this_file}"
+          break
+        fi
       done
-      new_index_files="${definite_index_files}"
-      new_index_files_sans_aux="`echo ${definite_index_files} \
-                                  | sed 's/'${filename_noext}'\.aux//;
-                                         s/^[ ]*//;s/[ ]*$//;'`"
-
-      # If old and new list don't at least have the same file list, then one
-      # file or another has definitely changed.
-      if test "${orig_index_files}" != "${new_index_files}" ; then
-         index_files_changed_p=t
-      else
-         # File list is the same.  We must compare each file until we find a
-         # difference.
-         index_files_changed_p=""
-         for this_file in ${new_index_files} ; do
-            # cmp -s will return nonzero exit status if files differ.
-            cmp -s "${this_file}" "${this_file}${backup_extension}"
-            if test $? -ne 0  ; then
-               # We only need to keep comparing until we find *one* that
-               # differs, because we'll have to run texindex & tex no
-               # matter what.
-               index_files_changed_p=t
-               break
-            fi
-         done
-      fi
+    fi
 
-      # If index files have changed since TeX has been run, or if the aux
-      # file wasn't present originally, run texindex and TeX again.
-      if test "${index_files_changed_p}"  ; then
-         retval=0
-         if test "${new_index_files_sans_aux}" ; then
-            ${texindex} ${new_index_files_sans_aux}
-            retval=$?
-         fi
-         if test ${retval} -eq 0 ; then
-            ${tex} "${command_line_filename}"
-         fi
-      fi
-   fi
-
-   # Generate list of files to delete, then call rm once with the entire
-   # list.  This is significantly faster than multiple executions of rm.
-   file_list=""
-   for file in ${orig_index_files} ; do
-       file_list="${file_list} ${file}${backup_extension}"
-   done
-   if test "${file_list}" ; then
-      rm -f ${file_list}
-   fi
+    # If index files have changed since TeX has been run, or if the aux
+    # file wasn't present originally, run texindex and TeX again.
+    if test "${index_files_changed_p}"; then :; else
+      # Nothing changed.  We're done with TeX.
+      break
+    fi
+  done
+
+  # If we were in clean mode, compilation was in a tmp directory.
+  # Copy the DVI file into the directory where the compilation
+  # has been done.  (The temp dir is about to get removed anyway.)
+  # We also return to the original directory so that
+  # - the next file is processed in correct conditions
+  # - the temporary file can be removed
+  if test -n "$clean"; then
+    $verbose "Copying DVI file from `pwd` to $orig_pwd"
+    cp -p $filename_noext.dvi $orig_pwd
+    cd $orig_pwd || exit 1
+  fi
+
+  # Generate list of files to delete, then call rm once with the entire
+  # list.  This is significantly faster than multiple executions of rm.
+  file_list=
+  for file in ${orig_index_files}; do
+    file_list="${file_list} ${file}${backup_extension}"
+  done
+  if test -n "${file_list}"; then
+    $verbose "Removing $file_list $tmp_dir $tmp_dir2 ..."
+    rm -f ${file_list}
+    rm -rf $tmp_dir $tmp_dir2
+  fi
 done
 
-# texi2dvi ends here
+$verbose "$0 done."
+true # exit successfully.
index cc7517854939cfd35f451a0aebc8bf3d08229262..4beec01b341f0898f1e97725dd1cbd02c83da1a4 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/local/bin/perl
 'di ';
 'ig 00 ';
 #+##############################################################################
@@ -9,7 +9,7 @@
 #                                                                              #
 #-##############################################################################
 
-# @(#)texi2html        1.51 09/10/96   Written (mainly) by Lionel Cons, Lionel.Cons@cern.ch
+# @(#)texi2html        1.52 01/05/98   Written (mainly) by Lionel Cons, Lionel.Cons@cern.ch
 
 # The man page for this program is included at the end of this file and can be
 # viewed using the command 'nroff -man texi2html'.
@@ -29,7 +29,7 @@ $DEBUG_DEF   = 16;
 $DEBUG_HTML  = 32;
 $DEBUG_USER  = 64;
 
-$BIBRE = '\[[\w\/]+\]';                        # RE for a bibliography reference
+$BIBRE = '\[[\w\/-]+\]';               # RE for a bibliography reference
 $FILERE = '[\/\w.+-]+';                        # RE for a file name
 $VARRE = '[^\s\{\}]+';                 # RE for a variable name
 $NODERE = '[^@{}:\'`",]+';             # RE for a node name
@@ -37,8 +37,8 @@ $NODESRE = '[^@{}:\'`"]+';            # RE for a list of node names
 $XREFRE = '[^@{}]+';                   # RE for a xref (should use NODERE)
 
 $ERROR = "***";                                # prefix for errors and warnings
-$THISPROG = "texi2html 1.51";                  # program name and version
-$HOMEPAGE = "http://wwwcn.cern.ch/dci/texi2html/"; # program home page
+$THISPROG = "texi2html 1.52";                  # program name and version
+$HOMEPAGE = "http://wwwinfo.cern.ch/dis/texi2html/"; # program home page
 $TODAY = &pretty_date;                 # like "20 September 1993"
 $SPLITTAG = "<!-- SPLIT HERE -->\n";   # tag to know where to split
 $PROTECTTAG = "_ThisIsProtected_";     # tag to recognize protected sections
@@ -129,6 +129,7 @@ $html2_doctype = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Strict Level 2//E
               "!", "!",
               "?", "?",
               ".", ".",
+              "-", "",
               );
 
 #
@@ -159,19 +160,23 @@ $html2_doctype = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Strict Level 2//E
              'cite', 'CITE',
              'code', 'CODE',
              'ctrl', '&do_ctrl',       # special case
-             'dfn', 'STRONG',          # DFN tag is illegal in the standard
+             'dfn', 'EM',              # DFN tag is illegal in the standard
              'dmn', '',                # useless
+             'email', '&do_email',     # insert a clickable email address
              'emph', 'EM',
              'file', '"TT',            # will put quotes, cf. &apply_style
              'i', 'I',
              'kbd', 'KBD',
              'key', 'KBD',
+             'math', 'EM',
              'r', '',                  # unsupported
              'samp', '"SAMP',          # will put quotes, cf. &apply_style
              'sc', '&do_sc',           # special case
              'strong', 'STRONG',
              't', 'TT',
              'titlefont', '',          # useless
+             'uref', '&do_uref',       # insert a clickable URL
+             'url', '&do_url',         # insert a clickable URL
              'var', 'VAR',
              'w', '',                  # unsupported
              );
@@ -270,6 +275,7 @@ $html2_doctype = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Strict Level 2//E
            'smallbook', 1,
            'vskip', 1,
            'filbreak', 1,
+           'paragraphindent', 1,
            # unsupported formats
            'cartouche', 1,
            'end cartouche', 1,
@@ -283,6 +289,8 @@ $html2_doctype = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Strict Level 2//E
 #                                                                              #
 #---############################################################################
 
+%value = ();                           # hold texinfo variables, see also -D
+
 $use_bibliography = 1;
 $use_acc = 0;
 $debug = 0;
@@ -306,6 +314,7 @@ To convert a Texinfo file to HMTL: $0 [options] file
     -expandinfo    : use \@ifinfo sections, not \@iftex
     -glossary      : handle a glossary
     -invisible name: use 'name' as an invisible anchor
+    -Dname         : define name like with \@set
     -I dir         : search also for files in 'dir'
     -menu          : handle menus
     -monolithic    : output only one file including ToC
@@ -317,7 +326,7 @@ To convert a Texinfo file to HMTL: $0 [options] file
 To check converted files: $0 -check [-verbose] files
 EOT
 
-while ($#ARGV >= 0 && $ARGV[0] =~ /^-/) {
+while (@ARGV && $ARGV[0] =~ /^-/) {
     $_ = shift(@ARGV);
     if (/^-acc$/)            { $use_acc = 1; next; }
     if (/^-d(ebug)?(\d+)?$/) { $debug = $2 || shift(@ARGV); next; }
@@ -327,6 +336,7 @@ while ($#ARGV >= 0 && $ARGV[0] =~ /^-/) {
     if (/^-g(lossary)?$/)    { $use_glossary = 1; next; }
     if (/^-i(nvisible)?$/)   { $invisible_mark = shift(@ARGV); next; }
     if (/^-iso$/)            { $use_iso = 1; next; }
+    if (/^-D(.+)?$/)         { $value{$1 || shift(@ARGV)} = 1; next; }
     if (/^-I(.+)?$/)         { push(@include_dirs, $1 || shift(@ARGV)); next; }
     if (/^-m(enu)?$/)        { $show_menu = 1; next; }
     if (/^-mono(lithic)?$/)  { $monolithic = 1; next; }
@@ -383,9 +393,8 @@ if ($monolithic) {
 #
 # variables
 #
-%value = ();                           # hold texinfo variables
 $value{'html'} = 1;                    # predefine html (the output format)
-$value{'texi2html'} = '1.51';          # predefine texi2html (the translator)
+$value{'texi2html'} = '1.52';          # predefine texi2html (the translator)
 # _foo: internal to track @foo
 foreach ('_author', '_title', '_subtitle',
         '_settitle', '_setfilename') {
@@ -453,7 +462,7 @@ $toplevel = 0;                              # top level seen in hierarchy
 $curlevel = 0;                         # current level in TOC
 $node = '';                            # current node name
 $in_table = 0;                         # am I inside a table
-$table_type = '';                      # type of table ('', 'f', 'v')
+$table_type = '';                      # type of table ('', 'f', 'v', 'multi')
 @tables = ();                          # nested table support
 $in_bibliography = 0;                  # am I inside a bibliography
 $in_glossary = 0;                      # am I inside a glossary
@@ -554,9 +563,11 @@ while ($_ = &next_line) {
     #
     s/((^|[^\@])(\@\@)*)\@c(omment)? .*/$1/;
     # non-@ substitutions cf. texinfmt.el
-    s/``/\"/g;
-    s/''/\"/g;
-    s/([\w ])---([\w ])/$1--$2/g;
+    unless ($in_pre) {
+       s/``/\"/g;
+       s/''/\"/g;
+       s/([\w ])---([\w ])/$1--$2/g;
+    }
     #
     # analyze the tag
     #
@@ -570,14 +581,9 @@ while ($_ = &next_line) {
        }
        &skip_until($tag), next if $tag eq 'tex';
        # handle special tables
-       if ($tag eq 'table') {
-           $table_type = '';
-       } elsif ($tag eq 'ftable') {
+       if ($tag =~ /^(|f|v|multi)table$/) {
+           $table_type = $1;
            $tag = 'table';
-           $table_type = 'f';
-       } elsif ($tag eq 'vtable') {
-           $tag = 'table';
-           $table_type = 'v';
        }
        # special cases
        if ($tag eq 'top' || ($tag eq 'node' && /^\@node\s+top\s*,/i)) {
@@ -647,11 +653,16 @@ while ($_ = &next_line) {
            push(@lines, &debug("<$format_map{$tag}>\n", __LINE__));
            next;
        } elsif ($tag eq 'table') {
-           if (/^\@[fv]?table\s+\@(\w+)\s*$/) {
-               $in_table = $1;
+           if (/^\@(|f|v|multi)table\s+\@(\w+)/) {
+               $in_table = $2;
                unshift(@tables, join($;, $table_type, $in_table));
-               push(@lines, &debug("<DL COMPACT>\n", __LINE__));
-               &html_push_if('DL');
+               if ($table_type eq "multi") {
+                   push(@lines, &debug("<TABLE BORDER>\n", __LINE__));
+                   &html_push_if('TABLE');
+               } else {
+                   push(@lines, &debug("<DL COMPACT>\n", __LINE__));
+                   &html_push_if('DL');
+               }
                push(@lines, &html_debug("\n", __LINE__));
            } else {
                warn "$ERROR Bad table line: $_";
@@ -776,18 +787,29 @@ while ($_ = &next_line) {
            &html_pop_if();
            push(@lines, &debug("</$format_map{$end_tag}>\n", __LINE__));
            push(@lines, &html_debug("\n", __LINE__));
-       } elsif ($end_tag eq 'table' ||
-                $end_tag eq 'ftable' ||
-                $end_tag eq 'vtable') {
-           shift(@tables);
+       } elsif ($end_tag =~ /^(|f|v|multi)table$/) {
+           unless (@tables) {
+               warn "$ERROR \@end $end_tag without \@*table\n";
+               next;
+           }
+           ($table_type, $in_table) = split($;, shift(@tables));
+           unless ($1 eq $table_type) {
+               warn "$ERROR \@end $end_tag without matching \@$end_tag\n";
+               next;
+           }
+           if ($table_type eq "multi") {
+               push(@lines, "</TR></TABLE>\n");
+               &html_pop_if('TR');
+           } else {
+               push(@lines, "</DL>\n");
+               &html_pop_if('DD');
+           }
+           &html_pop_if();
            if (@tables) {
                ($table_type, $in_table) = split($;, $tables[0]);
            } else {
                $in_table = 0;
            }
-           push(@lines, "</DL>\n");
-           &html_pop_if('DD');
-           &html_pop_if();
        } elsif (defined($def_map{$end_tag})) {
            push(@lines, &debug("</DL>\n", __LINE__));
        } elsif ($end_tag eq 'menu') {
@@ -986,6 +1008,12 @@ EOC
                    if ($table_type) { # add also an index
                        unshift(@input_spool, "\@${table_type}index $what\n");
                    }
+               } elsif ($html_element eq 'TABLE') {
+                   push(@lines, &debug("<TR><TD>$what</TD>\n", __LINE__));
+                   &html_push('TR');
+               } elsif ($html_element eq 'TR') {
+                   push(@lines, &debug("</TR>\n", __LINE__));
+                   push(@lines, &debug("<TR><TD>$what</TD>\n", __LINE__));
                } else {
                    push(@lines, &debug("<LI>$what\n", __LINE__));
                    &html_push('LI') unless $html_element eq 'LI';
@@ -996,6 +1024,9 @@ EOC
                    $deferred_ref = '';
                }
                next;
+           } elsif (/^\@tab\s+(.*)$/) {
+               push(@lines, "<TD>$1</TD>\n");
+               next;
            }
        }
     }
@@ -1088,13 +1119,25 @@ while (@lines) {
            print "# index $key sorted as $_\n"
                if $key ne $_ && $debug & $DEBUG_INDEX;
        }
+       push(@lines2, "Jump to:\n");
+       $last_letter = undef;
+       foreach $key (sort byalpha @keys) {
+           $letter = substr($key2alpha{$key}, 0, 1);
+           $letter = substr($key2alpha{$key}, 0, 2) if $letter eq $;;
+           if (!defined($last_letter) || $letter ne $last_letter) {
+               push(@lines2, "-\n") if defined($last_letter);
+               push(@lines2, "<A HREF=\"#$index\_$letter\">" . &protect_html($letter) . "</A>\n");
+               $last_letter = $letter;
+           }
+       }
+       push(@lines2, "<P>\n");
        $last_letter = undef;
        foreach $key (sort byalpha @keys) {
            $letter = substr($key2alpha{$key}, 0, 1);
            $letter = substr($key2alpha{$key}, 0, 2) if $letter eq $;;
            if (!defined($last_letter) || $letter ne $last_letter) {
                push(@lines2, "</DIR>\n") if defined($last_letter);
-               push(@lines2, "<H2>" . &protect_html($letter) . "</H2>\n");
+               push(@lines2, "<H2><A NAME=\"$index\_$letter\">" . &protect_html($letter) . "</A></H2>\n");
                push(@lines2, "<DIR>\n");
                $last_letter = $letter;
            }
@@ -1657,8 +1700,24 @@ sub menu_entry {
 
 sub do_ctrl { "^$_[0]" }
 
+sub do_email {
+    local($addr, $text) = split(/,\s*/, $_[0]);
+
+    $text = $addr unless $text;
+    &anchor('', "mailto:$addr", $text);
+}
+
 sub do_sc { "\U$_[0]\E" }
 
+sub do_uref {
+    local($url, $text) = split(/,\s*/, $_[0]);
+
+    $text = $url unless $text;
+    &anchor('', $url, $text);
+}
+
+sub do_url { &anchor('', $_[0], $_[0]) }
+
 sub apply_style {
     local($texi_style, $text) = @_;
     local($style);
@@ -1822,7 +1881,7 @@ sub print_toplevel_footer {
     print FILE <<EOT;
 This document was generated on $TODAY using the
 <A HREF=\"$HOMEPAGE\">texi2html</A>
-translator version 1.51.</P>
+translator version 1.52.</P>
 EOT
     &print_footer;
 }
@@ -1879,7 +1938,7 @@ sub byalpha {
 .nr nl 0-1             \" fake up transition to first page again
 .nr % 0                        \" start at page 1
 '; __END__ ############# From here on it's a standard manual page ############
-.TH TEXI2HTML 1 "09/10/96"
+.TH TEXI2HTML 1 "01/05/98"
 .AT 3
 .SH NAME
 texi2html \- a Texinfo to HTML converter
@@ -1924,8 +1983,9 @@ Use the section named 'Glossary' to build a list of terms and put links in the H
 document from each term toward its definition.
 .TP
 .B \-invisible \fIname\fP
-Use \fIname\fP to create invisible destination anchors for index links. This is a workaround
-for a known bug of many WWW browsers, including xmosaic.
+Use \fIname\fP to create invisible destination anchors for index links
+(you can for instance use the invisible.xbm file shipped with this program).
+This is a workaround for a known bug of many WWW browsers, including netscape.
 .TP
 .B \-I \fIdir\fP
 Look also in \fIdir\fP to find included files.
@@ -1985,21 +2045,21 @@ option, it creates only one file:
 predefines the following variables: \fBhtml\fP, \fBtexi2html\fP.
 .SH ADDITIONAL COMMANDS
 .I texi2html
-implements the following non-Texinfo commands:
+implements the following non-Texinfo commands (maybe they are in Texinfo now...):
 .TP 16
 .B @ifhtml
 This indicates the start of an HTML section, this section will passed through
-without any modofication.
+without any modification.
 .TP
 .B @end ifhtml
-This indcates the end of an HTML section.
+This indicates the end of an HTML section.
 .SH VERSION
-This is \fItexi2html\fP version 1.51, 09/10/96.
+This is \fItexi2html\fP version 1.52, 01/05/98.
 .PP
 The latest version of \fItexi2html\fP can be found in WWW, cf. URL
-http://wwwcn.cern.ch/dci/texi2html/
+http://wwwinfo.cern.ch/dis/texi2html/
 .SH AUTHOR
-The main author is Lionel Cons, CERN CN/DCI/UWS, Lionel.Cons@cern.ch.
+The main author is Lionel Cons, CERN IT/DIS/OSE, Lionel.Cons@cern.ch.
 Many other people around the net contributed to this program.
 .SH COPYRIGHT
 This program is the intellectual property of the European
diff --git a/test.c b/test.c
index c1dcdb78d69715ce19684e5f80d62cebaeb763e2..93e442635ebd11a2e2f7e4fc46ba1019b9c8e82c 100644 (file)
--- a/test.c
+++ b/test.c
@@ -98,6 +98,8 @@ extern int errno;
 #define FALSE 0
 #define SHELL_BOOLEAN(value) (!(value))
 
+#define TEST_ERREXIT_STATUS    2
+
 static procenv_t test_exit_buf;
 static int test_error_return;
 #define test_exit(val) \
@@ -142,7 +144,7 @@ test_syntax_error (format, arg)
   fprintf (stderr, format, arg);
   fprintf (stderr, "\n");
   fflush (stderr);
-  test_exit (SHELL_BOOLEAN (FALSE));
+  test_exit (TEST_ERREXIT_STATUS);
 }
 
 /*
diff --git a/tests/cprint.right b/tests/cprint.right
new file mode 100644 (file)
index 0000000..6b711b8
--- /dev/null
@@ -0,0 +1,72 @@
+tf is a function
+tf () 
+{ 
+    echo this is ${0##*/} >/dev/null;
+    echo a | cat - >/dev/null;
+    test -f ${0##*/} && echo ${0##*/} is a regular file;
+    test -d ${0##*/} || echo ${0##*/} is not a directory;
+    echo a;
+    echo b;
+    echo c;
+    echo background >/dev/null & ( exit 1 );
+    echo $?;
+    { 
+        echo a
+    };
+    i=0;
+    while (( " i < 3 " )); do
+        test -r /dev/fd/$i;
+        i=$(( i + 1 ));
+    done;
+    [[ -r /dev/fd/0 && -w /dev/fd/1 ]] || echo oops >/dev/null;
+    for name in $( echo 1 2 3 );
+    do
+        test -r /dev/fd/$name;
+    done;
+    if [[ -r /dev/fd/0 && -w /dev/fd/1 ]]; then
+        echo ok >/dev/null;
+    else
+        if (( " 7 > 40 " )); then
+            echo oops;
+        else
+            echo done;
+        fi;
+    fi >/dev/null;
+    case $PATH in 
+        *$PWD*)
+            echo \$PWD in \$PATH
+        ;;
+        *)
+            echo \$PWD not in \$PATH
+        ;;
+    esac >/dev/null;
+    while false; do
+        echo z;
+    done >/dev/null;
+    until true; do
+        echo z;
+    done >/dev/null;
+    echo \&\|'()' \{ echo abcde \; \};
+    eval fu\%nc'()' \{ echo abcde \; \};
+    type fu\%nc
+}
+tf2 is a function
+tf2 () 
+{ 
+    ( { 
+        time -p echo a | cat - >/dev/null
+    } ) 2>&1
+}
+cprint.tests is a regular file
+cprint.tests is not a directory
+a
+b
+c
+1
+a
+&|() { echo abcde ; }
+fu%nc is a function
+fu%nc () 
+{ 
+    echo abcde
+}
diff --git a/tests/cprint.tests b/tests/cprint.tests
new file mode 100644 (file)
index 0000000..08ff1eb
--- /dev/null
@@ -0,0 +1,67 @@
+#
+# a nonsense script and shell function to test out the command printing code
+#
+tf()
+{
+       # simple command with redir
+       echo this is ${0##*/} > /dev/null
+
+       # pipeline
+       echo a | cat - > /dev/null
+
+       test -f ${0##*/} && echo ${0##*/} is a regular file
+       test -d ${0##*/} || echo ${0##*/} is not a directory
+
+       echo a ; echo b ; echo c
+
+       echo background >/dev/null &
+
+       ( exit 1 )
+       echo $?
+
+       { echo a ; }
+
+       i=0
+       while (( i < 3 )); do
+               test -r /dev/fd/$i
+               i=$(( i + 1 ))
+       done
+
+       [[ -r /dev/fd/0 && -w /dev/fd/1 ]] || echo oops > /dev/null
+
+       for name in $( echo 1 2 3 ); do
+               test -r /dev/fd/$name
+       done
+
+       if [[ -r /dev/fd/0 && -w /dev/fd/1 ]] ; then
+               echo ok > /dev/null
+       elif (( 7 > 40 )) ; then
+               echo oops
+       else
+               echo done
+       fi > /dev/null
+
+       case $PATH in
+       *$PWD*) echo \$PWD in \$PATH ;;
+       *)      echo \$PWD not in \$PATH ;;
+       esac > /dev/null
+
+       while false; do echo z; done > /dev/null
+
+       until true; do echo z ; done > /dev/null
+
+       echo \&\|'()' \{ echo abcde \; \}
+       # when not in POSIX mode, we can have weirdly-named functions
+       eval fu\%nc'()' \{ echo abcde \; \}
+       type fu\%nc
+}
+
+tf2()
+{
+       ( { time -p echo a | cat - > /dev/null ; } ) 2>&1
+}
+
+type tf
+type tf2
+
+tf
index 190f5ad26eebb97759dafae001ec836af62089c4..c205a4f15778ae30e98d301a87019e2a421de596 100644 (file)
@@ -57,3 +57,22 @@ yes
 5: ef
 6: ef
 7: abcdef
+ab abef
+abcfef abef
+abcdef
+ab abcdef abcfef abef
+abcdef abcfef abef
+ok 37
+ok 38
+ok 39
+ok 40
+ok 41
+a b a,b a-b a.b a:b a;b a_b
+a b a,b a-b a.b a:b a;b a_b
+a b a,b a-b a.b a:b a;b a_b
+a b a,b a-b a.b a:b a;b a_b
+a.b
+a b a,b a-b a:b a;b a_b
+a b a,b a-b a.b a:b a;b a_b
+a b a,b a-b a.b a:b a;b a_b
+a b a,b a-b a.b a:b a;b a_b
index 4747eb5cb263f7a98de5aa4e1c866330fca3e27e..a815bab39aad58967145b14e26215c25a83fd01b 100644 (file)
@@ -274,7 +274,74 @@ echo 6: "${x#*(a|b)cd}"
 expect '7: abcdef'
 echo 7: ${x#"*(a|b)cd"}
 
-# clean up and exit
+# More tests derived from a bug report concerning extended glob patterns
+# following a *
+builtin cd $TESTDIR || { echo $0: cannot cd to $TESTDIR >&2 ; exit 1; }
+rm -rf *
+
+touch ab abcdef abef abcfef
+
+expect 'ab abef'
+echo ab*(e|f)
+
+expect 'abcfef abef'
+echo ab?*(e|f)
+
+expect abcdef
+echo ab*d+(e|f)
+
+expect 'ab abcdef abcfef abef'
+echo ab**(e|f)
+
+expect 'abcdef abcfef abef'
+echo ab*+(e|f)
+
+case 'abcfefg' in
+ab**(e|f))     echo ok 37;;
+*)             echo bad 37;;
+esac
+
+case 'abcfefg' in
+ab**(e|f)g)    echo ok 38;;
+*a)            echo bad 38;;
+esac
+
+case ab in
+ab*+(e|f))     echo bad 39;;
+*)             echo ok 39;;
+esac
+
+case abef in
+ab***ef)       echo ok 40;;
+*)             echo bad 40;;
+esac
+
+case abef in
+ab**)          echo ok 41;;
+*)             echo bad 41;;
+esac
+
+# clean up and do the next one
+
+builtin cd /
+rm -rf $TESTDIR
+
+mkdir $TESTDIR
+builtin cd $TESTDIR
+
+touch a.b a,b a:b a-b a\;b a\ b a_b
+
+echo a[^[:alnum:]]b
+echo a[-.,:\;\ _]b
+
+echo a@([^[:alnum:]])b
+echo a@([-.,:; _])b
+echo a@([.])b
+echo a@([^.])b
+echo a@([^x])b
+echo a+([^[:alnum:]])b
+
+echo a@(.|[^[:alnum:]])b
 
 builtin cd /
 rm -rf $TESTDIR
index 63e44dfc099012b39cd523a421a1c8d8f0eee540..e57ce2adbf7e903128a7cc3073496eaf8a059754 100644 (file)
@@ -192,3 +192,13 @@ argv[1] = <0>
 ./more-exp.tests: ${#1xyz}: bad substitution
 ./more-exp.tests: #: %: syntax error: operand expected (error token is "%")
 argv[1] = <0>
+argv[1] = <a+b>
+argv[1] = <+>
+argv[1] = <+>
+argv[1] = <+>
+argv[1] = <G { I >
+argv[2] = <K>
+argv[3] = <}>
+argv[1] = <hi>
+argv[2] = <K>
+argv[3] = <}>
index d01d96864b213baa2271f783dc13c7884f6afca9..d3f4b6f209c3e02ee0faa55449fc96ff9e43b513 100644 (file)
@@ -434,3 +434,29 @@ recho ${#:%}
 
 expect '<0>'
 recho ${#:-}
+
+set --
+unset a b
+
+x=a
+y=b
+
+IFS=+
+
+expect '<a+b>'
+recho $x+$y
+expect '<+>'
+recho $a+$b
+
+expect '<+>'
+recho + "$@"
+expect '<+>'
+recho +"$@"
+
+expect '<G { I>' '<K>' '<}>'
+recho ${gik:-G { I } K }
+
+abc=hi
+
+expect '<hi>' '<K>' '<}>'
+recho ${abc:-G { I } K }
index 0e6ab14c080cd1655e1bb8666164984447b16bb5..ac1bce4581a2824ee9c323607e7cd04a3d542b7a 100644 (file)
Binary files a/tests/printf.right and b/tests/printf.right differ
index d21eb4e7c120fe4e5f85b0f2bc4758b0b7979c0d..9b47d9e85b897d61bfa723bc53978c517ae5ba5a 100644 (file)
@@ -83,6 +83,11 @@ printf -- "--%b--\n"
 # of the format string
 printf -- "--%b--\n" '4.2\c5.4\n'; printf "\n"
 
+# make sure extra arguments are ignored if the format string doesn't
+# actually use them
+printf "\n" 4.4 BSD
+printf " " 4.4 BSD ; printf "\n"
+
 # make sure that a fieldwidth and precision of `*' are handled right
 printf "%10.8s\n" 4.4BSD
 printf "%*.*s\n" 10 8 4.4BSD
diff --git a/tests/run-cprint b/tests/run-cprint
new file mode 100644 (file)
index 0000000..5f202e4
--- /dev/null
@@ -0,0 +1,2 @@
+${THIS_SH} ./cprint.tests > /tmp/xx 2>&1
+diff /tmp/xx cprint.right && rm -f /tmp/xx
index 10361bcee063ee1ffed017f7abc4ff1c83fd3e32..4555c626769647503094e9110c54843e36e0c5f6 100644 (file)
@@ -1,2 +1,5 @@
+# See whether or not we can use `diff -a'
+( diff -a ./printf.tests ./printf.tests >/dev/null 2>&1 ) && AFLAG=-a
+
 ${THIS_SH} ./printf.tests > /tmp/xx 2>&1
-diff /tmp/xx printf.right && rm -f /tmp/xx
+diff $AFLAG /tmp/xx printf.right && rm -f /tmp/xx
index 845ee9017d5b3080926bdc7ca76d302217729384..9dc01fbc5339e31b79a2b88110b77d64b1b9b473 100644 (file)
@@ -21,6 +21,7 @@ shopt -u mailwarn
 shopt -u nocaseglob
 shopt -u nullglob
 shopt -s promptvars
+shopt -u restricted_shell
 shopt -u shift_verbose
 shopt -s sourcepath
 --
@@ -50,6 +51,7 @@ shopt -u lithist
 shopt -u mailwarn
 shopt -u nocaseglob
 shopt -u nullglob
+shopt -u restricted_shell
 shopt -u shift_verbose
 --
 cdable_vars            off
@@ -66,6 +68,7 @@ lithist               off
 mailwarn               off
 nocaseglob             off
 nullglob               off
+restricted_shell       off
 shift_verbose          off
 --
 set +o allexport
index e534c17b24f4a3b1567846f51c670d64f8586728..8684a1212d0107d2e03376d22602322d18277418 100644 (file)
@@ -222,45 +222,45 @@ t -h /tmp/test.symlink
 0
 t 4+3 -eq 7
 ./test-tests: test: 4+3: integer expression expected
-1
+2
 b 4-5 -eq 7
 ./test-tests: [: 4+3: integer expression expected
-1
+2
 t 9 -eq 4+5
 ./test-tests: test: 4+5: integer expression expected
-1
+2
 b 9 -eq 4+5
 ./test-tests: [: 4+5: integer expression expected
-1
+2
 t A -eq 7
 ./test-tests: test: A: integer expression expected
-1
+2
 b A -eq 7
 ./test-tests: [: A: integer expression expected
-1
+2
 t 9 -eq B
 ./test-tests: test: B: integer expression expected
-1
+2
 b 9 -eq B
 ./test-tests: [: B: integer expression expected
-1
+2
 t ( 1 = 2
 ./test-tests: test: `)' expected
-1
+2
 b ( 1 = 2
 ./test-tests: [: `)' expected, found ]
-1
+2
 ./test-tests: test: a: unary operator expected
-1
+2
 ./test-tests: test: b: binary operator expected
-1
+2
 ./test-tests: test: -A: unary operator expected
-1
+2
 ./test-tests: test: too many arguments
-1
+2
 ./test-tests: test: too many arguments
-1
+2
 ./test-tests: [: missing `]'
-1
+2
 ./test-tests: test: (: unary operator expected
-1
+2
index fe2c196e98a14ee3cdbf2caade19f55b7cdb9957..89b6f53636f319c6d2722bc0dd1fddb496ad9130 100644 (file)
@@ -1,4 +1,4 @@
-./type.tests: type: unknown option: f
+./type.tests: type: illegal option: -f
 type: usage: type [-apt] name [name ...]
 ./type.tests: type: notthere: not found
 ./type.tests: command: notthere: not found
diff --git a/trap.c b/trap.c
index ae58b44f5f67ae0d68b59a00dcd71cead8012175..7e27f185c2b9dca4620ec3edf4b6ce9af5a74b0c 100644 (file)
--- a/trap.c
+++ b/trap.c
@@ -116,6 +116,11 @@ initialize_traps ()
   set_signal_handler (SIGINT, original_signals[SIGINT]);
   sigmodes[SIGINT] |= SIG_SPECIAL;
 
+#if defined (__BEOS__)
+  /* BeOS sets SIGINT to SIG_IGN! */
+  original_signals[SIGINT] = SIG_DFL;
+#endif
+
   original_signals[SIGQUIT] =
     (SigHandler *) set_signal_handler (SIGQUIT, SIG_DFL);
   set_signal_handler (SIGQUIT, original_signals[SIGQUIT]);
@@ -159,10 +164,14 @@ decode_signal (string)
 
   /* A leading `SIG' may be omitted. */
   for (sig = 0; sig <= NSIG; sig++)
-    if (strcasecmp (string, signal_names[sig]) == 0 ||
-       (STREQN (signal_names[sig], "SIG", 3) &&
-         strcasecmp (string, &(signal_names[sig])[3]) == 0))
-      return ((int)sig);
+    {
+      if (signal_names[sig] == 0 || signal_names[sig][0] == '\0')
+       continue;
+      if (strcasecmp (string, signal_names[sig]) == 0 ||
+         (STREQN (signal_names[sig], "SIG", 3) &&
+           strcasecmp (string, &(signal_names[sig])[3]) == 0))
+       return ((int)sig);
+    }
 
   return (NO_SIG);
 }
index b72fc4f8428b409b74728abca74858cdc40abed8..8f4bb420fd56a5111ca9882a1545d5d5c0034474 100644 (file)
@@ -249,6 +249,12 @@ initialize_shell_variables (env, privmode)
        }
     }
 
+  /* According to the Single Unix Specification, v2, $OLDPWD is an
+     `environment variable' and therefore should be auto-exported.
+     Make a dummy invisible variable for OLDPWD, and mark it as exported. */
+  temp_var = bind_variable ("OLDPWD", (char *)NULL);
+  temp_var->attributes |= (att_exported | att_invisible);
+
   /* Set up initial value of $_ */
   temp_var = bind_variable ("_", dollar_vars[0]);
 
@@ -276,7 +282,13 @@ initialize_shell_variables (env, privmode)
   /* set up the prompts. */
   if (interactive_shell)
     {
+#if defined (PROMPT_STRING_DECODE)
       set_if_not ("PS1", primary_prompt);
+#else
+      if (current_user.uid == -1)
+       get_current_user_info ();
+      set_if_not ("PS1", current_user.euid == 0 ? "# " : primary_prompt);
+#endif
       set_if_not ("PS2", secondary_prompt);
     }
   set_if_not ("PS4", "+ ");
@@ -304,14 +316,7 @@ initialize_shell_variables (env, privmode)
   /* Do some things with shell level. */
   initialize_shell_level ();
 
-  /* Make a variable $PPID, which holds the pid of the shell's parent.  */
-  name = itos ((int) getppid ());
-  temp_var = find_variable ("PPID");
-  if (temp_var)
-    temp_var->attributes &= ~(att_readonly | att_exported);
-  temp_var = bind_variable ("PPID", name);
-  temp_var->attributes |= (att_readonly | att_integer);
-  free (name);
+  set_ppid ();
 
   /* Initialize the `getopts' stuff. */
   bind_variable ("OPTIND", "1");
@@ -395,6 +400,17 @@ initialize_shell_variables (env, privmode)
 
 /* Set $HOME to the information in the password file if we didn't get
    it from the environment. */
+
+/* This function is not static so the tilde and readline libraries can
+   use it. */
+char *
+get_home_dir ()
+{
+  if (current_user.home_dir == 0)
+    get_current_user_info ();
+  return current_user.home_dir;
+}
+
 static void
 set_home_var ()
 {
@@ -402,11 +418,7 @@ set_home_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 = bind_variable ("HOME", get_home_dir ());
   temp_var->attributes |= att_exported;
 }
 
@@ -552,33 +564,44 @@ initialize_shell_level ()
   adjust_shell_level (1);
 }
 
+/* Make a variable $PPID, which holds the pid of the shell's parent.  */
+void
+set_ppid ()
+{
+  char namebuf[32], *name;
+  SHELL_VAR *temp_var;
+
+  name = inttostr ((int) getppid (), namebuf, sizeof(namebuf));
+  temp_var = find_variable ("PPID");
+  if (temp_var)
+    temp_var->attributes &= ~(att_readonly | att_exported);
+  temp_var = bind_variable ("PPID", name);
+  temp_var->attributes |= (att_readonly | att_integer);
+}
+
 static void
 uidset ()
 {
-  char *buff;
+  char buff[32], *b;
   register SHELL_VAR *v;
 
-  buff = itos (current_user.uid);
+  b = inttostr (current_user.uid, buff, sizeof (buff));
   v = find_variable ("UID");
   if (v)
     v->attributes &= ~att_readonly;
 
-  v = bind_variable ("UID", buff);
+  v = bind_variable ("UID", b);
   v->attributes |= (att_readonly | att_integer);
 
   if (current_user.euid != current_user.uid)
-    {
-      free (buff);
-      buff = itos (current_user.euid);
-    }
+    b = inttostr (current_user.euid, buff, sizeof (buff));
 
   v = find_variable ("EUID");
   if (v)
     v->attributes &= ~att_readonly;
 
-  v = bind_variable ("EUID", buff);
+  v = bind_variable ("EUID", b);
   v->attributes |= (att_readonly | att_integer);
-  free (buff);
 }
 
 #if defined (ARRAY_VARS)
@@ -587,7 +610,7 @@ make_vers_array ()
 {
   SHELL_VAR *vv;
   ARRAY *av;
-  char *s, d[16];
+  char *s, d[32];
 
   makunbound ("BASH_VERSINFO", shell_variables);
 
@@ -599,12 +622,10 @@ make_vers_array ()
     *s++ = '\0';
   array_add_element (av, 0, d);
   array_add_element (av, 1, s);
-  s = itos (patch_level);
+  s = inttostr (patch_level, d, sizeof (d));
   array_add_element (av, 2, s);
-  free (s);
-  s = itos (build_version);
+  s = inttostr (build_version, d, sizeof (d));
   array_add_element (av, 3, s);
-  free (s);
   array_add_element (av, 4, release_status);
   array_add_element (av, 5, MACHTYPE);
 
@@ -618,15 +639,13 @@ void
 set_lines_and_columns (lines, cols)
      int lines, cols;
 {
-  char *val;
+  char val[32], *v;
 
-  val = itos (lines);
-  bind_variable ("LINES", val);
-  free (val);
+  v = inttostr (lines, val, sizeof (val));
+  bind_variable ("LINES", v);
 
-  val = itos (cols);
-  bind_variable ("COLUMNS", val);
-  free (val);
+  v = inttostr (cols, val, sizeof (val));
+  bind_variable ("COLUMNS", v);
 }
 
 /* Set NAME to VALUE if NAME has no value. */
@@ -1171,6 +1190,14 @@ get_string_value (var_name)
     return (var->value);
 }
 
+/* This is present for use by the tilde and readline libraries. */
+char *
+get_env_value (v)
+     char *v;
+{
+  return get_string_value (v);
+}
+
 /* Create a local variable referenced by NAME. */
 SHELL_VAR *
 make_local_variable (name)
@@ -1528,19 +1555,20 @@ assign_array_var_from_string (var, value)
     val = value;
 
   /* Expand the value string into a list of words, performing all the
-     shell expansions including word splitting. */
-#if 1
+     shell expansions including pathname generation and word splitting. */
   /* First we split the string on whitespace, using the shell parser
      (ksh93 seems to do this). */
   list = parse_string_to_word_list (val, "array assign");
   /* Now that we've split it, perform the shell expansions on each
      word in the list. */
+#if 0
   nlist = list ? expand_words_shellexp (list) : (WORD_LIST *)NULL;
-  dispose_words (list);
 #else
-  nlist = expand_string (val, 0);
+  nlist = list ? expand_words_no_vars (list) : (WORD_LIST *)NULL;
 #endif
 
+  dispose_words (list);
+
   if (val != value)
     free (val);
 
@@ -2509,20 +2537,36 @@ maybe_make_export_env ()
     }
 }
 
+/* This is an efficiency hack.  PWD and OLDPWD are auto-exported, so
+   we will need to remake the exported environment every time we
+   change directories.  `_' is always put into the environment for
+   every external command, so without special treatment it will always
+   cause the environment to be remade.
+
+   If there is no other reason to make the exported environment, we can
+   just update the variables in place and mark the exported environment
+   as no longer needing a remake. */
+void
+update_export_env_inplace (env_prefix, preflen, value)
+     char *env_prefix;
+     int preflen;
+     char *value;
+{
+  char *evar;
+
+  evar = xmalloc (STRLEN (value) + preflen + 1);
+  strcpy (evar, env_prefix);
+  if (value)
+    strcpy (evar + preflen, value);
+  export_env = add_or_supercede_exported_var (evar, 0);
+}
+
 /* We always put _ in the environment as the name of this command. */
 void
 put_command_name_into_env (command_name)
      char *command_name;
 {
-  char *dummy;
-
-  dummy = xmalloc (4 + strlen (command_name));
-
-  /* These three statements replace a call to sprintf */
-  dummy[0] = '_';
-  dummy[1] = '=';
-  strcpy (dummy + 2, command_name);
-  export_env = add_or_supercede_exported_var (dummy, 0);
+  update_export_env_inplace ("_=", 2, command_name);
 }
 
 #if 0  /* UNUSED -- it caused too many problems */
@@ -2920,7 +2964,7 @@ set_pipestatus_array (ps)
   SHELL_VAR *v;
   ARRAY *a;
   register int i;
-  char *t;
+  char *t, tbuf[16];
 
   v = find_variable ("PIPESTATUS");
   if (v == 0)
@@ -2932,9 +2976,8 @@ set_pipestatus_array (ps)
     empty_array (a);
   for (i = 0; ps[i] != -1; i++)
     {
-      t = itos (ps[i]);
+      t = inttostr (ps[i], tbuf, sizeof (tbuf));
       array_add_element (a, i, t);
-      free (t);
     }
 }
 #endif
index 58ad9b35da69431308300d5fdfa74ff3dbe54b96..9246860f8ce59ac4ef977e4e71edd69b0919c291 100644 (file)
@@ -9,6 +9,13 @@
 /* Shell variables and functions are stored in hash tables. */
 #include "hashlib.h"
 
+/* Placeholder for future modifications if cross-compiling or building a
+   `fat' binary, e.g. on Apple Rhapsody.  These values are used in multiple
+   files, so they appear here. */
+#define HOSTTYPE       CONF_HOSTTYPE
+#define OSTYPE         CONF_OSTYPE
+#define MACHTYPE       CONF_MACHTYPE
+
 /* What a shell variable looks like. */
 
 typedef struct variable *DYNAMIC_FUNC ();
@@ -69,6 +76,8 @@ extern void initialize_shell_variables __P((char **, int));
 extern SHELL_VAR *set_if_not __P((char *, char *));
 extern void set_lines_and_columns __P((int, int));
 
+extern void set_ppid __P((void));
+
 extern SHELL_VAR *find_function __P((char *));
 extern SHELL_VAR *find_variable __P((char *));
 extern SHELL_VAR *find_variable_internal __P((char *, int));
@@ -112,6 +121,7 @@ extern void set_var_auto_export __P((char *));
 extern void set_func_auto_export __P((char *));
 extern void sort_variables __P((SHELL_VAR **));
 extern void maybe_make_export_env __P((void));
+extern void update_export_env_inplace __P((char *, int, char *));
 extern void put_command_name_into_env __P((char *));
 extern void put_gnu_argv_flags_into_env __P((int, char *));
 extern void print_var_list __P((SHELL_VAR **));
index 282185b3a48324cd91ba4ed0f222e9921564404e..6adf7ba6883d922cae3cbc8890f214042fb25e6f 100644 (file)
--- a/version.c
+++ b/version.c
@@ -54,7 +54,11 @@ shell_version_string ()
 }
 
 #if !defined (MACHTYPE)
-#  define MACHTYPE "unknown"
+#  if defined (CONF_MACHTYPE)
+#    define MACHTYPE CONF_MACHTYPE
+#  else
+#    define MACHTYPE "unknown"
+#  endif
 #endif
 
 void
index 4c962a1dc6964a68e7530db4a61999cbf83b34be..ed7dd05c538728b511e3c03347974fdd41b14041 100644 (file)
--- a/xmalloc.c
+++ b/xmalloc.c
@@ -46,7 +46,7 @@
 #  endif /* !__STDC__ */
 #endif /* !PTR_T */
 
-#if !defined (SBRK_DECLARED)
+#if defined (HAVE_SBRK) && !defined (SBRK_DECLARED)
 extern char *sbrk();
 #endif
 
@@ -60,6 +60,19 @@ static size_t allocated;
 /*                                                                 */
 /* **************************************************************** */
 
+#if defined (HAVE_SBRK)
+static size_t
+findbrk ()
+{
+  if (brkfound == 0)
+    {
+      lbreak = (PTR_T)sbrk (0);
+      brkfound++;
+    }
+  return (char *)sbrk (0) - (char *)lbreak;
+}
+#endif
+
 /* Return a pointer to free()able block of memory large enough
    to hold BYTES number of bytes.  If the memory cannot be allocated,
    print an error message and abort. */
@@ -73,13 +86,12 @@ xmalloc (bytes)
 
   if (temp == 0)
     {
-      if (brkfound == 0)
-       {
-         lbreak = (PTR_T)sbrk (0);
-         brkfound++;
-       }
-      allocated = (char *)sbrk (0) - (char *)lbreak;
+#if defined (HAVE_SBRK)
+      allocated = findbrk ();
       fatal_error ("xmalloc: cannot allocate %lu bytes (%lu bytes allocated)", (unsigned long)bytes, (unsigned long)allocated);
+#else
+      fatal_error ("xmalloc: cannot allocate %lu bytes", (unsigned long)bytes);
+#endif /* !HAVE_SBRK */
     }
 
   return (temp);
@@ -96,13 +108,12 @@ xrealloc (pointer, bytes)
 
   if (temp == 0)
     {
-      if (brkfound == 0)
-       {
-         lbreak = (PTR_T)sbrk (0);
-         brkfound++;
-       }
-      allocated = (char *)sbrk (0) - (char *)lbreak;
+#if defined (HAVE_SBRK)
+      allocated = findbrk ();
       fatal_error ("xrealloc: cannot reallocate %lu bytes (%lu bytes allocated)", (unsigned long)bytes, (unsigned long)allocated);
+#else
+      fatal_error ("xmalloc: cannot allocate %lu bytes", (unsigned long)bytes);
+#endif /* !HAVE_SBRK */
     }
 
   return (temp);
diff --git a/y.tab.c b/y.tab.c
index 34c9838aeabe6fe896f27097e771b576a33ef449..a19a1fce0e5b3cd240680376e4ad72e044ed461e 100644 (file)
--- a/y.tab.c
+++ b/y.tab.c
@@ -1999,11 +1999,14 @@ yyerrhandle:
 #define TOKEN_DEFAULT_GROW_SIZE 512
 
 /* Shell meta-characters that, when unquoted, separate words. */
-#define shellmeta(c)   (strchr ("()<>;&|", (c)) != 0)
-#define shellbreak(c)  (strchr ("()<>;&| \t\n", (c)) != 0)
+#define shellmeta(c)   (strchr (shell_meta_chars, (c)) != 0)
+#define shellbreak(c)  (strchr (shell_break_chars, (c)) != 0)
 #define shellquote(c)  ((c) == '"' || (c) == '`' || (c) == '\'')
 #define shellexp(c)    ((c) == '$' || (c) == '<' || (c) == '>')
 
+char *shell_meta_chars = "()<>;&|";
+char *shell_break_chars = "()<>;&| \t\n";
+
 /* The token currently being read. */
 static int current_token;
 
@@ -2680,6 +2683,10 @@ STRING_INT_ALIST word_token_alist[] = {
   { (char *)NULL, 0}
 };
 
+/* XXX - we should also have an alist with strings for other tokens, so we
+         can give more descriptive error messages.  Look at y.tab.h for the
+         other tokens. */
+
 /* These are used by read_token_word, but appear up here so that shell_getc
    can use them to decide when to add otherwise blank lines to the history. */
 
@@ -3132,6 +3139,11 @@ time_command_acceptable ()
     case AND_AND:
     case OR_OR:
     case '&':
+    case DO:
+    case THEN:
+    case ELSE:
+    case '{':
+    case '(':
       return 1;
     default:
       return 0;
@@ -3235,7 +3247,7 @@ special_case_tokens (token)
 #endif
 
 #if defined (COMMAND_TIMING)
-  if (STREQ (token, "time") && time_command_acceptable ())
+  if (STREQ (token, "time") && ((parser_state & PST_CASEPAT) == 0) && time_command_acceptable ())
     return (TIME);
 #endif /* COMMAND_TIMING */
 
@@ -3501,6 +3513,9 @@ read_token (command)
    quoted strings ('', ``, "") and nested constructs.  It also must handle
    reprompting the user, if necessary, after reading a newline, and returning
    correct error values if it reads EOF. */
+
+#define P_FIRSTCLOSE   0x01
+
 static char matched_pair_error;
 static char *
 parse_matched_pair (qc, open, close, lenp, flags)
@@ -3560,7 +3575,7 @@ parse_matched_pair (qc, open, close, lenp, flags)
        }
       else if (ch == close)            /* ending delimiter */
        count--;
-      else if (ch == open)             /* nested begin */
+      else if (((flags & P_FIRSTCLOSE) == 0) && ch == open)            /* nested begin */
        count++;
 
       /* Add this character. */
@@ -3622,7 +3637,7 @@ parse_matched_pair (qc, open, close, lenp, flags)
          if (ch == '(')                /* ) */
            nestret = parse_matched_pair (0, '(', ')', &nestlen, 0);
          else if (ch == '{')           /* } */
-           nestret = parse_matched_pair (0, '{', '}', &nestlen, 0);
+           nestret = parse_matched_pair (0, '{', '}', &nestlen, P_FIRSTCLOSE);
          else if (ch == '[')           /* ] */
            nestret = parse_matched_pair (0, '[', ']', &nestlen, 0);
          if (nestret == &matched_pair_error)
@@ -4000,7 +4015,7 @@ read_token_word (character)
                ((peek_char == '{' || peek_char == '[') && character == '$'))   /* ) ] } */
            {
              if (peek_char == '{')             /* } */
-               ttok = parse_matched_pair (cd, '{', '}', &ttoklen, 0);
+               ttok = parse_matched_pair (cd, '{', '}', &ttoklen, P_FIRSTCLOSE);
              else if (peek_char == '(')                /* ) */
                {
                  /* XXX - push and pop the `(' as a delimiter for use by
@@ -4054,6 +4069,23 @@ read_token_word (character)
              all_digits = 0;
              goto next_character;
            }
+         /* This could eventually be extended to recognize all of the
+            shell's single-character parameter expansions, and set flags.*/
+         else if (character == '$' && peek_char == '$')
+           {
+             ttok = xmalloc (3);
+             ttok[0] = ttok[1] = '$';
+             ttok[2] = '\0';
+             RESIZE_MALLOCED_BUFFER (token, token_index, 3,
+                                     token_buffer_size,
+                                     TOKEN_DEFAULT_GROW_SIZE);
+             strcpy (token + token_index, ttok);
+             token_index += 2;
+             dollar_present = 1;
+             all_digits = 0;
+             FREE (ttok);
+             goto next_character;
+           }
          else
            shell_ungetc (peek_char);
        }
@@ -4068,6 +4100,11 @@ read_token_word (character)
              ttok = parse_matched_pair (cd, '(', ')', &ttoklen, 0);
              if (ttok == &matched_pair_error)
                return -1;              /* Bail immediately. */
+             if (ttok[0] == '(')       /* ) */
+               {
+                 FREE (ttok);
+                 return -1;
+               }
              RESIZE_MALLOCED_BUFFER (token, token_index, ttoklen + 2,
                                      token_buffer_size,
                                      TOKEN_DEFAULT_GROW_SIZE);
@@ -4686,9 +4723,11 @@ decode_prompt_string (string)
              goto add_string;
 
            case '$':
-             temp = xmalloc (2);
-             temp[0] = current_user.euid == 0 ? '#' : '$';
-             temp[1] = '\0';
+             t = temp = xmalloc (3);
+             if ((promptvars || posixly_correct) && (current_user.euid != 0))
+               *t++ = '\\';
+             *t++ = current_user.euid == 0 ? '#' : '$';
+             *t = '\0';
              goto add_string;
 
 #if defined (READLINE)