commit bash-20080507 snapshot

This commit is contained in:
Chet Ramey
2011-12-07 09:23:30 -05:00
parent 4ac1ff9885
commit f13513ff9e
33 changed files with 4651 additions and 12105 deletions
+4 -2
View File
@@ -271,5 +271,7 @@ bash-2.0 were significant.)
file permission bits obtained with stat(2). This obeys restrictions of
the file system (e.g., read-only or noexec mounts) not available via stat.
33. Beginning with bash-3.1/readline-5.1, the readline key binding code obeys
the current setting of the `convert-meta' variable.
33. Bash-3.2 adopts the convention used by other string and pattern matching
operators for the `[[' compound command, and matches any quoted portion
of the right-hand-side argument to the =~ operator as a string rather
than a regular expression.
+275
View File
@@ -0,0 +1,275 @@
This document details the incompatibilities between this version of bash,
bash-3.2, and the previous widely-available versions, bash-1.14 (which is
still the `standard' version for a few Linux distributions) and bash-2.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.)
1. Bash uses a new quoting syntax, $"...", to do locale-specific
string translation. Users who have relied on the (undocumented)
behavior of bash-1.14 will have to change their scripts. For
instance, if you are doing something like this to get the value of
a variable whose name is the value of a second variable:
eval var2=$"$var1"
you will have to change to a different syntax.
This capability is directly supported by bash-2.0:
var2=${!var1}
This alternate syntax will work portably between bash-1.14 and bash-2.0:
eval var2=\$${var1}
2. One of the bugs fixed in the YACC grammar tightens up the rules
concerning group commands ( {...} ). The `list' that composes the
body of the group command must be terminated by a newline or
semicolon. That's because the braces are reserved words, and are
recognized as such only when a reserved word is legal. This means
that while bash-1.14 accepted shell function definitions like this:
foo() { : }
bash-2.0 requires this:
foo() { :; }
This is also an issue for commands like this:
mkdir dir || { echo 'could not mkdir' ; exit 1; }
The syntax required by bash-2.0 is also accepted by bash-1.14.
3. The options to `bind' have changed to make them more consistent with
the rest of the bash builtins. If you are using `bind -d' to list
the readline key bindings in a form that can be re-read, use `bind -p'
instead. If you were using `bind -v' to list the key bindings, use
`bind -P' instead.
4. The `long' invocation options must now be prefixed by `--' instead
of `-'. (The old form is still accepted, for the time being.)
5. There was a bug in the version of readline distributed with bash-1.14
that caused it to write badly-formatted key bindings when using
`bind -d'. The only key sequences that were affected are C-\ (which
should appear as \C-\\ in a key binding) and C-" (which should appear
as \C-\"). If these key sequences appear in your inputrc, as, for
example,
"\C-\": self-insert
they will need to be changed to something like the following:
"\C-\\": self-insert
6. A number of people complained about having to use ESC to terminate an
incremental search, and asked for an alternate mechanism. Bash-2.03
uses the value of the settable readline variable `isearch-terminators'
to decide which characters should terminate an incremental search. If
that variable has not been set, ESC and Control-J will terminate a
search.
7. Some variables have been removed: MAIL_WARNING, notify, history_control,
command_oriented_history, glob_dot_filenames, allow_null_glob_expansion,
nolinks, hostname_completion_file, noclobber, no_exit_on_failed_exec, and
cdable_vars. Most of them are now implemented with the new `shopt'
builtin; others were already implemented by `set'. Here is a list of
correspondences:
MAIL_WARNING shopt mailwarn
notify set -o notify
history_control HISTCONTROL
command_oriented_history shopt cmdhist
glob_dot_filenames shopt dotglob
allow_null_glob_expansion shopt nullglob
nolinks set -o physical
hostname_completion_file HOSTFILE
noclobber set -o noclobber
no_exit_on_failed_exec shopt execfail
cdable_vars shopt cdable_vars
8. `ulimit' now sets both hard and soft limits and reports the soft limit
by default (when neither -H nor -S is specified). This is compatible
with versions of sh and ksh that implement `ulimit'. The bash-1.14
behavior of, for example,
ulimit -c 0
can be obtained with
ulimit -S -c 0
It may be useful to define an alias:
alias ulimit="ulimit -S"
9. Bash-2.01 uses a new quoting syntax, $'...' to do ANSI-C string
translation. Backslash-escaped characters in ... are expanded and
replaced as specified by the ANSI C standard.
10. The sourcing of startup files has changed somewhat. This is explained
more completely in the INVOCATION section of the manual page.
A non-interactive shell not named `sh' and not in posix mode reads
and executes commands from the file named by $BASH_ENV. A
non-interactive shell started by `su' and not in posix mode will read
startup files. No other non-interactive shells read any startup files.
An interactive shell started in posix mode reads and executes commands
from the file named by $ENV.
11. The <> redirection operator was changed to conform to the POSIX.2 spec.
In the absence of any file descriptor specification preceding the `<>',
file descriptor 0 is used. In bash-1.14, this was the behavior only
when in POSIX mode. The bash-1.14 behavior may be obtained with
<>filename 1>&0
12. The `alias' builtin now checks for invalid options and takes a `-p'
option to display output in POSIX mode. If you have old aliases beginning
with `-' or `+', you will have to add the `--' to the alias command
that declares them:
alias -x='chmod a-x' --> alias -- -x='chmod a-x'
13. The behavior of range specificiers within bracket matching expressions
in the pattern matcher (e.g., [A-Z]) depends on the current locale,
specifically the value of the LC_COLLATE environment variable. Setting
this variable to C or POSIX will result in the traditional ASCII behavior
for range comparisons. If the locale is set to something else, e.g.,
en_US (specified by the LANG or LC_ALL variables), collation order is
locale-dependent. For example, the en_US locale sorts the upper and
lower case letters like this:
AaBb...Zz
so a range specification like [A-Z] will match every letter except `z'.
Other locales collate like
aAbBcC...zZ
which means that [A-Z] matches every letter except `a'.
The portable way to specify upper case letters is [:upper:] instead of
A-Z; lower case may be specified as [:lower:] instead of a-z.
Look at the manual pages for setlocale(3), strcoll(3), and, if it is
present, locale(1).
You can find your current locale information by running locale(1):
caleb.ins.cwru.edu(2)$ locale
LANG=en_US
LC_CTYPE="en_US"
LC_NUMERIC="en_US"
LC_TIME="en_US"
LC_COLLATE="en_US"
LC_MONETARY="en_US"
LC_MESSAGES="en_US"
LC_ALL=en_US
My advice is to put
export LC_COLLATE=C
into /etc/profile and inspect any shell scripts run from cron for
constructs like [A-Z]. This will prevent things like
rm [A-Z]*
from removing every file in the current directory except those beginning
with `z' and still allow individual users to change the collation order.
Users may put the above command into their own profiles as well, of course.
14. Bash versions up to 1.14.7 included an undocumented `-l' operator to
the `test/[' builtin. It was a unary operator that expanded to the
length of its string argument. This let you do things like
test -l $variable -lt 20
for example.
This was included for backwards compatibility with old versions of the
Bourne shell, which did not provide an easy way to obtain the length of
the value of a shell variable.
This operator is not part of the POSIX standard, because one can (and
should) use ${#variable} to get the length of a variable's value.
Bash-2.x does not support it.
15. Bash no longer auto-exports the HOME, PATH, SHELL, TERM, HOSTNAME,
HOSTTYPE, MACHTYPE, or OSTYPE variables. If they appear in the initial
environment, the export attribute will be set, but if bash provides a
default value, they will remain local to the current shell.
16. Bash no longer initializes the FUNCNAME, GROUPS, or DIRSTACK variables
to have special behavior if they appear in the initial environment.
17. Bash no longer removes the export attribute from the SSH_CLIENT or
SSH2_CLIENT variables, and no longer attempts to discover whether or
not it has been invoked by sshd in order to run the startup files.
18. Bash no longer requires that the body of a function be a group command;
any compound command is accepted.
19. As of bash-3.0, the pattern substitution operators no longer perform
quote removal on the pattern before attempting the match. This is the
way the pattern removal functions behave, and is more consistent.
20. After bash-3.0 was released, I reimplemented tilde expansion, incorporating
it into the mainline word expansion code. This fixes the bug that caused
the results of tilde expansion to be re-expanded. There is one
incompatibility: a ${paramOPword} expansion within double quotes will not
perform tilde expansion on WORD. This is consistent with the other
expansions, and what POSIX specifies.
21. A number of variables have the integer attribute by default, so the +=
assignment operator returns expected results: RANDOM, LINENO, MAILCHECK,
HISTCMD, OPTIND.
22. Bash-3.x is much stricter about $LINENO correctly reflecting the line
number in a script; assignments to LINENO have little effect.
23. By default, readline binds the terminal special characters to their
readline equivalents. As of bash-3.1/readline-5.1, this is optional and
controlled by the bind-tty-special-chars readline variable.
24. The \W prompt string expansion abbreviates $HOME as `~'. The previous
behavior is available with ${PWD##/*/}.
25. The arithmetic exponentiation operator is right-associative as of bash-3.1.
26. The rules concerning valid alias names are stricter, as per POSIX.2.
27. The Readline key binding functions now obey the convert-meta setting active
when the binding takes place, as the dispatch code does when characters
are read and processed.
28. The historical behavior of `trap' reverting signal disposition to the
original handling in the absence of a valid first argument is implemented
only if the first argument is a valid signal number.
29. In versions of bash after 3.1, the ${parameter//pattern/replacement}
expansion does not interpret `%' or `#' specially. Those anchors don't
have any real meaning when replacing every match.
30. Beginning with bash-3.1, the combination of posix mode and enabling the
`xpg_echo' option causes echo to ignore all options, not looking for `-n'
31. Beginning with bash-3.2, bash follows the Bourne-shell-style (and POSIX-
style) rules for parsing the contents of old-style backquoted command
substitutions. Previous versions of bash attempted to recursively parse
embedded quoted strings and shell constructs; bash-3.2 uses strict POSIX
rules to find the closing backquote and simply passes the contents of the
command substitution to a subshell for parsing and execution.
32. Beginning with bash-3.2, bash uses access(2) when executing primaries for
the test builtin and the [[ compound command, rather than looking at the
file permission bits obtained with stat(2). This obeys restrictions of
the file system (e.g., read-only or noexec mounts) not available via stat.
33. Beginning with bash-3.1/readline-5.1, the readline key binding code obeys
the current setting of the `convert-meta' variable.
+48
View File
@@ -15735,3 +15735,51 @@ lib/readline/complete.c
lib/readline/readline.h
- extern declaration for rl_menu_completion_entry_function
5/8
---
lib/readline/bind.c
lib/readline/complete.c
- add support for a third argument to fnprint and print_filename,
which supports replacing a specified portion of the pathnames
printed when displaying possible completions with a `...' (or
`___', if the prefix would be confused with a portion of the
filename)
- new variable, _rl_completion_prefix_display_length, sets the
number of characters in a common prefix to be replaced with an
ellipsis when displaying possible completions
- add support to _rl_display_match_list to find the length of the
common prefix of all items being displayed, and passing that
value to print_filename for possible replacement with an ellipsis
if that length is longer than _rl_completion_prefix_display_length
lib/readline/bind.c
- add support for retrieving value of history-size variable to
_rl_get_string_variable_value
- new bindable variable, completion-prefix-display-length. When
displaying possible completions, matches with a common prefix
longer than this value have the common prefix replaced with an
ellipsis
- support for retrieving value of completion-prefix-display-length
variable to _rl_get_string_variable_value
- new bindable variable, revert-all-at-newline: if enabled, causes
all changes in history lines to be undone before readline returns
after processing a newline
doc/bash.1,lib/readline/doc/{readline.3,rluser.texi}
- document new `completion-prefix-display-length' variable
- document new `revert-all-at-newline' variable
execute_cmd.c
- change execute_builtin to not inherit the `-e' flag into commands
executed by the `command' or `source/.' builtins if we are supposed
to be ignoring the return value. This is like `eval'. Fixes bug
reported by Hiroshi Fujishima <hirobo@tonteki.org>
5/10
----
variables.c
- when reading the initial environment, don't create variables with
names that are not valid shell identifiers. Fixes bug reported by
Stephane Chazleas <stephane_chazelas@yahoo.fr>
+43
View File
@@ -15730,6 +15730,49 @@ array.h
lib/readline/complete.c
- new variable, rl_menu_completion_entry_function, generator for
rl_menu_complete
- new menu completion `browsing' implementation, with several
improvements over the old code. Inspired by Sami
lib/readline/readline.h
- extern declaration for rl_menu_completion_entry_function
5/8
---
lib/readline/bind.c
lib/readline/complete.c
- add support for a third argument to fnprint and print_filename,
which supports replacing a specified portion of the pathnames
printed when displaying possible completions with a `...' (or
`___', if the prefix would be confused with a portion of the
filename)
- new variable, _rl_completion_prefix_display_length, sets the
number of characters in a common prefix to be replaced with an
ellipsis when displaying possible completions
- add support to _rl_display_match_list to find the length of the
common prefix of all items being displayed, and passing that
value to print_filename for possible replacement with an ellipsis
if that length is longer than _rl_completion_prefix_display_length
lib/readline/bind.c
- add support for retrieving value of history-size variable to
_rl_get_string_variable_value
- new bindable variable, completion-prefix-display-length. When
displaying possible completions, matches with a common prefix
longer than this value have the common prefix replaced with an
ellipsis
- support for retrieving value of completion-prefix-display-length
variable to _rl_get_string_variable_value
- new bindable variable, revert-all-at-newline: if enabled, causes
all changes in history lines to be undone before readline returns
after processing a newline
doc/bash.1,lib/readline/doc/{readline.3,rluser.texi}
- document new `completion-prefix-display-length' variable
- document new `revert-all-at-newline' variable
execute_cmd.c
- change execute_builtin to not inherit the `-e' flag into commands
executed by the `command' or `source/.' builtins if we are supposed
to be ignoring the return value. This is like `eval'. Fixes bug
reported by Hiroshi Fujishima <hirobo@tonteki.org>
+3 -3
View File
@@ -1,7 +1,7 @@
Introduction
============
This is GNU Bash, version 3.2. Bash is the GNU Project's Bourne
This is GNU Bash, version 4.0. 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-1.14 and
bash-2.05b. For details, see the file COMPAT. The NEWS file tersely
of Bash and previous widely-distributed versions, bash-2.05b and
bash-3.2. 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]
+90
View File
@@ -0,0 +1,90 @@
Introduction
============
This is GNU Bash, version 3.2. Bash is the GNU Project's Bourne
Again SHell, a complete implementation of the POSIX.2 shell spec,
but also with interactive command line editing, job control on
architectures that support it, csh-like features such as history
substitution and brace expansion, and a slew of other features.
For more information on the features of Bash that are new to this
type of shell, see the file `doc/bashref.texi'. There is also a
large Unix-style man page. The man page is the definitive description
of the shell's features.
See the file 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-1.14 and
bash-2.05b. 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 Public License, version 2. For more information, see the
file COPYING.
A number of frequently-asked questions are answered in the file
`doc/FAQ'.
To compile Bash, try typing `./configure', then `make'. Bash
auto-configures the build process, so no further intervention
should be necessary. Bash builds with `gcc' by default if it is
available. If you want to use `cc' instead, type
CC=cc ./configure
if you are using a Bourne-style shell. If you are not, the following
may work:
env CC=cc ./configure
Read the file INSTALL in this directory for more information about how
to customize and control the build process. The file NOTES contains
platform-specific installation and configuration information.
If you are a csh user and wish to convert your csh aliases to Bash
aliases, you may wish to use the script `examples/misc/alias-conv.sh'
as a starting point. The script `examples/misc/cshtobash' is a
more ambitious script that attempts to do a more complete job.
Reporting Bugs
==============
Bug reports for bash should be sent to:
bug-bash@gnu.org
using the `bashbug' program that is built and installed at the same
time as bash.
The discussion list `bug-bash@gnu.org' often contains information
about new ports of Bash, or discussions of new features or behavior
changes that people would like. This mailing list is also available
as a usenet newsgroup: gnu.bash.bug.
When you send a bug report, please use the `bashbug' program that is
built at the same time as bash. If bash fails to build, try building
bashbug directly with `make bashbug'. If you cannot build `bashbug',
please send mail to bug-bash@gnu.org with the following information:
* the version number and release status of Bash (e.g., 2.05a-release)
* the machine and OS that it is running on (you may run
`bashversion -l' from the bash build directory for this information)
* a list of the compilation flags or the contents of `config.h', if
appropriate
* a description of the bug
* a recipe for recreating the bug reliably
* a fix for the bug if you have one!
The `bashbug' program includes much of this automatically.
If you would like to contact the Bash maintainers directly, send mail
to bash-maintainers@gnu.org.
While the Bash maintainers do not promise to fix all bugs, we would
like this shell to be the best that we can make it.
Enjoy!
Chet Ramey
chet.ramey@case.edu
+1618 -5649
View File
File diff suppressed because it is too large Load Diff
+20 -88
View File
@@ -17,115 +17,47 @@
{
'_LT_AC_TAGCONFIG' => 1,
'AM_PROG_F77_C_O' => 1,
'AC_INIT' => 1,
'm4_pattern_forbid' => 1,
'AC_CANONICAL_TARGET' => 1,
'AC_SUBST' => 1,
'AC_CONFIG_LIBOBJ_DIR' => 1,
'AC_TYPE_OFF_T' => 1,
'AC_C_VOLATILE' => 1,
'AC_FUNC_CLOSEDIR_VOID' => 1,
'AC_REPLACE_FNMATCH' => 1,
'AC_FC_SRCEXT' => 1,
'AC_CANONICAL_HOST' => 1,
'AC_PROG_LIBTOOL' => 1,
'AC_FUNC_STAT' => 1,
'AC_HEADER_TIME' => 1,
'AC_FUNC_WAIT3' => 1,
'AC_STRUCT_TM' => 1,
'AC_FUNC_LSTAT' => 1,
'AM_INIT_AUTOMAKE' => 1,
'AC_CONFIG_SUBDIRS' => 1,
'AM_AUTOMAKE_VERSION' => 1,
'AC_TYPE_MODE_T' => 1,
'AC_FUNC_GETMNTENT' => 1,
'AC_FUNC_STRTOD' => 1,
'AC_CHECK_HEADERS' => 1,
'LT_CONFIG_LTDL_DIR' => 1,
'AC_FUNC_STRNLEN' => 1,
'AC_REQUIRE_AUX_FILE' => 1,
'AC_CONFIG_LINKS' => 1,
'm4_sinclude' => 1,
'AC_PROG_CXX' => 1,
'AC_PATH_X' => 1,
'AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK' => 1,
'AC_PROG_AWK' => 1,
'LT_SUPPORTED_TAG' => 1,
'AM_MAINTAINER_MODE' => 1,
'AM_GNU_GETTEXT_INTL_SUBDIR' => 1,
'_m4_warn' => 1,
'AC_HEADER_STDC' => 1,
'AC_HEADER_MAJOR' => 1,
'AM_PROG_CXX_C_O' => 1,
'AM_ENABLE_MULTILIB' => 1,
'AC_CONFIG_FILES' => 1,
'include' => 1,
'LT_INIT' => 1,
'AC_FUNC_ERROR_AT_LINE' => 1,
'AC_PROG_GCC_TRADITIONAL' => 1,
'AM_GNU_GETTEXT' => 1,
'AC_LIBSOURCE' => 1,
'AC_FUNC_MBRTOWC' => 1,
'AC_STRUCT_ST_BLOCKS' => 1,
'AC_TYPE_SIGNAL' => 1,
'AM_PROG_FC_C_O' => 1,
'AC_CANONICAL_BUILD' => 1,
'AC_TYPE_UID_T' => 1,
'AC_PROG_MAKE_SET' => 1,
'AC_FC_FREEFORM' => 1,
'AH_OUTPUT' => 1,
'_AM_SUBST_NOTMAKE' => 1,
'AC_CONFIG_AUX_DIR' => 1,
'sinclude' => 1,
'm4_pattern_allow' => 1,
'AC_DEFINE_TRACE_LITERAL' => 1,
'AC_FUNC_STRERROR_R' => 1,
'AC_PROG_CC' => 1,
'AC_FUNC_FORK' => 1,
'AC_DECL_SYS_SIGLIST' => 1,
'AC_FUNC_VPRINTF' => 1,
'AC_FUNC_STRCOLL' => 1,
'AC_PROG_YACC' => 1,
'AC_SUBST_TRACE' => 1,
'AC_STRUCT_TIMEZONE' => 1,
'AC_INIT' => 1,
'AC_FUNC_CHOWN' => 1,
'AC_SUBST' => 1,
'AC_FUNC_ALLOCA' => 1,
'AC_CANONICAL_HOST' => 1,
'AC_FC_SRCEXT' => 1,
'AC_FUNC_GETPGRP' => 1,
'AC_PROG_RANLIB' => 1,
'AC_FUNC_SETPGRP' => 1,
'AM_INIT_AUTOMAKE' => 1,
'AC_CONFIG_SUBDIRS' => 1,
'AC_FUNC_MMAP' => 1,
'AC_FUNC_REALLOC' => 1,
'AC_TYPE_SIZE_T' => 1,
'AC_CONFIG_LINKS' => 1,
'AC_REQUIRE_AUX_FILE' => 1,
'AC_CHECK_TYPES' => 1,
'LT_SUPPORTED_TAG' => 1,
'AC_CHECK_MEMBERS' => 1,
'AM_MAINTAINER_MODE' => 1,
'AC_FUNC_UTIME_NULL' => 1,
'AC_FUNC_SELECT_ARGTYPES' => 1,
'AM_GNU_GETTEXT_INTL_SUBDIR' => 1,
'AC_HEADER_STAT' => 1,
'AC_FUNC_STRFTIME' => 1,
'AC_PROG_CPP' => 1,
'AC_C_INLINE' => 1,
'AC_TYPE_PID_T' => 1,
'AC_PROG_LEX' => 1,
'AM_ENABLE_MULTILIB' => 1,
'AC_C_CONST' => 1,
'AC_CONFIG_FILES' => 1,
'include' => 1,
'AC_FUNC_SETVBUF_REVERSED' => 1,
'AC_PROG_INSTALL' => 1,
'AM_GNU_GETTEXT' => 1,
'AC_FUNC_OBSTACK' => 1,
'AC_CHECK_LIB' => 1,
'AC_FUNC_MALLOC' => 1,
'AC_FUNC_GETGROUPS' => 1,
'AC_FC_FREEFORM' => 1,
'AC_FUNC_GETLOADAVG' => 1,
'AH_OUTPUT' => 1,
'AC_FUNC_FSEEKO' => 1,
'AM_PROG_CC_C_O' => 1,
'AC_FUNC_MKTIME' => 1,
'AM_CONDITIONAL' => 1,
'AC_CANONICAL_SYSTEM' => 1,
'AM_CONDITIONAL' => 1,
'AC_CONFIG_HEADERS' => 1,
'AC_HEADER_SYS_WAIT' => 1,
'AC_PROG_LN_S' => 1,
'AC_FUNC_MEMCMP' => 1,
'AC_DEFINE_TRACE_LITERAL' => 1,
'm4_include' => 1,
'AC_HEADER_DIRENT' => 1,
'AC_CHECK_FUNCS' => 1
'AC_SUBST_TRACE' => 1
}
], 'Autom4te::Request' )
);
+476 -591
View File
File diff suppressed because it is too large Load Diff
Vendored
+1616 -5647
View File
File diff suppressed because it is too large Load Diff
+14 -2
View File
@@ -5,12 +5,12 @@
.\" Case Western Reserve University
.\" chet@po.cwru.edu
.\"
.\" Last Change: Sun May 4 22:27:45 EDT 2008
.\" Last Change: Thu May 8 09:32:34 EDT 2008
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
.TH BASH 1 "2008 May 4" "GNU Bash-4.0"
.TH BASH 1 "2008 May 8" "GNU Bash-4.0"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -4678,6 +4678,12 @@ in vi command mode.
If set to \fBOn\fP, readline performs filename matching and completion
in a case\-insensitive fashion.
.TP
.B completion\-prefix\-display\-length (0)
The length in characters of the common prefix of a list of possible
completions that is displayed without modification. When set to a
value greater than zero, common prefixes longer than this value are
replaced with an ellipsis when displaying possible completions.
.TP
.B completion\-query\-items (100)
This determines when the user is queried about viewing
the number of possible completions
@@ -4787,6 +4793,12 @@ to display a screenful of possible completions at a time.
.B print\-completions\-horizontally (Off)
If set to \fBOn\fP, readline will display completions with matches
sorted horizontally in alphabetical order, rather than down the screen.
.TP
.B revert\-all\-at\-newline (Off)
If set to \fBon\fP, readline will undo all changes to history lines
before returning when \fBaccept\-line\fP is executed. By default,
history lines may be modified and retain individual undo lists across
calls to \fBreadline\fP.
.TP
.B show\-all\-if\-ambiguous (Off)
This alters the default behavior of the completion functions. If
+10 -3
View File
@@ -5,12 +5,12 @@
.\" Case Western Reserve University
.\" chet@po.cwru.edu
.\"
.\" Last Change: Sun May 4 22:27:45 EDT 2008
.\" Last Change: Thu May 8 09:32:34 EDT 2008
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
.TH BASH 1 "2008 May 4" "GNU Bash-4.0"
.TH BASH 1 "2008 May 8" "GNU Bash-4.0"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -4678,6 +4678,12 @@ in vi command mode.
If set to \fBOn\fP, readline performs filename matching and completion
in a case\-insensitive fashion.
.TP
.B completion\-prefix\-display\-length (0)
The length in characters of the common prefix of a list of possible
completions that is displayed without modification. When set to a
value greater than zero, common prefixes longer than this value are
replaced with an ellipsis when displaying possible completions.
.TP
.B completion\-query\-items (100)
This determines when the user is queried about viewing
the number of possible completions
@@ -7676,7 +7682,8 @@ not echoed.
.B \-t \fItimeout\fP
Cause \fBread\fP to time out and return failure if a complete line of
input is not read within \fItimeout\fP seconds.
\fItimeout\fP may be a decimal number with a fractional portion.
\fItimeout\fP may be a decimal number with a fractional portion following
the decimal point.
This option has no effect if \fBread\fP is not reading input from the
terminal or a pipe.
.TP
+4 -2
View File
@@ -3137,8 +3137,10 @@ execute_builtin (builtin, words, flags, subshell)
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. */
if (subshell == 0 && builtin == eval_builtin && (flags & CMD_IGNORE_RETURN))
restore it 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);
+5 -3
View File
@@ -1,6 +1,6 @@
/* execute_cmd.c -- Execute a COMMAND structure. */
/* Copyright (C) 1987-2007 Free Software Foundation, Inc.
/* Copyright (C) 1987-2008 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -3137,8 +3137,10 @@ execute_builtin (builtin, words, flags, subshell)
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. */
if (subshell == 0 && builtin == eval_builtin && (flags & CMD_IGNORE_RETURN))
restore it 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);
+47 -18
View File
@@ -1,6 +1,6 @@
/* bind.c -- key binding and startup file support for the readline library. */
/* Copyright (C) 1987-2006 Free Software Foundation, Inc.
/* Copyright (C) 1987-2008 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
@@ -1431,6 +1431,7 @@ static const struct {
{ "page-completions", &_rl_page_completions, 0 },
{ "prefer-visible-bell", &_rl_prefer_visible_bell, V_SPECIAL },
{ "print-completions-horizontally", &_rl_print_completions_horizontally, 0 },
{ "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 },
#if defined (VISIBLE_STATS)
@@ -1489,11 +1490,12 @@ typedef int _rl_sv_func_t PARAMS((const char *));
/* Forward declarations */
static int sv_bell_style PARAMS((const char *));
static int sv_combegin PARAMS((const char *));
static int sv_dispprefix PARAMS((const char *));
static int sv_compquery PARAMS((const char *));
static int sv_editmode PARAMS((const char *));
static int sv_histsize PARAMS((const char *));
static int sv_isrchterm PARAMS((const char *));
static int sv_keymap PARAMS((const char *));
static int sv_histsize PARAMS((const char *));
static const struct {
const char * const name;
@@ -1502,6 +1504,7 @@ static const struct {
} string_varlist[] = {
{ "bell-style", V_STRING, sv_bell_style },
{ "comment-begin", V_STRING, sv_combegin },
{ "completion-prefix-display-length", V_INT, sv_dispprefix },
{ "completion-query-items", V_INT, sv_compquery },
{ "editing-mode", V_STRING, sv_editmode },
{ "history-size", V_INT, sv_histsize },
@@ -1615,6 +1618,22 @@ sv_combegin (value)
return 1;
}
static int
sv_dispprefix (value)
const char *value;
{
int nval = 0;
if (value && *value)
{
nval = atoi (value);
if (nval < 0)
nval = 0;
}
_rl_completion_prefix_display_length = nval;
return 0;
}
static int
sv_compquery (value)
const char *value;
@@ -1631,6 +1650,22 @@ sv_compquery (value)
return 0;
}
static int
sv_histsize (value)
const char *value;
{
int nval = 500;
if (value && *value)
{
nval = atoi (value);
if (nval < 0)
return 1;
}
stifle_history (nval);
return 0;
}
static int
sv_keymap (value)
const char *value;
@@ -1699,22 +1734,6 @@ sv_isrchterm (value)
return 0;
}
static int
sv_histsize (value)
const char *value;
{
int nval = 500;
if (value && *value)
{
nval = atoi (value);
if (nval < 0)
return 1;
}
stifle_history (nval);
return 0;
}
/* Return the character which matches NAME.
For example, `Space' returns ' '. */
@@ -2237,6 +2256,11 @@ _rl_get_string_variable_value (name)
}
else if (_rl_stricmp (name, "comment-begin") == 0)
return (_rl_comment_begin ? _rl_comment_begin : RL_COMMENT_BEGIN_DEFAULT);
else if (_rl_stricmp (name, "completion-prefix-display-length") == 0)
{
sprintf (numbuf, "%d", _rl_completion_prefix_display_length);
return (numbuf);
}
else if (_rl_stricmp (name, "completion-query-items") == 0)
{
sprintf (numbuf, "%d", rl_completion_query_items);
@@ -2244,6 +2268,11 @@ _rl_get_string_variable_value (name)
}
else if (_rl_stricmp (name, "editing-mode") == 0)
return (rl_get_keymap_name_from_edit_mode ());
else if (_rl_stricmp (name, "history-size") == 0)
{
sprintf (numbuf, "%d", history_is_stifled() ? history_max_entries : 0);
return (numbuf);
}
else if (_rl_stricmp (name, "isearch-terminators") == 0)
{
if (_rl_isearch_terminators == 0)
+70 -42
View File
@@ -1,6 +1,6 @@
/* bind.c -- key binding and startup file support for the readline library. */
/* Copyright (C) 1987-2006 Free Software Foundation, Inc.
/* Copyright (C) 1987-2008 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
@@ -317,7 +317,7 @@ rl_macro_bind (keyseq, macro, map)
if (rl_translate_keyseq (macro, macro_keys, &macro_keys_len))
{
free (macro_keys);
xfree (macro_keys);
return -1;
}
rl_generic_bind (ISMACR, keyseq, macro_keys, map);
@@ -347,7 +347,7 @@ rl_generic_bind (type, keyseq, data, map)
if (keyseq == 0 || *keyseq == 0)
{
if (type == ISMACR)
free (data);
xfree (data);
return -1;
}
@@ -358,7 +358,7 @@ rl_generic_bind (type, keyseq, data, map)
KEYS into KEYS_LEN. */
if (rl_translate_keyseq (keyseq, keys, &keys_len))
{
free (keys);
xfree (keys);
return -1;
}
@@ -371,7 +371,7 @@ rl_generic_bind (type, keyseq, data, map)
ic = uc;
if (ic < 0 || ic >= KEYMAP_SIZE)
{
free (keys);
xfree (keys);
return -1;
}
@@ -414,7 +414,7 @@ rl_generic_bind (type, keyseq, data, map)
else
{
if (map[ic].type == ISMACR)
free ((char *)map[ic].function);
xfree ((char *)map[ic].function);
else if (map[ic].type == ISKMAP)
{
map = FUNCTION_TO_KEYMAP (map, ic);
@@ -427,7 +427,7 @@ rl_generic_bind (type, keyseq, data, map)
rl_binding_keymap = map;
}
free (keys);
xfree (keys);
return 0;
}
@@ -793,7 +793,7 @@ _rl_read_file (filename, sizep)
if (i < 0)
{
free (buffer);
xfree (buffer);
return ((char *)NULL);
}
@@ -863,7 +863,7 @@ _rl_read_init_file (filename, include_level)
openname = tilde_expand (filename);
buffer = _rl_read_file (openname, &file_size);
free (openname);
xfree (openname);
if (buffer == 0)
return (errno);
@@ -911,7 +911,7 @@ _rl_read_init_file (filename, include_level)
current_readline_init_lineno++;
}
free (buffer);
xfree (buffer);
currently_reading_init_file = 0;
return (0);
}
@@ -1002,7 +1002,7 @@ parser_if (args)
`$if term=sun-cmd' into their .inputrc. */
_rl_parsing_conditionalized_out = _rl_stricmp (args + 5, tname) &&
_rl_stricmp (args + 5, rl_terminal_name);
free (tname);
xfree (tname);
}
#if defined (VI_MODE)
else if (_rl_strnicmp (args, "mode=", 5) == 0)
@@ -1352,7 +1352,7 @@ rl_parse_and_bind (string)
else
rl_bind_keyseq (seq, rl_named_function (funname));
free (seq);
xfree (seq);
return 0;
}
@@ -1489,11 +1489,12 @@ typedef int _rl_sv_func_t PARAMS((const char *));
/* Forward declarations */
static int sv_bell_style PARAMS((const char *));
static int sv_combegin PARAMS((const char *));
static int sv_dispprefix PARAMS((const char *));
static int sv_compquery PARAMS((const char *));
static int sv_editmode PARAMS((const char *));
static int sv_histsize PARAMS((const char *));
static int sv_isrchterm PARAMS((const char *));
static int sv_keymap PARAMS((const char *));
static int sv_histsize PARAMS((const char *));
static const struct {
const char * const name;
@@ -1502,6 +1503,7 @@ static const struct {
} string_varlist[] = {
{ "bell-style", V_STRING, sv_bell_style },
{ "comment-begin", V_STRING, sv_combegin },
{ "completion-prefix-display-length", V_INT, sv_dispprefix },
{ "completion-query-items", V_INT, sv_compquery },
{ "editing-mode", V_STRING, sv_editmode },
{ "history-size", V_INT, sv_histsize },
@@ -1615,6 +1617,22 @@ sv_combegin (value)
return 1;
}
static int
sv_dispprefix (value)
const char *value;
{
int nval = 0;
if (value && *value)
{
nval = atoi (value);
if (nval < 0)
nval = 0;
}
_rl_completion_prefix_display_length = nval;
return 0;
}
static int
sv_compquery (value)
const char *value;
@@ -1631,6 +1649,22 @@ sv_compquery (value)
return 0;
}
static int
sv_histsize (value)
const char *value;
{
int nval = 500;
if (value && *value)
{
nval = atoi (value);
if (nval < 0)
return 1;
}
stifle_history (nval);
return 0;
}
static int
sv_keymap (value)
const char *value;
@@ -1695,26 +1729,10 @@ sv_isrchterm (value)
rl_translate_keyseq (v + beg, _rl_isearch_terminators, &end);
_rl_isearch_terminators[end] = '\0';
free (v);
xfree (v);
return 0;
}
static int
sv_histsize (value)
const char *value;
{
int nval = 500;
if (value && *value)
{
nval = atoi (value);
if (nval < 0)
return 1;
}
stifle_history (nval);
return 0;
}
/* Return the character which matches NAME.
For example, `Space' returns ' '. */
@@ -1856,7 +1874,7 @@ rl_list_funmap_names ()
for (i = 0; funmap_names[i]; i++)
fprintf (rl_outstream, "%s\n", funmap_names[i]);
free (funmap_names);
xfree (funmap_names);
}
static char *
@@ -2022,7 +2040,7 @@ rl_invoking_keyseqs_in_map (function, map)
}
strcat (keyname, seqs[i]);
free (seqs[i]);
xfree (seqs[i]);
if (result_index + 2 > result_size)
{
@@ -2034,7 +2052,7 @@ rl_invoking_keyseqs_in_map (function, map)
result[result_index] = (char *)NULL;
}
free (seqs);
xfree (seqs);
}
break;
}
@@ -2086,10 +2104,10 @@ rl_function_dumper (print_readably)
{
fprintf (rl_outstream, "\"%s\": %s\n",
invokers[j], name);
free (invokers[j]);
xfree (invokers[j]);
}
free (invokers);
xfree (invokers);
}
}
else
@@ -2113,9 +2131,9 @@ rl_function_dumper (print_readably)
fprintf (rl_outstream, "...\n");
for (j = 0; invokers[j]; j++)
free (invokers[j]);
xfree (invokers[j]);
free (invokers);
xfree (invokers);
}
}
}
@@ -2161,8 +2179,8 @@ _rl_macro_dumper_internal (print_readably, map, prefix)
fprintf (rl_outstream, "%s%s outputs %s\n", prefix ? prefix : "",
keyname,
out ? out : "");
free (keyname);
free (out);
xfree (keyname);
xfree (out);
break;
case ISFUNC:
break;
@@ -2185,13 +2203,13 @@ _rl_macro_dumper_internal (print_readably, map, prefix)
out = (char *)xmalloc (strlen (keyname) + prefix_len + 1);
strcpy (out, prefix);
strcpy (out + prefix_len, keyname);
free (keyname);
xfree (keyname);
keyname = out;
}
}
_rl_macro_dumper_internal (print_readably, FUNCTION_TO_KEYMAP (map, key), keyname);
free (keyname);
xfree (keyname);
break;
}
}
@@ -2237,6 +2255,11 @@ _rl_get_string_variable_value (name)
}
else if (_rl_stricmp (name, "comment-begin") == 0)
return (_rl_comment_begin ? _rl_comment_begin : RL_COMMENT_BEGIN_DEFAULT);
else if (_rl_stricmp (name, "completion-prefix-display-length") == 0)
{
sprintf (numbuf, "%d", _rl_completion_prefix_display_length);
return (numbuf);
}
else if (_rl_stricmp (name, "completion-query-items") == 0)
{
sprintf (numbuf, "%d", rl_completion_query_items);
@@ -2244,6 +2267,11 @@ _rl_get_string_variable_value (name)
}
else if (_rl_stricmp (name, "editing-mode") == 0)
return (rl_get_keymap_name_from_edit_mode ());
else if (_rl_stricmp (name, "history-size") == 0)
{
sprintf (numbuf, "%d", history_is_stifled() ? history_max_entries : 0);
return (numbuf);
}
else if (_rl_stricmp (name, "isearch-terminators") == 0)
{
if (_rl_isearch_terminators == 0)
@@ -2252,7 +2280,7 @@ _rl_get_string_variable_value (name)
if (ret)
{
strncpy (numbuf, ret, sizeof (numbuf) - 1);
free (ret);
xfree (ret);
numbuf[sizeof(numbuf) - 1] = '\0';
}
else
+54 -13
View File
@@ -110,8 +110,8 @@ static int get_y_or_n PARAMS((int));
static int _rl_internal_pager PARAMS((int));
static char *printable_part PARAMS((char *));
static int fnwidth PARAMS((const char *));
static int fnprint PARAMS((const char *));
static int print_filename PARAMS((char *, char *));
static int fnprint PARAMS((const char *, int));
static int print_filename PARAMS((char *, char *, int));
static char **gen_completion_matches PARAMS((char *, int, int, rl_compentry_func_t *, int, int));
@@ -164,6 +164,12 @@ int _rl_completion_case_fold;
Unix) when doing filename completion. */
int _rl_match_hidden_files = 1;
/* Length in characters of a common prefix replaced with an ellipsis (`...')
when displaying completion matches. Matches whose printable portion has
more than this number of displaying characters in common will have the common
display prefix replaced with an ellipsis. */
int _rl_completion_prefix_display_length = 0;
/* Global variables available to applications using readline. */
#if defined (VISIBLE_STATS)
@@ -647,9 +653,12 @@ fnwidth (string)
return width;
}
#define ELLIPSIS_LEN 3
static int
fnprint (to_print)
fnprint (to_print, prefix_bytes)
const char *to_print;
int prefix_bytes;
{
int printed_len;
const char *s;
@@ -665,7 +674,23 @@ fnprint (to_print)
#endif
printed_len = 0;
s = to_print;
/* Don't print only the ellipsis if the common prefix is one of the
possible completions */
if (to_print[prefix_bytes] == '\0')
prefix_bytes = 0;
if (prefix_bytes)
{
char ellipsis;
ellipsis = (to_print[prefix_bytes] == '.') ? '_' : '.';
for (w = 0; w < ELLIPSIS_LEN; w++)
putc (ellipsis, rl_outstream);
printed_len = ELLIPSIS_LEN;
}
s = to_print + prefix_bytes;
while (*s)
{
if (CTRL_CHAR (*s))
@@ -724,14 +749,15 @@ fnprint (to_print)
filenames. Return the number of characters we output. */
static int
print_filename (to_print, full_pathname)
print_filename (to_print, full_pathname, prefix_bytes)
char *to_print, *full_pathname;
int prefix_bytes;
{
int printed_len, extension_char, slen, tlen;
char *s, c, *new_full_pathname, *dn;
extension_char = 0;
printed_len = fnprint (to_print);
printed_len = fnprint (to_print, prefix_bytes);
#if defined (VISIBLE_STATS)
if (rl_filename_completion_desired && (rl_visible_stats || _rl_complete_mark_directories))
@@ -1289,8 +1315,24 @@ rl_display_match_list (matches, len, max)
int len, max;
{
int count, limit, printed_len, lines;
int i, j, k, l;
char *temp;
int i, j, k, l, common_length, sind;
char *temp, *t;
/* Find the length of the prefix common to all items: length as displayed
characters (common_length) and as a byte index into the matches (sind) */
common_length = sind = 0;
if (_rl_completion_prefix_display_length > 0)
{
t = printable_part (matches[0]);
temp = strrchr (t, '/');
common_length = temp ? fnwidth (temp) : fnwidth (t);
sind = temp ? strlen (temp) : strlen (t);
if (common_length > _rl_completion_prefix_display_length && common_length > ELLIPSIS_LEN)
max -= common_length - ELLIPSIS_LEN;
else
common_length = sind = 0;
}
/* How many items of MAX length can we fit in the screen window? */
max += 2;
@@ -1329,7 +1371,7 @@ rl_display_match_list (matches, len, max)
else
{
temp = printable_part (matches[l]);
printed_len = print_filename (temp, matches[l]);
printed_len = print_filename (temp, matches[l], sind);
if (j + 1 < limit)
for (k = 0; k < max - printed_len; k++)
@@ -1353,7 +1395,7 @@ rl_display_match_list (matches, len, max)
for (i = 1; matches[i]; i++)
{
temp = printable_part (matches[i]);
printed_len = print_filename (temp, matches[i]);
printed_len = print_filename (temp, matches[i], sind);
/* Have we reached the end of this line? */
if (matches[i+1])
{
@@ -1403,7 +1445,7 @@ display_matches (matches)
{
temp = printable_part (matches[0]);
rl_crlf ();
print_filename (temp, matches[0]);
print_filename (temp, matches[0], 0);
rl_crlf ();
rl_forced_update_display ();
@@ -2221,8 +2263,7 @@ rl_old_menu_complete (count, invoking_key)
/* matches[0] is lcd if match_list_size > 1, but the circular buffer
code below should take care of it. */
if
(match_list_size > 1 && _rl_complete_show_all)
if (match_list_size > 1 && _rl_complete_show_all)
display_matches (matches);
}
+54 -13
View File
@@ -110,8 +110,8 @@ static int get_y_or_n PARAMS((int));
static int _rl_internal_pager PARAMS((int));
static char *printable_part PARAMS((char *));
static int fnwidth PARAMS((const char *));
static int fnprint PARAMS((const char *));
static int print_filename PARAMS((char *, char *));
static int fnprint PARAMS((const char *, int));
static int print_filename PARAMS((char *, char *, int));
static char **gen_completion_matches PARAMS((char *, int, int, rl_compentry_func_t *, int, int));
@@ -164,6 +164,12 @@ int _rl_completion_case_fold;
Unix) when doing filename completion. */
int _rl_match_hidden_files = 1;
/* Length in characters of a common prefix replaced with an ellipsis (`...')
when displaying completion matches. Matches whose printable portion has
more than this number of displaying characters in common will have the common
display prefix replaced with an ellipsis. */
int _rl_completion_prefix_display_length = 0;
/* Global variables available to applications using readline. */
#if defined (VISIBLE_STATS)
@@ -647,9 +653,12 @@ fnwidth (string)
return width;
}
#define ELLIPSIS_LEN 3
static int
fnprint (to_print)
fnprint (to_print, prefix_bytes)
const char *to_print;
int prefix_bytes;
{
int printed_len;
const char *s;
@@ -665,7 +674,23 @@ fnprint (to_print)
#endif
printed_len = 0;
s = to_print;
/* Don't print only the ellipsis if the common prefix is one of the
possible completions */
if (to_print[prefix_bytes] == '\0')
prefix_bytes = 0;
if (prefix_bytes)
{
char ellipsis;
ellipsis = (to_print[prefix_bytes] == '.') ? '_' : '.';
for (w = 0; w < ELLIPSIS_LEN; w++)
putc (ellipsis, rl_outstream);
printed_len = ELLIPSIS_LEN;
}
s = to_print + prefix_bytes;
while (*s)
{
if (CTRL_CHAR (*s))
@@ -724,14 +749,15 @@ fnprint (to_print)
filenames. Return the number of characters we output. */
static int
print_filename (to_print, full_pathname)
print_filename (to_print, full_pathname, prefix_bytes)
char *to_print, *full_pathname;
int prefix_bytes;
{
int printed_len, extension_char, slen, tlen;
char *s, c, *new_full_pathname, *dn;
extension_char = 0;
printed_len = fnprint (to_print);
printed_len = fnprint (to_print, prefix_bytes);
#if defined (VISIBLE_STATS)
if (rl_filename_completion_desired && (rl_visible_stats || _rl_complete_mark_directories))
@@ -1193,8 +1219,7 @@ compute_lcd_of_matches (match_list, matches, text)
}
/* sort the list to get consistent answers. */
if (rl_sort_completion_matches)
qsort (match_list+1, matches, sizeof(char *), (QSFUNC *)_rl_qsort_string_compare);
qsort (match_list+1, matches, sizeof(char *), (QSFUNC *)_rl_qsort_string_compare);
si = strlen (text);
if (si <= low)
@@ -1290,8 +1315,24 @@ rl_display_match_list (matches, len, max)
int len, max;
{
int count, limit, printed_len, lines;
int i, j, k, l;
char *temp;
int i, j, k, l, common_length, sind;
char *temp, *t;
/* Find the length of the prefix common to all items: length as displayed
characters (common_length) and as a byte index into the matches (sind) */
common_length = sind = 0;
if (_rl_completion_prefix_display_length > 0)
{
t = printable_part (matches[0]);
temp = strrchr (t, '/');
common_length = temp ? fnwidth (temp) : fnwidth (t);
sind = temp ? strlen (temp) : strlen (t);
if (common_length > _rl_completion_prefix_display_length && common_length > ELLIPSIS_LEN)
max -= common_length - ELLIPSIS_LEN;
else
common_length = sind = 0;
}
/* How many items of MAX length can we fit in the screen window? */
max += 2;
@@ -1330,7 +1371,7 @@ rl_display_match_list (matches, len, max)
else
{
temp = printable_part (matches[l]);
printed_len = print_filename (temp, matches[l]);
printed_len = print_filename (temp, matches[l], sind);
if (j + 1 < limit)
for (k = 0; k < max - printed_len; k++)
@@ -1354,7 +1395,7 @@ rl_display_match_list (matches, len, max)
for (i = 1; matches[i]; i++)
{
temp = printable_part (matches[i]);
printed_len = print_filename (temp, matches[i]);
printed_len = print_filename (temp, matches[i], sind);
/* Have we reached the end of this line? */
if (matches[i+1])
{
@@ -1404,7 +1445,7 @@ display_matches (matches)
{
temp = printable_part (matches[0]);
rl_crlf ();
print_filename (temp, matches[0]);
print_filename (temp, matches[0], 0);
rl_crlf ();
rl_forced_update_display ();
+16 -4
View File
@@ -6,9 +6,9 @@
.\" Case Western Reserve University
.\" chet@ins.CWRU.Edu
.\"
.\" Last Change: Thu Feb 9 09:49:51 EST 2006
.\" Last Change: Thu May 8 09:29:59 EDT 2008
.\"
.TH READLINE 3 "2006 Apr 26" "GNU Readline 5.2"
.TH READLINE 3 "2008 May 8" "GNU Readline 5.2"
.\"
.\" File Name macro. This used to be `.PN', for Path Name,
.\" but Sun doesn't seem to like that very much.
@@ -34,8 +34,8 @@ readline \- get a line from a user with editing
\fBreadline\fP (\fIconst char *prompt\fP);
.fi
.SH COPYRIGHT
.if n Readline is Copyright (C) 1989\-2004 by the Free Software Foundation, Inc.
.if t Readline is Copyright \(co 1989\-2004 by the Free Software Foundation, Inc.
.if n Readline is Copyright (C) 1989\-2008 by the Free Software Foundation, Inc.
.if t Readline is Copyright \(co 1989\-2008 by the Free Software Foundation, Inc.
.SH DESCRIPTION
.LP
.B readline
@@ -365,6 +365,12 @@ in vi command mode.
If set to \fBOn\fP, readline performs filename matching and completion
in a case\-insensitive fashion.
.TP
.B completion\-prefix\-display\-length (0)
The length in characters of the common prefix of a list of possible
completions that is displayed without modification. When set to a
value greater than zero, common prefixes longer than this value are
replaced with an ellipsis when displaying possible completions.
.TP
.B completion\-query\-items (100)
This determines when the user is queried about viewing
the number of possible completions
@@ -475,6 +481,12 @@ to display a screenful of possible completions at a time.
If set to \fBOn\fP, readline will display completions with matches
sorted horizontally in alphabetical order, rather than down the screen.
.TP
.B revert\-all\-at\-newline (Off)
If set to \fBon\fP, readline will undo all changes to history lines
before returning when \fBaccept\-line\fP is executed. By default,
history lines may be modified and retain individual undo lists across
calls to \fBreadline\fP.
.TP
.B show\-all\-if\-ambiguous (Off)
This alters the default behavior of the completion functions. If
set to
+11 -4
View File
@@ -6,9 +6,9 @@
.\" Case Western Reserve University
.\" chet@ins.CWRU.Edu
.\"
.\" Last Change: Thu Feb 9 09:49:51 EST 2006
.\" Last Change: Thu May 8 09:29:59 EDT 2008
.\"
.TH READLINE 3 "2006 Apr 26" "GNU Readline 5.2"
.TH READLINE 3 "2008 May 8" "GNU Readline 5.2"
.\"
.\" File Name macro. This used to be `.PN', for Path Name,
.\" but Sun doesn't seem to like that very much.
@@ -34,8 +34,8 @@ readline \- get a line from a user with editing
\fBreadline\fP (\fIconst char *prompt\fP);
.fi
.SH COPYRIGHT
.if n Readline is Copyright (C) 1989\-2004 by the Free Software Foundation, Inc.
.if t Readline is Copyright \(co 1989\-2004 by the Free Software Foundation, Inc.
.if n Readline is Copyright (C) 1989\-2008 by the Free Software Foundation, Inc.
.if t Readline is Copyright \(co 1989\-2008 by the Free Software Foundation, Inc.
.SH DESCRIPTION
.LP
.B readline
@@ -365,6 +365,12 @@ in vi command mode.
If set to \fBOn\fP, readline performs filename matching and completion
in a case\-insensitive fashion.
.TP
.B completion\-prefix\-display\-length (0)
The length in characters of the common prefix of a list of possible
completions that is displayed without modification. When set to a
value greater than zero, common prefixes longer than this value are
replaced with an ellipsis when displaying possible completions.
.TP
.B completion\-query\-items (100)
This determines when the user is queried about viewing
the number of possible completions
@@ -408,6 +414,7 @@ attempts word completion.
If set to \fBon\fP, the history code attempts to place point at the
same location on each history line retrieved with \fBprevious-history\fP
or \fBnext-history\fP.
.TP
.B history\-size (0)
Set the maximum number of history entries saved in the history list. If
set to zero, the number of entries in the history list is not limited.
+14
View File
@@ -426,6 +426,13 @@ If set to @samp{on}, Readline performs filename matching and completion
in a case-insensitive fashion.
The default value is @samp{off}.
@item completion-prefix-display-length
@vindex completion-prefix-display-length
The length in characters of the common prefix of a list of possible
completions that is displayed without modification. When set to a
value greater than zero, common prefixes longer than this value are
replaced with an ellipsis when displaying possible completions.
@item completion-query-items
@vindex completion-query-items
The number of possible completions that determines when the user is
@@ -563,6 +570,13 @@ If set to @samp{on}, Readline will display completions with matches
sorted horizontally in alphabetical order, rather than down the screen.
The default is @samp{off}.
@item revert-all-at-newline
@vindex revert-all-at-newline
If set to @samp{on}, Readline will undo all changes to history lines
before returning when @code{accept-line} is executed. By default,
history lines may be modified and retain individual undo lists across
calls to @code{readline}. The default is @samp{off}.
@item show-all-if-ambiguous
@vindex show-all-if-ambiguous
This alters the default behavior of the completion functions. If
+21 -4
View File
@@ -426,6 +426,13 @@ If set to @samp{on}, Readline performs filename matching and completion
in a case-insensitive fashion.
The default value is @samp{off}.
@item completion-prefix-display-length
@vindex completion-prefix-display-length
The length in characters of the common prefix of a list of possible
completions that is displayed without modification. When set to a
value greater than zero, common prefixes longer than this value are
replaced with an ellipsis when displaying possible completions.
@item completion-query-items
@vindex completion-query-items
The number of possible completions that determines when the user is
@@ -563,6 +570,13 @@ If set to @samp{on}, Readline will display completions with matches
sorted horizontally in alphabetical order, rather than down the screen.
The default is @samp{off}.
@item revert-all-at-newline
@vindex revert-all-at-newline
If set to @samp{on}, Readline will undo all changes to history lines
before returning when @code{accept-line} is executed. By default,
history lines may be edited and retain individual undo lists across
calls to @code{readline}. The default is @samp{off}.
@item show-all-if-ambiguous
@vindex show-all-if-ambiguous
This alters the default behavior of the completion functions. If
@@ -1666,10 +1680,10 @@ matches were generated.
@item complete
@btindex complete
@example
@code{complete [-abcdefgjksuv] [-o @var{comp-option}] [-A @var{action}] [-G @var{globpat}] [-W @var{wordlist}]
@code{complete [-abcdefgjksuv] [-o @var{comp-option}] [-E] [-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 [@var{name} @dots{}]}
@code{complete -pr [-E] [@var{name} @dots{}]}
@end example
Specify how arguments to each @var{name} should be completed.
@@ -1679,6 +1693,9 @@ 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{-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}).
@@ -1851,8 +1868,6 @@ argument, an attempt is made to remove a completion specification for
a @var{name} for which no specification exists, or
an error occurs adding a completion specification.
@end table
@item compopt
@btindex compopt
@example
@@ -1870,4 +1885,6 @@ 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
specification exists, or an output error occurs.
@end table
@end ifset
+3 -3
View File
@@ -4,7 +4,7 @@ Copyright (C) 1988-2008 Free Software Foundation, Inc.
@set EDITION 5.2
@set VERSION 5.2
@set UPDATED 7 April 2008
@set UPDATED-MONTH April 2008
@set UPDATED 8 May 2008
@set UPDATED-MONTH May 2008
@set LASTCHANGE Mon Apr 7 23:00:49 EDT 2008
@set LASTCHANGE Thu May 8 09:29:33 EDT 2008
+4 -4
View File
@@ -1,10 +1,10 @@
@ignore
Copyright (C) 1988-2007 Free Software Foundation, Inc.
Copyright (C) 1988-2008 Free Software Foundation, Inc.
@end ignore
@set EDITION 5.2
@set VERSION 5.2
@set UPDATED 14 December 2007
@set UPDATED-MONTH December 2007
@set UPDATED 7 April 2008
@set UPDATED-MONTH April 2008
@set LASTCHANGE Fri Dec 14 23:24:03 EST 2007
@set LASTCHANGE Mon Apr 7 23:00:49 EDT 2008
+2 -2
View File
@@ -1,6 +1,6 @@
/* history.c -- standalone history library */
/* Copyright (C) 1989-2005 Free Software Foundation, Inc.
/* Copyright (C) 1989-2008 Free Software Foundation, Inc.
This file contains the GNU History Library (the Library), a set of
routines for managing the text of previously typed lines.
@@ -483,7 +483,7 @@ stifle_history (max)
/* Stop stifling the history. This returns the previous maximum
number of history entries. The value is positive if the history
was stifled, negative if it wasn't. */
was stifled, negative if it wasn't. */
int
unstifle_history ()
{
+1 -1
View File
@@ -158,7 +158,7 @@ history_set_pos (pos)
return (1);
}
/* Return the current history array. The caller has to be carefull, since this
/* Return the current history array. The caller has to be careful, since this
is the actual array of data, and could be bashed or made corrupt easily.
The array is terminated with a NULL pointer. */
HIST_ENTRY **
+1
View File
@@ -371,6 +371,7 @@ extern int _rl_complete_show_all;
extern int _rl_complete_show_unmodified;
extern int _rl_complete_mark_directories;
extern int _rl_complete_mark_symlink_dirs;
extern int _rl_completion_prefix_display_length;
extern int _rl_print_completions_horizontally;
extern int _rl_completion_case_fold;
extern int _rl_match_hidden_files;
+7 -4
View File
@@ -149,12 +149,9 @@ extern int rl_visible_stats;
extern int rl_line_buffer_len;
extern int rl_arg_sign;
extern int rl_visible_prompt_length;
extern int readline_echoing_p;
extern int rl_key_sequence_length;
extern int rl_byte_oriented;
extern _rl_keyseq_cxt *_rl_kscxt;
/* display.c */
extern int rl_display_fixed;
@@ -294,6 +291,10 @@ extern int _rl_restore_tty_signals PARAMS((void));
/* search.c */
extern int _rl_nsearch_callback PARAMS((_rl_search_cxt *));
/* signals.c */
extern void _rl_block_sigint PARAMS((void));
extern void _rl_release_sigint PARAMS((void));
/* terminal.c */
extern void _rl_get_screen_size PARAMS((int, int));
extern int _rl_init_terminal_io PARAMS((const char *));
@@ -396,6 +397,7 @@ extern int _rl_history_saved_point;
extern _rl_arg_cxt _rl_argcxt;
/* readline.c */
extern int _rl_echoing_p;
extern int _rl_horizontal_scroll_mode;
extern int _rl_mark_modified_lines;
extern int _rl_bell_preference;
@@ -411,7 +413,8 @@ extern FILE *_rl_in_stream;
extern FILE *_rl_out_stream;
extern int _rl_last_command_was_kill;
extern int _rl_eof_char;
extern procenv_t readline_top_level;
extern procenv_t _rl_top_level;
extern _rl_keyseq_cxt *_rl_kscxt;
/* search.c */
extern _rl_search_cxt *_rl_nscxt;
+21
View File
@@ -82,3 +82,24 @@ echo ! eval succeeded -- 1
! eval '(exit 5)'
echo ! eval succeeded -- 2
set -e
until builtin false; do echo a; break; done
echo $?
until eval false; do echo b; break; done
echo $?
: ${TMPDIR:=/tmp}
FN=$TMPDIR/set-e-$$
cat > $FN << EOF
false
echo after 1
false
EOF
set -e
until . $FN; do echo a; break; done
echo $?
rm -f $FN
+84
View File
@@ -0,0 +1,84 @@
if : ; then
set -e
N=95
while :; do
# expr returns 1 if expression is null or 0
set +e
N_MOD_100=`expr $N % 100`
set -e
echo $N_MOD_100
N=`expr $N + 1`
if [ $N -eq 110 ]; then
break
fi
done
set +e
fi
(
set -e
false
echo bad
)
echo $?
x=$(
set -e
false
echo bad
)
echo $? $x
# command subst should not inherit -e
set -e
echo $(false; echo ok)
if set +e
then
false
fi
echo hi
set -e
# a failing command in the compound list following a while, until, or
# if should not cause the shell to exit
while false; do
echo hi
done
echo while succeeded
x=1
until (( x == 4 )); do
x=4
done
echo until succeeded: $x
if false; then
echo oops
fi
echo if succeeded
# failing commands that are part of an AND or OR list should not
# cause the shell to exit
false && echo AND list failed
echo AND list succeeded
false || echo OR list succeeded
! false
echo ! succeeded
# make sure eval preserves the state of the -e flag and `!' reserved word
set -e
if eval false; then
echo oops
fi
echo eval succeeded
! eval false
echo ! eval succeeded -- 1
! eval '(exit 5)'
echo ! eval succeeded -- 2
+7
View File
@@ -26,3 +26,10 @@ OR list succeeded
eval succeeded
! eval succeeded -- 1
! eval succeeded -- 2
a
0
b
0
after 1
a
0
+1 -1
View File
@@ -356,7 +356,7 @@ initialize_shell_variables (env, privmode)
}
# endif
#endif
else
else if (legal_identifier (name))
{
temp_var = bind_variable (name, string, 0);
VSETATTR (temp_var, (att_exported | att_imported));
+7 -2
View File
@@ -356,12 +356,14 @@ initialize_shell_variables (env, privmode)
}
# endif
#endif
else
else if (legal_identifier (name))
{
temp_var = bind_variable (name, string, 0);
VSETATTR (temp_var, (att_exported | att_imported));
array_needs_making = 1;
}
else
internal_error (_("`%s': not a valid identifier"), name);
name[char_index] = '=';
/* temp_var can be NULL if it was an exported function with a syntax
@@ -1329,7 +1331,6 @@ get_bash_command (var)
SHELL_VAR *var;
{
char *p;
if (the_printed_command_except_trap)
p = savestring (the_printed_command_except_trap);
@@ -3519,6 +3520,8 @@ push_func_var (data)
shell_variables->flags |= VC_HASTMPVAR;
v->attributes |= var->attributes;
}
else
stupidly_hack_special_variables (var->name); /* XXX */
dispose_variable (var);
}
@@ -3605,6 +3608,8 @@ push_exported_var (data)
var->attributes &= ~att_propagate;
v->attributes |= var->attributes;
}
else
stupidly_hack_special_variables (var->name); /* XXX */
dispose_variable (var);
}