diff options
author | Chet Ramey <chet.ramey@case.edu> | 2011-11-28 14:41:26 -0500 |
---|---|---|
committer | Chet Ramey <chet.ramey@case.edu> | 2011-11-28 14:41:26 -0500 |
commit | d3a24ed242e91e6afb53b2cbf38b89667637168d (patch) | |
tree | b67e38d2eca8abd31da74e1dcbe69dd1bfa679a3 | |
parent | 7117c2d221b2aed4ede8600f6a36b7c1454b4f55 (diff) | |
download | bash-d3a24ed242e91e6afb53b2cbf38b89667637168d.tar.gz |
Initial devel branch import from bash-3.0-alpha
261 files changed, 23707 insertions, 5754 deletions
@@ -100,6 +100,7 @@ builtins/alias.def Brian Fox, Chet Ramey builtins/bind.def Brian Fox, Chet Ramey builtins/break.def Brian Fox, Chet Ramey builtins/builtin.def Brian Fox, Chet Ramey +builtins/caller.def Rocky Bernstein, Chet Ramey builtins/cd.def Brian Fox, Chet Ramey builtins/colon.def Brian Fox, Chet Ramey builtins/command.def Brian Fox, Chet Ramey @@ -1,3 +1,428 @@ +This document details the changes between this version, bash-3.0-alpha, +and the previous version, bash-2.05b-release. + +1. Changes to Bash + +a. Fixes so that the shell will compile without some of the default options + defined. + +b. Fixed an error message that did not pass enough arguments to printf. + +c. Fixed a bug that caused input redirection to a builtin inside a script + being read from standard input to result in the rest of the already- + read and buffered script to be discarded. + +d. Fixed a bug that caused subshell initialization to close the file + descriptor from which the shell was reading a script under certain + circumstances. + +e. Fixed a bug that caused the shell to not advance a string pointer over + a null wide character when doing string operations. + +f. Fixed the internal logout code so that shells that time out waiting for + input (using $TMOUT) run ~/.bash_logout. + +g. Portability and configuration changes for: cygwin, HP/UX, GNU/FreeBSD. + +h. The parser no longer adds implicit double quotes to ((...)) arithmetic + commands. + +i. The ((...)) arithmetic command evaluation code was fixed to not dump core + when the expanded string is null. + +j. The ((...)) arithmetic command evaluation code was fixed to not perform + variable assignments while expanding the expression. + +k. Fixed a bug that caused word splitting to be performed incorrectly when + IFS is set, but null. + +l. Fixed a bug in brace expansion that caused a quoted `$' preceding an + open brace to inhibit brace expansion. + +m. Fixed a bug that caused a leading `-' in the shell's name to cause it to + not be recognized as a restricted shell. + +n. Fixed a bug in the arithmetic evaluation code that could cause longjmps + to an invalid location and result in a core dump. + +o. Fixed a bug in the calculation of how many history lines are new in a + single shell session when reading new history lines from a file with + `history -n'. + +p. Fixed a bug in pathname canonicalization that caused the shell to dump + core when presented with a pathname longer than PATH_MAX. + +q. Fixed the parser so that it doesn't try to compare a char variable to + EOF, which fails when chars are unsigned. + +r. Fixed a bug in the simple command execution code that caused occasional + core dumps. + +s. The shell does a better job of saving any partial parsing state during + operations which cause a command to be executed while a line is being + entered and parsed. + +t. The completion code now splits words more like the expansion code when + $IFS is used to split. + +u. The locale code does a better job of recomputing the various locale + variable values when LC_ALL is unset. + +v. The programmable completion code does a better job of dequoting expanded + word lists before comparing them against the word to be matched. + +w. The shell no longer seg faults if the expanded value of $PS4 is null + and `set -x' is enabled. + +x. Fixed a bug that caused core dumps when a here string expanded to NULL. + +y. The mail checking code now makes sure the mailbox is bigger before + reporting the existence of new mail. + +z. The parser does not try to expand $'...' and $"..." when the appear + within double quotes unless the `extquote' option has been enabled with + `shopt'. For backwards compatibility, it is enabled by default. + +aa. Fixed a bug that caused `for x; do ...' and `select x; do ... to use + $@ instead of "$@" for the implicit list of arguments. + +bb. Fixed a bug that caused a subshell of a restricted shell (e.g., one + spawned to execute a pipeline) to not exit immediately if attempting + to use a command containing a slash. + +cc. Fixed a problem with empty replacements for a pattern that doesn't match + when performing ${param/word/} expansion. + +dd. Word expansions performed while expanding redirections no longer search + a command's temporary environment to expand variable values. + +ee. Improvements to the alias expansion code when expanding subsequent words + because an aliase's value ends with a space. + +ff. `cd -' now prints the current working directory after a successful chdir + even when the shell is not interactive, as the standard requires. + +gg. The shell does a better job of ensuring a child process dies of SIGINT + before resending SIGINT to itself. + +hh. The arithmetic expansion variable assignment code now does the right + thing when assigning to `special' variables like OPTIND. + +ii. When history expansion verification is enabled, the bash readline helper + functions that do history expansion on the current line don't print + the results. + +jj. Fixed bugs with multiple consecutive alias expansion when one of the + expansions ends with a space. + +kk. Fixed a problem in the programmable completion code that could cause core + dumps when trying to initialize a set of possible completions from a + list of variables. + +ll. The \[ and \] escape characters are now ignored when decoding the prompt + string if the shell is started with editing disabled. + +mm. Fixed a bug that could leave extra characters in a string when doing + quoted null character removal. + +nn. Command substitution and other subshell operations no longer reset the + line number (aids the bash debugger). + +oo. Better line number management when executing simple commands, conditional + commands, for commands, and select commands. + +pp. The globbing code now uses malloc, with its better failure properties, + rather than alloca(). + +qq. Fixed a bug that caused expansions like #{a[2]:=value} to create the + appropriate array element instead of a variable named `a[2]'. + +rr. Fixed a bug in the handling of a `?(...)' pattern immediately following + a `*' when extglob is enabled. + +ss. Fixed a bug that caused a `return' invoked in an exit trap when exit is + invoked in a function to misbehave. + +tt. Fixed a bug that caused CTLESC and CTLNUL characters to not be escaped + by the internal shell string quoting functions. + +uu. Fixed a bug that cause + +vv. Fixed a bug that caused redirections accompanying a null command to persist + in the current shell. + +ww. Fixed a bug that caused the prompt to be printed when the shell was + expanding a multiline alias. + +xx. Fixed a bug that resulted in core dumps when the completion for a command + changed the compspec. + +yy. Fixed a bug that caused evaluation of programmable completions to print + notifications of completed jobs. + +zz. Bash now disables line editing when $EMACS == `t' and $TERM == `dumb' + (which is what emacs shell windows do). + +aaa. In posix mode, `kill -l' causes signal names to be displayed without + a leading `SIG'. + +bbb. Clear error flag on standard output so it doesn't persist across multiple + builtin commands. + +ccc. In posix mode, `alias' displays alias values without the leading `alias', + so the output cannot be used as subsequent input. + +ddd. In posix mode, the `trap' builtin doesn't check whether or not its + first argument is a signal specification and revert the signal handling + to its original disposition if it is. + +eee. Fixed several bugs in the handling of "$*" and "${array[*]}" by the + pattern substitution and removal expansions. + +fff. Fixed several problems with the handling of ${array[@]}, ${array[*]}, + $@, and $* by the indirect variable expansion code. + +ggg. Fixed a bug that did not allow `time' to be aliased. + +hhh. Improved the mail checking code so it won't check (and possibly cause an + NFS file system mount) until MAILPATH or MAIL is given a value -- there + is no default if DEFAULT_MAIL_DIRECTORY is not defined at compile time. + (It is computed by configure, but can be #undef'd in config-bot.h.) + +iii. If the `chkwinsize' option is enabled, the shell checks for window size + changes if a child process exits due to a signal. + +jjj. Removed the attempts to avoid adding a slash at the end of a completed + executable name if there was a directory with the same name in the + current directory. + +kkk. Fixed PATH lookup code so it treats the permission bits separately for + owner, group, and other, rather than checking them all. + +lll. Fixed the locale code to reset the parser's idea of the character class + <blank>, which controls how it splits tokens, when the locale changes. + +mmm. The shell now binds its special readline functions and key bindings only + if the user's inputrc file has not already bound them. + +nnn. The shell now reports on processes that dump core due to signals when + invoked as `-c command'. + +2. Changes to Readline + +a. Fixes to avoid core dumps because of null pointer references in the + multibyte character code. + +b. Fix to avoid infinite recursion caused by certain key combinations. + +c. Fixed a bug that caused the vi-mode `last command' to be set incorrectly. + +d. Readline no longer tries to read ahead more than one line of input, even + when more is available. + +e. Fixed the code that adjusts the point to not mishandle null wide + characters. + +f. Fixed a bug in the history expansion `g' modifier that caused it to skip + every other match. + +g. Fixed a bug that caused the prompt to overwrite previous output when the + output doesn't contain a newline and the locale supports multibyte + characters. This same change fixes the problem of readline redisplay + slowing down dramatically as the line gets longer in multibyte locales. + +h. History traversal with arrow keys in vi insertion mode causes the cursor + to be placed at the end of the new line, like in emacs mode. + +i. The locale initialization code does a better job of using the right + precedence and defaulting when checking the appropriate environment + variables. + +j. Fixed the history word tokenizer to handle <( and >( better when used as + part of bash. + +k. The overwrite mode code received several bug fixes to improve undo. + +l. Many speedups to the multibyte character redisplay code. + +m. The callback character reading interface should not hang waiting to read + keyboard input. + +n. Fixed a bug with redoing vi-mode `s' command. + +o. The code that initializes the terminal tracks changes made to the terminal + special characters with stty(1) (or equivalent), so that these changes + are reflected in the readline bindings. New application-callable function + to make it work: rl_tty_unset_default_bindings(). + +p. Fixed a bug that could cause garbage to be inserted in the buffer when + changing character case in vi mode when using a multibyte locale. + +q. Fixed a bug in the redisplay code that caused problems on systems + supporting multibyte characters when moving between history lines when the + new line has more glyphs but fewer bytes. + +r. Undo and redo now work better after exiting vi insertion mode. + +s. Make sure system calls are restarted after a SIGWINCH is received using + SA_RESTART. + +t. Improvements to the code that displays possible completions when using + multibyte characters. + +u. Fixed a problem when parsing nested if statements in inputrc files. + +v. The completer now takes multibyte characters into account when looking for + quoted substrings on which to perform completion. + +w. The history search functions now perform better bounds checking on the + history list. + +3. New Features in Bash + +a. ANSI string expansion now implements the \x{hexdigits} escape. + +b. There is a new loadable `strftime' builtin. + +c. New variable, COMP_WORDBREAKS, which controls the readline completer's + idea of word break characters. + +d. The `type' builtin no longer reports on aliases unless alias expansion + will actually be performed. + +e. HISTCONTROL is now a colon-separated list of values, which permits + more extensibility and backwards compatibility. + +f. HISTCONTROL may now include the `erasedups' option, which causes all lines + matching a line being added to be removed from the history list. + +g. `configure' has a new `--enable-multibyte' argument that permits multibyte + character support to be disabled even on systems that support it. + +h. New variables to support the bash debugger: BASH_ARGC, BASH_ARGV, + BASH_SOURCE, BASH_LINENO, BASH_SUBSHELL, BASH_EXECUTION_STRING, + BASH_COMMAND + +i. FUNCNAME has been changed to support the debugger: it's now an array + variable. + +j. for, case, select, arithmetic commands now keep line number information + for the debugger. + +k. There is a new `RETURN' trap executed when a function or sourced script + returns (not inherited child processes; inherited by command substitution + if function tracing is enabled and the debugger is active). + +l. New invocation option: --debugger. Enables debugging and turns on new + `extdebug' shell option. + +m. New `functrace' and `errtrace' options to `set -o' cause DEBUG and ERR + traps, respectively, to be inherited by shell functions. Equivalent to + `set -T' and `set -E' respectively. The `functrace' option also controls + whether or not the DEBUG trap is inherited by sourced scripts. + +n. The DEBUG trap is run before binding the variable and running the action + list in a `for' command, binding the selection variable and running the + query in a `select' command, and before attempting a match in a `case' + command. + +o. New `--enable-debugger' option to `configure' to compile in the debugger + support code. + +p. `declare -F' now prints out extra line number and source file information + if the `extdebug' option is set. + +q. If `extdebug' is enabled, a non-zero return value from a DEBUG trap causes + the next command to be skipped, and a return value of 2 while in a + function or sourced script forces a `return'. + +r. New `caller' builtin to provide a call stack for the bash debugger. + +s. The DEBUG trap is run just before the first command in a function body is + executed, for the debugger. + +t. `for', `select', and `case' command heads are printed when `set -x' is + enabled. + +u. There is a new {x..y} brace expansion, which is shorthand for {x.x+1, + x+2,...,y}. x and y can be integers or single characters; the sequence + may ascend or descend; the increment is always 1. + +v. New ksh93-like ${!array[@]} expansion, expands to all the keys (indices) + of array. + +w. New `force_fignore' shopt option; if enabled, suffixes specified by + FIGNORE cause words to be ignored when performing word completion even + if they're the only possibilities. + +x. New `gnu_errfmt' shopt option; if enabled, error messages follow the `gnu + style' (filename:lineno:message) format. + +y. New `-o bashdefault' option to complete and compgen; if set, causes the + whole set of bash completions to be performed if the compspec doesn't + result in a match. + +z. New `-o plusdirs' option to complete and compgen; if set, causes directory + name completion to be performed and the results added to the rest of the + possible completions. + +aa. `kill' is available as a builtin even when the shell is built without + job control. + +bb. New HISTTIMEFORMAT variable; value is a format string to pass to + strftime(3). If set and not null, the `history' builtin prints out + timestamp information according to the specified format when displaying + history entries. If set, bash tells the history library to write out + timestamp information when the history file is written. + +cc. The [[ ... ]] command has a new binary `=~' operator that performs + extended regular expression (egrep-like) matching. + +dd. `configure' has a new `--enable-cond-regexp' option (enabled by default) + to enable the =~ operator and regexp matching in [[ ... ]]. + +ee. Subexpressions matched by the =~ operator are placed in the new + BASH_REMATCH array variable. + +ff. New `failglob' option that causes an expansion error when pathname + expansion fails to produce a match. + +gg. New `set -o pipefail' option that causes a pipeline to return a failure + status if any of the processes in the pipeline fail, not just the last + one. + +4. New Features in Readline + +a. History expansion has a new `a' modifier equivalent to the `g' modifier + for compatibility with the BSD csh. + +b. History expansion has a new `G' modifier equivalent to the BSD csh `g' + modifier, which performs a substitution once per word. + +c. All non-incremental search operations may now undo the operation of + replacing the current line with the history line. + +d. The text inserted by an `a' command in vi mode can be reinserted with + `.'. + +e. New bindable variable, `show-all-if-unmodified'. If set, the readline + completer will list possible completions immediately if there is more + than one completion and partial completion cannot be performed. + +f. There is a new application-callable `free_history_entry()' function. + +g. History list entries now contain timestamp information; the history file + functions know how to read and write timestamp information associated + with each entry. + +h. Four new key binding functions have been added: + + rl_bind_key_if_unbound() + rl_bind_key_if_unbound_in_map() + rl_bind_keyseq_if_unbound() + rl_bind_keyseq_if_unbound_in_map() + +------------------------------------------------------------------------------ This document details the changes between this version, bash-2.05b-release, and the previous version, bash-2.05b-beta2. @@ -157,7 +582,7 @@ e. The `fc' builtin has been fixed, as POSIX requires, to use the closest f. The history file loading code was changed to allow lines to be saved in the history list from the shell startup files. -g. `history -s args' now works bettern in compound commands. +g. `history -s args' now works better in compound commands. h. The tilde expansion code was fixed to better recognize when it's being invoked in an assignment context, which enables expansion after `=' diff --git a/CWRU/changelog b/CWRU/changelog index d090bf4f..5488776b 100644 --- a/CWRU/changelog +++ b/CWRU/changelog @@ -500,7 +500,7 @@ builtins/read.def - check for arithmetic overflow with -t and -n options input.c - - check for read error before doing \r\n translation on cygnus in + - check for read error before doing \r\n translation on cygwin in b_fill_buffer - reset bp->b_used to 0 instead of leaving it at -1 on read error in b_fill_buffer @@ -6254,3 +6254,2207 @@ shell.c ---- builtins/set.def - remove mention of `-i' from long help doc, since it has no effect + + 7/17 + ---- +[bash-2.05b released] + + 7/18 + ---- + +lib/malloc/malloc.c + - make sure that the `free_return' label has a non-empty statement + to branch to + + 7/19 + ---- +locale.c + - only call setlocale() from set_lang() if HAVE_SETLOCALE is defined; + otherwise just return 0 + +lib/readline/mbutil.c + - only try to memset `ps' in _rl_get_char_len if it's non-NULL. Ditto + for _rl_adjust_point + + 7/23 + ---- +execute_cmd.c + - fix for executing_line_number() when compiling without conditional + commands, dparen arithmetic or the arithmetic for command + + + 7/24 + ---- +support/Makefile.in + - fix maintainer-clean, distclean, mostlyclean targets + +builtins/common.c + - fix bug in sh_nojobs where it doesn't pass the right number of args + to builtin_error + +bashline.c + - when using command completion and trying to avoid appending a slash + if there's a directory with the same name in the current directory, + use absolute_pathname() instead of just checking whether the first + char of the match is a slash to catch things like ./ and ../ + +examples/complete/bashcc-1.0.1.tar.gz + - a package of completions for Clear Case, from Richard S. Smith + (http://www.rssnet.org/bashcc.html) + +input.c + - fix check_bash_input to call sync_buffered_stream if the passed fd + is 0 and the shell is currently reading input from fd 0 -- all it + should cost is maybe an additional read system call, and it fixes + the bug where an input redirection to a builtin inside a script + which is being read from stdin causes the already-read-and-buffered + part of the script to be thrown away, e.g.: + + bash < x1 + + where x1 is + + hostname + read Input < t.in + echo $Input + echo xxx + +execute_cmd.c + - in initialize_subshell(), call unset_bash_input (0) to not mess with + fd 0 if that's where bash thinks it's reading input from. Fixes + bug reported by jg@cs.tu-berlin.de on 17 July 2002. Should be a way + to check whether or not the current fd 0 at the time of the call has + not been redirected, like in the bug report. Also might eventually + want to throw in a sync_buffered_stream if bash is reading input + from fd 0 in a non-interactive shell into a buffered stream, so the + stream is sync'd -- might be necessary for some uses + + 7/25 + ---- +lib/readline/signals.c + - make sure rl_catch_sigwinch is declared even if SIGWINCH is not + defined, so the readline state saving and restoring functions in + readline.c are always the same size even if SIGWINCH is not defined, + and undefined references don't occur when SIGWINCH is not defined + + 7/30 + ---- +bashline.c + - augment patch from 7/24 to not disable rl_filename_completion_desired + if the first char of the match is `~' + +lib/readline/bind.c + - when creating `shadow' keymaps `bound' to ANYOTHERKEY, don't bind + a key whose type is ISFUNC but whose function is the `fake' + rl_do_lowercase_version (fixes debian bash bug #154123) + +lib/readline/readline.c + - don't call _rl_vi_set_last from _rl_dispatch_subseq if + key == ANYOTHERKEY (when truncated to `sizeof(char)', it will be 0, + which strchr will find in `vi_textmod') + + 7/31 + ---- +lib/readline/input.c + - fix rl_gather_tyi to only slurp up one line of available input, even + if more than one line is available (fixes debian bash bug #144585) + + 8/3 + --- +bashline.c + - better fix for command completion problem -- test for directory + explicitly with test_for_directory before turning off + rl_filename_completion_desired, since that's the case we're trying + to protect against + + 8/5 + --- +include/shmbutil.h + - fix ADVANCE_CHAR macro to advance the string pointer if mbrlen + returns 0, indicating that the null wide character (wide string + terminator) was found (debian bash bug #155436) + +lib/readline/mbutil.c + - fix _rl_adjust_point to increment the string pointer if mbrlen + returns 0 + +support/shobj-conf + - fix for the `-install_name' value in SHLIB_XLDFLAGS assignment for + Darwin from the fink folks + + 8/6 + --- +builtins/exit.def + - broke code that runs ~/.bash_logout out into a separate function: + bash_logout() + +builtins/common.h + - extern declaration for bash_logout() + +eval.c + - call bash_logout() from alrm_catcher(), so timed-out login shells + run ~/.bash_logout before processing the exit trap + +lib/sh/strtrans.c + - implemented $'\x{hexdigits}' expansion from ksh93 + +configure.in + - define RECYCLES_PIDS in LOCAL_CFLAGS for cygwin; don't bother to + link with -luser32 + +examples/loadables/strftime.c + - new loadable builtin, interface to strftime(3) + + 8/7 + --- +parse.y + - parse_arith_cmd now takes a second argument, a flag saying whether + or not to add double quotes to a parsed arithmetic command; changed + callers + - changed parse_dparen so it tells parse_arith_cmd to not add the + double quotes and therefore doesn't need to remove them + - change parse_dparen to add W_NOGLOB|W_NOSPLIT|W_QUOTED flags to word + created when parsing (( ... )) arithmetic command, since the double + quotes are no longer added + +make_cmd.c + - in make_arith_for_expr, set the flags on the created word to + W_NOGLOB|W_NOSPLIT|W_QUOTED + +execute_cmd.c + - change execute_arith_command to expand the expression with + expand_words_no_vars, like the arithmetic for command code does + - fix execute_arith_command to handle the case where the expanded + expression results in a NULL word without crashing + +tests/{arith-for,cprint}.tests + - change expected output to account for no longer adding quotes to + ((...)) commands + + 8/8 + --- +print_cmd.c + - take out the space after printing the `((' and before printing the + `))' in print_arith_command, print_arith_for_command, and + xtrace_print_arith_cmd + +tests/{arith-for,cprint}.tests + - change expected output to account for no longer adding leading and + trailing spaces when printing ((...)) and arithmetic for commands + + 8/17 + ---- +subst.c + - fix issep() define to handle case where separators[0] == '\0', in + which case it always returns false + +lib/readline/histexpand.c + - fix off-by-one error in history_expand_internal when using the `g' + modifier that causes it to skip every other match when matching a + single character (reported by gjyun90@resl.auto.inha.ac.kr) + +doc/{bash.1,bashref.texi} + - make sure that the name=word form of argument to declare/typeset, + export, and readonly is documented in the description + + 8/30 + ---- +lib/readline/histexpand.c + - make history_expand_internal understand double quotes, because + single quotes are not special inside double quotes, according to + our shell-like quoting conventions. We don't want unmatched + single quotes inside double-quoted strings inhibiting history + expansion + - make `a' modifier equivalent to `g' modifier for compatibility with + the BSD csh + - add a `G' modifier that performs a given substitution once per word + (tokenized as the shell would do it) like the BSD csh `g' modifier + + 8/31 + ---- +braces.c + - when compiling for the shell, treat ${...} like \{...} instead of + trying to peek backward when we see a `{'. This makes it easier + to handle things like \${, which should be brace expanded because + the $ is quoted + + 9/7 + --- +aclocal.m4 + - redirect stdin from /dev/null in BASH_CHECK_DEV_FD before testing + the readability of /dev/fd/0, so we're dealing with a known quantity + + 9/11 + ---- +[prayers for the victims of 9/11/01] + +shell.c + - fix maybe_make_restricted to handle a restricted login shell with a + base pathname of `-rbash' and skip over any leading `-' + + 9/13 + ---- +builtins/evalstring.c + - in parse_and_execute, make sure we don't try to run unwind-protects + back to `pe_dispose' after a longjmp back to top_level if the + pe_dispose frame hasn't been initialized + +lib/readline/display.c + - fix problem with prompt overwriting previous output when the output + doesn't contain a newline in a multi-byte locale. This also should + fix the problem of bash slowing down drastically on long lines when + using a multi-byte locale, because it no longer tries to rewrite the + entire line each time. Patch from Jiro SEKIBA <jir@yamato.ibm.com> + +parse.y + - move the typedef for alias_t that is compiled in if ALIAS is not + defined up before the prototype for push_string, since that takes + an alias_t * parameter + +lib/readline/terminal.c + - bind the termcap description's left and right arrow keys to + rl_backward_char and rl_forward_char, respectively, instead of + rl_forward and rl_backward (which are just there for backwards + compatibility) + +aclocal.m4 + - when testing readability of /dev/stdin, redirect stdin from /dev/null + to make sure it's a readable file + + 9/17 + ---- +config-bot.h + - don't test __STDC__ when deciding whether or not to use stdarg.h; + just use it if it's present + +tests/read2.sub + - redirect from /dev/tty when using `read -t' + + 9/20 + ---- +builtins/history.def + - when reading `new' entries from the history file with `history -n', + fix increment of history_lines_this_session by taking any change + in history_base into account + +lib/sh/pathphys.c + - changes to sh_physpath to deal with pathnames that end up being + longer than PATH_MAX without dumping core + +lib/readline/doc/{history.3,hsuser.texinfo},doc/ bash.1 + - documented new `a' and `G' history modifiers + + 9/25 + ---- +lib/readline/misc.c + - when traversing the history list with arrow keys in vi insertion + mode, put the cursor at the end of the line (like in emacs mode) + +mksyntax.c + - don't try to use \a and \v unless __STDC__ is defined; use the + ascii integer equivalents otherwise + - include "config.h" in the generated syntax.c file for a possible + definition of `const' + +doc/{bash.1,bashref.texi} + - document the meaning of a null directory in $PATH + + 9/26 + ---- +parse.y + - fix set_line_mbstate to handle case where mbrlen() returns 0, + indicating the null wide character + - fix set_line_mbstate so we don't directly compare a char variable + to EOF, since char can (and is) unsigned on some machines + +bashline.c + - change bash_execute_unix_command to save a little bit more state: + last_shell_builtin, this_shell_builtin, last_command_exit_value + + 9/27 + ---- +execute_cmd.c + - tentative change to execute_simple_command to avoid freeing freed + memory in the case where bash forks early but still ends up calling + execute_disk_command, without passing newly-allocated memory to + make_child. This may fix the core dumps with the linux-from-scratch + folks + + 9/28 + ---- +Makefile.in,{builtins,lib/sh}/Makefile.in + - fix up dependencies, mostly on ${BUILD_DIR}/version.h, so that + parallel makes work with GNU and BSD makes + +shell.h + - new struct to save partial parsing state when doing things like + bash_execute_unix_command and other operations that execute + commands while a line is being entered and parsed + +parse.y + - new functions, save_parser_state() and restore_parser_state(), to + save and restore partial parsing state + +bashline.c + - change bash_execute_unix_command to call {save,restore}_parser_state + +builtins/jobs.def + - change execute_list_with_replacements to eliminate a run_unwind_frame + in favor of calling the cleanup explicitly and discarding the frame + +execute_cmd.c + - change execute_for_command to avoid a run_unwind_frame in the case + where the loop variable is readonly or otherwise not assignable + - change execute_select_command and execute_simple_command to use + discard_unwind_frame by running the cleanup code explicitly, instead + of using run_unwind_frame + - make sure execute_select_command decreases loop_level even on error + + 9/30 + ---- +doc/{bash.1,bashref.texi} + - fixed description of `unset' now that unsetting a previously-unset + variable is no longer an error + + 10/3 + ---- +{configure,config.h}.in + - augment check for strtold with additional check to detect the + horribly broken hp/ux 11.x implementation that returns `long_double'; + defines STRTOLD_BROKEN if so + +builtins/printf.def + - define floatmax_t as `double' if STRTOLD_BROKEN is defined + + 10/5 + ---- +lib/readline/keymaps.c + - don't automatically bind uppercase keys to rl_do_lowercase_version + in rl_make_bare_keymap + +lib/readline/readline.c + - explicitly check for ANYOTHERKEY binding to rl_do_lowercase_version + and dispatch to lowercase of key when a prefix is not matched + + 10/12 + ----- +bashline.c + - set COMP_WORDBREAKS in enable_hostname_completion to the value + of rl_completer_word_break_characters + +variables.c + - new special variable COMP_WORDBREAKS, controls the value of + rl_completer_word_break_characters + +variables.h + - new extern declaration for sv_comp_wordbreaks() + +subst.c + - change split_at_delims to behave more like shell word splitting if + the passed value for the delimiters is NULL, indicating that the + function is to use $IFS to split + +{execute_cmd,jobs,test,findcmd,input,make_cmd,redir,shell}.c +builtins/mkbuiltins.c,builtins/{fc,history,source,umask}.def +lib/sh/netconn.c +lib/termcap/termcap.c +lib/readline/histfile.c + - make sure all inclusions of <sys/file.h> are protected by + HAVE_SYS_FILE_H + +bashline.c + - don't turn off rl_filename_completion_desired in + attempt_shell_completion if the partial pathname contains a slash. + This still doesn't solve the problem of partial pathname completion + starting with a directory in the current directory without a + leading `./'. There's no way to tell the difference between that + and a file found in $PATH (which may contain `.') at the point that + attempt_shell_completion acts + + 10/18 + ----- +locale.c + - don't set lc_all to the default locale when LC_ALL is being unset + - new function, reset_locale_vars(), called to recompute the correct + locale variable values when LC_ALL is unset + - changed set_lang to not set LC_ALL, which it never should have been + doing in the first place, and to maintain a local variable `lang' + corresponding to $LANG + - change get_locale_var to use the precedence posix.2 specifies: + LC_ALL overrides individual variables; LANG, if set, is the default + - change set_locale_var to call get_locale_var to get the appropriate + value for the variable being set or unset + - call get_locale_var instead of using passed value in set_locale_var + to get the defaulting and precedence right + +lib/readline/nls.c + - new function, _rl_get_locale_var(), which does the same thing as + locale.c:get_locale_var(), with the right precedence and defaulting, + using sh_get_env_value to get the right bash variable values + - if HAVE_SETLOCALE is defined, _rl_init_eightbit first calls + _rl_get_locale_var to get the right value for LC_CTYPE, and uses + that in the call to setlocale. If _rl_get_locale_var returns NULL, + call setlocale() to get the current international environment, and, + finally, if that returns null, call setlocale with a second argument + of "" to force the implementation's `native' environment + +pcomplete.c + - change gen_wordlist_completions to dequote the text before comparing + it against the expanded word list + - changed gen_matches_from_itemlist to do the same thing + +bashline.c + - new global function, bash_dequote_word, calls bash_dequote_filename + on the text passed. Used by the programmable completion code + +lib/readline/histfile.c + - make sure that whenever read_history_range returns a non-zero value + that it sets errno to some useful value + + 10/19 + ----- +variables.c + - COMP_WORDBREAKS is now a dynamic variable, mirroring value of + rl_completer_word_break_characters. Makes sure that the variable + always points to dynamic memory if it's not null or the readline + default + +bashline.c + - change enable_hostname_completion to manage a dynamic value of + rl_completer_word_break_characters, since assignments to + COMP_WORDBREAKS can change its value unpredictably + +lib/readline/{complete.c,readline.h} + - rl_completer_word_break_characters no longer has `const' attribute + +bashline.c + - clean up necessary places due to rl_completer_word_break_characters + no longer being `const' + +doc/{bash.1,bashref.texi} + - document new COMP_WORDBREAKS variable + + 10/21 + ----- +print_cmd.c + - fix indirection_level_string to handle the case where the decoded + $PS4 is null without seg faulting + + 10/22 + ----- +builtins/shift.def + - make sure that there is actually an argument when reporting a shift + count that exceeds the number of positional paramters and + shift_verbose is enabled + +lib/readline/rltty.c + - change SET_SPECIAL to call a new function, set_special_char, since + it contains a block. It's called infrequently, so the performance + impact of making it a function should be negligible, and it helps + debugging + + 10/29 + ----- +bashline.c + - make sure the editor in VI_EDIT_COMMAND and EMACS_EDIT_COMMAND is + quoted; it might contain spaces (e.g., `emacs -nw') + +aclocal.m4 + - cache ac_cv_rl_version in RL_LIB_READLINE_VERSION macro + +configure.in + - change logic that sets RL_INCLUDEDIR so that it doesn't try to set + a bogus include path if the argument to --with-installed-readline + is `yes' -- helps with cross-compiling + +lib/readline/histexpand.c + - fix history_tokenize_word so that it handles <( and >( better + + 10/30 + ----- +redir.c + - fix write_here_string so it handles the case where `herestr' expands + to NULL without seg faulting + + 10/31 + ----- +mailcheck.c + - reverse logic flip from bash-2.05 that handled systems that don't + change the atime when the mailbox is accessed; make sure the file + is bigger before we report new mail. This is the case in the vast + majority of cases. Reported by jim@jtan.com + + 11/5 + ---- +parse.y + - change action for `for x; { list; }' and corresponding `select' + production to use \"$@\" instead of just $@, as it is with all the + other actions + + 11/9 + ---- +parse.y + - new flag for parse_matched_pair: P_DQUOTE, indicating that the + pair of characters being matched is between double quotes + - parse_matched_pair now passes P_DQUOTE down to recursive calls: + if the open char to be matched is a `"' or the passed-in flags + include P_DQUOTE, set the local `rflags' variable to P_DQUOTE and + pass `rflags' down to recursive calls + - if `rflags' includes P_DQUOTE, don't try to ansiexpand $'...' or + locale expand $"..."; consistent with other quoting constructs + + 11/11 + ----- +doc/{bash.1,bashref.texi} + - explicitly note that variables referenced in arithmetic expressions + without using `$' evaluate to 0 if they are null or unset + - note that a null variable value evaluates to 0 when used in an + arithmetic context, like when a variable with the `-i' attribute is + assigned a null value + - document the ${!prefix@} expansion as equivalent to ${!prefix*} + + 11/12 + ----- +doc/{bash.1,bashref.texi} + - note that the value of an arithmetic expression is as in C + - change the wording to note that `arithmetic evaluation' (not + arithmetic expansion, which has a different meaning) is performed + on the value assigned to a variable whose integer attribute is set + + 11/13 + ----- +execute_cmd.c + - fix execute_disk_command so it calls exit() after printing the error + message in a restricted shell context if the shell has already forked + (nofork != 0 && there are no pipes) + + 11/19 + ----- +builtins/type.def + - don't report on aliases unless expand_aliases is set and the parser + is performing alias expansion; changed tests/type.tests and + tests/type.right accordingly + + 11/25 + ----- +general.c + - fix for full pathnames including drive letters on cygwin from + Corinna (convert to posix-style paths, which the rest of the + code handles much better) + +lib/readline/text.c + - fixes to overwrite mode from jimmy@is-vn.bg: + o in _rl_overwrite_char, do the overwrite mode self-insert + as one group, even when overwriting more than 1 char + o in _rl_overwrite_char, do the insert before the delete so + that an undo positions the cursor on the character restored, + not to the right of it + o in _rl_overwrite_rubout, don't do rl_insert_char(' ') unless + rl_point < rl_end. Since overwrite-mode self-insert acts as + in insert-mode when at eol, make rubout behave like + insert-mode rubout + + 11/30 + ----- +lib/readline/misc.c + - call rl_replace_line with `1' as second parameter if we're going to + immediately overwrite the undo list + +lib/readline/search.c + - in make_history_line_current, use _rl_replace_text to make the line + replacement an undoable operation. Affects all non-incremental + search functions. + +parse.y + - make behavior introduced on 11/9 dependent on extended_quote + variable, controllable by extquote shopt option. Default setting is + on for backwards compatibility + +builtins/shopt.def + - new `extquote' option to control extended_quote variable + + 12/3 + ---- +jobs.c + - change message printed when attempting to put a background job in + the background with `bg' to include the job id and make the + statement declarative + + 12/10 + ----- +bashhist.h + - define explicit flag values for history_control + +variables.c + - change sv_history_control to use new flag values + - change sv_history_control to parse $HISTCONTROL as a colon-separated + list of values for the history_control variable + +bashhist.c + - change check_history_control to use new flag values and restructure + to remove case statement + - new function hc_erasedups(line); removes all entries matching LINE + from the history list + - call hc_erasedups() from check_add_history after we've determined + that we're saving the line + +doc/{bash.1,bashref.texi} + - documented new options available for $HISTCONTROL and that it can + be a colon-separated list of history control options + + 12/11 + ----- +subst.c + - fix pat_subst() to not increment `e' (pointer to the end of the + matched portion of the string) until after we're sure we're going + around the loop again; fixes problem with empty replacements for + a pattern that doesn't match (bug reported by Don Coleman + <don@coleman.org>) + + 12/17 + ----- +lib/readline/display.c + - fixes to multibyte redisplay from jir@yamato.ibm.com (Jiro SEKIBA): + o speed up calculation of first difference between old and new + lines in the common case + o don't try to see if we're in the middle of a multbyte char + in update_line (we'll see how this one works out) + + 12/18 + ----- +doc/bashref.texi + - make it clear that the `command-list' function definition may be + terminated by an ampersand before the closing brace + + 12/28 + ----- +redir.c + - set `expanding_redir' flag when expanding words in a redirection + +subst.c + - new function, exp_jump_to_top_level(), to do any word expansion + cleanup before a call to jump_to_top_level from within that file; + sets expanding_redir back to 0 before jump_to_top_level + +variables.c + - in find_variable(), don't call find_variable_internal with a second + parameter of 1 if expanding_redir is non-zero + - in find_variable_internal(), don't search the temporary env if + subshell_environment includes SUBSHELL_FORK (indicating a simple + command) and expanding_redir is non-zero + +parse.y + - increment line_number when we read a \<newline> pair + +array.c + - added array_unshift_element and array_shift_element (which just call + array_shift and array_rshift, respectively), for bash debugger + support + + 1/4/2003 + -------- +doc/{bash.1,bashref.texi} + - note in the section describing the execution environment passed to + children that subshells inherit shell functions marked for export + - note in the section describing shell functions the possibility + that exported functions may result in two entries in the environment + with the same name + +parse.y + - when pushing an alias expansion onto the pushed_string list, append + a space to the expanded definition to make the parser's lookahead + work without using the `mustpop' hack in shell_getc + + 1/8 + --- +shell.c + - change calls to exit() with EX_USAGE as a parameter to use + EX_BADUSAGE instead, since EX_USAGE is defined as 258 and is + technically out of range + + 1/14 + ---- +aclocal.m4 + - check for the termcap functions in libc first: if we don't have + to link in another library, let's not do it + - change the test for mbstate_t to use AC_TRY_COMPILE instead of + AC_TRY_RUN + +doc/{bash.1,bashref.texi} + - document that bash turns line editing off if environment variable + EMACS is set to `t' when it starts up + +doc/bash.1 + - minor change to give the ftp url for the latest version of bash in + the bug reports section + +lib/readline/histexpand.c + - in get_history_event, cast a couple of `const char *' variables to + `char *' in function call parameter lists to avoid compiler warnings + + 1/21 + ---- +builtins/cd.def + - change `cd -' so it prints the current working directory after a + successful chdir even when the shell is not interactive + + 1/31 + ---- +lib/readline/doc/rltech.texinfo + - clarified exactly what is meant by the term `application-specific + completion function', made its use consistent, and documented + what variables are changed before such a function is called + +lib/readline/input.c + - new function, _rl_pushed_input_available(), returns non-zero if + there are characters in the input queue managed by rl_get_char + and _rl_unget_char + +lib/readline/rlprivate.h + - new extern declaration for _rl_pushed_input_available + +lib/readline/callback.c + - change rl_callback_read_char to check _rl_pushed_input_available + and loop if there's something there, so characters don't languish + until more keyboard input is read + +execute_cmd.c + - new variable, last_command_exit_signal, non-zero if + last_command_exit_value result from wait_for was result of a signal + +nojobs.c + - keep track of whether or not a given pid was killed by a signal with + a new flag in the pid_list array + - new function int find_termsig_by_pid(pid_t pid) to get the + terminating signal, if any, for a particular pid + - new function int get_termsig(WAIT status) returns the terminating + signal corresponding to status + - set last_command_exit_signal in wait_for and the various wait_for_xx + functions + +jobs.c + - new functions, process_exit_signal and job_exit_signal, return the + signal that killed a given process or job, if a signal caused its + death + - set last_command_exit_signal in wait_for by calling job_exit_signal + or process_exit_signal appropriately + +subst.c + - don't resend SIGINT to ourselves unless last_command_exit_signal is + SIGINT and last_command_exit_value == 128 + SIGINT. This fixes the + $(exit 130) bug reported by Paul Jarc + +expr.c + - new function, expr_bind_variable, calls bind_int_variable and + then stupidly_hack_special_variables. This fixes the + `let OPTIND=1' bug + +bashline.c + - change history_and_alias_expand_line and shell_expand_line to call + history_expand_line_internal so calls to pre_process_line are + localized + - change history_expand_line_internal and cleanup_expansion_error to + temporarily turn off hist_verify before calling pre_process_line + to avoid the effects described by teirllm@dms.auburn.edu + +parse.y + - don't unconditionally turn off PST_ALEXPNEXT in push_string. This + fixes the multiple alias expansion bug reported by Paul Jarc. + +lib/readline/vi_mode.c + - change rl_vi_subst to push `l' instead of ` ' -- it should be + equivalent, but this has been reported to fix a problem in multibyte + locales + +lib/readline/readline.h + - new state flag value RL_STATE_TTYCSAVED, indicates that save_tty_chars + has been called. Since it's only used and visible internally, it's + undocumented + +lib/readline/rltty.h + - changed all of the members of _rl_tty_chars struct to `unsigned char' + +lib/readline/rltty.c + - set the RL_STATE_TTYCSAVED after save_tty_chars is called + - new function, rl_tty_unset_default_bindings(), resets bindings for + everything rl_tty_set_default_bindings() messes with back to + rl_insert, so rl_tty_set_default_bindings can be called again with + possible changes + - new function that does the bulk of the work for + rltty_set_default_bindings: _rl_bind_tty_special_chars() + - change prepare_terminal_settings so that it can track changes to the + terminal special chars made by stty(1): unset the bindings with + rl_tty_unset_default_bindings before calling save_tty_chars, and + _rl_tty_set_default_bindings after, with the new values from + get_tty_settings(). This implements a long-standing request, most + recently made by Tim Waugh of Red Hat. + +lib/readline/readline.h + - extern declaration for rl_tty_unset_default_bindings() + +lib/readline/readline.c + - new function, reset_default_bindings, calls + rl_tty_unset_default_bindings() to reset the terminal special chars + back to rl_insert and then read the new ones + +lib/readline/doc/rltech.texinfo + - documented rl_tty_unset_default_bindings() + + 2/1 + --- +[prayers and condolences to the families of the space shuttle crew members] + +aclocal.m4 + - add checks for mbrtowc and mbrlen in BASH_CHECK_MULTIBYTE + - new check, BASH_FUNC_CTYPE_NONASCII, checks whether or not the ctype + functions handle non-ascii characters correctly + +config.h.in + - add HAVE_MBRTOWC and HAVE_MBRLEN + - add NO_MULTIBYTE_SUPPORT for new configure argument + - add CTYPE_NON_ASCII + +config-bot.h, lib/readline/rlmbutil.h + - make sure that mbrtowc, mbrlen, and wcwidth are all present before + turning on HANDLE_MULTIBYTE + - turn off multibyte chars if NO_MULTIBYTE_SUPPORT is defined + +configure.in + - new argument --enable-multibyte (enabled by default), allows + multibyte support to be turned off even on systems that support it + +lib/readline/chardefs.h + - define NON_NEGATIVE as 1 if CTYPE_NON_ASCII is defined + + 2/3 + --- +config.h.in + - add HAVE_WCTOMB + +aclocal.m4 + - check for wctomb in BASH_CHECK_MULTIBYTE + + 2/4 + --- +lib/readline/vi_mode.c + - in _rl_vi_change_mbchar_case, make sure the result from wctomb() + is NULL-terminated before trying to insert it with rl_insert_text() + + 2/5 + --- +lib/readline/display.c + - fix to update_line to avoid problems on systems with multibyte + characters when moving between history lines when the new line + has more glyphs but fewer bytes (twaugh@redhat.com) + +lib/readline/vi_mode.c + - use wcrtomb() instead of wctomb() in _rl_vi_change_mbchar_case + +pcomplete.c + - fix init_itemlist_from_varlist to handle the case where the + `varlist' is NULL + +doc/{bash.1,bashref.texi} + - clarified when a simple command may fail without the shell exiting + when -e is set + + 2/13 + ---- +parse.y + - when bash is started with --nolineediting, ignore \[ and \] when + decoding the prompt string + +subst.c + - fix remove_quoted_nulls so that a string with a CTLESC appearing + after a CTLNUL (which was removed) does not leave characters in + the string inappropriately + + 2/14 + ---- +builtins/common.h + - new flag value for parse_and_execute(): SEVAL_RESETLINE, which + allows the caller to specify whether or not the internal idea + of the line number should be reset to 1 + +builtins/evalstring.c + - parse_and_execute() now tells push_string to reset the line + number only if the SEVAL_RESETLINE flag is set by the caller + + 2/15 + ---- +builtins/evalfile.c + - pass SEVAL_RESETLINE from _evalfile() to parse_and_execute() + +subst.c + - if the shell is currently interactive, pass SEVAL_RESETLINE to + parse_and_execute() when doing command substitution + +jobs.c + - add SEVAL_RESETLINE to parse_and_execute while running SIGCHLD trap + +command.h + - add `line' members to case_com, for_com, select_com + - rearranged order of members in some of the command structs, so + `flags' and `line' are first + - added a `source_file' member to the function_def struct; keeps + track of where the function was defined + +doc/Makefile.in + - add some new suffix rules: .dvi.ps + +doc/{bash.1,bashref.texi} + - added text to the description of the `trap' builtin tightening up + the language describing when the ERR trap will be run + +error.c + - if $BASH_SOURCE (internally-maintained) exists, use BASH_SOURCE[0] + in get_name_for_error if the shell is not interactive + +array.h + - new convenience defines: array_push and array_pop + +variables.c + - change get_funcname to return this_shell_function->name only if + arrays have not been compiled into the shell + - change init_funcname_var to initialize FUNCNAME as an array variable + if we have arrays + - new function: get_self(SHELL_VAR *self), a degenerate `dynamic_value' + function for dynamic variables + - new function: init_dynamic_array_var(), a generic dynamic array + variable initializer to handle the common case + - use init_dynamic_array_var() instead of explicit init_dirstack_var() + - use init_dynamic_array_var() instead of explicit init_groups_var() + - new dynamic array variables: BASH_ARGC, BASH_ARGV, BASH_SOURCE, + BASH_LINENO, initialized with init_dynamic_array_var + +shell.c + - initialize BASH_LINENO, BASH_SOURCE, FUNCNAME in open_shell_script + +{execute_cmd,trap}.c + - take out trap_line_number, since parse_and_execute doesn't reset the + line number any more when running the trap commands + +make_cmd.c + - augment make_function_def to get source file name and call + bind_function_def to save the entire FUNCTION_DEF + +variables.c + - new hash table: shell_function_defs, keeps table of shell function + definitions including source file and line number info corresponding + to shell_functions table + - new functions: find_function_def and bind_function_def to manage + the shell_function_defs hash table + - new function: unbind_function_def to remove a function definition + from the shell_function_defs table (right now uncalled) + +variables.h + - extern declaration for bind_function_def, find_function_def + - new extern declaration for unbind_function_def + +execute_cmd.c + - in function prologue and epilogue, push and pop FUNCNAME, + BASH_SOURCE, and BASH_LINENO information + +dispose_cmd.c + - broke the code that disposes a FUNCTION_DEF out into two new + functions: dispose_function_def and dispose_function_def_contents + +dispose_cmd.h + - new extern declarations for dispose_function_def_contents and + dispose_function_def + +copy_cmd.c + - move body of copy_function_def (other than allocating a new + FUNCTION_DEF) to copy_function_def_contents + - make sure to copy the new source_file member of a function_def in + copy_function_def_contents + - copy_function_def is no longer static, copy_function_def_contents + is not either + +command.h + - new extern declaration for copy_function_def_contents and + copy_function_def + +parse.y + - keep a stack of line numbers where case, select, and for commands + start, with a maximum nesting level of 128; increment when reading + word after `for', `select' or `case' in read_token_word; decrement + in grammar actions after parsing a complete for, arith_for, select, + or case command + - create for, case, arith_for, and select commands with an extra + line number (word_lineno[word_top]) argument + +make_cmd.c + - make_for_or_select, make_for_command, make_case_command, and + make_select_command all take an extra `line_number' argument + +make_cmd.h + - corresponding changes to extern declarations for those functions + + 2/16 + ---- +{execute_cmd,shell,variables}.c + - follow each call to remember_args with a call to push_args or + pop_args to manage the BASH_ARGV and BASH_ARGC arrays. Only set + when the shell is started to run shell script or runs a shell + function. Doesn't handle `set' or `shift' yet, nor `source'. + +execute_cmd.c + - keep track of the level of subshells with a new variable, manipulated + in execute_in_subshell + - set currently_executing_command in execute_command_internal(), + even if we're running a trap + - better line number management when executing simple commands, + conditional commands, for commands in execute_command_internal() + and the various functions that implement the commands + (execute_cond_command, execute_for_command, execute_etc.) + +variables.c + - new dynamic variable BASH_SUBSHELL, with new get_subshell and + assign_subshell functions to manipulate it + - new functions push_args (WORD_LIST *list) and pop_args (void) to + manage the BASH_ARGC and BASH_ARGV dynamic array variables + +variables.h + - new extern declarations for push_args and pop_args + +builtins/evalfile.c + - in _evalfile, do appropriate things to the FUNCNAME, BASH_ARGV, + BASH_ARGC, BASH_SOURCE, and BASH_LINENO variables + +support/mksignames.c + - add another fake signal for `trap'; make NSIG+2 == `RETURN' + +trap.c + - _run_trap_internal now returns an int: the exit value of the command + run as the result of the trap + - run_debug_trap now returns an int: the exit value of the command + run as the result of the trap + - RETURN is a new special trap + - new function: set_return_trap(char *command) interface for the rest + of the shell, like set_{debug,error}_trap + - new function: run_return_trap() + - command substitution and other child processes don't inherit the + return trap + +trap.h + - new extern declaration for set_return_trap() and run_return_trap + - new defines for RETURN_TRAP; increment BASH_NSIG + - change extern declaration for run_debug_trap() since it now returns + an int + +shell.c + - new invocation long option: --debugger, turns on debugging and + sets internal `debugging_mode' variable + +execute_cmd.c + - new code to save return trap when executing a shell function, so + shell functions don't inherit it + - run debug trap before binding the variable and running the action + list in a `for' command + - run debug trap before binding the selection variable and running + the query in a `select' command + - run debug trap before running matcher in a `case' command + +builtins/set.def + - new `set -o functrace' (set -T), causes DEBUG trap to be inherited + by shell functions + - new `set -o errtrace' (set -E), causes ERR trap to be inherited + by shell functions + +flags.c + - new flags -E and -T, control error_trace_mode and + function_trace_mode respectively + +flags.h + - new extern declarations for error_trace_mode and function_trace_mode + + 2/17 + ---- +doc/bashref.texi + - changed the `dircategory' as per Karl Berry's suggestion + +doc/texinfo.tex + - update to version of 2003/02/04 from texinfo.org + +support/texi2dvi + - update to version 1.14 from texinfo-4.5 distribution + + 2/20 + ---- +support/config.{guess,sub} + - update to versions of 2002/11/30 + +lib/readline/doc/manvers.texinfo + - renamed to version.texi to match other GNU software + - UPDATE-MONTH variable is now `UPDATED-MONTH' + +lib/readline/doc/{hist,rlman,rluserman}.texinfo + - include version.texi + +doc/version.texi + - new file, with standard stuff matching other GNU distributions + +{doc,lib/readline/doc}/Makefile.in + - include right stuff for `version.texi' + +lib/readline/doc/{rluserman,rlman,hist}.texinfo + - use @copying and @insertcopying and @ifnottex instead of @ifinfo + - add FDL as an appendix entitled `Copying This Manual' + +lib/readline/doc/{rltech,rluser,hstech,hsuser}.texi + - changed the suffix from `texinfo' to `texi' + +lib/readline/doc/{rlman,rluserman}.texinfo, doc/bashref.texi + - include rltech.texi,rluser.texi,hstech.texi, and hsuser.texi + +lib/readline/doc/Makefile.in,doc/Makefile.in + - made appropriate changes for {{rl,hs}tech,{rl,hs}user}.texi + +lib/readline/doc/{rlman,rluserman}.texinfo + - changed the suffix from `texinfo' to `texi' + +lib/readline/doc/hist.texinfo + - renamed to history.texi + + 2/25 + ---- +pathnames.h.in + - moved pathnames.h here so value of DEBUGGER_START_FILE can be + substituted by configure + +aclocal.m4 + - added AM_PATH_LISPDIR for debugger + +configure.in + - added some variables: `bashvers', `relstatus' to use info in more + than one place + - call AM_PATH_LISPDIR + - new option: --enable-debugger, sets DEBUGGER cpp option + - new option with AC_ARG_VAR: DEBUGGER_START_FILE + - make `pathnames.h' a file generated by configure + +Makefile.in + - add rule to create pathnames.h + +builtins/declare.def + - added extra line number and source file name to `declare -F' output + if `--debugger' is used at startup + +builtins/evalfile.c + - call run_return_trap from source_file before returning the result + from _evalfile() + +execute_cmd.c + - call run_return_trap in execute_function before restoring the old + context + +builtins/source.def + - arrange to save and restore DEBUG traps when sourcing files if + function_trace_mode (set -o functrace) is not set + +print_cmd.c + - broke print_for_command, print_select_command, print_case_command + into two functions each: one to print the `header' and one for + the body + - print_cond_command is no longer static + - print_arith_command now takes a WORD_LIST *, since it doesn't + actually do anything with the ARITH_COM it's passed except print + the enclosed WORD_LIST + - print_arith_command is no longer static + +externs.h + - extern declarations for print_{for,select,case}_command_head, + print_cond_command, print_arith_command + +{.,builtins,lib/sh}/Makefile.in + - corrected dependencies on pathnames.h, since it's now created in + the build directory + + 3/5 + --- +lib/glob/glob.c + - handle alloca() failing (it's supposed to return NULL) + - use malloc() (with its attendent bookkeeping) instead of alloca() + in glob_filename() + +subst.c + - check whether shell_glob_filename returns NULL in + glob_expand_word_list + - change parameter_brace_expand_rhs to handle cases like + ${a[2]:=value} by properly creating the array element instead of a + variable named `a[2]' (reported by <opengeometry@yahoo.ca>) + +variables.c + - change bind_int_variable to use valid_array_reference instead + of looking for `[' + +lib/readline/vi_mode.c + - check for `a' in _rl_vi_done_inserting so the text inserted by an + `a' command can be reinserted with a `.' + +lib/readline/readline.c + - when entering vi insertion mode in readline_internal_setup(), make + sure that _rl_vi_last_key_before_insert is set to `i' so that undo + groups and redo work better (reported by <opengeometry@yahoo.ca>) + +lib/glob/sm_loop.c + - handle ?(...) in a pattern immediately following a `*', instead of + ignoring the `(' and treating the `?' as a single-char match, as + long as FNM_EXTFLAG is set (reported by <anderson110@poptop.llnl.gov>) + +aclocal.m4 + - new test for presence of struct timezone, BASH_STRUCT_TIMEZONE + +config.h.in + - add HAVE_STRUCT_TIMEZONE + +configure.in + - call BASH_STRUCT_TIMEZONE + +execute_cmd.c + - don't try to use `struct timezone' in calls to gettimeofday unless + HAVE_STRUCT_TIMEZONE is defined; use (void *)NULL otherwise + + 3/20 + ---- +execute_cmd.c + - new variable, the_printed_command_except_trap, saves the command + being executed before a trap is executed, for the debugger + +trap.c + - if in debugging mode, let command substitutions and other child + processes inherit the DEBUG and ERR traps if the `functrace' + (which is really a bad name, given this semantic) or `errtrace' + options, respectively, have been set + +shell.c + - local_pending_command renamed to command_execution_string; no longer + static + +variables.c + - new dynamic variable, BASH_COMMAND, set to the command string + currently executing, or the one that caused a trap to execute + (mapped to the_printed_command_except_trap) + - new variable, BASH_EXECUTION_STRING, set to the argument to the + -c invocation option, if the shell was started that way + + 3/22 + ---- +execute_cmd.c + - changed execute_for_command, eval_arith_for_expr, + execute_select_command, execute_arith_command, execute_cond_command, + execute_simple_command to implement new DEBUG trap semantics + for the debugger: if the DEBUG trap commands return a non-zero + status and debugging_mode is non-zero, we skip the command to be + executed + +trap.c + - change run_debug_trap for the debugger: if we're in the debugger + and the DEBUG trap returns 2 while we're in a function or sourced + script, we force a `return' + +shell.c + - new function, start_debugger(), that sources the debugger start file + and turns the debugger on + +builtins/shopt.def + - new settable option, `extdebug', turns on debugging_mode, as if + --debugger had been supplied at invocation (but does not source + debugger startup file) + +trap.c + - make sure that run_exit_trap arranges for `returns' to come back + there, too, so a `return' executed by an `exit' invoked within a + shell function behaves correctly + +support/shobj-conf + - change darwin/MacOS X stanza based on advice from mac os x developers + +lib/sh/mailstat.c + - set the atime member of the synthesized stat struct to 0 if `cur/' + is empty, rather than leaving it undefined + + 3/24 + ---- +builtins/caller.def + - new builtin to provide a call stack for the debugger + +builtins/evalfile.c + - added a second `flags' argument to source_file() + - new flag value for flags argument to _evalfile(): FEVAL_NOPUSHARGS. + If included in flags arg, it means to not manipulate the BASH_ARGV + and BASH_ARGC arrays + +builtins/common.h + - change prototype for source_file() + +builtins/source.def + - add flag value to call to source_file(): set to 1 if we replaced + the positional parameters + - add call to push_args if additional arguments supplied to the + source builtin + - add call to pop_args in maybe_pop_dollar_vars + +execute_cmd.c + - run the debug trap in execute_function so the debugger can stop + before the first command in a function body is executed + - modify subshell_level before executing a builtin or function in a + subshell + - print `for', `select', `case' command heads when set -x is enabled + +print_cmd.c + - `xtrace_print_word_list' now takes an additional flags argument, + which, if non-zero, says to print indirection_level_string() + - new functions to print for, select, and case command heads when + set -x is enabled + - add spaces after `((' and before `))' in xtrace_print_arith_command + +externs.h + - changed extern declaration for xtrace_print_word_list + - new declarations for xtrace_print_{for,case,select}_command_head() + +subst.c + - modify subshell_level when executing a command substitution + + 3/25 + ---- +execute_cmd.c + - use `line_number' in executing_line_number instead of looking into + the current command if it's a simple command; rearrange code to + make this simpler to compile in and out + - need to save and restore value of currently_executing_command around + calls to debug trap and return trap in execute_function + +make_cmd.c + - make sure make_arith_for_command() disposes the WORD_LIST * it is + passed, since nothing else does and it's not used directly + + 3/28 + ---- +Makefile.in + - fixed dependencies for `error.o' on shell.h and version.h -- makes + parallel makes (gmake -j 4) work correctly + +doc/{bash.1,bashref.texi} + - documented all new features added to support the debugger + + 4/1 + --- +lib/sh/shquote.c + - make sure CTLESC and CTLNUL characters are escaped with CTLESC + by sh_double_quote, sh_backslash_quote and + sh_backslash_quote_for_double_quotes + Fixes vulnerability reported by svdb@stack.nl + +shell.h + - new `pipestatus' member of sh_parser_state_t, to save and restore + $PIPESTATUS + +parse.y + - changes to save_parser_state and restore_parser_state to save and + restore $PIPESTATUS + +builtins/read.def + - add a call to word_list_remove_quoted_nulls before assigning the + word list read from standard input to an array variable. Fixes + bug reported by holzhey@ppprs1.phy.tu-dresden.de + + 4/3 + --- +execute_cmd.c + - in execute_null_command, if redirections are supplied, make sure + things like 3</etc/passwd are undone immediately, since they're + being done in the current shell + - functions now inherit the RETURN trap only if function tracing is + on for that function or globally + +lib/readline/misc.c + - in rl_replace_from_history, don't force rl_replace_line to clear + the undo_list, since it might point directly at an undo list + from a history entry (to which we have no handle) + + 4/4 + --- +trap.c + - initialize RETURN_TRAP stuff appropriately in initialize_traps() + - let command substitutions inherit the RETURN trap if we're in + the debugger and function tracing has been enabled + +redir.c + - do_redirections and do_redirection_internal now take a single + flags argument instead of multiple boolean flags + +redir.h + - new #defines for flags argument to do_redirection{s,_internal} + +execute_cmd.c + - change all calls to do_redirection to use new flag values + +parse.y + - new function, free_pushed_string_input(), an external interface to + clear the pushed_string list (alias expansion) + - new define SHOULD_PROMPT to say when it's OK to call prompt_again + (if the shell is currently interactive and is reading input from + the terminal or readline) + - make sure shell_getc and read_secondary_line only call prompt_again + if SHOULD_PROMPT evaluates to true + - prompt_again shouldn't do anything if the shell is currently in the + middle of expanding a multiline alias, since we won't be printing a + prompt anyway + +externs.h + - new extern declaration for free_pushed_string_input() + +execute_cmd.c + - command_substitute and process_substitute now call + free_pushed_string_input because they shouldn't deal with any + partial alias expansion the parent shell may have started + + 4/5 + --- +braces.c + - added {x..y} brace expansion, shorthand for {x,x+1,x+2,...,y}: + x, y can be integers or single characters; the sequence can be + ascending or descending; increment is always 1. Beware that + something like {a..A} can lead to non-letters. + + 4/7 + --- +subst.c + - change extract_delimited_string and extract_dollar_brace_string to + return NULL on an expansion error when no_longjmp_on_fatal_error + is set, so the calling functions don't assume that the expansion + was successful (primarily the prompt expansion and completion code) + +doc/{bash.1,bashref.texi} + - documented new sequence generation feature of brace expansion + + 4/8 + --- +lib/sh/strstr.c + - replacement for strstr(3), in case the C library doesn't provide it + +configure.in + - check for strstr, add to LIBOBJS if not found + +array.c + - array_walk now takes a third void * argument; it's passed to `func' + as its second argument + +array.h + - change sh_ae_map_func_t prototype to add void * second argument + + 4/10 + ---- +array.c + - new function: array_keys_to_word_list, returns a list of indices for + a given array + +array.h + - new extern declaration for array_keys_to_word_list + +arrayfunc.c +3 - new function: char *array_keys(), returns a string with keys for a + given array, with the appropriate quoting + +arrayfunc.h + - new extern declaration for array_keys + +subst.c + - code to implement ksh93-like ${!array[@]} expansion (array[*] works, + too), which expands to all the keys (indices) of ARRAY + +doc/{bash.1,bashref.texi} + - documented new ${!array[@]} expansion + + 4/19 + ---- +builtins/setattr.def + - remove any mention of the `-n' option from readonly builtin's short + and long documentation + +pcomplib.c + - fix progcomp_insert to increase the refcount on the `cs' argument + before calling hash_insert -- fixes the problem of multiple calls + to progcomp_insert with the same compspec + +doc/bash.1 + - add mention of characters that inhibit history expansion when found + immediately following an unquoted `!' + +bashline.c + - convert the code conditionally compiled in by the NO_FORCE_FIGNORE + #define to something runtime-tunable with the `force_fignore' + variable (opposite sense). force_fignore is 1 by default + +builtins/shopt.def + - new tunable `shopt' option: `force_fignore', controls force_fignore + variable and behavior of FIGNORE handling + +lib/readline/complete.c + - new variable, _rl_complete_show_unmodified, causes completer to list + possible completions if more than one completion and partial + completion cannot be done + - new value for what_to_do argument to rl_complete_internal, `@', + indicating that we want the show-unmodified behavior + - change rl_completion_type to return `@' when appropriate + +lib/readline/bind.c + - new bindable variable, show-all-if-unmodified, which controls value + of _rl_complete_show_unmodified + +lib/readline/rlprivate.h + - extern declaration for _rl_complete_show_unmodified + +lib/readline/doc/rluser.texi + - documented show-all-if-unmodified + +lib/readline/doc/rltech.texi + - documented new `@' value for second argument to rl_complete_internal + - documented new return value from rl_completion_type + + 4/22 + ---- +lib/readline/signals.c + - in rl_set_signal, set sa_flags to SA_RESTART for SIGWINCH, if we + have POSIX signals -- this is what most applications expect, and + they're not prepared to deal with EINTR + + 4/25 + ---- +bashline.c + - take out attempts to suppress readline filename completion when + attempting command completion and there is a directory with the + same name in the current directory. #if 0'd for now; maybe make + it conditional later + +error.c + - new variable, gnu_error_format, causes non-interactive errors with + line numbers to be printed in the `gnu style' (filename:lineno:) + instead of the `shell style' (filename: line lineno:) by + error_prolog and parser_error + +version.h,support/mkversion + - don't put extern function declarations into created version.h any + more + +version.c,externs.h + - add extern declarations for show_shell_version() and + shell_version_string(), since they're no longer in version.h + (this backs out change from 9/10/2001) + +shell.h + - don't include version.h + +Makefile.in + - remove unneeded dependencies on version.h -- only version.o + needs it now + +builtins/shopt.def + - new option `gnu_errfmt', changes error messages with line numbers + to use the `standard' gnu format + +pcomplete.h + - new COPT_BASHDEFAULT and COPT_PLUSDIRS defines + +bashline.c + - if the COPT_BASHDEFAULT flag is set, try the rest of the bash + default completions if a compspec with that flag set generates + no matches + - broke bash completions out into separate function: + bash_default_completion(const char *text, int start, int end, + int qc, int in_command_position); change attempt_shell_completion + to call it + +bashline.h + - new extern declaration for bash_default_completion + +builtins/complete.def + - added code to compgen to call bash_default_completion if a compspec + with the COPT_BASHDEFAULT flag set generates no matches from the + programmable completion options + +doc/{bash.1,bashref.texi} + - document new `gnu_errfmt' shopt option + +doc/bash.1,lib/readline/doc/rluser.texi + - document new `-o bashdefault' option to complete and compgen + + 4/26 + ---- +pcomplete.c + - if a compspec has the COPT_PLUSDIRS flag set, generate any + directory name completions and add them to the set of possible + completions as the last thing in gen_compspec_completions + +builtins/complete.def + - add new `-o plusdirs' option to complete and compgen; means to + do directory name completion in addition to other actions + specified by the compspec, and do it last + + 5/12 + ---- +copy_cmd.c + - fix copy_{for,select,case}_command to copy the line member + + 5/13 + ---- +lib/readline/rlmbutil.h,include/shmbutil.h + - new #define MB_INVALIDCH, evaluates to true if return value from + mbrtowc or mbrlen denotes an invalid multibyte character + - new #define MB_NULLWCH, evaluates to true if return value from + mbrtowc or mbrlen denotes a null multibyte character + +lib/readline/complete.c + - new function, fnwidth(), returns printed length of a filename, + correctly handling multibyte characters + - new function, fnprint(), displays a filename on rl_outstream + correctly handling multibyte characters + - use fnwidth() instead of simple strlen() for length calculations + in display_matches + +lib/readline/{display,mbutil}.c + - use MB_INVALIDCH and MB_NULLWCH as appropriate + + 5/21 + ---- +configure.in + - turn off the builtin malloc on GNU/FreeBSD systems (GNU userland, + FreeBSD kernel) + + 5/24 + ---- +pcomplete.c + - in programmable_completions, copy the compspec before using it to + generate the possible completions, allowing the completion for the + command to be changed by the compspec itself without causing a + core dump because the shell frees freed memory (reported by + marcus.harnish@gmx.net) + +parse.y + - in shell_getc, don't call notify_and_cleanup in an interactive shell + unless the shell is currently reading from the terminal and would + print a prompt. This fixes programmable completions printing job + notifications (reported by r.d.green@lancaster.ac.uk) + - use SHOULD_PROMPT macro consistently + +shell.c + - use get_string_value instead of getenv when looking up $TERM and + $EMACS to see whether the shell is running under emacs + - check for `TERM=dumb' as well as `EMACS=t' to decide whether or + not to turn off command-line editing in emacs shell windows + (reported by jik@kamens.brookline.ma.us) + + 5/28 + ---- +expr.c + - save and restore the `evalbuf' context, since evalexp can be + called recursively (e.g. a[b[c]]) + + 5/29 + ---- +builtins/common.c + - in display_signal_list, when displaying for `kill -l' in posix mode, + display signal names without the `SIG' prefix + +doc/bashref.texi + - documented changed to posix mode behavior of kill -l + +builtins/kill.def + - changed the error message printed when argument is not a pid or + job id + +doc/{bash.1,bashref.texi} + - fixed a slight inconsistency in the different sections describing + the `promptvars' option + +doc/Makefile.in + - new rule to create `bash.info' from `bashref.info' by running sed + to change the internal references. This makes the installed + bash.info work right + - make the install target install bash.info after it's been modified + from bashref.info + + 5/30 + ---- +builtins/cd.def + - after testing with ferror(), call clearerr if ferror() evaluates + to true + +execute_cmd.c + - call clearerr(stdout) after executing a builtin or function, + before restoring any redirections + +bashhist.c + - initialize history_comment_char in bash_history_initialize + +builtins/alias.def + - if posix mode is enabled, and the `-p' option is not supplied, don't + list aliases with a preceding `alias ', as POSIX.2 specifies + +doc/bashref.texi + - note new posix mode behavior of displaying alias names and values + - note new posix mode behavior of trap builtin not checking first + argument to be a possible signal specification + - note new posix mode behavior of `kill' not accepting signal names + with a leading `SIG' + +include/stdc.h,lib/readline/rlstdc.h + - don't check the __STRICT_ANSI__ define when deciding whether or not + to #undef __attribute__ + +trap.[ch] + - decode_signal and signal_object_p take an additional flags arg to + satisfy POSIX.2 signal name translation requirements + - change decode_signal to honor the new DSIG_NOCASE (match case- + insensitively) and DSIG_SIGPREFIX (allow signal specifications + with the `SIG' prefix) flags + +builtins/{common.c,{trap,kill}.def} + - change calls to decode_signal to add the new argument with + appropriate values. For kill, POSIX.2 says case-insensitive without + the `SIG' prefix. For trap, POSIX.2 says applications may decode + case-insensitively and with the SIG prefix + +builtins/trap.def + - when in posix mode, don't check for the first argument being a + possible signal spec and revert the signal handling to the + original disposition + + 6/1 + --- +shell.h + - new MATCH_STARSUB define, to tell the callers of the various pattern + substitution and removal functions that call string_list to treat + "$*" and "${array[*]}" appropriately +subst.c + - if get_var_and_type encounters an array variable subscripted by `*' + or `$*', return VT_STARSUB or'd into the variable type value + - callers of get_var_and_type check for VT_STARSUB in the returned type + this will fix problems with ${*...} not being separated with the + first character of $IFS when double-quoted + - in parameter_brace_patsub, set MATCH_STARSUB if VT_STARSUB is set by + get_var_and_type + - change pos_params_pat_subst to call string_list_dollar_star if + the match flags include MATCH_STARSUB + - change parameter_brace_substring to call array_subrange with an + additional argument indicating the character indexing the array + +array.c + - change array_patsub to join the modified array elements with the + first character of $IFS if MATCH_STARSUB is set in the match flags + passed in + - array_subrange now takes an additional argument indicating the + index type -- used to separate with first char of $IFS if the + index char is `*' and the expression is double-quoted + +array.h + - change prototype declaration of array_subrange to add additional arg + + 6/2 + --- +doc/FAQ + - merged in some updates about POSIX from Andrew Josey + + 6/3 + --- +bashjmp.h + - new value for jump_to_top_level: ERREXIT + +{eval,shell,subst,trap}.c,builtins/evalstring.c + - ERREXIT is (for now) equivalent to EXITPROG as a value from + jump_to_top_level + + 6/9 + --- +doc/bash.1,lib/readline/doc/readline.3 + - documented new `show-all-if-unmodified' readline variable + + 6/14 + ---- +lib/readline/history.c + - new function, histdata_t free_history_entry (HIST_ENTRY *h), + frees H and its line, returning the application-specific data + - use free_history_entry where appropriate + +lib/readline/history.h + - extern declaration for free_history_entry() + +lib/readline/doc/{history.3,hstech.texi} + - document free_history_entry + + 6/16 + ---- +lib/readline/readline.[ch] + - changed varions defines for readline/history library versions to 5.0 + +subst.c + - pass information about whether or not an indirectly-expanded variable + contains ${array[@]}, ${array[*]}, $@, or $* + - new function, chk_atstar, performs checks for ${array[@]}, + ${array[*]}, $@, or $* for the parameter_brace_expand* functions and + sets flags (passed as args) to the results + - call chk_atstar from parameter_brace_expand_indir and + parameter_brace_expand + + 6/28 + ---- +doc/{bash.1,bashref.texi} + - clarified that (...) commands are executed in a subshell environment + + 6/30 + ---- +lib/readline/bind.c + - fix a problem with parsing nested if statements in inputrc files + (fix from dimakar@yahoo.com) + + 7/3 + --- +{jobs,nojobs}.c + - fix places that use the return value from strsignal() to check + for NULL return values using a new function, j_strsignal() + +builtins/kill.def + - removed JOB_CONTROL restriction; kill is now available as a builtin + when the shell is built without job control + + 7/10 + ---- +jobs.c + - some systems have WIFCONTINUED but not WCONTINUED; separate the + #defines + + 7/14 + ---- +lib/readline/history.h + - new `timestamp' member of a HIST_ENTRY + - extern declarations for add_history_time and history_get_time + +lib/readline/doc/{history.3,hstech.texi} + - document add_history_time and history_get_time + +lib/readline/history.c + - implementations of history_get_time and add_history_time + - change add_history to initialize the timestamp information + - change free_history_entry to free the timestamp + - change replace_history_entry to duplicate the timestamp + - change history_total_bytes to add the memory taken by the time + stamps + +bashhist.c,builtins/history.def + - use free_history_entry where appropriate + +lib/readline/histfile.c + - changes to read_history_range to deal with new history file format + including timestamps + - changes to history_do_write to write out the timestamp information + - changes to history_truncate_file to understand the timestamp + information + + 7/22 + ---- +doc/{bash.1,bashref.texi} + - fixed function declaration documentation to specify that any compound + command may be used as the function body, not just a group command + + 7/23 + ---- +lib/readline/histfile.c + - don't allocate space for null timestamps in history_do_write, and + don't write out null timestamp entries + +parse.y + - fix CHECK_FOR_RESERVED_WORD to call time_command_acceptable() and + return TIME if the token is "time" and `time' is legal in that + context + + 7/29 + ---- +lib/sh/fmtulong.c + - include <inttypes.h> for possible definitions of intmax_t, uintmax_t + (reported by ro@techfak.uni-bielefeld.de) + + 7/30 + ---- +parse.y + - remove checking for `time' reserved word from special_case_tokens(); + use regular mechanism in CHECK_FOR_RESERVED_WORD. This allows `time' + to be aliased. (Reported by Glenn Morris + <gmorris+gmane@ast.cam.ac.uk>) + + 7/31 + ---- +lib/readline/history.h + - extern declaration for history_write_timestamps + +lib/readline/histfile.c + - don't write timestamps to the history file in history_do_write + unless history_write_timestamps is set to non-zero by the application + (set to 0 by default) + +lib/readline/doc/{hstech.texi,history.3} + - document history_write_timestamps + +variables.[ch] + - new special variable function, HISTTIMEFORMAT; special function + sets history_write_timestamps to 1 if HISTTIMEFORMAT is set + + 8/4 + --- +builtins/history.def + - added support for printing time stamps based on the value of the + HISTTIMEFORMAT variable when displaying history entries + +doc/{bash.1,bashref.texi} + - added description of new HISTTIMEFORMAT variable + + 8/5 + --- +config-top.h + - remove /usr/ucb from any default paths + +mailcheck.c + - make_default_mailpath now returns NULL if DEFAULT_MAIL_DIRECTORY + is not defined + - remember_mail_dates now returns if make_default_mailpath returns + NULL + +config-bot.h + - reorganized the sections; provide an explicit placeholder for + builders to #undef any feature defines they don't want that + configure creates for them, like the default mail path + + 8/9 + --- +config.h.in + - add HAVE_REGEX_H, HAVE_REGCOMP, HAVE_REGEXEC for detection of POSIX.2 + regular expression functions + - add COND_REGEXP define to enable and disable the =~ operator for + matching extended regular expressions in [[...]] commands + +configure.in + - new option, --enable-cond-regexp, enables =~ and code to perform + regular expression matching in [[...]] + +config-bot.h + - undef COND_REGEXP if the OS doesn't provide posix regexp support + +doc/bashref.texi + - documnent new --enable-cond-regexp option to configure + + 8/18 + ---- +support/shobj-conf + - support for shared objects on FreeBSD-gnu (from Robert Millan) + + 8/25 + ---- +lib/sh/shmatch.c + - new file, shell interface to posix extended regular expression + matching + +externs.h + - new extern declarations for functions in shmatch.c + +execute_cmd.c + - incorporate code into execute_cond_node that does extended regular + expression matching for the =~ operator + +parse.y + - add `=~' to the list of binary operators accepted by the conditional + command parser + +doc/{bash.1,bashref.texi} + - documented =~ conditional binary operator and the BASH_REMATCH + variable + + 8/27 + ---- +lib/readline/display.c + - take multibyte characters into account when looking for quoted + substrings on which to do completion (fix from jir@yamato.ibm.com) + +lib/readline/util.c + - fix typo in _rl_strpbrk + +lib/readline/rldefs.h + - use function version of _rl_strpbrk in multibyte locales, because + it understands to skip over special characters in multibyte + character sequences + + 8/28 + ---- +jobs.c + - in wait_for, check for window size changes if a job that exits due + to a signal or is stopped was in the foreground, not just if it's + the current job + + 9/10 + ---- +support/config.{guess,sub} + - add support to recognize FreeBSD running on the amd64 + +subst.c + - if the new `fail_glob_expansion' variable is non-zero, globbing that + fails to match anything causes an expansion error + +builtins/shopt.def + - new `failglob' expansion: if enabled, failed globs cause an error + +test/shopt.right + - take `failglob' into account + +doc/{bash.1,bashref.texi} + - documented new `failglob' option and its effects + + 9/12 + ---- +findcmd.c + - fix file_status to treat the mode bits and uid right -- in particular, + don't assume the `other' bits always apply. Bug reported by + <moseley@hank.org>; fix inspired by <carlo@alinoe.com> + +command.h + - new word flag: W_NOCOMSUB, meaning to not perform command + substitution on a word + +subst.c + - new flag for param_expand: PF_NOCOMSUB. If non-zero, $(...) + command substitutions are not expanded, but returned unchanged + - change expand_word_internal to pass through `` command substitutions + unchanged if (word->flags & W_NOCOMSUB) != 0 + - change expand_word_internal to pass PF_NOCOMSUB to param_expand + if (word->flags & W_NOCOMSUB) != 0 + +builtins/shopt.def + - rename set_interactive_comments to set_shellopts_after_change, which + more accurately reflects its purpose + +syntax.h + - add a define for isblank() in case the system doesn't provide one + +jobs.c + - change raw_job_exit_status to understand `pipefail', using the new + `pipefail_opt' variable + +flags.[ch] + - declare pipefail_opt + - reset pipefail_opt to 0 in reset_shell_flags + +builtins/set.def + - add `set -o pipefail' and document it in help output + +doc/{bash.1,bashref.texi} + - document `set -o pipefail' and the effect of the pipefail option + +mksyntax.c,syntax.h + - sh_syntaxtab is no longer `const' + - new generated variable, sh_syntabsiz, set to number of entries in + sh_syntaxtab, written to generated syntax.c + +locale.c + - new function, locale_setblanks(), sets each member of the current + locale's <blank> class to have the CSHBRK flag in sh_syntaxtab + + 9/17 + ---- +arrayfunc.c + - change convert_var_to_array to not set array[0] to a NULL value + (if the scalar variable had no value; e.g., after being created + with `local arrayvar') + +lib/readline/display.c + - save and restore the value of prompt_invis_chars_first_line in + rl_{save,restore}_prompt, and reinitialize it to 0 before printing + something in the message area + +lib/readline/bind.c + - new functions: rl_bind_keyseq_if_unbound_in_map(ks, func, kmap); + binds key sequence KS to function FUNC in keymap KMAP, and + rl_bind_keyseq_if_unbound (ks, func); binds key sequence KS to + function FUNC in the current keymap + +lib/readline/readline.h + - extern function declarations for rl_bind_keyseq_if_unbound_in_map and + rl_bind_keyseq_if_unbound + +lib/readline/{readline,terminal}.c + - _rl_bind_if_unbound -> rl_bind_keyseq_if_unbound + +lib/readline/{bind.c,rlprivate.h} + - remove _rl_bind_if_unbound + + 9/18 + ---- +lib/readline/doc/rltech.texi + - document rl_bind_keyseq_if_unbound and + rl_bind_keyseq_if_unbound_in_map + + 9/19 + ---- +lib/readline/bind.c + - new functions rl_bind_key_if_unbound_in_map and + rl_bind_key_if_unbound; analogous to (and implemented in terms of) + keyseq functions + - rl_bind_keyseq_in_map: a new function, equivalent to rl_set_key + (which remains for backwards compatibility); changed callers to + use it + - new function, rl_bind_keyseq, equivalent to rl_bind_keyseq_in_map + with a third argument of _rl_keymap + +lib/readline/readline.h + - extern declarations for rl_bind_key_if_unbound_in_map and + rl_bind_key_if_unbound + - extern declarations for rl_bind_keyseq_in_map and rl_bind_keyseq + +lib/readline/doc/rltech.texi + - document rl_bind_keyseq and rl_bind_keyseq_in_map + +configure.in + - require at least readline-5.0 + +config-bot.h + - define SYS_SIGLIST_DECLARED if it's not defined, but + HAVE_DECL_SYS_SIGLIST is, to deal with differences between + autoconf versions + +bashline.c + - use rl_bind_key_if_unbound_in_map when binding bash keybindings in + initialize_readline(), so inputrc files can override them + + 9/22 + ---- +lib/readline/histsearch.c + - do better bounds checking for history_offset and history_length in + history_search_internal + +builtins/history.def + - in delete_last_history(), make sure we don't leave the history + offset longer than the history length after calling delete_histent + + 9/23 + ---- +jobs.c + - small change to notify_of_job_status so job status messages get + printed even if the shell was started to run `-c command'. The + old behavior was intentional, but I cannot remember why, so we'll + try it the other way for a while (debian bash bug #211693) + + 9/24 + ---- +jobs.c + - slightly modify change from 9/23 so that jobs started to run + command substitutions don't print job status messages + + 9/25 + ---- +lib/readline/search.c + - when reading a non-incremental search string from the terminal, + use a separate undo list rather than chaining it to the undo list + from the rest of the line, since the whole undo list will get + freed when the search string is complete + +lib/readline/readline.h + - changed the defines guarding the stdarg prototype for rl_message to + match what's actually used in display.c, where it's defined @@ -316,6 +316,10 @@ does not provide the necessary support. This enables the job control features (*note Job Control::), if the operating system supports them. +`--enable-multibyte' + This enables support for multibyte characters if the operating + system provides the necessary support. + `--enable-net-redirections' This enables the special handling of filenames of the form `/dev/tcp/HOST/PORT' and `/dev/udp/HOST/PORT' when used in @@ -140,16 +140,17 @@ execute_cmd.h f redir.h f bashtypes.h f mailcheck.h f -pathnames.h f xmalloc.h f y.tab.c f y.tab.h f parser-built f +pathnames.h.in f builtins/Makefile.in f builtins/alias.def f builtins/bind.def f builtins/break.def f builtins/builtin.def f +builtins/caller.def f builtins/cd.def f builtins/colon.def f builtins/command.def f @@ -313,14 +314,15 @@ lib/readline/rlstdc.h f lib/readline/rlprivate.h f lib/readline/xmalloc.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 -lib/readline/doc/rluserman.texinfo f -lib/readline/doc/hist.texinfo f -lib/readline/doc/hstech.texinfo f -lib/readline/doc/hsuser.texinfo f +lib/readline/doc/version.texi f +lib/readline/doc/rlman.texi f +lib/readline/doc/rltech.texi f +lib/readline/doc/rluser.texi f +lib/readline/doc/rluserman.texi f +lib/readline/doc/history.texi f +lib/readline/doc/hstech.texi f +lib/readline/doc/hsuser.texi f +lib/readline/doc/fdl.texi f lib/readline/examples/Makefile f lib/readline/examples/excallback.c f lib/readline/examples/fileman.c f @@ -351,6 +353,7 @@ lib/sh/pathcanon.c f lib/sh/pathphys.c f lib/sh/rename.c f lib/sh/setlinebuf.c f +lib/sh/shmatch.c f lib/sh/shquote.c f lib/sh/shtty.c f lib/sh/snprintf.c f @@ -362,6 +365,7 @@ lib/sh/strindex.c f lib/sh/stringlist.c f lib/sh/stringvec.c f lib/sh/strpbrk.c f +lib/sh/strstr.c f lib/sh/strtod.c f lib/sh/strtoimax.c f lib/sh/strtol.c f @@ -427,9 +431,13 @@ doc/README f doc/INTRO f doc/texinfo.tex f doc/bashref.texi f +doc/version.texi f doc/bashref.info f doc/article.ms f doc/htmlpost.sh f 755 +doc/infopost.sh f 755 +doc/fdl.texi f +doc/fdl.txt f support/Makefile.in f support/bashversion.c f support/config.guess f @@ -450,7 +458,7 @@ support/zecho.c f support/SYMLINKS f support/fixlinks f 755 support/install.sh f 755 -support/texi2dvi f +support/texi2dvi f 755 support/texi2html f 755 support/xenix-link.sh f 755 support/shobj-conf f 755 @@ -468,6 +476,7 @@ examples/complete/complete.ianmac f examples/complete/complete2.ianmac f examples/complete/complete.freebsd f examples/complete/complete.gnu-longopt f +examples/complete/bashcc-1.0.1.tar.gz f examples/loadables/README f examples/loadables/template.c f examples/loadables/Makefile.in f @@ -476,6 +485,7 @@ examples/loadables/hello.c f examples/loadables/print.c f examples/loadables/realpath.c f examples/loadables/sleep.c f +examples/loadables/strftime.c f examples/loadables/truefalse.c f examples/loadables/getconf.h f examples/loadables/getconf.c f @@ -601,6 +611,8 @@ examples/misc/aliasconv.sh f examples/misc/aliasconv.bash f examples/misc/cshtobash f tests/README f +tests/alias.tests f +tests/alias.right f tests/arith-for.tests f tests/arith-for.right f tests/arith.tests f @@ -609,7 +621,7 @@ tests/array.tests f tests/array.right f tests/array-at-star f tests/array2.right f -tests/braces-tests f +tests/braces.tests f tests/braces.right f tests/builtins.tests f tests/builtins.right f @@ -624,7 +636,13 @@ tests/cond.tests f tests/cond.right f tests/cprint.tests f tests/cprint.right f +tests/dbg-support.right f +tests/dbg-support.sub f +tests/dbg-support.tests f +tests/dbg-support2.right f +tests/dbg-support2.tests f tests/dollar-at-star f +tests/dollar-star1.sub f tests/dollar.right f tests/dstack.tests f tests/dstack.right f @@ -640,6 +658,7 @@ tests/exec3.sub f tests/exec4.sub f tests/exec5.sub f tests/exec6.sub f +tests/exec7.sub f tests/exp-tests f tests/exp.right f tests/extglob.tests f @@ -690,6 +709,7 @@ tests/new-exp.tests f tests/new-exp1.sub f tests/new-exp2.sub f tests/new-exp3.sub f +tests/new-exp4.sub f tests/new-exp.right f tests/nquote.tests f tests/nquote.right f @@ -699,6 +719,8 @@ tests/nquote2.tests f tests/nquote2.right f tests/nquote3.tests f tests/nquote3.right f +tests/nquote4.tests f +tests/nquote4.right f tests/posix2.tests f tests/posix2.right f tests/posixpat.tests f @@ -725,12 +747,14 @@ tests/redir3.in2 f tests/redir4.sub f tests/redir4.in1 f tests/redir5.sub f +tests/redir6.sub f tests/rhs-exp.tests f tests/rhs-exp.right f tests/rsh.tests f tests/rsh.right f tests/run-all f tests/run-minimal f +tests/run-alias f tests/run-arith-for f tests/run-arith f tests/run-array f @@ -739,6 +763,8 @@ tests/run-braces f tests/run-builtins f tests/run-cond f tests/run-cprint f +tests/run-dbg-support f +tests/run-dbg-support2 f tests/run-dirstack f tests/run-dollars f tests/run-errors f @@ -763,6 +789,7 @@ tests/run-nquote f tests/run-nquote1 f tests/run-nquote2 f tests/run-nquote3 f +tests/run-nquote4 f tests/run-posix2 f tests/run-posixpat f tests/run-precedence f @@ -773,6 +800,7 @@ tests/run-redir f tests/run-rhs-exp f tests/run-rsh f tests/run-set-e f +tests/run-set-x f tests/run-shopt f tests/run-strip f tests/run-test f @@ -782,6 +810,8 @@ tests/run-type f tests/run-varenv f tests/set-e-test f tests/set-e.right f +tests/set-x.tests f +tests/set-x.right f tests/shopt.tests f tests/shopt.right f tests/strip.tests f diff --git a/Makefile.in b/Makefile.in index a3dcd7ee..dd0ee93e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,4 +1,4 @@ -# Makefile for bash-2.05b, version 2.142 +# Makefile for bash-2.05b, version 2.145 # # Copyright (C) 1996-2002 Free Software Foundation, Inc. @@ -179,7 +179,7 @@ SHLIB_SOURCE = ${SH_LIBSRC}/clktck.c ${SH_LIBSRC}/getcwd.c \ ${SH_LIBSRC}/fmtumax.c ${SH_LIBSRC}/netconn.c \ ${SH_LIBSRC}/mktime.c ${SH_LIBSRC}/strftime.c \ ${SH_LIBSRC}/memset.c ${SH_LIBSRC}/xstrchr.c \ - ${SH_LIBSRC}/zcatfd.c + ${SH_LIBSRC}/zcatfd.c ${SH_LIBSRC}/shmatch.c SHLIB_LIB = -lsh SHLIB_LIBNAME = libsh.a @@ -221,7 +221,7 @@ READLINE_SOURCE = $(RL_LIBSRC)/rldefs.h $(RL_LIBSRC)/rlconf.h \ $(RL_LIBSRC)/terminal.c $(RL_LIBSRC)/nls.c \ $(RL_LIBSRC)/input.c $(RL_LIBSRC)/xmalloc.c \ $(RL_LIBSRC)/shell.c $(RL_LIBSRC)/savestring.c \ - $(RL_LIBSRC)/misc.c $(RL_LIBSRC)/compat.c \ + $(RL_LIBSRC)/misc.c $(RL_LIBSRC)/mbutil.c $(RL_LIBSRC)/compat.c \ $(RL_LIBSRC)/histexpand.c $(RL_LIBSRC)/history.c \ $(RL_LIBSRC)/histsearch.c $(RL_LIBSRC)/histfile.c @@ -236,7 +236,7 @@ READLINE_OBJ = $(RL_LIBDIR)/readline.o $(RL_LIBDIR)/funmap.o \ $(RL_LIBDIR)/macro.o $(RL_LIBDIR)/input.o \ $(RL_LIBDIR)/terminal.o $(RL_LIBDIR)/callback.o \ $(RL_LIBDIR)/shell.o $(RL_LIBDIR)/savestring.o \ - $(RL_LIBDIR)/compat.o \ + $(RL_LIBDIR)/mbutil.o $(RL_LIBDIR)/compat.o \ $(RL_LIBDIR)/history.o $(RL_LIBDIR)/histexpand.o \ $(RL_LIBDIR)/histsearch.o $(RL_LIBDIR)/histfile.o @@ -395,11 +395,12 @@ BUILTIN_SRCDIR=$(srcdir)/builtins DEFSRC=$(BUILTIN_SRCDIR) BUILTIN_ABSSRC=${topdir}/builtins DEFDIR = $(dot)/builtins +DEBUGGER_DIR = $(dot)/debugger BUILTIN_DEFS = $(DEFSRC)/alias.def $(DEFSRC)/bind.def $(DEFSRC)/break.def \ $(DEFSRC)/builtin.def $(DEFSRC)/cd.def $(DEFSRC)/colon.def \ $(DEFSRC)/command.def ${DEFSRC}/complete.def \ - $(DEFSRC)/declare.def \ + $(DEFSRC)/caller.def $(DEFSRC)/declare.def \ $(DEFSRC)/echo.def $(DEFSRC)/enable.def $(DEFSRC)/eval.def \ $(DEFSRC)/exec.def $(DEFSRC)/exit.def $(DEFSRC)/fc.def \ $(DEFSRC)/fg_bg.def $(DEFSRC)/hash.def $(DEFSRC)/help.def \ @@ -418,7 +419,7 @@ BUILTIN_C_OBJ = $(DEFDIR)/common.o $(DEFDIR)/evalstring.o \ $(DEFDIR)/evalfile.o $(DEFDIR)/bashgetopt.o BUILTIN_OBJS = $(DEFDIR)/alias.o $(DEFDIR)/bind.o $(DEFDIR)/break.o \ $(DEFDIR)/builtin.o $(DEFDIR)/cd.o $(DEFDIR)/colon.o \ - $(DEFDIR)/command.o $(DEFDIR)/declare.o \ + $(DEFDIR)/command.o $(DEFDIR)/caller.o $(DEFDIR)/declare.o \ $(DEFDIR)/echo.o $(DEFDIR)/enable.o $(DEFDIR)/eval.o \ $(DEFDIR)/exec.o $(DEFDIR)/exit.o $(DEFDIR)/fc.o \ $(DEFDIR)/fg_bg.o $(DEFDIR)/hash.o $(DEFDIR)/help.o \ @@ -578,7 +579,7 @@ syntax.c: mksyntax${EXEEXT} $(srcdir)/syntax.h $(RM) $@ ./mksyntax -o $@ -$(BUILTINS_LIBRARY): $(BUILTIN_DEFS) $(BUILTIN_C_SRC) config.h ${BASHINCDIR}/memalloc.h +$(BUILTINS_LIBRARY): $(BUILTIN_DEFS) $(BUILTIN_C_SRC) config.h ${BASHINCDIR}/memalloc.h version.h @(cd $(DEFDIR) && $(MAKE) $(MFLAGS) DEBUG=${DEBUG} libbuiltins.a ) || exit 1 # these require special rules to circumvent make builtin rules @@ -597,6 +598,9 @@ ${DEFDIR}/builtext.h: $(BUILTIN_DEFS) Makefile makefile: config.status $(srcdir)/Makefile.in CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status +pathnames.h: config.status $(srcdir)/Makefile.in + CONFIG_HEADERS= $(SHELL) ./config.status + Makefiles makefiles: config.status $(srcdir)/Makefile.in @for mf in $(CREATED_MAKEFILES); do \ CONFIG_FILES=$$mf CONFIG_HEADERS= $(SHELL) ./config.status ; \ @@ -670,7 +674,7 @@ uninstall: .made basic-clean: $(RM) $(OBJECTS) $(Program) bashbug - $(RM) .build .made version.h + $(RM) .build .made version.h pathnames.h clean: basic-clean ( cd $(DOCDIR) && $(MAKE) $(MFLAGS) $@ ) @@ -799,22 +803,27 @@ dispose_cmd.o: make_cmd.h subst.h sig.h pathnames.h externs.h dispose_cmd.o: ${BASHINCDIR}/ocache.h error.o: config.h bashtypes.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h flags.h ${BASHINCDIR}/stdc.h error.h error.o: command.h general.h xmalloc.h externs.h input.h bashhist.h +error.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h +error.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h +error.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h +error.o: make_cmd.h subst.h sig.h pathnames.h externs.h +error.o: input.h execute_cmd.h eval.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h trap.h flags.h ${DEFSRC}/common.h eval.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h eval.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h eval.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h eval.o: make_cmd.h subst.h sig.h pathnames.h externs.h -eval.o: input.h execute_cmd.h +eval.o: input.h execute_cmd.h execute_cmd.o: config.h bashtypes.h ${BASHINCDIR}/filecntl.h ${BASHINCDIR}/posixstat.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h execute_cmd.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h execute_cmd.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h execute_cmd.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h -execute_cmd.o: make_cmd.h subst.h sig.h pathnames.h externs.h +execute_cmd.o: make_cmd.h subst.h sig.h pathnames.h externs.h execute_cmd.o: ${BASHINCDIR}/memalloc.h ${GRAM_H} flags.h builtins.h jobs.h quit.h siglist.h execute_cmd.o: execute_cmd.h findcmd.h redir.h trap.h test.h pathexp.h execute_cmd.o: $(DEFSRC)/common.h ${DEFDIR}/builtext.h ${GLOB_LIBSRC}/strmatch.h execute_cmd.o: ${BASHINCDIR}/posixtime.h ${BASHINCDIR}/chartypes.h -expr.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h +expr.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h expr.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h expr.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h expr.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h @@ -826,7 +835,7 @@ findcmd.o: ${BASHINCDIR}/stdc.h error.h general.h xmalloc.h variables.h arrayfun findcmd.o: dispose_cmd.h make_cmd.h subst.h sig.h pathnames.h externs.h findcmd.o: flags.h hashlib.h pathexp.h hashcmd.h findcmd.o: ${BASHINCDIR}/chartypes.h -flags.o: config.h flags.h +flags.o: config.h flags.h flags.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h flags.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h flags.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h @@ -835,7 +844,7 @@ general.o: config.h bashtypes.h ${BASHINCDIR}/posixstat.h ${BASHINCDIR}/filecntl general.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h general.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h general.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h -general.o: make_cmd.h subst.h sig.h pathnames.h externs.h +general.o: make_cmd.h subst.h sig.h pathnames.h externs.h general.o: ${BASHINCDIR}/maxpath.h ${BASHINCDIR}/posixtime.h general.o: ${BASHINCDIR}/chartypes.h hashcmd.o: config.h ${BASHINCDIR}/posixstat.h bashtypes.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h @@ -846,18 +855,18 @@ hashlib.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h hashlib.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h hashlib.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h hashlib.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h -hashlib.o: make_cmd.h subst.h sig.h pathnames.h externs.h +hashlib.o: make_cmd.h subst.h sig.h pathnames.h externs.h input.o: config.h bashtypes.h ${BASHINCDIR}/filecntl.h ${BASHINCDIR}/posixstat.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h input.o: command.h ${BASHINCDIR}/stdc.h general.h xmalloc.h input.h error.h externs.h list.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h list.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h list.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h -list.o: make_cmd.h subst.h sig.h pathnames.h externs.h +list.o: make_cmd.h subst.h sig.h pathnames.h externs.h locale.o: config.h bashtypes.h bashintl.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h locale.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h locale.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h locale.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h -locale.o: make_cmd.h subst.h sig.h pathnames.h externs.h +locale.o: make_cmd.h subst.h sig.h pathnames.h externs.h locale.o: ${BASHINCDIR}/chartypes.h mailcheck.o: config.h bashtypes.h ${BASHINCDIR}/posixstat.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h mailcheck.o: ${BASHINCDIR}/posixtime.h @@ -865,7 +874,7 @@ mailcheck.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h comman mailcheck.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h mailcheck.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h mailcheck.o: make_cmd.h subst.h sig.h pathnames.h externs.h -mailcheck.o: execute_cmd.h mailcheck.h +mailcheck.o: execute_cmd.h mailcheck.h make_cmd.o: config.h bashtypes.h ${BASHINCDIR}/filecntl.h bashansi.h make_cmd.o: command.h ${BASHINCDIR}/stdc.h general.h xmalloc.h error.h flags.h make_cmd.h make_cmd.o: variables.h arrayfunc.h conftypes.h array.h hashlib.h subst.h input.h externs.h @@ -890,18 +899,18 @@ print_cmd.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h print_cmd.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h print_cmd.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h print_cmd.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h -print_cmd.o: make_cmd.h subst.h sig.h pathnames.h externs.h +print_cmd.o: make_cmd.h subst.h sig.h pathnames.h externs.h print_cmd.o: ${GRAM_H} $(DEFSRC)/common.h redir.o: config.h bashtypes.h ${BASHINCDIR}/posixstat.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/filecntl.h redir.o: ${BASHINCDIR}/memalloc.h shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h redir.o: general.h xmalloc.h variables.h arrayfunc.h conftypes.h array.h hashlib.h quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h -redir.o: dispose_cmd.h make_cmd.h subst.h sig.h pathnames.h externs.h +redir.o: dispose_cmd.h make_cmd.h subst.h sig.h pathnames.h externs.h redir.o: flags.h execute_cmd.h redir.h input.h shell.o: config.h bashtypes.h ${BASHINCDIR}/posixstat.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/filecntl.h shell.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h shell.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h shell.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h -shell.o: make_cmd.h subst.h sig.h pathnames.h externs.h version.h +shell.o: make_cmd.h subst.h sig.h pathnames.h externs.h shell.o: flags.h trap.h mailcheck.h builtins.h $(DEFSRC)/common.h shell.o: jobs.h siglist.h input.h execute_cmd.h findcmd.h bashhist.h shell.o: ${GLOB_LIBSRC}/strmatch.h ${BASHINCDIR}/posixtime.h @@ -909,20 +918,20 @@ sig.o: config.h bashtypes.h sig.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h sig.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h sig.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h -sig.o: make_cmd.h subst.h sig.h pathnames.h externs.h +sig.o: make_cmd.h subst.h sig.h pathnames.h externs.h sig.o: jobs.h siglist.h trap.h $(DEFSRC)/common.h bashline.h bashhist.h siglist.o: config.h bashtypes.h siglist.h trap.h stringlib.o: bashtypes.h ${BASHINCDIR}/chartypes.h stringlib.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h stringlib.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h stringlib.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h -stringlib.o: make_cmd.h subst.h sig.h pathnames.h externs.h +stringlib.o: make_cmd.h subst.h sig.h pathnames.h externs.h stringlib.o: ${GLOB_LIBSRC}/glob.h ${GLOB_LIBSRC}/strmatch.h subst.o: config.h bashtypes.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/posixstat.h subst.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h subst.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h subst.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h -subst.o: make_cmd.h subst.h sig.h pathnames.h externs.h +subst.o: make_cmd.h subst.h sig.h pathnames.h externs.h subst.o: flags.h jobs.h siglist.h execute_cmd.h ${BASHINCDIR}/filecntl.h trap.h pathexp.h subst.o: mailcheck.h input.h $(DEFSRC)/getopt.h $(DEFSRC)/common.h subst.o: bashline.h bashhist.h ${GLOB_LIBSRC}/strmatch.h @@ -933,25 +942,26 @@ test.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h $ test.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h test.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h test.o: make_cmd.h subst.h sig.h pathnames.h externs.h test.h -test.o: ${DEFSRC}/common.h +test.o: ${DEFSRC}/common.h trap.o: config.h bashtypes.h trap.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h trap.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h trap.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h trap.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h -trap.o: make_cmd.h subst.h sig.h pathnames.h externs.h +trap.o: make_cmd.h subst.h sig.h pathnames.h externs.h trap.o: signames.h $(DEFSRC)/common.h +trap.o: ${DEFDIR}/builtext.h unwind_prot.o: config.h bashtypes.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h command.h ${BASHINCDIR}/stdc.h unwind_prot.o: general.h xmalloc.h unwind_prot.h quit.h sig.h variables.o: config.h bashtypes.h ${BASHINCDIR}/posixstat.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h variables.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h variables.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h variables.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h -variables.o: make_cmd.h subst.h sig.h pathnames.h externs.h +variables.o: make_cmd.h subst.h sig.h pathnames.h externs.h variables.o: flags.h execute_cmd.h mailcheck.h input.h $(DEFSRC)/common.h variables.o: findcmd.h bashhist.h hashcmd.h pathexp.h -variables.o: pcomplete.h version.h ${BASHINCDIR}/chartypes.h +variables.o: pcomplete.h ${BASHINCDIR}/chartypes.h variables.o: ${BASHINCDIR}/posixtime.h -version.o: version.h conftypes.h patchlevel.h +version.o: conftypes.h patchlevel.h version.h xmalloc.o: config.h bashtypes.h ${BASHINCDIR}/ansi_stdlib.h error.h # job control @@ -961,7 +971,7 @@ jobs.o: bashansi.h ${BASHINCDIR}/ansi_stdlib.h jobs.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h jobs.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h jobs.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h -jobs.o: make_cmd.h subst.h sig.h pathnames.h externs.h +jobs.o: make_cmd.h subst.h sig.h pathnames.h externs.h jobs.o: jobs.h flags.h $(DEFSRC)/common.h $(DEFDIR)/builtext.h jobs.o: ${BASHINCDIR}/posixwait.h ${BASHINCDIR}/unionwait.h jobs.o: ${BASHINCDIR}/posixtime.h @@ -975,24 +985,24 @@ array.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h array.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h array.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h array.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h -array.o: make_cmd.h subst.h sig.h pathnames.h externs.h +array.o: make_cmd.h subst.h sig.h pathnames.h externs.h array.o: $(DEFSRC)/common.h arrayfunc.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h arrayfunc.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h arrayfunc.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h arrayfunc.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h -arrayfunc.o: make_cmd.h subst.h sig.h pathnames.h externs.h +arrayfunc.o: make_cmd.h subst.h sig.h pathnames.h externs.h arrayfunc.o: $(DEFSRC)/common.h arrayfunc.o: ${BASHINCDIR}/shmbutil.h braces.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h braces.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h braces.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h braces.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h -braces.o: make_cmd.h subst.h sig.h pathnames.h externs.h +braces.o: make_cmd.h subst.h sig.h pathnames.h externs.h braces.o: ${BASHINCDIR}/shmbutil.h alias.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h command.h ${BASHINCDIR}/stdc.h alias.o: general.h xmalloc.h bashtypes.h externs.h alias.h -alias.o: pcomplete.h +alias.o: pcomplete.h alias.o: ${BASHINCDIR}/chartypes.h pcomplib.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h bashtypes.h @@ -1005,7 +1015,7 @@ pcomplete.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h bashtypes.h pcomplete.o: ${BASHINCDIR}/stdc.h hashlib.h pcomplete.h shell.h syntax.h pcomplete.o: bashjmp.h command.h general.h xmalloc.h error.h variables.h arrayfunc.h conftypes.h quit.h pcomplete.o: unwind_prot.h dispose_cmd.h make_cmd.h subst.h sig.h pathnames.h -pcomplete.o: externs.h ${BASHINCDIR}/maxpath.h execute_cmd.h +pcomplete.o: externs.h ${BASHINCDIR}/maxpath.h execute_cmd.h # library support files @@ -1014,14 +1024,14 @@ bashhist.o: ${BASHINCDIR}/filecntl.h bashhist.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h bashhist.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h bashhist.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h -bashhist.o: make_cmd.h subst.h sig.h pathnames.h externs.h +bashhist.o: make_cmd.h subst.h sig.h pathnames.h externs.h bashhist.o: flags.h input.h parser.h pathexp.h $(DEFSRC)/common.h bashline.h bashhist.o: $(GLOB_LIBSRC)/strmatch.h bashline.o: config.h bashtypes.h ${BASHINCDIR}/posixstat.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h bashline.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h bashline.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h bashline.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h -bashline.o: make_cmd.h subst.h sig.h pathnames.h externs.h +bashline.o: make_cmd.h subst.h sig.h pathnames.h externs.h bashline.o: builtins.h bashhist.h bashline.h execute_cmd.h findcmd.h pathexp.h bashline.o: $(DEFSRC)/common.h $(GLOB_LIBSRC)/glob.h alias.h bashline.o: pcomplete.h ${BASHINCDIR}/chartypes.h input.h @@ -1029,7 +1039,7 @@ bracecomp.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h bracecomp.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h bracecomp.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h bracecomp.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h -bracecomp.o: make_cmd.h subst.h sig.h pathnames.h externs.h +bracecomp.o: make_cmd.h subst.h sig.h pathnames.h externs.h bracecomp.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h command.h hashlib.h builtins.h general.h xmalloc.h bracecomp.o: quit.h alias.h config.h variables.h arrayfunc.h conftypes.h bracecomp.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h @@ -1065,21 +1075,21 @@ variables.o: $(TILDE_LIBSRC)/tilde.h builtins/bashgetopt.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h builtins/bashgetopt.o: shell.h syntax.h config.h bashjmp.h command.h general.h xmalloc.h error.h builtins/bashgetopt.o: variables.h arrayfunc.h conftypes.h quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h -builtins/bashgetopt.o: make_cmd.h subst.h sig.h pathnames.h externs.h +builtins/bashgetopt.o: make_cmd.h subst.h sig.h pathnames.h externs.h builtins/bashgetopt.o: $(DEFSRC)/common.h builtins/bashgetopt.o: ${BASHINCDIR}/chartypes.h builtins/common.o: bashtypes.h ${BASHINCDIR}/posixstat.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h builtins/common.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h command.h builtins/common.o: ${BASHINCDIR}/memalloc.h variables.h arrayfunc.h conftypes.h input.h siglist.h builtins/common.o: quit.h unwind_prot.h ${BASHINCDIR}/maxpath.h jobs.h builtins.h -builtins/common.o: dispose_cmd.h make_cmd.h subst.h externs.h bashhist.h +builtins/common.o: dispose_cmd.h make_cmd.h subst.h externs.h bashhist.h builtins/common.o: execute_cmd.h ${BASHINCDIR}/stdc.h general.h xmalloc.h error.h pathnames.h builtins/common.o: ${DEFDIR}/builtext.h builtins/common.o: ${BASHINCDIR}/chartypes.h builtins/evalfile.o: bashtypes.h ${BASHINCDIR}/posixstat.h ${BASHINCDIR}/filecntl.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h builtins/evalfile.o: shell.h syntax.h config.h bashjmp.h command.h general.h xmalloc.h error.h builtins/evalfile.o: variables.h arrayfunc.h conftypes.h quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h -builtins/evalfile.o: make_cmd.h subst.h sig.h pathnames.h externs.h +builtins/evalfile.o: make_cmd.h subst.h sig.h pathnames.h externs.h builtins/evalfile.o: jobs.h builtins.h flags.h input.h execute_cmd.h builtins/evalfile.o: bashhist.h $(DEFSRC)/common.h builtins/evalstring.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h @@ -1092,7 +1102,7 @@ builtins/evalstring.o: bashhist.h $(DEFSRC)/common.h builtins/getopt.o: config.h ${BASHINCDIR}/memalloc.h builtins/getopt.o: shell.h syntax.h bashjmp.h command.h general.h xmalloc.h error.h builtins/getopt.o: variables.h arrayfunc.h conftypes.h quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h -builtins/getopt.o: make_cmd.h subst.h sig.h pathnames.h externs.h +builtins/getopt.o: make_cmd.h subst.h sig.h pathnames.h externs.h builtins/getopt.o: $(DEFSRC)/getopt.h builtins/mkbuiltins.o: config.h bashtypes.h ${BASHINCDIR}/posixstat.h ${BASHINCDIR}/filecntl.h builtins/mkbuiltins.o: bashansi.h ${BASHINCDIR}/ansi_stdlib.h @@ -1113,6 +1123,12 @@ builtins/builtin.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general. builtins/builtin.o: quit.h $(DEFSRC)/common.h $(DEFSRC)/bashgetopt.h builtins/builtin.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h builtins/builtin.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h +builtins/caller.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h +builtins/caller.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h +builtins/caller.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h +builtins/caller.o: $(DEFSRC)/common.h quit.h +builtins/caller.o: ${BASHINCDIR}/chartypes.h bashtypes.h +builtins/caller.o: ${DEFDIR}/builtext.h builtins/cd.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h builtins/cd.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h builtins/cd.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h @@ -1131,16 +1147,16 @@ builtins/echo.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h builtins/enable.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h builtins/enable.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h quit.h builtins/enable.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h -builtins/enable.o: pcomplete.h +builtins/enable.o: pcomplete.h builtins/eval.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h builtins/eval.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h quit.h builtins/eval.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h -builtins/exec.o: bashtypes.h +builtins/exec.o: bashtypes.h builtins/exec.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h builtins/exec.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h -builtins/exec.o: dispose_cmd.h make_cmd.h subst.h externs.h execute_cmd.h +builtins/exec.o: dispose_cmd.h make_cmd.h subst.h externs.h execute_cmd.h builtins/exec.o: findcmd.h flags.h quit.h $(DEFSRC)/common.h ${BASHINCDIR}/stdc.h -builtins/exit.o: bashtypes.h +builtins/exit.o: bashtypes.h builtins/exit.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h builtins/exit.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h quit.h builtins/exit.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h @@ -1151,22 +1167,22 @@ builtins/fc.o: flags.h unwind_prot.h variables.h arrayfunc.h conftypes.h shell.h builtins/fc.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h quit.h builtins/fc.o: $(DEFSRC)/bashgetopt.h bashhist.h builtins/fc.o: ${BASHINCDIR}/chartypes.h -builtins/fg_bg.o: bashtypes.h $(DEFSRC)/bashgetopt.h +builtins/fg_bg.o: bashtypes.h $(DEFSRC)/bashgetopt.h builtins/fg_bg.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h builtins/fg_bg.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h quit.h builtins/fg_bg.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h builtins/getopts.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h builtins/getopts.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h quit.h builtins/getopts.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h -builtins/hash.o: bashtypes.h +builtins/hash.o: bashtypes.h builtins/hash.o: builtins.h command.h findcmd.h ${BASHINCDIR}/stdc.h $(DEFSRC)/common.h builtins/hash.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h builtins/hash.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h quit.h builtins/help.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h builtins/help.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h builtins/help.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h quit.h -builtins/help.o: $(GLOB_LIBSRC)/glob.h version.h -builtins/history.o: bashtypes.h +builtins/help.o: $(GLOB_LIBSRC)/glob.h +builtins/history.o: bashtypes.h builtins/history.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h builtins/history.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h builtins/history.o: ${BASHINCDIR}/filecntl.h shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h @@ -1217,14 +1233,14 @@ builtins/shopt.o: $(DEFSRC)/common.h $(DEFSRC)/bashgetopt.h builtins/source.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h builtins/source.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h builtins/source.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h -builtins/source.o: findcmd.h $(DEFSRC)/bashgetopt.h +builtins/source.o: findcmd.h $(DEFSRC)/bashgetopt.h flags.h trap.h builtins/suspend.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h builtins/suspend.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h builtins/suspend.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h builtins/test.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h builtins/test.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h builtins/test.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h -builtins/test.o: test.h +builtins/test.o: test.h builtins/times.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h builtins/times.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h builtins/times.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h @@ -1251,7 +1267,7 @@ builtins/wait.o: ${BASHINCDIR}/chartypes.h builtins/complete.o: config.h shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h builtins/complete.o: unwind_prot.h variables.h arrayfunc.h conftypes.h builtins/complete.o: bashtypes.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h -builtins/complete.o: builtins.h +builtins/complete.o: builtins.h builtins/complete.o: pcomplete.h builtins/complete.o: ${DEFSRC}/common.h ${DEFSRC}/bashgetopt.h @@ -1270,6 +1286,7 @@ builtins/alias.o: $(DEFSRC)/alias.def builtins/bind.o: $(DEFSRC)/bind.def builtins/break.o: $(DEFSRC)/break.def builtins/builtin.o: $(DEFSRC)/builtin.def +builtins/caller.o: $(DEFSRC)/caller.def builtins/cd.o: $(DEFSRC)/cd.def builtins/colon.o: $(DEFSRC)/colon.def builtins/command.o: $(DEFSRC)/command.def @@ -1,3 +1,152 @@ +This is a terse description of the new features added to bash-3.0 since +the release of bash-2.05b. As always, the manual page (doc/bash.1) is +the place to look for complete descriptions. + +1. New Features in Bash + +a. ANSI string expansion now implements the \x{hexdigits} escape. + +b. There is a new loadable `strftime' builtin. + +c. New variable, COMP_WORDBREAKS, which controls the readline completer's + idea of word break characters. + +d. The `type' builtin no longer reports on aliases unless alias expansion + will actually be performed. + +e. HISTCONTROL is now a colon-separated list of values, which permits + more extensibility and backwards compatibility. + +f. HISTCONTROL may now include the `erasedups' option, which causes all lines + matching a line being added to be removed from the history list. + +g. `configure' has a new `--enable-multibyte' argument that permits multibyte + character support to be disabled even on systems that support it. + +h. New variables to support the bash debugger: BASH_ARGC, BASH_ARGV, + BASH_SOURCE, BASH_LINENO, BASH_SUBSHELL, BASH_EXECUTION_STRING, + BASH_COMMAND + +i. FUNCNAME has been changed to support the debugger: it's now an array + variable. + +j. for, case, select, arithmetic commands now keep line number information + for the debugger. + +k. There is a new `RETURN' trap executed when a function or sourced script + returns (not inherited child processes; inherited by command substitution + if function tracing is enabled and the debugger is active). + +l. New invocation option: --debugger. Enables debugging and turns on new + `extdebug' shell option. + +m. New `functrace' and `errtrace' options to `set -o' cause DEBUG and ERR + traps, respectively, to be inherited by shell functions. Equivalent to + `set -T' and `set -E' respectively. The `functrace' option also controls + whether or not the DEBUG trap is inherited by sourced scripts. + +n. The DEBUG trap is run before binding the variable and running the action + list in a `for' command, binding the selection variable and running the + query in a `select' command, and before attempting a match in a `case' + command. + +o. New `--enable-debugger' option to `configure' to compile in the debugger + support code. + +p. `declare -F' now prints out extra line number and source file information + if the `extdebug' option is set. + +q. If `extdebug' is enabled, a non-zero return value from a DEBUG trap causes + the next command to be skipped, and a return value of 2 while in a + function or sourced script forces a `return'. + +r. New `caller' builtin to provide a call stack for the bash debugger. + +s. The DEBUG trap is run just before the first command in a function body is + executed, for the debugger. + +t. `for', `select', and `case' command heads are printed when `set -x' is + enabled. + +u. There is a new {x..y} brace expansion, which is shorthand for {x.x+1, + x+2,...,y}. x and y can be integers or single characters; the sequence + may ascend or descend; the increment is always 1. + +v. New ksh93-like ${!array[@]} expansion, expands to all the keys (indices) + of array. + +w. New `force_fignore' shopt option; if enabled, suffixes specified by + FIGNORE cause words to be ignored when performing word completion even + if they're the only possibilities. + +x. New `gnu_errfmt' shopt option; if enabled, error messages follow the `gnu + style' (filename:lineno:message) format. + +y. New `-o bashdefault' option to complete and compgen; if set, causes the + whole set of bash completions to be performed if the compspec doesn't + result in a match. + +z. New `-o plusdirs' option to complete and compgen; if set, causes directory + name completion to be performed and the results added to the rest of the + possible completions. + +aa. `kill' is available as a builtin even when the shell is built without + job control. + +bb. New HISTTIMEFORMAT variable; value is a format string to pass to + strftime(3). If set and not null, the `history' builtin prints out + timestamp information according to the specified format when displaying + history entries. If set, bash tells the history library to write out + timestamp information when the history file is written. + +cc. The [[ ... ]] command has a new binary `=~' operator that performs + extended regular expression (egrep-like) matching. + +dd. `configure' has a new `--enable-cond-regexp' option (enabled by default) + to enable the =~ operator and regexp matching in [[ ... ]]. + +ee. Subexpressions matched by the =~ operator are placed in the new + BASH_REMATCH array variable. + +ff. New `failglob' option that causes an expansion error when pathname + expansion fails to produce a match. + +gg. New `set -o pipefail' option that causes a pipeline to return a failure + status if any of the processes in the pipeline fail, not just the last + one. + +2. New Features in Readline + +a. History expansion has a new `a' modifier equivalent to the `g' modifier + for compatibility with the BSD csh. + +b. History expansion has a new `G' modifier equivalent to the BSD csh `g' + modifier, which performs a substitution once per word. + +c. All non-incremental search operations may now undo the operation of + replacing the current line with the history line. + +d. The text inserted by an `a' command in vi mode can be reinserted with + `.'. + +e. New bindable variable, `show-all-if-unmodified'. If set, the readline + completer will list possible completions immediately if there is more + than one completion and partial completion cannot be performed. + +f. There is a new application-callable `free_history_entry()' function. + +g. History list entries now contain timestamp information; the history file + functions know how to read and write timestamp information associated + with each entry. + +h. Four new key binding functions have been added: + + rl_bind_key_if_unbound() + rl_bind_key_if_unbound_in_map() + rl_bind_keyseq_if_unbound() + rl_bind_keyseq_if_unbound_in_map() + +------------------------------------------------------------------------------- This is a terse description of the new features added to bash-2.05b since the release of bash-2.05a. As always, the manual page (doc/bash.1) is the place to look for complete descriptions. @@ -29,20 +29,20 @@ 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. (Bash has them on by - default anyway.) - - 7. The POSIX 1003.2 startup files are executed (`$ENV') rather than + 6. The POSIX 1003.2 startup files are executed (`$ENV') rather than the normal Bash files. - 8. Tilde expansion is only performed on assignments preceding a + 7. Tilde expansion is only performed on assignments preceding a command name, rather than on all assignment statements on the line. - 9. The default history file is `~/.sh_history' (this is the default + 8. The default history file is `~/.sh_history' (this is the default value of `$HISTFILE'). - 10. The output of `kill -l' prints all the signal names on a single - line, separated by spaces. + 9. The output of `kill -l' prints all the signal names on a single + line, separated by spaces, without the `SIG' prefix. + + 10. The `kill' builtin does not accept signal names with a `SIG' + prefix. 11. Non-interactive shells exit if FILENAME in `.' FILENAME is not found. @@ -103,23 +103,33 @@ The following list is what's changed when `POSIX mode' is in effect: 26. The `trap' builtin displays signal names without the leading `SIG'. - 27. The `.' and `source' builtins do not search the current directory + 27. The `trap' builtin doesn't check the first argument for a possible + signal specification and revert the signal handling to the original + disposition if it is. If users want to reset the handler for a + given signal to the original disposition, they should use `-' as + the first argument. + + 28. The `.' and `source' builtins do not search the current directory for the filename argument if it is not found by searching `PATH'. - 28. Subshells spawned to execute command substitutions inherit the + 29. Subshells spawned to execute command substitutions inherit the value of the `-e' option from the parent shell. When not in POSIX mode, Bash clears the `-e' option in such subshells. - 29. Alias expansion is always enabled, even in non-interactive shells. + 30. Alias expansion is always enabled, even in non-interactive shells. + + 31. When the `alias' builtin displays alias definitions, it does not + display them with a leading `alias ' unless the `-p' option is + supplied. - 30. When the `set' builtin is invoked without options, it does not + 32. When the `set' builtin is invoked without options, it does not display shell function names and definitions. - 31. When the `set' builtin is invoked without options, it displays + 33. When the `set' builtin is invoked without options, it displays variable values without quotes, unless they contain shell metacharacters, even if the result contains nonprinting characters. - 32. When the `cd' builtin is invoked in LOGICAL mode, and the pathname + 34. When the `cd' builtin is invoked in LOGICAL mode, and the pathname constructed from `$PWD' and the directory name supplied as an argument does not refer to an existing directory, `cd' will fail instead of falling back to PHYSICAL mode. @@ -1,7 +1,7 @@ Introduction ============ -This is GNU Bash, version 2.05b. Bash is the GNU Project's Bourne +This is GNU Bash, version 3.0b. 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 @@ -981,11 +981,12 @@ AC_MSG_CHECKING(which library has the termcap functions) _bash_needmsg= fi AC_CACHE_VAL(bash_cv_termcap_lib, -[AC_CHECK_LIB(termcap, tgetent, bash_cv_termcap_lib=libtermcap, +[AC_CHECK_FUNC(tgetent, bash_cv_termcap_lib=libc, + [AC_CHECK_LIB(termcap, tgetent, bash_cv_termcap_lib=libtermcap, [AC_CHECK_LIB(tinfo, tgetent, bash_cv_termcap_lib=libtinfo, [AC_CHECK_LIB(curses, tgetent, bash_cv_termcap_lib=libcurses, [AC_CHECK_LIB(ncurses, tgetent, bash_cv_termcap_lib=libncurses, - bash_cv_termcap_lib=gnutermcap)])])])]) + bash_cv_termcap_lib=gnutermcap)])])])])]) if test "X$_bash_needmsg" = "Xyes"; then AC_MSG_CHECKING(which library has the termcap functions) fi @@ -1003,6 +1004,9 @@ TERMCAP_DEP= elif test $bash_cv_termcap_lib = libncurses; then TERMCAP_LIB=-lncurses TERMCAP_DEP= +elif test $bash_cv_termcap_lib = libc; then +TERMCAP_LIB= +TERMCAP_DEP= else TERMCAP_LIB=-lcurses TERMCAP_DEP= @@ -1141,6 +1145,22 @@ if test $bash_cv_struct_timeval = yes; then fi ]) +AC_DEFUN(BASH_STRUCT_TIMEZONE, +[AC_MSG_CHECKING(for struct timezone in sys/time.h and time.h) +AC_CACHE_VAL(bash_cv_struct_timezone, +[ +AC_EGREP_HEADER(struct timezone, sys/time.h, + bash_cv_struct_timezone=yes, + AC_EGREP_HEADER(struct timezone, time.h, + bash_cv_struct_timezone=yes, + bash_cv_struct_timezone=no)) +]) +AC_MSG_RESULT($bash_cv_struct_timezone) +if test $bash_cv_struct_timezone = yes; then + AC_DEFINE(HAVE_STRUCT_TIMEZONE) +fi +]) + AC_DEFUN(BASH_STRUCT_WINSIZE, [AC_MSG_CHECKING(for struct winsize in sys/ioctl.h and termios.h) AC_CACHE_VAL(bash_cv_struct_winsize_header, @@ -1526,9 +1546,9 @@ fi AC_DEFUN(BASH_CHECK_DEV_FD, [AC_MSG_CHECKING(whether /dev/fd is available) AC_CACHE_VAL(bash_cv_dev_fd, -[if test -d /dev/fd && test -r /dev/fd/0; then +[if test -d /dev/fd && test -r /dev/fd/0 < /dev/null; then bash_cv_dev_fd=standard - elif test -d /proc/self/fd && test -r /proc/self/fd/0; then + elif test -d /proc/self/fd && test -r /proc/self/fd/0 < /dev/null; then bash_cv_dev_fd=whacky else bash_cv_dev_fd=absent @@ -1547,9 +1567,9 @@ fi AC_DEFUN(BASH_CHECK_DEV_STDIN, [AC_MSG_CHECKING(whether /dev/stdin stdout stderr are available) AC_CACHE_VAL(bash_cv_dev_stdin, -[if test -d /dev/fd && test -r /dev/stdin; then +[if test -d /dev/fd && test -r /dev/stdin < /dev/null; then bash_cv_dev_stdin=present - elif test -d /proc/self/fd && test -r /dev/stdin; then + elif test -d /proc/self/fd && test -r /dev/stdin < /dev/null; then bash_cv_dev_stdin=present else bash_cv_dev_stdin=absent @@ -1653,17 +1673,18 @@ AC_CHECK_HEADERS(wchar.h) AC_CHECK_HEADERS(langinfo.h) AC_CHECK_FUNC(mbsrtowcs, AC_DEFINE(HAVE_MBSRTOWCS)) +AC_CHECK_FUNC(mbrtowc, AC_DEFINE(HAVE_MBRTOWC)) +AC_CHECK_FUNC(mbrlen, AC_DEFINE(HAVE_MBRLEN)) +AC_CHECK_FUNC(wctomb, AC_DEFINE(HAVE_WCTOMB)) AC_CHECK_FUNC(wcwidth, AC_DEFINE(HAVE_WCWIDTH)) AC_CACHE_CHECK([for mbstate_t], bash_cv_have_mbstate_t, -[AC_TRY_RUN([ -#include <wchar.h> -int -main () -{ +[AC_TRY_COMPILE([ +#include <wchar.h>], [ mbstate_t ps; - return 0; -}], bash_cv_have_mbstate_t=yes, bash_cv_have_mbstate_t=no)]) + mbstate_t *psp; + psp = (mbstate_t *)0; +], bash_cv_have_mbstate_t=yes, bash_cv_have_mbstate_t=no)]) if test $bash_cv_have_mbstate_t = yes; then AC_DEFINE(HAVE_MBSTATE_T) fi @@ -1712,7 +1733,8 @@ LIBS="$LIBS -lreadline ${TERMCAP_LIB}" CFLAGS="$CFLAGS -I${ac_cv_rl_includedir}" LDFLAGS="$LDFLAGS -L${ac_cv_rl_libdir}" -AC_TRY_RUN([ +AC_CACHE_VAL(ac_cv_rl_version, +[AC_TRY_RUN([ #include <stdio.h> #include <readline/readline.h> @@ -1728,7 +1750,7 @@ main() ], ac_cv_rl_version=`cat conftest.rlv`, ac_cv_rl_version='0.0', -ac_cv_rl_version='4.2') +ac_cv_rl_version='4.2')]) CFLAGS="$_save_CFLAGS" LDFLAGS="$_save_LDFLAGS" @@ -1790,3 +1812,77 @@ AC_MSG_RESULT($ac_cv_rl_version) fi ]) + +AC_DEFUN(BASH_FUNC_CTYPE_NONASCII, +[ +AC_MSG_CHECKING(whether the ctype macros accept non-ascii characters) +AC_CACHE_VAL(bash_cv_func_ctype_nonascii, +[AC_TRY_RUN([ +#ifdef HAVE_LOCALE_H +#include <locale.h> +#endif +#include <stdio.h> +#include <ctype.h> + +main(c, v) +int c; +char *v[]; +{ + char *deflocale; + unsigned char x; + int r1, r2; + +#ifdef HAVE_SETLOCALE + /* We take a shot here. If that locale is not known, try the + system default. We try this one because '\342' (226) is + known to be a printable character in that locale. */ + deflocale = setlocale(LC_ALL, "en_US.ISO8859-1"); + if (deflocale == 0) + deflocale = setlocale(LC_ALL, ""); +#endif + + x = '\342'; + r1 = isprint(x); + x -= 128; + r2 = isprint(x); + exit (r1 == 0 || r2 == 0); +} +], bash_cv_func_ctype_nonascii=yes, bash_cv_func_ctype_nonascii=no, + [AC_MSG_WARN(cannot check ctype macros if cross compiling -- defaulting to no) + bash_cv_func_ctype_nonascii=no] +)]) +AC_MSG_RESULT($bash_cv_func_ctype_nonascii) +if test $bash_cv_func_ctype_nonascii = yes; then +AC_DEFINE(CTYPE_NON_ASCII) +fi +]) + +dnl +dnl tests added for bashdb +dnl + + +AC_DEFUN([AM_PATH_LISPDIR], + [AC_ARG_WITH(lispdir, AC_HELP_STRING([--with-lispdir], [override the default lisp directory]), + [ lispdir="$withval" + AC_MSG_CHECKING([where .elc files should go]) + AC_MSG_RESULT([$lispdir])], + [ + # If set to t, that means we are running in a shell under Emacs. + # If you have an Emacs named "t", then use the full path. + test x"$EMACS" = xt && EMACS= + AC_CHECK_PROGS(EMACS, emacs xemacs, no) + if test $EMACS != "no"; then + if test x${lispdir+set} != xset; then + AC_CACHE_CHECK([where .elc files should go], [am_cv_lispdir], [dnl + am_cv_lispdir=`$EMACS -batch -q -eval '(while load-path (princ (concat (car load-path) "\n")) (setq load-path (cdr load-path)))' | sed -n -e 's,/$,,' -e '/.*\/lib\/\(x\?emacs\/site-lisp\)$/{s,,${libdir}/\1,;p;q;}' -e '/.*\/share\/\(x\?emacs\/site-lisp\)$/{s,,${datadir}/\1,;p;q;}'` + if test -z "$am_cv_lispdir"; then + am_cv_lispdir='${datadir}/emacs/site-lisp' + fi + ]) + lispdir="$am_cv_lispdir" + fi + fi + ]) + AC_SUBST(lispdir) +]) @@ -154,16 +154,17 @@ ARRAY_ELEMENT *s, *e; * element as the argument. */ void -array_walk(a, func) +array_walk(a, func, udata) ARRAY *a; sh_ae_map_func_t *func; +void *udata; { register ARRAY_ELEMENT *ae; if (a == 0 || array_empty(a)) return; for (ae = element_forw(a->head); ae != a->head; ae = element_forw(ae)) - if ((*func)(ae) < 0) + if ((*func)(ae, udata) < 0) return; } @@ -265,6 +266,21 @@ char *s; return (a->num_elements); } +ARRAY_ELEMENT * +array_unshift_element(a) +ARRAY *a; +{ + return (array_shift (a, 1, 0)); +} + +int +array_shift_element(a, v) +ARRAY *a; +char *v; +{ + return (array_rshift (a, 1, v)); +} + ARRAY * array_quote(array) ARRAY *array; @@ -283,13 +299,14 @@ ARRAY *array; } char * -array_subrange (a, start, end, quoted) +array_subrange (a, start, end, starsub, quoted) ARRAY *a; arrayind_t start, end; -int quoted; +int starsub, quoted; { ARRAY_ELEMENT *h, *p; arrayind_t i; + char *ifs, sep[2]; p = array_head (a); if (p == 0 || array_empty (a) || start > array_num_elements (a)) @@ -302,7 +319,14 @@ int quoted; for (h = p; p != a->head && i < end; i++, p = element_forw(p)) ; - return (array_to_string_internal (h, p, " ", quoted)); + if (starsub && (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT))) { + ifs = getifs(); + sep[0] = ifs ? *ifs : '\0'; + } else + sep[0] = ' '; + sep[1] = '\0'; + + return (array_to_string_internal (h, p, sep, quoted)); } char * @@ -313,7 +337,7 @@ int mflags; { ARRAY *a2; ARRAY_ELEMENT *e; - char *t; + char *t, *ifs, sifs[2]; if (array_head (a) == 0 || array_empty (a)) return ((char *)NULL); @@ -327,7 +351,13 @@ int mflags; if (mflags & MATCH_QUOTED) array_quote (a2); - t = array_to_string (a2, " ", 0); + if (mflags & MATCH_STARSUB) { + ifs = getifs(); + sifs[0] = ifs ? *ifs : '\0'; + sifs[1] = '\0'; + t = array_to_string (a2, sifs, 0); + } else + t = array_to_string (a2, " ", 0); array_dispose (a2); return t; @@ -365,8 +395,10 @@ void array_dispose_element(ae) ARRAY_ELEMENT *ae; { - FREE(ae->value); - free(ae); + if (ae) { + FREE(ae->value); + free(ae); + } } /* @@ -460,6 +492,7 @@ arrayind_t i; /* Convenience routines for the shell to translate to and from the form used by the rest of the code. */ + WORD_LIST * array_to_word_list(a) ARRAY *a; @@ -487,6 +520,25 @@ WORD_LIST *list; return (array_assign_list (a, list)); } +WORD_LIST * +array_keys_to_word_list(a) +ARRAY *a; +{ + WORD_LIST *list; + ARRAY_ELEMENT *ae; + char *t; + + if (a == 0 || array_empty(a)) + return((WORD_LIST *)NULL); + list = (WORD_LIST *)NULL; + for (ae = element_forw(a->head); ae != a->head; ae = element_forw(ae)) { + t = itos(element_index(ae)); + list = make_word_list (make_bare_word(t), list); + free(t); + } + return (REVERSE_LIST(list, WORD_LIST *)); +} + ARRAY * array_assign_list (array, list) ARRAY *array; @@ -767,7 +819,7 @@ print_array(a) ARRAY *a; { printf("\n"); - array_walk(a, print_element); + array_walk(a, print_element, (void *)NULL); } main() @@ -40,7 +40,7 @@ typedef struct array_element { struct array_element *next, *prev; } ARRAY_ELEMENT; -typedef int sh_ae_map_func_t __P((ARRAY_ELEMENT *)); +typedef int sh_ae_map_func_t __P((ARRAY_ELEMENT *, void *)); /* Basic operations on entire arrays */ extern ARRAY *array_create __P((void)); @@ -48,13 +48,15 @@ extern void array_flush __P((ARRAY *)); extern void array_dispose __P((ARRAY *)); extern ARRAY *array_copy __P((ARRAY *)); extern ARRAY *array_slice __P((ARRAY *, ARRAY_ELEMENT *, ARRAY_ELEMENT *)); -extern void array_walk __P((ARRAY *, sh_ae_map_func_t *)); +extern void array_walk __P((ARRAY *, sh_ae_map_func_t *, void *)); extern ARRAY_ELEMENT *array_shift __P((ARRAY *, int, int)); extern int array_rshift __P((ARRAY *, int, char *)); +extern ARRAY_ELEMENT *array_unshift_element __P((ARRAY *)); +extern int array_shift_element __P((ARRAY *, char *)); extern ARRAY *array_quote __P((ARRAY *)); -extern char *array_subrange __P((ARRAY *, arrayind_t, arrayind_t, int)); +extern char *array_subrange __P((ARRAY *, arrayind_t, arrayind_t, int, int)); extern char *array_patsub __P((ARRAY *, char *, char *, int)); /* Basic operations on array elements. */ @@ -69,6 +71,8 @@ extern char *array_reference __P((ARRAY *, arrayind_t)); /* Converting to and from arrays */ extern WORD_LIST *array_to_word_list __P((ARRAY *)); extern ARRAY *array_from_word_list __P((WORD_LIST *)); +extern WORD_LIST *array_keys_to_word_list __P((ARRAY *)); + extern ARRAY *array_assign_list __P((ARRAY *, WORD_LIST *)); extern char **array_to_argv __P((ARRAY *)); @@ -90,6 +94,18 @@ extern ARRAY *array_from_string __P((char *, char *)); #define element_forw(ae) ((ae)->next) #define element_back(ae) ((ae)->prev) +/* Convenience */ +#define array_push(a,v) \ + do { array_rshift ((a), 1, (v)); } while (0) +#define array_pop(a) \ + do { array_dispose_element (array_shift ((a), 1, 0)); } while (0) + +#define GET_ARRAY_FROM_VAR(n, v, a) \ + do { \ + (v) = find_variable (n); \ + (a) = ((v) && array_p ((v))) ? array_cell (v) : (ARRAY *)0; \ + } while (0) + #define ALL_ELEMENT_SUB(c) ((c) == '@' || (c) == '*') #endif /* _ARRAY_H_ */ diff --git a/arrayfunc.c b/arrayfunc.c index 60e70d92..3ac6fd58 100644 --- a/arrayfunc.c +++ b/arrayfunc.c @@ -56,7 +56,8 @@ convert_var_to_array (var) oldval = value_cell (var); array = array_create (); - array_insert (array, 0, oldval); + if (oldval) + array_insert (array, 0, oldval); FREE (value_cell (var)); var_setarray (var, array); @@ -395,13 +396,13 @@ skipsubscript (s, i) state_bak = state; mblength = mbrlen (s + i, slength, &state); - if (mblength == (size_t)-2 || mblength == (size_t)-1) + if (MB_INVALIDCH (mblength)) { state = state_bak; i++; slength--; } - else if (mblength == 0) + else if (MB_NULLWCH (mblength)) return i; else { @@ -623,6 +624,9 @@ array_value_internal (s, quoted, allow_all, rtype) return (char *)NULL; #endif + if (len == 0) + return ((char *)NULL); /* error message already printed */ + /* [ */ if (ALL_ELEMENT_SUB (t[0]) && t[1] == ']') { @@ -704,4 +708,41 @@ get_array_value (s, allow_all, rtype) return (array_value_internal (s, 0, allow_all, rtype)); } +char * +array_keys (s, quoted) + char *s; + int quoted; +{ + int len; + char *retval, *t, *temp; + WORD_LIST *l; + SHELL_VAR *var; + + var = array_variable_part (s, &t, &len); + + /* [ */ + if (var == 0 || ALL_ELEMENT_SUB (t[0]) == 0 || t[1] != ']') + return (char *)NULL; + + if (array_p (var) == 0) + l = add_string_to_list ("0", (WORD_LIST *)NULL); + else + { + l = array_keys_to_word_list (array_cell (var)); + if (l == (WORD_LIST *)NULL) + return ((char *) NULL); + } + + if (t[0] == '*' && (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES))) + { + temp = string_list_dollar_star (l); + retval = quote_string (temp); + free (temp); + } + else /* ${!name[@]} or unquoted ${!name[*]} */ + retval = string_list_dollar_at (l, quoted); + + dispose_words (l); + return retval; +} #endif /* ARRAY_VARS */ diff --git a/arrayfunc.h b/arrayfunc.h index 7eae976f..375f6f37 100644 --- a/arrayfunc.h +++ b/arrayfunc.h @@ -45,6 +45,8 @@ extern int valid_array_reference __P((char *)); extern char *array_value __P((char *, int, int *)); extern char *get_array_value __P((char *, int, int *)); +extern char *array_keys __P((char *, int)); + extern char *array_variable_name __P((char *, char **, int *)); extern SHELL_VAR *array_variable_part __P((char *, char **, int *)); @@ -58,6 +58,7 @@ extern int errno; static int histignore_item_func __P((struct ign *)); static int check_history_control __P((char *)); +static void hc_erasedups __P((char *)); static void really_add_history __P((char *)); static struct ignorevar histignore = @@ -77,7 +78,10 @@ static struct ignorevar histignore = becomes zero when we read lines from a file, for example. */ int remember_on_history = 1; -/* The number of lines that Bash has added to this history session. */ +/* The number of lines that Bash has added to this history session. The + difference between the number of the top element in the history list + (offset from history_base) and the number of lines in the history file. + Appending this session's history to the history file resets this to 0. */ int history_lines_this_session; /* The number of lines that Bash has read from the history file. */ @@ -134,10 +138,14 @@ int literal_history; exit, even if the history has been stifled. */ int force_append_history; -/* A nit for picking at history saving. - Value of 0 means save all lines parsed by the shell on the history. - Value of 1 means save all lines that do not start with a space. - Value of 2 means save all lines that do not match the last line saved. */ +/* A nit for picking at history saving. Flags have the following values: + + Value == 0 means save all lines parsed by the shell on the history. + Value & HC_IGNSPACE means save all lines that do not start with a space. + Value & HC_IGNDUPS means save all lines that do not match the last + line saved. + Value & HC_ERASEDUPS means to remove all other matching lines from the + history list before saving the latest line. */ int history_control; /* Set to 1 if the last command was added to the history list successfully @@ -206,6 +214,7 @@ bash_initialize_history () history_quotes_inhibit_expansion = 1; history_search_delimiter_chars = ";&()|<>"; history_inhibit_expansion_function = bash_history_inhibit_expansion; + history_comment_char = '#'; } void @@ -511,27 +520,49 @@ check_history_control (line) HIST_ENTRY *temp; int r; - switch (history_control) + if (history_control == 0) + return 1; + + /* ignorespace or ignoreboth */ + if ((history_control & HC_IGNSPACE) && *line == ' ') + return 0; + + /* ignoredups or ignoreboth */ + if (history_control & HC_IGNDUPS) { - case 0: /* nothing */ - return 1; - case 1: /* ignorespace */ - return (*line != ' '); - case 3: /* ignoreboth */ - if (*line == ' ') - return 0; - /* FALLTHROUGH if case == 3 (`ignoreboth') */ - case 2: /* ignoredups */ using_history (); temp = previous_history (); r = (temp == 0 || STREQ (temp->line, line) == 0); using_history (); - return r; + + if (r == 0) + return r; } - return 0; + return 1; +} + +/* Remove all entries matching LINE from the history list. Triggered when + HISTCONTROL includes `erasedups'. */ +static void +hc_erasedups (line) + char *line; +{ + HIST_ENTRY *temp; + int r; + + using_history (); + while (temp = previous_history ()) + { + if (STREQ (temp->line, line)) + { + r = where_history (); + remove_history (r); + } + } + using_history (); } /* Add LINE to the history list, handling possibly multi-line compound @@ -577,6 +608,11 @@ check_add_history (line, force) { if (check_history_control (line) && history_should_ignore (line) == 0) { + /* We're committed to saving the line. If the user has requested it, + remove other matching lines from the history. */ + if (history_control & HC_ERASEDUPS) + hc_erasedups (line); + if (force) { really_add_history (line); @@ -635,10 +671,8 @@ bash_add_history (line) free (new_line); if (old) - { - FREE (old->line); - free (old); - } + free_history_entry (old); + add_it = 0; } } @@ -23,6 +23,13 @@ #include "stdc.h" +/* Flag values for history_control */ +#define HC_IGNSPACE 0x01 +#define HC_IGNDUPS 0x02 +#define HC_ERASEDUPS 0x04 + +#define HC_IGNBOTH (HC_IGNSPACE|HC_IGNDUPS) + extern int remember_on_history; extern int history_lines_this_session; extern int history_lines_in_file; @@ -33,9 +33,10 @@ extern procenv_t return_catch; /* used by `return' builtin */ xbcopy ((char *)old, (char *)save, sizeof (procenv_t)); /* Values for the second argument to longjmp/siglongjmp. */ -#define NOT_JUMPED 0 /* Not returning from a longjmp. */ -#define FORCE_EOF 1 /* We want to stop parsing. */ -#define DISCARD 2 /* Discard current command. */ -#define EXITPROG 3 /* Unconditionally exit the program now. */ +#define NOT_JUMPED 0 /* Not returning from a longjmp. */ +#define FORCE_EOF 1 /* We want to stop parsing. */ +#define DISCARD 2 /* Discard current command. */ +#define EXITPROG 3 /* Unconditionally exit the program now. */ +#define ERREXIT 4 /* Exit due to error condition */ #endif /* _BASHJMP_H_ */ @@ -150,10 +150,15 @@ static char **prog_complete_matches; #endif /* Variables used here but defined in other files. */ -extern int current_command_line_count; +#if defined (BANG_HISTORY) +extern int hist_verify; +#endif + +extern int current_command_line_count, last_command_exit_value; extern int posixly_correct, no_symbolic_links; extern char *current_prompt_string, *ps1_prompt; extern STRING_INT_ALIST word_token_alist[]; +extern sh_builtin_func_t *last_shell_builtin, *this_shell_builtin; /* SPECIFIC_COMPLETION_FUNCTIONS specifies that we have individual completion functions which indicate what type of completion should be @@ -205,8 +210,14 @@ int perform_hostname_completion = 1; /* If non-zero, we don't do command completion on an empty line. */ int no_empty_command_completion; +/* Set FORCE_FIGNORE if you want to honor FIGNORE even if it ignores the + only possible matches. Set to 0 if you want to match filenames if they + are the only possible matches, even if FIGNORE says to. */ +int force_fignore = 1; + static char *bash_completer_word_break_characters = " \t\n\"'@><=;|&(:"; static char *bash_nohostname_word_break_characters = " \t\n\"'><=;|&(:"; +/* )) */ static rl_hook_func_t *old_rl_startup_hook = (rl_hook_func_t *)NULL; @@ -233,11 +244,14 @@ posix_readline_initialize (on_or_off) #endif } +/* When this function returns, rl_completer_word_break_characters points to + dynamically allocated memory. */ int enable_hostname_completion (on_or_off) int on_or_off; { int old_value; + char *at, *nv, *nval; old_value = perform_hostname_completion; @@ -245,13 +259,60 @@ enable_hostname_completion (on_or_off) { perform_hostname_completion = 1; rl_special_prefixes = "$@"; - rl_completer_word_break_characters = bash_completer_word_break_characters; } else { perform_hostname_completion = 0; rl_special_prefixes = "$"; - rl_completer_word_break_characters = bash_nohostname_word_break_characters; + } + + /* Now we need to figure out how to appropriately modify and assign + rl_completer_word_break_characters depending on whether we want + hostname completion on or off. */ + + /* If this is the first time this has been called + (bash_readline_initialized == 0), use the sames values as before, but + allocate new memory for rl_completer_word_break_characters. */ + + if (bash_readline_initialized == 0 && + (rl_completer_word_break_characters == 0 || + rl_completer_word_break_characters == rl_basic_word_break_characters)) + { + if (on_or_off) + rl_completer_word_break_characters = savestring (bash_completer_word_break_characters); + else + rl_completer_word_break_characters = savestring (bash_nohostname_word_break_characters); + } + else + { + /* See if we have anything to do. */ + at = strchr (rl_completer_word_break_characters, '@'); + if ((at == 0 && on_or_off == 0) || (at != 0 && on_or_off != 0)) + return; + + /* We have something to do. Do it. */ + nval = (char *)xmalloc (strlen (rl_completer_word_break_characters) + 1 + on_or_off); + + if (on_or_off == 0) + { + /* Turn it off -- just remove `@' from word break chars. We want + to remove all occurrences of `@' from the char list, so we loop + rather than just copy the rest of the list over AT. */ + for (nv = nval, at = rl_completer_word_break_characters; *at; ) + if (*at != '@') + *nv++ = *at++; + else + at++; + *nv = '\0'; + } + else + { + nval[0] = '@'; + strcpy (nval + 1, rl_completer_word_break_characters); + } + + free (rl_completer_word_break_characters); + rl_completer_word_break_characters = nval; } return (old_value); @@ -320,15 +381,14 @@ initialize_readline () rl_initialize (); /* Bind up our special shell functions. */ - rl_bind_key_in_map (CTRL('E'), shell_expand_line, emacs_meta_keymap); + rl_bind_key_if_unbound_in_map (CTRL('E'), shell_expand_line, emacs_meta_keymap); - /* Bind up our special shell functions. */ #ifdef BANG_HISTORY - rl_bind_key_in_map ('^', history_expand_line, emacs_meta_keymap); + rl_bind_key_if_unbound_in_map ('^', history_expand_line, emacs_meta_keymap); #endif - rl_bind_key_in_map (CTRL ('O'), operate_and_get_next, emacs_standard_keymap); - rl_bind_key_in_map (CTRL ('V'), display_shell_version, emacs_ctlx_keymap); + rl_bind_key_if_unbound_in_map (CTRL ('O'), operate_and_get_next, emacs_standard_keymap); + rl_bind_key_if_unbound_in_map (CTRL ('V'), display_shell_version, emacs_ctlx_keymap); /* In Bash, the user can switch editing modes with "set -o [vi emacs]", so it is not necessary to allow C-M-j for context switching. Turn @@ -340,32 +400,32 @@ initialize_readline () #endif #if defined (BRACE_COMPLETION) - rl_bind_key_in_map ('{', bash_brace_completion, emacs_meta_keymap); + rl_bind_key_if_unbound_in_map ('{', bash_brace_completion, emacs_meta_keymap); /*}*/ #endif /* BRACE_COMPLETION */ #if defined (SPECIFIC_COMPLETION_FUNCTIONS) - rl_bind_key_in_map ('/', bash_complete_filename, emacs_meta_keymap); - rl_bind_key_in_map ('/', bash_possible_filename_completions, emacs_ctlx_keymap); + rl_bind_key_if_unbound_in_map ('/', bash_complete_filename, emacs_meta_keymap); + rl_bind_key_if_unbound_in_map ('/', bash_possible_filename_completions, emacs_ctlx_keymap); - rl_bind_key_in_map ('~', bash_complete_username, emacs_meta_keymap); - rl_bind_key_in_map ('~', bash_possible_username_completions, emacs_ctlx_keymap); + rl_bind_key_if_unbound_in_map ('~', bash_complete_username, emacs_meta_keymap); + rl_bind_key_if_unbound_in_map ('~', bash_possible_username_completions, emacs_ctlx_keymap); - rl_bind_key_in_map ('@', bash_complete_hostname, emacs_meta_keymap); - rl_bind_key_in_map ('@', bash_possible_hostname_completions, emacs_ctlx_keymap); + rl_bind_key_if_unbound_in_map ('@', bash_complete_hostname, emacs_meta_keymap); + rl_bind_key_if_unbound_in_map ('@', bash_possible_hostname_completions, emacs_ctlx_keymap); - rl_bind_key_in_map ('$', bash_complete_variable, emacs_meta_keymap); - rl_bind_key_in_map ('$', bash_possible_variable_completions, emacs_ctlx_keymap); + rl_bind_key_if_unbound_in_map ('$', bash_complete_variable, emacs_meta_keymap); + rl_bind_key_if_unbound_in_map ('$', bash_possible_variable_completions, emacs_ctlx_keymap); - rl_bind_key_in_map ('!', bash_complete_command, emacs_meta_keymap); - rl_bind_key_in_map ('!', bash_possible_command_completions, emacs_ctlx_keymap); + rl_bind_key_if_unbound_in_map ('!', bash_complete_command, emacs_meta_keymap); + rl_bind_key_if_unbound_in_map ('!', bash_possible_command_completions, emacs_ctlx_keymap); - rl_bind_key_in_map ('g', bash_glob_complete_word, emacs_meta_keymap); - 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_bind_key_if_unbound_in_map ('g', bash_glob_complete_word, emacs_meta_keymap); + rl_bind_key_if_unbound_in_map ('*', bash_glob_expand_word, emacs_ctlx_keymap); + rl_bind_key_if_unbound_in_map ('g', bash_glob_list_expansions, emacs_ctlx_keymap); #endif /* SPECIFIC_COMPLETION_FUNCTIONS */ - rl_bind_key_in_map (TAB, dynamic_complete_history, emacs_meta_keymap); + rl_bind_key_if_unbound_in_map (TAB, dynamic_complete_history, emacs_meta_keymap); /* Tell the completer that we want a crack first. */ rl_attempted_completion_function = attempt_shell_completion; @@ -378,11 +438,11 @@ initialize_readline () rl_ignore_some_completions_function = filename_completion_ignore; /* Bind C-xC-e to invoke emacs and run result as commands. */ - rl_bind_key_in_map (CTRL ('E'), emacs_edit_and_execute_command, emacs_ctlx_keymap); + rl_bind_key_if_unbound_in_map (CTRL ('E'), emacs_edit_and_execute_command, emacs_ctlx_keymap); #if defined (VI_MODE) - rl_bind_key_in_map ('v', vi_edit_and_execute_command, vi_movement_keymap); + rl_bind_key_if_unbound_in_map ('v', 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_if_unbound_in_map ('@', posix_edit_macros, vi_movement_keymap); # endif #endif @@ -708,8 +768,8 @@ operate_and_get_next (count, c) command being entered (if no explicit argument is given), otherwise on a command from the history file. */ -#define VI_EDIT_COMMAND "fc -e ${VISUAL:-${EDITOR:-vi}}" -#define EMACS_EDIT_COMMAND "fc -e ${VISUAL:-${EDITOR:-emacs}}" +#define VI_EDIT_COMMAND "fc -e \"${VISUAL:-${EDITOR:-vi}}\"" +#define EMACS_EDIT_COMMAND "fc -e \"${VISUAL:-${EDITOR:-emacs}}\"" static int edit_and_execute_command (count, c, editing_mode, edit_command) @@ -810,6 +870,7 @@ posix_edit_macros (count, key) /* **************************************************************** */ #define COMMAND_SEPARATORS ";|&{(`" +/* )} */ static int check_redir (ti) @@ -1008,11 +1069,27 @@ attempt_shell_completion (text, start, end) matches = rl_completion_matches (text, prog_complete_return); if ((foundcs & COPT_DEFAULT) == 0) rl_attempted_completion_over = 1; /* no default */ - return (matches); + if (matches || ((foundcs & COPT_BASHDEFAULT) == 0)) + return (matches); } } #endif + if (matches == 0) + matches = bash_default_completion (text, start, end, qc, in_command_position); + + return matches; +} + +char ** +bash_default_completion (text, start, end, qc, in_command_position) + const char *text; + int start, end, qc, in_command_position; +{ + char **matches; + + matches = (char **)NULL; + /* New posix-style command substitution or variable name? */ if (!matches && *text == '$') { @@ -1044,7 +1121,10 @@ attempt_shell_completion (text, start, end) } else { +#define CMD_IS_DIR(x) (absolute_pathname(x) == 0 && absolute_program(x) == 0 && *(x) != '~' && test_for_directory (x)) + matches = rl_completion_matches (text, command_word_completion_function); + /* If we are attempting command completion and nothing matches, we do not want readline to perform filename completion for us. We still want to be able to complete partial pathnames, so set the @@ -1052,7 +1132,8 @@ attempt_shell_completion (text, start, end) filenames and leave directories in the match list. */ if (matches == (char **)NULL) rl_ignore_some_completions_function = bash_ignore_filenames; - else if (matches[1] == 0 && *matches[0] != '/') +#if 0 + else if (matches[1] == 0 && CMD_IS_DIR(matches[0])) /* Turn off rl_filename_completion_desired so readline doesn't append a slash if there is a directory with the same name in the current directory, or other filename-specific things. @@ -1061,7 +1142,7 @@ attempt_shell_completion (text, start, end) looking in the current directory anyway, so there's no conflict. */ rl_filename_completion_desired = 0; - else if (matches[0] && matches[1] && STREQ (matches[0], matches[1]) && *matches[0] != '/') + else if (matches[0] && matches[1] && STREQ (matches[0], matches[1]) && CMD_IS_DIR (matches[0])) /* There are multiple instances of the same match (duplicate completions haven't yet been removed). In this case, all of the matches will be the same, and the duplicate removal code @@ -1071,6 +1152,7 @@ attempt_shell_completion (text, start, end) completion. If there are multiple completions this won't make a difference and the problem won't occur. */ rl_filename_completion_desired = 0; +#endif } } @@ -1631,8 +1713,13 @@ history_expand_line_internal (line) char *line; { char *new_line; + int old_verify; + old_verify = hist_verify; + hist_verify = 0; new_line = pre_process_line (line, 0, 0); + hist_verify = old_verify; + return (new_line == line) ? savestring (line) : new_line; } #endif @@ -1643,9 +1730,18 @@ static void cleanup_expansion_error () { char *to_free; +#if defined (BANG_HISTORY) + int old_verify; + + old_verify = hist_verify; + hist_verify = 0; +#endif fprintf (rl_outstream, "\r\n"); to_free = pre_process_line (rl_line_buffer, 1, 0); +#if defined (BANG_HISTORY) + hist_verify = old_verify; +#endif if (to_free != rl_line_buffer) free (to_free); putc ('\r', rl_outstream); @@ -1773,9 +1869,7 @@ history_and_alias_expand_line (count, ignore) { char *new_line; - new_line = pre_process_line (rl_line_buffer, 0, 0); - if (new_line == rl_line_buffer) - new_line = savestring (new_line); + new_line = history_expand_line_internal (rl_line_buffer); #if defined (ALIAS) if (new_line) @@ -1811,9 +1905,7 @@ shell_expand_line (count, ignore) char *new_line; WORD_LIST *expanded_string; - new_line = pre_process_line (rl_line_buffer, 0, 0); - if (new_line == rl_line_buffer) - new_line = savestring (new_line); + new_line = history_expand_line_internal (rl_line_buffer); #if defined (ALIAS) if (new_line) @@ -1873,10 +1965,6 @@ shell_expand_line (count, ignore) } } -/* Define NO_FORCE_FIGNORE if you want to match filenames that would - otherwise be ignored if they are the only possible matches. */ -/* #define NO_FORCE_FIGNORE */ - /* If FIGNORE is set, then don't match files with the given suffixes when completing filenames. If only one of the possibilities has an acceptable suffix, delete the others, else just return and let the completer @@ -1901,10 +1989,8 @@ _ignore_completion_names (names, name_func) { char **newnames; int idx, nidx; -#ifdef NO_FORCE_FIGNORE char **oldnames; int oidx; -#endif /* If there is only one completion, see if it is acceptable. If it is not, free it up. In any case, short-circuit and return. This is a @@ -1912,13 +1998,13 @@ _ignore_completion_names (names, name_func) if there is only one completion; it is the completion itself. */ if (names[1] == (char *)0) { -#ifndef NO_FORCE_FIGNORE - if ((*name_func) (names[0]) == 0) - { - free (names[0]); - names[0] = (char *)NULL; - } -#endif + if (force_fignore) + if ((*name_func) (names[0]) == 0) + { + free (names[0]); + names[0] = (char *)NULL; + } + return; } @@ -1927,22 +2013,22 @@ _ignore_completion_names (names, name_func) for (nidx = 1; names[nidx]; nidx++) ; newnames = strvec_create (nidx + 1); -#ifdef NO_FORCE_FIGNORE - oldnames = strvec_create (nidx - 1); - oidx = 0; -#endif + + if (force_fignore == 0) + { + oldnames = strvec_create (nidx - 1); + oidx = 0; + } newnames[0] = names[0]; for (idx = nidx = 1; names[idx]; idx++) { if ((*name_func) (names[idx])) newnames[nidx++] = names[idx]; + else if (force_fignore == 0) + oldnames[oidx++] = names[idx]; else -#ifndef NO_FORCE_FIGNORE free (names[idx]); -#else - oldnames[oidx++] = names[idx]; -#endif } newnames[nidx] = (char *)NULL; @@ -1950,21 +2036,24 @@ _ignore_completion_names (names, name_func) /* If none are acceptable then let the completer handle it. */ if (nidx == 1) { -#ifndef NO_FORCE_FIGNORE - free (names[0]); - names[0] = (char *)NULL; -#else - free (oldnames); -#endif + if (force_fignore) + { + free (names[0]); + names[0] = (char *)NULL; + } + else + free (oldnames); + free (newnames); return; } -#ifdef NO_FORCE_FIGNORE - while (oidx) - free (oldnames[--oidx]); - free (oldnames); -#endif + if (force_fignore == 0) + { + while (oidx) + free (oldnames[--oidx]); + free (oldnames); + } /* If only one is acceptable, copy it to names[0] and return. */ if (nidx == 2) @@ -2292,7 +2381,7 @@ bash_complete_filename_internal (what_to_do) rl_compentry_func_t *orig_func; rl_completion_func_t *orig_attempt_func; rl_icppfunc_t *orig_dir_func; - const char *orig_rl_completer_word_break_characters; + /*const*/ char *orig_rl_completer_word_break_characters; int r; orig_func = rl_completion_entry_function; @@ -2676,8 +2765,7 @@ bash_execute_unix_command (count, key) Keymap xkmap; /* unix command executing keymap */ register int i; char *cmd; - int old_line_count; - int *ts; + sh_parser_state_t ps; /* First, we need to find the right command to execute. This is tricky, because we might have already indirected into another keymap. */ @@ -2713,14 +2801,12 @@ bash_execute_unix_command (count, key) rl_crlf (); /* move to a new line */ - old_line_count = current_command_line_count; - ts = save_token_state (); + save_parser_state (&ps); cmd = savestring (cmd); parse_and_execute (cmd, "bash_execute_unix_command", SEVAL_NOHIST); - current_command_line_count = old_line_count; - restore_token_state (ts); + restore_parser_state (&ps); /* and restore the readline buffer and display after command execution. */ rl_forced_update_display (); @@ -2825,7 +2911,7 @@ bind_keyseq_to_unix_command (line) /* and bind the key sequence in the current keymap to a function that understands how to execute from CMD_XMAP */ - rl_set_key (kseq, bash_execute_unix_command, kmap); + rl_bind_keyseq_in_map (kseq, bash_execute_unix_command, kmap); return 0; } @@ -2854,4 +2940,16 @@ bash_directory_completion_matches (text) (void)bash_ignore_filenames (m1); return m1; } + +char * +bash_dequote_text (text) + const char *text; +{ + char *dtxt; + int qc; + + qc = (text[0] == '"' || text[0] == '\'') ? text[0] : 0; + dtxt = bash_dequote_filename ((char *)text, qc); + return (dtxt); +} #endif /* READLINE */ @@ -33,6 +33,8 @@ extern int bash_re_edit __P((char *)); extern int bind_keyseq_to_unix_command __P((char *)); +extern char **bash_default_completion __P((const char *, int, int, int, int)); + /* Used by programmable completion code. */ extern char *command_word_completion_function __P((const char *, int)); extern char *bash_groupname_completion_function __P((const char *, int)); @@ -42,5 +44,6 @@ extern char **get_hostname_list __P((void)); extern void clear_hostname_list __P((void)); extern char **bash_directory_completion_matches __P((const char *)); +extern char *bash_dequote_text __P((const char *)); #endif /* _BASHLINE_H_ */ @@ -1,6 +1,6 @@ /* braces.c -- code for doing word expansion in curly braces. */ -/* Copyright (C) 1987-2002 Free Software Foundation, Inc. +/* Copyright (C) 1987-2003 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -39,9 +39,12 @@ #include "general.h" #include "shmbutil.h" +#include "chartypes.h" #define brace_whitespace(c) (!(c) || (c) == ' ' || (c) == '\t' || (c) == '\n') +#define BRACE_SEQ_SPECIFIER ".." + /* Basic idea: Segregate the text into 3 sections: preamble (stuff before an open brace), @@ -56,11 +59,15 @@ int brace_arg_separator = ','; #if defined (__P) static int brace_gobbler __P((char *, size_t, int *, int)); -static char **expand_amble __P((char *, size_t)); +static char **expand_amble __P((char *, size_t, int)); +static char **expand_seqterm __P((char *, size_t)); +static char **mkseq __P((int, int, int)); static char **array_concat __P((char **, char **)); #else static int brace_gobbler (); static char **expand_amble (); +static char **expand_seqterm (); +static char **mkseq(); static char **array_concat (); #endif @@ -161,22 +168,29 @@ brace_expand (text) ADVANCE_CHAR (amble, alen, j); } - if (!amble[j]) + if (amble[j] == 0) { - free (amble); - free (preamble); - result[0] = savestring (text); - return (result); + tack = expand_seqterm (amble, alen); + if (tack) + goto add_tack; + else + { + free (amble); + free (preamble); + result[0] = savestring (text); + return (result); + } } #endif /* SHELL */ - postamble = &text[i + 1]; - - tack = expand_amble (amble, alen); + tack = expand_amble (amble, alen, 0); +add_tack: result = array_concat (result, tack); free (amble); strvec_dispose (tack); + postamble = text + i + 1; + tack = brace_expand (postamble); result = array_concat (result, tack); strvec_dispose (tack); @@ -189,9 +203,10 @@ brace_expand (text) expand each slot which needs it, until there are no more slots which need it. */ static char ** -expand_amble (text, tlen) +expand_amble (text, tlen, flags) char *text; size_t tlen; + int flags; { char **result, **partial; char *tem; @@ -220,9 +235,10 @@ expand_amble (text, tlen) result = partial; else { - register int lr = strvec_len (result); - register int lp = strvec_len (partial); - register int j; + register int lr, lp, j; + + lr = strvec_len (result); + lp = strvec_len (partial); result = strvec_resize (result, lp + lr + 1); @@ -239,6 +255,108 @@ expand_amble (text, tlen) return (result); } +#define ST_BAD 0 +#define ST_INT 1 +#define ST_CHAR 2 + +static char ** +mkseq (start, end, type) + int start, end, type; +{ + int n, incr, i; + char **result, *t; + + n = abs (end - start) + 1; + result = strvec_create (n + 1); + + incr = (start < end) ? 1 : -1; + + /* Make sure we go through the loop at least once, so {3..3} prints `3' */ + i = 0; + n = start; + do + { + if (type == ST_INT) + result[i++] = itos (n); + else + { + t = (char *)xmalloc (2); + t[0] = n; + t[1] = '\0'; + result[i++] = t; + } + if (n == end) + break; + n += incr; + } + while (1); + + result[i] = (char *)0; + return (result); +} + +static char ** +expand_seqterm (text, tlen) + char *text; + size_t tlen; +{ + char *t, *lhs, *rhs; + int i, lhs_t, rhs_t, lhs_v, rhs_v; + intmax_t tl, tr; + char **result; + + t = strstr (text, BRACE_SEQ_SPECIFIER); + if (t == 0) + return ((char **)NULL); + + i = t - text; /* index of start of BRACE_SEQ_SPECIFIER */ + lhs = substring (text, 0, i); + rhs = substring (text, i + sizeof(BRACE_SEQ_SPECIFIER) - 1, tlen); + + if (lhs[0] == 0 || rhs[0] == 0) + { + free (lhs); + free (rhs); + return ((char **)NULL); + } + + /* Now figure out whether LHS and RHS are integers or letters. Both + sides have to match. */ + lhs_t = (legal_number (lhs, &tl)) ? ST_INT : + ((ISALPHA (lhs[0]) && lhs[1] == 0) ? ST_CHAR : ST_BAD); + rhs_t = (legal_number (rhs, &tr)) ? ST_INT : + ((ISALPHA (rhs[0]) && rhs[1] == 0) ? ST_CHAR : ST_BAD); + + if (lhs_t != rhs_t || lhs_t == ST_BAD || rhs_t == ST_BAD) + { + free (lhs); + free (rhs); + return ((char **)NULL); + } + + /* OK, we have something. It's either a sequence of integers, ascending + or descending, or a sequence or letters, ditto. Generate the sequence, + put it into a string vector, and return it. */ + + if (lhs_t == ST_CHAR) + { + lhs_v = lhs[0]; + rhs_v = rhs[0]; + } + else + { + lhs_v = tl; /* integer truncation */ + rhs_v = tr; + } + + result = mkseq (lhs_v, rhs_v, lhs_t); + + free (lhs); + free (rhs); + + return (result); +} + /* Start at INDEX, and skip characters in TEXT. Set INDEX to the index of the character matching SATISFY. This understands about quoting. Return the character that caused us to stop searching; @@ -278,6 +396,16 @@ brace_gobbler (text, tlen, indx, satisfy) continue; } +#if defined (SHELL) + /* If compiling for the shell, treat ${...} like \{...} */ + if (c == '$' && text[i+1] == '{' && quoted != '\'') /* } */ + { + pass_next = 1; + i++; + continue; + } +#endif + if (quoted) { if (c == quoted) @@ -318,11 +446,7 @@ brace_gobbler (text, tlen, indx, satisfy) i++; continue; } -#if defined (SHELL) - /* If this is being compiled as part of bash, ignore the `{' - in a `${}' construct */ - if ((c != '{') || i == 0 || (text[i - 1] != '$')) -#endif /* SHELL */ + break; } @@ -368,8 +492,7 @@ array_concat (arr1, arr2) for (j = 0; j < len2; j++) { - result[len] = - (char *)xmalloc (1 + strlen_1 + strlen (arr2[j])); + result[len] = (char *)xmalloc (1 + strlen_1 + strlen (arr2[j])); strcpy (result[len], arr1[i]); strcpy (result[len] + strlen_1, arr2[j]); len++; diff --git a/builtins/Makefile.in b/builtins/Makefile.in index 53ae75ac..ce650e7b 100644 --- a/builtins/Makefile.in +++ b/builtins/Makefile.in @@ -106,7 +106,8 @@ RL_LIBSRC = $(topdir)/lib/readline $(CC) -c $(CCFLAGS) $< DEFSRC = $(srcdir)/alias.def $(srcdir)/bind.def $(srcdir)/break.def \ - $(srcdir)/builtin.def $(srcdir)/cd.def $(srcdir)/colon.def \ + $(srcdir)/builtin.def $(srcdir)/caller.def \ + $(srcdir)/cd.def $(srcdir)/colon.def \ $(srcdir)/command.def $(srcdir)/declare.def $(srcdir)/echo.def \ $(srcdir)/enable.def $(srcdir)/eval.def $(srcdir)/getopts.def \ $(srcdir)/exec.def $(srcdir)/exit.def $(srcdir)/fc.def \ @@ -124,7 +125,7 @@ STATIC_SOURCE = common.c evalstring.c evalfile.c getopt.c bashgetopt.c \ getopt.h OFILES = builtins.o \ - alias.o bind.o break.o builtin.o cd.o colon.o command.o \ + alias.o bind.o break.o builtin.o caller.o cd.o colon.o command.o \ common.o declare.o echo.o enable.o eval.o evalfile.o \ evalstring.o exec.o \ exit.o fc.o fg_bg.o hash.o help.o history.o jobs.o kill.o let.o \ @@ -214,10 +215,14 @@ distclean maintainer-clean: clean $(OFILES): $(MKBUILTINS) ../config.h +../version.h: ../config.h ../Makefile Makefile + -( cd ${BUILD_DIR} && ${MAKE} ${MFLAGS} version.h ) + alias.o: alias.def bind.o: bind.def break.o: break.def builtin.o: builtin.def +caller.o: caller.def cd.o: cd.def colon.o: colon.def command.o: command.def @@ -263,7 +268,7 @@ bashgetopt.o: $(topdir)/command.h $(topdir)/general.h $(topdir)/xmalloc.h $(topd bashgetopt.o: $(topdir)/variables.h $(topdir)/conftypes.h $(topdir)/quit.h $(BASHINCDIR)/maxpath.h bashgetopt.o: $(topdir)/unwind_prot.h $(topdir)/dispose_cmd.h bashgetopt.o: $(topdir)/make_cmd.h $(topdir)/subst.h $(topdir)/sig.h -bashgetopt.o: $(topdir)/pathnames.h $(topdir)/externs.h $(srcdir)/common.h +bashgetopt.o: ../pathnames.h $(topdir)/externs.h $(srcdir)/common.h bashgetopt.o: $(BASHINCDIR)/chartypes.h common.o: $(topdir)/bashtypes.h $(BASHINCDIR)/posixstat.h $(topdir)/bashansi.h $(BASHINCDIR)/ansi_stdlib.h common.o: $(topdir)/shell.h $(topdir)/syntax.h ../config.h $(topdir)/bashjmp.h $(BASHINCDIR)/posixjmp.h @@ -274,7 +279,7 @@ common.o: $(topdir)/siglist.h $(topdir)/bashhist.h $(topdir)/quit.h common.o: $(topdir)/unwind_prot.h $(BASHINCDIR)/maxpath.h $(topdir)/jobs.h common.o: $(topdir)/builtins.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h common.o: $(topdir)/subst.h $(topdir)/execute_cmd.h $(topdir)/error.h -common.o: $(topdir)/externs.h $(topdir)/pathnames.h ./builtext.h +common.o: $(topdir)/externs.h ../pathnames.h ./builtext.h common.o: $(BASHINCDIR)/chartypes.h evalfile.o: $(topdir)/bashtypes.h $(BASHINCDIR)/posixstat.h ${BASHINCDIR}/filecntl.h evalfile.o: $(topdir)/bashansi.h $(BASHINCDIR)/ansi_stdlib.h @@ -283,7 +288,7 @@ evalfile.o: $(topdir)/command.h $(topdir)/general.h $(topdir)/xmalloc.h $(topdir evalfile.o: $(topdir)/variables.h $(topdir)/conftypes.h $(topdir)/quit.h $(BASHINCDIR)/maxpath.h evalfile.o: $(topdir)/unwind_prot.h $(topdir)/dispose_cmd.h evalfile.o: $(topdir)/make_cmd.h $(topdir)/subst.h $(topdir)/sig.h -evalfile.o: $(topdir)/pathnames.h $(topdir)/externs.h +evalfile.o: ../pathnames.h $(topdir)/externs.h evalfile.o: $(topdir)/jobs.h $(topdir)/builtins.h $(topdir)/flags.h evalfile.o: $(topdir)/input.h $(topdir)/execute_cmd.h evalfile.o: $(topdir)/bashhist.h $(srcdir)/common.h @@ -303,8 +308,8 @@ getopt.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/bashjmp.h $(topdir)/com getopt.o: $(topdir)/general.h $(topdir)/xmalloc.h $(topdir)/error.h $(topdir)/variables.h $(topdir)/conftypes.h getopt.o: $(topdir)/quit.h $(BASHINCDIR)/maxpath.h $(topdir)/unwind_prot.h getopt.o: $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h $(topdir)/subst.h -getopt.o: $(topdir)/sig.h $(topdir)/pathnames.h $(topdir)/externs.h -getopt.o: $(srcdir)/getopt.h +getopt.o: $(topdir)/sig.h ../pathnames.h $(topdir)/externs.h +getopt.o: $(srcdir)/getopt.h mkbuiltins.o: ../config.h $(topdir)/bashtypes.h $(BASHINCDIR)/posixstat.h mkbuiltins.o: ${BASHINCDIR}/filecntl.h mkbuiltins.o: $(topdir)/bashansi.h $(BASHINCDIR)/ansi_stdlib.h @@ -331,6 +336,12 @@ builtin.o: $(topdir)/quit.h $(srcdir)/common.h $(BASHINCDIR)/maxpath.h builtin.o: $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h $(topdir)/subst.h builtin.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h builtin.o: $(srcdir)/bashgetopt.h +caller.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h $(topdir)/error.h +caller.o: $(topdir)/general.h $(topdir)/xmalloc.h $(topdir)/quit.h $(topdir)/dispose_cmd.h +caller.o: $(topdir)/make_cmd.h $(topdir)/subst.h $(topdir)/externs.h +caller.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h +caller.o: $(srcdir)/common.h $(BASHINCDIR)/maxpath.h ./builtext.h +caller.o: ${BASHINCDIR}/chartypes.h $(topdir)/bashtypes.h cd.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h $(topdir)/error.h cd.o: $(topdir)/general.h $(topdir)/xmalloc.h $(topdir)/quit.h $(topdir)/dispose_cmd.h cd.o: $(topdir)/make_cmd.h $(topdir)/subst.h $(topdir)/externs.h @@ -347,6 +358,7 @@ declare.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h declare.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h declare.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h declare.o: $(topdir)/arrayfunc.h $(srcdir)/bashgetopt.h +declare.o: ./builtext.h echo.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h $(topdir)/error.h echo.o: $(topdir)/general.h $(topdir)/xmalloc.h $(topdir)/subst.h $(topdir)/externs.h echo.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h @@ -362,7 +374,7 @@ enable.o: $(topdir)/pcomplete.h eval.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h eval.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h eval.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h -eval.o: $(topdir)/subst.h $(topdir)/externs.h +eval.o: $(topdir)/subst.h $(topdir)/externs.h eval.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h eval.o: $(BASHINCDIR)/maxpath.h exec.o: $(topdir)/bashtypes.h @@ -377,7 +389,7 @@ exit.o: $(topdir)/bashtypes.h exit.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h exit.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h exit.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h -exit.o: $(topdir)/subst.h $(topdir)/externs.h +exit.o: $(topdir)/subst.h $(topdir)/externs.h exit.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h exit.o: $(BASHINCDIR)/maxpath.h ./builtext.h fc.o: $(topdir)/bashtypes.h $(BASHINCDIR)/posixstat.h @@ -416,7 +428,7 @@ history.o: $(topdir)/bashtypes.h history.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h history.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h history.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h -history.o: $(topdir)/subst.h $(topdir)/externs.h +history.o: $(topdir)/subst.h $(topdir)/externs.h history.o: ${BASHINCDIR}/filecntl.h $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h history.o: $(topdir)/variables.h $(topdir)/conftypes.h $(topdir)/bashhist.h $(BASHINCDIR)/maxpath.h inlib.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h @@ -426,7 +438,7 @@ inlib.o: $(BASHINCDIR)/maxpath.h $(topdir)/subst.h $(topdir)/externs.h inlib.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h jobs.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h $(topdir)/error.h jobs.o: $(topdir)/general.h $(topdir)/xmalloc.h $(topdir)/quit.h $(srcdir)/bashgetopt.h -jobs.o: $(BASHINCDIR)/maxpath.h $(topdir)/externs.h +jobs.o: $(BASHINCDIR)/maxpath.h $(topdir)/externs.h jobs.o: $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h $(topdir)/subst.h jobs.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h kill.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h $(topdir)/error.h @@ -443,13 +455,13 @@ printf.o: ../config.h $(BASHINCDIR)/memalloc.h $(topdir)/bashjmp.h printf.o: $(topdir)/command.h $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h printf.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h printf.o: $(topdir)/subst.h $(topdir)/externs.h $(topdir)/sig.h -printf.o: $(topdir)/pathnames.h $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h +printf.o: ../pathnames.h $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h printf.o: $(topdir)/variables.h $(topdir)/conftypes.h $(BASHINCDIR)/stdc.h $(srcdir)/bashgetopt.h printf.o: $(topdir)/bashtypes.h ${srcdir}/common.h $(BASHINCDIR)/chartypes.h pushd.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h pushd.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h pushd.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h -pushd.o: $(topdir)/subst.h $(topdir)/externs.h +pushd.o: $(topdir)/subst.h $(topdir)/externs.h pushd.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h pushd.o: $(BASHINCDIR)/maxpath.h $(srcdir)/common.h ./builtext.h read.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h @@ -474,7 +486,7 @@ setattr.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h setattr.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h $(BASHINCDIR)/maxpath.h setattr.o: $(topdir)/quit.h $(srcdir)/common.h $(srcdir)/bashgetopt.h setattr.o: $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h $(topdir)/subst.h -setattr.o: $(topdir)/externs.h +setattr.o: $(topdir)/externs.h setattr.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h setattr.o: $(topdir)/arrayfunc.h shift.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h @@ -487,7 +499,7 @@ source.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h $(topdir)/fi source.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h source.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h source.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h -source.o: $(srcdir)/bashgetopt.h +source.o: $(srcdir)/bashgetopt.h $(topdir)/flags.h $(topdir)/trap.h suspend.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h suspend.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h suspend.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h @@ -541,7 +553,7 @@ shopt.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h shopt.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h shopt.o: $(srcdir)/common.h $(srcdir)/bashgetopt.h -complete.o: ../config.h +complete.o: ../config.h complete.o: ${topdir}/shell.h $(topdir)/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h ${topdir}/sig.h complete.o: ${topdir}/unwind_prot.h ${topdir}/variables.h complete.o: ${topdir}/bashtypes.h ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h diff --git a/builtins/alias.def b/builtins/alias.def index f51df948..5c7ed3d5 100644 --- a/builtins/alias.def +++ b/builtins/alias.def @@ -51,17 +51,23 @@ $END # include "common.h" # include "bashgetopt.h" -static void print_alias __P((alias_t *)); +/* Flags for print_alias */ +#define AL_REUSABLE 0x01 + +static void print_alias __P((alias_t *, int)); + +extern int posixly_correct; /* Hack the alias command in a Korn shell way. */ int alias_builtin (list) WORD_LIST *list; { - int any_failed, offset, pflag; + int any_failed, offset, pflag, dflags; alias_t **alias_list, *t; char *name, *value; + dflags = posixly_correct ? 0 : AL_REUSABLE; pflag = 0; reset_internal_getopt (); while ((offset = internal_getopt (list, "p")) != -1) @@ -70,6 +76,7 @@ alias_builtin (list) { case 'p': pflag = 1; + dflags |= AL_REUSABLE; break; default: builtin_usage (); @@ -90,7 +97,7 @@ alias_builtin (list) return (EXECUTION_SUCCESS); for (offset = 0; alias_list[offset]; offset++) - print_alias (alias_list[offset]); + print_alias (alias_list[offset], dflags); free (alias_list); /* XXX - Do not free the strings. */ @@ -117,7 +124,7 @@ alias_builtin (list) { t = find_alias (name); if (t) - print_alias (t); + print_alias (t, dflags); else { sh_notfound (name); @@ -192,13 +199,16 @@ unalias_builtin (list) /* Output ALIAS in such a way as to allow it to be read back in. */ static void -print_alias (alias) +print_alias (alias, flags) alias_t *alias; + int flags; { char *value; value = sh_single_quote (alias->value); - printf ("alias %s=%s\n", alias->name, value); + if (flags & AL_REUSABLE) + printf ("alias "); + printf ("%s=%s\n", alias->name, value); free (value); fflush (stdout); diff --git a/builtins/caller.def b/builtins/caller.def new file mode 100644 index 00000000..868b2ee8 --- /dev/null +++ b/builtins/caller.def @@ -0,0 +1,146 @@ +This file is caller.def, from which is created caller.c. It implements the +builtin "caller" in Bash. + +Copyright (C) 2002 Rocky Bernstein for Free Software Foundation, Inc. + +This file is part of GNU Bash, the Bourne Again SHell. + +Bash is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. + +Bash is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License along +with Bash; see the file COPYING. If not, write to the Free Software +Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. + +$PRODUCES caller.c + +$BUILTIN caller +$FUNCTION caller_builtin +$DEPENDS_ON DEBUGGER +$SHORT_DOC caller [EXPR] + +Returns the context of the current subroutine call. + +Without EXPR, returns returns "$line $filename". With EXPR, +returns "$line $subroutine $filename"; this extra information +can be used used to provide a stack trace. + +The value of EXPR indicates how many call frames to go back before the +current one; the top frame is frame 0. +$END + +#include <config.h> +#include <stdio.h> +#include "chartypes.h" +#include "bashtypes.h" + +#if defined (HAVE_UNISTD_H) +# ifdef _MINIX +# include <sys/types.h> +# endif +# include <unistd.h> +#endif + +#include <errno.h> + +#include "../shell.h" +#include "common.h" +#include "builtext.h" + +#ifdef LOADABLE_BUILTIN +# include "builtins.h" +#endif + +#if !defined (errno) +extern int errno; +#endif /* !errno */ + +int +caller_builtin (list) + WORD_LIST *list; +{ +#if !defined (ARRAY_VARS) + printf ("1 NULL\n"); + return (EXECUTION_FAILURE); +#else + SHELL_VAR *funcname_v, *bash_source_v, *bash_lineno_v; + ARRAY *funcname_a, *bash_source_a, *bash_lineno_a; + char *funcname_s, *source_s, *lineno_s; + ARRAY_ELEMENT *ae; + intmax_t num; + + GET_ARRAY_FROM_VAR ("FUNCNAME", funcname_v, funcname_a); + GET_ARRAY_FROM_VAR ("BASH_SOURCE", bash_source_v, bash_source_a); + GET_ARRAY_FROM_VAR ("BASH_LINENO", bash_lineno_v, bash_lineno_a); + + if (bash_lineno_a == 0 || array_empty (bash_lineno_a)) + return (EXECUTION_FAILURE); + + if (bash_source_a == 0 || array_empty (bash_source_a)) + return (EXECUTION_FAILURE); + + /* If there is no argument list, then give short form: line filename. */ + if (list == 0) + { + lineno_s = array_reference (bash_lineno_a, 0); + source_s = array_reference (bash_source_a, 1); + printf("%s %s\n", lineno_s ? lineno_s : "NULL", source_s ? source_s : "NULL"); + return (EXECUTION_SUCCESS); + } + + if (funcname_a == 0 || array_empty (funcname_a)) + return (EXECUTION_FAILURE); + + if (legal_number (list->word->word, &num)) + { + lineno_s = array_reference (bash_lineno_a, num); + source_s = array_reference (bash_source_a, num+1); + funcname_s = array_reference (funcname_a, num+1); + + if (lineno_s == NULL|| source_s == NULL || funcname_s == NULL) + return (EXECUTION_FAILURE); + + printf("%s %s %s\n", lineno_s, funcname_s, source_s); + } + else + { + sh_invalidnum (list->word->word); + builtin_usage (); + return (EXECUTION_FAILURE); + } + + return (EXECUTION_SUCCESS); +#endif +} + + +#ifdef LOADABLE_BUILTIN +static char *caller_doc[] = { + "Returns the context of the current subroutine call.", + "", + "Without EXPR, returns returns \"$line $filename\". With EXPR,", + "returns \"$line $subroutine $filename\"; this extra information", + "can be used used to provide a stack trace.", + "", + "The value of EXPR indicates how many call frames to go back before the", + "current one; the top frame is frame 0.", + (char *)NULL +}; + +struct builtin caller_struct = { + "caller", + caller_builtin, + BUILTIN_ENABLED, + caller_doc, + "caller [EXPR]", + 0 +}; + +#endif /* LOADABLE_BUILTIN */ diff --git a/builtins/cd.def b/builtins/cd.def index 1c58c7c1..c13a78a5 100644 --- a/builtins/cd.def +++ b/builtins/cd.def @@ -199,7 +199,11 @@ cd_builtin (list) builtin_error ("OLDPWD not set"); return (EXECUTION_FAILURE); } +#if 0 lflag = interactive ? LCD_PRINTPATH : 0; +#else + lflag = LCD_PRINTPATH; /* According to SUSv3 */ +#endif } else if (absolute_pathname (list->word->word)) dirname = list->word->word; @@ -343,8 +347,10 @@ pwd_builtin (list) if (ferror (stdout)) { builtin_error ("write error: %s", strerror (errno)); + clearerr (stdout); return (EXECUTION_FAILURE); } + return (EXECUTION_SUCCESS); } else diff --git a/builtins/common.c b/builtins/common.c index b8186002..e780be5a 100644 --- a/builtins/common.c +++ b/builtins/common.c @@ -244,7 +244,7 @@ sh_nojobs (s) char *s; { if (s) - builtin_error ("%s: no job control"); + builtin_error ("%s: no job control", s); else builtin_error ("no job control"); } @@ -602,6 +602,9 @@ get_job_spec (list) } #endif /* JOB_CONTROL */ +/* + * NOTE: `kill' calls this function with forcecols == 0 + */ int display_signal_list (list, forcecols) WORD_LIST *list; @@ -609,8 +612,7 @@ display_signal_list (list, forcecols) { register int i, column; char *name; - int result; - int signum; + int result, signum, dflags; intmax_t lsignum; result = EXECUTION_SUCCESS; @@ -623,7 +625,13 @@ display_signal_list (list, forcecols) continue; if (posixly_correct && !forcecols) - printf ("%s%s", name, (i == NSIG - 1) ? "" : " "); + { + /* This is for the kill builtin. POSIX.2 says the signal names + are displayed without the `SIG' prefix. */ + if (STREQN (name, "SIG", 3)) + name += 3; + printf ("%s%s", name, (i == NSIG - 1) ? "" : " "); + } else { printf ("%2d) %s", i, name); @@ -677,7 +685,10 @@ display_signal_list (list, forcecols) } else { - signum = decode_signal (list->word->word); + dflags = DSIG_NOCASE; + if (posixly_correct == 0 || this_shell_builtin != kill_builtin) + dflags |= DSIG_SIGPREFIX; + signum = decode_signal (list->word->word, dflags); if (signum == NO_SIG) { sh_invalidsig (list->word->word); diff --git a/builtins/common.h b/builtins/common.h index a971bcda..c8438638 100644 --- a/builtins/common.h +++ b/builtins/common.h @@ -30,6 +30,7 @@ #define SEVAL_INTERACT 0x002 #define SEVAL_NOHIST 0x004 #define SEVAL_NOFREE 0x008 +#define SEVAL_RESETLINE 0x010 /* Flags for describe_command, shared between type.def and command.def */ #define CDESC_ALL 0x001 /* type -a */ @@ -105,6 +106,9 @@ extern sh_builtin_func_t *builtin_address __P((char *)); extern sh_builtin_func_t *find_special_builtin __P((char *)); extern void initialize_shell_builtins __P((void)); +/* Functions from exit.def */ +extern void bash_logout __P((void)); + /* Functions from getopts.def */ extern void getopts_reset __P((int)); @@ -150,7 +154,7 @@ extern void parse_and_execute_cleanup __P((void)); /* Functions from evalfile.c */ extern int maybe_execute_file __P((const char *, int)); -extern int source_file __P((const char *)); +extern int source_file __P((const char *, int)); extern int fc_execute_file __P((const char *)); #endif /* !__COMMON_H */ diff --git a/builtins/complete.def b/builtins/complete.def index f3916204..06f0c957 100644 --- a/builtins/complete.def +++ b/builtins/complete.def @@ -47,6 +47,7 @@ $END #include "../shell.h" #include "../builtins.h" #include "../pcomplete.h" +#include "../bashline.h" #include "common.h" #include "bashgetopt.h" @@ -106,10 +107,12 @@ static struct _compopt { char *optname; int optflag; } compopts[] = { + { "bashdefault", COPT_BASHDEFAULT }, { "default", COPT_DEFAULT }, { "dirnames", COPT_DIRNAMES }, { "filenames",COPT_FILENAMES}, { "nospace", COPT_NOSPACE }, + { "plusdirs", COPT_PLUSDIRS }, { (char *)NULL, 0 }, }; @@ -428,10 +431,12 @@ print_one_completion (cmd, cs) copts = cs->options; /* First, print the -o options. */ + PRINTCOMPOPT (COPT_BASHDEFAULT, "bashdefault"); PRINTCOMPOPT (COPT_DEFAULT, "default"); PRINTCOMPOPT (COPT_DIRNAMES, "dirnames"); PRINTCOMPOPT (COPT_FILENAMES, "filenames"); PRINTCOMPOPT (COPT_NOSPACE, "nospace"); + PRINTCOMPOPT (COPT_PLUSDIRS, "plusdirs"); acts = cs->actions; @@ -540,7 +545,7 @@ compgen_builtin (list) unsigned long acts, copts; COMPSPEC *cs; STRINGLIST *sl; - char *word; + char *word, **matches; if (list == 0) return (EXECUTION_SUCCESS); @@ -583,12 +588,19 @@ compgen_builtin (list) rval = EXECUTION_FAILURE; sl = gen_compspec_completions (cs, "compgen", word, 0, 0); + /* If the compspec wants the bash default completions, temporarily + turn off programmable completion and call the bash completion code. */ + if ((sl == 0 || sl->list_len == 0) && (copts & COPT_BASHDEFAULT)) + { + matches = bash_default_completion (word, 0, 0, 0, 0); + sl = completions_to_stringlist (matches); + strvec_dispose (matches); + } + /* This isn't perfect, but it's the best we can do, given what readline exports from its set of completion utility functions. */ if ((sl == 0 || sl->list_len == 0) && (copts & COPT_DEFAULT)) { - char **matches; - matches = rl_completion_matches (word, rl_filename_completion_function); sl = completions_to_stringlist (matches); strvec_dispose (matches); diff --git a/builtins/declare.def b/builtins/declare.def index 75b154f8..0b151498 100644 --- a/builtins/declare.def +++ b/builtins/declare.def @@ -1,7 +1,7 @@ This file is declare.def, from which is created declare.c. It implements the builtins "declare" and "local" in Bash. -Copyright (C) 1987-2002 Free Software Foundation, Inc. +Copyright (C) 1987-2003 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -23,7 +23,7 @@ $PRODUCES declare.c $BUILTIN declare $FUNCTION declare_builtin -$SHORT_DOC declare [-afFirtx] [-p] name[=value] ... +$SHORT_DOC declare [-afFirtx] [-p] [name[=value] ...] Declare variables and/or give them attributes. If no NAMEs are given, then display the values of variables instead. The -p option will display the attributes and values of each NAME. @@ -32,7 +32,8 @@ The flags are: -a to make NAMEs arrays (if supported) -f to select from among function names only - -F to display function names without definitions + -F to display function names (and line number and source file name if + debugging) without definitions -i to make NAMEs have the `integer' attribute -r to make NAMEs readonly -t to make NAMEs have the `trace' attribute @@ -120,6 +121,7 @@ declare_internal (list, local_var) int flags_on, flags_off, *flags, any_failed, assign_error, pflag, nodefs, opt; char *t, *subscript_start; SHELL_VAR *var; + FUNCTION_DEF *shell_fn; flags_on = flags_off = any_failed = assign_error = pflag = nodefs = 0; reset_internal_getopt (); @@ -309,9 +311,22 @@ declare_internal (list, local_var) /* declare -[Ff] name [name...] */ if (flags_on == att_function && flags_off == 0) { - t = nodefs ? var->name - : named_function_string (name, function_cell (var), 1); - printf ("%s\n", t); +#if defined (DEBUGGER) + if (nodefs && debugging_mode) + { + shell_fn = find_function_def (var->name); + if (shell_fn) + printf ("%s %d %s\n", var->name, shell_fn->line, shell_fn->source_file); + else + printf ("%s\n", var->name); + } + else +#endif /* DEBUGGER */ + { + t = nodefs ? var->name + : named_function_string (name, function_cell (var), 1); + printf ("%s\n", t); + } } else /* declare -[fF] -[rx] name [name...] */ { diff --git a/builtins/evalfile.c b/builtins/evalfile.c index 0675753e..850acbd6 100644 --- a/builtins/evalfile.c +++ b/builtins/evalfile.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996 Free Software Foundation, Inc. +/* Copyright (C) 1996-2003 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -58,6 +58,7 @@ extern int errno; #define FEVAL_HISTORY 0x020 #define FEVAL_CHECKBINARY 0x040 #define FEVAL_REGFILE 0x080 +#define FEVAL_NOPUSHARGS 0x100 extern int posixly_correct; extern int indirection_level, startup_state, subshell_environment; @@ -79,9 +80,28 @@ _evalfile (filename, flags) struct stat finfo; size_t file_size; sh_vmsg_func_t *errfunc; +#if defined (ARRAY_VARS) + SHELL_VAR *funcname_v, *bash_source_v, *bash_lineno_v; + ARRAY *funcname_a, *bash_source_a, *bash_lineno_a; +# if defined (DEBUGGER) + SHELL_VAR *bash_argv_v, *bash_argc_v; + ARRAY *bash_argv_a, *bash_argc_a; +# endif + char *t, tt[2]; +#endif USE_VAR(pflags); +#if defined (ARRAY_VARS) + GET_ARRAY_FROM_VAR ("FUNCNAME", funcname_v, funcname_a); + GET_ARRAY_FROM_VAR ("BASH_SOURCE", bash_source_v, bash_source_a); + GET_ARRAY_FROM_VAR ("BASH_LINENO", bash_lineno_v, bash_lineno_a); +# if defined (DEBUGGER) + GET_ARRAY_FROM_VAR ("BASH_ARGV", bash_argv_v, bash_argv_a); + GET_ARRAY_FROM_VAR ("BASH_ARGC", bash_argc_v, bash_argc_a); +# endif +#endif + fd = open (filename, O_RDONLY); if (fd < 0 || (fstat (fd, &finfo) == -1)) @@ -176,8 +196,27 @@ file_error_and_exit: return_catch_flag++; sourcelevel++; +#if defined (ARRAY_VARS) + array_push (bash_source_a, (char *)filename); + t = itos (executing_line_number ()); + array_push (bash_lineno_a, t); + free (t); + array_push (funcname_a, "source"); /* not exactly right */ +# if defined (DEBUGGER) + /* Have to figure out a better way to do this when `source' is supplied + arguments */ + if ((flags & FEVAL_NOPUSHARGS) == 0) + { + array_push (bash_argv_a, (char *)filename); + tt[0] = '1'; tt[1] = '\0'; + array_push (bash_argc_a, tt); + } +# endif +#endif + /* set the flags to be passed to parse_and_execute */ - pflags = (flags & FEVAL_HISTORY) ? 0 : SEVAL_NOHIST; + pflags = SEVAL_RESETLINE; + pflags |= (flags & FEVAL_HISTORY) ? 0 : SEVAL_NOHIST; if (flags & FEVAL_BUILTIN) result = EXECUTION_SUCCESS; @@ -205,6 +244,19 @@ file_error_and_exit: COPY_PROCENV (old_return_catch, return_catch); } +#if defined (ARRAY_VARS) + array_pop (bash_source_a); + array_pop (bash_lineno_a); + array_pop (funcname_a); +# if defined (DEBUGGER) + if ((flags & FEVAL_NOPUSHARGS) == 0) + { + array_pop (bash_argc_a); + array_pop (bash_argv_a); + } +# endif +#endif + return ((flags & FEVAL_BUILTIN) ? result : 1); } @@ -240,14 +292,20 @@ fc_execute_file (filename) #endif /* HISTORY */ int -source_file (filename) +source_file (filename, sflags) const char *filename; + int sflags; { - int flags; + int flags, rval; flags = FEVAL_BUILTIN|FEVAL_UNWINDPROT|FEVAL_NONINT; + if (sflags) + flags |= FEVAL_NOPUSHARGS; /* POSIX shells exit if non-interactive and file error. */ if (posixly_correct && !interactive_shell) flags |= FEVAL_LONGJMP; - return (_evalfile (filename, flags)); + rval = _evalfile (filename, flags); + + run_return_trap (); + return rval; } diff --git a/builtins/evalstring.c b/builtins/evalstring.c index 860a3de8..88d6a9e5 100644 --- a/builtins/evalstring.c +++ b/builtins/evalstring.c @@ -84,6 +84,7 @@ parse_and_execute_cleanup () (flags & SEVAL_INTERACT) -> interactive = 1; (flags & SEVAL_NOHIST) -> call bash_history_disable () (flags & SEVAL_NOFREE) -> don't free STRING when finished + (flags & SEVAL_RESETLINE) -> reset line_number to 1 */ int @@ -92,7 +93,7 @@ parse_and_execute (string, from_file, flags) const char *from_file; int flags; { - int code, x; + int code, x, lreset; volatile int should_jump_to_top_level, last_result; char *orig_string; COMMAND *volatile command; @@ -107,6 +108,8 @@ parse_and_execute (string, from_file, flags) if (flags & (SEVAL_NONINT|SEVAL_INTERACT)) unwind_protect_int (interactive); + lreset = flags & SEVAL_RESETLINE; + #if defined (HISTORY) unwind_protect_int (remember_on_history); /* can be used in scripts */ # if defined (BANG_HISTORY) @@ -129,7 +132,15 @@ parse_and_execute (string, from_file, flags) end_unwind_frame (); parse_and_execute_level++; - push_stream (1); /* reset the line number */ + + /* Reset the line number if the caller wants us to. If we don't reset the + line number, we have to subtract one, because we will add one just + before executing the next command (resetting the line number sets it to + 0; the first line number is 1). */ + push_stream (lreset); + if (lreset == 0) + line_number--; + indirection_level++; if (flags & (SEVAL_NONINT|SEVAL_INTERACT)) interactive = (flags & SEVAL_NONINT) ? 0 : 1; @@ -141,11 +152,12 @@ parse_and_execute (string, from_file, flags) code = should_jump_to_top_level = 0; last_result = EXECUTION_SUCCESS; - command = (COMMAND *)NULL; with_input_from_string (string, from_file); while (*(bash_input.location.string)) { + command = (COMMAND *)NULL; + if (interrupt_state) { last_result = EXECUTION_FAILURE; @@ -163,15 +175,18 @@ parse_and_execute (string, from_file, flags) switch (code) { case FORCE_EOF: + case ERREXIT: case EXITPROG: - run_unwind_frame ("pe_dispose"); + if (command) + run_unwind_frame ("pe_dispose"); /* Remember to call longjmp (top_level) after the old value for it is restored. */ should_jump_to_top_level = 1; goto out; case DISCARD: - run_unwind_frame ("pe_dispose"); + if (command) + run_unwind_frame ("pe_dispose"); last_result = last_command_exit_value = EXECUTION_FAILURE; /* XXX */ if (subshell_environment) { diff --git a/builtins/exec.def b/builtins/exec.def index a6881b88..73a42f69 100644 --- a/builtins/exec.def +++ b/builtins/exec.def @@ -208,8 +208,7 @@ exec_builtin (list) file_error (command); failed_exec: - if (command) - free (command); + FREE (command); if (subshell_environment || (interactive == 0 && no_exit_on_failed_exec == 0)) exit_shell (exit_value); diff --git a/builtins/exit.def b/builtins/exit.def index bf1d9205..735fecc2 100644 --- a/builtins/exit.def +++ b/builtins/exit.def @@ -122,6 +122,18 @@ exit_or_logout (list) exit_value = get_exitstat (list); + bash_logout (); + + last_command_exit_value = exit_value; + + /* Exit the program. */ + jump_to_top_level (EXITPROG); + /*NOTREACHED*/ +} + +void +bash_logout () +{ /* Run our `~/.bash_logout' file if it exists, and this is a login shell. */ if (login_shell && sourced_logout++ == 0 && subshell_environment == 0) { @@ -130,10 +142,4 @@ exit_or_logout (list) maybe_execute_file (SYS_BASH_LOGOUT, 1); #endif } - - last_command_exit_value = exit_value; - - /* Exit the program. */ - jump_to_top_level (EXITPROG); - /*NOTREACHED*/ } diff --git a/builtins/fc.def b/builtins/fc.def index c300066f..0e6ab990 100644 --- a/builtins/fc.def +++ b/builtins/fc.def @@ -54,7 +54,7 @@ $END #endif #include "../bashtypes.h" #include "posixstat.h" -#ifndef _MINIX +#if ! defined(_MINIX) && defined (HAVE_SYS_FILE_H) # include <sys/file.h> #endif diff --git a/builtins/getopts.def b/builtins/getopts.def index a2a82ff4..6cd40d32 100644 --- a/builtins/getopts.def +++ b/builtins/getopts.def @@ -44,7 +44,7 @@ seen, getopts places the option character found into OPTARG. If a required argument is not found, getopts places a ':' into NAME and sets OPTARG to the option character found. If getopts is not in silent mode, and an invalid option is seen, getopts places '?' into -NAME and unsets OPTARG. If a required option is not found, a '?' +NAME and unsets OPTARG. If a required argument is not found, a '?' is placed in NAME, OPTARG is unset, and a diagnostic message is printed. diff --git a/builtins/history.def b/builtins/history.def index 7311705d..5c1a829d 100644 --- a/builtins/history.def +++ b/builtins/history.def @@ -34,20 +34,25 @@ current history to the history file; `-r' means to read the file and append the contents to the history list instead. `-a' means to append history lines from this session to the history file. Argument `-n' means to read all history lines not already read -from the history file and append them to the history list. If -FILENAME is given, then that is used as the history file else +from the history file and append them to the history list. + +If FILENAME is given, then that is used as the history file else if $HISTFILE has a value, that is used, else ~/.bash_history. If the -s option is supplied, the non-option ARGs are appended to the history list as a single entry. The -p option means to perform history expansion on each ARG and display the result, without storing anything in the history list. + +If the $HISTTIMEFORMAT variable is set and not null, its value is used +as a format string for strftime(3) to print the time stamp associated +with each displayed history entry. No time stamps are printed otherwise. $END #include <config.h> #if defined (HISTORY) #include "../bashtypes.h" -#ifndef _MINIX +#if ! defined(_MINIX) && defined (HAVE_SYS_FILE_H) # include <sys/file.h> #endif #include "posixstat.h" @@ -72,6 +77,7 @@ extern int errno; extern int current_command_line_count; +static char *histtime __P((HIST_ENTRY *, const char *)); static void display_history __P((WORD_LIST *)); static int delete_histent __P((int)); static int delete_last_history __P((void)); @@ -91,7 +97,7 @@ int history_builtin (list) WORD_LIST *list; { - int flags, opt, result, old_history_lines; + int flags, opt, result, old_history_lines, obase; char *filename, *delete_arg; intmax_t delete_offset; @@ -200,11 +206,23 @@ history_builtin (list) { /* Read all of the lines in the file that we haven't already read. */ old_history_lines = history_lines_in_file; + obase = history_base; + using_history (); result = read_history_range (filename, history_lines_in_file, -1); using_history (); + history_lines_in_file = where_history (); - history_lines_this_session += history_lines_in_file - old_history_lines; + /* The question is whether we reset history_lines_this_session to 0, + losing any history entries we had before we read the new entries + from the history file, or whether we count the new entries we just + read from the file as history lines added during this session. + Right now, we do the latter. This will cause these history entries + to be written to the history file along with any intermediate entries + we add when we do a `history -a', but the alternative is losing + them altogether. */ + history_lines_this_session += history_lines_in_file - old_history_lines + + history_base - obase; } return (result ? EXECUTION_FAILURE : EXECUTION_SUCCESS); @@ -214,6 +232,22 @@ history_builtin (list) #define histline(i) (hlist[(i)]->line) #define histdata(i) (hlist[(i)]->data) +static char * +histtime (hlist, histtimefmt) + HIST_ENTRY *hlist; + const char *histtimefmt; +{ + static char timestr[128]; + time_t t; + + t = history_get_time (hlist); + if (t) + strftime (timestr, sizeof (timestr), histtimefmt, localtime (&t)); + else + strcpy (timestr, "??"); + return timestr; +} + static void display_history (list) WORD_LIST *list; @@ -221,6 +255,7 @@ display_history (list) register int i; intmax_t limit; HIST_ENTRY **hlist; + char *histtimefmt, *timestr; if (list) { @@ -243,11 +278,17 @@ display_history (list) else i = 0; + + histtimefmt = get_string_value ("HISTTIMEFORMAT"); + while (hlist[i]) { QUIT; - printf ("%5d%c %s\n", i + history_base, + + timestr = (histtimefmt && *histtimefmt) ? histtime (hlist[i], histtimefmt) : (char *)NULL; + printf ("%5d%c %s%s\n", i + history_base, histdata(i) ? '*' : ' ', + ((timestr && *timestr) ? timestr : ""), histline(i)); i++; } @@ -263,11 +304,8 @@ delete_histent (i) discard = remove_history (i); if (discard) - { - if (discard->line) - free (discard->line); - free ((char *) discard); - } + free_history_entry (discard); + return 1; } @@ -276,6 +314,7 @@ delete_last_history () { register int i; HIST_ENTRY **hlist, *histent; + int r; hlist = history_list (); if (hlist == NULL) @@ -290,7 +329,12 @@ delete_last_history () if (histent == NULL) return 0; - return (delete_histent (i)); + r = delete_histent (i); + + if (where_history () > history_length) + history_set_pos (history_length); + + return r; } /* Remove the last entry in the history list and add each argument in diff --git a/builtins/jobs.def b/builtins/jobs.def index 54f50ca3..51b7c267 100644 --- a/builtins/jobs.def +++ b/builtins/jobs.def @@ -163,6 +163,7 @@ execute_list_with_replacements (list) { register WORD_LIST *l; int job, result; + COMMAND *command; /* First do the replacement of job specifications with pids. */ for (l = list; l; l = l->next) @@ -182,21 +183,18 @@ execute_list_with_replacements (list) /* Next make a new simple command and execute it. */ begin_unwind_frame ("jobs_builtin"); - { - COMMAND *command = (COMMAND *)NULL; - add_unwind_protect (dispose_command, command); + command = make_bare_simple_command (); + command->value.Simple->words = copy_word_list (list); + command->value.Simple->redirects = (REDIRECT *)NULL; + command->flags |= CMD_INHIBIT_EXPANSION; + command->value.Simple->flags |= CMD_INHIBIT_EXPANSION; - command = make_bare_simple_command (); - command->value.Simple->words = copy_word_list (list); - command->value.Simple->redirects = (REDIRECT *)NULL; - command->flags |= CMD_INHIBIT_EXPANSION; - command->value.Simple->flags |= CMD_INHIBIT_EXPANSION; + add_unwind_protect (dispose_command, command); + result = execute_command (command); + dispose_command (command); - result = execute_command (command); - } - - run_unwind_frame ("jobs_builtin"); + discard_unwind_frame ("jobs_builtin"); return (result); } #endif /* JOB_CONTROL */ diff --git a/builtins/kill.def b/builtins/kill.def index 96b34fcb..12074917 100644 --- a/builtins/kill.def +++ b/builtins/kill.def @@ -1,7 +1,7 @@ This file is kill.def, from which is created kill.c. It implements the builtin "kill" in Bash. -Copyright (C) 1987-2002 Free Software Foundation, Inc. +Copyright (C) 1987-2003 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -23,7 +23,6 @@ $PRODUCES kill.c $BUILTIN kill $FUNCTION kill_builtin -$DEPENDS_ON JOB_CONTROL $SHORT_DOC kill [-s sigspec | -n signum | -sigspec] [pid | job]... or kill -l [sigspec] Send the processes named by PID (or JOB) the signal SIGSPEC. If SIGSPEC is not present, then SIGTERM is assumed. An argument of `-l' @@ -57,9 +56,10 @@ $END extern int errno; #endif /* !errno */ -#if defined (JOB_CONTROL) extern int posixly_correct; +static void kill_error __P((pid_t, int)); + #if !defined (CONTINUE_AFTER_KILL_ERROR) # define CONTINUE_OR_FAIL return (EXECUTION_FAILURE) #else @@ -73,7 +73,7 @@ int kill_builtin (list) WORD_LIST *list; { - int sig, any_succeeded, listing, saw_signal; + int sig, any_succeeded, listing, saw_signal, dflags; char *sigspec, *word; pid_t pid; intmax_t pid_value; @@ -88,6 +88,7 @@ kill_builtin (list) sig = SIGTERM; sigspec = "TERM"; + dflags = DSIG_NOCASE | ((posixly_correct == 0) ? DSIG_SIGPREFIX : 0); /* Process options. */ while (list) { @@ -107,7 +108,7 @@ kill_builtin (list) if (sigspec[0] == '0' && sigspec[1] == '\0') sig = 0; else - sig = decode_signal (sigspec); + sig = decode_signal (sigspec, dflags); list = list->next; } else @@ -132,7 +133,7 @@ kill_builtin (list) else if ((*word == '-') && !saw_signal) { sigspec = word + 1; - sig = decode_signal (sigspec); + sig = decode_signal (sigspec, dflags); saw_signal++; list = list->next; } @@ -169,13 +170,20 @@ kill_builtin (list) pid = (pid_t) pid_value; if ((pid < -1 ? kill_pid (-pid, sig, 1) : kill_pid (pid, sig, 0)) < 0) - goto signal_error; + { + if (errno == EINVAL) + sh_invalidsig (sigspec); + else + kill_error (pid, errno); + CONTINUE_OR_FAIL; + } else any_succeeded++; } +#if defined (JOB_CONTROL) else if (*list->word->word && *list->word->word != '%') { - builtin_error ("%s: no such pid", list->word->word); + builtin_error ("%s: arguments must be process or job IDs", list->word->word); CONTINUE_OR_FAIL; } else if (*word && (interactive || job_control)) @@ -205,16 +213,16 @@ kill_builtin (list) if (kill_pid (pid, sig, 1) < 0) { - signal_error: if (errno == EINVAL) sh_invalidsig (sigspec); else - builtin_error ("(%ld) - %s", (long)pid, strerror (errno)); + kill_error (pid, errno); CONTINUE_OR_FAIL; } else any_succeeded++; } +#endif /* !JOB_CONTROL */ else { sh_badpid (list->word->word); @@ -226,4 +234,16 @@ kill_builtin (list) return (any_succeeded ? EXECUTION_SUCCESS : EXECUTION_FAILURE); } -#endif /* JOB_CONTROL */ + +static void +kill_error (pid, e) + pid_t pid; + int e; +{ + char *x; + + x = strerror (e); + if (x == 0) + x = "Unknown error"; + builtin_error ("(%ld) - %s", (long)pid, x); +} diff --git a/builtins/let.def b/builtins/let.def index 7c9341ed..85131b04 100644 --- a/builtins/let.def +++ b/builtins/let.def @@ -45,7 +45,7 @@ The levels are listed in order of decreasing precedence. && logical AND || logical OR expr ? expr : expr - conditional expression + conditional operator =, *=, /=, %=, +=, -=, <<=, >>=, &=, ^=, |= assignment diff --git a/builtins/mkbuiltins.c b/builtins/mkbuiltins.c index c911f86e..f8d82f11 100644 --- a/builtins/mkbuiltins.c +++ b/builtins/mkbuiltins.c @@ -29,8 +29,10 @@ Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ #endif #ifndef _MINIX -#include "../bashtypes.h" -#include <sys/file.h> +# include "../bashtypes.h" +# if defined (HAVE_SYS_FILE_H) +# include <sys/file.h> +# endif #endif #include "posixstat.h" diff --git a/builtins/printf.def b/builtins/printf.def index 8821ecb2..705f5b6e 100644 --- a/builtins/printf.def +++ b/builtins/printf.def @@ -114,7 +114,7 @@ static int getint __P((void)); static intmax_t getintmax __P((void)); static uintmax_t getuintmax __P((void)); -#if defined (HAVE_LONG_DOUBLE) && HAVE_DECL_STRTOLD +#if defined (HAVE_LONG_DOUBLE) && HAVE_DECL_STRTOLD && !defined(STRTOLD_BROKEN) typedef long double floatmax_t; # define FLOATMAX_CONV "L" # define strtofltmax strtold diff --git a/builtins/read.def b/builtins/read.def index 46a0407b..7f6a83c1 100644 --- a/builtins/read.def +++ b/builtins/read.def @@ -505,6 +505,7 @@ read_builtin (list) alist = list_string (input_string, ifs_chars, 0); if (alist) { + word_list_remove_quoted_nulls (alist); assign_array_var_from_word_list (var, alist); dispose_words (alist); } diff --git a/builtins/set.def b/builtins/set.def index 10aaf5ff..4f900dd6 100644 --- a/builtins/set.def +++ b/builtins/set.def @@ -77,6 +77,8 @@ $SHORT_DOC set [--abefhkmnptuvxBCHP] [-o option] [arg ...] emacs use an emacs-style line editing interface #endif /* READLINE */ errexit same as -e + errtrace same as -E + functrace same as -T hashall same as -h #if defined (BANG_HISTORY) histexpand same as -H @@ -97,6 +99,9 @@ $SHORT_DOC set [--abefhkmnptuvxBCHP] [-o option] [arg ...] nounset same as -u onecmd same as -t physical same as -P + pipefail the return value of a pipeline is the status of + the last command to exit with a non-zero status, + or zero if no command exited with a non-zero status posix change the behavior of bash where the default operation differs from the 1003.2 standard to match the standard @@ -119,12 +124,14 @@ $SHORT_DOC set [--abefhkmnptuvxBCHP] [-o option] [arg ...] #endif /* BRACE_EXPANSION */ -C If set, disallow existing regular files to be overwritten by redirection of output. + -E If set, the ERR trap is inherited by shell functions. #if defined (BANG_HISTORY) -H Enable ! style history substitution. This flag is on by default. #endif /* BANG_HISTORY */ -P If set, do not follow symbolic links when executing commands such as cd which change the current directory. + -T If set, the DEBUG trap is inherited by shell functions. Using + rather than - causes these flags to be turned off. The flags can also be used upon invocation of the shell. The current @@ -172,6 +179,8 @@ struct { { "emacs", '\0', (int *)NULL, set_edit_mode, get_edit_mode }, #endif { "errexit", 'e', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, + { "errtrace", 'E', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, + { "functrace", 'T', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, { "hashall", 'h', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, #if defined (BANG_HISTORY) { "histexpand", 'H', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, @@ -195,6 +204,7 @@ struct { { "nounset", 'u', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, { "onecmd", 't', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, { "physical", 'P', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, + { "pipefail", '\0', &pipefail_opt, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, { "posix", '\0', &posixly_correct, set_posix_mode, (setopt_get_func_t *)NULL }, { "privileged", 'p', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, { "verbose", 'v', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, diff --git a/builtins/setattr.def b/builtins/setattr.def index 8465e7d3..0ef5041e 100644 --- a/builtins/setattr.def +++ b/builtins/setattr.def @@ -75,13 +75,12 @@ export_builtin (list) $BUILTIN readonly $FUNCTION readonly_builtin -$SHORT_DOC readonly [-anf] [name[=value] ...] or readonly -p +$SHORT_DOC readonly [-af] [name[=value] ...] or readonly -p The given NAMEs are marked readonly and the values of these NAMEs may not be changed by subsequent assignment. If the -f option is given, then functions corresponding to the NAMEs are so marked. If no arguments are given, or if `-p' is given, a list of all readonly names -is printed. An argument of `-n' says to remove the readonly property -from subsequent NAMEs. The `-a' option means to treat each NAME as +is printed. The `-a' option means to treat each NAME as an array variable. An argument of `--' disables further option processing. $END @@ -103,7 +102,7 @@ readonly_builtin (list) /* For each variable name in LIST, make that variable have the specified ATTRIBUTE. An arg of `-n' says to remove the attribute from the the - remaining names in LIST. */ + remaining names in LIST (doesn't work for readonly). */ int set_or_show_attributes (list, attribute, nodefs) register WORD_LIST *list; diff --git a/builtins/shift.def b/builtins/shift.def index dbff0622..236f10ff 100644 --- a/builtins/shift.def +++ b/builtins/shift.def @@ -68,7 +68,7 @@ shift_builtin (list) else if (times > number_of_args ()) { if (print_shift_error) - sh_erange (list->word->word, "shift count"); + sh_erange (list ? list->word->word : NULL, "shift count"); return (EXECUTION_FAILURE); } diff --git a/builtins/shopt.def b/builtins/shopt.def index ae15330d..88ecbb2d 100644 --- a/builtins/shopt.def +++ b/builtins/shopt.def @@ -55,15 +55,17 @@ $END #define OPTFMT "%-15s\t%s\n" -extern int allow_null_glob_expansion, glob_dot_filenames; +extern int allow_null_glob_expansion, fail_glob_expansion, glob_dot_filenames; extern int cdable_vars, mail_warning, source_uses_path; extern int no_exit_on_failed_exec, print_shift_error; extern int check_hashed_filenames, promptvars; extern int cdspelling, expand_aliases; +extern int extended_quote; extern int check_window_size; extern int glob_ignore_case; extern int hup_on_exit; extern int xpg_echo; +extern int gnu_error_format; #if defined (EXTENDED_GLOB) extern int extended_glob; @@ -77,6 +79,7 @@ extern int force_append_history; #if defined (READLINE) extern int hist_verify, history_reediting, perform_hostname_completion; extern int no_empty_command_completion; +extern int force_fignore; extern int enable_hostname_completion __P((int)); #endif @@ -88,9 +91,13 @@ extern int prog_completion_enabled; extern char *shell_name; #endif +#if defined (DEBUGGER) +extern int debugging_mode; +#endif + static void shopt_error __P((char *)); -static int set_interactive_comments __P((int)); +static int set_shellopts_after_change __P((int)); #if defined (RESTRICTED_SHELL) static int set_restricted_shell __P((int)); @@ -115,10 +122,17 @@ static struct { { "dotglob", &glob_dot_filenames, (shopt_set_func_t *)NULL }, { "execfail", &no_exit_on_failed_exec, (shopt_set_func_t *)NULL }, { "expand_aliases", &expand_aliases, (shopt_set_func_t *)NULL }, +#if defined (DEBUGGER) + { "extdebug", &debugging_mode, (shopt_set_func_t *)NULL }, +#endif #if defined (EXTENDED_GLOB) { "extglob", &extended_glob, (shopt_set_func_t *)NULL }, #endif + { "extquote", &extended_quote, (shopt_set_func_t *)NULL }, + { "failglob", &fail_glob_expansion, (shopt_set_func_t *)NULL }, #if defined (READLINE) + { "force_fignore", &force_fignore, (shopt_set_func_t *)NULL }, + { "gnu_errfmt", &gnu_error_format, (shopt_set_func_t *)NULL }, { "histreedit", &history_reediting, (shopt_set_func_t *)NULL }, #endif #if defined (HISTORY) @@ -129,7 +143,7 @@ static struct { { "hostcomplete", &perform_hostname_completion, enable_hostname_completion }, #endif { "huponexit", &hup_on_exit, (shopt_set_func_t *)NULL }, - { "interactive_comments", &interactive_comments, set_interactive_comments }, + { "interactive_comments", &interactive_comments, set_shellopts_after_change }, #if defined (HISTORY) { "lithist", &literal_history, (shopt_set_func_t *)NULL }, #endif @@ -435,7 +449,7 @@ set_shopt_o_options (mode, list, quiet) /* If we set or unset interactive_comments with shopt, make sure the change is reflected in $SHELLOPTS. */ static int -set_interactive_comments (mode) +set_shellopts_after_change (mode) int mode; { set_shellopts (); diff --git a/builtins/source.def b/builtins/source.def index ffb23f07..422e293e 100644 --- a/builtins/source.def +++ b/builtins/source.def @@ -23,16 +23,20 @@ $PRODUCES source.c $BUILTIN source $FUNCTION source_builtin -$SHORT_DOC source filename +$SHORT_DOC source filename [arguments] Read and execute commands from FILENAME and return. The pathnames -in $PATH are used to find the directory containing FILENAME. +in $PATH are used to find the directory containing FILENAME. If any +ARGUMENTS are supplied, they become the positional parameters when +FILENAME is executed. $END $BUILTIN . $DOCNAME dot $FUNCTION source_builtin -$SHORT_DOC . filename +$SHORT_DOC . filename [arguments] Read and execute commands from FILENAME and return. The pathnames -in $PATH are used to find the directory containing FILENAME. +in $PATH are used to find the directory containing FILENAME. If any +ARGUMENTS are supplied, they become the positional parameters when +FILENAME is executed. $END /* source.c - Implements the `.' and `source' builtins. */ @@ -41,7 +45,7 @@ $END #include "../bashtypes.h" #include "posixstat.h" #include "filecntl.h" -#ifndef _MINIX +#if ! defined(_MINIX) && defined (HAVE_SYS_FILE_H) # include <sys/file.h> #endif #include <errno.h> @@ -53,9 +57,11 @@ $END #include "../bashansi.h" #include "../shell.h" +#include "../flags.h" #include "../findcmd.h" #include "common.h" #include "bashgetopt.h" +#include "../trap.h" #if !defined (errno) extern int errno; @@ -85,6 +91,7 @@ maybe_pop_dollar_vars () dispose_saved_dollar_vars (); else pop_dollar_vars (); + pop_args (); /* restore BASH_ARGC and BASH_ARGV */ set_dollar_vars_unchanged (); } @@ -97,7 +104,7 @@ source_builtin (list) WORD_LIST *list; { int result; - char *filename; + char *filename, *debug_trap; if (no_options (list)) return (EX_USAGE); @@ -140,10 +147,23 @@ source_builtin (list) push_dollar_vars (); add_unwind_protect ((Function *)maybe_pop_dollar_vars, (char *)NULL); remember_args (list->next, 1); + push_args (list->next); /* Update BASH_ARGV and BASH_ARGC */ } set_dollar_vars_unchanged (); - result = source_file (filename); + /* Don't inherit the DEBUG trap unless function_trace_mode (overloaded) + is set. XXX - should sourced files inherit the RETURN trap? Functions + don't. */ + debug_trap = TRAP_STRING (DEBUG_TRAP); + if (debug_trap && function_trace_mode == 0) + { + debug_trap = savestring (debug_trap); + add_unwind_protect (xfree, debug_trap); + add_unwind_protect (set_debug_trap, debug_trap); + restore_default_signal (DEBUG_TRAP); + } + + result = source_file (filename, (list && list->next)); run_unwind_frame ("source"); diff --git a/builtins/suspend.def b/builtins/suspend.def index 43391c0d..6a77210f 100644 --- a/builtins/suspend.def +++ b/builtins/suspend.def @@ -104,6 +104,9 @@ suspend_builtin (list) } } + /* XXX - should we put ourselves back into the original pgrp now? If so, + call end_job_control() here and do the right thing in suspend_continue + (that is, call restart_job_control()). */ old_cont = (SigHandler *)set_signal_handler (SIGCONT, suspend_continue); #if 0 old_stop = (SigHandler *)set_signal_handler (SIGSTOP, SIG_DFL); diff --git a/builtins/trap.def b/builtins/trap.def index af9e6d6c..70b90fa5 100644 --- a/builtins/trap.def +++ b/builtins/trap.def @@ -108,6 +108,8 @@ trap_builtin (list) } list = loptend; + opt = DSIG_NOCASE|DSIG_SIGPREFIX; /* flags for decode_signal */ + if (list_signal_names) return (display_signal_list ((WORD_LIST *)NULL, 1)); else if (display || list == 0) @@ -119,8 +121,12 @@ trap_builtin (list) operation = SET; first_arg = list->word->word; - if (first_arg && *first_arg && (*first_arg != '-' || first_arg[1]) && - signal_object_p (first_arg)) + /* When not in posix mode, the historical behavior of looking for a + missing first argument is disabled. To revert to the original + signal handling disposition, use `-' as the first argument. */ + if (posixly_correct == 0 && first_arg && *first_arg && + (*first_arg != '-' || first_arg[1]) && + signal_object_p (first_arg, opt)) operation = REVERT; else { @@ -133,7 +139,7 @@ trap_builtin (list) while (list) { - sig = decode_signal (list->word->word); + sig = decode_signal (list->word->word, opt); if (sig == NO_SIG) { @@ -235,7 +241,7 @@ display_traps (list) for (result = EXECUTION_SUCCESS; list; list = list->next) { - i = decode_signal (list->word->word); + i = decode_signal (list->word->word, DSIG_NOCASE|DSIG_SIGPREFIX); if (i == NO_SIG) { sh_invalidsig (list->word->word); diff --git a/builtins/type.def b/builtins/type.def index 2d9d2a56..8e5028a0 100644 --- a/builtins/type.def +++ b/builtins/type.def @@ -73,6 +73,7 @@ $END extern int find_reserved_word __P((char *)); extern char *this_command_name; +extern int expand_aliases; /* For each word in LIST, find out what the shell is going to do with it as a simple command. i.e., which file would this shell use to @@ -221,7 +222,7 @@ describe_command (command, dflags) #if defined (ALIAS) /* Command is an alias? */ - if (((dflags & CDESC_FORCE_PATH) == 0) && (alias = find_alias (command))) + if (((dflags & CDESC_FORCE_PATH) == 0) && expand_aliases && (alias = find_alias (command))) { if (dflags & CDESC_TYPE) puts ("alias"); diff --git a/builtins/umask.def b/builtins/umask.def index 19a0ac0d..f1693316 100644 --- a/builtins/umask.def +++ b/builtins/umask.def @@ -37,7 +37,7 @@ $END #include "../bashtypes.h" #include "filecntl.h" -#ifndef _MINIX +#if ! defined(_MINIX) && defined (HAVE_SYS_FILE_H) # include <sys/file.h> #endif @@ -67,14 +67,17 @@ enum command_type { cm_for, cm_case, cm_while, cm_if, cm_simple, cm_select, cm_arith, cm_cond, cm_arith_for, cm_subshell }; /* Possible values for the `flags' field of a WORD_DESC. */ -#define W_HASDOLLAR 0x01 /* Dollar sign present. */ -#define W_QUOTED 0x02 /* Some form of quote character is present. */ -#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. */ -#define W_NOSPLIT2 0x40 /* Don't split word except for $@ expansion. */ -#define W_TILDEEXP 0x80 /* Tilde expand this assignment word */ +#define W_HASDOLLAR 0x0001 /* Dollar sign present. */ +#define W_QUOTED 0x0002 /* Some form of quote character is present. */ +#define W_ASSIGNMENT 0x0004 /* This word is a variable assignment. */ +#define W_GLOBEXP 0x0008 /* This word is the result of a glob expansion. */ +#define W_NOSPLIT 0x0010 /* Do not perform word splitting on this word. */ +#define W_NOGLOB 0x0020 /* Do not perform globbing on this word. */ +#define W_NOSPLIT2 0x0040 /* Don't split word except for $@ expansion. */ +#define W_TILDEEXP 0x0080 /* Tilde expand this assignment word */ +#define W_DOLLARAT 0x0100 /* $@ and its special handling */ +#define W_DOLLARSTAR 0x0200 /* $* and its special handling */ +#define W_NOCOMSUB 0x0400 /* Don't perform command substitution on this word */ /* Possible values for subshell_environment */ #define SUBSHELL_ASYNC 0x01 /* subshell caused by `command &' */ @@ -195,6 +198,7 @@ typedef struct pattern_list { /* The CASE command. */ typedef struct case_com { int flags; /* See description of CMD flags. */ + int line; /* line number the `case' keyword appears on */ WORD_DESC *word; /* The thing to test. */ PATTERN_LIST *clauses; /* The clauses to test against, or NULL. */ } CASE_COM; @@ -202,6 +206,7 @@ typedef struct case_com { /* FOR command. */ typedef struct for_com { int flags; /* See description of CMD flags. */ + int line; /* line number the `for' keyword appears on */ WORD_DESC *name; /* The variable name to get mapped over. */ WORD_LIST *map_list; /* The things to map over. This is never NULL. */ COMMAND *action; /* The action to execute. @@ -224,6 +229,7 @@ typedef struct arith_for_com { /* KSH SELECT command. */ typedef struct select_com { int flags; /* See description of CMD flags. */ + int line; /* line number the `select' keyword appears on */ WORD_DESC *name; /* The variable name to get mapped over. */ WORD_LIST *map_list; /* The things to map over. This is never NULL. */ COMMAND *action; /* The action to execute. @@ -253,8 +259,8 @@ typedef struct while_com { time being. */ typedef struct arith_com { int flags; - WORD_LIST *exp; int line; + WORD_LIST *exp; } ARITH_COM; #endif /* DPAREN_ARITHMETIC */ @@ -278,18 +284,19 @@ typedef struct cond_com { /* The "simple" command. Just a collection of words and redirects. */ typedef struct simple_com { int flags; /* See description of CMD flags. */ + int line; /* line number the command starts on */ WORD_LIST *words; /* The program name, the arguments, variable assignments, etc. */ REDIRECT *redirects; /* Redirections to perform. */ - int line; /* line number the command starts on */ } SIMPLE_COM; /* The "function definition" command. */ typedef struct function_def { int flags; /* See description of CMD flags. */ + int line; /* Line number the function def starts on. */ WORD_DESC *name; /* The name of the function. */ COMMAND *command; /* The parsed execution tree. */ - int line; /* Line number the function def starts on. */ + char *source_file; /* file in which function was defined, if any */ } FUNCTION_DEF; /* A command that is `grouped' allows pipes and redirections to affect all @@ -316,6 +323,9 @@ extern COMMAND *global_command; /* Forward declarations of functions declared in copy_cmd.c. */ +extern FUNCTION_DEF *copy_function_def_contents __P((FUNCTION_DEF *, FUNCTION_DEF *)); +extern FUNCTION_DEF *copy_function_def __P((FUNCTION_DEF *)); + extern WORD_DESC *copy_word __P((WORD_DESC *)); extern WORD_LIST *copy_word_list __P((WORD_LIST *)); extern REDIRECT *copy_redirect __P((REDIRECT *)); diff --git a/config-bot.h b/config-bot.h index 76732998..06e107c6 100644 --- a/config-bot.h +++ b/config-bot.h @@ -19,11 +19,51 @@ with Bash; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ +/*********************************************************/ +/* Modify or set defines based on the configure results. */ +/*********************************************************/ + #if !defined (HAVE_VPRINTF) && defined (HAVE_DOPRNT) # define USE_VFPRINTF_EMULATION # define HAVE_VPRINTF #endif +#if defined (HAVE_SYS_RESOURCE_H) && defined (HAVE_GETRLIMIT) +# define HAVE_RESOURCE +#endif + +#if !defined (GETPGRP_VOID) +# define HAVE_BSD_PGRP +#endif + +/* Try this without testing __STDC__ for the time being. */ +#if defined (HAVE_STDARG_H) +# define PREFER_STDARG +# define USE_VARARGS +#else +# if defined (HAVE_VARARGS_H) +# define PREFER_VARARGS +# define USE_VARARGS +# endif +#endif + +#if defined (HAVE_SYS_SOCKET_H) && defined (HAVE_GETPEERNAME) && defined (HAVE_NETINET_IN_H) +# define HAVE_NETWORK +#endif + +#if defined (HAVE_REGEX_H) && defined (HAVE_REGCOMP) && defined (HAVE_REGEXEC) +# define HAVE_POSIX_REGEXP +#endif + +/* backwards compatibility between different autoconf versions */ +#if defined (HAVE_DECL_SYS_SIGLIST) && !defined (SYS_SIGLIST_DECLARED) +# define SYS_SIGLIST_DECLARED +#endif + +/***********************************************************************/ +/* Unset defines based on what configure reports as missing or broken. */ +/***********************************************************************/ + /* Ultrix botches type-ahead when switching from canonical to non-canonical mode, at least through version 4.3 */ #if !defined (HAVE_TERMIOS_H) || !defined (HAVE_TCGETATTR) || defined (ultrix) @@ -36,16 +76,20 @@ # undef HAVE_GETCWD #endif -#if defined (HAVE_SYS_RESOURCE_H) && defined (HAVE_GETRLIMIT) -# define HAVE_RESOURCE +#if !defined (HAVE_DEV_FD) && defined (NAMED_PIPES_MISSING) +# undef PROCESS_SUBSTITUTION #endif -#if !defined (GETPGRP_VOID) -# define HAVE_BSD_PGRP +#if defined (JOB_CONTROL_MISSING) +# undef JOB_CONTROL #endif -#if !defined (HAVE_DEV_FD) && defined (NAMED_PIPES_MISSING) -# undef PROCESS_SUBSTITUTION +#if defined (STRCOLL_BROKEN) +# undef HAVE_STRCOLL +#endif + +#if !defined (HAVE_POSIX_REGEXP) +# undef COND_REGEXP #endif /* If the shell is called by this name, it will become restricted. */ @@ -53,6 +97,10 @@ # define RESTRICTED_SHELL_NAME "rbash" #endif +/***********************************************************/ +/* Make sure feature defines have necessary prerequisites. */ +/***********************************************************/ + /* BANG_HISTORY requires HISTORY. */ #if defined (BANG_HISTORY) && !defined (HISTORY) # define HISTORY @@ -70,28 +118,6 @@ # undef DEFAULT_ECHO_TO_XPG #endif -#if defined (JOB_CONTROL_MISSING) -# undef JOB_CONTROL -#endif - -#if defined (__STDC__) && defined (HAVE_STDARG_H) -# define PREFER_STDARG -# define USE_VARARGS -#else -# if defined (HAVE_VARARGS_H) -# define PREFER_VARARGS -# define USE_VARARGS -# endif -#endif - -#if defined (STRCOLL_BROKEN) -# undef HAVE_STRCOLL -#endif - -#if defined (HAVE_SYS_SOCKET_H) && defined (HAVE_GETPEERNAME) && defined (HAVE_NETINET_IN_H) -# define HAVE_NETWORK -#endif - #if !defined (PROMPT_STRING_DECODE) # undef PPROMPT # define PPROMPT "$ " @@ -107,11 +133,18 @@ #if defined (HAVE_WCTYPE_H) && defined (HAVE_WCHAR_H) # include <wchar.h> # include <wctype.h> -# if defined (HAVE_MBSRTOWCS) /* system is supposed to support XPG5 */ +# if defined (HAVE_MBSRTOWCS) && defined (HAVE_MBRTOWC) && defined (HAVE_MBRLEN) && defined (HAVE_WCWIDTH) + /* system is supposed to support XPG5 */ # define HANDLE_MULTIBYTE 1 # endif #endif +/* If we don't want multibyte chars even on a system that supports them, let + the configuring user turn multibyte support off. */ +#if defined (NO_MULTIBYTE_SUPPORT) +# undef HANDLE_MULTIBYTE +#endif + /* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */ #if HANDLE_MULTIBYTE && !defined (HAVE_MBSTATE_T) # define wcsrtombs(dest, src, len, ps) (wcsrtombs) (dest, src, len, 0) @@ -137,3 +170,12 @@ /************************************************/ /* end of multibyte capability checks for I18N */ /************************************************/ + +/******************************************************************/ +/* Placeholder for builders to #undef any unwanted features from */ +/* config-top.h or created by configure (such as the default mail */ +/* file for mail checking). */ +/******************************************************************/ + +/* If you don't want bash to provide a default mail file to check. */ +/* #undef DEFAULT_MAIL_DIRECTORY */ diff --git a/config-top.h b/config-top.h index b2bcffab..c094fc59 100644 --- a/config-top.h +++ b/config-top.h @@ -52,14 +52,14 @@ /* The default value of the PATH variable. */ #ifndef DEFAULT_PATH_VALUE #define DEFAULT_PATH_VALUE \ - "/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin:." + "/usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:." #endif /* The value for PATH when invoking `command -p'. This is only used when the Posix.2 confstr () function, or CS_PATH define are not present. */ #ifndef STANDARD_UTILS_PATH #define STANDARD_UTILS_PATH \ - "/bin:/usr/bin:/usr/ucb:/sbin:/usr/sbin:/etc:/usr/etc" + "/bin:/usr/bin:/sbin:/usr/sbin:/etc:/usr/etc" #endif /* Default primary and secondary prompt strings. */ diff --git a/config.h.in b/config.h.in index ff28c0d1..52541dfc 100644 --- a/config.h.in +++ b/config.h.in @@ -1,6 +1,6 @@ /* config.h -- Configuration file for bash. */ -/* Copyright (C) 1987-2002 Free Software Foundation, Inc. +/* Copyright (C) 1987-2003 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -119,6 +119,10 @@ command. */ #undef COND_COMMAND +/* Define COND_REGEXP if you want extended regular expression matching and the + =~ binary operator in the [[...]] conditional command. */ +#define COND_REGEXP + /* Define ARITH_FOR_COMMAND if you want the ksh93-style for (( init; test; step )) do list; done arithmetic for command. */ @@ -132,6 +136,14 @@ and the complete builtin. */ #undef PROGRAMMABLE_COMPLETION +/* Define NO_MULTIBYTE_SUPPORT to not compile in support for multibyte + characters, even if the OS supports them. */ +#undef NO_MULTIBYTE_SUPPORT + +/* Define DEBUGGER if you want to compile in some features used only by the + bash debugger. */ +#undef DEBUGGER + /* Define MEMSCRAMBLE if you want the bash malloc and free to scramble memory contents on malloc() and free(). */ #undef MEMSCRAMBLE @@ -314,6 +326,7 @@ libraries. */ /* Define if `sys_siglist' is declared by <signal.h> or <unistd.h>. */ +#undef HAVE_DECL_SYS_SIGLIST #undef SYS_SIGLIST_DECLARED /* Define if `_sys_siglist' is declared by <signal.h> or <unistd.h>. */ @@ -325,8 +338,6 @@ #undef HAVE_SYS_ERRLIST -#undef HAVE_TIMEVAL - #undef HAVE_TZNAME @@ -359,6 +370,10 @@ #undef HAVE_STRUCT_TM_TM_ZONE #undef HAVE_TM_ZONE +#undef HAVE_TIMEVAL + +#undef HAVE_STRUCT_TIMEZONE + /* Characteristics of definitions in the system header files. */ #undef HAVE_GETPW_DECLS @@ -380,6 +395,7 @@ #undef HAVE_DECL_STRTOLD +#undef STRTOLD_BROKEN #undef HAVE_MBSTATE_T @@ -420,6 +436,8 @@ #undef HAVE_PRINTF_A_FORMAT +#undef CTYPE_NON_ASCII + /* Define if you have <langinfo.h> and nl_langinfo(CODESET). */ #undef HAVE_LANGINFO_CODESET @@ -564,6 +582,12 @@ /* Define if you have the lstat function. */ #undef HAVE_LSTAT +/* Define if you have the mbrlen function. */ +#undef HAVE_MBRLEN + +/* Define if you have the mbrtowc function. */ +#undef HAVE_MBRTOWC + /* Define if you have the mbsrtowcs function. */ #undef HAVE_MBSRTOWCS @@ -585,6 +609,12 @@ /* Define if you have the readlink function. */ #undef HAVE_READLINK +/* Define if you have the regcomp function. */ +#undef HAVE_REGCOMP + +/* Define if you have the regexec function. */ +#undef HAVE_REGEXEC + /* Define if you have the rename function. */ #undef HAVE_RENAME @@ -639,6 +669,9 @@ /* Define if you have the strpbrk function. */ #undef HAVE_STRPBRK +/* Define if you have the strstr function. */ +#undef HAVE_STRSTR + /* Define if you have the strtod function. */ #undef HAVE_STRTOD @@ -708,6 +741,9 @@ /* Define if you have the wait3 function. */ #undef HAVE_WAIT3 +/* Define if you have the wctomb function. */ +#undef HAVE_WCTOMB + /* Define if you have the wcwidth function. */ #undef HAVE_WCWIDTH @@ -749,6 +785,9 @@ /* Define if you have the <netinet/in.h> header file. */ #undef HAVE_NETINET_IN_H +/* Define if you have the <regex.h> header file. */ +#undef HAVE_REGEX_H + /* Define if you have the <stdlib.h> header file. */ #undef HAVE_STDLIB_H @@ -1,7 +1,7 @@ #! /bin/sh -# From configure.in for Bash 2.05b, version 2.144, from autoconf version 2.52. +# From configure.in for Bash 3.0, version 3.154, from autoconf version 2.52. # Guess values for system-dependent variables and create Makefiles. -# Generated by Autoconf 2.52 for bash 2.05b. +# Generated by Autoconf 2.52 for bash 3.0-alpha. # # Report bugs to <bug-bash@gnu.org>. # @@ -186,8 +186,8 @@ mandir='${prefix}/man' # Identity of this package. PACKAGE_NAME='bash' PACKAGE_TARNAME='bash' -PACKAGE_VERSION='2.05b' -PACKAGE_STRING='bash 2.05b' +PACKAGE_VERSION='3.0-alpha' +PACKAGE_STRING='bash 3.0-alpha' PACKAGE_BUGREPORT='bug-bash@gnu.org' ac_prev= @@ -576,6 +576,10 @@ ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias +ac_env_DEBUGGER_START_FILE_set=${DEBUGGER_START_FILE+set} +ac_env_DEBUGGER_START_FILE_value=$DEBUGGER_START_FILE +ac_cv_env_DEBUGGER_START_FILE_set=${DEBUGGER_START_FILE+set} +ac_cv_env_DEBUGGER_START_FILE_value=$DEBUGGER_START_FILE ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} @@ -604,7 +608,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<EOF -\`configure' configures bash 2.05b to adapt to many kinds of systems. +\`configure' configures bash 3.0-alpha to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -665,7 +669,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of bash 2.05b:";; + short | recursive ) echo "Configuration of bash 3.0-alpha:";; esac cat <<\EOF @@ -683,6 +687,9 @@ Optional Features: include brace expansion --enable-command-timing enable the time reserved word and command timing --enable-cond-command enable the conditional command + --enable-cond-regexp enable extgended regular expression matching in + conditional commands + --enable-debugger enable support for bash debugger --enable-directory-stack enable builtins pushd/popd/dirs --enable-disabled-builtins @@ -693,6 +700,7 @@ Optional Features: --enable-help-builtin include the help builtin --enable-history turn on command history --enable-job-control enable job control features + --enable-multibyte enable multibyte characters if OS supports them --enable-net-redirections enable /dev/tcp/host/port redirection --enable-process-substitution @@ -719,6 +727,7 @@ Optional Features: Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-lispdir override the default lisp directory --with-afs if you are running AFS --with-bash-malloc use the Bash version of malloc --with-curses use the curses library instead of the termcap @@ -731,6 +740,8 @@ Optional Packages: --with-purify configure to postprocess with purify Some influential environment variables: + DEBUGGER_START_FILE + location of bash debugger initialization file CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a @@ -785,7 +796,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\EOF -bash configure 2.05b +bash configure 3.0-alpha generated by GNU Autoconf 2.52 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 @@ -800,7 +811,7 @@ cat >&5 <<EOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by bash $as_me 2.05b, which was +It was created by bash $as_me 3.0-alpha, which was generated by GNU Autoconf 2.52. Invocation command line was $ $0 $@ @@ -925,7 +936,7 @@ if test -z "$CONFIG_SITE"; then fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then - { echo "$as_me:928: loading site script $ac_site_file" >&5 + { echo "$as_me:939: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} cat "$ac_site_file" >&5 . "$ac_site_file" @@ -936,7 +947,7 @@ if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then - { echo "$as_me:939: loading cache $cache_file" >&5 + { echo "$as_me:950: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; @@ -944,7 +955,7 @@ echo "$as_me: loading cache $cache_file" >&6;} esac fi else - { echo "$as_me:947: creating cache $cache_file" >&5 + { echo "$as_me:958: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi @@ -960,21 +971,21 @@ for ac_var in `(set) 2>&1 | eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) - { echo "$as_me:963: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 + { echo "$as_me:974: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) - { echo "$as_me:967: error: \`$ac_var' was not set in the previous run" >&5 + { echo "$as_me:978: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:973: error: \`$ac_var' has changed since the previous run:" >&5 + { echo "$as_me:984: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:975: former value: $ac_old_val" >&5 + { echo "$as_me:986: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:977: current value: $ac_new_val" >&5 + { echo "$as_me:988: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; @@ -993,9 +1004,9 @@ echo "$as_me: current value: $ac_new_val" >&2;} fi done if $ac_cache_corrupted; then - { echo "$as_me:996: error: changes in the environment can compromise the build" >&5 + { echo "$as_me:1007: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:998: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 + { { echo "$as_me:1009: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi @@ -1015,10 +1026,10 @@ esac echo "#! $SHELL" >conftest.sh echo "exit 0" >>conftest.sh chmod +x conftest.sh -if { (echo "$as_me:1018: PATH=\".;.\"; conftest.sh") >&5 +if { (echo "$as_me:1029: PATH=\".;.\"; conftest.sh") >&5 (PATH=".;."; conftest.sh) 2>&5 ac_status=$? - echo "$as_me:1021: \$? = $ac_status" >&5 + echo "$as_me:1032: \$? = $ac_status" >&5 (exit $ac_status); }; then ac_path_separator=';' else @@ -1044,7 +1055,7 @@ for ac_dir in ./support $srcdir/./support; do fi done if test -z "$ac_aux_dir"; then - { { echo "$as_me:1047: error: cannot find install-sh or install.sh in ./support $srcdir/./support" >&5 + { { echo "$as_me:1058: error: cannot find install-sh or install.sh in ./support $srcdir/./support" >&5 echo "$as_me: error: cannot find install-sh or install.sh in ./support $srcdir/./support" >&2;} { (exit 1); exit 1; }; } fi @@ -1054,8 +1065,8 @@ ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. ac_config_headers="$ac_config_headers config.h" -BASHVERS=2.05b -RELSTATUS=release +BASHVERS=3.0 +RELSTATUS=alpha case "$RELSTATUS" in alp*|bet*|dev*|rc*) DEBUG='-DDEBUG' MALLOC_DEBUG='-DMALLOC_DEBUG' ;; @@ -1064,11 +1075,11 @@ esac # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || - { { echo "$as_me:1067: error: cannot run $ac_config_sub" >&5 + { { echo "$as_me:1078: error: cannot run $ac_config_sub" >&5 echo "$as_me: error: cannot run $ac_config_sub" >&2;} { (exit 1); exit 1; }; } -echo "$as_me:1071: checking build system type" >&5 +echo "$as_me:1082: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6 if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1077,23 +1088,23 @@ else test -z "$ac_cv_build_alias" && ac_cv_build_alias=`$ac_config_guess` test -z "$ac_cv_build_alias" && - { { echo "$as_me:1080: error: cannot guess build type; you must specify one" >&5 + { { echo "$as_me:1091: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || - { { echo "$as_me:1084: error: $ac_config_sub $ac_cv_build_alias failed." >&5 + { { echo "$as_me:1095: error: $ac_config_sub $ac_cv_build_alias failed." >&5 echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed." >&2;} { (exit 1); exit 1; }; } fi -echo "$as_me:1089: result: $ac_cv_build" >&5 +echo "$as_me:1100: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6 build=$ac_cv_build build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$as_me:1096: checking host system type" >&5 +echo "$as_me:1107: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6 if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1102,12 +1113,12 @@ else test -z "$ac_cv_host_alias" && ac_cv_host_alias=$ac_cv_build_alias ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || - { { echo "$as_me:1105: error: $ac_config_sub $ac_cv_host_alias failed" >&5 + { { echo "$as_me:1116: error: $ac_config_sub $ac_cv_host_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} { (exit 1); exit 1; }; } fi -echo "$as_me:1110: result: $ac_cv_host" >&5 +echo "$as_me:1121: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6 host=$ac_cv_host host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` @@ -1132,6 +1143,7 @@ sparc-netbsd*) opt_bash_malloc=no ;; # needs 8-byte alignment mips-irix6*) opt_bash_malloc=no ;; # needs 8-byte alignment m68k-sysv) opt_bash_malloc=no ;; # fixes file descriptor leak in closedir sparc-linux*) opt_bash_malloc=no ;; # sparc running linux; requires ELF +*-freebsd*-gnu) opt_bash_malloc=no ;; # there's some undetermined problem here #*-freebsd*) opt_bash_malloc=no ;; # they claim it's better; I disagree *-openbsd*) opt_bash_malloc=no ;; # they claim it needs eight-bit alignment *-aix*) opt_bash_malloc=no ;; # AIX machines @@ -1154,6 +1166,78 @@ sco3.2v5*|sco3.2v4*) opt_memscramble=no ;; *) opt_memscramble=yes ;; esac +# Check whether --with-lispdir or --without-lispdir was given. +if test "${with_lispdir+set}" = set; then + withval="$with_lispdir" + lispdir="$withval" + echo "$as_me:1173: checking where .elc files should go" >&5 +echo $ECHO_N "checking where .elc files should go... $ECHO_C" >&6 + echo "$as_me:1175: result: $lispdir" >&5 +echo "${ECHO_T}$lispdir" >&6 +else + + # If set to t, that means we are running in a shell under Emacs. + # If you have an Emacs named "t", then use the full path. + test x"$EMACS" = xt && EMACS= + for ac_prog in emacs xemacs +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 "$as_me:1186: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_EMACS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$EMACS"; then + ac_cv_prog_EMACS="$EMACS" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_EMACS="$ac_prog" +echo "$as_me:1201: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +EMACS=$ac_cv_prog_EMACS +if test -n "$EMACS"; then + echo "$as_me:1209: result: $EMACS" >&5 +echo "${ECHO_T}$EMACS" >&6 +else + echo "$as_me:1212: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$EMACS" && break +done +test -n "$EMACS" || EMACS="no" + + if test $EMACS != "no"; then + if test x${lispdir+set} != xset; then + echo "$as_me:1222: checking where .elc files should go" >&5 +echo $ECHO_N "checking where .elc files should go... $ECHO_C" >&6 +if test "${am_cv_lispdir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + am_cv_lispdir=`$EMACS -batch -q -eval '(while load-path (princ (concat (car load-path) "\n")) (setq load-path (cdr load-path)))' | sed -n -e 's,/$,,' -e '/.*\/lib\/\(x\?emacs\/site-lisp\)$/{s,,${libdir}/\1,;p;q;}' -e '/.*\/share\/\(x\?emacs\/site-lisp\)$/{s,,${datadir}/\1,;p;q;}'` + if test -z "$am_cv_lispdir"; then + am_cv_lispdir='${datadir}/emacs/site-lisp' + fi + +fi +echo "$as_me:1233: result: $am_cv_lispdir" >&5 +echo "${ECHO_T}$am_cv_lispdir" >&6 + lispdir="$am_cv_lispdir" + fi + fi + +fi; + # Check whether --with-afs or --without-afs was given. if test "${with_afs+set}" = set; then withval="$with_afs" @@ -1241,6 +1325,10 @@ if test "$opt_curses" = yes; then prefer_curses=yes fi +if test -z "${DEBUGGER_START_FILE}"; then + DEBUGGER_START_FILE=${ac_default_prefix}/lib/bashdb/bashdb-main.inc +fi + opt_minimal_config=no opt_job_control=yes @@ -1262,10 +1350,13 @@ opt_disabled_builtins=no opt_command_timing=yes opt_xpg_echo=no opt_cond_command=yes +opt_cond_regexp=yes opt_arith_for_command=yes opt_net_redirs=yes opt_progcomp=yes opt_separate_help=no +opt_multibyte=yes +opt_debugger=yes opt_static_link=no opt_profiling=no @@ -1284,6 +1375,7 @@ if test $opt_minimal_config = yes; then opt_brace_expansion=no opt_disabled_builtins=no opt_command_timing=no opt_extended_glob=no opt_cond_command=no opt_arith_for_command=no opt_net_redirs=no opt_progcomp=no opt_separate_help=no + opt_multibyte=yes opt_cond_regexp=no fi # Check whether --enable-alias or --disable-alias was given. @@ -1321,6 +1413,16 @@ if test "${enable_cond_command+set}" = set; then enableval="$enable_cond_command" opt_cond_command=$enableval fi; +# Check whether --enable-cond-regexp or --disable-cond-regexp was given. +if test "${enable_cond_regexp+set}" = set; then + enableval="$enable_cond_regexp" + opt_cond_regexp=$enableval +fi; +# Check whether --enable-debugger or --disable-debugger was given. +if test "${enable_debugger+set}" = set; then + enableval="$enable_debugger" + opt_debugger=$enableval +fi; # Check whether --enable-directory-stack or --disable-directory-stack was given. if test "${enable_directory_stack+set}" = set; then enableval="$enable_directory_stack" @@ -1356,6 +1458,11 @@ if test "${enable_job_control+set}" = set; then enableval="$enable_job_control" opt_job_control=$enableval fi; +# Check whether --enable-multibyte or --disable-multibyte was given. +if test "${enable_multibyte+set}" = set; then + enableval="$enable_multibyte" + opt_multibyte=$enableval +fi; # Check whether --enable-net-redirections or --disable-net-redirections was given. if test "${enable_net_redirections+set}" = set; then enableval="$enable_net_redirections" @@ -1513,6 +1620,12 @@ cat >>confdefs.h <<\EOF EOF fi +if test $opt_cond_regexp = yes ; then +cat >>confdefs.h <<\EOF +#define COND_REGEXP 1 +EOF + +fi if test $opt_arith_for_command = yes; then cat >>confdefs.h <<\EOF #define ARITH_FOR_COMMAND 1 @@ -1531,6 +1644,18 @@ cat >>confdefs.h <<\EOF EOF fi +if test $opt_multibyte = no; then +cat >>confdefs.h <<\EOF +#define NO_MULTIBYTE_SUPPORT 1 +EOF + +fi +if test $opt_debugger = yes; then +cat >>confdefs.h <<\EOF +#define DEBUGGER 1 +EOF + +fi if test $opt_memscramble = yes; then cat >>confdefs.h <<\EOF @@ -1568,7 +1693,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -echo "$as_me:1571: checking for $ac_word" >&5 +echo "$as_me:1696: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1583,7 +1708,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="${ac_tool_prefix}gcc" -echo "$as_me:1586: found $ac_dir/$ac_word" >&5 +echo "$as_me:1711: found $ac_dir/$ac_word" >&5 break done @@ -1591,10 +1716,10 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:1594: result: $CC" >&5 + echo "$as_me:1719: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else - echo "$as_me:1597: result: no" >&5 + echo "$as_me:1722: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1603,7 +1728,7 @@ if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -echo "$as_me:1606: checking for $ac_word" >&5 +echo "$as_me:1731: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1618,7 +1743,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="gcc" -echo "$as_me:1621: found $ac_dir/$ac_word" >&5 +echo "$as_me:1746: found $ac_dir/$ac_word" >&5 break done @@ -1626,10 +1751,10 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - echo "$as_me:1629: result: $ac_ct_CC" >&5 + echo "$as_me:1754: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else - echo "$as_me:1632: result: no" >&5 + echo "$as_me:1757: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1642,7 +1767,7 @@ if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -echo "$as_me:1645: checking for $ac_word" >&5 +echo "$as_me:1770: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1657,7 +1782,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="${ac_tool_prefix}cc" -echo "$as_me:1660: found $ac_dir/$ac_word" >&5 +echo "$as_me:1785: found $ac_dir/$ac_word" >&5 break done @@ -1665,10 +1790,10 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:1668: result: $CC" >&5 + echo "$as_me:1793: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else - echo "$as_me:1671: result: no" >&5 + echo "$as_me:1796: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1677,7 +1802,7 @@ if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -echo "$as_me:1680: checking for $ac_word" >&5 +echo "$as_me:1805: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1692,7 +1817,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="cc" -echo "$as_me:1695: found $ac_dir/$ac_word" >&5 +echo "$as_me:1820: found $ac_dir/$ac_word" >&5 break done @@ -1700,10 +1825,10 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - echo "$as_me:1703: result: $ac_ct_CC" >&5 + echo "$as_me:1828: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else - echo "$as_me:1706: result: no" >&5 + echo "$as_me:1831: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1716,7 +1841,7 @@ fi 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 "$as_me:1719: checking for $ac_word" >&5 +echo "$as_me:1844: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1736,7 +1861,7 @@ if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then continue fi ac_cv_prog_CC="cc" -echo "$as_me:1739: found $ac_dir/$ac_word" >&5 +echo "$as_me:1864: found $ac_dir/$ac_word" >&5 break done @@ -1758,10 +1883,10 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:1761: result: $CC" >&5 + echo "$as_me:1886: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else - echo "$as_me:1764: result: no" >&5 + echo "$as_me:1889: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1772,7 +1897,7 @@ if test -z "$CC"; then do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -echo "$as_me:1775: checking for $ac_word" >&5 +echo "$as_me:1900: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1787,7 +1912,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="$ac_tool_prefix$ac_prog" -echo "$as_me:1790: found $ac_dir/$ac_word" >&5 +echo "$as_me:1915: found $ac_dir/$ac_word" >&5 break done @@ -1795,10 +1920,10 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:1798: result: $CC" >&5 + echo "$as_me:1923: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else - echo "$as_me:1801: result: no" >&5 + echo "$as_me:1926: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1811,7 +1936,7 @@ if test -z "$CC"; then 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 "$as_me:1814: checking for $ac_word" >&5 +echo "$as_me:1939: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1826,7 +1951,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="$ac_prog" -echo "$as_me:1829: found $ac_dir/$ac_word" >&5 +echo "$as_me:1954: found $ac_dir/$ac_word" >&5 break done @@ -1834,10 +1959,10 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - echo "$as_me:1837: result: $ac_ct_CC" >&5 + echo "$as_me:1962: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else - echo "$as_me:1840: result: no" >&5 + echo "$as_me:1965: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1849,32 +1974,32 @@ fi fi -test -z "$CC" && { { echo "$as_me:1852: error: no acceptable cc found in \$PATH" >&5 +test -z "$CC" && { { echo "$as_me:1977: error: no acceptable cc found in \$PATH" >&5 echo "$as_me: error: no acceptable cc found in \$PATH" >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. -echo "$as_me:1857:" \ +echo "$as_me:1982:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:1860: \"$ac_compiler --version </dev/null >&5\"") >&5 +{ (eval echo "$as_me:1985: \"$ac_compiler --version </dev/null >&5\"") >&5 (eval $ac_compiler --version </dev/null >&5) 2>&5 ac_status=$? - echo "$as_me:1863: \$? = $ac_status" >&5 + echo "$as_me:1988: \$? = $ac_status" >&5 (exit $ac_status); } -{ (eval echo "$as_me:1865: \"$ac_compiler -v </dev/null >&5\"") >&5 +{ (eval echo "$as_me:1990: \"$ac_compiler -v </dev/null >&5\"") >&5 (eval $ac_compiler -v </dev/null >&5) 2>&5 ac_status=$? - echo "$as_me:1868: \$? = $ac_status" >&5 + echo "$as_me:1993: \$? = $ac_status" >&5 (exit $ac_status); } -{ (eval echo "$as_me:1870: \"$ac_compiler -V </dev/null >&5\"") >&5 +{ (eval echo "$as_me:1995: \"$ac_compiler -V </dev/null >&5\"") >&5 (eval $ac_compiler -V </dev/null >&5) 2>&5 ac_status=$? - echo "$as_me:1873: \$? = $ac_status" >&5 + echo "$as_me:1998: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF -#line 1877 "configure" +#line 2002 "configure" #include "confdefs.h" int @@ -1890,13 +2015,13 @@ ac_clean_files="$ac_clean_files a.out a.exe" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -echo "$as_me:1893: checking for C compiler default output" >&5 +echo "$as_me:2018: checking for C compiler default output" >&5 echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -if { (eval echo "$as_me:1896: \"$ac_link_default\"") >&5 +if { (eval echo "$as_me:2021: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? - echo "$as_me:1899: \$? = $ac_status" >&5 + echo "$as_me:2024: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last @@ -1919,34 +2044,34 @@ done else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -{ { echo "$as_me:1922: error: C compiler cannot create executables" >&5 +{ { echo "$as_me:2047: error: C compiler cannot create executables" >&5 echo "$as_me: error: C compiler cannot create executables" >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext -echo "$as_me:1928: result: $ac_file" >&5 +echo "$as_me:2053: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -echo "$as_me:1933: checking whether the C compiler works" >&5 +echo "$as_me:2058: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' - { (eval echo "$as_me:1939: \"$ac_try\"") >&5 + { (eval echo "$as_me:2064: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:1942: \$? = $ac_status" >&5 + echo "$as_me:2067: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else - { { echo "$as_me:1949: error: cannot run C compiled programs. + { { echo "$as_me:2074: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'." >&2;} @@ -1954,24 +2079,24 @@ If you meant to cross compile, use \`--host'." >&2;} fi fi fi -echo "$as_me:1957: result: yes" >&5 +echo "$as_me:2082: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -echo "$as_me:1964: checking whether we are cross compiling" >&5 +echo "$as_me:2089: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 -echo "$as_me:1966: result: $cross_compiling" >&5 +echo "$as_me:2091: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 -echo "$as_me:1969: checking for executable suffix" >&5 +echo "$as_me:2094: checking for executable suffix" >&5 echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6 -if { (eval echo "$as_me:1971: \"$ac_link\"") >&5 +if { (eval echo "$as_me:2096: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:1974: \$? = $ac_status" >&5 + echo "$as_me:2099: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will @@ -1987,25 +2112,25 @@ for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do esac done else - { { echo "$as_me:1990: error: cannot compute EXEEXT: cannot compile and link" >&5 + { { echo "$as_me:2115: error: cannot compute EXEEXT: cannot compile and link" >&5 echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext -echo "$as_me:1996: result: $ac_cv_exeext" >&5 +echo "$as_me:2121: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT -echo "$as_me:2002: checking for object suffix" >&5 +echo "$as_me:2127: checking for object suffix" >&5 echo $ECHO_N "checking for object suffix... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 2008 "configure" +#line 2133 "configure" #include "confdefs.h" int @@ -2017,10 +2142,10 @@ main () } _ACEOF rm -f conftest.o conftest.obj -if { (eval echo "$as_me:2020: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2145: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2023: \$? = $ac_status" >&5 + echo "$as_me:2148: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in @@ -2032,24 +2157,24 @@ done else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -{ { echo "$as_me:2035: error: cannot compute OBJEXT: cannot compile" >&5 +{ { echo "$as_me:2160: error: cannot compute OBJEXT: cannot compile" >&5 echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -echo "$as_me:2042: result: $ac_cv_objext" >&5 +echo "$as_me:2167: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -echo "$as_me:2046: checking whether we are using the GNU C compiler" >&5 +echo "$as_me:2171: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 2052 "configure" +#line 2177 "configure" #include "confdefs.h" int @@ -2064,16 +2189,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2067: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2192: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2070: \$? = $ac_status" >&5 + echo "$as_me:2195: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2073: \"$ac_try\"") >&5 + { (eval echo "$as_me:2198: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2076: \$? = $ac_status" >&5 + echo "$as_me:2201: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else @@ -2085,19 +2210,19 @@ rm -f conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -echo "$as_me:2088: result: $ac_cv_c_compiler_gnu" >&5 +echo "$as_me:2213: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" -echo "$as_me:2094: checking whether $CC accepts -g" >&5 +echo "$as_me:2219: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 2100 "configure" +#line 2225 "configure" #include "confdefs.h" int @@ -2109,16 +2234,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2112: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2237: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2115: \$? = $ac_status" >&5 + echo "$as_me:2240: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2118: \"$ac_try\"") >&5 + { (eval echo "$as_me:2243: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2121: \$? = $ac_status" >&5 + echo "$as_me:2246: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else @@ -2128,7 +2253,7 @@ ac_cv_prog_cc_g=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:2131: result: $ac_cv_prog_cc_g" >&5 +echo "$as_me:2256: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS @@ -2155,16 +2280,16 @@ cat >conftest.$ac_ext <<_ACEOF #endif _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2158: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2283: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2161: \$? = $ac_status" >&5 + echo "$as_me:2286: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2164: \"$ac_try\"") >&5 + { (eval echo "$as_me:2289: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2167: \$? = $ac_status" >&5 + echo "$as_me:2292: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ ''\ @@ -2176,7 +2301,7 @@ if { (eval echo "$as_me:2158: \"$ac_compile\"") >&5 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF -#line 2179 "configure" +#line 2304 "configure" #include "confdefs.h" #include <stdlib.h> $ac_declaration @@ -2189,16 +2314,16 @@ exit (42); } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2192: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2317: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2195: \$? = $ac_status" >&5 + echo "$as_me:2320: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2198: \"$ac_try\"") >&5 + { (eval echo "$as_me:2323: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2201: \$? = $ac_status" >&5 + echo "$as_me:2326: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -2208,7 +2333,7 @@ continue fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF -#line 2211 "configure" +#line 2336 "configure" #include "confdefs.h" $ac_declaration int @@ -2220,16 +2345,16 @@ exit (42); } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2223: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2348: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2226: \$? = $ac_status" >&5 + echo "$as_me:2351: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2229: \"$ac_try\"") >&5 + { (eval echo "$as_me:2354: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2232: \$? = $ac_status" >&5 + echo "$as_me:2357: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else @@ -2256,12 +2381,12 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -echo "$as_me:2259: checking for POSIXized ISC" >&5 +echo "$as_me:2384: checking for POSIXized ISC" >&5 echo $ECHO_N "checking for POSIXized ISC... $ECHO_C" >&6 if test -d /etc/conf/kconfig.d && grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 then - echo "$as_me:2264: result: yes" >&5 + echo "$as_me:2389: result: yes" >&5 echo "${ECHO_T}yes" >&6 ISC=yes # If later tests want to check for ISC. @@ -2275,7 +2400,7 @@ EOF CC="$CC -Xp" fi else - echo "$as_me:2278: result: no" >&5 + echo "$as_me:2403: result: no" >&5 echo "${ECHO_T}no" >&6 ISC= fi @@ -2285,7 +2410,7 @@ ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -echo "$as_me:2288: checking how to run the C preprocessor" >&5 +echo "$as_me:2413: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then @@ -2306,18 +2431,18 @@ do # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF -#line 2309 "configure" +#line 2434 "configure" #include "confdefs.h" #include <assert.h> Syntax error _ACEOF -if { (eval echo "$as_me:2314: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:2439: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:2320: \$? = $ac_status" >&5 + echo "$as_me:2445: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -2340,17 +2465,17 @@ rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF -#line 2343 "configure" +#line 2468 "configure" #include "confdefs.h" #include <ac_nonexistent.h> _ACEOF -if { (eval echo "$as_me:2347: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:2472: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:2353: \$? = $ac_status" >&5 + echo "$as_me:2478: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -2387,7 +2512,7 @@ fi else ac_cv_prog_CPP=$CPP fi -echo "$as_me:2390: result: $CPP" >&5 +echo "$as_me:2515: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes @@ -2397,18 +2522,18 @@ do # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF -#line 2400 "configure" +#line 2525 "configure" #include "confdefs.h" #include <assert.h> Syntax error _ACEOF -if { (eval echo "$as_me:2405: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:2530: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:2411: \$? = $ac_status" >&5 + echo "$as_me:2536: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -2431,17 +2556,17 @@ rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF -#line 2434 "configure" +#line 2559 "configure" #include "confdefs.h" #include <ac_nonexistent.h> _ACEOF -if { (eval echo "$as_me:2438: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:2563: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:2444: \$? = $ac_status" >&5 + echo "$as_me:2569: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -2469,7 +2594,7 @@ rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else - { { echo "$as_me:2472: error: C preprocessor \"$CPP\" fails sanity check" >&5 + { { echo "$as_me:2597: error: C preprocessor \"$CPP\" fails sanity check" >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} { (exit 1); exit 1; }; } fi @@ -2480,23 +2605,23 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -echo "$as_me:2483: checking for minix/config.h" >&5 +echo "$as_me:2608: checking for minix/config.h" >&5 echo $ECHO_N "checking for minix/config.h... $ECHO_C" >&6 if test "${ac_cv_header_minix_config_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 2489 "configure" +#line 2614 "configure" #include "confdefs.h" #include <minix/config.h> _ACEOF -if { (eval echo "$as_me:2493: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:2618: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:2499: \$? = $ac_status" >&5 + echo "$as_me:2624: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -2515,7 +2640,7 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:2518: result: $ac_cv_header_minix_config_h" >&5 +echo "$as_me:2643: result: $ac_cv_header_minix_config_h" >&5 echo "${ECHO_T}$ac_cv_header_minix_config_h" >&6 if test $ac_cv_header_minix_config_h = yes; then MINIX=yes @@ -2556,7 +2681,7 @@ if test "${enable_largefile+set}" = set; then fi; if test "$enable_largefile" != no; then - echo "$as_me:2559: checking for special C compiler options needed for large files" >&5 + echo "$as_me:2684: checking for special C compiler options needed for large files" >&5 echo $ECHO_N "checking for special C compiler options needed for large files... $ECHO_C" >&6 if test "${ac_cv_sys_largefile_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -2568,7 +2693,7 @@ else # IRIX 6.2 and later do not support large files by default, # so use the C compiler's -n32 option if that helps. cat >conftest.$ac_ext <<_ACEOF -#line 2571 "configure" +#line 2696 "configure" #include "confdefs.h" #include <sys/types.h> /* Check that off_t can represent 2**63 - 1 correctly. @@ -2588,16 +2713,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2591: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2716: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2594: \$? = $ac_status" >&5 + echo "$as_me:2719: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2597: \"$ac_try\"") >&5 + { (eval echo "$as_me:2722: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2600: \$? = $ac_status" >&5 + echo "$as_me:2725: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else @@ -2607,16 +2732,16 @@ fi rm -f conftest.$ac_objext CC="$CC -n32" rm -f conftest.$ac_objext -if { (eval echo "$as_me:2610: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2735: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2613: \$? = $ac_status" >&5 + echo "$as_me:2738: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2616: \"$ac_try\"") >&5 + { (eval echo "$as_me:2741: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2619: \$? = $ac_status" >&5 + echo "$as_me:2744: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sys_largefile_CC=' -n32'; break else @@ -2630,13 +2755,13 @@ rm -f conftest.$ac_objext rm -f conftest.$ac_ext fi fi -echo "$as_me:2633: result: $ac_cv_sys_largefile_CC" >&5 +echo "$as_me:2758: result: $ac_cv_sys_largefile_CC" >&5 echo "${ECHO_T}$ac_cv_sys_largefile_CC" >&6 if test "$ac_cv_sys_largefile_CC" != no; then CC=$CC$ac_cv_sys_largefile_CC fi - echo "$as_me:2639: checking for _FILE_OFFSET_BITS value needed for large files" >&5 + echo "$as_me:2764: checking for _FILE_OFFSET_BITS value needed for large files" >&5 echo $ECHO_N "checking for _FILE_OFFSET_BITS value needed for large files... $ECHO_C" >&6 if test "${ac_cv_sys_file_offset_bits+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -2644,7 +2769,7 @@ else while :; do ac_cv_sys_file_offset_bits=no cat >conftest.$ac_ext <<_ACEOF -#line 2647 "configure" +#line 2772 "configure" #include "confdefs.h" #include <sys/types.h> /* Check that off_t can represent 2**63 - 1 correctly. @@ -2664,16 +2789,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2667: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2792: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2670: \$? = $ac_status" >&5 + echo "$as_me:2795: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2673: \"$ac_try\"") >&5 + { (eval echo "$as_me:2798: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2676: \$? = $ac_status" >&5 + echo "$as_me:2801: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else @@ -2682,7 +2807,7 @@ cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF -#line 2685 "configure" +#line 2810 "configure" #include "confdefs.h" #define _FILE_OFFSET_BITS 64 #include <sys/types.h> @@ -2703,16 +2828,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2706: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2831: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2709: \$? = $ac_status" >&5 + echo "$as_me:2834: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2712: \"$ac_try\"") >&5 + { (eval echo "$as_me:2837: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2715: \$? = $ac_status" >&5 + echo "$as_me:2840: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sys_file_offset_bits=64; break else @@ -2723,7 +2848,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext break done fi -echo "$as_me:2726: result: $ac_cv_sys_file_offset_bits" >&5 +echo "$as_me:2851: result: $ac_cv_sys_file_offset_bits" >&5 echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6 if test "$ac_cv_sys_file_offset_bits" != no; then @@ -2733,7 +2858,7 @@ EOF fi rm -f conftest* - echo "$as_me:2736: checking for _LARGE_FILES value needed for large files" >&5 + echo "$as_me:2861: checking for _LARGE_FILES value needed for large files" >&5 echo $ECHO_N "checking for _LARGE_FILES value needed for large files... $ECHO_C" >&6 if test "${ac_cv_sys_large_files+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -2741,7 +2866,7 @@ else while :; do ac_cv_sys_large_files=no cat >conftest.$ac_ext <<_ACEOF -#line 2744 "configure" +#line 2869 "configure" #include "confdefs.h" #include <sys/types.h> /* Check that off_t can represent 2**63 - 1 correctly. @@ -2761,16 +2886,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2764: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2889: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2767: \$? = $ac_status" >&5 + echo "$as_me:2892: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2770: \"$ac_try\"") >&5 + { (eval echo "$as_me:2895: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2773: \$? = $ac_status" >&5 + echo "$as_me:2898: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else @@ -2779,7 +2904,7 @@ cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF -#line 2782 "configure" +#line 2907 "configure" #include "confdefs.h" #define _LARGE_FILES 1 #include <sys/types.h> @@ -2800,16 +2925,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2803: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2928: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2806: \$? = $ac_status" >&5 + echo "$as_me:2931: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2809: \"$ac_try\"") >&5 + { (eval echo "$as_me:2934: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2812: \$? = $ac_status" >&5 + echo "$as_me:2937: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sys_large_files=1; break else @@ -2820,7 +2945,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext break done fi -echo "$as_me:2823: result: $ac_cv_sys_large_files" >&5 +echo "$as_me:2948: result: $ac_cv_sys_large_files" >&5 echo "${ECHO_T}$ac_cv_sys_large_files" >&6 if test "$ac_cv_sys_large_files" != no; then @@ -2890,14 +3015,14 @@ test -z "$CPPFLAGS_FOR_BUILD" && CPPFLAGS_FOR_BUILD="$CPPFLAGS" test -z "$CFLAGS_FOR_BUILD" && CFLAGS_FOR_BUILD="-g" if test $ac_cv_c_compiler_gnu = yes; then - echo "$as_me:2893: checking whether $CC needs -traditional" >&5 + echo "$as_me:3018: checking whether $CC needs -traditional" >&5 echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6 if test "${ac_cv_prog_gcc_traditional+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_pattern="Autoconf.*'x'" cat >conftest.$ac_ext <<_ACEOF -#line 2900 "configure" +#line 3025 "configure" #include "confdefs.h" #include <sgtty.h> Autoconf TIOCGETP @@ -2912,7 +3037,7 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat >conftest.$ac_ext <<_ACEOF -#line 2915 "configure" +#line 3040 "configure" #include "confdefs.h" #include <termio.h> Autoconf TCGETA @@ -2925,7 +3050,7 @@ rm -f conftest* fi fi -echo "$as_me:2928: result: $ac_cv_prog_gcc_traditional" >&5 +echo "$as_me:3053: result: $ac_cv_prog_gcc_traditional" >&5 echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6 if test $ac_cv_prog_gcc_traditional = yes; then CC="$CC -traditional" @@ -2941,14 +3066,75 @@ then if test "X$bash_cv_termcap_lib" = "X"; then _bash_needmsg=yes else -echo "$as_me:2944: checking which library has the termcap functions" >&5 +echo "$as_me:3069: checking which library has the termcap functions" >&5 echo $ECHO_N "checking which library has the termcap functions... $ECHO_C" >&6 _bash_needmsg= fi if test "${bash_cv_termcap_lib+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo "$as_me:2951: checking for tgetent in -ltermcap" >&5 + echo "$as_me:3076: checking for tgetent" >&5 +echo $ECHO_N "checking for tgetent... $ECHO_C" >&6 +if test "${ac_cv_func_tgetent+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 3082 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char tgetent (); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char tgetent (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_tgetent) || defined (__stub___tgetent) +choke me +#else +f = tgetent; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:3113: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:3116: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:3119: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3122: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_tgetent=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_tgetent=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:3132: result: $ac_cv_func_tgetent" >&5 +echo "${ECHO_T}$ac_cv_func_tgetent" >&6 +if test $ac_cv_func_tgetent = yes; then + bash_cv_termcap_lib=libc +else + echo "$as_me:3137: checking for tgetent in -ltermcap" >&5 echo $ECHO_N "checking for tgetent in -ltermcap... $ECHO_C" >&6 if test "${ac_cv_lib_termcap_tgetent+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -2956,7 +3142,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ltermcap $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 2959 "configure" +#line 3145 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -2975,16 +3161,16 @@ tgetent (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:2978: \"$ac_link\"") >&5 +if { (eval echo "$as_me:3164: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:2981: \$? = $ac_status" >&5 + echo "$as_me:3167: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:2984: \"$ac_try\"") >&5 + { (eval echo "$as_me:3170: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2987: \$? = $ac_status" >&5 + echo "$as_me:3173: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_termcap_tgetent=yes else @@ -2995,12 +3181,12 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:2998: result: $ac_cv_lib_termcap_tgetent" >&5 +echo "$as_me:3184: result: $ac_cv_lib_termcap_tgetent" >&5 echo "${ECHO_T}$ac_cv_lib_termcap_tgetent" >&6 if test $ac_cv_lib_termcap_tgetent = yes; then bash_cv_termcap_lib=libtermcap else - echo "$as_me:3003: checking for tgetent in -ltinfo" >&5 + echo "$as_me:3189: checking for tgetent in -ltinfo" >&5 echo $ECHO_N "checking for tgetent in -ltinfo... $ECHO_C" >&6 if test "${ac_cv_lib_tinfo_tgetent+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3008,7 +3194,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ltinfo $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 3011 "configure" +#line 3197 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -3027,16 +3213,16 @@ tgetent (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:3030: \"$ac_link\"") >&5 +if { (eval echo "$as_me:3216: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:3033: \$? = $ac_status" >&5 + echo "$as_me:3219: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:3036: \"$ac_try\"") >&5 + { (eval echo "$as_me:3222: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3039: \$? = $ac_status" >&5 + echo "$as_me:3225: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_tinfo_tgetent=yes else @@ -3047,12 +3233,12 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:3050: result: $ac_cv_lib_tinfo_tgetent" >&5 +echo "$as_me:3236: result: $ac_cv_lib_tinfo_tgetent" >&5 echo "${ECHO_T}$ac_cv_lib_tinfo_tgetent" >&6 if test $ac_cv_lib_tinfo_tgetent = yes; then bash_cv_termcap_lib=libtinfo else - echo "$as_me:3055: checking for tgetent in -lcurses" >&5 + echo "$as_me:3241: checking for tgetent in -lcurses" >&5 echo $ECHO_N "checking for tgetent in -lcurses... $ECHO_C" >&6 if test "${ac_cv_lib_curses_tgetent+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3060,7 +3246,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lcurses $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 3063 "configure" +#line 3249 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -3079,16 +3265,16 @@ tgetent (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:3082: \"$ac_link\"") >&5 +if { (eval echo "$as_me:3268: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:3085: \$? = $ac_status" >&5 + echo "$as_me:3271: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:3088: \"$ac_try\"") >&5 + { (eval echo "$as_me:3274: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3091: \$? = $ac_status" >&5 + echo "$as_me:3277: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_curses_tgetent=yes else @@ -3099,12 +3285,12 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:3102: result: $ac_cv_lib_curses_tgetent" >&5 +echo "$as_me:3288: result: $ac_cv_lib_curses_tgetent" >&5 echo "${ECHO_T}$ac_cv_lib_curses_tgetent" >&6 if test $ac_cv_lib_curses_tgetent = yes; then bash_cv_termcap_lib=libcurses else - echo "$as_me:3107: checking for tgetent in -lncurses" >&5 + echo "$as_me:3293: checking for tgetent in -lncurses" >&5 echo $ECHO_N "checking for tgetent in -lncurses... $ECHO_C" >&6 if test "${ac_cv_lib_ncurses_tgetent+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3112,7 +3298,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lncurses $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 3115 "configure" +#line 3301 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -3131,16 +3317,16 @@ tgetent (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:3134: \"$ac_link\"") >&5 +if { (eval echo "$as_me:3320: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:3137: \$? = $ac_status" >&5 + echo "$as_me:3323: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:3140: \"$ac_try\"") >&5 + { (eval echo "$as_me:3326: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3143: \$? = $ac_status" >&5 + echo "$as_me:3329: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_ncurses_tgetent=yes else @@ -3151,7 +3337,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:3154: result: $ac_cv_lib_ncurses_tgetent" >&5 +echo "$as_me:3340: result: $ac_cv_lib_ncurses_tgetent" >&5 echo "${ECHO_T}$ac_cv_lib_ncurses_tgetent" >&6 if test $ac_cv_lib_ncurses_tgetent = yes; then bash_cv_termcap_lib=libncurses @@ -3167,11 +3353,13 @@ fi fi +fi + if test "X$_bash_needmsg" = "Xyes"; then -echo "$as_me:3171: checking which library has the termcap functions" >&5 +echo "$as_me:3359: checking which library has the termcap functions" >&5 echo $ECHO_N "checking which library has the termcap functions... $ECHO_C" >&6 fi -echo "$as_me:3174: result: using $bash_cv_termcap_lib" >&5 +echo "$as_me:3362: result: using $bash_cv_termcap_lib" >&5 echo "${ECHO_T}using $bash_cv_termcap_lib" >&6 if test $bash_cv_termcap_lib = gnutermcap && test -z "$prefer_curses"; then LDFLAGS="$LDFLAGS -L./lib/termcap" @@ -3186,12 +3374,15 @@ TERMCAP_DEP= elif test $bash_cv_termcap_lib = libncurses; then TERMCAP_LIB=-lncurses TERMCAP_DEP= +elif test $bash_cv_termcap_lib = libc; then +TERMCAP_LIB= +TERMCAP_DEP= else TERMCAP_LIB=-lcurses TERMCAP_DEP= fi -echo "$as_me:3194: checking version of installed readline library" >&5 +echo "$as_me:3385: checking version of installed readline library" >&5 echo $ECHO_N "checking version of installed readline library... $ECHO_C" >&6 # What a pain in the ass this is. @@ -3216,11 +3407,14 @@ LIBS="$LIBS -lreadline ${TERMCAP_LIB}" CFLAGS="$CFLAGS -I${ac_cv_rl_includedir}" LDFLAGS="$LDFLAGS -L${ac_cv_rl_libdir}" -if test "$cross_compiling" = yes; then +if test "${ac_cv_rl_version+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then ac_cv_rl_version='4.2' else cat >conftest.$ac_ext <<_ACEOF -#line 3223 "configure" +#line 3417 "configure" #include "confdefs.h" #include <stdio.h> @@ -3238,15 +3432,15 @@ main() _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:3241: \"$ac_link\"") >&5 +if { (eval echo "$as_me:3435: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:3244: \$? = $ac_status" >&5 + echo "$as_me:3438: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:3246: \"$ac_try\"") >&5 + { (eval echo "$as_me:3440: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3249: \$? = $ac_status" >&5 + echo "$as_me:3443: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_rl_version=`cat conftest.rlv` else @@ -3257,6 +3451,7 @@ ac_cv_rl_version='0.0' fi rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi +fi CFLAGS="$_save_CFLAGS" LDFLAGS="$_save_LDFLAGS" @@ -3292,14 +3487,14 @@ RL_VERSION="0x${_RL_MAJOR}${_RL_MINOR}" # Readline versions greater than 4.2 have these defines in readline.h if test $ac_cv_rl_version = '0.0' ; then - { echo "$as_me:3295: WARNING: Could not test version of installed readline library." >&5 + { echo "$as_me:3490: WARNING: Could not test version of installed readline library." >&5 echo "$as_me: WARNING: Could not test version of installed readline library." >&2;} elif test $RL_MAJOR -gt 4 || { test $RL_MAJOR = 4 && test $RL_MINOR -gt 2 ; } ; then # set these for use by the caller RL_PREFIX=$ac_cv_rl_prefix RL_LIBDIR=$ac_cv_rl_libdir RL_INCLUDEDIR=$ac_cv_rl_includedir - echo "$as_me:3302: result: $ac_cv_rl_version" >&5 + echo "$as_me:3497: result: $ac_cv_rl_version" >&5 echo "${ECHO_T}$ac_cv_rl_version" >&6 else @@ -3320,17 +3515,17 @@ RL_PREFIX=$ac_cv_rl_prefix RL_LIBDIR=$ac_cv_rl_libdir RL_INCLUDEDIR=$ac_cv_rl_includedir -echo "$as_me:3323: result: $ac_cv_rl_version" >&5 +echo "$as_me:3518: result: $ac_cv_rl_version" >&5 echo "${ECHO_T}$ac_cv_rl_version" >&6 fi case "$ac_cv_rl_version" in - 4.[3-9]*|5*|6*|7*|8*|9*) ;; + 5*|6*|7*|8*|9*) ;; *) opt_with_installed_readline=no - { echo "$as_me:3331: WARNING: installed readline library is too old to be linked with bash" >&5 + { echo "$as_me:3526: WARNING: installed readline library is too old to be linked with bash" >&5 echo "$as_me: WARNING: installed readline library is too old to be linked with bash" >&2;} - { echo "$as_me:3333: WARNING: using private bash version" >&5 + { echo "$as_me:3528: WARNING: using private bash version" >&5 echo "$as_me: WARNING: using private bash version" >&2;} ;; esac @@ -3343,9 +3538,13 @@ EOF READLINE_LIB=-lreadline if test "$opt_with_installed_readline" != "no" ; then - case "$RL_INCLUDEDIR" in - /usr/include) ;; - *) RL_INCLUDE='-I${RL_INCLUDEDIR}' + case "$opt_with_installed_readline" in + yes) RL_INCLUDE= ;; + *) case "$RL_INCLUDEDIR" in + /usr/include) ;; + *) RL_INCLUDE='-I${RL_INCLUDEDIR}' ;; + esac + ;; esac READLINE_DEP= else @@ -3373,9 +3572,13 @@ EOF if test "$opt_with_installed_readline" != "no"; then HIST_LIBDIR=$RL_LIBDIR HISTORY_DEP= - case "$RL_INCLUDEDIR" in - /usr/include) ;; - *) RL_INCLUDE='-I${RL_INCLUDEDIR}' + case "$opt_with_installed_readline" in + yes) RL_INCLUDE= ;; + *) case "$RL_INCLUDEDIR" in + /usr/include) ;; + *) RL_INCLUDE='-I${RL_INCLUDEDIR}' ;; + esac + ;; esac else HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline' @@ -3398,7 +3601,7 @@ fi # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. -echo "$as_me:3401: checking for a BSD compatible install" >&5 +echo "$as_me:3604: checking for a BSD compatible install" >&5 echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then @@ -3447,7 +3650,7 @@ fi INSTALL=$ac_install_sh fi fi -echo "$as_me:3450: result: $INSTALL" >&5 +echo "$as_me:3653: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. @@ -3460,7 +3663,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 "$as_me:3463: checking for $ac_word" >&5 +echo "$as_me:3666: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3475,7 +3678,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_AR="" -echo "$as_me:3478: found $ac_dir/$ac_word" >&5 +echo "$as_me:3681: found $ac_dir/$ac_word" >&5 break done @@ -3484,10 +3687,10 @@ fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then - echo "$as_me:3487: result: $AR" >&5 + echo "$as_me:3690: result: $AR" >&5 echo "${ECHO_T}$AR" >&6 else - echo "$as_me:3490: result: no" >&5 + echo "$as_me:3693: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -3495,7 +3698,7 @@ test -n "$ARFLAGS" || ARFLAGS="cr" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -echo "$as_me:3498: checking for $ac_word" >&5 +echo "$as_me:3701: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3510,7 +3713,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" -echo "$as_me:3513: found $ac_dir/$ac_word" >&5 +echo "$as_me:3716: found $ac_dir/$ac_word" >&5 break done @@ -3518,10 +3721,10 @@ fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then - echo "$as_me:3521: result: $RANLIB" >&5 + echo "$as_me:3724: result: $RANLIB" >&5 echo "${ECHO_T}$RANLIB" >&6 else - echo "$as_me:3524: result: no" >&5 + echo "$as_me:3727: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -3530,7 +3733,7 @@ if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 -echo "$as_me:3533: checking for $ac_word" >&5 +echo "$as_me:3736: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3545,7 +3748,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_RANLIB="ranlib" -echo "$as_me:3548: found $ac_dir/$ac_word" >&5 +echo "$as_me:3751: found $ac_dir/$ac_word" >&5 break done @@ -3554,10 +3757,10 @@ fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then - echo "$as_me:3557: result: $ac_ct_RANLIB" >&5 + echo "$as_me:3760: result: $ac_ct_RANLIB" >&5 echo "${ECHO_T}$ac_ct_RANLIB" >&6 else - echo "$as_me:3560: result: no" >&5 + echo "$as_me:3763: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -3570,7 +3773,7 @@ for ac_prog in 'bison -y' byacc 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 "$as_me:3573: checking for $ac_word" >&5 +echo "$as_me:3776: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_YACC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3585,7 +3788,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_YACC="$ac_prog" -echo "$as_me:3588: found $ac_dir/$ac_word" >&5 +echo "$as_me:3791: found $ac_dir/$ac_word" >&5 break done @@ -3593,10 +3796,10 @@ fi fi YACC=$ac_cv_prog_YACC if test -n "$YACC"; then - echo "$as_me:3596: result: $YACC" >&5 + echo "$as_me:3799: result: $YACC" >&5 echo "${ECHO_T}$YACC" >&6 else - echo "$as_me:3599: result: no" >&5 + echo "$as_me:3802: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -3604,7 +3807,7 @@ fi done test -n "$YACC" || YACC="yacc" -echo "$as_me:3607: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "$as_me:3810: checking whether ${MAKE-make} sets \${MAKE}" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then @@ -3624,11 +3827,11 @@ fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$as_me:3627: result: yes" >&5 + echo "$as_me:3830: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else - echo "$as_me:3631: result: no" >&5 + echo "$as_me:3834: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi @@ -3642,7 +3845,7 @@ cat >>confdefs.h <<\EOF #define _GNU_SOURCE 1 EOF -echo "$as_me:3645: checking for $CC option to accept ANSI C" >&5 +echo "$as_me:3848: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3650,7 +3853,7 @@ else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF -#line 3653 "configure" +#line 3856 "configure" #include "confdefs.h" #include <stdarg.h> #include <stdio.h> @@ -3699,16 +3902,16 @@ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIO do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext -if { (eval echo "$as_me:3702: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3905: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3705: \$? = $ac_status" >&5 + echo "$as_me:3908: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3708: \"$ac_try\"") >&5 + { (eval echo "$as_me:3911: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3711: \$? = $ac_status" >&5 + echo "$as_me:3914: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break @@ -3725,21 +3928,21 @@ fi case "x$ac_cv_prog_cc_stdc" in x|xno) - echo "$as_me:3728: result: none needed" >&5 + echo "$as_me:3931: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) - echo "$as_me:3731: result: $ac_cv_prog_cc_stdc" >&5 + echo "$as_me:3934: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac -echo "$as_me:3736: checking for an ANSI C-conforming const" >&5 +echo "$as_me:3939: checking for an ANSI C-conforming const" >&5 echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 if test "${ac_cv_c_const+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 3742 "configure" +#line 3945 "configure" #include "confdefs.h" int @@ -3797,16 +4000,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3800: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:4003: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3803: \$? = $ac_status" >&5 + echo "$as_me:4006: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3806: \"$ac_try\"") >&5 + { (eval echo "$as_me:4009: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3809: \$? = $ac_status" >&5 + echo "$as_me:4012: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_const=yes else @@ -3816,7 +4019,7 @@ ac_cv_c_const=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:3819: result: $ac_cv_c_const" >&5 +echo "$as_me:4022: result: $ac_cv_c_const" >&5 echo "${ECHO_T}$ac_cv_c_const" >&6 if test $ac_cv_c_const = no; then @@ -3826,7 +4029,7 @@ EOF fi -echo "$as_me:3829: checking for inline" >&5 +echo "$as_me:4032: checking for inline" >&5 echo $ECHO_N "checking for inline... $ECHO_C" >&6 if test "${ac_cv_c_inline+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3834,7 +4037,7 @@ else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat >conftest.$ac_ext <<_ACEOF -#line 3837 "configure" +#line 4040 "configure" #include "confdefs.h" #ifndef __cplusplus static $ac_kw int static_foo () {return 0; } @@ -3843,16 +4046,16 @@ $ac_kw int foo () {return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3846: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:4049: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3849: \$? = $ac_status" >&5 + echo "$as_me:4052: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3852: \"$ac_try\"") >&5 + { (eval echo "$as_me:4055: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3855: \$? = $ac_status" >&5 + echo "$as_me:4058: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_inline=$ac_kw; break else @@ -3863,7 +4066,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext done fi -echo "$as_me:3866: result: $ac_cv_c_inline" >&5 +echo "$as_me:4069: result: $ac_cv_c_inline" >&5 echo "${ECHO_T}$ac_cv_c_inline" >&6 case $ac_cv_c_inline in inline | yes) ;; @@ -3878,7 +4081,7 @@ EOF ;; esac -echo "$as_me:3881: checking whether byte ordering is bigendian" >&5 +echo "$as_me:4084: checking whether byte ordering is bigendian" >&5 echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6 if test "${ac_cv_c_bigendian+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3886,7 +4089,7 @@ else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat >conftest.$ac_ext <<_ACEOF -#line 3889 "configure" +#line 4092 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/param.h> @@ -3903,20 +4106,20 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3906: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:4109: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3909: \$? = $ac_status" >&5 + echo "$as_me:4112: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3912: \"$ac_try\"") >&5 + { (eval echo "$as_me:4115: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3915: \$? = $ac_status" >&5 + echo "$as_me:4118: \$? = $ac_status" >&5 (exit $ac_status); }; }; then # It does; now see whether it defined to BIG_ENDIAN or not. cat >conftest.$ac_ext <<_ACEOF -#line 3919 "configure" +#line 4122 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/param.h> @@ -3933,16 +4136,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3936: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:4139: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3939: \$? = $ac_status" >&5 + echo "$as_me:4142: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3942: \"$ac_try\"") >&5 + { (eval echo "$as_me:4145: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3945: \$? = $ac_status" >&5 + echo "$as_me:4148: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_bigendian=yes else @@ -3958,12 +4161,12 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then if test "$cross_compiling" = yes; then - { { echo "$as_me:3961: error: cannot run test program while cross compiling" >&5 + { { echo "$as_me:4164: error: cannot run test program while cross compiling" >&5 echo "$as_me: error: cannot run test program while cross compiling" >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF -#line 3966 "configure" +#line 4169 "configure" #include "confdefs.h" int main () @@ -3979,15 +4182,15 @@ main () } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:3982: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4185: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:3985: \$? = $ac_status" >&5 + echo "$as_me:4188: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:3987: \"$ac_try\"") >&5 + { (eval echo "$as_me:4190: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3990: \$? = $ac_status" >&5 + echo "$as_me:4193: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_bigendian=no else @@ -4000,7 +4203,7 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi -echo "$as_me:4003: result: $ac_cv_c_bigendian" >&5 +echo "$as_me:4206: result: $ac_cv_c_bigendian" >&5 echo "${ECHO_T}$ac_cv_c_bigendian" >&6 if test $ac_cv_c_bigendian = yes; then @@ -4010,13 +4213,13 @@ EOF fi -echo "$as_me:4013: checking for preprocessor stringizing operator" >&5 +echo "$as_me:4216: checking for preprocessor stringizing operator" >&5 echo $ECHO_N "checking for preprocessor stringizing operator... $ECHO_C" >&6 if test "${ac_cv_c_stringize+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 4019 "configure" +#line 4222 "configure" #include "confdefs.h" #define x(y) #y @@ -4031,7 +4234,7 @@ fi rm -f conftest* fi -echo "$as_me:4034: result: $ac_cv_c_stringize" >&5 +echo "$as_me:4237: result: $ac_cv_c_stringize" >&5 echo "${ECHO_T}$ac_cv_c_stringize" >&6 if test $ac_cv_c_stringize = yes; then @@ -4041,7 +4244,7 @@ EOF fi -echo "$as_me:4044: checking for long double" >&5 +echo "$as_me:4247: checking for long double" >&5 echo $ECHO_N "checking for long double... $ECHO_C" >&6 if test "${ac_cv_c_long_double+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -4050,12 +4253,12 @@ else ac_cv_c_long_double=yes else if test "$cross_compiling" = yes; then - { { echo "$as_me:4053: error: cannot run test program while cross compiling" >&5 + { { echo "$as_me:4256: error: cannot run test program while cross compiling" >&5 echo "$as_me: error: cannot run test program while cross compiling" >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF -#line 4058 "configure" +#line 4261 "configure" #include "confdefs.h" int main () @@ -4068,15 +4271,15 @@ main () } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:4071: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4274: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4074: \$? = $ac_status" >&5 + echo "$as_me:4277: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:4076: \"$ac_try\"") >&5 + { (eval echo "$as_me:4279: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4079: \$? = $ac_status" >&5 + echo "$as_me:4282: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_long_double=yes else @@ -4089,7 +4292,7 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi -echo "$as_me:4092: result: $ac_cv_c_long_double" >&5 +echo "$as_me:4295: result: $ac_cv_c_long_double" >&5 echo "${ECHO_T}$ac_cv_c_long_double" >&6 if test $ac_cv_c_long_double = yes; then @@ -4099,10 +4302,10 @@ EOF fi -echo "$as_me:4102: checking for function prototypes" >&5 +echo "$as_me:4305: checking for function prototypes" >&5 echo $ECHO_N "checking for function prototypes... $ECHO_C" >&6 if test "$ac_cv_prog_cc_stdc" != no; then - echo "$as_me:4105: result: yes" >&5 + echo "$as_me:4308: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\EOF @@ -4110,17 +4313,17 @@ cat >>confdefs.h <<\EOF EOF else - echo "$as_me:4113: result: no" >&5 + echo "$as_me:4316: result: no" >&5 echo "${ECHO_T}no" >&6 fi -echo "$as_me:4117: checking for ANSI C header files" >&5 +echo "$as_me:4320: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 4123 "configure" +#line 4326 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -4128,13 +4331,13 @@ else #include <float.h> _ACEOF -if { (eval echo "$as_me:4131: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:4334: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:4137: \$? = $ac_status" >&5 + echo "$as_me:4340: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -4156,7 +4359,7 @@ rm -f conftest.err conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF -#line 4159 "configure" +#line 4362 "configure" #include "confdefs.h" #include <string.h> @@ -4174,7 +4377,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 <<_ACEOF -#line 4177 "configure" +#line 4380 "configure" #include "confdefs.h" #include <stdlib.h> @@ -4195,7 +4398,7 @@ if test $ac_cv_header_stdc = yes; then : else cat >conftest.$ac_ext <<_ACEOF -#line 4198 "configure" +#line 4401 "configure" #include "confdefs.h" #include <ctype.h> #if ((' ' & 0x0FF) == 0x020) @@ -4221,15 +4424,15 @@ main () } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:4224: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4427: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4227: \$? = $ac_status" >&5 + echo "$as_me:4430: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:4229: \"$ac_try\"") >&5 + { (eval echo "$as_me:4432: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4232: \$? = $ac_status" >&5 + echo "$as_me:4435: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -4242,7 +4445,7 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi -echo "$as_me:4245: result: $ac_cv_header_stdc" >&5 +echo "$as_me:4448: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then @@ -4258,28 +4461,28 @@ for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:4261: checking for $ac_header" >&5 +echo "$as_me:4464: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 4267 "configure" +#line 4470 "configure" #include "confdefs.h" $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:4273: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:4476: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4276: \$? = $ac_status" >&5 + echo "$as_me:4479: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:4279: \"$ac_try\"") >&5 + { (eval echo "$as_me:4482: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4282: \$? = $ac_status" >&5 + echo "$as_me:4485: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else @@ -4289,7 +4492,7 @@ eval "$as_ac_Header=no" fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:4292: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:4495: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<EOF @@ -4299,13 +4502,13 @@ EOF fi done -echo "$as_me:4302: checking whether char is unsigned" >&5 +echo "$as_me:4505: checking whether char is unsigned" >&5 echo $ECHO_N "checking whether char is unsigned... $ECHO_C" >&6 if test "${ac_cv_c_char_unsigned+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 4308 "configure" +#line 4511 "configure" #include "confdefs.h" $ac_includes_default int @@ -4317,16 +4520,16 @@ int _array_ [1 - 2 * !(((char) -1) < 0)] } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:4320: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:4523: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4323: \$? = $ac_status" >&5 + echo "$as_me:4526: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:4326: \"$ac_try\"") >&5 + { (eval echo "$as_me:4529: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4329: \$? = $ac_status" >&5 + echo "$as_me:4532: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_char_unsigned=no else @@ -4336,7 +4539,7 @@ ac_cv_c_char_unsigned=yes fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:4339: result: $ac_cv_c_char_unsigned" >&5 +echo "$as_me:4542: result: $ac_cv_c_char_unsigned" >&5 echo "${ECHO_T}$ac_cv_c_char_unsigned" >&6 if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then cat >>confdefs.h <<\EOF @@ -4348,13 +4551,13 @@ fi ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` -echo "$as_me:4351: checking for $ac_hdr that defines DIR" >&5 +echo "$as_me:4554: checking for $ac_hdr that defines DIR" >&5 echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 4357 "configure" +#line 4560 "configure" #include "confdefs.h" #include <sys/types.h> #include <$ac_hdr> @@ -4369,16 +4572,16 @@ return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:4372: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:4575: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4375: \$? = $ac_status" >&5 + echo "$as_me:4578: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:4378: \"$ac_try\"") >&5 + { (eval echo "$as_me:4581: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4381: \$? = $ac_status" >&5 + echo "$as_me:4584: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else @@ -4388,7 +4591,7 @@ eval "$as_ac_Header=no" fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:4391: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:4594: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<EOF @@ -4401,7 +4604,7 @@ fi done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then - echo "$as_me:4404: checking for opendir in -ldir" >&5 + echo "$as_me:4607: checking for opendir in -ldir" >&5 echo $ECHO_N "checking for opendir in -ldir... $ECHO_C" >&6 if test "${ac_cv_lib_dir_opendir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -4409,7 +4612,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldir $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 4412 "configure" +#line 4615 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -4428,16 +4631,16 @@ opendir (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4431: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4634: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4434: \$? = $ac_status" >&5 + echo "$as_me:4637: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4437: \"$ac_try\"") >&5 + { (eval echo "$as_me:4640: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4440: \$? = $ac_status" >&5 + echo "$as_me:4643: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dir_opendir=yes else @@ -4448,14 +4651,14 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:4451: result: $ac_cv_lib_dir_opendir" >&5 +echo "$as_me:4654: result: $ac_cv_lib_dir_opendir" >&5 echo "${ECHO_T}$ac_cv_lib_dir_opendir" >&6 if test $ac_cv_lib_dir_opendir = yes; then LIBS="$LIBS -ldir" fi else - echo "$as_me:4458: checking for opendir in -lx" >&5 + echo "$as_me:4661: checking for opendir in -lx" >&5 echo $ECHO_N "checking for opendir in -lx... $ECHO_C" >&6 if test "${ac_cv_lib_x_opendir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -4463,7 +4666,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lx $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 4466 "configure" +#line 4669 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -4482,16 +4685,16 @@ opendir (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4485: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4688: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4488: \$? = $ac_status" >&5 + echo "$as_me:4691: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4491: \"$ac_try\"") >&5 + { (eval echo "$as_me:4694: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4494: \$? = $ac_status" >&5 + echo "$as_me:4697: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_x_opendir=yes else @@ -4502,7 +4705,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:4505: result: $ac_cv_lib_x_opendir" >&5 +echo "$as_me:4708: result: $ac_cv_lib_x_opendir" >&5 echo "${ECHO_T}$ac_cv_lib_x_opendir" >&6 if test $ac_cv_lib_x_opendir = yes; then LIBS="$LIBS -lx" @@ -4510,13 +4713,13 @@ fi fi -echo "$as_me:4513: checking whether time.h and sys/time.h may both be included" >&5 +echo "$as_me:4716: checking whether time.h and sys/time.h may both be included" >&5 echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 if test "${ac_cv_header_time+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 4519 "configure" +#line 4722 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/time.h> @@ -4532,16 +4735,16 @@ return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:4535: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:4738: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4538: \$? = $ac_status" >&5 + echo "$as_me:4741: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:4541: \"$ac_try\"") >&5 + { (eval echo "$as_me:4744: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4544: \$? = $ac_status" >&5 + echo "$as_me:4747: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_time=yes else @@ -4551,7 +4754,7 @@ ac_cv_header_time=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:4554: result: $ac_cv_header_time" >&5 +echo "$as_me:4757: result: $ac_cv_header_time" >&5 echo "${ECHO_T}$ac_cv_header_time" >&6 if test $ac_cv_header_time = yes; then @@ -4564,23 +4767,23 @@ fi for ac_header in inttypes.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:4567: checking for $ac_header" >&5 +echo "$as_me:4770: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 4573 "configure" +#line 4776 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF -if { (eval echo "$as_me:4577: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:4780: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:4583: \$? = $ac_status" >&5 + echo "$as_me:4786: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -4599,7 +4802,7 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:4602: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:4805: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<EOF @@ -4611,26 +4814,26 @@ done for ac_header in unistd.h stdlib.h stdarg.h varargs.h limits.h string.h \ memory.h locale.h termcap.h termio.h termios.h dlfcn.h \ - stddef.h stdint.h netdb.h grp.h strings.h + stddef.h stdint.h netdb.h grp.h strings.h regex.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:4617: checking for $ac_header" >&5 +echo "$as_me:4820: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 4623 "configure" +#line 4826 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF -if { (eval echo "$as_me:4627: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:4830: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:4633: \$? = $ac_status" >&5 + echo "$as_me:4836: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -4649,7 +4852,7 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:4652: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:4855: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<EOF @@ -4664,23 +4867,23 @@ for ac_header in sys/ptem.h sys/pte.h sys/stream.h sys/select.h sys/file.h \ sys/time.h sys/times.h sys/wait.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:4667: checking for $ac_header" >&5 +echo "$as_me:4870: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 4673 "configure" +#line 4876 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF -if { (eval echo "$as_me:4677: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:4880: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:4683: \$? = $ac_status" >&5 + echo "$as_me:4886: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -4699,7 +4902,7 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:4702: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:4905: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<EOF @@ -4712,23 +4915,23 @@ done for ac_header in netinet/in.h arpa/inet.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:4715: checking for $ac_header" >&5 +echo "$as_me:4918: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 4721 "configure" +#line 4924 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF -if { (eval echo "$as_me:4725: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:4928: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:4731: \$? = $ac_status" >&5 + echo "$as_me:4934: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -4747,7 +4950,7 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:4750: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:4953: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<EOF @@ -4759,13 +4962,13 @@ done # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! -echo "$as_me:4762: checking for working alloca.h" >&5 +echo "$as_me:4965: checking for working alloca.h" >&5 echo $ECHO_N "checking for working alloca.h... $ECHO_C" >&6 if test "${ac_cv_working_alloca_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 4768 "configure" +#line 4971 "configure" #include "confdefs.h" #include <alloca.h> int @@ -4777,16 +4980,16 @@ char *p = (char *) alloca (2 * sizeof (int)); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4780: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4983: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4783: \$? = $ac_status" >&5 + echo "$as_me:4986: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4786: \"$ac_try\"") >&5 + { (eval echo "$as_me:4989: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4789: \$? = $ac_status" >&5 + echo "$as_me:4992: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_working_alloca_h=yes else @@ -4796,7 +4999,7 @@ ac_cv_working_alloca_h=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:4799: result: $ac_cv_working_alloca_h" >&5 +echo "$as_me:5002: result: $ac_cv_working_alloca_h" >&5 echo "${ECHO_T}$ac_cv_working_alloca_h" >&6 if test $ac_cv_working_alloca_h = yes; then @@ -4806,13 +5009,13 @@ EOF fi -echo "$as_me:4809: checking for alloca" >&5 +echo "$as_me:5012: checking for alloca" >&5 echo $ECHO_N "checking for alloca... $ECHO_C" >&6 if test "${ac_cv_func_alloca_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 4815 "configure" +#line 5018 "configure" #include "confdefs.h" #ifdef __GNUC__ # define alloca __builtin_alloca @@ -4844,16 +5047,16 @@ char *p = (char *) alloca (1); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4847: \"$ac_link\"") >&5 +if { (eval echo "$as_me:5050: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4850: \$? = $ac_status" >&5 + echo "$as_me:5053: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4853: \"$ac_try\"") >&5 + { (eval echo "$as_me:5056: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4856: \$? = $ac_status" >&5 + echo "$as_me:5059: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_alloca_works=yes else @@ -4863,7 +5066,7 @@ ac_cv_func_alloca_works=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:4866: result: $ac_cv_func_alloca_works" >&5 +echo "$as_me:5069: result: $ac_cv_func_alloca_works" >&5 echo "${ECHO_T}$ac_cv_func_alloca_works" >&6 if test $ac_cv_func_alloca_works = yes; then @@ -4884,13 +5087,13 @@ cat >>confdefs.h <<\EOF #define C_ALLOCA 1 EOF -echo "$as_me:4887: checking whether \`alloca.c' needs Cray hooks" >&5 +echo "$as_me:5090: checking whether \`alloca.c' needs Cray hooks" >&5 echo $ECHO_N "checking whether \`alloca.c' needs Cray hooks... $ECHO_C" >&6 if test "${ac_cv_os_cray+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 4893 "configure" +#line 5096 "configure" #include "confdefs.h" #if defined(CRAY) && ! defined(CRAY2) webecray @@ -4908,18 +5111,18 @@ fi rm -f conftest* fi -echo "$as_me:4911: result: $ac_cv_os_cray" >&5 +echo "$as_me:5114: result: $ac_cv_os_cray" >&5 echo "${ECHO_T}$ac_cv_os_cray" >&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:4916: checking for $ac_func" >&5 +echo "$as_me:5119: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 4922 "configure" +#line 5125 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ @@ -4950,16 +5153,16 @@ f = $ac_func; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4953: \"$ac_link\"") >&5 +if { (eval echo "$as_me:5156: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4956: \$? = $ac_status" >&5 + echo "$as_me:5159: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4959: \"$ac_try\"") >&5 + { (eval echo "$as_me:5162: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4962: \$? = $ac_status" >&5 + echo "$as_me:5165: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else @@ -4969,7 +5172,7 @@ eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:4972: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "$as_me:5175: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then @@ -4983,7 +5186,7 @@ fi done fi -echo "$as_me:4986: checking stack direction for C alloca" >&5 +echo "$as_me:5189: checking stack direction for C alloca" >&5 echo $ECHO_N "checking stack direction for C alloca... $ECHO_C" >&6 if test "${ac_cv_c_stack_direction+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -4992,7 +5195,7 @@ else ac_cv_c_stack_direction=0 else cat >conftest.$ac_ext <<_ACEOF -#line 4995 "configure" +#line 5198 "configure" #include "confdefs.h" int find_stack_direction () @@ -5015,15 +5218,15 @@ main () } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:5018: \"$ac_link\"") >&5 +if { (eval echo "$as_me:5221: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:5021: \$? = $ac_status" >&5 + echo "$as_me:5224: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:5023: \"$ac_try\"") >&5 + { (eval echo "$as_me:5226: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5026: \$? = $ac_status" >&5 + echo "$as_me:5229: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_stack_direction=1 else @@ -5035,7 +5238,7 @@ fi rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -echo "$as_me:5038: result: $ac_cv_c_stack_direction" >&5 +echo "$as_me:5241: result: $ac_cv_c_stack_direction" >&5 echo "${ECHO_T}$ac_cv_c_stack_direction" >&6 cat >>confdefs.h <<EOF @@ -5044,14 +5247,14 @@ EOF fi -echo "$as_me:5047: checking whether getpgrp takes no argument" >&5 +echo "$as_me:5250: checking whether getpgrp takes no argument" >&5 echo $ECHO_N "checking whether getpgrp takes no argument... $ECHO_C" >&6 if test "${ac_cv_func_getpgrp_void+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Use it with a single arg. cat >conftest.$ac_ext <<_ACEOF -#line 5054 "configure" +#line 5257 "configure" #include "confdefs.h" $ac_includes_default int @@ -5063,16 +5266,16 @@ getpgrp (0); } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:5066: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:5269: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:5069: \$? = $ac_status" >&5 + echo "$as_me:5272: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:5072: \"$ac_try\"") >&5 + { (eval echo "$as_me:5275: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5075: \$? = $ac_status" >&5 + echo "$as_me:5278: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_func_getpgrp_1=yes else @@ -5083,7 +5286,7 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext # Use it with no arg. cat >conftest.$ac_ext <<_ACEOF -#line 5086 "configure" +#line 5289 "configure" #include "confdefs.h" $ac_includes_default int @@ -5095,16 +5298,16 @@ getpgrp (); } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:5098: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:5301: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:5101: \$? = $ac_status" >&5 + echo "$as_me:5304: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:5104: \"$ac_try\"") >&5 + { (eval echo "$as_me:5307: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5107: \$? = $ac_status" >&5 + echo "$as_me:5310: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_func_getpgrp_0=yes else @@ -5118,12 +5321,12 @@ case $ac_func_getpgrp_0:$ac_func_getpgrp_1 in yes:no) ac_cv_func_getpgrp_void=yes;; no:yes) ac_cv_func_getpgrp_void=false;; *) if test "$cross_compiling" = yes; then - { { echo "$as_me:5121: error: cannot check getpgrp if cross compiling" >&5 + { { echo "$as_me:5324: error: cannot check getpgrp if cross compiling" >&5 echo "$as_me: error: cannot check getpgrp if cross compiling" >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF -#line 5126 "configure" +#line 5329 "configure" #include "confdefs.h" $ac_includes_default @@ -5177,15 +5380,15 @@ main () _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:5180: \"$ac_link\"") >&5 +if { (eval echo "$as_me:5383: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:5183: \$? = $ac_status" >&5 + echo "$as_me:5386: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:5185: \"$ac_try\"") >&5 + { (eval echo "$as_me:5388: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5188: \$? = $ac_status" >&5 + echo "$as_me:5391: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_getpgrp_void=yes else @@ -5199,7 +5402,7 @@ fi;; esac # $ac_func_getpgrp_0:$ac_func_getpgrp_1 fi -echo "$as_me:5202: result: $ac_cv_func_getpgrp_void" >&5 +echo "$as_me:5405: result: $ac_cv_func_getpgrp_void" >&5 echo "${ECHO_T}$ac_cv_func_getpgrp_void" >&6 if test $ac_cv_func_getpgrp_void = yes; then @@ -5209,18 +5412,18 @@ EOF fi -echo "$as_me:5212: checking whether setvbuf arguments are reversed" >&5 +echo "$as_me:5415: checking whether setvbuf arguments are reversed" >&5 echo $ECHO_N "checking whether setvbuf arguments are reversed... $ECHO_C" >&6 if test "${ac_cv_func_setvbuf_reversed+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then - { { echo "$as_me:5218: error: cannot run test program while cross compiling" >&5 + { { echo "$as_me:5421: error: cannot run test program while cross compiling" >&5 echo "$as_me: error: cannot run test program while cross compiling" >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF -#line 5223 "configure" +#line 5426 "configure" #include "confdefs.h" #include <stdio.h> /* If setvbuf has the reversed format, exit 0. */ @@ -5237,15 +5440,15 @@ main () } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:5240: \"$ac_link\"") >&5 +if { (eval echo "$as_me:5443: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:5243: \$? = $ac_status" >&5 + echo "$as_me:5446: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:5245: \"$ac_try\"") >&5 + { (eval echo "$as_me:5448: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5248: \$? = $ac_status" >&5 + echo "$as_me:5451: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_setvbuf_reversed=yes else @@ -5258,7 +5461,7 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f core core.* *.core fi -echo "$as_me:5261: result: $ac_cv_func_setvbuf_reversed" >&5 +echo "$as_me:5464: result: $ac_cv_func_setvbuf_reversed" >&5 echo "${ECHO_T}$ac_cv_func_setvbuf_reversed" >&6 if test $ac_cv_func_setvbuf_reversed = yes; then @@ -5271,13 +5474,13 @@ fi for ac_func in vprintf do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:5274: checking for $ac_func" >&5 +echo "$as_me:5477: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 5280 "configure" +#line 5483 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ @@ -5308,16 +5511,16 @@ f = $ac_func; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:5311: \"$ac_link\"") >&5 +if { (eval echo "$as_me:5514: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:5314: \$? = $ac_status" >&5 + echo "$as_me:5517: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:5317: \"$ac_try\"") >&5 + { (eval echo "$as_me:5520: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5320: \$? = $ac_status" >&5 + echo "$as_me:5523: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else @@ -5327,20 +5530,20 @@ eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:5330: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "$as_me:5533: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<EOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 EOF -echo "$as_me:5337: checking for _doprnt" >&5 +echo "$as_me:5540: checking for _doprnt" >&5 echo $ECHO_N "checking for _doprnt... $ECHO_C" >&6 if test "${ac_cv_func__doprnt+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 5343 "configure" +#line 5546 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char _doprnt (); below. */ @@ -5371,16 +5574,16 @@ f = _doprnt; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:5374: \"$ac_link\"") >&5 +if { (eval echo "$as_me:5577: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:5377: \$? = $ac_status" >&5 + echo "$as_me:5580: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:5380: \"$ac_try\"") >&5 + { (eval echo "$as_me:5583: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5383: \$? = $ac_status" >&5 + echo "$as_me:5586: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func__doprnt=yes else @@ -5390,7 +5593,7 @@ ac_cv_func__doprnt=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:5393: result: $ac_cv_func__doprnt" >&5 +echo "$as_me:5596: result: $ac_cv_func__doprnt" >&5 echo "${ECHO_T}$ac_cv_func__doprnt" >&6 if test $ac_cv_func__doprnt = yes; then @@ -5403,7 +5606,7 @@ fi fi done -echo "$as_me:5406: checking for working strcoll" >&5 +echo "$as_me:5609: checking for working strcoll" >&5 echo $ECHO_N "checking for working strcoll... $ECHO_C" >&6 if test "${ac_cv_func_strcoll_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -5412,7 +5615,7 @@ else ac_cv_func_strcoll_works=no else cat >conftest.$ac_ext <<_ACEOF -#line 5415 "configure" +#line 5618 "configure" #include "confdefs.h" $ac_includes_default int @@ -5426,15 +5629,15 @@ exit (strcoll ("abc", "def") >= 0 || } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:5429: \"$ac_link\"") >&5 +if { (eval echo "$as_me:5632: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:5432: \$? = $ac_status" >&5 + echo "$as_me:5635: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:5434: \"$ac_try\"") >&5 + { (eval echo "$as_me:5637: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5437: \$? = $ac_status" >&5 + echo "$as_me:5640: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_strcoll_works=yes else @@ -5446,7 +5649,7 @@ fi rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -echo "$as_me:5449: result: $ac_cv_func_strcoll_works" >&5 +echo "$as_me:5652: result: $ac_cv_func_strcoll_works" >&5 echo "${ECHO_T}$ac_cv_func_strcoll_works" >&6 if test $ac_cv_func_strcoll_works = yes; then @@ -5467,10 +5670,10 @@ if test "$ac_cv_func_alloca_works" = "no" && test "$opt_bash_malloc" = "no"; the fi if test "$ac_cv_func_vprintf" = no; then - echo "$as_me:5470: checking for declaration of vprintf in stdio.h" >&5 + echo "$as_me:5673: checking for declaration of vprintf in stdio.h" >&5 echo $ECHO_N "checking for declaration of vprintf in stdio.h... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line 5473 "configure" +#line 5676 "configure" #include "confdefs.h" #include <stdio.h> @@ -5481,7 +5684,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | fi rm -f conftest* - echo "$as_me:5484: result: $ac_cv_func_vprintf" >&5 + echo "$as_me:5687: result: $ac_cv_func_vprintf" >&5 echo "${ECHO_T}$ac_cv_func_vprintf" >&6 if test $ac_cv_func_vprintf = yes; then cat >>confdefs.h <<\EOF @@ -5495,13 +5698,13 @@ if test "$ac_cv_func_vprintf" = no && test "$ac_cv_func__doprnt" = "yes"; then LIBOBJS="$LIBOBJS vprint.$ac_objext" fi -echo "$as_me:5498: checking return type of signal handlers" >&5 +echo "$as_me:5701: checking return type of signal handlers" >&5 echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 if test "${ac_cv_type_signal+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 5504 "configure" +#line 5707 "configure" #include "confdefs.h" #include <sys/types.h> #include <signal.h> @@ -5523,16 +5726,16 @@ int i; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:5526: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:5729: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:5529: \$? = $ac_status" >&5 + echo "$as_me:5732: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:5532: \"$ac_try\"") >&5 + { (eval echo "$as_me:5735: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5535: \$? = $ac_status" >&5 + echo "$as_me:5738: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_signal=void else @@ -5542,20 +5745,20 @@ ac_cv_type_signal=int fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:5545: result: $ac_cv_type_signal" >&5 +echo "$as_me:5748: result: $ac_cv_type_signal" >&5 echo "${ECHO_T}$ac_cv_type_signal" >&6 cat >>confdefs.h <<EOF #define RETSIGTYPE $ac_cv_type_signal EOF -echo "$as_me:5552: checking for __setostype" >&5 +echo "$as_me:5755: checking for __setostype" >&5 echo $ECHO_N "checking for __setostype... $ECHO_C" >&6 if test "${ac_cv_func___setostype+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 5558 "configure" +#line 5761 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char __setostype (); below. */ @@ -5586,16 +5789,16 @@ f = __setostype; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:5589: \"$ac_link\"") >&5 +if { (eval echo "$as_me:5792: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:5592: \$? = $ac_status" >&5 + echo "$as_me:5795: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:5595: \"$ac_try\"") >&5 + { (eval echo "$as_me:5798: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5598: \$? = $ac_status" >&5 + echo "$as_me:5801: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func___setostype=yes else @@ -5605,7 +5808,7 @@ ac_cv_func___setostype=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:5608: result: $ac_cv_func___setostype" >&5 +echo "$as_me:5811: result: $ac_cv_func___setostype" >&5 echo "${ECHO_T}$ac_cv_func___setostype" >&6 if test $ac_cv_func___setostype = yes; then cat >>confdefs.h <<\EOF @@ -5614,13 +5817,13 @@ EOF fi -echo "$as_me:5617: checking for wait3" >&5 +echo "$as_me:5820: checking for wait3" >&5 echo $ECHO_N "checking for wait3... $ECHO_C" >&6 if test "${ac_cv_func_wait3+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 5623 "configure" +#line 5826 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char wait3 (); below. */ @@ -5651,16 +5854,16 @@ f = wait3; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:5654: \"$ac_link\"") >&5 +if { (eval echo "$as_me:5857: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:5657: \$? = $ac_status" >&5 + echo "$as_me:5860: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:5660: \"$ac_try\"") >&5 + { (eval echo "$as_me:5863: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5663: \$? = $ac_status" >&5 + echo "$as_me:5866: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_wait3=yes else @@ -5670,7 +5873,7 @@ ac_cv_func_wait3=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:5673: result: $ac_cv_func_wait3" >&5 +echo "$as_me:5876: result: $ac_cv_func_wait3" >&5 echo "${ECHO_T}$ac_cv_func_wait3" >&6 if test $ac_cv_func_wait3 = yes; then cat >>confdefs.h <<\EOF @@ -5679,13 +5882,13 @@ EOF fi -echo "$as_me:5682: checking for isinf" >&5 +echo "$as_me:5885: checking for isinf" >&5 echo $ECHO_N "checking for isinf... $ECHO_C" >&6 if test "${ac_cv_func_isinf+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 5688 "configure" +#line 5891 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char isinf (); below. */ @@ -5716,16 +5919,16 @@ f = isinf; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:5719: \"$ac_link\"") >&5 +if { (eval echo "$as_me:5922: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:5722: \$? = $ac_status" >&5 + echo "$as_me:5925: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:5725: \"$ac_try\"") >&5 + { (eval echo "$as_me:5928: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5728: \$? = $ac_status" >&5 + echo "$as_me:5931: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_isinf=yes else @@ -5735,7 +5938,7 @@ ac_cv_func_isinf=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:5738: result: $ac_cv_func_isinf" >&5 +echo "$as_me:5941: result: $ac_cv_func_isinf" >&5 echo "${ECHO_T}$ac_cv_func_isinf" >&6 if test $ac_cv_func_isinf = yes; then cat >>confdefs.h <<\EOF @@ -5744,13 +5947,13 @@ EOF fi -echo "$as_me:5747: checking for mkfifo" >&5 +echo "$as_me:5950: checking for mkfifo" >&5 echo $ECHO_N "checking for mkfifo... $ECHO_C" >&6 if test "${ac_cv_func_mkfifo+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 5753 "configure" +#line 5956 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char mkfifo (); below. */ @@ -5781,16 +5984,16 @@ f = mkfifo; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:5784: \"$ac_link\"") >&5 +if { (eval echo "$as_me:5987: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:5787: \$? = $ac_status" >&5 + echo "$as_me:5990: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:5790: \"$ac_try\"") >&5 + { (eval echo "$as_me:5993: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5793: \$? = $ac_status" >&5 + echo "$as_me:5996: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_mkfifo=yes else @@ -5800,7 +6003,7 @@ ac_cv_func_mkfifo=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:5803: result: $ac_cv_func_mkfifo" >&5 +echo "$as_me:6006: result: $ac_cv_func_mkfifo" >&5 echo "${ECHO_T}$ac_cv_func_mkfifo" >&6 if test $ac_cv_func_mkfifo = yes; then cat >>confdefs.h <<\EOF @@ -5820,13 +6023,13 @@ for ac_func in dup2 select getdtablesize getgroups gethostname \ readlink do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:5823: checking for $ac_func" >&5 +echo "$as_me:6026: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 5829 "configure" +#line 6032 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ @@ -5857,16 +6060,16 @@ f = $ac_func; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:5860: \"$ac_link\"") >&5 +if { (eval echo "$as_me:6063: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:5863: \$? = $ac_status" >&5 + echo "$as_me:6066: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:5866: \"$ac_try\"") >&5 + { (eval echo "$as_me:6069: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5869: \$? = $ac_status" >&5 + echo "$as_me:6072: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else @@ -5876,7 +6079,7 @@ eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:5879: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "$as_me:6082: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<EOF @@ -5889,13 +6092,13 @@ done for ac_func in rename do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:5892: checking for $ac_func" >&5 +echo "$as_me:6095: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 5898 "configure" +#line 6101 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ @@ -5926,16 +6129,16 @@ f = $ac_func; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:5929: \"$ac_link\"") >&5 +if { (eval echo "$as_me:6132: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:5932: \$? = $ac_status" >&5 + echo "$as_me:6135: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:5935: \"$ac_try\"") >&5 + { (eval echo "$as_me:6138: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5938: \$? = $ac_status" >&5 + echo "$as_me:6141: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else @@ -5945,7 +6148,7 @@ eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:5948: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "$as_me:6151: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<EOF @@ -5961,16 +6164,16 @@ for ac_func in bcopy bzero confstr sysconf pathconf setenv putenv unsetenv \ setlinebuf setvbuf setlocale strchr tcgetattr uname \ ulimit tzset siginterrupt memmove ttyname times \ getaddrinfo gethostbyname getservbyname getservent inet_aton \ - vsnprintf snprintf vasprintf asprintf fnmatch + vsnprintf snprintf vasprintf asprintf fnmatch regcomp regexec do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:5967: checking for $ac_func" >&5 +echo "$as_me:6170: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 5973 "configure" +#line 6176 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ @@ -6001,16 +6204,16 @@ f = $ac_func; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:6004: \"$ac_link\"") >&5 +if { (eval echo "$as_me:6207: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:6007: \$? = $ac_status" >&5 + echo "$as_me:6210: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:6010: \"$ac_try\"") >&5 + { (eval echo "$as_me:6213: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6013: \$? = $ac_status" >&5 + echo "$as_me:6216: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else @@ -6020,7 +6223,7 @@ eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:6023: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "$as_me:6226: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<EOF @@ -6033,13 +6236,13 @@ done for ac_func in isascii isblank isgraph isprint isspace isxdigit do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:6036: checking for $ac_func" >&5 +echo "$as_me:6239: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 6042 "configure" +#line 6245 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ @@ -6070,16 +6273,16 @@ f = $ac_func; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:6073: \"$ac_link\"") >&5 +if { (eval echo "$as_me:6276: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:6076: \$? = $ac_status" >&5 + echo "$as_me:6279: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:6079: \"$ac_try\"") >&5 + { (eval echo "$as_me:6282: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6082: \$? = $ac_status" >&5 + echo "$as_me:6285: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else @@ -6089,7 +6292,7 @@ eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:6092: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "$as_me:6295: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<EOF @@ -6099,16 +6302,16 @@ EOF fi done -for ac_func in getcwd strcasecmp strerror strftime strpbrk memset +for ac_func in getcwd strcasecmp strerror strftime strpbrk memset strstr do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:6105: checking for $ac_func" >&5 +echo "$as_me:6308: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 6111 "configure" +#line 6314 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ @@ -6139,16 +6342,16 @@ f = $ac_func; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:6142: \"$ac_link\"") >&5 +if { (eval echo "$as_me:6345: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:6145: \$? = $ac_status" >&5 + echo "$as_me:6348: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:6148: \"$ac_try\"") >&5 + { (eval echo "$as_me:6351: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6151: \$? = $ac_status" >&5 + echo "$as_me:6354: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else @@ -6158,7 +6361,7 @@ eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:6161: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "$as_me:6364: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<EOF @@ -6173,13 +6376,13 @@ done for ac_func in strtod strtol strtoul strtoll strtoull strtoimax strtoumax do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:6176: checking for $ac_func" >&5 +echo "$as_me:6379: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 6182 "configure" +#line 6385 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ @@ -6210,16 +6413,16 @@ f = $ac_func; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:6213: \"$ac_link\"") >&5 +if { (eval echo "$as_me:6416: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:6216: \$? = $ac_status" >&5 + echo "$as_me:6419: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:6219: \"$ac_try\"") >&5 + { (eval echo "$as_me:6422: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6222: \$? = $ac_status" >&5 + echo "$as_me:6425: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else @@ -6229,7 +6432,7 @@ eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:6232: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "$as_me:6435: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<EOF @@ -6241,13 +6444,13 @@ else fi done -echo "$as_me:6244: checking whether confstr is declared" >&5 +echo "$as_me:6447: checking whether confstr is declared" >&5 echo $ECHO_N "checking whether confstr is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_confstr+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 6250 "configure" +#line 6453 "configure" #include "confdefs.h" $ac_includes_default int @@ -6262,16 +6465,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:6265: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:6468: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:6268: \$? = $ac_status" >&5 + echo "$as_me:6471: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:6271: \"$ac_try\"") >&5 + { (eval echo "$as_me:6474: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6274: \$? = $ac_status" >&5 + echo "$as_me:6477: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_have_decl_confstr=yes else @@ -6281,7 +6484,7 @@ ac_cv_have_decl_confstr=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:6284: result: $ac_cv_have_decl_confstr" >&5 +echo "$as_me:6487: result: $ac_cv_have_decl_confstr" >&5 echo "${ECHO_T}$ac_cv_have_decl_confstr" >&6 if test $ac_cv_have_decl_confstr = yes; then @@ -6296,13 +6499,13 @@ EOF fi -echo "$as_me:6299: checking whether printf is declared" >&5 +echo "$as_me:6502: checking whether printf is declared" >&5 echo $ECHO_N "checking whether printf is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_printf+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 6305 "configure" +#line 6508 "configure" #include "confdefs.h" $ac_includes_default int @@ -6317,16 +6520,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:6320: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:6523: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:6323: \$? = $ac_status" >&5 + echo "$as_me:6526: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:6326: \"$ac_try\"") >&5 + { (eval echo "$as_me:6529: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6329: \$? = $ac_status" >&5 + echo "$as_me:6532: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_have_decl_printf=yes else @@ -6336,7 +6539,7 @@ ac_cv_have_decl_printf=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:6339: result: $ac_cv_have_decl_printf" >&5 +echo "$as_me:6542: result: $ac_cv_have_decl_printf" >&5 echo "${ECHO_T}$ac_cv_have_decl_printf" >&6 if test $ac_cv_have_decl_printf = yes; then @@ -6351,13 +6554,13 @@ EOF fi -echo "$as_me:6354: checking whether sbrk is declared" >&5 +echo "$as_me:6557: checking whether sbrk is declared" >&5 echo $ECHO_N "checking whether sbrk is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_sbrk+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 6360 "configure" +#line 6563 "configure" #include "confdefs.h" $ac_includes_default int @@ -6372,16 +6575,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:6375: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:6578: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:6378: \$? = $ac_status" >&5 + echo "$as_me:6581: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:6381: \"$ac_try\"") >&5 + { (eval echo "$as_me:6584: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6384: \$? = $ac_status" >&5 + echo "$as_me:6587: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_have_decl_sbrk=yes else @@ -6391,7 +6594,7 @@ ac_cv_have_decl_sbrk=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:6394: result: $ac_cv_have_decl_sbrk" >&5 +echo "$as_me:6597: result: $ac_cv_have_decl_sbrk" >&5 echo "${ECHO_T}$ac_cv_have_decl_sbrk" >&6 if test $ac_cv_have_decl_sbrk = yes; then @@ -6406,13 +6609,13 @@ EOF fi -echo "$as_me:6409: checking whether strcpy is declared" >&5 +echo "$as_me:6612: checking whether strcpy is declared" >&5 echo $ECHO_N "checking whether strcpy is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_strcpy+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 6415 "configure" +#line 6618 "configure" #include "confdefs.h" $ac_includes_default int @@ -6427,16 +6630,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:6430: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:6633: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:6433: \$? = $ac_status" >&5 + echo "$as_me:6636: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:6436: \"$ac_try\"") >&5 + { (eval echo "$as_me:6639: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6439: \$? = $ac_status" >&5 + echo "$as_me:6642: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_have_decl_strcpy=yes else @@ -6446,7 +6649,7 @@ ac_cv_have_decl_strcpy=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:6449: result: $ac_cv_have_decl_strcpy" >&5 +echo "$as_me:6652: result: $ac_cv_have_decl_strcpy" >&5 echo "${ECHO_T}$ac_cv_have_decl_strcpy" >&6 if test $ac_cv_have_decl_strcpy = yes; then @@ -6461,13 +6664,13 @@ EOF fi -echo "$as_me:6464: checking whether strsignal is declared" >&5 +echo "$as_me:6667: checking whether strsignal is declared" >&5 echo $ECHO_N "checking whether strsignal is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_strsignal+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 6470 "configure" +#line 6673 "configure" #include "confdefs.h" $ac_includes_default int @@ -6482,16 +6685,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:6485: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:6688: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:6488: \$? = $ac_status" >&5 + echo "$as_me:6691: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:6491: \"$ac_try\"") >&5 + { (eval echo "$as_me:6694: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6494: \$? = $ac_status" >&5 + echo "$as_me:6697: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_have_decl_strsignal=yes else @@ -6501,7 +6704,7 @@ ac_cv_have_decl_strsignal=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:6504: result: $ac_cv_have_decl_strsignal" >&5 +echo "$as_me:6707: result: $ac_cv_have_decl_strsignal" >&5 echo "${ECHO_T}$ac_cv_have_decl_strsignal" >&6 if test $ac_cv_have_decl_strsignal = yes; then @@ -6516,13 +6719,13 @@ EOF fi -echo "$as_me:6519: checking whether strtold is declared" >&5 +echo "$as_me:6722: checking whether strtold is declared" >&5 echo $ECHO_N "checking whether strtold is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_strtold+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 6525 "configure" +#line 6728 "configure" #include "confdefs.h" $ac_includes_default int @@ -6537,16 +6740,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:6540: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:6743: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:6543: \$? = $ac_status" >&5 + echo "$as_me:6746: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:6546: \"$ac_try\"") >&5 + { (eval echo "$as_me:6749: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6549: \$? = $ac_status" >&5 + echo "$as_me:6752: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_have_decl_strtold=yes else @@ -6556,7 +6759,7 @@ ac_cv_have_decl_strtold=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:6559: result: $ac_cv_have_decl_strtold" >&5 +echo "$as_me:6762: result: $ac_cv_have_decl_strtold" >&5 echo "${ECHO_T}$ac_cv_have_decl_strtold" >&6 if test $ac_cv_have_decl_strtold = yes; then @@ -6564,6 +6767,54 @@ cat >>confdefs.h <<EOF #define HAVE_DECL_STRTOLD 1 EOF + echo "$as_me:6770: checking for broken strtold" >&5 +echo $ECHO_N "checking for broken strtold... $ECHO_C" >&6 + if test "${bash_cv_strtold_broken+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 6776 "configure" +#include "confdefs.h" +#include <stdlib.h> +int +main () +{ +int main() { long double r; char *foo, bar; r = strtold(foo, &bar);} + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6788: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6791: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6794: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6797: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + bash_cv_strtold_broken=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +bash_cv_strtold_broken=yes +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi + + echo "$as_me:6809: result: $bash_cv_strtold_broken" >&5 +echo "${ECHO_T}$bash_cv_strtold_broken" >&6 + if test "$bash_cv_strtold_broken" = "yes" ; then + cat >>confdefs.h <<\EOF +#define STRTOLD_BROKEN 1 +EOF + + fi + else cat >>confdefs.h <<EOF #define HAVE_DECL_STRTOLD 0 @@ -6571,13 +6822,13 @@ EOF fi -echo "$as_me:6574: checking for declaration of strtoimax" >&5 +echo "$as_me:6825: checking for declaration of strtoimax" >&5 echo $ECHO_N "checking for declaration of strtoimax... $ECHO_C" >&6 if test "${bash_cv_decl_strtoimax+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 6580 "configure" +#line 6831 "configure" #include "confdefs.h" #if STDC_HEADERS @@ -6596,16 +6847,16 @@ return !strtoimax; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:6599: \"$ac_link\"") >&5 +if { (eval echo "$as_me:6850: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:6602: \$? = $ac_status" >&5 + echo "$as_me:6853: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:6605: \"$ac_try\"") >&5 + { (eval echo "$as_me:6856: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6608: \$? = $ac_status" >&5 + echo "$as_me:6859: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_decl_strtoimax=yes else @@ -6615,7 +6866,7 @@ bash_cv_decl_strtoimax=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:6618: result: $bash_cv_decl_strtoimax" >&5 +echo "$as_me:6869: result: $bash_cv_decl_strtoimax" >&5 echo "${ECHO_T}$bash_cv_decl_strtoimax" >&6 bash_tr_func=HAVE_DECL_`echo strtoimax | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` if test $bash_cv_decl_strtoimax = yes; then @@ -6630,13 +6881,13 @@ EOF fi -echo "$as_me:6633: checking for declaration of strtol" >&5 +echo "$as_me:6884: checking for declaration of strtol" >&5 echo $ECHO_N "checking for declaration of strtol... $ECHO_C" >&6 if test "${bash_cv_decl_strtol+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 6639 "configure" +#line 6890 "configure" #include "confdefs.h" #if STDC_HEADERS @@ -6655,16 +6906,16 @@ return !strtol; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:6658: \"$ac_link\"") >&5 +if { (eval echo "$as_me:6909: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:6661: \$? = $ac_status" >&5 + echo "$as_me:6912: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:6664: \"$ac_try\"") >&5 + { (eval echo "$as_me:6915: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6667: \$? = $ac_status" >&5 + echo "$as_me:6918: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_decl_strtol=yes else @@ -6674,7 +6925,7 @@ bash_cv_decl_strtol=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:6677: result: $bash_cv_decl_strtol" >&5 +echo "$as_me:6928: result: $bash_cv_decl_strtol" >&5 echo "${ECHO_T}$bash_cv_decl_strtol" >&6 bash_tr_func=HAVE_DECL_`echo strtol | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` if test $bash_cv_decl_strtol = yes; then @@ -6689,13 +6940,13 @@ EOF fi -echo "$as_me:6692: checking for declaration of strtoll" >&5 +echo "$as_me:6943: checking for declaration of strtoll" >&5 echo $ECHO_N "checking for declaration of strtoll... $ECHO_C" >&6 if test "${bash_cv_decl_strtoll+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 6698 "configure" +#line 6949 "configure" #include "confdefs.h" #if STDC_HEADERS @@ -6714,16 +6965,16 @@ return !strtoll; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:6717: \"$ac_link\"") >&5 +if { (eval echo "$as_me:6968: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:6720: \$? = $ac_status" >&5 + echo "$as_me:6971: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:6723: \"$ac_try\"") >&5 + { (eval echo "$as_me:6974: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6726: \$? = $ac_status" >&5 + echo "$as_me:6977: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_decl_strtoll=yes else @@ -6733,7 +6984,7 @@ bash_cv_decl_strtoll=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:6736: result: $bash_cv_decl_strtoll" >&5 +echo "$as_me:6987: result: $bash_cv_decl_strtoll" >&5 echo "${ECHO_T}$bash_cv_decl_strtoll" >&6 bash_tr_func=HAVE_DECL_`echo strtoll | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` if test $bash_cv_decl_strtoll = yes; then @@ -6748,13 +6999,13 @@ EOF fi -echo "$as_me:6751: checking for declaration of strtoul" >&5 +echo "$as_me:7002: checking for declaration of strtoul" >&5 echo $ECHO_N "checking for declaration of strtoul... $ECHO_C" >&6 if test "${bash_cv_decl_strtoul+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 6757 "configure" +#line 7008 "configure" #include "confdefs.h" #if STDC_HEADERS @@ -6773,16 +7024,16 @@ return !strtoul; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:6776: \"$ac_link\"") >&5 +if { (eval echo "$as_me:7027: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:6779: \$? = $ac_status" >&5 + echo "$as_me:7030: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:6782: \"$ac_try\"") >&5 + { (eval echo "$as_me:7033: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6785: \$? = $ac_status" >&5 + echo "$as_me:7036: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_decl_strtoul=yes else @@ -6792,7 +7043,7 @@ bash_cv_decl_strtoul=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:6795: result: $bash_cv_decl_strtoul" >&5 +echo "$as_me:7046: result: $bash_cv_decl_strtoul" >&5 echo "${ECHO_T}$bash_cv_decl_strtoul" >&6 bash_tr_func=HAVE_DECL_`echo strtoul | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` if test $bash_cv_decl_strtoul = yes; then @@ -6807,13 +7058,13 @@ EOF fi -echo "$as_me:6810: checking for declaration of strtoull" >&5 +echo "$as_me:7061: checking for declaration of strtoull" >&5 echo $ECHO_N "checking for declaration of strtoull... $ECHO_C" >&6 if test "${bash_cv_decl_strtoull+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 6816 "configure" +#line 7067 "configure" #include "confdefs.h" #if STDC_HEADERS @@ -6832,16 +7083,16 @@ return !strtoull; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:6835: \"$ac_link\"") >&5 +if { (eval echo "$as_me:7086: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:6838: \$? = $ac_status" >&5 + echo "$as_me:7089: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:6841: \"$ac_try\"") >&5 + { (eval echo "$as_me:7092: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6844: \$? = $ac_status" >&5 + echo "$as_me:7095: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_decl_strtoull=yes else @@ -6851,7 +7102,7 @@ bash_cv_decl_strtoull=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:6854: result: $bash_cv_decl_strtoull" >&5 +echo "$as_me:7105: result: $bash_cv_decl_strtoull" >&5 echo "${ECHO_T}$bash_cv_decl_strtoull" >&6 bash_tr_func=HAVE_DECL_`echo strtoull | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` if test $bash_cv_decl_strtoull = yes; then @@ -6866,13 +7117,13 @@ EOF fi -echo "$as_me:6869: checking for declaration of strtoumax" >&5 +echo "$as_me:7120: checking for declaration of strtoumax" >&5 echo $ECHO_N "checking for declaration of strtoumax... $ECHO_C" >&6 if test "${bash_cv_decl_strtoumax+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 6875 "configure" +#line 7126 "configure" #include "confdefs.h" #if STDC_HEADERS @@ -6891,16 +7142,16 @@ return !strtoumax; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:6894: \"$ac_link\"") >&5 +if { (eval echo "$as_me:7145: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:6897: \$? = $ac_status" >&5 + echo "$as_me:7148: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:6900: \"$ac_try\"") >&5 + { (eval echo "$as_me:7151: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6903: \$? = $ac_status" >&5 + echo "$as_me:7154: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_decl_strtoumax=yes else @@ -6910,7 +7161,7 @@ bash_cv_decl_strtoumax=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:6913: result: $bash_cv_decl_strtoumax" >&5 +echo "$as_me:7164: result: $bash_cv_decl_strtoumax" >&5 echo "${ECHO_T}$bash_cv_decl_strtoumax" >&6 bash_tr_func=HAVE_DECL_`echo strtoumax | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` if test $bash_cv_decl_strtoumax = yes; then @@ -6928,23 +7179,23 @@ fi for ac_header in sys/time.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:6931: checking for $ac_header" >&5 +echo "$as_me:7182: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 6937 "configure" +#line 7188 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF -if { (eval echo "$as_me:6941: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:7192: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:6947: \$? = $ac_status" >&5 + echo "$as_me:7198: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -6963,7 +7214,7 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:6966: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:7217: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<EOF @@ -6976,13 +7227,13 @@ done for ac_func in alarm do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:6979: checking for $ac_func" >&5 +echo "$as_me:7230: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 6985 "configure" +#line 7236 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ @@ -7013,16 +7264,16 @@ f = $ac_func; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:7016: \"$ac_link\"") >&5 +if { (eval echo "$as_me:7267: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:7019: \$? = $ac_status" >&5 + echo "$as_me:7270: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:7022: \"$ac_try\"") >&5 + { (eval echo "$as_me:7273: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:7025: \$? = $ac_status" >&5 + echo "$as_me:7276: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else @@ -7032,7 +7283,7 @@ eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:7035: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "$as_me:7286: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<EOF @@ -7042,7 +7293,7 @@ EOF fi done -echo "$as_me:7045: checking for working mktime" >&5 +echo "$as_me:7296: checking for working mktime" >&5 echo $ECHO_N "checking for working mktime... $ECHO_C" >&6 if test "${ac_cv_func_working_mktime+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -7051,7 +7302,7 @@ else ac_cv_func_working_mktime=no else cat >conftest.$ac_ext <<_ACEOF -#line 7054 "configure" +#line 7305 "configure" #include "confdefs.h" /* Test program from Paul Eggert and Tony Leneis. */ #if TIME_WITH_SYS_TIME @@ -7200,15 +7451,15 @@ main () } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:7203: \"$ac_link\"") >&5 +if { (eval echo "$as_me:7454: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:7206: \$? = $ac_status" >&5 + echo "$as_me:7457: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:7208: \"$ac_try\"") >&5 + { (eval echo "$as_me:7459: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:7211: \$? = $ac_status" >&5 + echo "$as_me:7462: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_working_mktime=yes else @@ -7220,7 +7471,7 @@ fi rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -echo "$as_me:7223: result: $ac_cv_func_working_mktime" >&5 +echo "$as_me:7474: result: $ac_cv_func_working_mktime" >&5 echo "${ECHO_T}$ac_cv_func_working_mktime" >&6 if test $ac_cv_func_working_mktime = no; then LIBOBJS="$LIBOBJS mktime.$ac_objext" @@ -7229,23 +7480,23 @@ fi for ac_header in libintl.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:7232: checking for $ac_header" >&5 +echo "$as_me:7483: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 7238 "configure" +#line 7489 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF -if { (eval echo "$as_me:7242: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:7493: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:7248: \$? = $ac_status" >&5 + echo "$as_me:7499: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -7264,7 +7515,7 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:7267: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:7518: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<EOF @@ -7277,13 +7528,13 @@ done for ac_func in gettext textdomain bindtextdomain do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:7280: checking for $ac_func" >&5 +echo "$as_me:7531: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 7286 "configure" +#line 7537 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ @@ -7314,16 +7565,16 @@ f = $ac_func; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:7317: \"$ac_link\"") >&5 +if { (eval echo "$as_me:7568: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:7320: \$? = $ac_status" >&5 + echo "$as_me:7571: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:7323: \"$ac_try\"") >&5 + { (eval echo "$as_me:7574: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:7326: \$? = $ac_status" >&5 + echo "$as_me:7577: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else @@ -7333,7 +7584,7 @@ eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:7336: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "$as_me:7587: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<EOF @@ -7345,7 +7596,7 @@ done if test "$ac_cv_func_bindtextdomain" = "no"; then -echo "$as_me:7348: checking for bindtextdomain in -lintl" >&5 +echo "$as_me:7599: checking for bindtextdomain in -lintl" >&5 echo $ECHO_N "checking for bindtextdomain in -lintl... $ECHO_C" >&6 if test "${ac_cv_lib_intl_bindtextdomain+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -7353,7 +7604,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lintl $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 7356 "configure" +#line 7607 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -7372,16 +7623,16 @@ bindtextdomain (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:7375: \"$ac_link\"") >&5 +if { (eval echo "$as_me:7626: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:7378: \$? = $ac_status" >&5 + echo "$as_me:7629: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:7381: \"$ac_try\"") >&5 + { (eval echo "$as_me:7632: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:7384: \$? = $ac_status" >&5 + echo "$as_me:7635: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_intl_bindtextdomain=yes else @@ -7392,7 +7643,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:7395: result: $ac_cv_lib_intl_bindtextdomain" >&5 +echo "$as_me:7646: result: $ac_cv_lib_intl_bindtextdomain" >&5 echo "${ECHO_T}$ac_cv_lib_intl_bindtextdomain" >&6 if test $ac_cv_lib_intl_bindtextdomain = yes; then cat >>confdefs.h <<EOF @@ -7408,13 +7659,13 @@ fi for ac_func in gettext textdomain bindtextdomain do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:7411: checking for $ac_func" >&5 +echo "$as_me:7662: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 7417 "configure" +#line 7668 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ @@ -7445,16 +7696,16 @@ f = $ac_func; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:7448: \"$ac_link\"") >&5 +if { (eval echo "$as_me:7699: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:7451: \$? = $ac_status" >&5 + echo "$as_me:7702: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:7454: \"$ac_try\"") >&5 + { (eval echo "$as_me:7705: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:7457: \$? = $ac_status" >&5 + echo "$as_me:7708: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else @@ -7464,7 +7715,7 @@ eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:7467: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "$as_me:7718: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<EOF @@ -7480,23 +7731,23 @@ fi for ac_header in wctype.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:7483: checking for $ac_header" >&5 +echo "$as_me:7734: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 7489 "configure" +#line 7740 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF -if { (eval echo "$as_me:7493: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:7744: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:7499: \$? = $ac_status" >&5 + echo "$as_me:7750: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -7515,7 +7766,7 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:7518: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:7769: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<EOF @@ -7528,23 +7779,23 @@ done for ac_header in wchar.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:7531: checking for $ac_header" >&5 +echo "$as_me:7782: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 7537 "configure" +#line 7788 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF -if { (eval echo "$as_me:7541: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:7792: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:7547: \$? = $ac_status" >&5 + echo "$as_me:7798: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -7563,7 +7814,7 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:7566: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:7817: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<EOF @@ -7576,23 +7827,23 @@ done for ac_header in langinfo.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:7579: checking for $ac_header" >&5 +echo "$as_me:7830: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 7585 "configure" +#line 7836 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF -if { (eval echo "$as_me:7589: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:7840: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:7595: \$? = $ac_status" >&5 + echo "$as_me:7846: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -7611,7 +7862,7 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:7614: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:7865: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<EOF @@ -7621,13 +7872,13 @@ EOF fi done -echo "$as_me:7624: checking for mbsrtowcs" >&5 +echo "$as_me:7875: checking for mbsrtowcs" >&5 echo $ECHO_N "checking for mbsrtowcs... $ECHO_C" >&6 if test "${ac_cv_func_mbsrtowcs+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 7630 "configure" +#line 7881 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char mbsrtowcs (); below. */ @@ -7658,16 +7909,16 @@ f = mbsrtowcs; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:7661: \"$ac_link\"") >&5 +if { (eval echo "$as_me:7912: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:7664: \$? = $ac_status" >&5 + echo "$as_me:7915: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:7667: \"$ac_try\"") >&5 + { (eval echo "$as_me:7918: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:7670: \$? = $ac_status" >&5 + echo "$as_me:7921: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_mbsrtowcs=yes else @@ -7677,7 +7928,7 @@ ac_cv_func_mbsrtowcs=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:7680: result: $ac_cv_func_mbsrtowcs" >&5 +echo "$as_me:7931: result: $ac_cv_func_mbsrtowcs" >&5 echo "${ECHO_T}$ac_cv_func_mbsrtowcs" >&6 if test $ac_cv_func_mbsrtowcs = yes; then cat >>confdefs.h <<\EOF @@ -7686,13 +7937,208 @@ EOF fi -echo "$as_me:7689: checking for wcwidth" >&5 +echo "$as_me:7940: checking for mbrtowc" >&5 +echo $ECHO_N "checking for mbrtowc... $ECHO_C" >&6 +if test "${ac_cv_func_mbrtowc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 7946 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char mbrtowc (); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char mbrtowc (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_mbrtowc) || defined (__stub___mbrtowc) +choke me +#else +f = mbrtowc; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:7977: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:7980: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:7983: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7986: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_mbrtowc=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_mbrtowc=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:7996: result: $ac_cv_func_mbrtowc" >&5 +echo "${ECHO_T}$ac_cv_func_mbrtowc" >&6 +if test $ac_cv_func_mbrtowc = yes; then + cat >>confdefs.h <<\EOF +#define HAVE_MBRTOWC 1 +EOF + +fi + +echo "$as_me:8005: checking for mbrlen" >&5 +echo $ECHO_N "checking for mbrlen... $ECHO_C" >&6 +if test "${ac_cv_func_mbrlen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 8011 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char mbrlen (); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char mbrlen (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_mbrlen) || defined (__stub___mbrlen) +choke me +#else +f = mbrlen; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:8042: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8045: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:8048: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8051: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_mbrlen=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_mbrlen=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:8061: result: $ac_cv_func_mbrlen" >&5 +echo "${ECHO_T}$ac_cv_func_mbrlen" >&6 +if test $ac_cv_func_mbrlen = yes; then + cat >>confdefs.h <<\EOF +#define HAVE_MBRLEN 1 +EOF + +fi + +echo "$as_me:8070: checking for wctomb" >&5 +echo $ECHO_N "checking for wctomb... $ECHO_C" >&6 +if test "${ac_cv_func_wctomb+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 8076 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char wctomb (); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char wctomb (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_wctomb) || defined (__stub___wctomb) +choke me +#else +f = wctomb; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:8107: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8110: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:8113: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8116: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_wctomb=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_wctomb=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:8126: result: $ac_cv_func_wctomb" >&5 +echo "${ECHO_T}$ac_cv_func_wctomb" >&6 +if test $ac_cv_func_wctomb = yes; then + cat >>confdefs.h <<\EOF +#define HAVE_WCTOMB 1 +EOF + +fi + +echo "$as_me:8135: checking for wcwidth" >&5 echo $ECHO_N "checking for wcwidth... $ECHO_C" >&6 if test "${ac_cv_func_wcwidth+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 7695 "configure" +#line 8141 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char wcwidth (); below. */ @@ -7723,16 +8169,16 @@ f = wcwidth; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:7726: \"$ac_link\"") >&5 +if { (eval echo "$as_me:8172: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:7729: \$? = $ac_status" >&5 + echo "$as_me:8175: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:7732: \"$ac_try\"") >&5 + { (eval echo "$as_me:8178: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:7735: \$? = $ac_status" >&5 + echo "$as_me:8181: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_wcwidth=yes else @@ -7742,7 +8188,7 @@ ac_cv_func_wcwidth=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:7745: result: $ac_cv_func_wcwidth" >&5 +echo "$as_me:8191: result: $ac_cv_func_wcwidth" >&5 echo "${ECHO_T}$ac_cv_func_wcwidth" >&6 if test $ac_cv_func_wcwidth = yes; then cat >>confdefs.h <<\EOF @@ -7751,50 +8197,49 @@ EOF fi -echo "$as_me:7754: checking for mbstate_t" >&5 +echo "$as_me:8200: checking for mbstate_t" >&5 echo $ECHO_N "checking for mbstate_t... $ECHO_C" >&6 if test "${bash_cv_have_mbstate_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "$cross_compiling" = yes; then - { { echo "$as_me:7760: error: cannot run test program while cross compiling" >&5 -echo "$as_me: error: cannot run test program while cross compiling" >&2;} - { (exit 1); exit 1; }; } -else cat >conftest.$ac_ext <<_ACEOF -#line 7765 "configure" +#line 8206 "configure" #include "confdefs.h" #include <wchar.h> int main () { + mbstate_t ps; + mbstate_t *psp; + psp = (mbstate_t *)0; + + ; return 0; } _ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:7777: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:8223: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:7780: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:7782: \"$ac_try\"") >&5 + echo "$as_me:8226: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:8229: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:7785: \$? = $ac_status" >&5 + echo "$as_me:8232: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_have_mbstate_t=yes else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 bash_cv_have_mbstate_t=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi +rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:7797: result: $bash_cv_have_mbstate_t" >&5 +echo "$as_me:8242: result: $bash_cv_have_mbstate_t" >&5 echo "${ECHO_T}$bash_cv_have_mbstate_t" >&6 if test $bash_cv_have_mbstate_t = yes; then cat >>confdefs.h <<\EOF @@ -7803,13 +8248,13 @@ EOF fi -echo "$as_me:7806: checking for nl_langinfo and CODESET" >&5 +echo "$as_me:8251: checking for nl_langinfo and CODESET" >&5 echo $ECHO_N "checking for nl_langinfo and CODESET... $ECHO_C" >&6 if test "${bash_cv_langinfo_codeset+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 7812 "configure" +#line 8257 "configure" #include "confdefs.h" #include <langinfo.h> int @@ -7821,16 +8266,16 @@ char* cs = nl_langinfo(CODESET); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:7824: \"$ac_link\"") >&5 +if { (eval echo "$as_me:8269: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:7827: \$? = $ac_status" >&5 + echo "$as_me:8272: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:7830: \"$ac_try\"") >&5 + { (eval echo "$as_me:8275: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:7833: \$? = $ac_status" >&5 + echo "$as_me:8278: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_langinfo_codeset=yes else @@ -7840,7 +8285,7 @@ bash_cv_langinfo_codeset=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:7843: result: $bash_cv_langinfo_codeset" >&5 +echo "$as_me:8288: result: $bash_cv_langinfo_codeset" >&5 echo "${ECHO_T}$bash_cv_langinfo_codeset" >&6 if test $bash_cv_langinfo_codeset = yes; then cat >>confdefs.h <<\EOF @@ -7851,7 +8296,7 @@ fi if test "$opt_static_link" != yes; then -echo "$as_me:7854: checking for dlopen in -ldl" >&5 +echo "$as_me:8299: checking for dlopen in -ldl" >&5 echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 if test "${ac_cv_lib_dl_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -7859,7 +8304,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 7862 "configure" +#line 8307 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -7878,16 +8323,16 @@ dlopen (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:7881: \"$ac_link\"") >&5 +if { (eval echo "$as_me:8326: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:7884: \$? = $ac_status" >&5 + echo "$as_me:8329: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:7887: \"$ac_try\"") >&5 + { (eval echo "$as_me:8332: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:7890: \$? = $ac_status" >&5 + echo "$as_me:8335: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dl_dlopen=yes else @@ -7898,7 +8343,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:7901: result: $ac_cv_lib_dl_dlopen" >&5 +echo "$as_me:8346: result: $ac_cv_lib_dl_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 if test $ac_cv_lib_dl_dlopen = yes; then cat >>confdefs.h <<EOF @@ -7912,13 +8357,13 @@ fi for ac_func in dlopen dlclose dlsym do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:7915: checking for $ac_func" >&5 +echo "$as_me:8360: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 7921 "configure" +#line 8366 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ @@ -7949,16 +8394,16 @@ f = $ac_func; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:7952: \"$ac_link\"") >&5 +if { (eval echo "$as_me:8397: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:7955: \$? = $ac_status" >&5 + echo "$as_me:8400: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:7958: \"$ac_try\"") >&5 + { (eval echo "$as_me:8403: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:7961: \$? = $ac_status" >&5 + echo "$as_me:8406: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else @@ -7968,7 +8413,7 @@ eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:7971: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "$as_me:8416: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<EOF @@ -7980,13 +8425,13 @@ done fi -echo "$as_me:7983: checking for sys_siglist declaration in signal.h or unistd.h" >&5 +echo "$as_me:8428: checking for sys_siglist declaration in signal.h or unistd.h" >&5 echo $ECHO_N "checking for sys_siglist declaration in signal.h or unistd.h... $ECHO_C" >&6 if test "${ac_cv_decl_sys_siglist+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 7989 "configure" +#line 8434 "configure" #include "confdefs.h" #include <sys/types.h> #include <signal.h> @@ -8004,16 +8449,16 @@ char *msg = *(sys_siglist + 1); } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:8007: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:8452: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:8010: \$? = $ac_status" >&5 + echo "$as_me:8455: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:8013: \"$ac_try\"") >&5 + { (eval echo "$as_me:8458: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8016: \$? = $ac_status" >&5 + echo "$as_me:8461: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_decl_sys_siglist=yes else @@ -8023,7 +8468,7 @@ ac_cv_decl_sys_siglist=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:8026: result: $ac_cv_decl_sys_siglist" >&5 +echo "$as_me:8471: result: $ac_cv_decl_sys_siglist" >&5 echo "${ECHO_T}$ac_cv_decl_sys_siglist" >&6 if test $ac_cv_decl_sys_siglist = yes; then @@ -8035,13 +8480,13 @@ fi if test "$ac_cv_func_inet_aton" != 'yes'; then -echo "$as_me:8038: checking for inet_aton" >&5 +echo "$as_me:8483: checking for inet_aton" >&5 echo $ECHO_N "checking for inet_aton... $ECHO_C" >&6 if test "${bash_cv_func_inet_aton+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 8044 "configure" +#line 8489 "configure" #include "confdefs.h" #include <sys/types.h> @@ -8057,16 +8502,16 @@ main () } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:8060: \"$ac_link\"") >&5 +if { (eval echo "$as_me:8505: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:8063: \$? = $ac_status" >&5 + echo "$as_me:8508: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:8066: \"$ac_try\"") >&5 + { (eval echo "$as_me:8511: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8069: \$? = $ac_status" >&5 + echo "$as_me:8514: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_func_inet_aton=yes else @@ -8076,7 +8521,7 @@ bash_cv_func_inet_aton=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:8079: result: $bash_cv_func_inet_aton" >&5 +echo "$as_me:8524: result: $bash_cv_func_inet_aton" >&5 echo "${ECHO_T}$bash_cv_func_inet_aton" >&6 if test $bash_cv_func_inet_aton = yes; then cat >>confdefs.h <<\EOF @@ -8091,7 +8536,7 @@ fi case "$host_os" in irix4*) -echo "$as_me:8094: checking for getpwent in -lsun" >&5 +echo "$as_me:8539: checking for getpwent in -lsun" >&5 echo $ECHO_N "checking for getpwent in -lsun... $ECHO_C" >&6 if test "${ac_cv_lib_sun_getpwent+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -8099,7 +8544,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lsun $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 8102 "configure" +#line 8547 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -8118,16 +8563,16 @@ getpwent (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:8121: \"$ac_link\"") >&5 +if { (eval echo "$as_me:8566: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:8124: \$? = $ac_status" >&5 + echo "$as_me:8569: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:8127: \"$ac_try\"") >&5 + { (eval echo "$as_me:8572: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8130: \$? = $ac_status" >&5 + echo "$as_me:8575: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_sun_getpwent=yes else @@ -8138,7 +8583,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:8141: result: $ac_cv_lib_sun_getpwent" >&5 +echo "$as_me:8586: result: $ac_cv_lib_sun_getpwent" >&5 echo "${ECHO_T}$ac_cv_lib_sun_getpwent" >&6 if test $ac_cv_lib_sun_getpwent = yes; then cat >>confdefs.h <<EOF @@ -8156,14 +8601,14 @@ if test "$ac_cv_func_getpeername" = no; then if test "X$bash_cv_have_socklib" = "X"; then _bash_needmsg= else -echo "$as_me:8159: checking for socket library" >&5 +echo "$as_me:8604: checking for socket library" >&5 echo $ECHO_N "checking for socket library... $ECHO_C" >&6 _bash_needmsg=yes fi if test "${bash_cv_have_socklib+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo "$as_me:8166: checking for getpeername in -lsocket" >&5 + echo "$as_me:8611: checking for getpeername in -lsocket" >&5 echo $ECHO_N "checking for getpeername in -lsocket... $ECHO_C" >&6 if test "${ac_cv_lib_socket_getpeername+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -8171,7 +8616,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket -lnsl $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 8174 "configure" +#line 8619 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -8190,16 +8635,16 @@ getpeername (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:8193: \"$ac_link\"") >&5 +if { (eval echo "$as_me:8638: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:8196: \$? = $ac_status" >&5 + echo "$as_me:8641: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:8199: \"$ac_try\"") >&5 + { (eval echo "$as_me:8644: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8202: \$? = $ac_status" >&5 + echo "$as_me:8647: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_socket_getpeername=yes else @@ -8210,7 +8655,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:8213: result: $ac_cv_lib_socket_getpeername" >&5 +echo "$as_me:8658: result: $ac_cv_lib_socket_getpeername" >&5 echo "${ECHO_T}$ac_cv_lib_socket_getpeername" >&6 if test $ac_cv_lib_socket_getpeername = yes; then bash_cv_have_socklib=yes @@ -8221,7 +8666,7 @@ fi fi if test "X$_bash_needmsg" = Xyes; then - echo "$as_me:8224: result: $bash_cv_have_socklib" >&5 + echo "$as_me:8669: result: $bash_cv_have_socklib" >&5 echo "${ECHO_T}$bash_cv_have_socklib" >&6 _bash_needmsg= fi @@ -8230,14 +8675,14 @@ if test $bash_cv_have_socklib = yes; then if test "X$bash_cv_have_libnsl" = "X"; then _bash_needmsg= else - echo "$as_me:8233: checking for libnsl" >&5 + echo "$as_me:8678: checking for libnsl" >&5 echo $ECHO_N "checking for libnsl... $ECHO_C" >&6 _bash_needmsg=yes fi if test "${bash_cv_have_libnsl+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo "$as_me:8240: checking for t_open in -lnsl" >&5 + echo "$as_me:8685: checking for t_open in -lnsl" >&5 echo $ECHO_N "checking for t_open in -lnsl... $ECHO_C" >&6 if test "${ac_cv_lib_nsl_t_open+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -8245,7 +8690,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 8248 "configure" +#line 8693 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -8264,16 +8709,16 @@ t_open (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:8267: \"$ac_link\"") >&5 +if { (eval echo "$as_me:8712: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:8270: \$? = $ac_status" >&5 + echo "$as_me:8715: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:8273: \"$ac_try\"") >&5 + { (eval echo "$as_me:8718: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8276: \$? = $ac_status" >&5 + echo "$as_me:8721: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_nsl_t_open=yes else @@ -8284,7 +8729,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:8287: result: $ac_cv_lib_nsl_t_open" >&5 +echo "$as_me:8732: result: $ac_cv_lib_nsl_t_open" >&5 echo "${ECHO_T}$ac_cv_lib_nsl_t_open" >&6 if test $ac_cv_lib_nsl_t_open = yes; then bash_cv_have_libnsl=yes @@ -8295,7 +8740,7 @@ fi fi if test "X$_bash_needmsg" = Xyes; then - echo "$as_me:8298: result: $bash_cv_have_libnsl" >&5 + echo "$as_me:8743: result: $bash_cv_have_libnsl" >&5 echo "${ECHO_T}$bash_cv_have_libnsl" >&6 _bash_needmsg= fi @@ -8319,7 +8764,7 @@ if test "$ac_cv_func_gethostbyname" = no; then if test "X$bash_cv_have_gethostbyname" = "X"; then _bash_needmsg=yes else -echo "$as_me:8322: checking for gethostbyname in socket library" >&5 +echo "$as_me:8767: checking for gethostbyname in socket library" >&5 echo $ECHO_N "checking for gethostbyname in socket library... $ECHO_C" >&6 _bash_needmsg= fi @@ -8327,7 +8772,7 @@ if test "${bash_cv_have_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 8330 "configure" +#line 8775 "configure" #include "confdefs.h" #include <netdb.h> int @@ -8341,16 +8786,16 @@ main () } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:8344: \"$ac_link\"") >&5 +if { (eval echo "$as_me:8789: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:8347: \$? = $ac_status" >&5 + echo "$as_me:8792: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:8350: \"$ac_try\"") >&5 + { (eval echo "$as_me:8795: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8353: \$? = $ac_status" >&5 + echo "$as_me:8798: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_have_gethostbyname=yes else @@ -8363,10 +8808,10 @@ rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi if test "X$_bash_needmsg" = Xyes; then - echo "$as_me:8366: checking for gethostbyname in socket library" >&5 + echo "$as_me:8811: checking for gethostbyname in socket library" >&5 echo $ECHO_N "checking for gethostbyname in socket library... $ECHO_C" >&6 fi -echo "$as_me:8369: result: $bash_cv_have_gethostbyname" >&5 +echo "$as_me:8814: result: $bash_cv_have_gethostbyname" >&5 echo "${ECHO_T}$bash_cv_have_gethostbyname" >&6 if test "$bash_cv_have_gethostbyname" = yes; then cat >>confdefs.h <<\EOF @@ -8377,13 +8822,13 @@ fi fi -echo "$as_me:8380: checking for uid_t in sys/types.h" >&5 +echo "$as_me:8825: checking for uid_t in sys/types.h" >&5 echo $ECHO_N "checking for uid_t in sys/types.h... $ECHO_C" >&6 if test "${ac_cv_type_uid_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 8386 "configure" +#line 8831 "configure" #include "confdefs.h" #include <sys/types.h> @@ -8397,7 +8842,7 @@ fi rm -f conftest* fi -echo "$as_me:8400: result: $ac_cv_type_uid_t" >&5 +echo "$as_me:8845: result: $ac_cv_type_uid_t" >&5 echo "${ECHO_T}$ac_cv_type_uid_t" >&6 if test $ac_cv_type_uid_t = no; then @@ -8411,7 +8856,7 @@ EOF fi -echo "$as_me:8414: checking type of array argument to getgroups" >&5 +echo "$as_me:8859: checking type of array argument to getgroups" >&5 echo $ECHO_N "checking type of array argument to getgroups... $ECHO_C" >&6 if test "${ac_cv_type_getgroups+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -8420,7 +8865,7 @@ else ac_cv_type_getgroups=cross else cat >conftest.$ac_ext <<_ACEOF -#line 8423 "configure" +#line 8868 "configure" #include "confdefs.h" /* Thanks to Mike Rendell for this test. */ #include <sys/types.h> @@ -8446,15 +8891,15 @@ main () } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:8449: \"$ac_link\"") >&5 +if { (eval echo "$as_me:8894: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:8452: \$? = $ac_status" >&5 + echo "$as_me:8897: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:8454: \"$ac_try\"") >&5 + { (eval echo "$as_me:8899: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8457: \$? = $ac_status" >&5 + echo "$as_me:8902: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_getgroups=gid_t else @@ -8467,7 +8912,7 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_type_getgroups = cross; then cat >conftest.$ac_ext <<_ACEOF -#line 8470 "configure" +#line 8915 "configure" #include "confdefs.h" #include <unistd.h> @@ -8482,20 +8927,20 @@ rm -f conftest* fi fi -echo "$as_me:8485: result: $ac_cv_type_getgroups" >&5 +echo "$as_me:8930: result: $ac_cv_type_getgroups" >&5 echo "${ECHO_T}$ac_cv_type_getgroups" >&6 cat >>confdefs.h <<EOF #define GETGROUPS_T $ac_cv_type_getgroups EOF -echo "$as_me:8492: checking for off_t" >&5 +echo "$as_me:8937: checking for off_t" >&5 echo $ECHO_N "checking for off_t... $ECHO_C" >&6 if test "${ac_cv_type_off_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 8498 "configure" +#line 8943 "configure" #include "confdefs.h" $ac_includes_default int @@ -8510,16 +8955,16 @@ if (sizeof (off_t)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:8513: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:8958: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:8516: \$? = $ac_status" >&5 + echo "$as_me:8961: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:8519: \"$ac_try\"") >&5 + { (eval echo "$as_me:8964: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8522: \$? = $ac_status" >&5 + echo "$as_me:8967: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_off_t=yes else @@ -8529,7 +8974,7 @@ ac_cv_type_off_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:8532: result: $ac_cv_type_off_t" >&5 +echo "$as_me:8977: result: $ac_cv_type_off_t" >&5 echo "${ECHO_T}$ac_cv_type_off_t" >&6 if test $ac_cv_type_off_t = yes; then : @@ -8541,13 +8986,13 @@ EOF fi -echo "$as_me:8544: checking for mode_t" >&5 +echo "$as_me:8989: checking for mode_t" >&5 echo $ECHO_N "checking for mode_t... $ECHO_C" >&6 if test "${ac_cv_type_mode_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 8550 "configure" +#line 8995 "configure" #include "confdefs.h" $ac_includes_default int @@ -8562,16 +9007,16 @@ if (sizeof (mode_t)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:8565: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:9010: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:8568: \$? = $ac_status" >&5 + echo "$as_me:9013: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:8571: \"$ac_try\"") >&5 + { (eval echo "$as_me:9016: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8574: \$? = $ac_status" >&5 + echo "$as_me:9019: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_mode_t=yes else @@ -8581,7 +9026,7 @@ ac_cv_type_mode_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:8584: result: $ac_cv_type_mode_t" >&5 +echo "$as_me:9029: result: $ac_cv_type_mode_t" >&5 echo "${ECHO_T}$ac_cv_type_mode_t" >&6 if test $ac_cv_type_mode_t = yes; then : @@ -8593,13 +9038,13 @@ EOF fi -echo "$as_me:8596: checking for uid_t in sys/types.h" >&5 +echo "$as_me:9041: checking for uid_t in sys/types.h" >&5 echo $ECHO_N "checking for uid_t in sys/types.h... $ECHO_C" >&6 if test "${ac_cv_type_uid_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 8602 "configure" +#line 9047 "configure" #include "confdefs.h" #include <sys/types.h> @@ -8613,7 +9058,7 @@ fi rm -f conftest* fi -echo "$as_me:8616: result: $ac_cv_type_uid_t" >&5 +echo "$as_me:9061: result: $ac_cv_type_uid_t" >&5 echo "${ECHO_T}$ac_cv_type_uid_t" >&6 if test $ac_cv_type_uid_t = no; then @@ -8627,13 +9072,13 @@ EOF fi -echo "$as_me:8630: checking for pid_t" >&5 +echo "$as_me:9075: checking for pid_t" >&5 echo $ECHO_N "checking for pid_t... $ECHO_C" >&6 if test "${ac_cv_type_pid_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 8636 "configure" +#line 9081 "configure" #include "confdefs.h" $ac_includes_default int @@ -8648,16 +9093,16 @@ if (sizeof (pid_t)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:8651: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:9096: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:8654: \$? = $ac_status" >&5 + echo "$as_me:9099: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:8657: \"$ac_try\"") >&5 + { (eval echo "$as_me:9102: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8660: \$? = $ac_status" >&5 + echo "$as_me:9105: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_pid_t=yes else @@ -8667,7 +9112,7 @@ ac_cv_type_pid_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:8670: result: $ac_cv_type_pid_t" >&5 +echo "$as_me:9115: result: $ac_cv_type_pid_t" >&5 echo "${ECHO_T}$ac_cv_type_pid_t" >&6 if test $ac_cv_type_pid_t = yes; then : @@ -8679,13 +9124,13 @@ EOF fi -echo "$as_me:8682: checking for size_t" >&5 +echo "$as_me:9127: checking for size_t" >&5 echo $ECHO_N "checking for size_t... $ECHO_C" >&6 if test "${ac_cv_type_size_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 8688 "configure" +#line 9133 "configure" #include "confdefs.h" $ac_includes_default int @@ -8700,16 +9145,16 @@ if (sizeof (size_t)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:8703: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:9148: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:8706: \$? = $ac_status" >&5 + echo "$as_me:9151: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:8709: \"$ac_try\"") >&5 + { (eval echo "$as_me:9154: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8712: \$? = $ac_status" >&5 + echo "$as_me:9157: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_size_t=yes else @@ -8719,7 +9164,7 @@ ac_cv_type_size_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:8722: result: $ac_cv_type_size_t" >&5 +echo "$as_me:9167: result: $ac_cv_type_size_t" >&5 echo "${ECHO_T}$ac_cv_type_size_t" >&6 if test $ac_cv_type_size_t = yes; then : @@ -8731,13 +9176,13 @@ EOF fi -echo "$as_me:8734: checking for ssize_t" >&5 +echo "$as_me:9179: checking for ssize_t" >&5 echo $ECHO_N "checking for ssize_t... $ECHO_C" >&6 if test "${ac_cv_type_ssize_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 8740 "configure" +#line 9185 "configure" #include "confdefs.h" $ac_includes_default int @@ -8752,16 +9197,16 @@ if (sizeof (ssize_t)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:8755: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:9200: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:8758: \$? = $ac_status" >&5 + echo "$as_me:9203: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:8761: \"$ac_try\"") >&5 + { (eval echo "$as_me:9206: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8764: \$? = $ac_status" >&5 + echo "$as_me:9209: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_ssize_t=yes else @@ -8771,7 +9216,7 @@ ac_cv_type_ssize_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:8774: result: $ac_cv_type_ssize_t" >&5 +echo "$as_me:9219: result: $ac_cv_type_ssize_t" >&5 echo "${ECHO_T}$ac_cv_type_ssize_t" >&6 if test $ac_cv_type_ssize_t = yes; then : @@ -8783,13 +9228,13 @@ EOF fi -echo "$as_me:8786: checking for time_t" >&5 +echo "$as_me:9231: checking for time_t" >&5 echo $ECHO_N "checking for time_t... $ECHO_C" >&6 if test "${ac_cv_type_time_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 8792 "configure" +#line 9237 "configure" #include "confdefs.h" $ac_includes_default int @@ -8804,16 +9249,16 @@ if (sizeof (time_t)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:8807: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:9252: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:8810: \$? = $ac_status" >&5 + echo "$as_me:9255: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:8813: \"$ac_try\"") >&5 + { (eval echo "$as_me:9258: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8816: \$? = $ac_status" >&5 + echo "$as_me:9261: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_time_t=yes else @@ -8823,7 +9268,7 @@ ac_cv_type_time_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:8826: result: $ac_cv_type_time_t" >&5 +echo "$as_me:9271: result: $ac_cv_type_time_t" >&5 echo "${ECHO_T}$ac_cv_type_time_t" >&6 if test $ac_cv_type_time_t = yes; then : @@ -8835,13 +9280,13 @@ EOF fi -echo "$as_me:8838: checking for long long" >&5 +echo "$as_me:9283: checking for long long" >&5 echo $ECHO_N "checking for long long... $ECHO_C" >&6 if test "${bash_cv_type_long_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 8844 "configure" +#line 9289 "configure" #include "confdefs.h" long long ll = 1; int i = 63; @@ -8857,16 +9302,16 @@ return ll << i | ll >> i | llm / ll | llm % ll; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:8860: \"$ac_link\"") >&5 +if { (eval echo "$as_me:9305: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:8863: \$? = $ac_status" >&5 + echo "$as_me:9308: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:8866: \"$ac_try\"") >&5 + { (eval echo "$as_me:9311: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8869: \$? = $ac_status" >&5 + echo "$as_me:9314: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_type_long_long='long long' else @@ -8876,7 +9321,7 @@ bash_cv_type_long_long='long' fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:8879: result: $bash_cv_type_long_long" >&5 +echo "$as_me:9324: result: $bash_cv_type_long_long" >&5 echo "${ECHO_T}$bash_cv_type_long_long" >&6 if test "$bash_cv_type_long_long" = 'long long'; then cat >>confdefs.h <<\EOF @@ -8885,13 +9330,13 @@ EOF fi -echo "$as_me:8888: checking for unsigned long long" >&5 +echo "$as_me:9333: checking for unsigned long long" >&5 echo $ECHO_N "checking for unsigned long long... $ECHO_C" >&6 if test "${bash_cv_type_unsigned_long_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 8894 "configure" +#line 9339 "configure" #include "confdefs.h" unsigned long long ull = 1; int i = 63; @@ -8907,16 +9352,16 @@ return ull << i | ull >> i | ullmax / ull | ullmax % ull; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:8910: \"$ac_link\"") >&5 +if { (eval echo "$as_me:9355: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:8913: \$? = $ac_status" >&5 + echo "$as_me:9358: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:8916: \"$ac_try\"") >&5 + { (eval echo "$as_me:9361: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8919: \$? = $ac_status" >&5 + echo "$as_me:9364: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_type_unsigned_long_long='unsigned long long' else @@ -8926,7 +9371,7 @@ bash_cv_type_unsigned_long_long='unsigned long' fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:8929: result: $bash_cv_type_unsigned_long_long" >&5 +echo "$as_me:9374: result: $bash_cv_type_unsigned_long_long" >&5 echo "${ECHO_T}$bash_cv_type_unsigned_long_long" >&6 if test "$bash_cv_type_unsigned_long_long" = 'unsigned long long'; then cat >>confdefs.h <<\EOF @@ -8935,13 +9380,13 @@ EOF fi -echo "$as_me:8938: checking return type of signal handlers" >&5 +echo "$as_me:9383: checking return type of signal handlers" >&5 echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 if test "${ac_cv_type_signal+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 8944 "configure" +#line 9389 "configure" #include "confdefs.h" #include <sys/types.h> #include <signal.h> @@ -8963,16 +9408,16 @@ int i; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:8966: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:9411: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:8969: \$? = $ac_status" >&5 + echo "$as_me:9414: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:8972: \"$ac_try\"") >&5 + { (eval echo "$as_me:9417: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8975: \$? = $ac_status" >&5 + echo "$as_me:9420: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_signal=void else @@ -8982,20 +9427,20 @@ ac_cv_type_signal=int fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:8985: result: $ac_cv_type_signal" >&5 +echo "$as_me:9430: result: $ac_cv_type_signal" >&5 echo "${ECHO_T}$ac_cv_type_signal" >&6 cat >>confdefs.h <<EOF #define RETSIGTYPE $ac_cv_type_signal EOF -echo "$as_me:8992: checking for char" >&5 +echo "$as_me:9437: checking for char" >&5 echo $ECHO_N "checking for char... $ECHO_C" >&6 if test "${ac_cv_type_char+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 8998 "configure" +#line 9443 "configure" #include "confdefs.h" $ac_includes_default int @@ -9010,16 +9455,16 @@ if (sizeof (char)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:9013: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:9458: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9016: \$? = $ac_status" >&5 + echo "$as_me:9461: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:9019: \"$ac_try\"") >&5 + { (eval echo "$as_me:9464: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9022: \$? = $ac_status" >&5 + echo "$as_me:9467: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_char=yes else @@ -9029,10 +9474,10 @@ ac_cv_type_char=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:9032: result: $ac_cv_type_char" >&5 +echo "$as_me:9477: result: $ac_cv_type_char" >&5 echo "${ECHO_T}$ac_cv_type_char" >&6 -echo "$as_me:9035: checking size of char" >&5 +echo "$as_me:9480: checking size of char" >&5 echo $ECHO_N "checking size of char... $ECHO_C" >&6 if test "${ac_cv_sizeof_char+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -9041,7 +9486,7 @@ else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF -#line 9044 "configure" +#line 9489 "configure" #include "confdefs.h" $ac_includes_default int @@ -9053,21 +9498,21 @@ int _array_ [1 - 2 * !((sizeof (char)) >= 0)] } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:9056: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:9501: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9059: \$? = $ac_status" >&5 + echo "$as_me:9504: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:9062: \"$ac_try\"") >&5 + { (eval echo "$as_me:9507: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9065: \$? = $ac_status" >&5 + echo "$as_me:9510: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF -#line 9070 "configure" +#line 9515 "configure" #include "confdefs.h" $ac_includes_default int @@ -9079,16 +9524,16 @@ int _array_ [1 - 2 * !((sizeof (char)) <= $ac_mid)] } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:9082: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:9527: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9085: \$? = $ac_status" >&5 + echo "$as_me:9530: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:9088: \"$ac_try\"") >&5 + { (eval echo "$as_me:9533: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9091: \$? = $ac_status" >&5 + echo "$as_me:9536: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid; break else @@ -9104,7 +9549,7 @@ cat conftest.$ac_ext >&5 ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF -#line 9107 "configure" +#line 9552 "configure" #include "confdefs.h" $ac_includes_default int @@ -9116,16 +9561,16 @@ int _array_ [1 - 2 * !((sizeof (char)) >= $ac_mid)] } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:9119: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:9564: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9122: \$? = $ac_status" >&5 + echo "$as_me:9567: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:9125: \"$ac_try\"") >&5 + { (eval echo "$as_me:9570: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9128: \$? = $ac_status" >&5 + echo "$as_me:9573: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=$ac_mid; break else @@ -9141,7 +9586,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF -#line 9144 "configure" +#line 9589 "configure" #include "confdefs.h" $ac_includes_default int @@ -9153,16 +9598,16 @@ int _array_ [1 - 2 * !((sizeof (char)) <= $ac_mid)] } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:9156: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:9601: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9159: \$? = $ac_status" >&5 + echo "$as_me:9604: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:9162: \"$ac_try\"") >&5 + { (eval echo "$as_me:9607: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9165: \$? = $ac_status" >&5 + echo "$as_me:9610: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid else @@ -9175,12 +9620,12 @@ done ac_cv_sizeof_char=$ac_lo else if test "$cross_compiling" = yes; then - { { echo "$as_me:9178: error: cannot run test program while cross compiling" >&5 + { { echo "$as_me:9623: error: cannot run test program while cross compiling" >&5 echo "$as_me: error: cannot run test program while cross compiling" >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF -#line 9183 "configure" +#line 9628 "configure" #include "confdefs.h" $ac_includes_default int @@ -9196,15 +9641,15 @@ fclose (f); } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:9199: \"$ac_link\"") >&5 +if { (eval echo "$as_me:9644: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:9202: \$? = $ac_status" >&5 + echo "$as_me:9647: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:9204: \"$ac_try\"") >&5 + { (eval echo "$as_me:9649: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9207: \$? = $ac_status" >&5 + echo "$as_me:9652: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_char=`cat conftest.val` else @@ -9220,19 +9665,19 @@ else ac_cv_sizeof_char=0 fi fi -echo "$as_me:9223: result: $ac_cv_sizeof_char" >&5 +echo "$as_me:9668: result: $ac_cv_sizeof_char" >&5 echo "${ECHO_T}$ac_cv_sizeof_char" >&6 cat >>confdefs.h <<EOF #define SIZEOF_CHAR $ac_cv_sizeof_char EOF -echo "$as_me:9229: checking for short" >&5 +echo "$as_me:9674: checking for short" >&5 echo $ECHO_N "checking for short... $ECHO_C" >&6 if test "${ac_cv_type_short+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 9235 "configure" +#line 9680 "configure" #include "confdefs.h" $ac_includes_default int @@ -9247,16 +9692,16 @@ if (sizeof (short)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:9250: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:9695: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9253: \$? = $ac_status" >&5 + echo "$as_me:9698: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:9256: \"$ac_try\"") >&5 + { (eval echo "$as_me:9701: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9259: \$? = $ac_status" >&5 + echo "$as_me:9704: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_short=yes else @@ -9266,10 +9711,10 @@ ac_cv_type_short=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:9269: result: $ac_cv_type_short" >&5 +echo "$as_me:9714: result: $ac_cv_type_short" >&5 echo "${ECHO_T}$ac_cv_type_short" >&6 -echo "$as_me:9272: checking size of short" >&5 +echo "$as_me:9717: checking size of short" >&5 echo $ECHO_N "checking size of short... $ECHO_C" >&6 if test "${ac_cv_sizeof_short+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -9278,7 +9723,7 @@ else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF -#line 9281 "configure" +#line 9726 "configure" #include "confdefs.h" $ac_includes_default int @@ -9290,21 +9735,21 @@ int _array_ [1 - 2 * !((sizeof (short)) >= 0)] } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:9293: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:9738: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9296: \$? = $ac_status" >&5 + echo "$as_me:9741: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:9299: \"$ac_try\"") >&5 + { (eval echo "$as_me:9744: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9302: \$? = $ac_status" >&5 + echo "$as_me:9747: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF -#line 9307 "configure" +#line 9752 "configure" #include "confdefs.h" $ac_includes_default int @@ -9316,16 +9761,16 @@ int _array_ [1 - 2 * !((sizeof (short)) <= $ac_mid)] } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:9319: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:9764: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9322: \$? = $ac_status" >&5 + echo "$as_me:9767: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:9325: \"$ac_try\"") >&5 + { (eval echo "$as_me:9770: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9328: \$? = $ac_status" >&5 + echo "$as_me:9773: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid; break else @@ -9341,7 +9786,7 @@ cat conftest.$ac_ext >&5 ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF -#line 9344 "configure" +#line 9789 "configure" #include "confdefs.h" $ac_includes_default int @@ -9353,16 +9798,16 @@ int _array_ [1 - 2 * !((sizeof (short)) >= $ac_mid)] } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:9356: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:9801: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9359: \$? = $ac_status" >&5 + echo "$as_me:9804: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:9362: \"$ac_try\"") >&5 + { (eval echo "$as_me:9807: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9365: \$? = $ac_status" >&5 + echo "$as_me:9810: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=$ac_mid; break else @@ -9378,7 +9823,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF -#line 9381 "configure" +#line 9826 "configure" #include "confdefs.h" $ac_includes_default int @@ -9390,16 +9835,16 @@ int _array_ [1 - 2 * !((sizeof (short)) <= $ac_mid)] } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:9393: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:9838: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9396: \$? = $ac_status" >&5 + echo "$as_me:9841: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:9399: \"$ac_try\"") >&5 + { (eval echo "$as_me:9844: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9402: \$? = $ac_status" >&5 + echo "$as_me:9847: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid else @@ -9412,12 +9857,12 @@ done ac_cv_sizeof_short=$ac_lo else if test "$cross_compiling" = yes; then - { { echo "$as_me:9415: error: cannot run test program while cross compiling" >&5 + { { echo "$as_me:9860: error: cannot run test program while cross compiling" >&5 echo "$as_me: error: cannot run test program while cross compiling" >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF -#line 9420 "configure" +#line 9865 "configure" #include "confdefs.h" $ac_includes_default int @@ -9433,15 +9878,15 @@ fclose (f); } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:9436: \"$ac_link\"") >&5 +if { (eval echo "$as_me:9881: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:9439: \$? = $ac_status" >&5 + echo "$as_me:9884: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:9441: \"$ac_try\"") >&5 + { (eval echo "$as_me:9886: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9444: \$? = $ac_status" >&5 + echo "$as_me:9889: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_short=`cat conftest.val` else @@ -9457,19 +9902,19 @@ else ac_cv_sizeof_short=0 fi fi -echo "$as_me:9460: result: $ac_cv_sizeof_short" >&5 +echo "$as_me:9905: result: $ac_cv_sizeof_short" >&5 echo "${ECHO_T}$ac_cv_sizeof_short" >&6 cat >>confdefs.h <<EOF #define SIZEOF_SHORT $ac_cv_sizeof_short EOF -echo "$as_me:9466: checking for int" >&5 +echo "$as_me:9911: checking for int" >&5 echo $ECHO_N "checking for int... $ECHO_C" >&6 if test "${ac_cv_type_int+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 9472 "configure" +#line 9917 "configure" #include "confdefs.h" $ac_includes_default int @@ -9484,16 +9929,16 @@ if (sizeof (int)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:9487: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:9932: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9490: \$? = $ac_status" >&5 + echo "$as_me:9935: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:9493: \"$ac_try\"") >&5 + { (eval echo "$as_me:9938: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9496: \$? = $ac_status" >&5 + echo "$as_me:9941: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_int=yes else @@ -9503,10 +9948,10 @@ ac_cv_type_int=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:9506: result: $ac_cv_type_int" >&5 +echo "$as_me:9951: result: $ac_cv_type_int" >&5 echo "${ECHO_T}$ac_cv_type_int" >&6 -echo "$as_me:9509: checking size of int" >&5 +echo "$as_me:9954: checking size of int" >&5 echo $ECHO_N "checking size of int... $ECHO_C" >&6 if test "${ac_cv_sizeof_int+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -9515,7 +9960,7 @@ else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF -#line 9518 "configure" +#line 9963 "configure" #include "confdefs.h" $ac_includes_default int @@ -9527,21 +9972,21 @@ int _array_ [1 - 2 * !((sizeof (int)) >= 0)] } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:9530: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:9975: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9533: \$? = $ac_status" >&5 + echo "$as_me:9978: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:9536: \"$ac_try\"") >&5 + { (eval echo "$as_me:9981: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9539: \$? = $ac_status" >&5 + echo "$as_me:9984: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF -#line 9544 "configure" +#line 9989 "configure" #include "confdefs.h" $ac_includes_default int @@ -9553,16 +9998,16 @@ int _array_ [1 - 2 * !((sizeof (int)) <= $ac_mid)] } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:9556: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:10001: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9559: \$? = $ac_status" >&5 + echo "$as_me:10004: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:9562: \"$ac_try\"") >&5 + { (eval echo "$as_me:10007: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9565: \$? = $ac_status" >&5 + echo "$as_me:10010: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid; break else @@ -9578,7 +10023,7 @@ cat conftest.$ac_ext >&5 ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF -#line 9581 "configure" +#line 10026 "configure" #include "confdefs.h" $ac_includes_default int @@ -9590,16 +10035,16 @@ int _array_ [1 - 2 * !((sizeof (int)) >= $ac_mid)] } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:9593: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:10038: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9596: \$? = $ac_status" >&5 + echo "$as_me:10041: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:9599: \"$ac_try\"") >&5 + { (eval echo "$as_me:10044: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9602: \$? = $ac_status" >&5 + echo "$as_me:10047: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=$ac_mid; break else @@ -9615,7 +10060,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF -#line 9618 "configure" +#line 10063 "configure" #include "confdefs.h" $ac_includes_default int @@ -9627,16 +10072,16 @@ int _array_ [1 - 2 * !((sizeof (int)) <= $ac_mid)] } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:9630: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:10075: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9633: \$? = $ac_status" >&5 + echo "$as_me:10078: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:9636: \"$ac_try\"") >&5 + { (eval echo "$as_me:10081: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9639: \$? = $ac_status" >&5 + echo "$as_me:10084: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid else @@ -9649,12 +10094,12 @@ done ac_cv_sizeof_int=$ac_lo else if test "$cross_compiling" = yes; then - { { echo "$as_me:9652: error: cannot run test program while cross compiling" >&5 + { { echo "$as_me:10097: error: cannot run test program while cross compiling" >&5 echo "$as_me: error: cannot run test program while cross compiling" >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF -#line 9657 "configure" +#line 10102 "configure" #include "confdefs.h" $ac_includes_default int @@ -9670,15 +10115,15 @@ fclose (f); } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:9673: \"$ac_link\"") >&5 +if { (eval echo "$as_me:10118: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:9676: \$? = $ac_status" >&5 + echo "$as_me:10121: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:9678: \"$ac_try\"") >&5 + { (eval echo "$as_me:10123: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9681: \$? = $ac_status" >&5 + echo "$as_me:10126: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_int=`cat conftest.val` else @@ -9694,19 +10139,19 @@ else ac_cv_sizeof_int=0 fi fi -echo "$as_me:9697: result: $ac_cv_sizeof_int" >&5 +echo "$as_me:10142: result: $ac_cv_sizeof_int" >&5 echo "${ECHO_T}$ac_cv_sizeof_int" >&6 cat >>confdefs.h <<EOF #define SIZEOF_INT $ac_cv_sizeof_int EOF -echo "$as_me:9703: checking for long" >&5 +echo "$as_me:10148: checking for long" >&5 echo $ECHO_N "checking for long... $ECHO_C" >&6 if test "${ac_cv_type_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 9709 "configure" +#line 10154 "configure" #include "confdefs.h" $ac_includes_default int @@ -9721,16 +10166,16 @@ if (sizeof (long)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:9724: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:10169: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9727: \$? = $ac_status" >&5 + echo "$as_me:10172: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:9730: \"$ac_try\"") >&5 + { (eval echo "$as_me:10175: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9733: \$? = $ac_status" >&5 + echo "$as_me:10178: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_long=yes else @@ -9740,10 +10185,10 @@ ac_cv_type_long=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:9743: result: $ac_cv_type_long" >&5 +echo "$as_me:10188: result: $ac_cv_type_long" >&5 echo "${ECHO_T}$ac_cv_type_long" >&6 -echo "$as_me:9746: checking size of long" >&5 +echo "$as_me:10191: checking size of long" >&5 echo $ECHO_N "checking size of long... $ECHO_C" >&6 if test "${ac_cv_sizeof_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -9752,7 +10197,7 @@ else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF -#line 9755 "configure" +#line 10200 "configure" #include "confdefs.h" $ac_includes_default int @@ -9764,21 +10209,21 @@ int _array_ [1 - 2 * !((sizeof (long)) >= 0)] } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:9767: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:10212: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9770: \$? = $ac_status" >&5 + echo "$as_me:10215: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:9773: \"$ac_try\"") >&5 + { (eval echo "$as_me:10218: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9776: \$? = $ac_status" >&5 + echo "$as_me:10221: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF -#line 9781 "configure" +#line 10226 "configure" #include "confdefs.h" $ac_includes_default int @@ -9790,16 +10235,16 @@ int _array_ [1 - 2 * !((sizeof (long)) <= $ac_mid)] } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:9793: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:10238: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9796: \$? = $ac_status" >&5 + echo "$as_me:10241: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:9799: \"$ac_try\"") >&5 + { (eval echo "$as_me:10244: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9802: \$? = $ac_status" >&5 + echo "$as_me:10247: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid; break else @@ -9815,7 +10260,7 @@ cat conftest.$ac_ext >&5 ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF -#line 9818 "configure" +#line 10263 "configure" #include "confdefs.h" $ac_includes_default int @@ -9827,16 +10272,16 @@ int _array_ [1 - 2 * !((sizeof (long)) >= $ac_mid)] } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:9830: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:10275: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9833: \$? = $ac_status" >&5 + echo "$as_me:10278: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:9836: \"$ac_try\"") >&5 + { (eval echo "$as_me:10281: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9839: \$? = $ac_status" >&5 + echo "$as_me:10284: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=$ac_mid; break else @@ -9852,7 +10297,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF -#line 9855 "configure" +#line 10300 "configure" #include "confdefs.h" $ac_includes_default int @@ -9864,16 +10309,16 @@ int _array_ [1 - 2 * !((sizeof (long)) <= $ac_mid)] } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:9867: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:10312: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9870: \$? = $ac_status" >&5 + echo "$as_me:10315: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:9873: \"$ac_try\"") >&5 + { (eval echo "$as_me:10318: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9876: \$? = $ac_status" >&5 + echo "$as_me:10321: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid else @@ -9886,12 +10331,12 @@ done ac_cv_sizeof_long=$ac_lo else if test "$cross_compiling" = yes; then - { { echo "$as_me:9889: error: cannot run test program while cross compiling" >&5 + { { echo "$as_me:10334: error: cannot run test program while cross compiling" >&5 echo "$as_me: error: cannot run test program while cross compiling" >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF -#line 9894 "configure" +#line 10339 "configure" #include "confdefs.h" $ac_includes_default int @@ -9907,15 +10352,15 @@ fclose (f); } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:9910: \"$ac_link\"") >&5 +if { (eval echo "$as_me:10355: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:9913: \$? = $ac_status" >&5 + echo "$as_me:10358: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:9915: \"$ac_try\"") >&5 + { (eval echo "$as_me:10360: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9918: \$? = $ac_status" >&5 + echo "$as_me:10363: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_long=`cat conftest.val` else @@ -9931,19 +10376,19 @@ else ac_cv_sizeof_long=0 fi fi -echo "$as_me:9934: result: $ac_cv_sizeof_long" >&5 +echo "$as_me:10379: result: $ac_cv_sizeof_long" >&5 echo "${ECHO_T}$ac_cv_sizeof_long" >&6 cat >>confdefs.h <<EOF #define SIZEOF_LONG $ac_cv_sizeof_long EOF -echo "$as_me:9940: checking for char *" >&5 +echo "$as_me:10385: checking for char *" >&5 echo $ECHO_N "checking for char *... $ECHO_C" >&6 if test "${ac_cv_type_char_p+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 9946 "configure" +#line 10391 "configure" #include "confdefs.h" $ac_includes_default int @@ -9958,16 +10403,16 @@ if (sizeof (char *)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:9961: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:10406: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9964: \$? = $ac_status" >&5 + echo "$as_me:10409: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:9967: \"$ac_try\"") >&5 + { (eval echo "$as_me:10412: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9970: \$? = $ac_status" >&5 + echo "$as_me:10415: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_char_p=yes else @@ -9977,10 +10422,10 @@ ac_cv_type_char_p=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:9980: result: $ac_cv_type_char_p" >&5 +echo "$as_me:10425: result: $ac_cv_type_char_p" >&5 echo "${ECHO_T}$ac_cv_type_char_p" >&6 -echo "$as_me:9983: checking size of char *" >&5 +echo "$as_me:10428: checking size of char *" >&5 echo $ECHO_N "checking size of char *... $ECHO_C" >&6 if test "${ac_cv_sizeof_char_p+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -9989,7 +10434,7 @@ else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF -#line 9992 "configure" +#line 10437 "configure" #include "confdefs.h" $ac_includes_default int @@ -10001,21 +10446,21 @@ int _array_ [1 - 2 * !((sizeof (char *)) >= 0)] } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:10004: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:10449: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:10007: \$? = $ac_status" >&5 + echo "$as_me:10452: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:10010: \"$ac_try\"") >&5 + { (eval echo "$as_me:10455: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10013: \$? = $ac_status" >&5 + echo "$as_me:10458: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF -#line 10018 "configure" +#line 10463 "configure" #include "confdefs.h" $ac_includes_default int @@ -10027,16 +10472,16 @@ int _array_ [1 - 2 * !((sizeof (char *)) <= $ac_mid)] } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:10030: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:10475: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:10033: \$? = $ac_status" >&5 + echo "$as_me:10478: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:10036: \"$ac_try\"") >&5 + { (eval echo "$as_me:10481: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10039: \$? = $ac_status" >&5 + echo "$as_me:10484: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid; break else @@ -10052,7 +10497,7 @@ cat conftest.$ac_ext >&5 ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF -#line 10055 "configure" +#line 10500 "configure" #include "confdefs.h" $ac_includes_default int @@ -10064,16 +10509,16 @@ int _array_ [1 - 2 * !((sizeof (char *)) >= $ac_mid)] } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:10067: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:10512: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:10070: \$? = $ac_status" >&5 + echo "$as_me:10515: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:10073: \"$ac_try\"") >&5 + { (eval echo "$as_me:10518: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10076: \$? = $ac_status" >&5 + echo "$as_me:10521: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=$ac_mid; break else @@ -10089,7 +10534,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF -#line 10092 "configure" +#line 10537 "configure" #include "confdefs.h" $ac_includes_default int @@ -10101,16 +10546,16 @@ int _array_ [1 - 2 * !((sizeof (char *)) <= $ac_mid)] } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:10104: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:10549: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:10107: \$? = $ac_status" >&5 + echo "$as_me:10552: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:10110: \"$ac_try\"") >&5 + { (eval echo "$as_me:10555: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10113: \$? = $ac_status" >&5 + echo "$as_me:10558: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid else @@ -10123,12 +10568,12 @@ done ac_cv_sizeof_char_p=$ac_lo else if test "$cross_compiling" = yes; then - { { echo "$as_me:10126: error: cannot run test program while cross compiling" >&5 + { { echo "$as_me:10571: error: cannot run test program while cross compiling" >&5 echo "$as_me: error: cannot run test program while cross compiling" >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF -#line 10131 "configure" +#line 10576 "configure" #include "confdefs.h" $ac_includes_default int @@ -10144,15 +10589,15 @@ fclose (f); } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:10147: \"$ac_link\"") >&5 +if { (eval echo "$as_me:10592: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:10150: \$? = $ac_status" >&5 + echo "$as_me:10595: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:10152: \"$ac_try\"") >&5 + { (eval echo "$as_me:10597: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10155: \$? = $ac_status" >&5 + echo "$as_me:10600: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_char_p=`cat conftest.val` else @@ -10168,19 +10613,19 @@ else ac_cv_sizeof_char_p=0 fi fi -echo "$as_me:10171: result: $ac_cv_sizeof_char_p" >&5 +echo "$as_me:10616: result: $ac_cv_sizeof_char_p" >&5 echo "${ECHO_T}$ac_cv_sizeof_char_p" >&6 cat >>confdefs.h <<EOF #define SIZEOF_CHAR_P $ac_cv_sizeof_char_p EOF -echo "$as_me:10177: checking for double" >&5 +echo "$as_me:10622: checking for double" >&5 echo $ECHO_N "checking for double... $ECHO_C" >&6 if test "${ac_cv_type_double+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 10183 "configure" +#line 10628 "configure" #include "confdefs.h" $ac_includes_default int @@ -10195,16 +10640,16 @@ if (sizeof (double)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:10198: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:10643: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:10201: \$? = $ac_status" >&5 + echo "$as_me:10646: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:10204: \"$ac_try\"") >&5 + { (eval echo "$as_me:10649: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10207: \$? = $ac_status" >&5 + echo "$as_me:10652: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_double=yes else @@ -10214,10 +10659,10 @@ ac_cv_type_double=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:10217: result: $ac_cv_type_double" >&5 +echo "$as_me:10662: result: $ac_cv_type_double" >&5 echo "${ECHO_T}$ac_cv_type_double" >&6 -echo "$as_me:10220: checking size of double" >&5 +echo "$as_me:10665: checking size of double" >&5 echo $ECHO_N "checking size of double... $ECHO_C" >&6 if test "${ac_cv_sizeof_double+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -10226,7 +10671,7 @@ else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF -#line 10229 "configure" +#line 10674 "configure" #include "confdefs.h" $ac_includes_default int @@ -10238,21 +10683,21 @@ int _array_ [1 - 2 * !((sizeof (double)) >= 0)] } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:10241: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:10686: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:10244: \$? = $ac_status" >&5 + echo "$as_me:10689: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:10247: \"$ac_try\"") >&5 + { (eval echo "$as_me:10692: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10250: \$? = $ac_status" >&5 + echo "$as_me:10695: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF -#line 10255 "configure" +#line 10700 "configure" #include "confdefs.h" $ac_includes_default int @@ -10264,16 +10709,16 @@ int _array_ [1 - 2 * !((sizeof (double)) <= $ac_mid)] } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:10267: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:10712: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:10270: \$? = $ac_status" >&5 + echo "$as_me:10715: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:10273: \"$ac_try\"") >&5 + { (eval echo "$as_me:10718: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10276: \$? = $ac_status" >&5 + echo "$as_me:10721: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid; break else @@ -10289,7 +10734,7 @@ cat conftest.$ac_ext >&5 ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF -#line 10292 "configure" +#line 10737 "configure" #include "confdefs.h" $ac_includes_default int @@ -10301,16 +10746,16 @@ int _array_ [1 - 2 * !((sizeof (double)) >= $ac_mid)] } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:10304: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:10749: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:10307: \$? = $ac_status" >&5 + echo "$as_me:10752: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:10310: \"$ac_try\"") >&5 + { (eval echo "$as_me:10755: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10313: \$? = $ac_status" >&5 + echo "$as_me:10758: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=$ac_mid; break else @@ -10326,7 +10771,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF -#line 10329 "configure" +#line 10774 "configure" #include "confdefs.h" $ac_includes_default int @@ -10338,16 +10783,16 @@ int _array_ [1 - 2 * !((sizeof (double)) <= $ac_mid)] } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:10341: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:10786: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:10344: \$? = $ac_status" >&5 + echo "$as_me:10789: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:10347: \"$ac_try\"") >&5 + { (eval echo "$as_me:10792: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10350: \$? = $ac_status" >&5 + echo "$as_me:10795: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid else @@ -10360,12 +10805,12 @@ done ac_cv_sizeof_double=$ac_lo else if test "$cross_compiling" = yes; then - { { echo "$as_me:10363: error: cannot run test program while cross compiling" >&5 + { { echo "$as_me:10808: error: cannot run test program while cross compiling" >&5 echo "$as_me: error: cannot run test program while cross compiling" >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF -#line 10368 "configure" +#line 10813 "configure" #include "confdefs.h" $ac_includes_default int @@ -10381,15 +10826,15 @@ fclose (f); } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:10384: \"$ac_link\"") >&5 +if { (eval echo "$as_me:10829: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:10387: \$? = $ac_status" >&5 + echo "$as_me:10832: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:10389: \"$ac_try\"") >&5 + { (eval echo "$as_me:10834: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10392: \$? = $ac_status" >&5 + echo "$as_me:10837: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_double=`cat conftest.val` else @@ -10405,19 +10850,19 @@ else ac_cv_sizeof_double=0 fi fi -echo "$as_me:10408: result: $ac_cv_sizeof_double" >&5 +echo "$as_me:10853: result: $ac_cv_sizeof_double" >&5 echo "${ECHO_T}$ac_cv_sizeof_double" >&6 cat >>confdefs.h <<EOF #define SIZEOF_DOUBLE $ac_cv_sizeof_double EOF -echo "$as_me:10414: checking for long long" >&5 +echo "$as_me:10859: checking for long long" >&5 echo $ECHO_N "checking for long long... $ECHO_C" >&6 if test "${ac_cv_type_long_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 10420 "configure" +#line 10865 "configure" #include "confdefs.h" $ac_includes_default int @@ -10432,16 +10877,16 @@ if (sizeof (long long)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:10435: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:10880: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:10438: \$? = $ac_status" >&5 + echo "$as_me:10883: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:10441: \"$ac_try\"") >&5 + { (eval echo "$as_me:10886: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10444: \$? = $ac_status" >&5 + echo "$as_me:10889: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_long_long=yes else @@ -10451,10 +10896,10 @@ ac_cv_type_long_long=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:10454: result: $ac_cv_type_long_long" >&5 +echo "$as_me:10899: result: $ac_cv_type_long_long" >&5 echo "${ECHO_T}$ac_cv_type_long_long" >&6 -echo "$as_me:10457: checking size of long long" >&5 +echo "$as_me:10902: checking size of long long" >&5 echo $ECHO_N "checking size of long long... $ECHO_C" >&6 if test "${ac_cv_sizeof_long_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -10463,7 +10908,7 @@ else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF -#line 10466 "configure" +#line 10911 "configure" #include "confdefs.h" $ac_includes_default int @@ -10475,21 +10920,21 @@ int _array_ [1 - 2 * !((sizeof (long long)) >= 0)] } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:10478: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:10923: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:10481: \$? = $ac_status" >&5 + echo "$as_me:10926: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:10484: \"$ac_try\"") >&5 + { (eval echo "$as_me:10929: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10487: \$? = $ac_status" >&5 + echo "$as_me:10932: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF -#line 10492 "configure" +#line 10937 "configure" #include "confdefs.h" $ac_includes_default int @@ -10501,16 +10946,16 @@ int _array_ [1 - 2 * !((sizeof (long long)) <= $ac_mid)] } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:10504: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:10949: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:10507: \$? = $ac_status" >&5 + echo "$as_me:10952: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:10510: \"$ac_try\"") >&5 + { (eval echo "$as_me:10955: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10513: \$? = $ac_status" >&5 + echo "$as_me:10958: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid; break else @@ -10526,7 +10971,7 @@ cat conftest.$ac_ext >&5 ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF -#line 10529 "configure" +#line 10974 "configure" #include "confdefs.h" $ac_includes_default int @@ -10538,16 +10983,16 @@ int _array_ [1 - 2 * !((sizeof (long long)) >= $ac_mid)] } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:10541: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:10986: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:10544: \$? = $ac_status" >&5 + echo "$as_me:10989: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:10547: \"$ac_try\"") >&5 + { (eval echo "$as_me:10992: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10550: \$? = $ac_status" >&5 + echo "$as_me:10995: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=$ac_mid; break else @@ -10563,7 +11008,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF -#line 10566 "configure" +#line 11011 "configure" #include "confdefs.h" $ac_includes_default int @@ -10575,16 +11020,16 @@ int _array_ [1 - 2 * !((sizeof (long long)) <= $ac_mid)] } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:10578: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:11023: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:10581: \$? = $ac_status" >&5 + echo "$as_me:11026: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:10584: \"$ac_try\"") >&5 + { (eval echo "$as_me:11029: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10587: \$? = $ac_status" >&5 + echo "$as_me:11032: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid else @@ -10597,12 +11042,12 @@ done ac_cv_sizeof_long_long=$ac_lo else if test "$cross_compiling" = yes; then - { { echo "$as_me:10600: error: cannot run test program while cross compiling" >&5 + { { echo "$as_me:11045: error: cannot run test program while cross compiling" >&5 echo "$as_me: error: cannot run test program while cross compiling" >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF -#line 10605 "configure" +#line 11050 "configure" #include "confdefs.h" $ac_includes_default int @@ -10618,15 +11063,15 @@ fclose (f); } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:10621: \"$ac_link\"") >&5 +if { (eval echo "$as_me:11066: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:10624: \$? = $ac_status" >&5 + echo "$as_me:11069: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:10626: \"$ac_try\"") >&5 + { (eval echo "$as_me:11071: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10629: \$? = $ac_status" >&5 + echo "$as_me:11074: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_long_long=`cat conftest.val` else @@ -10642,19 +11087,19 @@ else ac_cv_sizeof_long_long=0 fi fi -echo "$as_me:10645: result: $ac_cv_sizeof_long_long" >&5 +echo "$as_me:11090: result: $ac_cv_sizeof_long_long" >&5 echo "${ECHO_T}$ac_cv_sizeof_long_long" >&6 cat >>confdefs.h <<EOF #define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long EOF -echo "$as_me:10651: checking for u_int" >&5 +echo "$as_me:11096: checking for u_int" >&5 echo $ECHO_N "checking for u_int... $ECHO_C" >&6 if test "${ac_cv_type_u_int+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 10657 "configure" +#line 11102 "configure" #include "confdefs.h" $ac_includes_default int @@ -10669,16 +11114,16 @@ if (sizeof (u_int)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:10672: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:11117: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:10675: \$? = $ac_status" >&5 + echo "$as_me:11120: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:10678: \"$ac_try\"") >&5 + { (eval echo "$as_me:11123: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10681: \$? = $ac_status" >&5 + echo "$as_me:11126: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_u_int=yes else @@ -10688,7 +11133,7 @@ ac_cv_type_u_int=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:10691: result: $ac_cv_type_u_int" >&5 +echo "$as_me:11136: result: $ac_cv_type_u_int" >&5 echo "${ECHO_T}$ac_cv_type_u_int" >&6 if test $ac_cv_type_u_int = yes; then : @@ -10700,13 +11145,13 @@ EOF fi -echo "$as_me:10703: checking for u_long" >&5 +echo "$as_me:11148: checking for u_long" >&5 echo $ECHO_N "checking for u_long... $ECHO_C" >&6 if test "${ac_cv_type_u_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 10709 "configure" +#line 11154 "configure" #include "confdefs.h" $ac_includes_default int @@ -10721,16 +11166,16 @@ if (sizeof (u_long)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:10724: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:11169: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:10727: \$? = $ac_status" >&5 + echo "$as_me:11172: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:10730: \"$ac_try\"") >&5 + { (eval echo "$as_me:11175: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10733: \$? = $ac_status" >&5 + echo "$as_me:11178: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_u_long=yes else @@ -10740,7 +11185,7 @@ ac_cv_type_u_long=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:10743: result: $ac_cv_type_u_long" >&5 +echo "$as_me:11188: result: $ac_cv_type_u_long" >&5 echo "${ECHO_T}$ac_cv_type_u_long" >&6 if test $ac_cv_type_u_long = yes; then : @@ -10753,13 +11198,13 @@ EOF fi if test "$ac_cv_sizeof_short" = 2; then - echo "$as_me:10756: checking for bits16_t" >&5 + echo "$as_me:11201: checking for bits16_t" >&5 echo $ECHO_N "checking for bits16_t... $ECHO_C" >&6 if test "${ac_cv_type_bits16_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 10762 "configure" +#line 11207 "configure" #include "confdefs.h" $ac_includes_default int @@ -10774,16 +11219,16 @@ if (sizeof (bits16_t)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:10777: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:11222: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:10780: \$? = $ac_status" >&5 + echo "$as_me:11225: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:10783: \"$ac_try\"") >&5 + { (eval echo "$as_me:11228: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10786: \$? = $ac_status" >&5 + echo "$as_me:11231: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_bits16_t=yes else @@ -10793,7 +11238,7 @@ ac_cv_type_bits16_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:10796: result: $ac_cv_type_bits16_t" >&5 +echo "$as_me:11241: result: $ac_cv_type_bits16_t" >&5 echo "${ECHO_T}$ac_cv_type_bits16_t" >&6 if test $ac_cv_type_bits16_t = yes; then : @@ -10806,13 +11251,13 @@ EOF fi elif test "$ac_cv_sizeof_char" = 2; then - echo "$as_me:10809: checking for bits16_t" >&5 + echo "$as_me:11254: checking for bits16_t" >&5 echo $ECHO_N "checking for bits16_t... $ECHO_C" >&6 if test "${ac_cv_type_bits16_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 10815 "configure" +#line 11260 "configure" #include "confdefs.h" $ac_includes_default int @@ -10827,16 +11272,16 @@ if (sizeof (bits16_t)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:10830: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:11275: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:10833: \$? = $ac_status" >&5 + echo "$as_me:11278: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:10836: \"$ac_try\"") >&5 + { (eval echo "$as_me:11281: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10839: \$? = $ac_status" >&5 + echo "$as_me:11284: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_bits16_t=yes else @@ -10846,7 +11291,7 @@ ac_cv_type_bits16_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:10849: result: $ac_cv_type_bits16_t" >&5 +echo "$as_me:11294: result: $ac_cv_type_bits16_t" >&5 echo "${ECHO_T}$ac_cv_type_bits16_t" >&6 if test $ac_cv_type_bits16_t = yes; then : @@ -10859,13 +11304,13 @@ EOF fi else - echo "$as_me:10862: checking for bits16_t" >&5 + echo "$as_me:11307: checking for bits16_t" >&5 echo $ECHO_N "checking for bits16_t... $ECHO_C" >&6 if test "${ac_cv_type_bits16_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 10868 "configure" +#line 11313 "configure" #include "confdefs.h" $ac_includes_default int @@ -10880,16 +11325,16 @@ if (sizeof (bits16_t)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:10883: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:11328: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:10886: \$? = $ac_status" >&5 + echo "$as_me:11331: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:10889: \"$ac_try\"") >&5 + { (eval echo "$as_me:11334: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10892: \$? = $ac_status" >&5 + echo "$as_me:11337: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_bits16_t=yes else @@ -10899,7 +11344,7 @@ ac_cv_type_bits16_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:10902: result: $ac_cv_type_bits16_t" >&5 +echo "$as_me:11347: result: $ac_cv_type_bits16_t" >&5 echo "${ECHO_T}$ac_cv_type_bits16_t" >&6 if test $ac_cv_type_bits16_t = yes; then : @@ -10914,13 +11359,13 @@ fi fi if test "$ac_cv_sizeof_short" = 2; then - echo "$as_me:10917: checking for u_bits16_t" >&5 + echo "$as_me:11362: checking for u_bits16_t" >&5 echo $ECHO_N "checking for u_bits16_t... $ECHO_C" >&6 if test "${ac_cv_type_u_bits16_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 10923 "configure" +#line 11368 "configure" #include "confdefs.h" $ac_includes_default int @@ -10935,16 +11380,16 @@ if (sizeof (u_bits16_t)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:10938: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:11383: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:10941: \$? = $ac_status" >&5 + echo "$as_me:11386: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:10944: \"$ac_try\"") >&5 + { (eval echo "$as_me:11389: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10947: \$? = $ac_status" >&5 + echo "$as_me:11392: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_u_bits16_t=yes else @@ -10954,7 +11399,7 @@ ac_cv_type_u_bits16_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:10957: result: $ac_cv_type_u_bits16_t" >&5 +echo "$as_me:11402: result: $ac_cv_type_u_bits16_t" >&5 echo "${ECHO_T}$ac_cv_type_u_bits16_t" >&6 if test $ac_cv_type_u_bits16_t = yes; then : @@ -10967,13 +11412,13 @@ EOF fi elif test "$ac_cv_sizeof_char" = 2; then - echo "$as_me:10970: checking for u_bits16_t" >&5 + echo "$as_me:11415: checking for u_bits16_t" >&5 echo $ECHO_N "checking for u_bits16_t... $ECHO_C" >&6 if test "${ac_cv_type_u_bits16_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 10976 "configure" +#line 11421 "configure" #include "confdefs.h" $ac_includes_default int @@ -10988,16 +11433,16 @@ if (sizeof (u_bits16_t)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:10991: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:11436: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:10994: \$? = $ac_status" >&5 + echo "$as_me:11439: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:10997: \"$ac_try\"") >&5 + { (eval echo "$as_me:11442: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11000: \$? = $ac_status" >&5 + echo "$as_me:11445: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_u_bits16_t=yes else @@ -11007,7 +11452,7 @@ ac_cv_type_u_bits16_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:11010: result: $ac_cv_type_u_bits16_t" >&5 +echo "$as_me:11455: result: $ac_cv_type_u_bits16_t" >&5 echo "${ECHO_T}$ac_cv_type_u_bits16_t" >&6 if test $ac_cv_type_u_bits16_t = yes; then : @@ -11020,13 +11465,13 @@ EOF fi else - echo "$as_me:11023: checking for u_bits16_t" >&5 + echo "$as_me:11468: checking for u_bits16_t" >&5 echo $ECHO_N "checking for u_bits16_t... $ECHO_C" >&6 if test "${ac_cv_type_u_bits16_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 11029 "configure" +#line 11474 "configure" #include "confdefs.h" $ac_includes_default int @@ -11041,16 +11486,16 @@ if (sizeof (u_bits16_t)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:11044: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:11489: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:11047: \$? = $ac_status" >&5 + echo "$as_me:11492: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:11050: \"$ac_try\"") >&5 + { (eval echo "$as_me:11495: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11053: \$? = $ac_status" >&5 + echo "$as_me:11498: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_u_bits16_t=yes else @@ -11060,7 +11505,7 @@ ac_cv_type_u_bits16_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:11063: result: $ac_cv_type_u_bits16_t" >&5 +echo "$as_me:11508: result: $ac_cv_type_u_bits16_t" >&5 echo "${ECHO_T}$ac_cv_type_u_bits16_t" >&6 if test $ac_cv_type_u_bits16_t = yes; then : @@ -11075,13 +11520,13 @@ fi fi if test "$ac_cv_sizeof_int" = 4; then - echo "$as_me:11078: checking for bits32_t" >&5 + echo "$as_me:11523: checking for bits32_t" >&5 echo $ECHO_N "checking for bits32_t... $ECHO_C" >&6 if test "${ac_cv_type_bits32_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 11084 "configure" +#line 11529 "configure" #include "confdefs.h" $ac_includes_default int @@ -11096,16 +11541,16 @@ if (sizeof (bits32_t)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:11099: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:11544: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:11102: \$? = $ac_status" >&5 + echo "$as_me:11547: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:11105: \"$ac_try\"") >&5 + { (eval echo "$as_me:11550: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11108: \$? = $ac_status" >&5 + echo "$as_me:11553: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_bits32_t=yes else @@ -11115,7 +11560,7 @@ ac_cv_type_bits32_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:11118: result: $ac_cv_type_bits32_t" >&5 +echo "$as_me:11563: result: $ac_cv_type_bits32_t" >&5 echo "${ECHO_T}$ac_cv_type_bits32_t" >&6 if test $ac_cv_type_bits32_t = yes; then : @@ -11128,13 +11573,13 @@ EOF fi elif test "$ac_cv_sizeof_long" = 4; then - echo "$as_me:11131: checking for bits32_t" >&5 + echo "$as_me:11576: checking for bits32_t" >&5 echo $ECHO_N "checking for bits32_t... $ECHO_C" >&6 if test "${ac_cv_type_bits32_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 11137 "configure" +#line 11582 "configure" #include "confdefs.h" $ac_includes_default int @@ -11149,16 +11594,16 @@ if (sizeof (bits32_t)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:11152: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:11597: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:11155: \$? = $ac_status" >&5 + echo "$as_me:11600: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:11158: \"$ac_try\"") >&5 + { (eval echo "$as_me:11603: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11161: \$? = $ac_status" >&5 + echo "$as_me:11606: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_bits32_t=yes else @@ -11168,7 +11613,7 @@ ac_cv_type_bits32_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:11171: result: $ac_cv_type_bits32_t" >&5 +echo "$as_me:11616: result: $ac_cv_type_bits32_t" >&5 echo "${ECHO_T}$ac_cv_type_bits32_t" >&6 if test $ac_cv_type_bits32_t = yes; then : @@ -11181,13 +11626,13 @@ EOF fi else - echo "$as_me:11184: checking for bits32_t" >&5 + echo "$as_me:11629: checking for bits32_t" >&5 echo $ECHO_N "checking for bits32_t... $ECHO_C" >&6 if test "${ac_cv_type_bits32_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 11190 "configure" +#line 11635 "configure" #include "confdefs.h" $ac_includes_default int @@ -11202,16 +11647,16 @@ if (sizeof (bits32_t)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:11205: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:11650: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:11208: \$? = $ac_status" >&5 + echo "$as_me:11653: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:11211: \"$ac_try\"") >&5 + { (eval echo "$as_me:11656: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11214: \$? = $ac_status" >&5 + echo "$as_me:11659: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_bits32_t=yes else @@ -11221,7 +11666,7 @@ ac_cv_type_bits32_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:11224: result: $ac_cv_type_bits32_t" >&5 +echo "$as_me:11669: result: $ac_cv_type_bits32_t" >&5 echo "${ECHO_T}$ac_cv_type_bits32_t" >&6 if test $ac_cv_type_bits32_t = yes; then : @@ -11236,13 +11681,13 @@ fi fi if test "$ac_cv_sizeof_int" = 4; then - echo "$as_me:11239: checking for u_bits32_t" >&5 + echo "$as_me:11684: checking for u_bits32_t" >&5 echo $ECHO_N "checking for u_bits32_t... $ECHO_C" >&6 if test "${ac_cv_type_u_bits32_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 11245 "configure" +#line 11690 "configure" #include "confdefs.h" $ac_includes_default int @@ -11257,16 +11702,16 @@ if (sizeof (u_bits32_t)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:11260: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:11705: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:11263: \$? = $ac_status" >&5 + echo "$as_me:11708: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:11266: \"$ac_try\"") >&5 + { (eval echo "$as_me:11711: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11269: \$? = $ac_status" >&5 + echo "$as_me:11714: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_u_bits32_t=yes else @@ -11276,7 +11721,7 @@ ac_cv_type_u_bits32_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:11279: result: $ac_cv_type_u_bits32_t" >&5 +echo "$as_me:11724: result: $ac_cv_type_u_bits32_t" >&5 echo "${ECHO_T}$ac_cv_type_u_bits32_t" >&6 if test $ac_cv_type_u_bits32_t = yes; then : @@ -11289,13 +11734,13 @@ EOF fi elif test "$ac_cv_sizeof_long" = 4; then - echo "$as_me:11292: checking for u_bits32_t" >&5 + echo "$as_me:11737: checking for u_bits32_t" >&5 echo $ECHO_N "checking for u_bits32_t... $ECHO_C" >&6 if test "${ac_cv_type_u_bits32_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 11298 "configure" +#line 11743 "configure" #include "confdefs.h" $ac_includes_default int @@ -11310,16 +11755,16 @@ if (sizeof (u_bits32_t)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:11313: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:11758: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:11316: \$? = $ac_status" >&5 + echo "$as_me:11761: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:11319: \"$ac_try\"") >&5 + { (eval echo "$as_me:11764: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11322: \$? = $ac_status" >&5 + echo "$as_me:11767: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_u_bits32_t=yes else @@ -11329,7 +11774,7 @@ ac_cv_type_u_bits32_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:11332: result: $ac_cv_type_u_bits32_t" >&5 +echo "$as_me:11777: result: $ac_cv_type_u_bits32_t" >&5 echo "${ECHO_T}$ac_cv_type_u_bits32_t" >&6 if test $ac_cv_type_u_bits32_t = yes; then : @@ -11342,13 +11787,13 @@ EOF fi else - echo "$as_me:11345: checking for u_bits32_t" >&5 + echo "$as_me:11790: checking for u_bits32_t" >&5 echo $ECHO_N "checking for u_bits32_t... $ECHO_C" >&6 if test "${ac_cv_type_u_bits32_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 11351 "configure" +#line 11796 "configure" #include "confdefs.h" $ac_includes_default int @@ -11363,16 +11808,16 @@ if (sizeof (u_bits32_t)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:11366: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:11811: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:11369: \$? = $ac_status" >&5 + echo "$as_me:11814: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:11372: \"$ac_try\"") >&5 + { (eval echo "$as_me:11817: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11375: \$? = $ac_status" >&5 + echo "$as_me:11820: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_u_bits32_t=yes else @@ -11382,7 +11827,7 @@ ac_cv_type_u_bits32_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:11385: result: $ac_cv_type_u_bits32_t" >&5 +echo "$as_me:11830: result: $ac_cv_type_u_bits32_t" >&5 echo "${ECHO_T}$ac_cv_type_u_bits32_t" >&6 if test $ac_cv_type_u_bits32_t = yes; then : @@ -11397,13 +11842,13 @@ fi fi if test "$ac_cv_sizeof_char_p" = 8; then - echo "$as_me:11400: checking for bits64_t" >&5 + echo "$as_me:11845: checking for bits64_t" >&5 echo $ECHO_N "checking for bits64_t... $ECHO_C" >&6 if test "${ac_cv_type_bits64_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 11406 "configure" +#line 11851 "configure" #include "confdefs.h" $ac_includes_default int @@ -11418,16 +11863,16 @@ if (sizeof (bits64_t)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:11421: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:11866: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:11424: \$? = $ac_status" >&5 + echo "$as_me:11869: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:11427: \"$ac_try\"") >&5 + { (eval echo "$as_me:11872: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11430: \$? = $ac_status" >&5 + echo "$as_me:11875: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_bits64_t=yes else @@ -11437,7 +11882,7 @@ ac_cv_type_bits64_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:11440: result: $ac_cv_type_bits64_t" >&5 +echo "$as_me:11885: result: $ac_cv_type_bits64_t" >&5 echo "${ECHO_T}$ac_cv_type_bits64_t" >&6 if test $ac_cv_type_bits64_t = yes; then : @@ -11450,13 +11895,13 @@ EOF fi elif test "$ac_cv_sizeof_double" = 8; then - echo "$as_me:11453: checking for bits64_t" >&5 + echo "$as_me:11898: checking for bits64_t" >&5 echo $ECHO_N "checking for bits64_t... $ECHO_C" >&6 if test "${ac_cv_type_bits64_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 11459 "configure" +#line 11904 "configure" #include "confdefs.h" $ac_includes_default int @@ -11471,16 +11916,16 @@ if (sizeof (bits64_t)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:11474: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:11919: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:11477: \$? = $ac_status" >&5 + echo "$as_me:11922: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:11480: \"$ac_try\"") >&5 + { (eval echo "$as_me:11925: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11483: \$? = $ac_status" >&5 + echo "$as_me:11928: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_bits64_t=yes else @@ -11490,7 +11935,7 @@ ac_cv_type_bits64_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:11493: result: $ac_cv_type_bits64_t" >&5 +echo "$as_me:11938: result: $ac_cv_type_bits64_t" >&5 echo "${ECHO_T}$ac_cv_type_bits64_t" >&6 if test $ac_cv_type_bits64_t = yes; then : @@ -11503,13 +11948,13 @@ EOF fi elif test -n "$ac_cv_type_long_long" && test "$ac_cv_sizeof_long_long" = 8; then - echo "$as_me:11506: checking for bits64_t" >&5 + echo "$as_me:11951: checking for bits64_t" >&5 echo $ECHO_N "checking for bits64_t... $ECHO_C" >&6 if test "${ac_cv_type_bits64_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 11512 "configure" +#line 11957 "configure" #include "confdefs.h" $ac_includes_default int @@ -11524,16 +11969,16 @@ if (sizeof (bits64_t)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:11527: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:11972: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:11530: \$? = $ac_status" >&5 + echo "$as_me:11975: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:11533: \"$ac_try\"") >&5 + { (eval echo "$as_me:11978: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11536: \$? = $ac_status" >&5 + echo "$as_me:11981: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_bits64_t=yes else @@ -11543,7 +11988,7 @@ ac_cv_type_bits64_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:11546: result: $ac_cv_type_bits64_t" >&5 +echo "$as_me:11991: result: $ac_cv_type_bits64_t" >&5 echo "${ECHO_T}$ac_cv_type_bits64_t" >&6 if test $ac_cv_type_bits64_t = yes; then : @@ -11556,13 +12001,13 @@ EOF fi elif test "$ac_cv_sizeof_long" = 8; then - echo "$as_me:11559: checking for bits64_t" >&5 + echo "$as_me:12004: checking for bits64_t" >&5 echo $ECHO_N "checking for bits64_t... $ECHO_C" >&6 if test "${ac_cv_type_bits64_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 11565 "configure" +#line 12010 "configure" #include "confdefs.h" $ac_includes_default int @@ -11577,16 +12022,16 @@ if (sizeof (bits64_t)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:11580: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:12025: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:11583: \$? = $ac_status" >&5 + echo "$as_me:12028: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:11586: \"$ac_try\"") >&5 + { (eval echo "$as_me:12031: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11589: \$? = $ac_status" >&5 + echo "$as_me:12034: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_bits64_t=yes else @@ -11596,7 +12041,7 @@ ac_cv_type_bits64_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:11599: result: $ac_cv_type_bits64_t" >&5 +echo "$as_me:12044: result: $ac_cv_type_bits64_t" >&5 echo "${ECHO_T}$ac_cv_type_bits64_t" >&6 if test $ac_cv_type_bits64_t = yes; then : @@ -11609,13 +12054,13 @@ EOF fi else - echo "$as_me:11612: checking for bits64_t" >&5 + echo "$as_me:12057: checking for bits64_t" >&5 echo $ECHO_N "checking for bits64_t... $ECHO_C" >&6 if test "${ac_cv_type_bits64_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 11618 "configure" +#line 12063 "configure" #include "confdefs.h" $ac_includes_default int @@ -11630,16 +12075,16 @@ if (sizeof (bits64_t)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:11633: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:12078: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:11636: \$? = $ac_status" >&5 + echo "$as_me:12081: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:11639: \"$ac_try\"") >&5 + { (eval echo "$as_me:12084: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11642: \$? = $ac_status" >&5 + echo "$as_me:12087: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_bits64_t=yes else @@ -11649,7 +12094,7 @@ ac_cv_type_bits64_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:11652: result: $ac_cv_type_bits64_t" >&5 +echo "$as_me:12097: result: $ac_cv_type_bits64_t" >&5 echo "${ECHO_T}$ac_cv_type_bits64_t" >&6 if test $ac_cv_type_bits64_t = yes; then : @@ -11664,13 +12109,13 @@ fi fi if test "$ac_cv_sizeof_int" = "$ac_cv_sizeof_char_p"; then - echo "$as_me:11667: checking for ptrdiff_t" >&5 + echo "$as_me:12112: checking for ptrdiff_t" >&5 echo $ECHO_N "checking for ptrdiff_t... $ECHO_C" >&6 if test "${ac_cv_type_ptrdiff_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 11673 "configure" +#line 12118 "configure" #include "confdefs.h" $ac_includes_default int @@ -11685,16 +12130,16 @@ if (sizeof (ptrdiff_t)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:11688: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:12133: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:11691: \$? = $ac_status" >&5 + echo "$as_me:12136: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:11694: \"$ac_try\"") >&5 + { (eval echo "$as_me:12139: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11697: \$? = $ac_status" >&5 + echo "$as_me:12142: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_ptrdiff_t=yes else @@ -11704,7 +12149,7 @@ ac_cv_type_ptrdiff_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:11707: result: $ac_cv_type_ptrdiff_t" >&5 +echo "$as_me:12152: result: $ac_cv_type_ptrdiff_t" >&5 echo "${ECHO_T}$ac_cv_type_ptrdiff_t" >&6 if test $ac_cv_type_ptrdiff_t = yes; then : @@ -11717,13 +12162,13 @@ EOF fi elif test "$ac_cv_sizeof_long" = "$ac_cv_sizeof_char_p"; then - echo "$as_me:11720: checking for ptrdiff_t" >&5 + echo "$as_me:12165: checking for ptrdiff_t" >&5 echo $ECHO_N "checking for ptrdiff_t... $ECHO_C" >&6 if test "${ac_cv_type_ptrdiff_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 11726 "configure" +#line 12171 "configure" #include "confdefs.h" $ac_includes_default int @@ -11738,16 +12183,16 @@ if (sizeof (ptrdiff_t)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:11741: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:12186: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:11744: \$? = $ac_status" >&5 + echo "$as_me:12189: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:11747: \"$ac_try\"") >&5 + { (eval echo "$as_me:12192: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11750: \$? = $ac_status" >&5 + echo "$as_me:12195: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_ptrdiff_t=yes else @@ -11757,7 +12202,7 @@ ac_cv_type_ptrdiff_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:11760: result: $ac_cv_type_ptrdiff_t" >&5 +echo "$as_me:12205: result: $ac_cv_type_ptrdiff_t" >&5 echo "${ECHO_T}$ac_cv_type_ptrdiff_t" >&6 if test $ac_cv_type_ptrdiff_t = yes; then : @@ -11770,13 +12215,13 @@ EOF fi elif test "$ac_cv_type_long_long" = yes && test "$ac_cv_sizeof_long_long" = "$ac_cv_sizeof_char_p"; then - echo "$as_me:11773: checking for ptrdiff_t" >&5 + echo "$as_me:12218: checking for ptrdiff_t" >&5 echo $ECHO_N "checking for ptrdiff_t... $ECHO_C" >&6 if test "${ac_cv_type_ptrdiff_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 11779 "configure" +#line 12224 "configure" #include "confdefs.h" $ac_includes_default int @@ -11791,16 +12236,16 @@ if (sizeof (ptrdiff_t)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:11794: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:12239: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:11797: \$? = $ac_status" >&5 + echo "$as_me:12242: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:11800: \"$ac_try\"") >&5 + { (eval echo "$as_me:12245: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11803: \$? = $ac_status" >&5 + echo "$as_me:12248: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_ptrdiff_t=yes else @@ -11810,7 +12255,7 @@ ac_cv_type_ptrdiff_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:11813: result: $ac_cv_type_ptrdiff_t" >&5 +echo "$as_me:12258: result: $ac_cv_type_ptrdiff_t" >&5 echo "${ECHO_T}$ac_cv_type_ptrdiff_t" >&6 if test $ac_cv_type_ptrdiff_t = yes; then : @@ -11823,13 +12268,13 @@ EOF fi else - echo "$as_me:11826: checking for ptrdiff_t" >&5 + echo "$as_me:12271: checking for ptrdiff_t" >&5 echo $ECHO_N "checking for ptrdiff_t... $ECHO_C" >&6 if test "${ac_cv_type_ptrdiff_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 11832 "configure" +#line 12277 "configure" #include "confdefs.h" $ac_includes_default int @@ -11844,16 +12289,16 @@ if (sizeof (ptrdiff_t)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:11847: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:12292: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:11850: \$? = $ac_status" >&5 + echo "$as_me:12295: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:11853: \"$ac_try\"") >&5 + { (eval echo "$as_me:12298: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11856: \$? = $ac_status" >&5 + echo "$as_me:12301: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_ptrdiff_t=yes else @@ -11863,7 +12308,7 @@ ac_cv_type_ptrdiff_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:11866: result: $ac_cv_type_ptrdiff_t" >&5 +echo "$as_me:12311: result: $ac_cv_type_ptrdiff_t" >&5 echo "${ECHO_T}$ac_cv_type_ptrdiff_t" >&6 if test $ac_cv_type_ptrdiff_t = yes; then : @@ -11877,13 +12322,13 @@ fi fi -echo "$as_me:11880: checking whether stat file-mode macros are broken" >&5 +echo "$as_me:12325: checking whether stat file-mode macros are broken" >&5 echo $ECHO_N "checking whether stat file-mode macros are broken... $ECHO_C" >&6 if test "${ac_cv_header_stat_broken+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 11886 "configure" +#line 12331 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/stat.h> @@ -11922,7 +12367,7 @@ fi rm -f conftest* fi -echo "$as_me:11925: result: $ac_cv_header_stat_broken" >&5 +echo "$as_me:12370: result: $ac_cv_header_stat_broken" >&5 echo "${ECHO_T}$ac_cv_header_stat_broken" >&6 if test $ac_cv_header_stat_broken = yes; then @@ -11932,7 +12377,7 @@ EOF fi -echo "$as_me:11935: checking whether #! works in shell scripts" >&5 +echo "$as_me:12380: checking whether #! works in shell scripts" >&5 echo $ECHO_N "checking whether #! works in shell scripts... $ECHO_C" >&6 if test "${ac_cv_sys_interpreter+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -11949,7 +12394,7 @@ else fi rm -f conftest fi -echo "$as_me:11952: result: $ac_cv_sys_interpreter" >&5 +echo "$as_me:12397: result: $ac_cv_sys_interpreter" >&5 echo "${ECHO_T}$ac_cv_sys_interpreter" >&6 interpval=$ac_cv_sys_interpreter @@ -11961,13 +12406,13 @@ EOF fi if test "$ac_cv_func_lstat" = "no"; then -echo "$as_me:11964: checking for lstat" >&5 +echo "$as_me:12409: checking for lstat" >&5 echo $ECHO_N "checking for lstat... $ECHO_C" >&6 if test "${bash_cv_func_lstat+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 11970 "configure" +#line 12415 "configure" #include "confdefs.h" #include <sys/types.h> @@ -11982,16 +12427,16 @@ main () } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:11985: \"$ac_link\"") >&5 +if { (eval echo "$as_me:12430: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:11988: \$? = $ac_status" >&5 + echo "$as_me:12433: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:11991: \"$ac_try\"") >&5 + { (eval echo "$as_me:12436: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11994: \$? = $ac_status" >&5 + echo "$as_me:12439: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_func_lstat=yes else @@ -12001,7 +12446,7 @@ bash_cv_func_lstat=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:12004: result: $bash_cv_func_lstat" >&5 +echo "$as_me:12449: result: $bash_cv_func_lstat" >&5 echo "${ECHO_T}$bash_cv_func_lstat" >&6 if test $bash_cv_func_lstat = yes; then cat >>confdefs.h <<\EOF @@ -12012,18 +12457,95 @@ fi fi -echo "$as_me:12015: checking if dup2 fails to clear the close-on-exec flag" >&5 +echo "$as_me:12460: checking whether the ctype macros accept non-ascii characters" >&5 +echo $ECHO_N "checking whether the ctype macros accept non-ascii characters... $ECHO_C" >&6 +if test "${bash_cv_func_ctype_nonascii+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + { echo "$as_me:12466: WARNING: cannot check ctype macros if cross compiling -- defaulting to no" >&5 +echo "$as_me: WARNING: cannot check ctype macros if cross compiling -- defaulting to no" >&2;} + bash_cv_func_ctype_nonascii=no + +else + cat >conftest.$ac_ext <<_ACEOF +#line 12472 "configure" +#include "confdefs.h" + +#ifdef HAVE_LOCALE_H +#include <locale.h> +#endif +#include <stdio.h> +#include <ctype.h> + +main(c, v) +int c; +char *v[]; +{ + char *deflocale; + unsigned char x; + int r1, r2; + +#ifdef HAVE_SETLOCALE + /* We take a shot here. If that locale is not known, try the + system default. We try this one because '\342' (226) is + known to be a printable character in that locale. */ + deflocale = setlocale(LC_ALL, "en_US.ISO8859-1"); + if (deflocale == 0) + deflocale = setlocale(LC_ALL, ""); +#endif + + x = '\342'; + r1 = isprint(x); + x -= 128; + r2 = isprint(x); + exit (r1 == 0 || r2 == 0); +} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:12507: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:12510: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:12512: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12515: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + bash_cv_func_ctype_nonascii=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +bash_cv_func_ctype_nonascii=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi + +echo "$as_me:12528: result: $bash_cv_func_ctype_nonascii" >&5 +echo "${ECHO_T}$bash_cv_func_ctype_nonascii" >&6 +if test $bash_cv_func_ctype_nonascii = yes; then +cat >>confdefs.h <<\EOF +#define CTYPE_NON_ASCII 1 +EOF + +fi + +echo "$as_me:12537: checking if dup2 fails to clear the close-on-exec flag" >&5 echo $ECHO_N "checking if dup2 fails to clear the close-on-exec flag... $ECHO_C" >&6 if test "${bash_cv_dup2_broken+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then - { echo "$as_me:12021: WARNING: cannot check dup2 if cross compiling -- defaulting to no" >&5 + { echo "$as_me:12543: WARNING: cannot check dup2 if cross compiling -- defaulting to no" >&5 echo "$as_me: WARNING: cannot check dup2 if cross compiling -- defaulting to no" >&2;} bash_cv_dup2_broken=no else cat >conftest.$ac_ext <<_ACEOF -#line 12026 "configure" +#line 12548 "configure" #include "confdefs.h" #include <sys/types.h> @@ -12044,15 +12566,15 @@ main() _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:12047: \"$ac_link\"") >&5 +if { (eval echo "$as_me:12569: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:12050: \$? = $ac_status" >&5 + echo "$as_me:12572: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:12052: \"$ac_try\"") >&5 + { (eval echo "$as_me:12574: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12055: \$? = $ac_status" >&5 + echo "$as_me:12577: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_dup2_broken=yes else @@ -12066,7 +12588,7 @@ fi fi -echo "$as_me:12069: result: $bash_cv_dup2_broken" >&5 +echo "$as_me:12591: result: $bash_cv_dup2_broken" >&5 echo "${ECHO_T}$bash_cv_dup2_broken" >&6 if test $bash_cv_dup2_broken = yes; then cat >>confdefs.h <<\EOF @@ -12075,18 +12597,18 @@ EOF fi -echo "$as_me:12078: checking whether pgrps need synchronization" >&5 +echo "$as_me:12600: checking whether pgrps need synchronization" >&5 echo $ECHO_N "checking whether pgrps need synchronization... $ECHO_C" >&6 if test "${bash_cv_pgrp_pipe+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then - { echo "$as_me:12084: WARNING: cannot check pgrp synchronization if cross compiling -- defaulting to no" >&5 + { echo "$as_me:12606: WARNING: cannot check pgrp synchronization if cross compiling -- defaulting to no" >&5 echo "$as_me: WARNING: cannot check pgrp synchronization if cross compiling -- defaulting to no" >&2;} bash_cv_pgrp_pipe=no else cat >conftest.$ac_ext <<_ACEOF -#line 12089 "configure" +#line 12611 "configure" #include "confdefs.h" #ifdef HAVE_UNISTD_H @@ -12139,15 +12661,15 @@ main() _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:12142: \"$ac_link\"") >&5 +if { (eval echo "$as_me:12664: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:12145: \$? = $ac_status" >&5 + echo "$as_me:12667: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:12147: \"$ac_try\"") >&5 + { (eval echo "$as_me:12669: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12150: \$? = $ac_status" >&5 + echo "$as_me:12672: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_pgrp_pipe=no else @@ -12161,7 +12683,7 @@ fi fi -echo "$as_me:12164: result: $bash_cv_pgrp_pipe" >&5 +echo "$as_me:12686: result: $bash_cv_pgrp_pipe" >&5 echo "${ECHO_T}$bash_cv_pgrp_pipe" >&6 if test $bash_cv_pgrp_pipe = yes; then cat >>confdefs.h <<\EOF @@ -12170,14 +12692,14 @@ EOF fi -echo "$as_me:12173: checking for type of signal functions" >&5 +echo "$as_me:12695: checking for type of signal functions" >&5 echo $ECHO_N "checking for type of signal functions... $ECHO_C" >&6 if test "${bash_cv_signal_vintage+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 12180 "configure" +#line 12702 "configure" #include "confdefs.h" #include <signal.h> int @@ -12195,16 +12717,16 @@ main () } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:12198: \"$ac_link\"") >&5 +if { (eval echo "$as_me:12720: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:12201: \$? = $ac_status" >&5 + echo "$as_me:12723: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:12204: \"$ac_try\"") >&5 + { (eval echo "$as_me:12726: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12207: \$? = $ac_status" >&5 + echo "$as_me:12729: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_signal_vintage=posix else @@ -12212,7 +12734,7 @@ else cat conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF -#line 12215 "configure" +#line 12737 "configure" #include "confdefs.h" #include <signal.h> int @@ -12227,16 +12749,16 @@ main () } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:12230: \"$ac_link\"") >&5 +if { (eval echo "$as_me:12752: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:12233: \$? = $ac_status" >&5 + echo "$as_me:12755: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:12236: \"$ac_try\"") >&5 + { (eval echo "$as_me:12758: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12239: \$? = $ac_status" >&5 + echo "$as_me:12761: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_signal_vintage=4.2bsd else @@ -12244,7 +12766,7 @@ else cat conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF -#line 12247 "configure" +#line 12769 "configure" #include "confdefs.h" #include <signal.h> @@ -12262,16 +12784,16 @@ main () } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:12265: \"$ac_link\"") >&5 +if { (eval echo "$as_me:12787: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:12268: \$? = $ac_status" >&5 + echo "$as_me:12790: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:12271: \"$ac_try\"") >&5 + { (eval echo "$as_me:12793: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12274: \$? = $ac_status" >&5 + echo "$as_me:12796: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_signal_vintage=svr3 else @@ -12290,7 +12812,7 @@ rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:12293: result: $bash_cv_signal_vintage" >&5 +echo "$as_me:12815: result: $bash_cv_signal_vintage" >&5 echo "${ECHO_T}$bash_cv_signal_vintage" >&6 if test "$bash_cv_signal_vintage" = posix; then cat >>confdefs.h <<\EOF @@ -12309,13 +12831,13 @@ EOF fi -echo "$as_me:12312: checking for sys_errlist and sys_nerr" >&5 +echo "$as_me:12834: checking for sys_errlist and sys_nerr" >&5 echo $ECHO_N "checking for sys_errlist and sys_nerr... $ECHO_C" >&6 if test "${bash_cv_sys_errlist+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 12318 "configure" +#line 12840 "configure" #include "confdefs.h" #include <errno.h> int @@ -12329,16 +12851,16 @@ extern char *sys_errlist[]; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:12332: \"$ac_link\"") >&5 +if { (eval echo "$as_me:12854: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:12335: \$? = $ac_status" >&5 + echo "$as_me:12857: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:12338: \"$ac_try\"") >&5 + { (eval echo "$as_me:12860: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12341: \$? = $ac_status" >&5 + echo "$as_me:12863: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_sys_errlist=yes else @@ -12348,7 +12870,7 @@ bash_cv_sys_errlist=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:12351: result: $bash_cv_sys_errlist" >&5 +echo "$as_me:12873: result: $bash_cv_sys_errlist" >&5 echo "${ECHO_T}$bash_cv_sys_errlist" >&6 if test $bash_cv_sys_errlist = yes; then cat >>confdefs.h <<\EOF @@ -12357,18 +12879,18 @@ EOF fi -echo "$as_me:12360: checking for sys_siglist in system C library" >&5 +echo "$as_me:12882: checking for sys_siglist in system C library" >&5 echo $ECHO_N "checking for sys_siglist in system C library... $ECHO_C" >&6 if test "${bash_cv_sys_siglist+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then - { echo "$as_me:12366: WARNING: cannot check for sys_siglist if cross compiling -- defaulting to no" >&5 + { echo "$as_me:12888: WARNING: cannot check for sys_siglist if cross compiling -- defaulting to no" >&5 echo "$as_me: WARNING: cannot check for sys_siglist if cross compiling -- defaulting to no" >&2;} bash_cv_sys_siglist=no else cat >conftest.$ac_ext <<_ACEOF -#line 12371 "configure" +#line 12893 "configure" #include "confdefs.h" #include <sys/types.h> @@ -12386,15 +12908,15 @@ exit(msg == 0); } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:12389: \"$ac_link\"") >&5 +if { (eval echo "$as_me:12911: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:12392: \$? = $ac_status" >&5 + echo "$as_me:12914: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:12394: \"$ac_try\"") >&5 + { (eval echo "$as_me:12916: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12397: \$? = $ac_status" >&5 + echo "$as_me:12919: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_sys_siglist=yes else @@ -12407,7 +12929,7 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -echo "$as_me:12410: result: $bash_cv_sys_siglist" >&5 +echo "$as_me:12932: result: $bash_cv_sys_siglist" >&5 echo "${ECHO_T}$bash_cv_sys_siglist" >&6 if test $bash_cv_sys_siglist = yes; then cat >>confdefs.h <<\EOF @@ -12416,13 +12938,13 @@ EOF fi -echo "$as_me:12419: checking for _sys_siglist in signal.h or unistd.h" >&5 +echo "$as_me:12941: checking for _sys_siglist in signal.h or unistd.h" >&5 echo $ECHO_N "checking for _sys_siglist in signal.h or unistd.h... $ECHO_C" >&6 if test "${bash_cv_decl_under_sys_siglist+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 12425 "configure" +#line 12947 "configure" #include "confdefs.h" #include <sys/types.h> @@ -12439,16 +12961,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:12442: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:12964: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:12445: \$? = $ac_status" >&5 + echo "$as_me:12967: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:12448: \"$ac_try\"") >&5 + { (eval echo "$as_me:12970: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12451: \$? = $ac_status" >&5 + echo "$as_me:12973: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_decl_under_sys_siglist=yes else @@ -12458,7 +12980,7 @@ bash_cv_decl_under_sys_siglist=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:12461: result: $bash_cv_decl_under_sys_siglist" >&5 +echo "$as_me:12983: result: $bash_cv_decl_under_sys_siglist" >&5 echo "${ECHO_T}$bash_cv_decl_under_sys_siglist" >&6 if test $bash_cv_decl_under_sys_siglist = yes; then cat >>confdefs.h <<\EOF @@ -12467,18 +12989,18 @@ EOF fi -echo "$as_me:12470: checking for _sys_siglist in system C library" >&5 +echo "$as_me:12992: checking for _sys_siglist in system C library" >&5 echo $ECHO_N "checking for _sys_siglist in system C library... $ECHO_C" >&6 if test "${bash_cv_under_sys_siglist+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then - { echo "$as_me:12476: WARNING: cannot check for _sys_siglist if cross compiling -- defaulting to no" >&5 + { echo "$as_me:12998: WARNING: cannot check for _sys_siglist if cross compiling -- defaulting to no" >&5 echo "$as_me: WARNING: cannot check for _sys_siglist if cross compiling -- defaulting to no" >&2;} bash_cv_under_sys_siglist=no else cat >conftest.$ac_ext <<_ACEOF -#line 12481 "configure" +#line 13003 "configure" #include "confdefs.h" #include <sys/types.h> @@ -12496,15 +13018,15 @@ exit(msg == 0); } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:12499: \"$ac_link\"") >&5 +if { (eval echo "$as_me:13021: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:12502: \$? = $ac_status" >&5 + echo "$as_me:13024: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:12504: \"$ac_try\"") >&5 + { (eval echo "$as_me:13026: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12507: \$? = $ac_status" >&5 + echo "$as_me:13029: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_under_sys_siglist=yes else @@ -12517,7 +13039,7 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -echo "$as_me:12520: result: $bash_cv_under_sys_siglist" >&5 +echo "$as_me:13042: result: $bash_cv_under_sys_siglist" >&5 echo "${ECHO_T}$bash_cv_under_sys_siglist" >&6 if test $bash_cv_under_sys_siglist = yes; then cat >>confdefs.h <<\EOF @@ -12526,13 +13048,13 @@ EOF fi -echo "$as_me:12529: checking whether signal handlers are of type void" >&5 +echo "$as_me:13051: checking whether signal handlers are of type void" >&5 echo $ECHO_N "checking whether signal handlers are of type void... $ECHO_C" >&6 if test "${bash_cv_void_sighandler+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 12535 "configure" +#line 13057 "configure" #include "confdefs.h" #include <sys/types.h> #include <signal.h> @@ -12552,16 +13074,16 @@ int i; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:12555: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:13077: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:12558: \$? = $ac_status" >&5 + echo "$as_me:13080: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:12561: \"$ac_try\"") >&5 + { (eval echo "$as_me:13083: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12564: \$? = $ac_status" >&5 + echo "$as_me:13086: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_void_sighandler=yes else @@ -12571,7 +13093,7 @@ bash_cv_void_sighandler=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:12574: result: $bash_cv_void_sighandler" >&5 +echo "$as_me:13096: result: $bash_cv_void_sighandler" >&5 echo "${ECHO_T}$bash_cv_void_sighandler" >&6 if test $bash_cv_void_sighandler = yes; then cat >>confdefs.h <<\EOF @@ -12580,13 +13102,13 @@ EOF fi -echo "$as_me:12583: checking for clock_t" >&5 +echo "$as_me:13105: checking for clock_t" >&5 echo $ECHO_N "checking for clock_t... $ECHO_C" >&6 if test "${bash_cv_type_clock_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 12589 "configure" +#line 13111 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -12609,7 +13131,7 @@ rm -f conftest* fi -echo "$as_me:12612: result: $bash_cv_type_clock_t" >&5 +echo "$as_me:13134: result: $bash_cv_type_clock_t" >&5 echo "${ECHO_T}$bash_cv_type_clock_t" >&6 if test $bash_cv_type_clock_t = no; then @@ -12619,13 +13141,13 @@ EOF fi -echo "$as_me:12622: checking for sigset_t" >&5 +echo "$as_me:13144: checking for sigset_t" >&5 echo $ECHO_N "checking for sigset_t... $ECHO_C" >&6 if test "${bash_cv_type_sigset_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 12628 "configure" +#line 13150 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -12648,7 +13170,7 @@ rm -f conftest* fi -echo "$as_me:12651: result: $bash_cv_type_sigset_t" >&5 +echo "$as_me:13173: result: $bash_cv_type_sigset_t" >&5 echo "${ECHO_T}$bash_cv_type_sigset_t" >&6 if test $bash_cv_type_sigset_t = no; then @@ -12658,13 +13180,13 @@ EOF fi -echo "$as_me:12661: checking for quad_t" >&5 +echo "$as_me:13183: checking for quad_t" >&5 echo $ECHO_N "checking for quad_t... $ECHO_C" >&6 if test "${bash_cv_type_quad_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 12667 "configure" +#line 13189 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -12686,7 +13208,7 @@ rm -f conftest* fi -echo "$as_me:12689: result: $bash_cv_type_quad_t" >&5 +echo "$as_me:13211: result: $bash_cv_type_quad_t" >&5 echo "${ECHO_T}$bash_cv_type_quad_t" >&6 if test $bash_cv_type_quad_t = yes; then cat >>confdefs.h <<\EOF @@ -12701,13 +13223,13 @@ EOF fi -echo "$as_me:12704: checking for intmax_t" >&5 +echo "$as_me:13226: checking for intmax_t" >&5 echo $ECHO_N "checking for intmax_t... $ECHO_C" >&6 if test "${bash_cv_type_intmax_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 12710 "configure" +#line 13232 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -12729,7 +13251,7 @@ rm -f conftest* fi -echo "$as_me:12732: result: $bash_cv_type_intmax_t" >&5 +echo "$as_me:13254: result: $bash_cv_type_intmax_t" >&5 echo "${ECHO_T}$bash_cv_type_intmax_t" >&6 if test $bash_cv_type_intmax_t = no; then @@ -12739,13 +13261,13 @@ EOF fi -echo "$as_me:12742: checking for uintmax_t" >&5 +echo "$as_me:13264: checking for uintmax_t" >&5 echo $ECHO_N "checking for uintmax_t... $ECHO_C" >&6 if test "${bash_cv_type_uintmax_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 12748 "configure" +#line 13270 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -12767,7 +13289,7 @@ rm -f conftest* fi -echo "$as_me:12770: result: $bash_cv_type_uintmax_t" >&5 +echo "$as_me:13292: result: $bash_cv_type_uintmax_t" >&5 echo "${ECHO_T}$bash_cv_type_uintmax_t" >&6 if test $bash_cv_type_uintmax_t = no; then @@ -12779,13 +13301,13 @@ fi if test "$ac_cv_header_sys_socket_h" = "yes"; then -echo "$as_me:12782: checking for socklen_t" >&5 +echo "$as_me:13304: checking for socklen_t" >&5 echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6 if test "${bash_cv_type_socklen_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 12788 "configure" +#line 13310 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -12808,7 +13330,7 @@ rm -f conftest* fi -echo "$as_me:12811: result: $bash_cv_type_socklen_t" >&5 +echo "$as_me:13333: result: $bash_cv_type_socklen_t" >&5 echo "${ECHO_T}$bash_cv_type_socklen_t" >&6 if test $bash_cv_type_socklen_t = yes; then cat >>confdefs.h <<\EOF @@ -12824,13 +13346,13 @@ EOF fi fi -echo "$as_me:12827: checking for size and type of struct rlimit fields" >&5 +echo "$as_me:13349: checking for size and type of struct rlimit fields" >&5 echo $ECHO_N "checking for size and type of struct rlimit fields... $ECHO_C" >&6 if test "${bash_cv_type_rlimit+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 12833 "configure" +#line 13355 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/resource.h> @@ -12843,16 +13365,16 @@ rlim_t xxx; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:12846: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:13368: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:12849: \$? = $ac_status" >&5 + echo "$as_me:13371: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:12852: \"$ac_try\"") >&5 + { (eval echo "$as_me:13374: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12855: \$? = $ac_status" >&5 + echo "$as_me:13377: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_type_rlimit=rlim_t else @@ -12860,12 +13382,12 @@ else cat conftest.$ac_ext >&5 if test "$cross_compiling" = yes; then - { echo "$as_me:12863: WARNING: cannot check quad_t if cross compiling -- defaulting to long" >&5 + { echo "$as_me:13385: WARNING: cannot check quad_t if cross compiling -- defaulting to long" >&5 echo "$as_me: WARNING: cannot check quad_t if cross compiling -- defaulting to long" >&2;} bash_cv_type_rlimit=long else cat >conftest.$ac_ext <<_ACEOF -#line 12868 "configure" +#line 13390 "configure" #include "confdefs.h" #include <sys/types.h> @@ -12882,15 +13404,15 @@ main() } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:12885: \"$ac_link\"") >&5 +if { (eval echo "$as_me:13407: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:12888: \$? = $ac_status" >&5 + echo "$as_me:13410: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:12890: \"$ac_try\"") >&5 + { (eval echo "$as_me:13412: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12893: \$? = $ac_status" >&5 + echo "$as_me:13415: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_type_rlimit=quad_t else @@ -12906,7 +13428,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:12909: result: $bash_cv_type_rlimit" >&5 +echo "$as_me:13431: result: $bash_cv_type_rlimit" >&5 echo "${ECHO_T}$bash_cv_type_rlimit" >&6 if test $bash_cv_type_rlimit = quad_t; then cat >>confdefs.h <<\EOF @@ -12920,13 +13442,13 @@ EOF fi -echo "$as_me:12923: checking for struct termios.c_line" >&5 +echo "$as_me:13445: checking for struct termios.c_line" >&5 echo $ECHO_N "checking for struct termios.c_line... $ECHO_C" >&6 if test "${ac_cv_member_struct_termios_c_line+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 12929 "configure" +#line 13451 "configure" #include "confdefs.h" #include <sys/types.h> @@ -12943,16 +13465,16 @@ return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:12946: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:13468: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:12949: \$? = $ac_status" >&5 + echo "$as_me:13471: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:12952: \"$ac_try\"") >&5 + { (eval echo "$as_me:13474: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12955: \$? = $ac_status" >&5 + echo "$as_me:13477: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_member_struct_termios_c_line=yes else @@ -12962,7 +13484,7 @@ ac_cv_member_struct_termios_c_line=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:12965: result: $ac_cv_member_struct_termios_c_line" >&5 +echo "$as_me:13487: result: $ac_cv_member_struct_termios_c_line" >&5 echo "${ECHO_T}$ac_cv_member_struct_termios_c_line" >&6 if test $ac_cv_member_struct_termios_c_line = yes; then cat >>confdefs.h <<\EOF @@ -12971,13 +13493,13 @@ EOF fi -echo "$as_me:12974: checking for struct termio.c_line" >&5 +echo "$as_me:13496: checking for struct termio.c_line" >&5 echo $ECHO_N "checking for struct termio.c_line... $ECHO_C" >&6 if test "${ac_cv_member_struct_termio_c_line+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 12980 "configure" +#line 13502 "configure" #include "confdefs.h" #include <sys/types.h> @@ -12994,16 +13516,16 @@ return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:12997: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:13519: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:13000: \$? = $ac_status" >&5 + echo "$as_me:13522: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:13003: \"$ac_try\"") >&5 + { (eval echo "$as_me:13525: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13006: \$? = $ac_status" >&5 + echo "$as_me:13528: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_member_struct_termio_c_line=yes else @@ -13013,7 +13535,7 @@ ac_cv_member_struct_termio_c_line=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:13016: result: $ac_cv_member_struct_termio_c_line" >&5 +echo "$as_me:13538: result: $ac_cv_member_struct_termio_c_line" >&5 echo "${ECHO_T}$ac_cv_member_struct_termio_c_line" >&6 if test $ac_cv_member_struct_termio_c_line = yes; then cat >>confdefs.h <<\EOF @@ -13022,13 +13544,13 @@ EOF fi -echo "$as_me:13025: checking if struct dirent has a d_ino member" >&5 +echo "$as_me:13547: checking if struct dirent has a d_ino member" >&5 echo $ECHO_N "checking if struct dirent has a d_ino member... $ECHO_C" >&6 if test "${bash_cv_dirent_has_dino+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 13031 "configure" +#line 13553 "configure" #include "confdefs.h" #include <stdio.h> @@ -13062,16 +13584,16 @@ struct dirent d; int z; z = d.d_ino; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:13065: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:13587: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:13068: \$? = $ac_status" >&5 + echo "$as_me:13590: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:13071: \"$ac_try\"") >&5 + { (eval echo "$as_me:13593: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13074: \$? = $ac_status" >&5 + echo "$as_me:13596: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_dirent_has_dino=yes else @@ -13082,7 +13604,7 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:13085: result: $bash_cv_dirent_has_dino" >&5 +echo "$as_me:13607: result: $bash_cv_dirent_has_dino" >&5 echo "${ECHO_T}$bash_cv_dirent_has_dino" >&6 if test $bash_cv_dirent_has_dino = yes; then cat >>confdefs.h <<\EOF @@ -13091,13 +13613,13 @@ EOF fi -echo "$as_me:13094: checking if struct dirent has a d_fileno member" >&5 +echo "$as_me:13616: checking if struct dirent has a d_fileno member" >&5 echo $ECHO_N "checking if struct dirent has a d_fileno member... $ECHO_C" >&6 if test "${bash_cv_dirent_has_d_fileno+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 13100 "configure" +#line 13622 "configure" #include "confdefs.h" #include <stdio.h> @@ -13131,16 +13653,16 @@ struct dirent d; int z; z = d.d_fileno; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:13134: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:13656: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:13137: \$? = $ac_status" >&5 + echo "$as_me:13659: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:13140: \"$ac_try\"") >&5 + { (eval echo "$as_me:13662: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13143: \$? = $ac_status" >&5 + echo "$as_me:13665: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_dirent_has_d_fileno=yes else @@ -13151,7 +13673,7 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:13154: result: $bash_cv_dirent_has_d_fileno" >&5 +echo "$as_me:13676: result: $bash_cv_dirent_has_d_fileno" >&5 echo "${ECHO_T}$bash_cv_dirent_has_d_fileno" >&6 if test $bash_cv_dirent_has_d_fileno = yes; then cat >>confdefs.h <<\EOF @@ -13160,13 +13682,13 @@ EOF fi -echo "$as_me:13163: checking for struct winsize in sys/ioctl.h and termios.h" >&5 +echo "$as_me:13685: checking for struct winsize in sys/ioctl.h and termios.h" >&5 echo $ECHO_N "checking for struct winsize in sys/ioctl.h and termios.h... $ECHO_C" >&6 if test "${bash_cv_struct_winsize_header+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 13169 "configure" +#line 13691 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/ioctl.h> @@ -13179,23 +13701,23 @@ struct winsize x; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:13182: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:13704: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:13185: \$? = $ac_status" >&5 + echo "$as_me:13707: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:13188: \"$ac_try\"") >&5 + { (eval echo "$as_me:13710: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13191: \$? = $ac_status" >&5 + echo "$as_me:13713: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_struct_winsize_header=ioctl_h else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF -#line 13198 "configure" +#line 13720 "configure" #include "confdefs.h" #include <sys/types.h> #include <termios.h> @@ -13208,16 +13730,16 @@ struct winsize x; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:13211: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:13733: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:13214: \$? = $ac_status" >&5 + echo "$as_me:13736: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:13217: \"$ac_try\"") >&5 + { (eval echo "$as_me:13739: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13220: \$? = $ac_status" >&5 + echo "$as_me:13742: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_struct_winsize_header=termios_h else @@ -13232,32 +13754,32 @@ rm -f conftest.$ac_objext conftest.$ac_ext fi if test $bash_cv_struct_winsize_header = ioctl_h; then - echo "$as_me:13235: result: sys/ioctl.h" >&5 + echo "$as_me:13757: result: sys/ioctl.h" >&5 echo "${ECHO_T}sys/ioctl.h" >&6 cat >>confdefs.h <<\EOF #define STRUCT_WINSIZE_IN_SYS_IOCTL 1 EOF elif test $bash_cv_struct_winsize_header = termios_h; then - echo "$as_me:13242: result: termios.h" >&5 + echo "$as_me:13764: result: termios.h" >&5 echo "${ECHO_T}termios.h" >&6 cat >>confdefs.h <<\EOF #define STRUCT_WINSIZE_IN_TERMIOS 1 EOF else - echo "$as_me:13249: result: not found" >&5 + echo "$as_me:13771: result: not found" >&5 echo "${ECHO_T}not found" >&6 fi -echo "$as_me:13253: checking for struct timeval in sys/time.h and time.h" >&5 +echo "$as_me:13775: checking for struct timeval in sys/time.h and time.h" >&5 echo $ECHO_N "checking for struct timeval in sys/time.h and time.h... $ECHO_C" >&6 if test "${bash_cv_struct_timeval+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 13260 "configure" +#line 13782 "configure" #include "confdefs.h" #include <sys/time.h> @@ -13267,7 +13789,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | bash_cv_struct_timeval=yes else cat >conftest.$ac_ext <<_ACEOF -#line 13270 "configure" +#line 13792 "configure" #include "confdefs.h" #include <time.h> @@ -13285,7 +13807,7 @@ rm -f conftest* fi -echo "$as_me:13288: result: $bash_cv_struct_timeval" >&5 +echo "$as_me:13810: result: $bash_cv_struct_timeval" >&5 echo "${ECHO_T}$bash_cv_struct_timeval" >&6 if test $bash_cv_struct_timeval = yes; then cat >>confdefs.h <<\EOF @@ -13294,13 +13816,13 @@ EOF fi -echo "$as_me:13297: checking for struct stat.st_blocks" >&5 +echo "$as_me:13819: checking for struct stat.st_blocks" >&5 echo $ECHO_N "checking for struct stat.st_blocks... $ECHO_C" >&6 if test "${ac_cv_member_struct_stat_st_blocks+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 13303 "configure" +#line 13825 "configure" #include "confdefs.h" $ac_includes_default int @@ -13314,16 +13836,16 @@ return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:13317: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:13839: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:13320: \$? = $ac_status" >&5 + echo "$as_me:13842: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:13323: \"$ac_try\"") >&5 + { (eval echo "$as_me:13845: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13326: \$? = $ac_status" >&5 + echo "$as_me:13848: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_member_struct_stat_st_blocks=yes else @@ -13333,7 +13855,7 @@ ac_cv_member_struct_stat_st_blocks=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:13336: result: $ac_cv_member_struct_stat_st_blocks" >&5 +echo "$as_me:13858: result: $ac_cv_member_struct_stat_st_blocks" >&5 echo "${ECHO_T}$ac_cv_member_struct_stat_st_blocks" >&6 if test $ac_cv_member_struct_stat_st_blocks = yes; then @@ -13343,13 +13865,13 @@ EOF fi -echo "$as_me:13346: checking whether struct tm is in sys/time.h or time.h" >&5 +echo "$as_me:13868: checking whether struct tm is in sys/time.h or time.h" >&5 echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6 if test "${ac_cv_struct_tm+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 13352 "configure" +#line 13874 "configure" #include "confdefs.h" #include <sys/types.h> #include <time.h> @@ -13363,16 +13885,16 @@ struct tm *tp; tp->tm_sec; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:13366: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:13888: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:13369: \$? = $ac_status" >&5 + echo "$as_me:13891: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:13372: \"$ac_try\"") >&5 + { (eval echo "$as_me:13894: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13375: \$? = $ac_status" >&5 + echo "$as_me:13897: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_struct_tm=time.h else @@ -13382,7 +13904,7 @@ ac_cv_struct_tm=sys/time.h fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:13385: result: $ac_cv_struct_tm" >&5 +echo "$as_me:13907: result: $ac_cv_struct_tm" >&5 echo "${ECHO_T}$ac_cv_struct_tm" >&6 if test $ac_cv_struct_tm = sys/time.h; then @@ -13392,13 +13914,13 @@ EOF fi -echo "$as_me:13395: checking for struct tm.tm_zone" >&5 +echo "$as_me:13917: checking for struct tm.tm_zone" >&5 echo $ECHO_N "checking for struct tm.tm_zone... $ECHO_C" >&6 if test "${ac_cv_member_struct_tm_tm_zone+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 13401 "configure" +#line 13923 "configure" #include "confdefs.h" #include <sys/types.h> #include <$ac_cv_struct_tm> @@ -13414,16 +13936,16 @@ return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:13417: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:13939: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:13420: \$? = $ac_status" >&5 + echo "$as_me:13942: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:13423: \"$ac_try\"") >&5 + { (eval echo "$as_me:13945: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13426: \$? = $ac_status" >&5 + echo "$as_me:13948: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_member_struct_tm_tm_zone=yes else @@ -13433,7 +13955,7 @@ ac_cv_member_struct_tm_tm_zone=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:13436: result: $ac_cv_member_struct_tm_tm_zone" >&5 +echo "$as_me:13958: result: $ac_cv_member_struct_tm_tm_zone" >&5 echo "${ECHO_T}$ac_cv_member_struct_tm_tm_zone" >&6 if test $ac_cv_member_struct_tm_tm_zone = yes; then @@ -13450,13 +13972,13 @@ cat >>confdefs.h <<\EOF EOF else - echo "$as_me:13453: checking for tzname" >&5 + echo "$as_me:13975: checking for tzname" >&5 echo $ECHO_N "checking for tzname... $ECHO_C" >&6 if test "${ac_cv_var_tzname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 13459 "configure" +#line 13981 "configure" #include "confdefs.h" #include <time.h> #ifndef tzname /* For SGI. */ @@ -13472,16 +13994,16 @@ atoi(*tzname); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:13475: \"$ac_link\"") >&5 +if { (eval echo "$as_me:13997: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:13478: \$? = $ac_status" >&5 + echo "$as_me:14000: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:13481: \"$ac_try\"") >&5 + { (eval echo "$as_me:14003: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13484: \$? = $ac_status" >&5 + echo "$as_me:14006: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_var_tzname=yes else @@ -13491,7 +14013,7 @@ ac_cv_var_tzname=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:13494: result: $ac_cv_var_tzname" >&5 +echo "$as_me:14016: result: $ac_cv_var_tzname" >&5 echo "${ECHO_T}$ac_cv_var_tzname" >&6 if test $ac_cv_var_tzname = yes; then @@ -13502,13 +14024,57 @@ EOF fi fi -echo "$as_me:13505: checking for the existence of strsignal" >&5 +echo "$as_me:14027: checking for struct timezone in sys/time.h and time.h" >&5 +echo $ECHO_N "checking for struct timezone in sys/time.h and time.h... $ECHO_C" >&6 +if test "${bash_cv_struct_timezone+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +#line 14034 "configure" +#include "confdefs.h" +#include <sys/time.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "struct timezone" >/dev/null 2>&1; then + bash_cv_struct_timezone=yes +else + cat >conftest.$ac_ext <<_ACEOF +#line 14044 "configure" +#include "confdefs.h" +#include <time.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "struct timezone" >/dev/null 2>&1; then + bash_cv_struct_timezone=yes +else + bash_cv_struct_timezone=no +fi +rm -f conftest* + +fi +rm -f conftest* + +fi + +echo "$as_me:14062: result: $bash_cv_struct_timezone" >&5 +echo "${ECHO_T}$bash_cv_struct_timezone" >&6 +if test $bash_cv_struct_timezone = yes; then + cat >>confdefs.h <<\EOF +#define HAVE_STRUCT_TIMEZONE 1 +EOF + +fi + +echo "$as_me:14071: checking for the existence of strsignal" >&5 echo $ECHO_N "checking for the existence of strsignal... $ECHO_C" >&6 if test "${bash_cv_have_strsignal+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 13511 "configure" +#line 14077 "configure" #include "confdefs.h" #include <sys/types.h> #include <signal.h> @@ -13521,16 +14087,16 @@ char *s = (char *)strsignal(2); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:13524: \"$ac_link\"") >&5 +if { (eval echo "$as_me:14090: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:13527: \$? = $ac_status" >&5 + echo "$as_me:14093: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:13530: \"$ac_try\"") >&5 + { (eval echo "$as_me:14096: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13533: \$? = $ac_status" >&5 + echo "$as_me:14099: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_have_strsignal=yes else @@ -13541,7 +14107,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:13544: result: $bash_cv_have_strsignal" >&5 +echo "$as_me:14110: result: $bash_cv_have_strsignal" >&5 echo "${ECHO_T}$bash_cv_have_strsignal" >&6 if test $bash_cv_have_strsignal = yes; then cat >>confdefs.h <<\EOF @@ -13550,19 +14116,19 @@ EOF fi -echo "$as_me:13553: checking if opendir() opens non-directories" >&5 +echo "$as_me:14119: checking if opendir() opens non-directories" >&5 echo $ECHO_N "checking if opendir() opens non-directories... $ECHO_C" >&6 if test "${bash_cv_opendir_not_robust+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then - { echo "$as_me:13559: WARNING: cannot check opendir if cross compiling -- defaulting to no" >&5 + { echo "$as_me:14125: WARNING: cannot check opendir if cross compiling -- defaulting to no" >&5 echo "$as_me: WARNING: cannot check opendir if cross compiling -- defaulting to no" >&2;} bash_cv_opendir_not_robust=no else cat >conftest.$ac_ext <<_ACEOF -#line 13565 "configure" +#line 14131 "configure" #include "confdefs.h" #include <stdio.h> @@ -13605,15 +14171,15 @@ exit (dir == 0); } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:13608: \"$ac_link\"") >&5 +if { (eval echo "$as_me:14174: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:13611: \$? = $ac_status" >&5 + echo "$as_me:14177: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:13613: \"$ac_try\"") >&5 + { (eval echo "$as_me:14179: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13616: \$? = $ac_status" >&5 + echo "$as_me:14182: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_opendir_not_robust=yes else @@ -13626,7 +14192,7 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -echo "$as_me:13629: result: $bash_cv_opendir_not_robust" >&5 +echo "$as_me:14195: result: $bash_cv_opendir_not_robust" >&5 echo "${ECHO_T}$bash_cv_opendir_not_robust" >&6 if test $bash_cv_opendir_not_robust = yes; then cat >>confdefs.h <<\EOF @@ -13635,19 +14201,19 @@ EOF fi -echo "$as_me:13638: checking whether ulimit can substitute for getdtablesize" >&5 +echo "$as_me:14204: checking whether ulimit can substitute for getdtablesize" >&5 echo $ECHO_N "checking whether ulimit can substitute for getdtablesize... $ECHO_C" >&6 if test "${bash_cv_ulimit_maxfds+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then - { echo "$as_me:13644: WARNING: cannot check ulimit if cross compiling -- defaulting to no" >&5 + { echo "$as_me:14210: WARNING: cannot check ulimit if cross compiling -- defaulting to no" >&5 echo "$as_me: WARNING: cannot check ulimit if cross compiling -- defaulting to no" >&2;} bash_cv_ulimit_maxfds=no else cat >conftest.$ac_ext <<_ACEOF -#line 13650 "configure" +#line 14216 "configure" #include "confdefs.h" main() @@ -13658,15 +14224,15 @@ exit (maxfds == -1L); _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:13661: \"$ac_link\"") >&5 +if { (eval echo "$as_me:14227: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:13664: \$? = $ac_status" >&5 + echo "$as_me:14230: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:13666: \"$ac_try\"") >&5 + { (eval echo "$as_me:14232: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13669: \$? = $ac_status" >&5 + echo "$as_me:14235: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_ulimit_maxfds=yes else @@ -13679,7 +14245,7 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -echo "$as_me:13682: result: $bash_cv_ulimit_maxfds" >&5 +echo "$as_me:14248: result: $bash_cv_ulimit_maxfds" >&5 echo "${ECHO_T}$bash_cv_ulimit_maxfds" >&6 if test $bash_cv_ulimit_maxfds = yes; then cat >>confdefs.h <<\EOF @@ -13688,19 +14254,19 @@ EOF fi -echo "$as_me:13691: checking to see if getenv can be redefined" >&5 +echo "$as_me:14257: checking to see if getenv can be redefined" >&5 echo $ECHO_N "checking to see if getenv can be redefined... $ECHO_C" >&6 if test "${bash_cv_getenv_redef+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then - { echo "$as_me:13697: WARNING: cannot check getenv redefinition if cross compiling -- defaulting to yes" >&5 + { echo "$as_me:14263: WARNING: cannot check getenv redefinition if cross compiling -- defaulting to yes" >&5 echo "$as_me: WARNING: cannot check getenv redefinition if cross compiling -- defaulting to yes" >&2;} bash_cv_getenv_redef=yes else cat >conftest.$ac_ext <<_ACEOF -#line 13703 "configure" +#line 14269 "configure" #include "confdefs.h" #ifdef HAVE_UNISTD_H @@ -13736,15 +14302,15 @@ exit(s == 0); /* force optimizer to leave getenv in */ _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:13739: \"$ac_link\"") >&5 +if { (eval echo "$as_me:14305: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:13742: \$? = $ac_status" >&5 + echo "$as_me:14308: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:13744: \"$ac_try\"") >&5 + { (eval echo "$as_me:14310: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13747: \$? = $ac_status" >&5 + echo "$as_me:14313: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_getenv_redef=yes else @@ -13757,7 +14323,7 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -echo "$as_me:13760: result: $bash_cv_getenv_redef" >&5 +echo "$as_me:14326: result: $bash_cv_getenv_redef" >&5 echo "${ECHO_T}$bash_cv_getenv_redef" >&6 if test $bash_cv_getenv_redef = yes; then cat >>confdefs.h <<\EOF @@ -13767,19 +14333,19 @@ EOF fi if test "$ac_cv_func_getcwd" = "yes"; then -echo "$as_me:13770: checking if getcwd() calls popen()" >&5 +echo "$as_me:14336: checking if getcwd() calls popen()" >&5 echo $ECHO_N "checking if getcwd() calls popen()... $ECHO_C" >&6 if test "${bash_cv_getcwd_calls_popen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then - { echo "$as_me:13776: WARNING: cannot check whether getcwd calls popen if cross compiling -- defaulting to no" >&5 + { echo "$as_me:14342: WARNING: cannot check whether getcwd calls popen if cross compiling -- defaulting to no" >&5 echo "$as_me: WARNING: cannot check whether getcwd calls popen if cross compiling -- defaulting to no" >&2;} bash_cv_getcwd_calls_popen=no else cat >conftest.$ac_ext <<_ACEOF -#line 13782 "configure" +#line 14348 "configure" #include "confdefs.h" #include <stdio.h> @@ -13835,15 +14401,15 @@ main() _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:13838: \"$ac_link\"") >&5 +if { (eval echo "$as_me:14404: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:13841: \$? = $ac_status" >&5 + echo "$as_me:14407: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:13843: \"$ac_try\"") >&5 + { (eval echo "$as_me:14409: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13846: \$? = $ac_status" >&5 + echo "$as_me:14412: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_getcwd_calls_popen=no else @@ -13856,7 +14422,7 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -echo "$as_me:13859: result: $bash_cv_getcwd_calls_popen" >&5 +echo "$as_me:14425: result: $bash_cv_getcwd_calls_popen" >&5 echo "${ECHO_T}$bash_cv_getcwd_calls_popen" >&6 if test $bash_cv_getcwd_calls_popen = yes; then cat >>confdefs.h <<\EOF @@ -13868,19 +14434,19 @@ fi fi -echo "$as_me:13871: checking for presence of POSIX-style sigsetjmp/siglongjmp" >&5 +echo "$as_me:14437: checking for presence of POSIX-style sigsetjmp/siglongjmp" >&5 echo $ECHO_N "checking for presence of POSIX-style sigsetjmp/siglongjmp... $ECHO_C" >&6 if test "${bash_cv_func_sigsetjmp+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then - { echo "$as_me:13877: WARNING: cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to missing" >&5 + { echo "$as_me:14443: WARNING: cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to missing" >&5 echo "$as_me: WARNING: cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to missing" >&2;} bash_cv_func_sigsetjmp=missing else cat >conftest.$ac_ext <<_ACEOF -#line 13883 "configure" +#line 14449 "configure" #include "confdefs.h" #ifdef HAVE_UNISTD_H @@ -13922,15 +14488,15 @@ exit(1); } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:13925: \"$ac_link\"") >&5 +if { (eval echo "$as_me:14491: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:13928: \$? = $ac_status" >&5 + echo "$as_me:14494: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:13930: \"$ac_try\"") >&5 + { (eval echo "$as_me:14496: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13933: \$? = $ac_status" >&5 + echo "$as_me:14499: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_func_sigsetjmp=present else @@ -13943,7 +14509,7 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -echo "$as_me:13946: result: $bash_cv_func_sigsetjmp" >&5 +echo "$as_me:14512: result: $bash_cv_func_sigsetjmp" >&5 echo "${ECHO_T}$bash_cv_func_sigsetjmp" >&6 if test $bash_cv_func_sigsetjmp = present; then cat >>confdefs.h <<\EOF @@ -13952,19 +14518,19 @@ EOF fi -echo "$as_me:13955: checking whether or not strcoll and strcmp differ" >&5 +echo "$as_me:14521: checking whether or not strcoll and strcmp differ" >&5 echo $ECHO_N "checking whether or not strcoll and strcmp differ... $ECHO_C" >&6 if test "${bash_cv_func_strcoll_broken+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then - { echo "$as_me:13961: WARNING: cannot check strcoll if cross compiling -- defaulting to no" >&5 + { echo "$as_me:14527: WARNING: cannot check strcoll if cross compiling -- defaulting to no" >&5 echo "$as_me: WARNING: cannot check strcoll if cross compiling -- defaulting to no" >&2;} bash_cv_func_strcoll_broken=no else cat >conftest.$ac_ext <<_ACEOF -#line 13967 "configure" +#line 14533 "configure" #include "confdefs.h" #include <stdio.h> @@ -14004,15 +14570,15 @@ char *v[]; _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:14007: \"$ac_link\"") >&5 +if { (eval echo "$as_me:14573: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:14010: \$? = $ac_status" >&5 + echo "$as_me:14576: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:14012: \"$ac_try\"") >&5 + { (eval echo "$as_me:14578: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:14015: \$? = $ac_status" >&5 + echo "$as_me:14581: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_func_strcoll_broken=yes else @@ -14025,7 +14591,7 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -echo "$as_me:14028: result: $bash_cv_func_strcoll_broken" >&5 +echo "$as_me:14594: result: $bash_cv_func_strcoll_broken" >&5 echo "${ECHO_T}$bash_cv_func_strcoll_broken" >&6 if test $bash_cv_func_strcoll_broken = yes; then cat >>confdefs.h <<\EOF @@ -14036,13 +14602,13 @@ fi if test "$ac_cv_func_putenv" = "yes"; then -echo "$as_me:14039: checking for standard-conformant putenv declaration" >&5 +echo "$as_me:14605: checking for standard-conformant putenv declaration" >&5 echo $ECHO_N "checking for standard-conformant putenv declaration... $ECHO_C" >&6 if test "${bash_cv_std_putenv+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 14045 "configure" +#line 14611 "configure" #include "confdefs.h" #if STDC_HEADERS @@ -14069,16 +14635,16 @@ return (putenv == 0); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:14072: \"$ac_link\"") >&5 +if { (eval echo "$as_me:14638: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:14075: \$? = $ac_status" >&5 + echo "$as_me:14641: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:14078: \"$ac_try\"") >&5 + { (eval echo "$as_me:14644: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:14081: \$? = $ac_status" >&5 + echo "$as_me:14647: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_std_putenv=yes else @@ -14089,7 +14655,7 @@ bash_cv_std_putenv=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:14092: result: $bash_cv_std_putenv" >&5 +echo "$as_me:14658: result: $bash_cv_std_putenv" >&5 echo "${ECHO_T}$bash_cv_std_putenv" >&6 if test $bash_cv_std_putenv = yes; then cat >>confdefs.h <<\EOF @@ -14106,13 +14672,13 @@ EOF fi if test "$ac_cv_func_unsetenv" = "yes"; then -echo "$as_me:14109: checking for standard-conformant unsetenv declaration" >&5 +echo "$as_me:14675: checking for standard-conformant unsetenv declaration" >&5 echo $ECHO_N "checking for standard-conformant unsetenv declaration... $ECHO_C" >&6 if test "${bash_cv_std_unsetenv+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 14115 "configure" +#line 14681 "configure" #include "confdefs.h" #if STDC_HEADERS @@ -14139,16 +14705,16 @@ return (unsetenv == 0); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:14142: \"$ac_link\"") >&5 +if { (eval echo "$as_me:14708: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:14145: \$? = $ac_status" >&5 + echo "$as_me:14711: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:14148: \"$ac_try\"") >&5 + { (eval echo "$as_me:14714: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:14151: \$? = $ac_status" >&5 + echo "$as_me:14717: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_std_unsetenv=yes else @@ -14159,7 +14725,7 @@ bash_cv_std_unsetenv=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:14162: result: $bash_cv_std_unsetenv" >&5 +echo "$as_me:14728: result: $bash_cv_std_unsetenv" >&5 echo "${ECHO_T}$bash_cv_std_unsetenv" >&6 if test $bash_cv_std_unsetenv = yes; then cat >>confdefs.h <<\EOF @@ -14175,19 +14741,19 @@ EOF fi -echo "$as_me:14178: checking for printf floating point output in hex notation" >&5 +echo "$as_me:14744: checking for printf floating point output in hex notation" >&5 echo $ECHO_N "checking for printf floating point output in hex notation... $ECHO_C" >&6 if test "${bash_cv_printf_a_format+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then - { echo "$as_me:14184: WARNING: cannot check printf if cross compiling -- defaulting to no" >&5 + { echo "$as_me:14750: WARNING: cannot check printf if cross compiling -- defaulting to no" >&5 echo "$as_me: WARNING: cannot check printf if cross compiling -- defaulting to no" >&2;} bash_cv_printf_a_format=no else cat >conftest.$ac_ext <<_ACEOF -#line 14190 "configure" +#line 14756 "configure" #include "confdefs.h" #include <stdio.h> @@ -14205,15 +14771,15 @@ main() _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:14208: \"$ac_link\"") >&5 +if { (eval echo "$as_me:14774: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:14211: \$? = $ac_status" >&5 + echo "$as_me:14777: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:14213: \"$ac_try\"") >&5 + { (eval echo "$as_me:14779: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:14216: \$? = $ac_status" >&5 + echo "$as_me:14782: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_printf_a_format=yes else @@ -14226,7 +14792,7 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -echo "$as_me:14229: result: $bash_cv_printf_a_format" >&5 +echo "$as_me:14795: result: $bash_cv_printf_a_format" >&5 echo "${ECHO_T}$bash_cv_printf_a_format" >&6 if test $bash_cv_printf_a_format = yes; then cat >>confdefs.h <<\EOF @@ -14235,19 +14801,19 @@ EOF fi -echo "$as_me:14238: checking if signal handlers must be reinstalled when invoked" >&5 +echo "$as_me:14804: checking if signal handlers must be reinstalled when invoked" >&5 echo $ECHO_N "checking if signal handlers must be reinstalled when invoked... $ECHO_C" >&6 if test "${bash_cv_must_reinstall_sighandlers+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then - { echo "$as_me:14244: WARNING: cannot check signal handling if cross compiling -- defaulting to no" >&5 + { echo "$as_me:14810: WARNING: cannot check signal handling if cross compiling -- defaulting to no" >&5 echo "$as_me: WARNING: cannot check signal handling if cross compiling -- defaulting to no" >&2;} bash_cv_must_reinstall_sighandlers=no else cat >conftest.$ac_ext <<_ACEOF -#line 14250 "configure" +#line 14816 "configure" #include "confdefs.h" #include <signal.h> @@ -14295,15 +14861,15 @@ main() _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:14298: \"$ac_link\"") >&5 +if { (eval echo "$as_me:14864: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:14301: \$? = $ac_status" >&5 + echo "$as_me:14867: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:14303: \"$ac_try\"") >&5 + { (eval echo "$as_me:14869: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:14306: \$? = $ac_status" >&5 + echo "$as_me:14872: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_must_reinstall_sighandlers=no else @@ -14316,7 +14882,7 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -echo "$as_me:14319: result: $bash_cv_must_reinstall_sighandlers" >&5 +echo "$as_me:14885: result: $bash_cv_must_reinstall_sighandlers" >&5 echo "${ECHO_T}$bash_cv_must_reinstall_sighandlers" >&6 if test $bash_cv_must_reinstall_sighandlers = yes; then cat >>confdefs.h <<\EOF @@ -14325,19 +14891,19 @@ EOF fi -echo "$as_me:14328: checking for presence of necessary job control definitions" >&5 +echo "$as_me:14894: checking for presence of necessary job control definitions" >&5 echo $ECHO_N "checking for presence of necessary job control definitions... $ECHO_C" >&6 if test "${bash_cv_job_control_missing+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then - { echo "$as_me:14334: WARNING: cannot check job control if cross-compiling -- defaulting to missing" >&5 + { echo "$as_me:14900: WARNING: cannot check job control if cross-compiling -- defaulting to missing" >&5 echo "$as_me: WARNING: cannot check job control if cross-compiling -- defaulting to missing" >&2;} bash_cv_job_control_missing=missing else cat >conftest.$ac_ext <<_ACEOF -#line 14340 "configure" +#line 14906 "configure" #include "confdefs.h" #include <sys/types.h> @@ -14385,15 +14951,15 @@ exit(0); } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:14388: \"$ac_link\"") >&5 +if { (eval echo "$as_me:14954: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:14391: \$? = $ac_status" >&5 + echo "$as_me:14957: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:14393: \"$ac_try\"") >&5 + { (eval echo "$as_me:14959: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:14396: \$? = $ac_status" >&5 + echo "$as_me:14962: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_job_control_missing=present else @@ -14406,7 +14972,7 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -echo "$as_me:14409: result: $bash_cv_job_control_missing" >&5 +echo "$as_me:14975: result: $bash_cv_job_control_missing" >&5 echo "${ECHO_T}$bash_cv_job_control_missing" >&6 if test $bash_cv_job_control_missing = missing; then cat >>confdefs.h <<\EOF @@ -14415,19 +14981,19 @@ EOF fi -echo "$as_me:14418: checking for presence of named pipes" >&5 +echo "$as_me:14984: checking for presence of named pipes" >&5 echo $ECHO_N "checking for presence of named pipes... $ECHO_C" >&6 if test "${bash_cv_sys_named_pipes+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then - { echo "$as_me:14424: WARNING: cannot check for named pipes if cross-compiling -- defaulting to missing" >&5 + { echo "$as_me:14990: WARNING: cannot check for named pipes if cross-compiling -- defaulting to missing" >&5 echo "$as_me: WARNING: cannot check for named pipes if cross-compiling -- defaulting to missing" >&2;} bash_cv_sys_named_pipes=missing else cat >conftest.$ac_ext <<_ACEOF -#line 14430 "configure" +#line 14996 "configure" #include "confdefs.h" #include <sys/types.h> @@ -14469,15 +15035,15 @@ exit(0); } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:14472: \"$ac_link\"") >&5 +if { (eval echo "$as_me:15038: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:14475: \$? = $ac_status" >&5 + echo "$as_me:15041: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:14477: \"$ac_try\"") >&5 + { (eval echo "$as_me:15043: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:14480: \$? = $ac_status" >&5 + echo "$as_me:15046: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_sys_named_pipes=present else @@ -14490,7 +15056,7 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -echo "$as_me:14493: result: $bash_cv_sys_named_pipes" >&5 +echo "$as_me:15059: result: $bash_cv_sys_named_pipes" >&5 echo "${ECHO_T}$bash_cv_sys_named_pipes" >&6 if test $bash_cv_sys_named_pipes = missing; then cat >>confdefs.h <<\EOF @@ -14499,13 +15065,13 @@ EOF fi -echo "$as_me:14502: checking POSIX termios" >&5 +echo "$as_me:15068: checking POSIX termios" >&5 echo $ECHO_N "checking POSIX termios... $ECHO_C" >&6 if test "${ac_cv_sys_posix_termios+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 14508 "configure" +#line 15074 "configure" #include "confdefs.h" #include <sys/types.h> #include <unistd.h> @@ -14520,16 +15086,16 @@ main () } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:14523: \"$ac_link\"") >&5 +if { (eval echo "$as_me:15089: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:14526: \$? = $ac_status" >&5 + echo "$as_me:15092: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:14529: \"$ac_try\"") >&5 + { (eval echo "$as_me:15095: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:14532: \$? = $ac_status" >&5 + echo "$as_me:15098: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sys_posix_termios=yes else @@ -14539,17 +15105,17 @@ ac_cv_sys_posix_termios=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:14542: result: $ac_cv_sys_posix_termios" >&5 +echo "$as_me:15108: result: $ac_cv_sys_posix_termios" >&5 echo "${ECHO_T}$ac_cv_sys_posix_termios" >&6 if test $ac_cv_sys_posix_termios = yes; then - echo "$as_me:14546: checking whether termios.h defines TIOCGWINSZ" >&5 + echo "$as_me:15112: checking whether termios.h defines TIOCGWINSZ" >&5 echo $ECHO_N "checking whether termios.h defines TIOCGWINSZ... $ECHO_C" >&6 if test "${ac_cv_sys_tiocgwinsz_in_termios_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 14552 "configure" +#line 15118 "configure" #include "confdefs.h" #include <sys/types.h> #include <termios.h> @@ -14567,18 +15133,18 @@ fi rm -f conftest* fi -echo "$as_me:14570: result: $ac_cv_sys_tiocgwinsz_in_termios_h" >&5 +echo "$as_me:15136: result: $ac_cv_sys_tiocgwinsz_in_termios_h" >&5 echo "${ECHO_T}$ac_cv_sys_tiocgwinsz_in_termios_h" >&6 fi if test $ac_cv_sys_tiocgwinsz_in_termios_h != yes; then - echo "$as_me:14575: checking whether sys/ioctl.h defines TIOCGWINSZ" >&5 + echo "$as_me:15141: checking whether sys/ioctl.h defines TIOCGWINSZ" >&5 echo $ECHO_N "checking whether sys/ioctl.h defines TIOCGWINSZ... $ECHO_C" >&6 if test "${ac_cv_sys_tiocgwinsz_in_sys_ioctl_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 14581 "configure" +#line 15147 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/ioctl.h> @@ -14596,7 +15162,7 @@ fi rm -f conftest* fi -echo "$as_me:14599: result: $ac_cv_sys_tiocgwinsz_in_sys_ioctl_h" >&5 +echo "$as_me:15165: result: $ac_cv_sys_tiocgwinsz_in_sys_ioctl_h" >&5 echo "${ECHO_T}$ac_cv_sys_tiocgwinsz_in_sys_ioctl_h" >&6 if test $ac_cv_sys_tiocgwinsz_in_sys_ioctl_h = yes; then @@ -14608,13 +15174,13 @@ EOF fi fi -echo "$as_me:14611: checking for TIOCSTAT in sys/ioctl.h" >&5 +echo "$as_me:15177: checking for TIOCSTAT in sys/ioctl.h" >&5 echo $ECHO_N "checking for TIOCSTAT in sys/ioctl.h... $ECHO_C" >&6 if test "${bash_cv_tiocstat_in_ioctl+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 14617 "configure" +#line 15183 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/ioctl.h> @@ -14627,16 +15193,16 @@ int x = TIOCSTAT; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:14630: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:15196: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:14633: \$? = $ac_status" >&5 + echo "$as_me:15199: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:14636: \"$ac_try\"") >&5 + { (eval echo "$as_me:15202: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:14639: \$? = $ac_status" >&5 + echo "$as_me:15205: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_tiocstat_in_ioctl=yes else @@ -14647,7 +15213,7 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:14650: result: $bash_cv_tiocstat_in_ioctl" >&5 +echo "$as_me:15216: result: $bash_cv_tiocstat_in_ioctl" >&5 echo "${ECHO_T}$bash_cv_tiocstat_in_ioctl" >&6 if test $bash_cv_tiocstat_in_ioctl = yes; then cat >>confdefs.h <<\EOF @@ -14656,13 +15222,13 @@ EOF fi -echo "$as_me:14659: checking for FIONREAD in sys/ioctl.h" >&5 +echo "$as_me:15225: checking for FIONREAD in sys/ioctl.h" >&5 echo $ECHO_N "checking for FIONREAD in sys/ioctl.h... $ECHO_C" >&6 if test "${bash_cv_fionread_in_ioctl+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 14665 "configure" +#line 15231 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/ioctl.h> @@ -14675,16 +15241,16 @@ int x = FIONREAD; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:14678: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:15244: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:14681: \$? = $ac_status" >&5 + echo "$as_me:15247: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:14684: \"$ac_try\"") >&5 + { (eval echo "$as_me:15250: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:14687: \$? = $ac_status" >&5 + echo "$as_me:15253: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_fionread_in_ioctl=yes else @@ -14695,7 +15261,7 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:14698: result: $bash_cv_fionread_in_ioctl" >&5 +echo "$as_me:15264: result: $bash_cv_fionread_in_ioctl" >&5 echo "${ECHO_T}$bash_cv_fionread_in_ioctl" >&6 if test $bash_cv_fionread_in_ioctl = yes; then cat >>confdefs.h <<\EOF @@ -14704,13 +15270,13 @@ EOF fi -echo "$as_me:14707: checking for speed_t in sys/types.h" >&5 +echo "$as_me:15273: checking for speed_t in sys/types.h" >&5 echo $ECHO_N "checking for speed_t in sys/types.h... $ECHO_C" >&6 if test "${bash_cv_speed_t_in_sys_types+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 14713 "configure" +#line 15279 "configure" #include "confdefs.h" #include <sys/types.h> int @@ -14722,16 +15288,16 @@ speed_t x; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:14725: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:15291: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:14728: \$? = $ac_status" >&5 + echo "$as_me:15294: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:14731: \"$ac_try\"") >&5 + { (eval echo "$as_me:15297: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:14734: \$? = $ac_status" >&5 + echo "$as_me:15300: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_speed_t_in_sys_types=yes else @@ -14742,7 +15308,7 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:14745: result: $bash_cv_speed_t_in_sys_types" >&5 +echo "$as_me:15311: result: $bash_cv_speed_t_in_sys_types" >&5 echo "${ECHO_T}$bash_cv_speed_t_in_sys_types" >&6 if test $bash_cv_speed_t_in_sys_types = yes; then cat >>confdefs.h <<\EOF @@ -14751,13 +15317,13 @@ EOF fi -echo "$as_me:14754: checking whether getpw functions are declared in pwd.h" >&5 +echo "$as_me:15320: checking whether getpw functions are declared in pwd.h" >&5 echo $ECHO_N "checking whether getpw functions are declared in pwd.h... $ECHO_C" >&6 if test "${bash_cv_getpw_declared+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 14760 "configure" +#line 15326 "configure" #include "confdefs.h" #include <sys/types.h> @@ -14777,7 +15343,7 @@ rm -f conftest* fi -echo "$as_me:14780: result: $bash_cv_getpw_declared" >&5 +echo "$as_me:15346: result: $bash_cv_getpw_declared" >&5 echo "${ECHO_T}$bash_cv_getpw_declared" >&6 if test $bash_cv_getpw_declared = yes; then cat >>confdefs.h <<\EOF @@ -14786,19 +15352,19 @@ EOF fi -echo "$as_me:14789: checking for unusable real-time signals due to large values" >&5 +echo "$as_me:15355: checking for unusable real-time signals due to large values" >&5 echo $ECHO_N "checking for unusable real-time signals due to large values... $ECHO_C" >&6 if test "${bash_cv_unusable_rtsigs+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then - { echo "$as_me:14795: WARNING: cannot check real-time signals if cross compiling -- defaulting to yes" >&5 + { echo "$as_me:15361: WARNING: cannot check real-time signals if cross compiling -- defaulting to yes" >&5 echo "$as_me: WARNING: cannot check real-time signals if cross compiling -- defaulting to yes" >&2;} bash_cv_unusable_rtsigs=yes else cat >conftest.$ac_ext <<_ACEOF -#line 14801 "configure" +#line 15367 "configure" #include "confdefs.h" #include <sys/types.h> @@ -14821,15 +15387,15 @@ main () } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:14824: \"$ac_link\"") >&5 +if { (eval echo "$as_me:15390: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:14827: \$? = $ac_status" >&5 + echo "$as_me:15393: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:14829: \"$ac_try\"") >&5 + { (eval echo "$as_me:15395: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:14832: \$? = $ac_status" >&5 + echo "$as_me:15398: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_unusable_rtsigs=yes else @@ -14842,7 +15408,7 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -echo "$as_me:14845: result: $bash_cv_unusable_rtsigs" >&5 +echo "$as_me:15411: result: $bash_cv_unusable_rtsigs" >&5 echo "${ECHO_T}$bash_cv_unusable_rtsigs" >&6 if test $bash_cv_unusable_rtsigs = yes; then cat >>confdefs.h <<\EOF @@ -14858,13 +15424,13 @@ else fi case "$host_os" in -hpux*) echo "$as_me:14861: checking whether $host_os needs _KERNEL for RLIMIT defines" >&5 +hpux*) echo "$as_me:15427: checking whether $host_os needs _KERNEL for RLIMIT defines" >&5 echo $ECHO_N "checking whether $host_os needs _KERNEL for RLIMIT defines... $ECHO_C" >&6 if test "${bash_cv_kernel_rlimit+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 14867 "configure" +#line 15433 "configure" #include "confdefs.h" #include <sys/types.h> @@ -14882,23 +15448,23 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:14885: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:15451: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:14888: \$? = $ac_status" >&5 + echo "$as_me:15454: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:14891: \"$ac_try\"") >&5 + { (eval echo "$as_me:15457: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:14894: \$? = $ac_status" >&5 + echo "$as_me:15460: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_kernel_rlimit=no else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF -#line 14901 "configure" +#line 15467 "configure" #include "confdefs.h" #include <sys/types.h> @@ -14918,16 +15484,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:14921: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:15487: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:14924: \$? = $ac_status" >&5 + echo "$as_me:15490: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:14927: \"$ac_try\"") >&5 + { (eval echo "$as_me:15493: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:14930: \$? = $ac_status" >&5 + echo "$as_me:15496: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bash_cv_kernel_rlimit=yes else @@ -14941,7 +15507,7 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:14944: result: $bash_cv_kernel_rlimit" >&5 +echo "$as_me:15510: result: $bash_cv_kernel_rlimit" >&5 echo "${ECHO_T}$bash_cv_kernel_rlimit" >&6 if test $bash_cv_kernel_rlimit = yes; then cat >>confdefs.h <<\EOF @@ -14960,14 +15526,75 @@ esac if test "X$bash_cv_termcap_lib" = "X"; then _bash_needmsg=yes else -echo "$as_me:14963: checking which library has the termcap functions" >&5 +echo "$as_me:15529: checking which library has the termcap functions" >&5 echo $ECHO_N "checking which library has the termcap functions... $ECHO_C" >&6 _bash_needmsg= fi if test "${bash_cv_termcap_lib+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo "$as_me:14970: checking for tgetent in -ltermcap" >&5 + echo "$as_me:15536: checking for tgetent" >&5 +echo $ECHO_N "checking for tgetent... $ECHO_C" >&6 +if test "${ac_cv_func_tgetent+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 15542 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char tgetent (); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char tgetent (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_tgetent) || defined (__stub___tgetent) +choke me +#else +f = tgetent; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:15573: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:15576: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:15579: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:15582: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_tgetent=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_tgetent=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:15592: result: $ac_cv_func_tgetent" >&5 +echo "${ECHO_T}$ac_cv_func_tgetent" >&6 +if test $ac_cv_func_tgetent = yes; then + bash_cv_termcap_lib=libc +else + echo "$as_me:15597: checking for tgetent in -ltermcap" >&5 echo $ECHO_N "checking for tgetent in -ltermcap... $ECHO_C" >&6 if test "${ac_cv_lib_termcap_tgetent+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -14975,7 +15602,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ltermcap $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 14978 "configure" +#line 15605 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -14994,16 +15621,16 @@ tgetent (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:14997: \"$ac_link\"") >&5 +if { (eval echo "$as_me:15624: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:15000: \$? = $ac_status" >&5 + echo "$as_me:15627: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:15003: \"$ac_try\"") >&5 + { (eval echo "$as_me:15630: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:15006: \$? = $ac_status" >&5 + echo "$as_me:15633: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_termcap_tgetent=yes else @@ -15014,12 +15641,12 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:15017: result: $ac_cv_lib_termcap_tgetent" >&5 +echo "$as_me:15644: result: $ac_cv_lib_termcap_tgetent" >&5 echo "${ECHO_T}$ac_cv_lib_termcap_tgetent" >&6 if test $ac_cv_lib_termcap_tgetent = yes; then bash_cv_termcap_lib=libtermcap else - echo "$as_me:15022: checking for tgetent in -ltinfo" >&5 + echo "$as_me:15649: checking for tgetent in -ltinfo" >&5 echo $ECHO_N "checking for tgetent in -ltinfo... $ECHO_C" >&6 if test "${ac_cv_lib_tinfo_tgetent+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -15027,7 +15654,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ltinfo $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 15030 "configure" +#line 15657 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -15046,16 +15673,16 @@ tgetent (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:15049: \"$ac_link\"") >&5 +if { (eval echo "$as_me:15676: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:15052: \$? = $ac_status" >&5 + echo "$as_me:15679: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:15055: \"$ac_try\"") >&5 + { (eval echo "$as_me:15682: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:15058: \$? = $ac_status" >&5 + echo "$as_me:15685: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_tinfo_tgetent=yes else @@ -15066,12 +15693,12 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:15069: result: $ac_cv_lib_tinfo_tgetent" >&5 +echo "$as_me:15696: result: $ac_cv_lib_tinfo_tgetent" >&5 echo "${ECHO_T}$ac_cv_lib_tinfo_tgetent" >&6 if test $ac_cv_lib_tinfo_tgetent = yes; then bash_cv_termcap_lib=libtinfo else - echo "$as_me:15074: checking for tgetent in -lcurses" >&5 + echo "$as_me:15701: checking for tgetent in -lcurses" >&5 echo $ECHO_N "checking for tgetent in -lcurses... $ECHO_C" >&6 if test "${ac_cv_lib_curses_tgetent+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -15079,7 +15706,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lcurses $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 15082 "configure" +#line 15709 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -15098,16 +15725,16 @@ tgetent (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:15101: \"$ac_link\"") >&5 +if { (eval echo "$as_me:15728: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:15104: \$? = $ac_status" >&5 + echo "$as_me:15731: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:15107: \"$ac_try\"") >&5 + { (eval echo "$as_me:15734: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:15110: \$? = $ac_status" >&5 + echo "$as_me:15737: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_curses_tgetent=yes else @@ -15118,12 +15745,12 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:15121: result: $ac_cv_lib_curses_tgetent" >&5 +echo "$as_me:15748: result: $ac_cv_lib_curses_tgetent" >&5 echo "${ECHO_T}$ac_cv_lib_curses_tgetent" >&6 if test $ac_cv_lib_curses_tgetent = yes; then bash_cv_termcap_lib=libcurses else - echo "$as_me:15126: checking for tgetent in -lncurses" >&5 + echo "$as_me:15753: checking for tgetent in -lncurses" >&5 echo $ECHO_N "checking for tgetent in -lncurses... $ECHO_C" >&6 if test "${ac_cv_lib_ncurses_tgetent+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -15131,7 +15758,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lncurses $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 15134 "configure" +#line 15761 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -15150,16 +15777,16 @@ tgetent (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:15153: \"$ac_link\"") >&5 +if { (eval echo "$as_me:15780: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:15156: \$? = $ac_status" >&5 + echo "$as_me:15783: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:15159: \"$ac_try\"") >&5 + { (eval echo "$as_me:15786: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:15162: \$? = $ac_status" >&5 + echo "$as_me:15789: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_ncurses_tgetent=yes else @@ -15170,7 +15797,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:15173: result: $ac_cv_lib_ncurses_tgetent" >&5 +echo "$as_me:15800: result: $ac_cv_lib_ncurses_tgetent" >&5 echo "${ECHO_T}$ac_cv_lib_ncurses_tgetent" >&6 if test $ac_cv_lib_ncurses_tgetent = yes; then bash_cv_termcap_lib=libncurses @@ -15186,11 +15813,13 @@ fi fi +fi + if test "X$_bash_needmsg" = "Xyes"; then -echo "$as_me:15190: checking which library has the termcap functions" >&5 +echo "$as_me:15819: checking which library has the termcap functions" >&5 echo $ECHO_N "checking which library has the termcap functions... $ECHO_C" >&6 fi -echo "$as_me:15193: result: using $bash_cv_termcap_lib" >&5 +echo "$as_me:15822: result: using $bash_cv_termcap_lib" >&5 echo "${ECHO_T}using $bash_cv_termcap_lib" >&6 if test $bash_cv_termcap_lib = gnutermcap && test -z "$prefer_curses"; then LDFLAGS="$LDFLAGS -L./lib/termcap" @@ -15205,6 +15834,9 @@ TERMCAP_DEP= elif test $bash_cv_termcap_lib = libncurses; then TERMCAP_LIB=-lncurses TERMCAP_DEP= +elif test $bash_cv_termcap_lib = libc; then +TERMCAP_LIB= +TERMCAP_DEP= else TERMCAP_LIB=-lcurses TERMCAP_DEP= @@ -15212,14 +15844,14 @@ fi fi -echo "$as_me:15215: checking whether /dev/fd is available" >&5 +echo "$as_me:15847: checking whether /dev/fd is available" >&5 echo $ECHO_N "checking whether /dev/fd is available... $ECHO_C" >&6 if test "${bash_cv_dev_fd+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test -d /dev/fd && test -r /dev/fd/0; then + if test -d /dev/fd && test -r /dev/fd/0 < /dev/null; then bash_cv_dev_fd=standard - elif test -d /proc/self/fd && test -r /proc/self/fd/0; then + elif test -d /proc/self/fd && test -r /proc/self/fd/0 < /dev/null; then bash_cv_dev_fd=whacky else bash_cv_dev_fd=absent @@ -15227,7 +15859,7 @@ else fi -echo "$as_me:15230: result: $bash_cv_dev_fd" >&5 +echo "$as_me:15862: result: $bash_cv_dev_fd" >&5 echo "${ECHO_T}$bash_cv_dev_fd" >&6 if test $bash_cv_dev_fd = "standard"; then cat >>confdefs.h <<\EOF @@ -15249,14 +15881,14 @@ EOF fi -echo "$as_me:15252: checking whether /dev/stdin stdout stderr are available" >&5 +echo "$as_me:15884: checking whether /dev/stdin stdout stderr are available" >&5 echo $ECHO_N "checking whether /dev/stdin stdout stderr are available... $ECHO_C" >&6 if test "${bash_cv_dev_stdin+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test -d /dev/fd && test -r /dev/stdin; then + if test -d /dev/fd && test -r /dev/stdin < /dev/null; then bash_cv_dev_stdin=present - elif test -d /proc/self/fd && test -r /dev/stdin; then + elif test -d /proc/self/fd && test -r /dev/stdin < /dev/null; then bash_cv_dev_stdin=present else bash_cv_dev_stdin=absent @@ -15264,7 +15896,7 @@ else fi -echo "$as_me:15267: result: $bash_cv_dev_stdin" >&5 +echo "$as_me:15899: result: $bash_cv_dev_stdin" >&5 echo "${ECHO_T}$bash_cv_dev_stdin" >&6 if test $bash_cv_dev_stdin = "present"; then cat >>confdefs.h <<\EOF @@ -15273,7 +15905,7 @@ EOF fi -echo "$as_me:15276: checking for default mail directory" >&5 +echo "$as_me:15908: checking for default mail directory" >&5 echo $ECHO_N "checking for default mail directory... $ECHO_C" >&6 if test "${bash_cv_mail_dir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -15292,7 +15924,7 @@ else fi -echo "$as_me:15295: result: $bash_cv_mail_dir" >&5 +echo "$as_me:15927: result: $bash_cv_mail_dir" >&5 echo "${ECHO_T}$bash_cv_mail_dir" >&6 cat >>confdefs.h <<EOF #define DEFAULT_MAIL_DIRECTORY "$bash_cv_mail_dir" @@ -15346,7 +15978,7 @@ lynxos*) LOCAL_CFLAGS=-DRECYCLES_PIDS ;; linux*) LOCAL_LDFLAGS=-rdynamic ;; # allow dynamic loading *qnx*) LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;; powerux*) LOCAL_LIBS="-lgen" ;; -cygwin*) LOCAL_LIBS="-luser32" ;; +cygwin*) LOCAL_CFLAGS=-DRECYCLES_PIDS ;; opennt*|interix*) LOCAL_CFLAGS="-DNO_MAIN_ENV_ARG -DBROKEN_DIRENT_D_INO" ;; esac @@ -15383,11 +16015,11 @@ esac # if test "$ac_cv_func_dlopen" = "yes" && test -f ${srcdir}/support/shobj-conf then - echo "$as_me:15386: checking shared object configuration for loadable builtins" >&5 + echo "$as_me:16018: checking shared object configuration for loadable builtins" >&5 echo $ECHO_N "checking shared object configuration for loadable builtins... $ECHO_C" >&6 eval `${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C "${CC}" -c "${host_cpu}" -o "${host_os}" -v "${host_vendor}"` - echo "$as_me:15390: result: $SHOBJ_STATUS" >&5 + echo "$as_me:16022: result: $SHOBJ_STATUS" >&5 echo "${ECHO_T}$SHOBJ_STATUS" >&6 fi @@ -15411,7 +16043,7 @@ BUILD_DIR=`pwd` #AC_SUBST(ALLOCA_SOURCE) #AC_SUBST(ALLOCA_OBJECT) -ac_config_files="$ac_config_files Makefile builtins/Makefile lib/readline/Makefile lib/glob/Makefile lib/malloc/Makefile lib/sh/Makefile lib/termcap/Makefile lib/tilde/Makefile doc/Makefile support/Makefile examples/loadables/Makefile examples/loadables/perl/Makefile" +ac_config_files="$ac_config_files Makefile builtins/Makefile lib/readline/Makefile lib/glob/Makefile lib/malloc/Makefile lib/sh/Makefile lib/termcap/Makefile lib/tilde/Makefile doc/Makefile support/Makefile examples/loadables/Makefile examples/loadables/perl/Makefile pathnames.h" ac_config_commands="$ac_config_commands default" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -15492,7 +16124,7 @@ DEFS=-DHAVE_CONFIG_H : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:15495: creating $CONFIG_STATUS" >&5 +{ echo "$as_me:16127: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL @@ -15623,7 +16255,7 @@ EOF cat >>$CONFIG_STATUS <<EOF ac_cs_version="\\ -bash config.status 2.05b +bash config.status 3.0-alpha configured by $0, generated by GNU Autoconf 2.52, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" @@ -15668,7 +16300,7 @@ cat >>$CONFIG_STATUS <<\EOF echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header - { { echo "$as_me:15671: error: ambiguous option: $1 + { { echo "$as_me:16303: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} @@ -15687,7 +16319,7 @@ Try \`$0 --help' for more information." >&2;} ac_need_defaults=false;; # This is an error. - -*) { { echo "$as_me:15690: error: unrecognized option: $1 + -*) { { echo "$as_me:16322: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} @@ -15706,7 +16338,7 @@ cat >&5 << _ACEOF ## Running config.status. ## ## ----------------------- ## -This file was extended by $as_me (bash 2.05b) 2.52, executed with +This file was extended by $as_me (bash 3.0-alpha) 2.52, executed with CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS @@ -15734,9 +16366,10 @@ do "support/Makefile" ) CONFIG_FILES="$CONFIG_FILES support/Makefile" ;; "examples/loadables/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/loadables/Makefile" ;; "examples/loadables/perl/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/loadables/perl/Makefile" ;; + "pathnames.h" ) CONFIG_FILES="$CONFIG_FILES pathnames.h" ;; "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; - *) { { echo "$as_me:15739: error: invalid argument: $ac_config_target" >&5 + *) { { echo "$as_me:16372: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac @@ -15826,6 +16459,9 @@ s,@host@,$host,;t t s,@host_cpu@,$host_cpu,;t t s,@host_vendor@,$host_vendor,;t t s,@host_os@,$host_os,;t t +s,@EMACS@,$EMACS,;t t +s,@lispdir@,$lispdir,;t t +s,@DEBUGGER_START_FILE@,$DEBUGGER_START_FILE,;t t s,@TESTSCRIPT@,$TESTSCRIPT,;t t s,@PURIFY@,$PURIFY,;t t s,@MALLOC_TARGET@,$MALLOC_TARGET,;t t @@ -16011,7 +16647,7 @@ done; } esac if test x"$ac_file" != x-; then - { echo "$as_me:16014: creating $ac_file" >&5 + { echo "$as_me:16650: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi @@ -16029,7 +16665,7 @@ echo "$as_me: creating $ac_file" >&6;} -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:16032: error: cannot find input file: $f" >&5 + test -f "$f" || { { echo "$as_me:16668: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; @@ -16042,7 +16678,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;} echo $srcdir/$f else # /dev/null tree - { { echo "$as_me:16045: error: cannot find input file: $f" >&5 + { { echo "$as_me:16681: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; @@ -16103,7 +16739,7 @@ for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue * ) ac_file_in=$ac_file.in ;; esac - test x"$ac_file" != x- && { echo "$as_me:16106: creating $ac_file" >&5 + test x"$ac_file" != x- && { echo "$as_me:16742: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the @@ -16114,7 +16750,7 @@ echo "$as_me: creating $ac_file" >&6;} -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:16117: error: cannot find input file: $f" >&5 + test -f "$f" || { { echo "$as_me:16753: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; @@ -16127,7 +16763,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;} echo $srcdir/$f else # /dev/null tree - { { echo "$as_me:16130: error: cannot find input file: $f" >&5 + { { echo "$as_me:16766: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; @@ -16244,7 +16880,7 @@ cat >>$CONFIG_STATUS <<\EOF rm -f $tmp/in if test x"$ac_file" != x-; then if cmp -s $ac_file $tmp/config.h 2>/dev/null; then - { echo "$as_me:16247: $ac_file is unchanged" >&5 + { echo "$as_me:16883: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ diff --git a/configure.in b/configure.in index 5f069788..f5f4c226 100644 --- a/configure.in +++ b/configure.in @@ -5,7 +5,7 @@ dnl report bugs to chet@po.cwru.edu dnl dnl Process this file with autoconf to produce a configure script. -# Copyright (C) 1987-2002 Free Software Foundation, Inc. +# Copyright (C) 1987-2003 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 @@ -22,9 +22,12 @@ dnl Process this file with autoconf to produce a configure script. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -AC_REVISION([for Bash 2.05b, version 2.144, from autoconf version] AC_ACVERSION)dnl +AC_REVISION([for Bash 3.0, version 3.154, from autoconf version] AC_ACVERSION)dnl -AC_INIT(bash, 2.05b, bug-bash@gnu.org) +define(bashvers, 3.0) +define(relstatus, alpha) + +AC_INIT(bash, bashvers-relstatus, bug-bash@gnu.org) dnl make sure we are using a recent autoconf version AC_PREREQ(2.50) @@ -35,8 +38,8 @@ AC_CONFIG_AUX_DIR(./support) AC_CONFIG_HEADERS(config.h) dnl checks for version info -BASHVERS=2.05b -RELSTATUS=release +BASHVERS=bashvers +RELSTATUS=relstatus dnl defaults for debug settings case "$RELSTATUS" in @@ -70,6 +73,7 @@ sparc-netbsd*) opt_bash_malloc=no ;; # needs 8-byte alignment mips-irix6*) opt_bash_malloc=no ;; # needs 8-byte alignment m68k-sysv) opt_bash_malloc=no ;; # fixes file descriptor leak in closedir sparc-linux*) opt_bash_malloc=no ;; # sparc running linux; requires ELF +*-freebsd*-gnu) opt_bash_malloc=no ;; # there's some undetermined problem here #*-freebsd*) opt_bash_malloc=no ;; # they claim it's better; I disagree *-openbsd*) opt_bash_malloc=no ;; # they claim it needs eight-bit alignment *-aix*) opt_bash_malloc=no ;; # AIX machines @@ -92,6 +96,12 @@ sco3.2v5*|sco3.2v4*) opt_memscramble=no ;; *) opt_memscramble=yes ;; esac +dnl +dnl macros for the bash debugger +dnl +AM_PATH_LISPDIR +AC_ARG_VAR(DEBUGGER_START_FILE, [location of bash debugger initialization file]) + dnl arguments to configure dnl packages AC_ARG_WITH(afs, AC_HELP_STRING([--with-afs], [if you are running AFS]), opt_afs=$withval) @@ -138,6 +148,10 @@ if test "$opt_curses" = yes; then prefer_curses=yes fi +if test -z "${DEBUGGER_START_FILE}"; then + DEBUGGER_START_FILE=${ac_default_prefix}/lib/bashdb/bashdb-main.inc +fi + dnl optional shell features in config.h.in opt_minimal_config=no @@ -160,10 +174,13 @@ opt_disabled_builtins=no opt_command_timing=yes opt_xpg_echo=no opt_cond_command=yes +opt_cond_regexp=yes opt_arith_for_command=yes opt_net_redirs=yes opt_progcomp=yes opt_separate_help=no +opt_multibyte=yes +opt_debugger=yes dnl options that affect how bash is compiled and linked opt_static_link=no @@ -182,6 +199,7 @@ if test $opt_minimal_config = yes; then opt_brace_expansion=no opt_disabled_builtins=no opt_command_timing=no opt_extended_glob=no opt_cond_command=no opt_arith_for_command=no opt_net_redirs=no opt_progcomp=no opt_separate_help=no + opt_multibyte=yes opt_cond_regexp=no fi AC_ARG_ENABLE(alias, AC_HELP_STRING([--enable-alias], [enable shell aliases]), opt_alias=$enableval) @@ -191,6 +209,8 @@ AC_ARG_ENABLE(bang-history, AC_HELP_STRING([--enable-bang-history], [turn on csh AC_ARG_ENABLE(brace-expansion, AC_HELP_STRING([--enable-brace-expansion], [include brace expansion]), opt_brace_expansion=$enableval) AC_ARG_ENABLE(command-timing, AC_HELP_STRING([--enable-command-timing], [enable the time reserved word and command timing]), opt_command_timing=$enableval) AC_ARG_ENABLE(cond-command, AC_HELP_STRING([--enable-cond-command], [enable the conditional command]), opt_cond_command=$enableval) +AC_ARG_ENABLE(cond-regexp, AC_HELP_STRING([--enable-cond-regexp], [enable extgended regular expression matching in conditional commands]), opt_cond_regexp=$enableval) +AC_ARG_ENABLE(debugger, AC_HELP_STRING([--enable-debugger], [enable support for bash debugger]), opt_debugger=$enableval) AC_ARG_ENABLE(directory-stack, AC_HELP_STRING([--enable-directory-stack], [enable builtins pushd/popd/dirs]), opt_dirstack=$enableval) AC_ARG_ENABLE(disabled-builtins, AC_HELP_STRING([--enable-disabled-builtins], [allow disabled builtins to still be invoked]), opt_disabled_builtins=$enableval) AC_ARG_ENABLE(dparen-arithmetic, AC_HELP_STRING([--enable-dparen-arithmetic], [include ((...)) command]), opt_dparen_arith=$enableval) @@ -198,6 +218,7 @@ AC_ARG_ENABLE(extended-glob, AC_HELP_STRING([--enable-extended-glob], [include k AC_ARG_ENABLE(help-builtin, AC_HELP_STRING([--enable-help-builtin], [include the help builtin]), opt_help=$enableval) AC_ARG_ENABLE(history, AC_HELP_STRING([--enable-history], [turn on command history]), opt_history=$enableval) AC_ARG_ENABLE(job-control, AC_HELP_STRING([--enable-job-control], [enable job control features]), opt_job_control=$enableval) +AC_ARG_ENABLE(multibyte, AC_HELP_STRING([--enable-multibyte], [enable multibyte characters if OS supports them]), opt_multibyte=$enableval) AC_ARG_ENABLE(net-redirections, AC_HELP_STRING([--enable-net-redirections], [enable /dev/tcp/host/port redirection]), opt_net_redirs=$enableval) AC_ARG_ENABLE(process-substitution, AC_HELP_STRING([--enable-process-substitution], [enable process substitution]), opt_process_subst=$enableval) AC_ARG_ENABLE(progcomp, AC_HELP_STRING([--enable-progcomp], [enable programmable completion and the complete builtin]), opt_progcomp=$enableval) @@ -265,6 +286,9 @@ fi if test $opt_cond_command = yes ; then AC_DEFINE(COND_COMMAND) fi +if test $opt_cond_regexp = yes ; then +AC_DEFINE(COND_REGEXP) +fi if test $opt_arith_for_command = yes; then AC_DEFINE(ARITH_FOR_COMMAND) fi @@ -274,6 +298,12 @@ fi if test $opt_progcomp = yes; then AC_DEFINE(PROGRAMMABLE_COMPLETION) fi +if test $opt_multibyte = no; then +AC_DEFINE(NO_MULTIBYTE_SUPPORT) +fi +if test $opt_debugger = yes; then +AC_DEFINE(DEBUGGER) +fi if test $opt_memscramble = yes; then AC_DEFINE(MEMSCRAMBLE) @@ -430,7 +460,7 @@ then RL_LIB_READLINE_VERSION case "$ac_cv_rl_version" in - 4.[[3-9]]*|5*|6*|7*|8*|9*) ;; + 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) @@ -442,9 +472,13 @@ if test $opt_readline = yes; then AC_DEFINE(READLINE) READLINE_LIB=-lreadline if test "$opt_with_installed_readline" != "no" ; then - case "$RL_INCLUDEDIR" in - /usr/include) ;; - *) RL_INCLUDE='-I${RL_INCLUDEDIR}' + case "$opt_with_installed_readline" in + yes) RL_INCLUDE= ;; + *) case "$RL_INCLUDEDIR" in + /usr/include) ;; + *) RL_INCLUDE='-I${RL_INCLUDEDIR}' ;; + esac + ;; esac READLINE_DEP= else @@ -466,9 +500,13 @@ if test $opt_history = yes || test $opt_bang_history = yes; then if test "$opt_with_installed_readline" != "no"; then HIST_LIBDIR=$RL_LIBDIR HISTORY_DEP= - case "$RL_INCLUDEDIR" in - /usr/include) ;; - *) RL_INCLUDE='-I${RL_INCLUDEDIR}' + case "$opt_with_installed_readline" in + yes) RL_INCLUDE= ;; + *) case "$RL_INCLUDEDIR" in + /usr/include) ;; + *) RL_INCLUDE='-I${RL_INCLUDEDIR}' ;; + esac + ;; esac else HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline' @@ -525,7 +563,7 @@ BASH_HEADER_INTTYPES AC_CHECK_HEADERS(unistd.h stdlib.h stdarg.h varargs.h limits.h string.h \ memory.h locale.h termcap.h termio.h termios.h dlfcn.h \ - stddef.h stdint.h netdb.h grp.h strings.h) + stddef.h stdint.h netdb.h grp.h strings.h regex.h) AC_CHECK_HEADERS(sys/ptem.h sys/pte.h sys/stream.h sys/select.h sys/file.h \ sys/resource.h sys/param.h sys/socket.h \ sys/time.h sys/times.h sys/wait.h) @@ -588,9 +626,9 @@ AC_CHECK_FUNCS(bcopy bzero confstr sysconf pathconf setenv putenv unsetenv \ setlinebuf setvbuf setlocale strchr tcgetattr uname \ ulimit tzset siginterrupt memmove ttyname times \ getaddrinfo gethostbyname getservbyname getservent inet_aton \ - vsnprintf snprintf vasprintf asprintf fnmatch) + vsnprintf snprintf vasprintf asprintf fnmatch regcomp regexec) AC_CHECK_FUNCS(isascii isblank isgraph isprint isspace isxdigit) -AC_REPLACE_FUNCS(getcwd strcasecmp strerror strftime strpbrk memset) +AC_REPLACE_FUNCS(getcwd strcasecmp strerror strftime strpbrk memset strstr) AC_REPLACE_FUNCS(strtod strtol strtoul strtoll strtoull strtoimax strtoumax) AC_CHECK_DECLS([confstr]) @@ -598,7 +636,24 @@ AC_CHECK_DECLS([printf]) AC_CHECK_DECLS([sbrk]) AC_CHECK_DECLS([strcpy]) AC_CHECK_DECLS([strsignal]) -AC_CHECK_DECLS([strtold]) + +dnl Extra test to detect the horribly broken HP/UX 11.00 strtold(3) +AC_CHECK_DECLS([strtold], [ + AC_MSG_CHECKING([for broken strtold]) + AC_CACHE_VAL(bash_cv_strtold_broken, + [AC_TRY_COMPILE( + [#include <stdlib.h>], + [int main() { long double r; char *foo, bar; r = strtold(foo, &bar);}], + bash_cv_strtold_broken=no, bash_cv_strtold_broken=yes, + [AC_MSG_WARN(cannot check for broken strtold if cross-compiling, defaulting to no)]) + ] + ) + AC_MSG_RESULT($bash_cv_strtold_broken) + if test "$bash_cv_strtold_broken" = "yes" ; then + AC_DEFINE(STRTOLD_BROKEN) + fi +]) + BASH_CHECK_DECL(strtoimax) BASH_CHECK_DECL(strtol) @@ -702,6 +757,7 @@ BASH_FUNC_LSTAT fi dnl behavior of system calls and library functions +BASH_FUNC_CTYPE_NONASCII BASH_FUNC_DUP2_CLOEXEC_CHECK BASH_SYS_PGRP_SYNC BASH_SYS_SIGNAL_VINTAGE @@ -733,6 +789,7 @@ BASH_STRUCT_TIMEVAL AC_CHECK_MEMBERS([struct stat.st_blocks]) AC_STRUCT_TM AC_STRUCT_TIMEZONE +BASH_STRUCT_TIMEZONE dnl presence and behavior of C library functions BASH_FUNC_STRSIGNAL @@ -851,7 +908,7 @@ lynxos*) LOCAL_CFLAGS=-DRECYCLES_PIDS ;; linux*) LOCAL_LDFLAGS=-rdynamic ;; # allow dynamic loading *qnx*) LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;; powerux*) LOCAL_LIBS="-lgen" ;; -cygwin*) LOCAL_LIBS="-luser32" ;; +cygwin*) LOCAL_CFLAGS=-DRECYCLES_PIDS ;; opennt*|interix*) LOCAL_CFLAGS="-DNO_MAIN_ENV_ARG -DBROKEN_DIRENT_D_INO" ;; esac @@ -948,7 +1005,8 @@ AC_SUBST(LOCAL_DEFS) AC_OUTPUT([Makefile builtins/Makefile lib/readline/Makefile lib/glob/Makefile \ lib/malloc/Makefile lib/sh/Makefile lib/termcap/Makefile \ lib/tilde/Makefile doc/Makefile support/Makefile \ - examples/loadables/Makefile examples/loadables/perl/Makefile], + examples/loadables/Makefile examples/loadables/perl/Makefile \ + pathnames.h], [ # Makefile uses this timestamp file to record whether config.h is up to date. echo timestamp > stamp-h @@ -50,7 +50,6 @@ static ARITH_COM *copy_arith_command __P((ARITH_COM *)); static COND_COM *copy_cond_command __P((COND_COM *)); #endif static SIMPLE_COM *copy_simple_command __P((SIMPLE_COM *)); -static FUNCTION_DEF *copy_function_def __P((FUNCTION_DEF *)); WORD_DESC * copy_word (w) @@ -166,6 +165,7 @@ copy_for_command (com) new_for = (FOR_COM *)xmalloc (sizeof (FOR_COM)); new_for->flags = com->flags; + new_for->line = com->line; new_for->name = copy_word (com->name); new_for->map_list = copy_word_list (com->map_list); new_for->action = copy_command (com->action); @@ -221,6 +221,7 @@ copy_case_command (com) new_case = (CASE_COM *)xmalloc (sizeof (CASE_COM)); new_case->flags = com->flags; + new_case->line = com->line; new_case->word = copy_word (com->word); new_case->clauses = copy_case_clauses (com->clauses); return (new_case); @@ -302,17 +303,26 @@ copy_simple_command (com) return (new_simple); } -static FUNCTION_DEF * +FUNCTION_DEF * +copy_function_def_contents (old, new_def) + FUNCTION_DEF *old, *new_def; +{ + new_def->name = copy_word (old->name); + new_def->command = copy_command (old->command); + new_def->flags = old->flags; + new_def->line = old->line; + new_def->source_file = old->source_file ? savestring (old->source_file) : old->source_file; + return (new_def); +} + +FUNCTION_DEF * copy_function_def (com) FUNCTION_DEF *com; { FUNCTION_DEF *new_def; new_def = (FUNCTION_DEF *)xmalloc (sizeof (FUNCTION_DEF)); - new_def->name = copy_word (com->name); - new_def->command = copy_command (com->command); - new_def->flags = com->flags; - new_def->line = com->line; + new_def = copy_function_def_contents (com, new_def); return (new_def); } diff --git a/dispose_cmd.c b/dispose_cmd.c index 90515df8..1a4c0d7e 100644 --- a/dispose_cmd.c +++ b/dispose_cmd.c @@ -186,9 +186,7 @@ dispose_command (command) register FUNCTION_DEF *c; c = command->value.Function_def; - dispose_word (c->name); - dispose_command (c->command); - free (c); + dispose_function_def (c); break; } @@ -218,6 +216,23 @@ dispose_cond_node (cond) } #endif /* COND_COMMAND */ +void +dispose_function_def_contents (c) + FUNCTION_DEF *c; +{ + dispose_word (c->name); + dispose_command (c->command); + FREE (c->source_file); +} + +void +dispose_function_def (c) + FUNCTION_DEF *c; +{ + dispose_function_def_contents (c); + free (c); +} + /* How to free a WORD_DESC. */ void dispose_word (w) diff --git a/dispose_cmd.h b/dispose_cmd.h index 595a6ad7..2d23505b 100644 --- a/dispose_cmd.h +++ b/dispose_cmd.h @@ -33,4 +33,7 @@ extern void dispose_redirects __P((REDIRECT *)); extern void dispose_cond_node __P((COND_COM *)); #endif +extern void dispose_function_def_contents __P((FUNCTION_DEF *)); +extern void dispose_function_def __P((FUNCTION_DEF *)); + #endif /* !_DISPOSE_CMD_H_ */ @@ -1,4 +1,4 @@ -This is the Bash FAQ, version 3.20, for Bash version 2.05b. +This is the Bash FAQ, version 3.26, for Bash version 2.05b. This document contains a set of frequently-asked questions concerning Bash, the GNU Bourne-Again Shell. Bash is a freely-available command @@ -31,7 +31,7 @@ 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'? +A9) What's the `POSIX Shell and Utilities standard'? A10) What is the bash `posix mode'? Section B: The latest version @@ -75,6 +75,9 @@ E8) Why does the arithmetic evaluation code complain about `08'? E9) Why does the pattern matching expression [A-Z]* match files beginning with every letter except `z'? E10) Why does `cd //' leave $PWD as `//'? +E11) If I resize my xterm while another program is running, why doesn't bash + notice the change? +E12) Why don't negative offsets in substring expansion work like I expect? Section F: Things to watch out for on certain Unix versions @@ -271,7 +274,8 @@ it is invoked as a login shell. Next, add a line similar to the above to ~/.profile: - [ -f /usr/gnu/bin/bash ] && exec /usr/gnu/bin/bash --login + [ -f /usr/gnu/bin/bash ] && [ -x /usr/gnu/bin/bash ] && \ + exec /usr/gnu/bin/bash --login 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 @@ -325,7 +329,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. -A9) What's the `POSIX 1003.2 standard'? +A9) What's the `POSIX Shell and Utilities standard'? POSIX is a name originally coined by Richard Stallman for a family of open system standards based on UNIX. There are a @@ -335,44 +339,50 @@ call and C library level to applications and tools to system administration and management. Each area of standardization is assigned to a working group in the 1003 series. -The POSIX Shell and Utilities standard has been developed by IEEE -Working Group 1003.2 (POSIX.2). It concentrates on the command +The POSIX Shell and Utilities standard was originally developed by +IEEE Working Group 1003.2 (POSIX.2). Today it has been merged with +the original 1003.1 Working Group and is maintained by the Austin +Group (a joint working group of the IEEE, The Open Group and +ISO/IEC SC22/WG15). Today the Shell and Utilities are a volume +within the set of documents that make up IEEE Std 1003.1-2001, and +thus now the former POSIX.2 (from 1992) is now part of the current +POSIX.1 standard (POSIX 1003.1-2001). + +The Shell and Utilities volume concentrates on the command interpreter interface and utility programs commonly executed from -the command line or by other programs. An initial version of the -standard has been approved and published by the IEEE, and work is -currently underway to update it. +the command line or by other programs. The standard is freely +available on the web at http://www.UNIX-systems.org/version3/ . +Work continues at the Austin Group on maintenance issues; see +http://www.opengroup.org/austin/ to join the discussions. -Bash is concerned with the aspects of the shell's behavior -defined by POSIX.2. The shell command language has of course -been standardized, including the basic flow control and program -execution constructs, I/O redirection and pipelining, argument -handling, variable expansion, and quoting. +Bash is concerned with the aspects of the shell's behavior defined +by the POSIX Shell and Utilities volume. The shell command +language has of course been standardized, including the basic flow +control and program execution constructs, I/O redirection and +pipelining, argument handling, variable expansion, and quoting. The `special' builtins, which must be implemented as part of the shell to provide the desired functionality, are specified as being part of the shell; examples of these are `eval' and -`export'. Other utilities appear in the sections of POSIX.2 not +`export'. Other utilities appear in the sections of POSIX not devoted to the shell which are commonly (and in some cases must be) implemented as builtin commands, such as `read' and `test'. -POSIX.2 also specifies aspects of the shell's interactive +POSIX also specifies aspects of the shell's interactive behavior as part of the UPE, including job control and command line editing. Only vi-style line editing commands have been standardized; emacs editing commands were left out due to objections. -The Open Group has made an older version of its Single Unix -Specification (version 2), which is very similar to POSIX.2, -available on the web at - -http://www.opengroup.org/onlinepubs/007908799/ +The latest version of the POSIX Shell and Utilities standard is +available (now updated to the 2003 Edition incorporating the +Technical Corrigendum 1), as part of the Single UNIX Specification +Version 3 at -The Single Unix Specification, version 3, is available on the web at - -http://www.opengroup.org/onlinepubs/007904975/ +http://www.UNIX-systems.org/version3/ A10) What is the bash `posix mode'? -Although bash is an implementation of the POSIX.2 shell +Although bash is an implementation of the POSIX shell specification, there are areas where the bash default behavior differs from that spec. The bash `posix mode' changes the bash behavior in these areas so that it obeys the spec more closely. @@ -821,6 +831,8 @@ New things in ksh-93 not in bash-2.05b: -I invocation option DEBUG trap now executed before each simple command, instead of after printf %H, %P, %T, %Z modifiers, output base for %d + lexical scoping for local variables in `ksh' functions + no scoping for local variables in `POSIX' functions New things in ksh-93 present in bash-2.05b: [n]<&word- and [n]>&word- redirections (combination dup and close) @@ -1305,6 +1317,49 @@ This is, I presume, for historical compatibility. Certain versions of Unix, and early network file systems, used paths of the form //hostname/path to access `path' on server `hostname'. +E11) If I resize my xterm while another program is running, why doesn't bash + notice the change? + +This is another issue that deals with job control. + +The kernel maintains a notion of a current terminal process group. Members +of this process group (processes whose process group ID is equal to the +current terminal process group ID) receive terminal-generated signals like +SIGWINCH. (For more details, see the JOB CONTROL section of the bash +man page.) + +If a terminal is resized, the kernel sends SIGWINCH to each member of +the terminal's current process group (the `foreground' process group). + +When bash is running with job control enabled, each pipeline (which may be +a single command) is run in its own process group, different from bash's +process group. This foreground process group receives the SIGWINCH; bash +does not. Bash has no way of knowing that the terminal has been resized. + +There is a `checkwinsize' option, settable with the `shopt' builtin, that +will cause bash to check the window size and adjust its idea of the +terminal's dimensions each time a process stops or exits and returns control +of the terminal to bash. Enable it with `shopt -s checkwinsize'. + +E12) Why don't negative offsets in substring expansion work like I expect? + +When substring expansion of the form ${param:offset[:length} is used, +an `offset' that evaluates to a number less than zero counts back from +the end of the expanded value of $param. + +When a negative `offset' begins with a minus sign, however, unexpected things +can happen. Consider + + a=12345678 + echo ${a:-4} + +intending to print the last four characters of $a. The problem is that +${param:-word} already has a well-defined meaning: expand to word if the +expanded value of param is unset or null, and $param otherwise. + +To use negative offsets that begin with a minus sign, separate the +minus sign and the colon with a space. + Section F: Things to watch out for on certain Unix versions F1) Why can't I use command line editing in my `cmdtool'? @@ -1671,6 +1726,12 @@ 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. +The GNU Bash Reference Manual has been published as a printed book by +Network Theory Ltd (Paperback, ISBN: 0-9541617-7-7, Feb 2003). It covers +bash-2.0 and is available from most online bookstores (see +http://www.network-theory.co.uk/bash/manual/ for details). The publisher +will donate $1 to the Free Software Foundation for each copy sold. + H3) What's coming in future versions? These are features I hope to include in a future version of bash. @@ -1698,10 +1759,10 @@ Some of the new ksh93 pattern matching operators, like backreferencing H5) When will the next release appear? -The next version will appear sometime in 2002. Never make predictions. +The next version will appear sometime in 2003. Never make predictions. -This document is Copyright 1995-2002 by Chester Ramey. +This document is Copyright 1995-2003 by Chester Ramey. Permission is hereby granted, without written agreement and without license or royalty fees, to use, copy, and distribute diff --git a/doc/Makefile.in b/doc/Makefile.in index 3ecc5d88..2d6667e9 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -1,6 +1,6 @@ # This Makefile is for the Bash/documentation directory -*- text -*-. # -# Copyright (C) 1996 Free Software Foundation, Inc. +# Copyright (C) 2003 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 @@ -59,11 +59,14 @@ TEXI2DVI = ${topdir}/support/texi2dvi TEXI2HTML = ${topdir}/support/texi2html MAN2HTML = ${BUILD_DIR}/support/man2html HTMLPOST = ${srcdir}/htmlpost.sh +INFOPOST = ${srcdir}/infopost.sh QUIETPS = #set this to -q to shut up dvips PAPERSIZE = letter # change to a4 for A4-size paper -PSDPI = 300 # could be 600 if you like +PSDPI = 600 # could be 300 if you like DVIPS = dvips -D ${PSDPI} $(QUIETPS) -t ${PAPERSIZE} -o $@ # tricky + TEXINPUTDIR = $(RL_LIBDIR)/doc +SET_TEXINPUTS = TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS # These tools might not be available; they're not required DVIPDF = dvipdfm -o $@ -p ${PAPERSIZE} @@ -77,8 +80,10 @@ NROFF = groff -Tascii # This should be a program that converts troff to postscript GROFF = groff -HSUSER = $(RL_LIBDIR)/doc/hsuser.texinfo -RLUSER = $(RL_LIBDIR)/doc/rluser.texinfo +HSUSER = $(RL_LIBDIR)/doc/hsuser.texi +RLUSER = $(RL_LIBDIR)/doc/rluser.texi + +BASHREF_FILES = $(srcdir)/bashref.texi $(srcdir)/version.texi .SUFFIXES: .0 .1 .3 .ms .ps .txt .dvi .html .pdf @@ -122,10 +127,14 @@ RLUSER = $(RL_LIBDIR)/doc/rluser.texinfo $(RM) $@ -${DVIPDF} $< +.dvi.ps: + ${RM} $@ + -${DVIPS} $< + all: ps info dvi text html nodvi: ps info text html -PSFILES = bash.ps bashbug.ps article.ps builtins.ps rbash.ps +PSFILES = bash.ps bashbug.ps article.ps builtins.ps rbash.ps DVIFILES = bashref.dvi bashref.ps INFOFILES = bashref.info MAN0FILES = bash.0 bashbug.0 builtins.0 rbash.0 @@ -139,35 +148,17 @@ text: ${MAN0FILES} html: ${HTMLFILES} pdf: ${PDFFILES} -bashref.dvi: $(srcdir)/bashref.texi $(HSUSER) $(RLUSER) - TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/bashref.texi +bashref.dvi: $(BASHREF_FILES) $(HSUSER) $(RLUSER) + ${SET_TEXINPUTS} $(TEXI2DVI) $(srcdir)/bashref.texi -bashref.ps: bashref.dvi - $(RM) $@ - $(DVIPS) bashref.dvi - -bashref.info: $(srcdir)/bashref.texi $(HSUSER) $(RLUSER) +bashref.info: $(BASHREF_FILES) $(HSUSER) $(RLUSER) $(MAKEINFO) --no-split -I$(TEXINPUTDIR) $(srcdir)/bashref.texi -bashref.html: bashref.texi $(HSUSER) $(RLUSER) +bashref.html: $(BASHREF_FILES) $(HSUSER) $(RLUSER) $(TEXI2HTML) -menu -monolithic -I $(TEXINPUTDIR) $(srcdir)/bashref.texi -new-bashref.dvi: $(srcdir)/new-bashref.texi $(HSUSER) $(RLUSER) - TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/new-bashref.texi - -new-bashref.ps: new-bashref.dvi - $(RM) $@ - $(DVIPS) new-bashref.dvi - -new-bashref.info: $(srcdir)/new-bashref.texi $(HSUSER) $(RLUSER) - $(MAKEINFO) --no-split -I$(TEXINPUTDIR) $(srcdir)/new-bashref.texi - -#bash.dvi: bash.texinfo $(HSUSER) $(RLUSER) -# TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2DVI) bash.texinfo -# -#bashman.ps: bash.dvi -# $(RM) $@ -# $(DVIPS) bash.dvi +bash.info: bashref.info + ${SHELL} ${INFOPOST} < bashref.info > $@ bash.txt: bash.1 bash.ps: bash.1 @@ -181,6 +172,8 @@ builtins.0: builtins.1 bash.1 rbash.0: rbash.1 bash.1 article.ps: article.ms +bashref.ps: bashref.dvi + article.pdf: article.ps bashref.pdf: bashref.dvi bash.pdf: bash.ps @@ -217,12 +210,12 @@ installdirs: test -d $(htmldir) || $(SHELL) ${MKDIRS} $(DESTDIR)$(htmldir) ; \ fi -install: info installdirs +install: info installdirs bash.info -$(INSTALL_DATA) $(srcdir)/bash.1 $(DESTDIR)$(man1dir)/bash${man1ext} -$(INSTALL_DATA) $(srcdir)/bashbug.1 $(DESTDIR)$(man1dir)/bashbug${man1ext} # uncomment the next line to install the builtins man page # -$(INSTALL_DATA) $(srcdir)/builtins.1 $(DESTDIR)$(man1dir)/bash_builtins${man1ext} - -$(INSTALL_DATA) $(srcdir)/bashref.info $(DESTDIR)$(infodir)/bash.info + -$(INSTALL_DATA) $(srcdir)/bash.info $(DESTDIR)$(infodir)/bash.info # run install-info if it is present to update the info directory if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \ install-info --dir-file=$(DESTDIR)$(infodir)/dir $(DESTDIR)$(infodir)/bash.info; \ @@ -4,14 +4,14 @@ .\" Chet Ramey .\" Information Network Services .\" Case Western Reserve University -.\" chet@ins.CWRU.Edu +.\" chet@po.CWRU.Edu .\" -.\" Last Change: Mon Jul 15 15:20:56 EDT 2002 +.\" Last Change: Fri Sep 12 18:20:41 EDT 2003 .\" .\" bash_builtins, strip all but Built-Ins section .if \n(zZ=1 .ig zZ .if \n(zY=1 .ig zY -.TH BASH 1 "2002 July 15" "GNU Bash-2.05b" +.TH BASH 1 "2003 Sep 12" "GNU Bash-3.0" .\" .\" There's some problem with having a `@' .\" in a tagged paragraph with the BSD man macros. @@ -152,6 +152,17 @@ single-character options to be recognized. .PP .PD 0 .TP +.B \-\-debugger +Arrange for the debugger profile to be executed before the shell +starts. Turns on extended debugging mode (see the description of the +.B extdebug +option to the +.B shopt +builtin below) and shell function tracing (see the description of the +\fB\-o functrace\fP option to the +.B set +builtin below). +.TP .B \-\-dump\-po\-strings Equivalent to \fB\-D\fP, but the output is in the GNU \fIgettext\fP \fBpo\fP (portable object) file format. @@ -510,12 +521,15 @@ command (see .B REDIRECTION below). .PP +The return status of a pipeline is the exit status of the last +command, unless the \fBpipefail\fP option is enabled. +If \fBpipefail\fP is enabled, the pipeline's return status is the +value of the last (rightmost) command to exit with a non-zero status, +or zero if all commands exit successfully. If the reserved word .B ! -precedes a pipeline, the exit status of that -pipeline is the logical NOT of the exit status of the last command. -Otherwise, the status of the pipeline is the exit status of the last -command. +precedes a pipeline, the exit status of that pipeline is the logical +negation of the exit status as described above. The shell waits for all commands in the pipeline to terminate before returning a value. .PP @@ -610,7 +624,11 @@ executed in the list. A \fIcompound command\fP is one of the following: .TP (\fIlist\fP) -\fIlist\fP is executed in a subshell. Variable assignments and builtin +\fIlist\fP is executed in a subshell environment (see +.SM +\fBCOMMAND EXECUTION ENVIRONMENT\fP +below). +Variable assignments and builtin commands that affect the shell's environment do not remain in effect after the command completes. The return status is the exit status of \fIlist\fP. @@ -621,7 +639,7 @@ after the command completes. The return status is the exit status of This is known as a \fIgroup command\fP. The return status is the exit status of \fIlist\fP. -Note that unlike the metacharacters \fB(\fP and \fB\)\fP, \fB{\fP and +Note that unlike the metacharacters \fB(\fP and \fB)\fP, \fB{\fP and \fB}\fP are \fIreserved words\fP and must occur where a reserved word is permitted to be recognized. Since they do not cause a word break, they must be separated from \fIlist\fP by whitespace. @@ -645,6 +663,8 @@ Word splitting and pathname expansion are not performed on the words between the \fB[[\fP and \fB]]\fP; tilde expansion, parameter and variable expansion, arithmetic expansion, command substitution, process substitution, and quote removal are performed. +Conditional operators such as \fB\-f\fP must be unquoted to be recognized +as primaries. .if t .sp 0.5 .if n .sp 1 When the \fB==\fP and \fB!=\fP operators are used, the string to the @@ -656,6 +676,26 @@ Any part of the pattern may be quoted to force it to be matched as a string. .if t .sp 0.5 .if n .sp 1 +An additional binary operator, \fB=~\fP, is available, with the same +precedence as \fB==\fP and \fB!=\fP. +When it is used, the string to the right of the operator is considered +an extended regular expression and matched accordingly (as in \fIregex\fP(3)). +The return value is 0 if the string matches +the pattern, and 1 otherwise. +If the regular expression is syntactically incorrect, the conditional +expression's return value is 2. +If the shell option +.B nocaseglob +is enabled, the match is performed without regard to the case +of alphabetic characters. +Substrings matched by parenthesized subexpressions within the regular +expression are saved in the array variable \fBBASH_REMATCH\fP. +The element of \fBBASH_REMATCH\fP with index 0 is the portion of the string +matching the entire regular expression. +The element of \fBBASH_REMATCH\fP with index \fIn\fP is the portion of the +string matching the \fIn\fPth parenthesized subexpression. +.if t .sp 0.5 +.if n .sp 1 Expressions may be combined using the following operators, listed in decreasing order of precedence: .if t .sp 0.5 @@ -798,15 +838,32 @@ The exit status of the \fBwhile\fP and \fBuntil\fP commands is the exit status of the last \fBdo\fP \fIlist\fP command executed, or zero if none was executed. -.TP -[ \fBfunction\fP ] \fIname\fP () { \fIlist\fP; } -This defines a function named \fIname\fP. The \fIbody\fP of the -function is the -.I list -of commands between { and }. This list -is executed whenever \fIname\fP is specified as the -name of a simple command. The exit status of a function is -the exit status of the last command executed in the body. (See +.SS Shell Function Definitions +.PP +A shell function is an object that is called like a simple command and +executes a compound command with a new set of positional parameters. +Shell functions are declared as follows: +.TP +[ \fBfunction\fP ] \fIname\fP () \fIcompound\-command\fP [\fIredirection\fP] +This defines a function named \fIname\fP. +The reserved word \fBfunction\fP is optional. +If the \fBfunction\fP reserved word is supplied, the parentheses are optional. +The \fIbody\fP of the function is the compound command +.I compound\-command +(see \fBCompound Commands\fP above). +That command is usually a \fIlist\fP of commands between { and }, but +may be any command listed under \fBCompound Commands\fP above. +\fIcompound\-command\fP is executed whenever \fIname\fP is specified as the +name of a simple command. +Any redirections (see +.SM +.B REDIRECTION +below) specified when a function is defined are performed +when the function is executed. +The exit status of a function definition is zero unless a syntax error +occurs or a readonly function with the same name already exists. +When executed, the exit status of a function is the exit status of the +last command executed in the body. (See .SM .B FUNCTIONS below.) @@ -880,6 +937,8 @@ or .BR <newline> . A double quote may be quoted within double quotes by preceding it with a backslash. +When command history is being used, the double quote may not be used to +quote the history expansion character. .PP The special parameters .B * @@ -958,7 +1017,7 @@ It can be a .IR name , a number, or one of the special characters listed below under .BR "Special Parameters" . -For the shell's purposes, a +A .I variable is a parameter denoted by a .IR name . @@ -1001,7 +1060,7 @@ below). If the variable has its .B integer attribute set, then .I value -is subject to arithmetic expansion even if the $((...)) expansion is +is evaluated as an arithmetic expression even if the $((...)) expansion is not used (see .B "Arithmetic Expansion" below). @@ -1138,6 +1197,54 @@ The following variables are set by the shell: Expands to the full file name used to invoke this instance of .BR bash . .TP +.B BASH_ARGC +An array variable whose values are the number of parameters in each +frame of the current bash execution call stack. The number of +parameters to the current subroutine (shell function or script executed +with \fB.\fP or \fBsource\fP) is at the top of the stack. When a +subroutine is executed, the number of parameters passed is pushed onto +\fBBASH_ARGC\fP. +.TP +.B BASH_ARGV +An array variable containing all of the parameters in the current bash +execution call stack. The final parameter of the last subroutine call +is at the top of the stack; the first parameter of the initial call is +at the bottom. When a subroutine is executed, the parameters supplied +are pushed onto \fBBASH_ARGV\fP. +.TP +.B BASH_COMMAND +The command currently being executed or about to be executed, unless the +shell is executing a command as the result of a trap, +in which case it is the command executing at the time of the trap. +.TP +.B BASH_EXECUTION_STRING +The command argument to the \fB\-c\fP invocation option. +.TP +.B BASH_LINENO +An array variable whose members are the line numbers in source files +corresponding to each member of @var{FUNCNAME}. +\fB${BASH_LINENO[\fP\fI$i\fP\fB]}\fP is the line number in the source +file where \fB${FUNCNAME[\fP\fI$i + 1\fP\fB]}\fP was called. +The corresponding source file name is \fB${BASH_SOURCE[\fP\fI$i + 1\fP\fB]}\fB. +Use \fBLINENO\fP to obtain the current line number. +.TP +.B BASH_REMATCH +An array variable whose members are assigned by the \fB=~\fP binary +operator to the \fB[[\fP conditional command. +The element with index 0 is the portion of the string +matching the entire regular expression. +The element with index \fIn\fP is the portion of the +string matching the \fIn\fPth parenthesized subexpression. +This variable is read-only. +.TP +.B BASH_SOURCE +An array variable whose members are the source filenames corresponding +to the elements in the \fBFUNCNAME\fP array variable. +.TP +.B BASH_SUBSHELL +Incremented by one each time a subshell or subshell environment is spawned. +The initial value is 0. +.TP .B BASH_VERSINFO A readonly array variable whose members hold version information for this instance of @@ -1195,6 +1302,15 @@ commands invoked by the programmable completion facilities (see \fBProgrammable Completion\fP below). .TP +.B COMP_WORDBREAKS +The set of characters that the Readline library treats as word +separators when performing word completion. +If +.SM +.B COMP_WORDBREAKS +is unset, it loses its special properties, even if it is +subsequently reset. +.TP .B COMP_WORDS An array variable (see \fBArrays\fP below) consisting of the individual words in the current command line. @@ -1227,7 +1343,11 @@ Expands to the effective user ID of the current user, initialized at shell startup. This variable is readonly. .TP .B FUNCNAME -The name of any currently-executing shell function. +An array variable containing the names of all shell functions +currently in the execution call stack. +The element with index 0 is the name of any currently-executing +shell function. +The bottom-most element is "main". This variable exists only when a shell function is executing. Assignments to .SM @@ -1439,6 +1559,14 @@ An array variable from which \fBbash\fP reads the possible completions generated by a shell function invoked by the programmable completion facility (see \fBProgrammable Completion\fP below). .TP +.B EMACS +If \fBbash\fP finds this variable in the environment when the shell starts +with value +.if t \f(CWt\fP, +.if n "t", +it assumes that the shell is running in an emacs shell buffer and disables +line editing. +.TP .B FCEDIT The default editor for the .B fc @@ -1468,23 +1596,27 @@ of the patterns in it is removed from the list of matches. .TP .B HISTCONTROL -If set to a value of +A colon-separated list of values controlling how commands are saved on +the history list. +If the list of values includes .IR ignorespace , lines which begin with a .B space -character are not entered on the history list. -If set to a value of -.IR ignoredups , -lines matching the last history line are not entered. +character are not saved in the history list. +A value of +.I ignoredups +causes lines matching the previous history entry to not be saved. A value of .I ignoreboth -combines the two options. -If unset, or if set to any other value than those above, -all lines read -by the parser are saved on the history list, subject to the value -of -.BR HISTIGNORE . -This variable's function is superseded by +is shorthand for \fIignorespace\fP and \fIignoredups\fP. +A value of +.IR erasedups +causes all previous lines matching the current line to be removed from +the history list before that line is saved. +Any value not in the above list is ignored. +If \fBHISTCONTROL\fP is unset, or does not include a valid value, +all lines read by the shell parser are saved on the history list, +subject to the value of .BR HISTIGNORE . The second and subsequent lines of a multi-line compound command are not tested, and are added to the history regardless of the value of @@ -1525,6 +1657,13 @@ The number of commands to remember in the command history (see .B HISTORY below). The default value is 500. .TP +.B HISTTIMEFORMAT +If this variable is set and not null, its value is used as a format string +for \fIstrftime\fP(3) to print the time stamp associated with each history +entry displayed by the \fBhistory\fP builtin. +If this variable is set, time stamps are written to the history file so +they may be preserved across shell sessions. +.TP .B HOME The home directory of the current user; the default argument for the \fBcd\fP builtin command. @@ -1673,7 +1812,12 @@ is a colon-separated list of directories in which the shell looks for commands (see .SM .B COMMAND EXECUTION -below). The default path is system-dependent, +below). +A zero-length (null) directory name in the value of \fBPATH\fP indicates the +current directory. +A null directory name may appear as two adjacent colons, or as an initial +or trailing colon. +The default path is system-dependent, and is set by the administrator who installs .BR bash . A common value is @@ -1958,8 +2102,9 @@ may be generated. This mechanism is similar to need not exist. Patterns to be brace expanded take the form of an optional .IR preamble , -followed by a series of comma-separated strings -between a pair of braces, followed by an optional +followed by either a series of comma-separated strings or +a sequence expression between a pair of braces, followed by +an optional .IR postscript . The preamble is prefixed to each string contained within the braces, and the postscript is then appended @@ -1969,6 +2114,14 @@ Brace expansions may be nested. The results of each expanded string are not sorted; left to right order is preserved. For example, a\fB{\fPd,c,b\fB}\fPe expands into `ade ace abe'. .PP +A sequence expression takes the form \fB{\fP\fIx\fP\fB..\fP\fIy\fP\fB}\fP, +where \fIx\fP and \fIy\fP are either integers or single characters. +When integers are supplied, the expression expands to each number between +\fIx\fP and \fIy\fP, inclusive. +When characters are supplied, the expression expands to each character +lexicographically between \fIx\fP and \fIy\fP, inclusive. Note that +both \fIx\fP and \fIy\fP must be of the same type. +.PP Brace expansion is performed before any other expansions, and any characters special to other expansions are preserved in the result. It is strictly textual. @@ -1977,7 +2130,8 @@ does not apply any syntactic interpretation to the context of the expansion or the text between the braces. .PP A correctly-formed brace expansion must contain unquoted opening -and closing braces, and at least one unquoted comma. +and closing braces, and at least one unquoted comma or a valid +sequence expression. Any incorrectly formed brace expansion is left unchanged. A \fB{\fP or \fB,\fP may be quoted with a backslash to prevent its being considered part of a brace expression. @@ -2115,8 +2269,10 @@ a level of variable indirection is introduced. expanded and that value is used in the rest of the substitution, rather than the value of \fIparameter\fP itself. This is known as \fIindirect expansion\fP. -The exception to this is the expansion of ${!\fIprefix\fP*} -described below. +The exceptions to this are the expansions of ${!\fIprefix\fP*} and +${\fB!\fP\fIname\fP[\fI@\fP]} described below. +The exclamation point must immediately follow the left brace in order to +introduce indirection. .PP In each of the cases below, \fIword\fP is subject to tilde expansion, parameter expansion, command substitution, and arithmetic expansion. @@ -2194,12 +2350,28 @@ Substring indexing is zero-based unless the positional parameters are used, in which case the indexing starts at 1. .TP ${\fB!\fP\fIprefix\fP\fB*\fP} +.PD 0 +.TP +${\fB!\fP\fIprefix\fP\fB@\fP} +.PD Expands to the names of variables whose names begin with \fIprefix\fP, separated by the first character of the .SM .B IFS special variable. .TP +${\fB!\fP\fIname\fP[\fI@\fP]} +.PD 0 +.TP +${\fB!\fP\fIname\fP[\fI*\fP]} +.PD +If \fIname\fP is an array variable, expands to the list of array indices +(keys) assigned in \fIname\fP. +If \fIname\fP is not an array, expands to 0 if \fIname\fP is set and null +otherwise. +When \fI@\fP is used and the expansion appears within double quotes, each +key expands to a separate word. +.TP ${\fB#\fP\fIparameter\fP} The length in characters of the value of \fIparameter\fP is substituted. If @@ -2367,7 +2539,7 @@ is treated as if it were within double quotes, but a double quote inside the parentheses is not treated specially. All tokens in the expression undergo parameter expansion, string expansion, command substitution, and quote removal. -Arithmetic substitutions may be nested. +Arithmetic expansions may be nested. .PP The evaluation is performed according to the rules listed below under .SM @@ -2490,6 +2662,10 @@ If the .B nullglob option is set, and no matches are found, the word is removed. +If the +.B failglob +shell option is set, and no matches are found, an error message +is printed and the command is not executed. If the shell option .B nocaseglob is enabled, the match is performed without regard to the case @@ -2514,6 +2690,7 @@ below under for a description of the .BR nocaseglob , .BR nullglob , +.BR failglob , and .B dotglob shell options. @@ -2534,13 +2711,13 @@ The file names .B ``.'' and .B ``..'' -are always ignored, even when +are always ignored when .SM .B GLOBIGNORE -is set. However, setting +is set and not null. However, setting .SM .B GLOBIGNORE -has the effect of enabling the +to a non-null value has the effect of enabling the .B dotglob shell option, so all other file names beginning with a .B ``.'' @@ -2563,7 +2740,9 @@ is unset. .PP Any character that appears in a pattern, other than the special pattern characters described below, matches itself. The NUL character may not -occur in a pattern. The special pattern characters must be quoted if +occur in a pattern. A backslash escapes the following character; the +escaping backslash is discarded when matching. +The special pattern characters must be quoted if they are to be matched literally. .PP The special pattern characters have the following meanings: @@ -3094,7 +3273,7 @@ The special parameter .B # is updated to reflect the change. Positional parameter 0 is unchanged. -The +The first element of the .SM .B FUNCNAME variable is set to the name of the function while the function @@ -3113,7 +3292,10 @@ below) is not inherited unless the function has been given the \fBtrace\fP attribute (see the description of the .SM .B declare -builtin below). +builtin below) or the +\fB\-o functrace\fP shell option has been enabled with +the \fBset\fP builtin +(in which case all functions inherit the \fBDEBUG\fP trap). .PP Variables local to the function may be declared with the .B local @@ -3124,7 +3306,10 @@ If the builtin command .B return is executed in a function, the function completes and execution resumes with the next command after the function -call. When a function completes, the values of the +call. +Any command associated with the \fBRETURN\fP trap is executed +before execution resumes. +When a function completes, the values of the positional parameters and the special parameter .B # are restored to the values they had prior to the function's @@ -3142,24 +3327,30 @@ option to .B declare or .B typeset -will list the function names only. +will list the function names only +(and optionally the source file and line number, if the \fBextdebug\fP +shell option is enabled). Functions may be exported so that subshells automatically have them defined with the .B \-f option to the .B export builtin. +Note that shell functions and variables with the same name may result +in multiple identically-named entries in the environment passed to the +shell's children. +Care should be taken in cases where this may cause a problem. .PP Functions may be recursive. No limit is imposed on the number of recursive calls. .SH "ARITHMETIC EVALUATION" The shell allows arithmetic expressions to be evaluated, under -certain circumstances (see the \fBlet\fP builtin command and -\fBArithmetic Expansion\fP). +certain circumstances (see the \fBlet\fP and \fBdeclare\fP builtin +commands and \fBArithmetic Expansion\fP). Evaluation is done in fixed-width integers with no check for overflow, though division by 0 is trapped and flagged as an error. -The operators and their precedence and associativity are the same -as in the C language. +The operators and their precedence, associativity, and values +are the same as in the C language. The following list of operators is grouped into levels of equal-precedence operators. The levels are listed in order of decreasing precedence. @@ -3212,7 +3403,7 @@ logical AND logical OR .TP .B \fIexpr\fP?\fIexpr\fP:\fIexpr\fP -conditional evaluation +conditional operator .TP .B = *= /= %= += \-= <<= >>= &= ^= |= assignment @@ -3225,8 +3416,12 @@ Shell variables are allowed as operands; parameter expansion is performed before the expression is evaluated. Within an expression, shell variables may also be referenced by name without using the parameter expansion syntax. +A shell variable that is null or unset evaluates to 0 when referenced +by name without using the parameter expansion syntax. The value of a variable is evaluated as an arithmetic expression -when it is referenced. +when it is referenced, or when a variable which has been given the +\fIinteger\fP attribute using \fBdeclare -i\fP is assigned a value. +A null value evaluates to 0. A shell variable need not have its integer attribute turned on to be used in an expression. .PP @@ -3537,16 +3732,17 @@ the current working directory .IP \(bu the file creation mode mask .IP \(bu -shell variables marked for export, along with variables exported for -the command, passed in the environment +shell variables and functions marked for export, along with variables +exported for the command, passed in the environment .IP \(bu -traps caught by the shell are reset to the values the inherited -from the shell's parent, and traps ignored by the shell are ignored +traps caught by the shell are reset to the values inherited from the +shell's parent, and traps ignored by the shell are ignored .PP A command invoked in this separate environment cannot affect the shell's execution environment. .PP -Command substitution and asynchronous commands are invoked in a +Command substitution, commands grouped with parentheses, +and asynchronous commands are invoked in a subshell environment that is a duplicate of the shell environment, except that traps caught by the shell are reset to the values that the shell inherited from its parent at invocation. Builtin @@ -4420,6 +4616,16 @@ set to words which have more than one possible completion cause the matches to be listed immediately instead of ringing the bell. .TP +.B show\-all\-if\-unmodified (Off) +This alters the default behavior of the completion functions in +a fashion similar to \fBshow\-all\-if\-ambiguous\fP. +If set to +.BR on , +words which have more than one possible completion without any +possible partial completion (the possible completions don't share +a common prefix) cause the matches to be listed immediately instead +of ringing the bell. +.TP .B visible\-stats (Off) If set to \fBOn\fP, a character denoting a file's type as reported by \fIstat\fP(2) is appended to the filename when listing possible @@ -5184,13 +5390,21 @@ If the previously-applied actions do not generate any matches, and the \fB\-o dirnames\fP option was supplied to \fBcomplete\fP when the compspec was defined, directory name completion is attempted. .PP +If the \fB\-o plusdirs\fP option was supplied to \fBcomplete\fP when the +compspec was defined, directory name completion is attempted and any +matches are added to the results of the other actions. +.PP By default, if a compspec is found, whatever it generates is returned to the completion code as the full set of possible completions. The default \fBbash\fP completions are not attempted, and the readline default of filename completion is disabled. -If the \fB-o default\fP option was supplied to \fBcomplete\fP when the -compspec was defined, readline's default completion will be performed +If the \fB\-o bashdefault\fP option was supplied to \fBcomplete\fP when +the compspec was defined, the \fBbash\fP default completions are attempted if the compspec generates no matches. +If the \fB\-o default\fP option was supplied to \fBcomplete\fP when the +compspec was defined, readline's default completion will be performed +if the compspec (and, if attempted, the default \fBbash\fP completions) +generate no matches. .PP When a compspec indicates that directory name completion is desired, the programmable completion functions force readline to append a slash @@ -5342,6 +5556,12 @@ history expansion character, which is \^\fB!\fP\^ by default. Only backslash (\^\fB\e\fP\^) and single quotes can quote the history expansion character. .PP +Several characters inhibit history expansion if found immediately +following the history expansion character, even if it is unquoted: +space, tab, newline, carriage return, and \fB=\fP. +If the \fBextglob\fP shell option is enabled, \fB(\fP will also +inhibit expansion. +.PP Several shell options settable with the .B shopt builtin may be used to tailor the behavior of history expansion. @@ -5393,7 +5613,9 @@ history list. .B ! Start a history substitution, except when followed by a .BR blank , -newline, = or (. +newline, carriage return, = +or ( (when the \fBextglob\fP shell option is enabled using +the \fBshopt\fP builtin). .TP .B !\fIn\fR Refer to command line @@ -5553,6 +5775,10 @@ or `\fB:&\fP'. If used with `\fB:s\fP', any delimiter can be used in place of /, and the final delimiter is optional if it is the last character of the event line. +An \fBa\fP may be used as a synonym for \fBg\fP. +.TP +.B G +Apply the following `\fBs\fP' modifier once to each word in the event line. .PD .SH "SHELL BUILTIN COMMANDS" .\" start of bash_builtins @@ -5796,9 +6022,27 @@ option forces symbolic links to be followed. An argument of is equivalent to .SM .BR $OLDPWD . +If a non-empty directory name from \fBCDPATH\fP is used, or if +\fB\-\fP is the first argument, and the directory change is +successful, the absolute pathname of the new working directory is +written to the standard output. The return value is true if the directory was successfully changed; false otherwise. .TP +\fBcaller\fP [\fIexpr\fP] +Returns the context of any active subroutine call (a shell function or +a script executed with the \fB.\fP or \fBsource\fP builtins. +Without \fIexpr\fP, \fBcaller\fP displays the line number and source +filename of the current subroutine call. +If a non-negative integer is supplied as \fIexpr\fP, \fBcaller\fP +displays the line number, subroutine name, and source file corresponding +to that position in the current execution call stack. This extra +information may be used, for example, to print a stack trace. The +current frame is frame 0. +The return value is 0 unless the shell is not executing a subroutine +call or \fIexpr\fP does not correspond to a valid position in the +call stack. +.TP \fBcommand\fP [\fB\-pVv\fP] \fIcommand\fP [\fIarg\fP ...] Run .I command @@ -5895,6 +6139,10 @@ beyond the simple generation of completions. \fIcomp-option\fP may be one of: .RS .TP 8 +.B bashdefault +Perform the rest of the default \fBbash\fP completions if the compspec +generates no matches. +.TP 8 .B default Use readline's default filename completion if the compspec generates no matches. @@ -6062,10 +6310,10 @@ shell is not executing a loop when .B continue is executed. .TP -\fBdeclare\fP [\fB\-afFirtx\fP] [\fB\-p\fP] [\fIname\fP[=\fIvalue\fP]] +\fBdeclare\fP [\fB\-afFirtx\fP] [\fB\-p\fP] [\fIname\fP[=\fIvalue\fP] ...] .PD 0 .TP -\fBtypeset\fP [\fB\-afFirtx\fP] [\fB\-p\fP] [\fIname\fP[=\fIvalue\fP]] +\fBtypeset\fP [\fB\-afFirtx\fP] [\fB\-p\fP] [\fIname\fP[=\fIvalue\fP] ...] .PD Declare variables and/or give them attributes. If no \fIname\fPs are given then display the values of variables. @@ -6080,7 +6328,9 @@ The .B \-F option inhibits the display of function definitions; only the function name and attributes are printed. -The +If the \fBextdebug\fP shell option is enabled using \fBshopt\fP, +the source file name and line number where the function is defined +are displayed as well. The .B \-F option implies .BR \-f . @@ -6123,7 +6373,10 @@ may not be used to destroy an array variable. When used in a function, makes each \fIname\fP local, as with the .B local -command. The return value is 0 unless an invalid option is encountered, +command. +If a variable name is followed by =\fIvalue\fP, the value of +the variable is set to \fIvalue\fP. +The return value is 0 unless an invalid option is encountered, an attempt is made to define a function using .if n ``\-f foo=bar'', .if t \f(CW\-f foo=bar\fP, @@ -6399,6 +6652,8 @@ The .B \-n option causes the export property to be removed from the named variables. +If a variable name is followed by =\fIword\fP, the value of +the variable is set to \fIword\fP. .B export returns an exit status of 0 unless an invalid option is encountered, @@ -6472,7 +6727,7 @@ echoed and executed. In the second form, \fIcommand\fP is re-executed after each instance of \fIpat\fP is replaced by \fIrep\fP. A useful alias to use with this is -.if n ``r=fc -s'', +.if n ``r="fc -s"'', .if t \f(CWr='fc \-s'\fP, so that typing .if n ``r cc'' @@ -6688,7 +6943,13 @@ have been modified. An argument of .I n lists only the last .I n -lines. If \fIfilename\fP is supplied, it is used as the +lines. +If the shell variable \fBHISTTIMEFORMAT\fP is set and not null, +it is used as a format string for \fIstrftime\fP(3) to display +the time stamp associated with each displayed history entry. +No intervening blank is printed between the formatted time stamp +and the history line. +If \fIfilename\fP is supplied, it is used as the name of the history file; if not, the value of .SM .B HISTFILE @@ -6735,6 +6996,8 @@ history list is removed before the are added. .PD .PP +If the \fBHISTTIMEFORMAT\fP is set, the time stamp information +associated with each history entry is written to the history file. The return value is 0 unless an invalid option is encountered, an error occurs while reading or writing the history file, an invalid \fIoffset\fP is supplied as an argument to \fB\-d\fP, or the @@ -7101,7 +7364,7 @@ times out, or an invalid file descriptor is supplied as the argument to \fB\-u\fP. .RE .TP -\fBreadonly\fP [\fB\-apf\fP] [\fIname\fP ...] +\fBreadonly\fP [\fB\-apf\fP] [\fIname\fP[=\fIword\fP] ...] .PD The given \fInames\fP are marked readonly; the values of these @@ -7124,6 +7387,8 @@ The .B \-p option causes output to be displayed in a format that may be reused as input. +If a variable name is followed by =\fIword\fP, the value of +the variable is set to \fIword\fP. The return status is 0 unless an invalid option is encountered, one of the .I names @@ -7149,6 +7414,8 @@ or the exit status of the last command executed within the script as the exit status of the script. If used outside a function and not during execution of a script by \fB.\fP\^, the return status is false. +Any command associated with the \fBRETURN\fP trap is executed +before execution resumes after the function or script. .TP \fBset\fP [\fB\-\-abefhkmnptuvxBCHP\fP] [\fB\-o\fP \fIoption\fP] [\fIarg\fP ...] Without options, the name and value of each shell variable are displayed @@ -7178,13 +7445,14 @@ effective only when job control is enabled. Exit immediately if a \fIsimple command\fP (see .SM .B SHELL GRAMMAR -above) exits with a non-zero status. The shell does not exit if the -command that fails is part of an -.I until +above) exits with a non-zero status. +The shell does not exit if the +command that fails is part of the command list immediately following a +.B while or -.I while -loop, -part of an +.B until +keyword, +part of the test in an .I if statement, part of a .B && @@ -7241,6 +7509,14 @@ with the .B \-\-noediting option. .TP 8 +.B errtrace +Same as +.BR \-E . +.TP 8 +.B functrace +Same as +.BR \-T . +.TP 8 .B errexit Same as .BR \-e . @@ -7306,11 +7582,17 @@ Same as Same as .BR \-P . .TP 8 +.B pipefail +If set, the return value of a pipeline is the value of the last +(rightmost) command to exit with a non-zero status, or zero if all +commands in the pipeline exit successfully. +This option is disabled by default. +.TP 8 .B posix Change the behavior of .B bash where the default operation differs -from the POSIX 1003.2 standard to match the standard (\fIposix mode\fP). +from the POSIX 1003.2 standard to match the standard (\fI`posix mode\fP). .TP 8 .B privileged Same as @@ -7376,10 +7658,12 @@ Print shell input lines as they are read. .TP 8 .B \-x After expanding each \fIsimple command\fP, -display the expanded value of +\fBfor\fP command, \fBcase\fP command, \fBselect\fP command, or +arithmetic \fBfor\fP command, display the expanded value of .SM .BR PS4 , -followed by the command and its expanded arguments. +followed by the command and its expanded arguments +or associated word list. .TP 8 .B \-B The shell performs brace expansion (see @@ -7400,6 +7684,11 @@ creating output files by using the redirection operator instead of .BR > . .TP 8 +.B \-E +If set, any trap on \fBERR\fP is inherited by shell functions, command +substitutions, and commands executed in a subshell environment. +The \fBERR\fP trap is normally not inherited in such cases. +.TP 8 .B \-H Enable .B ! @@ -7416,6 +7705,11 @@ physical directory structure instead. By default, follows the logical chain of directories when performing commands which change the current directory. .TP 8 +.B \-T +If set, any trap on \fBDEBUG\fP is inherited by shell functions, command +substitutions, and commands executed in a subshell environment. +The \fBDEBUG\fP trap is normally not inherited in such cases. +.TP 8 .B \-\- If no arguments follow this option, then the positional parameters are unset. Otherwise, the positional parameters are set to the @@ -7576,10 +7870,53 @@ If set, aliases are expanded as described above under .BR ALIASES . This option is enabled by default for interactive shells. .TP 8 +.B extdebug +If set, behavior intended for use by debuggers is enabled: +.RS +.TP +.B 1. +The \fB\-F\fP option to the \fBdeclare\fP builtin displays the source +file name and line number corresponding to each function name supplied +as an argument. +.TP +.B 2. +If the command run by the \fBDEBUG\fP trap returns a non-zero value, the +next command is skipped and not executed. +.TP +.B 3. +If the command run by the \fBDEBUG\fP trap returns a value of 2, and the +shell is executing in a subroutine (a shell function or a shell script +executed by the \fB.\fP or \fBsource\fP builtins), a call to +\fBreturn\fP is simulated. +.RE +.TP 8 .B extglob If set, the extended pattern matching features described above under \fBPathname Expansion\fP are enabled. .TP 8 +.B extquote +If set, \fB$\fP'\fIstring\fP' and \fB$\fP"\fIstring\fP" quoting is +performed within \fB${\fP\fIparameter\fP\fB}\fP expansions +enclosed in double quotes. This option is enabled by default. +.TP 8 +.B failglob +If set, patterns which fail to match filenames during pathname expansion +result in an expansion error. +.TP 8 +.B force_fignore +If set, the suffixes specified by the \fBFIGNORE\fP shell variable +cause words to be ignored when performing word completion even if +the ignored words are the only possible completions. +See +.SM +\fBSHELL VARIABLES\fP +above for a description of \fBFIGNORE\fP. +This option is enabled by default. +.TP 8 +.B gnu_errfmt +If set, shell error messages are written in the standard GNU error +message format. +.TP 8 .B histappend If set, the history list is appended to the file named by the value of the @@ -7675,8 +8012,9 @@ If set, the programmable completion facilities (see This option is enabled by default. .TP 8 .B promptvars -If set, prompt strings undergo variable and parameter expansion after -being expanded as described in +If set, prompt strings undergo +parameter expansion, command substitution, arithmetic +expansion, and quote removal after being expanded as described in .SM .B PROMPTING above. This option is enabled by default. @@ -7848,6 +8186,10 @@ If no arguments are supplied or if only is given, .B trap prints the list of commands associated with each signal number. +The +.B \-l +option causes the shell to print a list of signal names and +their corresponding numbers. Each .I sigspec is either @@ -7867,10 +8209,14 @@ is .BR DEBUG , the command .I arg -is executed after every \fIsimple command\fP (see +is executed before every \fIsimple command\fP, \fIfor\fP command, +\fIcase\fP command, \fIselect\fP command, every arithmetic \fIfor\fP +command, and before the first command executes in a shell function (see .SM .B SHELL GRAMMAR above). +Refer to the description of the \fBextglob\fP option to the +\fBshopt\fP builtin for details of its effect on the \fBDEBUG\fP trap. If a .I sigspec is @@ -7881,13 +8227,14 @@ the command is executed whenever a simple command has a non\-zero exit status. The .SM -.BR ERR -trap is not executed if the failed command is part of an -.I until +.B ERR +trap is not executed if the failed +command is part of the command list immediately following a +.B while or -.I while -loop, -part of an +.B until +keyword, +part of the test in an .I if statement, part of a .B && @@ -7896,10 +8243,15 @@ or list, or if the command's return value is being inverted via .BR ! . -The -.B \-l -option causes the shell to print a list of signal names and -their corresponding numbers. +If a +.I sigspec +is +.SM +.BR RETURN , +the command +.I arg +is executed each time a shell function or a script executed with the +\fB.\fP or \fBsource\fP builtins finishes executing. Signals ignored upon entry to the shell cannot be trapped or reset. Trapped signals are reset to their original values in a child process when it is created. @@ -8142,7 +8494,7 @@ or are unset, they lose their special properties, even if they are subsequently reset. The exit status is true unless a .I name -does not exist or is readonly. +is readonly. .TP \fBwait\fP [\fIn\fP] Wait for the specified process and return its termination @@ -8287,15 +8639,16 @@ bfox@gnu.org .PP Chet Ramey, Case Western Reserve University .br -chet@ins.CWRU.Edu +chet@po.CWRU.Edu .SH BUG REPORTS If you find a bug in .B bash, you should report it. But first, you should make sure that it really is a bug, and that it appears in the latest version of -.B bash -that you have. +.BR bash . +The latest version is always available from +\fIftp://ftp.gnu.org/pub/bash/\fP. .PP Once you have determined that a bug actually exists, use the .I bashbug @@ -8327,7 +8680,7 @@ it provides for filing a bug report. .PP Comments and bug reports concerning this manual page should be directed to -.IR chet@ins.CWRU.Edu . +.IR chet@po.CWRU.Edu . .SH BUGS .PP It's too big and too slow. diff --git a/doc/bashref.info b/doc/bashref.info index 8f1b799c..349b559d 100644 --- a/doc/bashref.info +++ b/doc/bashref.info @@ -1,34 +1,35 @@ -This is bashref.info, produced by makeinfo version 4.1 from +This is bashref.info, produced by makeinfo version 4.5 from /usr/homes/chet/src/bash/src/doc/bashref.texi. -INFO-DIR-SECTION Utilities +This text is a brief description of the features that are present in +the Bash shell (version 3.0-alpha, 5 August 2003). + + This is Edition 3.0, last updated 5 August 2003, of `The GNU Bash +Reference Manual', for `Bash', Version 3.0-alpha. + + Copyright (C) 1988-2003 Free Software Foundation, Inc. + + Permission is granted to make and distribute verbatim copies of this +manual provided the copyright notice and this permission notice are +preserved on all copies. + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free Documentation License, + Version 1.1 or any later version published by the Free Software + Foundation; with no Invariant Sections, with the Front-Cover texts + being "A GNU Manual," and with the Back-Cover Texts as in (a) + below. A copy of the license is included in the section entitled + "GNU Free Documentation License." + + (a) The FSF's Back-Cover Text is: "You have freedom to copy and + modify this GNU Manual, like GNU software. Copies published by + the Free Software Foundation raise funds for GNU development." + +INFO-DIR-SECTION Basics START-INFO-DIR-ENTRY * Bash: (bash). The GNU Bourne-Again SHell. END-INFO-DIR-ENTRY -This text is a brief description of the features that are present in -the Bash shell. - -This is Edition 2.5b, last updated 15 July 2002, -of `The GNU Bash Reference Manual', -for `Bash', Version 2.05b. - -Copyright (C) 1991-2002 Free Software Foundation, Inc. - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided that the entire -resulting derived work is distributed under the terms of a permission -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 Free Software Foundation. - File: bashref.info, Node: Top, Next: Introduction, Prev: (dir), Up: (dir) @@ -36,12 +37,10 @@ Bash Features ************* This text is a brief description of the features that are present in -the Bash shell. - - This is Edition 2.5b, last updated 15 July 2002, of `The GNU Bash -Reference Manual', for `Bash', Version 2.05b. +the Bash shell (version 3.0-alpha, 5 August 2003).. - Copyright (C) 1991-2002 Free Software Foundation, Inc. + This is Edition 3.0, last updated 5 August 2003, of `The GNU Bash +Reference Manual', for `Bash', Version 3.0-alpha. Bash contains features that appear in other popular shells, and some features that only appear in Bash. Some of the shells that Bash has @@ -86,6 +85,8 @@ on shell behavior. between Bash and historical versions of /bin/sh. +* Copying This Manual:: Copying this manual. + * Builtin Index:: Index of Bash builtin commands. * Reserved Word Index:: Index of Bash reserved words. @@ -119,8 +120,8 @@ What is Bash? Bash is the shell, or command language interpreter, for the GNU operating system. The name is an acronym for the `Bourne-Again SHell', a pun on Stephen Bourne, the author of the direct ancestor of the -current Unix shell `/bin/sh', which appeared in the Seventh Edition -Bell Labs Research version of Unix. +current Unix shell `sh', which appeared in the Seventh Edition Bell +Labs Research version of Unix. Bash is largely compatible with `sh' and incorporates useful features from the Korn shell `ksh' and the C shell `csh'. It is @@ -132,7 +133,7 @@ improvements over `sh' for both interactive and programming use. version of `csh', Bash is the default shell. Like other GNU software, Bash is quite portable. It currently runs on nearly every version of Unix and a few other operating systems - independently-supported ports -exist for MS-DOS, OS/2, Windows 95/98, and Windows NT. +exist for MS-DOS, OS/2, and Windows platforms. File: bashref.info, Node: What is a shell?, Prev: What is Bash?, Up: Introduction @@ -141,12 +142,21 @@ What is a shell? ================ At its base, a shell is simply a macro processor that executes -commands. A Unix shell is both a command interpreter, which provides -the user interface to the rich set of GNU utilities, and a programming -language, allowing these utilitites to be combined. Files containing +commands. The term macro processor means functionality where text and +symbols are expanded to create larger expressions. + + A Unix shell is both a command interpreter and a programming +language. As a command interpreter, the shell provides the user +interface to the rich set of GNU utilities. The programming language +features allow these utilitites to be combined. Files containing commands can be created, and become commands themselves. These new commands have the same status as system commands in directories such as -`/bin', allowing users or groups to establish custom environments. +`/bin', allowing users or groups to establish custom environments to +automate their common tasks. + + Shells may be used interactively or non-interactively. In +interactive mode, they accept input typed from the keyboard. When +executing non-interactively, shells execute commands read from a file. A shell allows execution of GNU commands, both synchronously and asynchronously. The shell waits for synchronous commands to complete @@ -154,9 +164,7 @@ before accepting more input; asynchronous commands continue to execute in parallel with the shell while it reads and executes additional commands. The "redirection" constructs permit fine-grained control of the input and output of those commands. Moreover, the shell allows -control over the contents of commands' environments. Shells may be -used interactively or non-interactively: they accept input typed from -the keyboard or from a file. +control over the contents of commands' environments. Shells also provide a small set of built-in commands ("builtins") implementing functionality impossible or inconvenient to obtain via @@ -175,8 +183,8 @@ control constructs, quoting, and functions. Shells offer features geared specifically for interactive use rather than to augment the programming language. These interactive features -include job control, command line editing, history and aliases. Each -of these features is described in this manual. +include job control, command line editing, command history and aliases. +Each of these features is described in this manual. File: bashref.info, Node: Definitions, Next: Basic Shell Features, Prev: Introduction, Up: Top @@ -275,9 +283,9 @@ Basic Shell Features Bash is an acronym for `Bourne-Again SHell'. The Bourne shell is the traditional Unix shell originally written by Stephen Bourne. All -of the Bourne shell builtin commands are available in Bash, and the -rules for evaluation and quoting are taken from the POSIX 1003.2 -specification for the `standard' Unix shell. +of the Bourne shell builtin commands are available in Bash, The rules +for evaluation and quoting are taken from the POSIX specification for +the `standard' Unix shell. This chapter briefly summarizes the shell's `building blocks': commands, control structures, shell functions, shell parameters, shell @@ -289,8 +297,8 @@ from and to named files, and how the shell executes commands. * Shell Syntax:: What your input means to the shell. * Shell Commands:: The types of commands you can use. * Shell Functions:: Grouping commands by name. -* Shell Parameters:: Special shell variables. -* Shell Expansions:: How Bash expands variables and the various +* Shell Parameters:: How the shell stores values. +* Shell Expansions:: How Bash expands parameters and the various expansions available. * Redirections:: A way to control where input and output go. * Executing Commands:: What happens when you run a command. @@ -387,8 +395,10 @@ meaning to the shell and must be quoted if it is to represent itself. When the command history expansion facilities are being used, the HISTORY EXPANSION character, usually `!', must be quoted to prevent history expansion. *Note Bash History Facilities::, for more details -concerning history expansion. There are three quoting mechanisms: the -ESCAPE CHARACTER, single quotes, and double quotes. +concerning history expansion. + + There are three quoting mechanisms: the ESCAPE CHARACTER, single +quotes, and double quotes. File: bashref.info, Node: Escape Character, Next: Single Quotes, Up: Quoting @@ -428,7 +438,8 @@ characters: `$', ``', `"', `\', or `newline'. Within double quotes, backslashes that are followed by one of these characters are removed. Backslashes preceding characters without a special meaning are left unmodified. A double quote may be quoted within double quotes by -preceding it with a backslash. +preceding it with a backslash. When command history is being used, the +double quote may not be used to quote the history expansion character. The special parameters `*' and `@' have special meaning when in double quotes (*note Shell Parameter Expansion::). @@ -542,9 +553,7 @@ construct, or in some other grouping. * Pipelines:: Connecting the input and output of several commands. * Lists:: How to execute commands sequentially. -* Looping Constructs:: Shell commands for iterative action. -* Conditional Constructs:: Shell commands for conditional execution. -* Command Grouping:: Ways to group commands. +* Compound Commands:: Shell commands for control flow. File: bashref.info, Node: Simple Commands, Next: Pipelines, Up: Shell Commands @@ -598,7 +607,7 @@ exit status of the last command in the pipeline. If the reserved word the exit status of the last command. -File: bashref.info, Node: Lists, Next: Looping Constructs, Prev: Pipelines, Up: Shell Commands +File: bashref.info, Node: Lists, Next: Compound Commands, Prev: Pipelines, Up: Shell Commands Lists of Commands ----------------- @@ -642,10 +651,32 @@ status. command executed in the list. -File: bashref.info, Node: Looping Constructs, Next: Conditional Constructs, Prev: Lists, Up: Shell Commands +File: bashref.info, Node: Compound Commands, Prev: Lists, Up: Shell Commands + +Compound Commands +----------------- + +* Menu: + +* Looping Constructs:: Shell commands for iterative action. +* Conditional Constructs:: Shell commands for conditional execution. +* Command Grouping:: Ways to group commands. + + Compound commands are the shell programming constructs. Each +construct begins with a reserved word or control operator and is +terminated by a corresponding reserved word or operator. Any +redirections (*note Redirections::) associated with a compound command +apply to all commands within that compound command unless explicitly +overridden. + + Bash provides looping constructs, conditional commands, and +mechanisms to group commands and execute them as a unit. + + +File: bashref.info, Node: Looping Constructs, Next: Conditional Constructs, Up: Compound Commands Looping Constructs ------------------- +.................. Bash supports the following looping constructs. @@ -695,14 +726,15 @@ syntax, it may be replaced with one or more newlines. command in LIST that is executed, or false if any of the expressions is invalid. + The `break' and `continue' builtins (*note Bourne Shell Builtins::) may be used to control loop execution. -File: bashref.info, Node: Conditional Constructs, Next: Command Grouping, Prev: Looping Constructs, Up: Shell Commands +File: bashref.info, Node: Conditional Constructs, Next: Command Grouping, Prev: Looping Constructs, Up: Compound Commands Conditional Constructs ----------------------- +...................... `if' The syntax of the `if' command is: @@ -813,7 +845,8 @@ Conditional Constructs performed on the words between the `[[' and `]]'; tilde expansion, parameter and variable expansion, arithmetic expansion, command substitution, process substitution, and quote removal are - performed. + performed. Conditional operators such as `-f' must be unquoted to + be recognized as primaries. When the `==' and `!=' operators are used, the string to the right of the operator is considered a pattern and matched according to @@ -842,11 +875,12 @@ Conditional Constructs value of EXPRESSION1 is sufficient to determine the return value of the entire conditional expression. + -File: bashref.info, Node: Command Grouping, Prev: Conditional Constructs, Up: Shell Commands +File: bashref.info, Node: Command Grouping, Prev: Conditional Constructs, Up: Compound Commands Grouping Commands ------------------ +................. Bash provides two ways to group a list of commands to be executed as a unit. When commands are grouped, redirections may be applied to the @@ -857,9 +891,10 @@ the list may be redirected to a single stream. ( LIST ) Placing a list of commands between parentheses causes a subshell - to be created, and each of the commands in LIST to be executed in - that subshell. Since the LIST is executed in a subshell, variable - assignments do not remain in effect after the subshell completes. + environment to be created (*note Command Execution Environment::), + and each of the commands in LIST to be executed in that subshell. + Since the LIST is executed in a subshell, variable assignments do + not remain in effect after the subshell completes. `{}' { LIST; } @@ -892,41 +927,69 @@ name is executed. Shell functions are executed in the current shell context; no new process is created to interpret them. Functions are declared using this syntax: - [ `function' ] NAME () { COMMAND-LIST; } + [ `function' ] NAME () COMPOUND-COMMAND [ REDIRECTIONS ] This defines a shell function named NAME. The reserved word `function' is optional. If the `function' reserved word is supplied, -the parentheses are optional. The BODY of the function is the -COMMAND-LIST between { and }. This list is executed whenever NAME is -specified as the name of a command. The exit status of a function is -the exit status of the last command executed in the body. - - Note that for historical reasons, the curly braces that surround the -body of the function must be separated from the body by `blank's or -newlines. This is because the braces are reserved words and are only -recognized as such when they are separated by whitespace. Also, the -COMMAND-LIST must be terminated with a semicolon or a newline. +the parentheses are optional. The BODY of the function is the compound +command COMPOUND-COMMAND (*note Compound Commands::). That command is +usually a LIST enclosed between { and }, but may be any compound +command listed above. COMPOUND-COMMAND is executed whenever NAME is +specified as the name of a command. Any redirections (*note +Redirections::) associated with the shell function are performed when +the function is executed. + + The exit status of a function definition is zero unless a syntax +error occurs or a readonly function with the same name already exists. +When executed, the exit status of a function is the exit status of the +last command executed in the body. + + Note that for historical reasons, in the most common usage the curly +braces that surround the body of the function must be separated from +the body by `blank's or newlines. This is because the braces are +reserved words and are only recognized as such when they are separated +by whitespace. Also, when using the braces, the LIST must be +terminated by a semicolon, a `&', or a newline. When a function is executed, the arguments to the function become the positional parameters during its execution (*note Positional Parameters::). The special parameter `#' that expands to the number of positional parameters is updated to reflect the change. Positional -parameter `0' is unchanged. The `FUNCNAME' variable is set to the name -of the function while the function is executing. +parameter `0' is unchanged. The first element of the `FUNCNAME' +variable is set to the name of the function while the function is +executing. All other aspects of the shell execution environment are +identical between a function and its caller with the exception that the +`DEBUG' trap below) is not inherited unless the function has been given +the `trace' attribute using the `declare' builtin or the `-o functrace' +option has been enabled with the `set' builtin, (in which case all +functions inherit the `DEBUG' trap). *Note Bourne Shell Builtins::, +for the description of the `trap' builtin. If the builtin command `return' is executed in a function, the function completes and execution resumes with the next command after -the function call. When a function completes, the values of the -positional parameters and the special parameter `#' are restored to the -values they had prior to the function's execution. If a numeric -argument is given to `return', that is the function's return status; -otherwise the function's return status is the exit status of the last -command executed before the `return'. +the function call. Any command associated with the `RETURN' trap is +executed before execution resumes. When a function completes, the +values of the positional parameters and the special parameter `#' are +restored to the values they had prior to the function's execution. If +a numeric argument is given to `return', that is the function's return +status; otherwise the function's return status is the exit status of +the last command executed before the `return'. Variables local to the function may be declared with the `local' builtin. These variables are visible only to the function and the commands it invokes. + Function names and definitions may be listed with the `-f' option to +the `declare' or `typeset' builtin commands (*note Bash Builtins::). +The `-F' option to `declare' or `typeset' will list the function names +only (and optionally the source file and line number, if the `extdebug' +shell option is enabled). Functions may be exported so that subshells +automatically have them defined with the `-f' option to the `export' +builtin (*note Bourne Shell Builtins::). Note that shell functions and +variables with the same name may result in multiple identically-named +entries in the environment passed to the shell's children. Care should +be taken in cases where this may cause a problem. + Functions may be recursive. No limit is placed on the number of recursive calls. @@ -939,14 +1002,13 @@ Shell Parameters * Menu: * Positional Parameters:: The shell's command-line arguments. -* Special Parameters:: Parameters with special meanings. +* Special Parameters:: Parameters denoted by special characters. A PARAMETER is an entity that stores values. It can be a `name', a -number, or one of the special characters listed below. For the shell's -purposes, a VARIABLE is a parameter denoted by a `name'. A variable -has a VALUE and zero or more ATTRIBUTES. Attributes are assigned using -the `declare' builtin command (see the description of the `declare' -builtin in *Note Bash Builtins::). +number, or one of the special characters listed below. A VARIABLE is a +parameter denoted by a `name'. A variable has a VALUE and zero or more +ATTRIBUTES. Attributes are assigned using the `declare' builtin command +(see the description of the `declare' builtin in *Note Bash Builtins::). A parameter is set if it has been assigned a value. The null string is a valid value. Once a variable is set, it may be unset only by using @@ -959,12 +1021,12 @@ If VALUE is not given, the variable is assigned the null string. All VALUEs undergo tilde expansion, parameter and variable expansion, command substitution, arithmetic expansion, and quote removal (detailed below). If the variable has its `integer' attribute set, then VALUE is -subject to arithmetic expansion even if the `$((...))' expansion is not -used (*note Arithmetic Expansion::). Word splitting is not performed, -with the exception of `"$@"' as explained below. Filename expansion is -not performed. Assignment statements may also appear as arguments to -the `declare', `typeset', `export', `readonly', and `local' builtin -commands. +evaluated as an arithmetic expression even if the `$((...))' expansion +is not used (*note Arithmetic Expansion::). Word splitting is not +performed, with the exception of `"$@"' as explained below. Filename +expansion is not performed. Assignment statements may also appear as +arguments to the `declare', `typeset', `export', `readonly', and +`local' builtin commands. File: bashref.info, Node: Positional Parameters, Next: Special Parameters, Up: Shell Parameters @@ -1114,16 +1176,24 @@ Brace Expansion generated. This mechanism is similar to FILENAME EXPANSION (*note Filename Expansion::), but the file names generated need not exist. Patterns to be brace expanded take the form of an optional PREAMBLE, -followed by a series of comma-separated strings between a pair of -braces, followed by an optional POSTSCRIPT. The preamble is prefixed -to each string contained within the braces, and the postscript is then -appended to each resulting string, expanding left to right. +followed by either a series of comma-separated strings or a sequnce +expression between a pair of braces, followed by an optional POSTSCRIPT. +The preamble is prefixed to each string contained within the braces, and +the postscript is then appended to each resulting string, expanding left +to right. Brace expansions may be nested. The results of each expanded string are not sorted; left to right order is preserved. For example, bash$ echo a{d,c,b}e ade ace abe + A sequence expression takes the form `{X..Y}', where X and Y are +either integers or single characters. When integers are supplied, the +expression expands to each number between X and Y, inclusive. When +characters are supplied, the expression expands to each character +lexicographically between X and Y, inclusive. Note that both X and Y +must be of the same type. + Brace expansion is performed before any other expansions, and any characters special to other expansions are preserved in the result. It is strictly textual. Bash does not apply any syntactic interpretation @@ -1132,8 +1202,13 @@ avoid conflicts with parameter expansion, the string `${' is not considered eligible for brace expansion. A correctly-formed brace expansion must contain unquoted opening and -closing braces, and at least one unquoted comma. Any incorrectly -formed brace expansion is left unchanged. +closing braces, and at least one unquoted comma or a valid sequence +expression. Any incorrectly formed brace expansion is left unchanged. + + A { or `,' may be quoted with a backslash to prevent its being +considered part of a brace expression. To avoid conflicts with +parameter expansion, the string `${' is not considered eligible for +brace expansion. This construct is typically used as shorthand when the common prefix of the strings to be generated is longer than in the above example: @@ -1205,6 +1280,7 @@ the expanded value. `~-N' The string that would be displayed by `dirs -N' + File: bashref.info, Node: Shell Parameter Expansion, Next: Command Substitution, Prev: Tilde Expansion, Up: Shell Expansions @@ -1233,8 +1309,10 @@ of variable indirection is introduced. Bash uses the value of the variable formed from the rest of PARAMETER as the name of the variable; this variable is then expanded and that value is used in the rest of the substitution, rather than the value of PARAMETER itself. This is -known as `indirect expansion'. The exception to this is the expansion -of ${!PREFIX*} described below. +known as `indirect expansion'. The exceptions to this are the +expansions of ${!PREFIX*} and ${!NAME[@]} described below. The +exclamation point must immediately follow the left brace in order to +introduce indirection. In each of the cases below, WORD is subject to tilde expansion, parameter expansion, command substitution, and arithmetic expansion. @@ -1284,9 +1362,18 @@ if the colon is omitted, the operator tests only for existence. starts at 1. `${!PREFIX*}' +`${!PREFIX@}' Expands to the names of variables whose names begin with PREFIX, separated by the first character of the `IFS' special variable. +`${!NAME[@]}' +`${!NAME[*]}' + If NAME is an array variable, expands to the list of array indices + (keys) assigned in NAME. If NAME is not an array, expands to 0 if + NAME is set and null otherwise. When `@' is used and the + expansion appears within double quotes, each key expands to a + separate word. + `${#PARAMETER}' The length in characters of the expanded value of PARAMETER is substituted. If PARAMETER is `*' or `@', the value substituted is @@ -1340,6 +1427,7 @@ if the colon is omitted, the operator tests only for existence. member of the array in turn, and the expansion is the resultant list. + File: bashref.info, Node: Command Substitution, Next: Arithmetic Expansion, Prev: Shell Parameter Expansion, Up: Shell Expansions @@ -1387,8 +1475,7 @@ arithmetic expansion is: The expression is treated as if it were within double quotes, but a double quote inside the parentheses is not treated specially. All tokens in the expression undergo parameter expansion, command -substitution, and quote removal. Arithmetic substitutions may be -nested. +substitution, and quote removal. Arithmetic expansions may be nested. The evaluation is performed according to the rules listed below (*note Shell Arithmetic::). If the expression is invalid, Bash prints @@ -1485,12 +1572,12 @@ description of the `nocaseglob', `nullglob', and `dotglob' options. filenames matching a pattern. If `GLOBIGNORE' is set, each matching filename that also matches one of the patterns in `GLOBIGNORE' is removed from the list of matches. The filenames `.' and `..' are -always ignored, even when `GLOBIGNORE' is set. However, setting -`GLOBIGNORE' has the effect of enabling the `dotglob' shell option, so -all other filenames beginning with a `.' will match. To get the old -behavior of ignoring filenames beginning with a `.', make `.*' one of -the patterns in `GLOBIGNORE'. The `dotglob' option is disabled when -`GLOBIGNORE' is unset. +always ignored when `GLOBIGNORE' is set and not null. However, setting +`GLOBIGNORE' to a non-null value has the effect of enabling the +`dotglob' shell option, so all other filenames beginning with a `.' +will match. To get the old behavior of ignoring filenames beginning +with a `.', make `.*' one of the patterns in `GLOBIGNORE'. The +`dotglob' option is disabled when `GLOBIGNORE' is unset. File: bashref.info, Node: Pattern Matching, Up: Filename Expansion @@ -1500,8 +1587,10 @@ Pattern Matching Any character that appears in a pattern, other than the special pattern characters described below, matches itself. The NUL character -may not occur in a pattern. The special pattern characters must be -quoted if they are to be matched literally. +may not occur in a pattern. A backslash escapes the following +character; the escaping backslash is discarded when matching. The +special pattern characters must be quoted if they are to be matched +literally. The special pattern characters have the following meanings: `*' @@ -1643,6 +1732,7 @@ redirections, as described in the following table: integer port number or service name, Bash attempts to open a UDP connection to the corresponding socket. + A failure to open or create a file causes the redirection to fail. Redirecting Input @@ -1948,8 +2038,9 @@ inherited from the shell. * the file creation mode mask - * shell variables marked for export, along with variables exported - for the command, passed in the environment (*note Environment::) + * shell variables and functions marked for export, along with + variables exported for the command, passed in the environment + (*note Environment::) * traps caught by the shell are reset to the values inherited from the shell's parent, and traps ignored by the shell are ignored @@ -1958,13 +2049,13 @@ inherited from the shell. A command invoked in this separate environment cannot affect the shell's execution environment. - Command substitution and asynchronous commands are invoked in a -subshell environment that is a duplicate of the shell environment, -except that traps caught by the shell are reset to the values that the -shell inherited from its parent at invocation. Builtin commands that -are invoked as part of a pipeline are also executed in a subshell -environment. Changes made to the subshell environment cannot affect -the shell's execution environment. + Command substitution, commands grouped with parentheses, and +asynchronous commands are invoked in a subshell environment that is a +duplicate of the shell environment, except that traps caught by the +shell are reset to the values that the shell inherited from its parent +at invocation. Builtin commands that are invoked as part of a pipeline +are also executed in a subshell environment. Changes made to the +subshell environment cannot affect the shell's execution environment. If a command is followed by a `&' and job control is not active, the default standard input for the command is the empty file `/dev/null'. @@ -2206,11 +2297,19 @@ standard. Change the current working directory to DIRECTORY. If DIRECTORY is not given, the value of the `HOME' shell variable is used. If the shell variable `CDPATH' exists, it is used as a search path. - If DIRECTORY begins with a slash, `CDPATH' is not used. The `-P' - option means to not follow symbolic links; symbolic links are - followed by default or with the `-L' option. If DIRECTORY is `-', - it is equivalent to `$OLDPWD'. The return status is zero if the - directory is successfully changed, non-zero otherwise. + If DIRECTORY begins with a slash, `CDPATH' is not used. + + The `-P' option means to not follow symbolic links; symbolic links + are followed by default or with the `-L' option. If DIRECTORY is + `-', it is equivalent to `$OLDPWD'. + + If a non-empty directory name from `CDPATH' is used, or if `-' is + the first argument, and the directory change is successful, the + absolute pathname of the new working directory is written to the + standard output. + + The return status is zero if the directory is successfully changed, + non-zero otherwise. `continue' continue [N] @@ -2253,10 +2352,12 @@ standard. option means to no longer mark each NAME for export. If no NAMES are supplied, or if the `-p' option is given, a list of exported names is displayed. The `-p' option displays output in a form - that may be reused as input. The return status is zero unless an - invalid option is supplied, one of the names is not a valid shell - variable name, or `-f' is supplied with a name that is not a shell - function. + that may be reused as input. If a variable name is followed by + =VALUE, the value of the variable is set to VALUE. + + The return status is zero unless an invalid option is supplied, + one of the names is not a valid shell variable name, or `-f' is + supplied with a name that is not a shell function. `getopts' getopts OPTSTRING NAME [ARGS] @@ -2328,17 +2429,19 @@ standard. current directory or an invalid option is supplied. `readonly' - readonly [-apf] [NAME] ... + readonly [-apf] [NAME[=VALUE]] ... Mark each NAME as readonly. The values of these names may not be changed by subsequent assignment. If the `-f' option is supplied, each NAME refers to a shell function. The `-a' option means each NAME refers to an array variable. If no NAME arguments are given, or if the `-p' option is supplied, a list of all readonly names is printed. The `-p' option causes output to be displayed in a - format that may be reused as input. The return status is zero - unless an invalid option is supplied, one of the NAME arguments is - not a valid shell variable or function name, or the `-f' option is - supplied with a name that is not a shell function. + format that may be reused as input. If a variable name is + followed by =VALUE, the value of the variable is set to VALUE. + The return status is zero unless an invalid option is supplied, + one of the NAME arguments is not a valid shell variable or + function name, or the `-f' option is supplied with a name that is + not a shell function. `return' return [N] @@ -2348,9 +2451,10 @@ standard. terminate execution of a script being executed with the `.' (or `source') builtin, returning either N or the exit status of the last command executed within the script as the exit status of the - script. The return status is non-zero if `return' is used outside - a function and not during the execution of a script by `.' or - `source'. + script. Any command associated with the `RETURN' trap is executed + before execution resumes after the function or script. The return + status is non-zero if `return' is used outside a function and not + during the execution of a script by `.' or `source'. `shift' shift [N] @@ -2444,18 +2548,27 @@ standard. displays the trap commands associated with each SIGSPEC. If no arguments are supplied, or only `-p' is given, `trap' prints the list of commands associated with each signal number in a form that - may be reused as shell input. Each SIGSPEC is either a signal - name such as `SIGINT' (with or without the `SIG' prefix) or a - signal number. If a SIGSPEC is `0' or `EXIT', ARG is executed - when the shell exits. If a SIGSPEC is `DEBUG', the command ARG is - executed after every simple command. If a SIGSPEC is `ERR', the - command ARG is executed whenever a simple command has a non-zero - exit status. The `ERR' trap is not executed if the failed command - is part of an `until' or `while' loop, part of an `if' statement, - part of a `&&' or `||' list, or if the command's return status is - being inverted using `!'. The `-l' option causes the shell to + may be reused as shell input. The `-l' option causes the shell to print a list of signal names and their corresponding numbers. + Each SIGSPEC is either a signal name such as `SIGINT' (with or + without the `SIG' prefix) or a signal number. If a SIGSPEC is `0' + or `EXIT', ARG is executed when the shell exits. If a SIGSPEC is + `DEBUG', the command ARG is executed before every simple command, + `for' command, `case' command, `select' command, every arithmetic + `for' command, and before the first command executes in a shell + function. Refer to the description of the `extglob' option to the + `shopt' builtin (*note Bash Builtins::) for details of its effect + on the `DEBUG' trap. If a SIGSPEC is `ERR', the command ARG is + executed whenever a simple command has a non-zero exit status. + The `ERR' trap is not executed if the failed command is part of the + command list immediately following an `until' or `while' keyword, + part of the test in an `if' statement, part of a `&&' or `||' + list, or if the command's return status is being inverted using + `!'. If a SIGSPEC is `RETURN', the command ARG is executed each + time a shell function or a script executed with the `.' or + `source' builtins finishes executing. + Signals ignored upon entry to the shell cannot be trapped or reset. Trapped signals are reset to their original values in a child process when it is created. @@ -2487,7 +2600,7 @@ standard. variable. If the `-f' option is given, the NAMEs refer to shell functions, and the function definition is removed. Readonly variables and functions may not be unset. The return status is - zero unless a NAME does not exist or is readonly. + zero unless a NAME is readonly. File: bashref.info, Node: Bash Builtins, Next: The Set Builtin, Prev: Bourne Shell Builtins, Up: Shell Builtin Commands @@ -2576,6 +2689,7 @@ POSIX 1003.2 standard. `-x KEYSEQ:SHELL-COMMAND' Cause SHELL-COMMAND to be executed whenever KEYSEQ is entered. + The return status is zero unless an invalid option is supplied or an error occurs. @@ -2587,6 +2701,23 @@ POSIX 1003.2 standard. within the function. The return status is non-zero if SHELL-BUILTIN is not a shell builtin command. +`caller' + caller [EXPR] + Returns the context of any active subroutine call (a shell + function or a script executed with the `.' or `source' builtins. + + Without EXPR, `caller' displays the line number and source + filename of the current subroutine call. If a non-negative + integer is supplied as EXPR, `caller' displays the line number, + subroutine name, and source file corresponding to that position in + the current execution call stack. This extra information may be + used, for example, to print a stack trace. The current frame is + frame 0. + + The return value is 0 unless the shell is not executing a + subroutine call or EXPR does not correspond to a valid position in + the call stack. + `command' command [-pVv] COMMAND [ARGUMENTS ...] Runs COMMAND with ARGUMENTS ignoring any shell function named @@ -2607,7 +2738,7 @@ POSIX 1003.2 standard. non-zero if not. `declare' - declare [-afFirtx] [-p] [NAME[=VALUE]] + declare [-afFirtx] [-p] [NAME[=VALUE] ...] Declare variables and give them attributes. If no NAMEs are given, then display the values of variables instead. @@ -2615,9 +2746,12 @@ POSIX 1003.2 standard. The `-p' option will display the attributes and values of each NAME. When `-p' is used, additional options are ignored. The `-F' option inhibits the display of function definitions; only the - function name and attributes are printed. `-F' implies `-f'. The - following options can be used to restrict output to variables with - the specified attributes or to give variables attributes: + function name and attributes are printed. If the `extdebug' shell + option is enabled using `shopt' (*note Bash Builtins::), the + source file name and line number where the function is defined are + displayed as well. `-F' implies `-f'. The following options can + be used to restrict output to variables with the specified + attributes or to give variables attributes: `-a' Each NAME is an array variable (*note Arrays::). @@ -2645,7 +2779,8 @@ POSIX 1003.2 standard. Using `+' instead of `-' turns off the attribute instead. When used in a function, `declare' makes each NAME local, as with the - `local' command. + `local' command. If a variable name is followed by =VALUE, the + value of the variable is set to VALUE. The return status is zero unless an invalid option is encountered, an attempt is made to define a function using `-f foo=bar', an @@ -2755,7 +2890,7 @@ POSIX 1003.2 standard. evaluates to 0, `let' returns 1; otherwise 0 is returned. `local' - local [OPTION] NAME[=VALUE] + local [OPTION] NAME[=VALUE] ... For each argument, a local variable named NAME is created, and assigned VALUE. The OPTION can be any of the options accepted by `declare'. `local' can only be used within a function; it makes @@ -2848,6 +2983,7 @@ POSIX 1003.2 standard. `-u FD' Read input from file descriptor FD. + `shopt' shopt [-pqsu] [-o] [OPTNAME ...] Toggle the values of variables controlling optional shell behavior. @@ -2927,10 +3063,43 @@ POSIX 1003.2 standard. *Note Aliases::. This option is enabled by default for interactive shells. + `extdebug' + If set, behavior intended for use by debuggers is enabled: + + 1. The `-F' option to the `declare' builtin (*note Bash + Builtins::) displays the source file name and line + number corresponding to each function name supplied as + an argument. + + 2. If the command run by the `DEBUG' trap returns a + non-zero value, the next command is skipped and not + executed. + + 3. If the command run by the `DEBUG' trap returns a value + of 2, and the shell is executing in a subroutine (a + shell function or a shell script executed by the `.' or + `source' builtins), a call to `return' is simulated. + `extglob' If set, the extended pattern matching features described above (*note Pattern Matching::) are enabled. + `extquote' + If set, `$'STRING'' and `$"STRING"' quoting is performed + within `${PARAMETER}' expansions enclosed in double quotes. + This option is enabled by default. + + `force_fignore' + If set, the suffixes specified by the `FIGNORE' shell variable + cause words to be ignored when performing word completion + even if the ignored words are the only possible completions. + *Note Bash Variables::, for a description of `FIGNORE'. This + option is enabled by default. + + `gnu_errfmt' + If set, shell error messages are written in the standard GNU + error message format. + `histappend' If set, the history list is appended to the file named by the value of the `HISTFILE' variable when the shell exits, rather @@ -2994,8 +3163,9 @@ POSIX 1003.2 standard. enabled by default. `promptvars' - If set, prompt strings undergo variable and parameter - expansion after being expanded (*note Printing a Prompt::). + If set, prompt strings undergo parameter expansion, command + substitution, arithmetic expansion, and quote removal after + being expanded as described below (*note Printing a Prompt::). This option is enabled by default. `restricted_shell' @@ -3019,6 +3189,7 @@ POSIX 1003.2 standard. If set, the `echo' builtin expands backslash-escape sequences by default. + The return status when listing options is zero if all OPTNAMES are enabled, non-zero otherwise. When setting or unsetting options, the return status is zero unless an OPTNAME is not a valid shell @@ -3060,7 +3231,7 @@ POSIX 1003.2 standard. if none are found. `typeset' - typeset [-afFrxi] [-p] [NAME[=VALUE]] + typeset [-afFrxi] [-p] [NAME[=VALUE] ...] The `typeset' command is supplied for compatibility with the Korn shell; however, it has been deprecated in favor of the `declare' builtin command. @@ -3112,6 +3283,7 @@ POSIX 1003.2 standard. `-v' The maximum amount of virtual memory available to the process. + If LIMIT is given, it is the new value of the specified resource; the special LIMIT values `hard', `soft', and `unlimited' stand for the current hard limit, the current soft limit, and no limit, @@ -3132,6 +3304,7 @@ POSIX 1003.2 standard. Remove each NAME from the list of aliases. If `-a' is supplied, all aliases are removed. Aliases are described in *Note Aliases::. + File: bashref.info, Node: The Set Builtin, Next: Special Builtins, Prev: Bash Builtins, Up: Shell Builtin Commands @@ -3162,10 +3335,11 @@ The Set Builtin `-e' Exit immediately if a simple command (*note Simple Commands::) exits with a non-zero status, unless the command - that fails is part of an `until' or `while' loop, part of an - `if' statement, part of a `&&' or `||' list, or if the - command's return status is being inverted using `!'. A trap - on `ERR', if set, is executed before the shell exits. + that fails is part of the command list immediately following + a `while' or `until' keyword, part of the test in an `if' + statement, part of a `&&' or `||' list, or if the command's + return status is being inverted using `!'. A trap on `ERR', + if set, is executed before the shell exits. `-f' Disable file name generation (globbing). @@ -3203,6 +3377,12 @@ The Set Builtin `errexit' Same as `-e'. + `errtrace' + Same as `-E'. + + `functrace' + Same as `-T'. + `hashall' Same as `-h'. @@ -3290,8 +3470,13 @@ The Set Builtin Print shell input lines as they are read. `-x' - Print a trace of simple commands and their arguments after - they are expanded and before they are executed. + Print a trace of simple commands, \fBfor\fP commands, + \fBcase\fP commands, \fBselect\fP commands, and arithmetic + \fBfor\fP commands and their arguments or associated word + lists after they are expanded and before they are executed. + The value of the `PS4' variable is expanded and the resultant + value is printed before the command and its expanded + arguments. `-B' The shell will perform brace expansion (*note Brace @@ -3301,6 +3486,12 @@ The Set Builtin Prevent output redirection using `>', `>&', and `<>' from overwriting existing files. + `-E' + If set, any trap on `ERR' is inherited by shell functions, + command substitutions, and commands executed in a subshell + environment. The `ERR' trap is normally not inherited in + such cases. + `-H' Enable `!' style history substitution (*note History Interaction::). This option is on by default for interactive @@ -3326,6 +3517,12 @@ The Set Builtin $ cd ..; pwd /usr/local + `-T' + If set, any trap on `DEBUG' is inherited by shell functions, + command substitutions, and commands executed in a subshell + environment. The `DEBUG' trap is normally not inherited in + such cases. + `--' If no arguments follow this option, then the positional parameters are unset. Otherwise, the positional parameters @@ -3436,7 +3633,9 @@ shell. In some cases, Bash assigns a default value to the variable. `PATH' A colon-separated list of directories in which the shell looks for - commands. + commands. A zero-length (null) directory name in the value of + `PATH' indicates the current directory. A null directory name may + appear as two adjacent colons, or as an initial or trailing colon. `PS1' The primary prompt string. The default value is `\s-\v\$ '. @@ -3446,6 +3645,7 @@ shell. In some cases, Bash assigns a default value to the variable. `PS2' The secondary prompt string. The default value is `> '. + File: bashref.info, Node: Bash Variables, Prev: Bourne Shell Variables, Up: Shell Variables @@ -3462,14 +3662,50 @@ Variables::). `BASH' The full pathname used to execute the current instance of Bash. +`BASH_ARGC' + An array variable whose values are the number of parameters in each + frame of the current bash execution call stack. The number of + parameters to the current subroutine (shell function or script + executed with `.' or `source') is at the top of the stack. When a + subroutine is executed, the number of parameters passed is pushed + onto `BASH_ARGC'. + +`BASH_ARGV' + An array variable containing all of the parameters in the current + bash execution call stack. The final parameter of the last + subroutine call is at the top of the stack; the first parameter of + the initial call is at the bottom. When a subroutine is executed, + the parameters supplied are pushed onto `BASH_ARGV'. + +`BASH_COMMAND' + The command currently being executed or about to be executed, + unless the shell is executing a command as the result of a trap, + in which case it is the command executing at the time of the trap. + `BASH_ENV' If this variable is set when Bash is invoked to execute a shell script, its value is expanded and used as the name of a startup file to read before executing the script. *Note Bash Startup Files::. -`BASH_VERSION' - The version number of the current instance of Bash. +`BASH_EXECUTION_STRING' + The command argument to the `-c' invocation option. + +`BASH_LINENO' + An array variable whose members are the line numbers in source + files corresponding to each member of FUNCNAME. + `${BASH_LINENO[$i]}' is the line number in the source file where + `${FUNCNAME[$i + 1]}' was called. The corresponding source file + name is `${BASH_SOURCE[$i + 1]}'. Use `LINENO' to obtain the + current line number. + +`BASH_SOURCE' + An array variable whose members are the source filenames + corresponding to the elements in the `FUNCNAME' array variable. + +`BASH_SUBSHELL' + Incremented by one each time a subshell or subshell environment is + spawned. The initial value is 0. `BASH_VERSINFO' A readonly array variable (*note Arrays::) whose members hold @@ -3494,6 +3730,10 @@ Variables::). `BASH_VERSINFO[5]' The value of `MACHTYPE'. + +`BASH_VERSION' + The version number of the current instance of Bash. + `COLUMNS' Used by the `select' builtin command to determine the terminal width when printing selection lists. Automatically set upon @@ -3518,6 +3758,12 @@ Variables::). functions and external commands invoked by the programmable completion facilities (*note Programmable Completion::). +`COMP_WORDBREAKS' + The set of characters that the Readline library treats as word + separators when performing word completion. If `COMP_WORDBREAKS' + is unset, it loses its special properties, even if it is + subsequently reset. + `COMP_WORDS' An array variable consisting of the individual words in the current command line. This variable is available only in shell @@ -3539,6 +3785,11 @@ Variables::). the current directory. If `DIRSTACK' is unset, it loses its special properties, even if it is subsequently reset. +`EMACS' + If Bash finds this variable in the environment when the shell + starts with value `t', it assumes that the shell is running in an + emacs shell buffer and disables line editing. + `EUID' The numeric effective user id of the current user. This variable is readonly. @@ -3554,11 +3805,13 @@ Variables::). names. A sample value is `.o:~' `FUNCNAME' - The name of any currently-executing shell function. This variable - exists only when a shell function is executing. Assignments to - `FUNCNAME' have no effect and return an error status. If - `FUNCNAME' is unset, it loses its special properties, even if it - is subsequently reset. + An array variable containing the names of all shell functions + currently in the execution call stack. The element with index 0 + is the name of any currently-executing shell function. The + bottom-most element is "main". This variable exists only when a + shell function is executing. Assignments to `FUNCNAME' have no + effect and return an error status. If `FUNCNAME' is unset, it + loses its special properties, even if it is subsequently reset. `GLOBIGNORE' A colon-separated list of patterns defining the set of filenames to @@ -3593,14 +3846,20 @@ Variables::). even if it is subsequently reset. `HISTCONTROL' - A value of `ignorespace' means to not enter lines which begin with - a space or tab into the history list. A value of `ignoredups' - means to not enter lines which match the last entered line. A - value of `ignoreboth' combines the two options. Unset, or set to - any other value than those above, means to save all lines on the - history list. The second and subsequent lines of a multi-line - compound command are not tested, and are added to the history - regardless of the value of `HISTCONTROL'. + A colon-separated list of values controlling how commands are + saved on the history list. If the list of values includes + `ignorespace', lines which begin with a space character are not + saved in the history list. A value of `ignoredups' causes lines + which match the previous history entry to not be saved. A value + of `ignoreboth' is shorthand for `ignorespace' and `ignoredups'. + A value of `erasedups' causes all previous lines matching the + current line to be removed from the history list before that line + is saved. Any value not in the above list is ignored. If + `HISTCONTROL' is unset, or does not include a valid value, all + lines read by the shell parser are saved on the history list, + subject to the value of `HISTIGNORE'. The second and subsequent + lines of a multi-line compound command are not tested, and are + added to the history regardless of the value of `HISTCONTROL'. `HISTFILE' The name of the file to which the command history is saved. The @@ -3636,6 +3895,13 @@ Variables::). The maximum number of commands to remember on the history list. The default value is 500. +`HISTTIMEFORMAT' + If this variable is set and not null, its value is used as a + format string for STRFTIME to print the time stamp associated with + each history entry displayed by the `history' builtin. If this + variable is set, time stamps are written to the history file so + they may be preserved across shell sessions. + `HOSTFILE' Contains the name of a file in the same format as `/etc/hosts' that should be read when the shell needs to complete a hostname. The @@ -3845,6 +4111,7 @@ Variables::). The numeric real user id of the current user. This variable is readonly. + File: bashref.info, Node: Bash Features, Next: Job Control, Prev: Shell Variables, Up: Top @@ -3885,6 +4152,13 @@ Invoking Bash that you can use. These options must appear on the command line before the single-character options to be recognized. +`--debugger' + Arrange for the debugger profile to be executed before the shell + starts. Turns on extended debugging mode (see *Note Bash + Builtins:: for a description of the `extdebug' option to the + `shopt' builtin) and shell function tracing (see *Note The Set + Builtin:: for a description of the `-o functrace' option). + `--dump-po-strings' A list of all double-quoted strings preceded by `$' is printed on the standard ouput in the GNU `gettext' PO (portable object) file @@ -3935,6 +4209,7 @@ the single-character options to be recognized. Show version information for this instance of Bash on the standard output and exit successfully. + There are several single-character options that may be supplied at invocation which are not available with the `set' builtin. @@ -3986,6 +4261,7 @@ invocation which are not available with the `set' builtin. processing. Any arguments after the `--' are treated as filenames and arguments. + A _login_ shell is one whose first character of argument zero is `-', or one invoked with the `--login' option. @@ -4377,6 +4653,7 @@ checked. If the FILE argument to one of the primaries is one of greater than or equal to ARG2, respectively. ARG1 and ARG2 may be positive or negative integers. + File: bashref.info, Node: Shell Arithmetic, Next: Aliases, Prev: Bash Conditional Expressions, Up: Bash Features @@ -4384,14 +4661,15 @@ Shell Arithmetic ================ The shell allows arithmetic expressions to be evaluated, as one of -the shell expansions or by the `let' builtin. +the shell expansions or by the `let' and the `-i' option to the +`declare' builtins. Evaluation is done in fixed-width integers with no check for overflow, though division by 0 is trapped and flagged as an error. The -operators and their precedence and associativity are the same as in the -C language. The following list of operators is grouped into levels of -equal-precedence operators. The levels are listed in order of -decreasing precedence. +operators and their precedence, associativity, and values are the same +as in the C language. The following list of operators is grouped into +levels of equal-precedence operators. The levels are listed in order +of decreasing precedence. `ID++ ID--' variable post-increment and post-decrement @@ -4439,7 +4717,7 @@ decreasing precedence. logical OR `expr ? expr : expr' - conditional evaluation + conditional operator `= *= /= %= += -= <<= >>= &= ^= |=' assignment @@ -4450,9 +4728,13 @@ decreasing precedence. Shell variables are allowed as operands; parameter expansion is performed before the expression is evaluated. Within an expression, shell variables may also be referenced by name without using the -parameter expansion syntax. The value of a variable is evaluated as an -arithmetic expression when it is referenced. A shell variable need not -have its integer attribute turned on to be used in an expression. +parameter expansion syntax. A shell variable that is null or unset +evaluates to 0 when referenced by name without using the parameter +expansion syntax. The value of a variable is evaluated as an +arithmetic expression when it is referenced, or when a variable which +has been given the INTEGER attribute using `declare -i' is assigned a +value. A null value evaluates to 0. A shell variable need not have +its integer attribute turned on to be used in an expression. Constants with a leading 0 are interpreted as octal numbers. A leading `0x' or `0X' denotes hexadecimal. Otherwise, numbers take the @@ -4688,6 +4970,7 @@ Directory Stack Builtins Makes the current working directory be the top of the stack, and then executes the equivalent of ``cd' DIR'. `cd's to DIR. + File: bashref.info, Node: Printing a Prompt, Next: The Restricted Shell, Prev: The Directory Stack, Up: Bash Features @@ -4883,20 +5166,20 @@ startup files. performed on the values of `PS1' and `PS2' regardless of the setting of the `promptvars' option. - 6. Interactive comments are enabled by default. (Bash has them on by - default anyway.) - - 7. The POSIX 1003.2 startup files are executed (`$ENV') rather than + 6. The POSIX 1003.2 startup files are executed (`$ENV') rather than the normal Bash files. - 8. Tilde expansion is only performed on assignments preceding a + 7. Tilde expansion is only performed on assignments preceding a command name, rather than on all assignment statements on the line. - 9. The default history file is `~/.sh_history' (this is the default + 8. The default history file is `~/.sh_history' (this is the default value of `$HISTFILE'). - 10. The output of `kill -l' prints all the signal names on a single - line, separated by spaces. + 9. The output of `kill -l' prints all the signal names on a single + line, separated by spaces, without the `SIG' prefix. + + 10. The `kill' builtin does not accept signal names with a `SIG' + prefix. 11. Non-interactive shells exit if FILENAME in `.' FILENAME is not found. @@ -4957,23 +5240,33 @@ startup files. 26. The `trap' builtin displays signal names without the leading `SIG'. - 27. The `.' and `source' builtins do not search the current directory + 27. The `trap' builtin doesn't check the first argument for a possible + signal specification and revert the signal handling to the original + disposition if it is. If users want to reset the handler for a + given signal to the original disposition, they should use `-' as + the first argument. + + 28. The `.' and `source' builtins do not search the current directory for the filename argument if it is not found by searching `PATH'. - 28. Subshells spawned to execute command substitutions inherit the + 29. Subshells spawned to execute command substitutions inherit the value of the `-e' option from the parent shell. When not in POSIX mode, Bash clears the `-e' option in such subshells. - 29. Alias expansion is always enabled, even in non-interactive shells. + 30. Alias expansion is always enabled, even in non-interactive shells. - 30. When the `set' builtin is invoked without options, it does not + 31. When the `alias' builtin displays alias definitions, it does not + display them with a leading `alias ' unless the `-p' option is + supplied. + + 32. When the `set' builtin is invoked without options, it does not display shell function names and definitions. - 31. When the `set' builtin is invoked without options, it displays + 33. When the `set' builtin is invoked without options, it displays variable values without quotes, unless they contain shell metacharacters, even if the result contains nonprinting characters. - 32. When the `cd' builtin is invoked in LOGICAL mode, and the pathname + 34. When the `cd' builtin is invoked in LOGICAL mode, and the pathname constructed from `$PWD' and the directory name supplied as an argument does not refer to an existing directory, `cd' will fail instead of falling back to PHYSICAL mode. @@ -5193,6 +5486,7 @@ Job Control Builtins signal. The `-f' option means to suspend even if the shell is a login shell. + When job control is not active, the `kill' and `wait' builtins do not accept JOBSPEC arguments. They must be supplied process IDs. @@ -5219,6 +5513,7 @@ Job Control Variables a prefix of a stopped job's name; this provides functionality analogous to the `%' job ID. + File: bashref.info, Node: Command Line Editing, Next: Installing Bash, Prev: Using History Interactively, Up: Top @@ -5425,6 +5720,7 @@ available to be yanked back later, when you are typing another line. Kill from the cursor to the previous whitespace. This is different than `M-<DEL>' because the word boundaries differ. + Here is how to "yank" the text back into the line. Yanking means to copy the most-recently-killed text from the kill buffer. @@ -5579,12 +5875,12 @@ Variable Settings `completion-query-items' The number of possible completions that determines when the - user is asked whether he wants to see the list of - possibilities. If the number of possible completions is - greater than this value, Readline will ask the user whether - or not he wishes to view them; otherwise, they are simply - listed. This variable must be set to an integer value - greater than or equal to 0. The default limit is `100'. + user is asked whether the list of possibilities should be + displayed. If the number of possible completions is greater + than this value, Readline will ask the user whether or not he + wishes to view them; otherwise, they are simply listed. This + variable must be set to an integer value greater than or + equal to 0. The default limit is `100'. `convert-meta' If set to `on', Readline will convert characters with the @@ -5613,7 +5909,7 @@ Variable Settings attempts word completion. The default is `off'. If set to `on', the history code attempts to place point at - the same location on each history line retrived with + the same location on each history line retrieved with `previous-history' or `next-history'. `horizontal-scroll-mode' @@ -5688,11 +5984,21 @@ Variable Settings completion cause the matches to be listed immediately instead of ringing the bell. The default value is `off'. + `show-all-if-unmodified' + This alters the default behavior of the completion functions + in a fashion similar to SHOW-ALL-IF-AMBIGUOUS. If set to + `on', words which have more than one possible completion + without any possible partial completion (the possible + completions don't share a common prefix) cause the matches to + be listed immediately instead of ringing the bell. The + default value is `off'. + `visible-stats' If set to `on', a character denoting a file's type is appended to the filename when listing possible completions. The default is `off'. + Key Bindings The syntax for controlling key bindings in the init file is simple. First you need to find the name of the command that you @@ -5747,6 +6053,7 @@ Key Bindings `<ESC> <[> <1> <1> <~>' is bound to insert the text `Function Key 1'. + The following GNU Emacs style escape sequences are available when specifying key sequences: @@ -5812,6 +6119,7 @@ Key Bindings the line: "\C-x\\": "\\" + File: bashref.info, Node: Conditional Init Constructs, Next: Sample Init File, Prev: Readline Init File Syntax, Up: Readline Init File @@ -6043,6 +6351,7 @@ Commands For Moving `redraw-current-line ()' Refresh the current line. By default, this is unbound. + File: bashref.info, Node: Commands For History, Next: Commands For Text, Prev: Commands For Moving, Up: Bindable Readline Commands @@ -6113,6 +6422,7 @@ Commands For Manipulating The History through the history list, inserting the last argument of each line in turn. + File: bashref.info, Node: Commands For Text, Next: Commands For Killing, Prev: Commands For History, Up: Bindable Readline Commands @@ -6177,6 +6487,7 @@ Commands For Changing Text By default, this command is unbound. + File: bashref.info, Node: Commands For Killing, Next: Numeric Arguments, Prev: Commands For Text, Up: Bindable Readline Commands @@ -6352,6 +6663,7 @@ Letting Readline Type For You completions enclosed within braces so the list is available to the shell (*note Brace Expansion::). + File: bashref.info, Node: Keyboard Macros, Next: Miscellaneous Commands, Prev: Commands For Completion, Up: Bindable Readline Commands @@ -6369,6 +6681,7 @@ Keyboard Macros Re-execute the last keyboard macro defined, by making the characters in the macro appear as if typed at the keyboard. + File: bashref.info, Node: Miscellaneous Commands, Prev: Keyboard Macros, Up: Bindable Readline Commands @@ -6503,6 +6816,7 @@ Some Miscellaneous Commands result as shell commands. Bash attempts to invoke `$FCEDIT', `$EDITOR', and `emacs' as the editor, in that order. + File: bashref.info, Node: Readline vi Mode, Next: Programmable Completion, Prev: Bindable Readline Commands, Up: Command Line Editing @@ -6611,12 +6925,19 @@ completions. the `-o dirnames' option was supplied to `complete' when the compspec was defined, directory name completion is attempted. + If the `-o plusdirs' option was supplied to `complete' when the +compspec was defined, directory name completion is attempted and any +matches are added to the results of the other actions. + By default, if a compspec is found, whatever it generates is returned to the completion code as the full set of possible completions. The default Bash completions are not attempted, and the Readline default -of filename completion is disabled. If the `-o default' option was -supplied to `complete' when the compspec was defined, Readline's -default completion will be performed if the compspec generates no +of filename completion is disabled. If the `-o bashdefault' option was +supplied to `complete' when the compspec was defined, the default Bash +completions are attempted if the compspec generates no matches. If the +`-o default' option was supplied to `complete' when the compspec was +defined, Readline's default completion will be performed if the +compspec (and, if attempted, the default Bash completions) generate no matches. When a compspec indicates that directory name completion is desired, @@ -6679,6 +7000,10 @@ completion facilities. behavior beyond the simple generation of completions. COMP-OPTION may be one of: + `bashdefault' + Perform the rest of the default Bash completions if the + compspec generates no matches. + `default' Use Readline's default filename completion if the compspec generates no matches. @@ -6689,7 +7014,7 @@ completion facilities. `filenames' Tell Readline that the compspec generates filenames, so - it can perform any filename\-specific processing (like + it can perform any filename-specific processing (like adding a slash to directory names or suppressing trailing spaces). This option is intended to be used with shell functions specified with `-F'. @@ -6824,6 +7149,7 @@ completion facilities. for a NAME for which no specification exists, or an error occurs adding a completion specification. + File: bashref.info, Node: Using History Interactively, Next: Command Line Editing, Prev: Job Control, Up: Top @@ -6873,6 +7199,9 @@ history, the history file is truncated to contain no more than `$HISTFILESIZE' lines. If `HISTFILESIZE' is not set, no truncation is performed. + If the `HISTTIMEFORMAT' is set, the time stamp information +associated with each history entry is written to the history file. + The builtin command `fc' may be used to list or edit and re-execute a portion of the history list. The `history' builtin may be used to display or modify the history list and manipulate the history file. @@ -6937,8 +7266,13 @@ and history file. With no options, display the history list with line numbers. Lines prefixed with a `*' have been modified. An argument of N - lists only the last N lines. Options, if supplied, have the - following meanings: + lists only the last N lines. If the shell variable + `HISTTIMEFORMAT' is set and not null, it is used as a format + string for STRFTIME to display the time stamp associated with each + displayed history entry. No intervening blank is printed between + the formatted time stamp and the history line. + + Options, if supplied, have the following meanings: `-c' Clear the history list. This may be combined with the other @@ -6974,10 +7308,12 @@ and history file. The ARGs are added to the end of the history list as a single entry. + When any of the `-w', `-r', `-a', or `-n' options is used, if FILENAME is given, then it is used as the history file. If not, then the value of the `HISTFILE' variable is used. + File: bashref.info, Node: History Interaction, Prev: Bash History Builtins, Up: Using History Interactively @@ -7040,7 +7376,8 @@ history list. `!' Start a history substitution, except when followed by a space, tab, - the end of the line, `=' or `('. + the end of the line, `=' or `(' (when the `extglob' shell option + is enabled using the `shopt' builtin). `!N' Refer to command line N. @@ -7066,6 +7403,7 @@ history list. `!#' The entire command line typed so far. + File: bashref.info, Node: Word Designators, Next: Modifiers, Prev: Event Designators, Up: History Interaction @@ -7124,6 +7462,7 @@ line separated by single spaces. `X-' Abbreviates `X-$' like `X*', but omits the last word. + If a word designator is supplied without an event specification, the previous command is used as the event. @@ -7171,9 +7510,14 @@ more of the following modifiers, each preceded by a `:'. Repeat the previous substitution. `g' +`a' Cause changes to be applied over the entire event line. Used in conjunction with `s', as in `gs/OLD/NEW/', or with `&'. +`G' + Apply the following `s' modifier once to each word in the event. + + File: bashref.info, Node: Installing Bash, Next: Reporting Bugs, Prev: Command Line Editing, Up: Top @@ -7184,7 +7528,7 @@ Installing Bash various supported platforms. The distribution supports the GNU operating systems, nearly every version of Unix, and several non-Unix systems such as BeOS and Interix. Other independent ports exist for -MS-DOS, OS/2, Windows 95/98, and Windows NT. +MS-DOS, OS/2, and Windows platforms. * Menu: @@ -7554,6 +7898,10 @@ does not provide the necessary support. This enables the job control features (*note Job Control::), if the operating system supports them. +`--enable-multibyte' + This enables support for multibyte characters if the operating + system provides the necessary support. + `--enable-net-redirections' This enables the special handling of filenames of the form `/dev/tcp/HOST/PORT' and `/dev/udp/HOST/PORT' when used in @@ -7598,6 +7946,7 @@ does not provide the necessary support. Specification, version 2. *Note Bash Builtins::, for a description of the escape sequences that `echo' recognizes. + The file `config-top.h' contains C Preprocessor `#define' statements for options which are not settable from `configure'. Some of these are not meant to be changed; beware of the consequences if you do. Read @@ -7612,7 +7961,8 @@ Reporting Bugs Please report all bugs you find in Bash. But first, you should make sure that it really is a bug, and that it appears in the latest version -of Bash that you have. +of Bash. The latest version of Bash is always available for FTP from +`ftp://ftp.gnu.org/pub/bash/'. Once you have determined that a bug actually exists, use the `bashbug' command to submit a bug report. If you have a fix, you are @@ -7638,7 +7988,7 @@ it provides for filing a bug report. Please send all reports concerning this manual to <chet@po.CWRU.Edu>. -File: bashref.info, Node: Major Differences From The Bourne Shell, Next: Builtin Index, Prev: Reporting Bugs, Up: Top +File: bashref.info, Node: Major Differences From The Bourne Shell, Next: Copying This Manual, Prev: Reporting Bugs, Up: Top Major Differences From The Bourne Shell *************************************** @@ -7868,14 +8218,27 @@ included in SVR4.2 as the baseline reference. * The `trap' builtin (*note Bourne Shell Builtins::) allows a `DEBUG' pseudo-signal specification, similar to `EXIT'. Commands - specified with a `DEBUG' trap are executed after every simple - command. The `DEBUG' trap is not inherited by shell functions - unless the function has been given the `trace' attribute. + specified with a `DEBUG' trap are executed before every simple + command, `for' command, `case' command, `select' command, every + arithmetic `for' command, and before the first command executes in + a shell function. The `DEBUG' trap is not inherited by shell + functions unless the function has been given the `trace' attribute + or the `functrace' option has been enabled using the `shopt' + builtin. The `extdebug' shell option has additional effects on the + `DEBUG' trap. The `trap' builtin (*note Bourne Shell Builtins::) allows an `ERR' pseudo-signal specification, similar to `EXIT' and `DEBUG'. Commands specified with an `ERR' trap are executed after a simple command fails, with a few exceptions. The `ERR' trap is not + inherited by shell functions unless the `-o errtrace' option to + the `set' builtin is enabled. + + The `trap' builtin (*note Bourne Shell Builtins::) allows a + `RETURN' pseudo-signal specification, similar to `EXIT' and + `DEBUG'. Commands specified with an `RETURN' trap are executed + before execution resumes after a shell function or a shell script + executed with `.' or `source' returns. The `RETURN' trap is not inherited by shell functions. * The Bash `type' builtin is more extensive and gives more @@ -7958,7 +8321,448 @@ from many of the limitations of the SVR4.2 shell. For instance: turns on job control). -File: bashref.info, Node: Builtin Index, Next: Reserved Word Index, Prev: Major Differences From The Bourne Shell, Up: Top +File: bashref.info, Node: Copying This Manual, Next: Builtin Index, Prev: Major Differences From The Bourne Shell, Up: Top + +Copying This Manual +******************* + +* Menu: + +* GNU Free Documentation License:: License for copying this manual. + + +File: bashref.info, Node: GNU Free Documentation License, Up: Copying This Manual + +GNU Free Documentation License +============================== + + Version 1.2, November 2002 + Copyright (C) 2000,2001,2002 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + 0. PREAMBLE + + The purpose of this License is to make a manual, textbook, or other + functional and useful document "free" in the sense of freedom: to + assure everyone the effective freedom to copy and redistribute it, + with or without modifying it, either commercially or + noncommercially. Secondarily, this License preserves for the + author and publisher a way to get credit for their work, while not + being considered responsible for modifications made by others. + + This License is a kind of "copyleft", which means that derivative + works of the document must themselves be free in the same sense. + It complements the GNU General Public License, which is a copyleft + license designed for free software. + + We have designed this License in order to use it for manuals for + free software, because free software needs free documentation: a + free program should come with manuals providing the same freedoms + that the software does. But this License is not limited to + software manuals; it can be used for any textual work, regardless + of subject matter or whether it is published as a printed book. + We recommend this License principally for works whose purpose is + instruction or reference. + + 1. APPLICABILITY AND DEFINITIONS + + This License applies to any manual or other work, in any medium, + that contains a notice placed by the copyright holder saying it + can be distributed under the terms of this License. Such a notice + grants a world-wide, royalty-free license, unlimited in duration, + to use that work under the conditions stated herein. The + "Document", below, refers to any such manual or work. Any member + of the public is a licensee, and is addressed as "you". You + accept the license if you copy, modify or distribute the work in a + way requiring permission under copyright law. + + A "Modified Version" of the Document means any work containing the + Document or a portion of it, either copied verbatim, or with + modifications and/or translated into another language. + + A "Secondary Section" is a named appendix or a front-matter section + of the Document that deals exclusively with the relationship of the + publishers or authors of the Document to the Document's overall + subject (or to related matters) and contains nothing that could + fall directly within that overall subject. (Thus, if the Document + is in part a textbook of mathematics, a Secondary Section may not + explain any mathematics.) The relationship could be a matter of + historical connection with the subject or with related matters, or + of legal, commercial, philosophical, ethical or political position + regarding them. + + The "Invariant Sections" are certain Secondary Sections whose + titles are designated, as being those of Invariant Sections, in + the notice that says that the Document is released under this + License. If a section does not fit the above definition of + Secondary then it is not allowed to be designated as Invariant. + The Document may contain zero Invariant Sections. If the Document + does not identify any Invariant Sections then there are none. + + The "Cover Texts" are certain short passages of text that are + listed, as Front-Cover Texts or Back-Cover Texts, in the notice + that says that the Document is released under this License. A + Front-Cover Text may be at most 5 words, and a Back-Cover Text may + be at most 25 words. + + A "Transparent" copy of the Document means a machine-readable copy, + represented in a format whose specification is available to the + general public, that is suitable for revising the document + straightforwardly with generic text editors or (for images + composed of pixels) generic paint programs or (for drawings) some + widely available drawing editor, and that is suitable for input to + text formatters or for automatic translation to a variety of + formats suitable for input to text formatters. A copy made in an + otherwise Transparent file format whose markup, or absence of + markup, has been arranged to thwart or discourage subsequent + modification by readers is not Transparent. An image format is + not Transparent if used for any substantial amount of text. A + copy that is not "Transparent" is called "Opaque". + + Examples of suitable formats for Transparent copies include plain + ASCII without markup, Texinfo input format, LaTeX input format, + SGML or XML using a publicly available DTD, and + standard-conforming simple HTML, PostScript or PDF designed for + human modification. Examples of transparent image formats include + PNG, XCF and JPG. Opaque formats include proprietary formats that + can be read and edited only by proprietary word processors, SGML or + XML for which the DTD and/or processing tools are not generally + available, and the machine-generated HTML, PostScript or PDF + produced by some word processors for output purposes only. + + The "Title Page" means, for a printed book, the title page itself, + plus such following pages as are needed to hold, legibly, the + material this License requires to appear in the title page. For + works in formats which do not have any title page as such, "Title + Page" means the text near the most prominent appearance of the + work's title, preceding the beginning of the body of the text. + + A section "Entitled XYZ" means a named subunit of the Document + whose title either is precisely XYZ or contains XYZ in parentheses + following text that translates XYZ in another language. (Here XYZ + stands for a specific section name mentioned below, such as + "Acknowledgements", "Dedications", "Endorsements", or "History".) + To "Preserve the Title" of such a section when you modify the + Document means that it remains a section "Entitled XYZ" according + to this definition. + + The Document may include Warranty Disclaimers next to the notice + which states that this License applies to the Document. These + Warranty Disclaimers are considered to be included by reference in + this License, but only as regards disclaiming warranties: any other + implication that these Warranty Disclaimers may have is void and + has no effect on the meaning of this License. + + 2. VERBATIM COPYING + + You may copy and distribute the Document in any medium, either + commercially or noncommercially, provided that this License, the + copyright notices, and the license notice saying this License + applies to the Document are reproduced in all copies, and that you + add no other conditions whatsoever to those of this License. You + may not use technical measures to obstruct or control the reading + or further copying of the copies you make or distribute. However, + you may accept compensation in exchange for copies. If you + distribute a large enough number of copies you must also follow + the conditions in section 3. + + You may also lend copies, under the same conditions stated above, + and you may publicly display copies. + + 3. COPYING IN QUANTITY + + If you publish printed copies (or copies in media that commonly + have printed covers) of the Document, numbering more than 100, and + the Document's license notice requires Cover Texts, you must + enclose the copies in covers that carry, clearly and legibly, all + these Cover Texts: Front-Cover Texts on the front cover, and + Back-Cover Texts on the back cover. Both covers must also clearly + and legibly identify you as the publisher of these copies. The + front cover must present the full title with all words of the + title equally prominent and visible. You may add other material + on the covers in addition. Copying with changes limited to the + covers, as long as they preserve the title of the Document and + satisfy these conditions, can be treated as verbatim copying in + other respects. + + If the required texts for either cover are too voluminous to fit + legibly, you should put the first ones listed (as many as fit + reasonably) on the actual cover, and continue the rest onto + adjacent pages. + + If you publish or distribute Opaque copies of the Document + numbering more than 100, you must either include a + machine-readable Transparent copy along with each Opaque copy, or + state in or with each Opaque copy a computer-network location from + which the general network-using public has access to download + using public-standard network protocols a complete Transparent + copy of the Document, free of added material. If you use the + latter option, you must take reasonably prudent steps, when you + begin distribution of Opaque copies in quantity, to ensure that + this Transparent copy will remain thus accessible at the stated + location until at least one year after the last time you + distribute an Opaque copy (directly or through your agents or + retailers) of that edition to the public. + + It is requested, but not required, that you contact the authors of + the Document well before redistributing any large number of + copies, to give them a chance to provide you with an updated + version of the Document. + + 4. MODIFICATIONS + + You may copy and distribute a Modified Version of the Document + under the conditions of sections 2 and 3 above, provided that you + release the Modified Version under precisely this License, with + the Modified Version filling the role of the Document, thus + licensing distribution and modification of the Modified Version to + whoever possesses a copy of it. In addition, you must do these + things in the Modified Version: + + A. Use in the Title Page (and on the covers, if any) a title + distinct from that of the Document, and from those of + previous versions (which should, if there were any, be listed + in the History section of the Document). You may use the + same title as a previous version if the original publisher of + that version gives permission. + + B. List on the Title Page, as authors, one or more persons or + entities responsible for authorship of the modifications in + the Modified Version, together with at least five of the + principal authors of the Document (all of its principal + authors, if it has fewer than five), unless they release you + from this requirement. + + C. State on the Title page the name of the publisher of the + Modified Version, as the publisher. + + D. Preserve all the copyright notices of the Document. + + E. Add an appropriate copyright notice for your modifications + adjacent to the other copyright notices. + + F. Include, immediately after the copyright notices, a license + notice giving the public permission to use the Modified + Version under the terms of this License, in the form shown in + the Addendum below. + + G. Preserve in that license notice the full lists of Invariant + Sections and required Cover Texts given in the Document's + license notice. + + H. Include an unaltered copy of this License. + + I. Preserve the section Entitled "History", Preserve its Title, + and add to it an item stating at least the title, year, new + authors, and publisher of the Modified Version as given on + the Title Page. If there is no section Entitled "History" in + the Document, create one stating the title, year, authors, + and publisher of the Document as given on its Title Page, + then add an item describing the Modified Version as stated in + the previous sentence. + + J. Preserve the network location, if any, given in the Document + for public access to a Transparent copy of the Document, and + likewise the network locations given in the Document for + previous versions it was based on. These may be placed in + the "History" section. You may omit a network location for a + work that was published at least four years before the + Document itself, or if the original publisher of the version + it refers to gives permission. + + K. For any section Entitled "Acknowledgements" or "Dedications", + Preserve the Title of the section, and preserve in the + section all the substance and tone of each of the contributor + acknowledgements and/or dedications given therein. + + L. Preserve all the Invariant Sections of the Document, + unaltered in their text and in their titles. Section numbers + or the equivalent are not considered part of the section + titles. + + M. Delete any section Entitled "Endorsements". Such a section + may not be included in the Modified Version. + + N. Do not retitle any existing section to be Entitled + "Endorsements" or to conflict in title with any Invariant + Section. + + O. Preserve any Warranty Disclaimers. + + If the Modified Version includes new front-matter sections or + appendices that qualify as Secondary Sections and contain no + material copied from the Document, you may at your option + designate some or all of these sections as invariant. To do this, + add their titles to the list of Invariant Sections in the Modified + Version's license notice. These titles must be distinct from any + other section titles. + + You may add a section Entitled "Endorsements", provided it contains + nothing but endorsements of your Modified Version by various + parties--for example, statements of peer review or that the text + has been approved by an organization as the authoritative + definition of a standard. + + You may add a passage of up to five words as a Front-Cover Text, + and a passage of up to 25 words as a Back-Cover Text, to the end + of the list of Cover Texts in the Modified Version. Only one + passage of Front-Cover Text and one of Back-Cover Text may be + added by (or through arrangements made by) any one entity. If the + Document already includes a cover text for the same cover, + previously added by you or by arrangement made by the same entity + you are acting on behalf of, you may not add another; but you may + replace the old one, on explicit permission from the previous + publisher that added the old one. + + The author(s) and publisher(s) of the Document do not by this + License give permission to use their names for publicity for or to + assert or imply endorsement of any Modified Version. + + 5. COMBINING DOCUMENTS + + You may combine the Document with other documents released under + this License, under the terms defined in section 4 above for + modified versions, provided that you include in the combination + all of the Invariant Sections of all of the original documents, + unmodified, and list them all as Invariant Sections of your + combined work in its license notice, and that you preserve all + their Warranty Disclaimers. + + The combined work need only contain one copy of this License, and + multiple identical Invariant Sections may be replaced with a single + copy. If there are multiple Invariant Sections with the same name + but different contents, make the title of each such section unique + by adding at the end of it, in parentheses, the name of the + original author or publisher of that section if known, or else a + unique number. Make the same adjustment to the section titles in + the list of Invariant Sections in the license notice of the + combined work. + + In the combination, you must combine any sections Entitled + "History" in the various original documents, forming one section + Entitled "History"; likewise combine any sections Entitled + "Acknowledgements", and any sections Entitled "Dedications". You + must delete all sections Entitled "Endorsements." + + 6. COLLECTIONS OF DOCUMENTS + + You may make a collection consisting of the Document and other + documents released under this License, and replace the individual + copies of this License in the various documents with a single copy + that is included in the collection, provided that you follow the + rules of this License for verbatim copying of each of the + documents in all other respects. + + You may extract a single document from such a collection, and + distribute it individually under this License, provided you insert + a copy of this License into the extracted document, and follow + this License in all other respects regarding verbatim copying of + that document. + + 7. AGGREGATION WITH INDEPENDENT WORKS + + A compilation of the Document or its derivatives with other + separate and independent documents or works, in or on a volume of + a storage or distribution medium, is called an "aggregate" if the + copyright resulting from the compilation is not used to limit the + legal rights of the compilation's users beyond what the individual + works permit. When the Document is included an aggregate, this + License does not apply to the other works in the aggregate which + are not themselves derivative works of the Document. + + If the Cover Text requirement of section 3 is applicable to these + copies of the Document, then if the Document is less than one half + of the entire aggregate, the Document's Cover Texts may be placed + on covers that bracket the Document within the aggregate, or the + electronic equivalent of covers if the Document is in electronic + form. Otherwise they must appear on printed covers that bracket + the whole aggregate. + + 8. TRANSLATION + + Translation is considered a kind of modification, so you may + distribute translations of the Document under the terms of section + 4. Replacing Invariant Sections with translations requires special + permission from their copyright holders, but you may include + translations of some or all Invariant Sections in addition to the + original versions of these Invariant Sections. You may include a + translation of this License, and all the license notices in the + Document, and any Warranty Disclaimers, provided that you also + include the original English version of this License and the + original versions of those notices and disclaimers. In case of a + disagreement between the translation and the original version of + this License or a notice or disclaimer, the original version will + prevail. + + If a section in the Document is Entitled "Acknowledgements", + "Dedications", or "History", the requirement (section 4) to + Preserve its Title (section 1) will typically require changing the + actual title. + + 9. TERMINATION + + You may not copy, modify, sublicense, or distribute the Document + except as expressly provided for under this License. Any other + attempt to copy, modify, sublicense or distribute the Document is + void, and will automatically terminate your rights under this + License. However, parties who have received copies, or rights, + from you under this License will not have their licenses + terminated so long as such parties remain in full compliance. + + 10. FUTURE REVISIONS OF THIS LICENSE + + The Free Software Foundation may publish new, revised versions of + the GNU Free Documentation License from time to time. Such new + versions will be similar in spirit to the present version, but may + differ in detail to address new problems or concerns. See + `http://www.gnu.org/copyleft/'. + + Each version of the License is given a distinguishing version + number. If the Document specifies that a particular numbered + version of this License "or any later version" applies to it, you + have the option of following the terms and conditions either of + that specified version or of any later version that has been + published (not as a draft) by the Free Software Foundation. If + the Document does not specify a version number of this License, + you may choose any version ever published (not as a draft) by the + Free Software Foundation. + +ADDENDUM: How to use this License for your documents +---------------------------------------------------- + + To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and license +notices just after the title page: + + Copyright (C) YEAR YOUR NAME. + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.2 + or any later version published by the Free Software Foundation; + with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. + A copy of the license is included in the section entitled ``GNU + Free Documentation License''. + + If you have Invariant Sections, Front-Cover Texts and Back-Cover +Texts, replace the "with...Texts." line with this: + + with the Invariant Sections being LIST THEIR TITLES, with + the Front-Cover Texts being LIST, and with the Back-Cover Texts + being LIST. + + If you have Invariant Sections without Cover Texts, or some other +combination of the three, merge those two alternatives to suit the +situation. + + If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, to +permit their use in free software. + + +File: bashref.info, Node: Builtin Index, Next: Reserved Word Index, Prev: Copying This Manual, Up: Top Index of Shell Builtin Commands ******************************* @@ -7973,6 +8777,7 @@ Index of Shell Builtin Commands * bind: Bash Builtins. * break: Bourne Shell Builtins. * builtin: Bash Builtins. +* caller: Bash Builtins. * cd: Bourne Shell Builtins. * command: Bash Builtins. * compgen: Programmable Completion Builtins. @@ -8070,7 +8875,14 @@ Parameter and Variable Index * _: Special Parameters. * auto_resume: Job Control Variables. * BASH: Bash Variables. +* BASH_ARGC: Bash Variables. +* BASH_ARGV: Bash Variables. +* BASH_COMMAND: Bash Variables. * BASH_ENV: Bash Variables. +* BASH_EXECUTION_STRING: Bash Variables. +* BASH_LINENO: Bash Variables. +* BASH_SOURCE: Bash Variables. +* BASH_SUBSHELL: Bash Variables. * BASH_VERSINFO: Bash Variables. * BASH_VERSION: Bash Variables. * bell-style: Readline Init File Syntax. @@ -8080,6 +8892,7 @@ Parameter and Variable Index * COMP_CWORD: Bash Variables. * COMP_LINE: Bash Variables. * COMP_POINT: Bash Variables. +* COMP_WORDBREAKS: Bash Variables. * COMP_WORDS: Bash Variables. * completion-query-items: Readline Init File Syntax. * COMPREPLY: Bash Variables. @@ -8087,6 +8900,7 @@ Parameter and Variable Index * DIRSTACK: Bash Variables. * disable-completion: Readline Init File Syntax. * editing-mode: Readline Init File Syntax. +* EMACS: Bash Variables. * enable-keypad: Readline Init File Syntax. * EUID: Bash Variables. * expand-tilde: Readline Init File Syntax. @@ -8103,6 +8917,7 @@ Parameter and Variable Index * HISTIGNORE: Bash Variables. * history-preserve-point: Readline Init File Syntax. * HISTSIZE: Bash Variables. +* HISTTIMEFORMAT: Bash Variables. * HOME: Bourne Shell Variables. * horizontal-scroll-mode: Readline Init File Syntax. * HOSTFILE: Bash Variables. @@ -8154,6 +8969,7 @@ Parameter and Variable Index * SHELLOPTS: Bash Variables. * SHLVL: Bash Variables. * show-all-if-ambiguous: Readline Init File Syntax. +* show-all-if-unmodified: Readline Init File Syntax. * TEXTDOMAIN: Locale Translation. * TEXTDOMAINDIR: Locale Translation. * TIMEFORMAT: Bash Variables. @@ -8266,6 +9082,7 @@ Concept Index * command search: Command Search and Execution. * command substitution: Command Substitution. * command timing: Pipelines. +* commands, compound: Compound Commands. * commands, conditional: Conditional Constructs. * commands, grouping: Command Grouping. * commands, lists: Lists. @@ -8294,6 +9111,7 @@ Concept Index * expansion, tilde: Tilde Expansion. * expressions, arithmetic: Shell Arithmetic. * expressions, conditional: Bash Conditional Expressions. +* FDL, GNU Free Documentation License: GNU Free Documentation License. * field: Definitions. * filename: Definitions. * filename expansion: Filename Expansion. @@ -8308,12 +9126,12 @@ Concept Index * initialization file, readline: Readline Init File. * installation: Basic Installation. * interaction, readline: Readline Interaction. -* interactive shell <1>: Invoking Bash. -* interactive shell: Interactive Shells. +* interactive shell <1>: Interactive Shells. +* interactive shell: Invoking Bash. * internationalization: Locale Translation. * job: Definitions. -* job control <1>: Job Control Basics. -* job control: Definitions. +* job control <1>: Definitions. +* job control: Job Control Basics. * kill ring: Readline Killing Commands. * killing text: Readline Killing Commands. * localization: Locale Translation. @@ -8352,8 +9170,8 @@ Concept Index * shell, interactive: Interactive Shells. * signal: Definitions. * signal handling: Signals. -* special builtin <1>: Special Builtins. -* special builtin: Definitions. +* special builtin <1>: Definitions. +* special builtin: Special Builtins. * startup files: Bash Startup Files. * suspending jobs: Job Control Basics. * tilde expansion: Tilde Expansion. @@ -8368,126 +9186,129 @@ Concept Index Tag Table: -Node: Top1160 -Node: Introduction3285 -Node: What is Bash?3510 -Node: What is a shell?4611 -Node: Definitions6845 -Node: Basic Shell Features9585 -Node: Shell Syntax10809 -Node: Shell Operation11833 -Node: Quoting13118 -Node: Escape Character14377 -Node: Single Quotes14849 -Node: Double Quotes15184 -Node: ANSI-C Quoting16085 -Node: Locale Translation17028 -Node: Comments17911 -Node: Shell Commands18516 -Node: Simple Commands19397 -Node: Pipelines20018 -Node: Lists21554 -Node: Looping Constructs23177 -Node: Conditional Constructs25621 -Node: Command Grouping31547 -Node: Shell Functions32924 -Node: Shell Parameters35460 -Node: Positional Parameters37034 -Node: Special Parameters37925 -Node: Shell Expansions40583 -Node: Brace Expansion42503 -Node: Tilde Expansion44172 -Node: Shell Parameter Expansion46503 -Node: Command Substitution53303 -Node: Arithmetic Expansion54625 -Node: Process Substitution55469 -Node: Word Splitting56506 -Node: Filename Expansion57958 -Node: Pattern Matching59916 -Node: Quote Removal63140 -Node: Redirections63426 -Node: Executing Commands70900 -Node: Simple Command Expansion71567 -Node: Command Search and Execution73488 -Node: Command Execution Environment75485 -Node: Environment78192 -Node: Exit Status79843 -Node: Signals81038 -Node: Shell Scripts82949 -Node: Shell Builtin Commands85460 -Node: Bourne Shell Builtins86890 -Node: Bash Builtins102594 -Node: The Set Builtin127866 -Node: Special Builtins134847 -Node: Shell Variables135819 -Node: Bourne Shell Variables136255 -Node: Bash Variables138034 -Node: Bash Features154053 -Node: Invoking Bash154935 -Node: Bash Startup Files160399 -Node: Interactive Shells165269 -Node: What is an Interactive Shell?165671 -Node: Is this Shell Interactive?166306 -Node: Interactive Shell Behavior167112 -Node: Bash Conditional Expressions170379 -Node: Shell Arithmetic173798 -Node: Aliases176236 -Node: Arrays178739 -Node: The Directory Stack181759 -Node: Directory Stack Builtins182465 -Node: Printing a Prompt185343 -Node: The Restricted Shell187969 -Node: Bash POSIX Mode189794 -Node: Job Control195965 -Node: Job Control Basics196431 -Node: Job Control Builtins200711 -Node: Job Control Variables205006 -Node: Command Line Editing206155 -Node: Introduction and Notation207153 -Node: Readline Interaction208770 -Node: Readline Bare Essentials209956 -Node: Readline Movement Commands211736 -Node: Readline Killing Commands212692 -Node: Readline Arguments214600 -Node: Searching215635 -Node: Readline Init File217812 -Node: Readline Init File Syntax218866 -Node: Conditional Init Constructs230030 -Node: Sample Init File232554 -Node: Bindable Readline Commands235737 -Node: Commands For Moving236936 -Node: Commands For History237784 -Node: Commands For Text240672 -Node: Commands For Killing243332 -Node: Numeric Arguments245282 -Node: Commands For Completion246409 -Node: Keyboard Macros249989 -Node: Miscellaneous Commands250547 -Node: Readline vi Mode255845 -Node: Programmable Completion256754 -Node: Programmable Completion Builtins262149 -Node: Using History Interactively269370 -Node: Bash History Facilities270049 -Node: Bash History Builtins272609 -Node: History Interaction276175 -Node: Event Designators278726 -Node: Word Designators279653 -Node: Modifiers281282 -Node: Installing Bash282599 -Node: Basic Installation283741 -Node: Compilers and Options286426 -Node: Compiling For Multiple Architectures287160 -Node: Installation Names288817 -Node: Specifying the System Type289628 -Node: Sharing Defaults290337 -Node: Operation Controls291002 -Node: Optional Features291953 -Node: Reporting Bugs299895 -Node: Major Differences From The Bourne Shell300992 -Node: Builtin Index315476 -Node: Reserved Word Index319067 -Node: Variable Index320543 -Node: Function Index326841 -Node: Concept Index331391 +Node: Top1367 +Node: Introduction3520 +Node: What is Bash?3745 +Node: What is a shell?4833 +Node: Definitions7369 +Node: Basic Shell Features10109 +Node: Shell Syntax11327 +Node: Shell Operation12351 +Node: Quoting13636 +Node: Escape Character14898 +Node: Single Quotes15370 +Node: Double Quotes15705 +Node: ANSI-C Quoting16718 +Node: Locale Translation17661 +Node: Comments18544 +Node: Shell Commands19149 +Node: Simple Commands19910 +Node: Pipelines20531 +Node: Lists22067 +Node: Compound Commands23689 +Node: Looping Constructs24461 +Node: Conditional Constructs26895 +Node: Command Grouping32914 +Node: Shell Functions34350 +Node: Shell Parameters38615 +Node: Positional Parameters40177 +Node: Special Parameters41068 +Node: Shell Expansions43726 +Node: Brace Expansion45646 +Node: Tilde Expansion47962 +Node: Shell Parameter Expansion50294 +Node: Command Substitution57548 +Node: Arithmetic Expansion58870 +Node: Process Substitution59711 +Node: Word Splitting60748 +Node: Filename Expansion62200 +Node: Pattern Matching64185 +Node: Quote Removal67506 +Node: Redirections67792 +Node: Executing Commands75267 +Node: Simple Command Expansion75934 +Node: Command Search and Execution77855 +Node: Command Execution Environment79852 +Node: Environment82614 +Node: Exit Status84265 +Node: Signals85460 +Node: Shell Scripts87371 +Node: Shell Builtin Commands89882 +Node: Bourne Shell Builtins91312 +Node: Bash Builtins108084 +Node: The Set Builtin135896 +Node: Special Builtins143821 +Node: Shell Variables144793 +Node: Bourne Shell Variables145229 +Node: Bash Variables147206 +Node: Bash Features166301 +Node: Invoking Bash167183 +Node: Bash Startup Files172994 +Node: Interactive Shells177864 +Node: What is an Interactive Shell?178266 +Node: Is this Shell Interactive?178901 +Node: Interactive Shell Behavior179707 +Node: Bash Conditional Expressions182974 +Node: Shell Arithmetic186394 +Node: Aliases189134 +Node: Arrays191637 +Node: The Directory Stack194657 +Node: Directory Stack Builtins195363 +Node: Printing a Prompt198242 +Node: The Restricted Shell200868 +Node: Bash POSIX Mode202693 +Node: Job Control209339 +Node: Job Control Basics209805 +Node: Job Control Builtins214085 +Node: Job Control Variables218381 +Node: Command Line Editing219531 +Node: Introduction and Notation220529 +Node: Readline Interaction222146 +Node: Readline Bare Essentials223332 +Node: Readline Movement Commands225112 +Node: Readline Killing Commands226068 +Node: Readline Arguments227977 +Node: Searching229012 +Node: Readline Init File231189 +Node: Readline Init File Syntax232243 +Node: Conditional Init Constructs243887 +Node: Sample Init File246411 +Node: Bindable Readline Commands249594 +Node: Commands For Moving250793 +Node: Commands For History251642 +Node: Commands For Text254531 +Node: Commands For Killing257192 +Node: Numeric Arguments259142 +Node: Commands For Completion260269 +Node: Keyboard Macros263850 +Node: Miscellaneous Commands264409 +Node: Readline vi Mode269708 +Node: Programmable Completion270617 +Node: Programmable Completion Builtins276424 +Node: Using History Interactively283786 +Node: Bash History Facilities284465 +Node: Bash History Builtins287155 +Node: History Interaction291007 +Node: Event Designators293558 +Node: Word Designators294562 +Node: Modifiers296192 +Node: Installing Bash297589 +Node: Basic Installation298723 +Node: Compilers and Options301408 +Node: Compiling For Multiple Architectures302142 +Node: Installation Names303799 +Node: Specifying the System Type304610 +Node: Sharing Defaults305319 +Node: Operation Controls305984 +Node: Optional Features306935 +Node: Reporting Bugs315012 +Node: Major Differences From The Bourne Shell316187 +Node: Copying This Manual331430 +Node: GNU Free Documentation License331684 +Node: Builtin Index354077 +Node: Reserved Word Index357704 +Node: Variable Index359180 +Node: Function Index366116 +Node: Concept Index370666 End Tag Table diff --git a/doc/bashref.texi b/doc/bashref.texi index 4a00d54a..849a85af 100644 --- a/doc/bashref.texi +++ b/doc/bashref.texi @@ -4,104 +4,82 @@ @settitle Bash Reference Manual @c %**end of header -@ignore -Last Change: Mon Jul 15 15:21:16 EDT 2002 -@end ignore - -@set EDITION 2.5b -@set VERSION 2.05b -@set UPDATED 15 July 2002 -@set UPDATE-MONTH July 2002 - -@iftex -@finalout -@end iftex - @setchapternewpage odd -@defcodeindex bt -@defcodeindex rw -@set BashFeatures -@ifinfo -@dircategory Utilities -@direntry - * Bash: (bash). The GNU Bourne-Again SHell. -@end direntry +@include version.texi -@format +@copying This text is a brief description of the features that are present in -the Bash shell. +the Bash shell (version @value{VERSION}, @value{UPDATED}). 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-2002 Free Software Foundation, Inc. +Copyright @copyright{} 1988-2003 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. -@ignore -Permission is granted to process this file through TeX and print the -results, provided the printed document carries copying permission -notice identical to this one except for the removal of this paragraph -(this paragraph not being relevant to the printed manual). - -@end ignore -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided that the entire -resulting derived work is distributed under the terms of a permission -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 Free Software Foundation. -@end format -@end ifinfo +@quotation +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.1 or +any later version published by the Free Software Foundation; with no +Invariant Sections, with the Front-Cover texts being ``A GNU Manual,'' +and with the Back-Cover Texts as in (a) below. A copy of the license is +included in the section entitled ``GNU Free Documentation License.'' + +(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify +this GNU Manual, like GNU software. Copies published by the Free +Software Foundation raise funds for GNU development.'' +@end quotation +@end copying + +@defcodeindex bt +@defcodeindex rw +@set BashFeatures + +@dircategory Basics +@direntry +* Bash: (bash). The GNU Bourne-Again SHell. +@end direntry + +@finalout @titlepage @title Bash Reference Manual @subtitle Reference Documentation for Bash @subtitle Edition @value{EDITION}, for @code{Bash} Version @value{VERSION}. -@subtitle @value{UPDATE-MONTH} +@subtitle @value{UPDATED-MONTH} @author Chet Ramey, Case Western Reserve University @author Brian Fox, Free Software Foundation + @page @vskip 0pt plus 1filll -Copyright @copyright{} 1991-2002 Free Software Foundation, Inc. - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. +@insertcopying -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided that the entire -resulting derived work is distributed under the terms of a permission -notice identical to this one. +@sp 1 +Published by the Free Software Foundation @* +59 Temple Place, Suite 330, @* +Boston, MA 02111-1307 @* +USA @* -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 Free Software Foundation. @end titlepage -@ifinfo +@contents + +@ifnottex @node Top, Introduction, (dir), (dir) @top Bash Features -@end ifinfo -@ifinfo This text is a brief description of the features that are present in -the Bash shell. +the Bash shell (version @value{VERSION}, @value{UPDATED}).. 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-2002 Free Software Foundation, Inc. - Bash contains features that appear in other popular shells, and some features that only appear in Bash. Some of the shells that Bash has borrowed concepts from are the Bourne Shell (@file{sh}), the Korn Shell @@ -145,6 +123,8 @@ reference on shell behavior. between Bash and historical versions of /bin/sh. +* Copying This Manual:: Copying this manual. + * Builtin Index:: Index of Bash builtin commands. * Reserved Word Index:: Index of Bash reserved words. @@ -157,7 +137,7 @@ reference on shell behavior. * Concept Index:: General index for concepts described in this manual. @end menu -@end ifinfo +@end ifnottex @node Introduction @chapter Introduction @@ -174,7 +154,7 @@ Bash is the shell, or command language interpreter, for the @sc{gnu} operating system. The name is an acronym for the @samp{Bourne-Again SHell}, a pun on Stephen Bourne, the author of the direct ancestor of -the current Unix shell @code{/bin/sh}, +the current Unix shell @code{sh}, which appeared in the Seventh Edition Bell Labs Research version of Unix. @@ -190,19 +170,29 @@ a version of @code{csh}, Bash is the default shell. Like other @sc{gnu} software, Bash is quite portable. It currently runs on nearly every version of Unix and a few other operating systems @minus{} independently-supported ports exist for @sc{ms-dos}, @sc{os/2}, -Windows @sc{95/98}, and Windows @sc{nt}. +and Windows platforms. @node What is a shell? @section What is a shell? At its base, a shell is simply a macro processor that executes -commands. A Unix shell is both a command interpreter, which -provides the user interface to the rich set of @sc{gnu} utilities, -and a programming language, allowing these utilitites to be -combined. Files containing commands can be created, and become +commands. The term macro processor means functionality where text +and symbols are expanded to create larger expressions. + +A Unix shell is both a command interpreter and a programming +language. As a command interpreter, the shell provides the user +interface to the rich set of @sc{gnu} utilities. The programming +language features allow these utilitites to be combined. +Files containing commands can be created, and become commands themselves. These new commands have the same status as system commands in directories such as @file{/bin}, allowing users -or groups to establish custom environments. +or groups to establish custom environments to automate their common +tasks. + +Shells may be used interactively or non-interactively. In +interactive mode, they accept input typed from the keyboard. +When executing non-interactively, shells execute commands read +from a file. A shell allows execution of @sc{gnu} commands, both synchronously and asynchronously. @@ -213,8 +203,6 @@ The @dfn{redirection} constructs permit fine-grained control of the input and output of those commands. Moreover, the shell allows control over the contents of commands' environments. -Shells may be used interactively or non-interactively: they accept -input typed from the keyboard or from a file. Shells also provide a small set of built-in commands (@dfn{builtins}) implementing functionality impossible @@ -236,7 +224,7 @@ variables, flow control constructs, quoting, and functions. Shells offer features geared specifically for interactive use rather than to augment the programming language. These interactive features include job control, command line -editing, history and aliases. Each of these features is +editing, command history and aliases. Each of these features is described in this manual. @node Definitions @@ -358,8 +346,8 @@ Bash is an acronym for @samp{Bourne-Again SHell}. The Bourne shell is the traditional Unix shell originally written by Stephen Bourne. All of the Bourne shell builtin commands are available in Bash, -and the rules for evaluation and quoting are taken from the @sc{posix} -1003.2 specification for the `standard' Unix shell. +The rules for evaluation and quoting are taken from the @sc{posix} +specification for the `standard' Unix shell. This chapter briefly summarizes the shell's `building blocks': commands, control structures, shell functions, shell @i{parameters}, @@ -371,8 +359,8 @@ and to named files, and how the shell executes commands. * Shell Syntax:: What your input means to the shell. * Shell Commands:: The types of commands you can use. * Shell Functions:: Grouping commands by name. -* Shell Parameters:: Special shell variables. -* Shell Expansions:: How Bash expands variables and the various +* Shell Parameters:: How the shell stores values. +* Shell Expansions:: How Bash expands parameters and the various expansions available. * Redirections:: A way to control where input and output go. * Executing Commands:: What happens when you run a command. @@ -473,6 +461,7 @@ When the command history expansion facilities are being used, the @var{history expansion} character, usually @samp{!}, must be quoted to prevent history expansion. @xref{Bash History Facilities}, for more details concerning history expansion. + There are three quoting mechanisms: the @var{escape character}, single quotes, and double quotes. @@ -508,6 +497,8 @@ characters are removed. Backslashes preceding characters without a special meaning are left unmodified. A double quote may be quoted within double quotes by preceding it with a backslash. +When command history is being used, the double quote may not be used to +quote the history expansion character. The special parameters @samp{*} and @samp{@@} have special meaning when in double quotes (@pxref{Shell Parameter Expansion}). @@ -614,9 +605,7 @@ some other grouping. * Pipelines:: Connecting the input and output of several commands. * Lists:: How to execute commands sequentially. -* Looping Constructs:: Shell commands for iterative action. -* Conditional Constructs:: Shell commands for conditional execution. -* Command Grouping:: Ways to group commands. +* Compound Commands:: Shell commands for control flow. @end menu @node Simple Commands @@ -674,8 +663,16 @@ shell waits for all commands in the pipeline to complete. Each command in a pipeline is executed in its own subshell (@pxref{Command Execution Environment}). The exit status of a pipeline is the exit status of the last command in the -pipeline. If the reserved word @samp{!} precedes the pipeline, the -exit status is the logical negation of the exit status of the last command. +pipeline, unless the @code{pipefail} option is enabled +(@pxref{The Set Builtin}). +If @code{pipefail} is enabled, the pipeline's return status is the +value of the last (rightmost) command to exit with a non-zero status, +or zero if all commands exit successfully. +If the reserved word @samp{!} precedes the pipeline, the +exit status is the logical negation of the exit status as described +above. +The shell waits for all commands in the pipeline to terminate before +returning a value. @node Lists @subsection Lists of Commands @@ -730,8 +727,27 @@ The return status of @sc{and} and @sc{or} lists is the exit status of the last command executed in the list. +@node Compound Commands +@subsection Compound Commands +@cindex commands, compound + +@menu +* Looping Constructs:: Shell commands for iterative action. +* Conditional Constructs:: Shell commands for conditional execution. +* Command Grouping:: Ways to group commands. +@end menu + +Compound commands are the shell programming constructs. +Each construct begins with a reserved word or control operator and is +terminated by a corresponding reserved word or operator. +Any redirections (@pxref{Redirections}) associated with a compound command +apply to all commands within that compound command unless explicitly overridden. + +Bash provides looping constructs, conditional commands, and mechanisms +to group commands and execute them as a unit. + @node Looping Constructs -@subsection Looping Constructs +@subsubsection Looping Constructs @cindex commands, looping Bash supports the following looping constructs. @@ -803,7 +819,7 @@ The @code{break} and @code{continue} builtins (@pxref{Bourne Shell Builtins}) may be used to control loop execution. @node Conditional Constructs -@subsection Conditional Constructs +@subsubsection Conditional Constructs @cindex commands, conditional @table @code @@ -950,6 +966,8 @@ Word splitting and filename expansion are not performed on the words between the @samp{[[} and @samp{]]}; tilde expansion, parameter and variable expansion, arithmetic expansion, command substitution, process substitution, and quote removal are performed. +Conditional operators such as @samp{-f} must be unquoted to be recognized +as primaries. When the @samp{==} and @samp{!=} operators are used, the string to the right of the operator is considered a pattern and matched according @@ -959,6 +977,25 @@ the pattern, respectively, and 1 otherwise. Any part of the pattern may be quoted to force it to be matched as a string. +An additional binary operator, @samp{=~}, is available, with the same +precedence as @samp{==} and @samp{!=}. +When it is used, the string to the right of the operator is considered +an extended regular expression and matched accordingly (as in @i{regex}3)). +The return value is 0 if the string matches +the pattern, and 1 otherwise. +If the regular expression is syntactically incorrect, the conditional +expression's return value is 2. +If the shell option @code{nocaseglob} +(see the description of @code{shopt} in @ref{Bash Builtins}) +is enabled, the match is performed without regard to the case +of alphabetic characters. +Substrings matched by parenthesized subexpressions within the regular +expression are saved in the array variable @code{BASH_REMATCH}. +The element of @code{BASH_REMATCH} with index 0 is the portion of the string +matching the entire regular expression. +The element of @code{BASH_REMATCH} with index @var{n} is the portion of the +string matching the @var{n}th parenthesized subexpression. + Expressions may be combined using the following operators, listed in decreasing order of precedence: @@ -984,7 +1021,7 @@ value of the entire conditional expression. @end table @node Command Grouping -@subsection Grouping Commands +@subsubsection Grouping Commands @cindex commands, grouping Bash provides two ways to group a list of commands to be executed @@ -999,9 +1036,10 @@ commands in the list may be redirected to a single stream. @end example Placing a list of commands between parentheses causes a subshell -to be created, and each of the commands in @var{list} to be executed -in that subshell. Since the @var{list} is executed in a subshell, -variable assignments do not remain in effect after the subshell completes. +environment to be created (@pxref{Command Execution Environment}), and each +of the commands in @var{list} to be executed in that subshell. Since the +@var{list} is executed in a subshell, variable assignments do not remain in +effect after the subshell completes. @item @{@} @rwindex @{ @@ -1041,25 +1079,34 @@ shell context; no new process is created to interpret them. Functions are declared using this syntax: @rwindex function @example -[ @code{function} ] @var{name} () @{ @var{command-list}; @} +[ @code{function} ] @var{name} () @var{compound-command} [ @var{redirections} ] @end example This defines a shell function named @var{name}. The reserved word @code{function} is optional. If the @code{function} reserved word is supplied, the parentheses are optional. -The @var{body} of the function is the @var{command-list} between @{ and @}. -This list is executed whenever @var{name} is specified as the -name of a command. The exit status of a function is -the exit status of the last command executed in the body. - -Note that for historical reasons, the curly braces that surround -the body of the function must be separated from the body by +The @var{body} of the function is the compound command +@var{compound-command} (@pxref{Compound Commands}). +That command is usually a @var{list} enclosed between @{ and @}, but +may be any compound command listed above. +@var{compound-command} is executed whenever @var{name} is specified as the +name of a command. +Any redirections (@pxref{Redirections}) associated with the shell function +are performed when the function is executed. + +The exit status of a function definition is zero unless a syntax error +occurs or a readonly function with the same name already exists. +When executed, the exit status of a function is the exit status of the +last command executed in the body. + +Note that for historical reasons, in the most common usage the curly braces +that surround the body of the function must be separated from the body by @code{blank}s or newlines. This is because the braces are reserved words and are only recognized as such when they are separated by whitespace. -Also, the @var{command-list} must be terminated with a semicolon -or a newline. +Also, when using the braces, the @var{list} must be terminated by a semicolon, +a @samp{&}, or a newline. When a function is executed, the arguments to the function become the positional parameters @@ -1067,13 +1114,26 @@ during its execution (@pxref{Positional Parameters}). The special parameter @samp{#} that expands to the number of positional parameters is updated to reflect the change. Positional parameter @code{0} is unchanged. -The @env{FUNCNAME} variable is set to the name of the function -while the function is executing. +The first element of the @env{FUNCNAME} variable is set to the +name of the function while the function is executing. +All other aspects of the shell execution +environment are identical between a function and its caller +with the exception that the @env{DEBUG} trap +below) is not inherited unless the function has been given the +@code{trace} attribute using the @code{declare} builtin or +the @code{-o functrace} option has been enabled with +the @code{set} builtin, +(in which case all functions inherit the @code{DEBUG} trap). +@xref{Bourne Shell Builtins}, for the description of the +@code{trap} builtin. If the builtin command @code{return} is executed in a function, the function completes and execution resumes with the next command after the function -call. When a function completes, the values of the +call. +Any command associated with the @code{RETURN} trap is executed +before execution resumes. +When a function completes, the values of the positional parameters and the special parameter @samp{#} are restored to the values they had prior to the function's execution. If a numeric argument is given to @code{return}, @@ -1085,6 +1145,22 @@ Variables local to the function may be declared with the @code{local} builtin. These variables are visible only to the function and the commands it invokes. +Function names and definitions may be listed with the +@option{-f} option to the @code{declare} or @code{typeset} +builtin commands (@pxref{Bash Builtins}). +The @option{-F} option to @code{declare} or @code{typeset} +will list the function names only +(and optionally the source file and line number, if the @code{extdebug} +shell option is enabled). +Functions may be exported so that subshells +automatically have them defined with the +@option{-f} option to the @code{export} builtin +(@pxref{Bourne Shell Builtins}). +Note that shell functions and variables with the same name may result +in multiple identically-named entries in the environment passed to the +shell's children. +Care should be taken in cases where this may cause a problem. + Functions may be recursive. No limit is placed on the number of recursive calls. @@ -1096,14 +1172,13 @@ recursive calls. @menu * Positional Parameters:: The shell's command-line arguments. -* Special Parameters:: Parameters with special meanings. +* Special Parameters:: Parameters denoted by special characters. @end menu A @var{parameter} is an entity that stores values. It can be a @code{name}, a number, or one of the special characters listed below. -For the shell's purposes, a @var{variable} is a parameter denoted by a -@code{name}. +A @var{variable} is a parameter denoted by a @code{name}. A variable has a @var{value} and zero or more @var{attributes}. Attributes are assigned using the @code{declare} builtin command (see the description of the @code{declare} builtin in @ref{Bash Builtins}). @@ -1123,7 +1198,7 @@ is not given, the variable is assigned the null string. All command substitution, arithmetic expansion, and quote removal (detailed below). If the variable has its @code{integer} attribute set, then @var{value} -is subject to arithmetic expansion even if the @code{$((@dots{}))} +is evaluated as an arithmetic expression even if the @code{$((@dots{}))} expansion is not used (@pxref{Arithmetic Expansion}). Word splitting is not performed, with the exception of @code{"$@@"} as explained below. @@ -1287,7 +1362,8 @@ This mechanism is similar to @var{filename expansion} (@pxref{Filename Expansion}), but the file names generated need not exist. Patterns to be brace expanded take the form of an optional @var{preamble}, -followed by a series of comma-separated strings between a pair of braces, +followed by either a series of comma-separated strings or a sequnce expression +between a pair of braces, followed by an optional @var{postscript}. The preamble is prefixed to each string contained within the braces, and the postscript is then appended to each resulting string, expanding left @@ -1302,6 +1378,14 @@ bash$ echo a@{d,c,b@}e ade ace abe @end example +A sequence expression takes the form @code{@{@var{x}..@var{y}@}}, +where @var{x} and @var{y} are either integers or single characters. +When integers are supplied, the expression expands to each number between +@var{x} and @var{y}, inclusive. +When characters are supplied, the expression expands to each character +lexicographically between @var{x} and @var{y}, inclusive. Note that +both @var{x} and @var{y} must be of the same type. + Brace expansion is performed before any other expansions, and any characters special to other expansions are preserved in the result. It is strictly textual. Bash @@ -1311,9 +1395,15 @@ To avoid conflicts with parameter expansion, the string @samp{$@{} is not considered eligible for brace expansion. A correctly-formed brace expansion must contain unquoted opening -and closing braces, and at least one unquoted comma. +and closing braces, and at least one unquoted comma or a valid +sequence expression. Any incorrectly formed brace expansion is left unchanged. +A @{ or @samp{,} may be quoted with a backslash to prevent its +being considered part of a brace expression. +To avoid conflicts with parameter expansion, the string @samp{$@{} +is not considered eligible for brace expansion. + This construct is typically used as shorthand when the common prefix of the strings to be generated is longer than in the above example: @@ -1428,8 +1518,11 @@ Bash uses the value of the variable formed from the rest of expanded and that value is used in the rest of the substitution, rather than the value of @var{parameter} itself. This is known as @code{indirect expansion}. -The exception to this is the expansion of $@{!@var{prefix*@}} +The exceptions to this are the expansions of $@{!@var{prefix*}@} +and $@{!@var{name}[@@]@} described below. +The exclamation point must immediately follow the left brace in order to +introduce indirection. In each of the cases below, @var{word} is subject to tilde expansion, parameter expansion, command substitution, and arithmetic expansion. @@ -1490,9 +1583,19 @@ Substring indexing is zero-based unless the positional parameters are used, in which case the indexing starts at 1. @item $@{!@var{prefix}*@} +@itemx $@{!@var{prefix}@@@} Expands to the names of variables whose names begin with @var{prefix}, separated by the first character of the @env{IFS} special variable. +@item $@{!@var{name}[@@]@} +@itemx $@{!@var{name}[*]@} +If @var{name} is an array variable, expands to the list of array indices +(keys) assigned in @var{name}. +If @var{name} is not an array, expands to 0 if @var{name} is set and null +otherwise. +When @samp{@@} is used and the expansion appears within double quotes, each +key expands to a separate word. + @item $@{#@var{parameter}@} The length in characters of the expanded value of @var{parameter} is substituted. @@ -1615,7 +1718,7 @@ The expression is treated as if it were within double quotes, but a double quote inside the parentheses is not treated specially. All tokens in the expression undergo parameter expansion, command substitution, and quote removal. -Arithmetic substitutions may be nested. +Arithmetic expansions may be nested. The evaluation is performed according to the rules listed below (@pxref{Shell Arithmetic}). @@ -1708,6 +1811,8 @@ and the shell option @code{nullglob} is disabled, the word is left unchanged. If the @code{nullglob} option is set, and no matches are found, the word is removed. +If the @code{failglob} shell option is set, and no matches are found, +an error message is printed and the command is not executed. If the shell option @code{nocaseglob} is enabled, the match is performed without regard to the case of alphabetic characters. @@ -1720,7 +1825,7 @@ In other cases, the @samp{.} character is not treated specially. See the description of @code{shopt} in @ref{Bash Builtins}, for a description of the @code{nocaseglob}, @code{nullglob}, -and @code{dotglob} options. +@code{failglob}, and @code{dotglob} options. The @env{GLOBIGNORE} shell variable may be used to restrict the set of filenames matching a @@ -1728,8 +1833,9 @@ pattern. If @env{GLOBIGNORE} is set, each matching filename that also matches one of the patterns in @env{GLOBIGNORE} is removed from the list of matches. The filenames @file{.} and @file{..} -are always ignored, even when @env{GLOBIGNORE} -is set. However, setting @env{GLOBIGNORE} has the effect of +are always ignored when @env{GLOBIGNORE} +is set and not null. +However, setting @env{GLOBIGNORE} to a non-null value has the effect of enabling the @code{dotglob} shell option, so all other filenames beginning with a @samp{.} will match. @@ -1744,9 +1850,12 @@ is unset. @cindex matching, pattern Any character that appears in a pattern, other than the special pattern -characters described below, matches itself. The @sc{nul} character may not -occur in a pattern. The special pattern characters must be quoted if -they are to be matched literally. +characters described below, matches itself. +The @sc{nul} character may not occur in a pattern. +A backslash escapes the following character; the +escaping backslash is discarded when matching. +The special pattern characters must be quoted if they are to be matched +literally. The special pattern characters have the following meanings: @table @code @@ -2257,8 +2366,8 @@ the current working directory the file creation mode mask @item -shell variables marked for export, along with variables exported for -the command, passed in the environment (@pxref{Environment}) +shell variables and functions marked for export, along with variables +exported for the command, passed in the environment (@pxref{Environment}) @item traps caught by the shell are reset to the values inherited from the @@ -2269,7 +2378,8 @@ shell's parent, and traps ignored by the shell are ignored A command invoked in this separate environment cannot affect the shell's execution environment. -Command substitution and asynchronous commands are invoked in a +Command substitution, commands grouped with parentheses, +and asynchronous commands are invoked in a subshell environment that is a duplicate of the shell environment, except that traps caught by the shell are reset to the values that the shell inherited from its parent at invocation. Builtin @@ -2536,14 +2646,21 @@ The return status is zero unless @var{n} is not greater than or equal to 1. @example cd [-L|-P] [@var{directory}] @end example -Change the current working directory to @var{directory}. If @var{directory} -is not given, the value of the @env{HOME} shell variable is used. If the -shell variable @env{CDPATH} exists, it is used as a search path. If -@var{directory} begins with a slash, @env{CDPATH} is not used. -The @option{-P} option means -to not follow symbolic links; symbolic links are followed by default -or with the @option{-L} option. +Change the current working directory to @var{directory}. +If @var{directory} is not given, the value of the @env{HOME} shell +variable is used. +If the shell variable @env{CDPATH} exists, it is used as a search path. +If @var{directory} begins with a slash, @env{CDPATH} is not used. + +The @option{-P} option means to not follow symbolic links; symbolic +links are followed by default or with the @option{-L} option. If @var{directory} is @samp{-}, it is equivalent to @env{$OLDPWD}. + +If a non-empty directory name from @env{CDPATH} is used, or if +@samp{-} is the first argument, and the directory change is +successful, the absolute pathname of the new working directory is +written to the standard output. + The return status is zero if the directory is successfully changed, non-zero otherwise. @@ -2609,6 +2726,9 @@ The @option{-n} option means to no longer mark each @var{name} for export. If no @var{names} are supplied, or if the @option{-p} option is given, a list of exported names is displayed. The @option{-p} option displays output in a form that may be reused as input. +If a variable name is followed by =@var{value}, the value of +the variable is set to @var{value}. + The return status is zero unless an invalid option is supplied, one of the names is not a valid shell variable name, or @option{-f} is supplied with a name that is not a shell function. @@ -2709,7 +2829,7 @@ is supplied. @item readonly @btindex readonly @example -readonly [-apf] [@var{name}] @dots{} +readonly [-apf] [@var{name}[=@var{value}]] @dots{} @end example Mark each @var{name} as readonly. The values of these names may not be changed by subsequent assignment. @@ -2720,6 +2840,8 @@ If no @var{name} arguments are given, or if the @option{-p} option is supplied, a list of all readonly names is printed. The @option{-p} option causes output to be displayed in a format that may be reused as input. +If a variable name is followed by =@var{value}, the value of +the variable is set to @var{value}. The return status is zero unless an invalid option is supplied, one of the @var{name} arguments is not a valid shell variable or function name, or the @option{-f} option is supplied with a name that is not a shell function. @@ -2736,6 +2858,8 @@ This may also be used to terminate execution of a script being executed with the @code{.} (or @code{source}) builtin, returning either @var{n} or the exit status of the last command executed within the script as the exit status of the script. +Any command associated with the @code{RETURN} trap is executed +before execution resumes after the function or script. The return status is non-zero if @code{return} is used outside a function and not during the execution of a script by @code{.} or @code{source}. @@ -2854,20 +2978,30 @@ If no arguments are supplied, or only @option{-p} is given, @code{trap} prints the list of commands associated with each signal number in a form that may be reused as shell input. +The @option{-l} option causes the shell to print a list of signal names +and their corresponding numbers. + Each @var{sigspec} is either a signal name such as @code{SIGINT} (with or without the @code{SIG} prefix) or a signal number. If a @var{sigspec} is @code{0} or @code{EXIT}, @var{arg} is executed when the shell exits. If a @var{sigspec} is @code{DEBUG}, the command @var{arg} is executed -after every simple command. +before every simple command, @code{for} command, @code{case} command, +@code{select} command, every arithmetic @code{for} command, and before +the first command executes in a shell function. +Refer to the description of the @code{extglob} option to the +@code{shopt} builtin (@pxref{Bash Builtins}) for details of its +effect on the @code{DEBUG} trap. If a @var{sigspec} is @code{ERR}, the command @var{arg} is executed whenever a simple command has a non-zero exit status. -The @code{ERR} trap is not executed if the failed command is part of an -@code{until} or @code{while} loop, part of an @code{if} statement, +The @code{ERR} trap is not executed if the failed command is part of the +command list immediately following an @code{until} or @code{while} keyword, +part of the test in an @code{if} statement, part of a @code{&&} or @code{||} list, or if the command's return status is being inverted using @code{!}. -The @option{-l} option causes the shell to print a list of signal names -and their corresponding numbers. +If a @var{sigspec} is @code{RETURN}, the command @var{arg} is executed +each time a shell function or a script executed with the @code{.} or +@code{source} builtins finishes executing. Signals ignored upon entry to the shell cannot be trapped or reset. Trapped signals are reset to their original values in a child @@ -2908,8 +3042,7 @@ If no options are supplied, or the @option{-v} option is given, each If the @option{-f} option is given, the @var{name}s refer to shell functions, and the function definition is removed. Readonly variables and functions may not be unset. -The return status is zero unless a @var{name} does not exist or is -readonly. +The return status is zero unless a @var{name} is readonly. @end table @node Bash Builtins @@ -3031,6 +3164,26 @@ the function. The return status is non-zero if @var{shell-builtin} is not a shell builtin command. +@item caller +@btindex caller +@example +caller [@var{expr}] +@end example +Returns the context of any active subroutine call (a shell function or +a script executed with the @code{.} or @code{source} builtins. + +Without @var{expr}, @code{caller} displays the line number and source +filename of the current subroutine call. +If a non-negative integer is supplied as @var{expr}, @code{caller} +displays the line number, subroutine name, and source file corresponding +to that position in the current execution call stack. This extra +information may be used, for example, to print a stack trace. The +current frame is frame 0. + +The return value is 0 unless the shell is not executing a subroutine +call or @var{expr} does not correspond to a valid position in the +call stack. + @item command @btindex command @example @@ -3059,19 +3212,23 @@ zero if @var{command} is found, and non-zero if not. @item declare @btindex declare @example -declare [-afFirtx] [-p] [@var{name}[=@var{value}]] +declare [-afFirtx] [-p] [@var{name}[=@var{value}] @dots{}] @end example Declare variables and give them attributes. If no @var{name}s are given, then display the values of variables instead. The @option{-p} option will display the attributes and values of each -@var{name}. When @option{-p} is used, additional options are ignored. +@var{name}. +When @option{-p} is used, additional options are ignored. The @option{-F} option inhibits the display of function definitions; -only the function name and attributes are printed. @option{-F} implies -@option{-f}. The following options can be used to restrict output -to variables with the specified attributes or to give variables -attributes: +only the function name and attributes are printed. +If the @code{extdebug} shell option is enabled using @code{shopt} +(@pxref{Bash Builtins}), the source file name and line number where +the function is defined are displayed as well. +@option{-F} implies @option{-f}. +The following options can be used to restrict output to variables with +the specified attributes or to give variables attributes: @table @code @item -a @@ -3101,7 +3258,8 @@ the environment. Using @samp{+} instead of @samp{-} turns off the attribute instead. When used in a function, @code{declare} makes each @var{name} local, -as with the @code{local} command. +as with the @code{local} command. If a variable name is followed by +=@var{value}, the value of the variable is set to @var{value}. The return status is zero unless an invalid option is encountered, an attempt is made to define a function using @samp{-f foo=bar}, @@ -3221,7 +3379,7 @@ otherwise 0 is returned. @item local @btindex local @example -local [@var{option}] @var{name}[=@var{value}] +local [@var{option}] @var{name}[=@var{value}] @dots{} @end example For each argument, a local variable named @var{name} is created, and assigned @var{value}. @@ -3422,10 +3580,50 @@ If set, aliases are expanded as described below under Aliases, @ref{Aliases}. This option is enabled by default for interactive shells. +@item extdebug +If set, behavior intended for use by debuggers is enabled: + +@enumerate +@item +The @option{-F} option to the @code{declare} builtin (@pxref{Bash Builtins}) +displays the source file name and line number corresponding to each function +name supplied as an argument. + +@item +If the command run by the @code{DEBUG} trap returns a non-zero value, the +next command is skipped and not executed. + +@item +If the command run by the @code{DEBUG} trap returns a value of 2, and the +shell is executing in a subroutine (a shell function or a shell script +executed by the @code{.} or @code{source} builtins), a call to +@code{return} is simulated. +@end enumerate + @item extglob If set, the extended pattern matching features described above (@pxref{Pattern Matching}) are enabled. +@item extquote +If set, @code{$'@var{string}'} and @code{$"@var{string}"} quoting is +performed within @code{$@{@var{parameter}@}} expansions +enclosed in double quotes. This option is enabled by default. + +@item failglob +If set, patterns which fail to match filenames during pathname expansion +result in an expansion error. + +@item force_fignore +If set, the suffixes specified by the @env{FIGNORE} shell variable +cause words to be ignored when performing word completion even if +the ignored words are the only possible completions. +@xref{Bash Variables}, for a description of @env{FIGNORE}. +This option is enabled by default. + +@item gnu_errfmt +If set, shell error messages are written in the standard @sc{gnu} error +message format. + @item histappend If set, the history list is appended to the file named by the value of the @env{HISTFILE} @@ -3492,8 +3690,10 @@ If set, the programmable completion facilities This option is enabled by default. @item promptvars -If set, prompt strings undergo variable and parameter expansion after -being expanded (@pxref{Printing a Prompt}). +If set, prompt strings undergo +parameter expansion, command substitution, arithmetic +expansion, and quote removal after being expanded +as described below (@pxref{Printing a Prompt}). This option is enabled by default. @item restricted_shell @@ -3572,7 +3772,7 @@ if none are found. @item typeset @btindex typeset @example -typeset [-afFrxi] [-p] [@var{name}[=@var{value}]] +typeset [-afFrxi] [-p] [@var{name}[=@var{value}] @dots{}] @end example The @code{typeset} command is supplied for compatibility with the Korn shell; however, it has been deprecated in favor of the @code{declare} @@ -3689,8 +3889,9 @@ immediately, rather than before printing the next primary prompt. @item -e Exit immediately if a simple command (@pxref{Simple Commands}) exits -with a non-zero status, unless the command that fails is part of an -@code{until} or @code{while} loop, part of an @code{if} statement, +with a non-zero status, unless the command that fails is part of the +command list immediately following a @code{while} or @code{until} +keyword, part of the test in an @code{if} statement, part of a @code{&&} or @code{||} list, or if the command's return status is being inverted using @code{!}. A trap on @code{ERR}, if set, is executed before the shell exits. @@ -3732,6 +3933,12 @@ Use an @code{emacs}-style line editing interface (@pxref{Command Line Editing}). @item errexit Same as @code{-e}. +@item errtrace +Same as @code{-E}. + +@item functrace +Same as @code{-T}. + @item hashall Same as @code{-h}. @@ -3775,6 +3982,12 @@ Same as @code{-t}. @item physical Same as @code{-P}. +@item pipefail +If set, the return value of a pipeline is the value of the last +(rightmost) command to exit with a non-zero status, or zero if all +commands in the pipeline exit successfully. +This option is disabled by default. + @item posix Change the behavior of Bash where the default operation differs from the @sc{posix} 1003.2 standard to match the standard @@ -3821,8 +4034,12 @@ shell will exit. Print shell input lines as they are read. @item -x -Print a trace of simple commands and their arguments after they are -expanded and before they are executed. +Print a trace of simple commands, \fBfor\fP commands, \fBcase\fP +commands, \fBselect\fP commands, and arithmetic \fBfor\fP commands +and their arguments or associated word lists after they are +expanded and before they are executed. The value of the @env{PS4} +variable is expanded and the resultant value is printed before +the command and its expanded arguments. @item -B The shell will perform brace expansion (@pxref{Brace Expansion}). @@ -3832,6 +4049,11 @@ This option is on by default. Prevent output redirection using @samp{>}, @samp{>&}, and @samp{<>} from overwriting existing files. +@item -E +If set, any trap on @code{ERR} is inherited by shell functions, command +substitutions, and commands executed in a subshell environment. +The @code{ERR} trap is normally not inherited in such cases. + @item -H Enable @samp{!} style history substitution (@pxref{History Interaction}). This option is on by default for interactive shells. @@ -3861,6 +4083,11 @@ $ cd ..; pwd /usr/local @end example +@item -T +If set, any trap on @code{DEBUG} is inherited by shell functions, command +substitutions, and commands executed in a subshell environment. +The @code{DEBUG} trap is normally not inherited in such cases. + @item -- If no arguments follow this option, then the positional parameters are unset. Otherwise, the positional parameters are set to the @@ -3972,6 +4199,11 @@ The index of the last option argument processed by the @code{getopts} builtin. @item PATH A colon-separated list of directories in which the shell looks for commands. +A zero-length (null) directory name in the value of @code{PATH} indicates the +current directory. +A null directory name may appear as two adjacent colons, or as an initial +or trailing colon. + @item PS1 The primary prompt string. The default value is @samp{\s-\v\$ }. @@ -3998,13 +4230,59 @@ variables for controlling the job control facilities @item BASH The full pathname used to execute the current instance of Bash. +@item BASH_ARGC +An array variable whose values are the number of parameters in each +frame of the current bash execution call stack. The number of +parameters to the current subroutine (shell function or script executed +with @code{.} or @code{source}) is at the top of the stack. When a +subroutine is executed, the number of parameters passed is pushed onto +@code{BASH_ARGC}. + +@item BASH_ARGV +An array variable containing all of the parameters in the current bash +execution call stack. The final parameter of the last subroutine call +is at the top of the stack; the first parameter of the initial call is +at the bottom. When a subroutine is executed, the parameters supplied +are pushed onto @code{BASH_ARGV}. + +@item BASH_COMMAND +The command currently being executed or about to be executed, unless the +shell is executing a command as the result of a trap, +in which case it is the command executing at the time of the trap. + @item BASH_ENV If this variable is set when Bash is invoked to execute a shell script, its value is expanded and used as the name of a startup file to read before executing the script. @xref{Bash Startup Files}. -@item BASH_VERSION -The version number of the current instance of Bash. +@item BASH_EXECUTION_STRING +The command argument to the @option{-c} invocation option. + +@item BASH_LINENO +An array variable whose members are the line numbers in source files +corresponding to each member of @var{FUNCNAME}. +@code{$@{BASH_LINENO[$i]@}} is the line number in the source file where +@code{$@{FUNCNAME[$i + 1]@}} was called. +The corresponding source file name is @code{$@{BASH_SOURCE[$i + 1]@}}. +Use @code{LINENO} to obtain the current line number. + +@item BASH_REMATCH +An array variable whose members are assigned by the @samp{=~} binary +operator to the @code{[[} conditional command +(@pxref{Conditional Constructs}). +The element with index 0 is the portion of the string +matching the entire regular expression. +The element with index @var{n} is the portion of the +string matching the @var{n}th parenthesized subexpression. +This variable is read-only. + +@item BASH_SOURCE +An array variable whose members are the source filenames corresponding +to the elements in the @code{FUNCNAME} array variable. + +@item BASH_SUBSHELL +Incremented by one each time a subshell or subshell environment is spawned. +The initial value is 0. @item BASH_VERSINFO A readonly array variable (@pxref{Arrays}) @@ -4033,6 +4311,9 @@ The value of @env{MACHTYPE}. @end table +@item BASH_VERSION +The version number of the current instance of Bash. + @item COLUMNS Used by the @code{select} builtin command to determine the terminal width when printing selection lists. Automatically set upon receipt of a @@ -4059,6 +4340,12 @@ This variable is available only in shell functions and external commands invoked by the programmable completion facilities (@pxref{Programmable Completion}). +@item COMP_WORDBREAKS +The set of characters that the Readline library treats as word +separators when performing word completion. +If @code{COMP_WORDBREAKS} is unset, it loses its special properties, +even if it is subsequently reset. + @item COMP_WORDS An array variable consisting of the individual words in the current command line. @@ -4081,6 +4368,11 @@ Assignment to this variable will not change the current directory. If @env{DIRSTACK} is unset, it loses its special properties, even if it is subsequently reset. +@item EMACS +If Bash finds this variable in the environment when the shell +starts with value @samp{t}, it assumes that the shell is running in an +emacs shell buffer and disables line editing. + @item EUID The numeric effective user id of the current user. This variable is readonly. @@ -4098,7 +4390,11 @@ is excluded from the list of matched file names. A sample value is @samp{.o:~} @item FUNCNAME -The name of any currently-executing shell function. +An array variable containing the names of all shell functions +currently in the execution call stack. +The element with index 0 is the name of any currently-executing +shell function. +The bottom-most element is "main". This variable exists only when a shell function is executing. Assignments to @env{FUNCNAME} have no effect and return an error status. If @env{FUNCNAME} is unset, it loses its special properties, even if @@ -4138,13 +4434,21 @@ command. If @env{HISTCMD} is unset, it loses its special properties, even if it is subsequently reset. @item HISTCONTROL -A value of @samp{ignorespace} means to not enter lines which -begin with a space or tab into the history list. -A value of @samp{ignoredups} means to not enter lines which match the last -entered line. -A value of @samp{ignoreboth} combines the two options. -Unset, or set to any other value than those above, means to save -all lines on the history list. +A colon-separated list of values controlling how commands are saved on +the history list. +If the list of values includes @samp{ignorespace}, lines which begin +with a space character are not saved in the history list. +A value of @samp{ignoredups} causes lines which match the previous +history entry to not be saved. +A value of @samp{ignoreboth} is shorthand for +@samp{ignorespace} and @samp{ignoredups}. +A value of @samp{erasedups} causes all previous lines matching the +current line to be removed from the history list before that line +is saved. +Any value not in the above list is ignored. +If @env{HISTCONTROL} is unset, or does not include a valid value, +all lines read by the shell parser are saved on the history list, +subject to the value of @env{HISTIGNORE}. The second and subsequent lines of a multi-line compound command are not tested, and are added to the history regardless of the value of @env{HISTCONTROL}. @@ -4185,6 +4489,13 @@ provides the functionality of @code{ignoreboth}. The maximum number of commands to remember on the history list. The default value is 500. +@item HISTTIMEFORMAT +If this variable is set and not null, its value is used as a format string +for @var{strftime} to print the time stamp associated with each history +entry displayed by the @code{history} builtin. +If this variable is set, time stamps are written to the history file so +they may be preserved across shell sessions. + @item HOSTFILE Contains the name of a file in the same format as @file{/etc/hosts} that should be read when the shell needs to complete a hostname. @@ -4445,6 +4756,14 @@ options that you can use. These options must appear on the command line before the single-character options to be recognized. @table @code +@item --debugger +Arrange for the debugger profile to be executed before the shell +starts. Turns on extended debugging mode (see @ref{Bash Builtins} +for a description of the @code{extdebug} option to the @code{shopt} +builtin) and shell function tracing +(see @ref{The Set Builtin} for a description of the @code{-o functrace} +option). + @item --dump-po-strings A list of all double-quoted strings preceded by @samp{$} is printed on the standard ouput @@ -4988,12 +5307,13 @@ may be positive or negative integers. @cindex arithmetic evaluation The shell allows arithmetic expressions to be evaluated, as one of -the shell expansions or by the @code{let} builtin. +the shell expansions or by the @code{let} and the @option{-i} option +to the @code{declare} builtins. Evaluation is done in fixed-width integers with no check for overflow, though division by 0 is trapped and flagged as an error. -The operators and their precedence and associativity are the same -as in the C language. +The operators and their precedence, associativity, and values +are the same as in the C language. The following list of operators is grouped into levels of equal-precedence operators. The levels are listed in order of decreasing precedence. @@ -5046,7 +5366,7 @@ logical AND logical OR @item expr ? expr : expr -conditional evaluation +conditional operator @item = *= /= %= += -= <<= >>= &= ^= |= assignment @@ -5059,8 +5379,12 @@ Shell variables are allowed as operands; parameter expansion is performed before the expression is evaluated. Within an expression, shell variables may also be referenced by name without using the parameter expansion syntax. +A shell variable that is null or unset evaluates to 0 when referenced +by name without using the parameter expansion syntax. The value of a variable is evaluated as an arithmetic expression -when it is referenced. +when it is referenced, or when a variable which has been given the +@var{integer} attribute using @samp{declare -i} is assigned a value. +A null value evaluates to 0. A shell variable need not have its integer attribute turned on to be used in an expression. @@ -5509,10 +5833,6 @@ and parameter expansion is performed on the values of @env{PS1} and @env{PS2} regardless of the setting of the @code{promptvars} option. @item -Interactive comments are enabled by default. (Bash has them on by -default anyway.) - -@item The @sc{posix} 1003.2 startup files are executed (@env{$ENV}) rather than the normal Bash files. @@ -5526,7 +5846,11 @@ default value of @env{$HISTFILE}). @item The output of @samp{kill -l} prints all the signal names on a single line, -separated by spaces. +separated by spaces, without the @samp{SIG} prefix. + +@item +The @code{kill} builtin does not accept signal names with a @samp{SIG} +prefix. @item Non-interactive shells exit if @var{filename} in @code{.} @var{filename} @@ -5608,6 +5932,13 @@ The @code{trap} builtin displays signal names without the leading @code{SIG}. @item +The @code{trap} builtin doesn't check the first argument for a possible +signal specification and revert the signal handling to the original +disposition if it is. If users want to reset the handler for a given +signal to the original disposition, they should use @samp{-} as the +first argument. + +@item The @code{.} and @code{source} builtins do not search the current directory for the filename argument if it is not found by searching @env{PATH}. @@ -5620,6 +5951,11 @@ Bash clears the @option{-e} option in such subshells. Alias expansion is always enabled, even in non-interactive shells. @item +When the @code{alias} builtin displays alias definitions, it does not +display them with a leading @samp{alias } unless the @option{-p} option +is supplied. + +@item When the @code{set} builtin is invoked without options, it does not display shell function names and definitions. @@ -5929,9 +6265,9 @@ analogous to the @samp{%} job @sc{id}. @set readline-appendix @set history-appendix @cindex Readline, how to use -@include rluser.texinfo +@include rluser.texi @cindex History, how to use -@include hsuser.texinfo +@include hsuser.texi @clear readline-appendix @clear history-appendix @@ -5943,7 +6279,7 @@ the various supported platforms. The distribution supports the @sc{gnu} operating systems, nearly every version of Unix, and several non-Unix systems such as BeOS and Interix. Other independent ports exist for -@sc{ms-dos}, @sc{os/2}, Windows @sc{95/98}, and Windows @sc{nt}. +@sc{ms-dos}, @sc{os/2}, and Windows platforms. @menu * Basic Installation:: Installation instructions. @@ -6304,7 +6640,12 @@ displaying timing statistics for the pipeline following @code{time} This allows pipelines as well as shell builtins and functions to be timed. @item --enable-cond-command -Include support for the @code{[[} conditional command +Include support for the @code{[[} conditional command. +(@pxref{Conditional Constructs}). + +@item --enable-cond-regexp +Include support for matching POSIX regular expressions using the +@samp{=~} binary operator in the @code{[[} conditional command. (@pxref{Conditional Constructs}). @item --enable-directory-stack @@ -6338,6 +6679,10 @@ builtin commands (@pxref{Bash History Facilities}). This enables the job control features (@pxref{Job Control}), if the operating system supports them. +@item --enable-multibyte +This enables support for multibyte characters if the operating +system provides the necessary support. + @item --enable-net-redirections This enables the special handling of filenames of the form @code{/dev/tcp/@var{host}/@var{port}} and @@ -6400,7 +6745,9 @@ information about its effect. Please report all bugs you find in Bash. But first, you should make sure that it really is a bug, and that it appears in the latest -version of Bash that you have. +version of Bash. +The latest version of Bash is always available for FTP from +@uref{ftp://ftp.gnu.org/pub/bash/}. Once you have determined that a bug actually exists, use the @code{bashbug} command to submit a bug report. @@ -6722,16 +7069,30 @@ which specifies the behavior based on the number of arguments. @item The @code{trap} builtin (@pxref{Bourne Shell Builtins}) allows a @code{DEBUG} pseudo-signal specification, similar to @code{EXIT}. -Commands specified with a @code{DEBUG} trap are executed after every -simple command. +Commands specified with a @code{DEBUG} trap are executed before every +simple command, @code{for} command, @code{case} command, +@code{select} command, every arithmetic @code{for} command, and before +the first command executes in a shell function. The @code{DEBUG} trap is not inherited by shell functions unless the -function has been given the @code{trace} attribute. +function has been given the @code{trace} attribute or the +@code{functrace} option has been enabled using the @code{shopt} builtin. +The @code{extdebug} shell option has additional effects on the +@code{DEBUG} trap. The @code{trap} builtin (@pxref{Bourne Shell Builtins}) allows an @code{ERR} pseudo-signal specification, similar to @code{EXIT} and @code{DEBUG}. Commands specified with an @code{ERR} trap are executed after a simple command fails, with a few exceptions. -The @code{ERR} trap is not inherited by shell functions. +The @code{ERR} trap is not inherited by shell functions unless the +@code{-o errtrace} option to the @code{set} builtin is enabled. + +The @code{trap} builtin (@pxref{Bourne Shell Builtins}) allows a +@code{RETURN} pseudo-signal specification, similar to +@code{EXIT} and @code{DEBUG}. +Commands specified with an @code{RETURN} trap are executed before +execution resumes after a shell function or a shell script executed with +@code{.} or @code{source} returns. +The @code{RETURN} trap is not inherited by shell functions. @item The Bash @code{type} builtin is more extensive and gives more information @@ -6841,6 +7202,15 @@ The SVR4.2 shell behaves differently when invoked as @code{jsh} (it turns on job control). @end itemize +@node Copying This Manual +@appendix Copying This Manual + +@menu +* GNU Free Documentation License:: License for copying this manual. +@end menu + +@include fdl.texi + @node Builtin Index @unnumbered Index of Shell Builtin Commands @printindex bt @@ -6861,5 +7231,4 @@ The SVR4.2 shell behaves differently when invoked as @code{jsh} @unnumbered Concept Index @printindex cp -@contents @bye diff --git a/doc/fdl.texi b/doc/fdl.texi new file mode 100644 index 00000000..47ead9f0 --- /dev/null +++ b/doc/fdl.texi @@ -0,0 +1,452 @@ + +@node GNU Free Documentation License +@appendixsec GNU Free Documentation License + +@cindex FDL, GNU Free Documentation License +@center Version 1.2, November 2002 + +@display +Copyright @copyright{} 2000,2001,2002 Free Software Foundation, Inc. +59 Temple Place, Suite 330, Boston, MA 02111-1307, USA + +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. +@end display + +@enumerate 0 +@item +PREAMBLE + +The purpose of this License is to make a manual, textbook, or other +functional and useful document @dfn{free} in the sense of freedom: to +assure everyone the effective freedom to copy and redistribute it, +with or without modifying it, either commercially or noncommercially. +Secondarily, this License preserves for the author and publisher a way +to get credit for their work, while not being considered responsible +for modifications made by others. + +This License is a kind of ``copyleft'', which means that derivative +works of the document must themselves be free in the same sense. It +complements the GNU General Public License, which is a copyleft +license designed for free software. + +We have designed this License in order to use it for manuals for free +software, because free software needs free documentation: a free +program should come with manuals providing the same freedoms that the +software does. But this License is not limited to software manuals; +it can be used for any textual work, regardless of subject matter or +whether it is published as a printed book. We recommend this License +principally for works whose purpose is instruction or reference. + +@item +APPLICABILITY AND DEFINITIONS + +This License applies to any manual or other work, in any medium, that +contains a notice placed by the copyright holder saying it can be +distributed under the terms of this License. Such a notice grants a +world-wide, royalty-free license, unlimited in duration, to use that +work under the conditions stated herein. The ``Document'', below, +refers to any such manual or work. Any member of the public is a +licensee, and is addressed as ``you''. You accept the license if you +copy, modify or distribute the work in a way requiring permission +under copyright law. + +A ``Modified Version'' of the Document means any work containing the +Document or a portion of it, either copied verbatim, or with +modifications and/or translated into another language. + +A ``Secondary Section'' is a named appendix or a front-matter section +of the Document that deals exclusively with the relationship of the +publishers or authors of the Document to the Document's overall +subject (or to related matters) and contains nothing that could fall +directly within that overall subject. (Thus, if the Document is in +part a textbook of mathematics, a Secondary Section may not explain +any mathematics.) The relationship could be a matter of historical +connection with the subject or with related matters, or of legal, +commercial, philosophical, ethical or political position regarding +them. + +The ``Invariant Sections'' are certain Secondary Sections whose titles +are designated, as being those of Invariant Sections, in the notice +that says that the Document is released under this License. If a +section does not fit the above definition of Secondary then it is not +allowed to be designated as Invariant. The Document may contain zero +Invariant Sections. If the Document does not identify any Invariant +Sections then there are none. + +The ``Cover Texts'' are certain short passages of text that are listed, +as Front-Cover Texts or Back-Cover Texts, in the notice that says that +the Document is released under this License. A Front-Cover Text may +be at most 5 words, and a Back-Cover Text may be at most 25 words. + +A ``Transparent'' copy of the Document means a machine-readable copy, +represented in a format whose specification is available to the +general public, that is suitable for revising the document +straightforwardly with generic text editors or (for images composed of +pixels) generic paint programs or (for drawings) some widely available +drawing editor, and that is suitable for input to text formatters or +for automatic translation to a variety of formats suitable for input +to text formatters. A copy made in an otherwise Transparent file +format whose markup, or absence of markup, has been arranged to thwart +or discourage subsequent modification by readers is not Transparent. +An image format is not Transparent if used for any substantial amount +of text. A copy that is not ``Transparent'' is called ``Opaque''. + +Examples of suitable formats for Transparent copies include plain +@sc{ascii} without markup, Texinfo input format, La@TeX{} input +format, @acronym{SGML} or @acronym{XML} using a publicly available +@acronym{DTD}, and standard-conforming simple @acronym{HTML}, +PostScript or @acronym{PDF} designed for human modification. Examples +of transparent image formats include @acronym{PNG}, @acronym{XCF} and +@acronym{JPG}. Opaque formats include proprietary formats that can be +read and edited only by proprietary word processors, @acronym{SGML} or +@acronym{XML} for which the @acronym{DTD} and/or processing tools are +not generally available, and the machine-generated @acronym{HTML}, +PostScript or @acronym{PDF} produced by some word processors for +output purposes only. + +The ``Title Page'' means, for a printed book, the title page itself, +plus such following pages as are needed to hold, legibly, the material +this License requires to appear in the title page. For works in +formats which do not have any title page as such, ``Title Page'' means +the text near the most prominent appearance of the work's title, +preceding the beginning of the body of the text. + +A section ``Entitled XYZ'' means a named subunit of the Document whose +title either is precisely XYZ or contains XYZ in parentheses following +text that translates XYZ in another language. (Here XYZ stands for a +specific section name mentioned below, such as ``Acknowledgements'', +``Dedications'', ``Endorsements'', or ``History''.) To ``Preserve the Title'' +of such a section when you modify the Document means that it remains a +section ``Entitled XYZ'' according to this definition. + +The Document may include Warranty Disclaimers next to the notice which +states that this License applies to the Document. These Warranty +Disclaimers are considered to be included by reference in this +License, but only as regards disclaiming warranties: any other +implication that these Warranty Disclaimers may have is void and has +no effect on the meaning of this License. + +@item +VERBATIM COPYING + +You may copy and distribute the Document in any medium, either +commercially or noncommercially, provided that this License, the +copyright notices, and the license notice saying this License applies +to the Document are reproduced in all copies, and that you add no other +conditions whatsoever to those of this License. You may not use +technical measures to obstruct or control the reading or further +copying of the copies you make or distribute. However, you may accept +compensation in exchange for copies. If you distribute a large enough +number of copies you must also follow the conditions in section 3. + +You may also lend copies, under the same conditions stated above, and +you may publicly display copies. + +@item +COPYING IN QUANTITY + +If you publish printed copies (or copies in media that commonly have +printed covers) of the Document, numbering more than 100, and the +Document's license notice requires Cover Texts, you must enclose the +copies in covers that carry, clearly and legibly, all these Cover +Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on +the back cover. Both covers must also clearly and legibly identify +you as the publisher of these copies. The front cover must present +the full title with all words of the title equally prominent and +visible. You may add other material on the covers in addition. +Copying with changes limited to the covers, as long as they preserve +the title of the Document and satisfy these conditions, can be treated +as verbatim copying in other respects. + +If the required texts for either cover are too voluminous to fit +legibly, you should put the first ones listed (as many as fit +reasonably) on the actual cover, and continue the rest onto adjacent +pages. + +If you publish or distribute Opaque copies of the Document numbering +more than 100, you must either include a machine-readable Transparent +copy along with each Opaque copy, or state in or with each Opaque copy +a computer-network location from which the general network-using +public has access to download using public-standard network protocols +a complete Transparent copy of the Document, free of added material. +If you use the latter option, you must take reasonably prudent steps, +when you begin distribution of Opaque copies in quantity, to ensure +that this Transparent copy will remain thus accessible at the stated +location until at least one year after the last time you distribute an +Opaque copy (directly or through your agents or retailers) of that +edition to the public. + +It is requested, but not required, that you contact the authors of the +Document well before redistributing any large number of copies, to give +them a chance to provide you with an updated version of the Document. + +@item +MODIFICATIONS + +You may copy and distribute a Modified Version of the Document under +the conditions of sections 2 and 3 above, provided that you release +the Modified Version under precisely this License, with the Modified +Version filling the role of the Document, thus licensing distribution +and modification of the Modified Version to whoever possesses a copy +of it. In addition, you must do these things in the Modified Version: + +@enumerate A +@item +Use in the Title Page (and on the covers, if any) a title distinct +from that of the Document, and from those of previous versions +(which should, if there were any, be listed in the History section +of the Document). You may use the same title as a previous version +if the original publisher of that version gives permission. + +@item +List on the Title Page, as authors, one or more persons or entities +responsible for authorship of the modifications in the Modified +Version, together with at least five of the principal authors of the +Document (all of its principal authors, if it has fewer than five), +unless they release you from this requirement. + +@item +State on the Title page the name of the publisher of the +Modified Version, as the publisher. + +@item +Preserve all the copyright notices of the Document. + +@item +Add an appropriate copyright notice for your modifications +adjacent to the other copyright notices. + +@item +Include, immediately after the copyright notices, a license notice +giving the public permission to use the Modified Version under the +terms of this License, in the form shown in the Addendum below. + +@item +Preserve in that license notice the full lists of Invariant Sections +and required Cover Texts given in the Document's license notice. + +@item +Include an unaltered copy of this License. + +@item +Preserve the section Entitled ``History'', Preserve its Title, and add +to it an item stating at least the title, year, new authors, and +publisher of the Modified Version as given on the Title Page. If +there is no section Entitled ``History'' in the Document, create one +stating the title, year, authors, and publisher of the Document as +given on its Title Page, then add an item describing the Modified +Version as stated in the previous sentence. + +@item +Preserve the network location, if any, given in the Document for +public access to a Transparent copy of the Document, and likewise +the network locations given in the Document for previous versions +it was based on. These may be placed in the ``History'' section. +You may omit a network location for a work that was published at +least four years before the Document itself, or if the original +publisher of the version it refers to gives permission. + +@item +For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve +the Title of the section, and preserve in the section all the +substance and tone of each of the contributor acknowledgements and/or +dedications given therein. + +@item +Preserve all the Invariant Sections of the Document, +unaltered in their text and in their titles. Section numbers +or the equivalent are not considered part of the section titles. + +@item +Delete any section Entitled ``Endorsements''. Such a section +may not be included in the Modified Version. + +@item +Do not retitle any existing section to be Entitled ``Endorsements'' or +to conflict in title with any Invariant Section. + +@item +Preserve any Warranty Disclaimers. +@end enumerate + +If the Modified Version includes new front-matter sections or +appendices that qualify as Secondary Sections and contain no material +copied from the Document, you may at your option designate some or all +of these sections as invariant. To do this, add their titles to the +list of Invariant Sections in the Modified Version's license notice. +These titles must be distinct from any other section titles. + +You may add a section Entitled ``Endorsements'', provided it contains +nothing but endorsements of your Modified Version by various +parties---for example, statements of peer review or that the text has +been approved by an organization as the authoritative definition of a +standard. + +You may add a passage of up to five words as a Front-Cover Text, and a +passage of up to 25 words as a Back-Cover Text, to the end of the list +of Cover Texts in the Modified Version. Only one passage of +Front-Cover Text and one of Back-Cover Text may be added by (or +through arrangements made by) any one entity. If the Document already +includes a cover text for the same cover, previously added by you or +by arrangement made by the same entity you are acting on behalf of, +you may not add another; but you may replace the old one, on explicit +permission from the previous publisher that added the old one. + +The author(s) and publisher(s) of the Document do not by this License +give permission to use their names for publicity for or to assert or +imply endorsement of any Modified Version. + +@item +COMBINING DOCUMENTS + +You may combine the Document with other documents released under this +License, under the terms defined in section 4 above for modified +versions, provided that you include in the combination all of the +Invariant Sections of all of the original documents, unmodified, and +list them all as Invariant Sections of your combined work in its +license notice, and that you preserve all their Warranty Disclaimers. + +The combined work need only contain one copy of this License, and +multiple identical Invariant Sections may be replaced with a single +copy. If there are multiple Invariant Sections with the same name but +different contents, make the title of each such section unique by +adding at the end of it, in parentheses, the name of the original +author or publisher of that section if known, or else a unique number. +Make the same adjustment to the section titles in the list of +Invariant Sections in the license notice of the combined work. + +In the combination, you must combine any sections Entitled ``History'' +in the various original documents, forming one section Entitled +``History''; likewise combine any sections Entitled ``Acknowledgements'', +and any sections Entitled ``Dedications''. You must delete all +sections Entitled ``Endorsements.'' + +@item +COLLECTIONS OF DOCUMENTS + +You may make a collection consisting of the Document and other documents +released under this License, and replace the individual copies of this +License in the various documents with a single copy that is included in +the collection, provided that you follow the rules of this License for +verbatim copying of each of the documents in all other respects. + +You may extract a single document from such a collection, and distribute +it individually under this License, provided you insert a copy of this +License into the extracted document, and follow this License in all +other respects regarding verbatim copying of that document. + +@item +AGGREGATION WITH INDEPENDENT WORKS + +A compilation of the Document or its derivatives with other separate +and independent documents or works, in or on a volume of a storage or +distribution medium, is called an ``aggregate'' if the copyright +resulting from the compilation is not used to limit the legal rights +of the compilation's users beyond what the individual works permit. +When the Document is included an aggregate, this License does not +apply to the other works in the aggregate which are not themselves +derivative works of the Document. + +If the Cover Text requirement of section 3 is applicable to these +copies of the Document, then if the Document is less than one half of +the entire aggregate, the Document's Cover Texts may be placed on +covers that bracket the Document within the aggregate, or the +electronic equivalent of covers if the Document is in electronic form. +Otherwise they must appear on printed covers that bracket the whole +aggregate. + +@item +TRANSLATION + +Translation is considered a kind of modification, so you may +distribute translations of the Document under the terms of section 4. +Replacing Invariant Sections with translations requires special +permission from their copyright holders, but you may include +translations of some or all Invariant Sections in addition to the +original versions of these Invariant Sections. You may include a +translation of this License, and all the license notices in the +Document, and any Warranty Disclaimers, provided that you also include +the original English version of this License and the original versions +of those notices and disclaimers. In case of a disagreement between +the translation and the original version of this License or a notice +or disclaimer, the original version will prevail. + +If a section in the Document is Entitled ``Acknowledgements'', +``Dedications'', or ``History'', the requirement (section 4) to Preserve +its Title (section 1) will typically require changing the actual +title. + +@item +TERMINATION + +You may not copy, modify, sublicense, or distribute the Document except +as expressly provided for under this License. Any other attempt to +copy, modify, sublicense or distribute the Document is void, and will +automatically terminate your rights under this License. However, +parties who have received copies, or rights, from you under this +License will not have their licenses terminated so long as such +parties remain in full compliance. + +@item +FUTURE REVISIONS OF THIS LICENSE + +The Free Software Foundation may publish new, revised versions +of the GNU Free Documentation License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. See +@uref{http://www.gnu.org/copyleft/}. + +Each version of the License is given a distinguishing version number. +If the Document specifies that a particular numbered version of this +License ``or any later version'' applies to it, you have the option of +following the terms and conditions either of that specified version or +of any later version that has been published (not as a draft) by the +Free Software Foundation. If the Document does not specify a version +number of this License, you may choose any version ever published (not +as a draft) by the Free Software Foundation. +@end enumerate + +@page +@appendixsubsec ADDENDUM: How to use this License for your documents + +To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and +license notices just after the title page: + +@smallexample +@group + Copyright (C) @var{year} @var{your name}. + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.2 + or any later version published by the Free Software Foundation; + with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. + A copy of the license is included in the section entitled ``GNU + Free Documentation License''. +@end group +@end smallexample + +If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, +replace the ``with...Texts.'' line with this: + +@smallexample +@group + with the Invariant Sections being @var{list their titles}, with + the Front-Cover Texts being @var{list}, and with the Back-Cover Texts + being @var{list}. +@end group +@end smallexample + +If you have Invariant Sections without Cover Texts, or some other +combination of the three, merge those two alternatives to suit the +situation. + +If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, +to permit their use in free software. + +@c Local Variables: +@c ispell-local-pdict: "ispell-dict" +@c End: + diff --git a/doc/fdl.txt b/doc/fdl.txt new file mode 100644 index 00000000..daa2dd4f --- /dev/null +++ b/doc/fdl.txt @@ -0,0 +1,397 @@ + GNU Free Documentation License + Version 1.2, November 2002 + + + Copyright (C) 2000,2001,2002 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + +0. PREAMBLE + +The purpose of this License is to make a manual, textbook, or other +functional and useful document "free" in the sense of freedom: to +assure everyone the effective freedom to copy and redistribute it, +with or without modifying it, either commercially or noncommercially. +Secondarily, this License preserves for the author and publisher a way +to get credit for their work, while not being considered responsible +for modifications made by others. + +This License is a kind of "copyleft", which means that derivative +works of the document must themselves be free in the same sense. It +complements the GNU General Public License, which is a copyleft +license designed for free software. + +We have designed this License in order to use it for manuals for free +software, because free software needs free documentation: a free +program should come with manuals providing the same freedoms that the +software does. But this License is not limited to software manuals; +it can be used for any textual work, regardless of subject matter or +whether it is published as a printed book. We recommend this License +principally for works whose purpose is instruction or reference. + + +1. APPLICABILITY AND DEFINITIONS + +This License applies to any manual or other work, in any medium, that +contains a notice placed by the copyright holder saying it can be +distributed under the terms of this License. Such a notice grants a +world-wide, royalty-free license, unlimited in duration, to use that +work under the conditions stated herein. The "Document", below, +refers to any such manual or work. Any member of the public is a +licensee, and is addressed as "you". You accept the license if you +copy, modify or distribute the work in a way requiring permission +under copyright law. + +A "Modified Version" of the Document means any work containing the +Document or a portion of it, either copied verbatim, or with +modifications and/or translated into another language. + +A "Secondary Section" is a named appendix or a front-matter section of +the Document that deals exclusively with the relationship of the +publishers or authors of the Document to the Document's overall subject +(or to related matters) and contains nothing that could fall directly +within that overall subject. (Thus, if the Document is in part a +textbook of mathematics, a Secondary Section may not explain any +mathematics.) The relationship could be a matter of historical +connection with the subject or with related matters, or of legal, +commercial, philosophical, ethical or political position regarding +them. + +The "Invariant Sections" are certain Secondary Sections whose titles +are designated, as being those of Invariant Sections, in the notice +that says that the Document is released under this License. If a +section does not fit the above definition of Secondary then it is not +allowed to be designated as Invariant. The Document may contain zero +Invariant Sections. If the Document does not identify any Invariant +Sections then there are none. + +The "Cover Texts" are certain short passages of text that are listed, +as Front-Cover Texts or Back-Cover Texts, in the notice that says that +the Document is released under this License. A Front-Cover Text may +be at most 5 words, and a Back-Cover Text may be at most 25 words. + +A "Transparent" copy of the Document means a machine-readable copy, +represented in a format whose specification is available to the +general public, that is suitable for revising the document +straightforwardly with generic text editors or (for images composed of +pixels) generic paint programs or (for drawings) some widely available +drawing editor, and that is suitable for input to text formatters or +for automatic translation to a variety of formats suitable for input +to text formatters. A copy made in an otherwise Transparent file +format whose markup, or absence of markup, has been arranged to thwart +or discourage subsequent modification by readers is not Transparent. +An image format is not Transparent if used for any substantial amount +of text. A copy that is not "Transparent" is called "Opaque". + +Examples of suitable formats for Transparent copies include plain +ASCII without markup, Texinfo input format, LaTeX input format, SGML +or XML using a publicly available DTD, and standard-conforming simple +HTML, PostScript or PDF designed for human modification. Examples of +transparent image formats include PNG, XCF and JPG. Opaque formats +include proprietary formats that can be read and edited only by +proprietary word processors, SGML or XML for which the DTD and/or +processing tools are not generally available, and the +machine-generated HTML, PostScript or PDF produced by some word +processors for output purposes only. + +The "Title Page" means, for a printed book, the title page itself, +plus such following pages as are needed to hold, legibly, the material +this License requires to appear in the title page. For works in +formats which do not have any title page as such, "Title Page" means +the text near the most prominent appearance of the work's title, +preceding the beginning of the body of the text. + +A section "Entitled XYZ" means a named subunit of the Document whose +title either is precisely XYZ or contains XYZ in parentheses following +text that translates XYZ in another language. (Here XYZ stands for a +specific section name mentioned below, such as "Acknowledgements", +"Dedications", "Endorsements", or "History".) To "Preserve the Title" +of such a section when you modify the Document means that it remains a +section "Entitled XYZ" according to this definition. + +The Document may include Warranty Disclaimers next to the notice which +states that this License applies to the Document. These Warranty +Disclaimers are considered to be included by reference in this +License, but only as regards disclaiming warranties: any other +implication that these Warranty Disclaimers may have is void and has +no effect on the meaning of this License. + + +2. VERBATIM COPYING + +You may copy and distribute the Document in any medium, either +commercially or noncommercially, provided that this License, the +copyright notices, and the license notice saying this License applies +to the Document are reproduced in all copies, and that you add no other +conditions whatsoever to those of this License. You may not use +technical measures to obstruct or control the reading or further +copying of the copies you make or distribute. However, you may accept +compensation in exchange for copies. If you distribute a large enough +number of copies you must also follow the conditions in section 3. + +You may also lend copies, under the same conditions stated above, and +you may publicly display copies. + + +3. COPYING IN QUANTITY + +If you publish printed copies (or copies in media that commonly have +printed covers) of the Document, numbering more than 100, and the +Document's license notice requires Cover Texts, you must enclose the +copies in covers that carry, clearly and legibly, all these Cover +Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on +the back cover. Both covers must also clearly and legibly identify +you as the publisher of these copies. The front cover must present +the full title with all words of the title equally prominent and +visible. You may add other material on the covers in addition. +Copying with changes limited to the covers, as long as they preserve +the title of the Document and satisfy these conditions, can be treated +as verbatim copying in other respects. + +If the required texts for either cover are too voluminous to fit +legibly, you should put the first ones listed (as many as fit +reasonably) on the actual cover, and continue the rest onto adjacent +pages. + +If you publish or distribute Opaque copies of the Document numbering +more than 100, you must either include a machine-readable Transparent +copy along with each Opaque copy, or state in or with each Opaque copy +a computer-network location from which the general network-using +public has access to download using public-standard network protocols +a complete Transparent copy of the Document, free of added material. +If you use the latter option, you must take reasonably prudent steps, +when you begin distribution of Opaque copies in quantity, to ensure +that this Transparent copy will remain thus accessible at the stated +location until at least one year after the last time you distribute an +Opaque copy (directly or through your agents or retailers) of that +edition to the public. + +It is requested, but not required, that you contact the authors of the +Document well before redistributing any large number of copies, to give +them a chance to provide you with an updated version of the Document. + + +4. MODIFICATIONS + +You may copy and distribute a Modified Version of the Document under +the conditions of sections 2 and 3 above, provided that you release +the Modified Version under precisely this License, with the Modified +Version filling the role of the Document, thus licensing distribution +and modification of the Modified Version to whoever possesses a copy +of it. In addition, you must do these things in the Modified Version: + +A. Use in the Title Page (and on the covers, if any) a title distinct + from that of the Document, and from those of previous versions + (which should, if there were any, be listed in the History section + of the Document). You may use the same title as a previous version + if the original publisher of that version gives permission. +B. List on the Title Page, as authors, one or more persons or entities + responsible for authorship of the modifications in the Modified + Version, together with at least five of the principal authors of the + Document (all of its principal authors, if it has fewer than five), + unless they release you from this requirement. +C. State on the Title page the name of the publisher of the + Modified Version, as the publisher. +D. Preserve all the copyright notices of the Document. +E. Add an appropriate copyright notice for your modifications + adjacent to the other copyright notices. +F. Include, immediately after the copyright notices, a license notice + giving the public permission to use the Modified Version under the + terms of this License, in the form shown in the Addendum below. +G. Preserve in that license notice the full lists of Invariant Sections + and required Cover Texts given in the Document's license notice. +H. Include an unaltered copy of this License. +I. Preserve the section Entitled "History", Preserve its Title, and add + to it an item stating at least the title, year, new authors, and + publisher of the Modified Version as given on the Title Page. If + there is no section Entitled "History" in the Document, create one + stating the title, year, authors, and publisher of the Document as + given on its Title Page, then add an item describing the Modified + Version as stated in the previous sentence. +J. Preserve the network location, if any, given in the Document for + public access to a Transparent copy of the Document, and likewise + the network locations given in the Document for previous versions + it was based on. These may be placed in the "History" section. + You may omit a network location for a work that was published at + least four years before the Document itself, or if the original + publisher of the version it refers to gives permission. +K. For any section Entitled "Acknowledgements" or "Dedications", + Preserve the Title of the section, and preserve in the section all + the substance and tone of each of the contributor acknowledgements + and/or dedications given therein. +L. Preserve all the Invariant Sections of the Document, + unaltered in their text and in their titles. Section numbers + or the equivalent are not considered part of the section titles. +M. Delete any section Entitled "Endorsements". Such a section + may not be included in the Modified Version. +N. Do not retitle any existing section to be Entitled "Endorsements" + or to conflict in title with any Invariant Section. +O. Preserve any Warranty Disclaimers. + +If the Modified Version includes new front-matter sections or +appendices that qualify as Secondary Sections and contain no material +copied from the Document, you may at your option designate some or all +of these sections as invariant. To do this, add their titles to the +list of Invariant Sections in the Modified Version's license notice. +These titles must be distinct from any other section titles. + +You may add a section Entitled "Endorsements", provided it contains +nothing but endorsements of your Modified Version by various +parties--for example, statements of peer review or that the text has +been approved by an organization as the authoritative definition of a +standard. + +You may add a passage of up to five words as a Front-Cover Text, and a +passage of up to 25 words as a Back-Cover Text, to the end of the list +of Cover Texts in the Modified Version. Only one passage of +Front-Cover Text and one of Back-Cover Text may be added by (or +through arrangements made by) any one entity. If the Document already +includes a cover text for the same cover, previously added by you or +by arrangement made by the same entity you are acting on behalf of, +you may not add another; but you may replace the old one, on explicit +permission from the previous publisher that added the old one. + +The author(s) and publisher(s) of the Document do not by this License +give permission to use their names for publicity for or to assert or +imply endorsement of any Modified Version. + + +5. COMBINING DOCUMENTS + +You may combine the Document with other documents released under this +License, under the terms defined in section 4 above for modified +versions, provided that you include in the combination all of the +Invariant Sections of all of the original documents, unmodified, and +list them all as Invariant Sections of your combined work in its +license notice, and that you preserve all their Warranty Disclaimers. + +The combined work need only contain one copy of this License, and +multiple identical Invariant Sections may be replaced with a single +copy. If there are multiple Invariant Sections with the same name but +different contents, make the title of each such section unique by +adding at the end of it, in parentheses, the name of the original +author or publisher of that section if known, or else a unique number. +Make the same adjustment to the section titles in the list of +Invariant Sections in the license notice of the combined work. + +In the combination, you must combine any sections Entitled "History" +in the various original documents, forming one section Entitled +"History"; likewise combine any sections Entitled "Acknowledgements", +and any sections Entitled "Dedications". You must delete all sections +Entitled "Endorsements". + + +6. COLLECTIONS OF DOCUMENTS + +You may make a collection consisting of the Document and other documents +released under this License, and replace the individual copies of this +License in the various documents with a single copy that is included in +the collection, provided that you follow the rules of this License for +verbatim copying of each of the documents in all other respects. + +You may extract a single document from such a collection, and distribute +it individually under this License, provided you insert a copy of this +License into the extracted document, and follow this License in all +other respects regarding verbatim copying of that document. + + +7. AGGREGATION WITH INDEPENDENT WORKS + +A compilation of the Document or its derivatives with other separate +and independent documents or works, in or on a volume of a storage or +distribution medium, is called an "aggregate" if the copyright +resulting from the compilation is not used to limit the legal rights +of the compilation's users beyond what the individual works permit. +When the Document is included an aggregate, this License does not +apply to the other works in the aggregate which are not themselves +derivative works of the Document. + +If the Cover Text requirement of section 3 is applicable to these +copies of the Document, then if the Document is less than one half of +the entire aggregate, the Document's Cover Texts may be placed on +covers that bracket the Document within the aggregate, or the +electronic equivalent of covers if the Document is in electronic form. +Otherwise they must appear on printed covers that bracket the whole +aggregate. + + +8. TRANSLATION + +Translation is considered a kind of modification, so you may +distribute translations of the Document under the terms of section 4. +Replacing Invariant Sections with translations requires special +permission from their copyright holders, but you may include +translations of some or all Invariant Sections in addition to the +original versions of these Invariant Sections. You may include a +translation of this License, and all the license notices in the +Document, and any Warranty Disclaimers, provided that you also include +the original English version of this License and the original versions +of those notices and disclaimers. In case of a disagreement between +the translation and the original version of this License or a notice +or disclaimer, the original version will prevail. + +If a section in the Document is Entitled "Acknowledgements", +"Dedications", or "History", the requirement (section 4) to Preserve +its Title (section 1) will typically require changing the actual +title. + + +9. TERMINATION + +You may not copy, modify, sublicense, or distribute the Document except +as expressly provided for under this License. Any other attempt to +copy, modify, sublicense or distribute the Document is void, and will +automatically terminate your rights under this License. However, +parties who have received copies, or rights, from you under this +License will not have their licenses terminated so long as such +parties remain in full compliance. + + +10. FUTURE REVISIONS OF THIS LICENSE + +The Free Software Foundation may publish new, revised versions +of the GNU Free Documentation License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. See +http://www.gnu.org/copyleft/. + +Each version of the License is given a distinguishing version number. +If the Document specifies that a particular numbered version of this +License "or any later version" applies to it, you have the option of +following the terms and conditions either of that specified version or +of any later version that has been published (not as a draft) by the +Free Software Foundation. If the Document does not specify a version +number of this License, you may choose any version ever published (not +as a draft) by the Free Software Foundation. + + +ADDENDUM: How to use this License for your documents + +To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and +license notices just after the title page: + + Copyright (c) YEAR YOUR NAME. + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.2 + or any later version published by the Free Software Foundation; + with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. + A copy of the license is included in the section entitled "GNU + Free Documentation License". + +If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, +replace the "with...Texts." line with this: + + with the Invariant Sections being LIST THEIR TITLES, with the + Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST. + +If you have Invariant Sections without Cover Texts, or some other +combination of the three, merge those two alternatives to suit the +situation. + +If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, +to permit their use in free software. diff --git a/doc/infopost.sh b/doc/infopost.sh new file mode 100755 index 00000000..85c49b4d --- /dev/null +++ b/doc/infopost.sh @@ -0,0 +1,8 @@ +#! /bin/sh +# +# Some of these should really be done by options to makeinfo or by +# using @setfilename, but this way we can have both bashref.info and +# bash.info (for installing) +# + +sed -e 's|bashref.info|bash.info|g' diff --git a/doc/texinfo.tex b/doc/texinfo.tex index c49af9f4..555a0770 100644 --- a/doc/texinfo.tex +++ b/doc/texinfo.tex @@ -3,10 +3,10 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{1999-09-25.10} +\def\texinfoversion{2003-02-03.16} % -% Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 -% Free Software Foundation, Inc. +% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, +% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. % % This texinfo.tex file is free software; you can redistribute it and/or % modify it under the terms of the GNU General Public License as @@ -29,16 +29,17 @@ % % Please try the latest version of texinfo.tex before submitting bug % reports; you can get the latest version from: -% ftp://ftp.gnu.org/gnu/texinfo.tex -% (and all GNU mirrors, see http://www.gnu.org/order/ftp.html) -% ftp://texinfo.org/tex/texinfo.tex -% ftp://us.ctan.org/macros/texinfo/texinfo.tex -% (and all CTAN mirrors, finger ctan@us.ctan.org for a list). -% /home/gd/gnu/doc/texinfo.tex on the GNU machines. +% ftp://ftp.gnu.org/gnu/texinfo/texinfo.tex +% (and all GNU mirrors, see http://www.gnu.org/order/ftp.html) +% ftp://tug.org/tex/texinfo.tex +% (and all CTAN mirrors, see http://www.ctan.org), +% and /home/gd/gnu/doc/texinfo.tex on the GNU machines. +% +% The GNU Texinfo home page is http://www.gnu.org/software/texinfo. +% % The texinfo.tex in any given Texinfo distribution could well be out % of date, so if that's what you're using, please check. -% Texinfo has a small home page at http://texinfo.org/. -% +% % Send bug reports to bug-texinfo@gnu.org. Please include including a % complete document in each bug report with which we can reproduce the % problem. Patches are, of course, greatly appreciated. @@ -50,13 +51,14 @@ % texindex foo.?? % tex foo.texi % tex foo.texi -% dvips foo.dvi -o # or whatever, to process the dvi file; this makes foo.ps. -% The extra runs of TeX get the cross-reference information correct. +% dvips foo.dvi -o # or whatever; this makes foo.ps. +% The extra TeX runs get the cross-reference information correct. % Sometimes one run after texindex suffices, and sometimes you need more % than two; texi2dvi does it as many times as necessary. -% -% It is possible to adapt texinfo.tex for other languages. You can get -% the existing language-specific files from ftp://ftp.gnu.org/gnu/texinfo/. +% +% It is possible to adapt texinfo.tex for other languages, to some +% extent. You can get the existing language-specific files from the +% full Texinfo distribution. \message{Loading texinfo [version \texinfoversion]:} @@ -66,6 +68,13 @@ \everyjob{\message{[Texinfo version \texinfoversion]}% \catcode`+=\active \catcode`\_=\active} +\message{Basics,} +\chardef\other=12 + +% We never want plain's outer \+ definition in Texinfo. +% For @tex, we can use \tabalign. +\let\+ = \relax + % Save some parts of plain tex whose names we will redefine. \let\ptexb=\b \let\ptexbullet=\bullet @@ -76,19 +85,16 @@ \let\ptexend=\end \let\ptexequiv=\equiv \let\ptexexclam=\! +\let\ptexgtr=> +\let\ptexhat=^ \let\ptexi=\i \let\ptexlbrace=\{ +\let\ptexless=< +\let\ptexplus=+ \let\ptexrbrace=\} \let\ptexstar=\* \let\ptext=\t -% We never want plain's outer \+ definition in Texinfo. -% For @tex, we can use \tabalign. -\let\+ = \relax - -\message{Basics,} -\chardef\other=12 - % If this character appears in an error message or help string, it % starts a new line in the output. \newlinechar = `^^J @@ -135,40 +141,74 @@ \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi \ifx\putwordDeftypefun\undefined\gdef\putwordDeftypefun{Function}\fi +% In some macros, we cannot use the `\? notation---the left quote is +% in some cases the escape char. +\chardef\colonChar = `\: +\chardef\commaChar = `\, +\chardef\dotChar = `\. +\chardef\equalChar = `\= +\chardef\exclamChar= `\! +\chardef\questChar = `\? +\chardef\semiChar = `\; +\chardef\spaceChar = `\ % +\chardef\underChar = `\_ + % Ignore a token. % \def\gobble#1{} +% True if #1 is the empty string, i.e., called like `\ifempty{}'. +% +\def\ifempty#1{\ifemptyx #1\emptymarkA\emptymarkB}% +\def\ifemptyx#1#2\emptymarkB{\ifx #1\emptymarkA}% + +% Hyphenation fixes. \hyphenation{ap-pen-dix} \hyphenation{mini-buf-fer mini-buf-fers} \hyphenation{eshell} \hyphenation{white-space} % Margin to add to right of even pages, to left of odd pages. -\newdimen \bindingoffset -\newdimen \normaloffset +\newdimen\bindingoffset +\newdimen\normaloffset \newdimen\pagewidth \newdimen\pageheight % Sometimes it is convenient to have everything in the transcript file % and nothing on the terminal. We don't just call \tracingall here, -% since that produces some useless output on the terminal. +% since that produces some useless output on the terminal. We also make +% some effort to order the tracing commands to reduce output in the log +% file; cf. trace.sty in LaTeX. % \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% -\ifx\eTeXversion\undefined -\def\loggingall{\tracingcommands2 \tracingstats2 - \tracingpages1 \tracingoutput1 \tracinglostchars1 - \tracingmacros2 \tracingparagraphs1 \tracingrestores1 - \showboxbreadth\maxdimen\showboxdepth\maxdimen -}% -\else -\def\loggingall{\tracingcommands3 \tracingstats2 - \tracingpages1 \tracingoutput1 \tracinglostchars1 - \tracingmacros2 \tracingparagraphs1 \tracingrestores1 - \tracingscantokens1 \tracingassigns1 \tracingifs1 - \tracinggroups1 \tracingnesting2 - \showboxbreadth\maxdimen\showboxdepth\maxdimen +\def\loggingall{% + \tracingstats2 + \tracingpages1 + \tracinglostchars2 % 2 gives us more in etex + \tracingparagraphs1 + \tracingoutput1 + \tracingmacros2 + \tracingrestores1 + \showboxbreadth\maxdimen \showboxdepth\maxdimen + \ifx\eTeXversion\undefined\else % etex gives us more logging + \tracingscantokens1 + \tracingifs1 + \tracinggroups1 + \tracingnesting2 + \tracingassigns1 + \fi + \tracingcommands3 % 3 gives us more in etex + \errorcontextlines\maxdimen }% -\fi + +% add check for \lastpenalty to plain's definitions. If the last thing +% we did was a \nobreak, we don't want to insert more space. +% +\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount + \removelastskip\penalty-50\smallskip\fi\fi} +\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount + \removelastskip\penalty-100\medskip\fi\fi} +\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount + \removelastskip\penalty-200\bigskip\fi\fi} % For @cropmarks command. % Do @cropmarks to get crop marks. @@ -214,6 +254,9 @@ \normalturnoffactive % \ in index entries must not stay \, e.g., if % the page break happens to be in the middle of an example. \shipout\vbox{% + % Do this early so pdf references go to the beginning of the page. + \ifpdfmakepagedest \pdfmkdest{\the\pageno} \fi + % \ifcropmarks \vbox to \outervsize\bgroup \hsize = \outerhsize \vskip-\topandbottommargin @@ -243,8 +286,6 @@ \unvbox\footlinebox \fi % - \ifpdfmakepagedest \pdfmkdest{\the\pageno} \fi - % \ifcropmarks \egroup % end of \vbox\bgroup \hfil\egroup % end of (centering) \line\bgroup @@ -262,7 +303,7 @@ \egroup % \vbox from first cropmarks clause \fi }% end of \shipout\vbox - }% end of group with \turnoffactive + }% end of group with \normalturnoffactive \advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi } @@ -422,17 +463,6 @@ } -% Single-spacing is done by various environments (specifically, in -% \nonfillstart and \quotations). -\newskip\singlespaceskip \singlespaceskip = 12.5pt -\def\singlespace{% - % Why was this kern here? It messes up equalizing space above and below - % environments. --karl, 6may93 - %{\advance \baselineskip by -\singlespaceskip - %\kern \baselineskip}% - \setleading \singlespaceskip -} - %% Simple single-character @ commands % @@ prints an @ @@ -452,16 +482,19 @@ \let\{=\mylbrace \let\}=\myrbrace \begingroup - % Definitions to produce actual \{ & \} command in an index. - \catcode`\{ = 12 \catcode`\} = 12 + % Definitions to produce \{ and \} commands for indices, + % and @{ and @} for the aux file. + \catcode`\{ = \other \catcode`\} = \other \catcode`\[ = 1 \catcode`\] = 2 - \catcode`\@ = 0 \catcode`\\ = 12 - @gdef@lbracecmd[\{]% - @gdef@rbracecmd[\}]% -@endgroup + \catcode`\! = 0 \catcode`\\ = \other + !gdef!lbracecmd[\{]% + !gdef!rbracecmd[\}]% + !gdef!lbraceatcmd[@{]% + !gdef!rbraceatcmd[@}]% +!endgroup % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent -% Others are defined by plain TeX: @` @' @" @^ @~ @= @v @H. +% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. \let\, = \c \let\dotaccent = \. \def\ringaccent#1{{\accent23 #1}} @@ -470,7 +503,7 @@ \let\udotaccent = \d % Other special characters: @questiondown @exclamdown -% Plain TeX defines: @AA @AE @O @OE @L (and lowercase versions) @ss. +% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. \def\questiondown{?`} \def\exclamdown{!`} @@ -525,6 +558,16 @@ % therefore, no glue is inserted, and the space between the headline and % the text is small, which looks bad. % +% Another complication is that the group might be very large. This can +% cause the glue on the previous page to be unduly stretched, because it +% does not have much material. In this case, it's better to add an +% explicit \vfill so that the extra space is at the bottom. The +% threshold for doing this is if the group is more than \vfilllimit +% percent of a page (\vfilllimit can be changed inside of @tex). +% +\newbox\groupbox +\def\vfilllimit{0.7} +% \def\group{\begingroup \ifnum\catcode13=\active \else \errhelp = \groupinvalidhelp @@ -538,10 +581,22 @@ % above. But it's pretty close. \def\Egroup{% \egroup % End the \vtop. + % \dimen0 is the vertical size of the group's box. + \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox + % \dimen2 is how much space is left on the page (more or less). + \dimen2 = \pageheight \advance\dimen2 by -\pagetotal + % if the group doesn't fit on the current page, and it's a big big + % group, force a page break. + \ifdim \dimen0 > \dimen2 + \ifdim \pagetotal < \vfilllimit\pageheight + \page + \fi + \fi + \copy\groupbox \endgroup % End the \group. }% % - \vtop\bgroup + \setbox\groupbox = \vtop\bgroup % We have to put a strut on the last line in case the @group is in % the midst of an example, rather than completely enclosing it. % Otherwise, the interline space between the last line of the group @@ -687,44 +742,88 @@ where each line of input produces a line of output.} \def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount \leftline{\hskip\leftskip{\rm#1}}}} -% @inmargin{TEXT} puts TEXT in the margin next to the current paragraph. - -\def\inmargin#1{% -\strut\vadjust{\nobreak\kern-\strutdepth - \vtop to \strutdepth{\baselineskip\strutdepth\vss - \llap{\rightskip=\inmarginspacing \vbox{\noindent #1}}\null}}} +% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current +% paragraph. For more general purposes, use the \margin insertion +% class. WHICH is `l' or `r'. +% \newskip\inmarginspacing \inmarginspacing=1cm \def\strutdepth{\dp\strutbox} - -%\hbox{{\rm#1}}\hfil\break}} +% +\def\doinmargin#1#2{\strut\vadjust{% + \nobreak + \kern-\strutdepth + \vtop to \strutdepth{% + \baselineskip=\strutdepth + \vss + % if you have multiple lines of stuff to put here, you'll need to + % make the vbox yourself of the appropriate size. + \ifx#1l% + \llap{\ignorespaces #2\hskip\inmarginspacing}% + \else + \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}% + \fi + \null + }% +}} +\def\inleftmargin{\doinmargin l} +\def\inrightmargin{\doinmargin r} +% +% @inmargin{TEXT [, RIGHT-TEXT]} +% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right; +% else use TEXT for both). +% +\def\inmargin#1{\parseinmargin #1,,\finish} +\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing. + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt + \def\lefttext{#1}% have both texts + \def\righttext{#2}% + \else + \def\lefttext{#1}% have only one text + \def\righttext{#1}% + \fi + % + \ifodd\pageno + \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin + \else + \def\temp{\inleftmargin\lefttext}% + \fi + \temp +} % @include file insert text of that file as input. % Allow normal characters that we make active in the argument (a file name). \def\include{\begingroup - \catcode`\\=12 - \catcode`~=12 - \catcode`^=12 - \catcode`_=12 - \catcode`|=12 - \catcode`<=12 - \catcode`>=12 - \catcode`+=12 + \catcode`\\=\other + \catcode`~=\other + \catcode`^=\other + \catcode`_=\other + \catcode`|=\other + \catcode`<=\other + \catcode`>=\other + \catcode`+=\other \parsearg\includezzz} % Restore active chars for included file. \def\includezzz#1{\endgroup\begingroup % Read the included file in a group so nested @include's work. \def\thisfile{#1}% + \let\value=\expandablevalue \input\thisfile \endgroup} \def\thisfile{} -% @center line outputs that line, centered - -\def\center{\parsearg\centerzzz} -\def\centerzzz #1{{\advance\hsize by -\leftskip -\advance\hsize by -\rightskip -\centerline{#1}}} +% @center line +% outputs that line, centered. +% +\def\center{\parsearg\docenter} +\def\docenter#1{{% + \ifhmode \hfil\break \fi + \advance\hsize by -\leftskip + \advance\hsize by -\rightskip + \line{\hfil \ignorespaces#1\unskip \hfil}% + \ifhmode \break \fi +}} % @sp n outputs n lines of vertical space @@ -784,18 +883,56 @@ where each line of input produces a line of output.} % \def\asis#1{#1} -% @math means output in math mode. -% We don't use $'s directly in the definition of \math because control -% sequences like \math are expanded when the toc file is written. Then, -% we read the toc file back, the $'s will be normal characters (as they -% should be, according to the definition of Texinfo). So we must use a -% control sequence to switch into and out of math mode. +% @math outputs its argument in math mode. +% We don't use $'s directly in the definition of \math because we need +% to set catcodes according to plain TeX first, to allow for subscripts, +% superscripts, special math chars, etc. +% +\let\implicitmath = $%$ font-lock fix % -% This isn't quite enough for @math to work properly in indices, but it -% seems unlikely it will ever be needed there. +% One complication: _ usually means subscripts, but it could also mean +% an actual _ character, as in @math{@var{some_variable} + 1}. So make +% _ within @math be active (mathcode "8000), and distinguish by seeing +% if the current family is \slfam, which is what @var uses. +% +{\catcode\underChar = \active +\gdef\mathunderscore{% + \catcode\underChar=\active + \def_{\ifnum\fam=\slfam \_\else\sb\fi}% +}} % -\let\implicitmath = $ -\def\math#1{\implicitmath #1\implicitmath} +% Another complication: we want \\ (and @\) to output a \ character. +% FYI, plain.tex uses \\ as a temporary control sequence (why?), but +% this is not advertised and we don't care. Texinfo does not +% otherwise define @\. +% +% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\. +\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} +% +\def\math{% + \tex + \mathcode`\_="8000 \mathunderscore + \let\\ = \mathbackslash + \mathactive + \implicitmath\finishmath} +\def\finishmath#1{#1\implicitmath\Etex} + +% Some active characters (such as <) are spaced differently in math. +% We have to reset their definitions in case the @math was an +% argument to a command which set the catcodes (such as @item or @section). +% +{ + \catcode`^ = \active + \catcode`< = \active + \catcode`> = \active + \catcode`+ = \active + \gdef\mathactive{% + \let^ = \ptexhat + \let< = \ptexless + \let> = \ptexgtr + \let+ = \ptexplus + } +} % @bullet and @minus need the same treatment as @math, just above. \def\bullet{\implicitmath\ptexbullet\implicitmath} @@ -878,20 +1015,26 @@ where each line of input produces a line of output.} \def\dopdfimage#1#2#3{% \def\imagewidth{#2}% \def\imageheight{#3}% + % without \immediate, pdftex seg faults when the same image is + % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.) \ifnum\pdftexversion < 14 - \pdfimage + \immediate\pdfimage \else - \pdfximage + \immediate\pdfximage \fi \ifx\empty\imagewidth\else width \imagewidth \fi \ifx\empty\imageheight\else height \imageheight \fi - {#1.pdf}% + \ifnum\pdftexversion<13 + #1.pdf% + \else + {#1.pdf}% + \fi \ifnum\pdftexversion < 14 \else \pdfrefximage \pdflastximage \fi} - \def\pdfmkdest#1{\pdfdest name{#1@} xyz} - \def\pdfmkpgn#1{#1@} - \let\linkcolor = \Cyan + \def\pdfmkdest#1{{\normalturnoffactive \pdfdest name{#1} xyz}} + \def\pdfmkpgn#1{#1} + \let\linkcolor = \Blue % was Cyan, but that seems light? \def\endlink{\Black\pdfendlink} % Adding outlines to PDF; macros for calculating structure of outlines % come from Petr Olsak @@ -902,41 +1045,43 @@ where each line of input produces a line of output.} \expandafter\xdef\csname#1\endcsname{\the\tempnum}} \def\pdfmakeoutlines{{% \openin 1 \jobname.toc - \ifeof 1\else\bgroup + \ifeof 1\else\begingroup \closein 1 - \indexnofonts - \def\tt{} - % thanh's hack / proper braces in bookmarks + % Thanh's hack / proper braces in bookmarks \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace % \def\chapentry ##1##2##3{} - \def\unnumbchapentry ##1##2{} \def\secentry ##1##2##3##4{\advancenumber{chap##2}} - \def\unnumbsecentry ##1##2{} \def\subsecentry ##1##2##3##4##5{\advancenumber{sec##2.##3}} - \def\unnumbsubsecentry ##1##2{} \def\subsubsecentry ##1##2##3##4##5##6{\advancenumber{subsec##2.##3.##4}} - \def\unnumbsubsubsecentry ##1##2{} + \let\appendixentry = \chapentry + \let\unnumbchapentry = \chapentry + \let\unnumbsecentry = \secentry + \let\unnumbsubsecentry = \subsecentry + \let\unnumbsubsubsecentry = \subsubsecentry \input \jobname.toc \def\chapentry ##1##2##3{% \pdfoutline goto name{\pdfmkpgn{##3}}count-\expnumber{chap##2}{##1}} - \def\unnumbchapentry ##1##2{% - \pdfoutline goto name{\pdfmkpgn{##2}}{##1}} \def\secentry ##1##2##3##4{% \pdfoutline goto name{\pdfmkpgn{##4}}count-\expnumber{sec##2.##3}{##1}} - \def\unnumbsecentry ##1##2{% - \pdfoutline goto name{\pdfmkpgn{##2}}{##1}} \def\subsecentry ##1##2##3##4##5{% \pdfoutline goto name{\pdfmkpgn{##5}}count-\expnumber{subsec##2.##3.##4}{##1}} - \def\unnumbsubsecentry ##1##2{% - \pdfoutline goto name{\pdfmkpgn{##2}}{##1}} \def\subsubsecentry ##1##2##3##4##5##6{% \pdfoutline goto name{\pdfmkpgn{##6}}{##1}} - \def\unnumbsubsubsecentry ##1##2{% - \pdfoutline goto name{\pdfmkpgn{##2}}{##1}} + \let\appendixentry = \chapentry + \let\unnumbchapentry = \chapentry + \let\unnumbsecentry = \secentry + \let\unnumbsubsecentry = \subsecentry + \let\unnumbsubsubsecentry = \subsubsecentry + % + % Make special characters normal for writing to the pdf file. + % + \indexnofonts + \let\tt=\relax + \turnoffactive \input \jobname.toc - \egroup\fi + \endgroup\fi }} \def\makelinks #1,{% \def\params{#1}\def\E{END}% @@ -986,6 +1131,7 @@ where each line of input produces a line of output.} \def\pdfurl#1{% \begingroup \normalturnoffactive\def\@{@}% + \let\value=\expandablevalue \leavevmode\Red \startlink attr{/Border [0 0 0]}% user{/Subtype /Link /A << /S /URI /URI (#1) >>}% @@ -1013,9 +1159,8 @@ where each line of input produces a line of output.} \def\makelink{\addtokens{\toksB}% {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} \def\pdflink#1{% - \startlink attr{/Border [0 0 0]} goto name{\mkpgn{#1}} + \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} \linkcolor #1\endlink} - \def\mkpgn#1{#1@} \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} \fi % \ifx\pdfoutput @@ -1032,9 +1177,26 @@ where each line of input produces a line of output.} % We don't need math for this one. \def\ttsl{\tenttsl} -% Use Computer Modern fonts at \magstephalf (11pt). -\newcount\mainmagstep -\mainmagstep=\magstephalf +% Default leading. +\newdimen\textleading \textleading = 13.2pt + +% Set the baselineskip to #1, and the lineskip and strut size +% correspondingly. There is no deep meaning behind these magic numbers +% used as factors; they just match (closely enough) what Knuth defined. +% +\def\lineskipfactor{.08333} +\def\strutheightpercent{.70833} +\def\strutdepthpercent {.29167} +% +\def\setleading#1{% + \normalbaselineskip = #1\relax + \normallineskip = \lineskipfactor\normalbaselineskip + \normalbaselines + \setbox\strutbox =\hbox{% + \vrule width0pt height\strutheightpercent\baselineskip + depth \strutdepthpercent \baselineskip + }% +} % Set the font macro #1 to the font named #2, adding on the % specified font prefix (normally `cm'). @@ -1064,17 +1226,21 @@ where each line of input produces a line of output.} \def\scshape{csc} \def\scbshape{csc} +\newcount\mainmagstep \ifx\bigger\relax -\let\mainmagstep=\magstep1 -\setfont\textrm\rmshape{12}{1000} -\setfont\texttt\ttshape{12}{1000} + % not really supported. + \mainmagstep=\magstep1 + \setfont\textrm\rmshape{12}{1000} + \setfont\texttt\ttshape{12}{1000} \else -\setfont\textrm\rmshape{10}{\mainmagstep} -\setfont\texttt\ttshape{10}{\mainmagstep} + \mainmagstep=\magstephalf + \setfont\textrm\rmshape{10}{\mainmagstep} + \setfont\texttt\ttshape{10}{\mainmagstep} \fi -% Instead of cmb10, you many want to use cmbx10. +% Instead of cmb10, you may want to use cmbx10. % cmbx10 is a prettier font on its own, but cmb10 -% looks better when embedded in a line with cmr10. +% looks better when embedded in a line with cmr10 +% (in Bob's opinion). \setfont\textbf\bfshape{10}{\mainmagstep} \setfont\textit\itshape{10}{\mainmagstep} \setfont\textsl\slshape{10}{\mainmagstep} @@ -1101,6 +1267,18 @@ where each line of input produces a line of output.} \font\smalli=cmmi9 \font\smallsy=cmsy9 +% Fonts for small examples (8pt). +\setfont\smallerrm\rmshape{8}{1000} +\setfont\smallertt\ttshape{8}{1000} +\setfont\smallerbf\bfshape{10}{800} +\setfont\smallerit\itshape{8}{1000} +\setfont\smallersl\slshape{8}{1000} +\setfont\smallersf\sfshape{8}{1000} +\setfont\smallersc\scshape{10}{800} +\setfont\smallerttsl\ttslshape{10}{800} +\font\smalleri=cmmi8 +\font\smallersy=cmsy8 + % Fonts for title page: \setfont\titlerm\rmbshape{12}{\magstep3} \setfont\titleit\itbshape{10}{\magstep4} @@ -1113,6 +1291,7 @@ where each line of input produces a line of output.} \font\titlei=cmmi12 scaled \magstep3 \font\titlesy=cmsy10 scaled \magstep4 \def\authorrm{\secrm} +\def\authortt{\sectt} % Chapter (and unnumbered) fonts (17.28pt). \setfont\chaprm\rmbshape{12}{\magstep2} @@ -1138,20 +1317,6 @@ where each line of input produces a line of output.} \font\seci=cmmi12 scaled \magstep1 \font\secsy=cmsy10 scaled \magstep2 -% \setfont\ssecrm\bxshape{10}{\magstep1} % This size an font looked bad. -% \setfont\ssecit\itshape{10}{\magstep1} % The letters were too crowded. -% \setfont\ssecsl\slshape{10}{\magstep1} -% \setfont\ssectt\ttshape{10}{\magstep1} -% \setfont\ssecsf\sfshape{10}{\magstep1} - -%\setfont\ssecrm\bfshape{10}{1315} % Note the use of cmb rather than cmbx. -%\setfont\ssecit\itshape{10}{1315} % Also, the size is a little larger than -%\setfont\ssecsl\slshape{10}{1315} % being scaled magstep1. -%\setfont\ssectt\ttshape{10}{1315} -%\setfont\ssecsf\sfshape{10}{1315} - -%\let\ssecbf=\ssecrm - % Subsection fonts (13.15pt). \setfont\ssecrm\rmbshape{12}{\magstephalf} \setfont\ssecit\itbshape{10}{1315} @@ -1168,17 +1333,16 @@ where each line of input produces a line of output.} % In order for the font changes to affect most math symbols and letters, % we have to define the \textfont of the standard families. Since -% texinfo doesn't allow for producing subscripts and superscripts, we -% don't bother to reset \scriptfont and \scriptscriptfont (which would -% also require loading a lot more fonts). +% texinfo doesn't allow for producing subscripts and superscripts except +% in the main text, we don't bother to reset \scriptfont and +% \scriptscriptfont (which would also require loading a lot more fonts). % \def\resetmathfonts{% - \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy - \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf - \textfont\ttfam = \tentt \textfont\sffam = \tensf + \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy + \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf + \textfont\ttfam=\tentt \textfont\sffam=\tensf } - % The font-changing commands redefine the meanings of \tenSTYLE, instead % of just \STYLE. We do this so that font changes will continue to work % in math mode, where it is the current \fam that is relevant in most @@ -1189,7 +1353,7 @@ where each line of input produces a line of output.} \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl - \resetmathfonts} + \resetmathfonts \setleading{\textleading}} \def\titlefonts{% \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc @@ -1218,7 +1382,32 @@ where each line of input produces a line of output.} \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy \let\tenttsl=\smallttsl - \resetmathfonts \setleading{11pt}} + \resetmathfonts \setleading{10.5pt}} +\def\smallerfonts{% + \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl + \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc + \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy + \let\tenttsl=\smallerttsl + \resetmathfonts \setleading{9.5pt}} + +% Set the fonts to use with the @small... environments. +\let\smallexamplefonts = \smallfonts + +% About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample +% can fit this many characters: +% 8.5x11=86 smallbook=72 a4=90 a5=69 +% If we use \smallerfonts (8pt), then we can fit this many characters: +% 8.5x11=90+ smallbook=80 a4=90+ a5=77 +% For me, subjectively, the few extra characters that fit aren't worth +% the additional smallness of 8pt. So I'm making the default 9pt. +% +% By the way, for comparison, here's what fits with @example (10pt): +% 8.5x11=71 smallbook=60 a4=75 a5=58 +% +% I wish we used A4 paper on this side of the Atlantic. +% +% --karl, 24jan03. + % Set up the default fonts, so we can use them for creating boxes. % @@ -1235,6 +1424,7 @@ where each line of input produces a line of output.} \setfont\shortcontrm\rmshape{12}{1000} \setfont\shortcontbf\bxshape{12}{1000} \setfont\shortcontsl\slshape{12}{1000} +\setfont\shortconttt\ttshape{12}{1000} %% Add scribe-like font environments, plus @l for inline lisp (usually sans %% serif) and @ii for TeX italic @@ -1242,8 +1432,8 @@ where each line of input produces a line of output.} % \smartitalic{ARG} outputs arg in italics, followed by an italic correction % unless the following character is such as not to need one. \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi} -\def\smartslanted#1{{\sl #1}\futurelet\next\smartitalicx} -\def\smartitalic#1{{\it #1}\futurelet\next\smartitalicx} +\def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx} +\def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx} \let\i=\smartitalic \let\var=\smartslanted @@ -1261,6 +1451,17 @@ where each line of input produces a line of output.} \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} \def\restorehyphenation{\hyphenchar\font = `- } +% Set sfcode to normal for the chars that usually have another value. +% Can't use plain's \frenchspacing because it uses the `\x notation, and +% sometimes \x has an active definition that messes things up. +% +\catcode`@=11 + \def\frenchspacing{% + \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m + \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m + } +\catcode`@=\other + \def\t#1{% {\tt \rawbackslash \frenchspacing #1}% \null @@ -1332,11 +1533,19 @@ where each line of input produces a line of output.} \def\realdash{-} \def\codedash{-\discretionary{}{}{}} -\def\codeunder{\ifusingtt{\normalunderscore\discretionary{}{}{}}{\_}} +\def\codeunder{% + % this is all so @math{@code{var_name}+1} can work. In math mode, _ + % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.) + % will therefore expand the active definition of _, which is us + % (inside @code that is), therefore an endless loop. + \ifusingtt{\ifmmode + \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_. + \else\normalunderscore \fi + \discretionary{}{}{}}% + {\_}% +} \def\codex #1{\tclose{#1}\endgroup} -%\let\exp=\tclose %Was temporary - % @kbd is like @code, except that if the argument is just one @key command, % then @kbd has no effect. @@ -1352,15 +1561,17 @@ where each line of input produces a line of output.} \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% \else\ifx\arg\wordcode \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% + \else + \errhelp = \EMsimple + \errmessage{Unknown @kbdinputstyle `\arg'}% \fi\fi\fi } \def\worddistinct{distinct} \def\wordexample{example} \def\wordcode{code} -% Default is kbdinputdistinct. (Too much of a hassle to call the macro, -% the catcodes are wrong for parsearg to work.) -\gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl} +% Default is `distinct.' +\kbdinputstyle distinct \def\xkey{\key} \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% @@ -1474,7 +1685,8 @@ where each line of input produces a line of output.} \let\subtitlerm=\tenrm \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}% % - \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}% + \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines + \let\tt=\authortt}% % % Leave some space at the very top of the page. \vglue\titlepagetopglue @@ -1521,6 +1733,10 @@ where each line of input produces a line of output.} \oldpage \endgroup % + % Need this before the \...aftertitlepage checks so that if they are + % in effect the toc pages will come out with page numbers. + \HEADINGSon + % % If they want short, they certainly want long too. \ifsetshortcontentsaftertitlepage \shortcontents @@ -1534,10 +1750,6 @@ where each line of input produces a line of output.} \global\let\contents = \relax \global\let\shortcontents = \relax \fi - % - \ifpdf \pdfmakepagedesttrue \fi - % - \HEADINGSon } \def\finishtitlepage{% @@ -1670,7 +1882,10 @@ where each line of input produces a line of output.} } % Subroutines used in generating headings -% Produces Day Month Year style of output. +% This produces Day Month Year style of output. +% Only define if not already defined, in case a txi-??.tex file has set +% up a different format (e.g., txi-cs.tex does this). +\ifx\today\undefined \def\today{% \number\day\space \ifcase\month @@ -1679,6 +1894,7 @@ where each line of input produces a line of output.} \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec \fi \space\number\year} +\fi % @settitle line... specifies the title of the document, for headings. % It generates no output of its own. @@ -1751,10 +1967,18 @@ where each line of input produces a line of output.} % \parskip glue -- logically it's part of the @item we just started. \nobreak \vskip-\parskip % - % Stop a page break at the \parskip glue coming up. Unfortunately + % Stop a page break at the \parskip glue coming up. (Unfortunately % we can't prevent a possible page break at the following - % \baselineskip glue. - \nobreak + % \baselineskip glue.) However, if what follows is an environment + % such as @example, there will be no \parskip glue; then + % the negative vskip we just would cause the example and the item to + % crash together. So we use this bizarre value of 10001 as a signal + % to \aboveenvbreak to insert \parskip glue after all. + % (Possibly there are other commands that could be followed by + % @example which need the same treatment, but not section titles; or + % maybe section titles are the only special case and they should be + % penalty 10001...) + \penalty 10001 \endgroup \itemxneedsnegativevskipfalse \else @@ -1860,11 +2084,6 @@ where each line of input produces a line of output.} \def\itemcontents{#1}% \let\item=\itemizeitem} -% Set sfcode to normal for the chars that usually have another value. -% These are `.?!:;,' -\def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000 - \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 } - % \splitoff TOKENS\endmark defines \first to be the first token in % TOKENS, and \rest to be the remainder. % @@ -2086,8 +2305,8 @@ where each line of input produces a line of output.} \let\go\pickupwholefraction \else \global\advance\colcount by 1 - \setbox0=\hbox{#1\unskip }% Add a normal word space as a separator; - % typically that is always in the input, anyway. + \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a + % separator; typically that is always in the input, anyway. \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% \fi \fi @@ -2102,18 +2321,18 @@ where each line of input produces a line of output.} \go } -% This used to have \hskip1sp. But then the space in a template line is -% not enough. That is bad. So let's go back to just & until we -% encounter the problem it was intended to solve again. -% --karl, nathan@acm.org, 20apr99. -\def\tab{&} - % @multitable ... @end multitable definitions: % \def\multitable{\parsearg\dotable} \def\dotable#1{\bgroup \vskip\parskip - \let\item\crcr + \let\item=\crcrwithfootnotes + % A \tab used to include \hskip1sp. But then the space in a template + % line is not enough. That is bad. So let's go back to just & until + % we encounter the problem it was intended to solve again. --karl, + % nathan@acm.org, 20apr99. + \let\tab=&% + \let\startfootins=\startsavedfootnote \tolerance=9500 \hbadness=9500 \setmultitablespacing @@ -2121,7 +2340,11 @@ where each line of input produces a line of output.} \parindent=\multitableparindent \overfullrule=0pt \global\colcount=0 - \def\Emultitable{\global\setpercentfalse\cr\egroup\egroup}% + \def\Emultitable{% + \global\setpercentfalse + \crcrwithfootnotes\crcr + \egroup\egroup + }% % % To parse everything between @multitable and @item: \setuptable#1 \endsetuptable @@ -2210,6 +2433,25 @@ width0pt\relax} \fi %% than skip between lines in the table. \fi} +% In case a @footnote appears inside an alignment, save the footnote +% text to a box and make the \insert when a row of the table is +% finished. Otherwise, the insertion is lost, it never migrates to the +% main vertical list. --kasal, 22jan03. +% +\newbox\savedfootnotes +% +% \dotable \let's \startfootins to this, so that \dofootnote will call +% it instead of starting the insertion right away. +\def\startsavedfootnote{% + \global\setbox\savedfootnotes = \vbox\bgroup + \unvbox\savedfootnotes +} +\def\crcrwithfootnotes{% + \crcr + \ifvoid\savedfootnotes \else + \noalign{\insert\footins{\box\savedfootnotes}}% + \fi +} \message{conditionals,} % Prevent errors for section commands. @@ -2245,64 +2487,117 @@ width0pt\relax} \fi % and so want to turn off most commands, in case they are used % incorrectly. % +% We use \empty instead of \relax for the @def... commands, so that \end +% doesn't throw an error. For instance: +% @ignore +% @deffn ... +% @end deffn +% @end ignore +% +% The @end deffn is going to get expanded, because we're trying to allow +% nested conditionals. But we don't want to expand the actual @deffn, +% since it might be syntactically correct and intended to be ignored. +% Since \end checks for \relax, using \empty does not cause an error. +% \def\ignoremorecommands{% \let\defcodeindex = \relax - \let\defcv = \relax - \let\deffn = \relax - \let\deffnx = \relax + \let\defcv = \empty + \let\defcvx = \empty + \let\Edefcv = \empty + \let\deffn = \empty + \let\deffnx = \empty + \let\Edeffn = \empty \let\defindex = \relax - \let\defivar = \relax - \let\defmac = \relax - \let\defmethod = \relax - \let\defop = \relax - \let\defopt = \relax - \let\defspec = \relax - \let\deftp = \relax - \let\deftypefn = \relax - \let\deftypefun = \relax - \let\deftypeivar = \relax - \let\deftypeop = \relax - \let\deftypevar = \relax - \let\deftypevr = \relax - \let\defun = \relax - \let\defvar = \relax - \let\defvr = \relax - \let\ref = \relax - \let\xref = \relax - \let\printindex = \relax - \let\pxref = \relax - \let\settitle = \relax - \let\setchapternewpage = \relax - \let\setchapterstyle = \relax - \let\everyheading = \relax + \let\defivar = \empty + \let\defivarx = \empty + \let\Edefivar = \empty + \let\defmac = \empty + \let\defmacx = \empty + \let\Edefmac = \empty + \let\defmethod = \empty + \let\defmethodx = \empty + \let\Edefmethod = \empty + \let\defop = \empty + \let\defopx = \empty + \let\Edefop = \empty + \let\defopt = \empty + \let\defoptx = \empty + \let\Edefopt = \empty + \let\defspec = \empty + \let\defspecx = \empty + \let\Edefspec = \empty + \let\deftp = \empty + \let\deftpx = \empty + \let\Edeftp = \empty + \let\deftypefn = \empty + \let\deftypefnx = \empty + \let\Edeftypefn = \empty + \let\deftypefun = \empty + \let\deftypefunx = \empty + \let\Edeftypefun = \empty + \let\deftypeivar = \empty + \let\deftypeivarx = \empty + \let\Edeftypeivar = \empty + \let\deftypemethod = \empty + \let\deftypemethodx = \empty + \let\Edeftypemethod = \empty + \let\deftypeop = \empty + \let\deftypeopx = \empty + \let\Edeftypeop = \empty + \let\deftypevar = \empty + \let\deftypevarx = \empty + \let\Edeftypevar = \empty + \let\deftypevr = \empty + \let\deftypevrx = \empty + \let\Edeftypevr = \empty + \let\defun = \empty + \let\defunx = \empty + \let\Edefun = \empty + \let\defvar = \empty + \let\defvarx = \empty + \let\Edefvar = \empty + \let\defvr = \empty + \let\defvrx = \empty + \let\Edefvr = \empty + \let\clear = \relax + \let\down = \relax + \let\evenfooting = \relax \let\evenheading = \relax - \let\oddheading = \relax \let\everyfooting = \relax - \let\evenfooting = \relax - \let\oddfooting = \relax + \let\everyheading = \relax \let\headings = \relax \let\include = \relax + \let\item = \relax \let\lowersections = \relax - \let\down = \relax + \let\oddfooting = \relax + \let\oddheading = \relax + \let\printindex = \relax + \let\pxref = \relax \let\raisesections = \relax - \let\up = \relax + \let\ref = \relax \let\set = \relax - \let\clear = \relax - \let\item = \relax + \let\setchapternewpage = \relax + \let\setchapterstyle = \relax + \let\settitle = \relax + \let\up = \relax + \let\verbatiminclude = \relax + \let\xref = \relax } -% Ignore @ignore ... @end ignore. -% -\def\ignore{\doignore{ignore}} - -% Ignore @ifinfo, @ifhtml, @ifnottex, @html, @menu, and @direntry text. +% Ignore @ignore, @ifhtml, @ifinfo, and the like. % -\def\ifinfo{\doignore{ifinfo}} +\def\direntry{\doignore{direntry}} +\def\documentdescriptionword{documentdescription} +\def\documentdescription{\doignore{documentdescription}} +\def\html{\doignore{html}} \def\ifhtml{\doignore{ifhtml}} +\def\ifinfo{\doignore{ifinfo}} \def\ifnottex{\doignore{ifnottex}} -\def\html{\doignore{html}} +\def\ifplaintext{\doignore{ifplaintext}} +\def\ifxml{\doignore{ifxml}} +\def\ignore{\doignore{ignore}} \def\menu{\doignore{menu}} -\def\direntry{\doignore{direntry}} +\def\xml{\doignore{xml}} % @dircategory CATEGORY -- specify a category of the dir file % which this file should belong to. Ignore this in TeX. @@ -2320,7 +2615,7 @@ width0pt\relax} \fi \long\def\doignoretext##1@end #1{\enddoignore}% % % Make sure that spaces turn into tokens that match what \doignoretext wants. - \catcode32 = 10 + \catcode\spaceChar = 10 % % Ignore braces, too, so mismatched braces don't cause trouble. \catcode`\{ = 9 @@ -2329,14 +2624,21 @@ width0pt\relax} \fi % We must not have @c interpreted as a control sequence. \catcode`\@ = 12 % - % Make the letter c a comment character so that the rest of the line - % will be ignored. This way, the document can have (for example) - % @c @end ifinfo - % and the @end ifinfo will be properly ignored. - % (We've just changed @ to catcode 12.) - \catcode`\c = 14 + \def\ignoreword{#1}% + \ifx\ignoreword\documentdescriptionword + % The c kludge breaks documentdescription, since + % `documentdescription' contains a `c'. Means not everything will + % be ignored inside @documentdescription, but oh well... + \else + % Make the letter c a comment character so that the rest of the line + % will be ignored. This way, the document can have (for example) + % @c @end ifinfo + % and the @end ifinfo will be properly ignored. + % (We've just changed @ to catcode 12.) + \catcode`\c = 14 + \fi % - % And now expand that command. + % And now expand the command defined above. \doignoretext } @@ -2355,7 +2657,7 @@ width0pt\relax} \fi \immediate\write16{If you are running another version of TeX, relax.} \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.} \immediate\write16{ Then upgrade your TeX installation if you can.} - \immediate\write16{ (See ftp://ftp.gnu.org/pub/gnu/TeX.README.)} + \immediate\write16{ (See ftp://ftp.gnu.org/non-gnu/TeX.README.)} \immediate\write16{If you are stuck with version 3.0, run the} \immediate\write16{ script ``tex3patch'' from the Texinfo distribution} \immediate\write16{ to use a workaround.} @@ -2377,8 +2679,8 @@ width0pt\relax} \fi % We must actually expand the ignored text to look for the @end % command, so that nested ignore constructs work. Thus, we put the % text into a \vbox and then do nothing with the result. To minimize - % the change of memory overflow, we follow the approach outlined on - % page 401 of the TeXbook: make the current font be a dummy font. + % the chance of memory overflow, we follow the approach outlined on + % page 401 of the TeXbook. % \setbox0 = \vbox\bgroup % Don't complain about control sequences we have declared \outer. @@ -2399,8 +2701,8 @@ width0pt\relax} \fi % % Set the current font to be \nullfont, a TeX primitive, and define % all the font commands to also use \nullfont. We don't use - % dummy.tfm, as suggested in the TeXbook, because not all sites - % might have that installed. Therefore, math mode will still + % dummy.tfm, as suggested in the TeXbook, because some sites + % might not have that installed. Therefore, math mode will still % produce output, but that should be an extremely small amount of % stuff compared to the main input. % @@ -2408,10 +2710,14 @@ width0pt\relax} \fi \let\tenrm=\nullfont \let\tenit=\nullfont \let\tensl=\nullfont \let\tenbf=\nullfont \let\tentt=\nullfont \let\smallcaps=\nullfont \let\tensf=\nullfont - % Similarly for index fonts (mostly for their use in smallexample). + % Similarly for index fonts. \let\smallrm=\nullfont \let\smallit=\nullfont \let\smallsl=\nullfont \let\smallbf=\nullfont \let\smalltt=\nullfont \let\smallsc=\nullfont \let\smallsf=\nullfont + % Similarly for smallexample fonts. + \let\smallerrm=\nullfont \let\smallerit=\nullfont \let\smallersl=\nullfont + \let\smallerbf=\nullfont \let\smallertt=\nullfont \let\smallersc=\nullfont + \let\smallersf=\nullfont % % Don't complain when characters are missing from the fonts. \tracinglostchars = 0 @@ -2425,7 +2731,7 @@ width0pt\relax} \fi % Do minimal line-breaking. \pretolerance = 10000 % - % Do not execute instructions in @tex + % Do not execute instructions in @tex. \def\tex{\doignore{tex}}% % Do not execute macro definitions. % `c' is a comment character, so the word `macro' will get cut off. @@ -2470,7 +2776,7 @@ width0pt\relax} \fi % we're called from @code, as @code{@value{foo-bar_}}. So \let any % such active characters to their normal equivalents. \gdef\value{\begingroup - \catcode`\-=12 \catcode`\_=12 + \catcode`\-=\other \catcode`\_=\other \indexbreaks \let_\normalunderscore \valuexxx} } @@ -2479,15 +2785,17 @@ width0pt\relax} \fi % We have this subroutine so that we can handle at least some @value's % properly in indexes (we \let\value to this in \indexdummies). Ones % whose names contain - or _ still won't work, but we can't do anything -% about that. The command has to be fully expandable, since the result -% winds up in the index file. This means that if the variable's value -% contains other Texinfo commands, it's almost certain it will fail -% (although perhaps we could fix that with sufficient work to do a -% one-level expansion on the result, instead of complete). +% about that. The command has to be fully expandable (if the variable +% is set), since the result winds up in the index file. This means that +% if the variable's value contains other Texinfo commands, it's almost +% certain it will fail (although perhaps we could fix that with +% sufficient work to do a one-level expansion on the result, instead of +% complete). % \def\expandablevalue#1{% \expandafter\ifx\csname SET#1\endcsname\relax {[No value for ``#1'']}% + \message{Variable `#1', used in @value, is not set.}% \else \csname SET#1\endcsname \fi @@ -2496,13 +2804,14 @@ width0pt\relax} \fi % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined % with @set. % -\def\ifset{\parsearg\ifsetxxx} -\def\ifsetxxx #1{% +\def\ifset{\parsearg\doifset} +\def\doifset#1{% \expandafter\ifx\csname SET#1\endcsname\relax - \expandafter\ifsetfail + \let\next=\ifsetfail \else - \expandafter\ifsetsucceed + \let\next=\ifsetsucceed \fi + \next } \def\ifsetsucceed{\conditionalsucceed{ifset}} \def\ifsetfail{\nestedignore{ifset}} @@ -2511,51 +2820,39 @@ width0pt\relax} \fi % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been % defined with @set, or has been undefined with @clear. % -\def\ifclear{\parsearg\ifclearxxx} -\def\ifclearxxx #1{% +\def\ifclear{\parsearg\doifclear} +\def\doifclear#1{% \expandafter\ifx\csname SET#1\endcsname\relax - \expandafter\ifclearsucceed + \let\next=\ifclearsucceed \else - \expandafter\ifclearfail + \let\next=\ifclearfail \fi + \next } \def\ifclearsucceed{\conditionalsucceed{ifclear}} \def\ifclearfail{\nestedignore{ifclear}} \defineunmatchedend{ifclear} -% @iftex, @ifnothtml, @ifnotinfo always succeed; we read the text -% following, through the first @end iftex (etc.). Make `@end iftex' -% (etc.) valid only after an @iftex. +% @iftex, @ifnothtml, @ifnotinfo, @ifnotplaintext always succeed; we +% read the text following, through the first @end iftex (etc.). Make +% `@end iftex' (etc.) valid only after an @iftex. % \def\iftex{\conditionalsucceed{iftex}} \def\ifnothtml{\conditionalsucceed{ifnothtml}} \def\ifnotinfo{\conditionalsucceed{ifnotinfo}} +\def\ifnotplaintext{\conditionalsucceed{ifnotplaintext}} \defineunmatchedend{iftex} \defineunmatchedend{ifnothtml} \defineunmatchedend{ifnotinfo} +\defineunmatchedend{ifnotplaintext} -% We can't just want to start a group at @iftex (for example) and end it -% at @end iftex, since then @set commands inside the conditional have no -% effect (they'd get reverted at the end of the group). So we must -% define \Eiftex to redefine itself to be its previous value. (We can't -% just define it to fail again with an ``unmatched end'' error, since -% the @ifset might be nested.) -% -\def\conditionalsucceed#1{% - \edef\temp{% - % Remember the current value of \E#1. - \let\nece{prevE#1} = \nece{E#1}% - % - % At the `@end #1', redefine \E#1 to be its previous value. - \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}% - }% - \temp -} - -% We need to expand lots of \csname's, but we don't want to expand the -% control sequences after we've constructed them. +% True conditional. Since \set globally defines its variables, we can +% just start and end a group (to keep the @end definition undefined at +% the outer level). % -\def\nece#1{\expandafter\noexpand\csname#1\endcsname} +\def\conditionalsucceed#1{\begingroup + \expandafter\def\csname E#1\endcsname{\endgroup}% +} % @defininfoenclose. \let\definfoenclose=\comment @@ -2587,42 +2884,48 @@ width0pt\relax} \fi } % @defindex foo == \newindex{foo} - +% \def\defindex{\parsearg\newindex} % Define @defcodeindex, like @defindex except put all entries in @code. - +% +\def\defcodeindex{\parsearg\newcodeindex} +% \def\newcodeindex#1{% \iflinks \expandafter\newwrite \csname#1indfile\endcsname \openout \csname#1indfile\endcsname \jobname.#1 \fi \expandafter\xdef\csname#1index\endcsname{% - \noexpand\docodeindex{#1}} + \noexpand\docodeindex{#1}}% } -\def\defcodeindex{\parsearg\newcodeindex} % @synindex foo bar makes index foo feed into index bar. % Do this instead of @defindex foo if you don't want it as a separate index. -% The \closeout helps reduce unnecessary open files; the limit on the -% Acorn RISC OS is a mere 16 files. -\def\synindex#1 #2 {% - \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname - \expandafter\closeout\csname#1indfile\endcsname - \expandafter\let\csname#1indfile\endcsname=\synindexfoo - \expandafter\xdef\csname#1index\endcsname{% define \xxxindex - \noexpand\doindex{#2}}% -} - +% % @syncodeindex foo bar similar, but put all entries made for index foo % inside @code. -\def\syncodeindex#1 #2 {% - \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname - \expandafter\closeout\csname#1indfile\endcsname - \expandafter\let\csname#1indfile\endcsname=\synindexfoo - \expandafter\xdef\csname#1index\endcsname{% define \xxxindex - \noexpand\docodeindex{#2}}% +% +\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}} +\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}} + +% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo), +% #3 the target index (bar). +\def\dosynindex#1#2#3{% + % Only do \closeout if we haven't already done it, else we'll end up + % closing the target index. + \expandafter \ifx\csname donesynindex#2\endcsname \undefined + % The \closeout helps reduce unnecessary open files; the limit on the + % Acorn RISC OS is a mere 16 files. + \expandafter\closeout\csname#2indfile\endcsname + \expandafter\let\csname\donesynindex#2\endcsname = 1 + \fi + % redefine \fooindfile: + \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname + \expandafter\let\csname#2indfile\endcsname=\temp + % redefine \fooindex: + \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}% } % Define \doindex, the driver for all \fooindex macros. @@ -2642,171 +2945,254 @@ width0pt\relax} \fi \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} +% Take care of Texinfo commands that can appear in an index entry. +% Since there are some commands we want to expand, and others we don't, +% we have to laboriously prevent expansion for those that we don't. +% \def\indexdummies{% -\def\ { }% -% Take care of the plain tex accent commands. -\def\"{\realbackslash "}% -\def\`{\realbackslash `}% -\def\'{\realbackslash '}% -\def\^{\realbackslash ^}% -\def\~{\realbackslash ~}% -\def\={\realbackslash =}% -\def\b{\realbackslash b}% -\def\c{\realbackslash c}% -\def\d{\realbackslash d}% -\def\u{\realbackslash u}% -\def\v{\realbackslash v}% -\def\H{\realbackslash H}% -% Take care of the plain tex special European modified letters. -\def\oe{\realbackslash oe}% -\def\ae{\realbackslash ae}% -\def\aa{\realbackslash aa}% -\def\OE{\realbackslash OE}% -\def\AE{\realbackslash AE}% -\def\AA{\realbackslash AA}% -\def\o{\realbackslash o}% -\def\O{\realbackslash O}% -\def\l{\realbackslash l}% -\def\L{\realbackslash L}% -\def\ss{\realbackslash ss}% -% Take care of texinfo commands likely to appear in an index entry. -% (Must be a way to avoid doing expansion at all, and thus not have to -% laboriously list every single command here.) -\def\@{@}% will be @@ when we switch to @ as escape char. -% Need these in case \tex is in effect and \{ is a \delimiter again. -% But can't use \lbracecmd and \rbracecmd because texindex assumes -% braces and backslashes are used only as delimiters. -\let\{ = \mylbrace -\let\} = \myrbrace -\def\_{{\realbackslash _}}% -\def\w{\realbackslash w }% -\def\bf{\realbackslash bf }% -%\def\rm{\realbackslash rm }% -\def\sl{\realbackslash sl }% -\def\sf{\realbackslash sf}% -\def\tt{\realbackslash tt}% -\def\gtr{\realbackslash gtr}% -\def\less{\realbackslash less}% -\def\hat{\realbackslash hat}% -\def\TeX{\realbackslash TeX}% -\def\dots{\realbackslash dots }% -\def\result{\realbackslash result}% -\def\equiv{\realbackslash equiv}% -\def\expansion{\realbackslash expansion}% -\def\print{\realbackslash print}% -\def\error{\realbackslash error}% -\def\point{\realbackslash point}% -\def\copyright{\realbackslash copyright}% -\def\tclose##1{\realbackslash tclose {##1}}% -\def\code##1{\realbackslash code {##1}}% -\def\uref##1{\realbackslash uref {##1}}% -\def\url##1{\realbackslash url {##1}}% -\def\env##1{\realbackslash env {##1}}% -\def\command##1{\realbackslash command {##1}}% -\def\option##1{\realbackslash option {##1}}% -\def\dotless##1{\realbackslash dotless {##1}}% -\def\samp##1{\realbackslash samp {##1}}% -\def\,##1{\realbackslash ,{##1}}% -\def\t##1{\realbackslash t {##1}}% -\def\r##1{\realbackslash r {##1}}% -\def\i##1{\realbackslash i {##1}}% -\def\b##1{\realbackslash b {##1}}% -\def\sc##1{\realbackslash sc {##1}}% -\def\cite##1{\realbackslash cite {##1}}% -\def\key##1{\realbackslash key {##1}}% -\def\file##1{\realbackslash file {##1}}% -\def\var##1{\realbackslash var {##1}}% -\def\kbd##1{\realbackslash kbd {##1}}% -\def\dfn##1{\realbackslash dfn {##1}}% -\def\emph##1{\realbackslash emph {##1}}% -\def\acronym##1{\realbackslash acronym {##1}}% -% -% Handle some cases of @value -- where the variable name does not -% contain - or _, and the value does not contain any -% (non-fully-expandable) commands. -\let\value = \expandablevalue -% -\unsepspaces -% Turn off macro expansion -\turnoffmacros + \def\@{@}% change to @@ when we switch to @ as escape char in index files. + \def\ {\realbackslash\space }% + % Need these in case \tex is in effect and \{ is a \delimiter again. + % But can't use \lbracecmd and \rbracecmd because texindex assumes + % braces and backslashes are used only as delimiters. + \let\{ = \mylbrace + \let\} = \myrbrace + % + % \definedummyword defines \#1 as \realbackslash #1\space, thus + % effectively preventing its expansion. This is used only for control + % words, not control letters, because the \space would be incorrect + % for control characters, but is needed to separate the control word + % from whatever follows. + % + % For control letters, we have \definedummyletter, which omits the + % space. + % + % These can be used both for control words that take an argument and + % those that do not. If it is followed by {arg} in the input, then + % that will dutifully get written to the index (or wherever). + % + \def\definedummyword##1{% + \expandafter\def\csname ##1\endcsname{\realbackslash ##1\space}% + }% + \def\definedummyletter##1{% + \expandafter\def\csname ##1\endcsname{\realbackslash ##1}% + }% + % + % Do the redefinitions. + \commondummies +} + +% For the aux file, @ is the escape character. So we want to redefine +% everything using @ instead of \realbackslash. When everything uses +% @, this will be simpler. +% +\def\atdummies{% + \def\@{@@}% + \def\ {@ }% + \let\{ = \lbraceatcmd + \let\} = \rbraceatcmd + % + % (See comments in \indexdummies.) + \def\definedummyword##1{% + \expandafter\def\csname ##1\endcsname{@##1\space}% + }% + \def\definedummyletter##1{% + \expandafter\def\csname ##1\endcsname{@##1}% + }% + % + % Do the redefinitions. + \commondummies +} + +% Called from \indexdummies and \atdummies. \definedummyword and +% \definedummyletter must be defined first. +% +\def\commondummies{% + % + \normalturnoffactive + % + % Control letters and accents. + \definedummyletter{_}% + \definedummyletter{,}% + \definedummyletter{"}% + \definedummyletter{`}% + \definedummyletter{'}% + \definedummyletter{^}% + \definedummyletter{~}% + \definedummyletter{=}% + \definedummyword{u}% + \definedummyword{v}% + \definedummyword{H}% + \definedummyword{dotaccent}% + \definedummyword{ringaccent}% + \definedummyword{tieaccent}% + \definedummyword{ubaraccent}% + \definedummyword{udotaccent}% + \definedummyword{dotless}% + % + % Other non-English letters. + \definedummyword{AA}% + \definedummyword{AE}% + \definedummyword{L}% + \definedummyword{OE}% + \definedummyword{O}% + \definedummyword{aa}% + \definedummyword{ae}% + \definedummyword{l}% + \definedummyword{oe}% + \definedummyword{o}% + \definedummyword{ss}% + % + % Although these internal commands shouldn't show up, sometimes they do. + \definedummyword{bf}% + \definedummyword{gtr}% + \definedummyword{hat}% + \definedummyword{less}% + \definedummyword{sf}% + \definedummyword{sl}% + \definedummyword{tclose}% + \definedummyword{tt}% + % + % Texinfo font commands. + \definedummyword{b}% + \definedummyword{i}% + \definedummyword{r}% + \definedummyword{sc}% + \definedummyword{t}% + % + \definedummyword{TeX}% + \definedummyword{acronym}% + \definedummyword{cite}% + \definedummyword{code}% + \definedummyword{command}% + \definedummyword{dfn}% + \definedummyword{dots}% + \definedummyword{emph}% + \definedummyword{env}% + \definedummyword{file}% + \definedummyword{kbd}% + \definedummyword{key}% + \definedummyword{math}% + \definedummyword{option}% + \definedummyword{samp}% + \definedummyword{strong}% + \definedummyword{uref}% + \definedummyword{url}% + \definedummyword{var}% + \definedummyword{w}% + % + % Assorted special characters. + \definedummyword{bullet}% + \definedummyword{copyright}% + \definedummyword{dots}% + \definedummyword{enddots}% + \definedummyword{equiv}% + \definedummyword{error}% + \definedummyword{expansion}% + \definedummyword{minus}% + \definedummyword{pounds}% + \definedummyword{point}% + \definedummyword{print}% + \definedummyword{result}% + % + % Handle some cases of @value -- where the variable name does not + % contain - or _, and the value does not contain any + % (non-fully-expandable) commands. + \let\value = \expandablevalue + % + % Normal spaces, not active ones. + \unsepspaces + % + % No macro expansion. + \turnoffmacros } % If an index command is used in an @example environment, any spaces % therein should become regular spaces in the raw index file, not the -% expansion of \tie (\\leavevmode \penalty \@M \ ). +% expansion of \tie (\leavevmode \penalty \@M \ ). {\obeyspaces \gdef\unsepspaces{\obeyspaces\let =\space}} -% \indexnofonts no-ops all font-change commands. -% This is used when outputting the strings to sort the index by. -\def\indexdummyfont#1{#1} + +% \indexnofonts is used when outputting the strings to sort the index +% by, and when constructing control sequence names. It eliminates all +% control sequences and just writes whatever the best ASCII sort string +% would be for a given command (usually its argument). +% \def\indexdummytex{TeX} \def\indexdummydots{...} - +% \def\indexnofonts{% -% Just ignore accents. -\let\,=\indexdummyfont -\let\"=\indexdummyfont -\let\`=\indexdummyfont -\let\'=\indexdummyfont -\let\^=\indexdummyfont -\let\~=\indexdummyfont -\let\==\indexdummyfont -\let\b=\indexdummyfont -\let\c=\indexdummyfont -\let\d=\indexdummyfont -\let\u=\indexdummyfont -\let\v=\indexdummyfont -\let\H=\indexdummyfont -\let\dotless=\indexdummyfont -% Take care of the plain tex special European modified letters. -\def\oe{oe}% -\def\ae{ae}% -\def\aa{aa}% -\def\OE{OE}% -\def\AE{AE}% -\def\AA{AA}% -\def\o{o}% -\def\O{O}% -\def\l{l}% -\def\L{L}% -\def\ss{ss}% -\let\w=\indexdummyfont -\let\t=\indexdummyfont -\let\r=\indexdummyfont -\let\i=\indexdummyfont -\let\b=\indexdummyfont -\let\emph=\indexdummyfont -\let\strong=\indexdummyfont -\let\cite=\indexdummyfont -\let\sc=\indexdummyfont -%Don't no-op \tt, since it isn't a user-level command -% and is used in the definitions of the active chars like <, >, |... -%\let\tt=\indexdummyfont -\let\tclose=\indexdummyfont -\let\code=\indexdummyfont -\let\url=\indexdummyfont -\let\uref=\indexdummyfont -\let\env=\indexdummyfont -\let\acronym=\indexdummyfont -\let\command=\indexdummyfont -\let\option=\indexdummyfont -\let\file=\indexdummyfont -\let\samp=\indexdummyfont -\let\kbd=\indexdummyfont -\let\key=\indexdummyfont -\let\var=\indexdummyfont -\let\TeX=\indexdummytex -\let\dots=\indexdummydots -\def\@{@}% -} - -% To define \realbackslash, we must make \ not be an escape. -% We must first make another character (@) an escape -% so we do not become unable to do a definition. - -{\catcode`\@=0 \catcode`\\=\other - @gdef@realbackslash{\}} + \def\ { }% + \def\@{@}% + % how to handle braces? + \def\_{\normalunderscore}% + % + \let\,=\asis + \let\"=\asis + \let\`=\asis + \let\'=\asis + \let\^=\asis + \let\~=\asis + \let\==\asis + \let\u=\asis + \let\v=\asis + \let\H=\asis + \let\dotaccent=\asis + \let\ringaccent=\asis + \let\tieaccent=\asis + \let\ubaraccent=\asis + \let\udotaccent=\asis + \let\dotless=\asis + % + % Other non-English letters. + \def\AA{AA}% + \def\AE{AE}% + \def\L{L}% + \def\OE{OE}% + \def\O{O}% + \def\aa{aa}% + \def\ae{ae}% + \def\l{l}% + \def\oe{oe}% + \def\o{o}% + \def\ss{ss}% + \def\exclamdown{!}% + \def\questiondown{?}% + % + % Don't no-op \tt, since it isn't a user-level command + % and is used in the definitions of the active chars like <, >, |, etc. + % Likewise with the other plain tex font commands. + %\let\tt=\asis + % + % Texinfo font commands. + \let\b=\asis + \let\i=\asis + \let\r=\asis + \let\sc=\asis + \let\t=\asis + % + \let\TeX=\indexdummytex + \let\acronym=\asis + \let\cite=\asis + \let\code=\asis + \let\command=\asis + \let\dfn=\asis + \let\dots=\indexdummydots + \let\emph=\asis + \let\env=\asis + \let\file=\asis + \let\kbd=\asis + \let\key=\asis + \let\math=\asis + \let\option=\asis + \let\samp=\asis + \let\strong=\asis + \let\uref=\asis + \let\url=\asis + \let\var=\asis + \let\w=\asis +} \let\indexbackslash=0 %overridden during \printindex. \let\SETmarginindex=\relax % put index entries in margin (undocumented)? @@ -2838,32 +3224,29 @@ width0pt\relax} \fi \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now % so it will be output as is; and it will print as backslash. % - \def\thirdarg{#3}% - % - % If third arg is present, precede it with space in sort key. - \ifx\thirdarg\emptymacro - \let\subentry = \empty - \else - \def\subentry{ #3}% - \fi - % - % First process the index entry with all font commands turned - % off to get the string to sort by. - {\indexnofonts \xdef\indexsorttmp{#2\subentry}}% - % - % Now the real index entry with the fonts. + % The main index entry text. \toks0 = {#2}% % - % If third (subentry) arg is present, add it to the index - % string. And include a space. + % If third arg is present, precede it with space in sort key. + \def\thirdarg{#3}% \ifx\thirdarg\emptymacro \else + % If the third (subentry) arg is present, add it to the index + % line to write. \toks0 = \expandafter{\the\toks0 \space #3}% \fi % - % Set up the complete index entry, with both the sort key - % and the original text, including any font commands. We write - % three arguments to \entry to the .?? file, texindex reduces to - % two when writing the .??s sorted result. + % Process the index entry with all font commands turned off, to + % get the string to sort by. + {\indexnofonts + \edef\temp{\the\toks0}% need full expansion + \xdef\indexsorttmp{\temp}% + }% + % + % Set up the complete index entry, with both the sort key and + % the original text, including any font commands. We write + % three arguments to \entry to the .?? file (four in the + % subentry case), texindex reduces to two when writing the .??s + % sorted result. \edef\temp{% \write\csname#1indfile\endcsname{% \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}% @@ -2889,12 +3272,11 @@ width0pt\relax} \fi \iflinks \ifvmode \skip0 = \lastskip - \ifdim\lastskip = 0pt \else \nobreak\vskip-\lastskip \fi + \ifdim\lastskip = 0pt \else \nobreak\vskip-\skip0 \fi \fi % \temp % do the write % - % \ifvmode \ifdim\skip0 = 0pt \else \nobreak\vskip\skip0 \fi \fi \fi }% @@ -3085,11 +3467,18 @@ width0pt\relax} \fi \def\primary #1{\line{#1\hfil}} \newskip\secondaryindent \secondaryindent=0.5cm - -\def\secondary #1#2{ -{\parfillskip=0in \parskip=0in -\hangindent =1in \hangafter=1 -\noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par +\def\secondary#1#2{{% + \parfillskip=0in + \parskip=0in + \hangindent=1in + \hangafter=1 + \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill + \ifpdf + \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. + \else + #2 + \fi + \par }} % Define two-column mode, which we use to typeset indexes. @@ -3149,7 +3538,6 @@ width0pt\relax} \fi % % Double the \vsize as well. (We don't need a separate register here, % since nobody clobbers \vsize.) - \advance\vsize by -\ht\partialpage \vsize = 2\vsize } @@ -3163,6 +3551,7 @@ width0pt\relax} \fi % previous page. \dimen@ = \vsize \divide\dimen@ by 2 + \advance\dimen@ by -\ht\partialpage % % box0 will be the left-hand column, box2 the right. \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ @@ -3170,15 +3559,18 @@ width0pt\relax} \fi \unvbox255 \penalty\outputpenalty } +% +% Re-output the contents of the output page -- any previous material, +% followed by the two boxes we just split, in box0 and box2. \def\pagesofar{% - % Re-output the contents of the output page -- any previous material, - % followed by the two boxes we just split, in box0 and box2. \unvbox\partialpage % \hsize = \doublecolumnhsize \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}% } +% +% All done with double columns. \def\enddoublecolumns{% \output = {% % Split the last of the double-column material. Leave it on the @@ -3203,8 +3595,9 @@ width0pt\relax} \fi % \endgroup where \vsize got restored). \pagegoal = \vsize } +% +% Called at the end of the double column material. \def\balancecolumns{% - % Called at the end of the double column material. \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120. \dimen@ = \ht0 \advance\dimen@ by \topskip @@ -3359,42 +3752,41 @@ width0pt\relax} \fi \outer\def\chapter{\parsearg\chapteryyy} \def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz \def\chapterzzz #1{% -\secno=0 \subsecno=0 \subsubsecno=0 -\global\advance \chapno by 1 \message{\putwordChapter\space \the\chapno}% -\chapmacro {#1}{\the\chapno}% -\gdef\thissection{#1}% -\gdef\thischaptername{#1}% -% We don't substitute the actual chapter name into \thischapter -% because we don't want its macros evaluated now. -\xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}% - {\the\chapno}}}% -\temp -\donoderef -\global\let\section = \numberedsec -\global\let\subsection = \numberedsubsec -\global\let\subsubsection = \numberedsubsubsec -} + \secno=0 \subsecno=0 \subsubsecno=0 + \global\advance \chapno by 1 \message{\putwordChapter\space \the\chapno}% + \chapmacro {#1}{\the\chapno}% + \gdef\thissection{#1}% + \gdef\thischaptername{#1}% + % We don't substitute the actual chapter name into \thischapter + % because we don't want its macros evaluated now. + \xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}% + \writetocentry{chap}{#1}{{\the\chapno}} + \donoderef + \global\let\section = \numberedsec + \global\let\subsection = \numberedsubsec + \global\let\subsubsection = \numberedsubsubsec +} + +% we use \chapno to avoid indenting back +\def\appendixbox#1{% + \setbox0 = \hbox{\putwordAppendix{} \the\chapno}% + \hbox to \wd0{#1\hss}} \outer\def\appendix{\parsearg\appendixyyy} \def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz \def\appendixzzz #1{% -\secno=0 \subsecno=0 \subsubsecno=0 -\global\advance \appendixno by 1 -\message{\putwordAppendix\space \appendixletter}% -\chapmacro {#1}{\putwordAppendix{} \appendixletter}% -\gdef\thissection{#1}% -\gdef\thischaptername{#1}% -\xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}% - {\putwordAppendix{} \appendixletter}}}% -\temp -\appendixnoderef -\global\let\section = \appendixsec -\global\let\subsection = \appendixsubsec -\global\let\subsubsection = \appendixsubsubsec + \secno=0 \subsecno=0 \subsubsecno=0 + \global\advance \appendixno by 1 + \message{\putwordAppendix\space \appendixletter}% + \chapmacro {#1}{\appendixbox{\putwordAppendix{} \appendixletter}}% + \gdef\thissection{#1}% + \gdef\thischaptername{#1}% + \xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}% + \writetocentry{appendix}{#1}{{\appendixletter}} + \appendixnoderef + \global\let\section = \appendixsec + \global\let\subsection = \appendixsubsec + \global\let\subsubsection = \appendixsubsubsec } % @centerchap is like @unnumbered, but the heading is centered. @@ -3407,149 +3799,121 @@ width0pt\relax} \fi \outer\def\unnumbered{\parsearg\unnumberedyyy} \def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz \def\unnumberedzzz #1{% -\secno=0 \subsecno=0 \subsubsecno=0 -% -% This used to be simply \message{#1}, but TeX fully expands the -% argument to \message. Therefore, if #1 contained @-commands, TeX -% expanded them. For example, in `@unnumbered The @cite{Book}', TeX -% expanded @cite (which turns out to cause errors because \cite is meant -% to be executed, not expanded). -% -% Anyway, we don't want the fully-expanded definition of @cite to appear -% as a result of the \message, we just want `@cite' itself. We use -% \the<toks register> to achieve this: TeX expands \the<toks> only once, -% simply yielding the contents of <toks register>. (We also do this for -% the toc entries.) -\toks0 = {#1}\message{(\the\toks0)}% -% -\unnumbchapmacro {#1}% -\gdef\thischapter{#1}\gdef\thissection{#1}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash unnumbchapentry{\the\toks0}}}% -\temp -\unnumbnoderef -\global\let\section = \unnumberedsec -\global\let\subsection = \unnumberedsubsec -\global\let\subsubsection = \unnumberedsubsubsec + \secno=0 \subsecno=0 \subsubsecno=0 + % + % This used to be simply \message{#1}, but TeX fully expands the + % argument to \message. Therefore, if #1 contained @-commands, TeX + % expanded them. For example, in `@unnumbered The @cite{Book}', TeX + % expanded @cite (which turns out to cause errors because \cite is meant + % to be executed, not expanded). + % + % Anyway, we don't want the fully-expanded definition of @cite to appear + % as a result of the \message, we just want `@cite' itself. We use + % \the<toks register> to achieve this: TeX expands \the<toks> only once, + % simply yielding the contents of <toks register>. (We also do this for + % the toc entries.) + \toks0 = {#1}\message{(\the\toks0)}% + % + \unnumbchapmacro {#1}% + \gdef\thischapter{#1}\gdef\thissection{#1}% + \writetocentry{unnumbchap}{#1}{{\the\chapno}} + \unnumbnoderef + \global\let\section = \unnumberedsec + \global\let\subsection = \unnumberedsubsec + \global\let\subsubsection = \unnumberedsubsubsec } % Sections. \outer\def\numberedsec{\parsearg\secyyy} \def\secyyy #1{\numhead1{#1}} % normally calls seczzz \def\seczzz #1{% -\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % -\gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}% - {\the\chapno}{\the\secno}}}% -\temp -\donoderef -\nobreak + \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % + \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}% + \writetocentry{sec}{#1}{{\the\chapno}{\the\secno}} + \donoderef + \nobreak } \outer\def\appendixsection{\parsearg\appendixsecyyy} \outer\def\appendixsec{\parsearg\appendixsecyyy} \def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz \def\appendixsectionzzz #1{% -\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % -\gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}% - {\appendixletter}{\the\secno}}}% -\temp -\appendixnoderef -\nobreak + \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % + \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}% + \writetocentry{sec}{#1}{{\appendixletter}{\the\secno}} + \appendixnoderef + \nobreak } \outer\def\unnumberedsec{\parsearg\unnumberedsecyyy} \def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz \def\unnumberedseczzz #1{% -\plainsecheading {#1}\gdef\thissection{#1}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsecentry{\the\toks0}}}% -\temp -\unnumbnoderef -\nobreak + \plainsecheading {#1}\gdef\thissection{#1}% + \writetocentry{unnumbsec}{#1}{{\the\chapno}{\the\secno}} + \unnumbnoderef + \nobreak } % Subsections. \outer\def\numberedsubsec{\parsearg\numberedsubsecyyy} \def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz \def\numberedsubseczzz #1{% -\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % -\subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}% - {\the\chapno}{\the\secno}{\the\subsecno}}}% -\temp -\donoderef -\nobreak + \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % + \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}% + \writetocentry{subsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}} + \donoderef + \nobreak } \outer\def\appendixsubsec{\parsearg\appendixsubsecyyy} \def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz \def\appendixsubseczzz #1{% -\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % -\subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}% - {\appendixletter}{\the\secno}{\the\subsecno}}}% -\temp -\appendixnoderef -\nobreak + \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % + \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}% + \writetocentry{subsec}{#1}{{\appendixletter}{\the\secno}{\the\subsecno}} + \appendixnoderef + \nobreak } \outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy} \def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz \def\unnumberedsubseczzz #1{% -\plainsubsecheading {#1}\gdef\thissection{#1}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsecentry% - {\the\toks0}}}% -\temp -\unnumbnoderef -\nobreak + \plainsubsecheading {#1}\gdef\thissection{#1}% + \writetocentry{unnumbsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}} + \unnumbnoderef + \nobreak } % Subsubsections. \outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy} \def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz \def\numberedsubsubseczzz #1{% -\gdef\thissection{#1}\global\advance \subsubsecno by 1 % -\subsubsecheading {#1} - {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}% - {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}% -\temp -\donoderef -\nobreak + \gdef\thissection{#1}\global\advance \subsubsecno by 1 % + \subsubsecheading {#1} + {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}% + \writetocentry{subsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}} + \donoderef + \nobreak } \outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy} \def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz \def\appendixsubsubseczzz #1{% -\gdef\thissection{#1}\global\advance \subsubsecno by 1 % -\subsubsecheading {#1} - {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}% - {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}% -\temp -\appendixnoderef -\nobreak + \gdef\thissection{#1}\global\advance \subsubsecno by 1 % + \subsubsecheading {#1} + {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}% + \writetocentry{subsubsec}{#1}{{\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}} + \appendixnoderef + \nobreak } \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy} \def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz \def\unnumberedsubsubseczzz #1{% -\plainsubsubsecheading {#1}\gdef\thissection{#1}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsubsecentry% - {\the\toks0}}}% -\temp -\unnumbnoderef -\nobreak + \plainsubsubsecheading {#1}\gdef\thissection{#1}% + \writetocentry{unnumbsubsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}} + \unnumbnoderef + \nobreak } % These are variants which are not "outer", so they can appear in @ifinfo. @@ -3590,16 +3954,16 @@ width0pt\relax} \fi \def\majorheading{\parsearg\majorheadingzzz} \def\majorheadingzzz #1{% -{\advance\chapheadingskip by 10pt \chapbreak }% -{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}\bigskip \par\penalty 200} + {\advance\chapheadingskip by 10pt \chapbreak }% + {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt\raggedright + \rm #1\hfill}}\bigskip \par\penalty 200} \def\chapheading{\parsearg\chapheadingzzz} \def\chapheadingzzz #1{\chapbreak % -{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}\bigskip \par\penalty 200} + {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt\raggedright + \rm #1\hfill}}\bigskip \par\penalty 200} % @heading, @subheading, @subsubheading. \def\heading{\parsearg\plainsecheading} @@ -3745,7 +4109,16 @@ width0pt\relax} \fi \hangindent = \wd0 % zero if no section number \unhbox0 #3}% }% - \ifdim\parskip<10pt \nobreak\kern10pt\nobreak\kern-\parskip\fi \nobreak + % Add extra space after the heading -- either a line space or a + % paragraph space, whichever is more. (Some people like to set + % \parskip to large values for some reason.) Don't allow stretch, though. + \nobreak + \ifdim\parskip>\normalbaselineskip + \kern\parskip + \else + \kern\normalbaselineskip + \fi + \nobreak } @@ -3757,16 +4130,30 @@ width0pt\relax} \fi % Called from @chapter, etc. We supply {\folio} at the end of the % argument, which will end up as the last argument to the \...entry macro. % -% We open the .toc file here instead of at @setfilename or any other -% given time so that @contents can be put in the document anywhere. +% Usage: \writetocentry{chap}{The Name of The Game}{{\the\chapno}} +% We open the .toc file for writing here instead of at @setfilename (or +% any other fixed time) so that @contents can be anywhere in the document. % \newif\iftocfileopened -\def\writetocentry#1{% +\def\writetocentry#1#2#3{% \iftocfileopened\else \immediate\openout\tocfile = \jobname.toc \global\tocfileopenedtrue \fi - \iflinks \write\tocfile{#1{\folio}}\fi + % + \iflinks + \toks0 = {#2}% + \edef\temp{\write\tocfile{\realbackslash #1entry{\the\toks0}#3{\folio}}}% + \temp + \fi + % + % Tell \shipout to create a page destination if we're doing pdf, which + % will be the target of the links in the table of contents. We can't + % just do it on every page because the title pages are numbered 1 and + % 2 (the page numbers aren't printed), and so are the first two pages + % of the document. Thus, we'd have two destinations named `1', and + % two named `2'. + \ifpdf \pdfmakepagedesttrue \fi } \newskip\contentsrightmargin \contentsrightmargin=1in @@ -3797,7 +4184,7 @@ width0pt\relax} \fi \advance\hsize by -\contentsrightmargin % Don't use the full line length. % % Roman numerals for page numbers. - \ifnum \pageno>0 \pageno = \lastnegativepageno \fi + \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi } @@ -3814,7 +4201,7 @@ width0pt\relax} \fi \pdfmakeoutlines \endgroup \lastnegativepageno = \pageno - \pageno = \savepageno + \global\pageno = \savepageno } % And just the chapters. @@ -3822,19 +4209,21 @@ width0pt\relax} \fi \startcontents{\putwordShortTOC}% % \let\chapentry = \shortchapentry + \let\appendixentry = \shortappendixentry \let\unnumbchapentry = \shortunnumberedentry % We want a true roman here for the page numbers. \secfonts - \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl + \let\rm=\shortcontrm \let\bf=\shortcontbf + \let\sl=\shortcontsl \let\tt=\shortconttt \rm \hyphenpenalty = 10000 \advance\baselineskip by 1pt % Open it up a little. \def\secentry ##1##2##3##4{} - \def\unnumbsecentry ##1##2{} \def\subsecentry ##1##2##3##4##5{} - \def\unnumbsubsecentry ##1##2{} \def\subsubsecentry ##1##2##3##4##5##6{} - \def\unnumbsubsubsecentry ##1##2{} + \let\unnumbsecentry = \secentry + \let\unnumbsubsecentry = \subsecentry + \let\unnumbsubsubsecentry = \subsubsecentry \openin 1 \jobname.toc \ifeof 1 \else \closein 1 @@ -3844,7 +4233,7 @@ width0pt\relax} \fi \contentsalignmacro % in case @setchapternewpage odd is in effect \endgroup \lastnegativepageno = \pageno - \pageno = \savepageno + \global\pageno = \savepageno } \let\shortcontents = \summarycontents @@ -3857,16 +4246,24 @@ width0pt\relax} \fi % The last argument is the page number. % The arguments in between are the chapter number, section number, ... -% Chapter-level things, for both the long and short contents. +% Chapters, in the main contents. \def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}} - -% See comments in \dochapentry re vbox and related settings +% +% Chapters, in the short toc. +% See comments in \dochapentry re vbox and related settings. \def\shortchapentry#1#2#3{% \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#3\egroup}% } +% Appendices, in the main contents. +\def\appendixentry#1#2#3{% + \dochapentry{\appendixbox{\putwordAppendix{} #2}\labelspace#1}{#3}} +% +% Appendices, in the short toc. +\let\shortappendixentry = \shortchapentry + % Typeset the label for a chapter or appendix for the short contents. -% The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter. +% The arg is, e.g., `Appendix A' for an appendix, or `3' for a chapter. % We could simplify the code here by writing out an \appendixentry % command in the toc file for appendices, instead of using \chapentry % for both, but it doesn't seem worth it. @@ -3874,38 +4271,31 @@ width0pt\relax} \fi \newdimen\shortappendixwidth % \def\shortchaplabel#1{% - % Compute width of word "Appendix", may change with language. - \setbox0 = \hbox{\shortcontrm \putwordAppendix}% - \shortappendixwidth = \wd0 - % - % We typeset #1 in a box of constant width, regardless of the text of - % #1, so the chapter titles will come out aligned. - \setbox0 = \hbox{#1}% - \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi - % - % This space should be plenty, since a single number is .5em, and the + % This space should be enough, since a single number is .5em, and the % widest letter (M) is 1em, at least in the Computer Modern fonts. + % But use \hss just in case. % (This space doesn't include the extra space that gets added after % the label; that gets put in by \shortchapentry above.) - \advance\dimen0 by 1.1em - \hbox to \dimen0{#1\hfil}% + \dimen0 = 1em + \hbox to \dimen0{#1\hss}% } -\def\unnumbchapentry#1#2{\dochapentry{#1}{#2}} -\def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno\bgroup#2\egroup}} +% Unnumbered chapters. +\def\unnumbchapentry#1#2#3{\dochapentry{#1}{#3}} +\def\shortunnumberedentry#1#2#3{\tocentry{#1}{\doshortpageno\bgroup#3\egroup}} % Sections. \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}} -\def\unnumbsecentry#1#2{\dosecentry{#1}{#2}} +\def\unnumbsecentry#1#2#3#4{\dosecentry{#1}{#4}} % Subsections. \def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}} -\def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}} +\def\unnumbsubsecentry#1#2#3#4#5{\dosubsecentry{#1}{#5}} % And subsubsections. \def\subsubsecentry#1#2#3#4#5#6{% \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}} -\def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}} +\def\unnumbsubsubsecentry#1#2#3#4#5#6{\dosubsubsecentry{#1}{#6}} % This parameter controls the indentation of the various levels. \newdimen\tocindent \tocindent = 3pc @@ -3946,7 +4336,7 @@ width0pt\relax} \fi \def\tocentry#1#2{\begingroup \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks % Do not use \turnoffactive in these arguments. Since the toc is - % typeset in cmr, so characters such as _ would come out wrong; we + % typeset in cmr, characters such as _ would come out wrong; we % have to do the usual translation tricks. \entry{#1}{#2}% \endgroup} @@ -3966,36 +4356,27 @@ width0pt\relax} \fi \message{environments,} % @foo ... @end foo. +% @point{}, @result{}, @expansion{}, @print{}, @equiv{}. +% % Since these characters are used in examples, it should be an even number of % \tt widths. Each \tt character is 1en, so two makes it 1em. -% Furthermore, these definitions must come after we define our fonts. -\newbox\dblarrowbox \newbox\longdblarrowbox -\newbox\pushcharbox \newbox\bullbox -\newbox\equivbox \newbox\errorbox - -%{\tentt -%\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil} -%\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil} -%\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil} -%\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil} -% Adapted from the manmac format (p.420 of TeXbook) -%\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex -% depth .1ex\hfil} -%} - -% @point{}, @result{}, @expansion{}, @print{}, @equiv{}. +% \def\point{$\star$} \def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} \def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}} \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} \def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}} +% The @error{} command. % Adapted from the TeXbook's \boxit. +% +\newbox\errorbox +% {\tentt \global\dimen0 = 3em}% Width of the box. \dimen2 = .55pt % Thickness of rules % The text. (`r' is open on the right, `e' somewhat less so on the left.) \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt} - +% \global\setbox\errorbox=\hbox to \dimen0{\hfil \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. \advance\hsize by -2\dimen2 % Rules. @@ -4006,8 +4387,7 @@ width0pt\relax} \fi \kern3pt\vrule width\dimen2}% Space to right. \hrule height\dimen2} \hfil} - -% The @error{} command. +% \def\error{\leavevmode\lower.7ex\copy\errorbox} % @tex ... @end tex escapes into raw Tex temporarily. @@ -4017,14 +4397,14 @@ width0pt\relax} \fi \def\tex{\begingroup \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 - \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie + \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie \catcode `\%=14 - \catcode 43=12 % plus - \catcode`\"=12 - \catcode`\==12 - \catcode`\|=12 - \catcode`\<=12 - \catcode`\>=12 + \catcode `\+=\other + \catcode `\"=\other + \catcode `\==\other + \catcode `\|=\other + \catcode `\<=\other + \catcode `\>=\other \escapechar=`\\ % \let\b=\ptexb @@ -4047,9 +4427,9 @@ width0pt\relax} \fi \def\@{@}% \let\Etex=\endgroup} -% Define @lisp ... @endlisp. +% Define @lisp ... @end lisp. % @lisp does a \begingroup so it can rebind things, -% including the definition of @endlisp (which normally is erroneous). +% including the definition of @end lisp (which normally is erroneous). % Amount to narrow the margins by for @lisp. \newskip\lispnarrowing \lispnarrowing=0.4in @@ -4078,11 +4458,22 @@ width0pt\relax} \fi % Make spacing and below environment symmetrical. We use \parskip here % to help in doing that, since in @example-like environments \parskip % is reset to zero; thus the \afterenvbreak inserts no space -- but the -% start of the next paragraph will insert \parskip -% -\def\aboveenvbreak{{\advance\envskipamount by \parskip -\endgraf \ifdim\lastskip<\envskipamount -\removelastskip \penalty-50 \vskip\envskipamount \fi}} +% start of the next paragraph will insert \parskip. +% +\def\aboveenvbreak{{% + % =10000 instead of <10000 because of a special case in \itemzzz, q.v. + \ifnum \lastpenalty=10000 \else + \advance\envskipamount by \parskip + \endgraf + \ifdim\lastskip<\envskipamount + \removelastskip + % it's not a good place to break if the last penalty was \nobreak + % or better ... + \ifnum\lastpenalty>10000 \else \penalty-50 \fi + \vskip\envskipamount + \fi + \fi +}} \let\afterenvbreak = \aboveenvbreak @@ -4110,7 +4501,8 @@ width0pt\relax} \fi % \newskip\lskip\newskip\rskip -\long\def\cartouche{% +\def\cartouche{% +\par % can't be in the midst of a paragraph. \begingroup \lskip=\leftskip \rskip=\rightskip \leftskip=0pt\rightskip=0pt %we want these *outside*. @@ -4157,7 +4549,6 @@ width0pt\relax} \fi \inENV % This group ends at the end of the body \hfuzz = 12pt % Don't be fussy \sepspaces % Make spaces be word-separators rather than space tokens. - \singlespace \let\par = \lisppar % don't ignore blank lines \obeylines % each line of input is a line of output \parskip = 0pt @@ -4196,27 +4587,16 @@ width0pt\relax} \fi % @example: Same as @lisp. \def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp} -% @small... is usually equivalent to the non-small (@smallbook -% redefines). We must call \example (or whatever) last in the -% definition, since it reads the return following the @example (or -% whatever) command. -% -% This actually allows (for example) @end display inside an -% @smalldisplay. Too bad, but makeinfo will catch the error anyway. -% -\def\smalldisplay{\begingroup\def\Esmalldisplay{\nonfillfinish\endgroup}\display} -\def\smallexample{\begingroup\def\Esmallexample{\nonfillfinish\endgroup}\lisp} -\def\smallformat{\begingroup\def\Esmallformat{\nonfillfinish\endgroup}\format} -\def\smalllisp{\begingroup\def\Esmalllisp{\nonfillfinish\endgroup}\lisp} - -% Real @smallexample and @smalllisp (when @smallbook): use smaller fonts. +% @smallexample and @smalllisp: use smaller fonts. % Originally contributed by Pavel@xerox. -\def\smalllispx{\begingroup +\def\smalllisp{\begingroup \def\Esmalllisp{\nonfillfinish\endgroup}% \def\Esmallexample{\nonfillfinish\endgroup}% - \smallfonts + \smallexamplefonts \lisp } +\let\smallexample = \smalllisp + % @display: same as @lisp except keep current font. % @@ -4225,12 +4605,12 @@ width0pt\relax} \fi \let\Edisplay = \nonfillfinish \gobble } - -% @smalldisplay (when @smallbook): @display plus smaller fonts. % -\def\smalldisplayx{\begingroup +% @smalldisplay: @display plus smaller fonts. +% +\def\smalldisplay{\begingroup \def\Esmalldisplay{\nonfillfinish\endgroup}% - \smallfonts \rm + \smallexamplefonts \rm \display } @@ -4242,12 +4622,12 @@ width0pt\relax} \fi \let\Eformat = \nonfillfinish \gobble } - -% @smallformat (when @smallbook): @format plus smaller fonts. % -\def\smallformatx{\begingroup +% @smallformat: @format plus smaller fonts. +% +\def\smallformat{\begingroup \def\Esmallformat{\nonfillfinish\endgroup}% - \smallfonts \rm + \smallexamplefonts \rm \format } @@ -4265,13 +4645,13 @@ width0pt\relax} \fi \gobble } + % @quotation does normal linebreaking (hence we can't use \nonfillstart) % and narrows the margins. % \def\quotation{% \begingroup\inENV %This group ends at the end of the @quotation body {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip - \singlespace \parindent=0pt % We have retained a nonzero parskip for the environment, since we're % doing normal filling. So to avoid extra space below the environment... @@ -4287,23 +4667,257 @@ width0pt\relax} \fi } +% LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>} +% If we want to allow any <char> as delimiter, +% we need the curly braces so that makeinfo sees the @verb command, eg: +% `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org +% +% [Knuth]: Donald Ervin Knuth, 1996. The TeXbook. +% +% [Knuth] p.344; only we need to do the other characters Texinfo sets +% active too. Otherwise, they get lost as the first character on a +% verbatim line. +\def\dospecials{% + \do\ \do\\\do\{\do\}\do\$\do\&% + \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~% + \do\<\do\>\do\|\do\@\do+\do\"% +} +% +% [Knuth] p. 380 +\def\uncatcodespecials{% + \def\do##1{\catcode`##1=12}\dospecials} +% +% [Knuth] pp. 380,381,391 +% Disable Spanish ligatures ?` and !` of \tt font +\begingroup + \catcode`\`=\active\gdef`{\relax\lq} +\endgroup +% +% Setup for the @verb command. +% +% Eight spaces for a tab +\begingroup + \catcode`\^^I=\active + \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }} +\endgroup +% +\def\setupverb{% + \tt % easiest (and conventionally used) font for verbatim + \def\par{\leavevmode\endgraf}% + \catcode`\`=\active + \tabeightspaces + % Respect line breaks, + % print special symbols as themselves, and + % make each space count + % must do in this order: + \obeylines \uncatcodespecials \sepspaces +} + +% Setup for the @verbatim environment +% +% Real tab expansion +\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount +% +\def\starttabbox{\setbox0=\hbox\bgroup} +\begingroup + \catcode`\^^I=\active + \gdef\tabexpand{% + \catcode`\^^I=\active + \def^^I{\leavevmode\egroup + \dimen0=\wd0 % the width so far, or since the previous tab + \divide\dimen0 by\tabw + \multiply\dimen0 by\tabw % compute previous multiple of \tabw + \advance\dimen0 by\tabw % advance to next multiple of \tabw + \wd0=\dimen0 \box0 \starttabbox + }% + } +\endgroup +\def\setupverbatim{% + % Easiest (and conventionally used) font for verbatim + \tt + \def\par{\leavevmode\egroup\box0\endgraf}% + \catcode`\`=\active + \tabexpand + % Respect line breaks, + % print special symbols as themselves, and + % make each space count + % must do in this order: + \obeylines \uncatcodespecials \sepspaces + \everypar{\starttabbox}% +} + +% Do the @verb magic: verbatim text is quoted by unique +% delimiter characters. Before first delimiter expect a +% right brace, after last delimiter expect closing brace: +% +% \def\doverb'{'<char>#1<char>'}'{#1} +% +% [Knuth] p. 382; only eat outer {} +\begingroup + \catcode`[=1\catcode`]=2\catcode`\{=12\catcode`\}=12 + \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next] +\endgroup +% +\def\verb{\begingroup\setupverb\doverb} +% +% +% Do the @verbatim magic: define the macro \doverbatim so that +% the (first) argument ends when '@end verbatim' is reached, ie: +% +% \def\doverbatim#1@end verbatim{#1} +% +% For Texinfo it's a lot easier than for LaTeX, +% because texinfo's \verbatim doesn't stop at '\end{verbatim}': +% we need not redefine '\', '{' and '}'. +% +% Inspired by LaTeX's verbatim command set [latex.ltx] +%% Include LaTeX hack for completeness -- never know +%% \begingroup +%% \catcode`|=0 \catcode`[=1 +%% \catcode`]=2\catcode`\{=12\catcode`\}=12\catcode`\ =\active +%% \catcode`\\=12|gdef|doverbatim#1@end verbatim[ +%% #1|endgroup|def|Everbatim[]|end[verbatim]] +%% |endgroup +% +\begingroup + \catcode`\ =\active + \obeylines % + % ignore everything up to the first ^^M, that's the newline at the end + % of the @verbatim input line itself. Otherwise we get an extra blank + % line in the output. + \gdef\doverbatim#1^^M#2@end verbatim{#2\end{verbatim}}% +\endgroup +% +\def\verbatim{% + \def\Everbatim{\nonfillfinish\endgroup}% + \begingroup + \nonfillstart + \advance\leftskip by -\defbodyindent + \begingroup\setupverbatim\doverbatim +} + +% @verbatiminclude FILE - insert text of file in verbatim environment. +% +% Allow normal characters that we make active in the argument (a file name). +\def\verbatiminclude{% + \begingroup + \catcode`\\=\other + \catcode`~=\other + \catcode`^=\other + \catcode`_=\other + \catcode`|=\other + \catcode`<=\other + \catcode`>=\other + \catcode`+=\other + \parsearg\doverbatiminclude +} +\def\setupverbatiminclude{% + \begingroup + \nonfillstart + \advance\leftskip by -\defbodyindent + \begingroup\setupverbatim +} +% +\def\doverbatiminclude#1{% + % Restore active chars for included file. + \endgroup + \begingroup + \let\value=\expandablevalue + \def\thisfile{#1}% + \expandafter\expandafter\setupverbatiminclude\input\thisfile + \endgroup + \nonfillfinish + \endgroup +} + +% @copying ... @end copying. +% Save the text away for @insertcopying later. Many commands won't be +% allowed in this context, but that's ok. +% +% We save the uninterpreted tokens, rather than creating a box. +% Saving the text in a box would be much easier, but then all the +% typesetting commands (@smallbook, font changes, etc.) have to be done +% beforehand -- and a) we want @copying to be done first in the source +% file; b) letting users define the frontmatter in as flexible order as +% possible is very desirable. +% +\def\copying{\begingroup + % Define a command to swallow text until we reach `@end copying'. + % \ is the escape char in this texinfo.tex file, so it is the + % delimiter for the command; @ will be the escape char when we read + % it, but that doesn't matter. + \long\def\docopying##1\end copying{\gdef\copyingtext{##1}\enddocopying}% + % + % We must preserve ^^M's in the input file; see \insertcopying below. + \catcode`\^^M = \active + \docopying +} + +% What we do to finish off the copying text. +% +\def\enddocopying{\endgroup\ignorespaces} + +% @insertcopying. Here we must play games with ^^M's. On the one hand, +% we need them to delimit commands such as `@end quotation', so they +% must be active. On the other hand, we certainly don't want every +% end-of-line to be a \par, as would happen with the normal active +% definition of ^^M. On the third hand, two ^^M's in a row should still +% generate a \par. +% +% Our approach is to make ^^M insert a space and a penalty1 normally; +% then it can also check if \lastpenalty=1. If it does, then manually +% do \par. +% +% This messes up the normal definitions of @c[omment], so we redefine +% it. Similarly for @ignore. (These commands are used in the gcc +% manual for man page generation.) +% +% Seems pretty fragile, most line-oriented commands will presumably +% fail, but for the limited use of getting the copying text (which +% should be quite simple) inserted, we can hope it's ok. +% +{\catcode`\^^M=\active % +\gdef\insertcopying{\begingroup % + \parindent = 0pt % looks wrong on title page + \def^^M{% + \ifnum \lastpenalty=1 % + \par % + \else % + \space \penalty 1 % + \fi % + }% + % + % Fix @c[omment] for catcode 13 ^^M's. + \def\c##1^^M{\ignorespaces}% + \let\comment = \c % + % + % Don't bother jumping through all the hoops that \doignore does, it + % would be very hard since the catcodes are already set. + \long\def\ignore##1\end ignore{\ignorespaces}% + % + \copyingtext % +\endgroup}% +} + \message{defuns,} % @defun etc. % Allow user to change definition object font (\df) internally -\def\setdeffont #1 {\csname DEF#1\endcsname} +\def\setdeffont#1 {\csname DEF#1\endcsname} \newskip\defbodyindent \defbodyindent=.4in \newskip\defargsindent \defargsindent=50pt -\newskip\deftypemargin \deftypemargin=12pt \newskip\deflastargmargin \deflastargmargin=18pt \newcount\parencount -% define \functionparens, which makes ( and ) and & do special things. -% \functionparens affects the group it is contained in. + +% We want ()&[] to print specially on the defun line. +% \def\activeparens{% -\catcode`\(=\active \catcode`\)=\active \catcode`\&=\active -\catcode`\[=\active \catcode`\]=\active} + \catcode`\(=\active \catcode`\)=\active + \catcode`\&=\active + \catcode`\[=\active \catcode`\]=\active +} % Make control sequences which act like normal parenthesis chars. \let\lparen = ( \let\rparen = ) @@ -4350,88 +4964,124 @@ width0pt\relax} \fi % Active &'s sneak into the index arguments, so make sure it's defined. { - \catcode`& = 13 + \catcode`& = \active \global\let& = \ampnr } -% First, defname, which formats the header line itself. -% #1 should be the function name. -% #2 should be the type of definition, such as "Function". - -\def\defname #1#2{% -% Get the values of \leftskip and \rightskip as they were -% outside the @def... -\dimen2=\leftskip -\advance\dimen2 by -\defbodyindent -\noindent -\setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}% -\dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line -\dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations -\parshape 2 0in \dimen0 \defargsindent \dimen1 -% Now output arg 2 ("Function" or some such) -% ending at \deftypemargin from the right margin, -% but stuck inside a box of width 0 so it does not interfere with linebreaking -{% Adjust \hsize to exclude the ambient margins, -% so that \rightline will obey them. -\advance \hsize by -\dimen2 -\rlap{\rightline{{\rm #2}\hskip -1.25pc }}}% -% Make all lines underfull and no complaints: -\tolerance=10000 \hbadness=10000 -\advance\leftskip by -\defbodyindent -\exdentamount=\defbodyindent -{\df #1}\enskip % Generate function name -} - -% Actually process the body of a definition -% #1 should be the terminating control sequence, such as \Edefun. -% #2 should be the "another name" control sequence, such as \defunx. -% #3 should be the control sequence that actually processes the header, -% such as \defunheader. - -\def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2{\begingroup\obeylines\activeparens\spacesplit#3}% -\parindent=0in -\advance\leftskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup % -\catcode 61=\active % 61 is `=' -\obeylines\activeparens\spacesplit#3} +% \defname, which formats the name of the @def (not the args). +% #1 is the function name. +% #2 is the type of definition, such as "Function". +% +\def\defname#1#2{% + % How we'll output the type name. Putting it in brackets helps + % distinguish it from the body text that may end up on the next line + % just below it. + \ifempty{#2}% + \def\defnametype{}% + \else + \def\defnametype{[\rm #2]}% + \fi + % + % Get the values of \leftskip and \rightskip as they were outside the @def... + \dimen2=\leftskip + \advance\dimen2 by -\defbodyindent + % + % Figure out values for the paragraph shape. + \setbox0=\hbox{\hskip \deflastargmargin{\defnametype}}% + \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line + \dimen1=\hsize \advance \dimen1 by -\defargsindent % size for continuations + \parshape 2 0in \dimen0 \defargsindent \dimen1 + % + % Output arg 2 ("Function" or some such) but stuck inside a box of + % width 0 so it does not interfere with linebreaking. + \noindent + % + {% Adjust \hsize to exclude the ambient margins, + % so that \rightline will obey them. + \advance \hsize by -\dimen2 + \dimen3 = 0pt % was -1.25pc + \rlap{\rightline{\defnametype\kern\dimen3}}% + }% + % + % Allow all lines to be underfull without complaint: + \tolerance=10000 \hbadness=10000 + \advance\leftskip by -\defbodyindent + \exdentamount=\defbodyindent + {\df #1}\enskip % output function name + % \defunargs will be called next to output the arguments, if any. +} +% Common pieces to start any @def... % #1 is the \E... control sequence to end the definition (which we define). -% #2 is the \...x control sequence for consecutive fns (which we define). -% #3 is the control sequence to call to resume processing. +% #2 is the \...x control sequence (which our caller defines). +% #3 is the control sequence to process the header, such as \defunheader. +% +\def\parsebodycommon#1#2#3{% + \begingroup\inENV + % If there are two @def commands in a row, we'll have a \nobreak, + % which is there to keep the function description together with its + % header. But if there's nothing but headers, we want to allow a + % break after all. Check for penalty 10002 (inserted by + % \defargscommonending) instead of 10000, since the sectioning + % commands insert a \penalty10000, and we don't want to allow a break + % between a section heading and a defun. + \ifnum\lastpenalty=10002 \penalty0 \fi + \medbreak + % + % Define the \E... end token that this defining construct specifies + % so that it will exit this group. + \def#1{\endgraf\endgroup\medbreak}% + % + \parindent=0in + \advance\leftskip by \defbodyindent + \exdentamount=\defbodyindent +} + +% Common part of the \...x definitions. +% +\def\defxbodycommon{% + % As with \parsebodycommon above, allow line break if we have multiple + % x headers in a row. It's not a great place, though. + \ifnum\lastpenalty=10000 \penalty1000 \fi + % + \begingroup\obeylines +} + +% Process body of @defun, @deffn, @defmac, etc. +% +\def\defparsebody#1#2#3{% + \parsebodycommon{#1}{#2}{#3}% + \def#2{\defxbodycommon \activeparens \spacesplit#3}% + \catcode\equalChar=\active + \begingroup\obeylines\activeparens + \spacesplit#3% +} + +% #1, #2, #3 are the common arguments (see \parsebodycommon above). % #4, delimited by the space, is the class name. % -\def\defmethparsebody#1#2#3#4 {\begingroup\inENV % -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}% -\parindent=0in -\advance\leftskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup\obeylines\activeparens\spacesplit{#3{#4}}} +\def\defmethparsebody#1#2#3#4 {% + \parsebodycommon{#1}{#2}{#3}% + \def#2##1 {\defxbodycommon \activeparens \spacesplit{#3{##1}}}% + \begingroup\obeylines\activeparens + % The \empty here prevents misinterpretation of a construct such as + % @deffn {whatever} {Enharmonic comma} + % See comments at \deftpparsebody, although in our case we don't have + % to remove the \empty afterwards, since it is empty. + \spacesplit{#3{#4}}\empty +} % Used for @deftypemethod and @deftypeivar. -% #1 is the \E... control sequence to end the definition (which we define). -% #2 is the \...x control sequence for consecutive fns (which we define). -% #3 is the control sequence to call to resume processing. +% #1, #2, #3 are the common arguments (see \defparsebody). % #4, delimited by a space, is the class name. % #5 is the method's return type. % -\def\deftypemethparsebody#1#2#3#4 #5 {\begingroup\inENV - \medbreak - \def#1{\endgraf\endgroup\medbreak}% - \def#2##1 ##2 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}{##2}}}% - \parindent=0in - \advance\leftskip by \defbodyindent - \exdentamount=\defbodyindent - \begingroup\obeylines\activeparens\spacesplit{#3{#4}{#5}}} +\def\deftypemethparsebody#1#2#3#4 #5 {% + \parsebodycommon{#1}{#2}{#3}% + \def#2##1 ##2 {\defxbodycommon \activeparens \spacesplit{#3{##1}{##2}}}% + \begingroup\obeylines\activeparens + \spacesplit{#3{#4}{#5}}% +} % Used for @deftypeop. The change from \deftypemethparsebody is an % extra argument at the beginning which is the `category', instead of it @@ -4440,64 +5090,48 @@ width0pt\relax} \fi % input at hand. Thus also need a control sequence (passed as #5) for % the \E... definition to assign the category name to. % -\def\deftypeopparsebody#1#2#3#4#5 #6 {\begingroup\inENV - \medbreak - \def#1{\endgraf\endgroup\medbreak}% - \def#2##1 ##2 ##3 {% - \def#4{##1}% - \begingroup\obeylines\activeparens\spacesplit{#3{##2}{##3}}}% - \parindent=0in - \advance\leftskip by \defbodyindent - \exdentamount=\defbodyindent - \begingroup\obeylines\activeparens\spacesplit{#3{#5}{#6}}} - -\def\defopparsebody #1#2#3#4#5 {\begingroup\inENV % -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2##1 ##2 {\def#4{##1}% -\begingroup\obeylines\activeparens\spacesplit{#3{##2}}}% -\parindent=0in -\advance\leftskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup\obeylines\activeparens\spacesplit{#3{#5}}} +\def\deftypeopparsebody#1#2#3#4#5 #6 {% + \parsebodycommon{#1}{#2}{#3}% + \def#2##1 ##2 ##3 {\def#4{##1}% + \defxbodycommon \activeparens \spacesplit{#3{##2}{##3}}}% + \begingroup\obeylines\activeparens + \spacesplit{#3{#5}{#6}}% +} + +% For @defop. +\def\defopparsebody #1#2#3#4#5 {% + \parsebodycommon{#1}{#2}{#3}% + \def#2##1 ##2 {\def#4{##1}% + \defxbodycommon \activeparens \spacesplit{#3{##2}}}% + \begingroup\obeylines\activeparens + \spacesplit{#3{#5}}% +} % These parsing functions are similar to the preceding ones % except that they do not make parens into active characters. % These are used for "variables" since they have no arguments. - -\def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2{\begingroup\obeylines\spacesplit#3}% -\parindent=0in -\advance\leftskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup % -\catcode 61=\active % -\obeylines\spacesplit#3} - -% This is used for \def{tp,vr}parsebody. It could probably be used for -% some of the others, too, with some judicious conditionals. % -\def\parsebodycommon#1#2#3{% - \begingroup\inENV % - \medbreak % - % Define the end token that this defining construct specifies - % so that it will exit this group. - \def#1{\endgraf\endgroup\medbreak}% - \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}% - \parindent=0in - \advance\leftskip by \defbodyindent - \exdentamount=\defbodyindent +\def\defvarparsebody #1#2#3{% + \parsebodycommon{#1}{#2}{#3}% + \def#2{\defxbodycommon \spacesplit#3}% + \catcode\equalChar=\active + \begingroup\obeylines + \spacesplit#3% +} + +% @defopvar. +\def\defopvarparsebody #1#2#3#4#5 {% + \parsebodycommon{#1}{#2}{#3}% + \def#2##1 ##2 {\def#4{##1}% + \defxbodycommon \spacesplit{#3{##2}}}% \begingroup\obeylines + \spacesplit{#3{#5}}% } \def\defvrparsebody#1#2#3#4 {% \parsebodycommon{#1}{#2}{#3}% + \def#2##1 {\defxbodycommon \spacesplit{#3{##1}}}% + \begingroup\obeylines \spacesplit{#3{#4}}% } @@ -4512,6 +5146,8 @@ width0pt\relax} \fi % \def\deftpparsebody #1#2#3#4 {% \parsebodycommon{#1}{#2}{#3}% + \def#2##1 {\defxbodycommon \spacesplit{#3{##1}}}% + \begingroup\obeylines \spacesplit{\parsetpheaderline{#3{#4}}}\empty } @@ -4528,38 +5164,37 @@ width0pt\relax} \fi #1{\removeemptybraces#2\relax}{#3}% }% -\def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV % -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2##1 ##2 {\def#4{##1}% -\begingroup\obeylines\spacesplit{#3{##2}}}% -\parindent=0in -\advance\leftskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup\obeylines\spacesplit{#3{#5}}} - -% Split up #2 at the first space token. +% Split up #2 (the rest of the input line) at the first space token. % call #1 with two arguments: % the first is all of #2 before the space token, % the second is all of #2 after that space token. % If #2 contains no space token, all of it is passed as the first arg % and the second is passed as empty. - -{\obeylines -\gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}% -\long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{% -\ifx\relax #3% -#1{#2}{}\else #1{#2}{#3#4}\fi}} - -% So much for the things common to all kinds of definitions. +% +{\obeylines % + \gdef\spacesplit#1#2^^M{\endgroup\spacesplitx{#1}#2 \relax\spacesplitx}% + \long\gdef\spacesplitx#1#2 #3#4\spacesplitx{% + \ifx\relax #3% + #1{#2}{}% + \else % + #1{#2}{#3#4}% + \fi}% +} % Define @defun. -% First, define the processing that is wanted for arguments of \defun -% Use this to expand the args and terminate the paragraph they make up +% This is called to end the arguments processing for all the @def... commands. +% +\def\defargscommonending{% + \interlinepenalty = 10000 + \advance\rightskip by 0pt plus 1fil + \endgraf + \nobreak\vskip -\parskip + \penalty 10002 % signal to \parsebodycommon. +} +% This expands the args and terminates the paragraph they comprise. +% \def\defunargs#1{\functionparens \sl % Expand, preventing hyphenation at `-' chars. % Note that groups don't affect changes in \hyphenchar. @@ -4568,9 +5203,7 @@ width0pt\relax} \fi #1% {\tensl\hyphenchar\font=45}% \ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi% -\interlinepenalty=10000 -\advance\rightskip by 0pt plus 1fil -\endgraf\nobreak\vskip -\parskip\nobreak + \defargscommonending } \def\deftypefunargs #1{% @@ -4579,9 +5212,7 @@ width0pt\relax} \fi % Use \boldbraxnoamp, not \functionparens, so that & is not special. \boldbraxnoamp \tclose{#1}% avoid \code because of side effects on active chars -\interlinepenalty=10000 -\advance\rightskip by 0pt plus 1fil -\endgraf\nobreak\vskip -\parskip\nobreak + \defargscommonending } % Do complete processing of one @defun or @defunx line already parsed. @@ -4592,7 +5223,7 @@ width0pt\relax} \fi \def\deffnheader #1#2#3{\doind {fn}{\code{#2}}% \begingroup\defname {#2}{#1}\defunargs{#3}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody +\catcode\equalChar=\other % Turn off change made in \defparsebody } % @defun == @deffn Function @@ -4602,7 +5233,7 @@ width0pt\relax} \fi \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index \begingroup\defname {#1}{\putwordDeffunc}% \defunargs {#2}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody +\catcode\equalChar=\other % Turn off change made in \defparsebody } % @deftypefun int foobar (int @var{foo}, float @var{bar}) @@ -4614,18 +5245,18 @@ width0pt\relax} \fi % #1 is the data type, #2 the name, #3 the args. \def\deftypefunheaderx #1#2 #3\relax{% \doind {fn}{\code{#2}}% Make entry in function index -\begingroup\defname {\defheaderxcond#1\relax$$$#2}{\putwordDeftypefun}% +\begingroup\defname {\defheaderxcond#1\relax$.$#2}{\putwordDeftypefun}% \deftypefunargs {#3}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody +\catcode\equalChar=\other % Turn off change made in \defparsebody } % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar}) \def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader} -% \defheaderxcond#1\relax$$$ +% \defheaderxcond#1\relax$.$ % puts #1 in @code, followed by a space, but does nothing if #1 is null. -\def\defheaderxcond#1#2$$${\ifx#1\relax\else\code{#1#2} \fi} +\def\defheaderxcond#1#2$.${\ifx#1\relax\else\code{#1#2} \fi} % #1 is the classification. #2 is the data type. #3 is the name and args. \def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax} @@ -4635,9 +5266,9 @@ width0pt\relax} \fi \begingroup \normalparens % notably, turn off `&' magic, which prevents % at least some C++ text from working -\defname {\defheaderxcond#2\relax$$$#3}{#1}% +\defname {\defheaderxcond#2\relax$.$#3}{#1}% \deftypefunargs {#4}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody +\catcode\equalChar=\other % Turn off change made in \defparsebody } % @defmac == @deffn Macro @@ -4647,7 +5278,7 @@ width0pt\relax} \fi \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index \begingroup\defname {#1}{\putwordDefmac}% \defunargs {#2}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody +\catcode\equalChar=\other % Turn off change made in \defparsebody } % @defspec == @deffn Special Form @@ -4657,7 +5288,7 @@ width0pt\relax} \fi \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index \begingroup\defname {#1}{\putwordDefspec}% \defunargs {#2}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody +\catcode\equalChar=\other % Turn off change made in \defparsebody } % @defop CATEGORY CLASS OPERATION ARG... @@ -4666,9 +5297,11 @@ width0pt\relax} \fi \defopparsebody\Edefop\defopx\defopheader\defoptype} % \def\defopheader#1#2#3{% -\dosubind {fn}{\code{#2}}{\putwordon\ #1}% Make entry in function index -\begingroup\defname {#2}{\defoptype\ \putwordon\ #1}% -\defunargs {#3}\endgroup % + \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% function index entry + \begingroup + \defname{#2}{\defoptype\ \putwordon\ #1}% + \defunargs{#3}% + \endgroup } % @deftypeop CATEGORY CLASS TYPE OPERATION ARG... @@ -4681,7 +5314,7 @@ width0pt\relax} \fi \def\deftypeopheader#1#2#3#4{% \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index \begingroup - \defname{\defheaderxcond#2\relax$$$#3} + \defname{\defheaderxcond#2\relax$.$#3} {\deftypeopcategory\ \putwordon\ \code{#1}}% \deftypefunargs{#4}% \endgroup @@ -4696,7 +5329,7 @@ width0pt\relax} \fi \def\deftypemethodheader#1#2#3#4{% \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index \begingroup - \defname{\defheaderxcond#2\relax$$$#3}{\putwordMethodon\ \code{#1}}% + \defname{\defheaderxcond#2\relax$.$#3}{\putwordMethodon\ \code{#1}}% \deftypefunargs{#4}% \endgroup } @@ -4710,7 +5343,8 @@ width0pt\relax} \fi \def\deftypeivarheader#1#2#3{% \dosubind{vr}{\code{#3}}{\putwordof\ \code{#1}}% entry in variable index \begingroup - \defname{#3}{\putwordInstanceVariableof\ \code{#1}}% + \defname{\defheaderxcond#2\relax$.$#3} + {\putwordInstanceVariableof\ \code{#1}}% \defvarargs{#3}% \endgroup } @@ -4734,9 +5368,11 @@ width0pt\relax} \fi \defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype} \def\defcvarheader #1#2#3{% -\dosubind {vr}{\code{#2}}{\putwordof\ #1}% Make entry in var index -\begingroup\defname {#2}{\defcvtype\ \putwordof\ #1}% -\defvarargs {#3}\endgroup % + \dosubind{vr}{\code{#2}}{\putwordof\ \code{#1}}% variable index entry + \begingroup + \defname{#2}{\defcvtype\ \putwordof\ #1}% + \defvarargs{#3}% + \endgroup } % @defivar CLASS VARNAME == @defcv {Instance Variable} CLASS VARNAME @@ -4744,7 +5380,7 @@ width0pt\relax} \fi \def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader} % \def\defivarheader#1#2#3{% - \dosubind {vr}{\code{#2}}{\putwordof\ #1}% entry in var index + \dosubind{vr}{\code{#2}}{\putwordof\ \code{#1}}% entry in var index \begingroup \defname{#2}{\putwordInstanceVariableof\ #1}% \defvarargs{#3}% @@ -4756,8 +5392,8 @@ width0pt\relax} \fi % This is actually simple: just print them in roman. % This must expand the args and terminate the paragraph they make up \def\defvarargs #1{\normalparens #1% -\interlinepenalty=10000 -\endgraf\nobreak\vskip -\parskip\nobreak} + \defargscommonending +} % @defvr Counter foo-count @@ -4792,9 +5428,8 @@ width0pt\relax} \fi % is actually part of the data type, which should not be put into the index. \def\deftypevarheader #1#2{% \dovarind#2 \relax% Make entry in variables index -\begingroup\defname {\defheaderxcond#1\relax$$$#2}{\putwordDeftypevar}% -\interlinepenalty=10000 -\endgraf\nobreak\vskip -\parskip\nobreak +\begingroup\defname {\defheaderxcond#1\relax$.$#2}{\putwordDeftypevar}% + \defargscommonending \endgroup} \def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}} @@ -4803,9 +5438,8 @@ width0pt\relax} \fi \def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader} \def\deftypevrheader #1#2#3{\dovarind#3 \relax% -\begingroup\defname {\defheaderxcond#2\relax$$$#3}{#1} -\interlinepenalty=10000 -\endgraf\nobreak\vskip -\parskip\nobreak +\begingroup\defname {\defheaderxcond#2\relax$.$#3}{#1} + \defargscommonending \endgroup} % Now define @deftp @@ -4854,7 +5488,7 @@ width0pt\relax} \fi \def\scanmacro#1{% \begingroup \newlinechar`\^^M % Undo catcode changes of \startcontents and \doprintindex - \catcode`\@=0 \catcode`\\=12 \escapechar=`\@ + \catcode`\@=0 \catcode`\\=\other \escapechar=`\@ % Append \endinput to make sure that TeX does not see the ending newline. \toks0={#1\endinput}% \immediate\openout\macscribble=\jobname.tmp @@ -4868,7 +5502,7 @@ width0pt\relax} \fi \def\scanmacro#1{% \begingroup \newlinechar`\^^M % Undo catcode changes of \startcontents and \doprintindex -\catcode`\@=0 \catcode`\\=12 \escapechar=`\@ +\catcode`\@=0 \catcode`\\=\other \escapechar=`\@ \let\xeatspaces\eatspaces\scantokens{#1\endinput}\endgroup} \fi @@ -4898,7 +5532,7 @@ width0pt\relax} \fi } % Trim a single trailing ^^M off a string. -{\catcode`\^^M=12\catcode`\Q=3% +{\catcode`\^^M=\other \catcode`\Q=3% \gdef\eatcr #1{\eatcra #1Q^^MQ}% \gdef\eatcra#1^^MQ{\eatcrb#1Q}% \gdef\eatcrb#1Q#2Q{#1}% @@ -4913,29 +5547,29 @@ width0pt\relax} \fi % body, and then making it the \newlinechar in \scanmacro. \def\macrobodyctxt{% - \catcode`\~=12 - \catcode`\^=12 - \catcode`\_=12 - \catcode`\|=12 - \catcode`\<=12 - \catcode`\>=12 - \catcode`\+=12 - \catcode`\{=12 - \catcode`\}=12 - \catcode`\@=12 - \catcode`\^^M=12 + \catcode`\~=\other + \catcode`\^=\other + \catcode`\_=\other + \catcode`\|=\other + \catcode`\<=\other + \catcode`\>=\other + \catcode`\+=\other + \catcode`\{=\other + \catcode`\}=\other + \catcode`\@=\other + \catcode`\^^M=\other \usembodybackslash} \def\macroargctxt{% - \catcode`\~=12 - \catcode`\^=12 - \catcode`\_=12 - \catcode`\|=12 - \catcode`\<=12 - \catcode`\>=12 - \catcode`\+=12 - \catcode`\@=12 - \catcode`\\=12} + \catcode`\~=\other + \catcode`\^=\other + \catcode`\_=\other + \catcode`\|=\other + \catcode`\<=\other + \catcode`\>=\other + \catcode`\+=\other + \catcode`\@=\other + \catcode`\\=\other} % \mbodybackslash is the definition of \ in @macro bodies. % It maps \foo\ => \csname macarg.foo\endcsname => #N @@ -4963,7 +5597,7 @@ width0pt\relax} \fi \message{Warning: redefining \the\macname}% \else \expandafter\ifx\csname \the\macname\endcsname \relax - \else \errmessage{The name \the\macname\space is reserved}\fi + \else \errmessage{Macro name \the\macname\space already defined}\fi \global\cslet{macsave.\the\macname}{\the\macname}% \global\expandafter\let\csname ismacro.\the\macname\endcsname=1% % Add the macroname to \macrolist @@ -4976,32 +5610,33 @@ width0pt\relax} \fi \else \expandafter\parsemacbody \fi} -\def\unmacro{\parsearg\unmacroxxx} -\def\unmacroxxx#1{% +\def\unmacro{\parsearg\dounmacro} +\def\dounmacro#1{% \if1\csname ismacro.#1\endcsname \global\cslet{#1}{macsave.#1}% \global\expandafter\let \csname ismacro.#1\endcsname=0% - % Remove the macro name from \macrolist + % Remove the macro name from \macrolist: \begingroup - \edef\tempa{\expandafter\noexpand\csname#1\endcsname}% - \def\do##1{% - \def\tempb{##1}% - \ifx\tempa\tempb - % remove this - \else - \toks0 = \expandafter{\newmacrolist\do}% - \edef\newmacrolist{\the\toks0\expandafter\noexpand\tempa}% - \fi}% - \def\newmacrolist{}% - % Execute macro list to define \newmacrolist - \macrolist - \global\let\macrolist\newmacrolist + \expandafter\let\csname#1\endcsname \relax + \let\do\unmacrodo + \xdef\macrolist{\macrolist}% \endgroup \else \errmessage{Macro #1 not defined}% \fi } +% Called by \do from \dounmacro on each macro. The idea is to omit any +% macro definitions that have been changed to \relax. +% +\def\unmacrodo#1{% + \ifx#1\relax + % remove this + \else + \noexpand\do \noexpand #1% + \fi +} + % This makes use of the obscure feature that if the last token of a % <parameter list> is #, then the preceding argument is delimited by % an opening brace, and that opening brace is not consumed. @@ -5184,15 +5819,23 @@ width0pt\relax} \fi \gdef\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} \gdef\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} -% \setref{NAME}{SNT} defines a cross-reference point NAME, namely -% NAME-title, NAME-pg, and NAME-SNT. Called from \foonoderef. We have -% to set \indexdummies so commands such as @code in a section title -% aren't expanded. It would be nicer not to expand the titles in the -% first place, but there's so many layers that that is hard to do. +% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an +% anchor), namely NAME-title (the corresponding @chapter/etc. name), +% NAME-pg (the page number), and NAME-snt (section number and type). +% Called from \foonoderef. +% +% We have to set \indexdummies so commands such as @code in a section +% title aren't expanded. It would be nicer not to expand the titles in +% the first place, but there's so many layers that that is hard to do. % +% Likewise, use \turnoffactive so that punctuation chars such as underscore +% and backslash work in node names. +% \def\setref#1#2{{% - \indexdummies + \atdummies \pdfmkdest{#1}% + % + \turnoffactive \dosetq{#1-title}{Ytitle}% \dosetq{#1-pg}{Ypagenumber}% \dosetq{#1-snt}{#2}% @@ -5244,13 +5887,15 @@ width0pt\relax} \fi \ifpdf \leavevmode \getfilename{#4}% - \ifnum\filenamelength>0 - \startlink attr{/Border [0 0 0]}% - goto file{\the\filename.pdf} name{#1@}% - \else - \startlink attr{/Border [0 0 0]}% - goto name{#1@}% - \fi + {\turnoffactive \otherbackslash + \ifnum\filenamelength>0 + \startlink attr{/Border [0 0 0]}% + goto file{\the\filename.pdf} name{#1}% + \else + \startlink attr{/Border [0 0 0]}% + goto name{#1}% + \fi + }% \linkcolor \fi % @@ -5262,7 +5907,7 @@ width0pt\relax} \fi % into the usual \leavevmode...\vrule stuff for purposes of % printing. So we \turnoffactive for the \refx-snt, back on for the % printing, back off for the \refx-pg. - {\normalturnoffactive + {\turnoffactive \otherbackslash % Only output a following space if the -snt ref is nonempty; for % @unnumbered and @anchor, it won't be. \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% @@ -5271,73 +5916,74 @@ width0pt\relax} \fi % [mynode], [\printednodename],\space % page 3 - \turnoffactive \putwordpage\tie\refx{#1-pg}{}% + \turnoffactive \otherbackslash \putwordpage\tie\refx{#1-pg}{}% \fi \endlink \endgroup} -% \dosetq is the interface for calls from other macros - -% Use \normalturnoffactive so that punctuation chars such as underscore -% and backslash work in node names. (\turnoffactive doesn't do \.) +% \dosetq is called from \setref to do the actual \write (\iflinks). +% \def\dosetq#1#2{% {\let\folio=0% - \normalturnoffactive \edef\next{\write\auxfile{\internalsetq{#1}{#2}}}% - \iflinks - \next - \fi + \iflinks \next \fi }% } -% \internalsetq {foo}{page} expands into -% CHARACTERS 'xrdef {foo}{...expansion of \Ypage...} -% When the aux file is read, ' is the escape character - -\def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}} - -% Things to be expanded by \internalsetq +% \internalsetq{foo}{page} expands into +% CHARACTERS @xrdef{foo}{...expansion of \page...} +\def\internalsetq#1#2{@xrdef{#1}{\csname #2\endcsname}} +% Things to be expanded by \internalsetq. +% \def\Ypagenumber{\folio} - \def\Ytitle{\thissection} - \def\Ynothing{} - \def\Ysectionnumberandtype{% -\ifnum\secno=0 \putwordChapter\xreftie\the\chapno % -\else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno % -\else \ifnum \subsubsecno=0 % -\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno % -\else % -\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno % -\fi \fi \fi } + \ifnum\secno=0 + \putwordChapter@tie \the\chapno + \else \ifnum\subsecno=0 + \putwordSection@tie \the\chapno.\the\secno + \else \ifnum\subsubsecno=0 + \putwordSection@tie \the\chapno.\the\secno.\the\subsecno + \else + \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno + \fi\fi\fi +} \def\Yappendixletterandtype{% -\ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}% -\else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno % -\else \ifnum \subsubsecno=0 % -\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno % -\else % -\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno % -\fi \fi \fi } - -\gdef\xreftie{'tie} + \ifnum\secno=0 + \putwordAppendix@tie @char\the\appendixno{}% + \else \ifnum\subsecno=0 + \putwordSection@tie @char\the\appendixno.\the\secno + \else \ifnum\subsubsecno=0 + \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno + \else + \putwordSection@tie + @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno + \fi\fi\fi +} % Use TeX 3.0's \inputlineno to get the line number, for better error % messages, but if we're using an old version of TeX, don't do anything. % \ifx\inputlineno\thisisundefined - \let\linenumber = \empty % Non-3.0. + \let\linenumber = \empty % Pre-3.0. \else \def\linenumber{\the\inputlineno:\space} \fi % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. % If its value is nonempty, SUFFIX is output afterward. - +% \def\refx#1#2{% - \expandafter\ifx\csname X#1\endcsname\relax + {% + \indexnofonts + \otherbackslash + \expandafter\global\expandafter\let\expandafter\thisrefX + \csname X#1\endcsname + }% + \ifx\thisrefX\relax % If not defined, say something at least. \angleleft un\-de\-fined\angleright \iflinks @@ -5352,19 +5998,14 @@ width0pt\relax} \fi \fi \else % It's defined, so just use it. - \csname X#1\endcsname + \thisrefX \fi #2% Output the suffix in any case. } % This is the macro invoked by entries in the aux file. % -\def\xrdef#1{\begingroup - % Reenable \ as an escape while reading the second argument. - \catcode`\\ = 0 - \afterassignment\endgroup - \expandafter\gdef\csname X#1\endcsname -} +\def\xrdef#1{\expandafter\gdef\csname X#1\endcsname} % Read the last existing aux file, if any. No error if none exists. \def\readauxfile{\begingroup @@ -5395,9 +6036,7 @@ width0pt\relax} \fi \catcode`\^^]=\other \catcode`\^^^=\other \catcode`\^^_=\other - \catcode`\@=\other - \catcode`\^=\other - % It was suggested to define this as 7, which would allow ^^e4 etc. + % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc. % in xref tags, i.e., node names. But since ^^e4 notation isn't % supported in the main text, it doesn't seem desirable. Furthermore, % that is not enough: for node names that actually contain a ^ @@ -5410,6 +6049,9 @@ width0pt\relax} \fi % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter % and then to call \auxhat in \setq. % + \catcode`\^=\other + % + % Special characters. Should be turned off anyway, but... \catcode`\~=\other \catcode`\[=\other \catcode`\]=\other @@ -5421,7 +6063,9 @@ width0pt\relax} \fi \catcode`\$=\other \catcode`\#=\other \catcode`\&=\other + \catcode`\%=\other \catcode`+=\other % avoid \+ for paranoia even though we've turned it off + % % Make the characters 128-255 be printing characters {% \count 1=128 @@ -5431,17 +6075,18 @@ width0pt\relax} \fi \ifnum \count 1<256 \loop \fi }% }% - % The aux file uses ' as the escape (for now). + % % Turn off \ as an escape so we do not lose on % entries which were dumped with control sequences in their names. - % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^ + % For example, @xrdef{$\leq $-fun}{page ...} made by @defun ^^ % Reference to such entries still does not work the way one would wish, % but at least they do not bomb out when the aux file is read in. + \catcode`\\=\other + % + % @ is our escape character in .aux files. \catcode`\{=1 \catcode`\}=2 - \catcode`\%=\other - \catcode`\'=0 - \catcode`\\=\other + \catcode`\@=0 % \openin 1 \jobname.aux \ifeof 1 \else @@ -5486,7 +6131,7 @@ width0pt\relax} \fi % Remove inadvertent blank space before typesetting the footnote number. \unskip \thisfootno\@sf - \footnotezzz + \dofootnote }% % Don't bother with the trickery in plain.tex to not require the @@ -5496,10 +6141,17 @@ width0pt\relax} \fi % \parseargline fail inside footnotes because the tokens are fixed when % the footnote is read. --karl, 16nov96. % -\long\gdef\footnotezzz{\insert\footins\bgroup +% The start of the footnote looks usually like this: +\gdef\startfootins{\insert\footins\bgroup} +% +% ... but this macro is redefined inside @multitable. +% +\gdef\dofootnote{% + \startfootins % We want to typeset this text as a normal paragraph, even if the % footnote reference occurs in (for example) a display environment. % So reset some parameters. + \hsize=\pagewidth \interlinepenalty\interfootnotelinepenalty \splittopskip\ht\strutbox % top baseline for broken footnotes \splitmaxdepth\dp\strutbox @@ -5512,8 +6164,15 @@ width0pt\relax} \fi % \smallfonts \rm % - % Hang the footnote text off the number. - \hang + % Because we use hanging indentation in footnotes, a @noindent appears + % to exdent this text, so make it be a no-op. makeinfo does not use + % hanging indentation so @noindent can still be needed within footnote + % text after an @example or the like (not that this is good style). + \let\noindent = \relax + % + % Hang the footnote text off the number. Use \everypar in case the + % footnote extends for more than one paragraph. + \everypar = {\hang}% \textindent{\thisfootno}% % % Don't crash into the line above the footnote text. Since this @@ -5522,32 +6181,8 @@ width0pt\relax} \fi \footstrut \futurelet\next\fo@t } -\def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t - \else\let\next\f@t\fi \next} -\def\f@@t{\bgroup\aftergroup\@foot\let\next} -\def\f@t#1{#1\@foot} -\def\@foot{\strut\par\egroup} - }%end \catcode `\@=11 -% Set the baselineskip to #1, and the lineskip and strut size -% correspondingly. There is no deep meaning behind these magic numbers -% used as factors; they just match (closely enough) what Knuth defined. -% -\def\lineskipfactor{.08333} -\def\strutheightpercent{.70833} -\def\strutdepthpercent {.29167} -% -\def\setleading#1{% - \normalbaselineskip = #1\relax - \normallineskip = \lineskipfactor\normalbaselineskip - \normalbaselines - \setbox\strutbox =\hbox{% - \vrule width0pt height\strutheightpercent\baselineskip - depth \strutdepthpercent \baselineskip - }% -} - % @| inserts a changebar to the left of the current line. It should % surround any changed text. This approach does *not* work if the % change spans more than two lines of output. To handle that, we would @@ -5592,8 +6227,8 @@ width0pt\relax} \fi \openin 1 = epsf.tex \ifeof 1 \else \closein 1 - % Do not bother showing banner with post-v2.7 epsf.tex (available in - % doc/epsf.tex until it shows up on ctan). + % Do not bother showing banner with epsf.tex v2.7k (available in + % doc/epsf.tex and on ctan). \def\epsfannounce{\toks0 = }% \input epsf.tex \fi @@ -5612,40 +6247,44 @@ width0pt\relax} \fi \global\warnednoepsftrue \fi \else - \imagexxx #1,,,\finish + \imagexxx #1,,,,,\finish \fi } % % Arguments to @image: % #1 is (mandatory) image filename; we tack on .eps extension. % #2 is (optional) width, #3 is (optional) height. -% #4 is just the usual extra ignored arg for parsing this stuff. -\def\imagexxx#1,#2,#3,#4\finish{% +% #4 is (ignored optional) html alt text. +% #5 is (ignored optional) extension. +% #6 is just the usual extra ignored arg for parsing this stuff. +\newif\ifimagevmode +\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup + \catcode`\^^M = 5 % in case we're inside an example + \normalturnoffactive % allow _ et al. in names + % If the image is by itself, center it. + \ifvmode + \imagevmodetrue + \nobreak\bigskip + % Usually we'll have text after the image which will insert + % \parskip glue, so insert it here too to equalize the space + % above and below. + \nobreak\vskip\parskip + \nobreak + \line\bgroup\hss + \fi + % + % Output the image. \ifpdf - \centerline{\dopdfimage{#1}{#2}{#3}}% + \dopdfimage{#1}{#2}{#3}% \else % \epsfbox itself resets \epsf?size at each figure. \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi - \begingroup - \catcode`\^^M = 5 % in case we're inside an example - % If the image is by itself, center it. - \ifvmode - \nobreak\bigskip - % Usually we'll have text after the image which will insert - % \parskip glue, so insert it here too to equalize the space - % above and below. - \nobreak\vskip\parskip - \nobreak - \centerline{\epsfbox{#1.eps}}% - \bigbreak - \else - % In the middle of a paragraph, no extra space. - \epsfbox{#1.eps}% - \fi - \endgroup + \epsfbox{#1.eps}% \fi -} + % + \ifimagevmode \hss \egroup \bigbreak \fi % space after the image +\endgroup} \message{localization,} @@ -5714,10 +6353,13 @@ should work if nowhere else does.} } % Parameters in order: 1) textheight; 2) textwidth; 3) voffset; -% 4) hoffset; 5) binding offset; 6) topskip. Then whoever calls us can -% set \parskip and call \setleading for \baselineskip. +% 4) hoffset; 5) binding offset; 6) topskip; 7) physical page height; 8) +% physical page width. +% +% We also call \setleading{\textleading}, so the caller should define +% \textleading. The caller should also set \parskip. % -\def\internalpagesizes#1#2#3#4#5#6{% +\def\internalpagesizes#1#2#3#4#5#6#7#8{% \voffset = #3\relax \topskip = #6\relax \splittopskip = \topskip @@ -5736,6 +6378,13 @@ should work if nowhere else does.} \normaloffset = #4\relax \bindingoffset = #5\relax % + \ifpdf + \pdfpageheight #7\relax + \pdfpagewidth #8\relax + \fi + % + \setleading{\textleading} + % \parindent = \defaultparindent \setemergencystretch } @@ -5743,61 +6392,99 @@ should work if nowhere else does.} % @letterpaper (the default). \def\letterpaper{{\globaldefs = 1 \parskip = 3pt plus 2pt minus 1pt - \setleading{13.2pt}% + \textleading = 13.2pt % % If page is nothing but text, make it come out even. - \internalpagesizes{46\baselineskip}{6in}{\voffset}{.25in}{\bindingoffset}{36pt}% + \internalpagesizes{46\baselineskip}{6in}% + {\voffset}{.25in}% + {\bindingoffset}{36pt}% + {11in}{8.5in}% }} % Use @smallbook to reset parameters for 7x9.5 (or so) format. \def\smallbook{{\globaldefs = 1 \parskip = 2pt plus 1pt - \setleading{12pt}% + \textleading = 12pt % - \internalpagesizes{7.5in}{5.in}{\voffset}{.25in}{\bindingoffset}{16pt}% + \internalpagesizes{7.5in}{5in}% + {\voffset}{.25in}% + {\bindingoffset}{16pt}% + {9.25in}{7in}% % \lispnarrowing = 0.3in \tolerance = 700 \hfuzz = 1pt \contentsrightmargin = 0pt - \deftypemargin = 0pt \defbodyindent = .5cm - % - \let\smalldisplay = \smalldisplayx - \let\smallexample = \smalllispx - \let\smallformat = \smallformatx - \let\smalllisp = \smalllispx }} % Use @afourpaper to print on European A4 paper. \def\afourpaper{{\globaldefs = 1 - \setleading{12pt}% \parskip = 3pt plus 2pt minus 1pt + \textleading = 13.2pt % - \internalpagesizes{53\baselineskip}{160mm}{\voffset}{4mm}{\bindingoffset}{44pt}% + % Double-side printing via postscript on Laserjet 4050 + % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm. + % To change the settings for a different printer or situation, adjust + % \normaloffset until the front-side and back-side texts align. Then + % do the same for \bindingoffset. You can set these for testing in + % your texinfo source file like this: + % @tex + % \global\normaloffset = -6mm + % \global\bindingoffset = 10mm + % @end tex + \internalpagesizes{51\baselineskip}{160mm} + {\voffset}{\hoffset}% + {\bindingoffset}{44pt}% + {297mm}{210mm}% % \tolerance = 700 \hfuzz = 1pt + \contentsrightmargin = 0pt + \defbodyindent = 5mm }} -% A specific text layout, 24x15cm overall, intended for A4 paper. Top margin -% 29mm, hence bottom margin 28mm, nominal side margin 3cm. -\def\afourlatex{{\globaldefs = 1 - \setleading{13.6pt}% +% Use @afivepaper to print on European A5 paper. +% From romildo@urano.iceb.ufop.br, 2 July 2000. +% He also recommends making @example and @lisp be small. +\def\afivepaper{{\globaldefs = 1 + \parskip = 2pt plus 1pt minus 0.1pt + \textleading = 12.5pt + % + \internalpagesizes{160mm}{120mm}% + {\voffset}{\hoffset}% + {\bindingoffset}{8pt}% + {210mm}{148mm}% % + \lispnarrowing = 0.2in + \tolerance = 800 + \hfuzz = 1.2pt + \contentsrightmargin = 0pt + \defbodyindent = 2mm + \tableindent = 12mm +}} + +% A specific text layout, 24x15cm overall, intended for A4 paper. +\def\afourlatex{{\globaldefs = 1 \afourpaper - \internalpagesizes{237mm}{150mm}{3.6mm}{3.6mm}{3mm}{7mm}% + \internalpagesizes{237mm}{150mm}% + {\voffset}{4.6mm}% + {\bindingoffset}{7mm}% + {297mm}{210mm}% % + % Must explicitly reset to 0 because we call \afourpaper. \globaldefs = 0 }} -% Use @afourwide to print on European A4 paper in wide format. -\def\afourwide{% +% Use @afourwide to print on A4 paper in landscape format. +\def\afourwide{{\globaldefs = 1 \afourpaper - \internalpagesizes{9.5in}{6.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}% - % + \internalpagesizes{241mm}{165mm}% + {\voffset}{-2.95mm}% + {\bindingoffset}{7mm}% + {297mm}{210mm}% \globaldefs = 0 -} +}} % @pagesizes TEXTHEIGHT[,TEXTWIDTH] % Perhaps we should allow setting the margins, \topskip, \parskip, @@ -5810,9 +6497,18 @@ should work if nowhere else does.} \globaldefs = 1 % \parskip = 3pt plus 2pt minus 1pt - \setleading{13.2pt}% + \setleading{\textleading}% + % + \dimen0 = #1 + \advance\dimen0 by \voffset % - \internalpagesizes{#1}{\hsize}{\voffset}{\normaloffset}{\bindingoffset}{44pt}% + \dimen2 = \hsize + \advance\dimen2 by \normaloffset + % + \internalpagesizes{#1}{\hsize}% + {\voffset}{\normaloffset}% + {\bindingoffset}{44pt}% + {\dimen0}{\dimen2}% }} % Set default to letter. @@ -5840,7 +6536,7 @@ should work if nowhere else does.} \def\normalless{<} \def\normalgreater{>} \def\normalplus{+} -\def\normaldollar{$} +\def\normaldollar{$}%$ font-lock fix % This macro is used to make a character print one way in ttfont % where it can probably just be output, and another way in other fonts, @@ -5876,7 +6572,7 @@ should work if nowhere else does.} \catcode`\_=\active \def_{\ifusingtt\normalunderscore\_} % Subroutine for the previous macro. -\def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}} +\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em } \catcode`\|=\active \def|{{\tt\char124}} @@ -5889,9 +6585,7 @@ should work if nowhere else does.} \catcode`\+=\active \def+{{\tt \char 43}} \catcode`\$=\active -\def${\ifusingit{{\sl\$}}\normaldollar} -%\catcode 27=\active -%\def^^[{$\diamondsuit$} +\def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix % Set up an active definition for =, but don't enable it most of the time. {\catcode`\==\active @@ -5908,44 +6602,46 @@ should work if nowhere else does.} \catcode`\@=0 -% \rawbackslashxx output one backslash character in current font +% \rawbackslashxx outputs one backslash character in current font, +% as in \char`\\. \global\chardef\rawbackslashxx=`\\ -%{\catcode`\\=\other -%@gdef@rawbackslashxx{\}} -% \rawbackslash redefines \ as input to do \rawbackslashxx. +% \rawbackslash defines an active \ to do \rawbackslashxx. +% \otherbackslash defines an active \ to be a literal `\' character with +% catcode other. {\catcode`\\=\active -@gdef@rawbackslash{@let\=@rawbackslashxx }} + @gdef@rawbackslash{@let\=@rawbackslashxx} + @gdef@otherbackslash{@let\=@realbackslash} +} + +% \realbackslash is an actual character `\' with catcode other. +{\catcode`\\=\other @gdef@realbackslash{\}} % \normalbackslash outputs one backslash in fixed width font. \def\normalbackslash{{\tt\rawbackslashxx}} -% \catcode 17=0 % Define control-q \catcode`\\=\active % Used sometimes to turn off (effectively) the active characters % even after parsing them. -@def@turnoffactive{@let"=@normaldoublequote -@let\=@realbackslash -@let~=@normaltilde -@let^=@normalcaret -@let_=@normalunderscore -@let|=@normalverticalbar -@let<=@normalless -@let>=@normalgreater -@let+=@normalplus -@let$=@normaldollar} - -@def@normalturnoffactive{@let"=@normaldoublequote -@let\=@normalbackslash -@let~=@normaltilde -@let^=@normalcaret -@let_=@normalunderscore -@let|=@normalverticalbar -@let<=@normalless -@let>=@normalgreater -@let+=@normalplus -@let$=@normaldollar} +@def@turnoffactive{% + @let"=@normaldoublequote + @let\=@realbackslash + @let~=@normaltilde + @let^=@normalcaret + @let_=@normalunderscore + @let|=@normalverticalbar + @let<=@normalless + @let>=@normalgreater + @let+=@normalplus + @let$=@normaldollar %$ font-lock fix +} + +% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of +% the literal character `\'. (Thus, \ is not expandable when this is in +% effect.) +% +@def@normalturnoffactive{@turnoffactive @let\=@normalbackslash} % Make _ and + \other characters, temporarily. % This is canceled by @fixbackslash. diff --git a/doc/version.texi b/doc/version.texi new file mode 100644 index 00000000..84b4ce67 --- /dev/null +++ b/doc/version.texi @@ -0,0 +1,10 @@ +@ignore +Copyright (C) 1988-2003 Free Software Foundation, Inc. +@end ignore + +@set EDITION 3.0 +@set VERSION 3.0-alpha +@set UPDATED 12 September 2003 +@set UPDATED-MONTH September 2003 + +@set LASTCHANGE Fri Sep 12 18:21:15 EDT 2003 @@ -40,11 +40,8 @@ extern int errno; #endif /* !errno */ #include "bashansi.h" +#include "shell.h" #include "flags.h" -#include "error.h" -#include "command.h" -#include "general.h" -#include "externs.h" #include "input.h" #if defined (HISTORY) @@ -71,20 +68,22 @@ static void error_prolog __P((int)); char *the_current_maintainer = MAINTAINER; +int gnu_error_format = 0; + static void error_prolog (print_lineno) int print_lineno; { + char *ename; int line; - fprintf (stderr, "%s: ", get_name_for_error ()); + ename = get_name_for_error (); + line = (print_lineno && interactive_shell == 0) ? executing_line_number () : -1; - if (print_lineno && interactive_shell == 0) - { - line = executing_line_number (); - if (line > 0) - fprintf (stderr, "line %d: ", line); - } + if (line > 0) + fprintf (stderr, "%s:%s%d: ", ename, gnu_error_format ? "" : " line ", line); + else + fprintf (stderr, "%s: ", ename); } /* Return the name of the shell or the shell script for error reporting. */ @@ -92,10 +91,23 @@ char * get_name_for_error () { char *name; +#if defined (ARRAY_VARS) + SHELL_VAR *bash_source_v; + ARRAY *bash_source_a; +#endif name = (char *)NULL; if (interactive_shell == 0) - name = dollar_vars[0]; + { +#if defined (ARRAY_VARS) + bash_source_v = find_variable ("BASH_SOURCE"); + if (bash_source_v && array_p (bash_source_v) && + (bash_source_a = array_cell (bash_source_v))) + name = array_reference (bash_source_a, 0); + if (name == 0) +#endif + name = dollar_vars[0]; + } if (name == 0 && shell_name && *shell_name) name = base_pathname (shell_name); if (name == 0) @@ -299,11 +311,11 @@ parser_error (lineno, format, va_alist) if (interactive) fprintf (stderr, "%s: ", ename); else if (interactive_shell) - fprintf (stderr, "%s: %s: line %d: ", ename, iname, lineno); + fprintf (stderr, "%s: %s:%s%d: ", ename, iname, gnu_error_format ? "" : " line ", lineno); else if (STREQ (ename, iname)) - fprintf (stderr, "%s: line %d: ", ename, lineno); + fprintf (stderr, "%s:%s%d: ", ename, gnu_error_format ? "" : " line ", lineno); else - fprintf (stderr, "%s: %s: line %d: ", ename, iname, lineno); + fprintf (stderr, "%s: %s:%s%d: ", ename, iname, gnu_error_format ? "" : " line ", lineno); SH_VA_START (args, format); @@ -88,6 +88,7 @@ reader_loop () { /* Some kind of throw to top_level has occured. */ case FORCE_EOF: + case ERREXIT: case EXITPROG: current_command = (COMMAND *)NULL; if (exit_immediately_on_error) @@ -170,6 +171,7 @@ alrm_catcher(i) int i; { printf ("\007timed out waiting for input: auto-logout\n"); + bash_logout (); /* run ~/.bash_logout if this is a login shell */ jump_to_top_level (EXITPROG); SIGRETURN (0); } diff --git a/examples/complete/bashcc-1.0.1.tar.gz b/examples/complete/bashcc-1.0.1.tar.gz Binary files differnew file mode 100644 index 00000000..d6804358 --- /dev/null +++ b/examples/complete/bashcc-1.0.1.tar.gz diff --git a/examples/functions/coproc.bash b/examples/functions/coproc.bash index d9175a1c..61dc8d74 100644 --- a/examples/functions/coproc.bash +++ b/examples/functions/coproc.bash @@ -63,7 +63,7 @@ function coprocess () shift local old_trap=$(trap -p SIGPIPE) trap 'coprocess close -SIGPIPE' SIGPIPE - if [ $# -eq 1 -a "$1" = "--stdin" ] ; then + if [ $# -eq 1 ] && [ "$1" = "--stdin" ] ; then cat >&61 else echo "$@" >&61 @@ -106,4 +106,3 @@ function coprocess () coprocess status return $? } - diff --git a/examples/functions/csh-compat b/examples/functions/csh-compat index a855eaf5..b8dcf8f7 100644 --- a/examples/functions/csh-compat +++ b/examples/functions/csh-compat @@ -33,15 +33,16 @@ function alias () then declare -f $1 else - echo $2 | egrep -s '(\!|#)' 2>/dev/null - if [ $? -eq 0 ] - then + case $2 in + *[#\!]*) comm=$(echo $2 | sed 's/\\!\*/\"$\@\"/g s/\\!:\([1-9]\)/\"$\1\"/g s/#/\\#/g') - else - comm="$2 \"\$@\"" - fi + ;; + *) + comm="$2 \"\$@\"" ;; + esac + eval function $1 \(\) "{" command "$comm" "; }" fi } diff --git a/examples/functions/exitstat b/examples/functions/exitstat index 2828a891..f49ebf58 100644 --- a/examples/functions/exitstat +++ b/examples/functions/exitstat @@ -8,7 +8,7 @@ function check_exit_status () local status="$?" local signal="" - if [ ${status} -ne 0 -a ${status} != 128 ]; then + if [ ${status} -ne 0 ] && [ ${status} != 128 ]; then # If process exited by a signal, determine name of signal. if [ ${status} -gt 128 ]; then signal="$(builtin kill -l $((${status} - 128)) 2>/dev/null)" diff --git a/examples/functions/getoptx.bash b/examples/functions/getoptx.bash index 23e5de52..d402c7d7 100644 --- a/examples/functions/getoptx.bash +++ b/examples/functions/getoptx.bash @@ -134,7 +134,7 @@ function getoptex() let OPTIND || OPTIND=1 [ $OPTIND -lt $# ] || return 1 shift $OPTIND - if [ "$1" != "-" -a "$1" != "${1#-}" ] + if [ "$1" != "-" ] && [ "$1" != "${1#-}" ] then OPTIND=$[OPTIND+1]; if [ "$1" != "--" ] then local o @@ -299,4 +299,3 @@ function getopt() #************************************** #*** (end of getopt2) *** - diff --git a/examples/functions/kshenv b/examples/functions/kshenv index 2b9a6ebb..7594f2d3 100644 --- a/examples/functions/kshenv +++ b/examples/functions/kshenv @@ -207,7 +207,7 @@ substring () ;; esac # test for too few or too many arguments - if [ x"$1" = x -o $# -gt 2 ]; then + if [ x"$1" = x ] || [ $# -gt 2 ]; then print -u2 'substring: bad argument count' return 1 fi diff --git a/examples/functions/manpage b/examples/functions/manpage index 224643e4..60f9aed0 100644 --- a/examples/functions/manpage +++ b/examples/functions/manpage @@ -70,7 +70,7 @@ function whatis () function apropos () { - whatis_internal "$1" "fgrep" + whatis_internal "$1" "grep -F" } # Note: "-" and "-t" together not supported. This man could be @@ -102,7 +102,7 @@ function man () g="grep -w" a=$(basename "$2") else - g=fgrep + g="grep -F" a="$2" fi whatis_internal "$a" "$g" diff --git a/examples/functions/recurse b/examples/functions/recurse index 14c4b9e3..f69cd503 100644 --- a/examples/functions/recurse +++ b/examples/functions/recurse @@ -44,15 +44,15 @@ function recurse if cd "$1" ; then for file in $2; do - if [ -f "$file" -o -d "$file" ]; then + if [ -f "$file" ] || [ -d "$file" ]; then eval "$3" fi done for file in .* * ; do - if [ "$file" = "." -o "$file" = ".." ] ; then + if [ "$file" = "." ] || [ "$file" = ".." ] ; then continue fi - if [ -d "$file" -a ! -L "$file" ]; then + if [ -d "$file" ] && [ ! -L "$file" ]; then recurse "$file" "$2" "$3" "$path" fi done @@ -61,4 +61,3 @@ function recurse } recurse "$1" "$2" 'echo "$path$file"' - diff --git a/examples/functions/substr b/examples/functions/substr index c5576779..a80b3b46 100644 --- a/examples/functions/substr +++ b/examples/functions/substr @@ -30,7 +30,7 @@ substr() ;; esac - if [ "$#" -eq 0 -o "$#" -gt 2 ] ; then + if [ "$#" -eq 0 ] || [ "$#" -gt 2 ] ; then echo "substr: bad argument count" return 2 fi diff --git a/examples/functions/substr2 b/examples/functions/substr2 index f5e75473..2bb8d363 100644 --- a/examples/functions/substr2 +++ b/examples/functions/substr2 @@ -32,7 +32,7 @@ substr() shift $[ $OPTIND -1 ] fi - if [ "$#" -eq 0 -o "$#" -gt 2 ] ; then + if [ "$#" -eq 0 ] || [ "$#" -gt 2 ] ; then echo "substr: bad argument count" return 2 fi diff --git a/examples/functions/xalias.bash b/examples/functions/xalias.bash index 29e8bfb7..88a00dc6 100644 --- a/examples/functions/xalias.bash +++ b/examples/functions/xalias.bash @@ -7,15 +7,16 @@ function xalias () then declare -f $1 else - echo $2 | egrep -q '(\!|#)' - if [ $? -eq 0 ] - then + case $2 in + *[#\!]*) comm=$(echo $2 | sed 's/\\!\*/\"$\@\"/g s/\\!:\([1-9]\)/\"$\1\"/g s/#/\\#/g') - else - comm="$2 \"\$@\"" - fi + ;; + *) + comm="$2 \"\$@\"" ;; + esac + eval function $1 \(\) "{" command "$comm" "; }" fi } diff --git a/examples/functions/xfind.bash b/examples/functions/xfind.bash index 578e8838..6d290381 100644 --- a/examples/functions/xfind.bash +++ b/examples/functions/xfind.bash @@ -39,7 +39,7 @@ xfind() # and directories that start with a period. for x in * ; do - if [ -d "$x" -a ! -L "$x" ] ; then + if [ -d "$x" ] && [ ! -L "$x" ] ; then $FUNCNAME "$x" "$2" "$action" fi done diff --git a/examples/loadables/Makefile.in b/examples/loadables/Makefile.in index ed1721f5..356baef3 100644 --- a/examples/loadables/Makefile.in +++ b/examples/loadables/Makefile.in @@ -72,7 +72,7 @@ INC = -I. -I.. -I$(topdir) -I$(topdir)/lib -I$(topdir)/builtins \ ALLPROG = print truefalse sleep pushd finfo logname basename dirname \ tty pathchk tee head mkdir rmdir printenv id whoami \ - uname sync push ln unlink cut realpath getconf + uname sync push ln unlink cut realpath getconf strftime OTHERPROG = necho hello cat all: $(SHOBJ_STATUS) @@ -172,6 +172,9 @@ cut: cut.o realpath: realpath.o $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ realpath.o $(SHOBJ_LIBS) +strftime: strftime.o + $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ strftime.o $(SHOBJ_LIBS) + # pushd is a special case. We use the same source that the builtin version # uses, with special compilation options. # @@ -221,3 +224,4 @@ sync.o: sync.c push.o: push.c mkdir.o: mkdir.c realpath.o: realpath.c +strftime.o: strftime.c diff --git a/examples/loadables/getconf.c b/examples/loadables/getconf.c index 5d079b6f..cc6d50b3 100644 --- a/examples/loadables/getconf.c +++ b/examples/loadables/getconf.c @@ -78,7 +78,7 @@ extern int errno; struct conf_variable { const char *name; - enum { SYSCONF, CONFSTR, PATHCONF, CONSTANT, G_UNDEF } type; + enum { SYSCONF, CONFSTR, PATHCONF, CONSTANT, LLCONST, G_UNDEF } type; long value; }; @@ -94,6 +94,11 @@ static long sysconf __P((int)); static long pathconf __P((const char *, int)); #endif +/* Hack to `encode' values wider than long into a conf_variable */ +#define VAL_LLONG_MIN -1000 +#define VAL_LLONG_MAX -1001 +#define VAL_ULLONG_MAX -1002 + static const struct conf_variable conf_table[] = { /* POSIX.2 Configurable Variable Values */ @@ -169,6 +174,8 @@ static const struct conf_variable conf_table[] = { "POSIX_V6_ILP32_OFF32_CFLAGS", CONFSTR, _CS_POSIX_V6_ILP32_OFF32_CFLAGS }, { "POSIX_V6_ILP32_OFF32_LDFLAGS", CONFSTR, _CS_POSIX_V6_ILP32_OFF32_LDFLAGS }, { "POSIX_V6_ILP32_OFF32_LIBS", CONFSTR, _CS_POSIX_V6_ILP32_OFF32_LIBS }, +#endif +#if defined (_CS_POSIX_V6_ILP32_OFF32_LINTFLAGS) { "POSIX_V6_ILP32_OFF32_LINTFLAGS", CONFSTR, _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS }, #endif #if defined (_SC_POSIX_V6_ILP32_OFFBIG) @@ -178,6 +185,8 @@ static const struct conf_variable conf_table[] = { "POSIX_V6_ILP32_OFFBIG_CFLAGS", CONFSTR, _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS }, { "POSIX_V6_ILP32_OFFBIG_LDFLAGS", CONFSTR, _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS }, { "POSIX_V6_ILP32_OFFBIG_LIBS", CONFSTR, _CS_POSIX_V6_ILP32_OFFBIG_LIBS }, +#endif +#if defined (_CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS) { "POSIX_V6_ILP32_OFFBIG_LINTFLAGS", CONFSTR, _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS }, #endif #if defined (_SC_POSIX_V6_LP64_OFF64) @@ -187,6 +196,8 @@ static const struct conf_variable conf_table[] = { "POSIX_V6_LP64_OFF64_CFLAGS", CONFSTR, _CS_POSIX_V6_LP64_OFF64_CFLAGS }, { "POSIX_V6_LP64_OFF64_LDFLAGS", CONFSTR, _CS_POSIX_V6_LP64_OFF64_LDFLAGS }, { "POSIX_V6_LP64_OFF64_LIBS", CONFSTR, _CS_POSIX_V6_LP64_OFF64_LIBS }, +#endif +#if defined (CS_POSIX_V6_LP64_OFF64_LINTFLAGS) { "POSIX_V6_LP64_OFF64_LINTFLAGS", CONFSTR, _CS_POSIX_V6_LP64_OFF64_LINTFLAGS }, #endif #if defined (_SC_POSIX_V6_LPBIG_OFFBIG) @@ -196,9 +207,15 @@ static const struct conf_variable conf_table[] = { "POSIX_V6_LPBIG_OFFBIG_CFLAGS", CONFSTR, _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS }, { "POSIX_V6_LPBIG_OFFBIG_LDFLAGS", CONFSTR, _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS }, { "POSIX_V6_LPBIG_OFFBIG_LIBS", CONFSTR, _CS_POSIX_V6_LPBIG_OFFBIG_LIBS }, +#endif +#if defined (_CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS) { "POSIX_V6_LPBIG_OFFBIG_LINTFLAGS", CONFSTR, _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS }, #endif +#if defined (_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS) + { "POSIX_6_WIDTH_RESTRICTED_ENVS", CONFSTR, _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS }, +#endif + /* POSIX.2 Utility Limit Minimum Values */ #ifdef _POSIX2_BC_BASE_MAX { "POSIX2_BC_BASE_MAX", CONSTANT, _POSIX2_BC_BASE_MAX }, @@ -220,6 +237,11 @@ static const struct conf_variable conf_table[] = #else { "POSIX2_BC_STRING_MAX", G_UNDEF, -1 }, #endif +#ifdef _POSIX2_CHARCLASS_NAME_MAX + { "POSIX2_CHARCLASS_NAME_MAX", CONSTANT, _POSIX2_CHARCLASS_NAME_MAX }, +#else + { "POSIX2_CHARCLASS_NAME_MAX", G_UNDEF, -1 }, +#endif #ifdef _POSIX2_COLL_WEIGHTS_MAX { "POSIX2_COLL_WEIGHTS_MAX", CONSTANT, _POSIX2_COLL_WEIGHTS_MAX }, #else @@ -251,7 +273,83 @@ static const struct conf_variable conf_table[] = # endif #endif +#ifdef _POSIX2_BC_BASE_MAX + { "_POSIX2_BC_BASE_MAX", CONSTANT, _POSIX2_BC_BASE_MAX }, +#else + { "_POSIX2_BC_BASE_MAX", G_UNDEF, -1 }, +#endif +#ifdef _POSIX2_BC_DIM_MAX + { "_POSIX2_BC_DIM_MAX", CONSTANT, _POSIX2_BC_DIM_MAX }, +#else + { "_POSIX2_BC_DIM_MAX", G_UNDEF, -1 }, +#endif +#ifdef _POSIX2_BC_SCALE_MAX + { "_POSIX2_BC_SCALE_MAX", CONSTANT, _POSIX2_BC_SCALE_MAX }, +#else + { "_POSIX2_BC_SCALE_MAX", G_UNDEF, -1 }, +#endif +#ifdef _POSIX2_BC_STRING_MAX + { "_POSIX2_BC_STRING_MAX", CONSTANT, _POSIX2_BC_STRING_MAX }, +#else + { "_POSIX2_BC_STRING_MAX", G_UNDEF, -1 }, +#endif +#ifdef _POSIX2_CHARCLASS_NAME_MAX + { "_POSIX2_CHARCLASS_NAME_MAX", CONSTANT, _POSIX2_CHARCLASS_NAME_MAX }, +#else + { "_POSIX2_CHARCLASS_NAME_MAX", G_UNDEF, -1 }, +#endif +#ifdef _POSIX2_COLL_WEIGHTS_MAX + { "_POSIX2_COLL_WEIGHTS_MAX", CONSTANT, _POSIX2_COLL_WEIGHTS_MAX }, +#else + { "_POSIX2_COLL_WEIGHTS_MAX", G_UNDEF, -1 }, +#endif +#if defined (_POSIX2_EQUIV_CLASS_MAX) + { "POSIX2_EQUIV_CLASS_MAX", CONSTANT, _POSIX2_EQUIV_CLASS_MAX }, +#endif +#ifdef _POSIX2_EXPR_NEST_MAX + { "_POSIX2_EXPR_NEST_MAX", CONSTANT, _POSIX2_EXPR_NEST_MAX }, +#else + { "_POSIX2_EXPR_NEST_MAX", G_UNDEF, -1 }, +#endif +#ifdef _POSIX2_LINE_MAX + { "_POSIX2_LINE_MAX", CONSTANT, _POSIX2_LINE_MAX }, +#else + { "_POSIX2_LINE_MAX", G_UNDEF, -1 }, +#endif +#ifdef _POSIX2_RE_DUP_MAX + { "_POSIX2_RE_DUP_MAX", CONSTANT, _POSIX2_RE_DUP_MAX }, +#else + { "_POSIX2_RE_DUP_MAX", G_UNDEF, -1 }, +#endif + + /* X/OPEN Maxmimum Values */ +#ifdef _XOPEN_IOV_MAX + { "_XOPEN_IOV_MAX", CONSTANT, _XOPEN_IOV_MAX }, +#else + { "_XOPEN_IOV_MAX", G_UNDEF, -1 }, +#endif +#ifdef _XOPEN_NAME_MAX + { "_XOPEN_NAME_MAX", CONSTANT, _XOPEN_NAME_MAX }, +#else + { "_XOPEN_NAME_MAX", G_UNDEF, -1 }, +#endif +#ifdef _XOPEN_PATH_MAX + { "_XOPEN_PATH_MAX", CONSTANT, _XOPEN_PATH_MAX }, +#else + { "_XOPEN_PATH_MAX", G_UNDEF, -1 }, +#endif + /* POSIX.1 Minimum Values */ +#ifdef _POSIX_AIO_LISTIO_MAX + { "_POSIX_AIO_LISTIO_MAX", CONSTANT, _POSIX_AIO_LISTIO_MAX }, +#else + { "_POSIX_AIO_LISTIO_MAX", G_UNDEF, -1 }, +#endif +#ifdef _POSIX_AIO_MAX + { "_POSIX_AIO_MAX", CONSTANT, _POSIX_AIO_MAX }, +#else + { "_POSIX_AIO_MAX", G_UNDEF, -1 }, +#endif #ifdef _POSIX_ARG_MAX { "_POSIX_ARG_MAX", CONSTANT, _POSIX_ARG_MAX }, #else @@ -260,13 +358,28 @@ static const struct conf_variable conf_table[] = #ifdef _POSIX_CHILD_MAX { "_POSIX_CHILD_MAX", CONSTANT, _POSIX_CHILD_MAX }, #else - { "_POSIX_CHILD_MAX", G_UNDEF, -1 }, + { "_POSIX_CHILD_MAX", G_UNDEF, -1 }, +#endif +#ifdef _POSIX_DELAYTIMER_MAX + { "_POSIX_DELAYTIMER_MAX", CONSTANT, _POSIX_DELAYTIMER_MAX }, +#else + { "_POSIX_DELAYTIMER_MAX", G_UNDEF, -1 }, +#endif +#ifdef _POSIX_HOST_NAME_MAX + { "_POSIX_HOST_NAME_MAX", CONSTANT, _POSIX_HOST_NAME_MAX }, +#else + { "_POSIX_HOST_NAME_MAX", G_UNDEF, -1 }, #endif #ifdef _POSIX_LINK_MAX { "_POSIX_LINK_MAX", CONSTANT, _POSIX_LINK_MAX }, #else { "_POSIX_LINK_MAX", G_UNDEF, -1 }, #endif +#ifdef _POSIX_LOGIN_NAME_MAX + { "_POSIX_LOGIN_NAME_MAX", CONSTANT, _POSIX_LOGIN_NAME_MAX }, +#else + { "_POSIX_LOGIN_NAME_MAX", G_UNDEF, -1 }, +#endif #ifdef _POSIX_MAX_CANON { "_POSIX_MAX_CANON", CONSTANT, _POSIX_MAX_CANON }, #else @@ -277,6 +390,16 @@ static const struct conf_variable conf_table[] = #else { "_POSIX_MAX_INPUT", G_UNDEF, -1 }, #endif +#ifdef _POSIX_MQ_OPEN_MAX + { "_POSIX_MQ_OPEN_MAX", CONSTANT, _POSIX_MQ_OPEN_MAX }, +#else + { "_POSIX_MQ_OPEN_MAX", G_UNDEF, -1 }, +#endif +#ifdef _POSIX_MQ_PRIO_MAX + { "_POSIX_MQ_PRIO_MAX", CONSTANT, _POSIX_MQ_PRIO_MAX }, +#else + { "_POSIX_MQ_PRIO_MAX", G_UNDEF, -1 }, +#endif #ifdef _POSIX_NAME_MAX { "_POSIX_NAME_MAX", CONSTANT, _POSIX_NAME_MAX }, #else @@ -302,20 +425,129 @@ static const struct conf_variable conf_table[] = #else { "_POSIX_PIPE_BUF", G_UNDEF, -1 }, #endif +#ifdef _POSIX_RE_DUP_MAX + { "_POSIX_RE_DUP_MAX", CONSTANT, _POSIX_RE_DUP_MAX }, +#else + { "_POSIX_RE_DUP_MAX", G_UNDEF, -1 }, +#endif +#ifdef _POSIX_RTSIG_MAX + { "_POSIX_RTSIG_MAX", CONSTANT, _POSIX_RTSIG_MAX }, +#else + { "_POSIX_RTSIG_MAX", G_UNDEF, -1 }, +#endif +#ifdef _POSIX_SEM_NSEMS_MAX + { "_POSIX_SEM_NSEMS_MAX", CONSTANT, _POSIX_SEM_NSEMS_MAX }, +#else + { "_POSIX_SEM_NSEMS_MAX", G_UNDEF, -1 }, +#endif +#ifdef _POSIX_SEM_VALUE_MAX + { "_POSIX_SEM_VALUE_MAX", CONSTANT, _POSIX_SEM_VALUE_MAX }, +#else + { "_POSIX_SEM_VALUE_MAX", G_UNDEF, -1 }, +#endif +#ifdef _POSIX_SIGQUEUE_MAX + { "_POSIX_SIGQUEUE_MAX", CONSTANT, _POSIX_SIGQUEUE_MAX }, +#else + { "_POSIX_SIGQUEUE_MAX", G_UNDEF, -1 }, +#endif #ifdef _POSIX_SSIZE_MAX { "_POSIX_SSIZE_MAX", CONSTANT, _POSIX_SSIZE_MAX }, #else { "_POSIX_SSIZE_MAX", G_UNDEF, -1 }, #endif +#ifdef _POSIX_SS_REPL_MAX + { "_POSIX_SS_REPL_MAX", CONSTANT, _POSIX_SS_REPL_MAX }, +#else + { "_POSIX_SS_REPL_MAX", G_UNDEF, -1 }, +#endif #ifdef _POSIX_STREAM_MAX { "_POSIX_STREAM_MAX", CONSTANT, _POSIX_STREAM_MAX }, #else { "_POSIX_STREAM_MAX", G_UNDEF, -1 }, #endif +#ifdef _POSIX_SYMLINK_MAX + { "_POSIX_SYMLINK_MAX", CONSTANT, _POSIX_SYMLINK_MAX }, +#else + { "_POSIX_SYMLINK_MAX", G_UNDEF, -1 }, +#endif +#ifdef _POSIX_SYMLOOP_MAX + { "_POSIX_SYMLOOP_MAX", CONSTANT, _POSIX_SYMLOOP_MAX }, +#else + { "_POSIX_SYMLOOP_MAX", G_UNDEF, -1 }, +#endif +#ifdef _POSIX_THREAD_DESTRUCTOR_ITERATIONS + { "_POSIX_THREAD_DESTRUCTOR_ITERATIONS", CONSTANT, _POSIX_THREAD_DESTRUCTOR_ITERATIONS }, +#else + { "_POSIX_THREAD_DESTRUCTOR_ITERATIONS", G_UNDEF, -1 }, +#endif +#ifdef _POSIX_THREAD_KEYS_MAX + { "_POSIX_THREAD_KEYS_MAX", CONSTANT, _POSIX_THREAD_KEYS_MAX }, +#else + { "_POSIX_THREAD_KEYS_MAX", G_UNDEF, -1 }, +#endif +#ifdef _POSIX_THREAD_THREADS_MAX + { "_POSIX_THREAD_THREADS_MAX",CONSTANT, _POSIX_THREAD_THREADS_MAX }, +#else + { "_POSIX_THREAD_THREADS_MAX",G_UNDEF, -1 }, +#endif +#ifdef _POSIX_TIMER_MAX + { "_POSIX_TIMER_MAX", CONSTANT, _POSIX_TIMER_MAX }, +#else + { "_POSIX_TIMER_MAX", G_UNDEF, -1 }, +#endif +#ifdef _POSIX_TRACE_EVENT_NAME_MAX + { "_POSIX_TRACE_EVENT_NAME_MAX", CONSTANT, _POSIX_TRACE_EVENT_NAME_MAX }, +#else + { "_POSIX_TRACE_EVENT_NAME_MAX", G_UNDEF, -1 }, +#endif +#ifdef _POSIX_TRACE_NAME_MAX + { "_POSIX_TRACE_NAME_MAX", CONSTANT, _POSIX_TRACE_NAME_MAX }, +#else + { "_POSIX_TRACE_NAME_MAX", G_UNDEF, -1 }, +#endif +#ifdef _POSIX_TRACE_SYS_MAX + { "_POSIX_TRACE_SYS_MAX", CONSTANT, _POSIX_TRACE_SYS_MAX }, +#else + { "_POSIX_TRACE_SYS_MAX", G_UNDEF, -1 }, +#endif +#ifdef _POSIX_TRACE_USER_EVENT_MAX + { "_POSIX_TRACE_USER_EVENT_MAX", CONSTANT, _POSIX_TRACE_USER_EVENT_MAX }, +#else + { "_POSIX_TRACE_USER_EVENT_MAX", G_UNDEF, -1 }, +#endif +#ifdef _POSIX_TTY_NAME_MAX + { "_POSIX_TTY_NAME_MAX", CONSTANT, _POSIX_TTY_NAME_MAX }, +#else + { "_POSIX_TTY_NAME_MAX", G_UNDEF, -1 }, +#endif #ifdef _POSIX_TZNAME_MAX { "_POSIX_TZNAME_MAX", CONSTANT, _POSIX_TZNAME_MAX }, #else - { "_POSIX_TZNAME_MAX", G_UNDEF, -1 }, + { "_POSIX_TZNAME_MAX", G_UNDEF, -1 }, +#endif + + /* POSIX.1 Maximum Values */ +#ifdef _POSIX_CLOCKRES_MIN + { "_POSIX_CLOCKRES_MIN", CONSTANT, _POSIX_CLOCKRES_MIN }, +#else + { "_POSIX_CLOCKRES_MIN", G_UNDEF, -1 }, +#endif + + /* POSIX.1-2001/XPG6 (and later) Runtime Invariants from <limits.h> */ +#ifdef _SC_SS_REPL_MAX + { "SS_REPL_MAX", SYSCONF, _SC_SS_REPL_MAX }, +#endif +#ifdef _SC_TRACE_EVENT_NAME_MAX + { "TRACE_EVENT_NAME_MAX", SYSCONF, _SC_TRACE_EVENT_NAME_MAX }, +#endif +#ifdef _SC_TRACE_NAME_MAX + { "TRACE_NAME_MAX", SYSCONF, _SC_TRACE_NAME_MAX }, +#endif +#ifdef _SC_TRACE_SYS_MAX + { "TRACE_SYS_MAX", SYSCONF, _SC_TRACE_SYS_MAX }, +#endif +#ifdef _SC_TRACE_USER_EVENT_MAX + { "TRACE_USER_EVENT_MAX", SYSCONF, _SC_TRACE_USER_EVENT_MAX }, #endif /* POSIX.2/XPG 4.2 (and later) Symbolic Utility Limits */ @@ -361,55 +593,58 @@ static const struct conf_variable conf_table[] = #ifdef NL_TEXTMAX { "NL_TEXTMAX", CONSTANT, NL_TEXTMAX }, #endif +#ifdef _SC_RAW_SOCKET + { "RAW_SOCKET", SYSCONF, _SC_RAW_SOCKET }, +#endif #ifdef _SC_RE_DUP_MAX { "RE_DUP_MAX", SYSCONF, _SC_RE_DUP_MAX }, #endif /* POSIX.2 Optional Facility Configuration Values */ #ifdef _SC_2_C_BIND - { "_POSIX2_C_BIND", SYSCONF, _SC_2_C_BIND }, + { "POSIX2_C_BIND", SYSCONF, _SC_2_C_BIND }, #else - { "_POSIX2_C_BIND", G_UNDEF, -1 }, + { "POSIX2_C_BIND", G_UNDEF, -1 }, #endif #ifdef _SC_2_C_DEV - { "_POSIX2_C_DEV", SYSCONF, _SC_2_C_DEV }, + { "POSIX2_C_DEV", SYSCONF, _SC_2_C_DEV }, #else - { "_POSIX2_C_DEV", G_UNDEF, -1 }, + { "POSIX2_C_DEV", G_UNDEF, -1 }, #endif #if defined (_SC_2_C_VERSION) - { "_POSIX2_C_VERSION", SYSCONF, _SC_2_C_VERSION }, + { "POSIX2_C_VERSION", SYSCONF, _SC_2_C_VERSION }, #else - { "_POSIX2_C_VERSION", G_UNDEF, -1 }, + { "POSIX2_C_VERSION", G_UNDEF, -1 }, #endif #if defined (_SC_2_CHAR_TERM) - { "_POSIX2_CHAR_TERM", SYSCONF, _SC_2_CHAR_TERM }, + { "POSIX2_CHAR_TERM", SYSCONF, _SC_2_CHAR_TERM }, #else - { "_POSIX2_CHAR_TERM", G_UNDEF, -1 }, + { "POSIX2_CHAR_TERM", G_UNDEF, -1 }, #endif #ifdef _SC_2_FORT_DEV - { "_POSIX2_FORT_DEV", SYSCONF, _SC_2_FORT_DEV }, + { "POSIX2_FORT_DEV", SYSCONF, _SC_2_FORT_DEV }, #else - { "_POSIX2_FORT_DEV", G_UNDEF, -1 }, + { "POSIX2_FORT_DEV", G_UNDEF, -1 }, #endif #ifdef _SC_2_FORT_RUN - { "_POSIX2_FORT_RUN", SYSCONF, _SC_2_FORT_RUN }, + { "POSIX2_FORT_RUN", SYSCONF, _SC_2_FORT_RUN }, #else - { "_POSIX2_FORT_RUN", G_UNDEF, -1 }, + { "POSIX2_FORT_RUN", G_UNDEF, -1 }, #endif #ifdef _SC_2_LOCALEDEF - { "_POSIX2_LOCALEDEF", SYSCONF, _SC_2_LOCALEDEF }, + { "POSIX2_LOCALEDEF", SYSCONF, _SC_2_LOCALEDEF }, #else - { "_POSIX2_LOCALEDEF", G_UNDEF, -1 }, + { "POSIX2_LOCALEDEF", G_UNDEF, -1 }, #endif #ifdef _SC_2_SW_DEV - { "_POSIX2_SW_DEV", SYSCONF, _SC_2_SW_DEV }, + { "POSIX2_SW_DEV", SYSCONF, _SC_2_SW_DEV }, #else - { "_POSIX2_SW_DEV", G_UNDEF, -1 }, + { "POSIX2_SW_DEV", G_UNDEF, -1 }, #endif #if defined (_SC2_UPE) - { "_POSIX2_UPE", SYSCONF, _SC_2_UPE }, + { "POSIX2_UPE", SYSCONF, _SC_2_UPE }, #else - { "_POSIX2_UPE", G_UNDEF, -1 }, + { "POSIX2_UPE", G_UNDEF, -1 }, #endif #if !defined (_POSIX2_VERSION) && defined (_SC_2_VERSION) { "_POSIX2_VERSION", SYSCONF, _SC_2_VERSION }, @@ -418,13 +653,18 @@ static const struct conf_variable conf_table[] = #endif #if defined (_SC_REGEX_VERSION) { "REGEX_VERSION", SYSCONF, _SC_REGEX_VERSION }, + { "_REGEX_VERSION", SYSCONF, _SC_REGEX_VERSION }, #else { "REGEX_VERSION", G_UNDEF, -1 }, + { "_REGEX_VERSION", G_UNDEF, -1 }, #endif #if defined (_SC_2_PBS) { "_POSIX2_PBS", SYSCONF, _SC_2_PBS }, { "_POSIX2_PBS_ACCOUNTING", SYSCONF, _SC_2_PBS_ACCOUNTING }, +# if defined (_SC_2_PBS_CHECKPOINT) + { "_POSIX2_PBS_CHECKPOINT", SYSCONF, _SC_2_PBS_CHECKPOINT }, +# endif { "_POSIX2_PBS_LOCATE", SYSCONF, _SC_2_PBS_LOCATE }, { "_POSIX2_PBS_MESSAGE", SYSCONF, _SC_2_PBS_MESSAGE }, { "_POSIX2_PBS_TRACK", SYSCONF, _SC_2_PBS_TRACK }, @@ -517,6 +757,9 @@ static const struct conf_variable conf_table[] = #if defined (_SC_FSYNC) { "_POSIX_FSYNC", SYSCONF, _SC_FSYNC }, #endif +#if defined (_SC_IPV6) + { "_POSIX_IPV6", SYSCONF, _SC_IPV6 }, +#endif #if defined (_SC_JOB_CONTROL) { "_POSIX_JOB_CONTROL", SYSCONF, _SC_JOB_CONTROL }, #endif @@ -556,6 +799,9 @@ static const struct conf_variable conf_table[] = #if defined (_SC_READER_WRITER_LOCKS) { "_POSIX_READER_WRITER_LOCKS", SYSCONF, _SC_READER_WRITER_LOCKS }, #endif +#if defined (_SC_RAW_SOCKETS) + { "_POSIX_RAW_SOCKETS", SYSCONF, _SC_RAW_SOCKETS }, +#endif #if defined (_SC_REALTIME_SIGNALS) { "_POSIX_REALTIME_SIGNALS", SYSCONF, _SC_REALTIME_SIGNALS }, #endif @@ -587,6 +833,9 @@ static const struct conf_variable conf_table[] = #if defined (_SC_SPORADIC_SERVER) { "_POSIX_SPORADIC_SERVER", SYSCONF, _SC_SPORADIC_SERVER }, #endif +#if defined (_SC_SYMLOOP_MAX) + { "_POSIX_SYMLOOP_MAX", SYSCONF, _SC_SYMLOOP_MAX }, +#endif #if defined (_SC_SYNCHRONIZED_IO) { "_POSIX_SYNCHRONIZED_IO", SYSCONF, _SC_SYNCHRONIZED_IO }, #endif @@ -701,9 +950,6 @@ static const struct conf_variable conf_table[] = #if defined (_SC_AIO_PRIO_DELTA_MAX) { "AIO_PRIO_DELTA_MAX", SYSCONF, _SC_AIO_PRIO_DELTA_MAX }, #endif -#if defined (_SC_DELAYTIMER_MAX) - { "DELAYTIMER_MAX", SYSCONF, _SC_DELAYTIMER_MAX }, -#endif #if defined (_SC_MQ_OPEN_MAX) { "MQ_OPEN_MAX", SYSCONF, _SC_MQ_OPEN_MAX }, #endif @@ -758,6 +1004,9 @@ static const struct conf_variable conf_table[] = #if defined (_SC_XOPEN_SHM) { "_XOPEN_SHM", SYSCONF, _SC_XOPEN_SHM }, #endif +#if defined (_SC_XOPEN_STREAMS) + { "_XOPEN_STREAMS", SYSCONF, _SC_XOPEN_STREAMS }, +#endif #if defined (_SC_XOPEN_UNIX) { "_XOPEN_UNIX", SYSCONF, _SC_XOPEN_UNIX }, #endif @@ -842,6 +1091,10 @@ static const struct conf_variable conf_table[] = { "INT_BIT", CONSTANT, INT_BIT }, { "INT_MAX", CONSTANT, INT_MAX }, { "INT_MIN", CONSTANT, INT_MIN }, +#ifdef LLONG_MAX + { "LLONG_MAX", LLCONST, VAL_LLONG_MAX }, + { "LLONG_MIN", LLCONST, VAL_LLONG_MIN }, +#endif { "LONG_BIT", CONSTANT, LONG_BIT }, { "LONG_MAX", CONSTANT, LONG_MAX }, { "LONG_MIN", CONSTANT, LONG_MIN }, @@ -856,6 +1109,9 @@ static const struct conf_variable conf_table[] = { "SSIZE_MAX", CONSTANT, SSIZE_MAX }, { "UCHAR_MAX", CONSTANT, UCHAR_MAX }, { "UINT_MAX", CONSTANT, UINT_MAX }, +#ifdef ULLONG_MAX + { "ULLONG_MAX", LLCONST, VAL_ULLONG_MAX }, +#endif { "ULONG_MAX", CONSTANT, ULONG_MAX }, { "USHRT_MAX", CONSTANT, USHRT_MAX }, { "WORD_BIT", CONSTANT, WORD_BIT }, @@ -940,6 +1196,24 @@ int all; printf("undefined\n"); break; +#ifdef LLONG_MAX + case LLCONST: + switch (cp->value) { + default: + case VAL_LLONG_MIN: + printf ("%lld\n", LLONG_MIN); + break; + case VAL_LLONG_MAX: + printf ("%lld\n", LLONG_MAX); + break; +# if (ULLONG_MAX != LLONG_MAX) + case VAL_ULLONG_MAX: + printf ("%llu\n", ULLONG_MAX); + break; +# endif + } + break; +#endif case CONSTANT: switch (cp->value) { case UCHAR_MAX: diff --git a/examples/loadables/strftime.c b/examples/loadables/strftime.c new file mode 100644 index 00000000..92f489e3 --- /dev/null +++ b/examples/loadables/strftime.c @@ -0,0 +1,105 @@ +/* strftime - loadable builtin interface to strftime(3) */ + +/* See Makefile for compilation details. */ + +#include <config.h> + +#if defined (HAVE_UNISTD_H) +# include <unistd.h> +#endif + +#include "bashtypes.h" +#include "posixtime.h" + +#include <stdio.h> + +#include "builtins.h" +#include "shell.h" +#include "common.h" + +int +strftime_builtin (list) + WORD_LIST *list; +{ + char *format, *tbuf; + size_t tbsize, tsize; + time_t secs; + struct tm *t; + int n; + intmax_t i; + + if (list == 0) + { + builtin_usage (); + return (EX_USAGE); + } + + if (no_options (list)) + return (EX_USAGE); + + format = list->word->word; + if (format == 0 || *format == 0) + { + printf ("\n"); + return (EXECUTION_SUCCESS); + } + + list = list->next; + + if (list && list->word->word) + { + n = legal_number (list->word->word, &i); + if (n == 0 || i < 0 || i != (time_t)i) + { + sh_invalidnum (list->word->word); + return (EXECUTION_FAILURE); + } + else + secs = i; + } + else + secs = NOW; + + t = localtime (&secs); + + tbsize = strlen (format) * 4; + tbuf = 0; + + /* Now try to figure out how big the buffer should really be. strftime(3) + will return the number of bytes placed in the buffer unless it's greater + than MAXSIZE, in which case it returns 0. */ + for (n = 1; n < 4; n++) + { + tbuf = xrealloc (tbuf, tbsize * n); + tsize = strftime (tbuf, tbsize * n, format, t); + if (tsize) + break; + } + + printf ("%s\n", tbuf); + free (tbuf); + + return (EXECUTION_SUCCESS); +} + +/* An array of strings forming the `long' documentation for a builtin xxx, + which is printed by `help xxx'. It must end with a NULL. */ +char *strftime_doc[] = { + "Converts date and time format to a string and displays it on the", + "standard output. If the optional second argument is supplied, it", + "is used as the number of seconds since the epoch to use in the", + "conversion, otherwise the current time is used.", + (char *)NULL +}; + +/* The standard structure describing a builtin command. bash keeps an array + of these structures. The flags must include BUILTIN_ENABLED so the + builtin can be used. */ +struct builtin strftime_struct = { + "strftime", /* builtin name */ + strftime_builtin, /* function implementing the builtin */ + BUILTIN_ENABLED, /* initial flags for builtin */ + strftime_doc, /* array of long documentation strings. */ + "strftime format [seconds]", /* usage synopsis; becomes short_doc */ + 0 /* reserved for internal use */ +}; diff --git a/examples/misc/aliasconv.bash b/examples/misc/aliasconv.bash index 3fbe877d..d3b5776c 100755 --- a/examples/misc/aliasconv.bash +++ b/examples/misc/aliasconv.bash @@ -14,16 +14,16 @@ T=$'\t' cat << \EOF >/tmp/cb$$.1 mkalias () { - if [ "x$2" = "x" ]; then - echo alias ${1}="''" - elif echo "$2" | egrep -s '(\!|#)' >/dev/null 2>&1; then + case $2 in + '') echo alias ${1}="''" ;; + *[#\!]*) comm=$(echo $2 | sed 's/\!\*/"$\@"/g s/\!:\([1-9]\)/"$\1"/g s/#/\#/g') echo $1 \(\) "{" command "$comm" "; }" - else - echo alias ${1}=\'$(echo "${2}" | sed "s:':'\\\\'':")\' - fi + ;; + *) echo alias ${1}=\'$(echo "${2}" | sed "s:':'\\\\'':")\' ;; + esac } EOF diff --git a/examples/misc/aliasconv.sh b/examples/misc/aliasconv.sh index 29e1ead9..75db0778 100755 --- a/examples/misc/aliasconv.sh +++ b/examples/misc/aliasconv.sh @@ -14,16 +14,16 @@ T=' ' cat << \EOF >/tmp/cb$$.1 mkalias () { - if [ "x$2" = "x" ]; then - echo alias ${1}="''" - elif echo "$2" | egrep -s '(\!|#)' >/dev/null 2>&1; then + case $2 in + '') echo alias ${1}="''" ;; + *[#\!]*) comm=`echo $2 | sed 's/\\!\*/"$\@"/g s/\\!:\([1-9]\)/"$\1"/g s/#/\#/g'` echo $1 \(\) "{" command "$comm" "; }" - else - echo alias ${1}=\'`echo "${2}" | sed "s:':'\\\\\\\\'':"`\' - fi + ;; + *) echo alias ${1}=\'`echo "${2}" | sed "s:':'\\\\\\\\'':"`\' ;; + esac } EOF diff --git a/examples/misc/cshtobash b/examples/misc/cshtobash index 93696220..8e2b05cf 100755 --- a/examples/misc/cshtobash +++ b/examples/misc/cshtobash @@ -36,16 +36,16 @@ EOF cat << \EOF >/tmp/cb$$.1 mkalias () { - if [ -z "$2" ]; then - echo alias ${1}="''" - elif echo "$2" | egrep -s '(\!|#)' >/dev/null 2>&1; then + case $2 in + '') echo alias ${1}="''" ;; + *[#\!]*) comm=$(echo $2 | sed 's/\!\*/"$\@"/g s/\!:\([1-9]\)/"$\1"/g s/#/\#/g') echo $1 \(\) "{" command "$comm" "; }" - else - echo alias ${1}=\'$(echo "${2}" | sed "s:':'\\\\'':")\' - fi + ;; + *) echo alias ${1}=\'$(echo "${2}" | sed "s:':'\\\\'':")\' ;; + esac } EOF diff --git a/examples/obashdb/README b/examples/obashdb/README index aa3aea75..3373f5f8 100644 --- a/examples/obashdb/README +++ b/examples/obashdb/README @@ -4,5 +4,9 @@ and Associates (ISBN 1-56592-054-6). The original `kshdb' is available for anonymous FTP with the URL -ftp://ftp.uu.net/published/oreilly/nutshell/ksh/ksh.tar.Z +http://examples.oreilly.com/korn/ksh.tar.Z + +A revised edition is available at: + +http://examples.oreilly.com/korn2/korn2_examples.tar.gz diff --git a/examples/obashdb/bashdb.fns b/examples/obashdb/bashdb.fns index 79d9737e..ac0612c0 100644 --- a/examples/obashdb/bashdb.fns +++ b/examples/obashdb/bashdb.fns @@ -88,7 +88,7 @@ _at_linenumbp() { if [ -z "${_linebp}" ]; then return 1 fi - echo "${_curline}" | egrep "(${_linebp%\|})" >/dev/null 2>&1 + echo "${_curline}" | grep -E "(${_linebp%\|})" >/dev/null 2>&1 return $? } @@ -101,7 +101,7 @@ _at_stringbp() { return 1; fi l=${_lines[$_curline-$_firstline+1]} - echo "${l}" | egrep "*(${_stringbp%\|})*" >/dev/null 2>&1 + echo "${l}" | grep -E "\\*(${_stringbp%\|})\\*" >/dev/null 2>&1 return $? } diff --git a/examples/scripts.noah/number.bash b/examples/scripts.noah/number.bash index 23e58b46..37b62b6f 100644 --- a/examples/scripts.noah/number.bash +++ b/examples/scripts.noah/number.bash @@ -108,7 +108,7 @@ function number () ;; 0 ) : ;; * ) - if test ".${val2}" != '.' -a ".${d1}" != '.0' ; then + if test ".${val2}" != '.' && test ".${d1}" != '.0' ; then val2="${val2}-" fi case "${d1}" in diff --git a/examples/scripts.noah/string.bash b/examples/scripts.noah/string.bash index 38c0af8b..d80ebe80 100644 --- a/examples/scripts.noah/string.bash +++ b/examples/scripts.noah/string.bash @@ -95,11 +95,11 @@ function strcmp () ###;;;autoload function strncmp () { - if [ -z "${3}" -o "${3}" -le "0" ]; then + if [ -z "${3}" ] || [ "${3}" -le "0" ]; then return 0 fi - if [ ${3} -ge ${#1} -a ${3} -ge ${#2} ]; then + if [ ${3} -ge ${#1} ] && [ ${3} -ge ${#2} ]; then strcmp "$1" "$2" return $? else diff --git a/examples/scripts.v2/cdhist.bash b/examples/scripts.v2/cdhist.bash index 39bec884..df8aea78 100644 --- a/examples/scripts.v2/cdhist.bash +++ b/examples/scripts.v2/cdhist.bash @@ -39,7 +39,7 @@ cd() set -- $HOME fi - if [ "$CDHISTFILE" -a -r "$CDHISTFILE" ] # if directory history exists + if [ "$CDHISTFILE" ] && [ -r "$CDHISTFILE" ] # if directory history exists then typeset CDHIST i=-1 @@ -49,7 +49,7 @@ cd() done <$CDHISTFILE fi - if [ "${CDHIST[0]}" != "$PWD" -a "$PWD" != "" ] + if [ "${CDHIST[0]}" != "$PWD" ] && [ -n "$PWD" ] then _cdins # insert $PWD into cd history fi diff --git a/examples/scripts.v2/fman b/examples/scripts.v2/fman index c9cf301a..1e94d21a 100644 --- a/examples/scripts.v2/fman +++ b/examples/scripts.v2/fman @@ -56,13 +56,13 @@ FindSectionsInIndex () fi done [ -z "$indexes" ] && return - # Make egrep give filename + # Make grep give filename [ NIndex -lt 2 ] && indexes="$indexes /dev/null" # set positional parameters to # indexfile:searchname pagename section ... # e.g. # /usr/man/index:FP_OFF Routines DOS - set -- `egrep "^$page[ ]" $indexes` + set -- `grep "^$page[ ]" $indexes` while [ $# -gt 2 ]; do FileNames[i]=${1%%index*}cat$3/$2.$3 Sections[i]=$3 diff --git a/examples/scripts.v2/frcp b/examples/scripts.v2/frcp index 08028e12..572aa7bc 100755 --- a/examples/scripts.v2/frcp +++ b/examples/scripts.v2/frcp @@ -110,7 +110,7 @@ function CopyFiles { */) ;; # don't add / if trailing / already present *) if [ $# -gt 2 ] || # if more than two args given, last must be a dir # If dest in on local machine, check whether it is a directory - [ $DestMach = $LocalMach -a -d $DestPath ] || + [ $DestMach = $LocalMach ] && [ -d "$DestPath" ] || # If dest ends with . or .., it is a directory lastisdot "$DestPath" then diff --git a/examples/scripts.v2/repeat b/examples/scripts.v2/repeat index 315d36ee..b6fccac6 100644 --- a/examples/scripts.v2/repeat +++ b/examples/scripts.v2/repeat @@ -103,7 +103,7 @@ esac shift -[ -z "$end" -o $count -le "$end" ] && increment=1 || increment=-1 +[ -z "$end" ] && [ $count -le "$end" ] && increment=1 || increment=-1 istrue $verbose && echo "start=$count end=$end" 1>&2 diff --git a/examples/scripts.v2/vtree b/examples/scripts.v2/vtree index 60583b0c..7523cc8f 100644 --- a/examples/scripts.v2/vtree +++ b/examples/scripts.v2/vtree @@ -38,7 +38,7 @@ for i in "$@"; do vars="$vars $i" ;; *) - if [ ! -x $i -o ! -d $i ]; then # arg must be a dir and executable + if [ ! -x $i ] || [ ! -d $i ]; then # arg must be a dir and executable echo "$i: directory not accessible." exit fi diff --git a/examples/scripts/bcsh.sh b/examples/scripts/bcsh.sh index 509fe885..b810cab8 100755 --- a/examples/scripts/bcsh.sh +++ b/examples/scripts/bcsh.sh @@ -389,7 +389,7 @@ esac trap ':' 2 trap exit 3 -trap "tail -$savehist $histfile>/tmp/hist$$;uniq /tmp/hist$$ > $histfile;\ +trap "tail -n $savehist $histfile>/tmp/hist$$;uniq /tmp/hist$$ > $histfile;\ rm -f /tmp/*$$;exit 0" 15 getcmd=yes @@ -517,7 +517,7 @@ do esac cmd="${cmd};$line" - while test "$line" != "done" -a "$line" != "end" + while test "$line" != "done" && test "$line" != "end" do echo $n "$PS2$c" read line @@ -531,7 +531,7 @@ do echo "$cmd" > /tmp/bcsh$$ ;; if[\ \ ]*) - while test "$line" != "fi" -a "$line" != "endif" + while test "$line" != "fi" && test "$line" != "endif" do echo $n "$PS2$c" read line @@ -659,7 +659,7 @@ esac/ -[0-9]*) wanted="`expr \"$i\" : '-\([0-9][0-9]*\).*'`" rest="`expr \"$i\" : '-[0-9][0-9]*\(.*\)'`" - i="`tail -$wanted $histfile | sed -e "1q"`" + i="`tail -n $wanted $histfile | sed -e "1q"`" ;; esac ;; @@ -917,14 +917,14 @@ esac/ continue ;; exec[\ \ ]*) - tail -$savehist $histfile>/tmp/hist$$ + tail -n $savehist $histfile>/tmp/hist$$ uniq /tmp/hist$$ > $histfile rm -f /tmp/*$$ echo $cmd > /tmp/cmd$$ . /tmp/cmd$$ ;; login[\ \ ]*|newgrp[\ \ ]*) - tail -$savehist $histfile>/tmp/hist$$ + tail -n $savehist $histfile>/tmp/hist$$ uniq /tmp/hist$$ > $histfile rm -f /tmp/*$$ echo $cmd > /tmp/cmd$$ @@ -936,22 +936,22 @@ esac/ # sh $logoutfile $SHELL $logoutfile fi - tail -$savehist $histfile > /tmp/hist$$ + tail -n $savehist $histfile > /tmp/hist$$ uniq /tmp/hist$$ > $histfile rm -f /tmp/*$$ exit 0 ;; h|history) - grep -n . $histfile | tail -$history | sed -e 's@:@ @' | $PAGER + grep -n . $histfile | tail -n $history | sed -e 's@:@ @' | $PAGER continue ;; h[\ \ ]\|*|h[\ \ ]\>*|h\|*|h\>*) - cmd="`echo \"$cmd\" | sed -e \"s@h@grep -n . $histfile | tail -$history | sed -e 's@:@ @'@\"`" + cmd="`echo \"$cmd\" | sed -e \"s@h@grep -n . $histfile | tail -n $history | sed -e 's@:@ @'@\"`" getcmd=no continue ;; history[\ \ ]*\|*|history[\ \ ]*\>*) - cmd="`echo \"$cmd\" | sed -e \"s@history@grep -n . $histfile | tail -$history | sed -e 's@:@ @'@\"`" + cmd="`echo \"$cmd\" | sed -e \"s@history@grep -n . $histfile | tail -n $history | sed -e 's@:@ @'@\"`" getcmd=no continue ;; diff --git a/examples/scripts/fixfiles.bash b/examples/scripts/fixfiles.bash index 67311eed..15f3ba86 100644 --- a/examples/scripts/fixfiles.bash +++ b/examples/scripts/fixfiles.bash @@ -62,7 +62,7 @@ processdir() set +f for file in * ; do set -f - if [ "$file" != "." -a "$file" != ".." ] ; then + if [ "$file" != "." ] && [ "$file" != ".." ] ; then if [ -L "$file" ] ; then echo "skipping symlink" $file in `pwd` elif [ -d "$file" ] ; then diff --git a/examples/scripts/line-input.bash b/examples/scripts/line-input.bash index 02c2bc2c..3f2efaef 100644 --- a/examples/scripts/line-input.bash +++ b/examples/scripts/line-input.bash @@ -125,11 +125,11 @@ function getline unset linesave # forget temp var ;; ) - while [ "${line% }" != "$line" -a ${#line} != 0 ] ; do + while [ "${line% }" != "$line" ] && [ ${#line} != 0 ] ; do echo -n " " line="${line%?}" done - while [ "${line% }" = "$line" -a ${#line} != 0 ] ; do + while [ "${line% }" = "$line" ] && [ ${#line} != 0 ] ; do echo -n " " line="${line%?}" done @@ -151,7 +151,7 @@ function getline # If length is restricted, and the line is too # long, then beep... - if [ "$2" != 0 -a $(( ${#line} >= $2 )) = 1 ] ; then + if [ "$2" != 0 ] && [ $(( ${#line} >= $2 )) = 1 ] ; then echo -n else # Otherwise add line="$line$key" # the character. @@ -182,4 +182,3 @@ getline LINE 50 restore echo "<$LINE>" - diff --git a/execute_cmd.c b/execute_cmd.c index 2291c7af..db256366 100644 --- a/execute_cmd.c +++ b/execute_cmd.c @@ -1,6 +1,6 @@ /* execute_command.c -- Execute a COMMAND structure. */ -/* Copyright (C) 1987-2002 Free Software Foundation, Inc. +/* Copyright (C) 1987-2003 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -26,7 +26,7 @@ #include <stdio.h> #include "chartypes.h" #include "bashtypes.h" -#ifndef _MINIX +#if !defined (_MINIX) && defined (HAVE_SYS_FILE_H) # include <sys/file.h> #endif #include "filecntl.h" @@ -97,7 +97,7 @@ extern int errno; extern int posixly_correct; extern int breaking, continuing, loop_level; extern int expand_aliases; -extern int parse_and_execute_level, running_trap, trap_line_number; +extern int parse_and_execute_level, running_trap; extern int command_string_index, line_number; extern int dot_found_in_search; extern int already_making_children; @@ -196,12 +196,22 @@ int stdin_redir; `test' needs this, for example. */ char *this_command_name; +/* The printed representation of the currently-executing command (same as + the_printed_command), except when a trap is being executed. Useful for + a debugger to know where exactly the program is currently executing. */ +char *the_printed_command_except_trap; + static COMMAND *currently_executing_command; struct stat SB; /* used for debugging */ static int special_builtin_failed; +/* XXX - set to 1 if we're running the DEBUG trap and we want to show the line + number containing the function name. Used by executing_line_number to + report the correct line number. Kind of a hack. */ +static int showing_function_line; + /* For catching RETURN in a function. */ int return_catch_flag; int return_catch_value; @@ -210,6 +220,10 @@ procenv_t return_catch; /* The value returned by the last synchronous command. */ int last_command_exit_value; +/* Whether or not the last command (corresponding to last_command_exit_value) + was terminated by a signal, and, if so, which one. */ +int last_command_exit_signal; + /* The list of redirections to perform which will undo the redirections that I made in the shell. */ REDIRECT *redirection_undo_list = (REDIRECT *)NULL; @@ -223,6 +237,9 @@ REDIRECT *exec_redirection_undo_list = (REDIRECT *)NULL; environment. */ int subshell_environment; +/* Count of nested subshells, like SHLVL. Available via $BASH_SUBSHELL */ +int subshell_level = 0; + /* Currently-executing shell function. */ SHELL_VAR *this_shell_function; @@ -282,21 +299,25 @@ close_fd_bitmap (fdbp) int executing_line_number () { - if (executing && (variable_context == 0 || interactive_shell == 0) && currently_executing_command) + if (executing && showing_function_line == 0 && + (variable_context == 0 || interactive_shell == 0) && + currently_executing_command) { - if (currently_executing_command->type == cm_simple) - return currently_executing_command->value.Simple->line; - else if (currently_executing_command->type == cm_cond) +#if defined (COND_COMMAND) + if (currently_executing_command->type == cm_cond) return currently_executing_command->value.Cond->line; +#endif +#if defined (DPAREN_ARITHMETIC) else if (currently_executing_command->type == cm_arith) return currently_executing_command->value.Arith->line; +#endif +#if defined (ARITH_FOR_COMMAND) else if (currently_executing_command->type == cm_arith_for) return currently_executing_command->value.ArithFor->line; - else +#endif + return line_number; } - else if (running_trap) - return trap_line_number; else return line_number; } @@ -374,7 +395,7 @@ static void cleanup_redirects (list) REDIRECT *list; { - do_redirections (list, 1, 0, 0); + do_redirections (list, RX_ACTIVE); dispose_redirects (list); } @@ -384,7 +405,7 @@ static void cleanup_func_redirects (list) REDIRECT *list; { - do_redirections (list, 1, 0, 0); + do_redirections (list, RX_ACTIVE); } #endif @@ -469,13 +490,16 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out, int exec_result, invert, ignore_return, was_error_trap; REDIRECT *my_undo_list, *exec_undo_list; volatile pid_t last_pid; + volatile int save_line_number; if (command == 0 || breaking || continuing || read_but_dont_execute) return (EXECUTION_SUCCESS); run_pending_traps (); +#if 0 if (running_trap == 0) +#endif currently_executing_command = command; invert = (command->flags & CMD_INVERT_RETURN) != 0; @@ -561,7 +585,9 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out, else { exec_result = time_command (command, asynchronous, pipe_in, pipe_out, fds_to_close); +#if 0 if (running_trap == 0) +#endif currently_executing_command = (COMMAND *)NULL; } return (exec_result); @@ -573,7 +599,7 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out, /* Handle WHILE FOR CASE etc. with redirections. (Also '&' input redirection.) */ - if (do_redirections (command->redirects, 1, 1, 0) != 0) + if (do_redirections (command->redirects, RX_ACTIVE|RX_UNDOABLE) != 0) { cleanup_redirects (redirection_undo_list); redirection_undo_list = (REDIRECT *)NULL; @@ -616,7 +642,8 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out, { case cm_simple: { - /* We can't rely on this variable retaining its value across a + save_line_number = line_number; + /* We can't rely on variables retaining their values across a call to execute_simple_command if a longjmp occurs as the result of a `return' builtin. This is true for sure with gcc. */ last_pid = last_made_pid; @@ -626,9 +653,12 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out, command->value.Simple->flags |= CMD_IGNORE_RETURN; if (command->flags & CMD_STDIN_REDIR) command->value.Simple->flags |= CMD_STDIN_REDIR; + + line_number = command->value.Simple->line; exec_result = execute_simple_command (command->value.Simple, pipe_in, pipe_out, asynchronous, fds_to_close); + line_number = save_line_number; /* The temporary environment should be used for only the simple command immediately following its definition. */ @@ -662,12 +692,15 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out, #endif /* When executing a shell function that executes other commands, this causes the last simple command in - the function to be waited for twice. */ + the function to be waited for twice. This also causes + subshells forked to execute builtin commands (e.g., in + pipelines) 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. */ + created. This has been reported to fix the problem on that + OS, and a similar problem on Cygwin. */ if (exec_result == 0) last_made_pid = NO_PID; #endif @@ -686,7 +719,7 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out, { last_command_exit_value = exec_result; run_pending_traps (); - jump_to_top_level (EXITPROG); + jump_to_top_level (ERREXIT); } break; @@ -798,7 +831,9 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out, case cm_cond: if (ignore_return) command->value.Cond->flags |= CMD_IGNORE_RETURN; + save_line_number = line_number; exec_result = execute_cond_command (command->value.Cond); + line_number = save_line_number; break; #endif @@ -813,7 +848,7 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out, if (my_undo_list) { - do_redirections (my_undo_list, 1, 0, 0); + do_redirections (my_undo_list, RX_ACTIVE); dispose_redirects (my_undo_list); } @@ -831,7 +866,9 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out, last_command_exit_value = exec_result; run_pending_traps (); +#if 0 if (running_trap == 0) +#endif currently_executing_command = (COMMAND *)NULL; return (last_command_exit_value); } @@ -1027,7 +1064,9 @@ time_command (command, asynchronous, pipe_in, pipe_out, fds_to_close) #if defined (HAVE_GETRUSAGE) && defined (HAVE_GETTIMEOFDAY) struct timeval real, user, sys; struct timeval before, after; - struct timezone dtz; +# if defined (HAVE_STRUCT_TIMEZONE) + struct timezone dtz; /* posix doesn't define this */ +# endif struct rusage selfb, selfa, kidsb, kidsa; /* a = after, b = before */ #else # if defined (HAVE_TIMES) @@ -1037,7 +1076,11 @@ time_command (command, asynchronous, pipe_in, pipe_out, fds_to_close) #endif #if defined (HAVE_GETRUSAGE) && defined (HAVE_GETTIMEOFDAY) +# if defined (HAVE_STRUCT_TIMEZONE) gettimeofday (&before, &dtz); +# else + gettimeofday (&before, (void *)NULL); +# endif /* !HAVE_STRUCT_TIMEZONE */ getrusage (RUSAGE_SELF, &selfb); getrusage (RUSAGE_CHILDREN, &kidsb); #else @@ -1057,7 +1100,11 @@ time_command (command, asynchronous, pipe_in, pipe_out, fds_to_close) rsf = usf = ssf = cpu = 0; #if defined (HAVE_GETRUSAGE) && defined (HAVE_GETTIMEOFDAY) +# if defined (HAVE_STRUCT_TIMEZONE) gettimeofday (&after, &dtz); +# else + gettimeofday (&after, (void *)NULL); +# endif /* !HAVE_STRUCT_TIMEZONE */ getrusage (RUSAGE_SELF, &selfa); getrusage (RUSAGE_CHILDREN, &kidsa); @@ -1125,6 +1172,7 @@ execute_in_subshell (command, asynchronous, pipe_in, pipe_out, fds_to_close) USE_VAR(tcom); USE_VAR(asynchronous); + subshell_level++; should_redir_stdin = (asynchronous && (command->flags & CMD_STDIN_REDIR) && pipe_in == NO_PIPE && stdin_redirects (command->redirects) == 0); @@ -1215,7 +1263,7 @@ execute_in_subshell (command, asynchronous, pipe_in, pipe_out, fds_to_close) /* Do redirections, then dispose of them before recursive call. */ if (command->redirects) { - if (do_redirections (command->redirects, 1, 0, 0) != 0) + if (do_redirections (command->redirects, RX_ACTIVE) != 0) exit (invert ? EXECUTION_SUCCESS : EXECUTION_FAILURE); dispose_redirects (command->redirects); @@ -1270,6 +1318,7 @@ execute_in_subshell (command, asynchronous, pipe_in, pipe_out, fds_to_close) return_code = run_exit_trap (); } + subshell_level--; return (return_code); /* NOTREACHED */ } @@ -1522,11 +1571,12 @@ execute_for_command (for_command) register WORD_LIST *releaser, *list; SHELL_VAR *v; char *identifier; - int retval; + int retval, save_line_number; #if 0 SHELL_VAR *old_value = (SHELL_VAR *)NULL; /* Remember the old value of x. */ #endif + save_line_number = line_number; if (check_identifier (for_command->name, 1) == 0) { if (posixly_correct && interactive_shell == 0) @@ -1560,10 +1610,36 @@ execute_for_command (for_command) for (retval = EXECUTION_SUCCESS; list; list = list->next) { QUIT; + + line_number = for_command->line; + + /* Remember what this command looks like, for debugger. */ + command_string_index = 0; + print_for_command_head (for_command); + + if (echo_command_at_execute) + xtrace_print_for_command_head (for_command); + + /* Save this command unless it's a trap command. */ + if (this_command_name == 0 || (STREQ (this_command_name, "trap") == 0)) + { + FREE (the_printed_command_except_trap); + the_printed_command_except_trap = savestring (the_printed_command); + } + + retval = run_debug_trap (); +#if defined (DEBUGGER) + /* In debugging mode, if the DEBUG trap returns a non-zero status, we + skip the command. */ + if (debugging_mode && retval != EXECUTION_SUCCESS) + continue; +#endif + this_command_name = (char *)NULL; v = bind_variable (identifier, list->word->word); if (readonly_p (v) || noassign_p (v)) { + line_number = save_line_number; if (readonly_p (v) && interactive_shell == 0 && posixly_correct) { last_command_exit_value = EXECUTION_FAILURE; @@ -1571,7 +1647,8 @@ execute_for_command (for_command) } else { - run_unwind_frame ("for"); + dispose_words (releaser); + discard_unwind_frame ("for"); loop_level--; return (EXECUTION_FAILURE); } @@ -1595,6 +1672,7 @@ execute_for_command (for_command) } loop_level--; + line_number = save_line_number; #if 0 if (lexical_scoping) @@ -1640,6 +1718,7 @@ eval_arith_for_expr (l, okp) { WORD_LIST *new; intmax_t expresult; + int r; new = expand_words_no_vars (l); if (new) @@ -1647,9 +1726,27 @@ eval_arith_for_expr (l, okp) if (echo_command_at_execute) xtrace_print_arith_cmd (new); this_command_name = "(("; /* )) for expression error messages */ - if (signal_is_trapped (DEBUG_TRAP) && signal_is_ignored (DEBUG_TRAP) == 0) - run_debug_trap (); + + command_string_index = 0; + print_arith_command (new); + FREE (the_printed_command_except_trap); + the_printed_command_except_trap = savestring (the_printed_command); + + r = run_debug_trap (); + /* In debugging mode, if the DEBUG trap returns a non-zero status, we + skip the command. */ +#if defined (DEBUGGER) + if (debugging_mode == 0 || r == EXECUTION_SUCCESS) + expresult = evalexp (new->word->word, okp); + else + { + expresult = 0; + if (okp) + *okp = 1; + } +#else expresult = evalexp (new->word->word, okp); +#endif dispose_words (new); } else @@ -1670,6 +1767,7 @@ execute_arith_for_command (arith_for_command) body_status = EXECUTION_SUCCESS; loop_level++; + save_lineno = line_number; if (arith_for_command->flags & CMD_IGNORE_RETURN) arith_for_command->action->flags |= CMD_IGNORE_RETURN; @@ -1679,19 +1777,21 @@ execute_arith_for_command (arith_for_command) /* save the starting line number of the command so we can reset line_number before executing each expression -- for $LINENO and the DEBUG trap. */ - arith_lineno = arith_for_command->line; + line_number = arith_lineno = arith_for_command->line; if (variable_context && interactive_shell) - line_number = arith_lineno -= function_line_number; + line_number -= function_line_number; /* Evaluate the initialization expression. */ expresult = eval_arith_for_expr (arith_for_command->init, &expok); if (expok == 0) - return (EXECUTION_FAILURE); + { + line_number = save_lineno; + return (EXECUTION_FAILURE); + } while (1) { /* Evaluate the test expression. */ - save_lineno = line_number; line_number = arith_lineno; expresult = eval_arith_for_expr (arith_for_command->test, &expok); line_number = save_lineno; @@ -1725,7 +1825,6 @@ execute_arith_for_command (arith_for_command) } /* Evaluate the step expression. */ - save_lineno = line_number; line_number = arith_lineno; expresult = eval_arith_for_expr (arith_for_command->step, &expok); line_number = save_lineno; @@ -1738,6 +1837,8 @@ execute_arith_for_command (arith_for_command) } loop_level--; + line_number = save_lineno; + return (body_status); } #endif @@ -1922,11 +2023,31 @@ execute_select_command (select_command) WORD_LIST *releaser, *list; SHELL_VAR *v; char *identifier, *ps3_prompt, *selection; - int retval, list_len, show_menu; + int retval, list_len, show_menu, save_line_number; if (check_identifier (select_command->name, 1) == 0) return (EXECUTION_FAILURE); + save_line_number = line_number; + line_number = select_command->line; + + command_string_index = 0; + print_select_command_head (select_command); + + if (echo_command_at_execute) + xtrace_print_select_command_head (select_command); + + FREE (the_printed_command_except_trap); + the_printed_command_except_trap = savestring (the_printed_command); + + retval = run_debug_trap (); +#if defined (DEBUGGER) + /* In debugging mode, if the DEBUG trap returns a non-zero status, we + skip the command. */ + if (debugging_mode && retval != EXECUTION_SUCCESS) + return (EXECUTION_SUCCESS); +#endif + loop_level++; identifier = select_command->name->word; @@ -1938,6 +2059,7 @@ execute_select_command (select_command) { if (list) dispose_words (list); + line_number = save_line_number; return (EXECUTION_SUCCESS); } @@ -1952,6 +2074,7 @@ execute_select_command (select_command) while (1) { + line_number = select_command->line; ps3_prompt = get_string_value ("PS3"); if (ps3_prompt == 0) ps3_prompt = "#? "; @@ -1977,7 +2100,10 @@ execute_select_command (select_command) } else { - run_unwind_frame ("select"); + dispose_words (releaser); + discard_unwind_frame ("select"); + loop_level--; + line_number = save_line_number; return (EXECUTION_FAILURE); } } @@ -2009,8 +2135,10 @@ execute_select_command (select_command) } loop_level--; + line_number = save_line_number; - run_unwind_frame ("select"); + dispose_words (releaser); + discard_unwind_frame ("select"); return (retval); } #endif /* SELECT_COMMAND */ @@ -2027,7 +2155,33 @@ execute_case_command (case_command) WORD_LIST *wlist, *es; PATTERN_LIST *clauses; char *word, *pattern; - int retval, match, ignore_return; + int retval, match, ignore_return, save_line_number; + + save_line_number = line_number; + line_number = case_command->line; + + command_string_index = 0; + print_case_command_head (case_command); + + if (echo_command_at_execute) + xtrace_print_case_command_head (case_command); + + if (this_command_name == 0 || (STREQ (this_command_name, "trap") == 0)) + { + FREE (the_printed_command_except_trap); + the_printed_command_except_trap = savestring (the_printed_command); + } + + retval = run_debug_trap(); +#if defined (DEBUGGER) + /* In debugging mode, if the DEBUG trap returns a non-zero status, we + skip the command. */ + if (debugging_mode && retval != EXECUTION_SUCCESS) + { + line_number = save_line_number; + return (EXECUTION_SUCCESS); + } +#endif /* Posix.2 specifies that the WORD is tilde expanded. */ if (member ('~', case_command->word->word)) @@ -2096,6 +2250,7 @@ execute_case_command (case_command) exit_case_command: free (word); discard_unwind_frame ("case"); + line_number = save_line_number; return (retval); } @@ -2191,10 +2346,12 @@ static int execute_if_command (if_command) IF_COM *if_command; { - int return_value; + int return_value, save_line_number; + save_line_number = line_number; if_command->test->flags |= CMD_IGNORE_RETURN; return_value = execute_command (if_command->test); + line_number = save_line_number; if (return_value == EXECUTION_SUCCESS) { @@ -2221,32 +2378,56 @@ static int execute_arith_command (arith_command) ARITH_COM *arith_command; { - int expok; + int expok, save_line_number, retval; intmax_t expresult; WORD_LIST *new; expresult = 0; + save_line_number = line_number; this_command_name = "(("; /* )) */ + line_number = arith_command->line; /* If we're in a function, update the line number information. */ if (variable_context && interactive_shell) - line_number = arith_command->line - function_line_number; + line_number -= function_line_number; + + command_string_index = 0; + print_arith_command (arith_command->exp); + FREE (the_printed_command_except_trap); + the_printed_command_except_trap = savestring (the_printed_command); /* Run the debug trap before each arithmetic command, but do it after we update the line number information and before we expand the various words in the expression. */ - if (signal_is_trapped (DEBUG_TRAP) && signal_is_ignored (DEBUG_TRAP) == 0) - run_debug_trap (); + retval = run_debug_trap (); +#if defined (DEBUGGER) + /* In debugging mode, if the DEBUG trap returns a non-zero status, we + skip the command. */ + if (debugging_mode && retval != EXECUTION_SUCCESS) + { + line_number = save_line_number; + return (EXECUTION_SUCCESS); + } +#endif - new = expand_words (arith_command->exp); + new = expand_words_no_vars (arith_command->exp); /* If we're tracing, make a new word list with `((' at the front and `))' at the back and print it. */ if (echo_command_at_execute) xtrace_print_arith_cmd (new); - expresult = evalexp (new->word->word, &expok); - dispose_words (new); + if (new) + { + expresult = evalexp (new->word->word, &expok); + line_number = save_line_number; + dispose_words (new); + } + else + { + expresult = 0; + expok = 1; + } if (expok == 0) return (EXECUTION_FAILURE); @@ -2263,7 +2444,7 @@ static int execute_cond_node (cond) COND_COM *cond; { - int result, invert, patmatch; + int result, invert, patmatch, rmatch, mflags; char *arg1, *arg2; invert = (cond->flags & CMD_INVERT_RETURN); @@ -2298,6 +2479,10 @@ execute_cond_node (cond) 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')); +#if defined (COND_REGEXP) + rmatch = (cond->op->word[0] == '=' && cond->op->word[1] == '~' && + cond->op->word[2] == '\0'); +#endif arg1 = cond_expand_word (cond->left->op, 0); if (arg1 == 0) @@ -2309,7 +2494,19 @@ execute_cond_node (cond) if (echo_command_at_execute) xtrace_print_cond_term (cond->type, invert, cond->op, arg1, arg2); - result = binary_test (cond->op->word, arg1, arg2, TEST_PATMATCH|TEST_ARITHEXP) +#if defined (COND_REGEXP) + if (rmatch) + { + mflags = SHMAT_PWARN; +#if defined (ARRAY_VARS) + mflags |= SHMAT_SUBEXP; +#endif + + result = sh_regmatch (arg1, arg2, mflags); + } + else +#endif /* COND_REGEXP */ + result = binary_test (cond->op->word, arg1, arg2, TEST_PATMATCH|TEST_ARITHEXP) ? EXECUTION_SUCCESS : EXECUTION_FAILURE; if (arg1 != nullstr) @@ -2334,25 +2531,42 @@ static int execute_cond_command (cond_command) COND_COM *cond_command; { - int result; + int retval, save_line_number; - result = EXECUTION_SUCCESS; + retval = EXECUTION_SUCCESS; + save_line_number = line_number; this_command_name = "[["; + line_number = cond_command->line; /* If we're in a function, update the line number information. */ if (variable_context && interactive_shell) - line_number = cond_command->line - function_line_number; + line_number -= function_line_number; + + command_string_index = 0; + print_cond_command (cond_command); + FREE (the_printed_command_except_trap); + the_printed_command_except_trap = savestring (the_printed_command); /* Run the debug trap before each conditional command, but do it after we update the line number information. */ - if (signal_is_trapped (DEBUG_TRAP) && signal_is_ignored (DEBUG_TRAP) == 0) - run_debug_trap (); + retval = run_debug_trap (); +#if defined (DEBUGGER) + /* In debugging mode, if the DEBUG trap returns a non-zero status, we + skip the command. */ + if (debugging_mode && retval != EXECUTION_SUCCESS) + { + line_number = save_line_number; + return (EXECUTION_SUCCESS); + } +#endif #if 0 debug_print_cond_command (cond_command); #endif - last_command_exit_value = result = execute_cond_node (cond_command); - return (result); + + last_command_exit_value = retval = execute_cond_node (cond_command); + line_number = save_line_number; + return (retval); } #endif /* COND_COMMAND */ @@ -2377,6 +2591,8 @@ execute_null_command (redirects, pipe_in, pipe_out, async, old_last_command_subs int pipe_in, pipe_out, async; pid_t old_last_command_subst_pid; { + int r; + if (pipe_in != NO_PIPE || pipe_out != NO_PIPE || async) { /* We have a null command, but we really want a subshell to take @@ -2390,7 +2606,7 @@ execute_null_command (redirects, pipe_in, pipe_out, async, old_last_command_subs subshell_environment = SUBSHELL_ASYNC; - if (do_redirections (redirects, 1, 0, 0) == 0) + if (do_redirections (redirects, RX_ACTIVE) == 0) exit (EXECUTION_SUCCESS); else exit (EXECUTION_FAILURE); @@ -2413,7 +2629,11 @@ execute_null_command (redirects, pipe_in, pipe_out, async, old_last_command_subs expanding the command or a redirection, return the value of that substitution. Otherwise, return EXECUTION_SUCCESS. */ - if (do_redirections (redirects, 0, 0, 0) != 0) + r = do_redirections (redirects, RX_ACTIVE|RX_UNDOABLE); + cleanup_redirects (redirection_undo_list); + redirection_undo_list = (REDIRECT *)NULL; + + if (r != 0) return (EXECUTION_FAILURE); else if (old_last_command_subst_pid != last_command_subst_pid) return (last_command_exit_value); @@ -2471,17 +2691,28 @@ execute_simple_command (simple_command, pipe_in, pipe_out, async, fds_to_close) /* If we're in a function, update the line number information. */ if (variable_context && interactive_shell) - line_number = simple_command->line - function_line_number; - - /* Run the debug trap before each simple command, but do it after we - update the line number information. */ - if (signal_is_trapped (DEBUG_TRAP) && signal_is_ignored (DEBUG_TRAP) == 0) - run_debug_trap (); + line_number -= function_line_number; /* Remember what this command line looks like at invocation. */ command_string_index = 0; print_simple_command (simple_command); + if (this_command_name == 0 || (STREQ (this_command_name, "trap") == 0)) + { + FREE (the_printed_command_except_trap); + the_printed_command_except_trap = savestring (the_printed_command); + } + + /* Run the debug trap before each simple command, but do it after we + update the line number information. */ + result = run_debug_trap (); +#if defined (DEBUGGER) + /* In debugging mode, if the DEBUG trap returns a non-zero status, we + skip the command. */ + if (debugging_mode && result != EXECUTION_SUCCESS) + return (EXECUTION_SUCCESS); +#endif + first_word_quoted = simple_command->words ? (simple_command->words->word->flags & W_QUOTED): 0; @@ -2506,14 +2737,20 @@ execute_simple_command (simple_command, pipe_in, pipe_out, async, fds_to_close) if (dofork) { +#if 0 /* XXX memory leak if expand_words() error causes a jump_to_top_level */ command_line = savestring (the_printed_command); +#endif /* Do this now, because execute_disk_command will do it anyway in the vast majority of cases. */ maybe_make_export_env (); +#if 0 if (make_child (command_line, async) == 0) +#else + if (make_child (savestring (the_printed_command), async) == 0) +#endif { already_forked = 1; simple_command->flags |= CMD_NO_FORK; @@ -2562,6 +2799,7 @@ execute_simple_command (simple_command, pipe_in, pipe_out, async, fds_to_close) no variable `$foo'. */ if (words == 0) { + this_command_name = 0; result = execute_null_command (simple_command->redirects, pipe_in, pipe_out, already_forked ? 0 : async, @@ -2581,7 +2819,7 @@ execute_simple_command (simple_command, pipe_in, pipe_out, async, fds_to_close) begin_unwind_frame ("simple-command"); if (echo_command_at_execute) - xtrace_print_word_list (words); + xtrace_print_word_list (words, 1); builtin = (sh_builtin_func_t *)NULL; func = (SHELL_VAR *)NULL; @@ -2690,10 +2928,12 @@ execute_simple_command (simple_command, pipe_in, pipe_out, async, fds_to_close) setup_async_signals (); } + subshell_level++; execute_subshell_builtin_or_function (words, simple_command->redirects, builtin, func, pipe_in, pipe_out, async, fds_to_close, simple_command->flags); + subshell_level--; } else { @@ -2738,7 +2978,9 @@ execute_simple_command (simple_command, pipe_in, pipe_out, async, fds_to_close) return_result: bind_lastarg (lastarg); FREE (command_line); - run_unwind_frame ("simple-command"); + dispose_words (words); + discard_unwind_frame ("simple-command"); + this_command_name = (char *)NULL; /* points to freed memory now */ return (result); } @@ -2850,11 +3092,24 @@ execute_function (var, words, flags, fds_to_close, async, subshell) int async, subshell; { int return_val, result; - COMMAND *tc, *fc; - char *debug_trap, *error_trap; + COMMAND *tc, *fc, *save_current; + char *debug_trap, *error_trap, *return_trap; +#if defined (ARRAY_VARS) + SHELL_VAR *funcname_v, *bash_source_v, *bash_lineno_v; + ARRAY *funcname_a, *bash_source_a, *bash_lineno_a; +#endif + FUNCTION_DEF *shell_fn; + char *sfile, *t; + static int funcnest = 0; USE_VAR(fc); +#if defined (ARRAY_VARS) + GET_ARRAY_FROM_VAR ("FUNCNAME", funcname_v, funcname_a); + GET_ARRAY_FROM_VAR ("BASH_SOURCE", bash_source_v, bash_source_a); + GET_ARRAY_FROM_VAR ("BASH_LINENO", bash_lineno_v, bash_lineno_a); +#endif + tc = (COMMAND *)copy_command (function_cell (var)); if (tc && (flags & CMD_IGNORE_RETURN)) tc->flags |= CMD_IGNORE_RETURN; @@ -2881,12 +3136,16 @@ execute_function (var, words, flags, fds_to_close, async, subshell) debug_trap = TRAP_STRING(DEBUG_TRAP); error_trap = TRAP_STRING(ERROR_TRAP); + return_trap = TRAP_STRING(RETURN_TRAP); - /* The order of the unwind protects for debug_trap and error_trap is - important here! unwind-protect commands are run in reverse order - of registration. If this causes problems, take out the xfree - unwind-protect calls and live with the small memory leak. */ - if (debug_trap && (trace_p (var) == 0)) + /* The order of the unwind protects for debug_trap, error_trap and + return_trap is important here! unwind-protect commands are run + in reverse order of registration. If this causes problems, take + out the xfree unwind-protect calls and live with the small memory leak. */ + + /* function_trace_mode != 0 means that all functions inherit the DEBUG trap. + if the function has the trace attribute set, it inherits the DEBUG trap */ + if (debug_trap && ((trace_p (var) == 0) && function_trace_mode == 0)) { if (subshell == 0) { @@ -2897,7 +3156,8 @@ execute_function (var, words, flags, fds_to_close, async, subshell) restore_default_signal (DEBUG_TRAP); } - if (error_trap) + /* error_trace_mode != 0 means that functions inherit the ERR trap. */ + if (error_trap && error_trace_mode == 0) { if (subshell == 0) { @@ -2908,14 +3168,39 @@ execute_function (var, words, flags, fds_to_close, async, subshell) restore_default_signal (ERROR_TRAP); } + if (return_trap && ((trace_p (var) == 0) && function_trace_mode == 0)) + { + if (subshell == 0) + { + return_trap = savestring (return_trap); + add_unwind_protect (xfree, return_trap); + add_unwind_protect (set_return_trap, return_trap); + } + restore_default_signal (RETURN_TRAP); + } + + funcnest++; +#if defined (ARRAY_VARS) + shell_fn = find_function_def (this_shell_function->name); + sfile = shell_fn ? shell_fn->source_file : ""; + /* This is quite similar to the code in shell.c and elsewhere. */ + array_push (bash_source_a, sfile); + t = itos (executing_line_number ()); + array_push (bash_lineno_a, t); + free (t); + array_push (funcname_a, this_shell_function->name); +#endif + /* The temporary environment for a function is supposed to apply to all commands executed within the function body. */ remember_args (words->next, 1); + /* Update BASH_ARGV and BASH_ARGC */ + push_args (words->next); + /* Number of the line on which the function body starts. */ - if (interactive_shell) - line_number = function_line_number = tc->line; + line_number = function_line_number = tc->line; if (subshell) { @@ -2936,11 +3221,45 @@ execute_function (var, words, flags, fds_to_close, async, subshell) if (return_val) result = return_catch_value; else - result = execute_command_internal (fc, 0, NO_PIPE, NO_PIPE, fds_to_close); + { + /* Run the debug trap here so we can trap at the start of a function's + execution rather than the execution of the body's first command. */ + showing_function_line = 1; + save_current = currently_executing_command; + result = run_debug_trap (); +#if defined (DEBUGGER) + /* In debugging mode, if the DEBUG trap returns a non-zero status, we + skip the command. */ + if (debugging_mode == 0 || result == EXECUTION_SUCCESS) + { + showing_function_line = 0; + currently_executing_command = save_current; + result = execute_command_internal (fc, 0, NO_PIPE, NO_PIPE, fds_to_close); + + /* Run the RETURN trap in the function's context */ + save_current = currently_executing_command; + run_return_trap (); + currently_executing_command = save_current; + } +#else + result = execute_command_internal (fc, 0, NO_PIPE, NO_PIPE, fds_to_close); +#endif + showing_function_line = 0; + } + + /* Restore BASH_ARGC and BASH_ARGV */ + pop_args (); if (subshell == 0) run_unwind_frame ("function_calling"); + funcnest--; +#if defined (ARRAY_VARS) + array_pop (bash_source_a); + array_pop (bash_lineno_a); + array_pop (funcname_a); +#endif + if (variable_context == 0 || this_shell_function == 0) make_funcname_visible (0); @@ -3023,7 +3342,7 @@ execute_subshell_builtin_or_function (words, redirects, builtin, var, do_piping (pipe_in, pipe_out); - if (do_redirections (redirects, 1, 0, 0) != 0) + if (do_redirections (redirects, RX_ACTIVE) != 0) exit (EXECUTION_FAILURE); if (builtin) @@ -3070,7 +3389,7 @@ execute_builtin_or_function (words, builtin, var, redirects, REDIRECT *saved_undo_list; sh_builtin_func_t *saved_this_shell_builtin; - if (do_redirections (redirects, 1, 1, 0) != 0) + if (do_redirections (redirects, RX_ACTIVE|RX_UNDOABLE) != 0) { cleanup_redirects (redirection_undo_list); redirection_undo_list = (REDIRECT *)NULL; @@ -3104,6 +3423,10 @@ execute_builtin_or_function (words, builtin, var, redirects, else result = execute_function (var, words, flags, fds_to_close, 0, 0); + /* We do this before undoing the effects of any redirections. */ + if (ferror (stdout)) + clearerr (stdout); + /* If we are executing the `command' builtin, but this_shell_builtin is set to `exec_builtin', we know that we have something like `command exec [redirection]', since otherwise `exec' would have @@ -3167,7 +3490,9 @@ setup_async_signals () Note that the filename hashing stuff has to take place up here, in the parent. This is probably why the Bourne style shells don't handle it, since that would require them to go through - this gnarly hair, for no good reason. */ + this gnarly hair, for no good reason. + + NOTE: callers expect this to fork or exit(). */ static void execute_disk_command (words, redirects, command_line, pipe_in, pipe_out, async, fds_to_close, cmdflags) @@ -3186,12 +3511,19 @@ execute_disk_command (words, redirects, command_line, pipe_in, pipe_out, pathname = words->word->word; #if defined (RESTRICTED_SHELL) + command = (char *)NULL; if (restricted && xstrchr (pathname, '/')) { internal_error ("%s: restricted: cannot specify `/' in command names", pathname); last_command_exit_value = EXECUTION_FAILURE; - return; + + /* If we're not going to fork below, we must already be in a child + process or a context in which it's safe to call exit(2). */ + if (nofork && pipe_in == NO_PIPE && pipe_out == NO_PIPE) + exit (last_command_exit_value); + else + goto parent_return; } #endif /* RESTRICTED_SHELL */ @@ -3255,7 +3587,7 @@ execute_disk_command (words, redirects, command_line, pipe_in, pipe_out, subshell_environment = SUBSHELL_FORK; - if (redirects && (do_redirections (redirects, 1, 0, 0) != 0)) + if (redirects && (do_redirections (redirects, RX_ACTIVE) != 0)) { #if defined (PROCESS_SUBSTITUTION) /* Try to remove named pipes that may have been created as the @@ -3282,6 +3614,7 @@ execute_disk_command (words, redirects, command_line, pipe_in, pipe_out, } else { +parent_return: /* Make sure that the pipes are closed in the parent. */ close_pipes (pipe_in, pipe_out); #if defined (PROCESS_SUBSTITUTION) && defined (HAVE_DEV_FD) @@ -3436,7 +3769,7 @@ initialize_subshell () /* If we're not interactive, close the file descriptor from which we're reading the current shell script. */ if (interactive_shell == 0) - unset_bash_input (1); + unset_bash_input (0); } #if defined (HAVE_SETOSTYPE) && defined (_POSIX_SOURCE) @@ -155,6 +155,7 @@ static void evalerror __P((char *)); static void pushexp __P((void)); static void popexp __P((void)); static void expr_unwind __P((void)); +static void expr_bind_variable __P((char *, char *)); static intmax_t subexpr __P((char *)); @@ -280,6 +281,14 @@ expr_unwind () free (expr_stack[expr_depth]); /* free the allocated EXPR_CONTEXT */ } +static void +expr_bind_variable (lhs, rhs) + char *lhs, *rhs; +{ + (void)bind_int_variable (lhs, rhs); + stupidly_hack_special_variables (lhs); +} + /* Evaluate EXPR, and return the arithmetic result. If VALIDP is non-null, a zero is stored into the location to which it points if the expression is invalid, non-zero otherwise. If a non-zero @@ -299,10 +308,16 @@ evalexp (expr, validp) int *validp; { intmax_t val; + int c; + procenv_t oevalbuf; val = 0; - if (setjmp (evalbuf)) + FASTCOPY (evalbuf, oevalbuf, sizeof (evalbuf)); + + c = setjmp (evalbuf); + + if (c) { FREE (tokstr); FREE (expression); @@ -320,6 +335,8 @@ evalexp (expr, validp) if (validp) *validp = 1; + FASTCOPY (oevalbuf, evalbuf, sizeof (evalbuf)); + return (val); } @@ -449,7 +466,7 @@ expassign () rhs = itos (value); if (noeval == 0) - (void)bind_int_variable (lhs, rhs); + expr_bind_variable (lhs, rhs); free (rhs); free (lhs); FREE (tokstr); @@ -799,7 +816,7 @@ exp0 () v2 = tokval + ((stok == PREINC) ? 1 : -1); vincdec = itos (v2); if (noeval == 0) - (void)bind_int_variable (tokstr, vincdec); + expr_bind_variable (tokstr, vincdec); free (vincdec); val = v2; @@ -837,7 +854,7 @@ exp0 () v2 = val + ((*tp == '+') ? 1 : -1); vincdec = itos (v2); if (noeval == 0) - (void)bind_int_variable (tokstr, vincdec); + expr_bind_variable (tokstr, vincdec); free (vincdec); tp += 2; curtok = NUM; /* make sure x++=7 is flagged as an error */ @@ -31,12 +31,33 @@ extern intmax_t evalexp __P((char *, int *)); /* Functions from print_cmd.c. */ extern char *make_command_string __P((COMMAND *)); +extern char *named_function_string __P((char *, COMMAND *, int)); + extern void print_command __P((COMMAND *)); extern void print_simple_command __P((SIMPLE_COM *)); -extern char *named_function_string __P((char *, COMMAND *, int)); extern void print_word_list __P((WORD_LIST *, char *)); + +/* debugger support */ +extern void print_for_command_head __P((FOR_COM *)); +#if defined (SELECT_COMMAND) +extern void print_select_command_head __P((SELECT_COM *)); +#endif +extern void print_case_command_head __P((CASE_COM *)); +#if defined (DPAREN_ARITHMETIC) +extern void print_arith_command __P((WORD_LIST *)); +#endif +#if defined (COND_COMMAND) +extern void print_cond_command __P((COND_COM *)); +#endif + +/* set -x support */ extern char *indirection_level_string __P((void)); -extern void xtrace_print_word_list __P((WORD_LIST *)); +extern void xtrace_print_word_list __P((WORD_LIST *, int)); +extern void xtrace_print_for_command_head __P((FOR_COM *)); +#if defined (SELECT_COMMAND) +extern void xtrace_print_select_command_head __P((SELECT_COM *)); +#endif +extern void xtrace_print_case_command_head __P((CASE_COM *)); #if defined (DPAREN_ARITHMETIC) extern void xtrace_print_arith_cmd __P((WORD_LIST *)); #endif @@ -74,6 +95,8 @@ extern int return_EOF __P((void)); extern void reset_parser __P((void)); extern WORD_LIST *parse_string_to_word_list __P((char *, const char *)); +extern void free_pushed_string_input __P((void)); + extern char *decode_prompt_string __P((char *)); extern int get_current_prompt_level __P((void)); @@ -113,6 +136,10 @@ extern void strip_leading __P((char *)); extern void strip_trailing __P((char *, int, int)); extern void xbcopy __P((char *, char *, int)); +/* Functions from version.c. */ +extern char *shell_version_string __P((void)); +extern void show_shell_version __P((int)); + /* Functions from the bash library, lib/sh/libsh.a. These should really go into a separate include file. */ @@ -197,6 +224,13 @@ extern char *sh_realpath __P((const char *, char *)); extern int sh_setlinebuf __P((FILE *)); #endif +/* declarations for functions defined in lib/sh/shmatch.c */ +extern int sh_regmatch __P((const char *, const char *, int)); + +/* defines for flags argument to sh_regmatch. */ +#define SHMAT_SUBEXP 0x001 /* save subexpressions in SH_REMATCH */ +#define SHMAT_PWARN 0x002 /* print a warning message on invalid regexp */ + /* declarations for functions defined in lib/sh/shquote.c */ extern char *sh_single_quote __P((char *)); extern char *sh_double_quote __P((char *)); @@ -24,7 +24,7 @@ #include <stdio.h> #include "chartypes.h" #include "bashtypes.h" -#ifndef _MINIX +#if !defined (_MINIX) && defined (HAVE_SYS_FILE_H) # include <sys/file.h> #endif #include "filecntl.h" @@ -100,10 +100,7 @@ file_status (name) /* We have to use access(2) to determine access because AFS does not support Unix file system semantics. This may produce wrong answers for non-AFS files when ruid != euid. I hate AFS. */ - if (access (name, X_OK) == 0) - return (FS_EXISTS | FS_EXECABLE); - else - return (FS_EXISTS); + return ((access (name, X_OK) == 0) ? (FS_EXISTS|FS_EXECABLE) : FS_EXISTS); #else /* !AFS */ /* Find out if the file is actually executable. By definition, the @@ -120,24 +117,20 @@ file_status (name) g_mode_bits (finfo.st_mode) | o_mode_bits (finfo.st_mode)); - if (X_BIT (bits)) - return (FS_EXISTS | FS_EXECABLE); + return ((X_BIT (bits)) ? (FS_EXISTS | FS_EXECABLE) : FS_EXISTS); } /* If we are the owner of the file, the owner execute bit applies. */ - if (current_user.euid == finfo.st_uid && X_BIT (u_mode_bits (finfo.st_mode))) - return (FS_EXISTS | FS_EXECABLE); + if (current_user.euid == finfo.st_uid) + return ((X_BIT (u_mode_bits (finfo.st_mode))) ? (FS_EXISTS | FS_EXECABLE) : FS_EXISTS); /* If we are in the owning group, the group permissions apply. */ - if (group_member (finfo.st_gid) && X_BIT (g_mode_bits (finfo.st_mode))) - return (FS_EXISTS | FS_EXECABLE); - - /* If `others' have execute permission to the file, then so do we, - since we are also `others'. */ - if (X_BIT (o_mode_bits (finfo.st_mode))) - return (FS_EXISTS | FS_EXECABLE); + else if (group_member (finfo.st_gid)) + return ((X_BIT (g_mode_bits (finfo.st_mode))) ? (FS_EXISTS | FS_EXECABLE) : FS_EXISTS); - return (FS_EXISTS); + /* Else we check whether `others' have permission to execute the file */ + else + return ((X_BIT (o_mode_bits (finfo.st_mode))) ? (FS_EXISTS | FS_EXECABLE) : FS_EXISTS); #endif /* !AFS */ } @@ -151,6 +151,17 @@ int privileged_mode = 0; int brace_expansion = 1; #endif +/* Non-zero means that shell functions inherit the DEBUG trap. */ +int function_trace_mode = 0; + +/* Non-zero means that shell functions inherit the ERR trap. */ +int error_trace_mode = 0; + +/* Non-zero means that the rightmost non-zero exit status in a pipeline + is the exit status of the entire pipeline. If each processes exits + with a 0 status, the status of the pipeline is 0. */ +int pipefail_opt = 0; + /* **************************************************************** */ /* */ /* The Flags ALIST. */ @@ -180,24 +191,22 @@ struct flags_alist shell_flags[] = { { 'u', &unbound_vars_is_error }, { 'v', &echo_input_at_read }, { 'x', &echo_command_at_execute }, - { 'C', &noclobber }, /* New flags that control non-standard things. */ #if 0 { 'l', &lexical_scoping }, #endif - { 'I', &no_invisible_vars }, - - { 'P', &no_symbolic_links }, - #if defined (BRACE_EXPANSION) { 'B', &brace_expansion }, #endif - + { 'C', &noclobber }, + { 'E', &error_trace_mode }, #if defined (BANG_HISTORY) { 'H', &history_expansion }, #endif /* BANG_HISTORY */ - + { 'I', &no_invisible_vars }, + { 'P', &no_symbolic_links }, + { 'T', &function_trace_mode }, {0, (int *)NULL} }; @@ -310,7 +319,7 @@ reset_shell_flags () place_keywords_in_env = read_but_dont_execute = just_one_command = 0; noclobber = unbound_vars_is_error = echo_input_at_read = 0; echo_command_at_execute = jobs_m_flag = forced_interactive = 0; - no_symbolic_links = no_invisible_vars = privileged_mode = 0; + no_symbolic_links = no_invisible_vars = privileged_mode = pipefail_opt = 0; hashing_enabled = interactive_comments = 1; @@ -46,7 +46,8 @@ extern int just_one_command, unbound_vars_is_error, echo_input_at_read, echo_command_at_execute, no_invisible_vars, noclobber, hashing_enabled, forced_interactive, privileged_mode, - asynchronous_notification, interactive_comments, no_symbolic_links; + asynchronous_notification, interactive_comments, no_symbolic_links, + function_trace_mode, error_trace_mode, pipefail_opt; #if 0 extern int lexical_scoping; @@ -470,7 +470,16 @@ make_absolute (string, dot_path) char *result; if (dot_path == 0 || ABSPATH(string)) +#ifdef __CYGWIN__ + { + char pathbuf[PATH_MAX + 1]; + + cygwin_conv_to_full_posix_path (string, pathbuf); + result = savestring (pathbuf); + } +#else result = savestring (string); +#endif else result = sh_makepath (dot_path, string, 0); diff --git a/include/shmbutil.h b/include/shmbutil.h index 7fe2f8ea..b700504d 100644 --- a/include/shmbutil.h +++ b/include/shmbutil.h @@ -70,6 +70,11 @@ extern size_t xmbsrtowcs __P((wchar_t *, const char **, size_t, mbstate_t *)); extern char *xstrchr __P((const char *, int)); +#ifndef MB_INVALIDCH +#define MB_INVALIDCH(x) ((x) == (size_t)-1 || (x) == (size_t)-2) +#define MB_NULLWCH(x) ((x) == 0) +#endif + #else /* !HANDLE_MULTIBYTE */ #undef MB_LEN_MAX @@ -81,6 +86,11 @@ extern char *xstrchr __P((const char *, int)); #undef xstrchr #define xstrchr(s, c) strchr(s, c) +#ifndef MB_INVALIDCH +#define MB_INVALIDCH(x) (0) +#define MB_NULLWCH(x) (0) +#endif + #endif /* !HANDLE_MULTIBYTE */ /* Declare and initialize a multibyte state. Call must be terminated @@ -120,6 +130,8 @@ extern char *xstrchr __P((const char *, int)); state = state_bak; \ (_i)++; \ } \ + else if (mblength == 0) \ + (_i)++; \ else \ (_i) += mblength; \ } \ diff --git a/include/stdc.h b/include/stdc.h index 05b743e5..efab869e 100644 --- a/include/stdc.h +++ b/include/stdc.h @@ -66,7 +66,7 @@ #endif /* !__STDC__ */ #ifndef __attribute__ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) # define __attribute__(x) # endif #endif @@ -21,7 +21,7 @@ #include "config.h" #include "bashtypes.h" -#ifndef _MINIX +#if !defined (_MINIX) && defined (HAVE_SYS_FILE_H) # include <sys/file.h> #endif #include "filecntl.h" @@ -234,7 +234,7 @@ save_bash_input (fd, new_fd) { /* What's this? A stray buffer without an associated open file descriptor? Free up the buffer and report the error. */ - internal_error ("check_bash_input: buffer already exists for new fd %d", nfd); + internal_error ("save_bash_input: buffer already exists for new fd %d", nfd); free_buffered_stream (buffers[nfd]); } @@ -276,8 +276,13 @@ int check_bash_input (fd) int fd; { - if (fd > 0 && fd_is_bash_input (fd)) - return ((save_bash_input (fd, -1) == -1) ? -1 : 0); + if (fd_is_bash_input (fd)) + { + if (fd > 0) + return ((save_bash_input (fd, -1) == -1) ? -1 : 0); + else if (fd == 0) + return ((sync_buffered_stream (fd) == -1) ? -1 : 0); + } return 0; } @@ -3,7 +3,7 @@ /* This file works with both POSIX and BSD systems. It implements job control. */ -/* Copyright (C) 1989, 1992 Free Software Foundation, Inc. +/* Copyright (C) 1989-2003 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -39,7 +39,10 @@ # include <sys/resource.h> #endif /* !_POSIX_VERSION && HAVE_SYS_RESOURCE_H && HAVE_WAIT3 && !RLIMTYPE */ -#include <sys/file.h> +#if defined (HAVE_SYS_FILE_H) +# include <sys/file.h> +#endif + #include "filecntl.h" #include <sys/ioctl.h> #include <sys/param.h> @@ -127,6 +130,8 @@ extern int errno; /* Some systems let waitpid(2) tell callers about stopped children. */ #if !defined (WCONTINUED) # define WCONTINUED 0 +#endif +#if !defined (WIFCONTINUED) # define WIFCONTINUED(s) (0) #endif @@ -142,7 +147,8 @@ extern void rl_set_screen_size __P((int, int)); /* Variables used here but defined in other files. */ extern int subshell_environment, line_number; extern int posixly_correct, shell_level; -extern int interrupt_immediately, last_command_exit_value; +extern int interrupt_immediately; +extern int last_command_exit_value, last_command_exit_signal; extern int loop_level, breaking; extern int sourcelevel; extern sh_builtin_func_t *this_shell_builtin; @@ -223,6 +229,7 @@ static PROCESS *find_pipeline __P((pid_t, int, int *)); static char *current_working_directory __P((void)); static char *job_working_directory __P((void)); +static char *j_strsignal __P((int)); static char *printable_job_status __P((int, PROCESS *, int)); static pid_t find_last_pid __P((int, int)); @@ -235,7 +242,9 @@ static int most_recent_job_in_state __P((int, JOB_STATE)); static int find_job __P((pid_t, int)); static int print_job __P((JOB *, int, int, int)); static int process_exit_status __P((WAIT)); +static int process_exit_signal __P((WAIT)); static int job_exit_status __P((int)); +static int job_exit_signal __P((int)); static int set_job_status_and_cleanup __P((int)); static WAIT raw_job_exit_status __P((int)); @@ -994,6 +1003,21 @@ describe_pid (pid) } static char * +j_strsignal (s) + int s; +{ + char *x; + + x = strsignal (s); + if (x == 0) + { + x = retcode_name_buffer; + sprintf (x, "Signal %d", s); + } + return x; +} + +static char * printable_job_status (j, p, format) int j; PROCESS *p; @@ -1019,9 +1043,9 @@ printable_job_status (j, p, format) else { if (WIFSTOPPED (p->status)) - temp = strsignal (WSTOPSIG (p->status)); + temp = j_strsignal (WSTOPSIG (p->status)); else if (WIFSIGNALED (p->status)) - temp = strsignal (WTERMSIG (p->status)); + temp = j_strsignal (WTERMSIG (p->status)); else if (WIFEXITED (p->status)) { temp = retcode_name_buffer; @@ -1725,6 +1749,13 @@ wait_sigint_handler (sig) } static int +process_exit_signal (status) + WAIT status; +{ + return (WIFSIGNALED (status) ? WTERMSIG (status) : 0); +} + +static int process_exit_status (status) WAIT status; { @@ -1743,6 +1774,16 @@ raw_job_exit_status (job) int job; { register PROCESS *p; + int fail; + + if (pipefail_opt) + { + fail = 0; + for (p = jobs[job]->pipe; p->next != jobs[job]->pipe; p = p->next) + if (p->status != EXECUTION_SUCCESS) fail = p->status; + return fail; + } + for (p = jobs[job]->pipe; p->next != jobs[job]->pipe; p = p->next) ; return (p->status); @@ -1758,6 +1799,13 @@ job_exit_status (job) return (process_exit_status (raw_job_exit_status (job))); } +static int +job_exit_signal (job) + int job; +{ + return (process_exit_signal (raw_job_exit_status (job))); +} + #define FIND_CHILD(pid, child) \ do \ { \ @@ -1885,11 +1933,12 @@ wait_for (pid) /* The exit state of the command is either the termination state of the child, or the termination state of the job. If a job, the status - of the last child in the pipeline is the significant one. */ - if (job != NO_JOB) - termination_state = job_exit_status (job); - else - termination_state = process_exit_status (child->status); + of the last child in the pipeline is the significant one. If the command + or job was terminated by a signal, note that value also. */ + termination_state = (job != NO_JOB) ? job_exit_status (job) + : process_exit_status (child->status); + last_command_exit_signal = (job != NO_JOB) ? job_exit_signal (job) + : process_exit_signal (child->status); if (job == NO_JOB || IS_JOBCONTROL (job)) { @@ -1949,7 +1998,7 @@ if (job == NO_JOB) /* If the current job was stopped or killed by a signal, and the user has requested it, get a possibly new window size */ - if (check_window_size && job == current_job) + if (check_window_size && (job == current_job || IS_FOREGROUND (job))) get_new_window_size (0); } else @@ -2243,7 +2292,7 @@ start_job (job, foreground) if (foreground == 0 && already_running) { - internal_error ("%s: bg background job?", this_command_name); + internal_error ("%s: job %%%d already in background", this_command_name, job + 1); UNBLOCK_CHILD (oset); return (-1); } @@ -2733,6 +2782,7 @@ run_sigchld_trap (nchild) begin_unwind_frame ("SIGCHLD trap"); unwind_protect_int (last_command_exit_value); + unwind_protect_int (last_command_exit_signal); unwind_protect_var (last_made_pid); unwind_protect_int (interrupt_immediately); unwind_protect_int (jobs_list_frozen); @@ -2742,8 +2792,8 @@ run_sigchld_trap (nchild) /* We have to add the commands this way because they will be run in reverse order of adding. We don't want maybe_set_sigchld_trap () to reference freed memory. */ - add_unwind_protect ((Function *)xfree, trap_command); - add_unwind_protect ((Function *)maybe_set_sigchld_trap, trap_command); + add_unwind_protect (xfree, trap_command); + add_unwind_protect (maybe_set_sigchld_trap, trap_command); subst_assign_varlist = (WORD_LIST *)NULL; the_pipeline = (PROCESS *)NULL; @@ -2753,7 +2803,7 @@ run_sigchld_trap (nchild) for (i = 0; i < nchild; i++) { interrupt_immediately = 1; - parse_and_execute (savestring (trap_command), "trap", SEVAL_NOHIST); + parse_and_execute (savestring (trap_command), "trap", SEVAL_NOHIST|SEVAL_RESETLINE); } run_unwind_frame ("SIGCHLD trap"); @@ -2800,11 +2850,21 @@ notify_of_job_status () ((DEADJOB (job) && IS_FOREGROUND (job) == 0) || STOPPED (job))) continue; +#if 0 /* 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 ((job_control == 0 && interactive_shell) || startup_state == 2) +#else + /* 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 and subshell_environment has the + SUBSHELL_COMSUB bit turned on, we were started to run a command + substitution, so don't print anything. */ + if ((job_control == 0 && interactive_shell) || + (startup_state == 2 && (subshell_environment & SUBSHELL_COMSUB))) +#endif { /* POSIX.2 compatibility: if the shell is not interactive, hang onto the job corresponding to the last asynchronous @@ -2828,7 +2888,8 @@ notify_of_job_status () #endif signal_is_trapped (termsig) == 0) { - fprintf (stderr, "%s: line %d: ", get_name_for_error (), line_number); + /* Don't print `0' for a line number. */ + fprintf (stderr, "%s: line %d: ", get_name_for_error (), (line_number == 0) ? 1 : line_number); pretty_print_job (job, JLIST_NONINTERACTIVE, stderr); } else if (IS_FOREGROUND (job)) @@ -2839,7 +2900,7 @@ notify_of_job_status () if (termsig && WIFSIGNALED (s) && termsig != SIGINT && termsig != SIGPIPE) #endif { - fprintf (stderr, "%s", strsignal (termsig)); + fprintf (stderr, "%s", j_strsignal (termsig)); if (WIFCORED (s)) fprintf (stderr, " (core dumped)"); @@ -2851,6 +2912,7 @@ notify_of_job_status () { if (dir == 0) dir = current_working_directory (); +itrace("calling pretty_print_job: startup_state == %d, subshell_environment = %d", startup_state, subshell_environment); pretty_print_job (job, JLIST_STANDARD, stderr); if (dir && strcmp (dir, jobs[job]->wd) != 0) fprintf (stderr, diff --git a/lib/glob/glob.c b/lib/glob/glob.c index 27099f76..cdc9b7b2 100644 --- a/lib/glob/glob.c +++ b/lib/glob/glob.c @@ -181,10 +181,14 @@ mbskipname (pat, dname) n = strlen(pat); pat_bak = (char *) alloca (n + 1); + if (pat_bak == 0) + return 0; memcpy (pat_bak, pat, n + 1); n = strlen(dname); dn_bak = (char *) alloca (n + 1); + if (dn_bak == 0) + return 0; memcpy (dn_bak, dname, n + 1); memset(&pat_ps, '\0', sizeof(mbstate_t)); @@ -198,6 +202,9 @@ mbskipname (pat, dname) pat_wc = (wchar_t *) alloca ((pat_n + 1) * sizeof(wchar_t)); dn_wc = (wchar_t *) alloca ((dn_n + 1) * sizeof(wchar_t)); + if (pat_wc == 0 || dn_wc == 0) + return 0; + (void) xmbsrtowcs (pat_wc, (const char **)&pat_bak, pat_n + 1, &pat_ps); (void) xmbsrtowcs (dn_wc, (const char **)&dn_bak, dn_n + 1, &dn_ps); @@ -255,6 +262,8 @@ wdequote_pathname (pathname) len = strlen (pathname); pathname_bak = (char *) alloca (len + 1); + if (pathname_bak == 0) + return; memcpy (pathname_bak, pathname , len + 1); /* Convert the strings into wide characters. */ @@ -264,7 +273,10 @@ wdequote_pathname (pathname) /* Something wrong. */ return; - wpathname = (wchar_t *) alloca ((n + 1) * sizeof (wchar_t)); + wpathname = (wchar_t *)alloca ((n + 1) * sizeof (wchar_t)); + if (wpathname == 0) + return; + (void) xmbsrtowcs (wpathname, (const char **)&pathname_bak, n + 1, &ps); for (i = j = 0; wpathname && wpathname[i]; ) @@ -373,6 +385,9 @@ glob_vector (pat, dir, flags) return ((char **) &glob_error_return); nextlink = (struct globval *)alloca (sizeof (struct globval)); + if (nextlink == NULL) + return ((char **) NULL); + nextlink->next = (struct globval *)0; nextname = (char *) malloc (1); if (nextname == 0) @@ -418,10 +433,15 @@ glob_vector (pat, dir, flags) { free (nextname); nextlink = (struct globval *)alloca (sizeof (struct globval)); - nextlink->next = (struct globval *)0; - lastlink = nextlink; - nextlink->name = npat; - count = 1; + if (nextlink) + { + nextlink->next = (struct globval *)0; + lastlink = nextlink; + nextlink->name = npat; + count = 1; + } + else + lose = 1; } else { @@ -490,14 +510,14 @@ glob_vector (pat, dir, flags) if (strmatch (pat, dp->d_name, mflags) != FNM_NOMATCH) { - nextlink = (struct globval *) alloca (sizeof (struct globval)); - nextlink->next = lastlink; nextname = (char *) malloc (D_NAMLEN (dp) + 1); - if (nextname == NULL) + nextlink = (struct globval *) alloca (sizeof (struct globval)); + if (nextlink == 0 || nextname == 0) { lose = 1; break; } + nextlink->next = lastlink; lastlink = nextlink; nextlink->name = nextname; bcopy (dp->d_name, nextname, D_NAMLEN (dp) + 1); @@ -631,6 +651,7 @@ glob_filename (pathname, flags) unsigned int result_size; char *directory_name, *filename; unsigned int directory_len; + int free_dirname; /* flag */ result = (char **) malloc (sizeof (char *)); result_size = 1; @@ -639,6 +660,8 @@ glob_filename (pathname, flags) result[0] = NULL; + directory_name = NULL; + /* Find the filename. */ filename = strrchr (pathname, '/'); if (filename == NULL) @@ -646,15 +669,20 @@ glob_filename (pathname, flags) filename = pathname; directory_name = ""; directory_len = 0; + free_dirname = 0; } else { directory_len = (filename - pathname) + 1; - directory_name = (char *) alloca (directory_len + 1); + directory_name = (char *) malloc (directory_len + 1); + + if (directory_name == 0) /* allocation failed? */ + return (NULL); bcopy (pathname, directory_name, directory_len); directory_name[directory_len] = '\0'; ++filename; + free_dirname = 1; } /* If directory_name contains globbing characters, then we @@ -669,6 +697,12 @@ glob_filename (pathname, flags) directories = glob_filename (directory_name, flags & ~GX_MARKDIRS); + if (free_dirname) + { + free (directory_name); + directory_name = NULL; + } + if (directories == NULL) goto memory_error; else if (directories == (char **)&glob_error_return) @@ -746,6 +780,8 @@ glob_filename (pathname, flags) if (result[0] == NULL) goto memory_error; bcopy (directory_name, result[0], directory_len + 1); + if (free_dirname) + free (directory_name); result[1] = NULL; return (result); } @@ -770,9 +806,16 @@ glob_filename (pathname, flags) flags & ~GX_MARKDIRS); if (temp_results == NULL || temp_results == (char **)&glob_error_return) - return (temp_results); + { + if (free_dirname) + free (directory_name); + return (temp_results); + } - return (glob_dir_to_array (directory_name, temp_results, flags)); + result = glob_dir_to_array (directory_name, temp_results, flags); + if (free_dirname) + free (directory_name); + return (result); } /* We get to memory_error if the program has run out of memory, or @@ -786,6 +829,9 @@ glob_filename (pathname, flags) free ((char *) result); } + if (free_dirname && directory_name) + free (directory_name); + QUIT; return (NULL); diff --git a/lib/glob/sm_loop.c b/lib/glob/sm_loop.c index 3760fb2f..0926b01b 100644 --- a/lib/glob/sm_loop.c +++ b/lib/glob/sm_loop.c @@ -134,6 +134,19 @@ fprintf(stderr, "gmatch: pattern = %s; pe = %s\n", pattern, pe); if ((flags & FNM_PATHNAME) && sc == L('/')) /* A slash does not match a wildcard under FNM_PATHNAME. */ return FNM_NOMATCH; +#ifdef EXTENDED_GLOB + else if ((flags & FNM_EXTMATCH) && c == L('?') && *p == L('(')) /* ) */ + { + CHAR *newn; + for (newn = n; newn < se; ++newn) + { + if (EXTMATCH (c, newn, se, p, pe, flags) == 0) + return (0); + } + /* We didn't match. If we have a `?(...)', that's failure. */ + return FNM_NOMATCH; + } +#endif else if (c == L('?')) { if (sc == L('\0')) diff --git a/lib/malloc/malloc.c b/lib/malloc/malloc.c index 0b4c8470..4871b711 100644 --- a/lib/malloc/malloc.c +++ b/lib/malloc/malloc.c @@ -236,7 +236,7 @@ static unsigned long binsizes[NBUCKETS] = { 8192UL, 16384UL, 32768UL, 65536UL, 131072UL, 262144UL, 524288UL, 1048576UL, 2097152UL, 4194304UL, 8388608UL, 16777216UL, 33554432UL, 67108864UL, 134217728UL, 268435456UL, 536870912UL, 1073741824UL, - 2147483648UL, 4294967296UL-1 + 2147483648UL, 4294967295UL }; /* binsizes[x] == (1 << ((x) + 3)) */ @@ -291,6 +291,9 @@ extern void mtrace_free __P((PTR_T, int, const char *, int)); #if !defined (botch) static void botch (s, file, line) + const char *s; + const char *file; + int line; { fprintf (stderr, "malloc: failed assertion: %s\n", s); (void)fflush (stderr); @@ -879,6 +882,7 @@ internal_free (mem, file, line, flags) busy[nunits] = 0; free_return: + ; /* Empty statement in case this is the end of the function */ #ifdef MALLOC_STATS _mstats.nmalloc[nunits]--; diff --git a/lib/readline/Makefile.in b/lib/readline/Makefile.in index 2caa69a3..ce91f46d 100644 --- a/lib/readline/Makefile.in +++ b/lib/readline/Makefile.in @@ -345,7 +345,7 @@ search.o: search.c shell.o: shell.c signals.o: signals.c terminal.o: terminal.c -text.o: terminal.c +text.o: text.c tilde.o: tilde.c undo.o: undo.c util.o: util.c diff --git a/lib/readline/bind.c b/lib/readline/bind.c index 65ef401e..aa0bb228 100644 --- a/lib/readline/bind.c +++ b/lib/readline/bind.c @@ -148,6 +148,34 @@ rl_bind_key_in_map (key, function, map) return (result); } +/* Bind key sequence KEYSEQ to DEFAULT_FUNC if KEYSEQ is unbound. Right + now, this is always used to attempt to bind the arrow keys, hence the + check for rl_vi_movement_mode. */ +int +rl_bind_key_if_unbound_in_map (key, default_func, kmap) + int key; + rl_command_func_t *default_func; + Keymap kmap; +{ + char keyseq[2]; + + keyseq[0] = (unsigned char)key; + keyseq[1] = '\0'; + return (rl_bind_keyseq_if_unbound_in_map (keyseq, default_func, kmap)); +} + +int +rl_bind_key_if_unbound (key, default_func) + int key; + rl_command_func_t *default_func; +{ + char keyseq[2]; + + keyseq[0] = (unsigned char)key; + keyseq[1] = '\0'; + return (rl_bind_keyseq_if_unbound_in_map (keyseq, default_func, _rl_keymap)); +} + /* Make KEY do nothing in the currently selected keymap. Returns non-zero in case of error. */ int @@ -200,9 +228,30 @@ rl_unbind_command_in_map (command, map) } /* Bind the key sequence represented by the string KEYSEQ to + FUNCTION, starting in the current keymap. This makes new + keymaps as necessary. */ +int +rl_bind_keyseq (keyseq, function) + const char *keyseq; + rl_command_func_t *function; +{ + return (rl_generic_bind (ISFUNC, keyseq, (char *)function, _rl_keymap)); +} + +/* Bind the key sequence represented by the string KEYSEQ to FUNCTION. This makes new keymaps as necessary. The initial place to do bindings is in MAP. */ int +rl_bind_keyseq_in_map (keyseq, function, map) + const char *keyseq; + rl_command_func_t *function; + Keymap map; +{ + return (rl_generic_bind (ISFUNC, keyseq, (char *)function, map)); +} + +/* Backwards compatibility; equivalent to rl_bind_keyseq_in_map() */ +int rl_set_key (keyseq, function, map) const char *keyseq; rl_command_func_t *function; @@ -211,6 +260,40 @@ rl_set_key (keyseq, function, map) return (rl_generic_bind (ISFUNC, keyseq, (char *)function, map)); } +/* Bind key sequence KEYSEQ to DEFAULT_FUNC if KEYSEQ is unbound. Right + now, this is always used to attempt to bind the arrow keys, hence the + check for rl_vi_movement_mode. */ +int +rl_bind_keyseq_if_unbound_in_map (keyseq, default_func, kmap) + const char *keyseq; + rl_command_func_t *default_func; + Keymap kmap; +{ + rl_command_func_t *func; + + if (keyseq) + { + func = rl_function_of_keyseq (keyseq, kmap, (int *)NULL); +#if defined (VI_MODE) + if (!func || func == rl_do_lowercase_version || func == rl_vi_movement_mode) +#else + if (!func || func == rl_do_lowercase_version) +#endif + return (rl_bind_keyseq_in_map (keyseq, default_func, kmap)); + else + return 1; + } + return 0; +} + +int +rl_bind_keyseq_if_unbound (keyseq, default_func) + const char *keyseq; + rl_command_func_t *default_func; +{ + return (rl_bind_keyseq_if_unbound_in_map (keyseq, default_func, _rl_keymap)); +} + /* Bind the key sequence represented by the string KEYSEQ to the string of characters MACRO. This makes new keymaps as necessary. The initial place to do bindings is in MAP. */ @@ -311,7 +394,7 @@ rl_generic_bind (type, keyseq, data, map) mapped to something, `abc' to be mapped to something else, and the function bound to `a' to be executed when the user types `abx', leaving `bx' in the input queue. */ - if (k.function /* && k.type == ISFUNC */) + if (k.function && ((k.type == ISFUNC && k.function != rl_do_lowercase_version) || k.type == ISMACR)) { map[ANYOTHERKEY] = k; k.function = 0; @@ -912,9 +995,15 @@ parser_else (args) return 0; } +#if 0 /* Check the previous (n - 1) levels of the stack to make sure that we haven't previously turned off parsing. */ for (i = 0; i < if_stack_depth - 1; i++) +#else + /* Check the previous (n) levels of the stack to make sure that + we haven't previously turned off parsing. */ + for (i = 0; i < if_stack_depth; i++) +#endif if (if_stack[i] == 1) return 0; @@ -1161,7 +1250,7 @@ rl_parse_and_bind (string) } /* If this is a new-style key-binding, then do the binding with - rl_set_key (). Otherwise, let the older code deal with it. */ + rl_bind_keyseq (). Otherwise, let the older code deal with it. */ if (*string == '"') { char *seq; @@ -1200,7 +1289,7 @@ rl_parse_and_bind (string) rl_macro_bind (seq, &funname[1], _rl_keymap); } else - rl_set_key (seq, rl_named_function (funname), _rl_keymap); + rl_bind_keyseq (seq, rl_named_function (funname)); free (seq); return 0; @@ -1281,6 +1370,7 @@ static struct { { "prefer-visible-bell", &_rl_prefer_visible_bell, V_SPECIAL }, { "print-completions-horizontally", &_rl_print_completions_horizontally, 0 }, { "show-all-if-ambiguous", &_rl_complete_show_all, 0 }, + { "show-all-if-unmodified", &_rl_complete_show_unmodified, 0 }, #if defined (VISIBLE_STATS) { "visible-stats", &rl_visible_stats, 0 }, #endif /* VISIBLE_STATS */ @@ -1650,7 +1740,7 @@ rl_get_keymap_name_from_edit_mode () /* Each of the following functions produces information about the state of keybindings and functions known to Readline. The info is always printed to rl_outstream, and in such a way that it can - be read back in (i.e., passed to rl_parse_and_bind (). */ + be read back in (i.e., passed to rl_parse_and_bind ()). */ /* Print the names of functions known to Readline. */ void @@ -2112,28 +2202,6 @@ rl_dump_variables (count, key) return (0); } -/* Bind key sequence KEYSEQ to DEFAULT_FUNC if KEYSEQ is unbound. Right - now, this is always used to attempt to bind the arrow keys, hence the - check for rl_vi_movement_mode. */ -void -_rl_bind_if_unbound (keyseq, default_func) - const char *keyseq; - rl_command_func_t *default_func; -{ - rl_command_func_t *func; - - if (keyseq) - { - func = rl_function_of_keyseq (keyseq, _rl_keymap, (int *)NULL); -#if defined (VI_MODE) - if (!func || func == rl_do_lowercase_version || func == rl_vi_movement_mode) -#else - if (!func || func == rl_do_lowercase_version) -#endif - rl_set_key (keyseq, default_func, _rl_keymap); - } -} - /* Return non-zero if any members of ARRAY are a substring in STRING. */ static int substring_member_of_array (string, array) diff --git a/lib/readline/callback.c b/lib/readline/callback.c index a8f4323c..5b05ea5c 100644 --- a/lib/readline/callback.c +++ b/lib/readline/callback.c @@ -131,7 +131,7 @@ rl_callback_read_char () if (in_handler == 0 && rl_linefunc) _rl_callback_newline (); } - if (rl_pending_input) + if (rl_pending_input || _rl_pushed_input_available ()) eof = readline_internal_char (); else break; diff --git a/lib/readline/chardefs.h b/lib/readline/chardefs.h index a537be22..cb04c982 100644 --- a/lib/readline/chardefs.h +++ b/lib/readline/chardefs.h @@ -77,7 +77,11 @@ # define isxdigit(c) (isdigit((c)) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F')) #endif -#define NON_NEGATIVE(c) ((unsigned char)(c) == (c)) +#if defined (CTYPE_NON_ASCII) +# define NON_NEGATIVE(c) 1 +#else +# define NON_NEGATIVE(c) ((unsigned char)(c) == (c)) +#endif /* Some systems define these; we want our definitions. */ #undef ISPRINT diff --git a/lib/readline/complete.c b/lib/readline/complete.c index 21a9d708..d72d2468 100644 --- a/lib/readline/complete.c +++ b/lib/readline/complete.c @@ -28,7 +28,7 @@ #include <sys/types.h> #include <fcntl.h> #if defined (HAVE_SYS_FILE_H) -#include <sys/file.h> +# include <sys/file.h> #endif #if defined (HAVE_UNISTD_H) @@ -105,6 +105,8 @@ static void set_completion_defaults PARAMS((int)); static int get_y_or_n PARAMS((int)); static int _rl_internal_pager PARAMS((int)); static char *printable_part PARAMS((char *)); +static int fnwidth PARAMS((const char *)); +static int fnprint PARAMS((const char *)); static int print_filename PARAMS((char *, char *)); static char **gen_completion_matches PARAMS((char *, int, int, rl_compentry_func_t *, int, int)); @@ -130,6 +132,10 @@ static char *make_quoted_replacement PARAMS((char *, int, char *)); /* If non-zero, non-unique completions always show the list of matches. */ int _rl_complete_show_all = 0; +/* If non-zero, non-unique completions show the list of matches, unless it + is not possible to do partial completion and modify the line. */ +int _rl_complete_show_unmodified = 0; + /* If non-zero, completed directory names have a slash appended. */ int _rl_complete_mark_directories = 1; @@ -214,7 +220,7 @@ const char *rl_basic_quote_characters = "\"'"; /* The list of characters that signal a break between words for rl_complete_internal. The default list is the contents of rl_basic_word_break_characters. */ -const char *rl_completer_word_break_characters = (const char *)NULL; +/*const*/ char *rl_completer_word_break_characters = (/*const*/ char *)NULL; /* List of characters which can be used to quote a substring of the line. Completion occurs on the entire substring, and within the substring @@ -320,6 +326,8 @@ rl_complete (ignore, invoking_key) return (rl_complete_internal ('?')); else if (_rl_complete_show_all) return (rl_complete_internal ('!')); + else if (_rl_complete_show_unmodified) + return (rl_complete_internal ('@')); else return (rl_complete_internal (TAB)); } @@ -352,6 +360,8 @@ rl_completion_mode (cfunc) return '?'; else if (_rl_complete_show_all) return '!'; + else if (_rl_complete_show_unmodified) + return '@'; else return TAB; } @@ -520,52 +530,139 @@ printable_part (pathname) return ++temp; } +/* Compute width of STRING when displayed on screen by print_filename */ +static int +fnwidth (string) + const char *string; +{ + int width, pos; +#if defined (HANDLE_MULTIBYTE) + mbstate_t ps; + int left, w; + size_t clen; + wchar_t wc; + + left = strlen (string) + 1; + memset (&ps, 0, sizeof (mbstate_t)); +#endif + + width = pos = 0; + while (string[pos]) + { + if (CTRL_CHAR (*string) || *string == RUBOUT) + { + width += 2; + pos++; + } + else + { +#if defined (HANDLE_MULTIBYTE) + clen = mbrtowc (&wc, string + pos, left - pos, &ps); + if (MB_INVALIDCH (clen)) + { + width++; + pos++; + memset (&ps, 0, sizeof (mbstate_t)); + } + else if (MB_NULLWCH (clen)) + break; + else + { + pos += clen; + w = wcwidth (wc); + width += (w >= 0) ? w : 1; + } +#else + width++; + pos++; +#endif + } + } + + return width; +} + +static int +fnprint (to_print) + const char *to_print; +{ + int printed_len; + const char *s; +#if defined (HANDLE_MULTIBYTE) + mbstate_t ps; + const char *end; + size_t tlen; + + end = to_print + strlen (to_print) + 1; + memset (&ps, 0, sizeof (mbstate_t)); +#endif + + printed_len = 0; + s = to_print; + while (*s) + { + if (CTRL_CHAR (*s)) + { + putc ('^', rl_outstream); + putc (UNCTRL (*s), rl_outstream); + printed_len += 2; + s++; +#if defined (HANDLE_MULTIBYTE) + memset (&ps, 0, sizeof (mbstate_t)); +#endif + } + else if (*s == RUBOUT) + { + putc ('^', rl_outstream); + putc ('?', rl_outstream); + printed_len += 2; + s++; +#if defined (HANDLE_MULTIBYTE) + memset (&ps, 0, sizeof (mbstate_t)); +#endif + } + else + { +#if defined (HANDLE_MULTIBYTE) + tlen = mbrlen (s, end - s, &ps); + if (MB_INVALIDCH (tlen)) + { + tlen = 1; + memset (&ps, 0, sizeof (mbstate_t)); + } + else if (MB_NULLWCH (tlen)) + break; + fwrite (s, 1, tlen, rl_outstream); + s += tlen; +#else + putc (*s, rl_outstream); + s++; +#endif + printed_len++; + } + } + + return printed_len; +} + /* Output TO_PRINT to rl_outstream. If VISIBLE_STATS is defined and we are using it, check for and output a single character for `special' filenames. Return the number of characters we output. */ -#define PUTX(c) \ - do { \ - if (CTRL_CHAR (c)) \ - { \ - putc ('^', rl_outstream); \ - putc (UNCTRL (c), rl_outstream); \ - printed_len += 2; \ - } \ - else if (c == RUBOUT) \ - { \ - putc ('^', rl_outstream); \ - putc ('?', rl_outstream); \ - printed_len += 2; \ - } \ - else \ - { \ - putc (c, rl_outstream); \ - printed_len++; \ - } \ - } while (0) - static int print_filename (to_print, full_pathname) char *to_print, *full_pathname; { - int printed_len = 0; -#if !defined (VISIBLE_STATS) + int printed_len; char *s; - - for (s = to_print; *s; s++) - { - PUTX (*s); - } -#else - char *s, c, *new_full_pathname; +#if defined (VISIBLE_STATS) + char c, *new_full_pathname; int extension_char, slen, tlen; +#endif - for (s = to_print; *s; s++) - { - PUTX (*s); - } + printed_len = fnprint (to_print); +#if defined (VISIBLE_STATS) if (rl_filename_completion_desired && rl_visible_stats) { /* If to_print != full_pathname, to_print is the basename of the @@ -612,6 +709,7 @@ print_filename (to_print, full_pathname) } } #endif /* VISIBLE_STATS */ + return printed_len; } @@ -663,7 +761,14 @@ _rl_find_completion_word (fp, dp) quote substrings for the completer. Try to find the start of an unclosed quoted substring. */ /* FOUND_QUOTE is set so we know what kind of quotes we found. */ +#if defined (HANDLE_MULTIBYTE) + for (scan = pass_next = 0; scan < end; + scan = ((MB_CUR_MAX == 1 || rl_byte_oriented) + ? (scan + 1) + : _rl_find_next_mbchar (rl_line_buffer, scan, 1, MB_FIND_ANY))) +#else for (scan = pass_next = 0; scan < end; scan++) +#endif { if (pass_next) { @@ -1203,7 +1308,7 @@ display_matches (matches) for (max = 0, i = 1; matches[i]; i++) { temp = printable_part (matches[i]); - len = strlen (temp); + len = fnwidth (temp); if (len > max) max = len; @@ -1449,7 +1554,9 @@ _rl_free_match_list (matches) TAB means do standard completion. `*' means insert all of the possible completions. `!' means to do standard completion, and list all possible completions if - there is more than one. */ + there is more than one. + `@' means to do standard completion, and list all possible completions if + there is more than one and partial completion is not possible. */ int rl_complete_internal (what_to_do) int what_to_do; @@ -1516,6 +1623,7 @@ rl_complete_internal (what_to_do) { case TAB: case '!': + case '@': /* Insert the first match with proper quoting. */ if (*matches[0]) insert_match (matches[0], start, matches[1] ? MULT_MATCH : SINGLE_MATCH, "e_char); @@ -1535,6 +1643,12 @@ rl_complete_internal (what_to_do) display_matches (matches); break; } + else if (what_to_do == '@') + { + if (nontrivial_lcd == 0) + display_matches (matches); + break; + } else if (rl_editing_mode != vi_mode) rl_ding (); /* There are other matches remaining. */ } diff --git a/lib/readline/display.c b/lib/readline/display.c index 5150ea6a..c1cd9544 100644 --- a/lib/readline/display.c +++ b/lib/readline/display.c @@ -70,7 +70,7 @@ static void insert_some_chars PARAMS((char *, int, int)); static void cr PARAMS((void)); #if defined (HANDLE_MULTIBYTE) -static int _rl_col_width PARAMS((char *, int, int)); +static int _rl_col_width PARAMS((const char *, int, int)); static int *_rl_wrapped_line; #else # define _rl_col_width(l, s, e) (((e) <= (s)) ? 0 : (e) - (s)) @@ -586,7 +586,7 @@ rl_redisplay () #if defined (HANDLE_MULTIBYTE) if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) { - if (wc_bytes == (size_t)-1 || wc_bytes == (size_t)-2) + if (MB_INVALIDCH (wc_bytes)) { /* Byte sequence is invalid or shortened. Assume that the first byte represents a character. */ @@ -595,12 +595,12 @@ rl_redisplay () wc_width = 1; memset (&ps, 0, sizeof (mbstate_t)); } - else if (wc_bytes == (size_t)0) + else if (MB_NULLWCH (wc_bytes)) break; /* Found '\0' */ else { temp = wcwidth (wc); - wc_width = (temp < 0) ? 1 : temp; + wc_width = (temp >= 0) ? temp : 1; } } #endif @@ -1069,12 +1069,12 @@ update_line (old, new, current_line, omax, nmax, inv_botlin) memset (&ps, 0, sizeof (mbstate_t)); ret = mbrtowc (&wc, new, MB_CUR_MAX, &ps); - if (ret == (size_t)-1 || ret == (size_t)-2) + if (MB_INVALIDCH (ret)) { tempwidth = 1; ret = 1; } - else if (ret == 0) + else if (MB_NULLWCH (ret)) tempwidth = 0; else tempwidth = wcwidth (wc); @@ -1091,7 +1091,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin) ret = mbrtowc (&wc, old, MB_CUR_MAX, &ps); if (ret != 0 && bytes != 0) { - if (ret == (size_t)-1 || ret == (size_t)-2) + if (MB_INVALIDCH (ret)) memmove (old+bytes, old+1, strlen (old+1)); else memmove (old+bytes, old+ret, strlen (old+ret)); @@ -1129,15 +1129,23 @@ update_line (old, new, current_line, omax, nmax, inv_botlin) memset (&ps_new, 0, sizeof(mbstate_t)); memset (&ps_old, 0, sizeof(mbstate_t)); - new_offset = old_offset = 0; - for (ofd = old, nfd = new; - (ofd - old < omax) && *ofd && - _rl_compare_chars(old, old_offset, &ps_old, new, new_offset, &ps_new); ) + if (omax == nmax && STREQN (new, old, omax)) { - old_offset = _rl_find_next_mbchar (old, old_offset, 1, MB_FIND_ANY); - new_offset = _rl_find_next_mbchar (new, new_offset, 1, MB_FIND_ANY); - ofd = old + old_offset; - nfd = new + new_offset; + ofd = old + omax; + nfd = new + nmax; + } + else + { + new_offset = old_offset = 0; + for (ofd = old, nfd = new; + (ofd - old < omax) && *ofd && + _rl_compare_chars(old, old_offset, &ps_old, new, new_offset, &ps_new); ) + { + old_offset = _rl_find_next_mbchar (old, old_offset, 1, MB_FIND_ANY); + new_offset = _rl_find_next_mbchar (new, new_offset, 1, MB_FIND_ANY); + ofd = old + old_offset; + nfd = new + new_offset; + } } } else @@ -1169,8 +1177,11 @@ update_line (old, new, current_line, omax, nmax, inv_botlin) memset (&ps_old, 0, sizeof (mbstate_t)); memset (&ps_new, 0, sizeof (mbstate_t)); +#if 0 + /* On advice from jir@yamato.ibm.com */ _rl_adjust_point (old, ols - old, &ps_old); _rl_adjust_point (new, nls - new, &ps_new); +#endif if (_rl_compare_chars (old, ols - old, &ps_old, new, nls - new, &ps_new) == 0) break; @@ -1324,7 +1335,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin) insert_some_chars (nfd, lendiff, col_lendiff); _rl_last_c_pos += col_lendiff; } - else if (*ols == 0) + else if (*ols == 0 && lendiff > 0) { /* At the end of a line the characters do not have to be "inserted". They can just be placed on the screen. */ @@ -1348,9 +1359,9 @@ update_line (old, new, current_line, omax, nmax, inv_botlin) { _rl_output_some_chars (nfd + lendiff, temp - lendiff); #if 0 - _rl_last_c_pos += _rl_col_width (nfd+lendiff, 0, temp-lendiff) - col_lendiff; -#else _rl_last_c_pos += _rl_col_width (nfd+lendiff, 0, temp-col_lendiff); +#else + _rl_last_c_pos += _rl_col_width (nfd+lendiff, 0, temp-lendiff); #endif } } @@ -1510,8 +1521,15 @@ _rl_move_cursor_relative (new, data) #if defined (HANDLE_MULTIBYTE) /* If we have multibyte characters, NEW is indexed by the buffer point in a multibyte string, but _rl_last_c_pos is the display position. In - this case, NEW's display position is not obvious. */ - if ((MB_CUR_MAX == 1 || rl_byte_oriented ) && _rl_last_c_pos == new) return; + this case, NEW's display position is not obvious and must be + calculated. */ + if (MB_CUR_MAX == 1 || rl_byte_oriented) + { + if (_rl_last_c_pos == new) + return; + } + else if (_rl_last_c_pos == _rl_col_width (data, 0, new)) + return; #else if (_rl_last_c_pos == new) return; #endif @@ -1594,11 +1612,7 @@ _rl_move_cursor_relative (new, data) #endif { if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) - { - tputs (_rl_term_cr, 1, _rl_output_character_function); - for (i = 0; i < new; i++) - putc (data[i], rl_outstream); - } + _rl_backspace (_rl_last_c_pos - _rl_col_width (data, 0, new)); else _rl_backspace (_rl_last_c_pos - new); } @@ -1764,10 +1778,13 @@ rl_reset_line_state () return 0; } +/* These are getting numerous enough that it's time to create a struct. */ + static char *saved_local_prompt; static char *saved_local_prefix; static int saved_last_invisible; static int saved_visible_length; +static int saved_invis_chars_first_line; void rl_save_prompt () @@ -1776,9 +1793,11 @@ rl_save_prompt () saved_local_prefix = local_prompt_prefix; saved_last_invisible = prompt_last_invisible; saved_visible_length = prompt_visible_length; + saved_invis_chars_first_line = prompt_invis_chars_first_line; local_prompt = local_prompt_prefix = (char *)0; prompt_last_invisible = prompt_visible_length = 0; + prompt_invis_chars_first_line = 0; } void @@ -1791,6 +1810,7 @@ rl_restore_prompt () local_prompt_prefix = saved_local_prefix; prompt_last_invisible = saved_last_invisible; prompt_visible_length = saved_visible_length; + prompt_invis_chars_first_line = saved_invis_chars_first_line; } char * @@ -2117,7 +2137,7 @@ _rl_current_display_line () scan from the beginning of the string to take the state into account. */ static int _rl_col_width (str, start, end) - char *str; + const char *str; int start, end; { wchar_t wc; @@ -2133,7 +2153,7 @@ _rl_col_width (str, start, end) while (point < start) { tmp = mbrlen (str + point, max, &ps); - if ((size_t)tmp == (size_t)-1 || (size_t)tmp == (size_t)-2) + if (MB_INVALIDCH ((size_t)tmp)) { /* In this case, the bytes are invalid or too short to compose a multibyte character, so we assume that the first byte represents @@ -2145,7 +2165,7 @@ _rl_col_width (str, start, end) effect of mbstate is undefined. */ memset (&ps, 0, sizeof (mbstate_t)); } - else if (tmp == 0) + else if (MB_NULLWCH (tmp)) break; /* Found '\0' */ else { @@ -2162,7 +2182,7 @@ _rl_col_width (str, start, end) while (point < end) { tmp = mbrtowc (&wc, str + point, max, &ps); - if ((size_t)tmp == (size_t)-1 || (size_t)tmp == (size_t)-2) + if (MB_INVALIDCH ((size_t)tmp)) { /* In this case, the bytes are invalid or too short to compose a multibyte character, so we assume that the first byte represents @@ -2177,7 +2197,7 @@ _rl_col_width (str, start, end) effect of mbstate is undefined. */ memset (&ps, 0, sizeof (mbstate_t)); } - else if (tmp == 0) + else if (MB_NULLWCH (tmp)) break; /* Found '\0' */ else { @@ -2193,4 +2213,3 @@ _rl_col_width (str, start, end) return width; } #endif /* HANDLE_MULTIBYTE */ - diff --git a/lib/readline/doc/Makefile b/lib/readline/doc/Makefile index 32f22280..817c2af6 100644 --- a/lib/readline/doc/Makefile +++ b/lib/readline/doc/Makefile @@ -49,11 +49,11 @@ QUIETPS = #set this to -q to shut up dvips PSDPI = 300 # I don't have any 600-dpi printers DVIPS = dvips -D ${PSDPI} $(QUIETPS) -o $@ # tricky -RLSRC = $(srcdir)/rlman.texinfo $(srcdir)/rluser.texinfo \ - $(srcdir)/rltech.texinfo $(srcdir)/manvers.texinfo \ - $(srcdir)/rluserman.texinfo -HISTSRC = $(srcdir)/hist.texinfo $(srcdir)/hsuser.texinfo \ - $(srcdir)/hstech.texinfo $(srcdir)/manvers.texinfo +RLSRC = $(srcdir)/rlman.texi $(srcdir)/rluser.texi \ + $(srcdir)/rltech.texi $(srcdir)/version.texi \ + $(srcdir)/rluserman.texi +HISTSRC = $(srcdir)/history.texi $(srcdir)/hsuser.texi \ + $(srcdir)/hstech.texi $(srcdir)/version.texi # This should be a program that converts troff to an ascii-readable format NROFF = groff -Tascii @@ -66,7 +66,7 @@ INFOOBJ = readline.info history.info rluserman.info PSOBJ = readline.ps history.ps rluserman.ps HTMLOBJ = readline.html history.html rluserman.html -INTERMEDIATE_OBJ = rlman.dvi hist.dvi rluserman.dvi +INTERMEDIATE_OBJ = rlman.dvi CREATED_DOCS = $(DVIOBJ) $(INFOOBJ) $(PSOBJ) $(HTMLOBJ) @@ -76,24 +76,23 @@ all: info dvi html ps nodvi: info html readline.dvi: $(RLSRC) - TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/rlman.texinfo + TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/rlman.texi mv rlman.dvi readline.dvi readline.info: $(RLSRC) - $(MAKEINFO) --no-split -I $(TEXINPUTDIR) -o $@ $(srcdir)/rlman.texinfo + $(MAKEINFO) --no-split -I $(TEXINPUTDIR) -o $@ $(srcdir)/rlman.texi rluserman.dvi: $(RLSRC) - TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/rluserman.texinfo + TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/rluserman.texi rluserman.info: $(RLSRC) - $(MAKEINFO) --no-split -I $(TEXINPUTDIR) -o $@ $(srcdir)/rluserman.texinfo + $(MAKEINFO) --no-split -I $(TEXINPUTDIR) -o $@ $(srcdir)/rluserman.texi history.dvi: ${HISTSRC} - TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/hist.texinfo - mv hist.dvi history.dvi + TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/history.texi history.info: ${HISTSRC} - $(MAKEINFO) --no-split -I $(TEXINPUTDIR) -o $@ $(srcdir)/hist.texinfo + $(MAKEINFO) --no-split -I $(TEXINPUTDIR) -o $@ $(srcdir)/history.texi readline.ps: readline.dvi $(RM) $@ @@ -108,17 +107,15 @@ history.ps: history.dvi $(DVIPS) history.dvi readline.html: ${RLSRC} - $(TEXI2HTML) -menu -monolithic -I $(TEXINPUTDIR) $(srcdir)/rlman.texinfo + $(TEXI2HTML) -menu -monolithic -I $(TEXINPUTDIR) $(srcdir)/rlman.texi sed -e 's:rlman.html:readline.html:' rlman.html > readline.html $(RM) rlman.html rluserman.html: ${RLSRC} - $(TEXI2HTML) -menu -monolithic -I $(TEXINPUTDIR) $(srcdir)/rluserman.texinfo + $(TEXI2HTML) -menu -monolithic -I $(TEXINPUTDIR) $(srcdir)/rluserman.texi history.html: ${HISTSRC} - $(TEXI2HTML) -menu -monolithic -I $(TEXINPUTDIR) $(srcdir)/hist.texinfo - sed -e 's:hist.html:history.html:' hist.html > history.html - $(RM) hist.html + $(TEXI2HTML) -menu -monolithic -I $(TEXINPUTDIR) $(srcdir)/history.texi info: $(INFOOBJ) dvi: $(DVIOBJ) diff --git a/lib/readline/doc/fdl.texi b/lib/readline/doc/fdl.texi new file mode 100644 index 00000000..47ead9f0 --- /dev/null +++ b/lib/readline/doc/fdl.texi @@ -0,0 +1,452 @@ + +@node GNU Free Documentation License +@appendixsec GNU Free Documentation License + +@cindex FDL, GNU Free Documentation License +@center Version 1.2, November 2002 + +@display +Copyright @copyright{} 2000,2001,2002 Free Software Foundation, Inc. +59 Temple Place, Suite 330, Boston, MA 02111-1307, USA + +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. +@end display + +@enumerate 0 +@item +PREAMBLE + +The purpose of this License is to make a manual, textbook, or other +functional and useful document @dfn{free} in the sense of freedom: to +assure everyone the effective freedom to copy and redistribute it, +with or without modifying it, either commercially or noncommercially. +Secondarily, this License preserves for the author and publisher a way +to get credit for their work, while not being considered responsible +for modifications made by others. + +This License is a kind of ``copyleft'', which means that derivative +works of the document must themselves be free in the same sense. It +complements the GNU General Public License, which is a copyleft +license designed for free software. + +We have designed this License in order to use it for manuals for free +software, because free software needs free documentation: a free +program should come with manuals providing the same freedoms that the +software does. But this License is not limited to software manuals; +it can be used for any textual work, regardless of subject matter or +whether it is published as a printed book. We recommend this License +principally for works whose purpose is instruction or reference. + +@item +APPLICABILITY AND DEFINITIONS + +This License applies to any manual or other work, in any medium, that +contains a notice placed by the copyright holder saying it can be +distributed under the terms of this License. Such a notice grants a +world-wide, royalty-free license, unlimited in duration, to use that +work under the conditions stated herein. The ``Document'', below, +refers to any such manual or work. Any member of the public is a +licensee, and is addressed as ``you''. You accept the license if you +copy, modify or distribute the work in a way requiring permission +under copyright law. + +A ``Modified Version'' of the Document means any work containing the +Document or a portion of it, either copied verbatim, or with +modifications and/or translated into another language. + +A ``Secondary Section'' is a named appendix or a front-matter section +of the Document that deals exclusively with the relationship of the +publishers or authors of the Document to the Document's overall +subject (or to related matters) and contains nothing that could fall +directly within that overall subject. (Thus, if the Document is in +part a textbook of mathematics, a Secondary Section may not explain +any mathematics.) The relationship could be a matter of historical +connection with the subject or with related matters, or of legal, +commercial, philosophical, ethical or political position regarding +them. + +The ``Invariant Sections'' are certain Secondary Sections whose titles +are designated, as being those of Invariant Sections, in the notice +that says that the Document is released under this License. If a +section does not fit the above definition of Secondary then it is not +allowed to be designated as Invariant. The Document may contain zero +Invariant Sections. If the Document does not identify any Invariant +Sections then there are none. + +The ``Cover Texts'' are certain short passages of text that are listed, +as Front-Cover Texts or Back-Cover Texts, in the notice that says that +the Document is released under this License. A Front-Cover Text may +be at most 5 words, and a Back-Cover Text may be at most 25 words. + +A ``Transparent'' copy of the Document means a machine-readable copy, +represented in a format whose specification is available to the +general public, that is suitable for revising the document +straightforwardly with generic text editors or (for images composed of +pixels) generic paint programs or (for drawings) some widely available +drawing editor, and that is suitable for input to text formatters or +for automatic translation to a variety of formats suitable for input +to text formatters. A copy made in an otherwise Transparent file +format whose markup, or absence of markup, has been arranged to thwart +or discourage subsequent modification by readers is not Transparent. +An image format is not Transparent if used for any substantial amount +of text. A copy that is not ``Transparent'' is called ``Opaque''. + +Examples of suitable formats for Transparent copies include plain +@sc{ascii} without markup, Texinfo input format, La@TeX{} input +format, @acronym{SGML} or @acronym{XML} using a publicly available +@acronym{DTD}, and standard-conforming simple @acronym{HTML}, +PostScript or @acronym{PDF} designed for human modification. Examples +of transparent image formats include @acronym{PNG}, @acronym{XCF} and +@acronym{JPG}. Opaque formats include proprietary formats that can be +read and edited only by proprietary word processors, @acronym{SGML} or +@acronym{XML} for which the @acronym{DTD} and/or processing tools are +not generally available, and the machine-generated @acronym{HTML}, +PostScript or @acronym{PDF} produced by some word processors for +output purposes only. + +The ``Title Page'' means, for a printed book, the title page itself, +plus such following pages as are needed to hold, legibly, the material +this License requires to appear in the title page. For works in +formats which do not have any title page as such, ``Title Page'' means +the text near the most prominent appearance of the work's title, +preceding the beginning of the body of the text. + +A section ``Entitled XYZ'' means a named subunit of the Document whose +title either is precisely XYZ or contains XYZ in parentheses following +text that translates XYZ in another language. (Here XYZ stands for a +specific section name mentioned below, such as ``Acknowledgements'', +``Dedications'', ``Endorsements'', or ``History''.) To ``Preserve the Title'' +of such a section when you modify the Document means that it remains a +section ``Entitled XYZ'' according to this definition. + +The Document may include Warranty Disclaimers next to the notice which +states that this License applies to the Document. These Warranty +Disclaimers are considered to be included by reference in this +License, but only as regards disclaiming warranties: any other +implication that these Warranty Disclaimers may have is void and has +no effect on the meaning of this License. + +@item +VERBATIM COPYING + +You may copy and distribute the Document in any medium, either +commercially or noncommercially, provided that this License, the +copyright notices, and the license notice saying this License applies +to the Document are reproduced in all copies, and that you add no other +conditions whatsoever to those of this License. You may not use +technical measures to obstruct or control the reading or further +copying of the copies you make or distribute. However, you may accept +compensation in exchange for copies. If you distribute a large enough +number of copies you must also follow the conditions in section 3. + +You may also lend copies, under the same conditions stated above, and +you may publicly display copies. + +@item +COPYING IN QUANTITY + +If you publish printed copies (or copies in media that commonly have +printed covers) of the Document, numbering more than 100, and the +Document's license notice requires Cover Texts, you must enclose the +copies in covers that carry, clearly and legibly, all these Cover +Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on +the back cover. Both covers must also clearly and legibly identify +you as the publisher of these copies. The front cover must present +the full title with all words of the title equally prominent and +visible. You may add other material on the covers in addition. +Copying with changes limited to the covers, as long as they preserve +the title of the Document and satisfy these conditions, can be treated +as verbatim copying in other respects. + +If the required texts for either cover are too voluminous to fit +legibly, you should put the first ones listed (as many as fit +reasonably) on the actual cover, and continue the rest onto adjacent +pages. + +If you publish or distribute Opaque copies of the Document numbering +more than 100, you must either include a machine-readable Transparent +copy along with each Opaque copy, or state in or with each Opaque copy +a computer-network location from which the general network-using +public has access to download using public-standard network protocols +a complete Transparent copy of the Document, free of added material. +If you use the latter option, you must take reasonably prudent steps, +when you begin distribution of Opaque copies in quantity, to ensure +that this Transparent copy will remain thus accessible at the stated +location until at least one year after the last time you distribute an +Opaque copy (directly or through your agents or retailers) of that +edition to the public. + +It is requested, but not required, that you contact the authors of the +Document well before redistributing any large number of copies, to give +them a chance to provide you with an updated version of the Document. + +@item +MODIFICATIONS + +You may copy and distribute a Modified Version of the Document under +the conditions of sections 2 and 3 above, provided that you release +the Modified Version under precisely this License, with the Modified +Version filling the role of the Document, thus licensing distribution +and modification of the Modified Version to whoever possesses a copy +of it. In addition, you must do these things in the Modified Version: + +@enumerate A +@item +Use in the Title Page (and on the covers, if any) a title distinct +from that of the Document, and from those of previous versions +(which should, if there were any, be listed in the History section +of the Document). You may use the same title as a previous version +if the original publisher of that version gives permission. + +@item +List on the Title Page, as authors, one or more persons or entities +responsible for authorship of the modifications in the Modified +Version, together with at least five of the principal authors of the +Document (all of its principal authors, if it has fewer than five), +unless they release you from this requirement. + +@item +State on the Title page the name of the publisher of the +Modified Version, as the publisher. + +@item +Preserve all the copyright notices of the Document. + +@item +Add an appropriate copyright notice for your modifications +adjacent to the other copyright notices. + +@item +Include, immediately after the copyright notices, a license notice +giving the public permission to use the Modified Version under the +terms of this License, in the form shown in the Addendum below. + +@item +Preserve in that license notice the full lists of Invariant Sections +and required Cover Texts given in the Document's license notice. + +@item +Include an unaltered copy of this License. + +@item +Preserve the section Entitled ``History'', Preserve its Title, and add +to it an item stating at least the title, year, new authors, and +publisher of the Modified Version as given on the Title Page. If +there is no section Entitled ``History'' in the Document, create one +stating the title, year, authors, and publisher of the Document as +given on its Title Page, then add an item describing the Modified +Version as stated in the previous sentence. + +@item +Preserve the network location, if any, given in the Document for +public access to a Transparent copy of the Document, and likewise +the network locations given in the Document for previous versions +it was based on. These may be placed in the ``History'' section. +You may omit a network location for a work that was published at +least four years before the Document itself, or if the original +publisher of the version it refers to gives permission. + +@item +For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve +the Title of the section, and preserve in the section all the +substance and tone of each of the contributor acknowledgements and/or +dedications given therein. + +@item +Preserve all the Invariant Sections of the Document, +unaltered in their text and in their titles. Section numbers +or the equivalent are not considered part of the section titles. + +@item +Delete any section Entitled ``Endorsements''. Such a section +may not be included in the Modified Version. + +@item +Do not retitle any existing section to be Entitled ``Endorsements'' or +to conflict in title with any Invariant Section. + +@item +Preserve any Warranty Disclaimers. +@end enumerate + +If the Modified Version includes new front-matter sections or +appendices that qualify as Secondary Sections and contain no material +copied from the Document, you may at your option designate some or all +of these sections as invariant. To do this, add their titles to the +list of Invariant Sections in the Modified Version's license notice. +These titles must be distinct from any other section titles. + +You may add a section Entitled ``Endorsements'', provided it contains +nothing but endorsements of your Modified Version by various +parties---for example, statements of peer review or that the text has +been approved by an organization as the authoritative definition of a +standard. + +You may add a passage of up to five words as a Front-Cover Text, and a +passage of up to 25 words as a Back-Cover Text, to the end of the list +of Cover Texts in the Modified Version. Only one passage of +Front-Cover Text and one of Back-Cover Text may be added by (or +through arrangements made by) any one entity. If the Document already +includes a cover text for the same cover, previously added by you or +by arrangement made by the same entity you are acting on behalf of, +you may not add another; but you may replace the old one, on explicit +permission from the previous publisher that added the old one. + +The author(s) and publisher(s) of the Document do not by this License +give permission to use their names for publicity for or to assert or +imply endorsement of any Modified Version. + +@item +COMBINING DOCUMENTS + +You may combine the Document with other documents released under this +License, under the terms defined in section 4 above for modified +versions, provided that you include in the combination all of the +Invariant Sections of all of the original documents, unmodified, and +list them all as Invariant Sections of your combined work in its +license notice, and that you preserve all their Warranty Disclaimers. + +The combined work need only contain one copy of this License, and +multiple identical Invariant Sections may be replaced with a single +copy. If there are multiple Invariant Sections with the same name but +different contents, make the title of each such section unique by +adding at the end of it, in parentheses, the name of the original +author or publisher of that section if known, or else a unique number. +Make the same adjustment to the section titles in the list of +Invariant Sections in the license notice of the combined work. + +In the combination, you must combine any sections Entitled ``History'' +in the various original documents, forming one section Entitled +``History''; likewise combine any sections Entitled ``Acknowledgements'', +and any sections Entitled ``Dedications''. You must delete all +sections Entitled ``Endorsements.'' + +@item +COLLECTIONS OF DOCUMENTS + +You may make a collection consisting of the Document and other documents +released under this License, and replace the individual copies of this +License in the various documents with a single copy that is included in +the collection, provided that you follow the rules of this License for +verbatim copying of each of the documents in all other respects. + +You may extract a single document from such a collection, and distribute +it individually under this License, provided you insert a copy of this +License into the extracted document, and follow this License in all +other respects regarding verbatim copying of that document. + +@item +AGGREGATION WITH INDEPENDENT WORKS + +A compilation of the Document or its derivatives with other separate +and independent documents or works, in or on a volume of a storage or +distribution medium, is called an ``aggregate'' if the copyright +resulting from the compilation is not used to limit the legal rights +of the compilation's users beyond what the individual works permit. +When the Document is included an aggregate, this License does not +apply to the other works in the aggregate which are not themselves +derivative works of the Document. + +If the Cover Text requirement of section 3 is applicable to these +copies of the Document, then if the Document is less than one half of +the entire aggregate, the Document's Cover Texts may be placed on +covers that bracket the Document within the aggregate, or the +electronic equivalent of covers if the Document is in electronic form. +Otherwise they must appear on printed covers that bracket the whole +aggregate. + +@item +TRANSLATION + +Translation is considered a kind of modification, so you may +distribute translations of the Document under the terms of section 4. +Replacing Invariant Sections with translations requires special +permission from their copyright holders, but you may include +translations of some or all Invariant Sections in addition to the +original versions of these Invariant Sections. You may include a +translation of this License, and all the license notices in the +Document, and any Warranty Disclaimers, provided that you also include +the original English version of this License and the original versions +of those notices and disclaimers. In case of a disagreement between +the translation and the original version of this License or a notice +or disclaimer, the original version will prevail. + +If a section in the Document is Entitled ``Acknowledgements'', +``Dedications'', or ``History'', the requirement (section 4) to Preserve +its Title (section 1) will typically require changing the actual +title. + +@item +TERMINATION + +You may not copy, modify, sublicense, or distribute the Document except +as expressly provided for under this License. Any other attempt to +copy, modify, sublicense or distribute the Document is void, and will +automatically terminate your rights under this License. However, +parties who have received copies, or rights, from you under this +License will not have their licenses terminated so long as such +parties remain in full compliance. + +@item +FUTURE REVISIONS OF THIS LICENSE + +The Free Software Foundation may publish new, revised versions +of the GNU Free Documentation License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. See +@uref{http://www.gnu.org/copyleft/}. + +Each version of the License is given a distinguishing version number. +If the Document specifies that a particular numbered version of this +License ``or any later version'' applies to it, you have the option of +following the terms and conditions either of that specified version or +of any later version that has been published (not as a draft) by the +Free Software Foundation. If the Document does not specify a version +number of this License, you may choose any version ever published (not +as a draft) by the Free Software Foundation. +@end enumerate + +@page +@appendixsubsec ADDENDUM: How to use this License for your documents + +To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and +license notices just after the title page: + +@smallexample +@group + Copyright (C) @var{year} @var{your name}. + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.2 + or any later version published by the Free Software Foundation; + with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. + A copy of the license is included in the section entitled ``GNU + Free Documentation License''. +@end group +@end smallexample + +If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, +replace the ``with...Texts.'' line with this: + +@smallexample +@group + with the Invariant Sections being @var{list their titles}, with + the Front-Cover Texts being @var{list}, and with the Back-Cover Texts + being @var{list}. +@end group +@end smallexample + +If you have Invariant Sections without Cover Texts, or some other +combination of the three, merge those two alternatives to suit the +situation. + +If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, +to permit their use in free software. + +@c Local Variables: +@c ispell-local-pdict: "ispell-dict" +@c End: + diff --git a/lib/readline/doc/history.texi b/lib/readline/doc/history.texi new file mode 100644 index 00000000..4bec927c --- /dev/null +++ b/lib/readline/doc/history.texi @@ -0,0 +1,104 @@ +\input texinfo @c -*-texinfo-*- +@c %**start of header (This is for running Texinfo on a region.) +@setfilename history.info +@settitle GNU History Library +@c %**end of header (This is for running Texinfo on a region.) + +@setchapternewpage odd + +@include version.texi + +@copying +This document describes the GNU History library +(version @value{VERSION}, @value{UPDATED}), +a programming tool that provides a consistent user interface for +recalling lines of previously typed input. + +Copyright @copyright{} 1988-2003 Free Software Foundation, Inc. + +Permission is granted to make and distribute verbatim copies of +this manual provided the copyright notice and this permission notice +are preserved on all copies. + +@quotation +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.1 or +any later version published by the Free Software Foundation; with no +Invariant Sections, with the Front-Cover texts being ``A GNU Manual,'' +and with the Back-Cover Texts as in (a) below. A copy of the license is +included in the section entitled ``GNU Free Documentation License.'' + +(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify +this GNU Manual, like GNU software. Copies published by the Free +Software Foundation raise funds for GNU development.'' +@end quotation +@end copying + +@dircategory Libraries +@direntry +* History: (history). The GNU history library API. +@end direntry + +@titlepage +@title GNU History Library +@subtitle Edition @value{EDITION}, for @code{History Library} Version @value{VERSION}. +@subtitle @value{UPDATED-MONTH} +@author Chet Ramey, Case Western Reserve University +@author Brian Fox, Free Software Foundation + +@page + +@vskip 0pt plus 1filll +@insertcopying + +@sp 1 +Published by the Free Software Foundation @* +59 Temple Place, Suite 330, @* +Boston, MA 02111-1307 @* +USA @* + +@end titlepage + +@contents + +@ifnottex +@node Top +@top GNU History Library + +This document describes the GNU History library, a programming tool that +provides a consistent user interface for recalling lines of previously +typed input. + +@menu +* Using History Interactively:: GNU History User's Manual. +* Programming with GNU History:: GNU History Programmer's Manual. +* Copying This Manual:: Copying This Manual. +* Concept Index:: Index of concepts described in this manual. +* Function and Variable Index:: Index of externally visible functions + and variables. +@end menu +@end ifnottex + +@syncodeindex fn vr + +@include hsuser.texi +@include hstech.texi + +@node Copying This Manual +@appendix Copying This Manual + +@menu +* GNU Free Documentation License:: License for copying this manual. +@end menu + +@include fdl.texi + +@node Concept Index +@appendix Concept Index +@printindex cp + +@node Function and Variable Index +@appendix Function and Variable Index +@printindex vr + +@bye diff --git a/lib/readline/doc/hstech.texi b/lib/readline/doc/hstech.texi new file mode 100644 index 00000000..4fdda5f1 --- /dev/null +++ b/lib/readline/doc/hstech.texi @@ -0,0 +1,573 @@ +@ignore +This file documents the user interface to the GNU History library. + +Copyright (C) 1988-2002 Free Software Foundation, Inc. +Authored by Brian Fox and Chet Ramey. + +Permission is granted to make and distribute verbatim copies of this manual +provided the copyright notice and this permission notice are preserved on +all copies. + +Permission is granted to process this file through Tex and print the +results, provided the printed document carries copying permission notice +identical to this one except for the removal of this paragraph (this +paragraph not being relevant to the printed manual). + +Permission is granted to copy and distribute modified versions of this +manual under the conditions for verbatim copying, provided also that the +GNU Copyright statement is available to the distributee, and provided that +the entire resulting derived work is distributed under the terms of a +permission 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. +@end ignore + +@node Programming with GNU History +@chapter Programming with GNU History + +This chapter describes how to interface programs that you write +with the @sc{gnu} History Library. +It should be considered a technical guide. +For information on the interactive use of @sc{gnu} History, @pxref{Using +History Interactively}. + +@menu +* Introduction to History:: What is the GNU History library for? +* History Storage:: How information is stored. +* History Functions:: Functions that you can use. +* History Variables:: Variables that control behaviour. +* History Programming Example:: Example of using the GNU History Library. +@end menu + +@node Introduction to History +@section Introduction to History + +Many programs read input from the user a line at a time. The @sc{gnu} +History library is able to keep track of those lines, associate arbitrary +data with each line, and utilize information from previous lines in +composing new ones. + +The programmer using the History library has available functions +for remembering lines on a history list, associating arbitrary data +with a line, removing lines from the list, searching through the list +for a line containing an arbitrary text string, and referencing any line +in the list directly. In addition, a history @dfn{expansion} function +is available which provides for a consistent user interface across +different programs. + +The user using programs written with the History library has the +benefit of a consistent user interface with a set of well-known +commands for manipulating the text of previous lines and using that text +in new commands. The basic history manipulation commands are similar to +the history substitution provided by @code{csh}. + +If the programmer desires, he can use the Readline library, which +includes some history manipulation by default, and has the added +advantage of command line editing. + +Before declaring any functions using any functionality the History +library provides in other code, an application writer should include +the file @code{<readline/history.h>} in any file that uses the +History library's features. It supplies extern declarations for all +of the library's public functions and variables, and declares all of +the public data structures. + +@node History Storage +@section History Storage + +The history list is an array of history entries. A history entry is +declared as follows: + +@example +typedef void *histdata_t; + +typedef struct _hist_entry @{ + char *line; + char *timestamp; + histdata_t data; +@} HIST_ENTRY; +@end example + +The history list itself might therefore be declared as + +@example +HIST_ENTRY **the_history_list; +@end example + +The state of the History library is encapsulated into a single structure: + +@example +/* + * A structure used to pass around the current state of the history. + */ +typedef struct _hist_state @{ + HIST_ENTRY **entries; /* Pointer to the entries themselves. */ + int offset; /* The location pointer within this array. */ + int length; /* Number of elements within this array. */ + int size; /* Number of slots allocated to this array. */ + int flags; +@} HISTORY_STATE; +@end example + +If the flags member includes @code{HS_STIFLED}, the history has been +stifled. + +@node History Functions +@section History Functions + +This section describes the calling sequence for the various functions +exported by the @sc{gnu} History library. + +@menu +* Initializing History and State Management:: Functions to call when you + want to use history in a + program. +* History List Management:: Functions used to manage the list + of history entries. +* Information About the History List:: Functions returning information about + the history list. +* Moving Around the History List:: Functions used to change the position + in the history list. +* Searching the History List:: Functions to search the history list + for entries containing a string. +* Managing the History File:: Functions that read and write a file + containing the history list. +* History Expansion:: Functions to perform csh-like history + expansion. +@end menu + +@node Initializing History and State Management +@subsection Initializing History and State Management + +This section describes functions used to initialize and manage +the state of the History library when you want to use the history +functions in your program. + +@deftypefun void using_history (void) +Begin a session in which the history functions might be used. This +initializes the interactive variables. +@end deftypefun + +@deftypefun {HISTORY_STATE *} history_get_history_state (void) +Return a structure describing the current state of the input history. +@end deftypefun + +@deftypefun void history_set_history_state (HISTORY_STATE *state) +Set the state of the history list according to @var{state}. +@end deftypefun + +@node History List Management +@subsection History List Management + +These functions manage individual entries on the history list, or set +parameters managing the list itself. + +@deftypefun void add_history (const char *string) +Place @var{string} at the end of the history list. The associated data +field (if any) is set to @code{NULL}. +@end deftypefun + +@deftypefun void add_history_time (const char *string) +Change the time stamp associated with the most recent history entry to +@var{string}. +@end deftypefun + +@deftypefun {HIST_ENTRY *} remove_history (int which) +Remove history entry at offset @var{which} from the history. The +removed element is returned so you can free the line, data, +and containing structure. +@end deftypefun + +@deftypefun {histdata_t} free_history_entry (HIST_ENTRY *histent) +Free the history entry @var{histent} and any history library private +data associated with it. Returns the application-specific data +so the caller can dispose of it. +@end deftypefun + +@deftypefun {HIST_ENTRY *} replace_history_entry (int which, const char *line, histdata_t data) +Make the history entry at offset @var{which} have @var{line} and @var{data}. +This returns the old entry so the caller can dispose of any +application-specific data. In the case +of an invalid @var{which}, a @code{NULL} pointer is returned. +@end deftypefun + +@deftypefun void clear_history (void) +Clear the history list by deleting all the entries. +@end deftypefun + +@deftypefun void stifle_history (int max) +Stifle the history list, remembering only the last @var{max} entries. +@end deftypefun + +@deftypefun int unstifle_history (void) +Stop stifling the history. This returns the previously-set +maximum number of history entries (as set by @code{stifle_history()}). +The value is positive if the history was +stifled, negative if it wasn't. +@end deftypefun + +@deftypefun int history_is_stifled (void) +Returns non-zero if the history is stifled, zero if it is not. +@end deftypefun + +@node Information About the History List +@subsection Information About the History List + +These functions return information about the entire history list or +individual list entries. + +@deftypefun {HIST_ENTRY **} history_list (void) +Return a @code{NULL} terminated array of @code{HIST_ENTRY *} which is the +current input history. Element 0 of this list is the beginning of time. +If there is no history, return @code{NULL}. +@end deftypefun + +@deftypefun int where_history (void) +Returns the offset of the current history element. +@end deftypefun + +@deftypefun {HIST_ENTRY *} current_history (void) +Return the history entry at the current position, as determined by +@code{where_history()}. If there is no entry there, return a @code{NULL} +pointer. +@end deftypefun + +@deftypefun {HIST_ENTRY *} history_get (int offset) +Return the history entry at position @var{offset}, starting from +@code{history_base} (@pxref{History Variables}). +If there is no entry there, or if @var{offset} +is greater than the history length, return a @code{NULL} pointer. +@end deftypefun + +@deftypefun time_t history_get_time (HIST_ENTRY *entry) +Return the time stamp associated with the history entry @var{entry}. +@end deftypefun + +@deftypefun int history_total_bytes (void) +Return the number of bytes that the primary history entries are using. +This function returns the sum of the lengths of all the lines in the +history. +@end deftypefun + +@node Moving Around the History List +@subsection Moving Around the History List + +These functions allow the current index into the history list to be +set or changed. + +@deftypefun int history_set_pos (int pos) +Set the current history offset to @var{pos}, an absolute index +into the list. +Returns 1 on success, 0 if @var{pos} is less than zero or greater +than the number of history entries. +@end deftypefun + +@deftypefun {HIST_ENTRY *} previous_history (void) +Back up the current history offset to the previous history entry, and +return a pointer to that entry. If there is no previous entry, return +a @code{NULL} pointer. +@end deftypefun + +@deftypefun {HIST_ENTRY *} next_history (void) +Move the current history offset forward to the next history entry, and +return the a pointer to that entry. If there is no next entry, return +a @code{NULL} pointer. +@end deftypefun + +@node Searching the History List +@subsection Searching the History List +@cindex History Searching + +These functions allow searching of the history list for entries containing +a specific string. Searching may be performed both forward and backward +from the current history position. The search may be @dfn{anchored}, +meaning that the string must match at the beginning of the history entry. +@cindex anchored search + +@deftypefun int history_search (const char *string, int direction) +Search the history for @var{string}, starting at the current history offset. +If @var{direction} is less than 0, then the search is through +previous entries, otherwise through subsequent entries. +If @var{string} is found, then +the current history index is set to that history entry, and the value +returned is the offset in the line of the entry where +@var{string} was found. Otherwise, nothing is changed, and a -1 is +returned. +@end deftypefun + +@deftypefun int history_search_prefix (const char *string, int direction) +Search the history for @var{string}, starting at the current history +offset. The search is anchored: matching lines must begin with +@var{string}. If @var{direction} is less than 0, then the search is +through previous entries, otherwise through subsequent entries. +If @var{string} is found, then the +current history index is set to that entry, and the return value is 0. +Otherwise, nothing is changed, and a -1 is returned. +@end deftypefun + +@deftypefun int history_search_pos (const char *string, int direction, int pos) +Search for @var{string} in the history list, starting at @var{pos}, an +absolute index into the list. If @var{direction} is negative, the search +proceeds backward from @var{pos}, otherwise forward. Returns the absolute +index of the history element where @var{string} was found, or -1 otherwise. +@end deftypefun + +@node Managing the History File +@subsection Managing the History File + +The History library can read the history from and write it to a file. +This section documents the functions for managing a history file. + +@deftypefun int read_history (const char *filename) +Add the contents of @var{filename} to the history list, a line at a time. +If @var{filename} is @code{NULL}, then read from @file{~/.history}. +Returns 0 if successful, or @code{errno} if not. +@end deftypefun + +@deftypefun int read_history_range (const char *filename, int from, int to) +Read a range of lines from @var{filename}, adding them to the history list. +Start reading at line @var{from} and end at @var{to}. +If @var{from} is zero, start at the beginning. If @var{to} is less than +@var{from}, then read until the end of the file. If @var{filename} is +@code{NULL}, then read from @file{~/.history}. Returns 0 if successful, +or @code{errno} if not. +@end deftypefun + +@deftypefun int write_history (const char *filename) +Write the current history to @var{filename}, overwriting @var{filename} +if necessary. +If @var{filename} is @code{NULL}, then write the history list to +@file{~/.history}. +Returns 0 on success, or @code{errno} on a read or write error. +@end deftypefun + +@deftypefun int append_history (int nelements, const char *filename) +Append the last @var{nelements} of the history list to @var{filename}. +If @var{filename} is @code{NULL}, then append to @file{~/.history}. +Returns 0 on success, or @code{errno} on a read or write error. +@end deftypefun + +@deftypefun int history_truncate_file (const char *filename, int nlines) +Truncate the history file @var{filename}, leaving only the last +@var{nlines} lines. +If @var{filename} is @code{NULL}, then @file{~/.history} is truncated. +Returns 0 on success, or @code{errno} on failure. +@end deftypefun + +@node History Expansion +@subsection History Expansion + +These functions implement history expansion. + +@deftypefun int history_expand (char *string, char **output) +Expand @var{string}, placing the result into @var{output}, a pointer +to a string (@pxref{History Interaction}). Returns: +@table @code +@item 0 +If no expansions took place (or, if the only change in +the text was the removal of escape characters preceding the history expansion +character); +@item 1 +if expansions did take place; +@item -1 +if there was an error in expansion; +@item 2 +if the returned line should be displayed, but not executed, +as with the @code{:p} modifier (@pxref{Modifiers}). +@end table + +If an error ocurred in expansion, then @var{output} contains a descriptive +error message. +@end deftypefun + +@deftypefun {char *} get_history_event (const char *string, int *cindex, int qchar) +Returns the text of the history event beginning at @var{string} + +@var{*cindex}. @var{*cindex} is modified to point to after the event +specifier. At function entry, @var{cindex} points to the index into +@var{string} where the history event specification begins. @var{qchar} +is a character that is allowed to end the event specification in addition +to the ``normal'' terminating characters. +@end deftypefun + +@deftypefun {char **} history_tokenize (const char *string) +Return an array of tokens parsed out of @var{string}, much as the +shell might. The tokens are split on the characters in the +@var{history_word_delimiters} variable, +and shell quoting conventions are obeyed. +@end deftypefun + +@deftypefun {char *} history_arg_extract (int first, int last, const char *string) +Extract a string segment consisting of the @var{first} through @var{last} +arguments present in @var{string}. Arguments are split using +@code{history_tokenize}. +@end deftypefun + +@node History Variables +@section History Variables + +This section describes the externally-visible variables exported by +the @sc{gnu} History Library. + +@deftypevar int history_base +The logical offset of the first entry in the history list. +@end deftypevar + +@deftypevar int history_length +The number of entries currently stored in the history list. +@end deftypevar + +@deftypevar int history_max_entries +The maximum number of history entries. This must be changed using +@code{stifle_history()}. +@end deftypevar + +@deftypevar int history_write_timestamps +If non-zero, timestamps are written to the history file, so they can be +preserved between sessions. The default value is 0, meaning that +timestamps are not saved. +@end deftypevar + +@deftypevar char history_expansion_char +The character that introduces a history event. The default is @samp{!}. +Setting this to 0 inhibits history expansion. +@end deftypevar + +@deftypevar char history_subst_char +The character that invokes word substitution if found at the start of +a line. The default is @samp{^}. +@end deftypevar + +@deftypevar char history_comment_char +During tokenization, if this character is seen as the first character +of a word, then it and all subsequent characters up to a newline are +ignored, suppressing history expansion for the remainder of the line. +This is disabled by default. +@end deftypevar + +@deftypevar {char *} history_word_delimiters +The characters that separate tokens for @code{history_tokenize()}. +The default value is @code{" \t\n()<>;&|"}. +@end deftypevar + +@deftypevar {char *} history_search_delimiter_chars +The list of additional characters which can delimit a history search +string, in addition to space, TAB, @samp{:} and @samp{?} in the case of +a substring search. The default is empty. +@end deftypevar + +@deftypevar {char *} history_no_expand_chars +The list of characters which inhibit history expansion if found immediately +following @var{history_expansion_char}. The default is space, tab, newline, +carriage return, and @samp{=}. +@end deftypevar + +@deftypevar int history_quotes_inhibit_expansion +If non-zero, single-quoted words are not scanned for the history expansion +character. The default value is 0. +@end deftypevar + +@deftypevar {rl_linebuf_func_t *} history_inhibit_expansion_function +This should be set to the address of a function that takes two arguments: +a @code{char *} (@var{string}) +and an @code{int} index into that string (@var{i}). +It should return a non-zero value if the history expansion starting at +@var{string[i]} should not be performed; zero if the expansion should +be done. +It is intended for use by applications like Bash that use the history +expansion character for additional purposes. +By default, this variable is set to @code{NULL}. +@end deftypevar + +@node History Programming Example +@section History Programming Example + +The following program demonstrates simple use of the @sc{gnu} History Library. + +@smallexample +#include <stdio.h> +#include <readline/history.h> + +main (argc, argv) + int argc; + char **argv; +@{ + char line[1024], *t; + int len, done = 0; + + line[0] = 0; + + using_history (); + while (!done) + @{ + printf ("history$ "); + fflush (stdout); + t = fgets (line, sizeof (line) - 1, stdin); + if (t && *t) + @{ + len = strlen (t); + if (t[len - 1] == '\n') + t[len - 1] = '\0'; + @} + + if (!t) + strcpy (line, "quit"); + + if (line[0]) + @{ + char *expansion; + int result; + + result = history_expand (line, &expansion); + if (result) + fprintf (stderr, "%s\n", expansion); + + if (result < 0 || result == 2) + @{ + free (expansion); + continue; + @} + + add_history (expansion); + strncpy (line, expansion, sizeof (line) - 1); + free (expansion); + @} + + if (strcmp (line, "quit") == 0) + done = 1; + else if (strcmp (line, "save") == 0) + write_history ("history_file"); + else if (strcmp (line, "read") == 0) + read_history ("history_file"); + else if (strcmp (line, "list") == 0) + @{ + register HIST_ENTRY **the_list; + register int i; + + the_list = history_list (); + if (the_list) + for (i = 0; the_list[i]; i++) + printf ("%d: %s\n", i + history_base, the_list[i]->line); + @} + else if (strncmp (line, "delete", 6) == 0) + @{ + int which; + if ((sscanf (line + 6, "%d", &which)) == 1) + @{ + HIST_ENTRY *entry = remove_history (which); + if (!entry) + fprintf (stderr, "No such entry %d\n", which); + else + @{ + free (entry->line); + free (entry); + @} + @} + else + @{ + fprintf (stderr, "non-numeric arg given to `delete'\n"); + @} + @} + @} +@} +@end smallexample diff --git a/lib/readline/doc/hsuser.texi b/lib/readline/doc/hsuser.texi new file mode 100644 index 00000000..6c891833 --- /dev/null +++ b/lib/readline/doc/hsuser.texi @@ -0,0 +1,457 @@ +@ignore +This file documents the user interface to the GNU History library. + +Copyright (C) 1988-2002 Free Software Foundation, Inc. +Authored by Brian Fox and Chet Ramey. + +Permission is granted to make and distribute verbatim copies of this manual +provided the copyright notice and this permission notice are preserved on +all copies. + +Permission is granted to process this file through Tex and print the +results, provided the printed document carries copying permission notice +identical to this one except for the removal of this paragraph (this +paragraph not being relevant to the printed manual). + +Permission is granted to copy and distribute modified versions of this +manual under the conditions for verbatim copying, provided also that the +GNU Copyright statement is available to the distributee, and provided that +the entire resulting derived work is distributed under the terms of a +permission 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. +@end ignore + +@node Using History Interactively +@chapter Using History Interactively + +@ifclear BashFeatures +@defcodeindex bt +@end ifclear + +@ifset BashFeatures +This chapter describes how to use the @sc{gnu} History Library +interactively, from a user's standpoint. +It should be considered a user's guide. +For information on using the @sc{gnu} History Library in other programs, +see the @sc{gnu} Readline Library Manual. +@end ifset +@ifclear BashFeatures +This chapter describes how to use the @sc{gnu} History Library interactively, +from a user's standpoint. It should be considered a user's guide. For +information on using the @sc{gnu} History Library in your own programs, +@pxref{Programming with GNU History}. +@end ifclear + +@ifset BashFeatures +@menu +* Bash History Facilities:: How Bash lets you manipulate your command + history. +* Bash History Builtins:: The Bash builtin commands that manipulate + the command history. +* History Interaction:: What it feels like using History as a user. +@end menu +@end ifset +@ifclear BashFeatures +@menu +* History Interaction:: What it feels like using History as a user. +@end menu +@end ifclear + +@ifset BashFeatures +@node Bash History Facilities +@section Bash History Facilities +@cindex command history +@cindex history list + +When the @option{-o history} option to the @code{set} builtin +is enabled (@pxref{The Set Builtin}), +the shell provides access to the @dfn{command history}, +the list of commands previously typed. +The value of the @env{HISTSIZE} shell variable is used as the +number of commands to save in a history list. +The text of the last @env{$HISTSIZE} +commands (default 500) is saved. +The shell stores each command in the history list prior to +parameter and variable expansion +but after history expansion is performed, subject to the +values of the shell variables +@env{HISTIGNORE} and @env{HISTCONTROL}. + +When the shell starts up, the history is initialized from the +file named by the @env{HISTFILE} variable (default @file{~/.bash_history}). +The file named by the value of @env{HISTFILE} is truncated, if +necessary, to contain no more than the number of lines specified by +the value of the @env{HISTFILESIZE} variable. +When an interactive shell exits, the last +@env{$HISTSIZE} lines are copied from the history list to the file +named by @env{$HISTFILE}. +If the @code{histappend} shell option is set (@pxref{Bash Builtins}), +the lines are appended to the history file, +otherwise the history file is overwritten. +If @env{HISTFILE} +is unset, or if the history file is unwritable, the history is +not saved. After saving the history, the history file is truncated +to contain no more than @env{$HISTFILESIZE} +lines. If @env{HISTFILESIZE} is not set, no truncation is performed. + +If the @env{HISTTIMEFORMAT} is set, the time stamp information +associated with each history entry is written to the history file. + +The builtin command @code{fc} may be used to list or edit and re-execute +a portion of the history list. +The @code{history} builtin may be used to display or modify the history +list and manipulate the history file. +When using command-line editing, search commands +are available in each editing mode that provide access to the +history list (@pxref{Commands For History}). + +The shell allows control over which commands are saved on the history +list. The @env{HISTCONTROL} and @env{HISTIGNORE} +variables may be set to cause the shell to save only a subset of the +commands entered. +The @code{cmdhist} +shell option, if enabled, causes the shell to attempt to save each +line of a multi-line command in the same history entry, adding +semicolons where necessary to preserve syntactic correctness. +The @code{lithist} +shell option causes the shell to save the command with embedded newlines +instead of semicolons. +The @code{shopt} builtin is used to set these options. +@xref{Bash Builtins}, for a description of @code{shopt}. + +@node Bash History Builtins +@section Bash History Builtins +@cindex history builtins + +Bash provides two builtin commands which manipulate the +history list and history file. + +@table @code + +@item fc +@btindex fc +@example +@code{fc [-e @var{ename}] [-nlr] [@var{first}] [@var{last}]} +@code{fc -s [@var{pat}=@var{rep}] [@var{command}]} +@end example + +Fix Command. In the first form, a range of commands from @var{first} to +@var{last} is selected from the history list. Both @var{first} and +@var{last} may be specified as a string (to locate the most recent +command beginning with that string) or as a number (an index into the +history list, where a negative number is used as an offset from the +current command number). If @var{last} is not specified it is set to +@var{first}. If @var{first} is not specified it is set to the previous +command for editing and @minus{}16 for listing. If the @option{-l} flag is +given, the commands are listed on standard output. The @option{-n} flag +suppresses the command numbers when listing. The @option{-r} flag +reverses the order of the listing. Otherwise, the editor given by +@var{ename} is invoked on a file containing those commands. If +@var{ename} is not given, the value of the following variable expansion +is used: @code{$@{FCEDIT:-$@{EDITOR:-vi@}@}}. This says to use the +value of the @env{FCEDIT} variable if set, or the value of the +@env{EDITOR} variable if that is set, or @code{vi} if neither is set. +When editing is complete, the edited commands are echoed and executed. + +In the second form, @var{command} is re-executed after each instance +of @var{pat} in the selected command is replaced by @var{rep}. + +A useful alias to use with the @code{fc} command is @code{r='fc -s'}, so +that typing @samp{r cc} runs the last command beginning with @code{cc} +and typing @samp{r} re-executes the last command (@pxref{Aliases}). + +@item history +@btindex history +@example +history [@var{n}] +history -c +history -d @var{offset} +history [-anrw] [@var{filename}] +history -ps @var{arg} +@end example + +With no options, display the history list with line numbers. +Lines prefixed with a @samp{*} have been modified. +An argument of @var{n} lists only the last @var{n} lines. +If the shell variable @env{HISTTIMEFORMAT} is set and not null, +it is used as a format string for @var{strftime} to display +the time stamp associated with each displayed history entry. +No intervening blank is printed between the formatted time stamp +and the history line. + +Options, if supplied, have the following meanings: + +@table @code +@item -c +Clear the history list. This may be combined +with the other options to replace the history list completely. + +@item -d @var{offset} +Delete the history entry at position @var{offset}. +@var{offset} should be specified as it appears when the history is +displayed. + +@item -a +Append the new +history lines (history lines entered since the beginning of the +current Bash session) to the history file. + +@item -n +Append the history lines not already read from the history file +to the current history list. These are lines appended to the history +file since the beginning of the current Bash session. + +@item -r +Read the current history file and append its contents to +the history list. + +@item -w +Write out the current history to the history file. + +@item -p +Perform history substitution on the @var{arg}s and display the result +on the standard output, without storing the results in the history list. + +@item -s +The @var{arg}s are added to the end of +the history list as a single entry. + +@end table + +When any of the @option{-w}, @option{-r}, @option{-a}, or @option{-n} options is +used, if @var{filename} +is given, then it is used as the history file. If not, then +the value of the @env{HISTFILE} variable is used. + +@end table +@end ifset + +@node History Interaction +@section History Expansion +@cindex history expansion + +The History library provides a history expansion feature that is similar +to the history expansion provided by @code{csh}. This section +describes the syntax used to manipulate the history information. + +History expansions introduce words from the history list into +the input stream, making it easy to repeat commands, insert the +arguments to a previous command into the current input line, or +fix errors in previous commands quickly. + +History expansion takes place in two parts. The first is to determine +which line from the history list should be used during substitution. +The second is to select portions of that line for inclusion into the +current one. The line selected from the history is called the +@dfn{event}, and the portions of that line that are acted upon are +called @dfn{words}. Various @dfn{modifiers} are available to manipulate +the selected words. The line is broken into words in the same fashion +that Bash does, so that several words +surrounded by quotes are considered one word. +History expansions are introduced by the appearance of the +history expansion character, which is @samp{!} by default. +@ifset BashFeatures +Only @samp{\} and @samp{'} may be used to escape the history expansion +character. +@end ifset + +@ifset BashFeatures +Several shell options settable with the @code{shopt} +builtin (@pxref{Bash Builtins}) may be used to tailor +the behavior of history expansion. If the +@code{histverify} shell option is enabled, and Readline +is being used, history substitutions are not immediately passed to +the shell parser. +Instead, the expanded line is reloaded into the Readline +editing buffer for further modification. +If Readline is being used, and the @code{histreedit} +shell option is enabled, a failed history expansion will be +reloaded into the Readline editing buffer for correction. +The @option{-p} option to the @code{history} builtin command +may be used to see what a history expansion will do before using it. +The @option{-s} option to the @code{history} builtin may be used to +add commands to the end of the history list without actually executing +them, so that they are available for subsequent recall. +This is most useful in conjunction with Readline. + +The shell allows control of the various characters used by the +history expansion mechanism with the @code{histchars} variable. +@end ifset + +@menu +* Event Designators:: How to specify which history line to use. +* Word Designators:: Specifying which words are of interest. +* Modifiers:: Modifying the results of substitution. +@end menu + +@node Event Designators +@subsection Event Designators +@cindex event designators + +An event designator is a reference to a command line entry in the +history list. +@cindex history events + +@table @asis + +@item @code{!} +@ifset BashFeatures +Start a history substitution, except when followed by a space, tab, +the end of the line, @samp{=} or @samp{(} (when the +@code{extglob} shell option is enabled using the @code{shopt} builtin). +@end ifset +@ifclear BashFeatures +Start a history substitution, except when followed by a space, tab, +the end of the line, or @samp{=}. +@end ifclear + +@item @code{!@var{n}} +Refer to command line @var{n}. + +@item @code{!-@var{n}} +Refer to the command @var{n} lines back. + +@item @code{!!} +Refer to the previous command. This is a synonym for @samp{!-1}. + +@item @code{!@var{string}} +Refer to the most recent command starting with @var{string}. + +@item @code{!?@var{string}[?]} +Refer to the most recent command containing @var{string}. The trailing +@samp{?} may be omitted if the @var{string} is followed immediately by +a newline. + +@item @code{^@var{string1}^@var{string2}^} +Quick Substitution. Repeat the last command, replacing @var{string1} +with @var{string2}. Equivalent to +@code{!!:s/@var{string1}/@var{string2}/}. + +@item @code{!#} +The entire command line typed so far. + +@end table + +@node Word Designators +@subsection Word Designators + +Word designators are used to select desired words from the event. +A @samp{:} separates the event specification from the word designator. It +may be omitted if the word designator begins with a @samp{^}, @samp{$}, +@samp{*}, @samp{-}, or @samp{%}. Words are numbered from the beginning +of the line, with the first word being denoted by 0 (zero). Words are +inserted into the current line separated by single spaces. + +@need 0.75 +For example, + +@table @code +@item !! +designates the preceding command. When you type this, the preceding +command is repeated in toto. + +@item !!:$ +designates the last argument of the preceding command. This may be +shortened to @code{!$}. + +@item !fi:2 +designates the second argument of the most recent command starting with +the letters @code{fi}. +@end table + +@need 0.75 +Here are the word designators: + +@table @code + +@item 0 (zero) +The @code{0}th word. For many applications, this is the command word. + +@item @var{n} +The @var{n}th word. + +@item ^ +The first argument; that is, word 1. + +@item $ +The last argument. + +@item % +The word matched by the most recent @samp{?@var{string}?} search. + +@item @var{x}-@var{y} +A range of words; @samp{-@var{y}} abbreviates @samp{0-@var{y}}. + +@item * +All of the words, except the @code{0}th. This is a synonym for @samp{1-$}. +It is not an error to use @samp{*} if there is just one word in the event; +the empty string is returned in that case. + +@item @var{x}* +Abbreviates @samp{@var{x}-$} + +@item @var{x}- +Abbreviates @samp{@var{x}-$} like @samp{@var{x}*}, but omits the last word. + +@end table + +If a word designator is supplied without an event specification, the +previous command is used as the event. + +@node Modifiers +@subsection Modifiers + +After the optional word designator, you can add a sequence of one or more +of the following modifiers, each preceded by a @samp{:}. + +@table @code + +@item h +Remove a trailing pathname component, leaving only the head. + +@item t +Remove all leading pathname components, leaving the tail. + +@item r +Remove a trailing suffix of the form @samp{.@var{suffix}}, leaving +the basename. + +@item e +Remove all but the trailing suffix. + +@item p +Print the new command but do not execute it. + +@ifset BashFeatures +@item q +Quote the substituted words, escaping further substitutions. + +@item x +Quote the substituted words as with @samp{q}, +but break into words at spaces, tabs, and newlines. +@end ifset + +@item s/@var{old}/@var{new}/ +Substitute @var{new} for the first occurrence of @var{old} in the +event line. Any delimiter may be used in place of @samp{/}. +The delimiter may be quoted in @var{old} and @var{new} +with a single backslash. If @samp{&} appears in @var{new}, +it is replaced by @var{old}. A single backslash will quote +the @samp{&}. The final delimiter is optional if it is the last +character on the input line. + +@item & +Repeat the previous substitution. + +@item g +@itemx a +Cause changes to be applied over the entire event line. Used in +conjunction with @samp{s}, as in @code{gs/@var{old}/@var{new}/}, +or with @samp{&}. + +@item G +Apply the following @samp{s} modifier once to each word in the event. + +@end table diff --git a/lib/readline/doc/rlman.texi b/lib/readline/doc/rlman.texi new file mode 100644 index 00000000..8c74b7f3 --- /dev/null +++ b/lib/readline/doc/rlman.texi @@ -0,0 +1,101 @@ +\input texinfo @c -*-texinfo-*- +@comment %**start of header (This is for running Texinfo on a region.) +@setfilename readline.info +@settitle GNU Readline Library +@comment %**end of header (This is for running Texinfo on a region.) +@synindex vr fn +@setchapternewpage odd + +@include version.texi + +@copying +This manual describes the GNU Readline Library +(version @value{VERSION}, @value{UPDATED}), a library which aids in the +consistency of user interface across discrete programs which provide +a command line interface. + +Copyright @copyright{} 1988-2003 Free Software Foundation, Inc. + +Permission is granted to make and distribute verbatim copies of +this manual provided the copyright notice and this permission notice +are preserved on all copies. + +@quotation +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.1 or +any later version published by the Free Software Foundation; with no +Invariant Sections, with the Front-Cover texts being ``A GNU Manual,'' +and with the Back-Cover Texts as in (a) below. A copy of the license is +included in the section entitled ``GNU Free Documentation License.'' + +(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify +this GNU Manual, like GNU software. Copies published by the Free +Software Foundation raise funds for GNU development.'' +@end quotation +@end copying + +@dircategory Libraries +@direntry +* Readline: (readline). The GNU readline library API. +@end direntry + +@titlepage +@title GNU Readline Library +@subtitle Edition @value{EDITION}, for @code{Readline Library} Version @value{VERSION}. +@subtitle @value{UPDATED-MONTH} +@author Chet Ramey, Case Western Reserve University +@author Brian Fox, Free Software Foundation + +@page +@vskip 0pt plus 1filll +@insertcopying + +@sp 1 +Published by the Free Software Foundation @* +59 Temple Place, Suite 330, @* +Boston, MA 02111-1307 @* +USA @* + +@end titlepage + +@contents + +@ifnottex +@node Top +@top GNU Readline Library + +This document describes the GNU Readline Library, a utility which aids +in the consistency of user interface across discrete programs which +provide a command line interface. + +@menu +* Command Line Editing:: GNU Readline User's Manual. +* Programming with GNU Readline:: GNU Readline Programmer's Manual. +* Copying This Manual:: Copying this manual. +* Concept Index:: Index of concepts described in this manual. +* Function and Variable Index:: Index of externally visible functions + and variables. +@end menu +@end ifnottex + +@include rluser.texi +@include rltech.texi + +@node Copying This Manual +@appendix Copying This Manual + +@menu +* GNU Free Documentation License:: License for copying this manual. +@end menu + +@include fdl.texi + +@node Concept Index +@unnumbered Concept Index +@printindex cp + +@node Function and Variable Index +@unnumbered Function and Variable Index +@printindex fn + +@bye diff --git a/lib/readline/doc/rltech.texi b/lib/readline/doc/rltech.texi new file mode 100644 index 00000000..95c41775 --- /dev/null +++ b/lib/readline/doc/rltech.texi @@ -0,0 +1,2224 @@ +@comment %**start of header (This is for running Texinfo on a region.) +@setfilename rltech.info +@comment %**end of header (This is for running Texinfo on a region.) +@setchapternewpage odd + +@ifinfo +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-2002 Free Software Foundation, Inc. + +Permission is granted to make and distribute verbatim copies of +this manual provided the copyright notice and this permission notice +pare preserved on all copies. + +@ignore +Permission is granted to process this file through TeX and print the +results, provided the printed document carries copying permission +notice identical to this one except for the removal of this paragraph +(this paragraph not being relevant to the printed manual). +@end ignore + +Permission is granted to copy and distribute modified versions of this +manual under the conditions for verbatim copying, provided that the entire +resulting derived work is distributed under the terms of a permission +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. +@end ifinfo + +@node Programming with GNU Readline +@chapter Programming with GNU Readline + +This chapter describes the interface between the @sc{gnu} Readline Library and +other programs. If you are a programmer, and you wish to include the +features found in @sc{gnu} Readline +such as completion, line editing, and interactive history manipulation +in your own programs, this section is for you. + +@menu +* Basic Behavior:: Using the default behavior of Readline. +* Custom Functions:: Adding your own functions to Readline. +* Readline Variables:: Variables accessible to custom + functions. +* Readline Convenience Functions:: Functions which Readline supplies to + 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 + +@node Basic Behavior +@section Basic Behavior + +Many programs provide a command line interface, such as @code{mail}, +@code{ftp}, and @code{sh}. For such programs, the default behaviour of +Readline is sufficient. This section describes how to use Readline in +the simplest way possible, perhaps to replace calls in your code to +@code{gets()} or @code{fgets()}. + +@findex readline +@cindex readline, function + +The function @code{readline()} prints a prompt @var{prompt} +and then reads and returns a single line of text from the user. +If @var{prompt} is @code{NULL} or the empty string, no prompt is displayed. +The line @code{readline} returns is allocated with @code{malloc()}; +the caller should @code{free()} the line when it has finished with it. +The declaration for @code{readline} in ANSI C is + +@example +@code{char *readline (const char *@var{prompt});} +@end example + +@noindent +So, one might say +@example +@code{char *line = readline ("Enter a line: ");} +@end example +@noindent +in order to read a line of text from the user. +The line returned has the final newline removed, so only the +text remains. + +If @code{readline} encounters an @code{EOF} while reading the line, and the +line is empty at that point, then @code{(char *)NULL} is returned. +Otherwise, the line is ended just as if a newline had been typed. + +If you want the user to be able to get at the line later, (with +@key{C-p} for example), you must call @code{add_history()} to save the +line away in a @dfn{history} list of such lines. + +@example +@code{add_history (line)}; +@end example + +@noindent +For full details on the GNU History Library, see the associated manual. + +It is preferable to avoid saving empty lines on the history list, since +users rarely have a burning need to reuse a blank line. Here is +a function which usefully replaces the standard @code{gets()} library +function, and has the advantage of no static buffer to overflow: + +@example +/* A static variable for holding the line. */ +static char *line_read = (char *)NULL; + +/* Read a string, and return a pointer to it. + Returns NULL on EOF. */ +char * +rl_gets () +@{ + /* If the buffer has already been allocated, + return the memory to the free pool. */ + if (line_read) + @{ + free (line_read); + line_read = (char *)NULL; + @} + + /* Get a line from the user. */ + line_read = readline (""); + + /* If the line has any text in it, + save it on the history. */ + if (line_read && *line_read) + add_history (line_read); + + return (line_read); +@} +@end example + +This function gives the user the default behaviour of @key{TAB} +completion: completion on file names. If you do not want Readline to +complete on filenames, you can change the binding of the @key{TAB} key +with @code{rl_bind_key()}. + +@example +@code{int rl_bind_key (int @var{key}, rl_command_func_t *@var{function});} +@end example + +@code{rl_bind_key()} takes two arguments: @var{key} is the character that +you want to bind, and @var{function} is the address of the function to +call when @var{key} is pressed. Binding @key{TAB} to @code{rl_insert()} +makes @key{TAB} insert itself. +@code{rl_bind_key()} returns non-zero if @var{key} is not a valid +ASCII character code (between 0 and 255). + +Thus, to disable the default @key{TAB} behavior, the following suffices: +@example +@code{rl_bind_key ('\t', rl_insert);} +@end example + +This code should be executed once at the start of your program; you +might write a function called @code{initialize_readline()} which +performs this and other desired initializations, such as installing +custom completers (@pxref{Custom Completers}). + +@node Custom Functions +@section Custom Functions + +Readline provides many functions for manipulating the text of +the line, but it isn't possible to anticipate the needs of all +programs. This section describes the various functions and variables +defined within the Readline library which allow a user program to add +customized functionality to Readline. + +Before declaring any functions that customize Readline's behavior, or +using any functionality Readline provides in other code, an +application writer should include the file @code{<readline/readline.h>} +in any file that uses Readline's features. Since some of the definitions +in @code{readline.h} use the @code{stdio} library, the file +@code{<stdio.h>} should be included before @code{readline.h}. + +@code{readline.h} defines a C preprocessor variable that should +be treated as an integer, @code{RL_READLINE_VERSION}, which may +be used to conditionally compile application code depending on +the installed Readline version. The value is a hexadecimal +encoding of the major and minor version numbers of the library, +of the form 0x@var{MMmm}. @var{MM} is the two-digit major +version number; @var{mm} is the two-digit minor version number. +For Readline 4.2, for example, the value of +@code{RL_READLINE_VERSION} would be @code{0x0402}. + +@menu +* Readline Typedefs:: C declarations to make code readable. +* Function Writing:: Variables and calling conventions. +@end menu + +@node Readline Typedefs +@subsection Readline Typedefs + +For readabilty, we declare a number of new object types, all pointers +to functions. + +The reason for declaring these new types is to make it easier to write +code describing pointers to C functions with appropriately prototyped +arguments and return values. + +For instance, say we want to declare a variable @var{func} as a pointer +to a function which takes two @code{int} arguments and returns an +@code{int} (this is the type of all of the Readline bindable functions). +Instead of the classic C declaration + +@code{int (*func)();} + +@noindent +or the ANSI-C style declaration + +@code{int (*func)(int, int);} + +@noindent +we may write + +@code{rl_command_func_t *func;} + +The full list of function pointer types available is + +@table @code +@item typedef int rl_command_func_t (int, int); + +@item typedef char *rl_compentry_func_t (const char *, int); + +@item typedef char **rl_completion_func_t (const char *, int, int); + +@item typedef char *rl_quote_func_t (char *, int, char *); + +@item typedef char *rl_dequote_func_t (char *, int); + +@item typedef int rl_compignore_func_t (char **); + +@item typedef void rl_compdisp_func_t (char **, int, int); + +@item typedef int rl_hook_func_t (void); + +@item typedef int rl_getc_func_t (FILE *); + +@item typedef int rl_linebuf_func_t (char *, int); + +@item typedef int rl_intfunc_t (int); +@item #define rl_ivoidfunc_t rl_hook_func_t +@item typedef int rl_icpfunc_t (char *); +@item typedef int rl_icppfunc_t (char **); + +@item typedef void rl_voidfunc_t (void); +@item typedef void rl_vintfunc_t (int); +@item typedef void rl_vcpfunc_t (char *); +@item typedef void rl_vcppfunc_t (char **); + +@end table + +@node Function Writing +@subsection Writing a New Function + +In order to write new functions for Readline, you need to know the +calling conventions for keyboard-invoked functions, and the names of the +variables that describe the current state of the line read so far. + +The calling sequence for a command @code{foo} looks like + +@example +@code{int foo (int count, int key)} +@end example + +@noindent +where @var{count} is the numeric argument (or 1 if defaulted) and +@var{key} is the key that invoked this function. + +It is completely up to the function as to what should be done with the +numeric argument. Some functions use it as a repeat count, some +as a flag, and others to choose alternate behavior (refreshing the current +line as opposed to refreshing the screen, for example). Some choose to +ignore it. In general, if a +function uses the numeric argument as a repeat count, it should be able +to do something useful with both negative and positive arguments. +At the very least, it should be aware that it can be passed a +negative argument. + +A command function should return 0 if its action completes successfully, +and a non-zero value if some error occurs. + +@node Readline Variables +@section Readline Variables + +These variables are available to function writers. + +@deftypevar {char *} rl_line_buffer +This is the line gathered so far. You are welcome to modify the +contents of the line, but see @ref{Allowing Undoing}. The +function @code{rl_extend_line_buffer} is available to increase +the memory allocated to @code{rl_line_buffer}. +@end deftypevar + +@deftypevar int rl_point +The offset of the current cursor position in @code{rl_line_buffer} +(the @emph{point}). +@end deftypevar + +@deftypevar int rl_end +The number of characters present in @code{rl_line_buffer}. When +@code{rl_point} is at the end of the line, @code{rl_point} and +@code{rl_end} are equal. +@end deftypevar + +@deftypevar int rl_mark +The @var{mark} (saved position) in the current line. If set, the mark +and point define a @emph{region}. +@end deftypevar + +@deftypevar int rl_done +Setting this to a non-zero value causes Readline to return the current +line immediately. +@end deftypevar + +@deftypevar int rl_num_chars_to_read +Setting this to a positive value before calling @code{readline()} causes +Readline to return after accepting that many characters, rather +than reading up to a character bound to @code{accept-line}. +@end deftypevar + +@deftypevar int rl_pending_input +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_dispatching +Set to a non-zero value if a function is being called from a key binding; +zero otherwise. Application functions can test this to discover whether +they were called directly or by Readline's dispatching mechanism. +@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. +The @code{rl_set_prompt()} function (@pxref{Redisplay}) may +be used to modify the prompt string after calling @code{readline()}. +@end deftypevar + +@deftypevar int rl_already_prompted +If an application wishes to display the prompt itself, rather than have +Readline do it the first time @code{readline()} is called, it should set +this variable to a non-zero value after displaying the prompt. +The prompt must also be passed as the argument to @code{readline()} so +the redisplay functions can update the display properly. +The calling application is responsible for managing the value; Readline +never sets it. +@end deftypevar + +@deftypevar {const char *} rl_library_version +The version number of this revision of the library. +@end deftypevar + +@deftypevar int rl_readline_version +An integer encoding the current version of the library. The encoding is +of the form 0x@var{MMmm}, where @var{MM} is the two-digit major version +number, and @var{mm} is the two-digit minor version number. +For example, for Readline-4.2, @code{rl_readline_version} would have the +value 0x0402. +@end deftypevar + +@deftypevar {int} rl_gnu_readline_p +Always set to 1, denoting that this is @sc{gnu} readline rather than some +emulation. +@end deftypevar + +@deftypevar {const char *} rl_terminal_name +The terminal type, used for initialization. If not set by the application, +Readline sets this to the value of the @env{TERM} environment variable +the first time it is called. +@end deftypevar + +@deftypevar {const char *} rl_readline_name +This variable is set to a unique name by each application using Readline. +The value allows conditional parsing of the inputrc file +(@pxref{Conditional Init Constructs}). +@end deftypevar + +@deftypevar {FILE *} rl_instream +The stdio stream from which Readline reads input. +If @code{NULL}, Readline defaults to @var{stdin}. +@end deftypevar + +@deftypevar {FILE *} rl_outstream +The stdio stream to which Readline performs output. +If @code{NULL}, Readline defaults to @var{stdout}. +@end deftypevar + +@deftypevar {rl_command_func_t *} rl_last_func +The address of the last command function Readline executed. May be used to +test whether or not a function is being executed twice in succession, for +example. +@end deftypevar + +@deftypevar {rl_hook_func_t *} rl_startup_hook +If non-zero, this is the address of a function to call just +before @code{readline} prints the first prompt. +@end deftypevar + +@deftypevar {rl_hook_func_t *} 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 {rl_hook_func_t *} rl_event_hook +If non-zero, this is the address of a function to call periodically +when Readline is waiting for terminal input. +By default, this will be called at most ten times a second if there +is no keyboard input. +@end deftypevar + +@deftypevar {rl_getc_func_t *} rl_getc_function +If non-zero, Readline will call indirectly through this pointer +to get a character from the input stream. By default, it is set to +@code{rl_getc}, the default Readline character input function +(@pxref{Character Input}). +@end deftypevar + +@deftypevar {rl_voidfunc_t *} rl_redisplay_function +If non-zero, Readline will call indirectly through this pointer +to update the display with the current contents of the editing buffer. +By default, it is set to @code{rl_redisplay}, the default Readline +redisplay function (@pxref{Redisplay}). +@end deftypevar + +@deftypevar {rl_vintfunc_t *} rl_prep_term_function +If non-zero, Readline will call indirectly through this pointer +to initialize the terminal. The function takes a single argument, an +@code{int} flag that says whether or not to use eight-bit characters. +By default, this is set to @code{rl_prep_terminal} +(@pxref{Terminal Management}). +@end deftypevar + +@deftypevar {rl_voidfunc_t *} rl_deprep_term_function +If non-zero, Readline will call indirectly through this pointer +to reset the terminal. This function should undo the effects of +@code{rl_prep_term_function}. +By default, this is set to @code{rl_deprep_terminal} +(@pxref{Terminal Management}). +@end deftypevar + +@deftypevar {Keymap} rl_executing_keymap +This variable is set to the keymap (@pxref{Keymaps}) in which the +currently executing readline function was found. +@end deftypevar + +@deftypevar {Keymap} rl_binding_keymap +This variable is set to the keymap (@pxref{Keymaps}) in which the +last key binding occurred. +@end deftypevar + +@deftypevar {char *} rl_executing_macro +This variable is set to the text of any currently-executing macro. +@end deftypevar + +@deftypevar {int} rl_readline_state +A variable with bit values that encapsulate the current Readline state. +A bit is set with the @code{RL_SETSTATE} macro, and unset with the +@code{RL_UNSETSTATE} macro. Use the @code{RL_ISSTATE} macro to test +whether a particular state bit is set. Current state bits include: + +@table @code +@item RL_STATE_NONE +Readline has not yet been called, nor has it begun to intialize. +@item RL_STATE_INITIALIZING +Readline is initializing its internal data structures. +@item RL_STATE_INITIALIZED +Readline has completed its initialization. +@item RL_STATE_TERMPREPPED +Readline has modified the terminal modes to do its own input and redisplay. +@item RL_STATE_READCMD +Readline is reading a command from the keyboard. +@item RL_STATE_METANEXT +Readline is reading more input after reading the meta-prefix character. +@item RL_STATE_DISPATCHING +Readline is dispatching to a command. +@item RL_STATE_MOREINPUT +Readline is reading more input while executing an editing command. +@item RL_STATE_ISEARCH +Readline is performing an incremental history search. +@item RL_STATE_NSEARCH +Readline is performing a non-incremental history search. +@item RL_STATE_SEARCH +Readline is searching backward or forward through the history for a string. +@item RL_STATE_NUMERICARG +Readline is reading a numeric argument. +@item RL_STATE_MACROINPUT +Readline is currently getting its input from a previously-defined keyboard +macro. +@item RL_STATE_MACRODEF +Readline is currently reading characters defining a keyboard macro. +@item RL_STATE_OVERWRITE +Readline is in overwrite mode. +@item RL_STATE_COMPLETING +Readline is performing word completion. +@item RL_STATE_SIGHANDLER +Readline is currently executing the readline signal handler. +@item RL_STATE_UNDOING +Readline is performing an undo. +@item RL_STATE_DONE +Readline has read a key sequence bound to @code{accept-line} +and is about to return the line to the caller. +@end table + +@end deftypevar + +@deftypevar {int} rl_explicit_arg +Set to a non-zero value if an explicit numeric argument was specified by +the user. Only valid in a bindable command function. +@end deftypevar + +@deftypevar {int} rl_numeric_arg +Set to the value of any numeric argument explicitly specified by the user +before executing the current Readline function. Only valid in a bindable +command function. +@end deftypevar + +@deftypevar {int} rl_editing_mode +Set to a value denoting Readline's current editing mode. A value of +@var{1} means Readline is currently in emacs mode; @var{0} +means that vi mode is active. +@end deftypevar + + +@node Readline Convenience Functions +@section Readline Convenience Functions + +@menu +* Function Naming:: How to give a function you write a name. +* Keymaps:: Making keymaps. +* Binding Keys:: Changing Keymaps. +* Associating Function Names and Bindings:: Translate function names to + key sequences. +* Allowing Undoing:: How to make your functions undoable. +* Redisplay:: Functions to control line display. +* Modifying Text:: Functions to modify @code{rl_line_buffer}. +* Character Input:: Functions to read keyboard input. +* Terminal Management:: Functions to manage terminal settings. +* Utility Functions:: Generally useful functions and hooks. +* Miscellaneous Functions:: Functions that don't fall into any category. +* Alternate Interface:: Using Readline in a `callback' fashion. +* A Readline Example:: An example Readline function. +@end menu + +@node Function Naming +@subsection Naming a Function + +The user can dynamically change the bindings of keys while using +Readline. This is done by representing the function with a descriptive +name. The user is able to type the descriptive name when referring to +the function. Thus, in an init file, one might find + +@example +Meta-Rubout: backward-kill-word +@end example + +This binds the keystroke @key{Meta-Rubout} to the function +@emph{descriptively} named @code{backward-kill-word}. You, as the +programmer, should bind the functions you write to descriptive names as +well. Readline provides a function for doing that: + +@deftypefun int rl_add_defun (const char *name, rl_command_func_t *function, int key) +Add @var{name} to the list of named functions. Make @var{function} be +the function that gets called. If @var{key} is not -1, then bind it to +@var{function} using @code{rl_bind_key()}. +@end deftypefun + +Using this function alone is sufficient for most applications. +It is the recommended way to add a few functions to the default +functions that Readline has built in. +If you need to do something other than adding a function to Readline, +you may need to use the underlying functions described below. + +@node Keymaps +@subsection Selecting a Keymap + +Key bindings take place on a @dfn{keymap}. The keymap is the +association between the keys that the user types and the functions that +get run. You can make your own keymaps, copy existing keymaps, and tell +Readline which keymap to use. + +@deftypefun Keymap rl_make_bare_keymap (void) +Returns a new, empty keymap. The space for the keymap is allocated with +@code{malloc()}; the caller should free it by calling +@code{rl_discard_keymap()} when done. +@end deftypefun + +@deftypefun Keymap rl_copy_keymap (Keymap map) +Return a new keymap which is a copy of @var{map}. +@end deftypefun + +@deftypefun Keymap rl_make_keymap (void) +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. +@end deftypefun + +@deftypefun void rl_discard_keymap (Keymap keymap) +Free the storage associated with @var{keymap}. +@end deftypefun + +Readline has several internal keymaps. These functions allow you to +change which keymap is active. + +@deftypefun Keymap rl_get_keymap (void) +Returns the currently active keymap. +@end deftypefun + +@deftypefun void rl_set_keymap (Keymap keymap) +Makes @var{keymap} the currently active keymap. +@end deftypefun + +@deftypefun Keymap rl_get_keymap_by_name (const char *name) +Return the keymap matching @var{name}. @var{name} is one which would +be supplied in a @code{set keymap} inputrc line (@pxref{Readline Init File}). +@end deftypefun + +@deftypefun {char *} rl_get_keymap_name (Keymap keymap) +Return the name matching @var{keymap}. @var{name} is one which would +be supplied in a @code{set keymap} inputrc line (@pxref{Readline Init File}). +@end deftypefun + +@node Binding Keys +@subsection Binding Keys + +Key sequences are associate with functions through the keymap. +Readline has several internal keymaps: @code{emacs_standard_keymap}, +@code{emacs_meta_keymap}, @code{emacs_ctlx_keymap}, +@code{vi_movement_keymap}, and @code{vi_insertion_keymap}. +@code{emacs_standard_keymap} is the default, and the examples in +this manual assume that. + +Since @code{readline()} installs a set of default key bindings the first +time it is called, there is always the danger that a custom binding +installed before the first call to @code{readline()} will be overridden. +An alternate mechanism is to install custom key bindings in an +initialization function assigned to the @code{rl_startup_hook} variable +(@pxref{Readline Variables}). + +These functions manage key bindings. + +@deftypefun int rl_bind_key (int key, rl_command_func_t *function) +Binds @var{key} to @var{function} in the currently active keymap. +Returns non-zero in the case of an invalid @var{key}. +@end deftypefun + +@deftypefun int rl_bind_key_in_map (int key, rl_command_func_t *function, Keymap map) +Bind @var{key} to @var{function} in @var{map}. +Returns non-zero in the case of an invalid @var{key}. +@end deftypefun + +@deftypefun int rl_bind_key_if_unbound (int key, rl_command_func_t *function) +Binds @var{key} to @var{function} if it is not already bound in the +currently active keymap. +Returns non-zero in the case of an invalid @var{key} or if @var{key} is +already bound. +@end deftypefun + +@deftypefun int rl_bind_key_if_unbound_in_map (int key, rl_command_func_t *function, Keymap map) +Binds @var{key} to @var{function} if it is not already bound in @var{map}. +Returns non-zero in the case of an invalid @var{key} or if @var{key} is +already bound. +@end deftypefun + +@deftypefun int rl_unbind_key (int key) +Bind @var{key} to the null function in the currently active keymap. +Returns non-zero in case of error. +@end deftypefun + +@deftypefun int rl_unbind_key_in_map (int key, Keymap map) +Bind @var{key} to the null function in @var{map}. +Returns non-zero in case of error. +@end deftypefun + +@deftypefun int rl_unbind_function_in_map (rl_command_func_t *function, Keymap map) +Unbind all keys that execute @var{function} in @var{map}. +@end deftypefun + +@deftypefun int rl_unbind_command_in_map (const char *command, Keymap map) +Unbind all keys that are bound to @var{command} in @var{map}. +@end deftypefun + +@deftypefun int rl_bind_keyseq (const char *keyseq, rl_command_func_t *function) +Bind the key sequence represented by the string @var{keyseq} to the function +@var{function}, beginning in the current keymap. +This makes new keymaps as necessary. +The return value is non-zero if @var{keyseq} is invalid. +@end deftypefun + +@deftypefun int rl_bind_keyseq_in_map (const char *keyseq, rl_command_func_t *function, Keymap map) +Bind the key sequence represented by the string @var{keyseq} to the function +@var{function}. This makes new keymaps as necessary. +Initial bindings are performed in @var{map}. +The return value is non-zero if @var{keyseq} is invalid. +@end deftypefun + +@deftypefun int rl_set_key (const char *keyseq, rl_command_func_t *function, Keymap map) +Equivalent to @code{rl_bind_keyseq_in_map}. +@end deftypefun + +@deftypefun int rl_bind_keyseq_if_unbound (const char *keyseq, rl_command_func_t *function) +Binds @var{keyseq} to @var{function} if it is not already bound in the +currently active keymap. +Returns non-zero in the case of an invalid @var{keyseq} or if @var{keyseq} is +already bound. +@end deftypefun + +@deftypefun int rl_bind_keyseq_if_unbound_in_map (const char *keyseq, rl_command_func_t *function, Keymap map) +Binds @var{keyseq} to @var{function} if it is not already bound in @var{map}. +Returns non-zero in the case of an invalid @var{keyseq} or if @var{keyseq} is +already bound. +@end deftypefun + +@deftypefun int rl_generic_bind (int type, const char *keyseq, char *data, Keymap map) +Bind the key sequence represented by the string @var{keyseq} to the arbitrary +pointer @var{data}. @var{type} says what kind of data is pointed to by +@var{data}; this can be a function (@code{ISFUNC}), a macro +(@code{ISMACR}), or a keymap (@code{ISKMAP}). This makes new keymaps as +necessary. The initial keymap in which to do bindings is @var{map}. +@end deftypefun + +@deftypefun int rl_parse_and_bind (char *line) +Parse @var{line} as if it had been read from the @code{inputrc} file and +perform any key bindings and variable assignments found +(@pxref{Readline Init File}). +@end deftypefun + +@deftypefun int rl_read_init_file (const char *filename) +Read keybindings and variable assignments from @var{filename} +(@pxref{Readline Init File}). +@end deftypefun + +@node Associating Function Names and Bindings +@subsection Associating Function Names and Bindings + +These functions allow you to find out what keys invoke named functions +and the functions invoked by a particular key sequence. You may also +associate a new function name with an arbitrary function. + +@deftypefun {rl_command_func_t *} rl_named_function (const char *name) +Return the function with name @var{name}. +@end deftypefun + +@deftypefun {rl_command_func_t *} rl_function_of_keyseq (const char *keyseq, Keymap map, int *type) +Return the function invoked by @var{keyseq} in keymap @var{map}. +If @var{map} is @code{NULL}, the current keymap is used. If @var{type} is +not @code{NULL}, the type of the object is returned in the @code{int} variable +it points to (one of @code{ISFUNC}, @code{ISKMAP}, or @code{ISMACR}). +@end deftypefun + +@deftypefun {char **} rl_invoking_keyseqs (rl_command_func_t *function) +Return an array of strings representing the key sequences used to +invoke @var{function} in the current keymap. +@end deftypefun + +@deftypefun {char **} rl_invoking_keyseqs_in_map (rl_command_func_t *function, Keymap map) +Return an array of strings representing the key sequences used to +invoke @var{function} in the keymap @var{map}. +@end deftypefun + +@deftypefun void rl_function_dumper (int readable) +Print the readline function names and the key sequences currently +bound to them to @code{rl_outstream}. If @var{readable} is non-zero, +the list is formatted in such a way that it can be made part of an +@code{inputrc} file and re-read. +@end deftypefun + +@deftypefun void rl_list_funmap_names (void) +Print the names of all bindable Readline functions to @code{rl_outstream}. +@end deftypefun + +@deftypefun {const char **} rl_funmap_names (void) +Return a NULL terminated array of known function names. The array is +sorted. The array itself is allocated, but not the strings inside. You +should @code{free()} the array when you are done, but not the pointers. +@end deftypefun + +@deftypefun int rl_add_funmap_entry (const char *name, rl_command_func_t *function) +Add @var{name} to the list of bindable Readline command names, and make +@var{function} the function to be called when @var{name} is invoked. +@end deftypefun + +@node Allowing Undoing +@subsection Allowing Undoing + +Supporting the undo command is a painless thing, and makes your +functions much more useful. It is certainly easy to try +something if you know you can undo it. + +If your function simply inserts text once, or deletes text once, and +uses @code{rl_insert_text()} or @code{rl_delete_text()} to do it, then +undoing is already done for you automatically. + +If you do multiple insertions or multiple deletions, or any combination +of these operations, you should group them together into one operation. +This is done with @code{rl_begin_undo_group()} and +@code{rl_end_undo_group()}. + +The types of events that can be undone are: + +@smallexample +enum undo_code @{ UNDO_DELETE, UNDO_INSERT, UNDO_BEGIN, UNDO_END @}; +@end smallexample + +Notice that @code{UNDO_DELETE} means to insert some text, and +@code{UNDO_INSERT} means to delete some text. That is, the undo code +tells what to undo, not how to undo it. @code{UNDO_BEGIN} and +@code{UNDO_END} are tags added by @code{rl_begin_undo_group()} and +@code{rl_end_undo_group()}. + +@deftypefun int rl_begin_undo_group (void) +Begins saving undo information in a group construct. The undo +information usually comes from calls to @code{rl_insert_text()} and +@code{rl_delete_text()}, but could be the result of calls to +@code{rl_add_undo()}. +@end deftypefun + +@deftypefun int rl_end_undo_group (void) +Closes the current undo group started with @code{rl_begin_undo_group +()}. There should be one call to @code{rl_end_undo_group()} +for each call to @code{rl_begin_undo_group()}. +@end deftypefun + +@deftypefun void rl_add_undo (enum undo_code what, int start, int end, char *text) +Remember how to undo an event (according to @var{what}). The affected +text runs from @var{start} to @var{end}, and encompasses @var{text}. +@end deftypefun + +@deftypefun void rl_free_undo_list (void) +Free the existing undo list. +@end deftypefun + +@deftypefun int rl_do_undo (void) +Undo the first thing on the undo list. Returns @code{0} if there was +nothing to undo, non-zero if something was undone. +@end deftypefun + +Finally, if you neither insert nor delete text, but directly modify the +existing text (e.g., change its case), call @code{rl_modifying()} +once, just before you modify the text. You must supply the indices of +the text range that you are going to modify. + +@deftypefun int rl_modifying (int start, int end) +Tell Readline to save the text between @var{start} and @var{end} as a +single undo unit. It is assumed that you will subsequently modify +that text. +@end deftypefun + +@node Redisplay +@subsection Redisplay + +@deftypefun void rl_redisplay (void) +Change what's displayed on the screen to reflect the current contents +of @code{rl_line_buffer}. +@end deftypefun + +@deftypefun int rl_forced_update_display (void) +Force the line to be updated and redisplayed, whether or not +Readline thinks the screen display is correct. +@end deftypefun + +@deftypefun int rl_on_new_line (void) +Tell the update functions that we have moved onto a new (empty) line, +usually after ouputting a newline. +@end deftypefun + +@deftypefun int rl_on_new_line_with_prompt (void) +Tell the update functions that we have moved onto a new line, with +@var{rl_prompt} already displayed. +This could be used by applications that want to output the prompt string +themselves, but still need Readline to know the prompt string length for +redisplay. +It should be used after setting @var{rl_already_prompted}. +@end deftypefun + +@deftypefun int rl_reset_line_state (void) +Reset the display state to a clean state and redisplay the current line +starting on a new line. +@end deftypefun + +@deftypefun int rl_crlf (void) +Move the cursor to the start of the next screen line. +@end deftypefun + +@deftypefun int rl_show_char (int c) +Display character @var{c} on @code{rl_outstream}. +If Readline has not been set to display meta characters directly, this +will convert meta characters to a meta-prefixed key sequence. +This is intended for use by applications which wish to do their own +redisplay. +@end deftypefun + +@deftypefun int rl_message (const char *, @dots{}) +The arguments are a format string as would be supplied to @code{printf}, +possibly containing conversion specifications such as @samp{%d}, and +any additional arguments necessary to satisfy the conversion specifications. +The resulting string is displayed in the @dfn{echo area}. The echo area +is also used to display numeric arguments and search strings. +@end deftypefun + +@deftypefun int rl_clear_message (void) +Clear the message in the echo area. +@end deftypefun + +@deftypefun void rl_save_prompt (void) +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 (void) +Restore the local Readline prompt display state saved by the most +recent call to @code{rl_save_prompt}. +@end deftypefun + +@deftypefun int rl_expand_prompt (char *prompt) +Expand any special character sequences in @var{prompt} and set up the +local Readline prompt redisplay variables. +This function is called by @code{readline()}. It may also be called to +expand the primary prompt if the @code{rl_on_new_line_with_prompt()} +function or @code{rl_already_prompted} variable is used. +It returns the number of visible characters on the last line of the +(possibly multi-line) prompt. +@end deftypefun + +@deftypefun int rl_set_prompt (const char *prompt) +Make Readline use @var{prompt} for subsequent redisplay. This calls +@code{rl_expand_prompt()} to expand the prompt and sets @code{rl_prompt} +to the result. +@end deftypefun + +@node Modifying Text +@subsection Modifying Text + +@deftypefun int rl_insert_text (const char *text) +Insert @var{text} into the line at the current cursor position. +Returns the number of characters inserted. +@end deftypefun + +@deftypefun int rl_delete_text (int start, int end) +Delete the text between @var{start} and @var{end} in the current line. +Returns the number of characters deleted. +@end deftypefun + +@deftypefun {char *} rl_copy_text (int start, int end) +Return a copy of the text between @var{start} and @var{end} in +the current line. +@end deftypefun + +@deftypefun int rl_kill_text (int start, int end) +Copy the text between @var{start} and @var{end} in the current line +to the kill ring, appending or prepending to the last kill if the +last command was a kill command. The text is deleted. +If @var{start} is less than @var{end}, +the text is appended, otherwise prepended. If the last command was +not a kill, a new kill ring slot is used. +@end deftypefun + +@deftypefun int rl_push_macro_input (char *macro) +Cause @var{macro} to be inserted into the line, as if it had been invoked +by a key bound to a macro. Not especially useful; use +@code{rl_insert_text()} instead. +@end deftypefun + +@node Character Input +@subsection Character Input + +@deftypefun int rl_read_key (void) +Return the next character available from Readline's current input stream. +This handles input inserted into +the input stream via @var{rl_pending_input} (@pxref{Readline Variables}) +and @code{rl_stuff_char()}, macros, and characters read from the keyboard. +While waiting for input, this function will call any function assigned to +the @code{rl_event_hook} variable. +@end deftypefun + +@deftypefun int rl_getc (FILE *stream) +Return the next character available from @var{stream}, which is assumed to +be the keyboard. +@end deftypefun + +@deftypefun int rl_stuff_char (int c) +Insert @var{c} into the Readline input stream. It will be "read" +before Readline attempts to read characters from the terminal with +@code{rl_read_key()}. Up to 512 characters may be pushed back. +@code{rl_stuff_char} returns 1 if the character was successfully inserted; +0 otherwise. +@end deftypefun + +@deftypefun int rl_execute_next (int c) +Make @var{c} be the next command to be executed when @code{rl_read_key()} +is called. This sets @var{rl_pending_input}. +@end deftypefun + +@deftypefun int rl_clear_pending_input (void) +Unset @var{rl_pending_input}, effectively negating the effect of any +previous call to @code{rl_execute_next()}. This works only if the +pending input has not already been read with @code{rl_read_key()}. +@end deftypefun + +@deftypefun int rl_set_keyboard_input_timeout (int u) +While waiting for keyboard input in @code{rl_read_key()}, Readline will +wait for @var{u} microseconds for input before calling any function +assigned to @code{rl_event_hook}. The default waiting period is +one-tenth of a second. Returns the old timeout value. +@end deftypefun + +@node Terminal Management +@subsection Terminal Management + +@deftypefun void rl_prep_terminal (int meta_flag) +Modify the terminal settings for Readline's use, so @code{readline()} +can read a single character at a time from the keyboard. +The @var{meta_flag} argument should be non-zero if Readline should +read eight-bit input. +@end deftypefun + +@deftypefun void rl_deprep_terminal (void) +Undo the effects of @code{rl_prep_terminal()}, leaving the terminal in +the state in which it was before the most recent call to +@code{rl_prep_terminal()}. +@end deftypefun + +@deftypefun void rl_tty_set_default_bindings (Keymap kmap) +Read the operating system's terminal editing characters (as would be +displayed by @code{stty}) to their Readline equivalents. +The bindings are performed in @var{kmap}. +@end deftypefun + +@deftypefun void rl_tty_unset_default_bindings (Keymap kmap) +Reset the bindings manipulated by @code{rl_tty_set_default_bindings} so +that the terminal editing characters are bound to @code{rl_insert}. +The bindings are performed in @var{kmap}. +@end deftypefun + +@deftypefun int rl_reset_terminal (const char *terminal_name) +Reinitialize Readline's idea of the terminal settings using +@var{terminal_name} as the terminal type (e.g., @code{vt100}). +If @var{terminal_name} is @code{NULL}, the value of the @code{TERM} +environment variable is used. +@end deftypefun + +@node Utility Functions +@subsection Utility Functions + +@deftypefun void rl_replace_line (const char *text, int clear_undo) +Replace the contents of @code{rl_line_buffer} with @var{text}. +The point and mark are preserved, if possible. +If @var{clear_undo} is non-zero, the undo list associated with the +current line is cleared. +@end deftypefun + +@deftypefun int rl_extend_line_buffer (int len) +Ensure that @code{rl_line_buffer} has enough space to hold @var{len} +characters, possibly reallocating it if necessary. +@end deftypefun + +@deftypefun int rl_initialize (void) +Initialize or re-initialize Readline's internal state. +It's not strictly necessary to call this; @code{readline()} calls it before +reading any input. +@end deftypefun + +@deftypefun int rl_ding (void) +Ring the terminal bell, obeying the setting of @code{bell-style}. +@end deftypefun + +@deftypefun int rl_alphabetic (int c) +Return 1 if @var{c} is an alphabetic character. +@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{chardefs.h}. +Applications should refrain from using them. + +@deftypefun int _rl_uppercase_p (int c) +Return 1 if @var{c} is an uppercase alphabetic character. +@end deftypefun + +@deftypefun int _rl_lowercase_p (int c) +Return 1 if @var{c} is a lowercase alphabetic character. +@end deftypefun + +@deftypefun int _rl_digit_p (int c) +Return 1 if @var{c} is a numeric character. +@end deftypefun + +@deftypefun int _rl_to_upper (int c) +If @var{c} is a lowercase alphabetic character, return the corresponding +uppercase character. +@end deftypefun + +@deftypefun int _rl_to_lower (int c) +If @var{c} is an uppercase alphabetic character, return the corresponding +lowercase character. +@end deftypefun + +@deftypefun int _rl_digit_value (int c) +If @var{c} is a number, return the value it represents. +@end deftypefun + +@node Miscellaneous Functions +@subsection Miscellaneous Functions + +@deftypefun int rl_macro_bind (const char *keyseq, const char *macro, Keymap map) +Bind the key sequence @var{keyseq} to invoke the macro @var{macro}. +The binding is performed in @var{map}. When @var{keyseq} is invoked, the +@var{macro} will be inserted into the line. This function is deprecated; +use @code{rl_generic_bind()} instead. +@end deftypefun + +@deftypefun void rl_macro_dumper (int readable) +Print the key sequences bound to macros and their values, using +the current keymap, to @code{rl_outstream}. +If @var{readable} is non-zero, the list is formatted in such a way +that it can be made part of an @code{inputrc} file and re-read. +@end deftypefun + +@deftypefun int rl_variable_bind (const char *variable, const char *value) +Make the Readline variable @var{variable} have @var{value}. +This behaves as if the readline command +@samp{set @var{variable} @var{value}} had been executed in an @code{inputrc} +file (@pxref{Readline Init File Syntax}). +@end deftypefun + +@deftypefun void rl_variable_dumper (int readable) +Print the readline variable names and their current values +to @code{rl_outstream}. +If @var{readable} is non-zero, the list is formatted in such a way +that it can be made part of an @code{inputrc} file and re-read. +@end deftypefun + +@deftypefun int rl_set_paren_blink_timeout (int u) +Set the time interval (in microseconds) that Readline waits when showing +a balancing character when @code{blink-matching-paren} has been enabled. +@end deftypefun + +@deftypefun {char *} rl_get_termcap (const char *cap) +Retrieve the string value of the termcap capability @var{cap}. +Readline fetches the termcap entry for the current terminal name and +uses those capabilities to move around the screen line and perform other +terminal-specific operations, like erasing a line. Readline does not +use all of a terminal's capabilities, and this function will return +values for only those capabilities Readline uses. +@end deftypefun + +@node Alternate Interface +@subsection Alternate Interface + +An alternate interface is available to plain @code{readline()}. Some +applications need to interleave keyboard I/O with file, device, or +window system I/O, typically by using a main loop to @code{select()} +on various file descriptors. To accomodate this need, readline can +also be invoked as a `callback' function from an event loop. There +are functions available to make this easy. + +@deftypefun void rl_callback_handler_install (const char *prompt, rl_vcpfunc_t *lhandler) +Set up the terminal for readline I/O and display the initial +expanded value of @var{prompt}. Save the value of @var{lhandler} to +use as a function to call when a complete line of input has been entered. +The function takes the text of the line as an argument. +@end deftypefun + +@deftypefun void rl_callback_read_char (void) +Whenever an application determines that keyboard input is available, it +should call @code{rl_callback_read_char()}, which will read the next +character from the current input source. +If that character completes the line, @code{rl_callback_read_char} will +invoke the @var{lhandler} function saved by @code{rl_callback_handler_install} +to process the line. +Before calling the @var{lhandler} function, the terminal settings are +reset to the values they had before calling +@code{rl_callback_handler_install}. +If the @var{lhandler} function returns, +the terminal settings are modified for Readline's use again. +@code{EOF} is indicated by calling @var{lhandler} with a +@code{NULL} line. +@end deftypefun + +@deftypefun void rl_callback_handler_remove (void) +Restore the terminal to its initial state and remove the line handler. +This may be called from within a callback as well as independently. +If the @var{lhandler} installed by @code{rl_callback_handler_install} +does not exit the program, either this function or the function referred +to by the value of @code{rl_deprep_term_function} should be called before +the program exits to reset the terminal settings. +@end deftypefun + +@node A Readline Example +@subsection A Readline Example + +Here is a function which changes lowercase characters to their uppercase +equivalents, and uppercase characters to lowercase. If +this function was bound to @samp{M-c}, then typing @samp{M-c} would +change the case of the character under point. Typing @samp{M-1 0 M-c} +would change the case of the following 10 characters, leaving the cursor on +the last character changed. + +@example +/* Invert the case of the COUNT following characters. */ +int +invert_case_line (count, key) + int count, key; +@{ + register int start, end, i; + + start = rl_point; + + if (rl_point >= rl_end) + return (0); + + if (count < 0) + @{ + direction = -1; + count = -count; + @} + else + direction = 1; + + /* Find the end of the range to modify. */ + end = start + (count * direction); + + /* Force it to be within range. */ + if (end > rl_end) + end = rl_end; + else if (end < 0) + end = 0; + + if (start == end) + return (0); + + if (start > end) + @{ + int temp = start; + start = end; + end = temp; + @} + + /* Tell readline that we are modifying the line, + so it will save the undo information. */ + rl_modifying (start, end); + + for (i = start; i != end; i++) + @{ + if (_rl_uppercase_p (rl_line_buffer[i])) + rl_line_buffer[i] = _rl_to_lower (rl_line_buffer[i]); + else if (_rl_lowercase_p (rl_line_buffer[i])) + rl_line_buffer[i] = _rl_to_upper (rl_line_buffer[i]); + @} + /* Move point to on top of the last character changed. */ + rl_point = (direction == 1) ? end - 1 : start; + return (0); +@} +@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 such a signal is received in order 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()} below). + +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 information, 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()} or @code{rl_set_screen_size()} 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 by reading values from the kernel. +@end deftypefun + +@deftypefun void rl_set_screen_size (int rows, int cols) +Set Readline's idea of the terminal size to @var{rows} rows and +@var{cols} columns. +@end deftypefun + +If an application does not want to install a @code{SIGWINCH} handler, but +is still interested in the screen dimensions, Readline's idea of the screen +size may be queried. + +@deftypefun void rl_get_screen_size (int *rows, int *cols) +Return Readline's idea of the terminal's size in the +variables pointed to by the arguments. +@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 +@cindex application-specific completion functions + +Typically, a program that reads commands from the user has a way of +disambiguating commands and data. If your program is one of these, then +it can provide completion for commands, data, or both. +The following sections describe how your program and Readline +cooperate to provide this service. + +@menu +* How Completing Works:: The logic used to do completion. +* Completion Functions:: Functions provided by Readline. +* Completion Variables:: Variables which control completion. +* A Short Completion Example:: An example of writing completer subroutines. +@end menu + +@node How Completing Works +@subsection How Completing Works + +In order to complete some text, the full list of possible completions +must be available. That is, it is not possible to accurately +expand a partial word without knowing all of the possible words +which make sense in that context. The Readline library provides +the user interface to completion, and two of the most common +completion functions: filename and username. For completing other types +of text, you must write your own completion function. This section +describes exactly what such functions must do, and provides an example. + +There are three major functions used to perform completion: + +@enumerate +@item +The user-interface function @code{rl_complete()}. This function is +called with the same arguments as other bindable Readline functions: +@var{count} and @var{invoking_key}. +It isolates the word to be completed and calls +@code{rl_completion_matches()} to generate a list of possible completions. +It then either lists the possible completions, inserts the possible +completions, or actually performs the +completion, depending on which behavior is desired. + +@item +The internal function @code{rl_completion_matches()} uses an +application-supplied @dfn{generator} function to generate the list of +possible matches, and then returns the array of these matches. +The caller should place the address of its generator function in +@code{rl_completion_entry_function}. + +@item +The generator function is called repeatedly from +@code{rl_completion_matches()}, returning a string each time. The +arguments to the generator function are @var{text} and @var{state}. +@var{text} is the partial word to be completed. @var{state} is zero the +first time the function is called, allowing the generator to perform +any necessary initialization, and a positive non-zero integer for +each subsequent call. The generator function returns +@code{(char *)NULL} to inform @code{rl_completion_matches()} that there are +no more possibilities left. Usually the generator function computes the +list of possible completions when @var{state} is zero, and returns them +one at a time on subsequent calls. Each string the generator function +returns as a match must be allocated with @code{malloc()}; Readline +frees the strings when it has finished with them. +Such a generator function is referred to as an +@dfn{application-specific completion function}. + +@end enumerate + +@deftypefun int rl_complete (int ignore, int invoking_key) +Complete the word at or before point. You have supplied the function +that does the initial simple matching selection algorithm (see +@code{rl_completion_matches()}). The default is to do filename completion. +@end deftypefun + +@deftypevar {rl_compentry_func_t *} rl_completion_entry_function +This is a pointer to the generator function for +@code{rl_completion_matches()}. +If the value of @code{rl_completion_entry_function} is +@code{NULL} then the default filename generator +function, @code{rl_filename_completion_function()}, is used. +An @dfn{application-specific completion function} is a function whose +address is assigned to @code{rl_completion_entry_function} and whose +return values are used to generate possible completions. +@end deftypevar + +@node Completion Functions +@subsection Completion Functions + +Here is the complete list of callable completion functions present in +Readline. + +@deftypefun int rl_complete_internal (int what_to_do) +Complete the word at or before point. @var{what_to_do} says what to do +with the completion. A value of @samp{?} means list the possible +completions. @samp{TAB} means do standard completion. @samp{*} means +insert all of the possible completions. @samp{!} means to display +all of the possible completions, if there is more than one, as well as +performing partial completion. @samp{@@} is similar to @samp{!}, but +possible completions are not listed if the possible completions share +a common prefix. +@end deftypefun + +@deftypefun int rl_complete (int ignore, int invoking_key) +Complete the word at or before point. You have supplied the function +that does the initial simple matching selection algorithm (see +@code{rl_completion_matches()} and @code{rl_completion_entry_function}). +The default is to do filename +completion. This calls @code{rl_complete_internal()} with an +argument depending on @var{invoking_key}. +@end deftypefun + +@deftypefun int rl_possible_completions (int count, int invoking_key) +List the possible completions. See description of @code{rl_complete +()}. This calls @code{rl_complete_internal()} with an argument of +@samp{?}. +@end deftypefun + +@deftypefun int rl_insert_completions (int count, int invoking_key) +Insert the list of possible completions into the line, deleting the +partially-completed word. See description of @code{rl_complete()}. +This calls @code{rl_complete_internal()} with an argument of @samp{*}. +@end deftypefun + +@deftypefun int rl_completion_mode (rl_command_func_t *cfunc) +Returns the apppriate value to pass to @code{rl_complete_internal()} +depending on whether @var{cfunc} was called twice in succession and +the values of the @code{show-all-if-ambiguous} and +@code{show-all-if-unmodified} variables. +Application-specific completion functions may use this function to present +the same interface as @code{rl_complete()}. +@end deftypefun + +@deftypefun {char **} rl_completion_matches (const char *text, rl_compentry_func_t *entry_func) +Returns an array of strings which is a list of completions for +@var{text}. If there are no completions, returns @code{NULL}. +The first entry in the returned array is the substitution for @var{text}. +The remaining entries are the possible completions. The array is +terminated with a @code{NULL} pointer. + +@var{entry_func} is a function of two args, and returns a +@code{char *}. The first argument is @var{text}. The second is a +state argument; it is zero on the first call, and non-zero on subsequent +calls. @var{entry_func} returns a @code{NULL} pointer to the caller +when there are no more matches. +@end deftypefun + +@deftypefun {char *} rl_filename_completion_function (const char *text, int state) +A generator function for filename completion in the general case. +@var{text} is a partial filename. +The Bash source is a useful reference for writing application-specific +completion functions (the Bash completion functions call this and other +Readline functions). +@end deftypefun + +@deftypefun {char *} rl_username_completion_function (const char *text, int state) +A completion generator for usernames. @var{text} contains a partial +username preceded by a random character (usually @samp{~}). As with all +completion generators, @var{state} is zero on the first call and non-zero +for subsequent calls. +@end deftypefun + +@node Completion Variables +@subsection Completion Variables + +@deftypevar {rl_compentry_func_t *} rl_completion_entry_function +A pointer to the generator function for @code{rl_completion_matches()}. +@code{NULL} means to use @code{rl_filename_completion_function()}, +the default filename completer. +@end deftypevar + +@deftypevar {rl_completion_func_t *} rl_attempted_completion_function +A pointer to an alternative function to create matches. +The function is called with @var{text}, @var{start}, and @var{end}. +@var{start} and @var{end} are indices in @code{rl_line_buffer} defining +the boundaries of @var{text}, which is a character string. +If this function exists and returns @code{NULL}, or if this variable is +set to @code{NULL}, then @code{rl_complete()} will call the value of +@code{rl_completion_entry_function} to generate matches, otherwise the +array of strings returned will be used. +If this function sets the @code{rl_attempted_completion_over} +variable to a non-zero value, Readline will not perform its default +completion even if this function returns no matches. +@end deftypevar + +@deftypevar {rl_quote_func_t *} rl_filename_quoting_function +A pointer to a function that will quote a filename in an +application-specific fashion. This is called if filename completion is being +attempted and one of the characters in @code{rl_filename_quote_characters} +appears in a completed filename. The function is called with +@var{text}, @var{match_type}, and @var{quote_pointer}. The @var{text} +is the filename to be quoted. The @var{match_type} is either +@code{SINGLE_MATCH}, if there is only one completion match, or +@code{MULT_MATCH}. Some functions use this to decide whether or not to +insert a closing quote character. The @var{quote_pointer} is a pointer +to any opening quote character the user typed. Some functions choose +to reset this character. +@end deftypevar + +@deftypevar {rl_dequote_func_t *} rl_filename_dequoting_function +A pointer to a function that will remove application-specific quoting +characters from a filename before completion is attempted, so those +characters do not interfere with matching the text against names in +the filesystem. It is called with @var{text}, the text of the word +to be dequoted, and @var{quote_char}, which is the quoting character +that delimits the filename (usually @samp{'} or @samp{"}). If +@var{quote_char} is zero, the filename was not in an embedded string. +@end deftypevar + +@deftypevar {rl_linebuf_func_t *} rl_char_is_quoted_p +A pointer to a function to call that determines whether or not a specific +character in the line buffer is quoted, according to whatever quoting +mechanism the program calling Readline uses. The function is called with +two arguments: @var{text}, the text of the line, and @var{index}, the +index of the character in the line. It is used to decide whether a +character found in @code{rl_completer_word_break_characters} should be +used to break words for the completer. +@end deftypevar + +@deftypevar {rl_compignore_func_t *} rl_ignore_some_completions_function +This function, if defined, is called by the completer when real filename +completion is done, after all the matching names have been generated. +It is passed a @code{NULL} terminated array of matches. +The first element (@code{matches[0]}) is the +maximal substring common to all matches. This function can +re-arrange the list of matches as required, but each element deleted +from the array must be freed. +@end deftypevar + +@deftypevar {rl_icppfunc_t *} rl_directory_completion_hook +This function, if defined, is allowed to modify the directory portion +of filenames Readline completes. It is called with the address of a +string (the current directory name) as an argument, and may modify that string. +If the string is replaced with a new string, the old value should be freed. +Any modified directory name should have a trailing slash. +The modified value will be displayed as part of the completion, replacing +the directory portion of the pathname the user typed. +It returns an integer that should be non-zero if the function modifies +its directory argument. +It could be used to expand symbolic links or shell variables in pathnames. +@end deftypevar + +@deftypevar {rl_compdisp_func_t *} 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 + +@deftypevar {const char *} rl_basic_word_break_characters +The basic list of characters that signal a break between words for the +completer routine. The default value of this variable is the characters +which break words for completion in Bash: +@code{" \t\n\"\\'`@@$><=;|&@{("}. +@end deftypevar + +@deftypevar {const char *} rl_basic_quote_characters +A list of quote characters which can cause a word break. +@end deftypevar + +@deftypevar {const char *} rl_completer_word_break_characters +The list of characters that signal a break between words for +@code{rl_complete_internal()}. The default list is the value of +@code{rl_basic_word_break_characters}. +@end deftypevar + +@deftypevar {const char *} rl_completer_quote_characters +A list of characters which can be used to quote a substring of the line. +Completion occurs on the entire substring, and within the substring +@code{rl_completer_word_break_characters} are treated as any other character, +unless they also appear within this list. +@end deftypevar + +@deftypevar {const char *} rl_filename_quote_characters +A list of characters that cause a filename to be quoted by the completer +when they appear in a completed filename. The default is the null string. +@end deftypevar + +@deftypevar {const char *} rl_special_prefixes +The list of characters that are word break characters, but should be +left in @var{text} when it is passed to the completion function. +Programs can use this to help determine what kind of completing to do. +For instance, Bash sets this variable to "$@@" so that it can complete +shell variables and hostnames. +@end deftypevar + +@deftypevar int rl_completion_query_items +Up to this many items will be displayed in response to a +possible-completions call. After that, we ask the user if she is sure +she wants to see them all. The default value is 100. +@end deftypevar + +@deftypevar {int} rl_completion_append_character +When a single completion alternative matches at the end of the command +line, this character is appended to the inserted completion text. The +default is a space character (@samp{ }). Setting this to the null +character (@samp{\0}) prevents anything being appended automatically. +This can be changed in application-specific completion functions to +provide the ``most sensible word separator character'' according to +an application-specific command line syntax specification. +@end deftypevar + +@deftypevar int rl_completion_suppress_append +If non-zero, @var{rl_completion_append_character} is not appended to +matches at the end of the command line, as described above. It is +set to 0 before any application-specific completion function is called, +and may only be changed within such a function. +@end deftypevar + +@deftypevar int rl_completion_mark_symlink_dirs +If non-zero, a slash will be appended to completed filenames that are +symbolic links to directory names, subject to the value of the +user-settable @var{mark-directories} variable. +This variable exists so that application-specific completion functions +can override the user's global preference (set via the +@var{mark-symlinked-directories} Readline variable) if appropriate. +This variable is set to the user's preference before any +application-specific completion function is called, so unless that +function modifies the value, the user's preferences are honored. +@end deftypevar + +@deftypevar int rl_ignore_completion_duplicates +If non-zero, then duplicates in the matches are removed. +The default is 1. +@end deftypevar + +@deftypevar int rl_filename_completion_desired +Non-zero means that the results of the matches are to be treated as +filenames. This is @emph{always} zero when completion is attempted, +and can only be changed +within an application-specific completion function. If it is set to a +non-zero value by such a function, directory names have a slash appended +and Readline attempts to quote completed filenames if they contain any +characters in @code{rl_filename_quote_characters} and +@code{rl_filename_quoting_desired} is set to a non-zero value. +@end deftypevar + +@deftypevar int rl_filename_quoting_desired +Non-zero means that the results of the matches are to be quoted using +double quotes (or an application-specific quoting mechanism) if the +completed filename contains any characters in +@code{rl_filename_quote_chars}. This is @emph{always} non-zero +when completion is attempted, and can only be changed within an +application-specific completion function. +The quoting is effected via a call to the function pointed to +by @code{rl_filename_quoting_function}. +@end deftypevar + +@deftypevar int rl_attempted_completion_over +If an application-specific completion function assigned to +@code{rl_attempted_completion_function} sets this variable to a non-zero +value, Readline will not perform its default filename completion even +if the application's completion function returns no matches. +It should be set only by an application's completion function. +@end deftypevar + +@deftypevar int rl_completion_type +Set to a character describing the type of completion Readline is currently +attempting; see the description of @code{rl_complete_internal()} +(@pxref{Completion Functions}) for the list of characters. +This is set to the appropriate value before any application-specific +completion function is called, allowing such functions to present +the same interface as @code{rl_complete()}. +@end deftypevar + +@deftypevar int rl_inhibit_completion +If this variable is non-zero, completion is inhibited. The completion +character will be inserted as any other bound to @code{self-insert}. +@end deftypevar + +@node A Short Completion Example +@subsection A Short Completion Example + +Here is a small application demonstrating the use of the GNU Readline +library. It is called @code{fileman}, and the source code resides in +@file{examples/fileman.c}. This sample application provides +completion of command names, line editing features, and access to the +history list. + +@page +@smallexample +/* fileman.c -- A tiny application which demonstrates how to use the + GNU Readline library. This application interactively allows users + to manipulate files and their modes. */ + +#include <stdio.h> +#include <sys/types.h> +#include <sys/file.h> +#include <sys/stat.h> +#include <sys/errno.h> + +#include <readline/readline.h> +#include <readline/history.h> + +extern char *xmalloc (); + +/* The names of functions that actually do the manipulation. */ +int com_list __P((char *)); +int com_view __P((char *)); +int com_rename __P((char *)); +int com_stat __P((char *)); +int com_pwd __P((char *)); +int com_delete __P((char *)); +int com_help __P((char *)); +int com_cd __P((char *)); +int com_quit __P((char *)); + +/* A structure which contains information on the commands this program + can understand. */ + +typedef struct @{ + char *name; /* User printable name of the function. */ + rl_icpfunc_t *func; /* Function to call to do the job. */ + char *doc; /* Documentation for this function. */ +@} COMMAND; + +COMMAND commands[] = @{ + @{ "cd", com_cd, "Change to directory DIR" @}, + @{ "delete", com_delete, "Delete FILE" @}, + @{ "help", com_help, "Display this text" @}, + @{ "?", com_help, "Synonym for `help'" @}, + @{ "list", com_list, "List files in DIR" @}, + @{ "ls", com_list, "Synonym for `list'" @}, + @{ "pwd", com_pwd, "Print the current working directory" @}, + @{ "quit", com_quit, "Quit using Fileman" @}, + @{ "rename", com_rename, "Rename FILE to NEWNAME" @}, + @{ "stat", com_stat, "Print out statistics on FILE" @}, + @{ "view", com_view, "View the contents of FILE" @}, + @{ (char *)NULL, (rl_icpfunc_t *)NULL, (char *)NULL @} +@}; + +/* Forward declarations. */ +char *stripwhite (); +COMMAND *find_command (); + +/* The name of this program, as taken from argv[0]. */ +char *progname; + +/* When non-zero, this means the user is done using this program. */ +int done; + +char * +dupstr (s) + int s; +@{ + char *r; + + r = xmalloc (strlen (s) + 1); + strcpy (r, s); + return (r); +@} + +main (argc, argv) + int argc; + char **argv; +@{ + char *line, *s; + + progname = argv[0]; + + initialize_readline (); /* Bind our completer. */ + + /* Loop reading and executing lines until the user quits. */ + for ( ; done == 0; ) + @{ + line = readline ("FileMan: "); + + if (!line) + break; + + /* Remove leading and trailing whitespace from the line. + Then, if there is anything left, add it to the history list + and execute it. */ + s = stripwhite (line); + + if (*s) + @{ + add_history (s); + execute_line (s); + @} + + free (line); + @} + exit (0); +@} + +/* Execute a command line. */ +int +execute_line (line) + char *line; +@{ + register int i; + COMMAND *command; + char *word; + + /* Isolate the command word. */ + i = 0; + while (line[i] && whitespace (line[i])) + i++; + word = line + i; + + while (line[i] && !whitespace (line[i])) + i++; + + if (line[i]) + line[i++] = '\0'; + + command = find_command (word); + + if (!command) + @{ + fprintf (stderr, "%s: No such command for FileMan.\n", word); + return (-1); + @} + + /* Get argument to command, if any. */ + while (whitespace (line[i])) + i++; + + word = line + i; + + /* Call the function. */ + return ((*(command->func)) (word)); +@} + +/* Look up NAME as the name of a command, and return a pointer to that + command. Return a NULL pointer if NAME isn't a command name. */ +COMMAND * +find_command (name) + char *name; +@{ + register int i; + + for (i = 0; commands[i].name; i++) + if (strcmp (name, commands[i].name) == 0) + return (&commands[i]); + + return ((COMMAND *)NULL); +@} + +/* Strip whitespace from the start and end of STRING. Return a pointer + into STRING. */ +char * +stripwhite (string) + char *string; +@{ + register char *s, *t; + + for (s = string; whitespace (*s); s++) + ; + + if (*s == 0) + return (s); + + t = s + strlen (s) - 1; + while (t > s && whitespace (*t)) + t--; + *++t = '\0'; + + return s; +@} + +/* **************************************************************** */ +/* */ +/* Interface to Readline Completion */ +/* */ +/* **************************************************************** */ + +char *command_generator __P((const char *, int)); +char **fileman_completion __P((const char *, int, int)); + +/* Tell the GNU Readline library how to complete. We want to try to + complete on command names if this is the first word in the line, or + on filenames if not. */ +initialize_readline () +@{ + /* Allow conditional parsing of the ~/.inputrc file. */ + rl_readline_name = "FileMan"; + + /* Tell the completer that we want a crack first. */ + rl_attempted_completion_function = fileman_completion; +@} + +/* Attempt to complete on the contents of TEXT. START and END + bound the region of rl_line_buffer that contains the word to + complete. TEXT is the word to complete. We can use the entire + contents of rl_line_buffer in case we want to do some simple + parsing. Returnthe array of matches, or NULL if there aren't any. */ +char ** +fileman_completion (text, start, end) + const char *text; + int start, end; +@{ + char **matches; + + matches = (char **)NULL; + + /* If this word is at the start of the line, then it is a command + to complete. Otherwise it is the name of a file in the current + directory. */ + if (start == 0) + matches = rl_completion_matches (text, command_generator); + + return (matches); +@} + +/* Generator function for command completion. STATE lets us + know whether to start from scratch; without any state + (i.e. STATE == 0), then we start at the top of the list. */ +char * +command_generator (text, state) + const char *text; + int state; +@{ + static int list_index, len; + char *name; + + /* If this is a new word to complete, initialize now. This + includes saving the length of TEXT for efficiency, and + initializing the index variable to 0. */ + if (!state) + @{ + list_index = 0; + len = strlen (text); + @} + + /* Return the next name which partially matches from the + command list. */ + while (name = commands[list_index].name) + @{ + list_index++; + + if (strncmp (name, text, len) == 0) + return (dupstr(name)); + @} + + /* If no names matched, then return NULL. */ + return ((char *)NULL); +@} + +/* **************************************************************** */ +/* */ +/* FileMan Commands */ +/* */ +/* **************************************************************** */ + +/* String to pass to system (). This is for the LIST, VIEW and RENAME + commands. */ +static char syscom[1024]; + +/* List the file(s) named in arg. */ +com_list (arg) + char *arg; +@{ + if (!arg) + arg = ""; + + sprintf (syscom, "ls -FClg %s", arg); + return (system (syscom)); +@} + +com_view (arg) + char *arg; +@{ + if (!valid_argument ("view", arg)) + return 1; + + sprintf (syscom, "more %s", arg); + return (system (syscom)); +@} + +com_rename (arg) + char *arg; +@{ + too_dangerous ("rename"); + return (1); +@} + +com_stat (arg) + char *arg; +@{ + struct stat finfo; + + if (!valid_argument ("stat", arg)) + return (1); + + if (stat (arg, &finfo) == -1) + @{ + perror (arg); + return (1); + @} + + printf ("Statistics for `%s':\n", arg); + + printf ("%s has %d link%s, and is %d byte%s in length.\n", arg, + finfo.st_nlink, + (finfo.st_nlink == 1) ? "" : "s", + finfo.st_size, + (finfo.st_size == 1) ? "" : "s"); + printf ("Inode Last Change at: %s", ctime (&finfo.st_ctime)); + printf (" Last access at: %s", ctime (&finfo.st_atime)); + printf (" Last modified at: %s", ctime (&finfo.st_mtime)); + return (0); +@} + +com_delete (arg) + char *arg; +@{ + too_dangerous ("delete"); + return (1); +@} + +/* Print out help for ARG, or for all of the commands if ARG is + not present. */ +com_help (arg) + char *arg; +@{ + register int i; + int printed = 0; + + for (i = 0; commands[i].name; i++) + @{ + if (!*arg || (strcmp (arg, commands[i].name) == 0)) + @{ + printf ("%s\t\t%s.\n", commands[i].name, commands[i].doc); + printed++; + @} + @} + + if (!printed) + @{ + printf ("No commands match `%s'. Possibilties are:\n", arg); + + for (i = 0; commands[i].name; i++) + @{ + /* Print in six columns. */ + if (printed == 6) + @{ + printed = 0; + printf ("\n"); + @} + + printf ("%s\t", commands[i].name); + printed++; + @} + + if (printed) + printf ("\n"); + @} + return (0); +@} + +/* Change to the directory ARG. */ +com_cd (arg) + char *arg; +@{ + if (chdir (arg) == -1) + @{ + perror (arg); + return 1; + @} + + com_pwd (""); + return (0); +@} + +/* Print out the current working directory. */ +com_pwd (ignore) + char *ignore; +@{ + char dir[1024], *s; + + s = getcwd (dir, sizeof(dir) - 1); + if (s == 0) + @{ + printf ("Error getting pwd: %s\n", dir); + return 1; + @} + + printf ("Current directory is %s\n", dir); + return 0; +@} + +/* The user wishes to quit using this program. Just set DONE + non-zero. */ +com_quit (arg) + char *arg; +@{ + done = 1; + return (0); +@} + +/* Function which tells you that you can't do this. */ +too_dangerous (caller) + char *caller; +@{ + fprintf (stderr, + "%s: Too dangerous for me to distribute.\n" + caller); + fprintf (stderr, "Write it yourself.\n"); +@} + +/* Return non-zero if ARG is a valid argument for CALLER, + else print an error message and return zero. */ +int +valid_argument (caller, arg) + char *caller, *arg; +@{ + if (!arg || !*arg) + @{ + fprintf (stderr, "%s: Argument required.\n", caller); + return (0); + @} + + return (1); +@} +@end smallexample diff --git a/lib/readline/doc/rluser.texi b/lib/readline/doc/rluser.texi new file mode 100644 index 00000000..ead09e46 --- /dev/null +++ b/lib/readline/doc/rluser.texi @@ -0,0 +1,1819 @@ +@comment %**start of header (This is for running Texinfo on a region.) +@setfilename rluser.info +@comment %**end of header (This is for running Texinfo on a region.) +@setchapternewpage odd + +@ignore +This file documents the end user interface to the GNU command line +editing features. It is to be an appendix to manuals for programs which +use these features. There is a document entitled "readline.texinfo" +which contains both end-user and programmer documentation for the +GNU Readline Library. + +Copyright (C) 1988-2002 Free Software Foundation, Inc. + +Authored by Brian Fox and Chet Ramey. + +Permission is granted to process this file through Tex and print the +results, provided the printed document carries copying permission notice +identical to this one except for the removal of this paragraph (this +paragraph not being relevant to the printed manual). + +Permission is granted to make and distribute verbatim copies of this manual +provided the copyright notice and this permission notice are preserved on +all copies. + +Permission is granted to copy and distribute modified versions of this +manual under the conditions for verbatim copying, provided also that the +GNU Copyright statement is available to the distributee, and provided that +the entire resulting derived work is distributed under the terms of a +permission 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. +@end ignore + +@comment If you are including this manual as an appendix, then set the +@comment variable readline-appendix. + +@ifclear BashFeatures +@defcodeindex bt +@end ifclear + +@node Command Line Editing +@chapter Command Line Editing + +This chapter describes the basic features of the @sc{gnu} +command line editing interface. +@ifset BashFeatures +Command line editing is provided by the Readline library, which is +used by several different programs, including Bash. +@end ifset + +@menu +* Introduction and Notation:: Notation used in this text. +* Readline Interaction:: The minimum set of commands for editing a line. +* Readline Init File:: Customizing Readline from a user's view. +* Bindable Readline Commands:: A description of most of the Readline commands + available for binding +* Readline vi Mode:: A short description of how to make Readline + behave like the vi editor. +@ifset BashFeatures +* Programmable Completion:: How to specify the possible completions for + a specific command. +* Programmable Completion Builtins:: Builtin commands to specify how to + complete arguments for a particular command. +@end ifset +@end menu + +@node Introduction and Notation +@section Introduction to Line Editing + +The following paragraphs describe the notation used to represent +keystrokes. + +The text @kbd{C-k} is read as `Control-K' and describes the character +produced when the @key{k} key is pressed while the Control key +is depressed. + +The text @kbd{M-k} is read as `Meta-K' and describes the character +produced when the Meta key (if you have one) is depressed, and the @key{k} +key is pressed. +The Meta key is labeled @key{ALT} on many keyboards. +On keyboards with two keys labeled @key{ALT} (usually to either side of +the space bar), the @key{ALT} on the left side is generally set to +work as a Meta key. +The @key{ALT} key on the right may also be configured to work as a +Meta key or may be configured as some other modifier, such as a +Compose key for typing accented characters. + +If you do not have a Meta or @key{ALT} key, or another key working as +a Meta key, the identical keystroke can be generated by typing @key{ESC} +@emph{first}, and then typing @key{k}. +Either process is known as @dfn{metafying} the @key{k} key. + +The text @kbd{M-C-k} is read as `Meta-Control-k' and describes the +character produced by @dfn{metafying} @kbd{C-k}. + +In addition, several keys have their own names. Specifically, +@key{DEL}, @key{ESC}, @key{LFD}, @key{SPC}, @key{RET}, and @key{TAB} all +stand for themselves when seen in this text, or in an init file +(@pxref{Readline Init File}). +If your keyboard lacks a @key{LFD} key, typing @key{C-j} will +produce the desired character. +The @key{RET} key may be labeled @key{Return} or @key{Enter} on +some keyboards. + +@node Readline Interaction +@section Readline Interaction +@cindex interaction, readline + +Often during an interactive session you type in a long line of text, +only to notice that the first word on the line is misspelled. The +Readline library gives you a set of commands for manipulating the text +as you type it in, allowing you to just fix your typo, and not forcing +you to retype the majority of the line. Using these editing commands, +you move the cursor to the place that needs correction, and delete or +insert the text of the corrections. Then, when you are satisfied with +the line, you simply press @key{RET}. You do not have to be at the +end of the line to press @key{RET}; the entire line is accepted +regardless of the location of the cursor within the line. + +@menu +* Readline Bare Essentials:: The least you need to know about Readline. +* Readline Movement Commands:: Moving about the input 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 + +@node Readline Bare Essentials +@subsection Readline Bare Essentials +@cindex notation, readline +@cindex command editing +@cindex editing command lines + +In order to enter characters into the line, simply type them. The typed +character appears where the cursor was, and then the cursor moves one +space to the right. If you mistype a character, you can use your +erase character to back up and delete the mistyped character. + +Sometimes you may mistype a character, and +not notice the error until you have typed several other characters. In +that case, you can type @kbd{C-b} to move the cursor to the left, and then +correct your mistake. Afterwards, you can move the cursor to the right +with @kbd{C-f}. + +When you add text in the middle of a line, you will notice that characters +to the right of the cursor are `pushed over' to make room for the text +that you have inserted. Likewise, when you delete text behind the cursor, +characters to the right of the cursor are `pulled back' to fill in the +blank space created by the removal of the text. A list of the bare +essentials for editing the text of an input line follows. + +@table @asis +@item @kbd{C-b} +Move back one character. +@item @kbd{C-f} +Move forward one character. +@item @key{DEL} or @key{Backspace} +Delete the character to the left of the cursor. +@item @kbd{C-d} +Delete the character underneath the cursor. +@item @w{Printing characters} +Insert the character into the line at the cursor. +@item @kbd{C-_} or @kbd{C-x C-u} +Undo the last editing command. You can undo all the way back to an +empty line. +@end table + +@noindent +(Depending on your configuration, the @key{Backspace} key be set to +delete the character to the left of the cursor and the @key{DEL} key set +to delete the character underneath the cursor, like @kbd{C-d}, rather +than the character to the left of the cursor.) + +@node Readline Movement Commands +@subsection Readline Movement Commands + + +The above table describes the most basic keystrokes that you need +in order to do editing of the input line. For your convenience, many +other commands have been added in addition to @kbd{C-b}, @kbd{C-f}, +@kbd{C-d}, and @key{DEL}. Here are some commands for moving more rapidly +about the line. + +@table @kbd +@item C-a +Move to the start of the line. +@item C-e +Move to the end of the line. +@item M-f +Move forward a word, where a word is composed of letters and digits. +@item M-b +Move backward a word. +@item C-l +Clear the screen, reprinting the current line at the top. +@end table + +Notice how @kbd{C-f} moves forward a character, while @kbd{M-f} moves +forward a word. It is a loose convention that control keystrokes +operate on characters while meta keystrokes operate on words. + +@node Readline Killing Commands +@subsection Readline Killing Commands + +@cindex killing text +@cindex yanking text + +@dfn{Killing} text means to delete the text from the line, but to save +it away for later use, usually by @dfn{yanking} (re-inserting) +it back into the line. +(`Cut' and `paste' are more recent jargon for `kill' and `yank'.) + +If the description for a command says that it `kills' text, then you can +be sure that you can get the text back in a different (or the same) +place later. + +When you use a kill command, the text is saved in a @dfn{kill-ring}. +Any number of consecutive kills save all of the killed text together, so +that when you yank it back, you get it all. The kill +ring is not line specific; the text that you killed on a previously +typed line is available to be yanked back later, when you are typing +another line. +@cindex kill ring + +Here is the list of commands for killing text. + +@table @kbd +@item C-k +Kill the text from the current cursor position to the end of the line. + +@item M-d +Kill from the cursor to the end of the current word, or, if between +words, to the end of the next word. +Word boundaries are the same as those used by @kbd{M-f}. + +@item M-@key{DEL} +Kill from the cursor the start of the current word, or, if between +words, to the start of the previous word. +Word boundaries are the same as those used by @kbd{M-b}. + +@item C-w +Kill from the cursor to the previous whitespace. This is different than +@kbd{M-@key{DEL}} because the word boundaries differ. + +@end table + +Here is how to @dfn{yank} the text back into the line. Yanking +means to copy the most-recently-killed text from the kill buffer. + +@table @kbd +@item C-y +Yank the most recently killed text back into the buffer at the cursor. + +@item M-y +Rotate the kill-ring, and yank the new top. You can only do this if +the prior command is @kbd{C-y} or @kbd{M-y}. +@end table + +@node Readline Arguments +@subsection Readline Arguments + +You can pass numeric arguments to Readline commands. Sometimes the +argument acts as a repeat count, other times it is the @i{sign} of the +argument that is significant. If you pass a negative argument to a +command which normally acts in a forward direction, that command will +act in a backward direction. For example, to kill text back to the +start of the line, you might type @samp{M-- C-k}. + +The general way to pass numeric arguments to a command is to type meta +digits before the command. If the first `digit' typed is a minus +sign (@samp{-}), then the sign of the argument will be negative. Once +you have typed one meta digit to get the argument started, you can type +the remainder of the digits, and then the command. For example, to give +the @kbd{C-d} command an argument of 10, you could type @samp{M-1 0 C-d}, +which will delete the next ten characters on the input line. + +@node Searching +@subsection Searching for Commands in the History + +Readline provides commands for searching through the command history +@ifset BashFeatures +(@pxref{Bash History Facilities}) +@end ifset +for lines containing a specified string. +There are two search modes: @dfn{incremental} and @dfn{non-incremental}. + +Incremental searches begin before the user has finished typing the +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. +To search backward in the history for a particular string, type +@kbd{C-r}. Typing @kbd{C-s} searches forward through the history. +The characters present in the value of the @code{isearch-terminators} variable +are used to terminate an incremental search. +If that variable has not been assigned a value, the @key{ESC} and +@kbd{C-J} characters will terminate an incremental search. +@kbd{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 @kbd{C-r} or +@kbd{C-s} 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 @key{RET} will terminate the search and accept +the line, thereby executing the command from the history list. +A movement command will terminate the search, make the last line found +the current line, and begin editing. + +Readline remembers the last incremental search string. If two +@kbd{C-r}s are typed without any intervening characters defining a new +search string, any remembered search string is used. + +Non-incremental searches read the entire search string before starting +to search for matching history lines. The search string may be +typed by the user or be part of the contents of the current line. + +@node Readline Init File +@section Readline Init File +@cindex initialization file, readline + +Although the Readline library comes with a set of Emacs-like +keybindings installed by default, it is possible to use a different set +of keybindings. +Any user can customize programs that use Readline by putting +commands in an @dfn{inputrc} file, conventionally in his home directory. +The name of this +@ifset BashFeatures +file is taken from the value of the shell variable @env{INPUTRC}. If +@end ifset +@ifclear BashFeatures +file is taken from the value of the environment variable @env{INPUTRC}. If +@end ifclear +that variable is unset, the default is @file{~/.inputrc}. + +When a program which uses the Readline library starts up, the +init file is read, and the key bindings are set. + +In addition, the @code{C-x C-r} command re-reads this init file, thus +incorporating any changes that you might have made to it. + +@menu +* Readline Init File Syntax:: Syntax for the commands in the inputrc file. + +* Conditional Init Constructs:: Conditional key bindings in the inputrc file. + +* Sample Init File:: An example inputrc file. +@end menu + +@node Readline Init File Syntax +@subsection Readline Init File Syntax + +There are only a few basic constructs allowed in the +Readline init file. Blank lines are ignored. +Lines beginning with a @samp{#} are comments. +Lines beginning with a @samp{$} indicate conditional +constructs (@pxref{Conditional Init Constructs}). Other lines +denote variable settings and key bindings. + +@table @asis +@item Variable Settings +You can modify the run-time behavior of Readline by +altering the values of variables in Readline +using the @code{set} command within the init file. +The syntax is simple: + +@example +set @var{variable} @var{value} +@end example + +@noindent +Here, for example, is how to +change from the default Emacs-like key binding to use +@code{vi} line editing commands: + +@example +set editing-mode vi +@end example + +Variable names and values, where appropriate, are recognized without regard +to case. + +@ifset BashFeatures +The @w{@code{bind -V}} command lists the current Readline variable names +and values. @xref{Bash Builtins}. +@end ifset + +A great deal of run-time behavior is changeable with the following +variables. + +@cindex variables, readline +@table @code + +@item bell-style +@vindex bell-style +Controls what happens when Readline wants to ring the terminal bell. +If set to @samp{none}, Readline never rings the bell. If set to +@samp{visible}, Readline uses a visible bell if one is available. +If set to @samp{audible} (the default), Readline attempts to ring +the terminal's bell. + +@item comment-begin +@vindex comment-begin +The string to insert at the beginning of the line when the +@code{insert-comment} command is executed. The default value +is @code{"#"}. + +@item completion-ignore-case +If set to @samp{on}, Readline performs filename matching and completion +in a case-insensitive fashion. +The default value is @samp{off}. + +@item completion-query-items +@vindex completion-query-items +The number of possible completions that determines when the user is +asked whether the list of possibilities should be displayed. +If the number of possible completions is greater than this value, +Readline will ask the user whether or not he wishes to view +them; otherwise, they are simply listed. +This variable must be set to an integer value greater than or equal to 0. +The default limit is @code{100}. + +@item convert-meta +@vindex convert-meta +If set to @samp{on}, Readline will convert characters with the +eighth bit set to an @sc{ascii} key sequence by stripping the eighth +bit and prefixing an @key{ESC} character, converting them to a +meta-prefixed key sequence. The default value is @samp{on}. + +@item disable-completion +@vindex disable-completion +If set to @samp{On}, Readline will inhibit word completion. +Completion characters will be inserted into the line as if they had +been mapped to @code{self-insert}. The default is @samp{off}. + +@item editing-mode +@vindex editing-mode +The @code{editing-mode} variable controls which default set of +key bindings is used. By default, Readline starts up in Emacs editing +mode, where the keystrokes are most similar to Emacs. This variable can be +set to either @samp{emacs} or @samp{vi}. + +@item enable-keypad +@vindex enable-keypad +When set to @samp{on}, Readline will try to enable the application +keypad when it is called. Some systems need this to enable the +arrow keys. The default is @samp{off}. + +@item expand-tilde +@vindex expand-tilde +If set to @samp{on}, tilde expansion is performed when Readline +attempts word completion. The default is @samp{off}. + +@vindex history-preserve-point +If set to @samp{on}, the history code attempts to place point at the +same location on each history line retrieved with @code{previous-history} +or @code{next-history}. + +@item horizontal-scroll-mode +@vindex horizontal-scroll-mode +This variable can be set to either @samp{on} or @samp{off}. Setting it +to @samp{on} means that the text of the lines being edited will scroll +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 clear the eighth bit in 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 +@kbd{C-J} will terminate an incremental search. + +@item keymap +@vindex keymap +Sets Readline's idea of the current keymap for key binding commands. +Acceptable @code{keymap} names are +@code{emacs}, +@code{emacs-standard}, +@code{emacs-meta}, +@code{emacs-ctlx}, +@code{vi}, +@code{vi-move}, +@code{vi-command}, and +@code{vi-insert}. +@code{vi} is equivalent to @code{vi-command}; @code{emacs} is +equivalent to @code{emacs-standard}. The default value is @code{emacs}. +The value of the @code{editing-mode} variable also affects the +default keymap. + +@item mark-directories +If set to @samp{on}, completed directory names have a slash +appended. The default is @samp{on}. + +@item mark-modified-lines +@vindex mark-modified-lines +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 mark-symlinked-directories +@vindex mark-symlinked-directories +If set to @samp{on}, completed names which are symbolic links +to directories have a slash appended (subject to the value of +@code{mark-directories}). +The default is @samp{off}. + +@item match-hidden-files +@vindex match-hidden-files +This variable, when set to @samp{on}, causes Readline to match files whose +names begin with a @samp{.} (hidden files) when performing filename +completion, unless the leading @samp{.} is +supplied by the user in the filename to be completed. +This variable is @samp{on} by default. + +@item output-meta +@vindex output-meta +If set to @samp{on}, Readline will display characters with the +eighth bit set directly rather than as a meta-prefixed escape +sequence. The default is @samp{off}. + +@item page-completions +@vindex page-completions +If set to @samp{on}, Readline uses an internal @code{more}-like pager +to display a screenful of possible completions at a time. +This variable is @samp{on} by default. + +@item print-completions-horizontally +If set to @samp{on}, Readline will display completions with matches +sorted horizontally in alphabetical order, rather than down the screen. +The default is @samp{off}. + +@item show-all-if-ambiguous +@vindex show-all-if-ambiguous +This alters the default behavior of the completion functions. If +set to @samp{on}, +words which have more than one possible completion cause the +matches to be listed immediately instead of ringing the bell. +The default value is @samp{off}. + +@item show-all-if-unmodified +@vindex show-all-if-unmodified +This alters the default behavior of the completion functions in +a fashion similar to @var{show-all-if-ambiguous}. +If set to @samp{on}, +words which have more than one possible completion without any +possible partial completion (the possible completions don't share +a common prefix) cause the matches to be listed immediately instead +of ringing the bell. +The default value is @samp{off}. + +@item visible-stats +@vindex visible-stats +If set to @samp{on}, a character denoting a file's type +is appended to the filename when listing possible +completions. The default is @samp{off}. + +@end table + +@item Key Bindings +The syntax for controlling key bindings in the init file is +simple. First you need to find the name of the command that you +want to change. The following sections contain tables of the command +name, the default keybinding, if any, and a short description of what +the command does. + +Once you know the name of the command, simply place on a line +in the init file the name of the key +you wish to bind the command to, a colon, and then the name of the +command. The name of the key +can be expressed in different ways, depending on what you find most +comfortable. + +In addition to command names, readline allows keys to be bound +to a string that is inserted when the key is pressed (a @var{macro}). + +@ifset BashFeatures +The @w{@code{bind -p}} command displays Readline function names and +bindings in a format that can put directly into an initialization file. +@xref{Bash Builtins}. +@end ifset + +@table @asis +@item @w{@var{keyname}: @var{function-name} or @var{macro}} +@var{keyname} is the name of a key spelled out in English. For example: +@example +Control-u: universal-argument +Meta-Rubout: backward-kill-word +Control-o: "> output" +@end example + +In the above example, @kbd{C-u} is bound to the function +@code{universal-argument}, +@kbd{M-DEL} is bound to the function @code{backward-kill-word}, and +@kbd{C-o} is bound to run the macro +expressed on the right hand side (that is, to insert the text +@samp{> output} into the line). + +A number of symbolic character names are recognized while +processing this key binding syntax: +@var{DEL}, +@var{ESC}, +@var{ESCAPE}, +@var{LFD}, +@var{NEWLINE}, +@var{RET}, +@var{RETURN}, +@var{RUBOUT}, +@var{SPACE}, +@var{SPC}, +and +@var{TAB}. + +@item @w{"@var{keyseq}": @var{function-name} or @var{macro}} +@var{keyseq} differs from @var{keyname} above in that strings +denoting an entire key sequence can be specified, by placing +the key sequence in double quotes. Some @sc{gnu} Emacs style key +escapes can be used, as in the following example, but the +special character names are not recognized. + +@example +"\C-u": universal-argument +"\C-x\C-r": re-read-init-file +"\e[11~": "Function Key 1" +@end example + +In the above example, @kbd{C-u} is again bound to the function +@code{universal-argument} (just as it was in the first example), +@samp{@kbd{C-x} @kbd{C-r}} is bound to the function @code{re-read-init-file}, +and @samp{@key{ESC} @key{[} @key{1} @key{1} @key{~}} is bound to insert +the text @samp{Function Key 1}. + +@end table + +The following @sc{gnu} Emacs style escape sequences are available when +specifying key sequences: + +@table @code +@item @kbd{\C-} +control prefix +@item @kbd{\M-} +meta prefix +@item @kbd{\e} +an escape character +@item @kbd{\\} +backslash +@item @kbd{\"} +@key{"}, a double quotation mark +@item @kbd{\'} +@key{'}, a single quote or apostrophe +@end table + +In addition to the @sc{gnu} Emacs style escape sequences, a second +set of backslash escapes is available: + +@table @code +@item \a +alert (bell) +@item \b +backspace +@item \d +delete +@item \f +form feed +@item \n +newline +@item \r +carriage return +@item \t +horizontal tab +@item \v +vertical tab +@item \@var{nnn} +the eight-bit character whose value is the octal value @var{nnn} +(one to three digits) +@item \x@var{HH} +the eight-bit character whose value is the hexadecimal value @var{HH} +(one or two hex digits) +@end table + +When entering the text of a macro, single or double quotes must +be used to indicate a macro definition. +Unquoted text is assumed to be a function name. +In the macro body, the backslash escapes described above are expanded. +Backslash will quote any other character in the macro text, +including @samp{"} and @samp{'}. +For example, the following binding will make @samp{@kbd{C-x} \} +insert a single @samp{\} into the line: +@example +"\C-x\\": "\\" +@end example + +@end table + +@node Conditional Init Constructs +@subsection Conditional Init Constructs + +Readline implements a facility similar in spirit to the conditional +compilation features of the C preprocessor which allows key +bindings and variable settings to be performed as the result +of tests. There are four parser directives used. + +@table @code +@item $if +The @code{$if} construct allows bindings to be made based on the +editing mode, the terminal being used, or the application using +Readline. The text of the test extends to the end of the line; +no characters are required to isolate it. + +@table @code +@item mode +The @code{mode=} form of the @code{$if} directive is used to test +whether Readline is in @code{emacs} or @code{vi} mode. +This may be used in conjunction +with the @samp{set keymap} command, for instance, to set bindings in +the @code{emacs-standard} and @code{emacs-ctlx} keymaps only if +Readline is starting out in @code{emacs} mode. + +@item term +The @code{term=} form may be used to include terminal-specific +key bindings, perhaps to bind the key sequences output by the +terminal's function keys. The word on the right side of the +@samp{=} is tested against both the full name of the terminal and +the portion of the terminal name before the first @samp{-}. This +allows @code{sun} to match both @code{sun} and @code{sun-cmd}, +for instance. + +@item application +The @var{application} construct is used to include +application-specific settings. Each program using the Readline +library sets the @var{application name}, and you can test for +a particular value. +This could be used to bind key sequences to functions useful for +a specific program. For instance, the following command adds a +key sequence that quotes the current or previous word in Bash: +@example +$if Bash +# Quote the current or previous word +"\C-xq": "\eb\"\ef\"" +$endif +@end example +@end table + +@item $endif +This command, as seen in the previous example, terminates an +@code{$if} command. + +@item $else +Commands in this branch of the @code{$if} directive are executed if +the test fails. + +@item $include +This directive takes a single filename as an argument and reads commands +and bindings from that file. +For example, the following directive reads from @file{/etc/inputrc}: +@example +$include /etc/inputrc +@end example +@end table + +@node Sample Init File +@subsection Sample Init File + +Here is an example of an @var{inputrc} file. This illustrates key +binding, variable assignment, and conditional syntax. + +@example +@page +# This file controls the behaviour of line input editing for +# programs that use the GNU Readline library. Existing +# programs include FTP, Bash, and GDB. +# +# You can re-read the inputrc file with C-x C-r. +# Lines beginning with '#' are comments. +# +# First, include any systemwide bindings and variable +# assignments from /etc/Inputrc +$include /etc/Inputrc + +# +# Set various bindings for emacs mode. + +set editing-mode emacs + +$if mode=emacs + +Meta-Control-h: backward-kill-word Text after the function name is ignored + +# +# Arrow keys in keypad mode +# +#"\M-OD": backward-char +#"\M-OC": forward-char +#"\M-OA": previous-history +#"\M-OB": next-history +# +# Arrow keys in ANSI mode +# +"\M-[D": backward-char +"\M-[C": forward-char +"\M-[A": previous-history +"\M-[B": next-history +# +# Arrow keys in 8 bit keypad mode +# +#"\M-\C-OD": backward-char +#"\M-\C-OC": forward-char +#"\M-\C-OA": previous-history +#"\M-\C-OB": next-history +# +# Arrow keys in 8 bit ANSI mode +# +#"\M-\C-[D": backward-char +#"\M-\C-[C": forward-char +#"\M-\C-[A": previous-history +#"\M-\C-[B": next-history + +C-q: quoted-insert + +$endif + +# An old-style binding. This happens to be the default. +TAB: complete + +# Macros that are convenient for shell interaction +$if Bash +# edit the path +"\C-xp": "PATH=$@{PATH@}\e\C-e\C-a\ef\C-f" +# prepare to type a quoted word -- +# insert open and close double quotes +# and move to just after the open quote +"\C-x\"": "\"\"\C-b" +# insert a backslash (testing backslash escapes +# in sequences and macros) +"\C-x\\": "\\" +# Quote the current or previous word +"\C-xq": "\eb\"\ef\"" +# Add a binding to refresh the line, which is unbound +"\C-xr": redraw-current-line +# Edit variable on current line. +"\M-\C-v": "\C-a\C-k$\C-y\M-\C-e\C-a\C-y=" +$endif + +# use a visible bell if one is available +set bell-style visible + +# don't strip characters to 7 bits when reading +set input-meta on + +# allow iso-latin1 characters to be inserted rather +# than converted to prefix-meta sequences +set convert-meta off + +# display characters with the eighth bit set directly +# rather than as meta-prefixed characters +set output-meta on + +# if there are more than 150 possible completions for +# a word, ask the user if he wants to see all of them +set completion-query-items 150 + +# For FTP +$if Ftp +"\C-xg": "get \M-?" +"\C-xt": "put \M-?" +"\M-.": yank-last-arg +$endif +@end example + +@node Bindable Readline Commands +@section Bindable Readline Commands + +@menu +* Commands For Moving:: Moving about the line. +* Commands For History:: Getting at previous lines. +* Commands For Text:: Commands for changing text. +* Commands For Killing:: Commands for killing and yanking. +* Numeric Arguments:: Specifying numeric arguments, repeat counts. +* Commands For Completion:: Getting Readline to do the typing for you. +* Keyboard Macros:: Saving and re-executing typed characters +* Miscellaneous Commands:: Other miscellaneous commands. +@end menu + +This section describes Readline commands that may be bound to key +sequences. +@ifset BashFeatures +You can list your key bindings by executing +@w{@code{bind -P}} or, for a more terse format, suitable for an +@var{inputrc} file, @w{@code{bind -p}}. (@xref{Bash Builtins}.) +@end ifset +Command names without an accompanying key sequence are unbound by default. + +In the following descriptions, @dfn{point} refers to the current cursor +position, and @dfn{mark} refers to a cursor position saved by the +@code{set-mark} command. +The text between the point and mark is referred to as the @dfn{region}. + +@node Commands For Moving +@subsection Commands For Moving +@ftable @code +@item beginning-of-line (C-a) +Move to the start of the current line. + +@item end-of-line (C-e) +Move to the end of the line. + +@item forward-char (C-f) +Move forward a character. + +@item backward-char (C-b) +Move back a character. + +@item forward-word (M-f) +Move forward to the end of the next word. Words are composed of +letters and digits. + +@item backward-word (M-b) +Move back to the start of the current or previous word. Words are +composed of letters and digits. + +@item clear-screen (C-l) +Clear the screen and redraw the current line, +leaving the current line at the top of the screen. + +@item redraw-current-line () +Refresh the current line. By default, this is unbound. + +@end ftable + +@node Commands For History +@subsection Commands For Manipulating The History + +@ftable @code +@item accept-line (Newline or Return) +@ifset BashFeatures +Accept the line regardless of where the cursor is. +If this line is +non-empty, add it to the history list according to the setting of +the @env{HISTCONTROL} and @env{HISTIGNORE} variables. +If this line is a modified history line, then restore the history line +to its original state. +@end ifset +@ifclear BashFeatures +Accept the line regardless of where the cursor is. +If this line is +non-empty, it may be added to the history list for future recall with +@code{add_history()}. +If this line is a modified history line, the history line is restored +to its original state. +@end ifclear + +@item previous-history (C-p) +Move `back' through the history list, fetching the previous command. + +@item next-history (C-n) +Move `forward' through the history list, fetching the next command. + +@item beginning-of-history (M-<) +Move to the first line in the history. + +@item end-of-history (M->) +Move to the end of the input history, i.e., the line currently +being entered. + +@item reverse-search-history (C-r) +Search backward starting at the current line and moving `up' through +the history as necessary. This is an incremental search. + +@item forward-search-history (C-s) +Search forward starting at the current line and moving `down' through +the the history as necessary. This is an incremental search. + +@item non-incremental-reverse-search-history (M-p) +Search backward starting at the current line and moving `up' +through the history as necessary using a non-incremental search +for a string supplied by the user. + +@item non-incremental-forward-search-history (M-n) +Search forward starting at the current line and moving `down' +through the the history as necessary using a non-incremental search +for a string supplied by the user. + +@item history-search-forward () +Search forward through the history for the string of characters +between the start of the current line and the point. +This is a non-incremental search. +By default, this command is unbound. + +@item history-search-backward () +Search backward through the history for the string of characters +between the start of the current line and the point. This +is a non-incremental search. By default, this command is unbound. + +@item yank-nth-arg (M-C-y) +Insert the first argument to the previous command (usually +the second word on the previous line) at point. +With an argument @var{n}, +insert the @var{n}th word from the previous command (the words +in the previous command begin with word 0). A negative argument +inserts the @var{n}th word from the end of the previous command. + +@item yank-last-arg (M-. or M-_) +Insert last argument to the previous command (the last word of the +previous history entry). With an +argument, behave exactly like @code{yank-nth-arg}. +Successive calls to @code{yank-last-arg} move back through the history +list, inserting the last argument of each line in turn. + +@end ftable + +@node Commands For Text +@subsection Commands For Changing Text + +@ftable @code +@item delete-char (C-d) +Delete the character at point. If point is at the +beginning of the line, there are no characters in the line, and +the last character typed was not bound to @code{delete-char}, then +return @sc{eof}. + +@item backward-delete-char (Rubout) +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 or C-v) +Add the next character typed to the line verbatim. This is +how to insert key sequences like @kbd{C-q}, for example. + +@ifclear BashFeatures +@item tab-insert (M-@key{TAB}) +Insert a tab character. +@end ifclear + +@item self-insert (a, b, A, 1, !, @dots{}) +Insert yourself. + +@item transpose-chars (C-t) +Drag the character before the cursor forward over +the character at the cursor, moving the +cursor forward as well. If the insertion point +is at the end of the line, then this +transposes the last two characters of the line. +Negative arguments have no effect. + +@item transpose-words (M-t) +Drag the word before point past the word after point, +moving point past that word as well. +If the insertion point is at the end of the line, this transposes +the last two words on the line. + +@item upcase-word (M-u) +Uppercase the current (or following) word. With a negative argument, +uppercase the previous word, but do not move the cursor. + +@item downcase-word (M-l) +Lowercase the current (or following) word. With a negative argument, +lowercase the previous word, but do not move the cursor. + +@item capitalize-word (M-c) +Capitalize the current (or following) word. With a negative argument, +capitalize the previous word, but do not move the cursor. + +@item overwrite-mode () +Toggle overwrite mode. With an explicit positive numeric argument, +switches to overwrite mode. With an explicit non-positive numeric +argument, switches to insert mode. This command affects only +@code{emacs} mode; @code{vi} mode does overwrite differently. +Each call to @code{readline()} starts in insert mode. + +In overwrite mode, characters bound to @code{self-insert} replace +the text at point rather than pushing the text to the right. +Characters bound to @code{backward-delete-char} replace the character +before point with a space. + +By default, this command is unbound. + +@end ftable + +@node Commands For Killing +@subsection Killing And Yanking + +@ftable @code + +@item kill-line (C-k) +Kill the text from point to the end of the line. + +@item backward-kill-line (C-x Rubout) +Kill backward to the beginning of the line. + +@item unix-line-discard (C-u) +Kill backward from the cursor to the beginning of the current line. + +@item kill-whole-line () +Kill all characters on the current line, no matter where point is. +By default, this is unbound. + +@item kill-word (M-d) +Kill from point to the end of the current word, or if between +words, to the end of the next word. +Word boundaries are the same as @code{forward-word}. + +@item backward-kill-word (M-@key{DEL}) +Kill the word behind point. +Word boundaries are the same as @code{backward-word}. + +@item unix-word-rubout (C-w) +Kill the word behind point, using white space as a word boundary. +The killed text is saved on the kill-ring. + +@item delete-horizontal-space () +Delete all spaces and tabs around point. By default, this is unbound. + +@item kill-region () +Kill the text in the current region. +By default, this command is unbound. + +@item copy-region-as-kill () +Copy the text in the region to the kill buffer, so it can be yanked +right away. By default, this command is unbound. + +@item copy-backward-word () +Copy the word before point to the kill buffer. +The word boundaries are the same as @code{backward-word}. +By default, this command is unbound. + +@item copy-forward-word () +Copy the word following point to the kill buffer. +The word boundaries are the same as @code{forward-word}. +By default, this command is unbound. + +@item yank (C-y) +Yank the top of the kill ring into the buffer at point. + +@item yank-pop (M-y) +Rotate the kill-ring, and yank the new top. You can only do this if +the prior command is @code{yank} or @code{yank-pop}. +@end ftable + +@node Numeric Arguments +@subsection Specifying Numeric Arguments +@ftable @code + +@item digit-argument (@kbd{M-0}, @kbd{M-1}, @dots{} @kbd{M--}) +Add this digit to the argument already accumulating, or start a new +argument. @kbd{M--} starts a negative argument. + +@item universal-argument () +This is another way to specify an argument. +If this command is followed by one or more digits, optionally with a +leading minus sign, those digits define the argument. +If the command is followed by digits, executing @code{universal-argument} +again ends the numeric argument, but is otherwise ignored. +As a special case, if this command is immediately followed by a +character that is neither a digit or minus sign, the argument count +for the next command is multiplied by four. +The argument count is initially one, so executing this function the +first time makes the argument count four, a second time makes the +argument count sixteen, and so on. +By default, this is not bound to a key. +@end ftable + +@node Commands For Completion +@subsection Letting Readline Type For You + +@ftable @code +@item complete (@key{TAB}) +Attempt to perform completion on the text before point. +The actual completion performed is application-specific. +@ifset BashFeatures +Bash attempts completion treating the text as a variable (if the +text begins with @samp{$}), username (if the text begins with +@samp{~}), hostname (if the text begins with @samp{@@}), or +command (including aliases and functions) in turn. If none +of these produces a match, filename completion is attempted. +@end ifset +@ifclear BashFeatures +The default is filename completion. +@end ifclear + +@item possible-completions (M-?) +List the possible completions of the text before point. + +@item insert-completions (M-*) +Insert all completions of the text before point that would have +been generated by @code{possible-completions}. + +@item menu-complete () +Similar to @code{complete}, but replaces the word to be completed +with a single match from the list of possible completions. +Repeated execution of @code{menu-complete} steps through the list +of possible completions, inserting each match in turn. +At the end of the list of completions, the bell is rung +(subject to the setting of @code{bell-style}) +and the original text is restored. +An argument of @var{n} moves @var{n} positions forward in the list +of matches; a negative argument may be used to move backward +through the list. +This command is intended to be bound to @key{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. + +@item possible-filename-completions (C-x /) +List the possible completions of the text before point, +treating it as a filename. + +@item complete-username (M-~) +Attempt completion on the text before point, treating +it as a username. + +@item possible-username-completions (C-x ~) +List the possible completions of the text before point, +treating it as a username. + +@item complete-variable (M-$) +Attempt completion on the text before point, treating +it as a shell variable. + +@item possible-variable-completions (C-x $) +List the possible completions of the text before point, +treating it as a shell variable. + +@item complete-hostname (M-@@) +Attempt completion on the text before point, treating +it as a hostname. + +@item possible-hostname-completions (C-x @@) +List the possible completions of the text before point, +treating it as a hostname. + +@item complete-command (M-!) +Attempt completion on the text before point, treating +it as a command name. Command completion attempts to +match the text against aliases, reserved words, shell +functions, shell builtins, and finally executable filenames, +in that order. + +@item possible-command-completions (C-x !) +List the possible completions of the text before point, +treating it as a command name. + +@item dynamic-complete-history (M-@key{TAB}) +Attempt completion on the text before point, comparing +the text against lines from the history list for possible +completion matches. + +@item complete-into-braces (M-@{) +Perform filename completion and insert the list of possible completions +enclosed within braces so the list is available to the shell +(@pxref{Brace Expansion}). + +@end ifset +@end ftable + +@node Keyboard Macros +@subsection Keyboard Macros +@ftable @code + +@item start-kbd-macro (C-x () +Begin saving the characters typed into the current keyboard macro. + +@item end-kbd-macro (C-x )) +Stop saving the characters typed into the current keyboard macro +and save the definition. + +@item call-last-kbd-macro (C-x e) +Re-execute the last keyboard macro defined, by making the characters +in the macro appear as if typed at the keyboard. + +@end ftable + +@node Miscellaneous Commands +@subsection Some Miscellaneous Commands +@ftable @code + +@item re-read-init-file (C-x C-r) +Read in the contents of the @var{inputrc} file, and incorporate +any bindings or variable assignments found there. + +@item abort (C-g) +Abort the current editing command and +ring the terminal's bell (subject to the setting of +@code{bell-style}). + +@item do-uppercase-version (M-a, M-b, M-@var{x}, @dots{}) +If the metafied character @var{x} is lowercase, run the command +that is bound to the corresponding uppercase character. + +@item prefix-meta (@key{ESC}) +Metafy the next character typed. This is for keyboards +without a meta key. Typing @samp{@key{ESC} f} is equivalent to typing +@kbd{M-f}. + +@item undo (C-_ or C-x C-u) +Incremental undo, separately remembered for each line. + +@item revert-line (M-r) +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-@@) +Set the mark to the point. If a +numeric argument is supplied, the mark is set to that position. + +@item exchange-point-and-mark (C-x C-x) +Swap the point with the mark. The current cursor position is set to +the saved position, and the old cursor position is saved as the mark. + +@item character-search (C-]) +A character is read and point is moved to the next occurrence of that +character. A negative count searches for previous occurrences. + +@item character-search-backward (M-C-]) +A character is read and point is moved to the previous occurrence +of that character. A negative count searches for subsequent +occurrences. + +@item insert-comment (M-#) +Without a numeric argument, the value of the @code{comment-begin} +variable is inserted at the beginning of the current line. +If a numeric argument is supplied, this command acts as a toggle: if +the characters at the beginning of the line do not match the value +of @code{comment-begin}, the value is inserted, otherwise +the characters in @code{comment-begin} are deleted from the beginning of +the line. +In either case, the line is accepted as if a newline had been typed. +@ifset BashFeatures +The default value of @code{comment-begin} causes this command +to make the current line a shell comment. +If a numeric argument causes the comment character to be removed, the line +will be executed by the shell. +@end ifset + +@item dump-functions () +Print all of the functions and their key bindings to the +Readline output stream. If a numeric argument is supplied, +the output is formatted in such a way that it can be made part +of an @var{inputrc} file. This command is unbound by default. + +@item dump-variables () +Print all of the settable variables and their values to the +Readline output stream. If a numeric argument is supplied, +the output is formatted in such a way that it can be made part +of an @var{inputrc} file. This command is unbound by default. + +@item dump-macros () +Print all of the Readline key sequences bound to macros and the +strings they output. If a numeric argument is supplied, +the output is formatted in such a way that it can be made part +of an @var{inputrc} file. This command is unbound by default. + +@ifset BashFeatures +@item glob-complete-word (M-g) +The word before point is treated as a pattern for pathname expansion, +with an asterisk implicitly appended. This pattern is used to +generate a list of matching file names for possible completions. + +@item glob-expand-word (C-x *) +The word before point is treated as a pattern for pathname expansion, +and the list of matching file names is inserted, replacing the word. +If a numeric argument is supplied, a @samp{*} is appended before +pathname expansion. + +@item glob-list-expansions (C-x g) +The list of expansions that would have been generated by +@code{glob-expand-word} is displayed, and the line is redrawn. +If a numeric argument is supplied, a @samp{*} is appended before +pathname expansion. + +@item display-shell-version (C-x C-v) +Display version information about the current instance of Bash. + +@item shell-expand-line (M-C-e) +Expand the line as the shell does. +This performs alias and history expansion as well as all of the shell +word expansions (@pxref{Shell Expansions}). + +@item history-expand-line (M-^) +Perform history expansion on the current line. + +@item magic-space () +Perform history expansion on the current line and insert a space +(@pxref{History Interaction}). + +@item alias-expand-line () +Perform alias expansion on the current line (@pxref{Aliases}). + +@item history-and-alias-expand-line () +Perform history and alias expansion on the current line. + +@item insert-last-argument (M-. or M-_) +A synonym for @code{yank-last-arg}. + +@item operate-and-get-next (C-o) +Accept the current line for execution and fetch the next line +relative to the current line from the history for editing. Any +argument is ignored. + +@item edit-and-execute-command (C-xC-e) +Invoke an editor on the current command line, and execute the result as shell +commands. +Bash attempts to invoke +@code{$FCEDIT}, @code{$EDITOR}, and @code{emacs} +as the editor, in that order. + +@end ifset + +@ifclear BashFeatures +@item emacs-editing-mode (C-e) +When in @code{vi} command mode, this causes a switch to @code{emacs} +editing mode. + +@item vi-editing-mode (M-C-j) +When in @code{emacs} editing mode, this causes a switch to @code{vi} +editing mode. + +@end ifclear + +@end ftable + +@node Readline vi Mode +@section Readline vi Mode + +While the Readline library does not have a full set of @code{vi} +editing functions, it does contain enough to allow simple editing +of the line. The Readline @code{vi} mode behaves as specified in +the @sc{posix} 1003.2 standard. + +@ifset BashFeatures +In order to switch interactively between @code{emacs} and @code{vi} +editing modes, use the @samp{set -o emacs} and @samp{set -o vi} +commands (@pxref{The Set Builtin}). +@end ifset +@ifclear BashFeatures +In order to switch interactively between @code{emacs} and @code{vi} +editing modes, use the command @kbd{M-C-j} (bound to emacs-editing-mode +when in @code{vi} mode and to vi-editing-mode in @code{emacs} mode). +@end ifclear +The Readline default is @code{emacs} mode. + +When you enter a line in @code{vi} mode, you are already placed in +`insertion' mode, as if you had typed an @samp{i}. Pressing @key{ESC} +switches you into `command' mode, where you can edit the text of the +line with the standard @code{vi} movement keys, move to previous +history lines with @samp{k} and subsequent lines with @samp{j}, and +so forth. + +@ifset BashFeatures +@node Programmable Completion +@section Programmable Completion +@cindex programmable completion + +When word completion is attempted for an argument to a command for +which a completion specification (a @var{compspec}) has been defined +using the @code{complete} builtin (@pxref{Programmable Completion Builtins}), +the programmable completion facilities are invoked. + +First, the command name is identified. +If a compspec has been defined for that command, the +compspec is used to generate the list of possible completions for the word. +If the command word is a full pathname, a compspec for the full +pathname is searched for first. +If no compspec is found for the full pathname, an attempt is made to +find a compspec for the portion following the final slash. + +Once a compspec has been found, it is used to generate the list of +matching words. +If a compspec is not found, the default Bash completion +described above (@pxref{Commands For Completion}) is performed. + +First, the actions specified by the compspec are used. +Only matches which are prefixed by the word being completed are +returned. +When the @option{-f} or @option{-d} option is used for filename or +directory name completion, the shell variable @env{FIGNORE} is +used to filter the matches. +@xref{Bash Variables}, for a description of @env{FIGNORE}. + +Any completions specified by a filename expansion pattern to the +@option{-G} option are generated next. +The words generated by the pattern need not match the word being completed. +The @env{GLOBIGNORE} shell variable is not used to filter the matches, +but the @env{FIGNORE} shell variable is used. + +Next, the string specified as the argument to the @option{-W} option +is considered. +The string is first split using the characters in the @env{IFS} +special variable as delimiters. +Shell quoting is honored. +Each word is then expanded using +brace expansion, tilde expansion, parameter and variable expansion, +command substitution, arithmetic expansion, and pathname expansion, +as described above (@pxref{Shell Expansions}). +The results are split using the rules described above +(@pxref{Word Splitting}). +The results of the expansion are prefix-matched against the word being +completed, and the matching words become the possible completions. + +After these matches have been generated, any shell function or command +specified with the @option{-F} and @option{-C} options is invoked. +When the command or function is invoked, the @env{COMP_LINE} and +@env{COMP_POINT} variables are assigned values as described above +(@pxref{Bash Variables}). +If a shell function is being invoked, the @env{COMP_WORDS} and +@env{COMP_CWORD} variables are also set. +When the function or command is invoked, the first argument is the +name of the command whose arguments are being completed, the +second argument is the word being completed, and the third argument +is the word preceding the word being completed on the current command line. +No filtering of the generated completions against the word being completed +is performed; the function or command has complete freedom in generating +the matches. + +Any function specified with @option{-F} is invoked first. +The function may use any of the shell facilities, including the +@code{compgen} builtin described below +(@pxref{Programmable Completion Builtins}), to generate the matches. +It must put the possible completions in the @env{COMPREPLY} array +variable. + +Next, any command specified with the @option{-C} option is invoked +in an environment equivalent to command substitution. +It should print a list of completions, one per line, to +the standard output. +Backslash may be used to escape a newline, if necessary. + +After all of the possible completions are generated, any filter +specified with the @option{-X} option is applied to the list. +The filter is a pattern as used for pathname expansion; a @samp{&} +in the pattern is replaced with the text of the word being completed. +A literal @samp{&} may be escaped with a backslash; the backslash +is removed before attempting a match. +Any completion that matches the pattern will be removed from the list. +A leading @samp{!} negates the pattern; in this case any completion +not matching the pattern will be removed. + +Finally, any prefix and suffix specified with the @option{-P} and @option{-S} +options are added to each member of the completion list, and the result is +returned to the Readline completion code as the list of possible +completions. + +If the previously-applied actions do not generate any matches, and the +@option{-o dirnames} option was supplied to @code{complete} when the +compspec was defined, directory name completion is attempted. + +If the @option{-o plusdirs} option was supplied to @code{complete} when +the compspec was defined, directory name completion is attempted and any +matches are added to the results of the other actions. + +By default, if a compspec is found, whatever it generates is returned to +the completion code as the full set of possible completions. +The default Bash completions are not attempted, and the Readline default +of filename completion is disabled. +If the @option{-o bashdefault} option was supplied to @code{complete} when +the compspec was defined, the default Bash completions are attempted +if the compspec generates no matches. +If the @option{-o default} option was supplied to @code{complete} when the +compspec was defined, Readline's default completion will be performed +if the compspec (and, if attempted, the default Bash completions) +generate no matches. + +When a compspec indicates that directory name completion is desired, +the programmable completion functions force Readline to append a slash +to completed names which are symbolic links to directories, subject to +the value of the @var{mark-directories} Readline variable, regardless +of the setting of the @var{mark-symlinked-directories} Readline variable. + +@node Programmable Completion Builtins +@section Programmable Completion Builtins +@cindex completion builtins + +Two builtin commands are available to manipulate the programmable completion +facilities. + +@table @code +@item compgen +@btindex compgen +@example +@code{compgen [@var{option}] [@var{word}]} +@end example + +Generate possible completion matches for @var{word} according to +the @var{option}s, which may be any option accepted by the +@code{complete} +builtin with the exception of @option{-p} and @option{-r}, and write +the matches to the standard output. +When using the @option{-F} or @option{-C} options, the various shell variables +set by the programmable completion facilities, while available, will not +have useful values. + +The matches will be generated in the same way as if the programmable +completion code had generated them directly from a completion specification +with the same flags. +If @var{word} is specified, only those completions matching @var{word} +will be displayed. + +The return value is true unless an invalid option is supplied, or no +matches were generated. + +@item complete +@btindex complete +@example +@code{complete [-abcdefgjksuv] [-o @var{comp-option}] [-A @var{action}] [-G @var{globpat}] [-W @var{wordlist}] +[-P @var{prefix}] [-S @var{suffix}] [-X @var{filterpat}] [-F @var{function}] +[-C @var{command}] @var{name} [@var{name} @dots{}]} +@code{complete -pr [@var{name} @dots{}]} +@end example + +Specify how arguments to each @var{name} should be completed. +If the @option{-p} option is supplied, or if no options are supplied, existing +completion specifications are printed in a way that allows them to be +reused as input. +The @option{-r} option removes a completion specification for +each @var{name}, or, if no @var{name}s are supplied, all +completion specifications. + +The process of applying these completion specifications when word completion +is attempted is described above (@pxref{Programmable Completion}). + +Other options, if specified, have the following meanings. +The arguments to the @option{-G}, @option{-W}, and @option{-X} options +(and, if necessary, the @option{-P} and @option{-S} options) +should be quoted to protect them from expansion before the +@code{complete} builtin is invoked. + + +@table @code +@item -o @var{comp-option} +The @var{comp-option} controls several aspects of the compspec's behavior +beyond the simple generation of completions. +@var{comp-option} may be one of: + +@table @code + +@item bashdefault +Perform the rest of the default Bash completions if the compspec +generates no matches. + +@item default +Use Readline's default filename completion if the compspec generates +no matches. + +@item dirnames +Perform directory name completion if the compspec generates no matches. + +@item filenames +Tell Readline that the compspec generates filenames, so it can perform any +filename-specific processing (like adding a slash to directory names or +suppressing trailing spaces). This option is intended to be used with +shell functions specified with @option{-F}. + +@item nospace +Tell Readline not to append a space (the default) to words completed at +the end of the line. +@end table + +@item -A @var{action} +The @var{action} may be one of the following to generate a list of possible +completions: + +@table @code +@item alias +Alias names. May also be specified as @option{-a}. + +@item arrayvar +Array variable names. + +@item binding +Readline key binding names (@pxref{Bindable Readline Commands}). + +@item builtin +Names of shell builtin commands. May also be specified as @option{-b}. + +@item command +Command names. May also be specified as @option{-c}. + +@item directory +Directory names. May also be specified as @option{-d}. + +@item disabled +Names of disabled shell builtins. + +@item enabled +Names of enabled shell builtins. + +@item export +Names of exported shell variables. May also be specified as @option{-e}. + +@item file +File names. May also be specified as @option{-f}. + +@item function +Names of shell functions. + +@item group +Group names. May also be specified as @option{-g}. + +@item helptopic +Help topics as accepted by the @code{help} builtin (@pxref{Bash Builtins}). + +@item hostname +Hostnames, as taken from the file specified by the +@env{HOSTFILE} shell variable (@pxref{Bash Variables}). + +@item job +Job names, if job control is active. May also be specified as @option{-j}. + +@item keyword +Shell reserved words. May also be specified as @option{-k}. + +@item running +Names of running jobs, if job control is active. + +@item service +Service names. May also be specified as @option{-s}. + +@item setopt +Valid arguments for the @option{-o} option to the @code{set} builtin +(@pxref{The Set Builtin}). + +@item shopt +Shell option names as accepted by the @code{shopt} builtin +(@pxref{Bash Builtins}). + +@item signal +Signal names. + +@item stopped +Names of stopped jobs, if job control is active. + +@item user +User names. May also be specified as @option{-u}. + +@item variable +Names of all shell variables. May also be specified as @option{-v}. +@end table + +@item -G @var{globpat} +The filename expansion pattern @var{globpat} is expanded to generate +the possible completions. + +@item -W @var{wordlist} +The @var{wordlist} is split using the characters in the +@env{IFS} special variable as delimiters, and each resultant word +is expanded. +The possible completions are the members of the resultant list which +match the word being completed. + +@item -C @var{command} +@var{command} is executed in a subshell environment, and its output is +used as the possible completions. + +@item -F @var{function} +The shell function @var{function} is executed in the current shell +environment. +When it finishes, the possible completions are retrieved from the value +of the @env{COMPREPLY} array variable. + +@item -X @var{filterpat} +@var{filterpat} is a pattern as used for filename expansion. +It is applied to the list of possible completions generated by the +preceding options and arguments, and each completion matching +@var{filterpat} is removed from the list. +A leading @samp{!} in @var{filterpat} negates the pattern; in this +case, any completion not matching @var{filterpat} is removed. + +@item -P @var{prefix} +@var{prefix} is added at the beginning of each possible completion +after all other options have been applied. + +@item -S @var{suffix} +@var{suffix} is appended to each possible completion +after all other options have been applied. +@end table + +The return value is true unless an invalid option is supplied, an option +other than @option{-p} or @option{-r} is supplied without a @var{name} +argument, an attempt is made to remove a completion specification for +a @var{name} for which no specification exists, or +an error occurs adding a completion specification. + +@end table +@end ifset diff --git a/lib/readline/doc/rluserman.texi b/lib/readline/doc/rluserman.texi new file mode 100644 index 00000000..8ef3e654 --- /dev/null +++ b/lib/readline/doc/rluserman.texi @@ -0,0 +1,88 @@ +\input texinfo @c -*-texinfo-*- +@comment %**start of header (This is for running Texinfo on a region.) +@setfilename rluserman.info +@settitle GNU Readline Library +@comment %**end of header (This is for running Texinfo on a region.) + +@setchapternewpage odd + +@include version.texi + +@copying +This manual describes the end user interface of the GNU Readline Library +(version @value{VERSION}, @value{UPDATED}), a library which aids in the +consistency of user interface across discrete programs which provide +a command line interface. + +Copyright @copyright{} 1988-2003 Free Software Foundation, Inc. + +Permission is granted to make and distribute verbatim copies of +this manual provided the copyright notice and this permission notice +are preserved on all copies. + +@quotation +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.1 or +any later version published by the Free Software Foundation; with no +Invariant Sections, with the Front-Cover texts being ``A GNU Manual,'' +and with the Back-Cover Texts as in (a) below. A copy of the license is +included in the section entitled ``GNU Free Documentation License.'' + +(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify +this GNU Manual, like GNU software. Copies published by the Free +Software Foundation raise funds for GNU development.'' +@end quotation +@end copying + +@dircategory Libraries +@direntry +* RLuserman: (rluserman). The GNU readline library User's Manual. +@end direntry + +@titlepage +@title GNU Readline Library User Interface +@subtitle Edition @value{EDITION}, for @code{Readline Library} Version @value{VERSION}. +@subtitle @value{UPDATED-MONTH} +@author Chet Ramey, Case Western Reserve University +@author Brian Fox, Free Software Foundation + +@page +@vskip 0pt plus 1filll +@insertcopying + +@sp 1 +Published by the Free Software Foundation @* +59 Temple Place, Suite 330, @* +Boston, MA 02111-1307 @* +USA @* + +@end titlepage + +@contents + +@ifnottex +@node Top +@top GNU Readline Library + +This document describes the end user interface of the GNU Readline Library, +a utility which aids in the consistency of user interface across discrete +programs which provide a command line interface. + +@menu +* Command Line Editing:: GNU Readline User's Manual. +* Copying This Manual:: Copying This Manual. +@end menu +@end ifnottex + +@include rluser.texi + +@node Copying This Manual +@appendix Copying This Manual + +@menu +* GNU Free Documentation License:: License for copying this manual. +@end menu + +@include fdl.texi + +@bye diff --git a/lib/readline/doc/version.texi b/lib/readline/doc/version.texi new file mode 100644 index 00000000..20737ab0 --- /dev/null +++ b/lib/readline/doc/version.texi @@ -0,0 +1,10 @@ +@ignore +Copyright (C) 1988-2003 Free Software Foundation, Inc. +@end ignore + +@set EDITION 5.0 +@set VERSION 5.0 +@set UPDATED 19 September 2003 +@set UPDATED-MONTH September 2003 + +@set LASTCHANGE Thu Sep 18 09:55:25 EDT 2003 diff --git a/lib/readline/examples/histexamp.c b/lib/readline/examples/histexamp.c index 45651dfb..e875e654 100644 --- a/lib/readline/examples/histexamp.c +++ b/lib/readline/examples/histexamp.c @@ -31,9 +31,10 @@ main (argc, argv) char **argv; { char line[1024], *t; - int len, done = 0; + int len, done; line[0] = 0; + done = 0; using_history (); while (!done) @@ -42,71 +43,80 @@ main (argc, argv) fflush (stdout); t = fgets (line, sizeof (line) - 1, stdin); if (t && *t) - { - len = strlen (t); - if (t[len - 1] == '\n') - t[len - 1] = '\0'; - } + { + len = strlen (t); + if (t[len - 1] == '\n') + t[len - 1] = '\0'; + } if (!t) - strcpy (line, "quit"); + strcpy (line, "quit"); if (line[0]) - { - char *expansion; - int result; + { + char *expansion; + int result; - using_history (); + using_history (); - result = history_expand (line, &expansion); - if (result) - fprintf (stderr, "%s\n", expansion); + result = history_expand (line, &expansion); + if (result) + fprintf (stderr, "%s\n", expansion); - if (result < 0 || result == 2) - { - free (expansion); - continue; - } + if (result < 0 || result == 2) + { + free (expansion); + continue; + } - add_history (expansion); - strncpy (line, expansion, sizeof (line) - 1); - free (expansion); - } + add_history (expansion); + strncpy (line, expansion, sizeof (line) - 1); + free (expansion); + } if (strcmp (line, "quit") == 0) - done = 1; + done = 1; else if (strcmp (line, "save") == 0) - write_history ("history_file"); + write_history ("history_file"); else if (strcmp (line, "read") == 0) - read_history ("history_file"); + read_history ("history_file"); else if (strcmp (line, "list") == 0) - { - register HIST_ENTRY **the_list; - register int i; - - the_list = history_list (); - if (the_list) - for (i = 0; the_list[i]; i++) - printf ("%d: %s\n", i + history_base, the_list[i]->line); - } + { + register HIST_ENTRY **the_list; + register int i; + time_t tt; + char timestr[128]; + + the_list = history_list (); + if (the_list) + for (i = 0; the_list[i]; i++) + { + tt = history_get_time (the_list[i]); + if (tt) + strftime (timestr, sizeof (timestr), "%a %R", localtime(&tt)); + else + strcpy (timestr, "??"); + printf ("%d: %s: %s\n", i + history_base, timestr, the_list[i]->line); + } + } else if (strncmp (line, "delete", 6) == 0) - { - int which; - if ((sscanf (line + 6, "%d", &which)) == 1) - { - HIST_ENTRY *entry = remove_history (which); - if (!entry) - fprintf (stderr, "No such entry %d\n", which); - else - { - free (entry->line); - free (entry); - } - } - else - { - fprintf (stderr, "non-numeric arg given to `delete'\n"); - } - } + { + int which; + if ((sscanf (line + 6, "%d", &which)) == 1) + { + HIST_ENTRY *entry = remove_history (which); + if (!entry) + fprintf (stderr, "No such entry %d\n", which); + else + { + free (entry->line); + free (entry); + } + } + else + { + fprintf (stderr, "non-numeric arg given to `delete'\n"); + } + } } } diff --git a/lib/readline/histexpand.c b/lib/readline/histexpand.c index 6c811961..584198a7 100644 --- a/lib/readline/histexpand.c +++ b/lib/readline/histexpand.c @@ -52,6 +52,8 @@ #define HISTORY_WORD_DELIMITERS " \t\n;&()|<>" #define HISTORY_QUOTE_CHARACTERS "\"'`" +#define slashify_in_quotes "\\`\"$" + typedef int _hist_search_func_t PARAMS((const char *, int)); extern int rl_byte_oriented; /* declared in mbutil.c */ @@ -65,6 +67,8 @@ static int subst_rhs_len; static char *get_history_word_specifier PARAMS((char *, char *, int *)); static char *history_find_word PARAMS((char *, int)); +static int history_tokenize_word PARAMS((const char *, int)); +static char *history_substring PARAMS((const char *, int, int)); static char *quote_breaks PARAMS((char *)); @@ -211,8 +215,8 @@ get_history_event (string, caller_index, delimiting_quote) memset (&ps, 0, sizeof (mbstate_t)); /* These produce warnings because we're passing a const string to a function that takes a non-const string. */ - _rl_adjust_point (string, i, &ps); - if ((v = _rl_get_char_len (string + i, &ps)) > 1) + _rl_adjust_point ((char *)string, i, &ps); + if ((v = _rl_get_char_len ((char *)string + i, &ps)) > 1) { i += v - 1; continue; @@ -517,7 +521,7 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line) char *current_line; /* for !# */ { int i, n, starting_index; - int substitute_globally, want_quotes, print_only; + int substitute_globally, subst_bywords, want_quotes, print_only; char *event, *temp, *result, *tstr, *t, c, *word_spec; int result_len; #if defined (HANDLE_MULTIBYTE) @@ -599,19 +603,25 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line) FREE (word_spec); /* Perhaps there are other modifiers involved. Do what they say. */ - want_quotes = substitute_globally = print_only = 0; + want_quotes = substitute_globally = subst_bywords = print_only = 0; starting_index = i; while (string[i] == ':') { c = string[i + 1]; - if (c == 'g') + if (c == 'g' || c == 'a') { substitute_globally = 1; i++; c = string[i + 1]; } + else if (c == 'G') + { + subst_bywords = 1; + i++; + c = string[i + 1]; + } switch (c) { @@ -683,7 +693,7 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line) case 's': { char *new_event; - int delimiter, failed, si, l_temp; + int delimiter, failed, si, l_temp, ws, we; if (c == 's') { @@ -760,33 +770,67 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line) } /* Find the first occurrence of THIS in TEMP. */ - si = 0; + /* Substitute SUBST_RHS for SUBST_LHS in TEMP. There are three + cases to consider: + + 1. substitute_globally == subst_bywords == 0 + 2. substitute_globally == 1 && subst_bywords == 0 + 3. substitute_globally == 0 && subst_bywords == 1 + + In the first case, we substitute for the first occurrence only. + In the second case, we substitute for every occurrence. + In the third case, we tokenize into words and substitute the + first occurrence of each word. */ + + si = we = 0; for (failed = 1; (si + subst_lhs_len) <= l_temp; si++) - if (STREQN (temp+si, subst_lhs, subst_lhs_len)) - { - int len = subst_rhs_len - subst_lhs_len + l_temp; - new_event = (char *)xmalloc (1 + len); - strncpy (new_event, temp, si); - strncpy (new_event + si, subst_rhs, subst_rhs_len); - strncpy (new_event + si + subst_rhs_len, - temp + si + subst_lhs_len, - l_temp - (si + subst_lhs_len)); - new_event[len] = '\0'; - free (temp); - temp = new_event; - - failed = 0; - - if (substitute_globally) - { - si += subst_rhs_len; - l_temp = strlen (temp); - substitute_globally++; - continue; - } - else - break; - } + { + /* First skip whitespace and find word boundaries if + we're past the end of the word boundary we found + the last time. */ + if (subst_bywords && si > we) + { + for (; temp[si] && whitespace (temp[si]); si++) + ; + ws = si; + we = history_tokenize_word (temp, si); + } + + if (STREQN (temp+si, subst_lhs, subst_lhs_len)) + { + int len = subst_rhs_len - subst_lhs_len + l_temp; + new_event = (char *)xmalloc (1 + len); + strncpy (new_event, temp, si); + strncpy (new_event + si, subst_rhs, subst_rhs_len); + strncpy (new_event + si + subst_rhs_len, + temp + si + subst_lhs_len, + l_temp - (si + subst_lhs_len)); + new_event[len] = '\0'; + free (temp); + temp = new_event; + + failed = 0; + + if (substitute_globally) + { + /* Reported to fix a bug that causes it to skip every + other match when matching a single character. Was + si += subst_rhs_len previously. */ + si += subst_rhs_len - 1; + l_temp = strlen (temp); + substitute_globally++; + continue; + } + else if (subst_bywords) + { + si = we; + l_temp = strlen (temp); + continue; + } + else + break; + } + } if (substitute_globally > 1) { @@ -879,7 +923,7 @@ history_expand (hstring, output) char **output; { register int j; - int i, r, l, passc, cc, modified, eindex, only_printing; + int i, r, l, passc, cc, modified, eindex, only_printing, dquote; char *string; /* The output string, and its length. */ @@ -942,7 +986,7 @@ history_expand (hstring, output) /* `!' followed by one of the characters in history_no_expand_chars is NOT an expansion. */ - for (i = 0; string[i]; i++) + for (i = dquote = 0; string[i]; i++) { #if defined (HANDLE_MULTIBYTE) if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) @@ -984,9 +1028,19 @@ history_expand (hstring, output) else break; } - /* XXX - at some point, might want to extend this to handle - double quotes as well. */ - else if (history_quotes_inhibit_expansion && string[i] == '\'') + /* Shell-like quoting: allow backslashes to quote double quotes + inside a double-quoted string. */ + else if (dquote && string[i] == '\\' && cc == '"') + i++; + /* More shell-like quoting: if we're paying attention to single + quotes and letting them quote the history expansion character, + then we need to pay attention to double quotes, because single + quotes are not special inside double-quoted strings. */ + else if (history_quotes_inhibit_expansion && string[i] == '"') + { + dquote = 1 - dquote; + } + else if (dquote == 0 && history_quotes_inhibit_expansion && string[i] == '\'') { /* If this is bash, single quotes inhibit history expansion. */ i++; @@ -999,6 +1053,7 @@ history_expand (hstring, output) if (cc == '\'' || cc == history_expansion_char) i++; } + } if (string[i] != history_expansion_char) @@ -1010,7 +1065,7 @@ history_expand (hstring, output) } /* Extract and perform the substitution. */ - for (passc = i = j = 0; i < l; i++) + for (passc = dquote = i = j = 0; i < l; i++) { int tchar = string[i]; @@ -1061,11 +1116,16 @@ history_expand (hstring, output) ADD_CHAR (tchar); break; + case '"': + dquote = 1 - dquote; + ADD_CHAR (tchar); + break; + case '\'': { /* If history_quotes_inhibit_expansion is set, single quotes inhibit history expansion. */ - if (history_quotes_inhibit_expansion) + if (dquote == 0 && history_quotes_inhibit_expansion) { int quote, slen; @@ -1338,7 +1398,103 @@ history_arg_extract (first, last, string) return (result); } -#define slashify_in_quotes "\\`\"$" +static int +history_tokenize_word (string, ind) + const char *string; + int ind; +{ + register int i; + int delimiter; + + i = ind; + delimiter = 0; + + if (member (string[i], "()\n")) + { + i++; + return i; + } + + if (member (string[i], "<>;&|$")) + { + int peek = string[i + 1]; + + if (peek == string[i] && peek != '$') + { + if (peek == '<' && string[i + 2] == '-') + i++; + i += 2; + return i; + } + else + { + if ((peek == '&' && (string[i] == '>' || string[i] == '<')) || + (peek == '>' && string[i] == '&') || + (peek == '(' && (string[i] == '>' || string[i] == '<')) || /* ) */ + (peek == '(' && string[i] == '$')) /* ) */ + { + i += 2; + return i; + } + } + + if (string[i] != '$') + { + i++; + return i; + } + } + + /* Get word from string + i; */ + + if (member (string[i], HISTORY_QUOTE_CHARACTERS)) + delimiter = string[i++]; + + for (; string[i]; i++) + { + if (string[i] == '\\' && string[i + 1] == '\n') + { + i++; + continue; + } + + if (string[i] == '\\' && delimiter != '\'' && + (delimiter != '"' || member (string[i], slashify_in_quotes))) + { + i++; + continue; + } + + if (delimiter && string[i] == delimiter) + { + delimiter = 0; + continue; + } + + if (!delimiter && (member (string[i], history_word_delimiters))) + break; + + if (!delimiter && member (string[i], HISTORY_QUOTE_CHARACTERS)) + delimiter = string[i]; + } + + return i; +} + +static char * +history_substring (string, start, end) + const char *string; + int start, end; +{ + register int len; + register char *result; + + len = end - start; + result = (char *)xmalloc (len + 1); + strncpy (result, string + start, len); + result[len] = '\0'; + return result; +} /* Parse STRING into tokens and return an array of strings. If WIND is not -1 and INDP is not null, we also want the word surrounding index @@ -1351,7 +1507,6 @@ history_tokenize_internal (string, wind, indp) { char **result; register int i, start, result_index, size; - int len, delimiter; /* If we're searching for a string that's not part of a word (e.g., " "), make sure we set *INDP to a reasonable value. */ @@ -1362,8 +1517,6 @@ history_tokenize_internal (string, wind, indp) exactly where the shell would split them. */ for (i = result_index = size = 0, result = (char **)NULL; string[i]; ) { - delimiter = 0; - /* Skip leading whitespace. */ for (; string[i] && whitespace (string[i]); i++) ; @@ -1371,88 +1524,19 @@ history_tokenize_internal (string, wind, indp) return (result); start = i; - - if (member (string[i], "()\n")) - { - i++; - goto got_token; - } - if (member (string[i], "<>;&|$")) - { - int peek = string[i + 1]; - - if (peek == string[i] && peek != '$') - { - if (peek == '<' && string[i + 2] == '-') - i++; - i += 2; - goto got_token; - } - else - { - if ((peek == '&' && (string[i] == '>' || string[i] == '<')) || - ((peek == '>') && (string[i] == '&')) || - ((peek == '(') && (string[i] == '$'))) - { - i += 2; - goto got_token; - } - } - if (string[i] != '$') - { - i++; - goto got_token; - } - } - - /* Get word from string + i; */ - - if (member (string[i], HISTORY_QUOTE_CHARACTERS)) - delimiter = string[i++]; - - for (; string[i]; i++) - { - if (string[i] == '\\' && string[i + 1] == '\n') - { - i++; - continue; - } - - if (string[i] == '\\' && delimiter != '\'' && - (delimiter != '"' || member (string[i], slashify_in_quotes))) - { - i++; - continue; - } - - if (delimiter && string[i] == delimiter) - { - delimiter = 0; - continue; - } - - if (!delimiter && (member (string[i], history_word_delimiters))) - break; - - if (!delimiter && member (string[i], HISTORY_QUOTE_CHARACTERS)) - delimiter = string[i]; - } - - got_token: + i = history_tokenize_word (string, start); /* If we are looking for the word in which the character at a particular index falls, remember it. */ if (indp && wind != -1 && wind >= start && wind < i) *indp = result_index; - len = i - start; if (result_index + 2 >= size) result = (char **)xrealloc (result, ((size += 10) * sizeof (char *))); - result[result_index] = (char *)xmalloc (1 + len); - strncpy (result[result_index], string + start, len); - result[result_index][len] = '\0'; - result[++result_index] = (char *)NULL; + + result[result_index++] = history_substring (string, start, i); + result[result_index] = (char *)NULL; } return (result); diff --git a/lib/readline/histfile.c b/lib/readline/histfile.c index 60a91251..b0b1a1b2 100644 --- a/lib/readline/histfile.c +++ b/lib/readline/histfile.c @@ -1,6 +1,6 @@ /* histfile.c - functions to manipulate the history file. */ -/* Copyright (C) 1989, 1992 Free Software Foundation, Inc. +/* Copyright (C) 1989-2003 Free Software Foundation, Inc. This file contains the GNU History Library (the Library), a set of routines for managing the text of previously typed lines. @@ -32,7 +32,7 @@ #include <stdio.h> #include <sys/types.h> -#ifndef _MINIX +#if ! defined (_MINIX) && defined (HAVE_SYS_FILE_H) # include <sys/file.h> #endif #include "posixstat.h" @@ -52,7 +52,7 @@ # undef HAVE_MMAP #endif -#ifdef HAVE_MMAP +#ifdef HISTORY_USE_MMAP # include <sys/mman.h> # ifdef MAP_FILE @@ -67,7 +67,7 @@ # define MAP_FAILED ((void *)-1) # endif -#endif /* HAVE_MMAP */ +#endif /* HISTORY_USE_MMAP */ /* If we're compiling for __EMX__ (OS/2) or __CYGWIN__ (cygwin32 environment on win 95/98/nt), we want to open files with O_BINARY mode so that there @@ -93,6 +93,13 @@ extern int errno; #include "rlshell.h" #include "xmalloc.h" +/* If non-zero, we write timestamps to the history file in history_do_write() */ +int history_write_timestamps = 0; + +/* Does S look like the beginning of a history timestamp entry? Placeholder + for more extensive tests. */ +#define HIST_TIMESTAMP_START(s) (*(s) == history_comment_char) + /* Return the string that should be used in the place of this filename. This only matters when you don't specify the filename to read_history (), or write_history (). */ @@ -151,13 +158,20 @@ read_history_range (filename, from, to) const char *filename; int from, to; { - register char *line_start, *line_end; - char *input, *buffer, *bufend; + register char *line_start, *line_end, *p; + char *input, *buffer, *bufend, *last_ts; int file, current_line, chars_read; struct stat finfo; size_t file_size; +#if defined (EFBIG) + int overflow_errno = EFBIG; +#elif defined (EOVERFLOW) + int overflow_errno = EOVERFLOW; +#else + int overflow_errno = EIO; +#endif - buffer = (char *)NULL; + buffer = last_ts = (char *)NULL; input = history_filename (filename); file = open (input, O_RDONLY|O_BINARY, 0666); @@ -169,37 +183,42 @@ read_history_range (filename, from, to) /* check for overflow on very large files */ if (file_size != finfo.st_size || file_size + 1 < file_size) { -#if defined (EFBIG) - errno = EFBIG; -#elif defined (EOVERFLOW) - errno = EOVERFLOW; -#endif + errno = overflow_errno; goto error_and_exit; } -#ifdef HAVE_MMAP +#ifdef HISTORY_USE_MMAP /* We map read/write and private so we can change newlines to NULs without affecting the underlying object. */ buffer = (char *)mmap (0, file_size, PROT_READ|PROT_WRITE, MAP_RFLAGS, file, 0); if ((void *)buffer == MAP_FAILED) - goto error_and_exit; + { + errno = overflow_errno; + goto error_and_exit; + } chars_read = file_size; #else buffer = (char *)malloc (file_size + 1); if (buffer == 0) - goto error_and_exit; + { + errno = overflow_errno; + goto error_and_exit; + } chars_read = read (file, buffer, file_size); #endif if (chars_read < 0) { error_and_exit: - chars_read = errno; + if (errno != 0) + chars_read = errno; + else + chars_read = EIO; if (file >= 0) close (file); FREE (input); -#ifndef HAVE_MMAP +#ifndef HISTORY_USE_MMAP FREE (buffer); #endif @@ -220,8 +239,12 @@ read_history_range (filename, from, to) for (line_start = line_end = buffer; line_end < bufend && current_line < from; line_end++) if (*line_end == '\n') { - current_line++; - line_start = line_end + 1; + p = line_end + 1; + /* If we see something we think is a timestamp, continue with this + line. We should check more extensively here... */ + if (HIST_TIMESTAMP_START(p) == 0) + current_line++; + line_start = p; } /* If there are lines left to gobble, then gobble them now. */ @@ -231,7 +254,22 @@ read_history_range (filename, from, to) *line_end = '\0'; if (*line_start) - add_history (line_start); + { + if (HIST_TIMESTAMP_START(line_start) == 0) + { + add_history (line_start); + if (last_ts) + { + add_history_time (last_ts); + last_ts = NULL; + } + } + else + { + last_ts = line_start; + current_line--; + } + } current_line++; @@ -242,7 +280,7 @@ read_history_range (filename, from, to) } FREE (input); -#ifndef HAVE_MMAP +#ifndef HISTORY_USE_MMAP FREE (buffer); #else munmap (buffer, file_size); @@ -259,7 +297,7 @@ history_truncate_file (fname, lines) const char *fname; int lines; { - char *buffer, *filename, *bp; + char *buffer, *filename, *bp, *bp1; /* bp1 == bp+1 */ int file, chars_read, rv; struct stat finfo; size_t file_size; @@ -322,11 +360,14 @@ history_truncate_file (fname, lines) } /* Count backwards from the end of buffer until we have passed - LINES lines. */ - for (bp = buffer + chars_read - 1; lines && bp > buffer; bp--) + LINES lines. bp1 is set funny initially. But since bp[1] can't + be a comment character (since it's off the end) and *bp can't be + both a newline and the history comment character, it should be OK. */ + for (bp1 = bp = buffer + chars_read - 1; lines && bp > buffer; bp--) { - if (*bp == '\n') + if (*bp == '\n' && HIST_TIMESTAMP_START(bp1) == 0) lines--; + bp1 = bp; } /* If this is the first line, then the file contains exactly the @@ -335,11 +376,14 @@ history_truncate_file (fname, lines) the current value of i and 0. Otherwise, write from the start of this line until the end of the buffer. */ for ( ; bp > buffer; bp--) - if (*bp == '\n') - { - bp++; - break; - } + { + if (*bp == '\n' && HIST_TIMESTAMP_START(bp1) == 0) + { + bp++; + break; + } + bp1 = bp; + } /* Write only if there are more lines in the file than we want to truncate to. */ @@ -374,9 +418,9 @@ history_do_write (filename, nelements, overwrite) register int i; char *output; int file, mode, rv; +#ifdef HISTORY_USE_MMAP size_t cursize; -#ifdef HAVE_MMAP mode = overwrite ? O_RDWR|O_CREAT|O_TRUNC|O_BINARY : O_RDWR|O_APPEND|O_BINARY; #else mode = overwrite ? O_WRONLY|O_CREAT|O_TRUNC|O_BINARY : O_WRONLY|O_APPEND|O_BINARY; @@ -390,7 +434,7 @@ history_do_write (filename, nelements, overwrite) return (errno); } -#ifdef HAVE_MMAP +#ifdef HISTORY_USE_MMAP cursize = overwrite ? 0 : lseek (file, 0, SEEK_END); #endif @@ -408,10 +452,18 @@ history_do_write (filename, nelements, overwrite) the_history = history_list (); /* Calculate the total number of bytes to write. */ for (buffer_size = 0, i = history_length - nelements; i < history_length; i++) - buffer_size += 1 + strlen (the_history[i]->line); +#if 0 + buffer_size += 2 + HISTENT_BYTES (the_history[i]); +#else + { + if (history_write_timestamps && the_history[i]->timestamp && the_history[i]->timestamp[0]) + buffer_size += strlen (the_history[i]->timestamp) + 1; + buffer_size += strlen (the_history[i]->line) + 1; + } +#endif /* Allocate the buffer, and fill it. */ -#ifdef HAVE_MMAP +#ifdef HISTORY_USE_MMAP if (ftruncate (file, buffer_size+cursize) == -1) goto mmap_error; buffer = (char *)mmap (0, buffer_size, PROT_READ|PROT_WRITE, MAP_WFLAGS, file, cursize); @@ -436,12 +488,18 @@ mmap_error: for (j = 0, i = history_length - nelements; i < history_length; i++) { + if (history_write_timestamps && the_history[i]->timestamp && the_history[i]->timestamp[0]) + { + strcpy (buffer + j, the_history[i]->timestamp); + j += strlen (the_history[i]->timestamp); + buffer[j++] = '\n'; + } strcpy (buffer + j, the_history[i]->line); j += strlen (the_history[i]->line); buffer[j++] = '\n'; } -#ifdef HAVE_MMAP +#ifdef HISTORY_USE_MMAP if (msync (buffer, buffer_size, 0) != 0 || munmap (buffer, buffer_size) != 0) rv = errno; #else diff --git a/lib/readline/history.c b/lib/readline/history.c index 4242f33e..d99b76e8 100644 --- a/lib/readline/history.c +++ b/lib/readline/history.c @@ -1,6 +1,6 @@ -/* History.c -- standalone history library */ +/* history.c -- standalone history library */ -/* Copyright (C) 1989, 1992 Free Software Foundation, Inc. +/* Copyright (C) 1989-2003 Free Software Foundation, Inc. This file contains the GNU History Library (the Library), a set of routines for managing the text of previously typed lines. @@ -52,6 +52,8 @@ /* The number of slots to increase the_history by. */ #define DEFAULT_HISTORY_GROW_SIZE 50 +static char *hist_inittime PARAMS((void)); + /* **************************************************************** */ /* */ /* History Functions */ @@ -123,14 +125,15 @@ using_history () } /* Return the number of bytes that the primary history entries are using. - This just adds up the lengths of the_history->lines. */ + This just adds up the lengths of the_history->lines and the associated + timestamps. */ int history_total_bytes () { register int i, result; for (i = result = 0; the_history && the_history[i]; i++) - result += strlen (the_history[i]->line); + result += HISTENT_BYTES (the_history[i]); return (result); } @@ -206,6 +209,40 @@ history_get (offset) : the_history[local_index]; } +time_t +history_get_time (hist) + HIST_ENTRY *hist; +{ + char *ts; + time_t t; + + if (hist == 0 || hist->timestamp == 0) + return 0; + ts = hist->timestamp; + if (ts[0] != history_comment_char) + return 0; + t = (time_t) atol (ts + 1); /* XXX - should use strtol() here */ + return t; +} + +static char * +hist_inittime () +{ + time_t t; + char ts[64], *ret; + + t = (time_t) time ((time_t *)0); +#if defined (HAVE_VSNPRINTF) /* assume snprintf if vsnprintf exists */ + snprintf (ts, sizeof (ts) - 1, "X%lu", (unsigned long) t); +#else + sprintf (ts, "X%lu", (unsigned long) t); +#endif + ret = savestring (ts); + ret[0] = history_comment_char; + + return ret; +} + /* Place STRING at the end of the history list. The data field is set to NULL. */ void @@ -225,10 +262,7 @@ add_history (string) /* If there is something in the slot, then remove it. */ if (the_history[0]) - { - free (the_history[0]->line); - free (the_history[0]); - } + (void) free_history_entry (the_history[0]); /* Copy the rest of the entries, moving down one slot. */ for (i = 0; i < history_length; i++) @@ -260,10 +294,41 @@ add_history (string) temp->line = savestring (string); temp->data = (char *)NULL; + temp->timestamp = hist_inittime (); + the_history[history_length] = (HIST_ENTRY *)NULL; the_history[history_length - 1] = temp; } +/* Change the time stamp of the most recent history entry to STRING. */ +void +add_history_time (string) + const char *string; +{ + HIST_ENTRY *hs; + + hs = the_history[history_length - 1]; + FREE (hs->timestamp); + hs->timestamp = savestring (string); +} + +/* Free HIST and return the data so the calling application can free it + if necessary and desired. */ +histdata_t +free_history_entry (hist) + HIST_ENTRY *hist; +{ + histdata_t x; + + if (hist == 0) + return ((histdata_t) 0); + FREE (hist->line); + FREE (hist->timestamp); + x = hist->data; + free (hist); + return (x); +} + /* 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. */ @@ -283,6 +348,7 @@ replace_history_entry (which, line, data) temp->line = savestring (line); temp->data = data; + temp->timestamp = savestring (old_value->timestamp); the_history[which] = temp; return (old_value); @@ -327,10 +393,7 @@ stifle_history (max) { /* This loses because we cannot free the data. */ for (i = 0, j = history_length - max; i < j; i++) - { - free (the_history[i]->line); - free (the_history[i]); - } + free_history_entry (the_history[i]); history_base = i; for (j = 0, i = history_length - max; j < max; i++, j++) @@ -372,8 +435,7 @@ clear_history () /* This loses because we cannot free the data. */ for (i = 0; i < history_length; i++) { - free (the_history[i]->line); - free (the_history[i]); + free_history_entry (the_history[i]); the_history[i] = (HIST_ENTRY *)NULL; } diff --git a/lib/readline/history.h b/lib/readline/history.h index 58b5de46..14ca2a99 100644 --- a/lib/readline/history.h +++ b/lib/readline/history.h @@ -1,5 +1,5 @@ -/* History.h -- the names of functions that you can call in history. */ -/* Copyright (C) 1989, 1992 Free Software Foundation, Inc. +/* history.h -- the names of functions that you can call in history. */ +/* Copyright (C) 1989-2003 Free Software Foundation, Inc. This file contains the GNU History Library (the Library), a set of routines for managing the text of previously typed lines. @@ -26,6 +26,8 @@ extern "C" { #endif +#include <time.h> /* XXX - for history timestamp code */ + #if defined READLINE_LIBRARY # include "rlstdc.h" # include "rltypedefs.h" @@ -43,9 +45,13 @@ typedef char *histdata_t; /* The structure used to store a history entry. */ typedef struct _hist_entry { char *line; + char *timestamp; /* char * rather than time_t for read/write */ histdata_t data; } HIST_ENTRY; +/* Size of the history-library-managed space in history entry HS. */ +#define HISTENT_BYTES(hs) (strlen ((hs)->line) + strlen ((hs)->timestamp)) + /* A structure used to pass the current state of the history stuff around. */ typedef struct _hist_state { HIST_ENTRY **entries; /* Pointer to the entries themselves. */ @@ -76,11 +82,19 @@ extern void history_set_history_state PARAMS((HISTORY_STATE *)); The associated data field (if any) is set to NULL. */ extern void add_history PARAMS((const char *)); +/* Change the timestamp associated with the most recent history entry to + STRING. */ +extern void add_history_time PARAMS((const 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 PARAMS((int)); +/* Free the history entry H and return any application-specific data + associated with it. */ +extern histdata_t free_history_entry PARAMS((HIST_ENTRY *)); + /* 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. */ @@ -119,6 +133,10 @@ extern HIST_ENTRY *current_history PARAMS((void)); array. OFFSET is relative to history_base. */ extern HIST_ENTRY *history_get PARAMS((int)); +/* Return the timestamp associated with the HIST_ENTRY * passed as an + argument */ +extern time_t history_get_time PARAMS((HIST_ENTRY *)); + /* 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 PARAMS((void)); @@ -231,6 +249,8 @@ extern char *history_no_expand_chars; extern char *history_search_delimiter_chars; extern int history_quotes_inhibit_expansion; +extern int history_write_timestamps; + /* Backwards compatibility */ extern int max_input_history; diff --git a/lib/readline/histsearch.c b/lib/readline/histsearch.c index d94fd6cd..1cc5875a 100644 --- a/lib/readline/histsearch.c +++ b/lib/readline/histsearch.c @@ -77,11 +77,11 @@ history_search_internal (string, direction, anchored) if (string == 0 || *string == '\0') return (-1); - if (!history_length || ((i == history_length) && !reverse)) + if (!history_length || ((i >= history_length) && !reverse)) return (-1); - if (reverse && (i == history_length)) - i--; + if (reverse && (i >= history_length)) + i = history_length - 1; #define NEXT_LINE() do { if (reverse) i--; else i++; } while (0) diff --git a/lib/readline/input.c b/lib/readline/input.c index 841f05d1..6d2bb2f1 100644 --- a/lib/readline/input.c +++ b/lib/readline/input.c @@ -154,6 +154,12 @@ _rl_unget_char (key) return (0); } +int +_rl_pushed_input_available () +{ + return (push_index != pop_index); +} + /* If a character is available to be read, then read it and stuff it into IBUFFER. Otherwise, just return. Returns number of characters read (0 if none available) and -1 on error (EIO). */ @@ -162,7 +168,7 @@ rl_gather_tyi () { int tty; register int tem, result; - int chars_avail; + int chars_avail, k; char input; #if defined(HAVE_SELECT) fd_set readfds, exceptfds; @@ -225,7 +231,12 @@ rl_gather_tyi () if (result != -1) { while (chars_avail--) - rl_stuff_char ((*rl_getc_function) (rl_instream)); + { + k = (*rl_getc_function) (rl_instream); + rl_stuff_char (k); + if (k == NEWLINE || k == RETURN) + break; + } } else { diff --git a/lib/readline/keymaps.c b/lib/readline/keymaps.c index 12506d3a..70d0cc08 100644 --- a/lib/readline/keymaps.c +++ b/lib/readline/keymaps.c @@ -64,11 +64,13 @@ rl_make_bare_keymap () keymap[i].function = (rl_command_func_t *)NULL; } +#if 0 for (i = 'A'; i < ('Z' + 1); i++) { keymap[i].type = ISFUNC; keymap[i].function = rl_do_lowercase_version; } +#endif return (keymap); } @@ -79,8 +81,9 @@ rl_copy_keymap (map) Keymap map; { register int i; - Keymap temp = rl_make_bare_keymap (); + Keymap temp; + temp = rl_make_bare_keymap (); for (i = 0; i < KEYMAP_SIZE; i++) { temp[i].type = map[i].type; @@ -109,12 +112,8 @@ rl_make_keymap () newmap[CTRL('H')].function = rl_rubout; #if KEYMAP_SIZE > 128 - /* Printing characters in some 8-bit character sets. */ - for (i = 128; i < 160; i++) - newmap[i].function = rl_insert; - - /* ISO Latin-1 printing characters should self-insert. */ - for (i = 160; i < 256; i++) + /* Printing characters in ISO Latin-1 and some 8-bit character sets. */ + for (i = 128; i < 256; i++) newmap[i].function = rl_insert; #endif /* KEYMAP_SIZE > 128 */ diff --git a/lib/readline/mbutil.c b/lib/readline/mbutil.c index 50302f01..64512546 100644 --- a/lib/readline/mbutil.c +++ b/lib/readline/mbutil.c @@ -97,7 +97,7 @@ _rl_find_next_mbchar_internal (string, seed, count, find_non_zero) while (count > 0) { tmp = mbrtowc (&wc, string+point, strlen(string + point), &ps); - if ((size_t)(tmp) == (size_t)-1 || (size_t)(tmp) == (size_t)-2) + if (MB_INVALIDCH ((size_t)tmp)) { /* invalid bytes. asume a byte represents a character */ point++; @@ -105,9 +105,8 @@ _rl_find_next_mbchar_internal (string, seed, count, find_non_zero) /* reset states. */ memset(&ps, 0, sizeof(mbstate_t)); } - else if (tmp == (size_t)0) - /* found '\0' char */ - break; + else if (MB_NULLWCH (tmp)) + break; /* found wide '\0' */ else { /* valid bytes */ @@ -160,7 +159,7 @@ _rl_find_prev_mbchar_internal (string, seed, find_non_zero) while (point < seed) { tmp = mbrtowc (&wc, string + point, length - point, &ps); - if ((size_t)(tmp) == (size_t)-1 || (size_t)(tmp) == (size_t)-2) + if (MB_INVALIDCH ((size_t)tmp)) { /* in this case, bytes are invalid or shorted to compose multibyte char, so assume that the first byte represents @@ -170,7 +169,7 @@ _rl_find_prev_mbchar_internal (string, seed, find_non_zero) in this case effect of mbstate is undefined */ memset(&ps, 0, sizeof (mbstate_t)); } - else if (tmp == 0) + else if (MB_NULLWCH (tmp)) break; /* Found '\0' char. Can this happen? */ else { @@ -205,14 +204,16 @@ _rl_get_char_len (src, ps) if (tmp == (size_t)(-2)) { /* shorted to compose multibyte char */ - memset (ps, 0, sizeof(mbstate_t)); + if (ps) + memset (ps, 0, sizeof(mbstate_t)); return -2; } else if (tmp == (size_t)(-1)) { /* invalid to compose multibyte char */ /* initialize the conversion state */ - memset (ps, 0, sizeof(mbstate_t)); + if (ps) + memset (ps, 0, sizeof(mbstate_t)); return -1; } else if (tmp == (size_t)0) @@ -225,9 +226,12 @@ _rl_get_char_len (src, ps) return 1. Otherwise return 0. */ int _rl_compare_chars (buf1, pos1, ps1, buf2, pos2, ps2) - char *buf1, *buf2; - mbstate_t *ps1, *ps2; - int pos1, pos2; + char *buf1; + int pos1; + mbstate_t *ps1; + char *buf2; + int pos2; + mbstate_t *ps2; { int i, w1, w2; @@ -268,7 +272,7 @@ _rl_adjust_point(string, point, ps) while (pos < point) { tmp = mbrlen (string + pos, length - pos, ps); - if((size_t)(tmp) == (size_t)-1 || (size_t)(tmp) == (size_t)-2) + if (MB_INVALIDCH ((size_t)tmp)) { /* in this case, bytes are invalid or shorted to compose multibyte char, so assume that the first byte represents @@ -276,8 +280,11 @@ _rl_adjust_point(string, point, ps) pos++; /* clear the state of the byte sequence, because in this case effect of mbstate is undefined */ - memset (ps, 0, sizeof (mbstate_t)); + if (ps) + memset (ps, 0, sizeof (mbstate_t)); } + else if (MB_NULLWCH (tmp)) + pos++; else pos += tmp; } diff --git a/lib/readline/misc.c b/lib/readline/misc.c index f3775d30..05c87090 100644 --- a/lib/readline/misc.c +++ b/lib/readline/misc.c @@ -253,7 +253,7 @@ rl_maybe_unsave_line () { if (_rl_saved_line_for_history) { - rl_replace_line (_rl_saved_line_for_history->line, 0); + rl_replace_line (_rl_saved_line_for_history->line, 1); rl_undo_list = (UNDO_LIST *)_rl_saved_line_for_history->data; _rl_free_history_entry (_rl_saved_line_for_history); _rl_saved_line_for_history = (HIST_ENTRY *)NULL; @@ -298,7 +298,7 @@ _rl_history_set_point () rl_point = rl_end; #if defined (VI_MODE) - if (rl_editing_mode == vi_mode) + if (rl_editing_mode == vi_mode && _rl_keymap != vi_insertion_keymap) rl_point = 0; #endif /* VI_MODE */ @@ -311,6 +311,8 @@ rl_replace_from_history (entry, flags) HIST_ENTRY *entry; int flags; /* currently unused */ { + /* Can't call with `1' because rl_undo_list might point to an undo list + from a history entry, just like we're setting up here. */ rl_replace_line (entry->line, 0); rl_undo_list = (UNDO_LIST *)entry->data; rl_point = rl_end; diff --git a/lib/readline/nls.c b/lib/readline/nls.c index 706c8195..bcee8756 100644 --- a/lib/readline/nls.c +++ b/lib/readline/nls.c @@ -75,6 +75,23 @@ static char *normalize_codeset PARAMS((char *)); static char *find_codeset PARAMS((char *, size_t *)); #endif /* !HAVE_SETLOCALE */ +static char *_rl_get_locale_var PARAMS((const char *)); + +static char * +_rl_get_locale_var (v) + const char *v; +{ + char *lspec; + + lspec = sh_get_env_value ("LC_ALL"); + if (lspec == 0 || *lspec == 0) + lspec = sh_get_env_value (v); + if (lspec == 0 || *lspec == 0) + lspec = sh_get_env_value ("LANG"); + + return lspec; +} + /* Check for LC_ALL, LC_CTYPE, and LANG and use the first with a value to decide the defaults for 8-bit character input and output. Returns 1 if we set eight-bit mode. */ @@ -84,10 +101,21 @@ _rl_init_eightbit () /* If we have setlocale(3), just check the current LC_CTYPE category value, and go into eight-bit mode if it's not C or POSIX. */ #if defined (HAVE_SETLOCALE) - char *t; + char *lspec, *t; /* Set the LC_CTYPE locale category from environment variables. */ - t = setlocale (LC_CTYPE, ""); + lspec = _rl_get_locale_var ("LC_CTYPE"); + /* Since _rl_get_locale_var queries the right environment variables, + we query the current locale settings with setlocale(), and, if + that doesn't return anything, we set lspec to the empty string to + force the subsequent call to setlocale() to define the `native' + environment. */ + if (lspec == 0 || *lspec == 0) + lspec = setlocale (LC_CTYPE, (char *)NULL); + if (lspec == 0) + lspec = ""; + t = setlocale (LC_CTYPE, lspec); + if (t && *t && (t[0] != 'C' || t[1]) && (STREQ (t, "POSIX") == 0)) { _rl_meta_flag = 1; @@ -105,9 +133,8 @@ _rl_init_eightbit () /* We don't have setlocale. Finesse it. Check the environment for the appropriate variables and set eight-bit mode if they have the right values. */ - lspec = sh_get_env_value ("LC_ALL"); - if (lspec == 0) lspec = sh_get_env_value ("LC_CTYPE"); - if (lspec == 0) lspec = sh_get_env_value ("LANG"); + lspec = _rl_get_locale_var ("LC_CTYPE"); + if (lspec == 0 || (t = normalize_codeset (lspec)) == 0) return (0); for (i = 0; t && legal_lang_values[i]; i++) diff --git a/lib/readline/readline.c b/lib/readline/readline.c index 28801f19..a70d80ff 100644 --- a/lib/readline/readline.c +++ b/lib/readline/readline.c @@ -68,11 +68,11 @@ #include "xmalloc.h" #ifndef RL_LIBRARY_VERSION -# define RL_LIBRARY_VERSION "4.3" +# define RL_LIBRARY_VERSION "5.0" #endif #ifndef RL_READLINE_VERSION -# define RL_READLINE_VERSION 0x0403 +# define RL_READLINE_VERSION 0x0500 #endif extern void _rl_free_history_entry PARAMS((HIST_ENTRY *)); @@ -85,6 +85,7 @@ static void bind_arrow_keys_internal PARAMS((Keymap)); static void bind_arrow_keys PARAMS((void)); static void readline_default_bindings PARAMS((void)); +static void reset_default_bindings PARAMS((void)); /* **************************************************************** */ /* */ @@ -347,7 +348,7 @@ readline_internal_setup () #if defined (VI_MODE) if (rl_editing_mode == vi_mode) - rl_vi_insertion_mode (1, 0); + rl_vi_insertion_mode (1, 'i'); #endif /* VI_MODE */ if (rl_pre_input_hook) @@ -650,7 +651,21 @@ _rl_dispatch_subseq (key, map, got_subseq) the function. The recursive call to _rl_dispatch_subseq has already taken care of pushing any necessary input back onto the input queue with _rl_unget_char. */ - r = _rl_dispatch (ANYOTHERKEY, FUNCTION_TO_KEYMAP (map, key)); + { +#if 0 + r = _rl_dispatch (ANYOTHERKEY, FUNCTION_TO_KEYMAP (map, key)); +#else + /* XXX - experimental code -- might never be executed. Save + for later. */ + Keymap m = FUNCTION_TO_KEYMAP (map, key); + int type = m[ANYOTHERKEY].type; + func = m[ANYOTHERKEY].function; + if (type == ISFUNC && func == rl_do_lowercase_version) + r = _rl_dispatch (_rl_to_lower (key), map); + else + r = _rl_dispatch (ANYOTHERKEY, m); +#endif + } else if (r && map[ANYOTHERKEY].function) { /* We didn't match (r is probably -1), so return something to @@ -684,6 +699,7 @@ _rl_dispatch_subseq (key, map, got_subseq) } #if defined (VI_MODE) if (rl_editing_mode == vi_mode && _rl_keymap == vi_movement_keymap && + key != ANYOTHERKEY && _rl_vi_textmod_command (key)) _rl_vi_set_last (key, rl_numeric_arg, rl_arg_sign); #endif @@ -838,7 +854,7 @@ readline_initialize_everything () /* If the completion parser's default word break characters haven't been set yet, then do so now. */ if (rl_completer_word_break_characters == (char *)NULL) - rl_completer_word_break_characters = rl_basic_word_break_characters; + rl_completer_word_break_characters = (char *)rl_basic_word_break_characters; } /* If this system allows us to look at the values of the regular @@ -850,6 +866,15 @@ readline_default_bindings () rl_tty_set_default_bindings (_rl_keymap); } +/* Reset the default bindings for the terminal special characters we're + interested in back to rl_insert and read the new ones. */ +static void +reset_default_bindings () +{ + rl_tty_unset_default_bindings (_rl_keymap); + rl_tty_set_default_bindings (_rl_keymap); +} + /* Bind some common arrow key sequences in MAP. */ static void bind_arrow_keys_internal (map) @@ -861,25 +886,25 @@ bind_arrow_keys_internal (map) _rl_keymap = map; #if defined (__MSDOS__) - _rl_bind_if_unbound ("\033[0A", rl_get_previous_history); - _rl_bind_if_unbound ("\033[0B", rl_backward_char); - _rl_bind_if_unbound ("\033[0C", rl_forward_char); - _rl_bind_if_unbound ("\033[0D", rl_get_next_history); + rl_bind_keyseq_if_unbound ("\033[0A", rl_get_previous_history); + rl_bind_keyseq_if_unbound ("\033[0B", rl_backward_char); + rl_bind_keyseq_if_unbound ("\033[0C", rl_forward_char); + rl_bind_keyseq_if_unbound ("\033[0D", rl_get_next_history); #endif - _rl_bind_if_unbound ("\033[A", rl_get_previous_history); - _rl_bind_if_unbound ("\033[B", rl_get_next_history); - _rl_bind_if_unbound ("\033[C", rl_forward_char); - _rl_bind_if_unbound ("\033[D", rl_backward_char); - _rl_bind_if_unbound ("\033[H", rl_beg_of_line); - _rl_bind_if_unbound ("\033[F", rl_end_of_line); - - _rl_bind_if_unbound ("\033OA", rl_get_previous_history); - _rl_bind_if_unbound ("\033OB", rl_get_next_history); - _rl_bind_if_unbound ("\033OC", rl_forward_char); - _rl_bind_if_unbound ("\033OD", rl_backward_char); - _rl_bind_if_unbound ("\033OH", rl_beg_of_line); - _rl_bind_if_unbound ("\033OF", rl_end_of_line); + rl_bind_keyseq_if_unbound ("\033[A", rl_get_previous_history); + rl_bind_keyseq_if_unbound ("\033[B", rl_get_next_history); + rl_bind_keyseq_if_unbound ("\033[C", rl_forward_char); + rl_bind_keyseq_if_unbound ("\033[D", rl_backward_char); + rl_bind_keyseq_if_unbound ("\033[H", rl_beg_of_line); + rl_bind_keyseq_if_unbound ("\033[F", rl_end_of_line); + + rl_bind_keyseq_if_unbound ("\033OA", rl_get_previous_history); + rl_bind_keyseq_if_unbound ("\033OB", rl_get_next_history); + rl_bind_keyseq_if_unbound ("\033OC", rl_forward_char); + rl_bind_keyseq_if_unbound ("\033OD", rl_backward_char); + rl_bind_keyseq_if_unbound ("\033OH", rl_beg_of_line); + rl_bind_keyseq_if_unbound ("\033OF", rl_end_of_line); _rl_keymap = xkeymap; } diff --git a/lib/readline/readline.h b/lib/readline/readline.h index f11b3d03..8bb08508 100644 --- a/lib/readline/readline.h +++ b/lib/readline/readline.h @@ -40,9 +40,9 @@ extern "C" { #endif /* Hex-encoded Readline version number. */ -#define RL_READLINE_VERSION 0x0403 /* Readline 4.3 */ -#define RL_VERSION_MAJOR 4 -#define RL_VERSION_MINOR 3 +#define RL_READLINE_VERSION 0x0500 /* Readline 5.0 */ +#define RL_VERSION_MAJOR 5 +#define RL_VERSION_MINOR 0 /* Readline data structures. */ @@ -290,12 +290,20 @@ extern int rl_bind_key PARAMS((int, rl_command_func_t *)); extern int rl_bind_key_in_map PARAMS((int, rl_command_func_t *, Keymap)); extern int rl_unbind_key PARAMS((int)); extern int rl_unbind_key_in_map PARAMS((int, Keymap)); +extern int rl_bind_key_if_unbound PARAMS((int, rl_command_func_t *)); +extern int rl_bind_key_if_unbound_in_map PARAMS((int, rl_command_func_t *, Keymap)); extern int rl_unbind_function_in_map PARAMS((rl_command_func_t *, Keymap)); extern int rl_unbind_command_in_map PARAMS((const char *, Keymap)); -extern int rl_set_key PARAMS((const char *, rl_command_func_t *, Keymap)); +extern int rl_bind_keyseq PARAMS((const char *, rl_command_func_t *)); +extern int rl_bind_keyseq_in_map PARAMS((const char *, rl_command_func_t *, Keymap)); +extern int rl_bind_keyseq_if_unbound PARAMS((const char *, rl_command_func_t *)); +extern int rl_bind_keyseq_if_unbound_in_map PARAMS((const char *, rl_command_func_t *, Keymap)); extern int rl_generic_bind PARAMS((int, const char *, char *, Keymap)); extern int rl_variable_bind PARAMS((const char *, const char *)); +/* Backwards compatibility, use rl_bind_keyseq_in_map instead. */ +extern int rl_set_key PARAMS((const char *, rl_command_func_t *, Keymap)); + /* Backwards compatibility, use rl_generic_bind instead. */ extern int rl_macro_bind PARAMS((const char *, const char *, Keymap)); @@ -358,7 +366,7 @@ extern int rl_clear_message PARAMS((void)); extern int rl_reset_line_state PARAMS((void)); extern int rl_crlf PARAMS((void)); -#if (defined (__STDC__) || defined (__cplusplus)) && defined (USE_VARARGS) && defined (PREFER_STDARG) +#if defined (USE_VARARGS) && defined (PREFER_STDARG) extern int rl_message (const char *, ...) __attribute__((__format__ (printf, 1, 2))); #else extern int rl_message (); @@ -384,6 +392,7 @@ extern char *rl_copy_text PARAMS((int, int)); extern void rl_prep_terminal PARAMS((int)); extern void rl_deprep_terminal PARAMS((void)); extern void rl_tty_set_default_bindings PARAMS((Keymap)); +extern void rl_tty_unset_default_bindings PARAMS((Keymap)); extern int rl_reset_terminal PARAMS((const char *)); extern void rl_resize_terminal PARAMS((void)); @@ -603,7 +612,7 @@ extern const char *rl_basic_word_break_characters; /* The list of characters that signal a break between words for rl_complete_internal. The default list is the contents of rl_basic_word_break_characters. */ -extern const char *rl_completer_word_break_characters; +extern /*const*/ char *rl_completer_word_break_characters; /* List of characters which can be used to quote a substring of the line. Completion occurs on the entire substring, and within the substring @@ -749,6 +758,7 @@ extern int rl_inhibit_completion; #define RL_STATE_SIGHANDLER 0x08000 /* in readline sighandler */ #define RL_STATE_UNDOING 0x10000 /* doing an undo */ #define RL_STATE_INPUTPENDING 0x20000 /* rl_execute_next called */ +#define RL_STATE_TTYCSAVED 0x40000 /* tty special chars saved */ #define RL_STATE_DONE 0x80000 /* done; accepted line */ diff --git a/lib/readline/rldefs.h b/lib/readline/rldefs.h index 4a28bd1e..0d600407 100644 --- a/lib/readline/rldefs.h +++ b/lib/readline/rldefs.h @@ -77,7 +77,7 @@ extern int _rl_stricmp PARAMS((char *, char *)); extern int _rl_strnicmp PARAMS((char *, char *, int)); #endif -#if defined (HAVE_STRPBRK) +#if defined (HAVE_STRPBRK) && !defined (HAVE_MULTIBYTE) # define _rl_strpbrk(a,b) strpbrk((a),(b)) #else extern char *_rl_strpbrk PARAMS((const char *, const char *)); diff --git a/lib/readline/rlmbutil.h b/lib/readline/rlmbutil.h index 27ca32bf..77cc026e 100644 --- a/lib/readline/rlmbutil.h +++ b/lib/readline/rlmbutil.h @@ -35,11 +35,18 @@ #if defined (HAVE_WCTYPE_H) && defined (HAVE_WCHAR_H) # include <wchar.h> # include <wctype.h> -# if defined (HAVE_MBSRTOWCS) /* system is supposed to support XPG5 */ +# if defined (HAVE_MBSRTOWCS) && defined (HAVE_MBRTOWC) && defined (HAVE_MBRLEN) && defined (HAVE_WCWIDTH) + /* system is supposed to support XPG5 */ # define HANDLE_MULTIBYTE 1 # endif #endif +/* If we don't want multibyte chars even on a system that supports them, let + the configuring user turn multibyte support off. */ +#if defined (NO_MULTIBYTE_SUPPORT) +# undef HANDLE_MULTIBYTE +#endif + /* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */ #if HANDLE_MULTIBYTE && !defined (HAVE_MBSTATE_T) # define wcsrtombs(dest, src, len, ps) (wcsrtombs) (dest, src, len, 0) @@ -90,6 +97,9 @@ extern int _rl_read_mbstring PARAMS((int, char *, int)); extern int _rl_is_mbchar_matched PARAMS((char *, int, int, char *, int)); +#define MB_INVALIDCH(x) ((x) == (size_t)-1 || (x) == (size_t)-2) +#define MB_NULLWCH(x) ((x) == 0) + #else /* !HANDLE_MULTIBYTE */ #undef MB_LEN_MAX @@ -101,6 +111,9 @@ extern int _rl_is_mbchar_matched PARAMS((char *, int, int, char *, int)); #define _rl_find_prev_mbchar(b, i, f) (((i) == 0) ? (i) : ((i) - 1)) #define _rl_find_next_mbchar(b, i1, i2, f) ((i1) + (i2)) +#define MB_INVALIDCH(x) (0) +#define MB_NULLWCH(x) (0) + #endif /* !HANDLE_MULTIBYTE */ extern int rl_byte_oriented; diff --git a/lib/readline/rlprivate.h b/lib/readline/rlprivate.h index ccb91446..8bcb547e 100644 --- a/lib/readline/rlprivate.h +++ b/lib/readline/rlprivate.h @@ -103,7 +103,6 @@ extern int readline_internal_char PARAMS((void)); #endif /* READLINE_CALLBACKS */ /* bind.c */ -extern void _rl_bind_if_unbound PARAMS((const char *, rl_command_func_t *)); /* complete.c */ extern char _rl_find_completion_word PARAMS((int *, int *)); @@ -131,6 +130,7 @@ extern int _rl_input_available PARAMS((void)); extern int _rl_input_queued PARAMS((int)); extern void _rl_insert_typein PARAMS((int)); extern int _rl_unget_char PARAMS((int)); +extern int _rl_pushed_input_available PARAMS((void)); /* macro.c */ extern void _rl_with_macro_input PARAMS((char *)); @@ -219,6 +219,7 @@ extern const char *_rl_possible_meta_prefixes[]; /* complete.c */ extern int _rl_complete_show_all; +extern int _rl_complete_show_unmodified; extern int _rl_complete_mark_directories; extern int _rl_complete_mark_symlink_dirs; extern int _rl_print_completions_horizontally; diff --git a/lib/readline/rlstdc.h b/lib/readline/rlstdc.h index d6a22b37..847fa9c2 100644 --- a/lib/readline/rlstdc.h +++ b/lib/readline/rlstdc.h @@ -37,7 +37,7 @@ #endif #ifndef __attribute__ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) # define __attribute__(x) # endif #endif diff --git a/lib/readline/rltty.c b/lib/readline/rltty.c index 755efeba..1a31f359 100644 --- a/lib/readline/rltty.c +++ b/lib/readline/rltty.c @@ -186,6 +186,8 @@ static int set_tty_settings PARAMS((int, TIOTYPE *)); static void prepare_terminal_settings PARAMS((int, TIOTYPE, TIOTYPE *)); +static void set_special_char PARAMS((Keymap, TIOTYPE *, int, rl_command_func_t)); + static void save_tty_chars (tiop) TIOTYPE *tiop; @@ -400,6 +402,9 @@ static int set_tty_settings PARAMS((int, TIOTYPE *)); static void prepare_terminal_settings PARAMS((int, TIOTYPE, TIOTYPE *)); +static void set_special_char PARAMS((Keymap, TIOTYPE *, int, rl_command_func_t)); +static void _rl_bind_tty_special_chars PARAMS((Keymap, TIOTYPE)); + #if defined (FLUSHO) # define OUTPUT_BEING_FLUSHED(tp) (tp->c_lflag & FLUSHO) #else @@ -652,7 +657,10 @@ rl_prep_terminal (meta_flag) otio = tio; + rl_tty_unset_default_bindings (_rl_keymap); save_tty_chars (&otio); + RL_SETSTATE(RL_STATE_TTYCSAVED); + _rl_bind_tty_special_chars (_rl_keymap, tio); prepare_terminal_settings (meta_flag, otio, &tio); @@ -776,70 +784,97 @@ rl_stop_output (count, key) /* */ /* **************************************************************** */ -/* Set the system's default editing characters to their readline equivalents - in KMAP. Should be static, now that we have rl_tty_set_default_bindings. */ -void -rltty_set_default_bindings (kmap) - Keymap kmap; -{ - TIOTYPE ttybuff; - int tty = fileno (rl_instream); +#define SET_SPECIAL(sc, func) set_special_char(kmap, &ttybuff, sc, func) #if defined (NEW_TTY_DRIVER) +static void +set_special_char (kmap, tiop, sc, func) + Keymap kmap; + TIOTYPE *tiop; + int sc; + rl_command_func_t *func; +{ + if (sc != -1 && kmap[(unsigned char)sc].type == ISFUNC) + kmap[(unsigned char)sc].function = func; +} -#define SET_SPECIAL(sc, func) \ - do \ - { \ - int ic; \ - ic = sc; \ - if (ic != -1 && kmap[(unsigned char)ic].type == ISFUNC) \ - kmap[(unsigned char)ic].function = func; \ - } \ - while (0) +#define RESET_SPECIAL(c) \ + if (c != -1 && kmap[(unsigned char)c].type == ISFUNC) + kmap[(unsigned char)c].function = rl_insert; - if (get_tty_settings (tty, &ttybuff) == 0) +static void +_rl_bind_tty_special_chars (kmap, ttybuff) + Keymap kmap; + TIOTYPE ttybuff; +{ + if (ttybuff.flags & SGTTY_SET) { - if (ttybuff.flags & SGTTY_SET) - { - SET_SPECIAL (ttybuff.sgttyb.sg_erase, rl_rubout); - SET_SPECIAL (ttybuff.sgttyb.sg_kill, rl_unix_line_discard); - } + SET_SPECIAL (ttybuff.sgttyb.sg_erase, rl_rubout); + SET_SPECIAL (ttybuff.sgttyb.sg_kill, rl_unix_line_discard); + } # if defined (TIOCGLTC) - if (ttybuff.flags & LTCHARS_SET) - { - SET_SPECIAL (ttybuff.ltchars.t_werasc, rl_unix_word_rubout); - SET_SPECIAL (ttybuff.ltchars.t_lnextc, rl_quoted_insert); - } -# endif /* TIOCGLTC */ + if (ttybuff.flags & LTCHARS_SET) + { + SET_SPECIAL (ttybuff.ltchars.t_werasc, rl_unix_word_rubout); + SET_SPECIAL (ttybuff.ltchars.t_lnextc, rl_quoted_insert); } +# endif /* TIOCGLTC */ +} #else /* !NEW_TTY_DRIVER */ +static void +set_special_char (kmap, tiop, sc, func) + Keymap kmap; + TIOTYPE *tiop; + int sc; + rl_command_func_t *func; +{ + unsigned char uc; -#define SET_SPECIAL(sc, func) \ - do \ - { \ - unsigned char uc; \ - uc = ttybuff.c_cc[sc]; \ - if (uc != (unsigned char)_POSIX_VDISABLE && kmap[uc].type == ISFUNC) \ - kmap[uc].function = func; \ - } \ - while (0) + uc = tiop->c_cc[sc]; + if (uc != (unsigned char)_POSIX_VDISABLE && kmap[uc].type == ISFUNC) + kmap[uc].function = func; +} - if (get_tty_settings (tty, &ttybuff) == 0) - { - SET_SPECIAL (VERASE, rl_rubout); - SET_SPECIAL (VKILL, rl_unix_line_discard); +/* used later */ +#define RESET_SPECIAL(uc) \ + if (uc != (unsigned char)_POSIX_VDISABLE && kmap[uc].type == ISFUNC) \ + kmap[uc].function = rl_insert; + +static void +_rl_bind_tty_special_chars (kmap, ttybuff) + Keymap kmap; + TIOTYPE ttybuff; +{ + SET_SPECIAL (VERASE, rl_rubout); + SET_SPECIAL (VKILL, rl_unix_line_discard); # if defined (VLNEXT) && defined (TERMIOS_TTY_DRIVER) - SET_SPECIAL (VLNEXT, rl_quoted_insert); + SET_SPECIAL (VLNEXT, rl_quoted_insert); # endif /* VLNEXT && TERMIOS_TTY_DRIVER */ # if defined (VWERASE) && defined (TERMIOS_TTY_DRIVER) - SET_SPECIAL (VWERASE, rl_unix_word_rubout); + SET_SPECIAL (VWERASE, rl_unix_word_rubout); # endif /* VWERASE && TERMIOS_TTY_DRIVER */ - } +} + #endif /* !NEW_TTY_DRIVER */ + +/* Set the system's default editing characters to their readline equivalents + in KMAP. Should be static, now that we have rl_tty_set_default_bindings. */ +void +rltty_set_default_bindings (kmap) + Keymap kmap; +{ + TIOTYPE ttybuff; + int tty; + static int called = 0; + + tty = fileno (rl_instream); + + if (get_tty_settings (tty, &ttybuff) == 0) + _rl_bind_tty_special_chars (kmap, ttybuff); } /* New public way to set the system default editing chars to their readline @@ -851,6 +886,30 @@ rl_tty_set_default_bindings (kmap) rltty_set_default_bindings (kmap); } +/* Rebind all of the tty special chars that readline worries about back + to self-insert. Call this before saving the current terminal special + chars with save_tty_chars(). This only works on POSIX termios or termio + systems. */ +void +rl_tty_unset_default_bindings (kmap) + Keymap kmap; +{ + /* Don't bother before we've saved the tty special chars at least once. */ + if (RL_ISSTATE(RL_STATE_TTYCSAVED) == 0) + return; + + RESET_SPECIAL (_rl_tty_chars.t_erase); + RESET_SPECIAL (_rl_tty_chars.t_kill); + +# if defined (VLNEXT) && defined (TERMIOS_TTY_DRIVER) + RESET_SPECIAL (_rl_tty_chars.t_lnext); +# endif /* VLNEXT && TERMIOS_TTY_DRIVER */ + +# if defined (VWERASE) && defined (TERMIOS_TTY_DRIVER) + RESET_SPECIAL (_rl_tty_chars.t_werase); +# endif /* VWERASE && TERMIOS_TTY_DRIVER */ +} + #if defined (HANDLE_SIGNALS) #if defined (NEW_TTY_DRIVER) diff --git a/lib/readline/rltty.h b/lib/readline/rltty.h index 029a3fbc..142e96b6 100644 --- a/lib/readline/rltty.h +++ b/lib/readline/rltty.h @@ -61,22 +61,22 @@ #endif /* !NEW_TTY_DRIVER && !_POSIX_VDISABLE */ typedef struct _rl_tty_chars { - char t_eof; - char t_eol; - char t_eol2; - char t_erase; - char t_werase; - char t_kill; - char t_reprint; - char t_intr; - char t_quit; - char t_susp; - char t_dsusp; - char t_start; - char t_stop; - char t_lnext; - char t_flush; - char t_status; + unsigned char t_eof; + unsigned char t_eol; + unsigned char t_eol2; + unsigned char t_erase; + unsigned char t_werase; + unsigned char t_kill; + unsigned char t_reprint; + unsigned char t_intr; + unsigned char t_quit; + unsigned char t_susp; + unsigned char t_dsusp; + unsigned char t_start; + unsigned char t_stop; + unsigned char t_lnext; + unsigned char t_flush; + unsigned char t_status; } _RL_TTY_CHARS; #endif /* _RLTTY_H_ */ diff --git a/lib/readline/search.c b/lib/readline/search.c index 7e0d60b5..ce7d54eb 100644 --- a/lib/readline/search.c +++ b/lib/readline/search.c @@ -82,8 +82,13 @@ static void make_history_line_current (entry) HIST_ENTRY *entry; { - rl_replace_line (entry->line, 0); +#if 0 + rl_replace_line (entry->line, 1); rl_undo_list = (UNDO_LIST *)entry->data; +#else + _rl_replace_text (entry->line, 0, rl_end); + _rl_fix_point (1); +#endif if (_rl_saved_line_for_history) _rl_free_history_entry (_rl_saved_line_for_history); @@ -189,6 +194,11 @@ noninc_search (dir, pchar) saved_point = rl_point; saved_mark = rl_mark; + /* Clear the undo list, since reading the search string should create its + own undo list, and the whole list will end up being freed when we + finish reading the search string. */ + rl_undo_list = 0; + /* Use the line buffer to read the search string. */ rl_line_buffer[0] = 0; rl_end = rl_point = 0; diff --git a/lib/readline/signals.c b/lib/readline/signals.c index 0a1468b6..8e9c0ae6 100644 --- a/lib/readline/signals.c +++ b/lib/readline/signals.c @@ -73,6 +73,10 @@ typedef struct { SigHandler *sa_handler; int sa_mask, sa_flags; } sighandler_cxt # define sigemptyset(m) #endif /* !HAVE_POSIX_SIGNALS */ +#ifndef SA_RESTART +# define SA_RESTART 0 +#endif + static SigHandler *rl_set_sighandler PARAMS((int, SigHandler *, sighandler_cxt *)); static void rl_maybe_set_sighandler PARAMS((int, SigHandler *, sighandler_cxt *)); @@ -85,6 +89,8 @@ int rl_catch_signals = 1; /* If non-zero, readline will install a signal handler for SIGWINCH. */ #ifdef SIGWINCH int rl_catch_sigwinch = 1; +#else +int rl_catch_sigwinch = 0; /* for the readline state struct in readline.c */ #endif static int signals_set_flag; @@ -233,7 +239,7 @@ rl_set_sighandler (sig, handler, ohandler) struct sigaction act; act.sa_handler = handler; - act.sa_flags = 0; /* XXX - should we set SA_RESTART for SIGWINCH? */ + act.sa_flags = (sig == SIGWINCH) ? SA_RESTART : 0; sigemptyset (&act.sa_mask); sigemptyset (&ohandler->sa_mask); sigaction (sig, &act, &old_handler); diff --git a/lib/readline/terminal.c b/lib/readline/terminal.c index f3f5b6c4..b95aea89 100644 --- a/lib/readline/terminal.c +++ b/lib/readline/terminal.c @@ -347,11 +347,7 @@ get_term_capabilities (bp) register int i; for (i = 0; i < NUM_TC_STRINGS; i++) -# ifdef __LCC__ *(tc_strings[i].tc_value) = tgetstr ((char *)tc_strings[i].tc_var, bp); -# else - *(tc_strings[i].tc_value) = tgetstr (tc_strings[i].tc_var, bp); -# endif #endif tcap_initialized = 1; } @@ -489,13 +485,13 @@ bind_termcap_arrow_keys (map) xkeymap = _rl_keymap; _rl_keymap = map; - _rl_bind_if_unbound (_rl_term_ku, rl_get_previous_history); - _rl_bind_if_unbound (_rl_term_kd, rl_get_next_history); - _rl_bind_if_unbound (_rl_term_kr, rl_forward); - _rl_bind_if_unbound (_rl_term_kl, rl_backward); + rl_bind_keyseq_if_unbound (_rl_term_ku, rl_get_previous_history); + rl_bind_keyseq_if_unbound (_rl_term_kd, rl_get_next_history); + rl_bind_keyseq_if_unbound (_rl_term_kr, rl_forward_char); + rl_bind_keyseq_if_unbound (_rl_term_kl, rl_backward_char); - _rl_bind_if_unbound (_rl_term_kh, rl_beg_of_line); /* Home */ - _rl_bind_if_unbound (_rl_term_at7, rl_end_of_line); /* End */ + rl_bind_keyseq_if_unbound (_rl_term_kh, rl_beg_of_line); /* Home */ + rl_bind_keyseq_if_unbound (_rl_term_at7, rl_end_of_line); /* End */ _rl_keymap = xkeymap; } diff --git a/lib/readline/text.c b/lib/readline/text.c index 2a7b724f..1afbbb9f 100644 --- a/lib/readline/text.c +++ b/lib/readline/text.c @@ -170,6 +170,9 @@ _rl_fix_point (fix_mark_too) } #undef _RL_FIX_POINT +/* Replace the contents of the line buffer between START and END with + TEXT. The operation is undoable. To replace the entire line in an + undoable mode, use _rl_replace_text(text, 0, rl_end); */ int _rl_replace_text (text, start, end) const char *text; @@ -801,13 +804,10 @@ _rl_overwrite_char (count, c) k = _rl_read_mbstring (c, mbkey, MB_LEN_MAX); #endif + rl_begin_undo_group (); + for (i = 0; i < count; i++) { - rl_begin_undo_group (); - - if (rl_point < rl_end) - rl_delete (1, c); - #if defined (HANDLE_MULTIBYTE) if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) rl_insert_text (mbkey); @@ -815,9 +815,12 @@ _rl_overwrite_char (count, c) #endif _rl_insert_char (1, c); - rl_end_undo_group (); + if (rl_point < rl_end) + rl_delete (1, c); } + rl_end_undo_group (); + return 0; } @@ -935,9 +938,12 @@ _rl_overwrite_rubout (count, key) rl_delete_text (opoint, rl_point); /* Emacs puts point at the beginning of the sequence of spaces. */ - opoint = rl_point; - _rl_insert_char (l, ' '); - rl_point = opoint; + if (rl_point < rl_end) + { + opoint = rl_point; + _rl_insert_char (l, ' '); + rl_point = opoint; + } rl_end_undo_group (); diff --git a/lib/readline/util.c b/lib/readline/util.c index c7bd360e..a632d811 100644 --- a/lib/readline/util.c +++ b/lib/readline/util.c @@ -250,7 +250,7 @@ _rl_strpbrk (string1, string2) { v = _rl_get_char_len (string1, &ps); if (v > 1) - string += v - 1; /* -1 to account for auto-increment in loop */ + string1 += v - 1; /* -1 to account for auto-increment in loop */ } #endif } diff --git a/lib/readline/vi_mode.c b/lib/readline/vi_mode.c index 5d146b3f..1050af6a 100644 --- a/lib/readline/vi_mode.c +++ b/lib/readline/vi_mode.c @@ -640,7 +640,7 @@ _rl_vi_done_inserting () } else { - if (_rl_vi_last_key_before_insert == 'i' && rl_undo_list) + if ((_rl_vi_last_key_before_insert == 'i' || _rl_vi_last_key_before_insert == 'a') && rl_undo_list) _rl_vi_save_insert (rl_undo_list); /* XXX - Other keys probably need to be checked. */ else if (_rl_vi_last_key_before_insert == 'C') @@ -680,7 +680,8 @@ _rl_vi_change_mbchar_case (count) int count; { wchar_t wc; - char mb[MB_LEN_MAX]; + char mb[MB_LEN_MAX+1]; + int mblen; mbstate_t ps; memset (&ps, 0, sizeof (mbstate_t)); @@ -703,7 +704,9 @@ _rl_vi_change_mbchar_case (count) /* Vi is kind of strange here. */ if (wc) { - wctomb (mb, wc); + mblen = wcrtomb (mb, wc, &ps); + if (mblen >= 0) + mb[mblen] = '\0'; rl_begin_undo_group (); rl_delete (1, 0); rl_insert_text (mb); @@ -1315,7 +1318,7 @@ rl_vi_subst (count, key) { /* If we are redoing, rl_vi_change_to will stuff the last motion char */ if (vi_redoing == 0) - rl_stuff_char ((key == 'S') ? 'c' : ' '); /* `S' == `cc', `s' == `c ' */ + rl_stuff_char ((key == 'S') ? 'c' : 'l'); /* `S' == `cc', `s' == `cl' */ return (rl_vi_change_to (count, 'c')); } diff --git a/lib/sh/Makefile.in b/lib/sh/Makefile.in index 468899d2..abf1efbf 100644 --- a/lib/sh/Makefile.in +++ b/lib/sh/Makefile.in @@ -71,8 +71,8 @@ CSOURCES = clktck.c clock.c getcwd.c getenv.c oslib.c setlinebuf.c \ inet_aton.c netconn.c netopen.c strpbrk.c timeval.c makepath.c \ pathcanon.c pathphys.c tmpfile.c stringlist.c stringvec.c spell.c \ shquote.c strtrans.c strindex.c snprintf.c mailstat.c \ - fmtulong.c fmtullong.c fmtumax.c \ - strtoll.c strtoull.c strtoimax.c strtoumax.c memset.c \ + fmtulong.c fmtullong.c fmtumax.c shmatch.c \ + strtoll.c strtoull.c strtoimax.c strtoumax.c memset.c strstr.c \ mktime.c strftime.c xstrchr.c zcatfd.c # The header files for this library. @@ -81,7 +81,7 @@ HSOURCES = # The object files contained in $(LIBRARY_NAME) LIBOBJS = @LIBOBJS@ OBJECTS = clktck.o clock.o getenv.o oslib.o setlinebuf.o \ - itos.o zread.o zwrite.o shtty.o \ + itos.o zread.o zwrite.o shtty.o shmatch.o \ netconn.o netopen.o timeval.o makepath.o pathcanon.o \ pathphys.o tmpfile.o stringlist.o stringvec.o spell.o shquote.o \ strtrans.o strindex.o snprintf.o mailstat.o fmtulong.o \ @@ -113,6 +113,9 @@ mostlyclean: clean # Dependencies +${BUILD_DIR}/version.h: ${BUILD_DIR}/config.h ${BUILD_DIR}/Makefile Makefile + -( cd ${BUILD_DIR} && ${MAKE} ${MFLAGS} version.h ) + # rules for losing makes, like SunOS clktck.o: clktck.c clock.o: clock.c @@ -231,7 +234,8 @@ getenv.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${topd getenv.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h getenv.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h getenv.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h -getenv.o: ${topdir}/pathnames.h ${topdir}/externs.h +getenv.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h +getenv.o: ${BUILD_DIR}/version.h inet_aton.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h inet_aton.o: ${BASHINCDIR}/stdc.h @@ -243,7 +247,7 @@ itos.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${topdir itos.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h itos.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h itos.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h -itos.o: ${topdir}/pathnames.h ${topdir}/externs.h +itos.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h makepath.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h makepath.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h @@ -252,7 +256,7 @@ makepath.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${to makepath.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h makepath.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h makepath.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h -makepath.o: ${topdir}/pathnames.h ${topdir}/externs.h +makepath.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h netconn.o: ${BASHINCDIR}/posixstat.h ${BASHINCDIR}/filecntl.h netconn.o: ${topdir}/bashtypes.h @@ -264,7 +268,7 @@ netopen.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${top netopen.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h netopen.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h netopen.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h -netopen.o: ${topdir}/pathnames.h ${topdir}/externs.h +netopen.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h oslib.o: ${topdir}/bashtypes.h ${topdir}/bashansi.h ${BASHINCDIR}/maxpath.h oslib.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h @@ -273,7 +277,7 @@ oslib.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${topdi oslib.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h oslib.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h oslib.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h -oslib.o: ${topdir}/pathnames.h ${topdir}/externs.h +oslib.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h oslib.o: ${BASHINCDIR}/posixstat.h ${BASHINCDIR}/filecntl.h oslib.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h @@ -284,7 +288,7 @@ pathcanon.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${t pathcanon.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h pathcanon.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h pathcanon.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h -pathcanon.o: ${topdir}/pathnames.h ${topdir}/externs.h +pathcanon.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h pathcanon.o: ${BASHINCDIR}/posixstat.h ${BASHINCDIR}/filecntl.h pathcanon.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h @@ -295,7 +299,7 @@ pathphys.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${to pathphys.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h pathphys.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h pathphys.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h -pathphys.o: ${topdir}/pathnames.h ${topdir}/externs.h +pathphys.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h pathphys.o: ${BASHINCDIR}/posixstat.h ${BASHINCDIR}/filecntl.h pathphys.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h @@ -329,7 +333,7 @@ strerror.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${to strerror.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h strerror.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h strerror.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h -strerror.o: ${topdir}/pathnames.h ${topdir}/externs.h +strerror.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h strindex.o: ${BASHINCDIR}/stdc.h ${topdir}/bashansi.h strindex.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h @@ -341,7 +345,7 @@ stringlist.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${ stringlist.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h stringlist.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h stringlist.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h -stringlist.o: ${topdir}/pathnames.h ${topdir}/externs.h +stringlist.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h stringvec.o: ${topdir}/bashansi.h ${BASHINCDIR}/chartypes.h stringvec.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h @@ -350,7 +354,7 @@ stringvec.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${t stringvec.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h stringvec.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h stringvec.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h -stringvec.o: ${topdir}/pathnames.h ${topdir}/externs.h +stringvec.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h strpbrk.o: ${BASHINCDIR}/stdc.h @@ -385,7 +389,7 @@ strtrans.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${to strtrans.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h strtrans.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h strtrans.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h -strtrans.o: ${topdir}/pathnames.h ${topdir}/externs.h +strtrans.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h times.o: ${BASHINCDIR}/systimes.h times.o: ${BASHINCDIR}/posixtime.h diff --git a/lib/sh/fmtulong.c b/lib/sh/fmtulong.c index dc313be9..3d849c83 100644 --- a/lib/sh/fmtulong.c +++ b/lib/sh/fmtulong.c @@ -38,6 +38,9 @@ #ifdef HAVE_STDINT_H # include <stdint.h> #endif +#ifdef HAVE_INTTYPES_H +# include <inttypes.h> +#endif #include <chartypes.h> #include <errno.h> diff --git a/lib/sh/getenv.c b/lib/sh/getenv.c index 028afb15..5e0fc5f9 100644 --- a/lib/sh/getenv.c +++ b/lib/sh/getenv.c @@ -169,7 +169,7 @@ setenv (name, value, rewrite) } var = 0; - v = value; + v = (char *)value; /* some compilers need explicit cast */ /* XXX - should we worry about readonly here? */ if (rewrite == 0) var = find_variable (name); diff --git a/lib/sh/mailstat.c b/lib/sh/mailstat.c index 8005252a..03782e78 100644 --- a/lib/sh/mailstat.c +++ b/lib/sh/mailstat.c @@ -149,7 +149,7 @@ mailstat(path, st) closedir(dd); } - if (atime) +/* if (atime) */ /* Set atime even if cur/ is empty */ st_ret.st_atime = atime; if (mtime) st_ret.st_mtime = mtime; diff --git a/lib/sh/netconn.c b/lib/sh/netconn.c index f412cb02..d05aef55 100644 --- a/lib/sh/netconn.c +++ b/lib/sh/netconn.c @@ -22,7 +22,7 @@ #include <config.h> #include <bashtypes.h> -#ifndef _MINIX +#if ! defined(_MINIX) && defined (HAVE_SYS_FILE_H) # include <sys/file.h> #endif #include <posixstat.h> diff --git a/lib/sh/pathphys.c b/lib/sh/pathphys.c index df692043..a820c911 100644 --- a/lib/sh/pathphys.c +++ b/lib/sh/pathphys.c @@ -68,7 +68,7 @@ _path_readlink (path, buf, bufsiz) /* * Return PATH with all symlinks expanded in newly-allocated memory. - * This always gets a full pathname. + * This always gets an absolute pathname. */ char * @@ -80,11 +80,26 @@ sh_physpath (path, flags) char *result, *p, *q, *qsave, *qbase, *workpath; int double_slash_path, linklen, nlink; + /* First sanity check -- punt immediately if the name is too long. */ + linklen = strlen (path); + +#if 0 + if (linklen >= PATH_MAX) + return (savestring (path)); +#endif + nlink = 0; q = result = (char *)xmalloc (PATH_MAX + 1); - workpath = (char *)xmalloc (PATH_MAX + 1); - strcpy (workpath, path); + /* Even if we get something longer than PATH_MAX, we might be able to + shorten it, so we try. */ + if (linklen >= PATH_MAX) + workpath = savestring (path); + else + { + workpath = (char *)xmalloc (PATH_MAX + 1); + strcpy (workpath, path); + } /* This always gets an absolute pathname. */ @@ -133,7 +148,19 @@ sh_physpath (path, flags) if (q != qbase) *q++ = DIRSEP; while (*p && (ISDIRSEP(*p) == 0)) - *q++ = *p++; + { + if (q - result >= PATH_MAX) + { +#ifdef ENAMETOOLONG + errno = ENAMETOOLONG; +#else + errno = EINVAL; +#endif + goto error; + } + + *q++ = *p++; + } *q = '\0'; @@ -160,6 +187,17 @@ error: linkbuf[linklen] = '\0'; + /* If the new path length would overrun PATH_MAX, punt now. */ + if ((strlen (p) + linklen + 2) >= PATH_MAX) + { +#ifdef ENAMETOOLONG + errno = ENAMETOOLONG; +#else + errno = EINVAL; +#endif + goto error; + } + /* Form the new pathname by copying the link value to a temporary buffer and appending the rest of `workpath'. Reset p to point to the start of the rest of the path. If the link value is an diff --git a/lib/sh/shmatch.c b/lib/sh/shmatch.c new file mode 100644 index 00000000..55667db8 --- /dev/null +++ b/lib/sh/shmatch.c @@ -0,0 +1,119 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. + + This file is part of GNU Bash, the Bourne Again SHell. + + Bash is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2, or (at your option) any later + version. + + Bash is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License along + with Bash; see the file COPYING. If not, write to the Free Software + Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ + +/* + * shmatch.c -- shell interface to posix regular expression matching. + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if defined (HAVE_POSIX_REGEXP) + +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif + +#include "bashansi.h" + +#include <stdio.h> +#include <regex.h> + +#include "shell.h" +#include "variables.h" +#include "externs.h" + +extern int glob_ignore_case; + +int +sh_regmatch (string, pattern, flags) + const char *string; + const char *pattern; + int flags; +{ + regex_t regex = { 0 }; + regmatch_t *matches; + int rflags; +#if defined (ARRAY_VARS) + SHELL_VAR *rematch; + ARRAY *amatch; + int subexp_ind; + char *subexp_str; + int subexp_len; +#endif + int result; + + + rematch = (SHELL_VAR *)NULL; + + rflags = REG_EXTENDED; + if (glob_ignore_case) + rflags |= REG_ICASE; +#if !defined (ARRAY_VARS) + rflags |= REG_NOSUB; +#endif + + if (regcomp (®ex, pattern, rflags)) + return 2; /* flag for printing a warning here. */ + +#if defined (ARRAY_VARS) + matches = (regmatch_t *)malloc (sizeof (regmatch_t) * (regex.re_nsub + 1)); +#else + matches = NULL; +#endif + + if (regexec (®ex, string, regex.re_nsub + 1, matches, 0)) + result = EXECUTION_FAILURE; + else + result = EXECUTION_SUCCESS; /* match */ + +#if defined (ARRAY_VARS) + subexp_len = strlen (string) + 10; + subexp_str = malloc (subexp_len + 1); + + /* Store the parenthesized subexpressions in the array BASH_REMATCH. + Element 0 is the portion that matched the entire regexp. Element 1 + is the part that matched the first subexpression, and so on. */ + unbind_variable ("BASH_REMATCH"); + rematch = make_new_array_variable ("BASH_REMATCH"); + amatch = array_cell (rematch); + + if ((flags & SHMAT_SUBEXP) && result == EXECUTION_SUCCESS && subexp_str) + { + for (subexp_ind = 0; subexp_ind <= regex.re_nsub; subexp_ind++) + { + memset (subexp_str, 0, subexp_len); + strncpy (subexp_str, string + matches[subexp_ind].rm_so, + matches[subexp_ind].rm_eo - matches[subexp_ind].rm_so); + array_insert (amatch, subexp_ind, subexp_str); + } + } + + VSETATTR (rematch, att_readonly); + + free (subexp_str); + free (matches); +#endif /* ARRAY_VARS */ + + regfree (®ex); + + return result; +} + +#endif /* HAVE_POSIX_REGEXP */ diff --git a/lib/sh/shquote.c b/lib/sh/shquote.c index 713f4819..aac2d349 100644 --- a/lib/sh/shquote.c +++ b/lib/sh/shquote.c @@ -83,6 +83,8 @@ sh_double_quote (string) { if (sh_syntaxtab[c] & CBSDQUOTE) *r++ = '\\'; + else if (c == CTLESC || c == CTLNUL) + *r++ = CTLESC; /* could be '\\'? */ *r++ = c; } @@ -94,7 +96,8 @@ sh_double_quote (string) } /* Remove backslashes that are quoting characters that are special between - double quotes. Return a new string. */ + double quotes. Return a new string. XXX - should this handle CTLESC + and CTLNUL? */ char * sh_un_double_quote (string) char *string; @@ -158,6 +161,11 @@ sh_backslash_quote (string) *r++ = c; break; #endif + case CTLESC: case CTLNUL: /* internal quoting characters */ + *r++ = CTLESC; /* could be '\\'? */ + *r++ = c; + break; + case '#': /* comment char */ if (s == string) *r++ = '\\'; @@ -188,6 +196,9 @@ sh_backslash_quote_for_double_quotes (string) { if (sh_syntaxtab[c] & CBSDQUOTE) *r++ = '\\'; + /* I should probably add flags for these to sh_syntaxtab[] */ + else if (c == CTLESC || c == CTLNUL) + *r++ = CTLESC; /* could be '\\'? */ *r++ = c; } diff --git a/lib/sh/snprintf.c b/lib/sh/snprintf.c index 7669576c..b79b41fb 100644 --- a/lib/sh/snprintf.c +++ b/lib/sh/snprintf.c @@ -45,10 +45,11 @@ /* * Currently doesn't handle (and bash/readline doesn't use): - * *M$ width, precision specifications - * %N$ numbered argument conversions - * inf, nan floating values imperfect (if isinf(), isnan() not in libc) - * support for `F' is imperfect, since underlying printf may not handle it + * * *M$ width, precision specifications + * * %N$ numbered argument conversions + * * inf, nan floating values imperfect (if isinf(), isnan() not in libc) + * * support for `F' is imperfect with ldfallback(), since underlying + * printf may not handle it -- should ideally have another autoconf test */ #define FLOATING_POINT diff --git a/lib/sh/strstr.c b/lib/sh/strstr.c new file mode 100644 index 00000000..c41e9034 --- /dev/null +++ b/lib/sh/strstr.c @@ -0,0 +1,122 @@ +/* Copyright (C) 1994, 1999 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +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. */ + +/* + * My personal strstr() implementation that beats most other algorithms. + * Until someone tells me otherwise, I assume that this is the + * fastest implementation of strstr() in C. + * I deliberately chose not to comment it. You should have at least + * as much fun trying to understand it, as I had to write it :-). + * + * Stephen R. van den Berg, berg@pool.informatik.rwth-aachen.de */ + +#if HAVE_CONFIG_H +# include <config.h> +#endif + +#if defined _LIBC || defined HAVE_STRING_H +# include <string.h> +#endif +#include <sys/types.h> + +typedef unsigned chartype; + +#undef strstr + +char * +strstr (const char *phaystack, const char *pneedle) +{ + register const unsigned char *haystack, *needle; + register chartype b, c; + + haystack = (const unsigned char *) phaystack; + needle = (const unsigned char *) pneedle; + + b = *needle; + if (b != '\0') + { + haystack--; /* possible ANSI violation */ + do + { + c = *++haystack; + if (c == '\0') + goto ret0; + } + while (c != b); + + c = *++needle; + if (c == '\0') + goto foundneedle; + ++needle; + goto jin; + + for (;;) + { + register chartype a; + register const unsigned char *rhaystack, *rneedle; + + do + { + a = *++haystack; + if (a == '\0') + goto ret0; + if (a == b) + break; + a = *++haystack; + if (a == '\0') + goto ret0; +shloop:; } + while (a != b); + +jin: a = *++haystack; + if (a == '\0') + goto ret0; + + if (a != c) + goto shloop; + + rhaystack = haystack-- + 1; + rneedle = needle; + a = *rneedle; + + if (*rhaystack == a) + do + { + if (a == '\0') + goto foundneedle; + ++rhaystack; + a = *++needle; + if (*rhaystack != a) + break; + if (a == '\0') + goto foundneedle; + ++rhaystack; + a = *++needle; + } + while (*rhaystack == a); + + needle = rneedle; /* took the register-poor approach */ + + if (a == '\0') + break; + } + } +foundneedle: + return (char*) haystack; +ret0: + return 0; +} diff --git a/lib/sh/strtrans.c b/lib/sh/strtrans.c index 741927c6..5436f232 100644 --- a/lib/sh/strtrans.c +++ b/lib/sh/strtrans.c @@ -92,10 +92,27 @@ ansicstr (string, len, flags, sawc, rlen) c &= 0xFF; break; case 'x': /* Hex digit -- non-ANSI */ + if ((flags & 2) && *s == '{') + { + flags |= 16; /* internal flag value */ + s++; + } + /* Consume at least two hex characters */ for (temp = 2, c = 0; ISXDIGIT ((unsigned char)*s) && temp--; s++) c = (c * 16) + HEXVALUE (*s); + /* DGK says that after a `\x{' ksh93 consumes ISXDIGIT chars + until a non-xdigit or `}', so potentially more than two + chars are consumed. */ + if (flags & 16) + { + for ( ; ISXDIGIT ((unsigned char)*s); s++) + c = (c * 16) + HEXVALUE (*s); + flags &= ~16; + if (*s == '}') + s++; + } /* \x followed by non-hex digits is passed through unchanged */ - if (temp == 2) + else if (temp == 2) { *r++ = '\\'; c = 'x'; diff --git a/lib/termcap/termcap.c b/lib/termcap/termcap.c index eaf94713..780b15ce 100644 --- a/lib/termcap/termcap.c +++ b/lib/termcap/termcap.c @@ -21,8 +21,8 @@ Free Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ #include <config.h> /* Get the O_* definitions for open et al. */ -#ifndef _MINIX -#include <sys/file.h> +#if !defined (_MINIX) && defined (HAVE_SYS_FILE_H) +# include <sys/file.h> #endif #include <fcntl.h> @@ -47,6 +47,14 @@ static char *default_dir; categories */ static char *lc_all; +/* tracks the value of LC_ALL; used to provide defaults for locale + categories */ +static char *lang; + +static int reset_locale_vars __P((void)); + +static void locale_setblanks __P((void)); + /* Set the value of default_locale and make the current locale the system default locale. This should be called very early in main(). */ void @@ -59,18 +67,25 @@ set_default_locale () #endif /* HAVE_SETLOCALE */ } -/* Set default values for LC_CTYPE, LC_COLLATE, and LC_MESSAGES if they - are not specified in the environment, but LANG or LC_ALL is. This +/* Set default values for LC_CTYPE, LC_COLLATE, LC_MESSAGES and LC_NUMERIC + if they are not specified in the environment, but LC_ALL is. This should be called from main() after parsing the environment. */ void set_default_locale_vars () { char *val; + int r; #if defined (HAVE_SETLOCALE) + +# if defined (LC_CTYPE) val = get_string_value ("LC_CTYPE"); if (val == 0 && lc_all && *lc_all) - setlocale (LC_CTYPE, lc_all); + { + setlocale (LC_CTYPE, lc_all); + locale_setblanks (); + } +# endif # if defined (LC_COLLATE) val = get_string_value ("LC_COLLATE"); @@ -115,6 +130,8 @@ int set_locale_var (var, value) char *var, *value; { + int r; + if (var[0] == 'T' && var[10] == 0) /* TEXTDOMAIN */ { FREE (default_domain); @@ -137,15 +154,15 @@ set_locale_var (var, value) FREE (lc_all); if (value) lc_all = savestring (value); - else if (default_locale) - lc_all = savestring (default_locale); else { lc_all = (char *)xmalloc (1); lc_all[0] = '\0'; } #if defined (HAVE_SETLOCALE) - return (setlocale (LC_ALL, lc_all) != 0); + r = *lc_all ? (setlocale (LC_ALL, lc_all) != 0) : reset_locale_vars (); + locale_setblanks (); + return r; #else return (1); #endif @@ -154,28 +171,34 @@ set_locale_var (var, value) #if defined (HAVE_SETLOCALE) else if (var[3] == 'C' && var[4] == 'T') /* LC_CTYPE */ { +# if defined (LC_CTYPE) if (lc_all == 0 || *lc_all == '\0') - return (setlocale (LC_CTYPE, value ? value : "") != 0); + { + r = (setlocale (LC_CTYPE, get_locale_var ("LC_CTYPE")) != 0); + locale_setblanks (); + return r; + } +# endif } else if (var[3] == 'C' && var[4] == 'O') /* LC_COLLATE */ { # if defined (LC_COLLATE) if (lc_all == 0 || *lc_all == '\0') - return (setlocale (LC_COLLATE, value ? value : "") != 0); + return (setlocale (LC_COLLATE, get_locale_var ("LC_COLLATE")) != 0); # endif /* LC_COLLATE */ } else if (var[3] == 'M' && var[4] == 'E') /* LC_MESSAGES */ { # if defined (LC_MESSAGES) if (lc_all == 0 || *lc_all == '\0') - return (setlocale (LC_MESSAGES, value ? value : "") != 0); + return (setlocale (LC_MESSAGES, get_locale_var ("LC_MESSAGES")) != 0); # endif /* LC_MESSAGES */ } else if (var[3] == 'N' && var[4] == 'U') /* LC_NUMERIC */ { # if defined (LC_NUMERIC) if (lc_all == 0 || *lc_all == '\0') - return (setlocale (LC_NUMERIC, value ? value : "") != 0); + return (setlocale (LC_NUMERIC, get_locale_var ("LC_NUMERIC")) != 0); # endif /* LC_NUMERIC */ } #endif /* HAVE_SETLOCALE */ @@ -183,17 +206,28 @@ set_locale_var (var, value) return (0); } -/* Called when LANG is assigned a value. Sets LC_ALL category with - setlocale(3) if that has not already been set. Doesn't change any - shell variables. */ +/* Called when LANG is assigned a value. Tracks value in `lang'. Calls + reset_locale_vars() to reset any default values if LC_ALL is unset or + null. */ int set_lang (var, value) char *var, *value; { - return ((lc_all == 0 || *lc_all == 0) ? setlocale (LC_ALL, value?value:"") != NULL : 0); + FREE (lang); + if (value) + lang = savestring (value); + else + { + lang = (char *)xmalloc (1); + lang[0] = '\0'; + } + + return ((lc_all == 0 || *lc_all == 0) ? reset_locale_vars () : 0); } -/* Get the value of one of the locale variables (LC_MESSAGES, LC_CTYPE) */ +/* Get the value of one of the locale variables (LC_MESSAGES, LC_CTYPE). + The precedence is as POSIX.2 specifies: LC_ALL has precedence over + the specific locale variables, and LANG, if set, is used as the default. */ char * get_locale_var (var) char *var; @@ -202,14 +236,47 @@ get_locale_var (var) locale = lc_all; - if (locale == 0) + if (locale == 0 || *locale == 0) locale = get_string_value (var); - if (locale == 0) - locale = default_locale; + if (locale == 0 || *locale == 0) + locale = lang; + if (locale == 0 || *locale == 0) + locale = default_locale; /* system-dependent; not really portable */ return (locale); } +static int +reset_locale_vars () +{ +#if defined (HAVE_SETLOCALE) + char *locale; + + locale = lang; + if (locale == 0 || *locale == '\0') + locale = default_locale; + if (setlocale (LC_ALL, locale) == 0) + return 0; + +# if defined (LC_CTYPE) + setlocale (LC_CTYPE, get_locale_var ("LC_CTYPE")); +# endif +# if defined (LC_COLLATE) + setlocale (LC_COLLATE, get_locale_var ("LC_COLLATE")); +# endif +# if defined (LC_MESSAGES) + setlocale (LC_MESSAGES, get_locale_var ("LC_MESSAGES")); +# endif +# if defined (LC_NUMERIC) + setlocale (LC_NUMERIC, get_locale_var ("LC_NUMERIC")); +# endif + + locale_setblanks (); + +#endif + return 1; +} + /* Translate the contents of STRING, a $"..." quoted string, according to the current locale. In the `C' or `POSIX' locale, or if gettext() is not available, the passed string is returned unchanged. The @@ -378,3 +445,21 @@ localeexpand (string, start, end, lineno, lenp) return (temp); } } + +/* Set every character in the <blank> character class to be a shell break + character for the lexical analyzer when the locale changes. */ +static void +locale_setblanks () +{ + int x; + + for (x = 0; x < sh_syntabsiz; x++) + { + if (isblank (x)) + sh_syntaxtab[x] |= CSHBRK; + else if (member (x, shell_break_chars)) + sh_syntaxtab[x] |= CSHBRK; + else + sh_syntaxtab[x] &= ~CSHBRK; + } +} diff --git a/mailcheck.c b/mailcheck.c index 5cc2fc22..df15b1eb 100644 --- a/mailcheck.c +++ b/mailcheck.c @@ -289,6 +289,7 @@ parse_mailpath_spec (str) char * make_default_mailpath () { +#if defined (DEFAULT_MAIL_DIRECTORY) char *mp; get_current_user_info (); @@ -297,6 +298,9 @@ make_default_mailpath () mp[sizeof(DEFAULT_MAIL_DIRECTORY) - 1] = '/'; strcpy (mp + sizeof (DEFAULT_MAIL_DIRECTORY), current_user.user_name); return (mp); +#else + return ((char *)NULL); +#endif } /* Remember the dates of the files specified by MAILPATH, or if there is @@ -321,8 +325,11 @@ remember_mail_dates () if (mailpaths == 0) { mailpaths = make_default_mailpath (); - add_mail_file (mailpaths, (char *)NULL); - free (mailpaths); + if (mailpaths) + { + add_mail_file (mailpaths, (char *)NULL); + free (mailpaths); + } return; } @@ -390,7 +397,7 @@ check_mail () the access time to be equal to the modification time when the mail in the file is manipulated, check the size also. If the file has not grown, continue. */ - if ((atime >= mtime) || !file_is_bigger) + if ((atime >= mtime) && !file_is_bigger) continue; /* If the mod time is later than the access time and the file @@ -1,7 +1,7 @@ /* make_cmd.c -- Functions for making instances of the various parser constructs. */ -/* Copyright (C) 1989-2002 Free Software Foundation, Inc. +/* Copyright (C) 1989-2003 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -23,7 +23,7 @@ Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ #include <stdio.h> #include "bashtypes.h" -#ifndef _MINIX +#if !defined (_MINIX) && defined (HAVE_SYS_FILE_H) # include <sys/file.h> #endif #include "filecntl.h" @@ -61,7 +61,7 @@ sh_obj_cache_t wlcache = {0, 0, 0}; #define WDCACHESIZE 60 #define WLCACHESIZE 60 -static COMMAND *make_for_or_select __P((enum command_type, WORD_DESC *, WORD_LIST *, COMMAND *)); +static COMMAND *make_for_or_select __P((enum command_type, WORD_DESC *, WORD_LIST *, COMMAND *, int)); #if defined (ARITH_FOR_COMMAND) static WORD_LIST *make_arith_for_expr __P((char *)); #endif @@ -199,39 +199,43 @@ command_connect (com1, com2, connector) } static COMMAND * -make_for_or_select (type, name, map_list, action) +make_for_or_select (type, name, map_list, action, lineno) enum command_type type; WORD_DESC *name; WORD_LIST *map_list; COMMAND *action; + int lineno; { FOR_COM *temp; temp = (FOR_COM *)xmalloc (sizeof (FOR_COM)); temp->flags = 0; temp->name = name; + temp->line = lineno; temp->map_list = map_list; temp->action = action; return (make_command (type, (SIMPLE_COM *)temp)); } COMMAND * -make_for_command (name, map_list, action) +make_for_command (name, map_list, action, lineno) WORD_DESC *name; WORD_LIST *map_list; COMMAND *action; + int lineno; { - return (make_for_or_select (cm_for, name, map_list, action)); + return (make_for_or_select (cm_for, name, map_list, action, lineno)); } COMMAND * -make_select_command (name, map_list, action) +make_select_command (name, map_list, action, lineno) WORD_DESC *name; WORD_LIST *map_list; COMMAND *action; + int lineno; { #if defined (SELECT_COMMAND) - return (make_for_or_select (cm_select, name, map_list, action)); + return (make_for_or_select (cm_select, name, map_list, action, lineno)); #else last_command_exit_value = 2; return ((COMMAND *)NULL); @@ -244,14 +248,21 @@ make_arith_for_expr (s) char *s; { WORD_LIST *result; + WORD_DESC *wd; if (s == 0 || *s == '\0') return ((WORD_LIST *)NULL); - result = make_word_list (make_word (s), (WORD_LIST *)NULL); + wd = make_word (s); + wd->flags |= W_NOGLOB|W_NOSPLIT|W_QUOTED; /* no word splitting or globbing */ + result = make_word_list (wd, (WORD_LIST *)NULL); return result; } #endif +/* Note that this function calls dispose_words on EXPRS, since it doesn't + use the word list directly. We free it here rather than at the caller + because no other function in this file requires that the caller free + any arguments. */ COMMAND * make_arith_for_command (exprs, action, lineno) WORD_LIST *exprs; @@ -318,8 +329,10 @@ make_arith_for_command (exprs, action, lineno) temp->step = step ? step : make_arith_for_expr ("1"); temp->action = action; + dispose_words (exprs); return (make_command (cm_arith_for, (SIMPLE_COM *)temp)); #else + dispose_words (exprs); last_command_exit_value = 2; return ((COMMAND *)NULL); #endif /* ARITH_FOR_COMMAND */ @@ -337,7 +350,7 @@ make_group_command (command) } COMMAND * -make_case_command (word, clauses) +make_case_command (word, clauses, lineno) WORD_DESC *word; PATTERN_LIST *clauses; { @@ -345,6 +358,7 @@ make_case_command (word, clauses) temp = (CASE_COM *)xmalloc (sizeof (CASE_COM)); temp->flags = 0; + temp->line = lineno; temp->word = word; temp->clauses = REVERSE_LIST (clauses, PATTERN_LIST *); return (make_command (cm_case, (SIMPLE_COM *)temp)); @@ -725,6 +739,11 @@ make_function_def (name, command, lineno, lstart) int lineno, lstart; { FUNCTION_DEF *temp; +#if defined (ARRAY_VARS) + SHELL_VAR *bash_source_v; + ARRAY *bash_source_a; + char *t; +#endif temp = (FUNCTION_DEF *)xmalloc (sizeof (FUNCTION_DEF)); temp->command = command; @@ -732,6 +751,18 @@ make_function_def (name, command, lineno, lstart) temp->line = lineno; temp->flags = 0; command->line = lstart; + + /* Information used primarily for debugging. */ + temp->source_file = 0; +#if defined (ARRAY_VARS) + GET_ARRAY_FROM_VAR ("BASH_SOURCE", bash_source_v, bash_source_a); + t = 0; + if (bash_source_a && array_num_elements (bash_source_a) > 0) + t = array_reference (bash_source_a, 0); + temp->source_file = t ? savestring (t) : savestring (""); +#endif + bind_function_def (name->word, temp); + return (make_command (cm_function_def, (SIMPLE_COM *)temp)); } @@ -36,9 +36,9 @@ extern WORD_LIST *make_word_list __P((WORD_DESC *, WORD_LIST *)); extern COMMAND *make_command __P((enum command_type, SIMPLE_COM *)); extern COMMAND *command_connect __P((COMMAND *, COMMAND *, int)); -extern COMMAND *make_for_command __P((WORD_DESC *, WORD_LIST *, COMMAND *)); +extern COMMAND *make_for_command __P((WORD_DESC *, WORD_LIST *, COMMAND *, int)); extern COMMAND *make_group_command __P((COMMAND *)); -extern COMMAND *make_case_command __P((WORD_DESC *, PATTERN_LIST *)); +extern COMMAND *make_case_command __P((WORD_DESC *, PATTERN_LIST *, int)); extern PATTERN_LIST *make_pattern_list __P((WORD_LIST *, COMMAND *)); extern COMMAND *make_if_command __P((COMMAND *, COMMAND *, COMMAND *)); extern COMMAND *make_while_command __P((COMMAND *, COMMAND *)); @@ -52,7 +52,7 @@ extern COMMAND *clean_simple_command __P((COMMAND *)); extern COMMAND *make_arith_command __P((WORD_LIST *)); -extern COMMAND *make_select_command __P((WORD_DESC *, WORD_LIST *, COMMAND *)); +extern COMMAND *make_select_command __P((WORD_DESC *, WORD_LIST *, COMMAND *, int)); #if defined (COND_COMMAND) extern COND_COM *make_cond_node __P((int, WORD_DESC *, COND_COM *, COND_COM *)); @@ -2,7 +2,7 @@ * mksyntax.c - construct shell syntax table for fast char attribute lookup. */ -/* Copyright (C) 2000 Free Software Foundation, Inc. +/* Copyright (C) 2000-2002 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -78,6 +78,7 @@ char preamble[] = "\ \n"; char includes[] = "\ +#include \"config.h\"\n\ #include \"stdc.h\"\n\ #include \"syntax.h\"\n\n"; @@ -128,8 +129,13 @@ cdesc (i) switch (i) { +#ifdef __STDC__ case '\a': xbuf[1] = 'a'; break; case '\v': xbuf[1] = 'v'; break; +#else + case '\007': xbuf[1] = 'a'; break; + case 0x0B: xbuf[1] = 'v'; break; +#endif case '\b': xbuf[1] = 'b'; break; case '\f': xbuf[1] = 'f'; break; case '\n': xbuf[1] = 'n'; break; @@ -270,7 +276,8 @@ dump_lsyntax (fp) { int i; - fprintf (fp, "const int sh_syntaxtab[%d] = {\n", SYNSIZE); + fprintf (fp, "int sh_syntabsiz = %d;\n", SYNSIZE); + fprintf (fp, "int sh_syntaxtab[%d] = {\n", SYNSIZE); for (i = 0; i < SYNSIZE; i++) { @@ -86,7 +86,7 @@ extern void rl_set_screen_size __P((int, int)); extern int interactive, interactive_shell, login_shell; extern int subshell_environment; -extern int last_command_exit_value; +extern int last_command_exit_value, last_command_exit_signal; extern int interrupt_immediately; extern sh_builtin_func_t *this_shell_builtin; #if defined (HAVE_POSIX_SIGNALS) @@ -120,6 +120,7 @@ struct proc_status { #define PROC_RUNNING 0x01 #define PROC_NOTIFIED 0x02 #define PROC_ASYNC 0x04 +#define PROC_SIGNALED 0x10 /* Return values from find_status_by_pid */ #define PROC_BAD -1 @@ -136,15 +137,19 @@ static int find_proc_slot __P((void)); static int find_index_by_pid __P((pid_t)); static int find_status_by_pid __P((pid_t)); static int process_exit_status __P((WAIT)); +static int find_termsig_by_pid __P((pid_t)); +static int get_termsig __P((WAIT)); static void set_pid_status __P((pid_t, WAIT)); static void set_pid_flags __P((pid_t, int)); static void unset_pid_flags __P((pid_t, int)); +static int get_pid_flags __P((pid_t)); static void add_pid __P((pid_t, int)); static void mark_dead_jobs_as_notified __P((int)); static void get_new_window_size __P((int)); static sighandler sigwinch_sighandler __P((int)); static sighandler wait_sigint_handler __P((int)); +static char *j_strsignal __P((int)); #if defined (HAVE_WAITPID) static void reap_zombie_children __P((void)); @@ -225,6 +230,35 @@ process_exit_status (status) return (WEXITSTATUS (status)); } +/* Return the status of PID as looked up in the PID_LIST array. A + return value of PROC_BAD indicates that PID wasn't found. */ +static int +find_termsig_by_pid (pid) + pid_t pid; +{ + int i; + + i = find_index_by_pid (pid); + if (i == NO_PID) + return (0); + if (pid_list[i].flags & PROC_RUNNING) + return (0); + return (get_termsig (pid_list[i].status)); +} + +/* Set LAST_COMMAND_EXIT_SIGNAL depending on STATUS. If STATUS is -1, look + up PID in the pid array and set LAST_COMMAND_EXIT_SIGNAL appropriately + depending on its flags and exit status. */ +static int +get_termsig (status) + WAIT status; +{ + if (WIFSTOPPED (status) == 0 && WIFSIGNALED (status)) + return (WTERMSIG (status)); + else + return (0); +} + /* Give PID the status value STATUS in the PID_LIST array. */ static void set_pid_status (pid, status) @@ -239,6 +273,8 @@ set_pid_status (pid, status) pid_list[slot].status = process_exit_status (status); pid_list[slot].flags &= ~PROC_RUNNING; + if (WIFSIGNALED (status)) + pid_list[slot].flags |= PROC_SIGNALED; /* If it's not a background process, mark it as notified so it gets cleaned up. */ if ((pid_list[slot].flags & PROC_ASYNC) == 0) @@ -275,6 +311,20 @@ unset_pid_flags (pid, flags) pid_list[slot].flags &= ~flags; } +/* Return the flags corresponding to PID in the PID_LIST array. */ +static int +get_pid_flags (pid) + pid_t pid; +{ + int slot; + + slot = find_index_by_pid (pid); + if (slot == NO_PID) + return 0; + + return (pid_list[slot].flags); +} + static void add_pid (pid, async) pid_t pid; @@ -565,7 +615,7 @@ wait_for_single_pid (pid) { pid_t got_pid; WAIT status; - int pstatus; + int pstatus, flags; pstatus = find_status_by_pid (pid); @@ -576,7 +626,11 @@ wait_for_single_pid (pid) } if (pstatus != PROC_STILL_ALIVE) - return (pstatus); + { + if (pstatus > 128) + last_command_exit_signal = find_termsig_by_pid (pid); + return (pstatus); + } siginterrupt (SIGINT, 1); while ((got_pid = WAITPID (pid, &status, 0)) != pid) @@ -688,6 +742,22 @@ wait_sigint_handler (sig) SIGRETURN (0); } +static char * +j_strsignal (s) + int s; +{ + static char retcode_name_buffer[64] = { '\0' }; + char *x; + + x = strsignal (s); + if (x == 0) + { + x = retcode_name_buffer; + sprintf (x, "Signal %d", s); + } + return x; +} + /* Wait for pid (one of our children) to terminate. This is called only by the execution code in execute_cmd.c. */ int @@ -704,7 +774,11 @@ wait_for (pid) return (0); if (pstatus != PROC_STILL_ALIVE) - return (pstatus); + { + if (pstatus > 128) + last_command_exit_signal = find_termsig_by_pid (pid); + return (pstatus); + } /* If we are running a script, ignore SIGINT while we're waiting for a child to exit. The loop below does some of this, but not all. */ @@ -762,6 +836,7 @@ wait_for (pid) /* Default return value. */ /* ``a full 8 bits of status is returned'' */ return_val = process_exit_status (status); + last_command_exit_signal = get_termsig (status); #if !defined (DONT_REPORT_SIGPIPE) if ((WIFSTOPPED (status) == 0) && WIFSIGNALED (status) && @@ -771,7 +846,7 @@ wait_for (pid) (WTERMSIG (status) != SIGINT) && (WTERMSIG (status) != SIGPIPE)) #endif { - fprintf (stderr, "%s", strsignal (WTERMSIG (status))); + fprintf (stderr, "%s", j_strsignal (WTERMSIG (status))); if (WIFCORED (status)) fprintf (stderr, " (core dumped)"); fprintf (stderr, "\n"); @@ -69,6 +69,8 @@ #if defined (ALIAS) # include "alias.h" +#else +typedef void *alias_t; #endif /* ALIAS */ #if defined (PROMPT_STRING_DECODE) @@ -171,7 +173,7 @@ static char *parse_compound_assignment __P((int *)); #endif #if defined (DPAREN_ARITHMETIC) || defined (ARITH_FOR_COMMAND) static int parse_dparen __P((int)); -static int parse_arith_cmd __P((char **)); +static int parse_arith_cmd __P((char **, int)); #endif #if defined (COND_COMMAND) static void cond_error __P((void)); @@ -239,6 +241,11 @@ int expand_aliases = 0; decode_prompt_string. */ int promptvars = 1; +/* If non-zero, $'...' and $"..." are expanded when they appear within + a ${...} expansion, even when the expansion appears within double + quotes. */ +int extended_quote = 1; + /* The decoded prompt string. Used if READLINE is not defined or if editing is turned off. Analogous to current_readline_prompt. */ static char *current_decoded_prompt; @@ -270,6 +277,13 @@ static int function_bstart; /* The line number in a script at which an arithmetic for command starts. */ static int arith_for_lineno; +/* The line number in a script where the word in a `case WORD', `select WORD' + or `for WORD' begins. This is a nested command maximum, since the array + index is decremented after a case, select, or for command is parsed. */ +#define MAX_CASE_NEST 128 +static int word_lineno[MAX_CASE_NEST]; +static int word_top = -1; + static REDIRECTEE redir; %} @@ -601,65 +615,116 @@ shell_command: for_command ; for_command: FOR WORD newline_list DO compound_list DONE - { $$ = make_for_command ($2, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), $5); } + { + $$ = make_for_command ($2, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), $5, word_lineno[word_top]); + if (word_top > 0) word_top--; + } | FOR WORD newline_list '{' compound_list '}' - { $$ = make_for_command ($2, add_string_to_list ("$@", (WORD_LIST *)NULL), $5); } + { + $$ = make_for_command ($2, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), $5, word_lineno[word_top]); + if (word_top > 0) word_top--; + } | FOR WORD ';' newline_list DO compound_list DONE - { $$ = make_for_command ($2, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), $6); } + { + $$ = make_for_command ($2, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), $6, word_lineno[word_top]); + if (word_top > 0) word_top--; + } | FOR WORD ';' newline_list '{' compound_list '}' - { $$ = make_for_command ($2, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), $6); } + { + $$ = make_for_command ($2, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), $6, word_lineno[word_top]); + if (word_top > 0) word_top--; + } | FOR WORD newline_list IN word_list list_terminator newline_list DO compound_list DONE - { $$ = make_for_command ($2, REVERSE_LIST ($5, WORD_LIST *), $9); } + { + $$ = make_for_command ($2, REVERSE_LIST ($5, WORD_LIST *), $9, word_lineno[word_top]); + if (word_top > 0) word_top--; + } | FOR WORD newline_list IN word_list list_terminator newline_list '{' compound_list '}' - { $$ = make_for_command ($2, REVERSE_LIST ($5, WORD_LIST *), $9); } + { + $$ = make_for_command ($2, REVERSE_LIST ($5, WORD_LIST *), $9, word_lineno[word_top]); + if (word_top > 0) word_top--; + } | FOR WORD newline_list IN list_terminator newline_list DO compound_list DONE - { $$ = make_for_command ($2, (WORD_LIST *)NULL, $8); } + { + $$ = make_for_command ($2, (WORD_LIST *)NULL, $8, word_lineno[word_top]); + if (word_top > 0) word_top--; + } | FOR WORD newline_list IN list_terminator newline_list '{' compound_list '}' - { $$ = make_for_command ($2, (WORD_LIST *)NULL, $8); } + { + $$ = make_for_command ($2, (WORD_LIST *)NULL, $8, word_lineno[word_top]); + if (word_top > 0) word_top--; + } ; arith_for_command: FOR ARITH_FOR_EXPRS list_terminator newline_list DO compound_list DONE - { $$ = make_arith_for_command ($2, $6, arith_for_lineno); } + { + $$ = make_arith_for_command ($2, $6, arith_for_lineno); + if (word_top > 0) word_top--; + } | FOR ARITH_FOR_EXPRS list_terminator newline_list '{' compound_list '}' - { $$ = make_arith_for_command ($2, $6, arith_for_lineno); } + { + $$ = make_arith_for_command ($2, $6, arith_for_lineno); + if (word_top > 0) word_top--; + } | FOR ARITH_FOR_EXPRS DO compound_list DONE - { $$ = make_arith_for_command ($2, $4, arith_for_lineno); } + { + $$ = make_arith_for_command ($2, $4, arith_for_lineno); + if (word_top > 0) word_top--; + } | FOR ARITH_FOR_EXPRS '{' compound_list '}' - { $$ = make_arith_for_command ($2, $4, arith_for_lineno); } + { + $$ = make_arith_for_command ($2, $4, arith_for_lineno); + if (word_top > 0) word_top--; + } ; select_command: SELECT WORD newline_list DO list DONE { - $$ = make_select_command ($2, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), $5); + $$ = make_select_command ($2, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), $5, word_lineno[word_top]); + if (word_top > 0) word_top--; } | SELECT WORD newline_list '{' list '}' { - $$ = make_select_command ($2, add_string_to_list ("$@", (WORD_LIST *)NULL), $5); + $$ = make_select_command ($2, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), $5, word_lineno[word_top]); + if (word_top > 0) word_top--; } | SELECT WORD ';' newline_list DO list DONE { - $$ = make_select_command ($2, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), $6); + $$ = make_select_command ($2, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), $6, word_lineno[word_top]); + if (word_top > 0) word_top--; } | SELECT WORD ';' newline_list '{' list '}' { - $$ = make_select_command ($2, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), $6); + $$ = make_select_command ($2, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), $6, word_lineno[word_top]); + if (word_top > 0) word_top--; } | SELECT WORD newline_list IN word_list list_terminator newline_list DO list DONE { - $$ = make_select_command ($2, REVERSE_LIST ($5, WORD_LIST *), $9); + $$ = make_select_command ($2, REVERSE_LIST ($5, WORD_LIST *), $9, word_lineno[word_top]); + if (word_top > 0) word_top--; } | SELECT WORD newline_list IN word_list list_terminator newline_list '{' list '}' { - $$ = make_select_command ($2, REVERSE_LIST ($5, WORD_LIST *), $9); + $$ = make_select_command ($2, REVERSE_LIST ($5, WORD_LIST *), $9, word_lineno[word_top]); + if (word_top > 0) word_top--; } ; case_command: CASE WORD newline_list IN newline_list ESAC - { $$ = make_case_command ($2, (PATTERN_LIST *)NULL); } + { + $$ = make_case_command ($2, (PATTERN_LIST *)NULL, word_lineno[word_top]); + if (word_top > 0) word_top--; + } | CASE WORD newline_list IN case_clause_sequence newline_list ESAC - { $$ = make_case_command ($2, $5); } + { + $$ = make_case_command ($2, $5, word_lineno[word_top]); + if (word_top > 0) word_top--; + } | CASE WORD newline_list IN case_clause ESAC - { $$ = make_case_command ($2, $5); } + { + $$ = make_case_command ($2, $5, word_lineno[word_top]); + if (word_top > 0) word_top--; + } ; function_def: WORD '(' ')' newline_list function_body @@ -918,23 +983,35 @@ timespec: TIME %% /* Possible states for the parser that require it to do special things. */ -#define PST_CASEPAT 0x001 /* in a case pattern list */ -#define PST_ALEXPNEXT 0x002 /* expand next word for aliases */ -#define PST_ALLOWOPNBRC 0x004 /* allow open brace for function def */ -#define PST_NEEDCLOSBRC 0x008 /* need close brace */ -#define PST_DBLPAREN 0x010 /* double-paren parsing */ -#define PST_SUBSHELL 0x020 /* ( ... ) subshell */ -#define PST_CMDSUBST 0x040 /* $( ... ) command substitution */ -#define PST_CASESTMT 0x080 /* parsing a case statement */ -#define PST_CONDCMD 0x100 /* parsing a [[...]] command */ -#define PST_CONDEXPR 0x200 /* parsing the guts of [[...]] */ -#define PST_ARITHFOR 0x400 /* parsing an arithmetic for command */ +#define PST_CASEPAT 0x0001 /* in a case pattern list */ +#define PST_ALEXPNEXT 0x0002 /* expand next word for aliases */ +#define PST_ALLOWOPNBRC 0x0004 /* allow open brace for function def */ +#define PST_NEEDCLOSBRC 0x0008 /* need close brace */ +#define PST_DBLPAREN 0x0010 /* double-paren parsing */ +#define PST_SUBSHELL 0x0020 /* ( ... ) subshell */ +#define PST_CMDSUBST 0x0040 /* $( ... ) command substitution */ +#define PST_CASESTMT 0x0080 /* parsing a case statement */ +#define PST_CONDCMD 0x0100 /* parsing a [[...]] command */ +#define PST_CONDEXPR 0x0200 /* parsing the guts of [[...]] */ +#define PST_ARITHFOR 0x0400 /* parsing an arithmetic for command */ +#define PST_ALEXPAND 0x0800 /* OK to expand aliases - unused */ +#define PST_CMDTOKEN 0x1000 /* command token OK - unused */ /* Initial size to allocate for tokens, and the amount to grow them by. */ #define TOKEN_DEFAULT_INITIAL_SIZE 496 #define TOKEN_DEFAULT_GROW_SIZE 512 +/* Should we call prompt_again? */ +#define SHOULD_PROMPT() \ + (interactive && (bash_input.type == st_stdin || bash_input.type == st_stream)) + +#if defined (ALIAS) +# define expanding_alias() (pushed_string_list && pushed_string_list->expander) +#else +# define expanding_alias() 0 +#endif + /* The token currently being read. */ static int current_token; @@ -1399,10 +1476,6 @@ restore_token_state (ts) #if defined (ALIAS) || defined (DPAREN_ARITHMETIC) -#if !defined (ALIAS) -typedef void *alias_t; -#endif - #define END_OF_ALIAS 0 /* @@ -1462,7 +1535,9 @@ push_string (s, expand, ap) shell_input_line_size = strlen (s); shell_input_line_index = 0; shell_input_line_terminator = '\0'; - parser_state &= ~PST_ALEXPNEXT; +#if 0 + parser_state &= ~PST_ALEXPNEXT; /* XXX */ +#endif set_line_mbstate (); } @@ -1523,6 +1598,14 @@ free_string_list () #endif /* ALIAS || DPAREN_ARITHMETIC */ +void +free_pushed_string_input () +{ +#if defined (ALIAS) || defined (DPAREN_ARITHMETIC) + free_string_list (); +#endif +} + /* Return a line of text, taken from wherever yylex () reads input. If there is no more input, then we return NULL. If REMOVE_QUOTED_NEWLINE is non-zero, we remove unquoted \<newline> pairs. This is used by @@ -1536,9 +1619,9 @@ read_a_line (remove_quoted_newline) int indx = 0, c, peekc, pass_next; #if defined (READLINE) - if (interactive && bash_input.type != st_string && no_line_editing) + if (no_line_editing && SHOULD_PROMPT ()) #else - if (interactive && bash_input.type != st_string) + if (SHOULD_PROMPT ()) #endif print_prompt (); @@ -1587,7 +1670,10 @@ read_a_line (remove_quoted_newline) { peekc = yy_getc (); if (peekc == '\n') - continue; /* Make the unquoted \<newline> pair disappear. */ + { + line_number++; + continue; /* Make the unquoted \<newline> pair disappear. */ + } else { yy_ungetc (peekc); @@ -1616,7 +1702,8 @@ read_secondary_line (remove_quoted_newline) int remove_quoted_newline; { prompt_string_pointer = &ps2_prompt; - prompt_again (); + if (SHOULD_PROMPT()) + prompt_again (); return (read_a_line (remove_quoted_newline)); } @@ -1778,20 +1865,27 @@ shell_getc (remove_quoted_newline) i = 0; shell_input_line_terminator = 0; + /* If the shell is interatctive, but not currently printing a prompt + (interactive_shell && interactive == 0), we don't want to print + notifies or cleanup the jobs -- we want to defer it until we do + print the next prompt. */ + if (interactive_shell == 0 || SHOULD_PROMPT()) + { #if defined (JOB_CONTROL) /* This can cause a problem when reading a command as the result of a trap, when the trap is called from flush_child. This call had better not cause jobs to disappear from the job table in that case, or we will have big trouble. */ - notify_and_cleanup (); + notify_and_cleanup (); #else /* !JOB_CONTROL */ - cleanup_dead_jobs (); + cleanup_dead_jobs (); #endif /* !JOB_CONTROL */ + } #if defined (READLINE) - if (interactive && bash_input.type != st_string && no_line_editing) + if (no_line_editing && SHOULD_PROMPT()) #else - if (interactive && bash_input.type != st_string) + if (SHOULD_PROMPT()) #endif print_prompt (); @@ -1911,7 +2005,8 @@ shell_getc (remove_quoted_newline) { shell_input_line_size = 0; prompt_string_pointer = ¤t_prompt_string; - prompt_again (); + if (SHOULD_PROMPT ()) + prompt_again (); goto restart_read; } @@ -1937,7 +2032,8 @@ shell_getc (remove_quoted_newline) if MBTEST(uc == '\\' && remove_quoted_newline && shell_input_line[shell_input_line_index] == '\n') { - prompt_again (); + if (SHOULD_PROMPT ()) + prompt_again (); line_number++; goto restart_read; } @@ -1950,19 +2046,10 @@ shell_getc (remove_quoted_newline) to. */ if (!uc && (pushed_string_list != (STRING_SAVER *)NULL)) { - if (mustpop) - { - pop_string (); - uc = shell_input_line[shell_input_line_index]; - if (uc) - shell_input_line_index++; - mustpop--; - } - else - { - mustpop++; - uc = ' '; - } + pop_string (); + uc = shell_input_line[shell_input_line_index]; + if (uc) + shell_input_line_index++; } #endif /* ALIAS || DPAREN_ARITHMETIC */ @@ -2016,25 +2103,17 @@ void execute_prompt_command (command) char *command; { - sh_builtin_func_t *temp_last, *temp_this; char *last_lastarg; - int temp_exit_value, temp_eof_encountered; + sh_parser_state_t ps; - temp_last = last_shell_builtin; - temp_this = this_shell_builtin; - temp_exit_value = last_command_exit_value; - temp_eof_encountered = eof_encountered; + save_parser_state (&ps); last_lastarg = get_string_value ("_"); if (last_lastarg) last_lastarg = savestring (last_lastarg); parse_and_execute (savestring (command), "PROMPT_COMMAND", SEVAL_NONINT|SEVAL_NOHIST); - last_shell_builtin = temp_last; - this_shell_builtin = temp_this; - last_command_exit_value = temp_exit_value; - eof_encountered = temp_eof_encountered; - + restore_parser_state (&ps); bind_variable ("_", last_lastarg); FREE (last_lastarg); @@ -2074,7 +2153,7 @@ yylex () /* Avoid printing a prompt if we're not going to read anything, e.g. after resetting the parser with read_token (RESET). */ - if (token_to_read == 0 && interactive) + if (token_to_read == 0 && SHOULD_PROMPT ()) prompt_again (); } @@ -2108,8 +2187,8 @@ static int open_brace_count; (((token) == ASSIGNMENT_WORD) || \ ((token) != SEMI_SEMI && reserved_word_acceptable(token))) -#define assignment_acceptable(token) command_token_position(token) && \ - ((parser_state & PST_CASEPAT) == 0) +#define assignment_acceptable(token) \ + (command_token_position(token) && ((parser_state & PST_CASEPAT) == 0)) /* Check to see if TOKEN is a reserved word and return the token value if it is. */ @@ -2124,7 +2203,7 @@ static int open_brace_count; { \ if ((parser_state & PST_CASEPAT) && (word_token_alist[i].token != ESAC)) \ break; \ - if (word_token_alist[i].token == TIME) \ + if (word_token_alist[i].token == TIME && time_command_acceptable () == 0) \ break; \ if (word_token_alist[i].token == ESAC) \ parser_state &= ~(PST_CASEPAT|PST_CASESTMT); \ @@ -2157,6 +2236,23 @@ static int open_brace_count; Special cases that disqualify: In a pattern list in a case statement (parser_state & PST_CASEPAT). */ + +static char * +mk_alexpansion (s) + char *s; +{ + int l; + char *r; + + l = strlen (s); + r = xmalloc (l + 2); + strcpy (r, s); + if (r[l -1] != ' ') + r[l++] = ' '; + r[l] = '\0'; + return r; +} + static int alias_expand_token (tokstr) char *tokstr; @@ -2173,7 +2269,12 @@ alias_expand_token (tokstr) if (ap && (ap->flags & AL_BEINGEXPANDED)) return (NO_EXPANSION); - expanded = ap ? savestring (ap->value) : (char *)NULL; + /* mk_alexpansion puts an extra space on the end of the alias expansion, + so the lookahead by the parser works right. If this gets changed, + make sure the code in shell_getc that deals with reaching the end of + an expanded alias is changed with it. */ + expanded = ap ? mk_alexpansion (ap->value) : (char *)NULL; + if (expanded) { push_string (expanded, ap->flags & AL_EXPANDNEXT, ap); @@ -2317,10 +2418,12 @@ special_case_tokens (tokstr) return (TIMEOPT); #endif +#if 0 #if defined (COMMAND_TIMING) if (STREQ (token, "time") && ((parser_state & PST_CASEPAT) == 0) && time_command_acceptable ()) return (TIME); #endif /* COMMAND_TIMING */ +#endif #if defined (COND_COMMAND) /* [[ */ if ((parser_state & PST_CONDEXPR) && tokstr[0] == ']' && tokstr[1] == ']' && tokstr[2] == '\0') @@ -2565,6 +2668,7 @@ read_token (command) */ #define P_FIRSTCLOSE 0x01 #define P_ALLOWESC 0x02 +#define P_DQUOTE 0x04 static char matched_pair_error; static char * @@ -2576,11 +2680,14 @@ parse_matched_pair (qc, open, close, lenp, flags) int count, ch, was_dollar; int pass_next_character, nestlen, ttranslen, start_lineno; char *ret, *nestret, *ttrans; - int retind, retsize; + int retind, retsize, rflags; count = 1; pass_next_character = was_dollar = 0; + /* RFLAGS is the set of flags we want to pass to recursive calls. */ + rflags = (qc == '"') ? P_DQUOTE : (flags & P_DQUOTE); + ret = (char *)xmalloc (retsize = 64); retind = 0; @@ -2597,8 +2704,7 @@ parse_matched_pair (qc, open, close, lenp, flags) } /* Possible reprompting. */ - if (ch == '\n' && interactive && - (bash_input.type == st_stdin || bash_input.type == st_stream)) + if (ch == '\n' && SHOULD_PROMPT ()) prompt_again (); if (pass_next_character) /* last char was backslash */ @@ -2654,16 +2760,16 @@ parse_matched_pair (qc, open, close, lenp, flags) /* '', ``, or "" inside $(...) or other grouping construct. */ push_delimiter (dstack, ch); if MBTEST(was_dollar && ch == '\'') /* $'...' inside group */ - nestret = parse_matched_pair (ch, ch, ch, &nestlen, P_ALLOWESC); + nestret = parse_matched_pair (ch, ch, ch, &nestlen, P_ALLOWESC|rflags); else - nestret = parse_matched_pair (ch, ch, ch, &nestlen, 0); + nestret = parse_matched_pair (ch, ch, ch, &nestlen, rflags); pop_delimiter (dstack); if (nestret == &matched_pair_error) { free (ret); return &matched_pair_error; } - if MBTEST(was_dollar && ch == '\'') + if MBTEST(was_dollar && ch == '\'' && (extended_quote || (rflags & P_DQUOTE) == 0)) { /* Translate $'...' here. */ ttrans = ansiexpand (nestret, 0, nestlen - 1, &ttranslen); @@ -2673,7 +2779,7 @@ parse_matched_pair (qc, open, close, lenp, flags) nestlen = strlen (nestret); retind -= 2; /* back up before the $' */ } - else if MBTEST(was_dollar && ch == '"') + else if MBTEST(was_dollar && ch == '"' && (extended_quote || (rflags & P_DQUOTE) == 0)) { /* Locale expand $"..." here. */ ttrans = localeexpand (nestret, 0, nestlen - 1, start_lineno, &ttranslen); @@ -2702,7 +2808,7 @@ parse_matched_pair (qc, open, close, lenp, flags) /* XXX - sh and ksh93 don't do this - XXX */ else if MBTEST(open == '"' && ch == '`') { - nestret = parse_matched_pair (0, '`', '`', &nestlen, 0); + nestret = parse_matched_pair (0, '`', '`', &nestlen, rflags); if (nestret == &matched_pair_error) { free (ret); @@ -2722,11 +2828,11 @@ parse_matched_pair (qc, open, close, lenp, flags) if (open == ch) /* undo previous increment */ count--; if (ch == '(') /* ) */ - nestret = parse_matched_pair (0, '(', ')', &nestlen, 0); + nestret = parse_matched_pair (0, '(', ')', &nestlen, rflags); else if (ch == '{') /* } */ - nestret = parse_matched_pair (0, '{', '}', &nestlen, P_FIRSTCLOSE); + nestret = parse_matched_pair (0, '{', '}', &nestlen, P_FIRSTCLOSE|rflags); else if (ch == '[') /* ] */ - nestret = parse_matched_pair (0, '[', ']', &nestlen, 0); + nestret = parse_matched_pair (0, '[', ']', &nestlen, rflags); if (nestret == &matched_pair_error) { free (ret); @@ -2766,19 +2872,12 @@ parse_dparen (c) if (last_read_token == FOR) { arith_for_lineno = line_number; - cmdtyp = parse_arith_cmd (&wval); + cmdtyp = parse_arith_cmd (&wval, 0); if (cmdtyp == 1) { - /* parse_arith_cmd adds quotes at the beginning and end - of the string it returns; we need to take those out. */ - len = strlen (wval); - wv2 = (char *)xmalloc (len); - strncpy (wv2, wval + 1, len - 2); - wv2[len - 2] = '\0'; - wd = make_word (wv2); + wd = make_word (wval); yylval.word_list = make_word_list (wd, (WORD_LIST *)NULL); free (wval); - free (wv2); return (ARITH_FOR_EXPRS); } else @@ -2790,11 +2889,19 @@ parse_dparen (c) if (reserved_word_acceptable (last_read_token)) { sline = line_number; - cmdtyp = parse_arith_cmd (&wval); +#if 0 + cmdtyp = parse_arith_cmd (&wval, 1); +#else + cmdtyp = parse_arith_cmd (&wval, 0); +#endif if (cmdtyp == 1) /* arithmetic command */ { wd = make_word (wval); +#if 0 wd->flags = W_QUOTED; +#else + wd->flags = W_QUOTED|W_NOSPLIT|W_NOGLOB; +#endif yylval.word_list = make_word_list (wd, (WORD_LIST *)NULL); free (wval); /* make_word copies it */ return (ARITH_CMD); @@ -2820,8 +2927,9 @@ parse_dparen (c) allocated buffer and make *ep point to that buffer. Return -1 on an error, for example EOF. */ static int -parse_arith_cmd (ep) +parse_arith_cmd (ep, adddq) char **ep; + int adddq; { int exp_lineno, rval, c; char *ttok, *tokstr; @@ -2840,20 +2948,28 @@ parse_arith_cmd (ep) tokstr = (char *)xmalloc (ttoklen + 4); - /* (( ... )) -> "..." */ - tokstr[0] = (rval == 1) ? '"' : '('; - strncpy (tokstr + 1, ttok, ttoklen - 1); /* don't copy the final `)' */ - if (rval == 1) + /* if ADDDQ != 0 then (( ... )) -> "..." */ + if (rval == 1 && adddq) /* arith cmd, add double quotes */ { + tokstr[0] = '"'; + strncpy (tokstr + 1, ttok, ttoklen - 1); tokstr[ttoklen] = '"'; tokstr[ttoklen+1] = '\0'; } - else + else if (rval == 1) /* arith cmd, don't add double quotes */ { + strncpy (tokstr, ttok, ttoklen - 1); + tokstr[ttoklen-1] = '\0'; + } + else /* nested subshell */ + { + tokstr[0] = '('; + strncpy (tokstr + 1, ttok, ttoklen - 1); tokstr[ttoklen] = ')'; tokstr[ttoklen+1] = c; tokstr[ttoklen+2] = '\0'; } + *ep = tokstr; FREE (ttok); return rval; @@ -2919,7 +3035,7 @@ cond_skip_newlines () { while ((cond_token = read_token (READ)) == '\n') { - if (interactive && (bash_input.type == st_stdin || bash_input.type == st_stream)) + if (SHOULD_PROMPT ()) prompt_again (); } return (cond_token); @@ -3005,6 +3121,10 @@ cond_term () tok = read_token (READ); if (tok == WORD && test_binop (yylval.word->word)) op = yylval.word; +#if defined (COND_REGEXP) + else if (tok == WORD && STREQ (yylval.word->word,"=~")) + op = yylval.word; +#endif else if (tok == '<' || tok == '>') op = make_word_from_token (tok); /* ( */ /* There should be a check before blindly accepting the `)' that we have @@ -3420,8 +3540,7 @@ read_token_word (character) TOKEN_DEFAULT_GROW_SIZE); next_character: - if (character == '\n' && interactive && - (bash_input.type == st_stdin || bash_input.type == st_stream)) + if (character == '\n' && SHOULD_PROMPT ()) prompt_again (); /* We want to remove quoted newlines (that is, a \<newline> pair) @@ -3503,10 +3622,19 @@ got_token: result = ((the_word->flags & (W_ASSIGNMENT|W_NOSPLIT)) == (W_ASSIGNMENT|W_NOSPLIT)) ? ASSIGNMENT_WORD : WORD; - if (last_read_token == FUNCTION) + switch (last_read_token) { + case FUNCTION: parser_state |= PST_ALLOWOPNBRC; function_dstart = line_number; + break; + case CASE: + case SELECT: + case FOR: + if (word_top < MAX_CASE_NEST) + word_top++; + word_lineno[word_top] = line_number; + break; } return (result); @@ -3664,7 +3792,7 @@ prompt_again () { char *temp_prompt; - if (!interactive) /* XXX */ + if (interactive == 0 || expanding_alias()) /* XXX */ return; ps1_prompt = get_string_value ("PS1"); @@ -4020,6 +4148,11 @@ decode_prompt_string (string) #if defined (READLINE) case '[': case ']': + if (no_line_editing) + { + string++; + break; + } temp = (char *)xmalloc (3); temp[0] = '\001'; temp[1] = (c == '[') ? RL_PROMPT_START_IGNORE : RL_PROMPT_END_IGNORE; @@ -4516,6 +4649,105 @@ parse_compound_assignment (retlenp) /************************************************ * * + * SAVING AND RESTORING PARTIAL PARSE STATE * + * * + ************************************************/ + +sh_parser_state_t * +save_parser_state (ps) + sh_parser_state_t *ps; +{ +#if defined (ARRAY_VARS) + SHELL_VAR *v; +#endif + + if (ps == 0) + ps = xmalloc (sizeof (sh_parser_state_t)); + if (ps == 0) + return ((sh_parser_state_t *)NULL); + + ps->parser_state = parser_state; + ps->token_state = save_token_state (); + + ps->input_line_terminator = shell_input_line_terminator; + ps->eof_encountered = eof_encountered; + + ps->current_command_line_count = current_command_line_count; + +#if defined (HISTORY) + ps->remember_on_history = remember_on_history; +# if defined (BANG_HISTORY) + ps->history_expansion_inhibited = history_expansion_inhibited; +# endif +#endif + + ps->last_command_exit_value = last_command_exit_value; +#if defined (ARRAY_VARS) + v = find_variable ("PIPESTATUS"); + if (v && array_p (v) && array_cell (v)) + ps->pipestatus = array_copy (array_cell (v)); + else + ps->pipestatus = (ARRAY *)NULL; +#endif + + ps->last_shell_builtin = last_shell_builtin; + ps->this_shell_builtin = this_shell_builtin; + + ps->expand_aliases = expand_aliases; + ps->echo_input_at_read = echo_input_at_read; + + return (ps); +} + +void +restore_parser_state (ps) + sh_parser_state_t *ps; +{ +#if defined (ARRAY_VARS) + SHELL_VAR *v; +#endif + + if (ps == 0) + return; + + parser_state = ps->parser_state; + if (ps->token_state) + { + restore_token_state (ps->token_state); + free (ps->token_state); + } + + shell_input_line_terminator = ps->input_line_terminator; + eof_encountered = ps->eof_encountered; + + current_command_line_count = ps->current_command_line_count; + +#if defined (HISTORY) + remember_on_history = ps->remember_on_history; +# if defined (BANG_HISTORY) + history_expansion_inhibited = ps->history_expansion_inhibited; +# endif +#endif + + last_command_exit_value = ps->last_command_exit_value; +#if defined (ARRAY_VARS) + v = find_variable ("PIPESTATUS"); + if (v && array_p (v) && array_cell (v)) + { + array_dispose (array_cell (v)); + var_setarray (v, ps->pipestatus); + } +#endif + + last_shell_builtin = ps->last_shell_builtin; + this_shell_builtin = ps->this_shell_builtin; + + expand_aliases = ps->expand_aliases; + echo_input_at_read = ps->echo_input_at_read; +} + +/************************************************ + * * * MULTIBYTE CHARACTER HANDLING * * * ************************************************/ @@ -4524,7 +4756,7 @@ parse_compound_assignment (retlenp) static void set_line_mbstate () { - int i, previ, len; + int i, previ, len, c; mbstate_t mbs, prevs; size_t mbclen; @@ -4539,7 +4771,8 @@ set_line_mbstate () { mbs = prevs; - if (shell_input_line[i] == EOF) + c = shell_input_line[i]; + if (c == EOF) { int j; for (j = i; j < len; j++) @@ -4563,7 +4796,11 @@ set_line_mbstate () } else { - /* mbrlen doesn't return any other values */ + /* XXX - what to do if mbrlen returns 0? (null wide character) */ + int j; + for (j = i; j < len; j++) + shell_input_line_property[j] = 1; + break; } shell_input_line_property[i] = mbclen; diff --git a/parser-built b/parser-built index 565b0399..e69de29b 100644 --- a/parser-built +++ b/parser-built @@ -1,60 +0,0 @@ -#ifndef BISON_Y_TAB_H -# define BISON_Y_TAB_H - -#ifndef YYSTYPE -typedef union { - WORD_DESC *word; /* the word that we read. */ - int number; /* the number that we read. */ - WORD_LIST *word_list; - COMMAND *command; - REDIRECT *redirect; - ELEMENT element; - PATTERN_LIST *pattern; -} yystype; -# define YYSTYPE yystype -#endif -# define IF 257 -# define THEN 258 -# define ELSE 259 -# define ELIF 260 -# define FI 261 -# define CASE 262 -# define ESAC 263 -# define FOR 264 -# define SELECT 265 -# define WHILE 266 -# define UNTIL 267 -# define DO 268 -# define DONE 269 -# define FUNCTION 270 -# define COND_START 271 -# define COND_END 272 -# define COND_ERROR 273 -# define IN 274 -# define BANG 275 -# define TIME 276 -# define TIMEOPT 277 -# define WORD 278 -# define ASSIGNMENT_WORD 279 -# define NUMBER 280 -# define ARITH_CMD 281 -# define ARITH_FOR_EXPRS 282 -# define COND_CMD 283 -# define AND_AND 284 -# define OR_OR 285 -# define GREATER_GREATER 286 -# define LESS_LESS 287 -# define LESS_AND 288 -# define LESS_LESS_LESS 289 -# define GREATER_AND 290 -# define SEMI_SEMI 291 -# define LESS_LESS_MINUS 292 -# define AND_GREATER 293 -# define LESS_GREATER 294 -# define GREATER_BAR 295 -# define yacc_EOF 296 - - -extern YYSTYPE yylval; - -#endif /* not BISON_Y_TAB_H */ diff --git a/pathnames.h.in b/pathnames.h.in new file mode 100644 index 00000000..2ced60cd --- /dev/null +++ b/pathnames.h.in @@ -0,0 +1,33 @@ +/* pathnames.h -- absolute filenames that bash wants for various defaults. */ + +/* Copyright (C) 1987,1991 Free Software Foundation, Inc. + + This file is part of GNU Bash, the Bourne Again SHell. + + Bash is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + Bash is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with Bash; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ + +#if !defined (_PATHNAMES_H_) +#define _PATHNAMES_H_ + +/* The default file for hostname completion. */ +#define DEFAULT_HOSTS_FILE "/etc/hosts" + +/* The default login shell startup file. */ +#define SYS_PROFILE "/etc/profile" + +/* The default location of the bash debugger initialization/startup file. */ +#define DEBUGGER_START_FILE "@DEBUGGER_START_FILE@" + +#endif /* _PATHNAMES_H */ diff --git a/pcomplete.c b/pcomplete.c index 18113512..2c55d1f1 100644 --- a/pcomplete.c +++ b/pcomplete.c @@ -371,6 +371,11 @@ init_itemlist_from_varlist (itp, svfunc) register int i, n; vlist = (*svfunc) (); + if (vlist == 0) + { + itp->slist = (STRINGLIST *)NULL; + return; + } for (n = 0; vlist[n]; n++) ; sl = strlist_create (n+1); @@ -628,7 +633,8 @@ it_init_shopts (itp) /* Generate a list of all matches for TEXT using the STRINGLIST in itp->slist as the list of possibilities. If the itemlist has been marked dirty or it should be regenerated every time, destroy the old STRINGLIST and make a - new one before trying the match. */ + new one before trying the match. TEXT is dequoted before attempting a + match. */ static STRINGLIST * gen_matches_from_itemlist (itp, text) ITEMLIST *itp; @@ -636,6 +642,7 @@ gen_matches_from_itemlist (itp, text) { STRINGLIST *ret, *sl; int tlen, i, n; + char *ntxt; if ((itp->flags & (LIST_DIRTY|LIST_DYNAMIC)) || (itp->flags & LIST_INITIALIZED) == 0) @@ -649,13 +656,18 @@ gen_matches_from_itemlist (itp, text) return ((STRINGLIST *)NULL); ret = strlist_create (itp->slist->list_len+1); sl = itp->slist; - tlen = STRLEN (text); + + ntxt = bash_dequote_text (text); + tlen = STRLEN (ntxt); + for (i = n = 0; i < sl->list_len; i++) { - if (tlen == 0 || STREQN (sl->list[i], text, tlen)) + if (tlen == 0 || STREQN (sl->list[i], ntxt, tlen)) ret->list[n++] = STRDUP (sl->list[i]); } ret->list[ret->list_len = n] = (char *)NULL; + + FREE (ntxt); return ret; } @@ -792,7 +804,8 @@ gen_wordlist_matches (cs, text) { WORD_LIST *l, *l2; STRINGLIST *sl; - int nw, tlen; + int nw, tlen, qc; + char *ntxt; /* dequoted TEXT to use in comparisons */ if (cs->words == 0 || cs->words[0] == '\0') return ((STRINGLIST *)NULL); @@ -810,15 +823,18 @@ gen_wordlist_matches (cs, text) nw = list_length (l2); sl = strlist_create (nw + 1); - tlen = STRLEN (text); + + ntxt = bash_dequote_text (text); + tlen = STRLEN (ntxt); for (nw = 0, l = l2; l; l = l->next) { - if (tlen == 0 || STREQN (l->word->word, text, tlen)) + if (tlen == 0 || STREQN (l->word->word, ntxt, tlen)) sl->list[nw++] = STRDUP (l->word->word); } sl->list[sl->list_len = nw] = (char *)NULL; + FREE (ntxt); return sl; } @@ -1132,6 +1148,7 @@ gen_compspec_completions (cs, cmd, word, start, end) char *line; int llen, nw, cw; WORD_LIST *lwords; + COMPSPEC *tcs; #ifdef DEBUG debug_printf ("gen_compspec_completions (%s, %s, %d, %d)", cmd, word, start, end); @@ -1286,12 +1303,19 @@ gen_compspec_completions (cs, cmd, word, start, end) names. */ if ((ret == 0 || ret->list_len == 0) && (cs->options & COPT_DIRNAMES)) { - COMPSPEC *dummy; - - dummy = compspec_create (); - dummy->actions = CA_DIRECTORY; - ret = gen_action_completions (dummy, word); - compspec_dispose (dummy); + tcs = compspec_create (); + tcs->actions = CA_DIRECTORY; + ret = gen_action_completions (tcs, word); + compspec_dispose (tcs); + } + else if (cs->options & COPT_PLUSDIRS) + { + tcs = compspec_create (); + tcs->actions = CA_DIRECTORY; + tmatches = gen_action_completions (tcs, word); + ret = strlist_append (ret, tmatches); + strlist_dispose (tmatches); + compspec_dispose (tcs); } return (ret); @@ -1326,6 +1350,8 @@ programmable_completions (cmd, word, start, end, foundp) return ((char **)NULL); } + cs = compspec_copy (cs); + /* Signal the caller that we found a COMPSPEC for this command, and pass back any meta-options associated with the compspec. */ if (foundp) @@ -1333,6 +1359,8 @@ programmable_completions (cmd, word, start, end, foundp) ret = gen_compspec_completions (cs, cmd, word, start, end); + compspec_dispose (cs); + if (ret) { rmatches = ret->list; diff --git a/pcomplete.h b/pcomplete.h index 9353fe1e..0b05ef81 100644 --- a/pcomplete.h +++ b/pcomplete.h @@ -71,6 +71,8 @@ typedef struct compspec { #define COPT_FILENAMES (1<<2) #define COPT_DIRNAMES (1<<3) #define COPT_NOSPACE (1<<4) +#define COPT_BASHDEFAULT (1<<5) +#define COPT_PLUSDIRS (1<<6) /* List of items is used by the code that implements the programmable completions. */ @@ -179,13 +179,14 @@ progcomp_insert (cmd, cs) if (prog_completes == 0) progcomp_create (); + cs->refcount++; item = hash_insert (cmd, prog_completes, 0); if (item->data) free_progcomp (item->data); else item->key = savestring (cmd); item->data = cs; - cs->refcount++; + return 1; } diff --git a/print_cmd.c b/print_cmd.c index 9429472e..e4a1c5ec 100644 --- a/print_cmd.c +++ b/print_cmd.c @@ -1,5 +1,5 @@ /* print_command -- A way to make readable commands from a command tree. */ -/* Copyright (C) 1989 Free Software Foundation, Inc. +/* Copyright (C) 1989-2003 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -87,12 +87,8 @@ static void print_while_command __P((WHILE_COM *)); static void print_until_command __P((WHILE_COM *)); static void print_until_or_while __P((WHILE_COM *, char *)); static void print_if_command __P((IF_COM *)); -#if defined (DPAREN_ARITHMETIC) -static void print_arith_command __P((ARITH_COM *)); -#endif #if defined (COND_COMMAND) static void print_cond_node __P((COND_COM *)); -static void print_cond_command __P((COND_COM *)); #endif static void print_function_def __P((FUNCTION_DEF *)); @@ -197,7 +193,7 @@ make_command_string_internal (command) #if defined (DPAREN_ARITHMETIC) case cm_arith: - print_arith_command (command->value.Arith); + print_arith_command (command->value.Arith->exp); break; #endif @@ -335,6 +331,9 @@ indirection_level_string () ps4 = decode_prompt_string (ps4); change_flag ('x', FLAG_ON); + if (ps4 == 0 || *ps4 == '\0') + return (indirection_string); + for (i = 0; *ps4 && i < indirection_level && i < 99; i++) indirection_string[i] = *ps4; @@ -348,13 +347,16 @@ indirection_level_string () /* A function to print the words of a simple command when set -x is on. */ void -xtrace_print_word_list (list) +xtrace_print_word_list (list, xtflags) WORD_LIST *list; + int xtflags; { WORD_LIST *w; char *t, *x; - fprintf (stderr, "%s", indirection_level_string ()); + if (xtflags) + fprintf (stderr, "%s", indirection_level_string ()); + for (w = list; w; w = w->next) { t = w->word->word; @@ -386,12 +388,29 @@ command_print_word_list (list, separator) _print_word_list (list, separator, cprintf); } -static void -print_for_command (for_command) +void +print_for_command_head (for_command) FOR_COM *for_command; { cprintf ("for %s in ", for_command->name->word); command_print_word_list (for_command->map_list, " "); +} + +void +xtrace_print_for_command_head (for_command) + FOR_COM *for_command; +{ + fprintf (stderr, "%s", indirection_level_string ()); + fprintf (stderr, "for %s in ", for_command->name->word); + xtrace_print_word_list (for_command->map_list, 0); +} + +static void +print_for_command (for_command) + FOR_COM *for_command; +{ + print_for_command_head (for_command); + cprintf (";"); newline ("do\n"); indentation += indentation_amount; @@ -406,13 +425,13 @@ static void print_arith_for_command (arith_for_command) ARITH_FOR_COM *arith_for_command; { - cprintf ("for (( "); + cprintf ("for (("); command_print_word_list (arith_for_command->init, " "); cprintf (" ; "); command_print_word_list (arith_for_command->test, " "); cprintf (" ; "); command_print_word_list (arith_for_command->step, " "); - cprintf (" ))"); + cprintf ("))"); newline ("do\n"); indentation += indentation_amount; make_command_string_internal (arith_for_command->action); @@ -423,12 +442,29 @@ print_arith_for_command (arith_for_command) #endif /* ARITH_FOR_COMMAND */ #if defined (SELECT_COMMAND) -static void -print_select_command (select_command) +void +print_select_command_head (select_command) SELECT_COM *select_command; { cprintf ("select %s in ", select_command->name->word); command_print_word_list (select_command->map_list, " "); +} + +void +xtrace_print_select_command_head (select_command) + SELECT_COM *select_command; +{ + fprintf (stderr, "%s", indirection_level_string ()); + fprintf (stderr, "select %s in ", select_command->name->word); + xtrace_print_word_list (select_command->map_list, 0); +} + +static void +print_select_command (select_command) + SELECT_COM *select_command; +{ + print_select_command_head (select_command); + cprintf (";"); newline ("do\n"); indentation += indentation_amount; @@ -476,11 +512,27 @@ print_group_command (group_command) group_command_nesting--; } +void +print_case_command_head (case_command) + CASE_COM *case_command; +{ + cprintf ("case %s in ", case_command->word->word); +} + +void +xtrace_print_case_command_head (case_command) + CASE_COM *case_command; +{ + fprintf (stderr, "%s", indirection_level_string ()); + fprintf (stderr, "case %s in\n", case_command->word->word); +} + static void print_case_command (case_command) CASE_COM *case_command; { - cprintf ("case %s in ", case_command->word->word); + print_case_command_head (case_command); + if (case_command->clauses) print_case_clauses (case_command->clauses); newline ("esac"); @@ -562,13 +614,13 @@ print_if_command (if_command) } #if defined (DPAREN_ARITHMETIC) -static void -print_arith_command (arith_command) - ARITH_COM *arith_command; +void +print_arith_command (arith_cmd_list) + WORD_LIST *arith_cmd_list; { - cprintf ("(( "); - command_print_word_list (arith_command->exp, " "); - cprintf (" ))"); + cprintf ("(("); + command_print_word_list (arith_cmd_list, " "); + cprintf ("))"); } #endif @@ -618,7 +670,7 @@ print_cond_node (cond) } } -static void +void print_cond_command (cond) COND_COM *cond; { @@ -25,7 +25,7 @@ #include <stdio.h> #include "bashtypes.h" -#ifndef _MINIX +#if !defined (_MINIX) && defined (HAVE_SYS_FILE_H) # include <sys/file.h> #endif #include "filecntl.h" @@ -53,6 +53,8 @@ extern int errno; # include "input.h" #endif +int expanding_redir; + extern int posixly_correct; extern REDIRECT *redirection_undo_list; extern REDIRECT *exec_redirection_undo_list; @@ -63,7 +65,7 @@ static void add_exec_redirect __P((REDIRECT *)); static int add_undo_redirect __P((int)); static int expandable_redirection_filename __P((REDIRECT *)); static int stdin_redirection __P((enum r_instruction, int)); -static int do_redirection_internal __P((REDIRECT *, int, int, int)); +static int do_redirection_internal __P((REDIRECT *, int)); static int write_here_document __P((int, WORD_DESC *)); static int write_here_string __P((int, WORD_DESC *)); @@ -160,21 +162,21 @@ redirection_error (temp, error) FREE (allocname); } -/* Perform the redirections on LIST. If FOR_REAL, then actually make - input and output file descriptors, otherwise just do whatever is - neccessary for side effecting. INTERNAL says to remember how to - undo the redirections later, if non-zero. If SET_CLEXEC is non-zero, - file descriptors opened in do_redirection () have their close-on-exec - flag set. */ +/* Perform the redirections on LIST. If flags & RX_ACTIVE, then actually + make input and output file descriptors, otherwise just do whatever is + neccessary for side effecting. flags & RX_UNDOABLE says to remember + how to undo the redirections later, if non-zero. If flags & RX_CLEXEC + is non-zero, file descriptors opened in do_redirection () have their + close-on-exec flag set. */ int -do_redirections (list, for_real, internal, set_clexec) +do_redirections (list, flags) REDIRECT *list; - int for_real, internal, set_clexec; + int flags; { int error; REDIRECT *temp; - if (internal) + if (flags & RX_UNDOABLE) { if (redirection_undo_list) { @@ -187,7 +189,7 @@ do_redirections (list, for_real, internal, set_clexec) for (temp = list; temp; temp = temp->next) { - error = do_redirection_internal (temp, for_real, internal, set_clexec); + error = do_redirection_internal (temp, flags); if (error) { redirection_error (temp, error); @@ -238,7 +240,9 @@ redirection_expand (word) w->flags |= W_NOSPLIT; tlist1 = make_word_list (w, (WORD_LIST *)NULL); + expanding_redir = 1; tlist2 = expand_words_no_vars (tlist1); + expanding_redir = 0; dispose_words (tlist1); if (!tlist2 || tlist2->next) @@ -263,7 +267,7 @@ write_here_string (fd, redirectee) int herelen, n, e; herestr = expand_string_to_string (redirectee->word, 0); - herelen = strlen (herestr); + herelen = STRLEN (herestr); n = write (fd, herestr, herelen); if (n == herelen) @@ -272,7 +276,7 @@ write_here_string (fd, redirectee) herelen = 1; } e = errno; - free (herestr); + FREE (herestr); if (n != herelen) { if (e == 0) @@ -600,14 +604,15 @@ redir_open (filename, flags, mode, ri) /* Do the specific redirection requested. Returns errno or one of the special redirection errors (*_REDIRECT) in case of error, 0 on success. - If FOR_REAL is zero, then just do whatever is neccessary to produce the - appropriate side effects. REMEMBERING, if non-zero, says to remember - how to undo each redirection. If SET_CLEXEC is non-zero, then - we set all file descriptors > 2 that we open to be close-on-exec. */ + If flags & RX_ACTIVE is zero, then just do whatever is neccessary to + produce the appropriate side effects. flags & RX_UNDOABLE, if non-zero, + says to remember how to undo each redirection. If flags & RX_CLEXEC is + non-zero, then we set all file descriptors > 2 that we open to be + close-on-exec. */ static int -do_redirection_internal (redirect, for_real, remembering, set_clexec) +do_redirection_internal (redirect, flags) REDIRECT *redirect; - int for_real, remembering, set_clexec; + int flags; { WORD_DESC *redirectee; int redir_fd, fd, redirector, r, oflags; @@ -739,9 +744,9 @@ do_redirection_internal (redirect, for_real, remembering, set_clexec) if (fd < 0) return (errno); - if (for_real) + if (flags & RX_ACTIVE) { - if (remembering) + if (flags & RX_UNDOABLE) { /* Only setup to undo it if the thing to undo is active. */ if ((fd != redirector) && (fcntl (redirector, F_GETFD, 0) != -1)) @@ -775,7 +780,7 @@ do_redirection_internal (redirect, for_real, remembering, set_clexec) * both sh and ksh leave the file descriptors open across execs. * The Posix standard mentions only the exec builtin. */ - if (set_clexec && (redirector > 2)) + if ((flags & RX_CLEXEC) && (redirector > 2)) SET_CLOSE_ON_EXEC (redirector); } @@ -793,9 +798,9 @@ do_redirection_internal (redirect, for_real, remembering, set_clexec) redirection here. */ if (ri == r_err_and_out) { - if (for_real) + if (flags & RX_ACTIVE) { - if (remembering) + if (flags & RX_UNDOABLE) add_undo_redirect (2); if (dup2 (1, 2) < 0) return (errno); @@ -818,9 +823,9 @@ do_redirection_internal (redirect, for_real, remembering, set_clexec) return (HEREDOC_REDIRECT); } - if (for_real) + if (flags & RX_ACTIVE) { - if (remembering) + if (flags & RX_UNDOABLE) { /* Only setup to undo it if the thing to undo is active. */ if ((fd != redirector) && (fcntl (redirector, F_GETFD, 0) != -1)) @@ -843,7 +848,7 @@ do_redirection_internal (redirect, for_real, remembering, set_clexec) duplicate_buffered_stream (fd, redirector); #endif - if (set_clexec && (redirector > 2)) + if ((flags & RX_CLEXEC) && (redirector > 2)) SET_CLOSE_ON_EXEC (redirector); } @@ -860,9 +865,9 @@ do_redirection_internal (redirect, for_real, remembering, set_clexec) case r_duplicating_output: case r_move_input: case r_move_output: - if (for_real && (redir_fd != redirector)) + if ((flags & RX_ACTIVE) && (redir_fd != redirector)) { - if (remembering) + if (flags & RX_UNDOABLE) { /* Only setup to undo it if the thing to undo is active. */ if (fcntl (redirector, F_GETFD, 0) != -1) @@ -890,7 +895,7 @@ do_redirection_internal (redirect, for_real, remembering, set_clexec) unless closed by something like `exec 2<&-'. */ /* if ((already_set || set_unconditionally) && (ok_to_set)) set_it () */ - if (((fcntl (redir_fd, F_GETFD, 0) == 1) || set_clexec) && + if (((fcntl (redir_fd, F_GETFD, 0) == 1) || (flags & RX_CLEXEC)) && (redirector > 2)) SET_CLOSE_ON_EXEC (redirector); @@ -901,9 +906,9 @@ do_redirection_internal (redirect, for_real, remembering, set_clexec) break; case r_close_this: - if (for_real) + if (flags & RX_ACTIVE) { - if (remembering && (fcntl (redirector, F_GETFD, 0) != -1)) + if ((flags & RX_UNDOABLE) && (fcntl (redirector, F_GETFD, 0) != -1)) add_undo_redirect (redirector); #if defined (BUFFERED_INPUT) @@ -23,8 +23,13 @@ #include "stdc.h" +/* Values for flags argument to do_redirections */ +#define RX_ACTIVE 0x01 /* do it; don't just go through the motions */ +#define RX_UNDOABLE 0x02 /* make a list to undo these redirections */ +#define RX_CLEXEC 0x04 /* set close-on-exec for opened fds > 2 */ + extern void redirection_error __P((REDIRECT *, int)); -extern int do_redirections __P((REDIRECT *, int, int, int)); +extern int do_redirections __P((REDIRECT *, int)); extern char *redirection_expand __P((WORD_DESC *)); extern int stdin_redirects __P((REDIRECT *)); @@ -1,6 +1,6 @@ /* shell.c -- GNU's idea of the POSIX shell specification. */ -/* Copyright (C) 1987-2002 Free Software Foundation, Inc. +/* Copyright (C) 1987-2003 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -27,7 +27,7 @@ #include "config.h" #include "bashtypes.h" -#ifndef _MINIX +#if !defined (_MINIX) && defined (HAVE_SYS_FILE_H) # include <sys/file.h> #endif #include "posixstat.h" @@ -192,6 +192,7 @@ static int do_version; /* Display interesting version info. */ static int make_login_shell; /* Make this shell be a `-bash' shell. */ static int want_initial_help; /* --help option */ +int debugging_mode = 0; /* In debugging mode with --debugger */ int no_line_editing = 0; /* Don't do fancy line editing. */ int posixly_correct = 0; /* Non-zero means posix.2 superset. */ int dump_translatable_strings; /* Dump strings in $"...", don't execute. */ @@ -208,6 +209,9 @@ struct { char **char_value; } long_args[] = { { "debug", Int, &debugging, (char **)0x0 }, +#if defined (DEBUGGER) + { "debugger", Int, &debugging_mode, (char **)0x0 }, +#endif { "dump-po-strings", Int, &dump_po_strings, (char **)0x0 }, { "dump-strings", Int, &dump_translatable_strings, (char **)0x0 }, { "help", Int, &want_initial_help, (char **)0x0 }, @@ -245,10 +249,12 @@ int default_buffered_input = -1; int read_from_stdin; /* -s flag supplied */ int want_pending_command; /* -c flag supplied */ +/* This variable is not static so it can be bound to $BASH_EXECUTION_STRING */ +char *command_execution_string; /* argument to -c option */ + int malloc_trace_at_exit = 0; static int shell_reinitialized = 0; -static char *local_pending_command; static FILE *default_input; @@ -259,6 +265,8 @@ static int parse_long_options __P((char **, int, int)); static int parse_shell_options __P((char **, int, int)); static int bind_args __P((char **, int, int, int)); +static void start_debugger __P((void)); + static void add_shopt_to_alist __P((char *, int)); static void run_shopt_alist __P((void)); @@ -374,7 +382,7 @@ main (argc, argv, env) /* Initialize `local' variables for all `invocations' of main (). */ arg_index = 1; - local_pending_command = (char *)NULL; + command_execution_string = (char *)NULL; want_pending_command = locally_skip_execution = read_from_stdin = 0; default_input = stdin; #if defined (BUFFERED_INPUT) @@ -447,11 +455,11 @@ main (argc, argv, env) following args are $0...$n respectively. */ if (want_pending_command) { - local_pending_command = argv[arg_index]; - if (local_pending_command == 0) + command_execution_string = argv[arg_index]; + if (command_execution_string == 0) { report_error ("-c: option requires an argument"); - exit (EX_USAGE); + exit (EX_BADUSAGE); } arg_index++; } @@ -469,7 +477,7 @@ main (argc, argv, env) Refer to Posix.2, the description of the `sh' utility. */ if (forced_interactive || /* -i flag */ - (!local_pending_command && /* No -c command and ... */ + (!command_execution_string && /* No -c command and ... */ wordexp_only == 0 && /* No --wordexp and ... */ ((arg_index == argc) || /* no remaining args or... */ read_from_stdin) && /* -s flag with args, and */ @@ -515,14 +523,18 @@ main (argc, argv, env) if (interactive_shell) { - char *term; + char *term, *emacs; - term = getenv ("TERM"); + term = get_string_value ("TERM"); no_line_editing |= term && (STREQ (term, "emacs")); - term = getenv ("EMACS"); - running_under_emacs = term ? ((strmatch ("*term*", term, 0) == 0) ? 2 : 1) + emacs = get_string_value ("EMACS"); + running_under_emacs = emacs ? ((strmatch ("*term*", emacs, 0) == 0) ? 2 : 1) : 0; - no_line_editing |= term && term[0] == 't' && term[1] == '\0'; +#if 0 + no_line_editing |= emacs && emacs[0] == 't' && emacs[1] == '\0'; +#else + no_line_editing |= emacs && emacs[0] == 't' && emacs[1] == '\0' && STREQ (term, "dumb"); +#endif } top_level_arg_index = arg_index; @@ -534,7 +546,7 @@ main (argc, argv, env) code = setjmp (top_level); if (code) { - if (code == EXITPROG) + if (code == EXITPROG || code == ERREXIT) exit_shell (last_command_exit_value); else { @@ -614,16 +626,20 @@ main (argc, argv, env) exit_shell (last_command_exit_value); } - if (local_pending_command) + if (command_execution_string) { arg_index = bind_args (argv, arg_index, argc, 0); startup_state = 2; + + if (debugging_mode) + start_debugger (); + #if defined (ONESHOT) executing = 1; - run_one_command (local_pending_command); + run_one_command (command_execution_string); exit_shell (last_command_exit_value); #else /* ONESHOT */ - with_input_from_string (local_pending_command, "-c"); + with_input_from_string (command_execution_string, "-c"); goto read_and_execute; #endif /* !ONESHOT */ } @@ -648,6 +664,10 @@ main (argc, argv, env) /* Bind remaining args to $1 ... $n */ arg_index = bind_args (argv, arg_index, argc, 1); + + if (debugging_mode && locally_skip_execution == 0 && running_setuid == 0) + start_debugger (); + /* Do the things that should be done only for interactive shells. */ if (interactive_shell) { @@ -711,7 +731,7 @@ parse_long_options (argv, arg_start, arg_end) else if (argv[++arg_index] == 0) { report_error ("%s: option requires an argument", long_args[i].name); - exit (EX_USAGE); + exit (EX_BADUSAGE); } else *long_args[i].char_value = argv[arg_index]; @@ -725,7 +745,7 @@ parse_long_options (argv, arg_start, arg_end) { report_error ("%s: invalid option", argv[arg_index]); show_shell_usage (stderr, 0); - exit (EX_USAGE); + exit (EX_BADUSAGE); } break; /* No such argument. Maybe flag arg. */ } @@ -786,7 +806,7 @@ parse_shell_options (argv, arg_start, arg_end) break; } if (set_minus_o_option (on_or_off, o_option) != EXECUTION_SUCCESS) - exit (EX_USAGE); + exit (EX_BADUSAGE); next_arg++; break; @@ -814,7 +834,7 @@ parse_shell_options (argv, arg_start, arg_end) { report_error ("%c%c: invalid option", on_or_off, arg_character); show_shell_usage (stderr, 0); - exit (EX_USAGE); + exit (EX_BADUSAGE); } } } @@ -929,7 +949,7 @@ run_startup_files () /* get the rshd/sshd case out of the way first. */ if (interactive_shell == 0 && no_rc == 0 && login_shell == 0 && - act_like_sh == 0 && local_pending_command) + act_like_sh == 0 && command_execution_string) { #ifdef SSH_SOURCE_BASHRC run_by_ssh = (find_variable ("SSH_CLIENT") != (SHELL_VAR *)0) || @@ -1082,6 +1102,8 @@ maybe_make_restricted (name) char *temp; temp = base_pathname (name); + if (*temp == '-') + temp++; if (restricted || (STREQ (temp, RESTRICTED_SHELL_NAME))) { set_var_read_only ("PATH"); @@ -1144,6 +1166,7 @@ run_wordexp (words) /* Some kind of throw to top_level has occured. */ case FORCE_EOF: return last_command_exit_value = 127; + case ERREXIT: case EXITPROG: return last_command_exit_value; case DISCARD: @@ -1217,6 +1240,7 @@ run_one_command (command) /* Some kind of throw to top_level has occured. */ case FORCE_EOF: return last_command_exit_value = 127; + case ERREXIT: case EXITPROG: return last_command_exit_value; case DISCARD: @@ -1250,9 +1274,13 @@ bind_args (argv, arg_start, arg_end, start_index) FREE (dollar_vars[0]); dollar_vars[0] = savestring (args->word->word); remember_args (args->next, 1); + push_args (args->next); /* BASH_ARGV and BASH_ARGC */ } else /* bind to $1...$n for shell script */ - remember_args (args, 1); + { + remember_args (args, 1); + push_args (args); /* BASH_ARGV and BASH_ARGC */ + } dispose_words (args); } @@ -1264,6 +1292,23 @@ void unbind_args () { remember_args ((WORD_LIST *)NULL, 1); + pop_args (); /* Reset BASH_ARGV and BASH_ARGC */ +} + +static void +start_debugger () +{ +#if defined (DEBUGGER) && defined (DEBUGGER_START_FILE) + int old_errexit; + + old_errexit = exit_immediately_on_error; + exit_immediately_on_error = 0; + + maybe_execute_file (DEBUGGER_START_FILE, 1); + function_trace_mode = 1; + + exit_immediately_on_error += old_errexit; +#endif } static int @@ -1271,15 +1316,34 @@ open_shell_script (script_name) char *script_name; { int fd, e, fd_is_tty; - char *filename, *path_filename; + char *filename, *path_filename, *t; char sample[80]; int sample_len; struct stat sb; +#if defined (ARRAY_VARS) + SHELL_VAR *funcname_v, *bash_source_v, *bash_lineno_v; + ARRAY *funcname_a, *bash_source_a, *bash_lineno_a; +#endif free (dollar_vars[0]); dollar_vars[0] = savestring (script_name); filename = savestring (script_name); +#if defined (ARRAY_VARS) + GET_ARRAY_FROM_VAR ("FUNCNAME", funcname_v, funcname_a); + GET_ARRAY_FROM_VAR ("BASH_SOURCE", bash_source_v, bash_source_a); + GET_ARRAY_FROM_VAR ("BASH_LINENO", bash_lineno_v, bash_lineno_a); + + array_push (bash_source_a, filename); + if (bash_lineno_a) + { + t = itos (executing_line_number ()); + array_push (bash_lineno_a, t); + free (t); + } + array_push (funcname_a, "main"); +#endif + fd = open (filename, O_RDONLY); if ((fd < 0) && (errno == ENOENT) && (absolute_program (filename) == 0)) { @@ -1706,7 +1770,7 @@ run_shopt_alist () for (i = 0; i < shopt_ind; i++) if (shopt_setopt (shopt_alist[i].word, (shopt_alist[i].token == '-')) != EXECUTION_SUCCESS) - exit (EX_USAGE); + exit (EX_BADUSAGE); free (shopt_alist); shopt_alist = 0; shopt_ind = shopt_len = 0; @@ -1,6 +1,6 @@ /* shell.h -- The data structures used by the shell */ -/* Copyright (C) 1993 Free Software Foundation, Inc. +/* Copyright (C) 1993-2002 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -40,7 +40,6 @@ #include "sig.h" #include "pathnames.h" #include "externs.h" -#include "version.h" extern int EOF_Reached; @@ -71,20 +70,22 @@ extern int EOF_Reached; #define EX_EXPFAIL 261 /* word expansion failed */ /* Flag values that control parameter pattern substitution. */ -#define MATCH_ANY 0x0 -#define MATCH_BEG 0x1 -#define MATCH_END 0x2 +#define MATCH_ANY 0x000 +#define MATCH_BEG 0x001 +#define MATCH_END 0x002 -#define MATCH_TYPEMASK 0x3 +#define MATCH_TYPEMASK 0x003 -#define MATCH_GLOBREP 0x10 -#define MATCH_QUOTED 0x20 +#define MATCH_GLOBREP 0x010 +#define MATCH_QUOTED 0x020 +#define MATCH_STARSUB 0x040 /* Some needed external declarations. */ extern char **shell_environment; extern WORD_LIST *rest_of_args; /* Generalized global variables. */ +extern int debugging_mode; extern int executing, login_shell; extern int interactive, interactive_shell; extern int startup_state; @@ -119,3 +120,44 @@ extern struct user_info current_user; #else # define USE_VAR(x) #endif + +/* Structure in which to save partial parsing state when doing things like + PROMPT_COMMAND and bash_execute_unix_command execution. */ + +typedef struct _sh_parser_state_t { + + /* parsing state */ + int parser_state; + int *token_state; + + /* input line state -- line number saved elsewhere */ + int input_line_terminator; + int eof_encountered; + +#if defined (HANDLE_MULTIBYTE) + /* Nothing right now for multibyte state, but might want something later. */ +#endif + + /* history state affecting or modified by the parser */ + int current_command_line_count; +#if defined (HISTORY) + int remember_on_history; + int history_expansion_inhibited; +#endif + + /* execution state possibly modified by the parser */ + int last_command_exit_value; +#if defined (ARRAY_VARS) + ARRAY *pipestatus; +#endif + sh_builtin_func_t *last_shell_builtin, *this_shell_builtin; + + /* flags state affecting the parser */ + int expand_aliases; + int echo_input_at_read; + +} sh_parser_state_t; + +/* Let's try declaring these here. */ +extern sh_parser_state_t *save_parser_state __P((sh_parser_state_t *)); +extern void restore_parser_state __P((sh_parser_state_t *)); @@ -51,6 +51,7 @@ #endif extern int last_command_exit_value; +extern int last_command_exit_signal; extern int return_catch_flag; extern int loop_level, continuing, breaking; extern int parse_and_execute_level, shell_initialized; @@ -343,6 +344,8 @@ throw_to_top_level () if (interrupt_state) return; + last_command_exit_signal = (last_command_exit_value > 128) ? + (last_command_exit_value - 128) : 0; last_command_exit_value |= 128; /* Run any traps set on SIGINT. */ @@ -4,7 +4,7 @@ /* ``Have a little faith, there's magic in the night. You ain't a beauty, but, hey, you're alright.'' */ -/* Copyright (C) 1987-2002 Free Software Foundation, Inc. +/* Copyright (C) 1987-2003 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -69,6 +69,8 @@ extern int errno; #define VT_ARRAYVAR 2 #define VT_ARRAYMEMBER 3 +#define VT_STARSUB 128 /* $* or ${array[*]} -- used to split */ + /* Flags for quoted_strchr */ #define ST_BACKSL 0x01 #define ST_CTLESC 0x02 @@ -79,6 +81,9 @@ extern int errno; #define EX_NOALLOC 0x01 /* just skip; don't return substring */ #define EX_VARNAME 0x02 /* variable name; for string_extract () */ +/* Flags for the `pflags' argument to param_expand() */ +#define PF_NOCOMSUB 0x01 /* Do not perform command substitution */ + /* These defs make it easier to use the editor. */ #define LBRACE '{' #define RBRACE '}' @@ -121,8 +126,9 @@ unsigned char ifs_cmap[UCHAR_MAX + 1]; unsigned char ifs_firstc; /* Extern functions and variables from different files. */ -extern int last_command_exit_value; +extern int last_command_exit_value, last_command_exit_signal; extern int subshell_environment; +extern int subshell_level; extern int eof_encountered; extern int return_catch_flag, return_catch_value; extern pid_t dollar_dollar_pid; @@ -130,11 +136,15 @@ extern int posixly_correct; extern char *this_command_name; extern struct fd_bitmap *current_fds_to_close; extern int wordexp_only; +extern int expanding_redir; /* Non-zero means to allow unmatched globbed filenames to expand to a null file. */ int allow_null_glob_expansion; +/* Non-zero means to throw an error when globbing fails to match anything. */ +int fail_glob_expansion; + #if 0 /* Variables to keep track of which words in an expanded word list (the output of expand_word_list_internal) are the result of globbing @@ -221,8 +231,10 @@ static arrayind_t array_length_reference __P((char *)); #endif static int valid_brace_expansion_word __P((char *, int)); +static int chk_atstar __P((char *, int, int *, int *)); + static char *parameter_brace_expand_word __P((char *, int, int)); -static char *parameter_brace_expand_indir __P((char *, int, int)); +static char *parameter_brace_expand_indir __P((char *, int, int, int *, int *)); static char *parameter_brace_expand_rhs __P((char *, char *, int, int, int *, int *)); static void parameter_brace_expand_error __P((char *, char *)); @@ -245,6 +257,8 @@ static WORD_LIST *expand_word_internal __P((WORD_DESC *, int, int, int *, int *) static WORD_LIST *word_list_split __P((WORD_LIST *)); +static void exp_jump_to_top_level __P((int)); + static WORD_LIST *separate_out_assignments __P((WORD_LIST *)); static WORD_LIST *glob_expand_word_list __P((WORD_LIST *, int)); #ifdef BRACE_EXPANSION @@ -989,11 +1003,19 @@ extract_delimited_string (string, sindex, opener, alt_opener, closer, flags) ADVANCE_CHAR (string, slen, i); } - if (c == 0 && nesting_level && no_longjmp_on_fatal_error == 0) + if (c == 0 && nesting_level) { - report_error ("bad substitution: no `%s' in %s", closer, string); - last_command_exit_value = EXECUTION_FAILURE; - jump_to_top_level (DISCARD); + if (no_longjmp_on_fatal_error == 0) + { + report_error ("bad substitution: no `%s' in %s", closer, string); + last_command_exit_value = EXECUTION_FAILURE; + exp_jump_to_top_level (DISCARD); + } + else + { + *sindex = i; + return (char *)NULL; + } } si = i - *sindex - len_closer + 1; @@ -1102,11 +1124,19 @@ extract_dollar_brace_string (string, sindex, quoted, flags) ADVANCE_CHAR (string, slen, i); } - if (c == 0 && nesting_level && no_longjmp_on_fatal_error == 0) + if (c == 0 && nesting_level) { - report_error ("bad substitution: no ending `}' in %s", string); - last_command_exit_value = EXECUTION_FAILURE; - jump_to_top_level (DISCARD); + if (no_longjmp_on_fatal_error == 0) + { /* { */ + report_error ("bad substitution: no ending `}' in %s", string); + last_command_exit_value = EXECUTION_FAILURE; + exp_jump_to_top_level (DISCARD); + } + else + { + *sindex = i; + return ((char *)NULL); + } } result = (flags & EX_NOALLOC) ? (char *)NULL : substring (string, *sindex, i); @@ -1357,7 +1387,8 @@ skip_to_delim (string, start, delims) /* Split STRING (length SLEN) at DELIMS, and return a WORD_LIST with the individual words. If DELIMS is NULL, the current value of $IFS is used - to split the string. SENTINEL is an index to look for. NWP, if non-NULL + to split the string, and the function follows the shell field splitting + rules. SENTINEL is an index to look for. NWP, if non-NULL, gets the number of words in the returned list. CWP, if non-NULL, gets the index of the word containing SENTINEL. Non-whitespace chars in DELIMS delimit separate fields. */ @@ -1369,7 +1400,7 @@ split_at_delims (string, slen, delims, sentinel, nwp, cwp) int sentinel; int *nwp, *cwp; { - int ts, te, i, nw, cw; + int ts, te, i, nw, cw, ifs_split; char *token, *d, *d2; WORD_LIST *ret, *tl; @@ -1383,6 +1414,7 @@ split_at_delims (string, slen, delims, sentinel, nwp, cwp) } d = (delims == 0) ? ifs_value : delims; + ifs_split = delims == 0; /* Make d2 the non-whitespace characters in delims */ d2 = 0; @@ -1399,7 +1431,9 @@ split_at_delims (string, slen, delims, sentinel, nwp, cwp) ret = (WORD_LIST *)NULL; - for (i = 0; member (string[i], d) && spctabnl(string[i]); i++) + /* Remove sequences of whitspace characters at the start of the string, as + long as those characters are delimiters. */ + for (i = 0; member (string[i], d) && spctabnl (string[i]); i++) ; if (string[i] == '\0') return (ret); @@ -1417,8 +1451,14 @@ split_at_delims (string, slen, delims, sentinel, nwp, cwp) if (ts == te && d2 && member (string[ts], d2)) { te = ts + 1; - while (member (string[te], d2)) - te++; + /* If we're using IFS splitting, the non-whitespace delimiter char + and any additional IFS whitespace delimits a field. */ + if (ifs_split) + while (member (string[te], d) && spctabnl (string[te])) + te++; + else + while (member (string[te], d2)) + te++; } token = substring (string, ts, te); @@ -1449,8 +1489,8 @@ split_at_delims (string, slen, delims, sentinel, nwp, cwp) if (string[te] == 0) break; - i = te /* + member (string[te], d) */; - while (member (string[i], d) && spctabnl(string[i])) + i = te; + while (member (string[i], d) && (ifs_split || spctabnl(string[i]))) i++; if (string[i]) @@ -1638,11 +1678,10 @@ string_list_dollar_at (list, quoted) /* This performs word splitting and quoted null character removal on STRING. */ -#if 0 -#define issep(c) ((separators)[1] ? (member ((c), separators)) : (c) == (separators)[0]) -#else -#define issep(c) ((separators)[1] ? isifs(c) : (c) == (separators)[0]) -#endif +#define issep(c) \ + (((separators)[0]) ? ((separators)[1] ? isifs(c) \ + : (c) == (separators)[0]) \ + : 0) WORD_LIST * list_string (string, separators, quoted) @@ -2313,14 +2352,13 @@ call_expand_word_internal (w, q, i, c, e) result = expand_word_internal (w, q, i, c, e); if (result == &expand_word_error || result == &expand_word_fatal) { - expand_no_split_dollar_star = 0; /* XXX */ /* By convention, each time this error is returned, w->word has already been freed (it sometimes may not be in the fatal case, but that doesn't result in a memory leak because we're going to exit in most cases). */ w->word = (char *)NULL; last_command_exit_value = EXECUTION_FAILURE; - jump_to_top_level ((result == &expand_word_error) ? DISCARD : FORCE_EOF); + exp_jump_to_top_level ((result == &expand_word_error) ? DISCARD : FORCE_EOF); /* NOTREACHED */ } else @@ -2754,7 +2792,11 @@ remove_quoted_nulls (string) { if (string[i] == CTLESC) { - i++; j++; + /* Old code had j++, but we cannot assume that i == j at this + point -- what if a CTLNUL has already been removed from the + string? We don't want to drop the CTLESC or recopy characters + that we've already copied down. */ + i++; string[j++] = CTLESC; if (i == slen) break; } @@ -3142,7 +3184,7 @@ parameter_brace_remove_pattern (varname, value, patstr, rtype, quoted) char *varname, *value, *patstr; int rtype, quoted; { - int vtype, patspec; + int vtype, patspec, starsub; char *temp1, *val, *pattern; SHELL_VAR *v; @@ -3155,6 +3197,9 @@ parameter_brace_remove_pattern (varname, value, patstr, rtype, quoted) if (vtype == -1) return ((char *)NULL); + starsub = vtype & VT_STARSUB; + vtype &= ~VT_STARSUB; + patspec = getpatspec (rtype, patstr); if (patspec == RP_LONG_LEFT || patspec == RP_LONG_RIGHT) patstr++; @@ -3499,6 +3544,7 @@ process_substitute (string, open_for_read_in_child) if (pid == 0) { reset_terminating_signals (); /* XXX */ + free_pushed_string_input (); /* Cancel traps, in trap.c. */ restore_original_signals (); setup_async_signals (); @@ -3716,7 +3762,7 @@ command_substitute (string, quoted) { pid_t pid, old_pid, old_pipeline_pgrp; char *istring; - int result, fildes[2], function_value; + int result, fildes[2], function_value, pflags, rc; istring = (char *)NULL; @@ -3743,6 +3789,9 @@ command_substitute (string, quoted) if (subst_assign_varlist == 0 || garglist == 0) maybe_make_export_env (); /* XXX */ + /* Flags to pass to parse_and_execute() */ + pflags = interactive ? SEVAL_RESETLINE : 0; + /* Pipe the output of executing STRING into the current shell. */ if (pipe (fildes) < 0) { @@ -3788,6 +3837,8 @@ command_substitute (string, quoted) { set_sigint_handler (); /* XXX */ + free_pushed_string_input (); + if (dup2 (fildes[1], 1) < 0) { sys_error ("command_substitute: cannot duplicate pipe as fd 1"); @@ -3836,14 +3887,21 @@ command_substitute (string, quoted) else function_value = 0; - if (result == EXITPROG) + if (result == ERREXIT) + exit (last_command_exit_value); + else if (result == EXITPROG) exit (last_command_exit_value); else if (result) exit (EXECUTION_FAILURE); else if (function_value) exit (return_catch_value); else - exit (parse_and_execute (string, "command substitution", SEVAL_NOHIST)); + { + subshell_level++; + rc = parse_and_execute (string, "command substitution", pflags|SEVAL_NOHIST); + subshell_level--; + exit (rc); + } } else { @@ -3866,7 +3924,7 @@ command_substitute (string, quoted) /* If last_command_exit_value > 128, then the substituted command was terminated by a signal. If that signal was SIGINT, then send SIGINT to ourselves. This will break out of loops, for instance. */ - if (last_command_exit_value == (128 + SIGINT)) + if (last_command_exit_value == (128 + SIGINT) && last_command_exit_signal == SIGINT) kill (getpid (), SIGINT); /* wait_for gives the terminal back to shell_pgrp. If some other @@ -3965,6 +4023,65 @@ valid_brace_expansion_word (name, var_is_special) return 0; } +static int +chk_atstar (name, quoted, quoted_dollar_atp, contains_dollar_at) + char *name; + int quoted; + int *quoted_dollar_atp, *contains_dollar_at; +{ + char *temp1; + + if (name == 0) + { + if (quoted_dollar_atp) + *quoted_dollar_atp = 0; + if (contains_dollar_at) + *contains_dollar_at = 0; + return 0; + } + + /* check for $@ and $* */ + if (name[0] == '@' && name[1] == 0) + { + if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && quoted_dollar_atp) + *quoted_dollar_atp = 1; + if (contains_dollar_at) + *contains_dollar_at = 1; + return 1; + } + else if (name[0] == '*' && name[1] == '\0' && quoted == 0) + { + if (contains_dollar_at) + *contains_dollar_at = 1; + return 1; + } + + /* Now check for ${array[@]} and ${array[*]} */ +#if defined (ARRAY_VARS) + else if (valid_array_reference (name)) + { + temp1 = xstrchr (name, '['); + if (temp1 && temp1[1] == '@' && temp1[2] == ']') + { + if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && quoted_dollar_atp) + *quoted_dollar_atp = 1; + if (contains_dollar_at) + *contains_dollar_at = 1; + return 1; + } /* [ */ + /* ${array[*]}, when unquoted, should be treated like ${array[@]}, + which should result in separate words even when IFS is unset. */ + if (temp1 && temp1[1] == '*' && temp1[2] == ']' && quoted == 0) + { + if (contains_dollar_at) + *contains_dollar_at = 1; + return 1; + } + } +#endif + return 0; +} + /* Parameter expand NAME, and return a new string which is the expansion, or NULL if there was no expansion. VAR_IS_SPECIAL is non-zero if NAME is one of the special variables in @@ -4032,13 +4149,15 @@ parameter_brace_expand_word (name, var_is_special, quoted) /* Expand an indirect reference to a variable: ${!NAME} expands to the value of the variable whose name is the value of NAME. */ static char * -parameter_brace_expand_indir (name, var_is_special, quoted) +parameter_brace_expand_indir (name, var_is_special, quoted, quoted_dollar_atp, contains_dollar_at) char *name; int var_is_special, quoted; + int *quoted_dollar_atp, *contains_dollar_at; { char *temp, *t; t = parameter_brace_expand_word (name, var_is_special, quoted); + chk_atstar (t, quoted, quoted_dollar_atp, contains_dollar_at); if (t == 0) return (t); temp = parameter_brace_expand_word (t, SPECIAL_VAR(t, 0), quoted); @@ -4116,6 +4235,11 @@ parameter_brace_expand_rhs (name, value, c, quoted, qdollaratp, hasdollarat) t = temp ? savestring (temp) : savestring (""); t1 = dequote_string (t); free (t); +#if defined (ARRAY_VARS) + if (valid_array_reference (name)) + assign_array_element (name, t1); + else +#endif /* ARRAY_VARS */ bind_variable (name, t1); free (t1); return (temp); @@ -4360,7 +4484,11 @@ verify_substring_values (value, substr, vtype, e1p, e2p) #if defined (ARRAY_VARS) case VT_ARRAYVAR: a = (ARRAY *)value; +#if 0 len = array_num_elements (a) + 1; +#else + len = array_num_elements (a); /* arrays index from 0 to n - 1 */ +#endif break; #endif } @@ -4420,6 +4548,8 @@ get_var_and_type (varname, value, varp, valp) /* This sets vtype to VT_VARIABLE or VT_POSPARMS */ vtype = (varname[0] == '@' || varname[0] == '*') && varname[1] == '\0'; + if (vtype == VT_POSPARMS && varname[0] == '*') + vtype |= VT_STARSUB; *varp = (SHELL_VAR *)NULL; #if defined (ARRAY_VARS) @@ -4431,6 +4561,8 @@ get_var_and_type (varname, value, varp, valp) if (ALL_ELEMENT_SUB (temp[0]) && temp[1] == ']') { vtype = VT_ARRAYVAR; + if (temp[0] == '*') + vtype |= VT_STARSUB; *valp = (char *)array_cell (v); } else @@ -4472,7 +4604,7 @@ parameter_brace_substring (varname, value, substr, quoted) int quoted; { intmax_t e1, e2; - int vtype, r; + int vtype, r, starsub; char *temp, *val, *tt; SHELL_VAR *v; @@ -4485,6 +4617,9 @@ parameter_brace_substring (varname, value, substr, quoted) if (vtype == -1) return ((char *)NULL); + starsub = vtype & VT_STARSUB; + vtype &= ~VT_STARSUB; + r = verify_substring_values (val, substr, vtype, &e1, &e2); if (r <= 0) return ((r == 0) ? &expand_param_error : (char *)NULL); @@ -4514,7 +4649,7 @@ parameter_brace_substring (varname, value, substr, quoted) break; #if defined (ARRAY_VARS) case VT_ARRAYVAR: - tt = array_subrange (array_cell (v), e1, e2, quoted); + tt = array_subrange (array_cell (v), e1, e2, starsub, quoted); if ((quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) == 0) { temp = tt ? quote_escapes (tt) : (char *)NULL; @@ -4597,11 +4732,13 @@ pat_subst (string, pat, rep, mflags) strncpy (ret + rptr, rep, replen); rptr += replen; } - if (s == e) - e++; /* avoid infinite recursion on zero-length match */ str = e; /* e == end of match */ + if (((mflags & MATCH_GLOBREP) == 0) || mtype != MATCH_ANY) break; + + if (s == e) + e++, str++; /* avoid infinite recursion on zero-length match */ } /* Now copy the unmatched portion of the input string */ @@ -4639,7 +4776,10 @@ pos_params_pat_subst (string, pat, rep, mflags) FREE (ret); } - ret = string_list ((mflags & MATCH_QUOTED) ? quote_list (save) : save); + if ((mflags & (MATCH_QUOTED|MATCH_STARSUB)) == (MATCH_QUOTED|MATCH_STARSUB)) + ret = string_list_dollar_star (quote_list (save)); + else + ret = string_list ((mflags & MATCH_QUOTED) ? quote_list (save) : save); dispose_words (save); return (ret); @@ -4654,7 +4794,7 @@ parameter_brace_patsub (varname, value, patsub, quoted) char *varname, *value, *patsub; int quoted; { - int vtype, mflags; + int vtype, mflags, starsub; char *val, *temp, *pat, *rep, *p, *lpatsub, *tt; SHELL_VAR *v; @@ -4667,6 +4807,9 @@ parameter_brace_patsub (varname, value, patsub, quoted) if (vtype == -1) return ((char *)NULL); + starsub = vtype & VT_STARSUB; + vtype &= ~VT_STARSUB; + mflags = 0; if (*patsub == '/') { @@ -4681,6 +4824,9 @@ parameter_brace_patsub (varname, value, patsub, quoted) if (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) mflags |= MATCH_QUOTED; + if (starsub) + mflags |= MATCH_STARSUB; + if (rep = quoted_strchr (lpatsub, '/', ST_BACKSL)) *rep++ = '\0'; else @@ -4911,7 +5057,7 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll *contains_dollar_at = 1; } - /* Process ${PREFIX*} expansion. */ + /* Process ${!PREFIX*} expansion. */ if (want_indir && string[sindex - 1] == RBRACE && (string[sindex - 2] == '*' || string[sindex - 2] == '@') && legal_variable_starter ((unsigned char) name[1])) @@ -4940,6 +5086,35 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll *indexp = sindex; return (temp); } + +#if defined (ARRAY_VARS) + /* Process ${!ARRAY[@]} and ${!ARRAY[*]} expansion. */ + if (want_indir && string[sindex - 1] == RBRACE && valid_array_reference (name+1)) + { + char *x, *x1; + + temp1 = savestring (name + 1); + x = array_variable_name (temp1, &x1, (int *)0); /* [ */ + FREE (x); + if (ALL_ELEMENT_SUB (x1[0]) && x1[1] == ']') + { + temp = array_keys (temp1, quoted); + if (x1[0] == '@') + { + if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && quoted_dollar_atp) + *quoted_dollar_atp = 1; + if (contains_dollar_at) + *contains_dollar_at = 1; + } + + free (temp1); + *indexp = sindex; + return (temp); + } + + free (temp1); + } +#endif /* ARRAY_VARS */ /* Make sure that NAME is valid before trying to go on. */ if (valid_brace_expansion_word (want_indir ? name + 1 : name, @@ -4950,29 +5125,13 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll } if (want_indir) - temp = parameter_brace_expand_indir (name + 1, var_is_special, quoted); + temp = parameter_brace_expand_indir (name + 1, var_is_special, quoted, quoted_dollar_atp, contains_dollar_at); else temp = parameter_brace_expand_word (name, var_is_special, quoted); #if defined (ARRAY_VARS) if (valid_array_reference (name)) - { - temp1 = xstrchr (name, '['); - if (temp1 && temp1[1] == '@' && temp1[2] == ']') - { - if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && quoted_dollar_atp) - *quoted_dollar_atp = 1; - if (contains_dollar_at) - *contains_dollar_at = 1; - } /* [ */ - /* ${array[*]}, when unquoted, should be treated like ${array[@]}, - which should result in separate words even when IFS is unset. */ - if (temp1 && temp1[1] == '*' && temp1[2] == ']' && quoted == 0) - { - if (contains_dollar_at) - *contains_dollar_at = 1; - } - } + chk_atstar (name, quoted, quoted_dollar_atp, contains_dollar_at); #endif var_is_set = temp != (char *)0; @@ -5357,7 +5516,11 @@ arithsub: } comsub: - temp1 = command_substitute (temp, quoted); + if (pflags & PF_NOCOMSUB) + /* we need zindex+1 because string[zindex] == RPAREN */ + temp1 = substring (string, *sindex, zindex+1); + else + temp1 = command_substitute (temp, quoted); FREE (temp); temp = temp1; break; @@ -5552,7 +5715,7 @@ expand_word_internal (word, quoted, isexp, contains_dollar_at, expanded_somethin state_bak = state; mblength = mbrlen (string + sindex, string_size - sindex, &state); - if (mblength == (size_t)-1 || mblength == (size_t)-2) + if (MB_INVALIDCH (mblength)) { state = state_bak; mblength = 1; @@ -5624,7 +5787,8 @@ add_string: has_dollar_at = 0; temp = param_expand (string, &sindex, quoted, expanded_something, &has_dollar_at, "ed_dollar_at, - &had_quoted_null, 0); + &had_quoted_null, + (word->flags & W_NOCOMSUB) ? PF_NOCOMSUB : 0); if (temp == &expand_param_error || temp == &expand_param_fatal) { @@ -5640,14 +5804,20 @@ add_string: case '`': /* Backquoted command substitution. */ { - sindex++; + t_index = sindex++; if (expanded_something) *expanded_something = 1; temp = string_extract (string, &sindex, "`", 0); - de_backslash (temp); - temp1 = command_substitute (temp, quoted); + if (word->flags & W_NOCOMSUB) + /* sindex + 1 because string[sindex] == '`' */ + temp1 = substring (string, t_index, sindex + 1); + else + { + de_backslash (temp); + temp1 = command_substitute (temp, quoted); + } FREE (temp); temp = temp1; goto dollar_add_string; @@ -5906,7 +6076,7 @@ add_twochars: sindex--; state_bak = state; mblength = mbrlen (string + sindex, string_size - sindex, &state); - if (mblength == (size_t)-1 || mblength == (size_t)-2) + if (MB_INVALIDCH (mblength)) { state = state_bak; mblength = 1; @@ -6225,6 +6395,18 @@ word_list_split (list) * * **************************************************/ +/* Do any word-expansion-specific cleanup and jump to top_level */ +static void +exp_jump_to_top_level (v) + int v; +{ + /* Cleanup code goes here. */ + expand_no_split_dollar_star = 0; /* XXX */ + expanding_redir = 0; + + jump_to_top_level (v); +} + /* Put NLIST (which is a WORD_LIST * of only one element) at the front of ELIST, and set ELIST to the new list. */ #define PREPEND_LIST(nlist, elist) \ @@ -6408,7 +6590,7 @@ glob_expand_word_list (tlist, eflags) or directory". However, I would like to report errors like "Read failed". */ - if (GLOB_FAILED (glob_array)) + if (glob_array == 0 || GLOB_FAILED (glob_array)) { glob_array = (char **)xmalloc (sizeof (char *)); glob_array[0] = (char *)NULL; @@ -6436,6 +6618,11 @@ glob_expand_word_list (tlist, eflags) output_list = (WORD_LIST *)list_append (glob_list, output_list); PREPEND_LIST (tlist, disposables); } + else if (fail_glob_expansion != 0) + { + report_error ("no match: %s", tlist->word->word); + jump_to_top_level (DISCARD); + } else if (allow_null_glob_expansion == 0) { /* Failed glob expressions are left unchanged. */ @@ -6586,9 +6773,9 @@ shell_expand_word_list (tlist, eflags) last_command_exit_value = EXECUTION_FAILURE; if (expanded == &expand_word_error) - jump_to_top_level (DISCARD); + exp_jump_to_top_level (DISCARD); else - jump_to_top_level (FORCE_EOF); + exp_jump_to_top_level (FORCE_EOF); } /* Don't split words marked W_NOSPLIT. */ @@ -6662,9 +6849,9 @@ expand_word_list_internal (list, eflags) { last_command_exit_value = EXECUTION_FAILURE; if (interactive_shell == 0 && posixly_correct) - jump_to_top_level (FORCE_EOF); + exp_jump_to_top_level (FORCE_EOF); else - jump_to_top_level (DISCARD); + exp_jump_to_top_level (DISCARD); } } dispose_words (subst_assign_varlist); @@ -6720,9 +6907,9 @@ expand_word_list_internal (list, eflags) { last_command_exit_value = EXECUTION_FAILURE; if (interactive_shell == 0 && posixly_correct) - jump_to_top_level (FORCE_EOF); + exp_jump_to_top_level (FORCE_EOF); else - jump_to_top_level (DISCARD); + exp_jump_to_top_level (DISCARD); } } diff --git a/support/Makefile.in b/support/Makefile.in index e437c695..9aacc2f5 100644 --- a/support/Makefile.in +++ b/support/Makefile.in @@ -36,6 +36,7 @@ BUILD_DIR = @BUILD_DIR@ RM = rm -f SHELL = @MAKE_SHELL@ CC = @CC@ +CC_FOR_BUILD = @CC_FOR_BUILD@ EXEEXT = @EXEEXT@ @@ -75,9 +76,12 @@ OBJ1 = man2html.o all: man2html$(EXEEXT) man2html$(EXEEXT): $(OBJ1) - $(CC) $(CCFLAGS) $(OBJ1) -o $@ ${LIBS} + $(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) $(OBJ1) -o $@ ${LIBS} clean: - rm man2html + $(RM) man2html$(EXEEXT) + +distclean maintainer-clean mostly-clean: clean + $(RM) $(OBJ1) man2html.o: man2html.c diff --git a/support/config.guess b/support/config.guess index 56681081..9a8a4995 100755 --- a/support/config.guess +++ b/support/config.guess @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002 Free Software Foundation, Inc. -timestamp='2002-03-20' +timestamp='2002-11-30' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -88,40 +88,47 @@ if test $# != 0; then exit 1 fi +trap 'exit 1' 1 2 15 -dummy=dummy-$$ -trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. -# CC_FOR_BUILD -- compiler used by this script. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. -set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int dummy(){}" > $dummy.c ; +# This shell variable is my proudest work .. or something. --bje + +set_cc_for_build='tmpdir=${TMPDIR-/tmp}/config-guess-$$ ; +(old=`umask` && umask 077 && mkdir $tmpdir && umask $old && unset old) + || (echo "$me: cannot create $tmpdir" >&2 && exit 1) ; +dummy=$tmpdir/dummy ; +files="$dummy.c $dummy.o $dummy.rel $dummy" ; +trap '"'"'rm -f $files; rmdir $tmpdir; exit 1'"'"' 1 2 15 ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do - ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; - if test $? = 0 ; then + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; - rm -f $dummy.c $dummy.o $dummy.rel ; + rm -f $files ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac' +esac ; +unset files' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH -elif (test -f /usr/5bin/uname) >/dev/null 2>&1 ; then # bash - PATH=$PATH:/usr/5bin fi -UNAME=`(uname) 2>/dev/null` || UNAME=unknown # bash UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown @@ -130,61 +137,6 @@ UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - # NOTE -- begin cases added for bash (mostly legacy) -- NOTE - mac68k:machten:*:*) - echo mac68k-apple-machten${UNAME_RELEASE} - exit 0 ;; - concurrent*:*:*:*) - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo concurrent-concurrent-sysv3 - else - echo concurrent-concurrent-bsd - fi - exit 0 ;; - ppc*:SunOS:5.*:*) - echo ppc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sparc:UNIX_SV:4.*:*) - echo sparc-unknown-sysv${UNAME_RELEASE} - exit 0 ;; - mips:UNIX_SV:4.*:*) - echo mips-mips-sysv${UNAME_RELEASE} - exit 0 ;; - mips:OSF*1:*:*) - echo mips-mips-osf1 - exit 0 ;; - mips:4.4BSD:*:*) - echo mips-mips-bsd4.4 - exit 0 ;; - MIS*:SMP_DC.OSx:*:dcosx) # not the same as below - echo pyramid-pyramid-sysv4 - exit 0 ;; - news*:NEWS*:*:*) - echo mips-sony-newsos${UNAME_RELEASE} - exit 0 ;; - *370:AIX:*:*) - echo ibm370-ibm-aix${UNAME_RELEASE} - exit 0 ;; - ksr1:OSF*1:*:*) - echo ksr1-ksr-osf1 - exit 0 ;; - esa:OSF*1:*:* | ESA:OSF*:*:*) - echo esa-ibm-osf1 - exit 0 ;; - DNP*:DNIX:*:*) - echo m68k-dnix-sysv - exit 0 ;; - *3b2*:*:*:*) - echo we32k-att-sysv3 - exit 0 ;; - Alpha*:Windows_NT:*:SP*) - echo alpha-pc-opennt - exit 0 ;; - *:Windows_NT:*:SP*) - echo i386-pc-opennt - exit 0 ;; - - # NOTE -- end legacy cases added for bash -- NOTE *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, @@ -200,6 +152,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; @@ -225,7 +178,18 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ;; esac # The OS release - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. @@ -264,9 +228,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in sun3:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - vax:OpenBSD:*:*) # bash - echo vax-dec-openbsd${UNAME_RELEASE} - exit 0 ;; wgrisc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -281,6 +242,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. + eval $set_cc_for_build cat <<EOF >$dummy.s .data \$Lformat: @@ -306,10 +268,9 @@ main: jsr \$26,exit .end main EOF - eval $set_cc_for_build - $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + $CC_FOR_BUILD -o $dummy $dummy.s 2>/dev/null if test "$?" = 0 ; then - case `./$dummy` in + case `$dummy` in 0-0) UNAME_MACHINE="alpha" ;; @@ -331,9 +292,12 @@ EOF 2-1307) UNAME_MACHINE="alphaev68" ;; + 3-1307) + UNAME_MACHINE="alphaev7" + ;; esac fi - rm -f $dummy.s $dummy + rm -f $dummy.s $dummy && rmdir $tmpdir echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; Alpha\ *:Windows_NT*:*) @@ -374,6 +338,10 @@ EOF NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; + DRS?6000:UNIX_SV:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7 && exit 0 ;; + esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; @@ -480,15 +448,21 @@ EOF exit (-1); } EOF - $CC_FOR_BUILD $dummy.c -o $dummy \ - && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && rm -f $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy + $CC_FOR_BUILD -o $dummy $dummy.c \ + && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 + rm -f $dummy.c $dummy && rmdir $tmpdir echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit 0 ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit 0 ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; @@ -561,8 +535,8 @@ EOF exit(0); } EOF - $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy + $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 + rm -f $dummy.c $dummy && rmdir $tmpdir echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 @@ -660,9 +634,9 @@ EOF exit (0); } EOF - (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`./$dummy` + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi - rm -f $dummy.c $dummy + rm -f $dummy.c $dummy && rmdir $tmpdir fi ;; esac echo ${HP_ARCH}-hp-hpux${HPUX_REV} @@ -698,8 +672,8 @@ EOF exit (0); } EOF - $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy + $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 + rm -f $dummy.c $dummy && rmdir $tmpdir echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) @@ -781,8 +755,23 @@ EOF *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; + amd64:FreeBSD:*:*) + echo x86_64-unknown-freebsd + exit 0 ;; *:FreeBSD:*:*) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + # Determine whether the default compiler uses glibc. + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <features.h> + #if __GLIBC__ >= 2 + LIBC=gnu + #else + LIBC= + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + rm -f $dummy.c && rmdir $tmpdir + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin @@ -794,13 +783,16 @@ EOF echo ${UNAME_MACHINE}-pc-pw32 exit 0 ;; x86:Interix*:3*) - echo i386-pc-interix3 + echo i586-pc-interix3 + exit 0 ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks exit 0 ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? - echo i386-pc-interix + echo i586-pc-interix exit 0 ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin @@ -843,8 +835,28 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - rm -f $dummy.c - test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0 + rm -f $dummy.c && rmdir $tmpdir + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + rm -f $dummy.c && rmdir $tmpdir + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu @@ -906,7 +918,7 @@ EOF ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit 0 ;; + exit 0 ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; @@ -939,7 +951,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - rm -f $dummy.c + rm -f $dummy.c && rmdir $tmpdir test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; @@ -957,6 +969,23 @@ EOF # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit 0 ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit 0 ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then @@ -978,22 +1007,19 @@ EOF UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` echo ${UNAME_MACHINE}-pc-isc$UNAME_REL elif /bin/uname -X 2>/dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` - (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 - (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 - (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit 0 ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about @@ -1017,9 +1043,15 @@ EOF # "miniframe" echo m68010-convergent-sysv exit 0 ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit 0 ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0) + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` @@ -1036,9 +1068,6 @@ EOF mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; @@ -1110,6 +1139,9 @@ EOF SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit 0 ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit 0 ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit 0 ;; @@ -1130,7 +1162,7 @@ EOF *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; - NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*) + NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; *:NonStop-UX:*:*) @@ -1153,11 +1185,6 @@ EOF fi echo ${UNAME_MACHINE}-unknown-plan9 exit 0 ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit 0 ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit 0 ;; @@ -1176,12 +1203,6 @@ EOF *:ITS:*:*) echo pdp10-unknown-its exit 0 ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit 0 ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 @@ -1302,8 +1323,8 @@ main () } EOF -$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 -rm -f $dummy.c $dummy +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 +rm -f $dummy.c $dummy && rmdir $tmpdir # Apollos put the system type in the environment. @@ -1335,17 +1356,6 @@ then esac fi -# NOTE -- Begin fallback cases added for bash -- NOTE -case "$UNAME" in -uts) echo uts-amdahl-sysv${UNAME_RELEASE}; exit 0 ;; -esac - -if [ -f /bin/fxc.info ]; then - echo fxc-alliant-concentrix - exit 0 -fi -# NOTE -- End fallback cases added for bash -- NOTE - cat >&2 <<EOF $0: unable to guess system type diff --git a/support/config.sub b/support/config.sub index 538dc098..aefb7e15 100644..100755 --- a/support/config.sub +++ b/support/config.sub @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002 Free Software Foundation, Inc. -timestamp='2002-03-07' +timestamp='2002-11-30' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -118,7 +118,7 @@ esac # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*) + nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; @@ -229,24 +229,34 @@ case $basic_machine in | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ - | c4x | clipper \ - | d10v | d30v | dsp16xx \ - | fr30 \ + | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ + | ip2k \ | m32r | m68000 | m68k | m88k | mcore \ - | mips | mips16 | mips64 | mips64el | mips64orion | mips64orionel \ - | mips64vr4100 | mips64vr4100el | mips64vr4300 \ - | mips64vr4300el | mips64vr5000 | mips64vr5000el \ - | mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \ - | mipsisa32 | mipsisa64 \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mipsisa32 | mipsisa32el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | ns16k | ns32k \ | openrisc | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ - | sh | sh[34] | sh[34]eb | shbe | shle | sh64 \ + | sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ | strongarm \ | tahoe | thumb | tic80 | tron \ @@ -267,7 +277,7 @@ case $basic_machine in # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) + i*86 | x86_64 | amd64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. @@ -281,34 +291,46 @@ case $basic_machine in | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ - | arm-* | armbe-* | armle-* | armv*-* \ + | amd64-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* \ | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c54x-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* \ | clipper-* | cydra-* \ - | d10v-* | d30v-* \ + | d10v-* | d30v-* | dlx-* \ | elxsi-* \ - | f30[01]-* | f700-* | fr30-* | fx80-* \ + | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* \ | m32r-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | mcore-* \ - | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \ - | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \ - | mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39 | mipstx39el \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ - | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* | sh64-* \ + | sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ + | tahoe-* | thumb-* | tic30-* | tic4x-* | tic54x-* | tic80-* | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ @@ -316,14 +338,6 @@ case $basic_machine in | ymp-* \ | z8k-*) ;; - - # NOTE -- BEGIN cases added for Bash -- NOTE - butterfly-bbn* | cadmus-* | ews*-nec | masscomp-masscomp \ - | tandem-* | symmetric-* | drs6000-icl | *-*ardent | concurrent-* \ - | ksr1-* | esa-ibm | fxc-alliant | *370-amdahl | sx[45]*-nec ) - ;; - # NOTE -- END cases added for Bash -- NOTE - # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) @@ -457,7 +471,7 @@ case $basic_machine in basic_machine=elxsi-elxsi os=-bsd ;; - encore | umax | mmax | multimax) # bash + encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) @@ -498,9 +512,6 @@ case $basic_machine in basic_machine=m88k-harris os=-sysv3 ;; - hbullx20-bull) - basic_machine=m68k-bull # bash - ;; hp300-*) basic_machine=m68k-hp ;; @@ -552,9 +563,6 @@ case $basic_machine in basic_machine=hppa1.1-hp os=-proelf ;; - ibm032-*) - basic_machine=ibmrt-ibm # bash - ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; @@ -575,14 +583,6 @@ case $basic_machine in basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; - i386-go32) - basic_machine=i386-pc # bash - os=-go32 - ;; - i386-mingw32) - basic_machine=i386-pc # bash - os=-mingw32 - ;; i386mach) basic_machine=i386-mach os=-mach @@ -605,12 +605,9 @@ case $basic_machine in basic_machine=m68k-isi os=-sysv ;; - luna88k-omron* | m88k-omron*) # bash + m88k-omron*) basic_machine=m88k-omron ;; - magicstation*) - basic_machine=magicstation-unknown # bash - ;; magnum | m3230) basic_machine=mips-mips os=-sysv @@ -723,10 +720,6 @@ case $basic_machine in nsr-tandem) basic_machine=nsr-tandem ;; - odt | odt3 | odt4) # SCO Open Desktop - basic_machine=i386-pc # bash - os=-sco3.2v4 - ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf @@ -739,10 +732,6 @@ case $basic_machine in basic_machine=m68000-ericsson os=-ose ;; - osr5 | sco5) # SCO Open Server - basic_machine=i386-pc # bash - os=-sco3.2v5 - ;; os68k) basic_machine=m68k-none os=-os68k @@ -761,13 +750,13 @@ case $basic_machine in pbb) basic_machine=m68k-tti ;; - pc532 | pc532-*) + pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; - pentiumpro | p6 | 6x86 | athlon) + pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2) @@ -788,22 +777,22 @@ case $basic_machine in power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown - ;; + ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown - ;; + ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown - ;; + ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown - ;; + ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; @@ -834,6 +823,12 @@ case $basic_machine in basic_machine=a29k-amd os=-udi ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; sequent) basic_machine=i386-sequent ;; @@ -899,7 +894,7 @@ case $basic_machine in sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; - sv1) + sv1) basic_machine=sv1-cray os=-unicos ;; @@ -919,6 +914,10 @@ case $basic_machine in basic_machine=t90-cray os=-unicos ;; + tic4x | c4x*) + basic_machine=tic4x-unknown + os=-coff + ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff @@ -944,14 +943,6 @@ case $basic_machine in basic_machine=a29k-nyu os=-sym1 ;; - uw2 | unixware | unixware2) # bash - basic_machine=i386-pc - os=-sysv4.2uw2.1 - ;; - uw7 | unixware7) # bash - basic_machine=i386-pc - os=-sysv5uw7 - ;; v810 | necv810) basic_machine=v810-nec os=-none @@ -965,8 +956,8 @@ case $basic_machine in os=-vms ;; vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; + basic_machine=f301-fujitsu + ;; vxworks960) basic_machine=i960-wrs os=-vxworks @@ -987,11 +978,7 @@ case $basic_machine in basic_machine=hppa1.1-winbond os=-proelf ;; - windows32) - basic_machine=i386-pc - os=-windows32-msvcrt - ;; - xps | xps100) + xps | xps100) basic_machine=xps100-honeywell ;; ymp) @@ -1037,7 +1024,7 @@ case $basic_machine in we32k) basic_machine=we32k-att ;; - sh3 | sh4 | sh3eb | sh4eb) + sh3 | sh4 | sh3eb | sh4eb | sh[1234]le | sh3ele) basic_machine=sh-unknown ;; sh64) @@ -1046,7 +1033,7 @@ case $basic_machine in sparc | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; - cydra) + cydra) basic_machine=cydra-cydrome ;; orion) @@ -1061,10 +1048,6 @@ case $basic_machine in pmac | pmac-mpw) basic_machine=powerpc-apple ;; - c4x*) - basic_machine=c4x-none - os=-coff - ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; @@ -1103,9 +1086,6 @@ case $os in -svr4*) os=-sysv4 ;; - -unixware7*) # bash - os=-sysv5uw7 - ;; -unixware*) os=-sysv4.2uw ;; @@ -1130,17 +1110,14 @@ case $os in | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova*) + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix*) # Remember, each alternative MUST END IN *, to match a version number. ;; - # NOTE -- BEGIN CASES ADDED FOR Bash -- NOTE - -powerux* | -superux*) - ;; - # NOTE -- END CASES ADDED FOR Bash -- NOTE -qnx*) case $basic_machine in x86-* | i*86-*) @@ -1150,8 +1127,10 @@ case $os in ;; esac ;; + -nto-qnx*) + ;; -nto*) - os=-nto-qnx + os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ @@ -1203,7 +1182,7 @@ case $os in os=-rtmk-nova ;; -ns2 ) - os=-nextstep2 + os=-nextstep2 ;; -nsk*) os=-nsk @@ -1230,9 +1209,6 @@ case $os in -sysvr4) os=-sysv4 ;; - -sysvr5) # bash - os=-sysv5 - ;; # This must come after -sysvr4. -sysv*) ;; @@ -1245,8 +1221,8 @@ case $os in -xenix) os=-xenix ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint ;; -none) ;; @@ -1283,7 +1259,7 @@ case $basic_machine in pdp10-*) os=-tops20 ;; - pdp11-*) + pdp11-*) os=-none ;; *-dec | vax-*) @@ -1376,19 +1352,19 @@ case $basic_machine in *-next) os=-nextstep3 ;; - *-gould) + *-gould) os=-sysv ;; - *-highlevel) + *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; - *-sgi) + *-sgi) os=-irix ;; - *-siemens) + *-siemens) os=-sysv4 ;; *-masscomp) @@ -1427,9 +1403,6 @@ case $basic_machine in -sunos*) vendor=sun ;; - -lynxos*) # bash - vendor=lynx - ;; -aix*) vendor=ibm ;; @@ -1463,7 +1436,7 @@ case $basic_machine in -ptx*) vendor=sequent ;; - -vxsim* | -vxworks*) + -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) diff --git a/support/mksignames.c b/support/mksignames.c index 798a9a40..c395e339 100644 --- a/support/mksignames.c +++ b/support/mksignames.c @@ -1,7 +1,7 @@ /* signames.c -- Create and write `signames.h', which contains an array of signal names. */ -/* Copyright (C) 1992 Free Software Foundation, Inc. +/* Copyright (C) 1992-2003 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -39,10 +39,11 @@ * EXIT == 0 * DEBUG == NSIG * ERR == NSIG+1 + * RETURN == NSIG+2 */ -#define LASTSIG NSIG+1 +#define LASTSIG NSIG+2 -char *signal_names[2 * NSIG + 3]; +char *signal_names[2 * (LASTSIG)]; #define signal_names_size (sizeof(signal_names)/sizeof(signal_names[0])) @@ -369,6 +370,7 @@ initialize_signames () signal_names[NSIG] = "DEBUG"; signal_names[NSIG+1] = "ERR"; + signal_names[NSIG+2] = "RETURN"; } void @@ -382,7 +384,7 @@ write_signames (stream) fprintf (stream, " Do not edit. Edit support/mksignames.c instead. */\n\n"); fprintf (stream, "/* A translation list so we can be polite to our users. */\n"); - fprintf (stream, "char *signal_names[NSIG + 3] = {\n"); + fprintf (stream, "char *signal_names[NSIG + 4] = {\n"); for (i = 0; i <= LASTSIG; i++) fprintf (stream, " \"%s\",\n", signal_names[i]); diff --git a/support/mkversion.sh b/support/mkversion.sh index 509a4548..a42eb780 100755 --- a/support/mkversion.sh +++ b/support/mkversion.sh @@ -147,10 +147,10 @@ echo "/* A version string for use by sccs and the what command. */" echo "#define SCCSVERSION \"@(#)Bash version ${sccs_string}\"" # extern function declarations -echo -echo '/* Functions from version.c. */' -echo 'extern char *shell_version_string __P((void));' -echo 'extern void show_shell_version __P((int));' +#echo +#echo '/* Functions from version.c. */' +#echo 'extern char *shell_version_string __P((void));' +#echo 'extern void show_shell_version __P((int));' if [ -n "$inc_build" ]; then # Make sure we can write to .build diff --git a/support/shobj-conf b/support/shobj-conf index 6bd7fb12..3df73e16 100755 --- a/support/shobj-conf +++ b/support/shobj-conf @@ -97,7 +97,7 @@ sunos5*|solaris2*) ;; # All versions of Linux or the semi-mythical GNU Hurd. -linux*|gnu*) +linux*-*|gnu*-*|k*bsd*-gnu-*) SHOBJ_CFLAGS=-fPIC SHOBJ_LD='${CC}' SHOBJ_LDFLAGS='-shared -Wl,-soname,$@' @@ -138,9 +138,9 @@ darwin*|macosx*) SHOBJ_STATUS=unsupported SHLIB_STATUS=supported - SHOBJ_CFLAGS='-dynamic -fno-common' + SHOBJ_CFLAGS='-fno-common' - SHOBJ_LD=/usr/bin/libtool + SHOBJ_LD='${CC}' SHLIB_LIBVERSION='$(SHLIB_MAJOR)$(SHLIB_MINOR).$(SHLIB_LIBSUFF)' SHLIB_LIBSUFF='dylib' @@ -148,7 +148,7 @@ darwin*|macosx*) SHOBJ_LDFLAGS='-dynamic' SHLIB_XLDFLAGS='-arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v' - SHLIB_LIBS='-lSystem' + SHLIB_LIBS='-lncurses' # see if -lcurses works on MacOS X 10.1 ;; openbsd*) @@ -296,6 +296,8 @@ hpux10*-*gcc*) # must use gcc; the bundled cc cannot compile PIC code SHOBJ_CFLAGS='-fpic' SHOBJ_LD='${CC}' + # if you have problems linking here, moving the `-Wl,+h,$@' from + # SHLIB_XLDFLAGS to SHOBJ_LDFLAGS has been reported to work SHOBJ_LDFLAGS='-shared -Wl,-b -Wl,+s' SHLIB_XLDFLAGS='-Wl,+h,$@ -Wl,+b,$(libdir)' diff --git a/support/texi2dvi b/support/texi2dvi index 5439e081..010b586b 100755 --- a/support/texi2dvi +++ b/support/texi2dvi @@ -1,8 +1,9 @@ #! /bin/sh # texi2dvi --- produce DVI (or PDF) files from Texinfo (or LaTeX) sources. -# $Id: texi2dvi,v 0.43 1999/09/28 19:36:53 karl Exp $ +# $Id: texi2dvi,v 1.14 2003/02/05 00:42:33 karl Exp $ # -# Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99 Free Software Foundation, Inc. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, +# 2002, 2003 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 @@ -26,12 +27,12 @@ # the `--debug' option when making a bug report. # This string is expanded by rcs automatically when this file is checked out. -rcs_revision='$Revision: 0.43 $' +rcs_revision='$Revision: 1.14 $' rcs_version=`set - $rcs_revision; echo $2` program=`echo $0 | sed -e 's!.*/!!'` -version="texi2dvi (GNU Texinfo 4.0) $rcs_version +version="texi2dvi (GNU Texinfo 4.5) $rcs_version -Copyright (C) 1999 Free Software Foundation, Inc. +Copyright (C) 2003 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." @@ -46,46 +47,52 @@ is used to determine its language (LaTeX or Texinfo). Makeinfo is used to perform Texinfo macro expansion before running TeX when needed. -Options: - -@ Use @input instead of \input; for preloaded Texinfo. - -b, --batch No interaction. - -c, --clean Remove all auxiliary files. - -D, --debug Turn on shell debugging (set -x). - -e, --expand Force macro expansion using makeinfo. - -I DIR Search DIR for Texinfo files. - -h, --help Display this help and exit successfully. - -l, --language=LANG Specify the LANG of FILE: LaTeX or Texinfo. - -p, --pdf Use pdftex or pdflatex for processing. - -q, --quiet No output unless errors (implies --batch). - -s, --silent Same as --quiet. - -t, --texinfo=CMD Insert CMD after @setfilename in copy of input file. - Multiple values accumulate. - -v, --version Display version information and exit successfully. - -V, --verbose Report on what is done. +Operation modes: + -b, --batch no interaction + -c, --clean remove all auxiliary files + -D, --debug turn on shell debugging (set -x) + -h, --help display this help and exit successfully + -o, --output=OFILE leave output in OFILE (implies --clean); + Only one input FILE may be specified in this case + -q, --quiet no output unless errors (implies --batch) + -s, --silent same as --quiet + -v, --version display version information and exit successfully + -V, --verbose report on what is done + +TeX tuning: + -@ use @input instead of \input; for preloaded Texinfo + -e, -E, --expand force macro expansion using makeinfo + -I DIR search DIR for Texinfo files + -l, --language=LANG specify the LANG of FILE (LaTeX or Texinfo) + -p, --pdf use pdftex or pdflatex for processing + -t, --texinfo=CMD insert CMD after @setfilename in copy of input file + multiple values accumulate The values of the BIBTEX, LATEX (or PDFLATEX), MAKEINDEX, MAKEINFO, TEX (or PDFTEX), and TEXINDEX environment variables are used to run those commands, if they are set. Email bug reports to <bug-texinfo@gnu.org>, -general questions and discussion to <help-texinfo@gnu.org>." +general questions and discussion to <help-texinfo@gnu.org>. +Texinfo home page: http://www.gnu.org/software/texinfo/" # Initialize variables for option overriding and otherwise. # Don't use `unset' since old bourne shells don't have this command. # Instead, assign them an empty value. -escape='\' batch=false # eval for batch mode clean= debug= +escape='\' expand= # t for expansion via makeinfo +miincludes= # makeinfo include path oformat=dvi +oname= # --output +quiet= # by default let the tools' message be displayed set_language= -miincludes= # makeinfo include path textra= tmpdir=${TMPDIR:-/tmp}/t2d$$ # avoid collisions on 8.3 filesystems. -txincludes= # TEXINPUTS extensions +txincludes= # TEXINPUTS extensions, with trailing colon txiprereq=19990129 # minimum texinfo.tex version to have macro expansion -quiet= # by default let the tools' message be displayed verbose=false # echo for verbose mode orig_pwd=`pwd` @@ -98,6 +105,12 @@ else path_sep=":" fi +# Pacify verbose cds. +CDPATH=${ZSH_VERSION+.}$path_sep + +# In case someone crazy insists on using grep -E. +: ${EGREP=egrep} + # Save this so we can construct a new TEXINPUTS path for each file. TEXINPUTS_orig="$TEXINPUTS" # Unfortunately makeindex does not read TEXINPUTS. @@ -136,14 +149,21 @@ while test x"$1" != x"$arg_sep"; do -q | -s | --q* | --s*) quiet=t; batch=eval;; -c | --c*) clean=t;; -D | --d*) debug=t;; - -e | --e*) expand=t;; + -e | -E | --e*) expand=t;; -h | --h*) echo "$usage"; exit 0;; -I | --I*) shift miincludes="$miincludes -I $1" - txincludes="$txincludes$path_sep$1" + txincludes="$txincludes$1$path_sep" ;; -l | --l*) shift; set_language=$1;; + -o | --o*) + shift + clean=t + case "$1" in + /* | ?:/*) oname=$1;; + *) oname="$orig_pwd/$1";; + esac;; -p | --p*) oformat=pdf;; -t | --t*) shift; textra="$textra\\ $1";; @@ -168,11 +188,20 @@ done shift # Interpret remaining command line args as filenames. -if test $# = 0; then +case $# in + 0) echo "$0: Missing file arguments." >&2 echo "$0: Try \`--help' for more information." >&2 exit 2 -fi + ;; + 1) ;; + *) + if test -n "$oname"; then + echo "$0: Can't use option \`--output' with more than one argument." >&2 + exit 2 + fi + ;; +esac # Prepare the temporary directory. Remove it at exit, unless debugging. if test -z "$debug"; then @@ -205,14 +234,23 @@ cat <<EOF >$comment_iftex_sed s/^@c texi2dvi// } } -/^@html/,/^@end html/d -/^@ifhtml/,/^@end ifhtml/d -/^@ifnottex/,/^@end ifnottex/d +/^@html/,/^@end html/{ + s/^/@c (texi2dvi)/ +} +/^@ifhtml/,/^@end ifhtml/{ + s/^/@c (texi2dvi)/ +} +/^@ifnottex/,/^@end ifnottex/{ + s/^/@c (texi2dvi)/ +} /^@ifinfo/,/^@end ifinfo/{ /^@node/p /^@menu/,/^@end menu/p - d + t + s/^/@c (texi2dvi)/ } +s/^@ifnotinfo/@c texi2dvi@ifnotinfo/ +s/^@end ifnotinfo/@c texi2dvi@end ifnotinfo/ EOF # Uncommenting is simple: Remove any leading `@c texi2dvi'. uncomment_iftex_sed=$utildir/uncomment.sed @@ -230,7 +268,7 @@ cat <<\EOF >$get_xref_files # Get list of xref files (indexes, tables and lists). # Find all files having root filename with a two-letter extension, # saves the ones that are really Texinfo-related files. .?o? catches -# LaTeX tables and lists. +# many files: .toc, .log, LaTeX tables and lists, FiXme's .lox, maybe more. for this_file in "$1".?o? "$1".aux "$1".?? "$1".idx; do # If file is empty, skip it. test -s "$this_file" || continue @@ -273,7 +311,7 @@ for command_line_filename in ${1+"$@"}; do # If the COMMAND_LINE_FILENAME is not absolute (e.g., --debug.tex), # prepend `./' in order to avoid that the tools take it as an option. - echo "$command_line_filename" | egrep '^(/|[A-z]:/)' >/dev/null \ + echo "$command_line_filename" | $EGREP '^(/|[A-z]:/)' >/dev/null \ || command_line_filename="./$command_line_filename" # See if the file exists. If it doesn't we're in trouble since, even @@ -314,22 +352,67 @@ for command_line_filename in ${1+"$@"}; do # Make all those directories and give up if we can't succeed. mkdir $tmpdir_src $tmpdir_xtr $tmpdir_bak || exit 1 - # Source file might include additional sources. Put `.' and - # directory where source file(s) reside in TEXINPUTS before anything - # else. `.' goes first to ensure that any old .aux, .cps, + # Source file might include additional sources. + # We want `.:$orig_pwd' before anything else. (We'll add `.:' later + # after all other directories have been turned into absolute paths.) + # `.' goes first to ensure that any old .aux, .cps, # etc. files in ${directory} don't get used in preference to fresher # files in `.'. Include orig_pwd in case we are in clean mode, where # we've cd'd to a temp directory. - common=".$path_sep$orig_pwd$path_sep$filename_dir$path_sep$txincludes$path_sep" + common="$orig_pwd$path_sep$filename_dir$path_sep$txincludes" TEXINPUTS="$common$TEXINPUTS_orig" INDEXSTYLE="$common$INDEXSTYLE_orig" + # Convert relative paths to absolute paths, so we can run in another + # directory (e.g., in --clean mode, or during the macro-support + # detection.) + # + # Empty path components are meaningful to tex. We rewrite them + # as `EMPTY' so they don't get lost when we split on $path_sep. + TEXINPUTS=`echo $TEXINPUTS |sed 's/^:/EMPTY:/;s/:$/:EMPTY/;s/::/:EMPTY:/g'` + INDEXSTYLE=`echo $INDEXSTYLE |sed 's/^:/EMPTY:/;s/:$/:EMPTY/;s/::/:EMPTY:/g'` + save_IFS=$IFS + IFS=$path_sep + set x $TEXINPUTS; shift + TEXINPUTS=. + for dir + do + case $dir in + EMPTY) + TEXINPUTS=$TEXINPUTS$path_sep + ;; + [\\/]* | ?:[\\/]*) # Absolute paths don't need to be expansed. + TEXINPUTS=$TEXINPUTS$path_sep$dir + ;; + *) + abs=`cd "$dir" && pwd` && TEXINPUTS=$TEXINPUTS$path_sep$abs + ;; + esac + done + set x $INDEXSTYLE; shift + INDEXSTYLE=. + for dir + do + case $dir in + EMPTY) + INDEXSTYLE=$INDEXSTYLE$path_sep + ;; + [\\/]* | ?:[\\/]*) # Absolute paths don't need to be expansed. + INDEXSTYLE=$INDEXSTYLE$path_sep$dir + ;; + *) + abs=`cd "$dir" && pwd` && INDEXSTYLE=$INDEXSTYLE$path_sep$abs + ;; + esac + done + IFS=$save_IFS + # If the user explicitly specified the language, use that. # Otherwise, if the first line is \input texinfo, assume it's texinfo. # Otherwise, guess from the file extension. if test -n "$set_language"; then language=$set_language - elif sed 1q "$command_line_filename" | fgrep 'input texinfo' >/dev/null; then + elif sed 1q "$command_line_filename" | grep 'input texinfo' >/dev/null; then language=texinfo else language= @@ -373,9 +456,9 @@ for command_line_filename in ${1+"$@"}; do txiversion_tex=txiversion.tex echo '\input texinfo.tex @bye' >$tmpdir/$txiversion_tex # Run in the tmpdir to avoid leaving files. - eval `cd $tmpdir >/dev/null \ - && $tex $txiversion_tex 2>/dev/null \ -| sed -n 's/^.*\[\(.*\)version \(....\)-\(..\)-\(..\).*$/txiformat=\1 txiversion="\2\3\4"/p'` + eval `cd $tmpdir >/dev/null && + $tex $txiversion_tex 2>/dev/null | + sed -n 's/^.*\[\(.*\)version \(....\)-\(..\)-\(..\).*$/txiformat=\1 txiversion="\2\3\4"/p'` $verbose "texinfo.tex preloaded as \`$txiformat', version is \`$txiversion' ..." if test "$txiprereq" -le "$txiversion" >/dev/null 2>&1; then makeinfo= @@ -467,10 +550,14 @@ for command_line_filename in ${1+"$@"}; do # What we'll run texindex on -- exclude non-index files. # Since we know index files are last, it is correct to remove everything - # before .aux and .?o?. + # before .aux and .?o?. But don't really do <anything>o<anything> + # -- don't match whitespace as <anything>. + # Otherwise, if orig_xref_files contains something like + # foo.xo foo.whatever + # the space after the o will get matched. index_files=`echo "$orig_xref_files" \ | sed "s!.*\.aux!!g; - s!./$filename_noext\..o.!!g; + s!./$filename_noext\.[^ ]o[^ ]!!g; s/^[ ]*//;s/[ ]*$//"` # Run texindex (or makeindex) on current index files. If they # already exist, and after running TeX a first time the index @@ -489,8 +576,8 @@ for command_line_filename in ${1+"$@"}; do # Prevent $ESCAPE from being interpreted by the shell if it happens # to be `/'. $batch tex_args="\\${escape}nonstopmode\ \\${escape}input" - $verbose "Running $cmd ..." cmd="$tex $tex_args $filename_input" + $verbose "Running $cmd ..." if $cmd >&5; then :; else echo "$0: $tex exited with bad status, quitting." >&2 echo "$0: see $filename_noext.log for errors." >&2 @@ -508,7 +595,7 @@ for command_line_filename in ${1+"$@"}; do # subdirs, since texi2dvi does not try to compare xref files in # subdirs. Performing xref files test is still good since LaTeX # does not report changes in xref files. - if fgrep "Rerun to get" "$filename_noext.log" >/dev/null 2>&1; then + if grep "Rerun to get" "$filename_noext.log" >/dev/null 2>&1; then finished= fi @@ -550,8 +637,13 @@ for command_line_filename in ${1+"$@"}; do # - the next file is processed in correct conditions # - the temporary file can be removed if test -n "$clean"; then - $verbose "Copying $oformat file from `pwd` to $orig_pwd" - cp -p "./$filename_noext.$oformat" "$orig_pwd" + if test -n "$oname"; then + dest=$oname + else + dest=$orig_pwd + fi + $verbose "Copying $oformat file from `pwd` to $dest" + cp -p "./$filename_noext.$oformat" "$dest" cd / # in case $orig_pwd is on a different drive (for DOS) cd $orig_pwd || exit 1 fi diff --git a/support/xenix-link.sh b/support/xenix-link.sh index 58e84194..ed22a08c 100755 --- a/support/xenix-link.sh +++ b/support/xenix-link.sh @@ -36,7 +36,7 @@ rm -f bash if [ -z "$CC" ] then - if [ -f /unix -a ! -f /xenix ] + if [ -f /unix ] && [ ! -f /xenix ] then CC="cc -xenix" else @@ -64,7 +64,8 @@ #define CSUBSTOP 0x1000 /* values of OP for ${word[:]OPstuff} */ /* Defines for use by the rest of the shell. */ -extern const int sh_syntaxtab[]; +extern int sh_syntaxtab[]; +extern int sh_syntabsiz; #define shellmeta(c) (sh_syntaxtab[(unsigned char)(c)] & CSHMETA) #define shellbreak(c) (sh_syntaxtab[(unsigned char)(c)] & CSHBRK) @@ -92,4 +93,8 @@ extern const int sh_syntaxtab[]; #define CTLESC '\001' #define CTLNUL '\177' +#if !defined (HAVE_ISBLANK) && !defined (isblank) +# define isblank(x) ((x) == ' ' || (x) == '\t') +#endif + #endif /* _SYNTAX_H_ */ @@ -45,7 +45,7 @@ extern int errno; #endif /* !errno */ -#if !defined (_POSIX_VERSION) +#if !defined (_POSIX_VERSION) && defined (HAVE_SYS_FILE_H) # include <sys/file.h> #endif /* !_POSIX_VERSION */ #include "posixstat.h" diff --git a/tests/alias.right b/tests/alias.right new file mode 100644 index 00000000..53111beb --- /dev/null +++ b/tests/alias.right @@ -0,0 +1,4 @@ +alias: 0 +alias: 0 +./alias.tests: line 25: qfoo: command not found +quux diff --git a/tests/alias.tests b/tests/alias.tests new file mode 100644 index 00000000..9cfec16b --- /dev/null +++ b/tests/alias.tests @@ -0,0 +1,37 @@ +# place holder for future alias testing +shopt -s expand_aliases + +# alias/unalias tests originally in builtins.tests + +unalias -a +# this should return success, according to POSIX.2 +alias +echo alias: $? +alias foo=bar +unalias foo +# this had better return success, according to POSIX.2 +alias +echo alias: $? + +# bug in all versions through bash-2.05b + +unalias qfoo qbar qbaz quux 2>/dev/null + +alias qfoo=qbar +alias qbar=qbaz +alias qbaz=quux +alias quux=qfoo + +qfoo + +unalias qfoo qbar qbaz quux + +unalias -a + +alias foo='echo ' +alias bar=baz +alias baz=quux + +foo bar + +unalias foo bar baz diff --git a/tests/arith-for.right b/tests/arith-for.right index 0c05d981..c74baa48 100644 --- a/tests/arith-for.right +++ b/tests/arith-for.right @@ -14,39 +14,39 @@ fx is a function fx () { i=0; - for (( 1 ; i < 3 ; i++ )) + for ((1 ; i < 3 ; i++ )) do echo $i; done; - for (( i=0 ; 1 ; i++ )) + for ((i=0 ; 1 ; i++ )) do - if (( " i >= 3 " )); then + if (( i >= 3 )); then break; fi; echo $i; done; - for (( i=0 ; i<3 ; 1 )) + for ((i=0 ; i<3 ; 1)) do echo $i; - (( " i++ " )); + (( i++ )); done; i=0; - for (( 1 ; 1 ; 1 )) + for ((1 ; 1 ; 1)) do - if (( " i > 2 " )); then + if (( i > 2 )); then break; fi; echo $i; - (( " i++ " )); + (( i++ )); done; i=0; - for (( 1 ; 1 ; 1 )) + for ((1 ; 1 ; 1)) do - if (( " i > 2 " )); then + if (( i > 2 )); then break; fi; echo $i; - (( " i++ " )); + (( i++ )); done } 0 diff --git a/tests/arith.right b/tests/arith.right index 6d82f1ac..f1f854b3 100644 --- a/tests/arith.right +++ b/tests/arith.right @@ -150,3 +150,4 @@ ok 42 42 42 +./arith.tests: line 281: b[c]d: syntax error in expression (error token is "d") diff --git a/tests/arith.tests b/tests/arith.tests index ccc6e5d8..ce6a372a 100644 --- a/tests/arith.tests +++ b/tests/arith.tests @@ -276,3 +276,6 @@ echo $(( 8#$(printf "%o\n" $n) )) printf "%u\n" $n echo $(( 16#$(printf "%x\n" $n) )) echo $(( 16#$(printf "%X\n" $n) )) + +# causes longjmp botches through bash-2.05b +a[b[c]d]=e diff --git a/tests/array.right b/tests/array.right index bda49d86..084c242f 100644 --- a/tests/array.right +++ b/tests/array.right @@ -6,7 +6,12 @@ abcde abcde abcde bdef abcde bdef +declare -a BASH_ARGC='()' +declare -a BASH_ARGV='()' +declare -a BASH_LINENO='([0]="0")' +declare -a BASH_SOURCE='([0]="./array.tests")' declare -a DIRSTACK='()' +declare -a FUNCNAME='([0]="main")' declare -a a='([0]="abcde" [1]="" [2]="bdef")' declare -a b='()' declare -ar c='()' @@ -29,7 +34,12 @@ declare -ar c='()' readonly -a a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")' readonly -a c='()' a test +declare -a BASH_ARGC='()' +declare -a BASH_ARGV='()' +declare -a BASH_LINENO='([0]="0")' +declare -a BASH_SOURCE='([0]="./array.tests")' declare -a DIRSTACK='()' +declare -a FUNCNAME='([0]="main")' declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")' declare -a b='([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")' declare -ar c='()' @@ -47,7 +57,12 @@ declare -a f='([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element ./array.tests: line 109: []=abcde: bad array subscript ./array.tests: line 109: [*]=last: cannot assign to non-numeric index ./array.tests: line 109: [-65]=negative: bad array subscript +declare -a BASH_ARGC='()' +declare -a BASH_ARGV='()' +declare -a BASH_LINENO='([0]="0")' +declare -a BASH_SOURCE='([0]="./array.tests")' declare -a DIRSTACK='()' +declare -a FUNCNAME='([0]="main")' declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")' declare -a b='([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")' declare -ar c='()' @@ -59,7 +74,12 @@ this of this is a test of read using arrays this test this is a test of arrays +declare -a BASH_ARGC='()' +declare -a BASH_ARGV='()' +declare -a BASH_LINENO='([0]="0")' +declare -a BASH_SOURCE='([0]="./array.tests")' declare -a DIRSTACK='()' +declare -a FUNCNAME='([0]="main")' declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")' declare -a b='([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")' declare -ar c='()' @@ -127,3 +147,16 @@ abc case if then else 5 case 4 case if then else 5 case if then else 5 +argv[1] = <0> +argv[2] = <1> +argv[3] = <4> +argv[4] = <10> +argv[1] = <0> +argv[2] = <1> +argv[3] = <4> +argv[4] = <10> +argv[1] = <0> +argv[2] = <1> +argv[3] = <4> +argv[4] = <10> +argv[1] = <0 1 4 10> diff --git a/tests/array.tests b/tests/array.tests index afa7556a..b38b91cf 100644 --- a/tests/array.tests +++ b/tests/array.tests @@ -289,3 +289,14 @@ echo ${foo[0]} ${#foo[0]} echo ${foo[1]} ${#foo[1]} echo ${foo[@]} ${#foo[@]} echo ${foo[*]} ${#foo[*]} + +# new expansions added after bash-2.05b +x[0]=zero +x[1]=one +x[4]=four +x[10]=ten + +recho ${!x[@]} +recho "${!x[@]}" +recho ${!x[*]} +recho "${!x[*]}" diff --git a/tests/braces.right b/tests/braces.right index d35e08d0..006f2c2d 100644 --- a/tests/braces.right +++ b/tests/braces.right @@ -17,3 +17,22 @@ abcd{efgh foo 1 2 bar foo 1 2 bar foo 1 2 bar +1 2 3 4 5 6 7 8 9 10 +0..10 braces +0 1 2 3 4 5 6 7 8 9 10 braces +x0y x1y x2y x3y x4y x5y x6y x7y x8y x9y x10y xbracesy +3 +x3y +10 9 8 7 6 5 4 3 2 1 +10y 9y 8y 7y 6y 5y 4y 3y 2y 1y +x10y x9y x8y x7y x6y x5y x4y x3y x2y x1y +a b c d e f +f e d c b a +a _ ^ ] [ Z Y X W V U T S R Q P O N M L K J I H G F E D C B A +A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ ] ^ _ a +f +{1..f} +{f..1} +01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 +-1 -2 -3 -4 -5 -6 -7 -8 -9 -10 +-20 -19 -18 -17 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 diff --git a/tests/braces.tests b/tests/braces.tests new file mode 100644 index 00000000..b9ae1806 --- /dev/null +++ b/tests/braces.tests @@ -0,0 +1,57 @@ +echo ff{c,b,a} +echo f{d,e,f}g +echo {l,n,m}xyz +echo {abc\,def} +echo {abc} + +echo \{a,b,c,d,e} +echo {x,y,\{a,b,c}} +echo {x\,y,\{abc\},trie} + +echo /usr/{ucb/{ex,edit},lib/{ex,how_ex}} + +echo XXXX\{`echo a b c | tr ' ' ','`\} +eval echo XXXX\{`echo a b c | tr ' ' ','`\} + +echo {} +echo { } +echo } +echo { +echo abcd{efgh + +echo foo {1,2} bar +echo `zecho foo {1,2} bar` +echo $(zecho foo {1,2} bar) + +# new sequence brace operators +echo {1..10} + +# this doesn't work yet +echo {0..10,braces} +# but this does +echo {{0..10},braces} +echo x{{0..10},braces}y + +echo {3..3} +echo x{3..3}y +echo {10..1} +echo {10..1}y +echo x{10..1}y + +echo {a..f} +echo {f..a} + +echo {a..A} +echo {A..a} + +echo {f..f} + +# mixes are incorrectly-formed brace expansions +echo {1..f} +echo {f..1} + +echo 0{1..9} {10..20} + +# do negative numbers work? +echo {-1..-10} +echo {-20..0} diff --git a/tests/builtins.right b/tests/builtins.right index 9d7bb0ee..f686606b 100644 --- a/tests/builtins.right +++ b/tests/builtins.right @@ -1,5 +1,3 @@ -alias: 0 -alias: 0 a end-1 a @@ -118,15 +116,15 @@ AVAR foo declare -x foo="" declare -x FOO="\$\$" -./builtins.tests: line 219: declare: FOO: not found +./builtins.tests: line 207: declare: FOO: not found declare -x FOO="\$\$" ok ok -./builtins.tests: line 251: kill: 4096: invalid signal specification +./builtins.tests: line 239: kill: 4096: invalid signal specification 1 a\n\n\nb a b -./builtins.tests: line 260: exit: status: numeric argument required +./builtins.tests: line 248: exit: status: numeric argument required diff --git a/tests/builtins.tests b/tests/builtins.tests index 979a4de0..3c286338 100644 --- a/tests/builtins.tests +++ b/tests/builtins.tests @@ -4,18 +4,6 @@ set +o posix ulimit -c 0 2>/dev/null -# alias/unalias tests - -unalias -a -# this should return success, according to POSIX.2 -alias -echo alias: $? -alias foo=bar -unalias foo -# this had better return success, according to POSIX.2 -alias -echo alias: $? - # check that break breaks loops for i in a b c; do echo $i; break; echo bad-$i; done echo end-1 diff --git a/tests/cond.right b/tests/cond.right index 58972ff1..06f36a9a 100644 --- a/tests/cond.right +++ b/tests/cond.right @@ -33,3 +33,5 @@ returns: 0 returns: 1 returns: 0 ok +ok 42 +ok 43 diff --git a/tests/cond.tests b/tests/cond.tests index acaa5272..3abfa9d7 100755 --- a/tests/cond.tests +++ b/tests/cond.tests @@ -153,3 +153,7 @@ PAT= if [[ $STR = $PAT ]]; then echo ok fi + +# bug in all versions up to and including bash-2.05b +if [[ "123abc" == *?(a)bc ]]; then echo ok 42; else echo bad 42; fi +if [[ "123abc" == *?(a)bc ]]; then echo ok 43; else echo bad 43; fi diff --git a/tests/cprint.right b/tests/cprint.right index 6b711b8c..5dd629d1 100644 --- a/tests/cprint.right +++ b/tests/cprint.right @@ -14,7 +14,7 @@ tf () echo a }; i=0; - while (( " i < 3 " )); do + while (( i < 3 )); do test -r /dev/fd/$i; i=$(( i + 1 )); done; @@ -26,7 +26,7 @@ tf () if [[ -r /dev/fd/0 && -w /dev/fd/1 ]]; then echo ok >/dev/null; else - if (( " 7 > 40 " )); then + if (( 7 > 40 )); then echo oops; else echo done; diff --git a/tests/dbg-support.right b/tests/dbg-support.right new file mode 100644 index 00000000..eb7d3c3a --- /dev/null +++ b/tests/dbg-support.right @@ -0,0 +1,353 @@ +debug lineno: 63 main +debug lineno: 66 main +FUNCNAME main +debug lineno: 70 main +debug lineno: 17 fn1 +debug lineno: 18 fn1 +LINENO 18 +debug lineno: 19 fn1 +LINENO 19 +debug lineno: 20 fn1 +BASH_SOURCE[0] ./dbg-support.tests +debug lineno: 21 fn1 +FUNCNAME[0] fn1 +debug lineno: 22 fn1 +debug lineno: 22 fn1 70 ./dbg-support.tests +debug lineno: 23 fn1 +debug lineno: 23 fn1 70 main ./dbg-support.tests +debug lineno: 24 fn1 +debug lineno: 24 fn1 +debug lineno: 25 fn1 +./dbg-support.tests: line 25: caller: foo: invalid number +caller: usage: caller [EXPR] +debug lineno: 25 fn1 +debug lineno: 17 fn1 +debug lineno: 12 print_return_trap +debug lineno: 13 print_return_trap +return lineno: 17 fn1 +debug lineno: 14 print_return_trap +debug lineno: 71 main +debug lineno: 28 fn2 +debug lineno: 29 fn2 +fn2 here. Calling fn1... +debug lineno: 30 fn2 +debug lineno: 17 fn1 +debug lineno: 18 fn1 +LINENO 18 +debug lineno: 19 fn1 +LINENO 19 +debug lineno: 20 fn1 +BASH_SOURCE[0] ./dbg-support.tests +debug lineno: 21 fn1 +FUNCNAME[0] fn1 +debug lineno: 22 fn1 +debug lineno: 22 fn1 30 ./dbg-support.tests +debug lineno: 23 fn1 +debug lineno: 23 fn1 30 fn2 ./dbg-support.tests +debug lineno: 24 fn1 +debug lineno: 24 fn1 71 main ./dbg-support.tests +debug lineno: 25 fn1 +./dbg-support.tests: line 25: caller: foo: invalid number +caller: usage: caller [EXPR] +debug lineno: 25 fn1 +debug lineno: 17 fn1 +debug lineno: 12 print_return_trap +debug lineno: 13 print_return_trap +return lineno: 17 fn1 +debug lineno: 14 print_return_trap +debug lineno: 28 fn2 +debug lineno: 12 print_return_trap +debug lineno: 13 print_return_trap +return lineno: 28 fn2 +debug lineno: 14 print_return_trap +debug lineno: 72 main +debug lineno: 33 fn3 +debug lineno: 34 fn3 +LINENO 34 +debug lineno: 35 fn3 +BASH_SOURCE[0] ./dbg-support.tests +debug lineno: 38 fn3 +debug lineno: 39 fn3 +debug lineno: 40 fn3 +debug lineno: 40 fn3 +debug lineno: 41 fn3 +debug lineno: 42 fn3 +debug lineno: 43 fn3 +fn3 called from file `./dbg-support.tests' at line 0 +debug lineno: 40 fn3 +debug lineno: 40 fn3 +debug lineno: 41 fn3 +debug lineno: 42 fn3 +debug lineno: 42 fn3 +debug lineno: 43 fn3 +main called from file `./dbg-support.tests' at line 0 +debug lineno: 40 fn3 +debug lineno: 40 fn3 +debug lineno: 46 fn3 +debug lineno: 18 source +SOURCED LINENO 18 +debug lineno: 19 source +SOURCED BASH_SOURCE[0] ./dbg-support.sub +debug lineno: 20 source +debug lineno: 3 sourced_fn +debug lineno: 4 sourced_fn +debug lineno: 5 sourced_fn +SOURCED FN LINENO 5 +debug lineno: 8 sourced_fn +debug lineno: 9 sourced_fn +debug lineno: 10 sourced_fn +debug lineno: 10 sourced_fn +debug lineno: 11 sourced_fn +debug lineno: 12 sourced_fn +debug lineno: 13 sourced_fn +FUNCNAME[0]: sourced_fn called from ./dbg-support.sub at line 20 +debug lineno: 10 sourced_fn +debug lineno: 10 sourced_fn +debug lineno: 11 sourced_fn +debug lineno: 12 sourced_fn +debug lineno: 13 sourced_fn +FUNCNAME[1]: source called from ./dbg-support.tests at line 46 +debug lineno: 10 sourced_fn +debug lineno: 10 sourced_fn +debug lineno: 11 sourced_fn +debug lineno: 12 sourced_fn +debug lineno: 13 sourced_fn +FUNCNAME[2]: fn3 called from ./dbg-support.tests at line 72 +debug lineno: 10 sourced_fn +debug lineno: 10 sourced_fn +debug lineno: 11 sourced_fn +debug lineno: 12 sourced_fn +debug lineno: 12 sourced_fn +debug lineno: 13 sourced_fn +FUNCNAME[3]: main called from ./dbg-support.tests at line 0 +debug lineno: 10 sourced_fn +debug lineno: 10 sourced_fn +debug lineno: 3 sourced_fn +debug lineno: 12 print_return_trap +debug lineno: 13 print_return_trap +return lineno: 3 sourced_fn +debug lineno: 14 print_return_trap +debug lineno: 46 fn3 +debug lineno: 12 print_return_trap +debug lineno: 13 print_return_trap +return lineno: 46 fn3 +debug lineno: 14 print_return_trap +debug lineno: 33 fn3 +debug lineno: 12 print_return_trap +debug lineno: 13 print_return_trap +return lineno: 33 fn3 +debug lineno: 14 print_return_trap +debug lineno: 73 main +debug lineno: 18 source +SOURCED LINENO 18 +debug lineno: 19 source +SOURCED BASH_SOURCE[0] ./dbg-support.sub +debug lineno: 20 source +debug lineno: 3 sourced_fn +debug lineno: 4 sourced_fn +debug lineno: 5 sourced_fn +SOURCED FN LINENO 5 +debug lineno: 8 sourced_fn +debug lineno: 9 sourced_fn +debug lineno: 10 sourced_fn +debug lineno: 10 sourced_fn +debug lineno: 11 sourced_fn +debug lineno: 12 sourced_fn +debug lineno: 13 sourced_fn +FUNCNAME[0]: sourced_fn called from ./dbg-support.sub at line 20 +debug lineno: 10 sourced_fn +debug lineno: 10 sourced_fn +debug lineno: 11 sourced_fn +debug lineno: 12 sourced_fn +debug lineno: 13 sourced_fn +FUNCNAME[1]: source called from ./dbg-support.tests at line 73 +debug lineno: 10 sourced_fn +debug lineno: 10 sourced_fn +debug lineno: 11 sourced_fn +debug lineno: 12 sourced_fn +debug lineno: 12 sourced_fn +debug lineno: 13 sourced_fn +FUNCNAME[2]: main called from ./dbg-support.tests at line 0 +debug lineno: 10 sourced_fn +debug lineno: 10 sourced_fn +debug lineno: 3 sourced_fn +debug lineno: 12 print_return_trap +debug lineno: 13 print_return_trap +return lineno: 3 sourced_fn +debug lineno: 14 print_return_trap +debug lineno: 73 main +debug lineno: 12 print_return_trap +debug lineno: 13 print_return_trap +return lineno: 73 main +debug lineno: 14 print_return_trap +debug lineno: 76 main +debug lineno: 79 main +LINENO 18 +LINENO 19 +BASH_SOURCE[0] ./dbg-support.tests +FUNCNAME[0] fn1 +79 ./dbg-support.tests +79 main ./dbg-support.tests + +./dbg-support.tests: line 25: caller: foo: invalid number +caller: usage: caller [EXPR] + +debug lineno: 80 main +fn2 here. Calling fn1... +LINENO 18 +LINENO 19 +BASH_SOURCE[0] ./dbg-support.tests +FUNCNAME[0] fn1 +30 ./dbg-support.tests +30 fn2 ./dbg-support.tests +80 main ./dbg-support.tests +./dbg-support.tests: line 25: caller: foo: invalid number +caller: usage: caller [EXPR] + +debug lineno: 81 main +LINENO 34 +BASH_SOURCE[0] ./dbg-support.tests +fn3 called from file `./dbg-support.tests' at line 0 +main called from file `./dbg-support.tests' at line 0 +SOURCED LINENO 18 +SOURCED BASH_SOURCE[0] ./dbg-support.sub +SOURCED FN LINENO 5 +FUNCNAME[0]: sourced_fn called from ./dbg-support.sub at line 20 +FUNCNAME[1]: source called from ./dbg-support.tests at line 46 +FUNCNAME[2]: fn3 called from ./dbg-support.tests at line 81 +FUNCNAME[3]: main called from ./dbg-support.tests at line 0 +debug lineno: 82 main +fn4 here. Calling fn3... +LINENO 34 +BASH_SOURCE[0] ./dbg-support.tests +fn3 called from file `./dbg-support.tests' at line 82 +fn4 called from file `./dbg-support.tests' at line 0 +main called from file `./dbg-support.tests' at line 0 +SOURCED LINENO 18 +SOURCED BASH_SOURCE[0] ./dbg-support.sub +SOURCED FN LINENO 5 +FUNCNAME[0]: sourced_fn called from ./dbg-support.sub at line 20 +FUNCNAME[1]: source called from ./dbg-support.tests at line 46 +FUNCNAME[2]: fn3 called from ./dbg-support.tests at line 51 +FUNCNAME[3]: fn4 called from ./dbg-support.tests at line 82 +FUNCNAME[4]: main called from ./dbg-support.tests at line 0 +debug lineno: 83 main +SOURCED LINENO 18 +SOURCED BASH_SOURCE[0] ./dbg-support.sub +SOURCED FN LINENO 5 +FUNCNAME[0]: sourced_fn called from ./dbg-support.sub at line 20 +FUNCNAME[1]: source called from ./dbg-support.tests at line 83 +FUNCNAME[2]: main called from ./dbg-support.tests at line 0 +return lineno: 83 main +debug lineno: 86 main +debug lineno: 89 main +debug lineno: 18 source +SOURCED LINENO 18 +debug lineno: 19 source +SOURCED BASH_SOURCE[0] ./dbg-support.sub +debug lineno: 20 source +debug lineno: 3 sourced_fn +debug lineno: 4 sourced_fn +debug lineno: 5 sourced_fn +SOURCED FN LINENO 5 +debug lineno: 8 sourced_fn +debug lineno: 9 sourced_fn +debug lineno: 10 sourced_fn +debug lineno: 10 sourced_fn +debug lineno: 11 sourced_fn +debug lineno: 12 sourced_fn +debug lineno: 13 sourced_fn +FUNCNAME[0]: sourced_fn called from ./dbg-support.sub at line 20 +debug lineno: 10 sourced_fn +debug lineno: 10 sourced_fn +debug lineno: 11 sourced_fn +debug lineno: 12 sourced_fn +debug lineno: 13 sourced_fn +FUNCNAME[1]: source called from ./dbg-support.tests at line 89 +debug lineno: 10 sourced_fn +debug lineno: 10 sourced_fn +debug lineno: 11 sourced_fn +debug lineno: 12 sourced_fn +debug lineno: 12 sourced_fn +debug lineno: 13 sourced_fn +FUNCNAME[2]: main called from ./dbg-support.tests at line 0 +debug lineno: 10 sourced_fn +debug lineno: 10 sourced_fn +debug lineno: 3 sourced_fn +debug lineno: 12 print_return_trap +debug lineno: 13 print_return_trap +return lineno: 3 sourced_fn +debug lineno: 14 print_return_trap +debug lineno: 89 main +debug lineno: 12 print_return_trap +debug lineno: 13 print_return_trap +return lineno: 89 main +debug lineno: 14 print_return_trap +debug lineno: 90 main +debug lineno: 93 main +debug lineno: 93 main +debug lineno: 94 main +debug lineno: 97 main +debug lineno: 93 main +debug lineno: 93 main +debug lineno: 94 main +debug lineno: 97 main +debug lineno: 93 main +debug lineno: 93 main +debug lineno: 94 main +debug lineno: 95 main +Hit 2 +debug lineno: 97 main +debug lineno: 93 main +debug lineno: 93 main +debug lineno: 103 main +SOURCED FN LINENO 5 FUNCNAME[0]: sourced_fn called from ./dbg-support.tests at line 103 FUNCNAME[1]: main called from ./dbg-support.tests at line 0 +debug lineno: 104 main +SOURCED FN LINENO 5 FUNCNAME[0]: sourced_fn called from ./dbg-support.tests at line 104 FUNCNAME[1]: main called from ./dbg-support.tests at line 0 +debug lineno: 105 main +debug lineno: 106 main +SOURCED FN LINENO 5 +FUNCNAME[0]: sourced_fn called from ./dbg-support.tests at line 106 +FUNCNAME[1]: main called from ./dbg-support.tests at line 0 +debug lineno: 110 main +debug lineno: 111 main +debug lineno: 3 sourced_fn +debug lineno: 4 sourced_fn +debug lineno: 5 sourced_fn +SOURCED FN LINENO 5 +debug lineno: 8 sourced_fn +debug lineno: 9 sourced_fn +debug lineno: 10 sourced_fn +debug lineno: 10 sourced_fn +debug lineno: 11 sourced_fn +debug lineno: 12 sourced_fn +debug lineno: 13 sourced_fn +FUNCNAME[0]: sourced_fn called from ./dbg-support.tests at line 111 +debug lineno: 10 sourced_fn +debug lineno: 10 sourced_fn +debug lineno: 11 sourced_fn +debug lineno: 12 sourced_fn +debug lineno: 12 sourced_fn +debug lineno: 13 sourced_fn +FUNCNAME[1]: main called from ./dbg-support.tests at line 0 +debug lineno: 10 sourced_fn +debug lineno: 10 sourced_fn +debug lineno: 3 sourced_fn +debug lineno: 12 print_return_trap +debug lineno: 13 print_return_trap +return lineno: 3 sourced_fn +debug lineno: 14 print_return_trap +debug lineno: 114 main +debug lineno: 119 main +debug lineno: 123 main +got it +debug lineno: 131 main +debug lineno: 132 main +debug lineno: 133 main +debug lineno: 132 main +debug lineno: 133 main +debug lineno: 131 main +debug lineno: 132 main +debug lineno: 133 main +debug lineno: 132 main +debug lineno: 133 main diff --git a/tests/dbg-support.sub b/tests/dbg-support.sub new file mode 100644 index 00000000..f68f8d9b --- /dev/null +++ b/tests/dbg-support.sub @@ -0,0 +1,26 @@ +# This file is intended to be sourced from one of the bashdb test programs + +sourced_fn() { + name="fn2" + echo "SOURCED FN LINENO $LINENO" + + # Print a stack trace + declare -i n + n=${#FUNCNAME[@]} + for (( i=0 ; (( i < $n )) ; i++ )) ; do + local -i j=i+1 + [ $j -eq $n ] && j=i # main()'s file is the same as the first caller + echo "FUNCNAME[$i]: ${FUNCNAME[$i]} called from ${BASH_SOURCE[$j]}" \ + "at line ${BASH_LINENO[$i]}" + done +} + +echo "SOURCED LINENO $LINENO" +echo "SOURCED BASH_SOURCE[0]" ${BASH_SOURCE[0]} +sourced_fn + +#;;; Local Variables: *** +#;;; mode:shell-script *** +#;;; eval: (sh-set-shell "bash") *** +#;;; End: *** + diff --git a/tests/dbg-support.tests b/tests/dbg-support.tests new file mode 100755 index 00000000..27825d6a --- /dev/null +++ b/tests/dbg-support.tests @@ -0,0 +1,139 @@ +#!../bash +# +# Test correct functioning bash debug support not via the bashdb +# debugger but merely by printing via print_trap() +# $Id: dbg-support.tests,v 1.13 2003/02/17 22:02:25 rockyb Exp $ +shopt -s extdebug +print_debug_trap() { + echo "debug lineno: $1 ${FUNCNAME[1]}" + return +} + +print_return_trap() { + echo "return lineno: $1 ${FUNCNAME[1]}" + return +} + +fn1() { + echo "LINENO $LINENO" + echo "LINENO $LINENO" + echo "BASH_SOURCE[0]" ${BASH_SOURCE[0]} + echo "FUNCNAME[0]" ${FUNCNAME[0]} + echo `caller` + echo `caller 0` + echo `caller 1` + echo `caller foo` +} + +fn2() { + echo "fn2 here. Calling fn1..." + fn1 +} + +fn3() { + echo "LINENO $LINENO" + echo "BASH_SOURCE[0]" ${BASH_SOURCE[0]} + + # Print a stack trace + declare -i n + n=${#FUNCNAME[@]} + for (( i=0 ; (( i < $n )) ; i++ )) ; do + local -i j=i+1 + [ $j -eq $n ] && j=i # main()'s file is the same as the first caller + echo "${FUNCNAME[$i]} called from file " \ + "\`${BASH_SOURCE[$j]}' at line ${BASH_LINENO[$j]}" + done + source ./dbg-support.sub +} + +fn4() { + echo "fn4 here. Calling fn3..." + fn3 +} + + +#!../bash +# +# Test of support for debugging facilities in bash +# +# Test debugger set option fntrace - set on. Not in vanilla Bash 2.05 +# +set -o functrace +trap 'print_debug_trap $LINENO' DEBUG +trap 'print_return_trap $LINENO' RETURN + +# Funcname is now an array. Vanilla Bash 2.05 doesn't have FUNCNAME array. +echo "FUNCNAME" ${FUNCNAME[0]} + +# We should trace into the below. +# Start easy with a simple function. +fn1 +fn2 +fn3 +source ./dbg-support.sub + +# Test debugger set option fntrace - set off +set +T + +# We should not trace into this. +fn1 +fn2 +fn3 +fn4 +source ./dbg-support.sub + +# Another way to say: set -o fntrace +set -T + +# We should trace into this. +source ./dbg-support.sub +set +T + +# Test that the line numbers in the presence of conditionals are correct. +for (( i=0 ; (( i <= 2 )) ; i++ )) ; do + if [ $i -eq 2 ] ; then + echo "Hit 2" + fi + j=4 +done + +# +# Check line numbers in command substitution +# +echo $(sourced_fn) +echo `sourced_fn` +x=$((sourced_fn)) +x={ sourced_fn } + +# Make sure we step into sourced_fn as a comand when we request to do so. +# Vanilla bash 2.0 doesn't do. +set -o functrace +x={ sourced_fn } + +# Should see line number of xyzzy below. Vanilla bash 2.05b doesn't do +case xyzzy in + a ) + x=5 + ;; + xyzz? ) + case 3 in + 2 ) + x=6 ;; + 3 ) + echo "got it" ;; + * ) echo "no good" ;; + esac + ;; + * ) +esac + +# Should see line numbers for initial for lines. +for i in 0 1 ; do + for j in 3 4 ; do + ((x=i+j)) + done +done +#;;; Local Variables: *** +#;;; mode:shell-script *** +#;;; eval: (sh-set-shell "bash") *** +#;;; End: *** diff --git a/tests/dbg-support2.right b/tests/dbg-support2.right new file mode 100644 index 00000000..c9d884e6 --- /dev/null +++ b/tests/dbg-support2.right @@ -0,0 +1,7 @@ +lineno: 17 (6) main +lineno: 18 (6) main +x is 1 +lineno: 19 (6) main +lineno: 20 (6) main +lineno: 21 (6) main +x is 1 diff --git a/tests/dbg-support2.tests b/tests/dbg-support2.tests new file mode 100755 index 00000000..fdc0f31e --- /dev/null +++ b/tests/dbg-support2.tests @@ -0,0 +1,26 @@ +#!../bash +# +# Test correct trap return codes = 2 means skip execution. +shopt -s extdebug +print_trap() { + echo "lineno: $1 ($LINENO) ${FUNCNAME[1]}" + if [[ $debug_exit == 2 ]] ; then + debug_exit=0 + return 2 + fi + return 0 +} + +debug_exit=0 +trap 'print_trap $LINENO' DEBUG + +x=1 +echo "x is $x" +debug_exit=2 +x=2 +echo "x is $x" + +#;;; Local Variables: *** +#;;; mode:shell-script *** +#;;; eval: (sh-set-shell "bash") *** +#;;; End: *** diff --git a/tests/dollar-at-star b/tests/dollar-at-star index 1a754d8c..ade9c1f9 100755 --- a/tests/dollar-at-star +++ b/tests/dollar-at-star @@ -207,4 +207,8 @@ case "$@" in *) echo bad 4;; esac +# tests for special expansion of "$*" and "${array[*]}" when used with other +# expansions -- bugs through bash-2.05b +${THIS_SH} ./dollar-star1.sub + exit 0 diff --git a/tests/dollar-star1.sub b/tests/dollar-star1.sub new file mode 100644 index 00000000..63a9ef86 --- /dev/null +++ b/tests/dollar-star1.sub @@ -0,0 +1,31 @@ +set -- a b c +x=(a b c); IFS='|' + +echo "${*/#/x}" +echo "${x[*]/#/x}" + +echo "$*" +echo "${x[*]}" + +echo "$@" +echo "${x[@]}" + +echo "${@/#/x}" +echo "${x[@]/#/x}" + +echo "${*:1:2}" +echo "${x[*]:1:2}" + +echo "${@:1:2}" +echo "${x[@]:1:2}" + +IFS=$' \t\n' +set -- xa xb xc +x=(xa xb xc) +IFS='|' + +echo "${*#x}" +echo "${x[*]#x}" + +echo "$*" +echo "${x[*]}" diff --git a/tests/dollar.right b/tests/dollar.right index 345775be..42bb65e7 100644 --- a/tests/dollar.right +++ b/tests/dollar.right @@ -95,3 +95,19 @@ ok 1 ok 2 ok 3 ok 4 +xa|xb|xc +xa|xb|xc +a|b|c +a|b|c +a b c +a b c +xa xb xc +xa xb xc +a|b +b|c +a b +b c +a|b|c +a|b|c +xa|xb|xc +xa|xb|xc diff --git a/tests/errors.right b/tests/errors.right index e2e8ad04..b00101cb 100644 --- a/tests/errors.right +++ b/tests/errors.right @@ -15,7 +15,7 @@ unset: usage: unset [-f] [-v] [name ...] ./errors.tests: line 52: unset: `/bin/sh': not a valid identifier ./errors.tests: line 55: unset: cannot simultaneously unset a function and a variable ./errors.tests: line 58: declare: -z: invalid option -declare: usage: declare [-afFirtx] [-p] name[=value] ... +declare: usage: declare [-afFirtx] [-p] [name[=value] ...] ./errors.tests: line 60: declare: `-z': not a valid identifier ./errors.tests: line 61: declare: `/bin/sh': not a valid identifier ./errors.tests: line 65: declare: cannot use `-f' to make functions @@ -53,20 +53,20 @@ umask: usage: umask [-p] [-S] [mode] ./errors.tests: line 159: declare: VAR: readonly variable ./errors.tests: line 161: declare: unset: not found ./errors.tests: line 164: VAR: readonly variable -./errors.tests: command substitution: line 2: syntax error: unexpected end of file -./errors.tests: command substitution: line 1: syntax error near unexpected token `done' -./errors.tests: command substitution: line 1: ` for z in 1 2 3; done ' +./errors.tests: command substitution: line 168: syntax error: unexpected end of file +./errors.tests: command substitution: line 168: syntax error near unexpected token `done' +./errors.tests: command substitution: line 168: ` for z in 1 2 3; done ' ./errors.tests: line 171: cd: HOME not set ./errors.tests: line 172: cd: /tmp/xyz.bash: No such file or directory ./errors.tests: line 174: cd: OLDPWD not set ./errors.tests: line 175: cd: /bin/sh: Not a directory ./errors.tests: line 177: cd: /tmp/cd-notthere: No such file or directory ./errors.tests: line 180: .: filename argument required -.: usage: . filename +.: usage: . filename [arguments] ./errors.tests: line 181: source: filename argument required -source: usage: source filename +source: usage: source filename [arguments] ./errors.tests: line 184: .: -i: invalid option -.: usage: . filename +.: usage: . filename [arguments] ./errors.tests: line 187: set: -q: invalid option set: usage: set [--abefhkmnptuvxBCHP] [-o option] [arg ...] ./errors.tests: line 190: enable: sh: not a shell builtin @@ -76,13 +76,13 @@ set: usage: set [--abefhkmnptuvxBCHP] [-o option] [arg ...] ./errors.tests: line 199: read: `/bin/sh': not a valid identifier ./errors.tests: line 202: VAR: readonly variable ./errors.tests: line 205: readonly: -x: invalid option -readonly: usage: readonly [-anf] [name[=value] ...] or readonly -p +readonly: usage: readonly [-af] [name[=value] ...] or readonly -p ./errors.tests: line 208: eval: -i: invalid option eval: usage: eval [arg ...] ./errors.tests: line 209: command: -i: invalid option command: usage: command [-pVv] command [arg ...] -./errors.tests: line 1: /bin/sh + 0: syntax error: operand expected (error token is "/bin/sh + 0") -./errors.tests: line 1: /bin/sh + 0: syntax error: operand expected (error token is "/bin/sh + 0") +./errors.tests: line 212: /bin/sh + 0: syntax error: operand expected (error token is "/bin/sh + 0") +./errors.tests: line 213: /bin/sh + 0: syntax error: operand expected (error token is "/bin/sh + 0") ./errors.tests: line 216: trap: NOSIG: invalid signal specification ./errors.tests: line 219: trap: -s: invalid option trap: usage: trap [arg] [signal_spec ...] or trap -l diff --git a/tests/exec.right b/tests/exec.right index 0121ed4b..070ea58e 100644 --- a/tests/exec.right +++ b/tests/exec.right @@ -50,3 +50,4 @@ this is ohio-state 1 0 1 +testb diff --git a/tests/exec7.sub b/tests/exec7.sub new file mode 100644 index 00000000..ea2fd066 --- /dev/null +++ b/tests/exec7.sub @@ -0,0 +1,20 @@ +# make sure that bash really checks the right things when deciding what +# constitutes an executable file + +[ $UID -eq 0 ] && { echo "exec7.sub: the test suite should not be run as root" >&2 ; } + +: ${TMPDIR:=/tmp} + +cd $TMPDIR || { echo "cannot cd to $TMPDIR" >&2 ; exit 2; } + +mkdir testa testb + +echo 'echo "testa"' > testa/foo +echo 'echo "testb"' > testb/foo + +chmod 655 testa/foo +chmod 755 testb/foo + +PATH=$TMPDIR/testa:$TMPDIR/testb $THIS_SH -c foo + +rm -rf testa testb diff --git a/tests/execscript b/tests/execscript index 7eab4af0..03208c9e 100644 --- a/tests/execscript +++ b/tests/execscript @@ -1,7 +1,7 @@ export LC_ALL=C export LANG=C -if (( $UID == 0 )); then +if [ $UID -eq 0 ]; then echo "execscript: the test suite should not be run as root" >&2 fi @@ -94,3 +94,6 @@ ${THIS_SH} -c 'cat </dev/null | cat >/dev/null' >&- # values ${THIS_SH} ./exec6.sub + +# checks for properly deciding what constitutes an executable file +${THIS_SH} ./exec7.sub diff --git a/tests/extglob.right b/tests/extglob.right index c205a4f1..154a969a 100644 --- a/tests/extglob.right +++ b/tests/extglob.right @@ -67,6 +67,7 @@ ok 38 ok 39 ok 40 ok 41 +ok 42 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 diff --git a/tests/extglob.tests b/tests/extglob.tests index b1295c07..1a123d8b 100644 --- a/tests/extglob.tests +++ b/tests/extglob.tests @@ -321,6 +321,12 @@ ab**) echo ok 41;; *) echo bad 41;; esac +# bug in all versions up to and including bash-2.05b +case "123abc" in +*?(a)bc) echo ok 42;; +*) echo bad 42;; +esac + # clean up and do the next one builtin cd / diff --git a/tests/glob-test b/tests/glob-test index dfb987ec..d4357083 100644 --- a/tests/glob-test +++ b/tests/glob-test @@ -35,6 +35,16 @@ recho a* X* shopt -u nullglob +# see if the failglob option works + +mkdir tmp +touch tmp/l1 tmp/l2 tmp/l3 +builtin echo tmp/l[12] tmp/*4 tmp/*3 +shopt -s failglob +builtin echo tmp/l[12] tmp/*4 tmp/*3 +rm -r tmp +shopt -u failglob + # see if the code that expands directories only works expect '<bdir/>' recho b*/ diff --git a/tests/glob.right b/tests/glob.right index 08f1778c..46ac4d3d 100644 --- a/tests/glob.right +++ b/tests/glob.right @@ -12,6 +12,8 @@ argv[1] = <a> argv[2] = <abc> argv[3] = <abd> argv[4] = <abe> +tmp/l1 tmp/l2 tmp/*4 tmp/l3 +./glob-test: line 44: no match: tmp/*4 argv[1] = <bdir/> argv[1] = <*> argv[1] = <a*> diff --git a/tests/herestr.right b/tests/herestr.right index c20c0a56..2659aace 100644 --- a/tests/herestr.right +++ b/tests/herestr.right @@ -24,3 +24,5 @@ f3 () echo $(echo hi) echo ho echo off to work we go +declare -a uu='([0]="" [1]="kghfjk" [2]="jkfzuk" [3]="i\ +")' diff --git a/tests/herestr.tests b/tests/herestr.tests index 4f3ac682..f77b229f 100644 --- a/tests/herestr.tests +++ b/tests/herestr.tests @@ -34,3 +34,6 @@ cat <<< 'echo $(echo hi)' cat <<< "echo ho" cat <<< "echo $(echo off to work we go)" + +IFS="/" read -r -d $'\000' -a uu <<< /kghfjk/jkfzuk/i +declare -p uu diff --git a/tests/jobs.right b/tests/jobs.right index 12bf8a34..1117f5e2 100644 --- a/tests/jobs.right +++ b/tests/jobs.right @@ -43,7 +43,7 @@ fg-bg 4 sleep 5 fg-bg 5 ./jobs.tests: line 83: fg: %2: no such job -./jobs.tests: line 84: bg: bg background job? +./jobs.tests: line 84: bg: job %1 already in background fg-bg 6 ./jobs.tests: line 91: fg: -s: invalid option fg: usage: fg [job_spec] diff --git a/tests/new-exp.right b/tests/new-exp.right index 95f16d99..a2ad16f1 100644 --- a/tests/new-exp.right +++ b/tests/new-exp.right @@ -422,7 +422,15 @@ argv[1] = <_QUANTITY-_QUART-_QUEST-_QUILL-_QUOTA-_QUOTE> ./new-exp3.sub: line 19: ${!_Q* }: bad substitution ./new-exp3.sub: line 24: ${!1*}: bad substitution ./new-exp3.sub: line 26: ${!@*}: bad substitution -./new-exp.tests: line 503: ${$(($#-1))}: bad substitution +Case01---3---A:B:C--- +Case02---1---A B C::--- +Case03---3---A:B:C--- +Case04---3---A:B:C--- +Case05---3---A:B:C--- +Case06---1---A B C::--- +Case07---3---A:B:C--- +Case08---3---A:B:C--- +./new-exp.tests: line 506: ${$(($#-1))}: bad substitution argv[1] = <a> argv[2] = <b> argv[3] = <c> @@ -439,7 +447,7 @@ argv[1] = <a> argv[1] = <a> argv[2] = <b> argv[1] = <> -./new-exp.tests: line 522: $(($# - 2)): substring expression < 0 +./new-exp.tests: line 525: $(($# - 2)): substring expression < 0 argv[1] = <bin> argv[2] = <bin> argv[3] = <ucb> @@ -471,4 +479,4 @@ argv[1] = </full/path/to> argv[1] = </> argv[1] = <full/path/to/x16> argv[1] = <x16> -./new-exp.tests: line 542: ABXD: parameter unset +./new-exp.tests: line 545: ABXD: parameter unset diff --git a/tests/new-exp.tests b/tests/new-exp.tests index 89b92136..5d806d6c 100644 --- a/tests/new-exp.tests +++ b/tests/new-exp.tests @@ -498,6 +498,9 @@ recho "${RECEIVED:$((${#RECEIVED}-1)):1}" # tests of new prefix expansion ${!prefix*} ${THIS_SH} ./new-exp3.sub +# bug with indirect expansion through bash-2.05b +${THIS_SH} ./new-exp4.sub + # these caused errors and core dumps in versions before bash-2.04 c="" echo ${c//${$(($#-1))}/x/} diff --git a/tests/new-exp4.sub b/tests/new-exp4.sub new file mode 100644 index 00000000..45439a06 --- /dev/null +++ b/tests/new-exp4.sub @@ -0,0 +1,31 @@ +#!/bin/bash + +arrayA=("A" "B" "C") + +arrayB=( ${arrayA[*]} ) +echo "Case01---${#arrayB[*]}---${arrayB[0]}:${arrayB[1]}:${arrayB[2]}---" + +arrayB=( "${arrayA[*]}" ) +echo "Case02---${#arrayB[*]}---${arrayB[0]}:${arrayB[1]}:${arrayB[2]}---" + +arrayB=( ${arrayA[@]} ) +echo "Case03---${#arrayB[@]}---${arrayB[0]}:${arrayB[1]}:${arrayB[2]}---" + +arrayB=( "${arrayA[@]}" ) +echo "Case04---${#arrayB[@]}---${arrayB[0]}:${arrayB[1]}:${arrayB[2]}---" + +xx="arrayA[*]" + +arrayB=( ${!xx} ) +echo "Case05---${#arrayB[*]}---${arrayB[0]}:${arrayB[1]}:${arrayB[2]}---" + +arrayB=( "${!xx}" ) +echo "Case06---${#arrayB[*]}---${arrayB[0]}:${arrayB[1]}:${arrayB[2]}---" + +xx="arrayA[@]" + +arrayB=( ${!xx} ) +echo "Case07---${#arrayB[@]}---${arrayB[0]}:${arrayB[1]}:${arrayB[2]}---" + +arrayB=( "${!xx}" ) +echo "Case08---${#arrayB[@]}---${arrayB[0]}:${arrayB[1]}:${arrayB[2]}---" diff --git a/tests/nquote4.right b/tests/nquote4.right new file mode 100644 index 00000000..1f7ae170 --- /dev/null +++ b/tests/nquote4.right @@ -0,0 +1,18 @@ +argv[1] = <ab> +argv[1] = <abAcd> +argv[1] = <abAcd> +argv[1] = <ab^Dcd> +argv[1] = <abLd> +argv[1] = <abÞ> +argv[1] = <abÞ> +argv[1] = <abÍe> +argv[1] = <ab^Lde> +argv[1] = <¼X> +argv[1] = <«cX> +argv[1] = <> +argv[1] = <> +argv[1] = <gX> +argv[1] = <Ab> +argv[1] = <> +argv[1] = <^Abcd> +argv[1] = <Þ> diff --git a/tests/nquote4.tests b/tests/nquote4.tests new file mode 100644 index 00000000..ed734677 --- /dev/null +++ b/tests/nquote4.tests @@ -0,0 +1,24 @@ +recho $'ab\x{}cd' +recho $'ab\x{41}cd' +recho $'ab\x41cd' + +recho $'ab\x{4}cd' +recho $'ab\x4cd' + +recho $'ab\x{cde' + +recho $'ab\x{cde' +recho $'ab\x{cd}e' +recho $'ab\x{c}de' + +recho $'\x{abcX' +recho $'\x{ab}cX' +recho $'\x{}X' +recho $'\x{X' +recho $'\x{01234567X' + +recho $'\x{41}b' +recho $'\x{}bc' +recho $'\x{1}bcd' + +recho $'\x{bde' diff --git a/tests/read2.sub b/tests/read2.sub index 1e632c35..176cf863 100644 --- a/tests/read2.sub +++ b/tests/read2.sub @@ -1,6 +1,6 @@ a=4 -read -t 2 a +read -t 2 a < /dev/tty echo $? echo $a @@ -10,7 +10,7 @@ echo $? echo $a -read -t -3 a +read -t -3 a < /dev/tty echo $? echo $a diff --git a/tests/redir.right b/tests/redir.right index 283bdcdb..54b05f8d 100644 --- a/tests/redir.right +++ b/tests/redir.right @@ -88,3 +88,9 @@ f () after read ./redir5.sub: line 27: read: read error: 0: Bad file descriptor # tests of ksh93-like dup-and-close redirection operators +/ +/ +/ +0 +0 +0 diff --git a/tests/redir.tests b/tests/redir.tests index e80b7309..19cf9a1e 100644 --- a/tests/redir.tests +++ b/tests/redir.tests @@ -153,3 +153,6 @@ cat < redir1.* # test ksh93 dup-and-close (move fd) redirections ${THIS_SH} ./redir5.sub + +# test behavior after a write error with a builtin command +${THIS_SH} ./redir6.sub diff --git a/tests/redir6.sub b/tests/redir6.sub new file mode 100644 index 00000000..60cc68b0 --- /dev/null +++ b/tests/redir6.sub @@ -0,0 +1,8 @@ +cd / +pwd +help >&- +pwd +pwd +echo $? +echo $? +echo $? diff --git a/tests/run-alias b/tests/run-alias new file mode 100644 index 00000000..6a20b06e --- /dev/null +++ b/tests/run-alias @@ -0,0 +1,2 @@ +${THIS_SH} ./alias.tests > /tmp/xx 2>&1 +diff /tmp/xx alias.right && rm -f /tmp/xx diff --git a/tests/run-braces b/tests/run-braces index 564a96f3..53d4f1b7 100644 --- a/tests/run-braces +++ b/tests/run-braces @@ -1,2 +1,2 @@ -${THIS_SH} ./braces-tests > /tmp/xx +${THIS_SH} ./braces.tests > /tmp/xx diff /tmp/xx braces.right && rm -f /tmp/xx diff --git a/tests/run-dbg-support b/tests/run-dbg-support new file mode 100755 index 00000000..9e9c649c --- /dev/null +++ b/tests/run-dbg-support @@ -0,0 +1,11 @@ +#!../bash +#$Id: run-dbg-support,v 1.5 2002/11/14 06:08:16 rockyb Exp $ + +TEST_NAME='dbg-support' +TEST_FILE="/tmp/${TEST_NAME}.check" +${THIS_SH} ./${TEST_NAME}.tests > $TEST_FILE 2>&1 < /dev/null +set -f +diff $TEST_FILE ${TEST_NAME}.right && rm -f $TEST_FILE + +# Return code tells testing mechanism whether passed or not. +exit $? diff --git a/tests/run-dbg-support2 b/tests/run-dbg-support2 new file mode 100755 index 00000000..f62583f8 --- /dev/null +++ b/tests/run-dbg-support2 @@ -0,0 +1,16 @@ +#!../bash +#$Id: run-dbg-support2,v 1.3 2002/11/14 06:08:16 rockyb Exp $ + +TEST_NAME='dbg-support2' +TEST_FILE="/tmp/${TEST_NAME}.check" +${THIS_SH} ./${TEST_NAME}.tests > $TEST_FILE 2>&1 < /dev/null +set -f +diff $TEST_FILE ${TEST_NAME}.right && rm -f $TEST_FILE + +# Return code tells testing mechanism whether passed or not. +exit $? + +#;;; Local Variables: *** +#;;; mode:shell-script *** +#;;; eval: (sh-set-shell "bash") *** +#;;; End: *** diff --git a/tests/run-glob-test b/tests/run-glob-test index a01047ff..659112a3 100644 --- a/tests/run-glob-test +++ b/tests/run-glob-test @@ -1,4 +1,4 @@ PATH=$PATH:`pwd` export PATH -${THIS_SH} ./glob-test | grep -v '^expect' > /tmp/xx +${THIS_SH} ./glob-test 2>&1 | grep -v '^expect' > /tmp/xx diff /tmp/xx glob.right && rm -f /tmp/xx diff --git a/tests/run-nquote4 b/tests/run-nquote4 new file mode 100644 index 00000000..006872c8 --- /dev/null +++ b/tests/run-nquote4 @@ -0,0 +1,2 @@ +${THIS_SH} ./nquote.tests 2>&1 | grep -v '^expect' > /tmp/xx +diff /tmp/xx nquote.right && rm -f /tmp/xx diff --git a/tests/run-set-x b/tests/run-set-x new file mode 100755 index 00000000..b999e698 --- /dev/null +++ b/tests/run-set-x @@ -0,0 +1,11 @@ +#!../bash +#$Id: run-set-x,v 1.1 2002/12/09 13:12:37 rockyb Exp $ + +TEST_NAME='set-x' +TEST_FILE="/tmp/${TEST_NAME}.check" +${THIS_SH} ./${TEST_NAME}.tests > $TEST_FILE 2>&1 < /dev/null +set -f +diff $TEST_FILE ${TEST_NAME}.right && rm -f $TEST_FILE + +# Return code tells testing mechanism whether passed or not. +exit $? diff --git a/tests/run-test b/tests/run-test index 32fbde7a..b2482c3f 100644 --- a/tests/run-test +++ b/tests/run-test @@ -1,2 +1,4 @@ +unset GROUPS UID 2>/dev/null + ${THIS_SH} ./test.tests >/tmp/xx 2>&1 diff /tmp/xx test.right && rm -f /tmp/xx diff --git a/tests/set-x.right b/tests/set-x.right new file mode 100644 index 00000000..fc55bd88 --- /dev/null +++ b/tests/set-x.right @@ -0,0 +1,28 @@ ++ (( i=0 )) ++ (( i<=5 )) ++ x=0 ++ (( i++ )) ++ (( i<=5 )) ++ x=0 ++ (( i++ )) ++ (( i<=5 )) ++ x=0 ++ (( i++ )) ++ (( i<=5 )) ++ x=0 ++ (( i++ )) ++ (( i<=5 )) ++ x=0 ++ (( i++ )) ++ (( i<=5 )) ++ x=0 ++ (( i++ )) ++ (( i<=5 )) ++ for i in 0 1 2 ++ x=i ++ for i in 0 1 2 ++ x=i ++ for i in 0 1 2 ++ x=i ++ case x in ++ x=i diff --git a/tests/set-x.tests b/tests/set-x.tests new file mode 100755 index 00000000..323b772d --- /dev/null +++ b/tests/set-x.tests @@ -0,0 +1,21 @@ +#!../bash +# $Id: set-x.tests,v 1.1 2002/12/09 13:12:37 rockyb Exp $ +# +# Test that "set -x" shows what we think it should. +# +set -x +for ((i=0; i<=5; i++ )) ; do + x=0 +done +for i in 0 1 2 ; do + x=i +done +case x in + 0) x=i ;; + *) x=i ;; +esac + +#;;; Local Variables: *** +#;;; mode:shell-script *** +#;;; eval: (sh-set-shell "bash") *** +#;;; End: *** diff --git a/tests/shopt.right b/tests/shopt.right index 51218f65..605a8f01 100644 --- a/tests/shopt.right +++ b/tests/shopt.right @@ -9,7 +9,12 @@ shopt -s cmdhist shopt -u dotglob shopt -u execfail shopt -s expand_aliases +shopt -u extdebug shopt -u extglob +shopt -s extquote +shopt -u failglob +shopt -s force_fignore +shopt -u gnu_errfmt shopt -u histreedit shopt -u histappend shopt -u histverify @@ -36,6 +41,8 @@ shopt -s sourcepath shopt -s cdspell shopt -s cmdhist shopt -s expand_aliases +shopt -s extquote +shopt -s force_fignore shopt -s hostcomplete shopt -s interactive_comments shopt -s progcomp @@ -47,7 +54,10 @@ shopt -u checkhash shopt -u checkwinsize shopt -u dotglob shopt -u execfail +shopt -u extdebug shopt -u extglob +shopt -u failglob +shopt -u gnu_errfmt shopt -u histreedit shopt -u histappend shopt -u histverify @@ -67,7 +77,10 @@ checkhash off checkwinsize off dotglob off execfail off +extdebug off extglob off +failglob off +gnu_errfmt off histreedit off histappend off histverify off @@ -86,6 +99,8 @@ set +o allexport set -o braceexpand set -o emacs set +o errexit +set +o errtrace +set +o functrace set -o hashall set -o histexpand set -o history @@ -101,6 +116,7 @@ set +o notify set +o nounset set +o onecmd set +o physical +set +o pipefail set +o posix set -o privileged set +o verbose @@ -111,6 +127,8 @@ allexport off braceexpand on emacs on errexit off +errtrace off +functrace off hashall on histexpand on history on @@ -126,6 +144,7 @@ notify off nounset off onecmd off physical off +pipefail off posix off privileged on verbose off @@ -136,6 +155,8 @@ set +o allexport set -o braceexpand set -o emacs set +o errexit +set +o errtrace +set +o functrace set -o hashall set -o histexpand set -o history @@ -151,6 +172,7 @@ set +o notify set +o nounset set +o onecmd set +o physical +set +o pipefail set +o posix set -o privileged set +o verbose @@ -171,6 +193,8 @@ set -o privileged -- set +o allexport set +o errexit +set +o errtrace +set +o functrace set +o ignoreeof set +o keyword set +o noclobber @@ -181,6 +205,7 @@ set +o notify set +o nounset set +o onecmd set +o physical +set +o pipefail set +o posix set +o verbose set +o vi @@ -188,6 +213,8 @@ set +o xtrace -- allexport off errexit off +errtrace off +functrace off ignoreeof off keyword off noclobber off @@ -198,6 +225,7 @@ notify off nounset off onecmd off physical off +pipefail off posix off verbose off vi off diff --git a/tests/test.tests b/tests/test.tests index d84af1bd..e378cf2b 100644 --- a/tests/test.tests +++ b/tests/test.tests @@ -99,7 +99,7 @@ t -s run-all echo 't -t 20' t -t 20 echo 't -t 0' -t -t 0 +t -t 0 < /dev/tty echo 't -u noexist' t -u noexist diff --git a/tests/trap.right b/tests/trap.right index 6c179d0a..72f3b6d2 100644 --- a/tests/trap.right +++ b/tests/trap.right @@ -29,6 +29,7 @@ trap -- 'echo [$LINENO] debug' DEBUG [28] debug ./trap.tests[33] debug ./trap.tests[34] debug +func2[30] debug func2[31] debug func2debug line ./trap.tests[36] debug diff --git a/tests/type.right b/tests/type.right index 30f433ab..853c33bb 100644 --- a/tests/type.right +++ b/tests/type.right @@ -4,7 +4,6 @@ type: usage: type [-afptP] name [name ...] ./type.tests: line 13: command: notthere: not found function keyword -alias builtin file file @@ -16,7 +15,6 @@ func () } while is a shell keyword while is a shell keyword -m is aliased to `more' builtin is a shell builtin /bin/sh is /bin/sh func @@ -27,6 +25,12 @@ func () } while while is a shell keyword +./type.tests: line 42: type: m: not found +./type.tests: line 43: command: m: not found +alias m='more' +alias m='more' +m is aliased to `more' +alias alias m='more' alias m='more' alias m='more' @@ -35,8 +39,8 @@ builtin builtin is a shell builtin /bin/sh /bin/sh is /bin/sh -./type.tests: line 51: type: func: not found -./type.tests: line 53: type: m: not found +./type.tests: line 64: type: func: not found +./type.tests: line 66: type: m: not found /bin/sh /tmp/bash bash is hashed (/tmp/bash) diff --git a/tests/type.tests b/tests/type.tests index 706e3be3..7307c869 100644 --- a/tests/type.tests +++ b/tests/type.tests @@ -19,7 +19,6 @@ func() { echo this is func; } type -t func type -t while -type -t m type -t builtin type -t /bin/sh type -t ${THIS_SH} @@ -29,7 +28,6 @@ type func # the following two should produce identical output type while type -a while -type m type builtin type /bin/sh @@ -37,11 +35,26 @@ command -v func command -V func command -v while command -V while + # the following three lines should produce the same output +# first test with alias expansion off (should all fail or produce no output) +type -t m +type m command -v m alias -p alias m + +# then test with alias expansion on +shopt -s expand_aliases +type m +type -t m +command -v m +alias -p +alias m + command -V m +shopt -u expand_aliases + command -v builtin command -V builtin command -v /bin/sh diff --git a/tests/varenv.right b/tests/varenv.right index 563411d3..c458b184 100644 --- a/tests/varenv.right +++ b/tests/varenv.right @@ -30,7 +30,7 @@ unset declare -x ivar="42" hB braceexpand:hashall:interactive-comments -hPB +hBP braceexpand:hashall:interactive-comments:physical declare -r SHELLOPTS="braceexpand:hashall:interactive-comments:physical" abcde @@ -1,7 +1,7 @@ /* trap.c -- Not the trap command, but useful functions for manipulating those objects. The trap command is in builtins/trap.def. */ -/* Copyright (C) 1987-2002 Free Software Foundation, Inc. +/* Copyright (C) 1987-2003 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -34,6 +34,7 @@ #include "trap.h" #include "shell.h" +#include "flags.h" #include "input.h" /* for save_token_state, restore_token_state */ #include "signames.h" #include "builtins.h" @@ -54,7 +55,7 @@ extern int errno; #define SIG_CHANGED 0x20 /* Trap value changed in trap handler. */ #define SIG_IGNORED 0x40 /* The signal is currently being ignored. */ -#define SPECIAL_TRAP(s) ((s) == EXIT_TRAP || (s) == DEBUG_TRAP || (s) == ERROR_TRAP) +#define SPECIAL_TRAP(s) ((s) == EXIT_TRAP || (s) == DEBUG_TRAP || (s) == ERROR_TRAP || (s) == RETURN_TRAP) /* An array of such flags, one for each signal, describing what the shell will do with a signal. DEBUG_TRAP == NSIG; some code below @@ -66,7 +67,7 @@ static void change_signal __P((int, char *)); static void get_original_signal __P((int)); -static void _run_trap_internal __P((int, char *)); +static int _run_trap_internal __P((int, char *)); static void reset_signal __P((int)); static void restore_signal __P((int)); @@ -77,8 +78,11 @@ extern int interrupt_immediately; extern int last_command_exit_value; extern int line_number; +extern char *this_command_name; extern sh_builtin_func_t *this_shell_builtin; extern procenv_t wait_intr_buf; +extern int return_catch_flag, return_catch_value; +extern int subshell_level; /* The list of things to do originally, before we started trapping. */ SigHandler *original_signals[NSIG]; @@ -99,11 +103,6 @@ int pending_traps[NSIG]; trap command (e.g., when `return' is executed in the trap command). */ int running_trap; -/* The value of line_number when the trap started executing, since - parse_and_execute resets it to 1 and the trap command might want - it. */ -int trap_line_number; - /* The (trapped) signal received while executing in the `wait' builtin */ int wait_signal_received; @@ -115,8 +114,8 @@ initialize_traps () { register int i; - trap_list[EXIT_TRAP] = trap_list[DEBUG_TRAP] = trap_list[ERROR_TRAP] = (char *)NULL; - sigmodes[EXIT_TRAP] = sigmodes[DEBUG_TRAP] = sigmodes[ERROR_TRAP] = SIG_INHERITED; + trap_list[EXIT_TRAP] = trap_list[DEBUG_TRAP] = trap_list[ERROR_TRAP] = trap_list[RETURN_TRAP] = (char *)NULL; + sigmodes[EXIT_TRAP] = sigmodes[DEBUG_TRAP] = sigmodes[ERROR_TRAP] = sigmodes[RETURN_TRAP] = SIG_INHERITED; original_signals[EXIT_TRAP] = IMPOSSIBLE_TRAP_HANDLER; for (i = 1; i < NSIG; i++) @@ -197,10 +196,12 @@ signal_name (sig) then (int)2 is returned. Return NO_SIG if STRING doesn't contain a valid signal descriptor. */ int -decode_signal (string) +decode_signal (string, flags) char *string; + int flags; { intmax_t sig; + char *name; if (legal_number (string, &sig)) return ((sig >= 0 && sig < NSIG) ? (int)sig : NO_SIG); @@ -208,11 +209,32 @@ decode_signal (string) /* A leading `SIG' may be omitted. */ for (sig = 0; sig < BASH_NSIG; sig++) { - if (signal_names[sig] == 0 || signal_names[sig][0] == '\0') + name = signal_names[sig]; + if (name == 0 || name[0] == '\0') continue; - if (strcasecmp (string, signal_names[sig]) == 0 || - (STREQN (signal_names[sig], "SIG", 3) && - strcasecmp (string, &(signal_names[sig])[3]) == 0)) + + /* Check name without the SIG prefix first case sensitivly or + insensitively depending on whether flags includes DSIG_NOCASE */ + if (STREQN (name, "SIG", 3)) + { + name += 3; + + if ((flags & DSIG_NOCASE) && strcasecmp (string, name) == 0) + return ((int)sig); + else if ((flags & DSIG_NOCASE) == 0 && strcmp (string, name) == 0) + return ((int)sig); + /* If we can't use the `SIG' prefix to match, punt on this + name now. */ + else if ((flags & DSIG_SIGPREFIX) == 0) + continue; + } + + /* Check name with SIG prefix case sensitively or insensitively + depending on whether flags includes DSIG_NOCASE */ + name = signal_names[sig]; + if ((flags & DSIG_NOCASE) && strcasecmp (string, name) == 0) + return ((int)sig); + else if ((flags & DSIG_NOCASE) == 0 && strcmp (string, name) == 0) return ((int)sig); } @@ -381,6 +403,13 @@ set_error_trap (command) set_signal (ERROR_TRAP, command); } +void +set_return_trap (command) + char *command; +{ + set_signal (RETURN_TRAP, command); +} + #ifdef INCLUDE_UNUSED void set_sigint_trap (command) @@ -541,7 +570,8 @@ restore_default_signal (sig) { if (SPECIAL_TRAP (sig)) { - if ((sig != DEBUG_TRAP && sig != ERROR_TRAP) || (sigmodes[sig] & SIG_INPROGRESS) == 0) + if ((sig != DEBUG_TRAP && sig != ERROR_TRAP && sig != RETURN_TRAP) || + (sigmodes[sig] & SIG_INPROGRESS) == 0) free_trap_command (sig); trap_list[sig] = (char *)NULL; sigmodes[sig] &= ~SIG_TRAPPED; @@ -609,9 +639,10 @@ int run_exit_trap () { char *trap_command; - int code, old_exit_value; + int code, function_code, old_exit_value; old_exit_value = last_command_exit_value; + function_code = 0; /* Run the trap only if signal 0 is trapped and not ignored, and we are not currently running in the trap handler (call to exit in the list of @@ -625,13 +656,21 @@ run_exit_trap () code = setjmp (top_level); - if (code == 0) + /* If we're in a function, make sure return longjmps come here, too. */ + if (return_catch_flag) + function_code = setjmp (return_catch); + + if (code == 0 && function_code == 0) { reset_parser (); parse_and_execute (trap_command, "exit trap", SEVAL_NONINT|SEVAL_NOHIST); } + else if (code == ERREXIT) + return (last_command_exit_value); else if (code == EXITPROG) return (last_command_exit_value); + else if (function_code != 0) + return (return_catch_value); else return (old_exit_value); } @@ -647,15 +686,16 @@ run_trap_cleanup (sig) } /* Run a trap command for SIG. SIG is one of the signals the shell treats - specially. */ -static void + specially. Returns the exit status of the executed trap command list. */ +static int _run_trap_internal (sig, tag) int sig; char *tag; { char *trap_command, *old_trap; - int old_exit_value, *token_state; + int old_exit_value, *token_state, trap_exit_value; + trap_exit_value = 0; /* Run the trap only if SIG is trapped and not ignored, and we are not currently executing in the trap handler. */ if ((sigmodes[sig] & SIG_TRAPPED) && ((sigmodes[sig] & SIG_IGNORED) == 0) && @@ -669,15 +709,13 @@ _run_trap_internal (sig, tag) running_trap = sig + 1; old_exit_value = last_command_exit_value; - /* Need to copy the value of line_number because parse_and_execute - resets it to 1, and the trap command might want it. */ - trap_line_number = line_number; token_state = save_token_state (); parse_and_execute (trap_command, tag, SEVAL_NONINT|SEVAL_NOHIST); restore_token_state (token_state); free (token_state); + trap_exit_value = last_command_exit_value; last_command_exit_value = old_exit_value; running_trap = 0; @@ -685,26 +723,63 @@ _run_trap_internal (sig, tag) if (sigmodes[sig] & SIG_CHANGED) { - free (old_trap); +#if 0 + /* Special traps like EXIT, DEBUG, RETURN are handled explicitly in + the places where they can be changed using unwind-protects. For + example, look at execute_cmd.c:execute_function(). */ + if (SPECIAL_TRAP (sig) == 0) +#endif + free (old_trap); sigmodes[sig] &= ~SIG_CHANGED; } } + return trap_exit_value; } -void +int run_debug_trap () { - if ((sigmodes[DEBUG_TRAP] & SIG_TRAPPED) && ((sigmodes[DEBUG_TRAP] & SIG_INPROGRESS) == 0)) - _run_trap_internal (DEBUG_TRAP, "debug trap"); + int trap_exit_value; + + /* XXX - question: should the DEBUG trap inherit the RETURN trap? */ + trap_exit_value = 0; + if ((sigmodes[DEBUG_TRAP] & SIG_TRAPPED) && ((sigmodes[DEBUG_TRAP] & SIG_IGNORED) == 0) && ((sigmodes[DEBUG_TRAP] & SIG_INPROGRESS) == 0)) + { + trap_exit_value = _run_trap_internal (DEBUG_TRAP, "debug trap"); + +#if defined (DEBUGGER) + /* If we're in the debugger and the DEBUG trap returns 2 while we're in + a function or sourced script, we force a `return'. */ + if (debugging_mode && trap_exit_value == 2 && return_catch_flag) + { + return_catch_value = trap_exit_value; + longjmp (return_catch, 1); + } +#endif + } + return trap_exit_value; } void run_error_trap () { - if ((sigmodes[ERROR_TRAP] & SIG_TRAPPED) && (sigmodes[ERROR_TRAP] & SIG_INPROGRESS) == 0) + if ((sigmodes[ERROR_TRAP] & SIG_TRAPPED) && ((sigmodes[ERROR_TRAP] & SIG_IGNORED) == 0) && (sigmodes[ERROR_TRAP] & SIG_INPROGRESS) == 0) _run_trap_internal (ERROR_TRAP, "error trap"); } +void +run_return_trap () +{ + int old_exit_value; + + if ((sigmodes[RETURN_TRAP] & SIG_TRAPPED) && ((sigmodes[RETURN_TRAP] & SIG_IGNORED) == 0) && (sigmodes[RETURN_TRAP] & SIG_INPROGRESS) == 0) + { + old_exit_value = last_command_exit_value; + _run_trap_internal (RETURN_TRAP, "return trap"); + last_command_exit_value = old_exit_value; + } +} + /* Run a trap set on SIGINT. This is called from throw_to_top_level (), and declared here to localize the trap functions. */ void @@ -727,7 +802,7 @@ free_trap_strings () trap_list[i] = (char *)DEFAULT_SIG; sigmodes[i] &= ~SIG_TRAPPED; } - trap_list[DEBUG_TRAP] = trap_list[EXIT_TRAP] = trap_list[ERROR_TRAP] = (char *)NULL; + trap_list[DEBUG_TRAP] = trap_list[EXIT_TRAP] = trap_list[ERROR_TRAP] = trap_list[RETURN_TRAP] = (char *)NULL; } #endif @@ -764,6 +839,7 @@ reset_or_restore_signal_handlers (reset) trap_list[EXIT_TRAP] = (char *)NULL; sigmodes[EXIT_TRAP] &= ~SIG_TRAPPED; } + for (i = 1; i < NSIG; i++) { if (sigmodes[i] & SIG_TRAPPED) @@ -778,9 +854,22 @@ reset_or_restore_signal_handlers (reset) } /* Command substitution and other child processes don't inherit the - debug or error traps. */ - sigmodes[DEBUG_TRAP] &= ~SIG_TRAPPED; - sigmodes[ERROR_TRAP] &= ~SIG_TRAPPED; + debug, error, or return traps. If we're in the debugger, and the + `functrace' or `errtrace' options have been set, then let command + substitutions inherit them. Let command substitution inherit the + RETURN trap if we're in the debugger and tracing functions. */ +#if defined (DEBUGGER) + if (debugging_mode == 0 || function_trace_mode == 0) +#endif + sigmodes[DEBUG_TRAP] &= ~SIG_TRAPPED; +#if defined (DEBUGGER) + if (debugging_mode == 0 || error_trace_mode == 0) +#endif + sigmodes[ERROR_TRAP] &= ~SIG_TRAPPED; +#if defined (DEBUGGER) + if (debugging_mode == 0 || function_trace_mode == 0) + sigmodes[RETURN_TRAP] &= ~SIG_TRAPPED; +#endif } /* Reset trapped signals to their original values, but don't free the @@ -33,18 +33,23 @@ #endif /* !NSIG */ #define NO_SIG -1 -#define DEFAULT_SIG SIG_DFL -#define IGNORE_SIG SIG_IGN +#define DEFAULT_SIG SIG_DFL +#define IGNORE_SIG SIG_IGN /* Special shell trap names. */ -#define DEBUG_TRAP NSIG -#define ERROR_TRAP NSIG+1 -#define EXIT_TRAP 0 +#define DEBUG_TRAP NSIG +#define ERROR_TRAP NSIG+1 +#define RETURN_TRAP NSIG+2 +#define EXIT_TRAP 0 /* system signals plus special bash traps */ -#define BASH_NSIG NSIG+2 +#define BASH_NSIG NSIG+3 -#define signal_object_p(x) (decode_signal (x) != NO_SIG) +/* Flags values for decode_signal() */ +#define DSIG_SIGPREFIX 0x01 /* don't alllow `SIG' PREFIX */ +#define DSIG_NOCASE 0x02 /* case-insensitive comparison */ + +#define signal_object_p(x,f) (decode_signal (x,f) != NO_SIG) #define TRAP_STRING(s) \ (signal_is_trapped (s) && signal_is_ignored (s) == 0) ? trap_list[s] \ @@ -54,26 +59,34 @@ extern char *trap_list[]; /* Externally-visible functions declared in trap.c. */ extern void initialize_traps __P((void)); + extern void run_pending_traps __P((void)); + extern void maybe_set_sigchld_trap __P((char *)); extern void set_sigchld_trap __P((char *)); + extern void set_debug_trap __P((char *)); extern void set_error_trap __P((char *)); +extern void set_return_trap __P((char *)); + extern void set_sigint_trap __P((char *)); extern void set_signal __P((int, char *)); + extern void restore_default_signal __P((int)); extern void ignore_signal __P((int)); extern int run_exit_trap __P((void)); extern void run_trap_cleanup __P((int)); -extern void run_debug_trap __P((void)); +extern int run_debug_trap __P((void)); extern void run_error_trap __P((void)); +extern void run_return_trap __P((void)); + extern void free_trap_strings __P((void)); extern void reset_signal_handlers __P((void)); extern void restore_original_signals __P((void)); extern char *signal_name __P((int)); -extern int decode_signal __P((char *)); +extern int decode_signal __P((char *, int)); extern void run_interrupt_trap __P((void)); extern int maybe_call_trap_handler __P((int)); extern int signal_is_trapped __P((int)); diff --git a/variables.c b/variables.c index 1f9180e8..97a00849 100644 --- a/variables.c +++ b/variables.c @@ -1,6 +1,6 @@ /* variables.c -- Functions for hacking shell variables. */ -/* Copyright (C) 1987-2002 Free Software Foundation, Inc. +/* Copyright (C) 1987-2003 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -72,17 +72,24 @@ /* Variables used here and defined in other files. */ extern int posixly_correct; extern int line_number; -extern int subshell_environment, indirection_level; +extern int subshell_environment, indirection_level, subshell_level; extern int build_version, patch_level; +extern int expanding_redir; extern char *dist_version, *release_status; extern char *shell_name; extern char *primary_prompt, *secondary_prompt; extern char *current_host_name; extern sh_builtin_func_t *this_shell_builtin; extern SHELL_VAR *this_shell_function; +extern char *the_printed_command_except_trap; extern char *this_command_name; +extern char *command_execution_string; extern time_t shell_start_time; +#if defined (READLINE) +extern int perform_hostname_completion; +#endif + /* The list of shell variables that the user has created at the global scope, or that came from the environment. */ VAR_CONTEXT *global_variables = (VAR_CONTEXT *)NULL; @@ -94,6 +101,12 @@ VAR_CONTEXT *shell_variables = (VAR_CONTEXT *)NULL; the environment. */ HASH_TABLE *shell_functions = (HASH_TABLE *)NULL; +#if defined (DEBUGGER) +/* The table of shell function definitions that the user defined or that + came from the environment. */ +HASH_TABLE *shell_function_defs = (HASH_TABLE *)NULL; +#endif + /* The current variable context. This is really a count of how deep into executing functions we are. */ int variable_context = 0; @@ -139,6 +152,11 @@ static SHELL_VAR *null_assign __P((SHELL_VAR *, char *, arrayind_t)); #if defined (ARRAY_VARS) static SHELL_VAR *null_array_assign __P((SHELL_VAR *, char *, arrayind_t)); #endif +static SHELL_VAR *get_self __P((SHELL_VAR *)); + +#if defined (ARRAY_VARS) +static SHELL_VAR *init_dynamic_array_var __P((char *, sh_var_value_func_t *, sh_var_assign_func_t *, int)); +#endif static SHELL_VAR *assign_seconds __P((SHELL_VAR *, char *, arrayind_t)); static SHELL_VAR *get_seconds __P((SHELL_VAR *)); @@ -152,6 +170,9 @@ static SHELL_VAR *get_random __P((SHELL_VAR *)); static SHELL_VAR *assign_lineno __P((SHELL_VAR *, char *, arrayind_t)); static SHELL_VAR *get_lineno __P((SHELL_VAR *)); +static SHELL_VAR *assign_subshell __P((SHELL_VAR *, char *, arrayind_t)); +static SHELL_VAR *get_subshell __P((SHELL_VAR *)); + #if defined (HISTORY) static SHELL_VAR *get_histcmd __P((SHELL_VAR *)); #endif @@ -159,12 +180,10 @@ static SHELL_VAR *get_histcmd __P((SHELL_VAR *)); #if defined (PUSHD_AND_POPD) && defined (ARRAY_VARS) static SHELL_VAR *assign_dirstack __P((SHELL_VAR *, char *, arrayind_t)); static SHELL_VAR *get_dirstack __P((SHELL_VAR *)); -static SHELL_VAR *init_dirstack_var __P((void)); #endif #if defined (ARRAY_VARS) static SHELL_VAR *get_groupset __P((SHELL_VAR *)); -static SHELL_VAR *init_groups_var __P((void)); #endif static SHELL_VAR *get_funcname __P((SHELL_VAR *)); @@ -239,6 +258,11 @@ initialize_shell_variables (env, privmode) if (shell_functions == 0) shell_functions = hash_create (0); +#if defined (DEBUGGER) + if (shell_function_defs == 0) + shell_function_defs = hash_create (0); +#endif + for (string_index = 0; string = env[string_index++]; ) { char_index = 0; @@ -408,6 +432,9 @@ initialize_shell_variables (env, privmode) make_vers_array (); #endif + if (command_execution_string) + bind_variable ("BASH_EXECUTION_STRING", command_execution_string); + /* Find out if we're supposed to be in Posix.2 mode via an environment variable. */ temp_var = find_variable ("POSIXLY_CORRECT"); @@ -986,6 +1013,38 @@ null_array_assign (self, value, ind) } #endif +/* Degenerate `dynamic_value' function; just returns what's passed without + manipulation. */ +static SHELL_VAR * +get_self (self) + SHELL_VAR *self; +{ + return (self); +} + +#if defined (ARRAY_VARS) +/* A generic dynamic array variable initializer. Intialize array variable + NAME with dynamic value function GETFUNC and assignment function SETFUNC. */ +static SHELL_VAR * +init_dynamic_array_var (name, getfunc, setfunc, attrs) + char *name; + sh_var_value_func_t *getfunc; + sh_var_assign_func_t *setfunc; + int attrs; +{ + SHELL_VAR *v; + + v = find_variable (name); + if (v) + return (v); + INIT_DYNAMIC_ARRAY_VAR (name, getfunc, setfunc); + if (attrs) + VSETATTR (v, attrs); + return v; +} +#endif + + /* The value of $SECONDS. This is the number of seconds since shell invocation, or, the number of seconds since the last assignment + the value of the last assignment. */ @@ -1132,6 +1191,44 @@ get_lineno (var) return (var); } +static SHELL_VAR * +assign_subshell (var, value, unused) + SHELL_VAR *var; + char *value; + arrayind_t unused; +{ + intmax_t new_value; + + if (value == 0 || *value == '\0' || legal_number (value, &new_value) == 0) + new_value = 0; + subshell_level = new_value; + return var; +} + +static SHELL_VAR * +get_subshell (var) + SHELL_VAR *var; +{ + char *p; + + p = itos (subshell_level); + FREE (value_cell (var)); + var_setvalue (var, p); + return (var); +} + +static SHELL_VAR * +get_bash_command (var) + SHELL_VAR *var; +{ + char *p; + + p = savestring (the_printed_command_except_trap); + FREE (value_cell (var)); + var_setvalue (var, p); + return (var); +} + #if defined (HISTORY) static SHELL_VAR * get_histcmd (var) @@ -1146,8 +1243,49 @@ get_histcmd (var) } #endif +#if defined (READLINE) +/* When this function returns, VAR->value points to malloced memory. */ +static SHELL_VAR * +get_comp_wordbreaks (var) + SHELL_VAR *var; +{ + char *p; + + /* If we don't have anything yet, assign a default value. */ + if (rl_completer_word_break_characters == 0 && bash_readline_initialized == 0) + enable_hostname_completion (perform_hostname_completion); + +#if 0 + FREE (value_cell (var)); + p = savestring (rl_completer_word_break_characters); + + var_setvalue (var, p); +#else + var_setvalue (var, rl_completer_word_break_characters); +#endif + + return (var); +} + +/* When this function returns, rl_completer_word_break_characters points to + malloced memory. */ +static SHELL_VAR * +assign_comp_wordbreaks (self, value, unused) + SHELL_VAR *self; + char *value; + arrayind_t unused; +{ + if (rl_completer_word_break_characters && + rl_completer_word_break_characters != rl_basic_word_break_characters) + free (rl_completer_word_break_characters); + + rl_completer_word_break_characters = savestring (value); + return self; +} +#endif /* READLINE */ + #if defined (PUSHD_AND_POPD) && defined (ARRAY_VARS) -static SHELL_VAR * +static SHELL_VAR * assign_dirstack (self, value, ind) SHELL_VAR *self; char *value; @@ -1171,18 +1309,6 @@ get_dirstack (self) var_setarray (self, a); return self; } - -static SHELL_VAR * -init_dirstack_var () -{ - SHELL_VAR *v; - - v = find_variable ("DIRSTACK"); - if (v) - return v; - INIT_DYNAMIC_ARRAY_VAR ("DIRSTACK", get_dirstack, assign_dirstack); - return v; -} #endif /* PUSHD AND POPD && ARRAY_VARS */ #if defined (ARRAY_VARS) @@ -1206,25 +1332,15 @@ get_groupset (self) } return (self); } - -static SHELL_VAR * -init_groups_var () -{ - SHELL_VAR *v; - - v = find_variable ("GROUPS"); - if (v) - return (v); - INIT_DYNAMIC_ARRAY_VAR ("GROUPS", get_groupset, null_array_assign); - VSETATTR (v, att_noassign); - return v; -} #endif /* ARRAY_VARS */ +/* If ARRAY_VARS is not defined, this just returns the name of any + currently-executing function. If we have arrays, it's a call stack. */ static SHELL_VAR * get_funcname (self) SHELL_VAR *self; { +#if ! defined (ARRAY_VARS) char *t; if (variable_context && this_shell_function) { @@ -1232,6 +1348,7 @@ get_funcname (self) t = savestring (this_shell_function->name); var_setvalue (self, t); } +#endif return (self); } @@ -1259,7 +1376,11 @@ init_funcname_var () v = find_variable ("FUNCNAME"); if (v) return v; +#if defined (ARRAY_VARS) + INIT_DYNAMIC_ARRAY_VAR ("FUNCNAME", get_funcname, null_array_assign); +#else INIT_DYNAMIC_VAR ("FUNCNAME", (char *)NULL, get_funcname, null_assign); +#endif VSETATTR (v, att_invisible|att_noassign); return v; } @@ -1271,6 +1392,9 @@ initialize_dynamic_variables () v = init_seconds_var (); + INIT_DYNAMIC_VAR ("BASH_COMMAND", (char *)NULL, get_bash_command, (sh_var_assign_func_t *)NULL); + INIT_DYNAMIC_VAR ("BASH_SUBSHELL", (char *)NULL, get_subshell, assign_subshell); + INIT_DYNAMIC_VAR ("RANDOM", (char *)NULL, get_random, assign_random); INIT_DYNAMIC_VAR ("LINENO", (char *)NULL, get_lineno, assign_lineno); @@ -1278,12 +1402,23 @@ initialize_dynamic_variables () INIT_DYNAMIC_VAR ("HISTCMD", (char *)NULL, get_histcmd, (sh_var_assign_func_t *)NULL); #endif +#if defined (READLINE) + INIT_DYNAMIC_VAR ("COMP_WORDBREAKS", (char *)NULL, get_comp_wordbreaks, assign_comp_wordbreaks); +#endif + #if defined (PUSHD_AND_POPD) && defined (ARRAY_VARS) - v = init_dirstack_var (); + v = init_dynamic_array_var ("DIRSTACK", get_dirstack, assign_dirstack, 0); #endif /* PUSHD_AND_POPD && ARRAY_VARS */ #if defined (ARRAY_VARS) - v = init_groups_var (); + v = init_dynamic_array_var ("GROUPS", get_groupset, null_array_assign, att_noassign); + +# if defined (DEBUGGER) + v = init_dynamic_array_var ("BASH_ARGC", get_self, null_array_assign, (att_invisible|att_noassign)); + v = init_dynamic_array_var ("BASH_ARGV", get_self, null_array_assign, (att_invisible|att_noassign)); +# endif /* DEBUGGER */ + v = init_dynamic_array_var ("BASH_SOURCE", get_self, null_array_assign, (att_invisible|att_noassign)); + v = init_dynamic_array_var ("BASH_LINENO", get_self, null_array_assign, (att_invisible|att_noassign)); #endif v = init_funcname_var (); @@ -1334,11 +1469,12 @@ var_lookup (name, vcontext) */ SHELL_VAR * -find_variable_internal (name, search_tempenv) +find_variable_internal (name, force_tempenv) const char *name; - int search_tempenv; + int force_tempenv; { SHELL_VAR *var; + int search_tempenv; var = (SHELL_VAR *)NULL; @@ -1347,7 +1483,9 @@ find_variable_internal (name, search_tempenv) to get the `exported' value of $foo. This happens if we are executing a function or builtin, or if we are looking up a variable in a "subshell environment". */ - if ((search_tempenv || subshell_environment) && temporary_env) + search_tempenv = force_tempenv || (expanding_redir == 0 && subshell_environment); + + if (search_tempenv && temporary_env) var = hash_lookup (name, temporary_env); if (var == 0) @@ -1364,7 +1502,7 @@ SHELL_VAR * find_variable (name) const char *name; { - return (find_variable_internal (name, this_shell_builtin != 0)); + return (find_variable_internal (name, (expanding_redir == 0 && this_shell_builtin != 0))); } /* Look up the function entry whose name matches STRING. @@ -1376,6 +1514,15 @@ find_function (name) return (hash_lookup (name, shell_functions)); } +/* Find the function definition for the shell function named NAME. Returns + the entry or NULL. */ +FUNCTION_DEF * +find_function_def (name) + const char *name; +{ + return ((FUNCTION_DEF *)hash_lookup (name, shell_function_defs)); +} + /* Return the value of VAR. VAR is assumed to have been the result of a lookup without any subscript, if arrays are compiled into the shell. */ char * @@ -1788,7 +1935,11 @@ bind_int_variable (lhs, rhs) isint = isarr = 0; #if defined (ARRAY_VARS) +# if 0 if (t = xstrchr (lhs, '[')) /*]*/ +# else + if (valid_array_reference (lhs)) +# endif { isarr = 1; v = array_variable_part (lhs, (char **)0, (int *)0); @@ -1873,6 +2024,31 @@ bind_function (name, value) return (entry); } +/* Bind a function definition, which includes source file and line number + information in addition to the command, into the FUNCTION_DEF hash table.*/ +void +bind_function_def (name, value) + const char *name; + FUNCTION_DEF *value; +{ + FUNCTION_DEF *entry; + BUCKET_CONTENTS *elt; + + entry = find_function_def (name); + if (entry) + { + dispose_function_def_contents (entry); + entry = copy_function_def_contents (value, entry); + } + else + { + entry = copy_function_def (value); + + elt = hash_insert (savestring (name), shell_function_defs, HASH_NOSRCH); + elt->data = (PTR_T *)entry; + } +} + /* Add STRING, which is of the form foo=bar, to the temporary environment HASH_TABLE (temporary_env). The functions in execute_cmd.c are responsible for moving the main temporary env to one of the other @@ -2062,6 +2238,28 @@ unbind_func (name) return 0; } +int +unbind_function_def (name) + const char *name; +{ + BUCKET_CONTENTS *elt; + FUNCTION_DEF *funcdef; + + elt = hash_remove (name, shell_function_defs, 0); + + if (elt == 0) + return -1; + + funcdef = (FUNCTION_DEF *)elt->data; + if (funcdef) + dispose_function_def (funcdef); + + free (elt->key); + free (elt); + + return 0; +} + /* Make the variable associated with NAME go away. HASH_LIST is the hash table from which this variable should be deleted (either shell_variables or shell_functions). @@ -3334,6 +3532,56 @@ dispose_saved_dollar_vars () dollar_arg_stack[dollar_arg_stack_index] = (WORD_LIST *)NULL; } +/* Manipulate the special BASH_ARGV and BASH_ARGC variables. */ + +void +push_args (list) + WORD_LIST *list; +{ +#if defined (ARRAY_VARS) && defined (DEBUGGER) + SHELL_VAR *bash_argv_v, *bash_argc_v; + ARRAY *bash_argv_a, *bash_argc_a; + WORD_LIST *l; + arrayind_t i; + char *t; + + GET_ARRAY_FROM_VAR ("BASH_ARGV", bash_argv_v, bash_argv_a); + GET_ARRAY_FROM_VAR ("BASH_ARGC", bash_argc_v, bash_argc_a); + + for (l = list, i = 0; l; l = l->next, i++) + array_push (bash_argv_a, l->word->word); + + t = itos (i); + array_push (bash_argc_a, t); + free (t); +#endif /* ARRAY_VARS && DEBUGGER */ +} + +/* Remove arguments from BASH_ARGV array. Pop top element off BASH_ARGC + array and use that value as the count of elements to remove from + BASH_ARGV. */ +void +pop_args () +{ +#if defined (ARRAY_VARS) && defined (DEBUGGER) + SHELL_VAR *bash_argv_v, *bash_argc_v; + ARRAY *bash_argv_a, *bash_argc_a; + ARRAY_ELEMENT *ce; + intmax_t i; + + GET_ARRAY_FROM_VAR ("BASH_ARGV", bash_argv_v, bash_argv_a); + GET_ARRAY_FROM_VAR ("BASH_ARGC", bash_argc_v, bash_argc_a); + + ce = array_shift (bash_argc_a, 1, 0); + if (ce == 0 || legal_number (element_value (ce), &i) == 0) + i = 0; + + for ( ; i > 0; i--) + array_pop (bash_argv_a); + array_dispose_element (ce); +#endif /* ARRAY_VARS && DEBUGGER */ +} + /************************************************* * * * Functions to manage special variables * @@ -3369,6 +3617,7 @@ static struct name_and_function special_vars[] = { { "HISTFILESIZE", sv_histsize }, { "HISTIGNORE", sv_histignore }, { "HISTSIZE", sv_histsize }, + { "HISTTIMEFORMAT", sv_histtimefmt }, #endif #if defined (READLINE) @@ -3598,18 +3847,28 @@ sv_history_control (name) char *name; { char *temp; + char *val; + int tptr; history_control = 0; temp = get_string_value (name); - if (temp && *temp && STREQN (temp, "ignore", 6)) + if (temp == 0 || *temp == 0) + return; + + tptr = 0; + while (val = extract_colon_unit (temp, &tptr)) { - if (temp[6] == 's') /* ignorespace */ - history_control = 1; - else if (temp[6] == 'd') /* ignoredups */ - history_control = 2; - else if (temp[6] == 'b') /* ignoreboth */ - history_control = 3; + if (STREQ (val, "ignorespace")) + history_control |= HC_IGNSPACE; + else if (STREQ (val, "ignoredups")) + history_control |= HC_IGNDUPS; + else if (STREQ (val, "ignoreboth")) + history_control |= HC_IGNBOTH; + else if (STREQ (val, "erasedups")) + history_control |= HC_ERASEDUPS; + + free (val); } } @@ -3640,6 +3899,16 @@ sv_histchars (name) } } #endif /* BANG_HISTORY */ + +void +sv_histtimefmt (name) + char *name; +{ + SHELL_VAR *v; + + v = find_variable (name); + history_write_timestamps = (v != 0); +} #endif /* HISTORY */ #if defined (HAVE_TZSET) && defined (PROMPT_STRING_DECODE) diff --git a/variables.h b/variables.h index 213f6ff7..cd11fd97 100644 --- a/variables.h +++ b/variables.h @@ -71,7 +71,11 @@ union _value { ARRAY *a; /* array */ HASH_TABLE *h; /* associative array */ double d; /* floating point number */ - void *v; /* opaque data for future use */ +#if defined (HAVE_LONG_DOUBLE) + long double ld; /* long double */ +#endif + struct variable *v; /* possible indirect variable use */ + void *opaque; /* opaque data for future use */ }; typedef struct variable { @@ -214,6 +218,7 @@ extern void make_funcname_visible __P((int)); extern SHELL_VAR *var_lookup __P((const char *, VAR_CONTEXT *)); extern SHELL_VAR *find_function __P((const char *)); +extern FUNCTION_DEF *find_function_def __P((const char *)); extern SHELL_VAR *find_variable __P((const char *)); extern SHELL_VAR *find_variable_internal __P((const char *, int)); extern SHELL_VAR *find_tempenv_variable __P((const char *)); @@ -222,6 +227,8 @@ extern SHELL_VAR *make_local_variable __P((const char *)); extern SHELL_VAR *bind_variable __P((const char *, char *)); extern SHELL_VAR *bind_function __P((const char *, COMMAND *)); +extern void bind_function_def __P((const char *, FUNCTION_DEF *)); + extern SHELL_VAR **map_over __P((sh_var_map_func_t *, VAR_CONTEXT *)); SHELL_VAR **map_over_funcs __P((sh_var_map_func_t *)); @@ -252,6 +259,7 @@ extern SHELL_VAR *bind_var_to_int __P((char *, intmax_t)); extern int assign_in_env __P((const char *)); extern int unbind_variable __P((const char *)); extern int unbind_func __P((const char *)); +extern int unbind_function_def __P((const char *)); extern int makunbound __P((const char *, VAR_CONTEXT *)); extern int kill_local_variable __P((const char *)); extern void delete_all_variables __P((HASH_TABLE *)); @@ -270,6 +278,9 @@ extern void push_dollar_vars __P((void)); extern void pop_dollar_vars __P((void)); extern void dispose_saved_dollar_vars __P((void)); +extern void push_args __P((WORD_LIST *)); +extern void pop_args __P((void)); + extern void adjust_shell_level __P((int)); extern void non_unsettable __P((char *)); extern void dispose_variable __P((SHELL_VAR *)); @@ -326,6 +337,7 @@ extern void sv_opterr __P((char *)); extern void sv_locale __P((char *)); #if defined (READLINE) +extern void sv_comp_wordbreaks __P((char *)); extern void sv_terminal __P((char *)); extern void sv_hostfile __P((char *)); #endif @@ -341,6 +353,7 @@ extern void sv_history_control __P((char *)); # if defined (BANG_HISTORY) extern void sv_histchars __P((char *)); # endif +extern void sv_histtimefmt __P((char *)); #endif /* HISTORY */ #endif /* !_VARIABLES_H_ */ @@ -43,6 +43,10 @@ const char *sccs_version = SCCSVERSION; /* Functions for getting, setting, and displaying the shell version. */ +/* Forward declarations so we don't have to include externs.h */ +extern char *shell_version_string __P((void)); +extern void show_shell_version __P((int)); + /* Give version information about this shell. */ char * shell_version_string () @@ -96,6 +96,8 @@ #if defined (ALIAS) # include "alias.h" +#else +typedef void *alias_t; #endif /* ALIAS */ #if defined (PROMPT_STRING_DECODE) @@ -198,7 +200,7 @@ static char *parse_compound_assignment __P((int *)); #endif #if defined (DPAREN_ARITHMETIC) || defined (ARITH_FOR_COMMAND) static int parse_dparen __P((int)); -static int parse_arith_cmd __P((char **)); +static int parse_arith_cmd __P((char **, int)); #endif #if defined (COND_COMMAND) static void cond_error __P((void)); @@ -266,6 +268,11 @@ int expand_aliases = 0; decode_prompt_string. */ int promptvars = 1; +/* If non-zero, $'...' and $"..." are expanded when they appear within + a ${...} expansion, even when the expansion appears within double + quotes. */ +int extended_quote = 1; + /* The decoded prompt string. Used if READLINE is not defined or if editing is turned off. Analogous to current_readline_prompt. */ static char *current_decoded_prompt; @@ -297,9 +304,16 @@ static int function_bstart; /* The line number in a script at which an arithmetic for command starts. */ static int arith_for_lineno; +/* The line number in a script where the word in a `case WORD', `select WORD' + or `for WORD' begins. This is a nested command maximum, since the array + index is decremented after a case, select, or for command is parsed. */ +#define MAX_CASE_NEST 128 +static int word_lineno[MAX_CASE_NEST]; +static int word_top = -1; + static REDIRECTEE redir; -#line 276 "/usr/homes/chet/src/bash/src/parse.y" +#line 290 "/usr/homes/chet/src/bash/src/parse.y" #ifndef YYSTYPE typedef union { WORD_DESC *word; /* the word that we read. */ @@ -446,20 +460,20 @@ static const short yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const short yyrline[] = { - 0, 326, 335, 342, 357, 367, 369, 373, 378, 383, - 388, 393, 398, 403, 409, 415, 420, 425, 430, 435, - 440, 445, 450, 455, 460, 465, 472, 479, 484, 489, - 494, 499, 504, 509, 514, 519, 526, 528, 530, 534, - 538, 549, 551, 555, 557, 559, 575, 579, 581, 583, - 585, 587, 589, 591, 593, 595, 597, 599, 603, 605, - 607, 609, 611, 613, 615, 617, 621, 623, 625, 627, - 631, 635, 639, 643, 647, 651, 657, 659, 661, 665, - 668, 671, 676, 678, 709, 716, 718, 720, 725, 729, - 733, 737, 739, 741, 745, 746, 750, 752, 754, 756, - 760, 761, 765, 767, 776, 784, 785, 791, 792, 799, - 803, 805, 807, 814, 816, 818, 822, 823, 826, 827, - 828, 831, 832, 841, 847, 856, 864, 866, 868, 875, - 878, 882, 884, 889, 894, 899, 906, 909, 913, 915 + 0, 340, 349, 356, 371, 381, 383, 387, 392, 397, + 402, 407, 412, 417, 423, 429, 434, 439, 444, 449, + 454, 459, 464, 469, 474, 479, 486, 493, 498, 503, + 508, 513, 518, 523, 528, 533, 540, 542, 544, 548, + 552, 563, 565, 569, 571, 573, 589, 593, 595, 597, + 599, 601, 603, 605, 607, 609, 611, 613, 617, 622, + 627, 632, 637, 642, 647, 652, 659, 664, 669, 674, + 681, 686, 691, 696, 701, 706, 713, 718, 723, 730, + 733, 736, 741, 743, 774, 781, 783, 785, 790, 794, + 798, 802, 804, 806, 810, 811, 815, 817, 819, 821, + 825, 826, 830, 832, 841, 849, 850, 856, 857, 864, + 868, 870, 872, 879, 881, 883, 887, 888, 891, 892, + 893, 896, 897, 906, 912, 921, 929, 931, 933, 940, + 943, 947, 949, 954, 959, 964, 971, 974, 978, 980 }; #endif @@ -1458,7 +1472,7 @@ yyreduce: switch (yyn) { case 1: -#line 327 "/usr/homes/chet/src/bash/src/parse.y" +#line 341 "/usr/homes/chet/src/bash/src/parse.y" { /* Case of regular command. Discard the error safety net,and return the command just parsed. */ @@ -1469,7 +1483,7 @@ case 1: } break; case 2: -#line 336 "/usr/homes/chet/src/bash/src/parse.y" +#line 350 "/usr/homes/chet/src/bash/src/parse.y" { /* Case of regular command, but not a very interesting one. Return a NULL command. */ @@ -1478,7 +1492,7 @@ case 2: } break; case 3: -#line 343 "/usr/homes/chet/src/bash/src/parse.y" +#line 357 "/usr/homes/chet/src/bash/src/parse.y" { /* Error during parsing. Return NULL command. */ global_command = (COMMAND *)NULL; @@ -1495,7 +1509,7 @@ case 3: } break; case 4: -#line 358 "/usr/homes/chet/src/bash/src/parse.y" +#line 372 "/usr/homes/chet/src/bash/src/parse.y" { /* Case of EOF seen by itself. Do ignoreeof or not. */ @@ -1505,57 +1519,57 @@ case 4: } break; case 5: -#line 368 "/usr/homes/chet/src/bash/src/parse.y" +#line 382 "/usr/homes/chet/src/bash/src/parse.y" { yyval.word_list = make_word_list (yyvsp[0].word, (WORD_LIST *)NULL); } break; case 6: -#line 370 "/usr/homes/chet/src/bash/src/parse.y" +#line 384 "/usr/homes/chet/src/bash/src/parse.y" { yyval.word_list = make_word_list (yyvsp[0].word, yyvsp[-1].word_list); } break; case 7: -#line 374 "/usr/homes/chet/src/bash/src/parse.y" +#line 388 "/usr/homes/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (1, r_output_direction, redir); } break; case 8: -#line 379 "/usr/homes/chet/src/bash/src/parse.y" +#line 393 "/usr/homes/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (0, r_input_direction, redir); } break; case 9: -#line 384 "/usr/homes/chet/src/bash/src/parse.y" +#line 398 "/usr/homes/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (yyvsp[-2].number, r_output_direction, redir); } break; case 10: -#line 389 "/usr/homes/chet/src/bash/src/parse.y" +#line 403 "/usr/homes/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (yyvsp[-2].number, r_input_direction, redir); } break; case 11: -#line 394 "/usr/homes/chet/src/bash/src/parse.y" +#line 408 "/usr/homes/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (1, r_appending_to, redir); } break; case 12: -#line 399 "/usr/homes/chet/src/bash/src/parse.y" +#line 413 "/usr/homes/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (yyvsp[-2].number, r_appending_to, redir); } break; case 13: -#line 404 "/usr/homes/chet/src/bash/src/parse.y" +#line 418 "/usr/homes/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (0, r_reading_until, redir); @@ -1563,7 +1577,7 @@ case 13: } break; case 14: -#line 410 "/usr/homes/chet/src/bash/src/parse.y" +#line 424 "/usr/homes/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (yyvsp[-2].number, r_reading_until, redir); @@ -1571,77 +1585,77 @@ case 14: } break; case 15: -#line 416 "/usr/homes/chet/src/bash/src/parse.y" +#line 430 "/usr/homes/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (0, r_reading_string, redir); } break; case 16: -#line 421 "/usr/homes/chet/src/bash/src/parse.y" +#line 435 "/usr/homes/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (yyvsp[-2].number, r_reading_string, redir); } break; case 17: -#line 426 "/usr/homes/chet/src/bash/src/parse.y" +#line 440 "/usr/homes/chet/src/bash/src/parse.y" { redir.dest = yyvsp[0].number; yyval.redirect = make_redirection (0, r_duplicating_input, redir); } break; case 18: -#line 431 "/usr/homes/chet/src/bash/src/parse.y" +#line 445 "/usr/homes/chet/src/bash/src/parse.y" { redir.dest = yyvsp[0].number; yyval.redirect = make_redirection (yyvsp[-2].number, r_duplicating_input, redir); } break; case 19: -#line 436 "/usr/homes/chet/src/bash/src/parse.y" +#line 450 "/usr/homes/chet/src/bash/src/parse.y" { redir.dest = yyvsp[0].number; yyval.redirect = make_redirection (1, r_duplicating_output, redir); } break; case 20: -#line 441 "/usr/homes/chet/src/bash/src/parse.y" +#line 455 "/usr/homes/chet/src/bash/src/parse.y" { redir.dest = yyvsp[0].number; yyval.redirect = make_redirection (yyvsp[-2].number, r_duplicating_output, redir); } break; case 21: -#line 446 "/usr/homes/chet/src/bash/src/parse.y" +#line 460 "/usr/homes/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (0, r_duplicating_input_word, redir); } break; case 22: -#line 451 "/usr/homes/chet/src/bash/src/parse.y" +#line 465 "/usr/homes/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (yyvsp[-2].number, r_duplicating_input_word, redir); } break; case 23: -#line 456 "/usr/homes/chet/src/bash/src/parse.y" +#line 470 "/usr/homes/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (1, r_duplicating_output_word, redir); } break; case 24: -#line 461 "/usr/homes/chet/src/bash/src/parse.y" +#line 475 "/usr/homes/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (yyvsp[-2].number, r_duplicating_output_word, redir); } break; case 25: -#line 466 "/usr/homes/chet/src/bash/src/parse.y" +#line 480 "/usr/homes/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection @@ -1650,7 +1664,7 @@ case 25: } break; case 26: -#line 473 "/usr/homes/chet/src/bash/src/parse.y" +#line 487 "/usr/homes/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection @@ -1659,88 +1673,88 @@ case 26: } break; case 27: -#line 480 "/usr/homes/chet/src/bash/src/parse.y" +#line 494 "/usr/homes/chet/src/bash/src/parse.y" { redir.dest = 0; yyval.redirect = make_redirection (1, r_close_this, redir); } break; case 28: -#line 485 "/usr/homes/chet/src/bash/src/parse.y" +#line 499 "/usr/homes/chet/src/bash/src/parse.y" { redir.dest = 0; yyval.redirect = make_redirection (yyvsp[-2].number, r_close_this, redir); } break; case 29: -#line 490 "/usr/homes/chet/src/bash/src/parse.y" +#line 504 "/usr/homes/chet/src/bash/src/parse.y" { redir.dest = 0; yyval.redirect = make_redirection (0, r_close_this, redir); } break; case 30: -#line 495 "/usr/homes/chet/src/bash/src/parse.y" +#line 509 "/usr/homes/chet/src/bash/src/parse.y" { redir.dest = 0; yyval.redirect = make_redirection (yyvsp[-2].number, r_close_this, redir); } break; case 31: -#line 500 "/usr/homes/chet/src/bash/src/parse.y" +#line 514 "/usr/homes/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (1, r_err_and_out, redir); } break; case 32: -#line 505 "/usr/homes/chet/src/bash/src/parse.y" +#line 519 "/usr/homes/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (yyvsp[-2].number, r_input_output, redir); } break; case 33: -#line 510 "/usr/homes/chet/src/bash/src/parse.y" +#line 524 "/usr/homes/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (0, r_input_output, redir); } break; case 34: -#line 515 "/usr/homes/chet/src/bash/src/parse.y" +#line 529 "/usr/homes/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (1, r_output_force, redir); } break; case 35: -#line 520 "/usr/homes/chet/src/bash/src/parse.y" +#line 534 "/usr/homes/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (yyvsp[-2].number, r_output_force, redir); } break; case 36: -#line 527 "/usr/homes/chet/src/bash/src/parse.y" +#line 541 "/usr/homes/chet/src/bash/src/parse.y" { yyval.element.word = yyvsp[0].word; yyval.element.redirect = 0; } break; case 37: -#line 529 "/usr/homes/chet/src/bash/src/parse.y" +#line 543 "/usr/homes/chet/src/bash/src/parse.y" { yyval.element.word = yyvsp[0].word; yyval.element.redirect = 0; } break; case 38: -#line 531 "/usr/homes/chet/src/bash/src/parse.y" +#line 545 "/usr/homes/chet/src/bash/src/parse.y" { yyval.element.redirect = yyvsp[0].redirect; yyval.element.word = 0; } break; case 39: -#line 535 "/usr/homes/chet/src/bash/src/parse.y" +#line 549 "/usr/homes/chet/src/bash/src/parse.y" { yyval.redirect = yyvsp[0].redirect; } break; case 40: -#line 539 "/usr/homes/chet/src/bash/src/parse.y" +#line 553 "/usr/homes/chet/src/bash/src/parse.y" { register REDIRECT *t; @@ -1751,23 +1765,23 @@ case 40: } break; case 41: -#line 550 "/usr/homes/chet/src/bash/src/parse.y" +#line 564 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = make_simple_command (yyvsp[0].element, (COMMAND *)NULL); } break; case 42: -#line 552 "/usr/homes/chet/src/bash/src/parse.y" +#line 566 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = make_simple_command (yyvsp[0].element, yyvsp[-1].command); } break; case 43: -#line 556 "/usr/homes/chet/src/bash/src/parse.y" +#line 570 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = clean_simple_command (yyvsp[0].command); } break; case 44: -#line 558 "/usr/homes/chet/src/bash/src/parse.y" +#line 572 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = yyvsp[0].command; } break; case 45: -#line 560 "/usr/homes/chet/src/bash/src/parse.y" +#line 574 "/usr/homes/chet/src/bash/src/parse.y" { COMMAND *tc; @@ -1785,167 +1799,218 @@ case 45: } break; case 46: -#line 576 "/usr/homes/chet/src/bash/src/parse.y" +#line 590 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = yyvsp[0].command; } break; case 47: -#line 580 "/usr/homes/chet/src/bash/src/parse.y" +#line 594 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = yyvsp[0].command; } break; case 48: -#line 582 "/usr/homes/chet/src/bash/src/parse.y" +#line 596 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = yyvsp[0].command; } break; case 49: -#line 584 "/usr/homes/chet/src/bash/src/parse.y" +#line 598 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = make_while_command (yyvsp[-3].command, yyvsp[-1].command); } break; case 50: -#line 586 "/usr/homes/chet/src/bash/src/parse.y" +#line 600 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = make_until_command (yyvsp[-3].command, yyvsp[-1].command); } break; case 51: -#line 588 "/usr/homes/chet/src/bash/src/parse.y" +#line 602 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = yyvsp[0].command; } break; case 52: -#line 590 "/usr/homes/chet/src/bash/src/parse.y" +#line 604 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = yyvsp[0].command; } break; case 53: -#line 592 "/usr/homes/chet/src/bash/src/parse.y" +#line 606 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = yyvsp[0].command; } break; case 54: -#line 594 "/usr/homes/chet/src/bash/src/parse.y" +#line 608 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = yyvsp[0].command; } break; case 55: -#line 596 "/usr/homes/chet/src/bash/src/parse.y" +#line 610 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = yyvsp[0].command; } break; case 56: -#line 598 "/usr/homes/chet/src/bash/src/parse.y" +#line 612 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = yyvsp[0].command; } break; case 57: -#line 600 "/usr/homes/chet/src/bash/src/parse.y" +#line 614 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = yyvsp[0].command; } break; case 58: -#line 604 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_for_command (yyvsp[-4].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command); } +#line 618 "/usr/homes/chet/src/bash/src/parse.y" +{ + yyval.command = make_for_command (yyvsp[-4].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command, word_lineno[word_top]); + if (word_top > 0) word_top--; + } break; case 59: -#line 606 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_for_command (yyvsp[-4].word, add_string_to_list ("$@", (WORD_LIST *)NULL), yyvsp[-1].command); } +#line 623 "/usr/homes/chet/src/bash/src/parse.y" +{ + yyval.command = make_for_command (yyvsp[-4].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command, word_lineno[word_top]); + if (word_top > 0) word_top--; + } break; case 60: -#line 608 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_for_command (yyvsp[-5].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command); } +#line 628 "/usr/homes/chet/src/bash/src/parse.y" +{ + yyval.command = make_for_command (yyvsp[-5].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command, word_lineno[word_top]); + if (word_top > 0) word_top--; + } break; case 61: -#line 610 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_for_command (yyvsp[-5].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command); } +#line 633 "/usr/homes/chet/src/bash/src/parse.y" +{ + yyval.command = make_for_command (yyvsp[-5].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command, word_lineno[word_top]); + if (word_top > 0) word_top--; + } break; case 62: -#line 612 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_for_command (yyvsp[-8].word, REVERSE_LIST (yyvsp[-5].word_list, WORD_LIST *), yyvsp[-1].command); } +#line 638 "/usr/homes/chet/src/bash/src/parse.y" +{ + yyval.command = make_for_command (yyvsp[-8].word, REVERSE_LIST (yyvsp[-5].word_list, WORD_LIST *), yyvsp[-1].command, word_lineno[word_top]); + if (word_top > 0) word_top--; + } break; case 63: -#line 614 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_for_command (yyvsp[-8].word, REVERSE_LIST (yyvsp[-5].word_list, WORD_LIST *), yyvsp[-1].command); } +#line 643 "/usr/homes/chet/src/bash/src/parse.y" +{ + yyval.command = make_for_command (yyvsp[-8].word, REVERSE_LIST (yyvsp[-5].word_list, WORD_LIST *), yyvsp[-1].command, word_lineno[word_top]); + if (word_top > 0) word_top--; + } break; case 64: -#line 616 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_for_command (yyvsp[-7].word, (WORD_LIST *)NULL, yyvsp[-1].command); } +#line 648 "/usr/homes/chet/src/bash/src/parse.y" +{ + yyval.command = make_for_command (yyvsp[-7].word, (WORD_LIST *)NULL, yyvsp[-1].command, word_lineno[word_top]); + if (word_top > 0) word_top--; + } break; case 65: -#line 618 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_for_command (yyvsp[-7].word, (WORD_LIST *)NULL, yyvsp[-1].command); } +#line 653 "/usr/homes/chet/src/bash/src/parse.y" +{ + yyval.command = make_for_command (yyvsp[-7].word, (WORD_LIST *)NULL, yyvsp[-1].command, word_lineno[word_top]); + if (word_top > 0) word_top--; + } break; case 66: -#line 622 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_arith_for_command (yyvsp[-5].word_list, yyvsp[-1].command, arith_for_lineno); } +#line 660 "/usr/homes/chet/src/bash/src/parse.y" +{ + yyval.command = make_arith_for_command (yyvsp[-5].word_list, yyvsp[-1].command, arith_for_lineno); + if (word_top > 0) word_top--; + } break; case 67: -#line 624 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_arith_for_command (yyvsp[-5].word_list, yyvsp[-1].command, arith_for_lineno); } +#line 665 "/usr/homes/chet/src/bash/src/parse.y" +{ + yyval.command = make_arith_for_command (yyvsp[-5].word_list, yyvsp[-1].command, arith_for_lineno); + if (word_top > 0) word_top--; + } break; case 68: -#line 626 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_arith_for_command (yyvsp[-3].word_list, yyvsp[-1].command, arith_for_lineno); } +#line 670 "/usr/homes/chet/src/bash/src/parse.y" +{ + yyval.command = make_arith_for_command (yyvsp[-3].word_list, yyvsp[-1].command, arith_for_lineno); + if (word_top > 0) word_top--; + } break; case 69: -#line 628 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_arith_for_command (yyvsp[-3].word_list, yyvsp[-1].command, arith_for_lineno); } +#line 675 "/usr/homes/chet/src/bash/src/parse.y" +{ + yyval.command = make_arith_for_command (yyvsp[-3].word_list, yyvsp[-1].command, arith_for_lineno); + if (word_top > 0) word_top--; + } break; case 70: -#line 632 "/usr/homes/chet/src/bash/src/parse.y" +#line 682 "/usr/homes/chet/src/bash/src/parse.y" { - yyval.command = make_select_command (yyvsp[-4].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command); + yyval.command = make_select_command (yyvsp[-4].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command, word_lineno[word_top]); + if (word_top > 0) word_top--; } break; case 71: -#line 636 "/usr/homes/chet/src/bash/src/parse.y" +#line 687 "/usr/homes/chet/src/bash/src/parse.y" { - yyval.command = make_select_command (yyvsp[-4].word, add_string_to_list ("$@", (WORD_LIST *)NULL), yyvsp[-1].command); + yyval.command = make_select_command (yyvsp[-4].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command, word_lineno[word_top]); + if (word_top > 0) word_top--; } break; case 72: -#line 640 "/usr/homes/chet/src/bash/src/parse.y" +#line 692 "/usr/homes/chet/src/bash/src/parse.y" { - yyval.command = make_select_command (yyvsp[-5].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command); + yyval.command = make_select_command (yyvsp[-5].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command, word_lineno[word_top]); + if (word_top > 0) word_top--; } break; case 73: -#line 644 "/usr/homes/chet/src/bash/src/parse.y" +#line 697 "/usr/homes/chet/src/bash/src/parse.y" { - yyval.command = make_select_command (yyvsp[-5].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command); + yyval.command = make_select_command (yyvsp[-5].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command, word_lineno[word_top]); + if (word_top > 0) word_top--; } break; case 74: -#line 648 "/usr/homes/chet/src/bash/src/parse.y" +#line 702 "/usr/homes/chet/src/bash/src/parse.y" { - yyval.command = make_select_command (yyvsp[-8].word, REVERSE_LIST (yyvsp[-5].word_list, WORD_LIST *), yyvsp[-1].command); + yyval.command = make_select_command (yyvsp[-8].word, REVERSE_LIST (yyvsp[-5].word_list, WORD_LIST *), yyvsp[-1].command, word_lineno[word_top]); + if (word_top > 0) word_top--; } break; case 75: -#line 652 "/usr/homes/chet/src/bash/src/parse.y" +#line 707 "/usr/homes/chet/src/bash/src/parse.y" { - yyval.command = make_select_command (yyvsp[-8].word, REVERSE_LIST (yyvsp[-5].word_list, WORD_LIST *), yyvsp[-1].command); + yyval.command = make_select_command (yyvsp[-8].word, REVERSE_LIST (yyvsp[-5].word_list, WORD_LIST *), yyvsp[-1].command, word_lineno[word_top]); + if (word_top > 0) word_top--; } break; case 76: -#line 658 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_case_command (yyvsp[-4].word, (PATTERN_LIST *)NULL); } +#line 714 "/usr/homes/chet/src/bash/src/parse.y" +{ + yyval.command = make_case_command (yyvsp[-4].word, (PATTERN_LIST *)NULL, word_lineno[word_top]); + if (word_top > 0) word_top--; + } break; case 77: -#line 660 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_case_command (yyvsp[-5].word, yyvsp[-2].pattern); } +#line 719 "/usr/homes/chet/src/bash/src/parse.y" +{ + yyval.command = make_case_command (yyvsp[-5].word, yyvsp[-2].pattern, word_lineno[word_top]); + if (word_top > 0) word_top--; + } break; case 78: -#line 662 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_case_command (yyvsp[-4].word, yyvsp[-1].pattern); } +#line 724 "/usr/homes/chet/src/bash/src/parse.y" +{ + yyval.command = make_case_command (yyvsp[-4].word, yyvsp[-1].pattern, word_lineno[word_top]); + if (word_top > 0) word_top--; + } break; case 79: -#line 666 "/usr/homes/chet/src/bash/src/parse.y" +#line 731 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = make_function_def (yyvsp[-4].word, yyvsp[0].command, function_dstart, function_bstart); } break; case 80: -#line 669 "/usr/homes/chet/src/bash/src/parse.y" +#line 734 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = make_function_def (yyvsp[-4].word, yyvsp[0].command, function_dstart, function_bstart); } break; case 81: -#line 672 "/usr/homes/chet/src/bash/src/parse.y" +#line 737 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = make_function_def (yyvsp[-2].word, yyvsp[0].command, function_dstart, function_bstart); } break; case 82: -#line 677 "/usr/homes/chet/src/bash/src/parse.y" +#line 742 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = yyvsp[0].command; } break; case 83: -#line 679 "/usr/homes/chet/src/bash/src/parse.y" +#line 744 "/usr/homes/chet/src/bash/src/parse.y" { COMMAND *tc; @@ -1976,82 +2041,82 @@ case 83: } break; case 84: -#line 710 "/usr/homes/chet/src/bash/src/parse.y" +#line 775 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = make_subshell_command (yyvsp[-1].command); yyval.command->flags |= CMD_WANT_SUBSHELL; } break; case 85: -#line 717 "/usr/homes/chet/src/bash/src/parse.y" +#line 782 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = make_if_command (yyvsp[-3].command, yyvsp[-1].command, (COMMAND *)NULL); } break; case 86: -#line 719 "/usr/homes/chet/src/bash/src/parse.y" +#line 784 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = make_if_command (yyvsp[-5].command, yyvsp[-3].command, yyvsp[-1].command); } break; case 87: -#line 721 "/usr/homes/chet/src/bash/src/parse.y" +#line 786 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = make_if_command (yyvsp[-4].command, yyvsp[-2].command, yyvsp[-1].command); } break; case 88: -#line 726 "/usr/homes/chet/src/bash/src/parse.y" +#line 791 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = make_group_command (yyvsp[-1].command); } break; case 89: -#line 730 "/usr/homes/chet/src/bash/src/parse.y" +#line 795 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = make_arith_command (yyvsp[0].word_list); } break; case 90: -#line 734 "/usr/homes/chet/src/bash/src/parse.y" +#line 799 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = yyvsp[-1].command; } break; case 91: -#line 738 "/usr/homes/chet/src/bash/src/parse.y" +#line 803 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = make_if_command (yyvsp[-2].command, yyvsp[0].command, (COMMAND *)NULL); } break; case 92: -#line 740 "/usr/homes/chet/src/bash/src/parse.y" +#line 805 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = make_if_command (yyvsp[-4].command, yyvsp[-2].command, yyvsp[0].command); } break; case 93: -#line 742 "/usr/homes/chet/src/bash/src/parse.y" +#line 807 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = make_if_command (yyvsp[-3].command, yyvsp[-1].command, yyvsp[0].command); } break; case 95: -#line 747 "/usr/homes/chet/src/bash/src/parse.y" +#line 812 "/usr/homes/chet/src/bash/src/parse.y" { yyvsp[0].pattern->next = yyvsp[-1].pattern; yyval.pattern = yyvsp[0].pattern; } break; case 96: -#line 751 "/usr/homes/chet/src/bash/src/parse.y" +#line 816 "/usr/homes/chet/src/bash/src/parse.y" { yyval.pattern = make_pattern_list (yyvsp[-2].word_list, yyvsp[0].command); } break; case 97: -#line 753 "/usr/homes/chet/src/bash/src/parse.y" +#line 818 "/usr/homes/chet/src/bash/src/parse.y" { yyval.pattern = make_pattern_list (yyvsp[-2].word_list, (COMMAND *)NULL); } break; case 98: -#line 755 "/usr/homes/chet/src/bash/src/parse.y" +#line 820 "/usr/homes/chet/src/bash/src/parse.y" { yyval.pattern = make_pattern_list (yyvsp[-2].word_list, yyvsp[0].command); } break; case 99: -#line 757 "/usr/homes/chet/src/bash/src/parse.y" +#line 822 "/usr/homes/chet/src/bash/src/parse.y" { yyval.pattern = make_pattern_list (yyvsp[-2].word_list, (COMMAND *)NULL); } break; case 101: -#line 762 "/usr/homes/chet/src/bash/src/parse.y" +#line 827 "/usr/homes/chet/src/bash/src/parse.y" { yyvsp[-1].pattern->next = yyvsp[-2].pattern; yyval.pattern = yyvsp[-1].pattern; } break; case 102: -#line 766 "/usr/homes/chet/src/bash/src/parse.y" +#line 831 "/usr/homes/chet/src/bash/src/parse.y" { yyval.word_list = make_word_list (yyvsp[0].word, (WORD_LIST *)NULL); } break; case 103: -#line 768 "/usr/homes/chet/src/bash/src/parse.y" +#line 833 "/usr/homes/chet/src/bash/src/parse.y" { yyval.word_list = make_word_list (yyvsp[0].word, yyvsp[-2].word_list); } break; case 104: -#line 777 "/usr/homes/chet/src/bash/src/parse.y" +#line 842 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = yyvsp[0].command; if (need_here_doc) @@ -2059,13 +2124,13 @@ case 104: } break; case 106: -#line 786 "/usr/homes/chet/src/bash/src/parse.y" +#line 851 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = yyvsp[0].command; } break; case 108: -#line 793 "/usr/homes/chet/src/bash/src/parse.y" +#line 858 "/usr/homes/chet/src/bash/src/parse.y" { if (yyvsp[-2].command->type == cm_connection) yyval.command = connect_async_list (yyvsp[-2].command, (COMMAND *)NULL, '&'); @@ -2074,15 +2139,15 @@ case 108: } break; case 110: -#line 804 "/usr/homes/chet/src/bash/src/parse.y" +#line 869 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, AND_AND); } break; case 111: -#line 806 "/usr/homes/chet/src/bash/src/parse.y" +#line 871 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, OR_OR); } break; case 112: -#line 808 "/usr/homes/chet/src/bash/src/parse.y" +#line 873 "/usr/homes/chet/src/bash/src/parse.y" { if (yyvsp[-3].command->type == cm_connection) yyval.command = connect_async_list (yyvsp[-3].command, yyvsp[0].command, '&'); @@ -2091,19 +2156,19 @@ case 112: } break; case 113: -#line 815 "/usr/homes/chet/src/bash/src/parse.y" +#line 880 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, ';'); } break; case 114: -#line 817 "/usr/homes/chet/src/bash/src/parse.y" +#line 882 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, ';'); } break; case 115: -#line 819 "/usr/homes/chet/src/bash/src/parse.y" +#line 884 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = yyvsp[0].command; } break; case 123: -#line 842 "/usr/homes/chet/src/bash/src/parse.y" +#line 907 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = yyvsp[0].command; if (need_here_doc) @@ -2111,7 +2176,7 @@ case 123: } break; case 124: -#line 848 "/usr/homes/chet/src/bash/src/parse.y" +#line 913 "/usr/homes/chet/src/bash/src/parse.y" { if (yyvsp[-1].command->type == cm_connection) yyval.command = connect_async_list (yyvsp[-1].command, (COMMAND *)NULL, '&'); @@ -2122,7 +2187,7 @@ case 124: } break; case 125: -#line 857 "/usr/homes/chet/src/bash/src/parse.y" +#line 922 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = yyvsp[-1].command; if (need_here_doc) @@ -2130,15 +2195,15 @@ case 125: } break; case 126: -#line 865 "/usr/homes/chet/src/bash/src/parse.y" +#line 930 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, AND_AND); } break; case 127: -#line 867 "/usr/homes/chet/src/bash/src/parse.y" +#line 932 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, OR_OR); } break; case 128: -#line 869 "/usr/homes/chet/src/bash/src/parse.y" +#line 934 "/usr/homes/chet/src/bash/src/parse.y" { if (yyvsp[-2].command->type == cm_connection) yyval.command = connect_async_list (yyvsp[-2].command, yyvsp[0].command, '&'); @@ -2147,59 +2212,59 @@ case 128: } break; case 129: -#line 876 "/usr/homes/chet/src/bash/src/parse.y" +#line 941 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = command_connect (yyvsp[-2].command, yyvsp[0].command, ';'); } break; case 130: -#line 879 "/usr/homes/chet/src/bash/src/parse.y" +#line 944 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = yyvsp[0].command; } break; case 131: -#line 883 "/usr/homes/chet/src/bash/src/parse.y" +#line 948 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = yyvsp[0].command; } break; case 132: -#line 885 "/usr/homes/chet/src/bash/src/parse.y" +#line 950 "/usr/homes/chet/src/bash/src/parse.y" { yyvsp[0].command->flags |= CMD_INVERT_RETURN; yyval.command = yyvsp[0].command; } break; case 133: -#line 890 "/usr/homes/chet/src/bash/src/parse.y" +#line 955 "/usr/homes/chet/src/bash/src/parse.y" { yyvsp[0].command->flags |= yyvsp[-1].number; yyval.command = yyvsp[0].command; } break; case 134: -#line 895 "/usr/homes/chet/src/bash/src/parse.y" +#line 960 "/usr/homes/chet/src/bash/src/parse.y" { yyvsp[0].command->flags |= yyvsp[-2].number|CMD_INVERT_RETURN; yyval.command = yyvsp[0].command; } break; case 135: -#line 900 "/usr/homes/chet/src/bash/src/parse.y" +#line 965 "/usr/homes/chet/src/bash/src/parse.y" { yyvsp[0].command->flags |= yyvsp[-1].number|CMD_INVERT_RETURN; yyval.command = yyvsp[0].command; } break; case 136: -#line 908 "/usr/homes/chet/src/bash/src/parse.y" +#line 973 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, '|'); } break; case 137: -#line 910 "/usr/homes/chet/src/bash/src/parse.y" +#line 975 "/usr/homes/chet/src/bash/src/parse.y" { yyval.command = yyvsp[0].command; } break; case 138: -#line 914 "/usr/homes/chet/src/bash/src/parse.y" +#line 979 "/usr/homes/chet/src/bash/src/parse.y" { yyval.number = CMD_TIME_PIPELINE; } break; case 139: -#line 916 "/usr/homes/chet/src/bash/src/parse.y" +#line 981 "/usr/homes/chet/src/bash/src/parse.y" { yyval.number = CMD_TIME_PIPELINE|CMD_TIME_POSIX; } break; } @@ -2435,27 +2500,39 @@ yyreturn: #endif return yyresult; } -#line 918 "/usr/homes/chet/src/bash/src/parse.y" +#line 983 "/usr/homes/chet/src/bash/src/parse.y" /* Possible states for the parser that require it to do special things. */ -#define PST_CASEPAT 0x001 /* in a case pattern list */ -#define PST_ALEXPNEXT 0x002 /* expand next word for aliases */ -#define PST_ALLOWOPNBRC 0x004 /* allow open brace for function def */ -#define PST_NEEDCLOSBRC 0x008 /* need close brace */ -#define PST_DBLPAREN 0x010 /* double-paren parsing */ -#define PST_SUBSHELL 0x020 /* ( ... ) subshell */ -#define PST_CMDSUBST 0x040 /* $( ... ) command substitution */ -#define PST_CASESTMT 0x080 /* parsing a case statement */ -#define PST_CONDCMD 0x100 /* parsing a [[...]] command */ -#define PST_CONDEXPR 0x200 /* parsing the guts of [[...]] */ -#define PST_ARITHFOR 0x400 /* parsing an arithmetic for command */ +#define PST_CASEPAT 0x0001 /* in a case pattern list */ +#define PST_ALEXPNEXT 0x0002 /* expand next word for aliases */ +#define PST_ALLOWOPNBRC 0x0004 /* allow open brace for function def */ +#define PST_NEEDCLOSBRC 0x0008 /* need close brace */ +#define PST_DBLPAREN 0x0010 /* double-paren parsing */ +#define PST_SUBSHELL 0x0020 /* ( ... ) subshell */ +#define PST_CMDSUBST 0x0040 /* $( ... ) command substitution */ +#define PST_CASESTMT 0x0080 /* parsing a case statement */ +#define PST_CONDCMD 0x0100 /* parsing a [[...]] command */ +#define PST_CONDEXPR 0x0200 /* parsing the guts of [[...]] */ +#define PST_ARITHFOR 0x0400 /* parsing an arithmetic for command */ +#define PST_ALEXPAND 0x0800 /* OK to expand aliases - unused */ +#define PST_CMDTOKEN 0x1000 /* command token OK - unused */ /* Initial size to allocate for tokens, and the amount to grow them by. */ #define TOKEN_DEFAULT_INITIAL_SIZE 496 #define TOKEN_DEFAULT_GROW_SIZE 512 +/* Should we call prompt_again? */ +#define SHOULD_PROMPT() \ + (interactive && (bash_input.type == st_stdin || bash_input.type == st_stream)) + +#if defined (ALIAS) +# define expanding_alias() (pushed_string_list && pushed_string_list->expander) +#else +# define expanding_alias() 0 +#endif + /* The token currently being read. */ static int current_token; @@ -2920,10 +2997,6 @@ restore_token_state (ts) #if defined (ALIAS) || defined (DPAREN_ARITHMETIC) -#if !defined (ALIAS) -typedef void *alias_t; -#endif - #define END_OF_ALIAS 0 /* @@ -2983,7 +3056,9 @@ push_string (s, expand, ap) shell_input_line_size = strlen (s); shell_input_line_index = 0; shell_input_line_terminator = '\0'; - parser_state &= ~PST_ALEXPNEXT; +#if 0 + parser_state &= ~PST_ALEXPNEXT; /* XXX */ +#endif set_line_mbstate (); } @@ -3044,6 +3119,14 @@ free_string_list () #endif /* ALIAS || DPAREN_ARITHMETIC */ +void +free_pushed_string_input () +{ +#if defined (ALIAS) || defined (DPAREN_ARITHMETIC) + free_string_list (); +#endif +} + /* Return a line of text, taken from wherever yylex () reads input. If there is no more input, then we return NULL. If REMOVE_QUOTED_NEWLINE is non-zero, we remove unquoted \<newline> pairs. This is used by @@ -3057,9 +3140,9 @@ read_a_line (remove_quoted_newline) int indx = 0, c, peekc, pass_next; #if defined (READLINE) - if (interactive && bash_input.type != st_string && no_line_editing) + if (no_line_editing && SHOULD_PROMPT ()) #else - if (interactive && bash_input.type != st_string) + if (SHOULD_PROMPT ()) #endif print_prompt (); @@ -3108,7 +3191,10 @@ read_a_line (remove_quoted_newline) { peekc = yy_getc (); if (peekc == '\n') - continue; /* Make the unquoted \<newline> pair disappear. */ + { + line_number++; + continue; /* Make the unquoted \<newline> pair disappear. */ + } else { yy_ungetc (peekc); @@ -3137,7 +3223,8 @@ read_secondary_line (remove_quoted_newline) int remove_quoted_newline; { prompt_string_pointer = &ps2_prompt; - prompt_again (); + if (SHOULD_PROMPT()) + prompt_again (); return (read_a_line (remove_quoted_newline)); } @@ -3299,20 +3386,27 @@ shell_getc (remove_quoted_newline) i = 0; shell_input_line_terminator = 0; + /* If the shell is interatctive, but not currently printing a prompt + (interactive_shell && interactive == 0), we don't want to print + notifies or cleanup the jobs -- we want to defer it until we do + print the next prompt. */ + if (interactive_shell == 0 || SHOULD_PROMPT()) + { #if defined (JOB_CONTROL) /* This can cause a problem when reading a command as the result of a trap, when the trap is called from flush_child. This call had better not cause jobs to disappear from the job table in that case, or we will have big trouble. */ - notify_and_cleanup (); + notify_and_cleanup (); #else /* !JOB_CONTROL */ - cleanup_dead_jobs (); + cleanup_dead_jobs (); #endif /* !JOB_CONTROL */ + } #if defined (READLINE) - if (interactive && bash_input.type != st_string && no_line_editing) + if (no_line_editing && SHOULD_PROMPT()) #else - if (interactive && bash_input.type != st_string) + if (SHOULD_PROMPT()) #endif print_prompt (); @@ -3432,7 +3526,8 @@ shell_getc (remove_quoted_newline) { shell_input_line_size = 0; prompt_string_pointer = ¤t_prompt_string; - prompt_again (); + if (SHOULD_PROMPT ()) + prompt_again (); goto restart_read; } @@ -3458,7 +3553,8 @@ shell_getc (remove_quoted_newline) if MBTEST(uc == '\\' && remove_quoted_newline && shell_input_line[shell_input_line_index] == '\n') { - prompt_again (); + if (SHOULD_PROMPT ()) + prompt_again (); line_number++; goto restart_read; } @@ -3471,19 +3567,10 @@ shell_getc (remove_quoted_newline) to. */ if (!uc && (pushed_string_list != (STRING_SAVER *)NULL)) { - if (mustpop) - { - pop_string (); - uc = shell_input_line[shell_input_line_index]; - if (uc) - shell_input_line_index++; - mustpop--; - } - else - { - mustpop++; - uc = ' '; - } + pop_string (); + uc = shell_input_line[shell_input_line_index]; + if (uc) + shell_input_line_index++; } #endif /* ALIAS || DPAREN_ARITHMETIC */ @@ -3537,25 +3624,17 @@ void execute_prompt_command (command) char *command; { - sh_builtin_func_t *temp_last, *temp_this; char *last_lastarg; - int temp_exit_value, temp_eof_encountered; + sh_parser_state_t ps; - temp_last = last_shell_builtin; - temp_this = this_shell_builtin; - temp_exit_value = last_command_exit_value; - temp_eof_encountered = eof_encountered; + save_parser_state (&ps); last_lastarg = get_string_value ("_"); if (last_lastarg) last_lastarg = savestring (last_lastarg); parse_and_execute (savestring (command), "PROMPT_COMMAND", SEVAL_NONINT|SEVAL_NOHIST); - last_shell_builtin = temp_last; - this_shell_builtin = temp_this; - last_command_exit_value = temp_exit_value; - eof_encountered = temp_eof_encountered; - + restore_parser_state (&ps); bind_variable ("_", last_lastarg); FREE (last_lastarg); @@ -3595,7 +3674,7 @@ yylex () /* Avoid printing a prompt if we're not going to read anything, e.g. after resetting the parser with read_token (RESET). */ - if (token_to_read == 0 && interactive) + if (token_to_read == 0 && SHOULD_PROMPT ()) prompt_again (); } @@ -3629,8 +3708,8 @@ static int open_brace_count; (((token) == ASSIGNMENT_WORD) || \ ((token) != SEMI_SEMI && reserved_word_acceptable(token))) -#define assignment_acceptable(token) command_token_position(token) && \ - ((parser_state & PST_CASEPAT) == 0) +#define assignment_acceptable(token) \ + (command_token_position(token) && ((parser_state & PST_CASEPAT) == 0)) /* Check to see if TOKEN is a reserved word and return the token value if it is. */ @@ -3645,7 +3724,7 @@ static int open_brace_count; { \ if ((parser_state & PST_CASEPAT) && (word_token_alist[i].token != ESAC)) \ break; \ - if (word_token_alist[i].token == TIME) \ + if (word_token_alist[i].token == TIME && time_command_acceptable () == 0) \ break; \ if (word_token_alist[i].token == ESAC) \ parser_state &= ~(PST_CASEPAT|PST_CASESTMT); \ @@ -3678,6 +3757,23 @@ static int open_brace_count; Special cases that disqualify: In a pattern list in a case statement (parser_state & PST_CASEPAT). */ + +static char * +mk_alexpansion (s) + char *s; +{ + int l; + char *r; + + l = strlen (s); + r = xmalloc (l + 2); + strcpy (r, s); + if (r[l -1] != ' ') + r[l++] = ' '; + r[l] = '\0'; + return r; +} + static int alias_expand_token (tokstr) char *tokstr; @@ -3694,7 +3790,12 @@ alias_expand_token (tokstr) if (ap && (ap->flags & AL_BEINGEXPANDED)) return (NO_EXPANSION); - expanded = ap ? savestring (ap->value) : (char *)NULL; + /* mk_alexpansion puts an extra space on the end of the alias expansion, + so the lookahead by the parser works right. If this gets changed, + make sure the code in shell_getc that deals with reaching the end of + an expanded alias is changed with it. */ + expanded = ap ? mk_alexpansion (ap->value) : (char *)NULL; + if (expanded) { push_string (expanded, ap->flags & AL_EXPANDNEXT, ap); @@ -3838,10 +3939,12 @@ special_case_tokens (tokstr) return (TIMEOPT); #endif +#if 0 #if defined (COMMAND_TIMING) if (STREQ (token, "time") && ((parser_state & PST_CASEPAT) == 0) && time_command_acceptable ()) return (TIME); #endif /* COMMAND_TIMING */ +#endif #if defined (COND_COMMAND) /* [[ */ if ((parser_state & PST_CONDEXPR) && tokstr[0] == ']' && tokstr[1] == ']' && tokstr[2] == '\0') @@ -4086,6 +4189,7 @@ read_token (command) */ #define P_FIRSTCLOSE 0x01 #define P_ALLOWESC 0x02 +#define P_DQUOTE 0x04 static char matched_pair_error; static char * @@ -4097,11 +4201,14 @@ parse_matched_pair (qc, open, close, lenp, flags) int count, ch, was_dollar; int pass_next_character, nestlen, ttranslen, start_lineno; char *ret, *nestret, *ttrans; - int retind, retsize; + int retind, retsize, rflags; count = 1; pass_next_character = was_dollar = 0; + /* RFLAGS is the set of flags we want to pass to recursive calls. */ + rflags = (qc == '"') ? P_DQUOTE : (flags & P_DQUOTE); + ret = (char *)xmalloc (retsize = 64); retind = 0; @@ -4118,8 +4225,7 @@ parse_matched_pair (qc, open, close, lenp, flags) } /* Possible reprompting. */ - if (ch == '\n' && interactive && - (bash_input.type == st_stdin || bash_input.type == st_stream)) + if (ch == '\n' && SHOULD_PROMPT ()) prompt_again (); if (pass_next_character) /* last char was backslash */ @@ -4175,16 +4281,16 @@ parse_matched_pair (qc, open, close, lenp, flags) /* '', ``, or "" inside $(...) or other grouping construct. */ push_delimiter (dstack, ch); if MBTEST(was_dollar && ch == '\'') /* $'...' inside group */ - nestret = parse_matched_pair (ch, ch, ch, &nestlen, P_ALLOWESC); + nestret = parse_matched_pair (ch, ch, ch, &nestlen, P_ALLOWESC|rflags); else - nestret = parse_matched_pair (ch, ch, ch, &nestlen, 0); + nestret = parse_matched_pair (ch, ch, ch, &nestlen, rflags); pop_delimiter (dstack); if (nestret == &matched_pair_error) { free (ret); return &matched_pair_error; } - if MBTEST(was_dollar && ch == '\'') + if MBTEST(was_dollar && ch == '\'' && (extended_quote || (rflags & P_DQUOTE) == 0)) { /* Translate $'...' here. */ ttrans = ansiexpand (nestret, 0, nestlen - 1, &ttranslen); @@ -4194,7 +4300,7 @@ parse_matched_pair (qc, open, close, lenp, flags) nestlen = strlen (nestret); retind -= 2; /* back up before the $' */ } - else if MBTEST(was_dollar && ch == '"') + else if MBTEST(was_dollar && ch == '"' && (extended_quote || (rflags & P_DQUOTE) == 0)) { /* Locale expand $"..." here. */ ttrans = localeexpand (nestret, 0, nestlen - 1, start_lineno, &ttranslen); @@ -4223,7 +4329,7 @@ parse_matched_pair (qc, open, close, lenp, flags) /* XXX - sh and ksh93 don't do this - XXX */ else if MBTEST(open == '"' && ch == '`') { - nestret = parse_matched_pair (0, '`', '`', &nestlen, 0); + nestret = parse_matched_pair (0, '`', '`', &nestlen, rflags); if (nestret == &matched_pair_error) { free (ret); @@ -4243,11 +4349,11 @@ parse_matched_pair (qc, open, close, lenp, flags) if (open == ch) /* undo previous increment */ count--; if (ch == '(') /* ) */ - nestret = parse_matched_pair (0, '(', ')', &nestlen, 0); + nestret = parse_matched_pair (0, '(', ')', &nestlen, rflags); else if (ch == '{') /* } */ - nestret = parse_matched_pair (0, '{', '}', &nestlen, P_FIRSTCLOSE); + nestret = parse_matched_pair (0, '{', '}', &nestlen, P_FIRSTCLOSE|rflags); else if (ch == '[') /* ] */ - nestret = parse_matched_pair (0, '[', ']', &nestlen, 0); + nestret = parse_matched_pair (0, '[', ']', &nestlen, rflags); if (nestret == &matched_pair_error) { free (ret); @@ -4287,19 +4393,12 @@ parse_dparen (c) if (last_read_token == FOR) { arith_for_lineno = line_number; - cmdtyp = parse_arith_cmd (&wval); + cmdtyp = parse_arith_cmd (&wval, 0); if (cmdtyp == 1) { - /* parse_arith_cmd adds quotes at the beginning and end - of the string it returns; we need to take those out. */ - len = strlen (wval); - wv2 = (char *)xmalloc (len); - strncpy (wv2, wval + 1, len - 2); - wv2[len - 2] = '\0'; - wd = make_word (wv2); + wd = make_word (wval); yylval.word_list = make_word_list (wd, (WORD_LIST *)NULL); free (wval); - free (wv2); return (ARITH_FOR_EXPRS); } else @@ -4311,11 +4410,19 @@ parse_dparen (c) if (reserved_word_acceptable (last_read_token)) { sline = line_number; - cmdtyp = parse_arith_cmd (&wval); +#if 0 + cmdtyp = parse_arith_cmd (&wval, 1); +#else + cmdtyp = parse_arith_cmd (&wval, 0); +#endif if (cmdtyp == 1) /* arithmetic command */ { wd = make_word (wval); +#if 0 wd->flags = W_QUOTED; +#else + wd->flags = W_QUOTED|W_NOSPLIT|W_NOGLOB; +#endif yylval.word_list = make_word_list (wd, (WORD_LIST *)NULL); free (wval); /* make_word copies it */ return (ARITH_CMD); @@ -4341,8 +4448,9 @@ parse_dparen (c) allocated buffer and make *ep point to that buffer. Return -1 on an error, for example EOF. */ static int -parse_arith_cmd (ep) +parse_arith_cmd (ep, adddq) char **ep; + int adddq; { int exp_lineno, rval, c; char *ttok, *tokstr; @@ -4361,20 +4469,28 @@ parse_arith_cmd (ep) tokstr = (char *)xmalloc (ttoklen + 4); - /* (( ... )) -> "..." */ - tokstr[0] = (rval == 1) ? '"' : '('; - strncpy (tokstr + 1, ttok, ttoklen - 1); /* don't copy the final `)' */ - if (rval == 1) + /* if ADDDQ != 0 then (( ... )) -> "..." */ + if (rval == 1 && adddq) /* arith cmd, add double quotes */ { + tokstr[0] = '"'; + strncpy (tokstr + 1, ttok, ttoklen - 1); tokstr[ttoklen] = '"'; tokstr[ttoklen+1] = '\0'; } - else + else if (rval == 1) /* arith cmd, don't add double quotes */ { + strncpy (tokstr, ttok, ttoklen - 1); + tokstr[ttoklen-1] = '\0'; + } + else /* nested subshell */ + { + tokstr[0] = '('; + strncpy (tokstr + 1, ttok, ttoklen - 1); tokstr[ttoklen] = ')'; tokstr[ttoklen+1] = c; tokstr[ttoklen+2] = '\0'; } + *ep = tokstr; FREE (ttok); return rval; @@ -4440,7 +4556,7 @@ cond_skip_newlines () { while ((cond_token = read_token (READ)) == '\n') { - if (interactive && (bash_input.type == st_stdin || bash_input.type == st_stream)) + if (SHOULD_PROMPT ()) prompt_again (); } return (cond_token); @@ -4526,6 +4642,10 @@ cond_term () tok = read_token (READ); if (tok == WORD && test_binop (yylval.word->word)) op = yylval.word; +#if defined (COND_REGEXP) + else if (tok == WORD && STREQ (yylval.word->word,"=~")) + op = yylval.word; +#endif else if (tok == '<' || tok == '>') op = make_word_from_token (tok); /* ( */ /* There should be a check before blindly accepting the `)' that we have @@ -4941,8 +5061,7 @@ read_token_word (character) TOKEN_DEFAULT_GROW_SIZE); next_character: - if (character == '\n' && interactive && - (bash_input.type == st_stdin || bash_input.type == st_stream)) + if (character == '\n' && SHOULD_PROMPT ()) prompt_again (); /* We want to remove quoted newlines (that is, a \<newline> pair) @@ -5024,10 +5143,19 @@ got_token: result = ((the_word->flags & (W_ASSIGNMENT|W_NOSPLIT)) == (W_ASSIGNMENT|W_NOSPLIT)) ? ASSIGNMENT_WORD : WORD; - if (last_read_token == FUNCTION) + switch (last_read_token) { + case FUNCTION: parser_state |= PST_ALLOWOPNBRC; function_dstart = line_number; + break; + case CASE: + case SELECT: + case FOR: + if (word_top < MAX_CASE_NEST) + word_top++; + word_lineno[word_top] = line_number; + break; } return (result); @@ -5185,7 +5313,7 @@ prompt_again () { char *temp_prompt; - if (!interactive) /* XXX */ + if (interactive == 0 || expanding_alias()) /* XXX */ return; ps1_prompt = get_string_value ("PS1"); @@ -5541,6 +5669,11 @@ decode_prompt_string (string) #if defined (READLINE) case '[': case ']': + if (no_line_editing) + { + string++; + break; + } temp = (char *)xmalloc (3); temp[0] = '\001'; temp[1] = (c == '[') ? RL_PROMPT_START_IGNORE : RL_PROMPT_END_IGNORE; @@ -6037,6 +6170,105 @@ parse_compound_assignment (retlenp) /************************************************ * * + * SAVING AND RESTORING PARTIAL PARSE STATE * + * * + ************************************************/ + +sh_parser_state_t * +save_parser_state (ps) + sh_parser_state_t *ps; +{ +#if defined (ARRAY_VARS) + SHELL_VAR *v; +#endif + + if (ps == 0) + ps = xmalloc (sizeof (sh_parser_state_t)); + if (ps == 0) + return ((sh_parser_state_t *)NULL); + + ps->parser_state = parser_state; + ps->token_state = save_token_state (); + + ps->input_line_terminator = shell_input_line_terminator; + ps->eof_encountered = eof_encountered; + + ps->current_command_line_count = current_command_line_count; + +#if defined (HISTORY) + ps->remember_on_history = remember_on_history; +# if defined (BANG_HISTORY) + ps->history_expansion_inhibited = history_expansion_inhibited; +# endif +#endif + + ps->last_command_exit_value = last_command_exit_value; +#if defined (ARRAY_VARS) + v = find_variable ("PIPESTATUS"); + if (v && array_p (v) && array_cell (v)) + ps->pipestatus = array_copy (array_cell (v)); + else + ps->pipestatus = (ARRAY *)NULL; +#endif + + ps->last_shell_builtin = last_shell_builtin; + ps->this_shell_builtin = this_shell_builtin; + + ps->expand_aliases = expand_aliases; + ps->echo_input_at_read = echo_input_at_read; + + return (ps); +} + +void +restore_parser_state (ps) + sh_parser_state_t *ps; +{ +#if defined (ARRAY_VARS) + SHELL_VAR *v; +#endif + + if (ps == 0) + return; + + parser_state = ps->parser_state; + if (ps->token_state) + { + restore_token_state (ps->token_state); + free (ps->token_state); + } + + shell_input_line_terminator = ps->input_line_terminator; + eof_encountered = ps->eof_encountered; + + current_command_line_count = ps->current_command_line_count; + +#if defined (HISTORY) + remember_on_history = ps->remember_on_history; +# if defined (BANG_HISTORY) + history_expansion_inhibited = ps->history_expansion_inhibited; +# endif +#endif + + last_command_exit_value = ps->last_command_exit_value; +#if defined (ARRAY_VARS) + v = find_variable ("PIPESTATUS"); + if (v && array_p (v) && array_cell (v)) + { + array_dispose (array_cell (v)); + var_setarray (v, ps->pipestatus); + } +#endif + + last_shell_builtin = ps->last_shell_builtin; + this_shell_builtin = ps->this_shell_builtin; + + expand_aliases = ps->expand_aliases; + echo_input_at_read = ps->echo_input_at_read; +} + +/************************************************ + * * * MULTIBYTE CHARACTER HANDLING * * * ************************************************/ @@ -6045,7 +6277,7 @@ parse_compound_assignment (retlenp) static void set_line_mbstate () { - int i, previ, len; + int i, previ, len, c; mbstate_t mbs, prevs; size_t mbclen; @@ -6060,7 +6292,8 @@ set_line_mbstate () { mbs = prevs; - if (shell_input_line[i] == EOF) + c = shell_input_line[i]; + if (c == EOF) { int j; for (j = i; j < len; j++) @@ -6084,7 +6317,11 @@ set_line_mbstate () } else { - /* mbrlen doesn't return any other values */ + /* XXX - what to do if mbrlen returns 0? (null wide character) */ + int j; + for (j = i; j < len; j++) + shell_input_line_property[j] = 1; + break; } shell_input_line_property[i] = mbclen; |