Bash-4.1 distribution source

This commit is contained in:
Chet Ramey 2011-11-21 20:51:19 -05:00
parent 89a92869e5
commit 0001803f0b
252 changed files with 51563 additions and 37176 deletions

View File

@ -334,6 +334,7 @@ examples/functions/manpage Tom Tromey
examples/functions/fstty Chet Ramey
examples/functions/jj.bash Chet Ramey
examples/functions/notify.bash Chet Ramey
examples/loadables/getconf.c J.T. Conklin
examples/scripts/shprompt Chet Ramey
examples/scripts/adventure.sh Chet Ramey, Doug Gwyn
examples/scripts/bcsh.sh Chris Robertson, Chet Ramey

374
CHANGES
View File

@ -1,3 +1,375 @@
This document details the changes between this version, bash-4.1-rc,
and the previous version, bash-4.1-beta.
1. Changes to Bash
a. Fixed a bug that caused printf to not return a partial value when it
encountered an error while converting an integer argument.
b. Fixed a bug that caused setting one of the compatNN options to not
turn off the others.
c. The (undocumented) --wordexp option is no longer included by default.
d. Fixed a bug in conditional command execution that caused it to not
correctly ignore the exit status under certain circumstances.
e. Added a configure-time check for correctly-working asprintf/snprintf.
f. Fixed some problems with line number calculation and display when sourcing
a file in an interactive shell.
g. Fixed a bug that caused the shell to crash when using `declare -A foo=bar'.
h. Fixed a bug that caused an off-by-one error when calculating the directories
to display with the PROMPT_DIRTRIM option.
2. Changes to Readline
a. Fixed a bug that caused applications using the callback interface to not
react to SIGINT (or other signals) until another character arrived.
------------------------------------------------------------------------------
This document details the changes between this version, bash-4.1-beta,
and the previous version, bash-4.1-alpha.
1. Changes to Bash
a. Fixed a bug in mapfile that caused the shell to crash if it was passed the
name of an associative array.
b. Fixed a bug that caused the shell to incorrectly split case patterns if
they contained characters in $IFS.
c. Fixed a bug that caused the shell to set $? to the wrong value when using
a construct ending with a variable assignment with set -x enabled and PS4
containing a command substitution.
d. Fixed a bug that caused the shell to read commands incorrectly if an
expansion error occurred under certain conditions in a user-specified
subshell.
e. Fixed a bug that caused the shell to set $? incorrectly if a parse error
occurred in an evaluation context ("eval", trap command, dot script, etc.)
f. Fixed a bug that caused the shell to attempt command substitution
completion within a single-quoted string.
g. Fixed a bug that caused the shell to insert an extra single quote during
word completion.
h. Fixed a bug that caused the shell to crash if invoked with the environment
variable EMACS having a null value.
i. Fixed a bug that caused bash to incorrectly report the presence of new
mail in a `maildir' environment.
j. Fixed a bug that caused the shell to not recognize a here-document ending
delimiter inside a command substitution.
k. Fixed a bug that caused the shell to crash when a a dynamic array variable
was assigned a scalar value.
2. Changes to Readline
3. New Features in Bash
a. The mapfile/readarray builtin no longer stores the commands it invokes via
callbacks in the history list.
b. There is a new `compat40' shopt option.
c. The < and > operators to [[ do string comparisons using the current locale
only if the compatibility level is greater than 40 (set to 41 by default).
4. New Features in Readline
------------------------------------------------------------------------------
This document details the changes between this version, bash-4.1-alpha,
and the previous version, bash-4.0-release.
1. Changes to Bash
a. Fixed bugs in the parser involving new parsing of the commands contained
in command substitution when the substitution is read.
b. Fixed a bug that caused the shell to dump core when performing programmable
completion using a shell function.
c. Fixed a bug in `mapfile' that caused it to invoke callbacks at the wrong
time.
d. Fixed a bug that caused the shell to dump core when listing jobs in the
`exit' builtin.
e. Fixed several bugs encountered when reading subscripts in associative
array assignments and expansions.
f. Fixed a bug that under some circumstances caused an associative array to
be converted to an indexed array.
g. Fixed a bug that caused syntax errors and SIGINT interrupts to not set
$? to a value > 128.
h. Fixed a bug that caused the shell to remove FIFOs associated with process
substitution inside shell functions.
i. Fixed a bug that caused terminal attributes to not be reset when the
`read' builtin timed out.
j. Fixed a bug in brace expansion that caused unwanted zero padding of the
expanded terms.
k. Fixed a bug that prevented the |& construct from working as intended when
used with a simple command with additional redirections.
l. Fixed a bug with the case statment ;& terminator that caused the shell to
dereference a NULL pointer.
m. Fixed a bug that caused assignment statements or redirections preceding
a simple command name to inhibit alias expansion.
n. Fixed the behavior of `set -u' to conform to the latest Posix interpretation:
every expansion of an unset variable except $@ and $* will cause the
shell to exit.
o. Fixed a bug that caused double-quoted expansions of $* inside word
expansions like ${x#$*} to not expand properly when $IFS is empty.
p. Fixed a bug that caused traps to set $LINENO to the wrong value when they
execute.
q. Fixed a bug that caused off-by-one errors when computing history lines in
the `fc' builtin.
r. Fixed a bug that caused some terminating signals to not exit the shell
quickly enough, forcing the kernel to send the signal (e.g., SIGSEGV)
multiple times.
s. Fixed a bug that caused the shell to attempt to add empty lines to the
history list when reading here documents.
t. Made some internal changes that dramatically speeds up sequential indexed
array access.
u. Fixed a bug that caused the shell to write past the end of a string when
completing a double-quoted string ending in a backslash.
v. Fixed a bug that caused the shell to replace too many characters when a
pattern match was null in a ${foo//bar} expansion.
w. Fixed bugs in the expansion of ** that caused duplicate directory names
and the contents of the current directory to be omitted.
x. Fixed a bug that caused $? to not be set correctly when referencing an
unset variable with set -u and set -e enabled.
y. Fixed a bug caused by executing an external program from the DEBUG trap
while a pipeline was running. The effect was to disturb the pipeline
state, occasionally causing it to hang.
z. Fixed a bug that caused the ** glob expansion to dump core if it
encountered an unsearchable directory.
aa. Fixed a bug that caused `command -v' and `command -V' to not honor the
path set by the -p option.
bb. Fixed a bug that caused brace expansion to take place too soon in some
compound array assignments.
cc. Fixed a bug that caused programmable completion functions' changes to
READLINE_POINT to not be reflected back to readline.
dd. Fixed a bug that caused the shell to dump core if a trap was executed
during a shell assignment statement.
ee. Fixed an off-by-one error when computing the number of positional
parameters for the ${@:0:n} expansion.
ff. Fixed a problem with setting COMP_CWORD for programmable completion
functions that could leave it set to -1.
gg. Fixed a bug that caused the ERR trap to be triggered in some cases where
`set -e' would not have caused the shell to exit.
hh. Fixed a bug that caused changes made by `compopt' to not persist past the
completion function in which compopt was executed.
ii. Fixed a bug that caused the list of hostname completions to not be cleared
when HOSTNAME was unset.
jj. Fixed a bug that caused variable expansion in here documents to look in
any temporary environment.
kk. Bash and readline can now convert file names between precomposed and
decomposed Unicode on Mac OS X ("keyboard" and file system forms,
respectively). This affects filename completion (using new
rl_filename_rewrite_hook), globbing, and readline redisplay.
ll. The ERR and EXIT traps now see a non-zero value for $? when a parser
error after set -e has been enabled causes the shell to exit.
mm. Fixed a bug that in brace expansion that caused zero-prefixed terms to
not contain the correct number of digits.
nn. Fixed a bug that caused the shell to free non-allocated memory when
unsetting an associative array which had had a value implicitly assigned
to index "0".
oo. Fixed a memory leak in the ${!prefix@} expansion.
pp. Fixed a bug that caused printf to not correctly report all write errors.
qq. Fixed a bug that caused single and double quotes to act as delimiters
when splitting a command line into words for programmable completion.
rr. Fixed a bug that caused ** globbing that caused **/path/* to match every
directory, not just those matching `path'.
ss. Fixed a bug that caused the shell to dump core when running `help' without
arguments if the terminal width was fewer than 7 characters.
2. Changes to Readline
a. The SIGWINCH signal handler now avoids calling the redisplay code if
one arrives while in the middle of redisplay.
b. Changes to the timeout code to make sure that timeout values greater
than one second are handled better.
c. Fixed a bug in the redisplay code that was triggered by a prompt
containing invisible characters exactly the width of the screen.
d. Fixed a bug in the redisplay code encountered when running in horizontal
scroll mode.
e. Fixed a bug that prevented menu completion from properly completing
filenames.
f. Fixed a redisplay bug caused by a multibyte character causing a line to
wrap.
g. Fixed a bug that caused key sequences of two characters to not be
recognized when a longer sequence identical in the first two characters
was bound.
h. Fixed a bug that caused history expansion to be attempted on $'...'
single-quoted strings.
i. Fixed a bug that caused incorrect redisplay when the prompt contained
multibyte characters in an `invisible' sequence bracketed by \[ and
\].
j. Fixed a bug that caused history expansion to short-circuit after
encountering a multibyte character.
3. New Features in Bash
a. Here-documents within $(...) command substitutions may once more be
delimited by the closing right paren, instead of requiring a newline.
b. Bash's file status checks (executable, readable, etc.) now take file
system ACLs into account on file systems that support them.
c. Bash now passes environment variables with names that are not valid
shell variable names through into the environment passed to child
processes.
d. The `execute-unix-command' readline function now attempts to clear and
reuse the current line rather than move to a new one after the command
executes.
e. `printf -v' can now assign values to array indices.
f. New `complete -E' and `compopt -E' options that work on the "empty"
completion: completion attempted on an empty command line.
g. New complete/compgen/compopt -D option to define a `default' completion:
a completion to be invoked on command for which no completion has been
defined. If this function returns 124, programmable completion is
attempted again, allowing a user to dynamically build a set of completions
as completion is attempted by having the default completion function
install individual completion functions each time it is invoked.
h. When displaying associative arrays, subscripts are now quoted.
i. Changes to dabbrev-expand to make it more `emacs-like': no space appended
after matches, completions are not sorted, and most recent history entries
are presented first.
j. The [[ and (( commands are now subject to the setting of `set -e' and the
ERR trap.
k. The source/. builtin now removes NUL bytes from the file before attempting
to parse commands.
l. There is a new configuration option (in config-top.h) that forces bash to
forward all history entries to syslog.
m. A new variable $BASHOPTS to export shell options settable using `shopt' to
child processes.
n. There is a new confgure option that forces the extglob option to be
enabled by default.
o. New variable $BASH_XTRACEFD; when set to an integer bash will write xtrace
output to that file descriptor.
p. If the optional left-hand-side of a redirection is of the form {var}, the
shell assigns the file descriptor used to $var or uses $var as the file
descriptor to move or close, depending on the redirection operator.
q. The < and > operators to the [[ conditional command now do string
comparison according to the current locale.
r. Programmable completion now uses the completion for `b' instead of `a'
when completion is attempted on a line like: a $(b c.
s. Force extglob on temporarily when parsing the pattern argument to
the == and != operators to the [[ command, for compatibility.
t. Changed the behavior of interrupting the wait builtin when a SIGCHLD is
received and a trap on SIGCHLD is set to be Posix-mode only.
u. The read builtin has a new `-N nchars' option, which reads exactly NCHARS
characters, ignoring delimiters like newline.
4. New Features in Readline
a. New bindable function: menu-complete-backward.
b. In the vi insertion keymap, C-n is now bound to menu-complete by default,
and C-p to menu-complete-backward.
c. When in vi command mode, repeatedly hitting ESC now does nothing, even
when ESC introduces a bound key sequence. This is closer to how
historical vi behaves.
d. New bindable function: skip-csi-sequence. Can be used as a default to
consume key sequences generated by keys like Home and End without having
to bind all keys.
e. New application-settable function: rl_filename_rewrite_hook. Can be used
to rewite or modify filenames read from the file system before they are
compared to the word to be completed.
f. New bindable variable: skip-completed-text, active when completing in the
middle of a word. If enabled, it means that characters in the completion
that match characters in the remainder of the word are "skipped" rather
than inserted into the line.
g. The pre-readline-6.0 version of menu completion is available as
"old-menu-complete" for users who do not like the readline-6.0 version.
h. New bindable variable: echo-control-characters. If enabled, and the
tty ECHOCTL bit is set, controls the echoing of characters corresponding
to keyboard-generated signals.
i. New bindable variable: enable-meta-key. Controls whether or not readline
sends the smm/rmm sequences if the terminal indicates it has a meta key
that enables eight-bit characters.
------------------------------------------------------------------------------
This document details the changes between this version, bash-4.0-release,
and the previous version, bash-4.0-rc1.
@ -601,7 +973,7 @@ bb. The command assigned to a key sequence with `bind -x' now sets two new
and cursor position by modifying READLINE_LINE_BUFFER and READLINE_POINT,
respectively.
cc. There is a new >>& redirection operator, which appends the standard output
cc. There is a new &>> redirection operator, which appends the standard output
and standard error to the named file.
dd. The parser now understands `|&' as a synonym for `2>&1 |', which redirects

59
COMPAT
View File

@ -1,10 +1,12 @@
Compatibility with previous versions
====================================
This document details the incompatibilities between this version of bash,
bash-4.0, and the previous widely-available versions, bash-1.14 (which is
still the `standard' version for a few Linux distributions) and bash-2.x.
bash-4.1, and the previous widely-available versions, bash-2.x (which is
still the `standard' version for a few Linux distributions) and bash-3.x.
These were discovered by users of bash-2.x and 3.x, so this list is not
comprehensive. Some of these incompatibilities occur between the current
version and versions 2.0 and above. (The differences between bash-1.14 and
bash-2.0 were significant.)
version and versions 2.0 and above.
1. Bash uses a new quoting syntax, $"...", to do locale-specific
string translation. Users who have relied on the (undocumented)
@ -277,7 +279,8 @@ bash-2.0 were significant.)
than a regular expression.
34. Bash-4.0 allows the behavior in the previous item to be modified using
the notion of a shell `compatibility level'.
the notion of a shell `compatibility level'. If the compat31 shopt
option is set, quoting the pattern has no special effect.
35. Bash-3.2 (patched) and Bash-4.0 fix a bug that leaves the shell in an
inconsistent internal state following an assignment error. One of the
@ -311,10 +314,54 @@ bash-2.0 were significant.)
41. Beginning with bash-4.0, when one of the commands in a pipeline is killed
by a SIGINT while executing a command list, the shell acts as if it
received the interrupt.
received the interrupt. This can be disabled by setting the compat31 or
compat32 shell options.
42. Bash-4.0 changes the handling of the set -e option so that the shell exits
if a pipeline fails (and not just if the last command in the failing
pipeline is a simple command). This is not as Posix specifies. There is
work underway to update this portion of the standard; the bash-4.0
behavior attempts to capture the consensus at the time of release.
43. Bash-4.0 fixes a Posix mode bug that caused the . (source) builtin to
search the current directory for its filename argument, even if "." is
not in $PATH. Posix says that the shell shouldn't look in $PWD in this
case.
44. Bash-4.1 uses the current locale when comparing strings using the < and
> operators to the `[[' command. This can be reverted to the previous
behavior by setting one of the `compatNN' shopt options.
Shell Compatibility Level
=========================
Bash-4.0 introduced the concept of a `shell compatibility level', specified
as a set of options to the shopt builtin (compat31, compat32, compat40 at
this writing). There is only one current compatibility level -- each
option is mutually exclusive. This list does not mention behavior that is
standard for a particular version (e.g., setting compat32 means that quoting
the rhs of the regexp matching operator quotes special regexp characters in
the word, which is default behavior in bash-3.2 and above).
compat31 set
- the < and > operators to the [[ command do not consider the current
locale when comparing strings
- quoting the rhs of the regexp matching operator (=~) has no
special effect
compat32 set
- the < and > operators to the [[ command do not consider the current
locale when comparing strings
compat40 set
- the < and > operators to the [[ command do not consider the current
locale when comparing strings
- interrupting a command list such as "a ; b ; c" causes the execution
of the entire list to be aborted
-------------------------------------------------------------------------------
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. This file is offered as-is,
without any warranty.

File diff suppressed because it is too large Load Diff

View File

@ -326,6 +326,10 @@ does not provide the necessary support.
Include support for the extended pattern matching features
described above under *note Pattern Matching::.
`--enable-extended-glob-default'
Set the default value of the EXTGLOB shell option described above
under *note The Shopt Builtin:: to be enabled.
`--enable-help-builtin'
Include the `help' builtin, which displays help on shell builtins
and variables (*note Bash Builtins::).

View File

@ -38,6 +38,7 @@ support d
tests d
tests/misc d
ABOUT-NLS f
ChangeLog s CWRU/changelog
CHANGES f
COMPAT f
COPYING f
@ -215,6 +216,7 @@ include/memalloc.h f
include/ocache.h f
include/posixdir.h f
include/posixjmp.h f
include/posixselect.h f
include/posixstat.h f
include/posixtime.h f
include/posixwait.h f
@ -351,6 +353,7 @@ lib/readline/histlib.h f
lib/readline/chardefs.h f
lib/readline/posixdir.h f
lib/readline/posixjmp.h f
lib/readline/posixselect.h f
lib/readline/posixstat.h f
lib/readline/ansi_stdlib.h f
lib/readline/rlstdc.h f
@ -384,6 +387,7 @@ lib/sh/fdprintf.c f
lib/sh/fmtullong.c f
lib/sh/fmtulong.c f
lib/sh/fmtumax.c f
lib/sh/fnxform.c f
lib/sh/fpurge.c f
lib/sh/getcwd.c f
lib/sh/getenv.c f
@ -392,6 +396,8 @@ lib/sh/input_avail.c f
lib/sh/itos.c f
lib/sh/mailstat.c f
lib/sh/makepath.c f
lib/sh/mbscasecmp.c f
lib/sh/mbschr.c f
lib/sh/mbscmp.c f
lib/sh/memset.c f
lib/sh/mktime.c f
@ -408,9 +414,9 @@ lib/sh/shtty.c f
lib/sh/snprintf.c f
lib/sh/spell.c f
lib/sh/strcasecmp.c f
lib/sh/strcasestr.c f
lib/sh/strerror.c f
lib/sh/strftime.c f
lib/sh/strindex.c f
lib/sh/stringlist.c f
lib/sh/stringvec.c f
lib/sh/strnlen.c f
@ -432,7 +438,6 @@ lib/sh/ufuncs.c f
lib/sh/vprint.c f
lib/sh/wcsdup.c f
lib/sh/winsize.c f
lib/sh/xstrchr.c f
lib/sh/zcatfd.c f
lib/sh/zgetline.c f
lib/sh/zmapfd.c f
@ -480,8 +485,12 @@ po/es.gmo f
po/es.po f
po/et.gmo f
po/et.po f
po/fi.gmo f
po/fi.po f
po/fr.gmo f
po/fr.po f
po/ga.gmo f
po/ga.po f
po/hu.gmo f
po/hu.po f
po/id.gmo f
@ -521,7 +530,6 @@ CWRU/misc/errlist.c f
CWRU/misc/hpux10-dlfcn.h f
CWRU/PLATFORMS f
CWRU/README f
CWRU/audit-patch f
CWRU/changelog f
CWRU/sh-redir-hack f
CWRU/mh-folder-comp f
@ -724,6 +732,7 @@ examples/misc/cshtobash f
tests/README f
tests/COPYRIGHT f
tests/alias.tests f
tests/alias1.sub f
tests/alias.right f
tests/appendop.tests f
tests/appendop.right f
@ -752,6 +761,8 @@ tests/assoc1.sub f
tests/assoc2.sub f
tests/assoc3.sub f
tests/assoc4.sub f
tests/assoc5.sub f
tests/assoc6.sub f
tests/braces.tests f
tests/braces.right f
tests/builtins.tests f
@ -770,11 +781,14 @@ tests/casemod.tests f
tests/casemod.right f
tests/comsub.tests f
tests/comsub.right f
tests/comsub1.sub f
tests/comsub-eof.tests f
tests/comsub-eof0.sub f
tests/comsub-eof1.sub f
tests/comsub-eof2.sub f
tests/comsub-eof3.sub f
tests/comsub-eof4.sub f
tests/comsub-eof5.sub f
tests/comsub-eof.right f
tests/comsub-posix.tests f
tests/comsub-posix.right f
@ -791,12 +805,16 @@ tests/dbg-support.sub f
tests/dbg-support.tests f
tests/dbg-support2.right f
tests/dbg-support2.tests f
tests/dbg-support3.sub f
tests/dollar-at-star f
tests/dollar-at1.sub f
tests/dollar-at2.sub f
tests/dollar-at3.sub f
tests/dollar-star1.sub f
tests/dollar-star2.sub f
tests/dollar-star3.sub f
tests/dollar-star4.sub f
tests/dollar-star5.sub f
tests/dollar.right f
tests/dstack.tests f
tests/dstack.right f
@ -818,6 +836,7 @@ tests/exp.tests f
tests/exp.right f
tests/exp1.sub f
tests/exp2.sub f
tests/exp3.sub f
tests/extglob.tests f
tests/extglob.right f
tests/extglob1.sub f
@ -839,9 +858,12 @@ tests/getopts4.sub f
tests/getopts5.sub f
tests/getopts6.sub f
tests/getopts7.sub f
tests/glob-test f
tests/glob.tests f
tests/glob1.sub f
tests/glob.right f
tests/globstar.tests f
tests/globstar.right f
tests/globstar1.sub f
tests/heredoc.tests f
tests/heredoc.right f
tests/heredoc1.sub f
@ -853,6 +875,7 @@ tests/history.tests f
tests/history.right f
tests/history.list f 444
tests/history1.sub f
tests/history2.sub f
tests/ifs.tests f
tests/ifs.right f
tests/ifs-posix.tests f
@ -890,6 +913,7 @@ tests/new-exp7.sub f
tests/new-exp.right f
tests/nquote.tests f
tests/nquote.right f
tests/nquote1.sub f
tests/nquote1.tests f
tests/nquote1.right f
tests/nquote2.tests f
@ -908,6 +932,7 @@ tests/prec.right f
tests/precedence f
tests/printf.tests f
tests/printf.right f
tests/printf2.sub f
tests/quote.tests f
tests/quote.right f
tests/read.tests f
@ -968,6 +993,7 @@ tests/run-extglob3 f
tests/run-func f
tests/run-getopts f
tests/run-glob-test f
tests/run-globstar f
tests/run-heredoc f
tests/run-herestr f
tests/run-histexpand f
@ -1007,11 +1033,13 @@ tests/run-tilde2 f
tests/run-trap f
tests/run-type f
tests/run-varenv f
tests/run-vredir f
tests/set-e.tests f
tests/set-e1.sub f
tests/set-e2.sub f
tests/set-e.right f
tests/set-x.tests f
tests/set-x1.sub f
tests/set-x.right f
tests/shopt.tests f
tests/shopt.right f
@ -1028,15 +1056,24 @@ tests/trap.right f
tests/trap1.sub f 755
tests/trap2.sub f 755
tests/trap2a.sub f 755
tests/trap3.sub f
tests/type.tests f
tests/type.right f
tests/type1.sub f
tests/type2.sub f
tests/varenv.right f
tests/varenv.sh f
tests/varenv1.sub f
tests/varenv2.sub f
tests/version f
tests/version.mini f
tests/vredir.tests f
tests/vredir.right f
tests/vredir1.sub f
tests/vredir2.sub f
tests/vredir3.sub f
tests/vredir4.sub f
tests/vredir5.sub f
tests/misc/dev-tcp.tests f
tests/misc/perf-script f
tests/misc/perftest f

View File

@ -1,4 +1,4 @@
# Makefile for bash-4.0, version 3.4
# Makefile for bash-4.0, version 3.5
#
# Copyright (C) 1996-2009 Free Software Foundation, Inc.
@ -147,7 +147,7 @@ CCFLAGS = $(BASE_CCFLAGS) $(CPPFLAGS) $(CFLAGS)
CCFLAGS_FOR_BUILD = $(BASE_CCFLAGS) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD)
LDFLAGS = @LDFLAGS@ $(STATIC_LD) $(LOCAL_LDFLAGS) $(PROFILE_FLAGS) $(CFLAGS)
LDFLAGS_FOR_BUILD = $(LDFLAGS)
LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@ $(LOCAL_LDFLAGS) $(CFLAGS_FOR_BUILD)
INCLUDES = -I. @RL_INCLUDE@ -I$(srcdir) -I$(BASHINCDIR) -I$(LIBSRC) $(INTL_INC)
@ -198,14 +198,14 @@ SHLIB_SOURCE = ${SH_LIBSRC}/clktck.c ${SH_LIBSRC}/getcwd.c \
${SH_LIBSRC}/pathphys.c ${SH_LIBSRC}/stringlist.c \
${SH_LIBSRC}/stringvec.c ${SH_LIBSRC}/tmpfile.c \
${SH_LIBSRC}/spell.c ${SH_LIBSRC}/strtrans.c \
${SH_LIBSRC}/strindex.c ${SH_LIBSRC}/shquote.c \
${SH_LIBSRC}/strcasestr.c ${SH_LIBSRC}/shquote.c \
${SH_LIBSRC}/snprintf.c ${SH_LIBSRC}/mailstat.c \
${SH_LIBSRC}/fmtulong.c ${SH_LIBSRC}/fmtullong.c \
${SH_LIBSRC}/strtoll.c ${SH_LIBSRC}/strtoull.c \
${SH_LIBSRC}/strtoimax.c ${SH_LIBSRC}/strtoumax.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}/memset.c ${SH_LIBSRC}/mbschr.c \
${SH_LIBSRC}/zcatfd.c ${SH_LIBSRC}/shmatch.c \
${SH_LIBSRC}/strnlen.c ${SH_LIBSRC}/winsize.c \
${SH_LIBSRC}/eaccess.c ${SH_LIBSRC}/wcsdup.c \
@ -213,7 +213,8 @@ SHLIB_SOURCE = ${SH_LIBSRC}/clktck.c ${SH_LIBSRC}/getcwd.c \
${SH_LIBSRC}/zgetline.c ${SH_LIBSRC}/mbscmp.c \
${SH_LIBSRC}/casemod.c ${SH_LIBSRC}/uconvert.c \
${SH_LIBSRC}/ufuncs.c ${SH_LIBSRC}/fdprintf.c \
${SH_LIBSRC}/input_avail.c
${SH_LIBSRC}/input_avail.c ${SH_LIBSRC}/mbscasecmp.c \
${SH_LIBSRC}/fnxform.c
SHLIB_LIB = -lsh
SHLIB_LIBNAME = libsh.a
@ -347,6 +348,9 @@ INTL_INC = @INTL_INC@
LIBINTL_H = @LIBINTL_H@
# libiconv
LIBICONV = @LIBICONV@
# tests
LIBINTL = @LIBINTL@
LTLIBINTL = @LTLIBINTL@
@ -393,10 +397,10 @@ BASHINCFILES = $(BASHINCDIR)/posixstat.h $(BASHINCDIR)/ansi_stdlib.h \
$(BASHINCDIR)/shtty.h $(BASHINCDIR)/typemax.h \
$(BASHINCDIR)/ocache.h
LIBRARIES = $(SHLIB_LIB) $(READLINE_LIB) $(HISTORY_LIB) $(TERMCAP_LIB) $(GLOB_LIB) \
$(TILDE_LIB) $(MALLOC_LIB) $(INTL_LIB) $(LOCAL_LIBS)
LIBRARIES = $(GLOB_LIB) $(SHLIB_LIB) $(READLINE_LIB) $(HISTORY_LIB) $(TERMCAP_LIB) \
$(TILDE_LIB) $(MALLOC_LIB) $(INTL_LIB) $(LIBICONV) $(LOCAL_LIBS)
LIBDEP = $(SHLIB_DEP) $(INTL_DEP) $(READLINE_DEP) $(HISTORY_DEP) $(TERMCAP_DEP) $(GLOB_DEP) \
LIBDEP = $(GLOB_DEP) $(SHLIB_DEP) $(INTL_DEP) $(READLINE_DEP) $(HISTORY_DEP) $(TERMCAP_DEP) \
$(TILDE_DEP) $(MALLOC_DEP)
LIBRARY_LDFLAGS = $(READLINE_LDFLAGS) $(HISTORY_LDFLAGS) $(GLOB_LDFLAGS) \
@ -595,7 +599,7 @@ $(READLINE_LIBRARY): config.h $(READLINE_SOURCE)
@( { test "${RL_LIBDIR}" = "${libdir}" && exit 0; } || \
cd ${RL_LIBDIR} && $(MAKE) $(MFLAGS) libreadline.a) || exit 1
$(HISTORY_LIBRARY): config.h $(HISTORY_SOURCE)
$(HISTORY_LIBRARY): config.h $(HISTORY_SOURCE) $(READLINE_DEP)
@echo making $@ in ${HIST_LIBDIR}
@( { test "${HIST_LIBDIR}" = "${libdir}" && exit 0; } || \
cd ${HIST_LIBDIR} && $(MAKE) $(MFLAGS) libhistory.a) || exit 1
@ -860,6 +864,7 @@ hashtest: hashlib.c
# Files that depend on the definitions in config-top.h, which are not meant
# to be changed
bashhist.o: config-top.h
shell.o: config-top.h
input.o: config-top.h
y.tab.o: config-top.h
@ -935,7 +940,7 @@ general.o: ${BASHINCDIR}/chartypes.h
hashcmd.o: config.h ${BASHINCDIR}/posixstat.h bashtypes.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
hashcmd.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
hashcmd.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashcmd.h
hashcmd.o: execute_cmd.h findcmd.h ${BASHINCDIR}/stdc.h hashlib.h
hashcmd.o: execute_cmd.h findcmd.h ${BASHINCDIR}/stdc.h pathnames.h hashlib.h
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
@ -943,6 +948,7 @@ 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
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
input.o: quit.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
@ -1022,6 +1028,7 @@ subst.o: mailcheck.h input.h $(DEFSRC)/getopt.h $(DEFSRC)/common.h
subst.o: bashline.h bashhist.h ${GLOB_LIBSRC}/strmatch.h
subst.o: ${BASHINCDIR}/chartypes.h
subst.o: ${BASHINCDIR}/shmbutil.h
subst.o: ${DEFDIR}/builtext.h
test.o: bashtypes.h ${BASHINCDIR}/posixstat.h ${BASHINCDIR}/filecntl.h
test.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
test.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
@ -1034,7 +1041,7 @@ trap.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h arra
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: signames.h $(DEFSRC)/common.h
trap.o: ${DEFDIR}/builtext.h
trap.o: ${DEFDIR}/builtext.h jobs.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
@ -1045,7 +1052,7 @@ 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 ${BASHINCDIR}/chartypes.h
variables.o: ${BASHINCDIR}/posixtime.h
variables.o: ${BASHINCDIR}/posixtime.h assoc.h
version.o: conftypes.h patchlevel.h version.h
xmalloc.o: config.h bashtypes.h ${BASHINCDIR}/ansi_stdlib.h error.h
@ -1056,7 +1063,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: execute_cmd.h 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
@ -1077,7 +1084,7 @@ 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 pathexp.h
arrayfunc.o: $(DEFSRC)/common.h
arrayfunc.o: ${BASHINCDIR}/shmbutil.h
assoc.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
@ -1130,13 +1137,12 @@ 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
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: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h
bracecomp.o: command.h ${BASHINCDIR}/stdc.h error.h
bracecomp.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h
bracecomp.o: array.h hashlib.h alias.h builtins.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: 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
# library dependencies
@ -1224,7 +1230,7 @@ builtins/evalstring.o: ${BASHINCDIR}/memalloc.h variables.h arrayfunc.h conftype
builtins/evalstring.o: quit.h unwind_prot.h ${BASHINCDIR}/maxpath.h jobs.h builtins.h
builtins/evalstring.o: dispose_cmd.h make_cmd.h subst.h externs.h
builtins/evalstring.o: jobs.h builtins.h flags.h input.h execute_cmd.h
builtins/evalstring.o: bashhist.h $(DEFSRC)/common.h
builtins/evalstring.o: bashhist.h $(DEFSRC)/common.h pathnames.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
@ -1235,80 +1241,89 @@ builtins/mkbuiltins.o: bashansi.h ${BASHINCDIR}/ansi_stdlib.h
# builtin def files
builtins/alias.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/alias.o: quit.h $(DEFSRC)/common.h
builtins/alias.o: quit.h $(DEFSRC)/common.h pathnames.h
builtins/alias.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h command.h ${BASHINCDIR}/stdc.h unwind_prot.h
builtins/alias.o: dispose_cmd.h make_cmd.h subst.h externs.h variables.h arrayfunc.h conftypes.h
builtins/bind.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/bind.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/bind.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h quit.h
builtins/bind.o: $(DEFSRC)/bashgetopt.h
builtins/bind.o: $(DEFSRC)/bashgetopt.h pathnames.h
builtins/break.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/break.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h quit.h
builtins/break.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/break.o: pathnames.h
builtins/builtin.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
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/builtin.o: pathnames.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/caller.o: ${DEFDIR}/builtext.h pathnames.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
builtins/cd.o: $(DEFSRC)/common.h quit.h
builtins/cd.o: $(DEFSRC)/common.h quit.h pathnames.h
builtins/command.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/command.o: quit.h $(DEFSRC)/bashgetopt.h
builtins/command.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/command.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/command.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h pathnames.h
builtins/declare.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/declare.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h quit.h
builtins/declare.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/declare.o: $(DEFSRC)/bashgetopt.h
builtins/declare.o: $(DEFSRC)/bashgetopt.h pathnames.h
builtins/echo.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/echo.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h quit.h
builtins/echo.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/echo.o: pathnames.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 pathnames.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/eval.o: pathnames.h
builtins/exec.o: bashtypes.h pathnames.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: findcmd.h flags.h quit.h $(DEFSRC)/common.h ${BASHINCDIR}/stdc.h
builtins/exec.o: pathnames.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
builtins/exit.o: pathnames.h
builtins/fc.o: bashtypes.h ${BASHINCDIR}/posixstat.h
builtins/fc.o: bashansi.h ${BASHINCDIR}/ansi_stdlib.h builtins.h command.h ${BASHINCDIR}/stdc.h
builtins/fc.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/fc.o: flags.h unwind_prot.h variables.h arrayfunc.h conftypes.h shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.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: $(DEFSRC)/bashgetopt.h bashhist.h pathnames.h
builtins/fc.o: ${BASHINCDIR}/chartypes.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/fg_bg.o: pathnames.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/getopts.o: pathnames.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/hash.o: pathnames.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
builtins/history.o: bashtypes.h
builtins/help.o: $(GLOB_LIBSRC)/glob.h pathnames.h
builtins/history.o: bashtypes.h pathnames.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
@ -1316,16 +1331,20 @@ builtins/history.o: bashhist.h variables.h arrayfunc.h conftypes.h
builtins/inlib.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/inlib.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h quit.h
builtins/inlib.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/inlib.o: pathnames.h
builtins/jobs.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/jobs.o: quit.h $(DEFSRC)/bashgetopt.h
builtins/jobs.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/jobs.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/jobs.o: pathnames.h
builtins/kill.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/kill.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/kill.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h trap.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/kill.o: pathnames.h
builtins/let.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/let.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/let.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/let.o: pathnames.h
builtins/printf.o: config.h ${BASHINCDIR}/memalloc.h bashjmp.h command.h error.h
builtins/printf.o: general.h xmalloc.h quit.h dispose_cmd.h make_cmd.h subst.h
builtins/printf.o: externs.h sig.h pathnames.h shell.h syntax.h unwind_prot.h
@ -1334,71 +1353,84 @@ builtins/printf.o: ${BASHINCDIR}/chartypes.h
builtins/pushd.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/pushd.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/pushd.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/pushd.o: $(DEFSRC)/common.h
builtins/pushd.o: $(DEFSRC)/common.h pathnames.h
builtins/read.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/read.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/read.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/read.o: pathnames.h
builtins/return.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/return.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/return.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/return.o: pathnames.h
builtins/set.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/set.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/set.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h flags.h
builtins/set.o: pathnames.h
builtins/setattr.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/setattr.o: quit.h $(DEFSRC)/common.h $(DEFSRC)/bashgetopt.h
builtins/setattr.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/setattr.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/setattr.o: pathnames.h
builtins/shift.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/shift.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/shift.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/shift.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/shift.o: pathnames.h
builtins/shopt.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h
builtins/shopt.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h
builtins/shopt.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h unwind_prot.h variables.h arrayfunc.h conftypes.h ${BASHINCDIR}/maxpath.h
builtins/shopt.o: $(DEFSRC)/common.h $(DEFSRC)/bashgetopt.h
builtins/shopt.o: $(DEFSRC)/common.h $(DEFSRC)/bashgetopt.h pathnames.h
builtins/shopt.o: bashhist.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 flags.h trap.h
builtins/source.o: pathnames.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/suspend.o: pathnames.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 pathnames.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
builtins/times.o: pathnames.h
builtins/trap.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/trap.o: quit.h $(DEFSRC)/common.h
builtins/trap.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/trap.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/trap.o: pathnames.h
builtins/type.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/type.o: quit.h $(DEFSRC)/common.h findcmd.h
builtins/type.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/type.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/type.o: pathnames.h
builtins/ulimit.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/ulimit.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/ulimit.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/ulimit.o: pathnames.h
builtins/umask.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/umask.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/umask.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/umask.o: ${BASHINCDIR}/chartypes.h
builtins/umask.o: ${BASHINCDIR}/chartypes.h pathnames.h
builtins/wait.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/wait.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/wait.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/wait.o: ${BASHINCDIR}/chartypes.h
builtins/wait.o: ${BASHINCDIR}/chartypes.h pathnames.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 pathnames.h
builtins/complete.o: pcomplete.h
builtins/complete.o: ${DEFSRC}/common.h ${DEFSRC}/bashgetopt.h
builtins/mapfile.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/mapfile.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/mapfile.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/mapfile.o: pathnames.h
# libintl dependencies
builtins/bind.o: ${topdir}/bashintl.h ${LIBINTL_H} $(BASHINCDIR)/gettext.h

123
NEWS
View File

@ -1,3 +1,120 @@
This is a terse description of the new features added to bash-4.1 since
the release of bash-4.0. As always, the manual page (doc/bash.1) is
the place to look for complete descriptions.
1. New Features in Bash
a. Here-documents within $(...) command substitutions may once more be
delimited by the closing right paren, instead of requiring a newline.
b. Bash's file status checks (executable, readable, etc.) now take file
system ACLs into account on file systems that support them.
c. Bash now passes environment variables with names that are not valid
shell variable names through into the environment passed to child
processes.
d. The `execute-unix-command' readline function now attempts to clear and
reuse the current line rather than move to a new one after the command
executes.
e. `printf -v' can now assign values to array indices.
f. New `complete -E' and `compopt -E' options that work on the "empty"
completion: completion attempted on an empty command line.
g. New complete/compgen/compopt -D option to define a `default' completion:
a completion to be invoked on command for which no completion has been
defined. If this function returns 124, programmable completion is
attempted again, allowing a user to dynamically build a set of completions
as completion is attempted by having the default completion function
install individual completion functions each time it is invoked.
h. When displaying associative arrays, subscripts are now quoted.
i. Changes to dabbrev-expand to make it more `emacs-like': no space appended
after matches, completions are not sorted, and most recent history entries
are presented first.
j. The [[ and (( commands are now subject to the setting of `set -e' and the
ERR trap.
k. The source/. builtin now removes NUL bytes from the file before attempting
to parse commands.
l. There is a new configuration option (in config-top.h) that forces bash to
forward all history entries to syslog.
m. A new variable $BASHOPTS to export shell options settable using `shopt' to
child processes.
n. There is a new confgure option that forces the extglob option to be
enabled by default.
o. New variable $BASH_XTRACEFD; when set to an integer bash will write xtrace
output to that file descriptor.
p. If the optional left-hand-side of a redirection is of the form {var}, the
shell assigns the file descriptor used to $var or uses $var as the file
descriptor to move or close, depending on the redirection operator.
q. The < and > operators to the [[ conditional command now do string
comparison according to the current locale if the compatibility level
is greater than 40.
r. Programmable completion now uses the completion for `b' instead of `a'
when completion is attempted on a line like: a $(b c.
s. Force extglob on temporarily when parsing the pattern argument to
the == and != operators to the [[ command, for compatibility.
t. Changed the behavior of interrupting the wait builtin when a SIGCHLD is
received and a trap on SIGCHLD is set to be Posix-mode only.
u. The read builtin has a new `-N nchars' option, which reads exactly NCHARS
characters, ignoring delimiters like newline.
v. The mapfile/readarray builtin no longer stores the commands it invokes via
callbacks in the history list.
w. There is a new `compat40' shopt option.
2. New Features in Readline
a. New bindable function: menu-complete-backward.
b. In the vi insertion keymap, C-n is now bound to menu-complete by default,
and C-p to menu-complete-backward.
c. When in vi command mode, repeatedly hitting ESC now does nothing, even
when ESC introduces a bound key sequence. This is closer to how
historical vi behaves.
d. New bindable function: skip-csi-sequence. Can be used as a default to
consume key sequences generated by keys like Home and End without having
to bind all keys.
e. New application-settable function: rl_filename_rewrite_hook. Can be used
to rewite or modify filenames read from the file system before they are
compared to the word to be completed.
f. New bindable variable: skip-completed-text, active when completing in the
middle of a word. If enabled, it means that characters in the completion
that match characters in the remainder of the word are "skipped" rather
than inserted into the line.
g. The pre-readline-6.0 version of menu completion is available as
"old-menu-complete" for users who do not like the readline-6.0 version.
h. New bindable variable: echo-control-characters. If enabled, and the
tty ECHOCTL bit is set, controls the echoing of characters corresponding
to keyboard-generated signals.
i. New bindable variable: enable-meta-key. Controls whether or not readline
sends the smm/rmm sequences if the terminal indicates it has a meta key
that enables eight-bit characters.
-------------------------------------------------------------------------------
This is a terse description of the new features added to bash-4.0 since
the release of bash-3.2. As always, the manual page (doc/bash.1) is
the place to look for complete descriptions.
@ -1410,3 +1527,9 @@ e. There are new library functions and variables available to application
f. The NEWLINE character (^J) is now treated as a search terminator by the
incremental search functions.
-------------------------------------------------------------------------------
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. This file is offered as-is,
without any warranty.

6
NOTES
View File

@ -344,4 +344,8 @@ Platform-Specific Configuration and Operation Notes
Apple ships inadequate dynamic libreadline and libhistory "replacements"
as standard libraries.
20. If you're on a system like SGI Irix, and you get an error about not
being able to refer to a dynamic symbol
(ld: non-dynamic relocations refer to dynamic symbol PC), add
-DNEED_EXTERN_PC to the LOCAL_CFLAGS variable in lib/readline/Makefile.in
and rebuild.

4
POSIX
View File

@ -164,6 +164,10 @@ The following list is what's changed when `POSIX mode' is in effect:
42. The `ulimit' builtin uses a block size of 512 bytes for the `-c'
and `-f' options.
43. The arrival of `SIGCHLD' when a trap is set on `SIGCHLD' does not
interrupt the `wait' builtin and cause it to return immediately.
The trap command is run once for each child that exits.
There is other POSIX behavior that Bash does not implement by default
even when in POSIX mode. Specifically:

11
README
View File

@ -1,7 +1,7 @@
Introduction
============
This is GNU Bash, version 4.0. Bash is the GNU Project's Bourne
This is GNU Bash, version 4.1. 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
@ -15,8 +15,8 @@ See the file POSIX for a discussion of how the Bash defaults differ
from the POSIX.2 spec and a description of the Bash `posix mode'.
There are some user-visible incompatibilities between this version
of Bash and previous widely-distributed versions, bash-2.05b and
bash-3.2. For details, see the file COMPAT. The NEWS file tersely
of Bash and previous widely-distributed versions, bash-3.2 and
bash-4.0. For details, see the file COMPAT. The NEWS file tersely
lists features that are new in this release.
Bash is free software, distributed under the terms of the [GNU] General
@ -89,3 +89,8 @@ Enjoy!
Chet Ramey
chet.ramey@case.edu
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. This file is offered as-is,
without any warranty.

97
aclocal.m4 vendored
View File

@ -80,6 +80,9 @@ AC_CACHE_VAL(bash_cv_type_$1,
#if HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#if HAVE_STDINT_H
#include <stdint.h>
#endif
$2
], bash_cv_type_$1=yes, bash_cv_type_$1=no)])
AC_MSG_RESULT($bash_cv_type_$1)
@ -1690,9 +1693,12 @@ AC_CHECK_HEADERS(wchar.h)
AC_CHECK_HEADERS(langinfo.h)
AC_CHECK_FUNC(mbrlen, AC_DEFINE(HAVE_MBRLEN))
AC_CHECK_FUNC(mbscasecmp, AC_DEFINE(HAVE_MBSCMP))
AC_CHECK_FUNC(mbscmp, AC_DEFINE(HAVE_MBSCMP))
AC_CHECK_FUNC(mbsrtowcs, AC_DEFINE(HAVE_MBSRTOWCS))
AC_REPLACE_FUNCS(mbschr)
AC_CHECK_FUNC(wcrtomb, AC_DEFINE(HAVE_WCRTOMB))
AC_CHECK_FUNC(wcscoll, AC_DEFINE(HAVE_WCSCOLL))
AC_CHECK_FUNC(wcsdup, AC_DEFINE(HAVE_WCSDUP))
@ -1753,6 +1759,13 @@ if test $bash_cv_type_wint_t = yes; then
AC_DEFINE(HAVE_WINT_T, 1, [systems should define this type here])
fi
if test "$am_cv_func_iconv" = yes; then
OLDLIBS="$LIBS"
LIBS="$LIBS $LIBICONV"
AC_CHECK_FUNCS(locale_charset)
LIBS="$OLDLIBS"
fi
])
dnl need: prefix exec_prefix libdir includedir CC TERMCAP_LIB
@ -4018,3 +4031,87 @@ AC_DEFUN([BASH_FUNC_FPURGE],
AC_CHECK_FUNCS_ONCE([__fpurge])
AC_CHECK_DECLS([fpurge], , , [#include <stdio.h>])
])
AC_DEFUN([BASH_FUNC_SNPRINTF],
[
AC_CHECK_FUNCS_ONCE([snprintf])
if test X$ac_cv_func_snprintf = Xyes; then
AC_CACHE_CHECK([for standard-conformant snprintf], [bash_cv_func_snprintf],
[AC_TRY_RUN([
#include <stdio.h>
main()
{
int n;
n = snprintf (0, 0, "%s", "0123456");
exit(n != 7);
}
], bash_cv_func_snprintf=yes, bash_cv_func_snprintf=no,
[AC_MSG_WARN([cannot check standard snprintf if cross-compiling])
bash_cv_func_snprintf=yes]
)])
if test $bash_cv_func_snprintf = no; then
ac_cv_func_snprintf=no
fi
fi
if test $ac_cv_func_snprintf = no; then
AC_DEFINE(HAVE_SNPRINTF, 0,
[Define if you have a standard-conformant snprintf function.])
fi
])
AC_DEFUN([BASH_FUNC_VSNPRINTF],
[
AC_CHECK_FUNCS_ONCE([vsnprintf])
if test X$ac_cv_func_vsnprintf = Xyes; then
AC_CACHE_CHECK([for standard-conformant vsnprintf], [bash_cv_func_vsnprintf],
[AC_TRY_RUN([
#if HAVE_STDARG_H
#include <stdarg.h>
#else
#include <varargs.h>
#endif
#include <stdio.h>
#include <stdlib.h>
static int
#if HAVE_STDARG_H
foo(const char *fmt, ...)
#else
foo(format, va_alist)
const char *format;
va_dcl
#endif
{
va_list args;
int n;
#if HAVE_STDARG_H
va_start(args, fmt);
#else
va_start(args);
#endif
n = vsnprintf(0, 0, fmt, args);
va_end (args);
return n;
}
main()
{
int n;
n = foo("%s", "0123456");
exit(n != 7);
}
], bash_cv_func_vsnprintf=yes, bash_cv_func_vsnprintf=no,
[AC_MSG_WARN([cannot check standard vsnprintf if cross-compiling])
bash_cv_func_vsnprintf=yes]
)])
if test $bash_cv_func_vsnprintf = no; then
ac_cv_func_vsnprintf=no
fi
fi
if test $ac_cv_func_vsnprintf = no; then
AC_DEFINE(HAVE_VSNPRINTF, 0,
[Define if you have a standard-conformant vsnprintf function.])
fi
])

View File

@ -526,7 +526,7 @@ alias_expand (string)
/* If there is a backslash-escaped character quoted in TOKEN,
then we don't do alias expansion. This should check for all
other quoting characters, too. */
if (xstrchr (token, '\\'))
if (mbschr (token, '\\'))
expand_this_token = 0;
/* If we should be expanding here, if we are expanding all words, or if

53
array.c
View File

@ -55,6 +55,31 @@
static char *array_to_string_internal __P((ARRAY_ELEMENT *, ARRAY_ELEMENT *, char *, int));
static ARRAY *lastarray = 0;
static ARRAY_ELEMENT *lastref = 0;
#define IS_LASTREF(a) ((a) == lastarray)
#define INVALIDATE_LASTREF(a) \
do { \
if ((a) == lastarray) { \
lastarray = 0; \
lastref = 0; \
} \
} while (0)
#define SET_LASTREF(a, e) \
do { \
lastarray = (a); \
lastref = (e); \
} while (0)
#define UNSET_LASTREF() \
do { \
lastarray = 0; \
lastref = 0; \
} while (0)
ARRAY *
array_create()
{
@ -87,6 +112,7 @@ ARRAY *a;
a->head->next = a->head->prev = a->head;
a->max_index = -1;
a->num_elements = 0;
INVALIDATE_LASTREF(a);
}
void
@ -185,6 +211,7 @@ int n, flags;
if (a == 0 || array_empty(a) || n <= 0)
return ((ARRAY_ELEMENT *)NULL);
INVALIDATE_LASTREF(a);
for (i = 0, ret = ae = element_forw(a->head); ae != a->head && i < n; ae = element_forw(ae), i++)
;
if (ae == a->head) {
@ -214,7 +241,7 @@ int n, flags;
element_index(ae) -= n; /* renumber retained indices */
a->num_elements -= n; /* modify bookkeeping information */
a->max_index -= n;
a->max_index = element_index(a->head->prev);
if (flags & AS_DISPOSE) {
for (ae = ret; ae; ) {
@ -251,9 +278,11 @@ char *s;
new = array_create_element(0, s);
ADD_BEFORE(ae, new);
a->num_elements++;
if (array_num_elements(a) == 1) /* array was empty */
if (array_num_elements(a) == 1) { /* array was empty */
a->max_index = 0;
return 1;
}
}
/*
* Renumber all elements in the array except the one we just added.
@ -263,6 +292,7 @@ char *s;
a->max_index = element_index(a->head->prev);
INVALIDATE_LASTREF(a);
return (a->num_elements);
}
@ -594,6 +624,7 @@ char *v;
ADD_BEFORE(a->head, new);
a->max_index = i;
a->num_elements++;
SET_LASTREF(a, new);
return(0);
}
/*
@ -607,13 +638,16 @@ char *v;
array_dispose_element(new);
free(element_value(ae));
ae->value = v ? savestring(v) : (char *)NULL;
SET_LASTREF(a, ae);
return(0);
} else if (element_index(ae) > i) {
ADD_BEFORE(ae, new);
a->num_elements++;
SET_LASTREF(a, new);
return(0);
}
}
INVALIDATE_LASTREF(a);
return (-1); /* problem */
}
@ -637,6 +671,7 @@ arrayind_t i;
a->num_elements--;
if (i == array_max_index(a))
a->max_index = element_index(ae->prev);
INVALIDATE_LASTREF(a);
return(ae);
}
return((ARRAY_ELEMENT *) NULL);
@ -654,9 +689,19 @@ arrayind_t i;
if (a == 0 || array_empty(a))
return((char *) NULL);
for (ae = element_forw(a->head); ae != a->head; ae = element_forw(ae))
if (element_index(ae) == i)
if (i > array_max_index(a))
return((char *)NULL);
/* Keep roving pointer into array to optimize sequential access */
if (lastref && IS_LASTREF(a))
ae = (i >= element_index(lastref)) ? lastref : element_forw(a->head);
else
ae = element_forw(a->head);
for ( ; ae != a->head; ae = element_forw(ae))
if (element_index(ae) == i) {
SET_LASTREF(a, ae);
return(element_value(ae));
}
UNSET_LASTREF();
return((char *) NULL);
}

View File

@ -31,7 +31,8 @@ enum atype {array_indexed, array_assoc};
typedef struct array {
enum atype type;
arrayind_t max_index, num_elements;
arrayind_t max_index;
int num_elements;
struct array_element *head;
} ARRAY;

View File

@ -407,6 +407,7 @@ expand_compound_array_assignment (var, value, flags)
return nlist;
}
/* Callers ensure that VAR is not NULL */
void
assign_compound_array_list (var, nlist, flags)
SHELL_VAR *var;
@ -431,9 +432,9 @@ assign_compound_array_list (var, nlist, flags)
value. */
if ((flags & ASS_APPEND) == 0)
{
if (array_p (var) && a)
if (a && array_p (var))
array_flush (a);
else if (assoc_p (var) && h)
else if (h && assoc_p (var))
assoc_flush (h);
}
@ -447,7 +448,7 @@ assign_compound_array_list (var, nlist, flags)
/* We have a word of the form [ind]=value */
if ((list->word->flags & W_ASSIGNMENT) && w[0] == '[')
{
len = skipsubscript (w, 0);
len = skipsubscript (w, 0, (var && assoc_p (var) != 0));
/* XXX - changes for `+=' */
if (w[len] != ']' || (w[len+1] != '=' && (w[len+1] != '+' || w[len+2] != '=')))
@ -560,8 +561,9 @@ quote_assign (string)
{
size_t slen;
int saw_eq;
char *temp, *t;
char *temp, *t, *subs;
const char *s, *send;
int ss, se;
DECLARE_MBSTATE;
slen = strlen (string);
@ -573,6 +575,20 @@ quote_assign (string)
{
if (*s == '=')
saw_eq = 1;
if (saw_eq == 0 && *s == '[') /* looks like a subscript */
{
ss = s - string;
se = skipsubscript (string, ss, 0);
subs = substring (s, ss, se);
*t++ = '\\';
strcpy (t, subs);
t += se - ss;
*t++ = '\\';
*t++ = ']';
s += se + 1;
free (subs);
continue;
}
if (saw_eq == 0 && (glob_char_p (s) || isifs (*s)))
*t++ = '\\';
@ -596,7 +612,7 @@ quote_array_assignment_chars (list)
if (l->word == 0 || l->word->word == 0 || l->word->word[0] == '\0')
continue; /* should not happen, but just in case... */
/* Don't bother if it doesn't look like [ind]=value */
if (l->word->word[0] != '[' || xstrchr (l->word->word, '=') == 0) /* ] */
if (l->word->word[0] != '[' || mbschr (l->word->word, '=') == 0) /* ] */
continue;
nword = quote_assign (l->word->word);
free (l->word->word);
@ -619,7 +635,7 @@ unbind_array_element (var, sub)
char *akey;
ARRAY_ELEMENT *ae;
len = skipsubscript (sub, 0);
len = skipsubscript (sub, 0, 0);
if (sub[len] != ']' || len == 0)
{
builtin_error ("%s[%s: %s", var->name, sub, _(bash_badsub_errmsg));
@ -713,7 +729,7 @@ valid_array_reference (name)
char *t;
int r, len;
t = xstrchr (name, '['); /* ] */
t = mbschr (name, '['); /* ] */
if (t)
{
*t = '\0';
@ -722,7 +738,7 @@ valid_array_reference (name)
if (r == 0)
return 0;
/* Check for a properly-terminated non-blank subscript. */
len = skipsubscript (t, 0);
len = skipsubscript (t, 0, 0);
if (t[len] != ']' || len == 1)
return 0;
for (r = 1; r < len; r++)
@ -773,7 +789,7 @@ array_variable_name (s, subp, lenp)
char *t, *ret;
int ind, ni;
t = xstrchr (s, '[');
t = mbschr (s, '[');
if (t == 0)
{
if (subp)
@ -783,7 +799,7 @@ array_variable_name (s, subp, lenp)
return ((char *)NULL);
}
ind = t - s;
ni = skipsubscript (s, ind);
ni = skipsubscript (s, ind, 0);
if (ni <= ind + 1 || s[ni] != ']')
{
err_badarraysub (s);

View File

@ -32,6 +32,8 @@ extern SHELL_VAR *bind_array_variable __P((char *, arrayind_t, char *, int));
extern SHELL_VAR *bind_array_element __P((SHELL_VAR *, arrayind_t, char *, int));
extern SHELL_VAR *assign_array_element __P((char *, char *, int));
extern SHELL_VAR *bind_assoc_variable __P((SHELL_VAR *, char *, char *, char *, int));
extern SHELL_VAR *find_or_make_array_variable __P((char *, int));
extern SHELL_VAR *assign_array_from_string __P((char *, char *, int));
@ -42,7 +44,7 @@ extern void assign_compound_array_list __P((SHELL_VAR *, WORD_LIST *, int));
extern SHELL_VAR *assign_array_var_from_string __P((SHELL_VAR *, char *, int));
extern int unbind_array_element __P((SHELL_VAR *, char *));
extern int skipsubscript __P((const char *, int));
extern int skipsubscript __P((const char *, int, int));
extern void print_array_assignment __P((SHELL_VAR *, int));
extern void print_assoc_assignment __P((SHELL_VAR *, int));

11
assoc.c
View File

@ -405,7 +405,14 @@ assoc_to_assign (hash, quoted)
for (i = 0; i < hash->nbuckets; i++)
for (tlist = hash_items (i, hash); tlist; tlist = tlist->next)
{
#if 1
if (sh_contains_shell_metas (tlist->key))
istr = sh_double_quote (tlist->key);
else
istr = tlist->key;
#else
istr = tlist->key;
#endif
vstr = tlist->data ? sh_double_quote ((char *)tlist->data) : (char *)0;
elen = STRLEN (istr) + 8 + STRLEN (vstr);
@ -423,6 +430,10 @@ assoc_to_assign (hash, quoted)
}
ret[rlen++] = ' ';
if (istr != tlist->key)
FREE (istr);
FREE (vstr);
}

View File

@ -38,6 +38,10 @@
#include "bashintl.h"
#if defined (SYSLOG_HISTORY)
# include <syslog.h>
#endif
#include "shell.h"
#include "flags.h"
#include "input.h"
@ -691,6 +695,26 @@ check_add_history (line, force)
return 0;
}
#if defined (SYSLOG_HISTORY)
#define SYSLOG_MAXLEN 600
void
bash_syslog_history (line)
const char *line;
{
char trunc[SYSLOG_MAXLEN];
if (strlen(line) < SYSLOG_MAXLEN)
syslog (SYSLOG_FACILITY|SYSLOG_LEVEL, "HISTORY: PID=%d UID=%d %s", getpid(), current_user.uid, line);
else
{
strncpy (trunc, line, SYSLOG_MAXLEN);
trunc[SYSLOG_MAXLEN - 1] = '\0';
syslog (SYSLOG_FACILITY|SYSLOG_LEVEL, "HISTORY (TRUNCATED): PID=%d UID=%d %s", getpid(), current_user.uid, trunc);
}
}
#endif
/* Add a line to the history list.
The variable COMMAND_ORIENTED_HISTORY controls the style of history
remembering; when non-zero, and LINE is not the first line of a
@ -746,6 +770,10 @@ bash_add_history (line)
if (add_it)
really_add_history (line);
#if defined (SYSLOG_HISTORY)
bash_syslog_history (line);
#endif
using_history ();
}

View File

@ -82,6 +82,9 @@
extern int bash_brace_completion __P((int, int));
#endif /* BRACE_COMPLETION */
/* To avoid including curses.h/term.h/termcap.h and that whole mess. */
extern int tputs __P((const char *string, int nlines, int (*outx)(int)));
/* Forward declarations */
/* Functions bound to keys in Readline for Bash users. */
@ -112,6 +115,7 @@ static int bash_backward_kill_shellword __P((int, int));
/* Helper functions for Readline. */
static char *restore_tilde __P((char *, char *));
static char *bash_filename_rewrite_hook __P((char *, int));
static void bash_directory_expansion __P((char **));
static int bash_directory_completion_hook __P((char **));
static int filename_completion_ignore __P((char **));
@ -146,6 +150,7 @@ static char *bash_dequote_filename __P((char *, int));
static char *quote_word_break_chars __P((char *));
static char *bash_quote_filename __P((char *, int, char *));
static int putx __P((int));
static int bash_execute_unix_command __P((int, int));
static void init_unix_command_map __P((void));
static int isolate_sequence __P((char *, int, int, int *));
@ -245,6 +250,9 @@ static rl_hook_func_t *old_rl_startup_hook = (rl_hook_func_t *)NULL;
static int dot_in_path = 0;
/* Set to non-zero when dabbrev-expand is running */
static int dabbrev_expand_active = 0;
/* What kind of quoting is performed by bash_quote_filename:
COMPLETE_DQUOTE = double-quoting the filename
COMPLETE_SQUOTE = single_quoting the filename
@ -494,6 +502,8 @@ initialize_readline ()
do other expansion on directory names. */
rl_directory_completion_hook = bash_directory_completion_hook;
rl_filename_rewrite_hook = bash_filename_rewrite_hook;
/* Tell the filename completer we want a chance to ignore some names. */
rl_ignore_some_completions_function = filename_completion_ignore;
@ -748,7 +758,7 @@ clear_hostname_list ()
return;
for (i = 0; i < hostname_list_length; i++)
free (hostname_list[i]);
hostname_list_length = 0;
hostname_list_length = hostname_list_initialized = 0;
}
/* Return a NULL terminated list of hostnames which begin with TEXT.
@ -1187,7 +1197,7 @@ find_cmd_start (start)
register int s, os;
os = 0;
while (((s = skip_to_delim (rl_line_buffer, os, COMMAND_SEPARATORS, SD_NOJMP)) <= start) &&
while (((s = skip_to_delim (rl_line_buffer, os, COMMAND_SEPARATORS, SD_NOJMP|SD_NOSKIPCMD)) <= start) &&
rl_line_buffer[s])
os = s+1;
return os;
@ -1305,8 +1315,9 @@ attempt_shell_completion (text, start, end)
/* Special handling for command substitution. If *TEXT is a backquote,
it can be the start or end of an old-style command substitution, or
unmatched. If it's unmatched, both calls to unclosed_pair will
succeed. */
if (*text == '`' &&
succeed. Don't bother if readline found a single quote and we are
completing on the substring. */
if (*text == '`' && rl_completion_quote_character != '\'' &&
(in_command_position || (unclosed_pair (rl_line_buffer, start, "`") &&
unclosed_pair (rl_line_buffer, end, "`"))))
matches = rl_completion_matches (text, command_subst_completion_function);
@ -1386,7 +1397,7 @@ bash_default_completion (text, start, end, qc, compflags)
/* If the word starts in `~', and there is no slash in the word, then
try completing this word as a username. */
if (!matches && *text == '~' && !xstrchr (text, '/'))
if (matches ==0 && *text == '~' && mbschr (text, '/') == 0)
matches = rl_completion_matches (text, rl_username_completion_function);
/* Another one. Why not? If the word starts in '@', then look through
@ -2652,6 +2663,20 @@ bash_directory_expansion (dirname)
}
}
/* If necessary, rewrite directory entry */
static char *
bash_filename_rewrite_hook (fname, fnlen)
char *fname;
int fnlen;
{
char *conv;
conv = fnx_fromfs (fname, fnlen);
if (conv != fname)
conv = savestring (conv);
return conv;
}
/* Handle symbolic link references and other directory name
expansions while hacking completion. */
static int
@ -2666,11 +2691,11 @@ bash_directory_completion_hook (dirname)
return_value = should_expand_dirname = 0;
local_dirname = *dirname;
if (xstrchr (local_dirname, '$'))
if (mbschr (local_dirname, '$'))
should_expand_dirname = 1;
else
{
t = xstrchr (local_dirname, '`');
t = mbschr (local_dirname, '`');
if (t && unclosed_pair (local_dirname, strlen (local_dirname), "`") == 0)
should_expand_dirname = 1;
}
@ -2787,6 +2812,8 @@ build_history_completion_array ()
if (hlist)
{
for (i = 0; hlist[i]; i++)
;
for ( --i; i >= 0; i--)
{
/* Separate each token, and place into an array. */
tokens = history_tokenize (hlist[i]->line);
@ -2803,6 +2830,7 @@ build_history_completion_array ()
}
/* Sort the complete list of tokens. */
if (dabbrev_expand_active == 0)
qsort (history_completion_array, harry_len, sizeof (char *), (QSFUNC *)strvec_strcmp);
}
}
@ -2819,6 +2847,8 @@ history_completion_generator (hint_text, state)
list of strings to complete over. */
if (state == 0)
{
if (dabbrev_expand_active) /* This is kind of messy */
rl_completion_suppress_append = 1;
local_index = 0;
build_history_completion_array ();
text = hint_text;
@ -2862,25 +2892,33 @@ static int
bash_dabbrev_expand (count, key)
int count, key;
{
int r;
int r, orig_suppress, orig_sort;
rl_compentry_func_t *orig_func;
rl_completion_func_t *orig_attempt_func;
orig_func = rl_menu_completion_entry_function;
orig_attempt_func = rl_attempted_completion_function;
orig_suppress = rl_completion_suppress_append;
orig_sort = rl_sort_completion_matches;
rl_menu_completion_entry_function = history_completion_generator;
rl_attempted_completion_function = (rl_completion_func_t *)NULL;
rl_filename_completion_desired = 0;
rl_completion_suppress_append = 1;
rl_sort_completion_matches = 0;
/* XXX - use rl_completion_mode here? */
dabbrev_expand_active = 1;
if (rl_last_func == bash_dabbrev_expand)
rl_last_func = rl_menu_complete;
r = rl_menu_complete (count, key);
dabbrev_expand_active = 0;
rl_last_func = bash_dabbrev_expand;
rl_menu_completion_entry_function = orig_func;
rl_attempted_completion_function = orig_attempt_func;
rl_completion_suppress_append = orig_suppress;
rl_sort_completion_matches = orig_sort;
return r;
}
@ -3225,7 +3263,7 @@ bash_dequote_filename (text, quote_char)
*r++ = *++p;
if (*p == '\0')
break;
return ret; /* XXX - was break; */
continue;
}
/* Close quote. */
@ -3271,7 +3309,7 @@ quote_word_break_chars (text)
}
/* OK, we have an unquoted character. Check its presence in
rl_completer_word_break_characters. */
if (xstrchr (rl_completer_word_break_characters, *s))
if (mbschr (rl_completer_word_break_characters, *s))
*r++ = '\\';
/* XXX -- check for standalone tildes here and backslash-quote them */
if (s == text && *s == '~' && file_exists (text))
@ -3313,7 +3351,7 @@ bash_quote_filename (s, rtype, qcp)
the word being completed contains newlines, since those are not
quoted correctly using backslashes (a backslash-newline pair is
special to the shell parser). */
if (*qcp == '\0' && cs == COMPLETE_BSQUOTE && xstrchr (s, '\n'))
if (*qcp == '\0' && cs == COMPLETE_BSQUOTE && mbschr (s, '\n'))
cs = COMPLETE_SQUOTE;
else if (*qcp == '"')
cs = COMPLETE_DQUOTE;
@ -3321,11 +3359,11 @@ bash_quote_filename (s, rtype, qcp)
cs = COMPLETE_SQUOTE;
#if defined (BANG_HISTORY)
else if (*qcp == '\0' && history_expansion && cs == COMPLETE_DQUOTE &&
history_expansion_inhibited == 0 && xstrchr (s, '!'))
history_expansion_inhibited == 0 && mbschr (s, '!'))
cs = COMPLETE_BSQUOTE;
if (*qcp == '"' && history_expansion && cs == COMPLETE_DQUOTE &&
history_expansion_inhibited == 0 && xstrchr (s, '!'))
history_expansion_inhibited == 0 && mbschr (s, '!'))
{
cs = COMPLETE_BSQUOTE;
*qcp = '\0';
@ -3379,6 +3417,13 @@ bash_quote_filename (s, rtype, qcp)
/* Support for binding readline key sequences to Unix commands. */
static Keymap cmd_xmap;
static int
putx(c)
int c;
{
putc (c, rl_outstream);
}
static int
bash_execute_unix_command (count, key)
int count; /* ignored */
@ -3386,10 +3431,10 @@ bash_execute_unix_command (count, key)
{
Keymap ckmap; /* current keymap */
Keymap xkmap; /* unix command executing keymap */
register int i;
register int i, r;
intmax_t mi;
sh_parser_state_t ps;
char *cmd, *value, *l;
char *cmd, *value, *l, *l1, *ce;
SHELL_VAR *v;
char ibuf[INT_STRLEN_BOUND(int) + 1];
@ -3425,12 +3470,20 @@ bash_execute_unix_command (count, key)
return 1;
}
ce = rl_get_termcap ("ce");
if (ce) /* clear current line */
{
fprintf (rl_outstream, "\r");
tputs (ce, 1, putx);
fflush (rl_outstream);
}
else
rl_crlf (); /* move to a new line */
v = bind_variable ("READLINE_LINE", rl_line_buffer, 0);
if (v)
VSETATTR (v, att_exported);
l = value_cell (v);
l = v ? value_cell (v) : 0;
value = inttostr (rl_point, ibuf, sizeof (ibuf));
v = bind_int_variable ("READLINE_POINT", value);
if (v)
@ -3438,11 +3491,12 @@ bash_execute_unix_command (count, key)
array_needs_making = 1;
save_parser_state (&ps);
parse_and_execute (cmd, "bash_execute_unix_command", SEVAL_NOHIST|SEVAL_NOFREE);
r = parse_and_execute (cmd, "bash_execute_unix_command", SEVAL_NOHIST|SEVAL_NOFREE);
restore_parser_state (&ps);
v = find_variable ("READLINE_LINE");
if (value_cell (v) != l)
l1 = v ? value_cell (v) : 0;
if (l1 != l)
maybe_make_readline_line (value_cell (v));
v = find_variable ("READLINE_POINT");
if (v && legal_number (value_cell (v), &mi))

View File

@ -35,4 +35,8 @@
# include <inttypes.h>
#endif
#if HAVE_STDINT_H
# include <stdint.h>
#endif
#endif /* _BASHTYPES_H_ */

View File

@ -364,7 +364,7 @@ expand_seqterm (text, tlen)
char *t, *lhs, *rhs;
int i, lhs_t, rhs_t, lhs_v, rhs_v, incr, lhs_l, rhs_l, width;
intmax_t tl, tr;
char **result, *ep;
char **result, *ep, *oep;
t = strstr (text, BRACE_SEQ_SPECIFIER);
if (t == 0)
@ -410,10 +410,12 @@ expand_seqterm (text, tlen)
incr = 1;
if (rhs_t != ST_BAD)
{
oep = ep;
if (ep && *ep == '.' && ep[1] == '.' && ep[2])
incr = strtoimax (ep + 2, &ep, 10);
if (*ep != 0)
rhs_t = ST_BAD; /* invalid incr */
tlen -= ep - oep;
}
if (lhs_t != rhs_t || lhs_t == ST_BAD || rhs_t == ST_BAD)
@ -449,6 +451,11 @@ expand_seqterm (text, tlen)
width = rhs_l, lhs_t = ST_ZINT;
if (rhs_l > 2 && rhs[0] == '-' && rhs[1] == '0' && width < rhs_l)
width = rhs_l, lhs_t = ST_ZINT;
if (width < lhs_l && lhs_t == ST_ZINT)
width = lhs_l;
if (width < rhs_l && lhs_t == ST_ZINT)
width = rhs_l;
}
result = mkseq (lhs_v, rhs_v, incr, lhs_t, width);

View File

@ -333,7 +333,7 @@ evalstring.o: $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h $(topdir)/subst.h
evalstring.o: $(topdir)/externs.h $(topdir)/jobs.h $(topdir)/builtins.h
evalstring.o: $(topdir)/flags.h $(topdir)/input.h $(topdir)/execute_cmd.h
evalstring.o: $(topdir)/bashhist.h $(srcdir)/common.h
evalstring.o: $(topdir)/trap.h $(topdir)/redir.h
evalstring.o: $(topdir)/trap.h $(topdir)/redir.h ../pathnames.h
getopt.o: ../config.h $(BASHINCDIR)/memalloc.h
getopt.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/bashjmp.h $(topdir)/command.h
getopt.o: $(topdir)/general.h $(topdir)/xmalloc.h $(topdir)/error.h $(topdir)/variables.h $(topdir)/conftypes.h
@ -351,63 +351,67 @@ alias.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h $(BASHINCDIR)
alias.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
alias.o: $(topdir)/subst.h $(topdir)/externs.h $(srcdir)/common.h
alias.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
alias.o: ../pathnames.h
bind.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h $(topdir)/error.h
bind.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
bind.o: $(topdir)/subst.h $(topdir)/externs.h $(srcdir)/bashgetopt.h
bind.o: $(topdir)/general.h $(topdir)/xmalloc.h $(BASHINCDIR)/maxpath.h $(topdir)/bashline.h
bind.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
bind.o: ../pathnames.h
break.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
break.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
break.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
break.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
break.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
break.o: ../pathnames.h
builtin.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
builtin.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h $(topdir)/externs.h
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
builtin.o: $(srcdir)/bashgetopt.h ../pathnames.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
caller.o: ${BASHINCDIR}/chartypes.h $(topdir)/bashtypes.h ../pathnames.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
cd.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
cd.o: $(srcdir)/common.h $(BASHINCDIR)/maxpath.h
cd.o: $(srcdir)/common.h $(BASHINCDIR)/maxpath.h ../pathnames.h
command.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
command.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h $(topdir)/externs.h
command.o: $(topdir)/quit.h $(srcdir)/bashgetopt.h $(BASHINCDIR)/maxpath.h
command.o: $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h $(topdir)/subst.h
command.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
command.o: ../pathnames.h
declare.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
declare.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
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
declare.o: ./builtext.h ../pathnames.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
echo.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
echo.o: $(BASHINCDIR)/maxpath.h
echo.o: $(BASHINCDIR)/maxpath.h ../pathnames.h
enable.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
enable.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
enable.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
enable.o: $(topdir)/subst.h $(topdir)/externs.h
enable.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
enable.o: $(BASHINCDIR)/maxpath.h
enable.o: $(BASHINCDIR)/maxpath.h ../pathnames.h
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)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
eval.o: $(BASHINCDIR)/maxpath.h
eval.o: $(BASHINCDIR)/maxpath.h ../pathnames.h
exec.o: $(topdir)/bashtypes.h
exec.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
exec.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
@ -415,14 +419,14 @@ exec.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
exec.o: $(topdir)/subst.h $(topdir)/externs.h $(topdir)/flags.h
exec.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
exec.o: $(srcdir)/common.h $(topdir)/execute_cmd.h $(BASHINCDIR)/maxpath.h
exec.o: $(topdir)/findcmd.h $(topdir)/jobs.h
exec.o: $(topdir)/findcmd.h $(topdir)/jobs.h ../pathnames.h
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 $(topdir)/jobs.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
exit.o: $(BASHINCDIR)/maxpath.h ./builtext.h ../pathnames.h
fc.o: $(topdir)/bashtypes.h $(BASHINCDIR)/posixstat.h
fc.o: $(topdir)/builtins.h $(topdir)/command.h $(srcdir)/bashgetopt.h
fc.o: $(topdir)/bashhist.h
@ -432,30 +436,32 @@ fc.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
fc.o: $(topdir)/subst.h $(topdir)/externs.h $(topdir)/shell.h $(topdir)/syntax.h
fc.o: $(topdir)/flags.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
fc.o: $(topdir)/bashansi.h $(BASHINCDIR)/ansi_stdlib.h $(BASHINCDIR)/chartypes.h
fc.o: ../pathnames.h
fg_bg.o: $(topdir)/bashtypes.h $(srcdir)/bashgetopt.h
fg_bg.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
fg_bg.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
fg_bg.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
fg_bg.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
fg_bg.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
fg_bg.o: $(topdir)/jobs.h
fg_bg.o: $(topdir)/jobs.h ../pathnames.h
getopts.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
getopts.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
getopts.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
getopts.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
getopts.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
getopts.o: ../pathnames.h
hash.o: $(topdir)/builtins.h $(topdir)/command.h $(topdir)/quit.h
hash.o: $(topdir)/findcmd.h $(topdir)/hashlib.h
hash.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
hash.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
hash.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
hash.o: $(srcdir)/common.h $(BASHINCDIR)/maxpath.h
hash.o: $(srcdir)/common.h $(BASHINCDIR)/maxpath.h ../pathnames.h
help.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
help.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
help.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
help.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
help.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
help.o: ${srcdir}/common.h
help.o: ${srcdir}/common.h ../pathnames.h
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
@ -463,27 +469,30 @@ history.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.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
history.o: ../pathnames.h
inlib.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
inlib.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
inlib.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
inlib.o: $(BASHINCDIR)/maxpath.h $(topdir)/subst.h $(topdir)/externs.h
inlib.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
inlib.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h ../pathnames.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 $(topdir)/jobs.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
jobs.o: ../pathnames.h
kill.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h $(topdir)/error.h
kill.o: $(topdir)/general.h $(topdir)/xmalloc.h $(topdir)/subst.h $(topdir)/externs.h
kill.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
kill.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/trap.h $(topdir)/unwind_prot.h
kill.o: $(topdir)/variables.h $(topdir)/conftypes.h $(BASHINCDIR)/maxpath.h
kill.o: $(topdir)/jobs.h
kill.o: $(topdir)/jobs.h ../pathnames.h
let.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
let.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
let.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
let.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
let.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
let.o: ../pathnames.h
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
@ -491,104 +500,111 @@ printf.o: $(topdir)/subst.h $(topdir)/externs.h $(topdir)/sig.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
printf.o: ../pathnames.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)/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
pushd.o: ../pathnames.h
read.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
read.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
read.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
read.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
read.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
read.o: $(BASHINCDIR)/shtty.h
read.o: $(topdir)/arrayfunc.h
read.o: $(topdir)/arrayfunc.h ../pathnames.h
return.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
return.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
return.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
return.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
return.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
return.o: ../pathnames.h
set.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
set.o: $(topdir)/general.h $(topdir)/xmalloc.h $(topdir)/subst.h $(topdir)/externs.h
set.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
set.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
set.o: $(BASHINCDIR)/maxpath.h $(topdir)/error.h
set.o: $(topdir)/arrayfunc.h
set.o: $(topdir)/arrayfunc.h ../pathnames.h
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)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
setattr.o: $(topdir)/arrayfunc.h
setattr.o: $(topdir)/arrayfunc.h ../pathnames.h
shift.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
shift.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
shift.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
shift.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
shift.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
shift.o: ../pathnames.h
shopt.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
shopt.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
shopt.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
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 ../pathnames.h
shopt.o: $(topdir)/bashhist.h
source.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
source.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h $(topdir)/findcmd.h
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 $(topdir)/flags.h $(topdir)/trap.h
source.o: ../pathnames.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
suspend.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
suspend.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
suspend.o: $(topdir)/jobs.h
suspend.o: $(topdir)/jobs.h ../pathnames.h
test.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
test.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
test.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
test.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
test.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
test.o: $(topdir)/test.h
test.o: $(topdir)/test.h ../pathnames.h
times.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
times.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
times.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
times.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
times.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
times.o: $(BASHINCDIR)/posixtime.h
times.o: $(BASHINCDIR)/posixtime.h ../pathnames.h
trap.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
trap.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h $(topdir)/externs.h
trap.o: $(topdir)/quit.h $(srcdir)/common.h $(BASHINCDIR)/maxpath.h
trap.o: $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h $(topdir)/subst.h
trap.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
trap.o: $(topdir)/findcmd.h
trap.o: $(topdir)/findcmd.h ../pathnames.h
type.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
type.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
type.o: $(topdir)/quit.h $(srcdir)/common.h $(BASHINCDIR)/maxpath.h
type.o: $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h $(topdir)/subst.h
type.o: $(topdir)/externs.h $(topdir)/hashcmd.h
type.o: $(topdir)/externs.h $(topdir)/hashcmd.h ../pathnames.h
type.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
ulimit.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
ulimit.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
ulimit.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
ulimit.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
ulimit.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
ulimit.o: ../pathnames.h
umask.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
umask.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
umask.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
umask.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
umask.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
umask.o: $(BASHINCDIR)/chartypes.h
umask.o: $(BASHINCDIR)/chartypes.h ../pathnames.h
wait.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
wait.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
wait.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
wait.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
wait.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
wait.o: $(topdir)/jobs.h
wait.o: $(BASHINCDIR)/chartypes.h
shopt.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
shopt.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
shopt.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
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
wait.o: $(BASHINCDIR)/chartypes.h ../pathnames.h
complete.o: ../config.h
complete.o: ../config.h ../pathnames.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
@ -600,7 +616,7 @@ mapfile.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
mapfile.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
mapfile.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
mapfile.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/variables.h $(topdir)/conftypes.h
mapfile.o: $(topdir)/arrayfunc.h
mapfile.o: $(topdir)/arrayfunc.h ../pathnames.h
#bind.o: $(RL_LIBSRC)chardefs.h $(RL_LIBSRC)readline.h $(RL_LIBSRC)keymaps.h

View File

@ -255,7 +255,7 @@ bind_builtin (list)
if ((flags & RFLAG) && remove_seq)
{
if (rl_set_key (remove_seq, (rl_command_func_t *)NULL, rl_get_keymap ()) != 0)
if (rl_bind_keyseq (remove_seq, (rl_command_func_t *)NULL) != 0)
{
builtin_error (_("`%s': cannot unbind"), remove_seq);
BIND_RETURN (EXECUTION_FAILURE);

View File

@ -100,6 +100,31 @@ command_builtin (list)
if (list == 0)
return (EXECUTION_SUCCESS);
#if defined (RESTRICTED_SHELL)
if (use_standard_path && restricted)
{
sh_restricted ("-p");
return (EXECUTION_FAILURE);
}
#endif
begin_unwind_frame ("command_builtin");
if (use_standard_path)
{
old_path = get_string_value ("PATH");
/* If old_path is NULL, $PATH is unset. If so, we want to make sure
it's unset after this command completes. */
if (old_path)
old_path = savestring (old_path);
add_unwind_protect ((Function *)restore_path, old_path);
standard_path = get_standard_path ();
bind_variable ("PATH", standard_path ? standard_path : "", 0);
stupidly_hack_special_variables ("PATH");
FREE (standard_path);
}
if (verbose)
{
int found, any_found;
@ -113,37 +138,15 @@ command_builtin (list)
any_found += found;
}
run_unwind_frame ("command_builtin");
return (any_found ? EXECUTION_SUCCESS : EXECUTION_FAILURE);
}
#if defined (RESTRICTED_SHELL)
if (use_standard_path && restricted)
{
sh_restricted ("-p");
return (EXECUTION_FAILURE);
}
#endif
begin_unwind_frame ("command_builtin");
/* We don't want this to be reparsed (consider command echo 'foo &'), so
just make a simple_command structure and call execute_command with it. */
if (use_standard_path)
{
old_path = get_string_value ("PATH");
/* If old_path is NULL, $PATH is unset. If so, we want to make sure
it's unset after this command completes. */
if (old_path)
old_path = savestring (old_path);
add_unwind_protect ((Function *)restore_path, old_path);
standard_path = get_standard_path ();
bind_variable ("PATH", standard_path ? standard_path : "", 0);
FREE (standard_path);
}
#define COMMAND_BUILTIN_FLAGS (CMD_NO_FUNCTIONS | CMD_INHIBIT_EXPANSION | CMD_COMMAND_BUILTIN)
/* We don't want this to be reparsed (consider command echo 'foo &'), so
just make a simple_command structure and call execute_command with it. */
command = make_bare_simple_command ();
command->value.Simple->words = (WORD_LIST *)copy_word_list (list);
command->value.Simple->redirects = (REDIRECT *)NULL;
@ -182,6 +185,8 @@ restore_path (var)
}
else
unbind_variable ("PATH");
stupidly_hack_special_variables ("PATH");
}
/* Return a value for PATH that is guaranteed to find all of the standard

View File

@ -612,7 +612,7 @@ get_job_by_name (name, flags)
match = STREQN (p->command, name, cl);
}
else if (flags & JM_SUBSTRING)
match = strindex (p->command, name) != (char *)0;
match = strcasestr (p->command, name) != (char *)0;
else
match = STREQN (p->command, name, wl);

View File

@ -139,7 +139,11 @@ extern char **get_shopt_options __P((void));
extern int shopt_setopt __P((char *, int));
extern int shopt_listopt __P((char *, int));
extern int set_login_shell __P((int));
extern int set_login_shell __P((char *, int));
extern void set_bashopts __P((void));
extern void parse_bashopts __P((char *));
extern void initialize_bashopts __P((int));
/* Functions from type.def */
extern int describe_command __P((char *, int));

View File

@ -23,7 +23,7 @@ $PRODUCES complete.c
$BUILTIN complete
$DEPENDS_ON PROGRAMMABLE_COMPLETION
$FUNCTION complete_builtin
$SHORT_DOC complete [-abcdefgjksuv] [-pr] [-o option] [-A action] [-G globpat] [-W wordlist] [-F function] [-C command] [-X filterpat] [-P prefix] [-S suffix] [name ...]
$SHORT_DOC complete [-abcdefgjksuv] [-pr] [-DE] [-o option] [-A action] [-G globpat] [-W wordlist] [-F function] [-C command] [-X filterpat] [-P prefix] [-S suffix] [name ...]
Specify how arguments are to be completed by Readline.
For each NAME, specify how arguments are to be completed. If no options
@ -34,9 +34,14 @@ Options:
-p print existing completion specifications in a reusable format
-r remove a completion specification for each NAME, or, if no
NAMEs are supplied, all completion specifications
-D apply the completions and actions as the default for commands
without any specific completion defined
-E apply the completions and actions to "empty" commands --
completion attempted on a blank line
When completion is attempted, the actions are applied in the order the
uppercase-letter options are listed above.
uppercase-letter options are listed above. The -D option takes
precedence over -E.
Exit Status:
Returns success unless an invalid option is supplied or an error occurs.
@ -72,6 +77,7 @@ $END
struct _optflags {
int pflag;
int rflag;
int Dflag;
int Eflag;
};
@ -187,7 +193,7 @@ build_actions (list, flagp, actp, optp)
opt_given = 0;
reset_internal_getopt ();
while ((opt = internal_getopt (list, "abcdefgjko:prsuvA:G:W:P:S:X:F:C:E")) != -1)
while ((opt = internal_getopt (list, "abcdefgjko:prsuvA:G:W:P:S:X:F:C:DE")) != -1)
{
opt_given = 1;
switch (opt)
@ -275,6 +281,18 @@ build_actions (list, flagp, actp, optp)
case 'C':
Carg = list_optarg;
break;
case 'D':
if (flagp)
{
flagp->Dflag = 1;
break;
}
else
{
sh_invalidopt ("-D");
builtin_usage ();
return (EX_USAGE);
}
case 'E':
if (flagp)
{
@ -334,7 +352,7 @@ complete_builtin (list)
return (EXECUTION_SUCCESS);
}
opt_given = oflags.pflag = oflags.rflag = oflags.Eflag = 0;
opt_given = oflags.pflag = oflags.rflag = oflags.Dflag = oflags.Eflag = 0;
acts = copts = (unsigned long)0L;
Garg = Warg = Parg = Sarg = Xarg = Farg = Carg = (char *)NULL;
@ -349,7 +367,8 @@ complete_builtin (list)
list = loptend;
wl = oflags.Eflag ? make_word_list (make_bare_word ("_EmptycmD_"), (WORD_LIST *)NULL) : 0;
wl = oflags.Dflag ? make_word_list (make_bare_word (DEFAULTCMD), (WORD_LIST *)NULL)
: (oflags.Eflag ? make_word_list (make_bare_word (EMPTYCMD), (WORD_LIST *)NULL) : 0);
/* -p overrides everything else */
if (oflags.pflag || (list == 0 && opt_given == 0))
@ -540,6 +559,11 @@ print_one_completion (cmd, cs)
/* simple arguments that don't require quoting */
PRINTARG (cs->funcname, "-F");
if (STREQ (cmd, EMPTYCMD))
printf ("-E\n");
else if (STREQ (cmd, DEFAULTCMD))
printf ("-D\n");
else
printf ("%s\n", cmd);
return (0);
@ -575,6 +599,11 @@ print_compopts (cmd, cs, full)
PRINTCOMPOPT (COPT_PLUSDIRS, "plusdirs");
}
if (STREQ (cmd, EMPTYCMD))
printf ("-E\n");
else if (STREQ (cmd, DEFAULTCMD))
printf ("-D\n");
else
printf ("%s\n", cmd);
}
@ -683,7 +712,7 @@ compgen_builtin (list)
cs->filterpat = STRDUP (Xarg);
rval = EXECUTION_FAILURE;
sl = gen_compspec_completions (cs, "compgen", word, 0, 0);
sl = gen_compspec_completions (cs, "compgen", word, 0, 0, 0);
/* If the compspec wants the bash default completions, temporarily
turn off programmable completion and call the bash completion code. */
@ -720,7 +749,7 @@ compgen_builtin (list)
$BUILTIN compopt
$DEPENDS_ON PROGRAMMABLE_COMPLETION
$FUNCTION compopt_builtin
$SHORT_DOC compopt [-o|+o option] [name ...]
$SHORT_DOC compopt [-o|+o option] [-DE] [name ...]
Modify or display completion options.
Modify the completion options for each NAME, or, if no NAMEs are supplied,
@ -729,6 +758,8 @@ the completion options for each NAME or the current completion specification.
Options:
-o option Set completion option OPTION for each NAME
-D Change options for the "default" command completion
-E Change options for the "empty" command completion
Using `+o' instead of `-o' turns off the specified option.
@ -749,15 +780,15 @@ int
compopt_builtin (list)
WORD_LIST *list;
{
int opts_on, opts_off, *opts, opt, oind, ret, Eflag;
WORD_LIST *l;
int opts_on, opts_off, *opts, opt, oind, ret, Dflag, Eflag;
WORD_LIST *l, *wl;
COMPSPEC *cs;
opts_on = opts_off = 0;
opts_on = opts_off = Eflag = Dflag = 0;
ret = EXECUTION_SUCCESS;
reset_internal_getopt ();
while ((opt = internal_getopt (list, "+o:")) != EOF)
while ((opt = internal_getopt (list, "+o:DE")) != EOF)
{
opts = (list_opttype == '-') ? &opts_on : &opts_off;
@ -772,6 +803,12 @@ compopt_builtin (list)
}
*opts |= compopts[oind].optflag;
break;
case 'D':
Dflag = 1;
break;
case 'E':
Eflag = 1;
break;
default:
builtin_usage ();
return (EX_USAGE);
@ -779,7 +816,10 @@ compopt_builtin (list)
}
list = loptend;
if (list == 0)
wl = Dflag ? make_word_list (make_bare_word (DEFAULTCMD), (WORD_LIST *)NULL)
: (Eflag ? make_word_list (make_bare_word (EMPTYCMD), (WORD_LIST *)NULL) : 0);
if (list == 0 && wl == 0)
{
if (RL_ISSTATE (RL_STATE_COMPLETING) == 0 || pcomp_curcs == 0)
{
@ -805,7 +845,7 @@ compopt_builtin (list)
return (ret);
}
for (l = list; l; l = l->next)
for (l = wl ? wl : list; l; l = l->next)
{
cs = progcomp_search (l->word->word);
if (cs == 0)

View File

@ -503,14 +503,19 @@ declare_internal (list, local_var)
assign_array_var_from_string (var, value, aflags);
else if (simple_array_assign && subscript_start)
{
/* declare [-a] name[N]=value */
/* declare [-aA] name[N]=value */
*subscript_start = '['; /* ] */
var = assign_array_element (name, value, 0); /* XXX - not aflags */
*subscript_start = '\0';
}
else if (simple_array_assign)
/* let bind_array_variable take care of this. */
{
/* let bind_{array,assoc}_variable take care of this. */
if (assoc_p (var))
bind_assoc_variable (var, name, "0", value, aflags);
else
bind_array_variable (name, 0, value, aflags);
}
else
#endif
/* bind_variable_value duplicates the essential internals of

View File

@ -81,7 +81,7 @@ _evalfile (filename, flags)
{
volatile int old_interactive;
procenv_t old_return_catch;
int return_val, fd, result, pflags;
int return_val, fd, result, pflags, i, nnull;
ssize_t nr; /* return value from read(2) */
char *string;
struct stat finfo;
@ -186,6 +186,26 @@ file_error_and_exit:
return ((flags & FEVAL_BUILTIN) ? EX_BINARY_FILE : -1);
}
i = strlen (string);
if (i < nr)
{
for (nnull = i = 0; i < nr; i++)
if (string[i] == '\0')
{
memmove (string+i, string+i+1, nr - i);
nr--;
/* Even if the `check binary' flag is not set, we want to avoid
sourcing files with more than 256 null characters -- that
probably indicates a binary file. */
if ((flags & FEVAL_BUILTIN) && ++nnull > 256)
{
free (string);
(*errfunc) (_("%s: cannot execute binary file"), filename);
return ((flags & FEVAL_BUILTIN) ? EX_BINARY_FILE : -1);
}
}
}
if (flags & FEVAL_UNWINDPROT)
{
begin_unwind_frame ("_evalfile");

View File

@ -43,6 +43,7 @@
#include "../execute_cmd.h"
#include "../redir.h"
#include "../trap.h"
#include "../bashintl.h"
#include <y.tab.h>
@ -51,6 +52,7 @@
#endif
#include "common.h"
#include "builtext.h"
#if !defined (errno)
extern int errno;
@ -67,6 +69,7 @@ extern int loop_level;
extern int executing_list;
extern int comsub_ignore_return;
extern int posixly_correct;
extern sh_builtin_func_t *this_shell_builtin;
int parse_and_execute_level = 0;
@ -324,6 +327,19 @@ parse_and_execute (string, from_file, flags)
{
last_result = EXECUTION_FAILURE;
if (interactive_shell == 0 && this_shell_builtin &&
(this_shell_builtin == source_builtin || this_shell_builtin == eval_builtin) &&
last_command_exit_value == EX_BADSYNTAX && posixly_correct)
{
#if 0 /* XXX - for bash-4.2 */
should_jump_to_top_level = 1;
code = ERREXIT;
last_command_exit_value = EX_BADUSAGE;
#else
internal_warning (_("syntax errors in . or eval will cause future versions of the shell to abort as Posix requires"));
#endif
}
/* Since we are shell compatible, syntax errors in a script
abort the execution of the script. Right? */
break;

View File

@ -23,7 +23,7 @@ $PRODUCES help.c
$BUILTIN help
$FUNCTION help_builtin
$DEPENDS_ON HELP_BUILTIN
$SHORT_DOC help [-ds] [pattern ...]
$SHORT_DOC help [-dms] [pattern ...]
Display information about builtin commands.
Displays brief summaries of builtin commands. If PATTERN is
@ -350,6 +350,8 @@ A star (*) next to a name means that the command is disabled.\n\
width /= 2;
if (width > sizeof (blurb))
width = sizeof (blurb);
if (width <= 3)
width = 40;
height = (num_shell_builtins + 1) / 2; /* number of rows */
for (i = 0; i < height; i++)

View File

@ -121,6 +121,9 @@ kill_builtin (list)
else
sig = decode_signal (sigspec, dflags);
list = list->next;
#if 0
saw_signal++; /* XXX - for bash-4.2 */
#endif
}
else
{
@ -141,7 +144,7 @@ kill_builtin (list)
/* If this is a signal specification then process it. We only process
the first one seen; other arguments may signify process groups (e.g,
-num == process group num). */
else if ((*word == '-') && !saw_signal)
else if (*word == '-' && saw_signal == 0)
{
sigspec = word + 1;
sig = decode_signal (sigspec, dflags);

View File

@ -24,11 +24,11 @@ $PRODUCES mapfile.c
$BUILTIN mapfile
$FUNCTION mapfile_builtin
$SHORT_DOC mapfile [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callback] [-c quantum] [array]
Read lines from the standard input into an array variable.
Read lines from the standard input into an indexed array variable.
Read lines from the standard input into the array variable ARRAY, or from
file descriptor FD if the -u option is supplied. The variable MAPFILE is
the default ARRAY.
Read lines from the standard input into the indexed array variable ARRAY, or
from file descriptor FD if the -u option is supplied. The variable MAPFILE
is the default ARRAY.
Options:
-n count Copy at most COUNT lines. If COUNT is 0, all lines are copied.
@ -50,7 +50,8 @@ If not supplied with an explicit origin, mapfile will clear ARRAY before
assigning to it.
Exit Status:
Returns success unless an invalid option is given or ARRAY is readonly.
Returns success unless an invalid option is given or ARRAY is readonly or
not an indexed array.
$END
$BUILTIN readarray
@ -71,6 +72,7 @@ $END
#endif
#include "bashansi.h"
#include "bashintl.h"
#include <stdio.h>
#include <errno.h>
@ -110,10 +112,10 @@ run_callback(callback, current_index)
execlen += 2;
execstr = xmalloc (execlen);
flags = 0;
flags = SEVAL_NOHIST;
#if 0
if (interactive)
flags |= SEVAL_NOHIST|SEVAL_INTERACT;
flags |= SEVAL_INTERACT;
#endif
snprintf (execstr, execlen, "%s %d", callback, current_index);
return parse_and_execute(execstr, NULL, flags);
@ -153,11 +155,17 @@ mapfile (fd, line_count_goal, origin, nskip, callback_quantum, callback, array_n
entry = find_or_make_array_variable (array_name, 1);
if (entry == 0 || readonly_p (entry) || noassign_p (entry))
{
if (readonly_p (entry))
if (entry && readonly_p (entry))
err_readonly (array_name);
return (EXECUTION_FAILURE);
}
else if (array_p (entry) == 0)
{
builtin_error (_("%s: not an indexed array"), array_name);
return (EXECUTION_FAILURE);
}
if (flags & MAPF_CLEARARRAY)
array_flush (array_cell (entry));
@ -281,7 +289,7 @@ mapfile_builtin (list)
break;
case 'c':
code = legal_number (list_optarg, &intval);
if (code == 0 || intval < 0 || intval != (unsigned)intval)
if (code == 0 || intval <= 0 || intval != (unsigned)intval)
{
builtin_error (_("%s: invalid callback quantum"), list_optarg);
return (EXECUTION_FAILURE);

View File

@ -135,7 +135,7 @@ extern int errno;
{ \
if (vflag) \
{ \
bind_variable (vname, vbuf, 0); \
bind_printf_variable (vname, vbuf, 0); \
stupidly_hack_special_variables (vname); \
} \
if (conv_bufsize > 4096 ) \
@ -156,6 +156,7 @@ extern int errno;
fflush (stdout); \
if (ferror (stdout)) \
{ \
sh_wrerror (); \
clearerr (stdout); \
return (EXECUTION_FAILURE); \
} \
@ -166,11 +167,11 @@ extern int errno;
#define SKIP1 "#'-+ 0"
#define LENMODS "hjlLtz"
#ifndef HAVE_ASPRINTF
#if !HAVE_ASPRINTF
extern int asprintf __P((char **, const char *, ...)) __attribute__((__format__ (printf, 2, 3)));
#endif
#ifndef HAVE_VSNPRINTF
#if !HAVE_VSNPRINTF
extern int vsnprintf __P((char *, size_t, const char *, ...)) __attribute__((__format__ (printf, 3, 4)));
#endif
@ -186,6 +187,7 @@ static char *getstr __P((void));
static int getint __P((void));
static intmax_t getintmax __P((void));
static uintmax_t getuintmax __P((void));
static SHELL_VAR *bind_printf_variable __P((char *, char *, int));
#if defined (HAVE_LONG_DOUBLE) && HAVE_DECL_STRTOLD && !defined(STRTOLD_BROKEN)
typedef long double floatmax_t;
@ -234,7 +236,12 @@ printf_builtin (list)
switch (ch)
{
case 'v':
if (legal_identifier (vname = list_optarg))
vname = list_optarg;
#if defined (ARRAY_VARS)
if (legal_identifier (vname) || valid_array_reference (vname))
#else
if (legal_identifier (vname))
#endif
{
vflag = 1;
vblen = 0;
@ -997,7 +1004,9 @@ getintmax ()
shall continue processing any remaining operands and shall write the
value accumulated at the time the error was detected to standard
output.'' Yecch. */
ret = 0;
#if 0
ret = 0; /* return partially-converted value from strtoimax */
#endif
conversion_error = 1;
}
else if (errno == ERANGE)
@ -1091,3 +1100,19 @@ asciicode ()
garglist = garglist->next;
return (ch);
}
static SHELL_VAR *
bind_printf_variable (name, value, flags)
char *name;
char *value;
int flags;
{
#if defined (ARRAY_VARS)
if (valid_array_reference (name) == 0)
return (bind_variable (name, value, flags));
else
return (assign_array_element (name, value, flags));
#else /* !ARRAY_VARS */
return bind_variable (name, value, flags);
#endif /* !ARRAY_VARS */
}

View File

@ -22,7 +22,7 @@ $PRODUCES read.c
$BUILTIN read
$FUNCTION read_builtin
$SHORT_DOC read [-ers] [-a array] [-d delim] [-i text] [-n nchars] [-p prompt] [-t timeout] [-u fd] [name ...]
$SHORT_DOC read [-ers] [-a array] [-d delim] [-i text] [-n nchars] [-N nchars] [-p prompt] [-t timeout] [-u fd] [name ...]
Read a line from the standard input and split it into fields.
Reads a single line from the standard input, or from file descriptor FD
@ -42,7 +42,10 @@ Options:
-e use Readline to obtain the line in an interactive shell
-i text Use TEXT as the initial text for Readline
-n nchars return after reading NCHARS characters rather than waiting
for a newline
for a newline, but honor a delimiter if fewer than NCHARS
characters are read before the delimiter
-N nchars return only after reading exactly NCHARS characters, unless
EOF is encountered or read times out, ignoring any delimiter
-p prompt output the string PROMPT without a trailing newline before
attempting to read
-r do not allow backslashes to escape any characters
@ -155,7 +158,7 @@ read_builtin (list)
register char *varname;
int size, i, nr, pass_next, saw_escape, eof, opt, retval, code, print_ps2;
int input_is_tty, input_is_pipe, unbuffered_read, skip_ctlesc, skip_ctlnul;
int raw, edit, nchars, silent, have_timeout, fd;
int raw, edit, nchars, silent, have_timeout, ignore_delim, fd;
unsigned int tmsec, tmusec;
long ival, uval;
intmax_t intval;
@ -211,9 +214,10 @@ read_builtin (list)
tmsec = tmusec = 0; /* no timeout */
nr = nchars = input_is_tty = input_is_pipe = unbuffered_read = have_timeout = 0;
delim = '\n'; /* read until newline */
ignore_delim = 0;
reset_internal_getopt ();
while ((opt = internal_getopt (list, "ersa:d:i:n:p:t:u:")) != -1)
while ((opt = internal_getopt (list, "ersa:d:i:n:p:t:u:N:")) != -1)
{
switch (opt)
{
@ -255,6 +259,9 @@ read_builtin (list)
tmusec = uval;
}
break;
case 'N':
ignore_delim = 1;
delim = -1;
case 'n':
code = legal_number (list_optarg, &intval);
if (code == 0 || intval < 0 || intval != (int)intval)
@ -299,10 +306,17 @@ read_builtin (list)
return (input_avail (fd) ? EXECUTION_SUCCESS : EXECUTION_FAILURE);
#endif
/* If we're asked to ignore the delimiter, make sure we do. */
if (ignore_delim)
delim = -1;
/* IF IFS is unset, we use the default of " \t\n". */
ifs_chars = getifs ();
if (ifs_chars == 0) /* XXX - shouldn't happen */
ifs_chars = "";
/* If we want to read exactly NCHARS chars, don't split on IFS */
if (ignore_delim)
ifs_chars = "";
for (skip_ctlesc = skip_ctlnul = 0, e = ifs_chars; *e; e++)
skip_ctlesc |= *e == CTLESC, skip_ctlnul |= *e == CTLNUL;
@ -601,15 +615,14 @@ add_char:
if (unbuffered_read == 0)
zsyncfd (fd);
interrupt_immediately--;
terminate_immediately--;
discard_unwind_frame ("read_builtin");
retval = eof ? EXECUTION_FAILURE : EXECUTION_SUCCESS;
assign_vars:
interrupt_immediately--;
terminate_immediately--;
#if defined (ARRAY_VARS)
/* If -a was given, take the string read, break it into a list of words,
an assign them to `arrayname' in turn. */

View File

@ -112,19 +112,20 @@ extern int debugging_mode;
static void shopt_error __P((char *));
static int set_shellopts_after_change __P((int));
static int set_compatibility_level __P((int));
static int set_shellopts_after_change __P((char *, int));
static int shopt_enable_hostname_completion __P((char *, int));
static int set_compatibility_level __P((char *, int));
#if defined (RESTRICTED_SHELL)
static int set_restricted_shell __P((int));
static int set_restricted_shell __P((char *, int));
#endif
static int shopt_login_shell;
static int shopt_compat31;
static int shopt_compat32;
static int shopt_compat40;
typedef int shopt_set_func_t __P((int));
typedef int shopt_set_func_t __P((char *, int));
static struct {
char *name;
@ -144,6 +145,7 @@ static struct {
#endif
{ "compat31", &shopt_compat31, set_compatibility_level },
{ "compat32", &shopt_compat32, set_compatibility_level },
{ "compat40", &shopt_compat40, set_compatibility_level },
#if defined (READLINE)
{ "dirspell", &dircomplete_spelling, (shopt_set_func_t *)NULL },
#endif
@ -169,7 +171,7 @@ static struct {
#if defined (READLINE)
{ "histreedit", &history_reediting, (shopt_set_func_t *)NULL },
{ "histverify", &hist_verify, (shopt_set_func_t *)NULL },
{ "hostcomplete", &perform_hostname_completion, enable_hostname_completion },
{ "hostcomplete", &perform_hostname_completion, shopt_enable_hostname_completion },
#endif
{ "huponexit", &hup_on_exit, (shopt_set_func_t *)NULL },
{ "interactive_comments", &interactive_comments, set_shellopts_after_change },
@ -197,6 +199,10 @@ static struct {
{ (char *)0, (int *)0, (shopt_set_func_t *)NULL }
};
#define N_SHOPT_OPTIONS (sizeof (shopt_vars) / sizeof (shopt_vars[0]))
#define GET_SHOPT_OPTION_VALUE(i) (*shopt_vars[i].value)
static const char * const on = "on";
static const char * const off = "off";
@ -340,9 +346,11 @@ toggle_shopts (mode, list, quiet)
{
*shopt_vars[ind].value = mode; /* 1 for set, 0 for unset */
if (shopt_vars[ind].set_func)
(*shopt_vars[ind].set_func) (mode);
(*shopt_vars[ind].set_func) (shopt_vars[ind].name, mode);
}
}
set_bashopts ();
return (rval);
}
@ -479,7 +487,8 @@ 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_shellopts_after_change (mode)
set_shellopts_after_change (option_name, mode)
char *option_name;
int mode;
{
set_shellopts ();
@ -487,14 +496,36 @@ set_shellopts_after_change (mode)
}
static int
set_compatibility_level (mode)
shopt_enable_hostname_completion (option_name, mode)
char *option_name;
int mode;
{
return (enable_hostname_completion (mode));
}
static int
set_compatibility_level (option_name, mode)
char *option_name;
int mode;
{
/* Need to change logic here as we add more compatibility levels */
/* First, check option_name so we can turn off other compat options when
one is set. */
if (mode && option_name[6] == '3' && option_name[7] == '1')
shopt_compat32 = shopt_compat40 = 0;
else if (mode && option_name[6] == '3' && option_name[7] == '2')
shopt_compat31 = shopt_compat40 = 0;
else if (mode && option_name[6] == '4' && option_name[7] == '0')
shopt_compat31 = shopt_compat32 = 0;
/* Then set shell_compatibility_level based on what remains */
if (shopt_compat31)
shell_compatibility_level = 31;
else if (shopt_compat32)
shell_compatibility_level = 32;
else if (shopt_compat40)
shell_compatibility_level = 40;
else
shell_compatibility_level = DEFAULT_COMPAT_LEVEL;
return 0;
@ -504,7 +535,8 @@ set_compatibility_level (mode)
/* Don't allow the value of restricted_shell to be modified. */
static int
set_restricted_shell (mode)
set_restricted_shell (option_name, mode)
char *option_name;
int mode;
{
static int save_restricted = -1;
@ -519,7 +551,8 @@ set_restricted_shell (mode)
/* Not static so shell.c can call it to initialize shopt_login_shell */
int
set_login_shell (mode)
set_login_shell (option_name, mode)
char *option_name;
int mode;
{
shopt_login_shell = login_shell != 0;
@ -579,3 +612,104 @@ shopt_listopt (name, reusable)
print_shopt (name, *shopt_vars[i].value, reusable ? PFLAG : 0);
return (sh_chkwrite (EXECUTION_SUCCESS));
}
void
set_bashopts ()
{
char *value;
char tflag[N_SHOPT_OPTIONS];
int vsize, i, vptr, *ip, exported;
SHELL_VAR *v;
for (vsize = i = 0; shopt_vars[i].name; i++)
{
tflag[i] = 0;
if (GET_SHOPT_OPTION_VALUE (i))
{
vsize += strlen (shopt_vars[i].name) + 1;
tflag[i] = 1;
}
}
value = (char *)xmalloc (vsize + 1);
for (i = vptr = 0; shopt_vars[i].name; i++)
{
if (tflag[i])
{
strcpy (value + vptr, shopt_vars[i].name);
vptr += strlen (shopt_vars[i].name);
value[vptr++] = ':';
}
}
if (vptr)
vptr--; /* cut off trailing colon */
value[vptr] = '\0';
v = find_variable ("BASHOPTS");
/* Turn off the read-only attribute so we can bind the new value, and
note whether or not the variable was exported. */
if (v)
{
VUNSETATTR (v, att_readonly);
exported = exported_p (v);
}
else
exported = 0;
v = bind_variable ("BASHOPTS", value, 0);
/* Turn the read-only attribute back on, and turn off the export attribute
if it was set implicitly by mark_modified_vars and SHELLOPTS was not
exported before we bound the new value. */
VSETATTR (v, att_readonly);
if (mark_modified_vars && exported == 0 && exported_p (v))
VUNSETATTR (v, att_exported);
free (value);
}
void
parse_bashopts (value)
char *value;
{
char *vname;
int vptr, ind;
vptr = 0;
while (vname = extract_colon_unit (value, &vptr))
{
ind = find_shopt (vname);
if (ind >= 0)
*shopt_vars[ind].value = 1;
free (vname);
}
}
void
initialize_bashopts (no_bashopts)
int no_bashopts;
{
char *temp;
SHELL_VAR *var;
if (no_bashopts == 0)
{
var = find_variable ("BASHOPTS");
/* set up any shell options we may have inherited. */
if (var && imported_p (var))
{
temp = (array_p (var) || assoc_p (var)) ? (char *)NULL : savestring (value_cell (var));
if (temp)
{
parse_bashopts (temp);
free (temp);
}
}
}
/* Set up the $BASHOPTS variable. */
set_bashopts ();
}

View File

@ -35,11 +35,15 @@ enum r_instruction {
r_append_err_and_out
};
/* Redirection flags; values for rflags */
#define REDIR_VARASSIGN 0x01
/* Redirection errors. */
#define AMBIGUOUS_REDIRECT -1
#define NOCLOBBER_REDIRECT -2
#define RESTRICTED_REDIRECT -3 /* can only happen in restricted shells. */
#define HEREDOC_REDIRECT -4 /* here-doc temp file can't be created */
#define BADVAR_REDIRECT -5 /* something wrong with {varname}redir */
#define CLOBBERING_REDIRECT(ri) \
(ri == r_output_direction || ri == r_err_and_out)
@ -73,9 +77,9 @@ enum command_type { cm_for, cm_case, cm_while, cm_if, cm_simple, cm_select,
#define W_QUOTED 0x000002 /* Some form of quote character is present. */
#define W_ASSIGNMENT 0x000004 /* This word is a variable assignment. */
#define W_GLOBEXP 0x000008 /* This word is the result of a glob expansion. */
#define W_NOSPLIT 0x000010 /* Do not perform word splitting on this word. */
#define W_NOSPLIT 0x000010 /* Do not perform word splitting on this word because ifs is empty string. */
#define W_NOGLOB 0x000020 /* Do not perform globbing on this word. */
#define W_NOSPLIT2 0x000040 /* Don't split word except for $@ expansion. */
#define W_NOSPLIT2 0x000040 /* Don't split word except for $@ expansion (using spaces) because context does not allow it. */
#define W_TILDEEXP 0x000080 /* Tilde expand this assignment word */
#define W_DOLLARAT 0x000100 /* $@ and its special handling */
#define W_DOLLARSTAR 0x000200 /* $* and its special handling */
@ -135,7 +139,8 @@ typedef union {
(or translator in redir.c) encountered an out-of-range file descriptor. */
typedef struct redirect {
struct redirect *next; /* Next element, or NULL. */
int redirector; /* Descriptor to be redirected. */
REDIRECTEE redirector; /* Descriptor or varname to be redirected. */
int rflags; /* Private flags for this redirection */
int flags; /* Flag value for `open'. */
enum r_instruction instruction; /* What to do with the information. */
REDIRECTEE redirectee; /* File descriptor or filename */

View File

@ -125,6 +125,10 @@
# define PPROMPT "$ "
#endif
#if !defined (HAVE_SYSLOG) || !defined (HAVE_SYSLOG_H)
# undef SYSLOG_HISTORY
#endif
/************************************************/
/* check multibyte capability for I18N code */
/************************************************/

View File

@ -98,3 +98,14 @@
name is not found. If you want to name it something other than the
default ("command_not_found_handle"), change it here. */
/* #define NOTFOUND_HOOK "command_not_found_handle" */
/* Define if you want each line saved to the history list in bashhist.c:
bash_add_history() to be sent to syslog(). */
/* #define SYSLOG_HISTORY */
#if defined (SYSLOG_HISTORY)
# define SYSLOG_FACILITY LOG_USER
# define SYSLOG_LEVEL LOG_INFO
#endif
/* Define if you want to include code in shell.c to support wordexp(3) */
/* #define WORDEXP_OPTION */

View File

@ -115,6 +115,10 @@
pattern matching. */
#undef EXTENDED_GLOB
/* Define EXTGLOB_DEFAULT to the value you'd like the extglob shell option
to have by default */
#undef EXTGLOB_DEFAULT
/* Define COND_COMMAND if you want the ksh-style [[...]] conditional
command. */
#undef COND_COMMAND
@ -494,6 +498,8 @@
/* Define if you have the /dev/stdin device. */
#undef HAVE_DEV_STDIN
/* The type of iconv's `inbuf' argument */
#undef ICONV_CONST
/* Type and behavior of signal handling functions. */
@ -608,6 +614,9 @@
/* Define if you have the getwd function. */
#undef HAVE_GETWD
/* Define if you have the iconv function. */
#undef HAVE_ICONV
/* Define if you have the inet_aton function. */
#undef HAVE_INET_ATON
@ -653,12 +662,21 @@
/* Define if you have the lstat function. */
#undef HAVE_LSTAT
/* Define if you have the locale_charset function. */
#undef HAVE_LOCALE_CHARSET
/* 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 mbscasecmp function. */
#undef HAVE_MBSCASECMP
/* Define if you have the mbschr function. */
#undef HAVE_MBSCHR
/* Define if you have the mbscmp function. */
#undef HAVE_MBSCMP
@ -738,6 +756,9 @@
/* Define if you have the strcasecmp function. */
#undef HAVE_STRCASECMP
/* Define if you have the strcasestr function. */
#undef HAVE_STRCASESTR
/* Define if you have the strchr function. */
#undef HAVE_STRCHR
@ -786,6 +807,9 @@
/* Define if you have the sysconf function. */
#undef HAVE_SYSCONF
/* Define if you have the syslog function. */
#undef HAVE_SYSLOG
/* Define if you have the tcgetattr function. */
#undef HAVE_TCGETATTR
@ -911,6 +935,9 @@
/* Define if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define if you have the <syslog.h> header file. */
#undef HAVE_SYSLOG_H
/* Define if you have the <sys/dir.h> header file. */
#undef HAVE_SYS_DIR_H

704
configure vendored
View File

@ -1,7 +1,7 @@
#! /bin/sh
# From configure.in for Bash 4.0, version 4.013.
# From configure.in for Bash 4.1, version 4.019.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.63 for bash 4.0-release.
# Generated by GNU Autoconf 2.63 for bash 4.1-release.
#
# Report bugs to <bug-bash@gnu.org>.
#
@ -597,8 +597,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='bash'
PACKAGE_TARNAME='bash'
PACKAGE_VERSION='4.0-release'
PACKAGE_STRING='bash 4.0-release'
PACKAGE_VERSION='4.1-release'
PACKAGE_STRING='bash 4.1-release'
PACKAGE_BUGREPORT='bug-bash@gnu.org'
ac_unique_file="shell.h"
@ -819,6 +819,7 @@ enable_directory_stack
enable_disabled_builtins
enable_dparen_arithmetic
enable_extended_glob
enable_extended_glob_default
enable_help_builtin
enable_history
enable_job_control
@ -1410,7 +1411,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 <<_ACEOF
\`configure' configures bash 4.0-release to adapt to many kinds of systems.
\`configure' configures bash 4.1-release to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1475,7 +1476,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of bash 4.0-release:";;
short | recursive ) echo "Configuration of bash 4.1-release:";;
esac
cat <<\_ACEOF
@ -1510,6 +1511,9 @@ Optional Features:
--enable-dparen-arithmetic
include ((...)) command
--enable-extended-glob include ksh-style extended pattern matching
--enable-extended-glob-default
force extended pattern matching to be enabled by
default
--enable-help-builtin include the help builtin
--enable-history turn on command history
--enable-job-control enable job control features
@ -1648,7 +1652,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
bash configure 4.0-release
bash configure 4.1-release
generated by GNU Autoconf 2.63
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@ -1662,7 +1666,7 @@ cat >config.log <<_ACEOF
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 4.0-release, which was
It was created by bash $as_me 4.1-release, which was
generated by GNU Autoconf 2.63. Invocation command line was
$ $0 $@
@ -1944,6 +1948,8 @@ ac_header_list="$ac_header_list unistd.h"
ac_func_list="$ac_func_list alarm"
ac_func_list="$ac_func_list fpurge"
ac_func_list="$ac_func_list __fpurge"
ac_func_list="$ac_func_list snprintf"
ac_func_list="$ac_func_list vsnprintf"
# Check that the precious variables saved in the cache have kept the same
# value.
ac_cache_corrupted=false
@ -2073,7 +2079,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
ac_config_headers="$ac_config_headers config.h"
BASHVERS=4.0
BASHVERS=4.1
RELSTATUS=release
case "$RELSTATUS" in
@ -2412,6 +2418,7 @@ opt_debugger=yes
opt_single_longdoc_strings=yes
opt_casemod_attrs=yes
opt_casemod_expansions=yes
opt_extglob_default=no
opt_static_link=no
opt_profiling=no
@ -2431,7 +2438,7 @@ if test $opt_minimal_config = yes; then
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 opt_coproc=no
opt_casemod_attrs=no opt_casemod_expansions=no
opt_casemod_attrs=no opt_casemod_expansions=no opt_extglob_default=no
fi
# Check whether --enable-alias was given.
@ -2514,6 +2521,11 @@ if test "${enable_extended_glob+set}" = set; then
enableval=$enable_extended_glob; opt_extended_glob=$enableval
fi
# Check whether --enable-extended-glob-default was given.
if test "${enable_extended_glob_default+set}" = set; then
enableval=$enable_extended_glob_default; opt_extglob_default=$enableval
fi
# Check whether --enable-help-builtin was given.
if test "${enable_help_builtin+set}" = set; then
enableval=$enable_help_builtin; opt_help=$enableval
@ -2702,6 +2714,17 @@ cat >>confdefs.h <<\_ACEOF
#define EXTENDED_GLOB 1
_ACEOF
fi
if test $opt_extglob_default = yes; then
cat >>confdefs.h <<\_ACEOF
#define EXTGLOB_DEFAULT 1
_ACEOF
else
cat >>confdefs.h <<\_ACEOF
#define EXTGLOB_DEFAULT 0
_ACEOF
fi
if test $opt_cond_command = yes ; then
cat >>confdefs.h <<\_ACEOF
@ -11478,11 +11501,13 @@ 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 pwd.h grp.h strings.h regex.h
stddef.h stdint.h netdb.h pwd.h grp.h strings.h regex.h \
syslog.h
do
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
@ -13548,13 +13573,14 @@ done
for ac_func in bcopy bzero confstr fnmatch \
getaddrinfo gethostbyname getservbyname getservent inet_aton \
memmove pathconf putenv raise regcomp regexec \
setenv setlinebuf setlocale setvbuf siginterrupt strchr \
sysconf tcgetattr times ttyname tzset unsetenv
sysconf syslog tcgetattr times ttyname tzset unsetenv
do
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
@ -13657,9 +13683,7 @@ done
for ac_func in vsnprintf snprintf vasprintf asprintf
for ac_func in vasprintf asprintf
do
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
@ -13970,13 +13994,122 @@ done
for ac_func in getcwd memset
do
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
$as_echo_n "checking for $ac_func... " >&6; }
if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
$as_echo_n "(cached) " >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
#define $ac_func innocuous_$ac_func
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func (); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
#undef $ac_func
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char $ac_func ();
/* 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_$ac_func || defined __stub___$ac_func
choke me
#endif
int
main ()
{
return $ac_func ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
$as_test_x conftest$ac_exeext
}; then
eval "$as_ac_var=yes"
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
eval "$as_ac_var=no"
fi
rm -rf conftest.dSYM
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
fi
ac_res=`eval 'as_val=${'$as_ac_var'}
$as_echo "$as_val"'`
{ $as_echo "$as_me:$LINENO: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
as_val=`eval 'as_val=${'$as_ac_var'}
$as_echo "$as_val"'`
if test "x$as_val" = x""yes; then
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
else
case " $LIBOBJS " in
*" $ac_func.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS $ac_func.$ac_objext"
;;
esac
fi
done
for ac_func in getcwd memset strcasecmp strerror strftime strnlen strpbrk strstr
for ac_func in strcasecmp strcasestr strerror strftime strnlen strpbrk strstr
do
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
@ -17128,6 +17261,98 @@ _ACEOF
fi
{ $as_echo "$as_me:$LINENO: checking for mbscasecmp" >&5
$as_echo_n "checking for mbscasecmp... " >&6; }
if test "${ac_cv_func_mbscasecmp+set}" = set; then
$as_echo_n "(cached) " >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Define mbscasecmp to an innocuous variant, in case <limits.h> declares mbscasecmp.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
#define mbscasecmp innocuous_mbscasecmp
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char mbscasecmp (); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
#undef mbscasecmp
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char mbscasecmp ();
/* 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_mbscasecmp || defined __stub___mbscasecmp
choke me
#endif
int
main ()
{
return mbscasecmp ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
$as_test_x conftest$ac_exeext
}; then
ac_cv_func_mbscasecmp=yes
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_func_mbscasecmp=no
fi
rm -rf conftest.dSYM
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_mbscasecmp" >&5
$as_echo "$ac_cv_func_mbscasecmp" >&6; }
if test "x$ac_cv_func_mbscasecmp" = x""yes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_MBSCMP 1
_ACEOF
fi
{ $as_echo "$as_me:$LINENO: checking for mbscmp" >&5
$as_echo_n "checking for mbscmp... " >&6; }
if test "${ac_cv_func_mbscmp+set}" = set; then
@ -17313,6 +17538,116 @@ _ACEOF
fi
for ac_func in mbschr
do
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
$as_echo_n "checking for $ac_func... " >&6; }
if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
$as_echo_n "(cached) " >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
#define $ac_func innocuous_$ac_func
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func (); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
#undef $ac_func
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char $ac_func ();
/* 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_$ac_func || defined __stub___$ac_func
choke me
#endif
int
main ()
{
return $ac_func ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
$as_test_x conftest$ac_exeext
}; then
eval "$as_ac_var=yes"
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
eval "$as_ac_var=no"
fi
rm -rf conftest.dSYM
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
fi
ac_res=`eval 'as_val=${'$as_ac_var'}
$as_echo "$as_val"'`
{ $as_echo "$as_me:$LINENO: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
as_val=`eval 'as_val=${'$as_ac_var'}
$as_echo "$as_val"'`
if test "x$as_val" = x""yes; then
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
else
case " $LIBOBJS " in
*" $ac_func.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS $ac_func.$ac_objext"
;;
esac
fi
done
{ $as_echo "$as_me:$LINENO: checking for wcrtomb" >&5
$as_echo_n "checking for wcrtomb... " >&6; }
if test "${ac_cv_func_wcrtomb+set}" = set; then
@ -18201,6 +18536,113 @@ _ACEOF
fi
if test "$am_cv_func_iconv" = yes; then
OLDLIBS="$LIBS"
LIBS="$LIBS $LIBICONV"
for ac_func in locale_charset
do
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
$as_echo_n "checking for $ac_func... " >&6; }
if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
$as_echo_n "(cached) " >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
#define $ac_func innocuous_$ac_func
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func (); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
#undef $ac_func
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char $ac_func ();
/* 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_$ac_func || defined __stub___$ac_func
choke me
#endif
int
main ()
{
return $ac_func ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
$as_test_x conftest$ac_exeext
}; then
eval "$as_ac_var=yes"
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
eval "$as_ac_var=no"
fi
rm -rf conftest.dSYM
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
fi
ac_res=`eval 'as_val=${'$as_ac_var'}
$as_echo "$as_val"'`
{ $as_echo "$as_me:$LINENO: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
as_val=`eval 'as_val=${'$as_ac_var'}
$as_echo "$as_val"'`
if test "x$as_val" = x""yes; then
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
LIBS="$OLDLIBS"
fi
if test "$opt_static_link" != yes; then
@ -26020,6 +26462,9 @@ cat >>conftest.$ac_ext <<_ACEOF
#if HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#if HAVE_STDINT_H
#include <stdint.h>
#endif
#include <sys/times.h>
_ACEOF
@ -26064,6 +26509,9 @@ cat >>conftest.$ac_ext <<_ACEOF
#if HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#if HAVE_STDINT_H
#include <stdint.h>
#endif
#include <signal.h>
_ACEOF
@ -26108,6 +26556,9 @@ cat >>conftest.$ac_ext <<_ACEOF
#if HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#if HAVE_STDINT_H
#include <stdint.h>
#endif
_ACEOF
@ -26157,6 +26608,9 @@ cat >>conftest.$ac_ext <<_ACEOF
#if HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#if HAVE_STDINT_H
#include <stdint.h>
#endif
_ACEOF
@ -26201,6 +26655,9 @@ cat >>conftest.$ac_ext <<_ACEOF
#if HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#if HAVE_STDINT_H
#include <stdint.h>
#endif
_ACEOF
@ -26246,6 +26703,9 @@ cat >>conftest.$ac_ext <<_ACEOF
#if HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#if HAVE_STDINT_H
#include <stdint.h>
#endif
#include <sys/socket.h>
_ACEOF
@ -28224,6 +28684,212 @@ fi
if test X$ac_cv_func_snprintf = Xyes; then
{ $as_echo "$as_me:$LINENO: checking for standard-conformant snprintf" >&5
$as_echo_n "checking for standard-conformant snprintf... " >&6; }
if test "${bash_cv_func_snprintf+set}" = set; then
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then
{ $as_echo "$as_me:$LINENO: WARNING: cannot check standard snprintf if cross-compiling" >&5
$as_echo "$as_me: WARNING: cannot check standard snprintf if cross-compiling" >&2;}
bash_cv_func_snprintf=yes
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <stdio.h>
main()
{
int n;
n = snprintf (0, 0, "%s", "0123456");
exit(n != 7);
}
_ACEOF
rm -f conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_link") 2>&5
ac_status=$?
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
{ (case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_try") 2>&5
ac_status=$?
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
bash_cv_func_snprintf=yes
else
$as_echo "$as_me: program exited with status $ac_status" >&5
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
bash_cv_func_snprintf=no
fi
rm -rf conftest.dSYM
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
{ $as_echo "$as_me:$LINENO: result: $bash_cv_func_snprintf" >&5
$as_echo "$bash_cv_func_snprintf" >&6; }
if test $bash_cv_func_snprintf = no; then
ac_cv_func_snprintf=no
fi
fi
if test $ac_cv_func_snprintf = no; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_SNPRINTF 0
_ACEOF
fi
if test X$ac_cv_func_vsnprintf = Xyes; then
{ $as_echo "$as_me:$LINENO: checking for standard-conformant vsnprintf" >&5
$as_echo_n "checking for standard-conformant vsnprintf... " >&6; }
if test "${bash_cv_func_vsnprintf+set}" = set; then
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then
{ $as_echo "$as_me:$LINENO: WARNING: cannot check standard vsnprintf if cross-compiling" >&5
$as_echo "$as_me: WARNING: cannot check standard vsnprintf if cross-compiling" >&2;}
bash_cv_func_vsnprintf=yes
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#if HAVE_STDARG_H
#include <stdarg.h>
#else
#include <varargs.h>
#endif
#include <stdio.h>
#include <stdlib.h>
static int
#if HAVE_STDARG_H
foo(const char *fmt, ...)
#else
foo(format, va_alist)
const char *format;
va_dcl
#endif
{
va_list args;
int n;
#if HAVE_STDARG_H
va_start(args, fmt);
#else
va_start(args);
#endif
n = vsnprintf(0, 0, fmt, args);
va_end (args);
return n;
}
main()
{
int n;
n = foo("%s", "0123456");
exit(n != 7);
}
_ACEOF
rm -f conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_link") 2>&5
ac_status=$?
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
{ (case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_try") 2>&5
ac_status=$?
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
bash_cv_func_vsnprintf=yes
else
$as_echo "$as_me: program exited with status $ac_status" >&5
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
bash_cv_func_vsnprintf=no
fi
rm -rf conftest.dSYM
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
{ $as_echo "$as_me:$LINENO: result: $bash_cv_func_vsnprintf" >&5
$as_echo "$bash_cv_func_vsnprintf" >&6; }
if test $bash_cv_func_vsnprintf = no; then
ac_cv_func_vsnprintf=no
fi
fi
if test $ac_cv_func_vsnprintf = no; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_VSNPRINTF 0
_ACEOF
fi
if test "$ac_cv_func_putenv" = "yes"; then
@ -29971,7 +30637,7 @@ _ACEOF
*qnx*) LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;;
powerux*) LOCAL_LIBS="-lgen" ;;
cygwin*) LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
opennt*|interix*) LOCAL_CFLAGS="-DNO_MAIN_ENV_ARG -DBROKEN_DIRENT_D_INO -D_POSIX_SOURCE" ;;
opennt*|interix*) LOCAL_CFLAGS="-DNO_MAIN_ENV_ARG -DBROKEN_DIRENT_D_INO -D_POSIX_SOURCE -D_ALL_SOURCE" ;;
esac
case "${host_os}-${CC}" in
@ -30504,7 +31170,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by bash $as_me 4.0-release, which was
This file was extended by bash $as_me 4.1-release, which was
generated by GNU Autoconf 2.63. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -30567,7 +31233,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
bash config.status 4.0-release
bash config.status 4.1-release
configured by $0, generated by GNU Autoconf 2.63,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"

View File

@ -1,5 +1,5 @@
dnl
dnl Configure script for bash-4.0
dnl Configure script for bash-4.1
dnl
dnl report bugs to chet@po.cwru.edu
dnl
@ -21,9 +21,9 @@ dnl Process this file with autoconf to produce a configure script.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
AC_REVISION([for Bash 4.0, version 4.013])dnl
AC_REVISION([for Bash 4.1, version 4.019])dnl
define(bashvers, 4.0)
define(bashvers, 4.1)
define(relstatus, release)
AC_INIT([bash], bashvers-relstatus, [bug-bash@gnu.org])
@ -185,6 +185,7 @@ opt_debugger=yes
opt_single_longdoc_strings=yes
opt_casemod_attrs=yes
opt_casemod_expansions=yes
opt_extglob_default=no
dnl options that affect how bash is compiled and linked
opt_static_link=no
@ -204,7 +205,7 @@ if test $opt_minimal_config = yes; then
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 opt_coproc=no
opt_casemod_attrs=no opt_casemod_expansions=no
opt_casemod_attrs=no opt_casemod_expansions=no opt_extglob_default=no
fi
AC_ARG_ENABLE(alias, AC_HELP_STRING([--enable-alias], [enable shell aliases]), opt_alias=$enableval)
@ -223,6 +224,7 @@ AC_ARG_ENABLE(directory-stack, AC_HELP_STRING([--enable-directory-stack], [enabl
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)
AC_ARG_ENABLE(extended-glob, AC_HELP_STRING([--enable-extended-glob], [include ksh-style extended pattern matching]), opt_extended_glob=$enableval)
AC_ARG_ENABLE(extended-glob-default, AC_HELP_STRING([--enable-extended-glob-default], [force extended pattern matching to be enabled by default]), opt_extglob_default=$enableval)
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)
@ -296,6 +298,11 @@ fi
if test $opt_extended_glob = yes ; then
AC_DEFINE(EXTENDED_GLOB)
fi
if test $opt_extglob_default = yes; then
AC_DEFINE(EXTGLOB_DEFAULT, 1)
else
AC_DEFINE(EXTGLOB_DEFAULT, 0)
fi
if test $opt_cond_command = yes ; then
AC_DEFINE(COND_COMMAND)
fi
@ -500,8 +507,8 @@ then
case "$ac_cv_rl_version" in
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)
AC_MSG_WARN([installed readline library is too old to be linked with bash])
AC_MSG_WARN([using private bash version])
;;
esac
fi
@ -651,7 +658,8 @@ 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 pwd.h grp.h strings.h regex.h)
stddef.h stdint.h netdb.h pwd.h grp.h strings.h regex.h \
syslog.h)
AC_CHECK_HEADERS(sys/pte.h sys/stream.h sys/select.h sys/file.h \
sys/resource.h sys/param.h sys/socket.h sys/stat.h \
sys/time.h sys/times.h sys/types.h sys/wait.h)
@ -723,12 +731,13 @@ AC_CHECK_FUNCS(bcopy bzero confstr fnmatch \
getaddrinfo gethostbyname getservbyname getservent inet_aton \
memmove pathconf putenv raise regcomp regexec \
setenv setlinebuf setlocale setvbuf siginterrupt strchr \
sysconf tcgetattr times ttyname tzset unsetenv)
sysconf syslog tcgetattr times ttyname tzset unsetenv)
AC_CHECK_FUNCS(vsnprintf snprintf vasprintf asprintf)
AC_CHECK_FUNCS(vasprintf asprintf)
AC_CHECK_FUNCS(isascii isblank isgraph isprint isspace isxdigit)
AC_CHECK_FUNCS(getpwent getpwnam getpwuid)
AC_REPLACE_FUNCS(getcwd memset strcasecmp strerror strftime strnlen strpbrk strstr)
AC_REPLACE_FUNCS(getcwd memset)
AC_REPLACE_FUNCS(strcasecmp strcasestr strerror strftime strnlen strpbrk strstr)
AC_REPLACE_FUNCS(strtod strtol strtoul strtoll strtoull strtoimax strtoumax)
AC_REPLACE_FUNCS(fdprintf)
@ -919,6 +928,8 @@ BASH_FUNC_GETCWD
fi
BASH_FUNC_POSIX_SETJMP
BASH_FUNC_STRCOLL
BASH_FUNC_SNPRINTF
BASH_FUNC_VSNPRINTF
dnl If putenv or unsetenv is not present, set the right define so the
dnl prototype and declaration in lib/sh/getenv.c will be standard-conformant
@ -1025,7 +1036,7 @@ 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_CFLAGS=-DRECYCLES_PIDS ;;
opennt*|interix*) LOCAL_CFLAGS="-DNO_MAIN_ENV_ARG -DBROKEN_DIRENT_D_INO -D_POSIX_SOURCE" ;;
opennt*|interix*) LOCAL_CFLAGS="-DNO_MAIN_ENV_ARG -DBROKEN_DIRENT_D_INO -D_POSIX_SOURCE -D_ALL_SOURCE" ;;
esac
dnl Stanza for OS/compiler pair-specific flags

View File

@ -113,7 +113,15 @@ copy_redirect (redirect)
REDIRECT *new_redirect;
new_redirect = (REDIRECT *)xmalloc (sizeof (REDIRECT));
#if 0
FASTCOPY ((char *)redirect, (char *)new_redirect, (sizeof (REDIRECT)));
#else
*new_redirect = *redirect; /* let the compiler do the fast structure copy */
#endif
if (redirect->rflags & REDIR_VARASSIGN)
new_redirect->redirector.filename = copy_word (redirect->redirector.filename);
switch (redirect->instruction)
{
case r_reading_until:

View File

@ -309,6 +309,10 @@ dispose_redirects (list)
{
t = list;
list = list->next;
if (t->rflags & REDIR_VARASSIGN)
dispose_word (t->redirector.filename);
switch (t->instruction)
{
case r_reading_until:

215
doc/FAQ
View File

@ -1,4 +1,4 @@
This is the Bash FAQ, version 4.01, for Bash version 4.0.
This is the Bash FAQ, version 4.11, for Bash version 4.1.
This document contains a set of frequently-asked questions concerning
Bash, the GNU Bourne-Again Shell. Bash is a freely-available command
@ -36,9 +36,9 @@ A10) What is the bash `posix mode'?
Section B: The latest version
B1) What's new in version 4.0?
B2) Are there any user-visible incompatibilities between bash-4.0,
bash-3.2, and bash-2.05b?
B1) What's new in version 4.1?
B2) Are there any user-visible incompatibilities between bash-4.1 and
previous bash versions?
Section C: Differences from other Unix shells
@ -81,6 +81,7 @@ E12) Why don't negative offsets in substring expansion work like I expect?
E13) Why does filename completion misbehave if a colon appears in the filename?
E14) Why does quoting the pattern argument to the regular expression matching
conditional operator (=~) cause matching to stop working?
E15) Tell me more about the shell compatibility level.
Section F: Things to watch out for on certain Unix versions
@ -143,26 +144,26 @@ of Case Western Reserve University.
A2) What's the latest version?
The latest version is 4.0, first made available on 20 February, 2009.
The latest version is 4.1, first made available on 31 December, 2009.
A3) Where can I get it?
Bash is the GNU project's shell, and so is available from the
master GNU archive site, ftp.gnu.org, and its mirrors. The
latest version is also available for FTP from ftp.cwru.edu.
The following URLs tell how to get version 4.0:
The following URLs tell how to get version 4.1:
ftp://ftp.gnu.org/pub/gnu/bash/bash-4.0.tar.gz
ftp://ftp.cwru.edu/pub/bash/bash-4.0.tar.gz
ftp://ftp.gnu.org/pub/gnu/bash/bash-4.1.tar.gz
ftp://ftp.cwru.edu/pub/bash/bash-4.1.tar.gz
Formatted versions of the documentation are available with the URLs:
ftp://ftp.gnu.org/pub/gnu/bash/bash-doc-4.0.tar.gz
ftp://ftp.cwru.edu/pub/bash/bash-doc-4.0.tar.gz
ftp://ftp.gnu.org/pub/gnu/bash/bash-doc-4.1.tar.gz
ftp://ftp.cwru.edu/pub/bash/bash-doc-4.1.tar.gz
Any patches for the current version are available with the URL:
ftp://ftp.cwru.edu/pub/bash/bash-4.0-patches/
ftp://ftp.cwru.edu/pub/bash/bash-4.1-patches/
A4) On what machines will bash run?
@ -194,7 +195,7 @@ http://www.cygwin.com/.
Cygnus originally ported bash-1.14.7, and that port was part of their
early GNU-Win32 (the original name) releases. Cygnus has also done
ports of bash-2.05b and bash-3.2 to the CYGWIN environment, and both
ports of bash-3.2 and bash-4.0 to the CYGWIN environment, and both
are available as part of their current release.
Bash-2.05b and later versions should require no local Cygnus changes to
@ -218,7 +219,7 @@ Mark began to work with bash-2.05, but I don't know the current status.
Bash-3.0 compiles and runs with no modifications under Microsoft's Services
for Unix (SFU), once known as Interix. I do not anticipate any problems
with building bash-4.0, but will gladly accept any patches that are needed.
with building bash-4.1, but will gladly accept any patches that are needed.
A6) How can I build bash with gcc?
@ -387,16 +388,124 @@ They are also listed in a section in the Bash Reference Manual
Section B: The latest version
B1) What's new in version 4.0?
B1) What's new in version 4.1?
Bash-4.0 is the fourth major release of bash. There are numerous new features,
some experimental. Depending on community reception, the experimental
features will evolve.
Bash-4.1 is the first revision to the fourth major release of bash.
Bash-4.0 contains the following new features (see the manual page for
complete descriptions and the CHANGES and NEWS files in the bash-4.0
Bash-4.1 contains the following new features (see the manual page for
complete descriptions and the CHANGES and NEWS files in the bash-4.1
distribution):
o Here-documents within $(...) command substitutions may once more be
delimited by the closing right paren, instead of requiring a newline.
o Bash's file status checks (executable, readable, etc.) now take file
system ACLs into account on file systems that support them.
o Bash now passes environment variables with names that are not valid
shell variable names through into the environment passed to child
processes.
o The `execute-unix-command' readline function now attempts to clear and
reuse the current line rather than move to a new one after the command
executes.
o `printf -v' can now assign values to array indices.
o New `complete -E' and `compopt -E' options that work on the "empty"
completion: completion attempted on an empty command line.
o New complete/compgen/compopt -D option to define a `default' completion:
a completion to be invoked on command for which no completion has been
defined. If this function returns 124, programmable completion is
attempted again, allowing a user to dynamically build a set of completions
as completion is attempted by having the default completion function
install individual completion functions each time it is invoked.
o When displaying associative arrays, subscripts are now quoted.
o Changes to dabbrev-expand to make it more `emacs-like': no space appended
after matches, completions are not sorted, and most recent history entries
are presented first.
o The [[ and (( commands are now subject to the setting of `set -e' and the
ERR trap.
o The source/. builtin now removes NUL bytes from the file before attempting
to parse commands.
o There is a new configuration option (in config-top.h) that forces bash to
forward all history entries to syslog.
o A new variable $BASHOPTS to export shell options settable using `shopt' to
child processes.
o There is a new confgure option that forces the extglob option to be
enabled by default.
o New variable $BASH_XTRACEFD; when set to an integer bash will write xtrace
output to that file descriptor.
o If the optional left-hand-side of a redirection is of the form {var}, the
shell assigns the file descriptor used to $var or uses $var as the file
descriptor to move or close, depending on the redirection operator.
o The < and > operators to the [[ conditional command now do string
comparison according to the current locale.
o Programmable completion now uses the completion for `b' instead of `a'
when completion is attempted on a line like: a $(b c.
o Force extglob on temporarily when parsing the pattern argument to
the == and != operators to the [[ command, for compatibility.
o Changed the behavior of interrupting the wait builtin when a SIGCHLD is
received and a trap on SIGCHLD is set to be Posix-mode only.
o The read builtin has a new `-N nchars' option, which reads exactly NCHARS
characters, ignoring delimiters like newline.
o The mapfile/readarray builtin no longer stores the commands it invokes via
callbacks in the history list.
o There is a new `compat40' shopt option.
o The < and > operators to [[ do string comparisons using the current locale
only if the compatibility level is greater than 40 (set to 41 by default).
o New bindable readline function: menu-complete-backward.
o In the readline vi-mode insertion keymap, C-n is now bound to menu-complete
by default, and C-p to menu-complete-backward.
o When in readline vi command mode, repeatedly hitting ESC now does nothing,
even when ESC introduces a bound key sequence. This is closer to how
historical vi behaves.
o New bindable readline function: skip-csi-sequence. Can be used as a
default to consume key sequences generated by keys like Home and End
without having to bind all keys.
o New bindable readline variable: skip-completed-text, active when
completing in the middle of a word. If enabled, it means that characters
in the completion that match characters in the remainder of the word are
"skipped" rather than inserted into the line.
o The pre-readline-6.0 version of menu completion is available as
"old-menu-complete" for users who do not like the readline-6.0 version.
o New bindable readline variable: echo-control-characters. If enabled, and
the tty ECHOCTL bit is set, controls the echoing of characters
corresponding to keyboard-generated signals.
o New bindable readline variable: enable-meta-key. Controls whether or not
readline sends the smm/rmm sequences if the terminal indicates it has a
meta key that enables eight-bit characters.
A short feature history dating from Bash-2.0:
Bash-4.0 contained the following new features:
o When using substring expansion on the positional parameters, a starting
index of 0 now causes $0 to be prefixed to the list.
@ -536,8 +645,6 @@ o New bindable readline functions shell-backward-kill-word and shell-kill-word
which kill words backward and forward, but use the same word boundaries
as shell-forward-word and shell-backward-word.
A short feature history dating from Bash-2.0:
Bash-3.2 contained the following new features:
o Bash-3.2 now checks shell scripts for NUL characters rather than non-printing
@ -794,13 +901,14 @@ grammar tighter and smaller (66 reduce-reduce conflicts gone)
lots of code now smaller and faster
test suite greatly expanded
B2) Are there any user-visible incompatibilities between bash-4.0, bash-3.2,
and bash-2.05b?
B2) Are there any user-visible incompatibilities between bash-4.1 and
previous bash versions?
There are a few incompatibilities between version 4.0 and version 3.2.
They are detailed in the file COMPAT in the bash distribution. That file
is not meant to be all-encompassing; send mail to bash-maintainers@gnu.org
if if you find something that's not mentioned there.
There are a few incompatibilities between version 4.1 and previous
versions. They are detailed in the file COMPAT in the bash distribution.
That file is not meant to be all-encompassing; send mail to
bash-maintainers@gnu.org (or bug-bash@gnu.org if you would like
community discussion) if if you find something that's not mentioned there.
Section C: Differences from other Unix shells
@ -837,7 +945,7 @@ Things bash has that sh does not:
HISTFILESIZE, HISTCONTROL, HISTIGNORE, GLOBIGNORE, GROUPS,
PROMPT_COMMAND, FCEDIT, FIGNORE, IGNOREEOF, INPUTRC,
SHELLOPTS, OPTERR, HOSTFILE, TMOUT, FUNCNAME, histchars,
auto_resume, PROMPT_DIRTRIM
auto_resume, PROMPT_DIRTRIM, BASHOPTS, BASH_XTRACEFD
DEBUG trap
ERR trap
variable arrays with new compound assignment syntax
@ -848,7 +956,7 @@ Things bash has that sh does not:
bash return builtin will exit a file sourced with `.'
builtins: cd -/-L/-P, exec -l/-c/-a, echo -e/-E, hash -d/-l/-p/-t.
export -n/-f/-p/name=value, pwd -L/-P,
read -e/-p/-a/-t/-n/-d/-s/-u/-i,
read -e/-p/-a/-t/-n/-d/-s/-u/-i/-N,
readonly -a/-f/name=value, trap -l, set +o,
set -b/-m/-o option/-h/-p/-B/-C/-H/-P,
unset -f/-v, ulimit -i/-m/-p/-q/-u/-x,
@ -894,6 +1002,7 @@ Things bash has that sh does not:
case-modifying word expansions and variable attributes
associative arrays
coprocesses using the `coproc' reserved word and variables
shell assignment of a file descriptor used in a redirection to a variable
Things sh has that bash does not:
uses variable SHACCT to do shell accounting
@ -950,7 +1059,7 @@ Things bash has or uses that ksh88 does not:
builtins: bind, builtin, command, declare, dirs, echo -e/-E, enable,
exec -l/-c/-a, fc -s, export -n/-f/-p, hash, help, history,
jobs -x/-r/-s, kill -s/-n/-l, local, logout, popd, pushd,
read -e/-p/-a/-t/-n/-d/-s, readonly -a/-n/-f/-p,
read -e/-p/-a/-t/-n/-d/-s/-N, readonly -a/-n/-f/-p,
set -o braceexpand/-o histexpand/-o interactive-comments/
-o notify/-o physical/-o posix/-o hashall/-o onecmd/
-h/-B/-C/-b/-H/-P, set +o, suspend, trap -l, type,
@ -979,6 +1088,7 @@ Things bash has or uses that ksh88 does not:
case-modifying word expansions and variable attributes
associative arrays
coprocesses using the `coproc' reserved word and variables
shell assignment of a file descriptor used in a redirection to a variable
Things ksh88 has or uses that bash does not:
tracked aliases (alias -t)
@ -1006,9 +1116,9 @@ Implementation differences:
C3) Which new features in ksh-93 are not in bash, and which are?
This list is current through ksh93t (11/04/2008)
This list is current through ksh93t+ (05/05/2009)
New things in ksh-93 not in bash-4.0:
New things in ksh-93 not in bash-4.1:
floating point arithmetic and variables
math library functions
${!name[sub]} name of subscript for associative array
@ -1031,10 +1141,11 @@ New things in ksh-93 not in bash-4.0:
`.' can execute shell functions
getopts -a
printf %B, %H, %P, %R, %T, %Z modifiers, output base for %d, `=' flag
read -N (read -n differs, too)/-v
read -n/-N differ/-v
set -o showme/-o multiline (bash default)
`sleep' and `getconf' builtins (bash has loadable versions)
typeset -n and `nameref' variables
[[ -R name ]] (checks whether or not name is a nameref)
typeset -C/-S/-T/-X/-h/-s
experimental `type' definitions (a la typedef) using typeset
negative subscripts for indexed array variables
@ -1042,11 +1153,11 @@ New things in ksh-93 not in bash-4.0:
associative array assignments using `;' as element separator
command substitution $(n<#) expands to current byte offset for fd N
new '${ ' form of command substitution, executed in current shell
new >;/<#pat/<##pat/<#/># redirections
redirection operators preceded with {varname} to store fd number in varname
new >;/<>;/<#pat/<##pat/<#/># redirections
brace expansion printf-like formats
[[ -v var ]] operators (checks whether or not var is set)
New things in ksh-93 present in bash-4.0:
New things in ksh-93 present in bash-4.1:
associative arrays
[n]<&word- and [n]>&word- redirections (combination dup and close)
for (( expr1; expr2; expr3 )) ; do list; done - arithmetic for command
@ -1080,6 +1191,8 @@ New things in ksh-93 present in bash-4.0:
the `;&' case statement "fallthrough" pattern list terminator
csh-style history expansion and set -H
negative offsets in ${param:offset:length}
redirection operators preceded with {varname} to store fd number in varname
DEBUG can force skipping following command
Section D: Why does bash do some things differently than other Unix shells?
@ -1641,6 +1754,32 @@ several options to the `shopt' builtin. If the `compat31' option is enabled,
bash reverts to the bash-3.1 behavior with respect to quoting the rhs of
the =~ operator.
E15) Tell me more about the shell compatibility level.
Bash-4.0 introduced the concept of a `shell compatibility level', specified
as a set of options to the shopt builtin (compat31, compat32, compat40 at
this writing). There is only one current compatibility level -- each
option is mutually exclusive. This list does not mention behavior that is
standard for a particular version (e.g., setting compat32 means that quoting
the rhs of the regexp matching operator quotes special regexp characters in
the word, which is default behavior in bash-3.2 and above).
compat31 set
- the < and > operators to the [[ command do not consider the current
locale when comparing strings
- quoting the rhs of the regexp matching operator (=~) has no
special effect
compat32 set
- the < and > operators to the [[ command do not consider the current
locale when comparing strings
compat40 set
- the < and > operators to the [[ command do not consider the current
locale when comparing strings
- interrupting a command list such as "a ; b ; c" causes the execution
of the entire list to be aborted
Section F: Things to watch out for on certain Unix versions
F1) Why can't I use command line editing in my `cmdtool'?
@ -2049,9 +2188,9 @@ Some of the new ksh93 pattern matching operators, like backreferencing
H5) When will the next release appear?
The next version will appear sometime in 2009. Never make predictions.
The next version will appear sometime in 2010. Never make predictions.
This document is Copyright 1995-2009 by Chester Ramey.
This document is Copyright 1995-2010 by Chester Ramey.
Permission is hereby granted, without written agreement and
without license or royalty fees, to use, copy, and distribute

View File

@ -94,7 +94,7 @@ GROFF = groff
HSUSER = $(RL_LIBDIR)/doc/hsuser.texi
RLUSER = $(RL_LIBDIR)/doc/rluser.texi
BASHREF_FILES = $(srcdir)/bashref.texi $(srcdir)/version.texi
BASHREF_FILES = $(srcdir)/bashref.texi $(srcdir)/fdl.texi $(srcdir)/version.texi
.SUFFIXES: .0 .1 .3 .ms .ps .txt .dvi .html .pdf

View File

@ -196,10 +196,11 @@ IINNVVOOCCAATTIIOONN
If the shell is started with the effective user (group) id not equal to
the real user (group) id, and the --pp option is not supplied, no startup
files are read, shell functions are not inherited from the environment,
the SSHHEELLLLOOPPTTSS variable, if it appears in the environment, is ignored,
and the effective user id is set to the real user id. If the --pp option
is supplied at invocation, the startup behavior is the same, but the
effective user id is not reset.
the SSHHEELLLLOOPPTTSS, BBAASSHHOOPPTTSS, CCDDPPAATTHH, and GGLLOOBBIIGGNNOORREE variables, if they
appear in the environment, are ignored, and the effective user id is
set to the real user id. If the --pp option is supplied at invocation,
the startup behavior is the same, but the effective user id is not
reset.
DDEEFFIINNIITTIIOONNSS
The following definitions are used throughout the rest of this docu-
@ -344,6 +345,9 @@ SSHHEELLLL GGRRAAMMMMAARR
tional operators such as --ff must be unquoted to be recognized as
primaries.
When used with [[[[, The << and >> operators sort lexicographically
using the current locale.
When the ==== and !!== operators are used, the string to the right
of the operator is considered a pattern and matched according to
the rules described below under PPaatttteerrnn MMaattcchhiinngg. If the shell
@ -387,7 +391,7 @@ SSHHEELLLL GGRRAAMMMMAARR
of _e_x_p_r_e_s_s_i_o_n_1 is sufficient to determine the return value of
the entire conditional expression.
ffoorr _n_a_m_e [ iinn _w_o_r_d ] ; ddoo _l_i_s_t ; ddoonnee
ffoorr _n_a_m_e [ [ iinn [ _w_o_r_d _._._. ] ] ; ] ddoo _l_i_s_t ; ddoonnee
The list of words following iinn is expanded, generating a list of
items. The variable _n_a_m_e is set to each element of this list in
turn, and _l_i_s_t is executed each time. If the iinn _w_o_r_d is omit-
@ -568,7 +572,8 @@ QQUUOOTTIINNGG
as follows:
\\aa alert (bell)
\\bb backspace
\\ee an escape character
\\ee
\\EE an escape character
\\ff form feed
\\nn new line
\\rr carriage return
@ -576,6 +581,7 @@ QQUUOOTTIINNGG
\\vv vertical tab
\\\\ backslash
\\'' single quote
\\"" double quote
\\_n_n_n the eight-bit character whose value is the octal value
_n_n_n (one to three digits)
\\xx_H_H the eight-bit character whose value is the hexadecimal
@ -585,10 +591,10 @@ QQUUOOTTIINNGG
The expanded result is single-quoted, as if the dollar sign had not
been present.
A double-quoted string preceded by a dollar sign ($$) will cause the
string to be translated according to the current locale. If the cur-
rent locale is CC or PPOOSSIIXX, the dollar sign is ignored. If the string
is translated and replaced, the replacement is double-quoted.
A double-quoted string preceded by a dollar sign ($$"_s_t_r_i_n_g") will cause
the string to be translated according to the current locale. If the
current locale is CC or PPOOSSIIXX, the dollar sign is ignored. If the
string is translated and replaced, the replacement is double-quoted.
PPAARRAAMMEETTEERRSS
A _p_a_r_a_m_e_t_e_r is an entity that stores values. It can be a _n_a_m_e, a num-
@ -692,6 +698,14 @@ PPAARRAAMMEETTEERRSS
BBAASSHH Expands to the full file name used to invoke this instance of
bbaasshh.
BBAASSHHOOPPTTSS
A colon-separated list of enabled shell options. Each word in
the list is a valid argument for the --ss option to the sshhoopptt
builtin command (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). The options
appearing in BBAASSHHOOPPTTSS are those reported as _o_n by sshhoopptt. If
this variable is in the environment when bbaasshh starts up, each
shell option in the list will be enabled before reading any
startup files. This variable is read-only.
BBAASSHHPPIIDD
Expands to the process id of the current bbaasshh process. This
differs from $$$$ under certain circumstances, such as subshells
@ -738,8 +752,8 @@ PPAARRAAMMEETTEERRSS
$${{BBAASSHH__LLIINNEENNOO[[_$_i]]}} is the line number in the source file where
$${{FFUUNNCCNNAAMMEE[[_$_i]]}} was called (or $${{BBAASSHH__LLIINNEENNOO[[_$_i_-_1]]}} if refer-
enced within another shell function). The corresponding source
file name is $${{BBAASSHH__SSOOUURRCCEE[[_$_i]]}}.. UUssee LLIINNEENNOO ttoo oobbttaaiinn tthhee ccuurr--
rreenntt lliinnee nnuummbbeerr..
file name is $${{BBAASSHH__SSOOUURRCCEE[[_$_i]]}}. Use LLIINNEENNOO to obtain the cur-
rent line number.
BBAASSHH__RREEMMAATTCCHH
An array variable whose members are assigned by the ==~~ binary
operator to the [[[[ conditional command. The element with index
@ -805,18 +819,18 @@ PPAARRAAMMEETTEERRSS
below).
CCOOMMPP__WWOORRDDBBRREEAAKKSS
The set of characters that the Readline library treats as word
The set of characters that the rreeaaddlliinnee library treats as word
separators when performing word completion. If CCOOMMPP__WWOORRDDBBRREEAAKKSS
is unset, it loses its special properties, even if it is subse-
quently reset.
CCOOMMPP__WWOORRDDSS
An array variable (see AArrrraayyss below) consisting of the individ-
ual words in the current command line. The words are split on
shell metacharacters as the shell parser would separate them.
This variable is available only in shell functions invoked by
the programmable completion facilities (see PPrrooggrraammmmaabbllee CCoommppllee--
ttiioonn below).
ual words in the current command line. The line is split into
words as rreeaaddlliinnee would split it, using CCOOMMPP__WWOORRDDBBRREEAAKKSS as
described above. This variable is available only in shell func-
tions invoked by the programmable completion facilities (see
PPrrooggrraammmmaabbllee CCoommpplleettiioonn below).
DDIIRRSSTTAACCKK
An array variable (see AArrrraayyss below) containing the current con-
@ -938,6 +952,15 @@ PPAARRAAMMEETTEERRSS
list of directories in which the shell looks for destination
directories specified by the ccdd command. A sample value is
".:~:/usr".
BBAASSHH__XXTTRRAACCEEFFDD
If set to an integer corresponding to a valid file descriptor,
bbaasshh will write the trace output generated when _s_e_t _-_x is
enabled to that file descriptor. The file descriptor is closed
when BBAASSHH__XXTTRRAACCEEFFDD is unset or assigned a new value. Unsetting
BBAASSHH__XXTTRRAACCEEFFDD or assigning it the empty string causes the trace
output to be sent to the standard error. Note that setting
BBAASSHH__XXTTRRAACCEEFFDD to 2 (the standard error file descriptor) and then
unsetting it will result in the standard error being closed.
CCOOLLUUMMNNSS
Used by the sseelleecctt builtin command to determine the terminal
width when printing selection lists. Automatically set upon
@ -1020,9 +1043,9 @@ PPAARRAAMMEETTEERRSS
the shell is running; the next time hostname completion is
attempted after the value is changed, bbaasshh adds the contents of
the new file to the existing list. If HHOOSSTTFFIILLEE is set, but has
no value, bbaasshh attempts to read _/_e_t_c_/_h_o_s_t_s to obtain the list of
possible hostname completions. When HHOOSSTTFFIILLEE is unset, the
hostname list is cleared.
no value, or does not name a readable file, bbaasshh attempts to
read _/_e_t_c_/_h_o_s_t_s to obtain the list of possible hostname comple-
tions. When HHOOSSTTFFIILLEE is unset, the hostname list is cleared.
IIFFSS The _I_n_t_e_r_n_a_l _F_i_e_l_d _S_e_p_a_r_a_t_o_r that is used for word splitting
after expansion and to split lines into words with the rreeaadd
builtin command. The default value is ``<space><tab><new-
@ -1059,7 +1082,7 @@ PPAARRAAMMEETTEERRSS
formatting.
LLIINNEESS Used by the sseelleecctt builtin command to determine the column
length for printing selection lists. Automatically set upon
receipt of a SIGWINCH.
receipt of a SSIIGGWWIINNCCHH.
MMAAIILL If this parameter is set to a file name and the MMAAIILLPPAATTHH vari-
able is not set, bbaasshh informs the user of the arrival of mail in
the specified file.
@ -1104,7 +1127,7 @@ PPAARRAAMMEETTEERRSS
PPRROOMMPPTT__DDIIRRTTRRIIMM
If set to a number greater than zero, the value is used as the
number of trailing directory components to retain when expanding
the \\ww aanndd \\WW pprroommpptt ssttrriinngg eessccaappeess ((sseeee PPRROOMMPPTTIINNGG below).
the \\ww and \\WW prompt string escapes (see PPRROOMMPPTTIINNGG below).
Characters removed are replaced with an ellipsis.
PPSS11 The value of this parameter is expanded (see PPRROOMMPPTTIINNGG below)
and used as the primary prompt string. The default value is
@ -1246,9 +1269,12 @@ PPAARRAAMMEETTEERRSS
ments in the array. Referencing an array variable without a subscript
is equivalent to referencing the array with a subscript of 0.
An array variable is considered set if a subscript has been assigned a
value. The null string is a valid value.
The uunnsseett builtin is used to destroy arrays. uunnsseett _n_a_m_e[_s_u_b_s_c_r_i_p_t]
destroys the array element at index _s_u_b_s_c_r_i_p_t. Care must be taken to
avoid unwanted side effects caused by filename generation. uunnsseett _n_a_m_e,
avoid unwanted side effects caused by pathname expansion. uunnsseett _n_a_m_e,
where _n_a_m_e is an array, or uunnsseett _n_a_m_e[_s_u_b_s_c_r_i_p_t], where _s_u_b_s_c_r_i_p_t is **
or @@, removes the entire array.
@ -1382,15 +1408,15 @@ EEXXPPAANNSSIIOONN
digit, or when _p_a_r_a_m_e_t_e_r is followed by a character which is not
to be interpreted as part of its name.
If the first character of _p_a_r_a_m_e_t_e_r is an exclamation point, a level of
variable indirection is introduced. BBaasshh uses the value of the vari-
able formed from the rest of _p_a_r_a_m_e_t_e_r 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 _p_a_r_a_m_e_t_e_r itself. This is
known as _i_n_d_i_r_e_c_t _e_x_p_a_n_s_i_o_n. The exceptions to this are the expansions
of ${!_p_r_e_f_i_x*} and ${!!_n_a_m_e[_@]} described below. The exclamation point
must immediately follow the left brace in order to introduce indirec-
tion.
If the first character of _p_a_r_a_m_e_t_e_r is an exclamation point (!!), a
level of variable indirection is introduced. BBaasshh uses the value of
the variable formed from the rest of _p_a_r_a_m_e_t_e_r as the name of the vari-
able; this variable is then expanded and that value is used in the rest
of the substitution, rather than the value of _p_a_r_a_m_e_t_e_r itself. This
is known as _i_n_d_i_r_e_c_t _e_x_p_a_n_s_i_o_n. The exceptions to this are the expan-
sions of ${!_p_r_e_f_i_x*} and ${!!_n_a_m_e[_@]} described below. The exclamation
point must immediately follow the left brace in order to introduce
indirection.
In each of the cases below, _w_o_r_d is subject to tilde expansion, parame-
ter expansion, command substitution, and arithmetic expansion.
@ -1655,7 +1681,7 @@ EEXXPPAANNSSIIOONN
The special pattern characters have the following meanings:
** Matches any string, including the null string. When the gglloobb--
ssttaarr shell option is enabled, and ** is used in a filename expan-
ssttaarr shell option is enabled, and ** is used in a pathname expan-
sion context, two adjacent **s used as a single pattern will
match all files and zero or more directories and subdirectories.
If followed by a //, two adjacent **s will match only directories
@ -1720,6 +1746,13 @@ RREEDDIIRREECCTTIIOONN
anywhere within a _s_i_m_p_l_e _c_o_m_m_a_n_d or may follow a _c_o_m_m_a_n_d. Redirections
are processed in the order they appear, from left to right.
Each redirection that may be preceded by a file descriptor number may
instead be preceded by a word of the form {_v_a_r_n_a_m_e}. In this case, for
each redirection operator except >&- and <&-, the shell will allocate a
file descriptor greater than 10 and assign it to _v_a_r_n_a_m_e. If >&- or
<&- is preceded by {_v_a_r_n_a_m_e}, the value of _v_a_r_n_a_m_e defines the file
descriptor to close.
In the following descriptions, if the file descriptor number is omit-
ted, and the first character of the redirection operator is <<, the re-
direction refers to the standard input (file descriptor 0). If the
@ -1743,8 +1776,8 @@ RREEDDIIRREECCTTIIOONN
ls 2>>&&1 >> dirlist
directs only the standard output to file _d_i_r_l_i_s_t, because the standard
error was duplicated as standard output before the standard output was
redirected to _d_i_r_l_i_s_t.
error was duplicated from the standard output before the standard out-
put was redirected to _d_i_r_l_i_s_t.
BBaasshh handles several filenames specially when they are used in redirec-
tions, as described in the following table:
@ -1979,14 +2012,17 @@ FFUUNNCCTTIIOONNSS
positional parameters during its execution. The special parameter ## is
updated to reflect the change. Special parameter 0 is unchanged. The
first element of the FFUUNNCCNNAAMMEE variable is set to the name of the func-
tion 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 DDEEBBUUGG and RREETTUURRNN traps (see the description
of the ttrraapp builtin under SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below) are not inher-
ited unless the function has been given the ttrraaccee attribute (see the
description of the ddeeccllaarree builtin below) or the --oo ffuunnccttrraaccee shell
option has been enabled with the sseett builtin (in which case all func-
tions inherit the DDEEBBUUGG and RREETTUURRNN traps).
tion while the function is executing.
All other aspects of the shell execution environment are identical
between a function and its caller with these exceptions: the DDEEBBUUGG and
RREETTUURRNN traps (see the description of the ttrraapp builtin under SSHHEELLLL
BBUUIILLTTIINN CCOOMMMMAANNDDSS below) are not inherited unless the function has been
given the ttrraaccee attribute (see the description of the ddeeccllaarree builtin
below) or the --oo ffuunnccttrraaccee shell option has been enabled with the sseett
builtin (in which case all functions inherit the DDEEBBUUGG and RREETTUURRNN
traps), and the EERRRR trap is not inherited unless the --oo eerrrrttrraaccee shell
option has been enabled.
Variables local to the function may be declared with the llooccaall builtin
command. Ordinarily, variables and their values are shared between the
@ -2087,6 +2123,9 @@ CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS
bolic links and operate on the target of the link, rather than the link
itself.
When used with [[[[, The << and >> operators sort lexicographically using
the current locale.
--aa _f_i_l_e
True if _f_i_l_e exists.
--bb _f_i_l_e
@ -2149,19 +2188,18 @@ CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS
True if the length of _s_t_r_i_n_g is non-zero.
_s_t_r_i_n_g_1 ==== _s_t_r_i_n_g_2
True if the strings are equal. == may be used in place of ==== for
strict POSIX compliance.
_s_t_r_i_n_g_1 == _s_t_r_i_n_g_2
True if the strings are equal. == should be used with the tteesstt
command for POSIX conformance.
_s_t_r_i_n_g_1 !!== _s_t_r_i_n_g_2
True if the strings are not equal.
_s_t_r_i_n_g_1 << _s_t_r_i_n_g_2
True if _s_t_r_i_n_g_1 sorts before _s_t_r_i_n_g_2 lexicographically in the
current locale.
True if _s_t_r_i_n_g_1 sorts before _s_t_r_i_n_g_2 lexicographically.
_s_t_r_i_n_g_1 >> _s_t_r_i_n_g_2
True if _s_t_r_i_n_g_1 sorts after _s_t_r_i_n_g_2 lexicographically in the
current locale.
True if _s_t_r_i_n_g_1 sorts after _s_t_r_i_n_g_2 lexicographically.
_a_r_g_1 OOPP _a_r_g_2
OOPP is one of --eeqq, --nnee, --lltt, --llee, --ggtt, or --ggee. These arithmetic
@ -2283,7 +2321,7 @@ CCOOMMMMAANNDD EEXXEECCUUTTIIOONN EENNVVIIRROONNMMEENN
+o shell aliases defined with aalliiaass
+o various process IDs, including those of background jobs, the
value of $$$$, and the value of $$PPPPIIDD
value of $$$$, and the value of PPPPIIDD
When a simple command other than a builtin or shell function is to be
executed, it is invoked in a separate execution environment that con-
@ -2418,7 +2456,8 @@ JJOOBB CCOONNTTRROOLL
_J_o_b _c_o_n_t_r_o_l refers to the ability to selectively stop (_s_u_s_p_e_n_d) the
execution of processes and continue (_r_e_s_u_m_e) their execution at a later
point. A user typically employs this facility via an interactive
interface supplied jointly by the system's terminal driver and bbaasshh.
interface supplied jointly by the operating system kernel's terminal
driver and bbaasshh.
The shell associates a _j_o_b with each pipeline. It keeps a table of
currently executing jobs, which may be listed with the jjoobbss command.
@ -2439,10 +2478,12 @@ JJOOBB CCOONNTTRROOLL
generated signals such as SSIIGGIINNTT. These processes are said to be in
the _f_o_r_e_g_r_o_u_n_d. _B_a_c_k_g_r_o_u_n_d processes are those whose process group ID
differs from the terminal's; such processes are immune to keyboard-gen-
erated signals. Only foreground processes are allowed to read from or
write to the terminal. Background processes which attempt to read from
(write to) the terminal are sent a SSIIGGTTTTIINN ((SSIIGGTTTTOOUU)) signal by the ter-
minal driver, which, unless caught, suspends the process.
erated signals. Only foreground processes are allowed to read from or,
if the user so specifies with stty tostop, write to the terminal.
Background processes which attempt to read from (write to when stty
tostop is in effect) the terminal are sent a SSIIGGTTTTIINN ((SSIIGGTTTTOOUU)) signal
by the kernel's terminal driver, which, unless caught, suspends the
process.
If the operating system on which bbaasshh is running supports job control,
bbaasshh contains facilities to use it. Typing the _s_u_s_p_e_n_d character (typ-
@ -2524,7 +2565,8 @@ PPRROOMMPPTTIINNGG
\\vv the version of bbaasshh (e.g., 2.00)
\\VV the release of bbaasshh, version + patch level (e.g., 2.00.0)
\\ww the current working directory, with $$HHOOMMEE abbreviated
with a tilde (uses the $$PPRROOMMPPTT__DDIIRRTTRRIIMM variable)
with a tilde (uses the value of the PPRROOMMPPTT__DDIIRRTTRRIIMM vari-
able)
\\WW the basename of the current working directory, with $$HHOOMMEE
abbreviated with a tilde
\\!! the history number of this command
@ -2731,10 +2773,18 @@ RREEAADDLLIINNEE
Controls whether readline begins with a set of key bindings sim-
ilar to _e_m_a_c_s or _v_i. eeddiittiinngg--mmooddee can be set to either eemmaaccss or
vvii.
eecchhoo--ccoonnttrrooll--cchhaarraacctteerrss ((OOnn))
When set to OOnn, on operating systems that indicate they support
it, readline echoes a character corresponding to a signal gener-
ated from the keyboard.
eennaabbllee--kkeeyyppaadd ((OOffff))
When set to OOnn, readline will try to enable the application key-
pad when it is called. Some systems need this to enable the
arrow keys.
eennaabbllee--mmeettaa--kkeeyy ((OOnn))
When set to OOnn, readline will try to enable any meta modifier
key the terminal claims to support when it is called. On many
terminals, the meta key is used to send eight-bit characters.
eexxppaanndd--ttiillddee ((OOffff))
If set to oonn, tilde expansion is performed when readline
attempts word completion.
@ -2808,6 +2858,13 @@ RREEAADDLLIINNEE
ble partial completion (the possible completions don't share a
common prefix) cause the matches to be listed immediately
instead of ringing the bell.
sskkiipp--ccoommpplleetteedd--tteexxtt ((OOffff))
If set to OOnn, this alters the default completion behavior when
inserting a single match into the line. It's only active when
performing completion in the middle of a word. If enabled,
readline does not insert characters from the completion that
match characters after point in the word being completed, so
portions of the word following the cursor are not duplicated.
vviissiibbllee--ssttaattss ((OOffff))
If set to OOnn, a character denoting a file's type as reported by
_s_t_a_t(2) is appended to the filename when listing possible com-
@ -3157,7 +3214,11 @@ RREEAADDLLIINNEE
moves _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 TTAABB, but is unbound by
default.
default.cc
mmeennuu--ccoommpplleettee--kkrrdd
Identicwwal to mmeennuu--ccoommpplleettee, but moves backward through the list
of possible completions, as if mmeennuu--ccoommpplleettee had been given a
negative argument. This command is unbound by default.
ddeelleettee--cchhaarr--oorr--lliisstt
Deletes the character under the cursor if not at the beginning
or end of the line (like ddeelleettee--cchhaarr). If at the end of the
@ -3253,6 +3314,14 @@ RREEAADDLLIINNEE
A character is read and point is moved to the previous occur-
rence of that character. A negative count searches for subse-
quent occurrences.
sskkiipp--ccssii--sseeqquueennccee (())
Read enough characters to consume a multi-key sequence such as
those defined for keys like Home and End. Such sequences begin
with a Control Sequence Indicator (CSI), usually ESC-[. If this
sequence is bound to "\[", keys producing such sequences will
have no effect unless explicitly bound to a readline command,
instead of inserting stray characters into the editing buffer.
This is unbound by default, but usually bound to ESC-[.
iinnsseerrtt--ccoommmmeenntt ((MM--##))
Without a numeric argument, the value of the readline ccoomm--
mmeenntt--bbeeggiinn variable is inserted at the beginning of the current
@ -3304,12 +3373,16 @@ RREEAADDLLIINNEE
the ccoommpplleettee builtin (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below), the pro-
grammable 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.
First, the command name is identified. If the command word is the
empty string (completion attempted at the beginning of an empty line),
any compspec defined with the --EE option to ccoommpplleettee is used. 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.
If those searches to not result in a compspec, any compspec defined
with the --DD option to ccoommpplleettee is used as the default.
Once a compspec has been found, it is used to generate the list of
matching words. If a compspec is not found, the default bbaasshh comple-
@ -3320,7 +3393,7 @@ RREEAADDLLIINNEE
--ff or --dd option is used for filename or directory name completion, the
shell variable FFIIGGNNOORREE is used to filter the matches.
Any completions specified by a filename expansion pattern to the --GG
Any completions specified by a pathname expansion pattern to the --GG
option are generated next. The words generated by the pattern need not
match the word being completed. The GGLLOOBBIIGGNNOORREE shell variable is not
used to filter the matches, but the FFIIGGNNOORREE variable is used.
@ -3395,6 +3468,29 @@ RREEAADDLLIINNEE
the value of the mmaarrkk--ddiirreeccttoorriieess readline variable, regardless of the
setting of the mmaarrkk--ssyymmlliinnkkeedd--ddiirreeccttoorriieess readline variable.
There is some support for dynamically modifying completions. This is
most useful when used in combination with a default completion speci-
fied with ccoommpplleettee --DD. It's possible for shell functions executed as
completion handlers to indicate that completion should be retried by
returning an exit status of 124. If a shell function returns 124, and
changes the compspec associated with the command on which completion is
being attempted (supplied as the first argument when the function is
executed), programmable completion restarts from the beginning, with an
attempt to find a compspec for that command. This allows a set of com-
pletions to be built dynamically as completion is attempted, rather
than being loaded all at once.
For instance, assuming that there is a library of compspecs, each kept
in a file corresponding to the name of the command, the following
default completion function would load completions dynamically:
_completion_loader()
{
. "/etc/bash_completion.d/$1.sh" >/dev/null 2>&1 && return 124
}
complete -D -F _completion_loader
HHIISSTTOORRYY
When the --oo hhiissttoorryy option to the sseett builtin is enabled, the shell
provides access to the _c_o_m_m_a_n_d _h_i_s_t_o_r_y, the list of commands previously
@ -3418,13 +3514,13 @@ HHIISSTTOORRYY
the description of sshhoopptt under SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below), the lines
are appended to the history file, otherwise the history file is over-
written. If HHIISSTTFFIILLEE is unset, or if the history file is unwritable,
the history is not saved. If the variable is set, time stamps are
written to the history file, marked with the history comment character,
so they may be preserved across shell sessions. This uses the history
comment character to distinguish timestamps from other history lines.
After saving the history, the history file is truncated to contain no
more than HHIISSTTFFIILLEESSIIZZEE lines. If HHIISSTTFFIILLEESSIIZZEE is not set, no trunca-
tion is performed.
the history is not saved. If the HHIISSTTTTIIMMEEFFOORRMMAATT variable is set, time
stamps are written to the history file, marked with the history comment
character, so they may be preserved across shell sessions. This uses
the history comment character to distinguish timestamps from other his-
tory lines. After saving the history, the history file is truncated to
contain no more than HHIISSTTFFIILLEESSIIZZEE lines. If HHIISSTTFFIILLEESSIIZZEE is not set,
no truncation is performed.
The builtin command ffcc (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below) may be used
to list or edit and re-execute a portion of the history list. The hhiiss--
@ -3478,17 +3574,17 @@ HHIISSTTOORRYY EEXXPPAANNSSIIOONN
Several shell options settable with the sshhoopptt builtin may be used to
tailor the behavior of history expansion. If the hhiissttvveerriiffyy shell
option is enabled (see the description of the sshhoopptt builtin), and rreeaadd--
lliinnee is being used, history substitutions are not immediately passed to
the shell parser. Instead, the expanded line is reloaded into the
rreeaaddlliinnee editing buffer for further modification. If rreeaaddlliinnee is being
used, and the hhiissttrreeeeddiitt shell option is enabled, a failed history sub-
stitution will be reloaded into the rreeaaddlliinnee editing buffer for correc-
tion. The --pp option to the hhiissttoorryy builtin command may be used to see
what a history expansion will do before using it. The --ss option to the
hhiissttoorryy 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.
option is enabled (see the description of the sshhoopptt builtin below), and
rreeaaddlliinnee is being used, history substitutions are not immediately
passed to the shell parser. Instead, the expanded line is reloaded
into the rreeaaddlliinnee editing buffer for further modification. If rreeaaddlliinnee
is being used, and the hhiissttrreeeeddiitt shell option is enabled, a failed
history substitution will be reloaded into the rreeaaddlliinnee editing buffer
for correction. The --pp option to the hhiissttoorryy builtin command may be
used to see what a history expansion will do before using it. The --ss
option to the hhiissttoorryy 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.
The shell allows control of the various characters used by the history
expansion mechanism (see the description of hhiissttcchhaarrss above under SShheellll
@ -3574,8 +3670,12 @@ HHIISSTTOORRYY EEXXPPAANNSSIIOONN
SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
Unless otherwise noted, each builtin command documented in this section
as accepting options preceded by -- accepts ---- to signify the end of the
options. For example, the ::, ttrruuee, ffaallssee, and tteesstt builtins do not
accept options.
options. The ::, ttrruuee, ffaallssee, and tteesstt builtins do not accept options
and do not treat ---- specially. The eexxiitt, llooggoouutt, bbrreeaakk, ccoonnttiinnuuee, lleett,
and sshhiifftt builtins accept and process arguments beginning with -- with-
out requiring ----. Other builtins that accept arguments but are not
specified as accepting options interpret arguments beginning with -- as
invalid options and require ---- to prevent this interpretation.
:: [_a_r_g_u_m_e_n_t_s]
No effect; the command does nothing beyond expanding _a_r_g_u_m_e_n_t_s
and performing any specified redirections. A zero exit code is
@ -3744,18 +3844,22 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
The return value is true unless an invalid option is supplied,
or no matches were generated.
ccoommpplleettee [--aabbccddeeffggjjkkssuuvv] [--oo _c_o_m_p_-_o_p_t_i_o_n] [--EE] [--AA _a_c_t_i_o_n] [--GG _g_l_o_b_p_a_t]
[--WW _w_o_r_d_l_i_s_t] [--FF _f_u_n_c_t_i_o_n] [--CC _c_o_m_m_a_n_d]
ccoommpplleettee [--aabbccddeeffggjjkkssuuvv] [--oo _c_o_m_p_-_o_p_t_i_o_n] [--DDEE] [--AA _a_c_t_i_o_n] [--GG _g_l_o_b_-
_p_a_t] [--WW _w_o_r_d_l_i_s_t] [--FF _f_u_n_c_t_i_o_n] [--CC _c_o_m_m_a_n_d]
[--XX _f_i_l_t_e_r_p_a_t] [--PP _p_r_e_f_i_x] [--SS _s_u_f_f_i_x] _n_a_m_e [_n_a_m_e _._._.]
ccoommpplleettee --pprr [--EE] [_n_a_m_e ...]
ccoommpplleettee --pprr [--DDEE] [_n_a_m_e ...]
Specify how arguments to each _n_a_m_e should be completed. If the
--pp 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 --rr option removes a completion spec-
ification for each _n_a_m_e, or, if no _n_a_m_es are supplied, all com-
pletion specifications. The --EE option indicates that the
remaining options and actions should apply to ``empty'' command
completion; that is, completion attempted on a blank line.
pletion specifications. The --DD option indicates that the
remaining options and actions should apply to the ``default''
command completion; that is, completion attempted on a command
for which no completion has previously been defined. The --EE
option indicates that the remaining options and actions should
apply to ``empty'' command completion; that is, completion
attempted on a blank line.
The process of applying these completion specifications when
word completion is attempted is described above under PPrroo--
@ -3835,7 +3939,7 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
Names of all shell variables. May also be spec-
ified as --vv.
--GG _g_l_o_b_p_a_t
The filename expansion pattern _g_l_o_b_p_a_t is expanded to
The pathname expansion pattern _g_l_o_b_p_a_t is expanded to
generate the possible completions.
--WW _w_o_r_d_l_i_s_t
The _w_o_r_d_l_i_s_t is split using the characters in the IIFFSS
@ -3852,7 +3956,7 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
pletions are retrieved from the value of the CCOOMMPPRREEPPLLYY
array variable.
--XX _f_i_l_t_e_r_p_a_t
_f_i_l_t_e_r_p_a_t is a pattern as used for filename expansion.
_f_i_l_t_e_r_p_a_t is a pattern as used for pathname expansion.
It is applied to the list of possible completions gener-
ated by the preceding options and arguments, and each
completion matching _f_i_l_t_e_r_p_a_t is removed from the list.
@ -3871,13 +3975,18 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
for a _n_a_m_e for which no specification exists, or an error occurs
adding a completion specification.
ccoommppoopptt [--oo _o_p_t_i_o_n] [++oo _o_p_t_i_o_n] [_n_a_m_e]
ccoommppoopptt [--oo _o_p_t_i_o_n] [--DDEE] [++oo _o_p_t_i_o_n] [_n_a_m_e]
Modify completion options for each _n_a_m_e according to the
_o_p_t_i_o_ns, or for the currently-execution completion if no _n_a_m_es
are supplied. If no _o_p_t_i_o_ns are given, display the completion
options for each _n_a_m_e or the current completion. The possible
values of _o_p_t_i_o_n are those valid for the ccoommpplleettee builtin
described above.
described above. The --DD option indicates that the remaining
options should apply to the ``default'' command completion; that
is, completion attempted on a command for which no completion
has previously been defined. The --EE option indicates that the
remaining options should apply to ``empty'' command completion;
that is, completion attempted on a blank line.
The return value is true unless an invalid option is supplied, an
attempt is made to modify the options for a _n_a_m_e for which no comple-
@ -3915,8 +4024,8 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
above).
--ff Use function names only.
--ii The variable is treated as an integer; arithmetic evalua-
tion (see AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN )) is performed when the
variable is assigned a value.
tion (see AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN above) is performed when
the variable is assigned a value.
--ll When the variable is assigned a value, all upper-case
characters are converted to lower-case. The upper-case
attribute is disabled.
@ -3934,8 +4043,8 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
Using `+' instead of `-' turns off the attribute instead, with
the exceptions that ++aa may not be used to destroy an array vari-
able and ++rr wwiillll nnoott rreemmoovvee tthhee rreeaaddoonnllyy aattttrriibbuuttee.. WWhheenn uusseedd
iinn aa ffuunnccttiioonn,, mmaakkeess eeaacchh _n_a_m_e llooccaall,, aass wwiitthh tthhee llooccaall command.
able and ++rr will not remove the readonly attribute. When used
in a function, makes each _n_a_m_e local, as with the llooccaall command.
If a variable name is followed by =_v_a_l_u_e, the value of the vari-
able is set to _v_a_l_u_e. The return value is 0 unless an invalid
option is encountered, an attempt is made to define a function
@ -3973,9 +4082,9 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
ddiissoowwnn [--aarr] [--hh] [_j_o_b_s_p_e_c ...]
Without options, each _j_o_b_s_p_e_c is removed from the table of
active jobs. If _j_o_b_s_p_e_c is not present, and neither --aa nnoorr --rr
iiss ssuupppplliieedd,, tthhee sshheellll''ss nnoottiioonn ooff tthhee _c_u_r_r_e_n_t _j_o_b iiss uusseedd.. IIff
tthhee --hh ooppttiioonn iiss ggiivveenn,, eeaacchh _j_o_b_s_p_e_c is not removed from the ta-
active jobs. If _j_o_b_s_p_e_c is not present, and neither --aa nor --rr
is supplied, the shell's notion of the _c_u_r_r_e_n_t _j_o_b is used. If
the --hh option is given, each _j_o_b_s_p_e_c is not removed from the ta-
ble, but is marked so that SSIIGGHHUUPP is not sent to the job if the
shell receives a SSIIGGHHUUPP. If no _j_o_b_s_p_e_c is present, and neither
the --aa nor the --rr option is supplied, the _c_u_r_r_e_n_t _j_o_b is used.
@ -4228,16 +4337,16 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
The last command in the history list is removed before
the _a_r_g_s are added.
If the HHIISSTTTTIIMMEEFFOORRMMAATT is set, the time stamp information associ-
ated with each history entry is written to the history file,
marked with the history comment character. When the history
file is read, lines beginning with the history comment character
followed immediately by a digit are interpreted as timestamps
for the previous history line. The return value is 0 unless an
invalid option is encountered, an error occurs while reading or
writing the history file, an invalid _o_f_f_s_e_t is supplied as an
argument to --dd, or the history expansion supplied as an argument
to --pp fails.
If the HHIISSTTTTIIMMEEFFOORRMMAATT variable is set, the time stamp informa-
tion associated with each history entry is written to the his-
tory file, marked with the history comment character. When the
history file is read, lines beginning with the history comment
character followed immediately by a digit are interpreted as
timestamps for the previous history line. The return value is 0
unless an invalid option is encountered, an error occurs while
reading or writing the history file, an invalid _o_f_f_s_e_t is sup-
plied as an argument to --dd, or the history expansion supplied as
an argument to --pp fails.
jjoobbss [--llnnpprrss] [ _j_o_b_s_p_e_c ... ]
jjoobbss --xx _c_o_m_m_a_n_d [ _a_r_g_s ... ]
@ -4276,8 +4385,8 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
lleett _a_r_g [_a_r_g ...]
Each _a_r_g is an arithmetic expression to be evaluated (see AARRIITTHH--
MMEETTIICC EEVVAALLUUAATTIIOONN). If the last _a_r_g evaluates to 0, lleett returns
1; 0 is returned otherwise.
MMEETTIICC EEVVAALLUUAATTIIOONN above). If the last _a_r_g evaluates to 0, lleett
returns 1; 0 is returned otherwise.
llooccaall [_o_p_t_i_o_n] [_n_a_m_e[=_v_a_l_u_e] ...]
For each argument, a local variable named _n_a_m_e is created, and
@ -4296,16 +4405,16 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
[--cc _q_u_a_n_t_u_m] [_a_r_r_a_y]
rreeaaddaarrrraayy [--nn _c_o_u_n_t] [--OO _o_r_i_g_i_n] [--ss _c_o_u_n_t] [--tt] [--uu _f_d] [--CC _c_a_l_l_b_a_c_k]
[--cc _q_u_a_n_t_u_m] [_a_r_r_a_y]
Read lines from the standard input into array variable _a_r_r_a_y, or
from file descriptor _f_d if the --uu option is supplied. The vari-
able MMAAPPFFIILLEE is the default _a_r_r_a_y. Options, if supplied, have
the following meanings:
Read lines from the standard input into the indexed array vari-
able _a_r_r_a_y, or from file descriptor _f_d if the --uu option is sup-
plied. The variable MMAAPPFFIILLEE is the default _a_r_r_a_y. Options, if
supplied, have the following meanings:
--nn Copy at most _c_o_u_n_t lines. If _c_o_u_n_t is 0, all lines are
copied.
--OO Begin assigning to _a_r_r_a_y at index _o_r_i_g_i_n. The default
index is 0.
--ss Discard the first _c_o_u_n_t lines read.
--tt Remove a trailing line from each line read.
--tt Remove a trailing newline from each line read.
--uu Read lines from file descriptor _f_d instead of the stan-
dard input.
--CC Evaluate _c_a_l_l_b_a_c_k each time _q_u_a_n_t_u_m lines are read. The
@ -4323,7 +4432,8 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
_a_r_r_a_y before assigning to it.
mmaappffiillee returns successfully unless an invalid option or option
argument is supplied, or _a_r_r_a_y is invalid or unassignable.
argument is supplied, _a_r_r_a_y is invalid or unassignable, or if
_a_r_r_a_y is not an indexed array.
ppooppdd [-nn] [+_n] [-_n]
Removes entries from the directory stack. With no arguments,
@ -4406,8 +4516,8 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
occurs while reading the name of the current directory or an
invalid option is supplied.
rreeaadd [--eerrss] [--aa _a_n_a_m_e] [--dd _d_e_l_i_m] [-- _t_e_x_t] [--nn _n_c_h_a_r_s] [--pp _p_r_o_m_p_t] [--tt
_t_i_m_e_o_u_t] [--uu _f_d] [_n_a_m_e ...]
rreeaadd [--eerrss] [--aa _a_n_a_m_e] [--dd _d_e_l_i_m] [--ii _t_e_x_t] [--nn _n_c_h_a_r_s] [--NN _n_c_h_a_r_s] [--pp
_p_r_o_m_p_t] [--tt _t_i_m_e_o_u_t] [--uu _f_d] [_n_a_m_e ...]
One line is read from the standard input, or from the file
descriptor _f_d supplied as an argument to the --uu option, and the
first word is assigned to the first _n_a_m_e, the second word to the
@ -4436,7 +4546,16 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
placed into the editing buffer before editing begins.
--nn _n_c_h_a_r_s
rreeaadd returns after reading _n_c_h_a_r_s characters rather than
waiting for a complete line of input.
waiting for a complete line of input, but honor a delim-
iter if fewer than _n_c_h_a_r_s characters are read before the
delimiter.
--NN _n_c_h_a_r_s
rreeaadd returns after reading exactly _n_c_h_a_r_s characters
rather than waiting for a complete line of input, unless
EOF is encountered or rreeaadd times out. Delimiter charac-
ters encountered in the input are not treated specially
and do not cause rreeaadd to return until _n_c_h_a_r_s characters
are read.
--pp _p_r_o_m_p_t
Display _p_r_o_m_p_t on standard error, without a trailing new-
line, before attempting to read any input. The prompt is
@ -4511,18 +4630,23 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
--bb Report the status of terminated background jobs immedi-
ately, rather than before the next primary prompt. This
is effective only when job control is enabled.
--ee Exit immediately if a _s_i_m_p_l_e _c_o_m_m_a_n_d (see SSHHEELLLL GGRRAAMMMMAARR
--ee Exit immediately if a _p_i_p_e_l_i_n_e (which may consist of a
single _s_i_m_p_l_e _c_o_m_m_a_n_d), a _s_u_b_s_h_e_l_l command enclosed in
parentheses, or one of the commands executed as part of
a command list enclosed by braces (see SSHHEELLLL GGRRAAMMMMAARR
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 wwhhiillee or uunnttiill keyword,
part of the test in an iiff statement, part of a command
executed in a &&&& or |||| list, any command in a pipeline
but the last, or if the command's return value is being
inverted via !!. Failing simple commands that are part
of shell functions or command lists enclosed in braces
or parentheses satisfying the above conditions do not
cause the shell to exit. A trap on EERRRR, if set, is exe-
cuted before the shell exits.
part of the test following the iiff or eelliiff reserved
words, part of any command executed in a &&&& or |||| list
except the command following the final &&&& or ||||, any
command in a pipeline but the last, or if the command's
return value is being inverted with !!. A trap on EERRRR,
if set, is executed before the shell exits. This option
applies to the shell environment and each subshell envi-
ronment separately (see CCOOMMMMAANNDD EEXXEECCUUTTIIOONN EENNVVIIRROONNMMEENNTT
above), and may cause subshells to exit before executing
all the commands in the subshell.
--ff Disable pathname expansion.
--hh Remember the location of commands as they are looked up
for execution. This is enabled by default.
@ -4549,11 +4673,11 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
is interactive, unless the shell is started with
the ----nnooeeddiittiinngg option. This also affects the
editing interface used for rreeaadd --ee.
eerrrreexxiitt Same as --ee.
eerrrrttrraaccee
Same as --EE.
ffuunnccttrraaccee
Same as --TT.
eerrrreexxiitt Same as --ee.
hhaasshhaallll Same as --hh.
hhiisstteexxppaanndd
Same as --HH.
@ -4600,20 +4724,22 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
--pp Turn on _p_r_i_v_i_l_e_g_e_d mode. In this mode, the $$EENNVV and
$$BBAASSHH__EENNVV files are not processed, shell functions are
not inherited from the environment, and the SSHHEELLLLOOPPTTSS,
CCDDPPAATTHH, and GGLLOOBBIIGGNNOORREE variables, if they appear in the
environment, are ignored. If the shell is started with
the effective user (group) id not equal to the real user
(group) id, and the --pp option is not supplied, these
actions are taken and the effective user id is set to
the real user id. If the --pp option is supplied at
startup, the effective user id is not reset. Turning
this option off causes the effective user and group ids
to be set to the real user and group ids.
BBAASSHHOOPPTTSS, CCDDPPAATTHH, and GGLLOOBBIIGGNNOORREE variables, if they
appear in the environment, are ignored. If the shell is
started with the effective user (group) id not equal to
the real user (group) id, and the --pp option is not sup-
plied, these actions are taken and the effective user id
is set to the real user id. If the --pp option is sup-
plied at startup, the effective user id is not reset.
Turning this option off causes the effective user and
group ids to be set to the real user and group ids.
--tt Exit after reading and executing one command.
--uu Treat unset variables as an error when performing param-
eter expansion. If expansion is attempted on an unset
variable, the shell prints an error message, and, if not
interactive, exits with a non-zero status.
--uu Treat unset variables and parameters other than the spe-
cial parameters "@" and "*" as an error when performing
parameter expansion. If expansion is attempted on an
unset variable or parameter, the shell prints an error
message, and, if not interactive, exits with a non-zero
status.
--vv Print shell input lines as they are read.
--xx After expanding each _s_i_m_p_l_e _c_o_m_m_a_n_d, ffoorr command, ccaassee
command, sseelleecctt command, or arithmetic ffoorr command, dis-
@ -4732,6 +4858,15 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
If set, bbaasshh changes its behavior to that of version 3.1
with respect to quoted arguments to the conditional com-
mand's =~ operator.
ccoommppaatt3322
If set, bbaasshh changes its behavior to that of version 3.2
with respect to locale-specific string comparison when
using the conditional command's < and > operators.
ccoommppaatt4400
If set, bbaasshh changes its behavior to that of version 4.0
with respect to locale-specific string comparison when
using the conditional command's < and > operators and
the effect of interrupting a command list.
ddiirrssppeellll
If set, bbaasshh attempts spelling correction on directory
names during word completion if the directory name ini-
@ -4786,7 +4921,7 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
description of FFIIGGNNOORREE. This option is enabled by
default.
gglloobbssttaarr
If set, the pattern **** used in a filename expansion con-
If set, the pattern **** used in a pathname expansion con-
text will match a files and zero or more directories and
subdirectories. If the pattern is followed by a //, only
directories and subdirectories match.
@ -4955,28 +5090,33 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
causes the shell to print a list of signal names and their cor-
responding numbers. Each _s_i_g_s_p_e_c is either a signal name
defined in <_s_i_g_n_a_l_._h>, or a signal number. Signal names are
case insensitive and the SIG prefix is optional. If a _s_i_g_s_p_e_c
is EEXXIITT (0) the command _a_r_g is executed on exit from the shell.
If a _s_i_g_s_p_e_c is DDEEBBUUGG, the command _a_r_g is executed before every
_s_i_m_p_l_e _c_o_m_m_a_n_d, _f_o_r command, _c_a_s_e command, _s_e_l_e_c_t command, every
arithmetic _f_o_r command, and before the first command executes in
a shell function (see SSHHEELLLL GGRRAAMMMMAARR above). Refer to the
description of the eexxttddeebbuugg option to the sshhoopptt builtin for
details of its effect on the DDEEBBUUGG trap. If a _s_i_g_s_p_e_c is EERRRR,
the command _a_r_g is executed whenever a simple command has a
non-zero exit status, subject to the following conditions. The
EERRRR trap is not executed if the failed command is part of the
command list immediately following a wwhhiillee or uunnttiill keyword,
part of the test in an _i_f statement, part of a command executed
in a &&&& or |||| list, or if the command's return value is being
inverted via !!. These are the same conditions obeyed by the
eerrrreexxiitt option. If a _s_i_g_s_p_e_c is RREETTUURRNN, the command _a_r_g is exe-
cuted each time a shell function or a script executed with the ..
or ssoouurrccee builtins finishes executing. Signals ignored upon
entry to the shell cannot be trapped or reset. Trapped signals
that are not being ignored are reset to their original values in
a child process when it is created. The return status is false
if any _s_i_g_s_p_e_c is invalid; otherwise ttrraapp returns true.
case insensitive and the SIG prefix is optional.
If a _s_i_g_s_p_e_c is EEXXIITT (0) the command _a_r_g is executed on exit
from the shell. If a _s_i_g_s_p_e_c is DDEEBBUUGG, the command _a_r_g is exe-
cuted before every _s_i_m_p_l_e _c_o_m_m_a_n_d, _f_o_r command, _c_a_s_e command,
_s_e_l_e_c_t command, every arithmetic _f_o_r command, and before the
first command executes in a shell function (see SSHHEELLLL GGRRAAMMMMAARR
above). Refer to the description of the eexxttddeebbuugg option to the
sshhoopptt builtin for details of its effect on the DDEEBBUUGG trap. If a
_s_i_g_s_p_e_c is RREETTUURRNN, the command _a_r_g is executed each time a shell
function or a script executed with the .. or ssoouurrccee builtins fin-
ishes executing.
If a _s_i_g_s_p_e_c is EERRRR, the command _a_r_g is executed whenever a sim-
ple command has a non-zero exit status, subject to the following
conditions. The EERRRR trap is not executed if the failed command
is part of the command list immediately following a wwhhiillee or
uunnttiill keyword, part of the test in an _i_f statement, part of a
command executed in a &&&& or |||| list, or if the command's return
value is being inverted via !!. These are the same conditions
obeyed by the eerrrreexxiitt option.
Signals ignored upon entry to the shell cannot be trapped or
reset. Trapped signals that are not being ignored are reset to
their original values in a subshell or subshell environment when
one is created. The return status is false if any _s_i_g_s_p_e_c is
invalid; otherwise ttrraapp returns true.
ttyyppee [--aaffttppPP] _n_a_m_e [_n_a_m_e ...]
With no options, indicate how each _n_a_m_e would be interpreted if
@ -5024,7 +5164,8 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
children
--ii The maximum number of pending signals
--ll The maximum size that may be locked into memory
--mm The maximum resident set size
--mm The maximum resident set size (many systems do not honor
this limit)
--nn The maximum number of open file descriptors (most systems
do not allow this value to be set)
--pp The pipe size in 512-byte blocks (this may not be set)
@ -5071,10 +5212,10 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
unset. If --ff is specified, each _n_a_m_e refers to a shell func-
tion, and the function definition is removed. Each unset vari-
able or function is removed from the environment passed to sub-
sequent commands. If any of RRAANNDDOOMM, SSEECCOONNDDSS, LLIINNEENNOO, HHIISSTTCCMMDD,
FFUUNNCCNNAAMMEE, GGRROOUUPPSS, or DDIIRRSSTTAACCKK are unset, they lose their special
properties, even if they are subsequently reset. The exit sta-
tus is true unless a _n_a_m_e is readonly.
sequent commands. If any of CCOOMMPP__WWOORRDDBBRREEAAKKSS, RRAANNDDOOMM, SSEECCOONNDDSS,
LLIINNEENNOO, HHIISSTTCCMMDD, FFUUNNCCNNAAMMEE, GGRROOUUPPSS, or DDIIRRSSTTAACCKK are unset, they
lose their special properties, even if they are subsequently
reset. The exit status is true unless a _n_a_m_e is readonly.
wwaaiitt [_n _._._.]
Wait for each specified process and return its termination sta-
@ -5163,7 +5304,7 @@ AAUUTTHHOORRSS
bfox@gnu.org
Chet Ramey, Case Western Reserve University
chet@po.cwru.edu
chet.ramey@case.edu
BBUUGG RREEPPOORRTTSS
If you find a bug in bbaasshh,, you should report it. But first, you should
@ -5214,4 +5355,4 @@ BBUUGGSS
GNU Bash-4.0 2008 December 29 BASH(1)
GNU Bash-4.1 2009 December 29 BASH(1)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

12518
doc/bash.ps

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -24,7 +24,7 @@ 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.2 or
under the terms of the GNU Free Documentation License, Version 1.3 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
@ -498,6 +498,7 @@ alert (bell)
@item \b
backspace
@item \e
@itemx \E
an escape character (not ANSI C)
@item \f
form feed
@ -513,6 +514,8 @@ vertical tab
backslash
@item \'
single quote
@item \"
double quote
@item \@var{nnn}
the eight-bit character whose value is the octal value @var{nnn}
(one to three digits)
@ -777,7 +780,7 @@ in @var{consequent-commands}, or zero if none was executed.
The syntax of the @code{for} command is:
@example
for @var{name} [in @var{words} @dots{}]; do @var{commands}; done
for @var{name} [ [in [@var{words} @dots{}] ] ; ] do @var{commands}; done
@end example
Expand @var{words}, and execute @var{commands} once for each member
in the resultant list, with @var{name} bound to the current member.
@ -864,7 +867,7 @@ operator terminates a pattern list.
A list of patterns and an associated command-list is known
as a @var{clause}.
Each clause must be terminated with @samp{;;}, @samp{,&}, or @samp{;;&}.
Each clause must be terminated with @samp{;;}, @samp{;&}, or @samp{;;&}.
The @var{word} undergoes tilde expansion, parameter expansion, command
substitution, arithmetic expansion, and quote removal before matching is
attempted. Each @var{pattern} undergoes tilde expansion, parameter
@ -976,6 +979,9 @@ substitution, and quote removal are performed.
Conditional operators such as @samp{-f} must be unquoted to be recognized
as primaries.
When used with @samp{[[}, The @samp{<} and @samp{>} operators sort
lexicographically using the current locale.
When the @samp{==} and @samp{!=} operators are used, the string to the
right of the operator is considered a pattern and matched according
to the rules described below in @ref{Pattern Matching}.
@ -1177,14 +1183,18 @@ positional parameters is updated to reflect the change.
Special parameter @code{0} is unchanged.
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} and @env{RETURN} traps
with these exceptions:
the @env{DEBUG} and @env{RETURN} traps
are 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 @env{DEBUG} and @env{RETURN} traps).
(in which case all functions inherit the @env{DEBUG} and @env{RETURN} traps),
and the @env{ERR} trap is not inherited unless the @code{-o errtrace}
shell option has been enabled.
@xref{Bourne Shell Builtins}, for the description of the
@code{trap} builtin.
@ -1461,7 +1471,7 @@ bash$ echo a@{d,c,b@}e
ade ace abe
@end example
A sequence expression takes the form @code{@{@var{x}..@var{y}[@var{incr}]@}},
A sequence expression takes the form @code{@{@var{x}..@var{y}[..@var{incr}]@}},
where @var{x} and @var{y} are either integers or single characters,
and @var{incr}, an optional increment, is an integer.
When integers are supplied, the expression expands to each number between
@ -1601,7 +1611,7 @@ or when @var{parameter}
is followed by a character that is not to be
interpreted as part of its name.
If the first character of @var{parameter} is an exclamation point,
If the first character of @var{parameter} is an exclamation point (!),
a level of variable indirection is introduced.
Bash uses the value of the variable formed from the rest of
@var{parameter} as the name of the variable; this variable is then
@ -1767,7 +1777,7 @@ array in turn, and the expansion is the resultant list.
@itemx $@{@var{parameter},,@var{pattern}@}
This expansion modifies the case of alphabetic characters in @var{parameter}.
The @var{pattern} is expanded to produce a pattern just as in
pathname expansion.
filename expansion.
The @samp{^} operator converts lowercase letters matching @var{pattern}
to uppercase; the @samp{,} operator converts matching uppercase letters
to lowercase.
@ -1941,7 +1951,7 @@ 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.
When a pattern is used for filename generation, the character @samp{.}
When a pattern is used for filename expansion, the character @samp{.}
at the start of a filename or immediately following a slash
must be matched explicitly, unless the shell option @code{dotglob} is set.
When matching a file name, the slash character must always be
@ -2084,6 +2094,14 @@ simple command or may follow a command.
Redirections are processed in the order they appear, from
left to right.
Each redirection that may be preceded by a file descriptor number
may instead be preceded by a word of the form @{@var{varname}@}.
In this case, for each redirection operator except
>&- and <&-, the shell will allocate a file descriptor greater
than 10 and assign it to @{@var{varname}@}. If >&- or <&- is preceded
by @{@var{varname}@}, the value of @var{varname} defines the file
descriptor to close.
In the following descriptions, if the file descriptor number is
omitted, and the first character of the redirection operator is
@samp{<}, the redirection refers to the standard input (file
@ -2765,8 +2783,14 @@ Many of the builtins have been extended by @sc{posix} or Bash.
Unless otherwise noted, each builtin command documented as accepting
options preceded by @samp{-} accepts @samp{--}
to signify the end of the options.
For example, the @code{:}, @code{true}, @code{false}, and @code{test}
builtins do not accept options.
The @code{:}, @code{true}, @code{false}, and @code{test}
builtins do not accept options and do not treat @samp{--} specially.
The @code{exit}, @code{logout}, @code{break}, @code{continue}, @code{let},
and @code{shift} builtins accept and process arguments beginning
with @samp{-} without requiring @samp{--}.
Other builtins that accept arguments but are not specified as accepting
options interpret arguments beginning with @samp{-} as invalid options and
require @samp{--} to prevent this interpretation.
@node Bourne Shell Builtins
@section Bourne Shell Builtins
@ -3159,15 +3183,20 @@ 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 or a signal number.
Signal names are case insensitive and the @code{SIG} prefix is optional.
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
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
Refer to the description of the @code{extdebug} option to the
@code{shopt} builtin (@pxref{The Shopt Builtin}) for details of its
effect on the @code{DEBUG} trap.
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.
If a @var{sigspec} is @code{ERR}, the command @var{arg}
is executed whenever a simple command has a non-zero exit status,
subject to the following conditions.
@ -3178,13 +3207,10 @@ part of a command executed in a @code{&&} or @code{||} list,
or if the command's return
status is being inverted using @code{!}.
These are the same conditions obeyed by the @code{errexit} option.
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 that are not being ignored are reset to their original
values in a child process when it is created.
values in a subshell or subshell environment when one is created.
The return status is zero unless a @var{sigspec} does not specify a
valid signal.
@ -3625,7 +3651,7 @@ parent.
mapfile [-n @var{count}] [-O @var{origin}] [-s @var{count}] [-t] [-u @var{fd}] [
-C @var{callback}] [-c @var{quantum}] [@var{array}]
@end example
Read lines from the standard input into array variable @var{array},
Read lines from the standard input into the indexed array variable @var{array},
or from file descriptor @var{fd}
if the @option{-u} option is supplied.
The variable @code{MAPFILE} is the default @var{array}.
@ -3640,7 +3666,7 @@ The default index is 0.
@item -s
Discard the first @var{count} lines read.
@item -t
Remove a trailing line from each line read.
Remove a trailing newline from each line read.
@item -u
Read lines from file descriptor @var{fd} instead of the standard input.
@item -C
@ -3661,7 +3687,8 @@ If not supplied with an explicit origin, @code{mapfile} will clear @var{array}
before assigning to it.
@code{mapfile} returns successfully unless an invalid option or option
argument is supplied, or @var{array} is invalid or unassignable.
argument is supplied, @var{array} is invalid or unassignable, or @var{array}
is not an indexed array.
@item printf
@btindex printf
@ -3696,7 +3723,7 @@ non-zero on failure.
@item read
@btindex read
@example
read [-ers] [-a @var{aname}] [-d @var{delim}] [-i @var{text}] [-n @var{nchars}] [-p @var{prompt}] [-t @var{timeout}] [-u @var{fd}] [@var{name} @dots{}]
read [-ers] [-a @var{aname}] [-d @var{delim}] [-i @var{text}] [-n @var{nchars}] [-N @var{nchars}] [-p @var{prompt}] [-t @var{timeout}] [-u @var{fd}] [@var{name} @dots{}]
@end example
One line is read from the standard input, or from the file descriptor
@var{fd} supplied as an argument to the @option{-u} option, and the first word
@ -3739,7 +3766,16 @@ the editing buffer before editing begins.
@item -n @var{nchars}
@code{read} returns after reading @var{nchars} characters rather than
waiting for a complete line of input.
waiting for a complete line of input, but honor a delimiter if fewer
than @var{nchars} characters are read before the delimiter.
@item -N @var{nchars}
@code{read} returns after reading exactly @var{nchars} characters rather
than waiting for a complete line of input, unless EOF is encountered or
@code{read} times out.
Delimiter characters encountered in the input are
not treated specially and do not cause @code{read} to return until
@var{nchars} characters are read.
@item -p @var{prompt}
Display @var{prompt}, without a trailing newline, before attempting
@ -3779,7 +3815,7 @@ Read input from file descriptor @var{fd}.
readarray [-n @var{count}] [-O @var{origin}] [-s @var{count}] [-t] [-u @var{fd}] [
-C @var{callback}] [-c @var{quantum}] [@var{array}]
@end example
Read lines from the standard input into array variable @var{array},
Read lines from the standard input into the indexed array variable @var{array},
or from file descriptor @var{fd}
if the @option{-u} option is supplied.
@ -4007,7 +4043,7 @@ separately (@pxref{Command Execution Environment}), and may cause
subshells to exit before executing all the commands in the subshell.
@item -f
Disable file name generation (globbing).
Disable filename expansion (globbing).
@item -h
Locate and remember (hash) commands as they are looked up for execution.
@ -4124,8 +4160,8 @@ Same as @code{-x}.
Turn on privileged mode.
In this mode, the @env{$BASH_ENV} and @env{$ENV} files are not
processed, shell functions are not inherited from the environment,
and the @env{SHELLOPTS}, @env{CDPATH} and @env{GLOBIGNORE} variables,
if they appear in the environment, are ignored.
and the @env{SHELLOPTS}, @env{BASHOPTS}, @env{CDPATH} and @env{GLOBIGNORE}
variables, if they appear in the environment, are ignored.
If the shell is started with the effective user (group) id not equal to the
real user (group) id, and the @code{-p} option is not supplied, these actions
are taken and the effective user id is set to the real user id.
@ -4391,7 +4427,7 @@ 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
If set, patterns which fail to match filenames during filename expansion
result in an expansion error.
@item force_fignore
@ -4638,6 +4674,16 @@ variables for controlling the job control facilities
@item BASH
The full pathname used to execute the current instance of Bash.
@item BASHOPTS
A colon-separated list of enabled shell options. Each word in
the list is a valid argument for the @option{-s} option to the
@code{shopt} builtin command (@pxref{The Shopt Builtin}).
The options appearing in @env{BASHOPTS} are those reported
as @samp{on} by @samp{shopt}.
If this variable is in the environment when Bash
starts up, each shell option in the list will be enabled before
reading any startup files. This variable is readonly.
@item BASHPID
Expands to the process id of the current Bash process.
This differs from @code{$$} under certain circumstances, such as subshells
@ -4750,6 +4796,20 @@ The value of @env{MACHTYPE}.
@item BASH_VERSION
The version number of the current instance of Bash.
@item BASH_XTRACEFD
If set to an integer corresponding to a valid file descriptor, Bash
will write the trace output generated when @samp{set -x}
is enabled to that file descriptor.
This allows tracing output to be separated from diagnostic and error
messages.
The file descriptor is closed when @code{BASH_XTRACEFD} is unset or assigned
a new value.
Unsetting @code{BASH_XTRACEFD} or assigning it the empty string causes the
trace output to be sent to the standard error.
Note that setting @code{BASH_XTRACEFD} to 2 (the standard error file
descriptor) and then unsetting it will result in the standard error
being closed.
@item COLUMNS
Used by the @code{select} builtin command to determine the terminal width
when printing selection lists. Automatically set upon receipt of a
@ -4962,7 +5022,8 @@ is running;
the next time hostname completion is attempted after the
value is changed, Bash adds the contents of the new file to the
existing list.
If @env{HOSTFILE} is set, but has no value, Bash attempts to read
If @env{HOSTFILE} is set, but has no value, or does not name a readable file,
Bash attempts to read
@file{/etc/hosts} to obtain the list of possible hostname completions.
When @env{HOSTFILE} is unset, the hostname list is cleared.
@ -5482,8 +5543,9 @@ allow them to be specified.
If Bash is started with the effective user (group) id not equal to the
real user (group) id, and the @code{-p} option is not supplied, no startup
files are read, shell functions are not inherited from the environment,
the @env{SHELLOPTS} variable, if it appears in the environment, is ignored,
and the effective user id is set to the real user id.
the @env{SHELLOPTS}, @env{BASHOPTS}, @env{CDPATH}, and @env{GLOBIGNORE}
variables, if they appear in the environment, are ignored, and the effective
user id is set to the real user id.
If the @code{-p} option is supplied at invocation, the startup behavior is
the same, but the effective user id is not reset.
@ -5660,6 +5722,9 @@ If the @var{file} argument to one of the primaries is one of
@file{/dev/stdin}, @file{/dev/stdout}, or @file{/dev/stderr}, file
descriptor 0, 1, or 2, respectively, is checked.
When used with @samp{[[}, The @samp{<} and @samp{>} operators sort
lexicographically using the current locale.
Unless otherwise specified, primaries that operate on files follow symbolic
links and operate on the target of the link, rather than the link itself.
@ -5752,19 +5817,18 @@ True if the length of @var{string} is zero.
True if the length of @var{string} is non-zero.
@item @var{string1} == @var{string2}
@itemx @var{string1} = @var{string2}
True if the strings are equal.
@samp{=} may be used in place of @samp{==} for strict @sc{posix} compliance.
@samp{=} should be used with the @code{test} command for @sc{posix} conformance.
@item @var{string1} != @var{string2}
True if the strings are not equal.
@item @var{string1} < @var{string2}
True if @var{string1} sorts before @var{string2} lexicographically
in the current locale.
True if @var{string1} sorts before @var{string2} lexicographically.
@item @var{string1} > @var{string2}
True if @var{string1} sorts after @var{string2} lexicographically
in the current locale.
True if @var{string1} sorts after @var{string2} lexicographically.
@item @var{arg1} OP @var{arg2}
@code{OP} is one of
@ -6032,11 +6096,14 @@ If @var{subscript} is @samp{@@} or
Referencing an array variable without a subscript is equivalent to
referencing with a subscript of 0.
An array variable is considered set if a subscript has been assigned a
value. The null string is a valid value.
The @code{unset} builtin is used to destroy arrays.
@code{unset} @var{name}[@var{subscript}]
destroys the array element at index @var{subscript}.
Care must be taken to avoid unwanted side effects caused by filename
generation.
expansion.
@code{unset} @var{name}, where @var{name} is an array, removes the
entire array. A subscript of @samp{*} or @samp{@@} also removes the
entire array.
@ -6512,6 +6579,11 @@ escape characters are converted.
The @code{ulimit} builtin uses a block size of 512 bytes for the @option{-c}
and @option{-f} options.
@item
The arrival of @code{SIGCHLD} when a trap is set on @code{SIGCHLD} does
not interrupt the @code{wait} builtin and cause it to return immediately.
The trap command is run once for each child that exits.
@end enumerate
There is other @sc{posix} behavior that Bash does not implement by
@ -6561,7 +6633,7 @@ refers to the ability to selectively stop (suspend)
the execution of processes and continue (resume)
their execution at a later point. A user typically employs
this facility via an interactive interface supplied jointly
by the system's terminal driver and Bash.
by the operating system kernel's terminal driver and Bash.
The shell associates a @var{job} with each pipeline. It keeps a
table of currently executing jobs, which may be listed with the
@ -6586,11 +6658,13 @@ process group @sc{id} is equal to the current terminal process group
These processes are said to be in the foreground. Background
processes are those whose process group @sc{id} differs from the
terminal's; such processes are immune to keyboard-generated
signals. Only foreground processes are allowed to read from or
write to the terminal. Background processes which attempt to
read from (write to) the terminal are sent a @code{SIGTTIN}
(@code{SIGTTOU}) signal by the terminal driver, which, unless
caught, suspends the process.
signals. Only foreground processes are allowed to read from or, if
the user so specifies with @code{stty tostop}, write to the terminal.
Background processes which attempt to
read from (write to when @code{stty tostop} is in effect) the
terminal are sent a @code{SIGTTIN} (@code{SIGTTOU})
signal by the kernel's terminal driver,
which, unless caught, suspends the process.
If the operating system on which Bash is running supports
job control, Bash contains facilities to use it. Typing the
@ -7225,6 +7299,10 @@ Include support for the @code{((@dots{}))} command
Include support for the extended pattern matching features described
above under @ref{Pattern Matching}.
@item --enable-extended-glob-default
Set the default value of the @var{extglob} shell option described
above under @ref{The Shopt Builtin} to be enabled.
@item --enable-help-builtin
Include the @code{help} builtin, which displays help on shell builtins and
variables (@pxref{Bash Builtins}).
@ -7318,7 +7396,7 @@ But first, you should
make sure that it really is a bug, and that it appears in the latest
version of Bash.
The latest version of Bash is always available for FTP from
@uref{ftp://ftp.gnu.org/pub/bash/}.
@uref{ftp://ftp.gnu.org/pub/gnu/bash/}.
Once you have determined that a bug actually exists, use the
@code{bashbug} command to submit a bug report.

View File

@ -14,8 +14,12 @@ NNAAMMEE
BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
Unless otherwise noted, each builtin command documented in this section
as accepting options preceded by -- accepts ---- to signify the end of the
options. For example, the ::, ttrruuee, ffaallssee, and tteesstt builtins do not
accept options.
options. The ::, ttrruuee, ffaallssee, and tteesstt builtins do not accept options
and do not treat ---- specially. The eexxiitt, llooggoouutt, bbrreeaakk, ccoonnttiinnuuee, lleett,
and sshhiifftt builtins accept and process arguments beginning with -- with-
out requiring ----. Other builtins that accept arguments but are not
specified as accepting options interpret arguments beginning with -- as
invalid options and require ---- to prevent this interpretation.
:: [_a_r_g_u_m_e_n_t_s]
No effect; the command does nothing beyond expanding _a_r_g_u_m_e_n_t_s
and performing any specified redirections. A zero exit code is
@ -184,18 +188,22 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
The return value is true unless an invalid option is supplied,
or no matches were generated.
ccoommpplleettee [--aabbccddeeffggjjkkssuuvv] [--oo _c_o_m_p_-_o_p_t_i_o_n] [--EE] [--AA _a_c_t_i_o_n] [--GG _g_l_o_b_p_a_t]
[--WW _w_o_r_d_l_i_s_t] [--FF _f_u_n_c_t_i_o_n] [--CC _c_o_m_m_a_n_d]
ccoommpplleettee [--aabbccddeeffggjjkkssuuvv] [--oo _c_o_m_p_-_o_p_t_i_o_n] [--DDEE] [--AA _a_c_t_i_o_n] [--GG _g_l_o_b_-
_p_a_t] [--WW _w_o_r_d_l_i_s_t] [--FF _f_u_n_c_t_i_o_n] [--CC _c_o_m_m_a_n_d]
[--XX _f_i_l_t_e_r_p_a_t] [--PP _p_r_e_f_i_x] [--SS _s_u_f_f_i_x] _n_a_m_e [_n_a_m_e _._._.]
ccoommpplleettee --pprr [--EE] [_n_a_m_e ...]
ccoommpplleettee --pprr [--DDEE] [_n_a_m_e ...]
Specify how arguments to each _n_a_m_e should be completed. If the
--pp 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 --rr option removes a completion spec-
ification for each _n_a_m_e, or, if no _n_a_m_es are supplied, all com-
pletion specifications. The --EE option indicates that the
remaining options and actions should apply to ``empty'' command
completion; that is, completion attempted on a blank line.
pletion specifications. The --DD option indicates that the
remaining options and actions should apply to the ``default''
command completion; that is, completion attempted on a command
for which no completion has previously been defined. The --EE
option indicates that the remaining options and actions should
apply to ``empty'' command completion; that is, completion
attempted on a blank line.
The process of applying these completion specifications when
word completion is attempted is described above under PPrroo--
@ -275,7 +283,7 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
Names of all shell variables. May also be spec-
ified as --vv.
--GG _g_l_o_b_p_a_t
The filename expansion pattern _g_l_o_b_p_a_t is expanded to
The pathname expansion pattern _g_l_o_b_p_a_t is expanded to
generate the possible completions.
--WW _w_o_r_d_l_i_s_t
The _w_o_r_d_l_i_s_t is split using the characters in the IIFFSS
@ -292,7 +300,7 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
pletions are retrieved from the value of the CCOOMMPPRREEPPLLYY
array variable.
--XX _f_i_l_t_e_r_p_a_t
_f_i_l_t_e_r_p_a_t is a pattern as used for filename expansion.
_f_i_l_t_e_r_p_a_t is a pattern as used for pathname expansion.
It is applied to the list of possible completions gener-
ated by the preceding options and arguments, and each
completion matching _f_i_l_t_e_r_p_a_t is removed from the list.
@ -311,13 +319,18 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
for a _n_a_m_e for which no specification exists, or an error occurs
adding a completion specification.
ccoommppoopptt [--oo _o_p_t_i_o_n] [++oo _o_p_t_i_o_n] [_n_a_m_e]
ccoommppoopptt [--oo _o_p_t_i_o_n] [--DDEE] [++oo _o_p_t_i_o_n] [_n_a_m_e]
Modify completion options for each _n_a_m_e according to the
_o_p_t_i_o_ns, or for the currently-execution completion if no _n_a_m_es
are supplied. If no _o_p_t_i_o_ns are given, display the completion
options for each _n_a_m_e or the current completion. The possible
values of _o_p_t_i_o_n are those valid for the ccoommpplleettee builtin
described above.
described above. The --DD option indicates that the remaining
options should apply to the ``default'' command completion; that
is, completion attempted on a command for which no completion
has previously been defined. The --EE option indicates that the
remaining options should apply to ``empty'' command completion;
that is, completion attempted on a blank line.
The return value is true unless an invalid option is supplied, an
attempt is made to modify the options for a _n_a_m_e for which no comple-
@ -355,8 +368,8 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
above).
--ff Use function names only.
--ii The variable is treated as an integer; arithmetic evalua-
tion (see AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN )) is performed when the
variable is assigned a value.
tion (see AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN above) is performed when
the variable is assigned a value.
--ll When the variable is assigned a value, all upper-case
characters are converted to lower-case. The upper-case
attribute is disabled.
@ -374,8 +387,8 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
Using `+' instead of `-' turns off the attribute instead, with
the exceptions that ++aa may not be used to destroy an array vari-
able and ++rr wwiillll nnoott rreemmoovvee tthhee rreeaaddoonnllyy aattttrriibbuuttee.. WWhheenn uusseedd
iinn aa ffuunnccttiioonn,, mmaakkeess eeaacchh _n_a_m_e llooccaall,, aass wwiitthh tthhee llooccaall command.
able and ++rr will not remove the readonly attribute. When used
in a function, makes each _n_a_m_e local, as with the llooccaall command.
If a variable name is followed by =_v_a_l_u_e, the value of the vari-
able is set to _v_a_l_u_e. The return value is 0 unless an invalid
option is encountered, an attempt is made to define a function
@ -413,9 +426,9 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
ddiissoowwnn [--aarr] [--hh] [_j_o_b_s_p_e_c ...]
Without options, each _j_o_b_s_p_e_c is removed from the table of
active jobs. If _j_o_b_s_p_e_c is not present, and neither --aa nnoorr --rr
iiss ssuupppplliieedd,, tthhee sshheellll''ss nnoottiioonn ooff tthhee _c_u_r_r_e_n_t _j_o_b iiss uusseedd.. IIff
tthhee --hh ooppttiioonn iiss ggiivveenn,, eeaacchh _j_o_b_s_p_e_c is not removed from the ta-
active jobs. If _j_o_b_s_p_e_c is not present, and neither --aa nor --rr
is supplied, the shell's notion of the _c_u_r_r_e_n_t _j_o_b is used. If
the --hh option is given, each _j_o_b_s_p_e_c is not removed from the ta-
ble, but is marked so that SSIIGGHHUUPP is not sent to the job if the
shell receives a SSIIGGHHUUPP. If no _j_o_b_s_p_e_c is present, and neither
the --aa nor the --rr option is supplied, the _c_u_r_r_e_n_t _j_o_b is used.
@ -668,16 +681,16 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
The last command in the history list is removed before
the _a_r_g_s are added.
If the HHIISSTTTTIIMMEEFFOORRMMAATT is set, the time stamp information associ-
ated with each history entry is written to the history file,
marked with the history comment character. When the history
file is read, lines beginning with the history comment character
followed immediately by a digit are interpreted as timestamps
for the previous history line. The return value is 0 unless an
invalid option is encountered, an error occurs while reading or
writing the history file, an invalid _o_f_f_s_e_t is supplied as an
argument to --dd, or the history expansion supplied as an argument
to --pp fails.
If the HHIISSTTTTIIMMEEFFOORRMMAATT variable is set, the time stamp informa-
tion associated with each history entry is written to the his-
tory file, marked with the history comment character. When the
history file is read, lines beginning with the history comment
character followed immediately by a digit are interpreted as
timestamps for the previous history line. The return value is 0
unless an invalid option is encountered, an error occurs while
reading or writing the history file, an invalid _o_f_f_s_e_t is sup-
plied as an argument to --dd, or the history expansion supplied as
an argument to --pp fails.
jjoobbss [--llnnpprrss] [ _j_o_b_s_p_e_c ... ]
jjoobbss --xx _c_o_m_m_a_n_d [ _a_r_g_s ... ]
@ -716,8 +729,8 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
lleett _a_r_g [_a_r_g ...]
Each _a_r_g is an arithmetic expression to be evaluated (see AARRIITTHH--
MMEETTIICC EEVVAALLUUAATTIIOONN). If the last _a_r_g evaluates to 0, lleett returns
1; 0 is returned otherwise.
MMEETTIICC EEVVAALLUUAATTIIOONN above). If the last _a_r_g evaluates to 0, lleett
returns 1; 0 is returned otherwise.
llooccaall [_o_p_t_i_o_n] [_n_a_m_e[=_v_a_l_u_e] ...]
For each argument, a local variable named _n_a_m_e is created, and
@ -736,16 +749,16 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
[--cc _q_u_a_n_t_u_m] [_a_r_r_a_y]
rreeaaddaarrrraayy [--nn _c_o_u_n_t] [--OO _o_r_i_g_i_n] [--ss _c_o_u_n_t] [--tt] [--uu _f_d] [--CC _c_a_l_l_b_a_c_k]
[--cc _q_u_a_n_t_u_m] [_a_r_r_a_y]
Read lines from the standard input into array variable _a_r_r_a_y, or
from file descriptor _f_d if the --uu option is supplied. The vari-
able MMAAPPFFIILLEE is the default _a_r_r_a_y. Options, if supplied, have
the following meanings:
Read lines from the standard input into the indexed array vari-
able _a_r_r_a_y, or from file descriptor _f_d if the --uu option is sup-
plied. The variable MMAAPPFFIILLEE is the default _a_r_r_a_y. Options, if
supplied, have the following meanings:
--nn Copy at most _c_o_u_n_t lines. If _c_o_u_n_t is 0, all lines are
copied.
--OO Begin assigning to _a_r_r_a_y at index _o_r_i_g_i_n. The default
index is 0.
--ss Discard the first _c_o_u_n_t lines read.
--tt Remove a trailing line from each line read.
--tt Remove a trailing newline from each line read.
--uu Read lines from file descriptor _f_d instead of the stan-
dard input.
--CC Evaluate _c_a_l_l_b_a_c_k each time _q_u_a_n_t_u_m lines are read. The
@ -763,7 +776,8 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
_a_r_r_a_y before assigning to it.
mmaappffiillee returns successfully unless an invalid option or option
argument is supplied, or _a_r_r_a_y is invalid or unassignable.
argument is supplied, _a_r_r_a_y is invalid or unassignable, or if
_a_r_r_a_y is not an indexed array.
ppooppdd [-nn] [+_n] [-_n]
Removes entries from the directory stack. With no arguments,
@ -846,8 +860,8 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
occurs while reading the name of the current directory or an
invalid option is supplied.
rreeaadd [--eerrss] [--aa _a_n_a_m_e] [--dd _d_e_l_i_m] [-- _t_e_x_t] [--nn _n_c_h_a_r_s] [--pp _p_r_o_m_p_t] [--tt
_t_i_m_e_o_u_t] [--uu _f_d] [_n_a_m_e ...]
rreeaadd [--eerrss] [--aa _a_n_a_m_e] [--dd _d_e_l_i_m] [--ii _t_e_x_t] [--nn _n_c_h_a_r_s] [--NN _n_c_h_a_r_s] [--pp
_p_r_o_m_p_t] [--tt _t_i_m_e_o_u_t] [--uu _f_d] [_n_a_m_e ...]
One line is read from the standard input, or from the file
descriptor _f_d supplied as an argument to the --uu option, and the
first word is assigned to the first _n_a_m_e, the second word to the
@ -876,7 +890,16 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
placed into the editing buffer before editing begins.
--nn _n_c_h_a_r_s
rreeaadd returns after reading _n_c_h_a_r_s characters rather than
waiting for a complete line of input.
waiting for a complete line of input, but honor a delim-
iter if fewer than _n_c_h_a_r_s characters are read before the
delimiter.
--NN _n_c_h_a_r_s
rreeaadd returns after reading exactly _n_c_h_a_r_s characters
rather than waiting for a complete line of input, unless
EOF is encountered or rreeaadd times out. Delimiter charac-
ters encountered in the input are not treated specially
and do not cause rreeaadd to return until _n_c_h_a_r_s characters
are read.
--pp _p_r_o_m_p_t
Display _p_r_o_m_p_t on standard error, without a trailing new-
line, before attempting to read any input. The prompt is
@ -951,18 +974,23 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
--bb Report the status of terminated background jobs immedi-
ately, rather than before the next primary prompt. This
is effective only when job control is enabled.
--ee Exit immediately if a _s_i_m_p_l_e _c_o_m_m_a_n_d (see SSHHEELLLL GGRRAAMMMMAARR
--ee Exit immediately if a _p_i_p_e_l_i_n_e (which may consist of a
single _s_i_m_p_l_e _c_o_m_m_a_n_d), a _s_u_b_s_h_e_l_l command enclosed in
parentheses, or one of the commands executed as part of
a command list enclosed by braces (see SSHHEELLLL GGRRAAMMMMAARR
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 wwhhiillee or uunnttiill keyword,
part of the test in an iiff statement, part of a command
executed in a &&&& or |||| list, any command in a pipeline
but the last, or if the command's return value is being
inverted via !!. Failing simple commands that are part
of shell functions or command lists enclosed in braces
or parentheses satisfying the above conditions do not
cause the shell to exit. A trap on EERRRR, if set, is exe-
cuted before the shell exits.
part of the test following the iiff or eelliiff reserved
words, part of any command executed in a &&&& or |||| list
except the command following the final &&&& or ||||, any
command in a pipeline but the last, or if the command's
return value is being inverted with !!. A trap on EERRRR,
if set, is executed before the shell exits. This option
applies to the shell environment and each subshell envi-
ronment separately (see CCOOMMMMAANNDD EEXXEECCUUTTIIOONN EENNVVIIRROONNMMEENNTT
above), and may cause subshells to exit before executing
all the commands in the subshell.
--ff Disable pathname expansion.
--hh Remember the location of commands as they are looked up
for execution. This is enabled by default.
@ -989,11 +1017,11 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
is interactive, unless the shell is started with
the ----nnooeeddiittiinngg option. This also affects the
editing interface used for rreeaadd --ee.
eerrrreexxiitt Same as --ee.
eerrrrttrraaccee
Same as --EE.
ffuunnccttrraaccee
Same as --TT.
eerrrreexxiitt Same as --ee.
hhaasshhaallll Same as --hh.
hhiisstteexxppaanndd
Same as --HH.
@ -1040,20 +1068,22 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
--pp Turn on _p_r_i_v_i_l_e_g_e_d mode. In this mode, the $$EENNVV and
$$BBAASSHH__EENNVV files are not processed, shell functions are
not inherited from the environment, and the SSHHEELLLLOOPPTTSS,
CCDDPPAATTHH, and GGLLOOBBIIGGNNOORREE variables, if they appear in the
environment, are ignored. If the shell is started with
the effective user (group) id not equal to the real user
(group) id, and the --pp option is not supplied, these
actions are taken and the effective user id is set to
the real user id. If the --pp option is supplied at
startup, the effective user id is not reset. Turning
this option off causes the effective user and group ids
to be set to the real user and group ids.
BBAASSHHOOPPTTSS, CCDDPPAATTHH, and GGLLOOBBIIGGNNOORREE variables, if they
appear in the environment, are ignored. If the shell is
started with the effective user (group) id not equal to
the real user (group) id, and the --pp option is not sup-
plied, these actions are taken and the effective user id
is set to the real user id. If the --pp option is sup-
plied at startup, the effective user id is not reset.
Turning this option off causes the effective user and
group ids to be set to the real user and group ids.
--tt Exit after reading and executing one command.
--uu Treat unset variables as an error when performing param-
eter expansion. If expansion is attempted on an unset
variable, the shell prints an error message, and, if not
interactive, exits with a non-zero status.
--uu Treat unset variables and parameters other than the spe-
cial parameters "@" and "*" as an error when performing
parameter expansion. If expansion is attempted on an
unset variable or parameter, the shell prints an error
message, and, if not interactive, exits with a non-zero
status.
--vv Print shell input lines as they are read.
--xx After expanding each _s_i_m_p_l_e _c_o_m_m_a_n_d, ffoorr command, ccaassee
command, sseelleecctt command, or arithmetic ffoorr command, dis-
@ -1172,6 +1202,15 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
If set, bbaasshh changes its behavior to that of version 3.1
with respect to quoted arguments to the conditional com-
mand's =~ operator.
ccoommppaatt3322
If set, bbaasshh changes its behavior to that of version 3.2
with respect to locale-specific string comparison when
using the conditional command's < and > operators.
ccoommppaatt4400
If set, bbaasshh changes its behavior to that of version 4.0
with respect to locale-specific string comparison when
using the conditional command's < and > operators and
the effect of interrupting a command list.
ddiirrssppeellll
If set, bbaasshh attempts spelling correction on directory
names during word completion if the directory name ini-
@ -1226,7 +1265,7 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
description of FFIIGGNNOORREE. This option is enabled by
default.
gglloobbssttaarr
If set, the pattern **** used in a filename expansion con-
If set, the pattern **** used in a pathname expansion con-
text will match a files and zero or more directories and
subdirectories. If the pattern is followed by a //, only
directories and subdirectories match.
@ -1395,28 +1434,33 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
causes the shell to print a list of signal names and their cor-
responding numbers. Each _s_i_g_s_p_e_c is either a signal name
defined in <_s_i_g_n_a_l_._h>, or a signal number. Signal names are
case insensitive and the SIG prefix is optional. If a _s_i_g_s_p_e_c
is EEXXIITT (0) the command _a_r_g is executed on exit from the shell.
If a _s_i_g_s_p_e_c is DDEEBBUUGG, the command _a_r_g is executed before every
_s_i_m_p_l_e _c_o_m_m_a_n_d, _f_o_r command, _c_a_s_e command, _s_e_l_e_c_t command, every
arithmetic _f_o_r command, and before the first command executes in
a shell function (see SSHHEELLLL GGRRAAMMMMAARR above). Refer to the
description of the eexxttddeebbuugg option to the sshhoopptt builtin for
details of its effect on the DDEEBBUUGG trap. If a _s_i_g_s_p_e_c is EERRRR,
the command _a_r_g is executed whenever a simple command has a
non-zero exit status, subject to the following conditions. The
EERRRR trap is not executed if the failed command is part of the
command list immediately following a wwhhiillee or uunnttiill keyword,
part of the test in an _i_f statement, part of a command executed
in a &&&& or |||| list, or if the command's return value is being
inverted via !!. These are the same conditions obeyed by the
eerrrreexxiitt option. If a _s_i_g_s_p_e_c is RREETTUURRNN, the command _a_r_g is exe-
cuted each time a shell function or a script executed with the ..
or ssoouurrccee builtins finishes executing. Signals ignored upon
entry to the shell cannot be trapped or reset. Trapped signals
that are not being ignored are reset to their original values in
a child process when it is created. The return status is false
if any _s_i_g_s_p_e_c is invalid; otherwise ttrraapp returns true.
case insensitive and the SIG prefix is optional.
If a _s_i_g_s_p_e_c is EEXXIITT (0) the command _a_r_g is executed on exit
from the shell. If a _s_i_g_s_p_e_c is DDEEBBUUGG, the command _a_r_g is exe-
cuted before every _s_i_m_p_l_e _c_o_m_m_a_n_d, _f_o_r command, _c_a_s_e command,
_s_e_l_e_c_t command, every arithmetic _f_o_r command, and before the
first command executes in a shell function (see SSHHEELLLL GGRRAAMMMMAARR
above). Refer to the description of the eexxttddeebbuugg option to the
sshhoopptt builtin for details of its effect on the DDEEBBUUGG trap. If a
_s_i_g_s_p_e_c is RREETTUURRNN, the command _a_r_g is executed each time a shell
function or a script executed with the .. or ssoouurrccee builtins fin-
ishes executing.
If a _s_i_g_s_p_e_c is EERRRR, the command _a_r_g is executed whenever a sim-
ple command has a non-zero exit status, subject to the following
conditions. The EERRRR trap is not executed if the failed command
is part of the command list immediately following a wwhhiillee or
uunnttiill keyword, part of the test in an _i_f statement, part of a
command executed in a &&&& or |||| list, or if the command's return
value is being inverted via !!. These are the same conditions
obeyed by the eerrrreexxiitt option.
Signals ignored upon entry to the shell cannot be trapped or
reset. Trapped signals that are not being ignored are reset to
their original values in a subshell or subshell environment when
one is created. The return status is false if any _s_i_g_s_p_e_c is
invalid; otherwise ttrraapp returns true.
ttyyppee [--aaffttppPP] _n_a_m_e [_n_a_m_e ...]
With no options, indicate how each _n_a_m_e would be interpreted if
@ -1464,7 +1508,8 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
children
--ii The maximum number of pending signals
--ll The maximum size that may be locked into memory
--mm The maximum resident set size
--mm The maximum resident set size (many systems do not honor
this limit)
--nn The maximum number of open file descriptors (most systems
do not allow this value to be set)
--pp The pipe size in 512-byte blocks (this may not be set)
@ -1511,10 +1556,10 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
unset. If --ff is specified, each _n_a_m_e refers to a shell func-
tion, and the function definition is removed. Each unset vari-
able or function is removed from the environment passed to sub-
sequent commands. If any of RRAANNDDOOMM, SSEECCOONNDDSS, LLIINNEENNOO, HHIISSTTCCMMDD,
FFUUNNCCNNAAMMEE, GGRROOUUPPSS, or DDIIRRSSTTAACCKK are unset, they lose their special
properties, even if they are subsequently reset. The exit sta-
tus is true unless a _n_a_m_e is readonly.
sequent commands. If any of CCOOMMPP__WWOORRDDBBRREEAAKKSS, RRAANNDDOOMM, SSEECCOONNDDSS,
LLIINNEENNOO, HHIISSTTCCMMDD, FFUUNNCCNNAAMMEE, GGRROOUUPPSS, or DDIIRRSSTTAACCKK are unset, they
lose their special properties, even if they are subsequently
reset. The exit status is true unless a _n_a_m_e is readonly.
wwaaiitt [_n _._._.]
Wait for each specified process and return its termination sta-

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,12 @@
@c The GNU Free Documentation License.
@center Version 1.2, November 2002
@center Version 1.3, 3 November 2008
@c This file is intended to be included within another document,
@c hence no sectioning command or @node.
@display
Copyright @copyright{} 2000,2001,2002 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
Copyright @copyright{} 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
@uref{http://fsf.org/}
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@ -111,6 +111,9 @@ 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.
The ``publisher'' means any person or entity that distributes copies
of the Document to the public.
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
@ -379,13 +382,30 @@ 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.
You may not copy, modify, sublicense, or distribute the Document
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense, or distribute it is void, and
will automatically terminate your rights under this License.
However, if you cease all violation of this License, then your license
from a particular copyright holder is reinstated (a) provisionally,
unless and until the copyright holder explicitly and finally
terminates your license, and (b) permanently, if the copyright holder
fails to notify you of the violation by some reasonable means prior to
60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, receipt of a copy of some or all of the same material does
not give you any rights to use it.
@item
FUTURE REVISIONS OF THIS LICENSE
@ -403,7 +423,42 @@ 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.
as a draft) by the Free Software Foundation. If the Document
specifies that a proxy can decide which future versions of this
License can be used, that proxy's public statement of acceptance of a
version permanently authorizes you to choose that version for the
Document.
@item
RELICENSING
``Massive Multiauthor Collaboration Site'' (or ``MMC Site'') means any
World Wide Web server that publishes copyrightable works and also
provides prominent facilities for anybody to edit those works. A
public wiki that anybody can edit is an example of such a server. A
``Massive Multiauthor Collaboration'' (or ``MMC'') contained in the
site means any set of copyrightable works thus published on the MMC
site.
``CC-BY-SA'' means the Creative Commons Attribution-Share Alike 3.0
license published by Creative Commons Corporation, a not-for-profit
corporation with a principal place of business in San Francisco,
California, as well as future copyleft versions of that license
published by that same organization.
``Incorporate'' means to publish or republish a Document, in whole or
in part, as part of another Document.
An MMC is ``eligible for relicensing'' if it is licensed under this
License, and if all works that were first published under this License
somewhere other than this MMC, and subsequently incorporated in whole
or in part into the MMC, (1) had no cover texts or invariant sections,
and (2) were thus incorporated prior to November 1, 2008.
The operator of an MMC Site may republish an MMC contained in the site
under CC-BY-SA on the same site at any time before August 1, 2009,
provided the MMC is eligible for relicensing.
@end enumerate
@page
@ -417,7 +472,7 @@ license notices just after the title page:
@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
under the terms of the GNU Free Documentation License, Version 1.3
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

View File

@ -1,13 +1,13 @@
GNU Free Documentation License
Version 1.2, November 2002
Version 1.3, 3 November 2008
Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
<http://fsf.org/>
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
@ -50,11 +50,11 @@ 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
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.
@ -103,6 +103,9 @@ 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.
The "publisher" means any person or entity that distributes copies of
the Document to the public.
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
@ -118,14 +121,13 @@ 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
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
@ -169,8 +171,9 @@ 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.
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
@ -285,16 +288,18 @@ 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 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.
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
@ -304,7 +309,7 @@ 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
When the Document is included in an aggregate, this License does not
apply to the other works in the aggregate which are not themselves
derivative works of the Document.
@ -340,21 +345,38 @@ 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.
You may not copy, modify, sublicense, or distribute the Document
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense, or distribute it is void, and
will automatically terminate your rights under this License.
However, if you cease all violation of this License, then your license
from a particular copyright holder is reinstated (a) provisionally,
unless and until the copyright holder explicitly and finally
terminates your license, and (b) permanently, if the copyright holder
fails to notify you of the violation by some reasonable means prior to
60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, receipt of a copy of some or all of the same material does
not give you any rights to use it.
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
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.
@ -364,7 +386,39 @@ 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.
as a draft) by the Free Software Foundation. If the Document
specifies that a proxy can decide which future versions of this
License can be used, that proxy's public statement of acceptance of a
version permanently authorizes you to choose that version for the
Document.
11. RELICENSING
"Massive Multiauthor Collaboration Site" (or "MMC Site") means any
World Wide Web server that publishes copyrightable works and also
provides prominent facilities for anybody to edit those works. A
public wiki that anybody can edit is an example of such a server. A
"Massive Multiauthor Collaboration" (or "MMC") contained in the site
means any set of copyrightable works thus published on the MMC site.
"CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
license published by Creative Commons Corporation, a not-for-profit
corporation with a principal place of business in San Francisco,
California, as well as future copyleft versions of that license
published by that same organization.
"Incorporate" means to publish or republish a Document, in whole or in
part, as part of another Document.
An MMC is "eligible for relicensing" if it is licensed under this
License, and if all works that were first published under this License
somewhere other than this MMC, and subsequently incorporated in whole or
in part into the MMC, (1) had no cover texts or invariant sections, and
(2) were thus incorporated prior to November 1, 2008.
The operator of an MMC Site may republish an MMC contained in the site
under CC-BY-SA on the same site at any time before August 1, 2009,
provided the MMC is eligible for relicensing.
ADDENDUM: How to use this License for your documents
@ -375,7 +429,7 @@ 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
under the terms of the GNU Free Documentation License, Version 1.3
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

View File

@ -1,6 +1,6 @@
%!PS-Adobe-3.0
%%Creator: groff version 1.19.2
%%CreationDate: Thu Feb 5 08:05:28 2009
%%CreationDate: Wed Dec 30 13:07:37 2009
%%DocumentNeededResources: font Times-Roman
%%+ font Times-Bold
%%DocumentSuppliedResources: procset grops 1.19 2
@ -240,9 +240,10 @@ E F0(\(1\))A F1(RESTRICTED SHELL)72 112.8 Q F0(If)108 124.8 Q F2(bash)
(bash)2.5 E F0(with the e)2.5 E(xception that the follo)-.15 E
(wing are disallo)-.25 E(wed or not performed:)-.25 E 32.5<8363>108
165.6 S(hanging directories with)-32.5 E F2(cd)2.5 E F0 32.5<8373>108
182.4 S(etting or unsetting the v)-32.5 E(alues of)-.25 E F2(SHELL)2.5 E
F0(,)A F2 -.74(PA)2.5 G(TH)-.21 E F0(,)A F2(ENV)2.5 E F0 2.5(,o)C(r)-2.5
E F2 -.3(BA)2.5 G(SH_ENV).3 E F0 32.5<8373>108 199.2 S
182.4 S(etting or unsetting the v)-32.5 E(alues of)-.25 E/F3 9
/Times-Bold@0 SF(SHELL)2.5 E/F4 9/Times-Roman@0 SF(,)A F3 -.666(PA)2.25
G(TH)-.189 E F4(,)A F3(ENV)2.25 E F4(,)A F0(or)2.25 E F3 -.27(BA)2.5 G
(SH_ENV).27 E F0 32.5<8373>108 199.2 S
(pecifying command names containing)-32.5 E F2(/)2.5 E F0 32.5<8373>108
216 S(pecifying a \214le name containing a)-32.5 E F2(/)2.5 E F0
(as an ar)2.5 E(gument to the)-.18 E F2(.)2.5 E F0 -.2(bu)5 G
@ -252,7 +253,7 @@ E F2 -.3(BA)2.5 G(SH_ENV).3 E F0 32.5<8373>108 199.2 S
(hash)2.851 E F0 -.2(bu)2.851 G .351(iltin com-).2 F(mand)144 244.8 Q
32.5<8369>108 261.6 S(mporting function de\214nitions from the shell en)
-32.5 E(vironment at startup)-.4 E 32.5<8370>108 278.4 S(arsing the v)
-32.5 E(alue of)-.25 E F2(SHELLOPTS)2.5 E F0(from the shell en)2.5 E
-32.5 E(alue of)-.25 E F3(SHELLOPTS)2.5 E F0(from the shell en)2.25 E
(vironment at startup)-.4 E 32.5<8372>108 295.2 S(edirecting output usi\
ng the >, >|, <>, >&, &>, and >> redirection operators)-32.5 E 32.5
<8375>108 312 S(sing the)-32.5 E F2(exec)2.5 E F0 -.2(bu)2.5 G

File diff suppressed because it is too large Load Diff

View File

@ -2,9 +2,9 @@
Copyright (C) 1988-2009 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Fri Feb 13 18:29:03 EST 2009
@set LASTCHANGE Wed Dec 23 16:29:41 EST 2009
@set EDITION 4.0
@set VERSION 4.0
@set UPDATED 13 February 2009
@set UPDATED-MONTH February 2009
@set EDITION 4.1
@set VERSION 4.1
@set UPDATED 23 December 2009
@set UPDATED-MONTH December 2009

View File

@ -53,6 +53,7 @@ extern int errno;
extern int executing_line_number __P((void));
extern int last_command_exit_value;
extern char *shell_name;
#if defined (JOB_CONTROL)
extern pid_t shell_pgrp;
@ -331,7 +332,7 @@ parser_error (lineno, format, va_alist)
va_end (args);
if (exit_immediately_on_error)
exit_shell (2);
exit_shell (last_command_exit_value = 2);
}
#ifdef DEBUG

View File

@ -1,4 +1,4 @@
#From: Mark Kennedy <mtk@ny.ubs.com>
#From: Mark Kennedy <mark.t.kennedy@gmail.com> (<mtk@ny.ubs.com>)
#Message-ID: <35E2B899.63A02DF5@ny.ubs.com>
#Date: Tue, 25 Aug 1998 09:14:01 -0400
#To: chet@nike.ins.cwru.edu

View File

@ -357,7 +357,7 @@ int flags;
else
printf("%d\n", st->st_gid);
} else if (flags & OPT_SIZE)
printf("%ld\n", st->st_size);
printf("%ld\n", (long) st->st_size);
return (0);
}

View File

@ -72,6 +72,7 @@ printenv_builtin (list)
else
print_var_value (var, 0);
printf("\n");
return (EXECUTION_SUCCESS);
}

View File

@ -7,11 +7,13 @@
# Chet Ramey
# chet@po.cwru.edu
#
trap 'rm -f /tmp/cb$$.?' 0 1 2 3 6 15
trap 'rm -f $TMPFILE' 0 1 2 3 6 15
TMPFILE=$(mktemp -t cb.XXXXXX) || exit 1
T=$'\t'
cat << \EOF >/tmp/cb$$.1
cat << \EOF >$TMPFILE
mkalias ()
{
case $2 in
@ -31,9 +33,9 @@ EOF
# since they whole thing is going to be surrounded by single quotes when
# passed to mkalias
sed -e "s:':\\'\\\'\\':" -e "s/^\([a-zA-Z0-9_-]*\)$T\(.*\)$/mkalias \1 '\2'/" >>/tmp/cb$$.1
sed -e "s:':\\'\\\'\\':" -e "s/^\([a-zA-Z0-9_-]*\)$T\(.*\)$/mkalias \1 '\2'/" >>$TMPFILE
$BASH /tmp/cb$$.1 | sed -e 's/\$cwd/\$PWD/g' \
$BASH $TMPFILE | sed -e 's/\$cwd/\$PWD/g' \
-e 's/\$term/\$TERM/g' \
-e 's/\$home/\$HOME/g' \
-e 's/\$user/\$USER/g' \

View File

@ -7,11 +7,11 @@
# Chet Ramey
# chet@po.cwru.edu
#
trap 'rm -f /tmp/cb$$.?' 0 1 2 3 6 15
trap 'rm -f $TMPFILE' 0 1 2 3 6 15
TMPFILE=$(mktemp -t cb.XXXXXX) || exit 1
T=' '
cat << \EOF >/tmp/cb$$.1
cat << \EOF >$TMPFILE
mkalias ()
{
case $2 in
@ -31,9 +31,9 @@ EOF
# since they whole thing is going to be surrounded by single quotes when
# passed to mkalias
sed -e "s:':\\'\\\'\\':" -e "s/^\([a-zA-Z0-9_-]*\)$T\(.*\)$/mkalias \1 '\2'/" >>/tmp/cb$$.1
sed -e "s:':\\'\\\'\\':" -e "s/^\([a-zA-Z0-9_-]*\)$T\(.*\)$/mkalias \1 '\2'/" >>$TMPFILE
sh /tmp/cb$$.1 | sed -e 's/\$cwd/\$PWD/g' \
sh $TMPFILE | sed -e 's/\$cwd/\$PWD/g' \
-e 's/\$term/\$TERM/g' \
-e 's/\$home/\$HOME/g' \
-e 's/\$user/\$USER/g' \

View File

@ -15,25 +15,34 @@
# Chet Ramey
# chet@po.cwru.edu
#
trap 'rm -f /tmp/cb$$.? cshout cshin' 0 1 2 3 6 15
trap 'rm -f $TMPFILE1 $TMPFILEa $TMPFILEe $TMPFILEv $TMPFILEco $TMPFILEci' 0 1 2 3 6 15
{ TMPFILE1=$(mktemp -t cb.1.XXXXXX) &&
TMPFILEa=$(mktemp -t cb.a.XXXXXX) &&
TMPFILEe=$(mktemp -t cb.e.XXXXXX) &&
TMPFILEv=$(mktemp -t cb.v.XXXXXX) &&
TMPFILEco=$(mktemp -t cshout.XXXXXX) &&
TMPFILEci=$(mktemp -t cshin.XXXXXX)
} || exit 1
T=$'\t'
SOURCE="${1:+source $1}"
cat << EOF >cshin
cat << EOF >$TMPFILEci
$SOURCE
alias >! /tmp/cb$$.a
setenv >! /tmp/cb$$.e
set >! /tmp/cb$$.v
alias >! $TMPFILEa
setenv >! $TMPFILEe
set >! $TMPFILEv
EOF
# give csh a minimal environment, similar to what login would provide
/usr/bin/env - USER=$USER HOME=$HOME PATH=/usr/bin:/bin:/usr/ucb:. TERM=$TERM SHELL=$SHELL /bin/csh -i < ./cshin > cshout 2>&1
/usr/bin/env - USER=$USER HOME=$HOME PATH=/usr/bin:/bin:/usr/ucb:. TERM=$TERM SHELL=$SHELL /bin/csh -i < $TMPFILEci > $TMPFILEco 2>&1
# First convert aliases
cat << \EOF >/tmp/cb$$.1
cat << \EOF >$TMPFILE1
mkalias ()
{
case $2 in
@ -49,12 +58,12 @@ mkalias ()
}
EOF
sed "s/^\([a-zA-Z0-9_]*\)$T\(.*\)$/mkalias \1 '\2'/" < /tmp/cb$$.a >>/tmp/cb$$.1
sed "s/^\([a-zA-Z0-9_]*\)$T\(.*\)$/mkalias \1 '\2'/" < $TMPFILEa >>$TMPFILE1
echo '# csh aliases'
echo
$BASH /tmp/cb$$.1 | sed -e 's/\$cwd/\$PWD/g' \
$BASH $TMPFILE1 | sed -e 's/\$cwd/\$PWD/g' \
-e 's/\$term/\$TERM/g' \
-e 's/\$home/\$HOME/g' \
-e 's/\$user/\$USER/g' \
@ -70,7 +79,7 @@ sed -e '/^SHLVL/d' \
-e '/^PWD/d' \
-e "s/'/'"\\\\"''"/g \
-e "s/^\([A-Za-z0-9_]*=\)/export \1'/" \
-e "s/$/'/" < /tmp/cb$$.e
-e "s/$/'/" < $TMPFILEe
# Finally, convert local variables
echo
@ -82,7 +91,7 @@ sed -e 's/'"$T"'/=/' \
-e '/^[A-Za-z0-9_]*=[^(]/{
s/=/='"'/"'
s/$/'"'/"'
}' < /tmp/cb$$.v |
}' < $TMPFILEv |
sed -e '/^argv=/d' -e '/^cwd=/d' -e '/^filec=/d' -e '/^status=/d' \
-e '/^verbose=/d' \
-e '/^term=/d' \
@ -110,7 +119,7 @@ echo
echo '# special csh variables converted to bash equivalents'
echo
sed -e 's/'"$T"'/=/' < /tmp/cb$$.v |
sed -e 's/'"$T"'/=/' < $TMPFILEv |
grep "^cdpath=" |
sed 's/(//
s/ /:/g
@ -118,7 +127,7 @@ sed 's/(//
s/cdpath=/CDPATH=/'
sed -e 's/'"$T"'/=/' < /tmp/cb$$.v |
sed -e 's/'"$T"'/=/' < $TMPFILEv |
grep "^mail=" |
sed 's/(//
s/ /:/g

View File

@ -1,7 +1,7 @@
shcat()
{
while read -r ; do
echo "$REPLY"
printf "%s\n" "$REPLY"
done
}

View File

@ -57,6 +57,8 @@
extern int errno;
#endif
#define NEED_FPURGE_DECL
#include "bashansi.h"
#include "bashintl.h"
@ -100,7 +102,7 @@ extern int posixly_correct;
extern int expand_aliases;
extern int autocd;
extern int breaking, continuing, loop_level;
extern int parse_and_execute_level, running_trap;
extern int parse_and_execute_level, running_trap, sourcelevel;
extern int command_string_index, line_number;
extern int dot_found_in_search;
extern int already_making_children;
@ -267,6 +269,10 @@ static int showing_function_line;
static int line_number_for_err_trap;
/* A sort of function nesting level counter */
static int funcnest = 0;
int funcnest_max = 0; /* XXX - for bash-4.2 */
struct fd_bitmap *current_fds_to_close = (struct fd_bitmap *)NULL;
#define FD_BITMAP_DEFAULT_SIZE 32
@ -607,7 +613,6 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
else
exec_result = last_command_exit_value;
if (user_subshell && was_error_trap && ignore_return == 0 && invert == 0 && exec_result != EXECUTION_SUCCESS)
{
last_command_exit_value = exec_result;
@ -883,19 +888,58 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
#if defined (DPAREN_ARITHMETIC)
case cm_arith:
was_error_trap = signal_is_trapped (ERROR_TRAP) && signal_is_ignored (ERROR_TRAP) == 0;
if (ignore_return)
command->value.Arith->flags |= CMD_IGNORE_RETURN;
line_number_for_err_trap = save_line_number = line_number;
exec_result = execute_arith_command (command->value.Arith);
line_number = save_line_number;
if (was_error_trap && ignore_return == 0 && invert == 0 && exec_result != EXECUTION_SUCCESS)
{
last_command_exit_value = exec_result;
save_line_number = line_number;
line_number = line_number_for_err_trap;
run_error_trap ();
line_number = save_line_number;
}
if (ignore_return == 0 && invert == 0 && exit_immediately_on_error && exec_result != EXECUTION_SUCCESS)
{
last_command_exit_value = exec_result;
run_pending_traps ();
jump_to_top_level (ERREXIT);
}
break;
#endif
#if defined (COND_COMMAND)
case cm_cond:
was_error_trap = signal_is_trapped (ERROR_TRAP) && signal_is_ignored (ERROR_TRAP) == 0;
if (ignore_return)
command->value.Cond->flags |= CMD_IGNORE_RETURN;
save_line_number = line_number;
line_number_for_err_trap = save_line_number = line_number;
exec_result = execute_cond_command (command->value.Cond);
line_number = save_line_number;
if (was_error_trap && ignore_return == 0 && invert == 0 && exec_result != EXECUTION_SUCCESS)
{
last_command_exit_value = exec_result;
save_line_number = line_number;
line_number = line_number_for_err_trap;
run_error_trap ();
line_number = save_line_number;
}
if (ignore_return == 0 && invert == 0 && exit_immediately_on_error && exec_result != EXECUTION_SUCCESS)
{
last_command_exit_value = exec_result;
run_pending_traps ();
jump_to_top_level (ERREXIT);
}
break;
#endif
@ -1248,6 +1292,7 @@ execute_in_subshell (command, asynchronous, pipe_in, pipe_out, fds_to_close)
{
int user_subshell, return_code, function_value, should_redir_stdin, invert;
int ois, user_coproc;
int result;
COMMAND *tcom;
USE_VAR(user_subshell);
@ -1414,13 +1459,21 @@ execute_in_subshell (command, asynchronous, pipe_in, pipe_out, fds_to_close)
invert = (tcom->flags & CMD_INVERT_RETURN) != 0;
tcom->flags &= ~CMD_INVERT_RETURN;
result = setjmp (top_level);
/* If we're inside a function while executing this subshell, we
need to handle a possible `return'. */
function_value = 0;
if (return_catch_flag)
function_value = setjmp (return_catch);
if (function_value)
/* If we're going to exit the shell, we don't want to invert the return
status. */
if (result == EXITPROG)
invert = 0, return_code = last_command_exit_value;
else if (result)
return_code = EXECUTION_FAILURE;
else if (function_value)
return_code = return_catch_value;
else
return_code = execute_command_internal (tcom, asynchronous, NO_PIPE, NO_PIPE, fds_to_close);
@ -1928,7 +1981,7 @@ execute_coproc (command, pipe_in, pipe_out, fds_to_close)
int pipe_in, pipe_out;
struct fd_bitmap *fds_to_close;
{
int rpipe[2], wpipe[2];
int rpipe[2], wpipe[2], estat;
pid_t coproc_pid;
Coproc *cp;
char *tcmd;
@ -1957,7 +2010,12 @@ execute_coproc (command, pipe_in, pipe_out, fds_to_close)
close (rpipe[0]);
close (wpipe[1]);
exit (execute_in_subshell (command, 1, wpipe[0], rpipe[1], fds_to_close));
estat = execute_in_subshell (command, 1, wpipe[0], rpipe[1], fds_to_close);
fflush (stdout);
fflush (stderr);
exit (estat);
}
close (rpipe[1]);
@ -3156,10 +3214,18 @@ static int
execute_cond_node (cond)
COND_COM *cond;
{
int result, invert, patmatch, rmatch, mflags;
int result, invert, patmatch, rmatch, mflags, ignore;
char *arg1, *arg2;
invert = (cond->flags & CMD_INVERT_RETURN);
ignore = (cond->flags & CMD_IGNORE_RETURN);
if (ignore)
{
if (cond->left)
cond->left->flags |= CMD_IGNORE_RETURN;
if (cond->right)
cond->right->flags |= CMD_IGNORE_RETURN;
}
if (cond->type == COND_EXPR)
result = execute_cond_node (cond->left);
@ -3177,7 +3243,11 @@ execute_cond_node (cond)
}
else if (cond->type == COND_UNARY)
{
if (ignore)
comsub_ignore_return++;
arg1 = cond_expand_word (cond->left->op, 0);
if (ignore)
comsub_ignore_return--;
if (arg1 == 0)
arg1 = nullstr;
if (echo_command_at_execute)
@ -3197,11 +3267,19 @@ execute_cond_node (cond)
cond->op->word[2] == '\0');
#endif
if (ignore)
comsub_ignore_return++;
arg1 = cond_expand_word (cond->left->op, 0);
if (ignore)
comsub_ignore_return--;
if (arg1 == 0)
arg1 = nullstr;
if (ignore)
comsub_ignore_return++;
arg2 = cond_expand_word (cond->right->op,
(rmatch && shell_compatibility_level > 31) ? 2 : (patmatch ? 1 : 0));
if (ignore)
comsub_ignore_return--;
if (arg2 == 0)
arg2 = nullstr;
@ -3224,7 +3302,7 @@ execute_cond_node (cond)
int oe;
oe = extended_glob;
extended_glob = 1;
result = binary_test (cond->op->word, arg1, arg2, TEST_PATMATCH|TEST_ARITHEXP)
result = binary_test (cond->op->word, arg1, arg2, TEST_PATMATCH|TEST_ARITHEXP|TEST_LOCALE)
? EXECUTION_SUCCESS
: EXECUTION_FAILURE;
extended_glob = oe;
@ -3261,7 +3339,6 @@ execute_cond_command (cond_command)
/* If we're in a function, update the line number information. */
if (variable_context && interactive_shell)
line_number -= function_line_number;
command_string_index = 0;
print_cond_command (cond_command);
@ -3315,8 +3392,13 @@ execute_null_command (redirects, pipe_in, pipe_out, async)
int pipe_in, pipe_out, async;
{
int r;
int forcefork;
REDIRECT *rd;
if (pipe_in != NO_PIPE || pipe_out != NO_PIPE || async)
for (forcefork = 0, rd = redirects; rd; rd = rd->next)
forcefork += rd->rflags & REDIR_VARASSIGN;
if (forcefork || pipe_in != NO_PIPE || pipe_out != NO_PIPE || async)
{
/* We have a null command, but we really want a subshell to take
care of it. Just fork, do piping and redirections, and exit. */
@ -3457,7 +3539,7 @@ execute_simple_command (simple_command, pipe_in, pipe_out, async, fds_to_close)
command_line = (char *)0;
/* If we're in a function, update the line number information. */
if (variable_context && interactive_shell)
if (variable_context && interactive_shell && sourcelevel == 0)
line_number -= function_line_number;
/* Remember what this command line looks like at invocation. */
@ -3814,25 +3896,35 @@ execute_builtin (builtin, words, flags, subshell)
{
int old_e_flag, result, eval_unwind;
int isbltinenv;
char *error_trap;
#if 0
/* XXX -- added 12/11 */
terminate_immediately++;
#endif
error_trap = 0;
old_e_flag = exit_immediately_on_error;
/* The eval builtin calls parse_and_execute, which does not know about
the setting of flags, and always calls the execution functions with
flags that will exit the shell on an error if -e is set. If the
eval builtin is being called, and we're supposed to ignore the exit
value of the command, we turn the -e flag off ourselves, then
restore it when the command completes. This is also a problem (as
below) for the command and source/. builtins. */
value of the command, we turn the -e flag off ourselves and disable
the ERR trap, then restore them when the command completes. This is
also a problem (as below) for the command and source/. builtins. */
if (subshell == 0 && (flags & CMD_IGNORE_RETURN) &&
(builtin == eval_builtin || builtin == command_builtin || builtin == source_builtin))
{
begin_unwind_frame ("eval_builtin");
unwind_protect_int (exit_immediately_on_error);
error_trap = TRAP_STRING (ERROR_TRAP);
if (error_trap)
{
error_trap = savestring (error_trap);
add_unwind_protect (xfree, error_trap);
add_unwind_protect (set_error_trap, error_trap);
restore_default_signal (ERROR_TRAP);
}
exit_immediately_on_error = 0;
eval_unwind = 1;
}
@ -3883,6 +3975,11 @@ execute_builtin (builtin, words, flags, subshell)
if (eval_unwind)
{
exit_immediately_on_error += old_e_flag;
if (error_trap)
{
set_error_trap (error_trap);
xfree (error_trap);
}
discard_unwind_frame ("eval_builtin");
}
@ -3911,10 +4008,17 @@ execute_function (var, words, flags, fds_to_close, async, subshell)
#endif
FUNCTION_DEF *shell_fn;
char *sfile, *t;
static int funcnest = 0;
USE_VAR(fc);
#if 0 /* for bash-4.2 */
if (funcnest_max > 0 && funcnest >= funcnest_max)
{
internal_error ("%s: maximum function nesting level exceeded (%d)", var->name, funcnest);
jump_to_top_level (DISCARD);
}
#endif
#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);
@ -3936,6 +4040,7 @@ execute_function (var, words, flags, fds_to_close, async, subshell)
add_unwind_protect (dispose_command, (char *)tc);
unwind_protect_pointer (this_shell_function);
unwind_protect_int (loop_level);
unwind_protect_int (funcnest);
}
else
push_context (var->name, subshell, temporary_env); /* don't unwind-protect for subshells */
@ -4077,7 +4182,6 @@ execute_function (var, words, flags, fds_to_close, async, subshell)
if (subshell == 0)
run_unwind_frame ("function_calling");
funcnest--;
#if defined (ARRAY_VARS)
/* These two variables cannot be unset, and cannot be affected by the
function. */
@ -4092,7 +4196,12 @@ execute_function (var, words, flags, fds_to_close, async, subshell)
#endif
if (variable_context == 0 || this_shell_function == 0)
{
make_funcname_visible (0);
#if defined (PROCESS_SUBSTITUTION)
unlink_fifo_list ();
#endif
}
return (result);
}
@ -4369,7 +4478,7 @@ execute_disk_command (words, redirects, command_line, pipe_in, pipe_out,
#if defined (RESTRICTED_SHELL)
command = (char *)NULL;
if (restricted && xstrchr (pathname, '/'))
if (restricted && mbschr (pathname, '/'))
{
internal_error (_("%s: restricted: cannot specify `/' in command names"),
pathname);
@ -4482,6 +4591,7 @@ 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)
if (variable_context == 0)
unlink_fifo_list ();
#endif
FREE (command);
@ -4631,7 +4741,7 @@ initialize_subshell ()
parse_and_execute_level = 0; /* nothing left to restore it */
/* We're no longer inside a shell function. */
variable_context = return_catch_flag = 0;
variable_context = return_catch_flag = funcnest = 0;
executing_list = 0; /* XXX */

5
expr.c
View File

@ -202,7 +202,7 @@ static int expr_depth; /* Location in the stack. */
static int expr_stack_size; /* Number of slots already allocated. */
extern char *this_command_name;
extern int unbound_vars_is_error;
extern int unbound_vars_is_error, last_command_exit_value;
#if defined (ARRAY_VARS)
extern const char * const bash_badsub_errmsg;
@ -923,6 +923,7 @@ expr_streval (tok, e)
value = tok;
#endif
last_command_exit_value = EXECUTION_FAILURE;
err_unboundvar (value);
#if defined (ARRAY_VARS)
@ -1057,7 +1058,7 @@ readtok ()
#if defined (ARRAY_VARS)
if (c == '[')
{
e = skipsubscript (cp, 0);
e = skipsubscript (cp, 0, 0);
if (cp[e] == ']')
{
cp += e + 1;

View File

@ -54,6 +54,12 @@ extern void print_cond_command __P((COND_COM *));
#endif
/* set -x support */
extern void xtrace_init __P((void));
#ifdef NEED_XTRACE_SET_DECL
extern void xtrace_set __P((int, FILE *));
#endif
extern void xtrace_fdchk __P((int));
extern void xtrace_reset __P((void));
extern char *indirection_level_string __P((void));
extern void xtrace_print_assignment __P((char *, char *, int, int));
extern void xtrace_print_word_list __P((WORD_LIST *, int));
@ -135,7 +141,7 @@ extern int find_string_in_alist __P((char *, STRING_INT_ALIST *, int));
extern char *find_token_in_alist __P((int, STRING_INT_ALIST *, int));
extern int find_index_in_alist __P((char *, STRING_INT_ALIST *, int));
extern char *substring __P((char *, int, int));
extern char *substring __P((const char *, int, int));
extern char *strsub __P((char *, char *, char *, int));
extern char *strcreplace __P((char *, int, char *, int));
extern void strip_leading __P((char *));
@ -191,6 +197,10 @@ extern char *fmtullong __P((unsigned long long int, int, char *, size_t, int));
/* Declarations for functions defined in lib/sh/fmtumax.c */
extern char *fmtumax __P((uintmax_t, int, char *, size_t, int));
/* Declarations for functions defined in lib/sh/fnxform.c */
extern char *fnx_fromfs __P((char *, size_t));
extern char *fnx_tofs __P((char *, size_t));
/* Declarations for functions defined in lib/sh/fpurge.c */
#if defined NEED_FPURGE_DECL
@ -226,6 +236,21 @@ extern char *uitos __P((uintmax_t));
extern char *sh_makepath __P((const char *, const char *, int));
/* declarations for functions defined in lib/sh/mbscasecmp.c */
#if !defined (HAVE_MBSCASECMP)
extern char *mbscasecmp __P((const char *, const char *));
#endif
/* declarations for functions defined in lib/sh/mbschr.c */
#if !defined (HAVE_MBSCHR)
extern char *mbschr __P((const char *, int));
#endif
/* declarations for functions defined in lib/sh/mbscmp.c */
#if !defined (HAVE_MBSCMP)
extern char *mbscmp __P((const char *, const char *));
#endif
/* declarations for functions defined in lib/sh/netconn.c */
extern int isnetconn __P((int));
@ -295,6 +320,11 @@ extern int strncasecmp __P((const char *, const char *, int));
extern int strcasecmp __P((const char *, const char *));
#endif /* HAVE_STRCASECMP */
/* declarations for functions defined in lib/sh/strcasestr.c */
#if ! HAVE_STRCASESTR
extern char *strcasestr __P((const char *, const char *));
#endif
/* declarations for functions defined in lib/sh/strerror.c */
#if !defined (HAVE_STRERROR) && !defined (strerror)
extern char *strerror __P((int));
@ -305,9 +335,6 @@ extern char *strerror __P((int));
extern size_t strftime __P((char *, size_t, const char *, const struct tm *));
#endif
/* declarations for functions defined in lib/sh/strindex.c */
extern char *strindex __P((const char *, const char *));
/* declarations for functions and structures defined in lib/sh/stringlist.c */
/* This is a general-purpose argv-style array struct. */
@ -424,10 +451,6 @@ extern unsigned int fsleep __P((unsigned int, unsigned int));
/* declarations for functions defined in lib/sh/winsize.c */
extern void get_new_window_size __P((int, int *, int *));
/* declarations for functions defined in lib/sh/xstrchr.c */
#undef xstrchr
extern char *xstrchr __P((const char *, int));
/* declarations for functions defined in lib/sh/zcatfd.c */
extern int zcatfd __P((int, int, char *));

View File

@ -93,7 +93,18 @@ file_status (name)
r = FS_EXISTS;
#if defined (AFS)
#if defined (HAVE_EACCESS)
/* Use eaccess(2) if we have it to take things like ACLs and other
file access mechanisms into account. eaccess uses the effective
user and group IDs, not the real ones. We could use sh_eaccess,
but we don't want any special treatment for /dev/fd. */
if (eaccess (name, X_OK) == 0)
r |= FS_EXECABLE;
if (eaccess (name, R_OK) == 0)
r |= FS_READABLE;
return r;
#elif defined (AFS)
/* 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. */
@ -103,7 +114,7 @@ file_status (name)
r |= FS_READABLE;
return r;
#else /* !AFS */
#else /* !HAVE_EACCESS && !AFS */
/* Find out if the file is actually executable. By definition, the
only other criteria is that the file has an execute bit set that

View File

@ -98,7 +98,7 @@ string_to_rlimtype (s)
neg = 0;
while (s && *s && whitespace (*s))
s++;
if (*s == '-' || *s == '+')
if (s && (*s == '-' || *s == '+'))
{
neg = *s == '-';
s++;
@ -285,7 +285,7 @@ assignment (string, flags)
#if defined (ARRAY_VARS)
if (c == '[')
{
newi = skipsubscript (string, indx);
newi = skipsubscript (string, indx, 0);
if (string[newi++] != ']')
return (0);
if (string[newi] == '+' && string[newi+1] == '=')
@ -577,7 +577,7 @@ int
absolute_program (string)
const char *string;
{
return ((char *)xstrchr (string, '/') != (char *)NULL);
return ((char *)mbschr (string, '/') != (char *)NULL);
}
/* **************************************************************** */
@ -717,7 +717,7 @@ trim_pathname (name, maxlen)
for (ndirs = 0, ntail = nbeg; *ntail; ntail++)
if (*ntail == '/')
ndirs++;
if (ndirs <= nskip)
if (ndirs < nskip)
return name;
for (ntail = (*nend == '/') ? nend : nend - 1; ntail > nbeg; ntail--)

View File

@ -70,7 +70,7 @@ extern char *strcpy __P((char *, const char *));
#endif
#ifndef member
# define member(c, s) ((c) ? ((char *)xstrchr ((s), (c)) != (char *)NULL) : 0)
# define member(c, s) ((c) ? ((char *)mbschr ((s), (c)) != (char *)NULL) : 0)
#endif
#ifndef whitespace

View File

@ -177,7 +177,7 @@ hash_search (string, table, flags)
bucket = HASH_BUCKET (string, table, hv);
for (list = table->bucket_array[bucket]; list; list = list->next)
for (list = table->bucket_array ? table->bucket_array[bucket] : 0; list; list = list->next)
{
if (hv == list->khash && STREQ (list->key, string))
{

18
jobs.c
View File

@ -1708,6 +1708,10 @@ make_child (command, async_p)
/* Create the child, handle severe errors. Retry on EAGAIN. */
while ((pid = fork ()) < 0 && errno == EAGAIN && forksleep < FORKSLEEP_MAX)
{
#if 0 /* for bash-4.2 */
/* If we can't create any children, try to reap some dead ones. */
waitchld (-1, 0);
#endif
sys_error ("fork: retry");
if (sleep (forksleep) != 0)
break;
@ -1725,6 +1729,7 @@ make_child (command, async_p)
if (the_pipeline)
kill_current_pipeline ();
last_command_exit_value = EX_NOEXEC;
throw_to_top_level (); /* Reset signals, etc. */
}
@ -2371,6 +2376,8 @@ wait_for (pid)
if (interactive && job_control == 0)
QUIT;
/* Check for terminating signals and exit the shell if we receive one */
CHECK_TERMSIG;
/* If we say wait_for (), then we have a record of this child somewhere.
If it and none of its peers are running, don't call waitchld(). */
@ -2449,6 +2456,8 @@ wait_for (pid)
old SIGINT signal handler. */
if (interactive && job_control == 0)
QUIT;
/* Check for terminating signals and exit the shell if we receive one */
CHECK_TERMSIG;
}
while (PRUNNING (child) || (job != NO_JOB && RUNNING (job)));
@ -3042,8 +3051,15 @@ waitchld (wpid, block)
: 0;
if (sigchld || block == 0)
waitpid_flags |= WNOHANG;
/* Check for terminating signals and exit the shell if we receive one */
CHECK_TERMSIG;
if (block == 1 && queue_sigchld == 0 && (waitpid_flags & WNOHANG) == 0)
{
internal_warning (_("waitchld: turning on WNOHANG to avoid indefinite block"));
waitpid_flags |= WNOHANG;
}
pid = WAITPID (-1, &status, waitpid_flags);
/* WCONTINUED may be rejected by waitpid as invalid even when defined */
@ -3137,7 +3153,7 @@ waitchld (wpid, block)
if (job_control && signal_is_trapped (SIGCHLD) && children_exited &&
trap_list[SIGCHLD] != (char *)IGNORE_SIG)
{
if (this_shell_builtin && this_shell_builtin == wait_builtin)
if (posixly_correct && this_shell_builtin && this_shell_builtin == wait_builtin)
{
interrupt_immediately = 0;
trap_handler (SIGCHLD); /* set pending_traps[SIGCHLD] */

View File

@ -246,6 +246,7 @@ udequote_pathname (pathname)
if (pathname[i - 1] == 0)
break;
}
if (pathname)
pathname[j] = '\0';
}
@ -279,6 +280,7 @@ wdequote_pathname (pathname)
if (wpathname[i - 1] == L'\0')
break;
}
if (wpathname)
wpathname[j] = L'\0';
/* Convert the wide character string into unibyte character set. */
@ -307,9 +309,9 @@ dequote_pathname (pathname)
# define GLOB_TESTNAME(name) (lstat (name, &finfo))
#else /* !HAVE_LSTAT */
# if !defined (AFS)
# define GLOB_TESTNAME(name) (sh_eaccess (nextname, F_OK))
# define GLOB_TESTNAME(name) (sh_eaccess (name, F_OK))
# else /* AFS */
# define GLOB_TESTNAME(name) (access (nextname, F_OK))
# define GLOB_TESTNAME(name) (access (name, F_OK))
# endif /* AFS */
#endif /* !HAVE_LSTAT */
@ -320,6 +322,7 @@ glob_testdir (dir)
{
struct stat finfo;
/*itrace("glob_testdir: testing %s", dir);*/
if (stat (dir, &finfo) < 0)
return (-1);
@ -426,13 +429,14 @@ glob_vector (pat, dir, flags)
register struct globval *nextlink;
register char *nextname, *npat, *subdir;
unsigned int count;
int lose, skip, ndirs, isdir, sdlen, add_current;
int lose, skip, ndirs, isdir, sdlen, add_current, patlen;
register char **name_vector;
register unsigned int i;
int mflags; /* Flags passed to strmatch (). */
int pflags; /* flags passed to sh_makepath () */
int nalloca;
struct globval *firstmalloc, *tmplink;
char *convfn;
lastlink = 0;
count = lose = skip = add_current = 0;
@ -466,6 +470,8 @@ glob_vector (pat, dir, flags)
skip = 1;
}
patlen = strlen (pat);
/* If the filename pattern (PAT) does not contain any globbing characters,
we can dispense with reading the directory, and just see if there is
a filename `DIR/PAT'. If there is, and we can access it, just make the
@ -479,8 +485,8 @@ glob_vector (pat, dir, flags)
return ((char **) &glob_error_return);
dirlen = strlen (dir);
nextname = (char *)malloc (dirlen + strlen (pat) + 2);
npat = (char *)malloc (strlen (pat) + 1);
nextname = (char *)malloc (dirlen + patlen + 2);
npat = (char *)malloc (patlen + 1);
if (nextname == 0 || npat == 0)
lose = 1;
else
@ -634,7 +640,8 @@ glob_vector (pat, dir, flags)
continue;
}
if (strmatch (pat, dp->d_name, mflags) != FNM_NOMATCH)
convfn = fnx_fromfs (dp->d_name, D_NAMLEN (dp));
if (strmatch (pat, convfn, mflags) != FNM_NOMATCH)
{
if (nalloca < ALLOCA_MAX)
{
@ -1023,7 +1030,7 @@ glob_filename (pathname, flags)
dflags |= GX_ALLDIRS|GX_ADDCURDIR;
#if 0
/* If we want all directories (dflags & GX_ALLDIRS) and we're not
being called recursively as something like `echo **/*.o'
being called recursively as something like `echo [star][star]/[star].o'
((flags & GX_ALLDIRS) == 0), we want to prevent glob_vector from
adding a null directory name to the front of the temp_results
array. We turn off ADDCURDIR if not called recursively and

View File

@ -418,6 +418,13 @@ rl_generic_bind (type, keyseq, data, map)
{
map = FUNCTION_TO_KEYMAP (map, ic);
ic = ANYOTHERKEY;
/* If we're trying to override a keymap with a null function
(e.g., trying to unbind it), we can't use a null pointer
here because that's indistinguishable from having not been
overridden. We use a special bindable function that does
nothing. */
if (type == ISFUNC && data == 0)
data = (char *)_rl_null_function;
}
map[ic].function = KEYMAP_TO_FUNCTION (data);
@ -1419,7 +1426,9 @@ static const struct {
{ "completion-ignore-case", &_rl_completion_case_fold, 0 },
{ "convert-meta", &_rl_convert_meta_chars_to_ascii, 0 },
{ "disable-completion", &rl_inhibit_completion, 0 },
{ "echo-control-characters", &_rl_echo_control_chars, 0 },
{ "enable-keypad", &_rl_enable_keypad, 0 },
{ "enable-meta-key", &_rl_enable_meta, 0 },
{ "expand-tilde", &rl_complete_with_tilde_expansion, 0 },
{ "history-preserve-point", &_rl_history_preserve_point, 0 },
{ "horizontal-scroll-mode", &_rl_horizontal_scroll_mode, 0 },
@ -1436,6 +1445,7 @@ static const struct {
{ "revert-all-at-newline", &_rl_revert_all_at_newline, 0 },
{ "show-all-if-ambiguous", &_rl_complete_show_all, 0 },
{ "show-all-if-unmodified", &_rl_complete_show_unmodified, 0 },
{ "skip-completed-text", &_rl_skip_completed_text, 0 },
#if defined (VISIBLE_STATS)
{ "visible-stats", &rl_visible_stats, 0 },
#endif /* VISIBLE_STATS */

View File

@ -179,6 +179,12 @@ int _rl_completion_prefix_display_length = 0;
int rl_visible_stats = 0;
#endif /* VISIBLE_STATS */
/* If non-zero, when completing in the middle of a word, don't insert
characters from the match that match characters following point in
the word. This means, for instance, completing when the cursor is
after the `e' in `Makefile' won't result in `Makefilefile'. */
int _rl_skip_completed_text = 0;
/* If non-zero, then this is the address of a function to call when
completing on a directory name. The function is called with
the address of a string (the current directory name) as an arg. */
@ -186,6 +192,17 @@ rl_icppfunc_t *rl_directory_completion_hook = (rl_icppfunc_t *)NULL;
rl_icppfunc_t *rl_directory_rewrite_hook = (rl_icppfunc_t *)NULL;
/* If non-zero, this is the address of a function to call when reading
directory entries from the filesystem for completion and comparing
them to the partial word to be completed. The function should
either return its first argument (if no conversion takes place) or
newly-allocated memory. This can, for instance, convert filenames
between character sets for comparison against what's typed at the
keyboard. The returned value is what is added to the list of
matches. The second argument is the length of the filename to be
converted. */
rl_dequote_func_t *rl_filename_rewrite_hook = (rl_dequote_func_t *)NULL;
/* Non-zero means readline completion functions perform tilde expansion. */
int rl_complete_with_tilde_expansion = 0;
@ -1021,6 +1038,7 @@ gen_completion_matches (text, start, end, our_func, found_quote, quote_char)
{
_rl_interrupt_immediately++;
matches = (*rl_attempted_completion_function) (text, start, end);
if (_rl_interrupt_immediately > 0)
_rl_interrupt_immediately--;
if (matches || rl_attempted_completion_over)
@ -1551,8 +1569,9 @@ insert_match (match, start, mtype, qc)
int start, mtype;
char *qc;
{
char *replacement;
char *replacement, *r;
char oqc;
int end, rlen;
oqc = qc ? *qc : '\0';
replacement = make_quoted_replacement (match, mtype, qc);
@ -1560,6 +1579,7 @@ insert_match (match, start, mtype, qc)
/* Now insert the match. */
if (replacement)
{
rlen = strlen (replacement);
/* Don't double an opening quote character. */
if (qc && *qc && start && rl_line_buffer[start - 1] == *qc &&
replacement[0] == *qc)
@ -1569,7 +1589,24 @@ insert_match (match, start, mtype, qc)
else if (qc && (*qc != oqc) && start && rl_line_buffer[start - 1] == oqc &&
replacement[0] != oqc)
start--;
_rl_replace_text (replacement, start, rl_point - 1);
end = rl_point - 1;
/* Don't double a closing quote character */
if (qc && *qc && end && rl_line_buffer[rl_point] == *qc && replacement[rlen - 1] == *qc)
end++;
if (_rl_skip_completed_text)
{
r = replacement;
while (start < rl_end && *r && rl_line_buffer[start] == *r)
{
start++;
r++;
}
if (start <= end || *r)
_rl_replace_text (r, start, end);
rl_point = start + strlen (r);
}
else
_rl_replace_text (replacement, start, end);
if (replacement != match)
free (replacement);
}
@ -1893,6 +1930,7 @@ rl_completion_matches (text, entry_function)
match_list[++matches] = string;
match_list[matches + 1] = (char *)NULL;
}
if (_rl_interrupt_immediately > 0)
_rl_interrupt_immediately--;
/* If there were any matches, then look through them finding out the
@ -1981,8 +2019,8 @@ rl_filename_completion_function (text, state)
static char *dirname = (char *)NULL;
static char *users_dirname = (char *)NULL;
static int filename_len;
char *temp;
int dirlen;
char *temp, *dentry, *convfn;
int dirlen, dentlen, convlen;
struct dirent *entry;
/* If we don't have any state, then do some initialization. */
@ -2086,6 +2124,15 @@ rl_filename_completion_function (text, state)
entry = (struct dirent *)NULL;
while (directory && (entry = readdir (directory)))
{
convfn = dentry = entry->d_name;
convlen = dentlen = D_NAMLEN (entry);
if (rl_filename_rewrite_hook)
{
convfn = (*rl_filename_rewrite_hook) (dentry, dentlen);
convlen = (convfn == dentry) ? dentlen : strlen (convfn);
}
/* Special case for no filename. If the user has disabled the
`match-hidden-files' variable, skip filenames beginning with `.'.
All other entries except "." and ".." match. */
@ -2094,9 +2141,8 @@ rl_filename_completion_function (text, state)
if (_rl_match_hidden_files == 0 && HIDDEN_FILE (entry->d_name))
continue;
if (entry->d_name[0] != '.' ||
(entry->d_name[1] &&
(entry->d_name[1] != '.' || entry->d_name[2])))
if (convfn[0] != '.' ||
(convfn[1] && (convfn[1] != '.' || convfn[2])))
break;
}
else
@ -2105,16 +2151,16 @@ rl_filename_completion_function (text, state)
it is a match. */
if (_rl_completion_case_fold)
{
if ((_rl_to_lower (entry->d_name[0]) == _rl_to_lower (filename[0])) &&
(((int)D_NAMLEN (entry)) >= filename_len) &&
(_rl_strnicmp (filename, entry->d_name, filename_len) == 0))
if ((_rl_to_lower (convfn[0]) == _rl_to_lower (filename[0])) &&
(convlen >= filename_len) &&
(_rl_strnicmp (filename, convfn, filename_len) == 0))
break;
}
else
{
if ((entry->d_name[0] == filename[0]) &&
(((int)D_NAMLEN (entry)) >= filename_len) &&
(strncmp (filename, entry->d_name, filename_len) == 0))
if ((convfn[0] == filename[0]) &&
(convlen >= filename_len) &&
(strncmp (filename, convfn, filename_len) == 0))
break;
}
}
@ -2176,19 +2222,22 @@ rl_filename_completion_function (text, state)
strcpy (temp + dirlen, entry->d_name);
}
else
temp = savestring (entry->d_name);
temp = savestring (convfn);
if (convfn != dentry)
free (convfn);
return (temp);
}
}
/* An initial implementation of a menu completion function a la tcsh. The
first time (if the last readline command was not rl_menu_complete), we
first time (if the last readline command was not rl_old_menu_complete), we
generate the list of matches. This code is very similar to the code in
rl_complete_internal -- there should be a way to combine the two. Then,
for each item in the list of matches, we insert the match in an undoable
fashion, with the appropriate character appended (this happens on the
second and subsequent consecutive calls to rl_menu_complete). When we
second and subsequent consecutive calls to rl_old_menu_complete). When we
hit the end of the match list, we restore the original unmatched text,
ring the bell, and reset the counter to zero. */
int
@ -2330,7 +2379,7 @@ rl_menu_complete (count, ignore)
/* The first time through, we generate the list of matches and set things
up to insert them. */
if (rl_last_func != rl_menu_complete || full_completion)
if ((rl_last_func != rl_menu_complete && rl_last_func != rl_backward_menu_complete) || full_completion)
{
/* Clean up from previous call, if any. */
FREE (orig_text);
@ -2470,3 +2519,12 @@ rl_menu_complete (count, ignore)
completion_changed_buffer = 1;
return (0);
}
int
rl_backward_menu_complete (count, key)
int count, key;
{
/* Positive arguments to backward-menu-complete translate into negative
arguments for menu-complete, and vice versa. */
return (rl_menu_complete (-count, key));
}

View File

@ -94,9 +94,9 @@ static int line_structures_initialized = 0;
#define invisible_line (line_state_invisible->line)
#if defined (HANDLE_MULTIBYTE)
static int _rl_col_width PARAMS((const char *, int, int));
static int _rl_col_width PARAMS((const char *, int, int, int));
#else
# define _rl_col_width(l, s, e) (((e) <= (s)) ? 0 : (e) - (s))
# define _rl_col_width(l, s, e, f) (((e) <= (s)) ? 0 : (e) - (s))
#endif
/* Heuristic used to decide whether it is faster to move from CUR to NEW
@ -312,7 +312,7 @@ expand_prompt (pmt, lp, lip, niflp, vlp)
not be the same as the number of physical characters
on the screen in the presence of multibyte characters */
rl += ind - pind;
physchars += _rl_col_width (pmt, pind, ind);
physchars += _rl_col_width (pmt, pind, ind, 0);
}
else
ninvis += ind - pind;
@ -688,7 +688,7 @@ rl_redisplay ()
temp = local_prompt_len;
while (num < temp)
{
z = _rl_col_width (local_prompt, n0, num);
z = _rl_col_width (local_prompt, n0, num, 1);
if (z > _rl_screenwidth)
{
num = _rl_find_prev_mbchar (local_prompt, num, MB_FIND_ANY);
@ -714,7 +714,7 @@ rl_redisplay ()
inv_lbreaks[++newlines] = temp;
#if defined (HANDLE_MULTIBYTE)
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0 && prompt_multibyte_chars > 0)
lpos -= _rl_col_width (local_prompt, n0, num);
lpos -= _rl_col_width (local_prompt, n0, num, 1);
else
#endif
lpos -= _rl_screenwidth;
@ -733,6 +733,7 @@ rl_redisplay ()
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
{
memset (&ps, 0, sizeof (mbstate_t));
/* XXX - what if wc_bytes ends up <= 0? check for MB_INVALIDCH */
wc_bytes = mbrtowc (&wc, rl_line_buffer, rl_end, &ps);
}
else
@ -893,6 +894,7 @@ rl_redisplay ()
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
{
in += wc_bytes;
/* XXX - what if wc_bytes ends up <= 0? check for MB_INVALIDCH */
wc_bytes = mbrtowc (&wc, rl_line_buffer + in, rl_end - in, &ps);
}
else
@ -958,6 +960,11 @@ rl_redisplay ()
#define VIS_LINE(line) ((line) > _rl_vis_botlin) ? "" : VIS_CHARS(line)
#define INV_LINE(line) (invisible_line + inv_lbreaks[line])
#define OLD_CPOS_IN_PROMPT() (cpos_adjusted == 0 && \
_rl_last_c_pos != o_cpos && \
_rl_last_c_pos > wrap_offset && \
o_cpos < prompt_last_invisible)
/* For each line in the buffer, do the updating display. */
for (linenum = 0; linenum <= inv_botlin; linenum++)
{
@ -980,11 +987,7 @@ rl_redisplay ()
time update_line is called, then we can assume in our
calculations that o_cpos does not need to be adjusted by
wrap_offset. */
if (linenum == 0 && (MB_CUR_MAX > 1 && rl_byte_oriented == 0) &&
cpos_adjusted == 0 &&
_rl_last_c_pos != o_cpos &&
_rl_last_c_pos > wrap_offset &&
o_cpos < prompt_last_invisible)
if (linenum == 0 && (MB_CUR_MAX > 1 && rl_byte_oriented == 0) && OLD_CPOS_IN_PROMPT())
_rl_last_c_pos -= prompt_invis_chars_first_line; /* XXX - was wrap_offset */
else if (linenum == prompt_last_screen_line && prompt_physical_chars > _rl_screenwidth &&
(MB_CUR_MAX > 1 && rl_byte_oriented == 0) &&
@ -1084,7 +1087,7 @@ rl_redisplay ()
_rl_output_some_chars (local_prompt, nleft);
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
_rl_last_c_pos = _rl_col_width (local_prompt, 0, nleft) - wrap_offset + modmark;
_rl_last_c_pos = _rl_col_width (local_prompt, 0, nleft, 1) - wrap_offset + modmark;
else
_rl_last_c_pos = nleft + modmark;
}
@ -1108,7 +1111,7 @@ rl_redisplay ()
{
/* TX == new physical cursor position in multibyte locale. */
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
tx = _rl_col_width (&visible_line[pos], 0, nleft) - visible_wrap_offset;
tx = _rl_col_width (&visible_line[pos], 0, nleft, 1) - visible_wrap_offset;
else
tx = nleft;
if (tx >= 0 && _rl_last_c_pos > tx)
@ -1201,11 +1204,7 @@ rl_redisplay ()
_rl_screenwidth + (lmargin ? 0 : wrap_offset),
0);
if ((MB_CUR_MAX > 1 && rl_byte_oriented == 0) &&
cpos_adjusted == 0 &&
_rl_last_c_pos != o_cpos &&
_rl_last_c_pos > wrap_offset &&
o_cpos < prompt_last_invisible)
if ((MB_CUR_MAX > 1 && rl_byte_oriented == 0) && OLD_CPOS_IN_PROMPT())
_rl_last_c_pos -= prompt_invis_chars_first_line; /* XXX - was wrap_offset */
/* If the visible new line is shorter than the old, but the number
@ -1320,7 +1319,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
if (tempwidth > 0)
{
int count;
int count, i;
bytes = ret;
for (count = 0; count < bytes; count++)
putc (new[count], rl_outstream);
@ -1331,10 +1330,13 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
if (ret != 0 && bytes != 0)
{
if (MB_INVALIDCH (ret))
memmove (old+bytes, old+1, strlen (old+1));
else
ret = 1;
memmove (old+bytes, old+ret, strlen (old+ret));
memcpy (old, new, bytes);
/* Fix up indices if we copy data from one line to another */
omax += bytes - ret;
for (i = current_line+1; i < inv_botlin+1; i++)
vis_lbreaks[i] += bytes - ret;
}
}
else
@ -1528,7 +1530,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
{
/* We take wrap_offset into account here so we can pass correct
information to _rl_move_cursor_relative. */
_rl_last_c_pos = _rl_col_width (local_prompt, 0, lendiff) - wrap_offset + modmark;
_rl_last_c_pos = _rl_col_width (local_prompt, 0, lendiff, 1) - wrap_offset + modmark;
cpos_adjusted = 1;
}
else
@ -1559,7 +1561,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
When not using multibyte characters, these are equal */
lendiff = (nls - nfd) - (ols - ofd);
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
col_lendiff = _rl_col_width (new, nfd - new, nls - new) - _rl_col_width (old, ofd - old, ols - old);
col_lendiff = _rl_col_width (new, nfd - new, nls - new, 1) - _rl_col_width (old, ofd - old, ols - old, 1);
else
col_lendiff = lendiff;
@ -1584,7 +1586,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
/* Insert (diff (len (old), len (new)) ch. */
temp = ne - nfd;
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
col_temp = _rl_col_width (new, nfd - new, ne - new);
col_temp = _rl_col_width (new, nfd - new, ne - new, 1);
else
col_temp = temp;
@ -1601,7 +1603,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
if (lendiff < 0)
{
_rl_output_some_chars (nfd, temp);
_rl_last_c_pos += _rl_col_width (nfd, 0, temp);
_rl_last_c_pos += _rl_col_width (nfd, 0, temp, 1);
/* If nfd begins before any invisible characters in the prompt,
adjust _rl_last_c_pos to account for wrap_offset and set
cpos_adjusted to let the caller know. */
@ -1679,7 +1681,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
multibyte characters and prompt strings with invisible
characters, but was previously disabled. */
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
twidth = _rl_col_width (nfd+lendiff, 0, temp-col_lendiff);
twidth = _rl_col_width (nfd+lendiff, 0, temp-col_lendiff, 1);
else
twidth = temp - lendiff;
_rl_last_c_pos += twidth;
@ -1738,7 +1740,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
_rl_output_some_chars (nfd, temp);
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
{
_rl_last_c_pos += _rl_col_width (nfd, 0, temp);
_rl_last_c_pos += _rl_col_width (nfd, 0, temp, 1);
if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
{
_rl_last_c_pos -= wrap_offset;
@ -1771,7 +1773,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
}
lendiff = (oe - old) - (ne - new);
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
col_lendiff = _rl_col_width (old, 0, oe - old) - _rl_col_width (new, 0, ne - new);
col_lendiff = _rl_col_width (old, 0, oe - old, 1) - _rl_col_width (new, 0, ne - new, 1);
else
col_lendiff = lendiff;
@ -1838,7 +1840,7 @@ rl_on_new_line_with_prompt ()
l = strlen (prompt_last_line);
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
_rl_last_c_pos = _rl_col_width (prompt_last_line, 0, l); /* XXX */
_rl_last_c_pos = _rl_col_width (prompt_last_line, 0, l, 1); /* XXX */
else
_rl_last_c_pos = l;
@ -1900,6 +1902,7 @@ _rl_move_cursor_relative (new, data)
register int i;
int woff; /* number of invisible chars on current line */
int cpos, dpos; /* current and desired cursor positions */
int adjust;
woff = WRAP_OFFSET (_rl_last_v_pos, wrap_offset);
cpos = _rl_last_c_pos;
@ -1915,15 +1918,34 @@ _rl_move_cursor_relative (new, data)
as long as we are past them and they are counted by _rl_col_width. */
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
{
dpos = _rl_col_width (data, 0, new);
adjust = 1;
/* Try to short-circuit common cases and eliminate a bunch of multibyte
character function calls. */
/* 1. prompt string */
if (new == local_prompt_len && memcmp (data, local_prompt, new) == 0)
{
dpos = prompt_physical_chars;
cpos_adjusted = 1;
adjust = 0;
}
/* 2. prompt_string + line contents */
else if (new > local_prompt_len && local_prompt && memcmp (data, local_prompt, local_prompt_len) == 0)
{
dpos = prompt_physical_chars + _rl_col_width (data, local_prompt_len, new, 1);
cpos_adjusted = 1;
adjust = 0;
}
else
dpos = _rl_col_width (data, 0, new, 1);
/* Use NEW when comparing against the last invisible character in the
prompt string, since they're both buffer indices and DPOS is a
desired display position. */
if ((new > prompt_last_invisible) || /* XXX - don't use woff here */
if (adjust && ((new > prompt_last_invisible) || /* XXX - don't use woff here */
(prompt_physical_chars >= _rl_screenwidth &&
_rl_last_v_pos == prompt_last_screen_line &&
wrap_offset >= woff && dpos >= woff &&
new > (prompt_last_invisible-(_rl_screenwidth*_rl_last_v_pos)-wrap_offset)))
new > (prompt_last_invisible-(_rl_screenwidth*_rl_last_v_pos)-wrap_offset))))
/* XXX last comparison might need to be >= */
{
dpos -= woff;
@ -2566,9 +2588,9 @@ _rl_current_display_line ()
In the case of multibyte characters with stateful encoding, we have to
scan from the beginning of the string to take the state into account. */
static int
_rl_col_width (str, start, end)
_rl_col_width (str, start, end, flags)
const char *str;
int start, end;
int start, end, flags;
{
wchar_t wc;
mbstate_t ps;
@ -2587,6 +2609,20 @@ _rl_ttymsg ("_rl_col_width: called with MB_CUR_MAX == 1");
point = 0;
max = end;
/* Try to short-circuit common cases. The adjustment to remove wrap_offset
is done by the caller. */
/* 1. prompt string */
if (flags && start == 0 && end == local_prompt_len && memcmp (str, local_prompt, local_prompt_len) == 0)
return (prompt_physical_chars + wrap_offset);
/* 2. prompt string + line contents */
else if (flags && start == 0 && local_prompt_len > 0 && end > local_prompt_len && local_prompt && memcmp (str, local_prompt, local_prompt_len) == 0)
{
tmp = prompt_physical_chars + wrap_offset;
/* XXX - try to call ourselves recursively with non-prompt portion */
tmp += _rl_col_width (str, local_prompt_len, end, flags);
return (tmp);
}
while (point < start)
{
tmp = mbrlen (str + point, max, &ps);

View File

@ -1,12 +1,12 @@
@c The GNU Free Documentation License.
@center Version 1.2, November 2002
@center Version 1.3, 3 November 2008
@c This file is intended to be included within another document,
@c hence no sectioning command or @node.
@display
Copyright @copyright{} 2000,2001,2002 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
Copyright @copyright{} 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
@uref{http://fsf.org/}
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@ -111,6 +111,9 @@ 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.
The ``publisher'' means any person or entity that distributes copies
of the Document to the public.
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
@ -379,13 +382,30 @@ 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.
You may not copy, modify, sublicense, or distribute the Document
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense, or distribute it is void, and
will automatically terminate your rights under this License.
However, if you cease all violation of this License, then your license
from a particular copyright holder is reinstated (a) provisionally,
unless and until the copyright holder explicitly and finally
terminates your license, and (b) permanently, if the copyright holder
fails to notify you of the violation by some reasonable means prior to
60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, receipt of a copy of some or all of the same material does
not give you any rights to use it.
@item
FUTURE REVISIONS OF THIS LICENSE
@ -403,7 +423,42 @@ 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.
as a draft) by the Free Software Foundation. If the Document
specifies that a proxy can decide which future versions of this
License can be used, that proxy's public statement of acceptance of a
version permanently authorizes you to choose that version for the
Document.
@item
RELICENSING
``Massive Multiauthor Collaboration Site'' (or ``MMC Site'') means any
World Wide Web server that publishes copyrightable works and also
provides prominent facilities for anybody to edit those works. A
public wiki that anybody can edit is an example of such a server. A
``Massive Multiauthor Collaboration'' (or ``MMC'') contained in the
site means any set of copyrightable works thus published on the MMC
site.
``CC-BY-SA'' means the Creative Commons Attribution-Share Alike 3.0
license published by Creative Commons Corporation, a not-for-profit
corporation with a principal place of business in San Francisco,
California, as well as future copyleft versions of that license
published by that same organization.
``Incorporate'' means to publish or republish a Document, in whole or
in part, as part of another Document.
An MMC is ``eligible for relicensing'' if it is licensed under this
License, and if all works that were first published under this License
somewhere other than this MMC, and subsequently incorporated in whole
or in part into the MMC, (1) had no cover texts or invariant sections,
and (2) were thus incorporated prior to November 1, 2008.
The operator of an MMC Site may republish an MMC contained in the site
under CC-BY-SA on the same site at any time before August 1, 2009,
provided the MMC is eligible for relicensing.
@end enumerate
@page
@ -417,7 +472,7 @@ license notices just after the title page:
@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
under the terms of the GNU Free Documentation License, Version 1.3
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

View File

@ -20,7 +20,7 @@ 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.2 or
under the terms of the GNU Free Documentation License, Version 1.3 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

View File

@ -21,7 +21,7 @@ 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.2 or
under the terms of the GNU Free Documentation License, Version 1.3 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

View File

@ -622,7 +622,7 @@ 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.
@code{rl_free_keymap()} when done.
@end deftypefun
@deftypefun Keymap rl_copy_keymap (Keymap map)
@ -636,7 +636,13 @@ the Meta digits bound to produce numeric arguments.
@end deftypefun
@deftypefun void rl_discard_keymap (Keymap keymap)
Free the storage associated with @var{keymap}.
Free the storage associated with the data in @var{keymap}.
The caller should free @var{keymap}.
@end deftypefun
@deftypefun void rl_free_keymap (Keymap keymap)
Free all storage associated with @var{keymap}. This calls
@code{rl_discard_keymap} to free subordindate keymaps and macros.
@end deftypefun
Readline has several internal keymaps. These functions allow you to
@ -1722,6 +1728,35 @@ remove any quote characters from the directory name, because its result will
be passed directly to @code{opendir()}.
@end deftypevar
@ignore
@deftypevar extern rl_icppfunc_t *rl_directory_rewrite_hook;
If non-zero, this is the address of a function to call when completing
a directory name. This function takes the address of the directory name
to be modified as an argument. Unlike @code{rl_directory_completion_hook},
it only modifies the directory name used in @code{opendir}, not what is
displayed when the possible completions are printed or inserted. It is
called before rl_directory_completion_hook.
I'm not happy with how this worksyet, so it's undocumented.
@end deftypevar
@end ignore
@deftypevar {rl_dequote_func_t *} rl_filename_rewrite_hook
If non-zero, this is the address of a function called when reading
directory entries from the filesystem for completion and comparing
them to the partial word to be completed. The function should
perform any necesary application or system-specific conversion on
the filename, such as converting between character sets or converting
from a filesystem format to a character input format.
The function takes two arguments: @var{fname}, the filename to be converted,
and @var{fnlen}, its length in bytes.
It must either return its first argument (if no conversion takes place)
or the converted filename in newly-allocated memory. The converted
form is used to compare against the word to be completed, and, if it
matches, is added to the list of matches. Readline will free the
allocated string.
@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.

View File

@ -474,12 +474,23 @@ 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 echo-control-characters
When set to @samp{on}, on operating systems that indicate they support it,
readline echoes a character corresponding to a signal generated from the
keyboard. The default is @samp{on}.
@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 enable-meta-key
When set to @samp{on}, Readline will try to enable any meta modifier
key the terminal claims to support when it is called. On many terminals,
the meta key is used to send eight-bit characters.
The default is @samp{on}.
@item expand-tilde
@vindex expand-tilde
If set to @samp{on}, tilde expansion is performed when Readline
@ -606,6 +617,20 @@ a common prefix) cause the matches to be listed immediately instead
of ringing the bell.
The default value is @samp{off}.
@item skip-completed-text
@vindex skip-completed-text
If set to @samp{on}, this alters the default completion behavior when
inserting a single match into the line. It's only active when
performing completion in the middle of a word. If enabled, readline
does not insert characters from the completion that match characters
after point in the word being completed, so portions of the word
following the cursor are not duplicated.
For instance, if this is enabled, attempting completion when the cursor
is after the @samp{e} in @samp{Makefile} will result in @samp{Makefile}
rather than @samp{Makefilefile}, assuming there is a single possible
completion.
The default value is @samp{off}.
@item visible-stats
@vindex visible-stats
If set to @samp{on}, a character denoting a file's type
@ -1292,6 +1317,11 @@ through the list.
This command is intended to be bound to @key{TAB}, but is unbound
by default.
@item menu-complete-backward ()
Identical to @code{menu-complete}, but moves backward through the list
of possible completions, as if @code{menu-complete} had been given a
negative argument.
@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}).
@ -1431,6 +1461,15 @@ A character is read and point is moved to the previous occurrence
of that character. A negative count searches for subsequent
occurrences.
@item skip-csi-sequence ()
Read enough characters to consume a multi-key sequence such as those
defined for keys like Home and End. Such sequences begin with a
Control Sequence Indicator (CSI), usually ESC-[. If this sequence is
bound to "\e[", keys producing such sequences will have no effect
unless explicitly bound to a readline command, instead of inserting
stray characters into the editing buffer. This is unbound by default,
but usually bound to ESC-[.
@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.
@ -1574,10 +1613,15 @@ 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 the empty string (completion attempted at the
beginning of an empty line), any compspec defined with
the @option{-E} option to @code{complete} is used.
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.
If those searches do not result in a compspec, any compspec defined with
the @option{-D} option to @code{complete} is used as the default.
Once a compspec has been found, it is used to generate the list of
matching words.
@ -1681,6 +1725,30 @@ 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.
There is some support for dynamically modifying completions. This is
most useful when used in combination with a default completion specified
with @option{-D}. It's possible for shell functions executed as completion
handlers to indicate that completion should be retried by returning an
exit status of 124. If a shell function returns 124, and changes
the compspec associated with the command on which completion is being
attempted (supplied as the first argument when the function is executed),
programmable completion restarts from the beginning, with an
attempt to find a compspec for that command. This allows a set of
completions to be built dynamically as completion is attempted, rather than
being loaded all at once.
For instance, assuming that there is a library of compspecs, each kept in a
file corresponding to the name of the command, the following default
completion function would load completions dynamically:
@example
_completion_loader()
@{
. "/etc/bash_completion.d/$1.sh" >/dev/null 2>&1 && return 124
@}
complete -D -F _completion_loader
@end example
@node Programmable Completion Builtins
@section Programmable Completion Builtins
@cindex completion builtins
@ -1716,10 +1784,10 @@ matches were generated.
@item complete
@btindex complete
@example
@code{complete [-abcdefgjksuv] [-o @var{comp-option}] [-E] [-A @var{action}] [-G @var{globpat}] [-W @var{wordlist}]
@code{complete [-abcdefgjksuv] [-o @var{comp-option}] [-DE] [-A @var{action}] [-G @var{globpat}] [-W @var{wordlist}]
[-F @var{function}] [-C @var{command}] [-X @var{filterpat}]
[-P @var{prefix}] [-S @var{suffix}] @var{name} [@var{name} @dots{}]}
@code{complete -pr [-E] [@var{name} @dots{}]}
@code{complete -pr [-DE] [@var{name} @dots{}]}
@end example
Specify how arguments to each @var{name} should be completed.
@ -1729,12 +1797,16 @@ 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 @option{-D} option indicates that the remaining options and actions should
apply to the ``default'' command completion; that is, completion attempted
on a command for which no completion has previously been defined.
The @option{-E} option indicates that the remaining options and actions should
apply to ``empty'' command completion; that is, completion attempted on a
blank line.
The process of applying these completion specifications when word completion
is attempted is described above (@pxref{Programmable Completion}).
is attempted is described above (@pxref{Programmable Completion}). The
@option{-D} option takes precedence over @option{-E}.
Other options, if specified, have the following meanings.
The arguments to the @option{-G}, @option{-W}, and @option{-X} options
@ -1908,7 +1980,7 @@ an error occurs adding a completion specification.
@item compopt
@btindex compopt
@example
@code{compopt} [-o @var{option}] [+o @var{option}] [@var{name}]
@code{compopt} [-o @var{option}] [-DE] [+o @var{option}] [@var{name}]
@end example
Modify completion options for each @var{name} according to the
@var{option}s, or for the currently-execution completion if no @var{name}s
@ -1917,6 +1989,14 @@ If no @var{option}s are given, display the completion options for each
@var{name} or the current completion.
The possible values of @var{option} are those valid for the @code{complete}
builtin described above.
The @option{-D} option indicates that the remaining options should
apply to the ``default'' command completion; that is, completion attempted
on a command for which no completion has previously been defined.
The @option{-E} option indicates that the remaining options should
apply to ``empty'' command completion; that is, completion attempted on a
blank line.
The @option{-D} option takes precedence over @option{-E}.
The return value is true unless an invalid option is supplied, an attempt
is made to modify the options for a @var{name} for which no completion

View File

@ -20,7 +20,7 @@ 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.2 or
under the terms of the GNU Free Documentation License, Version 1.3 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

View File

@ -2,9 +2,9 @@
Copyright (C) 1988-2009 Free Software Foundation, Inc.
@end ignore
@set EDITION 6.0
@set VERSION 6.0
@set UPDATED 28 October 2008
@set UPDATED-MONTH October 2008
@set EDITION 6.1
@set VERSION 6.1
@set UPDATED 9 October 2009
@set UPDATED-MONTH October 2009
@set LASTCHANGE Tue Oct 28 11:25:24 EDT 2008
@set LASTCHANGE Fri Oct 9 12:57:58 EDT 2009

View File

@ -105,11 +105,13 @@ static const FUNMAP default_funmap[] = {
{ "kill-region", rl_kill_region },
{ "kill-word", rl_kill_word },
{ "menu-complete", rl_menu_complete },
{ "menu-complete-backward", rl_backward_menu_complete },
{ "next-history", rl_get_next_history },
{ "non-incremental-forward-search-history", rl_noninc_forward_search },
{ "non-incremental-reverse-search-history", rl_noninc_reverse_search },
{ "non-incremental-forward-search-history-again", rl_noninc_forward_search_again },
{ "non-incremental-reverse-search-history-again", rl_noninc_reverse_search_again },
{ "old-menu-complete", rl_old_menu_complete },
{ "overwrite-mode", rl_overwrite_mode },
#ifdef __CYGWIN__
{ "paste-from-clipboard", rl_paste_from_clipboard },
@ -123,6 +125,7 @@ static const FUNMAP default_funmap[] = {
{ "revert-line", rl_revert_line },
{ "self-insert", rl_insert },
{ "set-mark", rl_set_mark },
{ "skip-csi-sequence", rl_skip_csi_sequence },
{ "start-kbd-macro", rl_start_kbd_macro },
{ "tab-insert", rl_tab_insert },
{ "tilde-expand", rl_tilde_expand },

View File

@ -305,16 +305,20 @@ get_history_event (string, caller_index, delimiting_quote)
/* Extract the contents of STRING as if it is enclosed in single quotes.
SINDEX, when passed in, is the offset of the character immediately
following the opening single quote; on exit, SINDEX is left pointing
to the closing single quote. */
to the closing single quote. FLAGS currently used to allow backslash
to escape a single quote (e.g., for bash $'...'). */
static void
hist_string_extract_single_quoted (string, sindex)
hist_string_extract_single_quoted (string, sindex, flags)
char *string;
int *sindex;
int *sindex, flags;
{
register int i;
for (i = *sindex; string[i] && string[i] != '\''; i++)
;
{
if ((flags & 1) && string[i] == '\\' && string[i+1])
i++;
}
*sindex = i;
}
@ -924,7 +928,7 @@ history_expand (hstring, output)
char **output;
{
register int j;
int i, r, l, passc, cc, modified, eindex, only_printing, dquote;
int i, r, l, passc, cc, modified, eindex, only_printing, dquote, flag;
char *string;
/* The output string, and its length. */
@ -1044,8 +1048,9 @@ history_expand (hstring, output)
else if (dquote == 0 && history_quotes_inhibit_expansion && string[i] == '\'')
{
/* If this is bash, single quotes inhibit history expansion. */
flag = (i > 0 && string[i - 1] == '$');
i++;
hist_string_extract_single_quoted (string, &i);
hist_string_extract_single_quoted (string, &i, flag);
}
else if (history_quotes_inhibit_expansion && string[i] == '\\')
{
@ -1096,7 +1101,7 @@ history_expand (hstring, output)
if (strlen (mb) > 1)
{
ADD_STRING (mb);
break;
continue;
}
}
#endif /* HANDLE_MULTIBYTE */
@ -1130,8 +1135,9 @@ history_expand (hstring, output)
{
int quote, slen;
flag = (i > 0 && string[i - 1] == '$');
quote = i++;
hist_string_extract_single_quoted (string, &i);
hist_string_extract_single_quoted (string, &i, flag);
slen = i - quote + 2;
temp = (char *)xmalloc (slen);
@ -1435,9 +1441,7 @@ history_tokenize_word (string, ind)
i += 2;
return i;
}
else
{
if ((peek == '&' && (string[i] == '>' || string[i] == '<')) ||
else if ((peek == '&' && (string[i] == '>' || string[i] == '<')) ||
(peek == '>' && string[i] == '&') ||
(peek == '(' && (string[i] == '>' || string[i] == '<')) || /* ) */
(peek == '(' && string[i] == '$')) /* ) */
@ -1445,7 +1449,13 @@ history_tokenize_word (string, ind)
i += 2;
return i;
}
#if 0
else if (peek == '\'' && string[i] == '$')
{
i += 2; /* XXX */
return i;
}
#endif
if (string[i] != '$')
{

View File

@ -45,14 +45,7 @@
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
#if defined (HAVE_SELECT)
# if !defined (HAVE_SYS_SELECT_H) || !defined (M_UNIX)
# include <sys/time.h>
# endif
#endif /* HAVE_SELECT */
#if defined (HAVE_SYS_SELECT_H)
# include <sys/select.h>
#endif
#include "posixselect.h"
#if defined (FIONREAD_IN_SYS_IOCTL)
# include <sys/ioctl.h>
@ -190,8 +183,7 @@ rl_gather_tyi ()
FD_ZERO (&exceptfds);
FD_SET (tty, &readfds);
FD_SET (tty, &exceptfds);
timeout.tv_sec = 0;
timeout.tv_usec = _keyboard_input_timeout;
USEC_TO_TIMEVAL (_keyboard_input_timeout, timeout);
result = select (tty + 1, &readfds, (fd_set *)NULL, &exceptfds, &timeout);
if (result <= 0)
return 0; /* Nothing to read. */

View File

@ -57,8 +57,9 @@ Keymap
rl_make_bare_keymap ()
{
register int i;
Keymap keymap = (Keymap)xmalloc (KEYMAP_SIZE * sizeof (KEYMAP_ENTRY));
Keymap keymap;
keymap = (Keymap)xmalloc (KEYMAP_SIZE * sizeof (KEYMAP_ENTRY));
for (i = 0; i < KEYMAP_SIZE; i++)
{
keymap[i].type = ISFUNC;
@ -76,7 +77,8 @@ rl_make_bare_keymap ()
return (keymap);
}
/* Return a new keymap which is a copy of MAP. */
/* Return a new keymap which is a copy of MAP. Just copies pointers, does
not copy text of macros or descend into child keymaps. */
Keymap
rl_copy_keymap (map)
Keymap map;
@ -128,7 +130,7 @@ rl_discard_keymap (map)
{
int i;
if (!map)
if (map == 0)
return;
for (i = 0; i < KEYMAP_SIZE; i++)
@ -140,6 +142,7 @@ rl_discard_keymap (map)
case ISKMAP:
rl_discard_keymap ((Keymap)map[i].function);
free ((char *)map[i].function);
break;
case ISMACR:
@ -148,3 +151,12 @@ rl_discard_keymap (map)
}
}
}
/* Convenience function that discards, then frees, MAP. */
void
rl_free_keymap (map)
Keymap map;
{
rl_discard_keymap (map);
free ((char *)map);
}

View File

@ -77,7 +77,7 @@ _rl_find_next_mbchar_internal (string, seed, count, find_non_zero)
char *string;
int seed, count, find_non_zero;
{
size_t tmp;
size_t tmp, len;
mbstate_t ps;
int point;
wchar_t wc;
@ -99,7 +99,10 @@ _rl_find_next_mbchar_internal (string, seed, count, find_non_zero)
while (count > 0)
{
tmp = mbrtowc (&wc, string+point, strlen(string + point), &ps);
len = strlen (string + point);
if (len == 0)
break;
tmp = mbrtowc (&wc, string+point, len, &ps);
if (MB_INVALIDCH ((size_t)tmp))
{
/* invalid bytes. assume a byte represents a character */

View File

@ -38,16 +38,7 @@
# include <unistd.h>
#endif
#if defined (FD_SET) && !defined (HAVE_SELECT)
# define HAVE_SELECT
#endif
#if defined (HAVE_SELECT)
# include <sys/time.h>
#endif /* HAVE_SELECT */
#if defined (HAVE_SYS_SELECT_H)
# include <sys/select.h>
#endif
#include "posixselect.h"
#if defined (HAVE_STRING_H)
# include <string.h>
@ -130,8 +121,7 @@ rl_insert_close (count, invoking_key)
FD_ZERO (&readfds);
FD_SET (fileno (rl_instream), &readfds);
timer.tv_sec = 0;
timer.tv_usec = _paren_blink_usec;
USEC_TO_TIMEVAL (_paren_blink_usec, timer);
orig_point = rl_point;
rl_point = match_point;

View File

@ -275,6 +275,10 @@ int _rl_bind_stty_chars = 1;
its initial state. */
int _rl_revert_all_at_newline = 0;
/* Non-zero means to honor the termios ECHOCTL bit and echo control
characters corresponding to keyboard-generated signals. */
int _rl_echo_control_chars = 1;
/* **************************************************************** */
/* */
/* Top Level Functions */
@ -686,6 +690,7 @@ _rl_dispatch_callback (cxt)
r = cxt->childval;
/* For now */
if (r != -3) /* don't do this if we indicate there will be other matches */
r = _rl_subseq_result (r, cxt->oldmap, cxt->okey, (cxt->flags & KSEQ_SUBSEQ));
RL_CHECK_SIGNALS ();
@ -831,7 +836,7 @@ _rl_dispatch_subseq (key, map, got_subseq)
{
/* Return 0 only the first time, to indicate success to
_rl_callback_read_char. The rest of the time, we're called
from _rl_dispatch_callback, so we return 3 to indicate
from _rl_dispatch_callback, so we return -3 to indicate
special handling is necessary. */
r = RL_ISSTATE (RL_STATE_MULTIKEY) ? -3 : 0;
cxt = _rl_keyseq_cxt_alloc ();
@ -1169,6 +1174,10 @@ bind_arrow_keys ()
#if defined (VI_MODE)
bind_arrow_keys_internal (vi_movement_keymap);
/* Unbind vi_movement_keymap[ESC] to allow users to repeatedly hit ESC
in vi command mode while still allowing the arrow keys to work. */
if (vi_movement_keymap[ESC].type == ISKMAP)
rl_bind_keyseq_in_map ("\033", (rl_command_func_t *)NULL, vi_movement_keymap);
bind_arrow_keys_internal (vi_insertion_keymap);
#endif
}

View File

@ -95,6 +95,7 @@ extern int rl_forward_word PARAMS((int, int));
extern int rl_backward_word PARAMS((int, int));
extern int rl_refresh_line PARAMS((int, int));
extern int rl_clear_screen PARAMS((int, int));
extern int rl_skip_csi_sequence PARAMS((int, int));
extern int rl_arrow_keys PARAMS((int, int));
/* Bindable commands for inserting and deleting text. */
@ -150,7 +151,9 @@ extern int rl_dump_variables PARAMS((int, int));
extern int rl_complete PARAMS((int, int));
extern int rl_possible_completions PARAMS((int, int));
extern int rl_insert_completions PARAMS((int, int));
extern int rl_old_menu_complete PARAMS((int, int));
extern int rl_menu_complete PARAMS((int, int));
extern int rl_backward_menu_complete PARAMS((int, int));
/* Bindable commands for killing and yanking text, and managing the kill ring. */
extern int rl_kill_word PARAMS((int, int));
@ -675,6 +678,17 @@ extern rl_icppfunc_t *rl_directory_completion_hook;
yet, so it's undocumented. */
extern rl_icppfunc_t *rl_directory_rewrite_hook;
/* If non-zero, this is the address of a function to call when reading
directory entries from the filesystem for completion and comparing
them to the partial word to be completed. The function should
either return its first argument (if no conversion takes place) or
newly-allocated memory. This can, for instance, convert filenames
between character sets for comparison against what's typed at the
keyboard. The returned value is what is added to the list of
matches. The second argument is the length of the filename to be
converted. */
extern rl_dequote_func_t *rl_filename_rewrite_hook;
/* Backwards compatibility with previous versions of readline. */
#define rl_symbolic_link_hook rl_directory_completion_hook

Some files were not shown because too many files have changed in this diff Show More