Bash-4.4 distribution sources and documentation

This commit is contained in:
Chet Ramey 2016-09-15 16:59:08 -04:00
commit a0c0a00fc4
588 changed files with 130746 additions and 80164 deletions

View file

@ -12,7 +12,7 @@ This document describes the GNU History library
a programming tool that provides a consistent user interface for
recalling lines of previously typed input.
Copyright @copyright{} 1988--2014 Free Software Foundation, Inc.
Copyright @copyright{} 1988--2016 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document

View file

@ -1,7 +1,7 @@
@ignore
This file documents the user interface to the GNU History library.
Copyright (C) 1988-2014 Free Software Foundation, Inc.
Copyright (C) 1988-2016 Free Software Foundation, Inc.
Authored by Brian Fox and Chet Ramey.
Permission is granted to make and distribute verbatim copies of this manual
@ -242,6 +242,7 @@ is greater than the history length, return a @code{NULL} pointer.
@deftypefun time_t history_get_time (HIST_ENTRY *entry)
Return the time stamp associated with the history entry @var{entry}.
If the timestamp is missing or invalid, return 0.
@end deftypefun
@deftypefun int history_total_bytes (void)
@ -270,9 +271,11 @@ a @code{NULL} pointer.
@end deftypefun
@deftypefun {HIST_ENTRY *} next_history (void)
Move the current history offset forward to the next history entry, and
return the a pointer to that entry. If there is no next entry, return
a @code{NULL} pointer.
If the current history offset refers to a valid history entry,
increment the current history offset.
If the possibly-incremented history offset refers to a valid history
entry, return a pointer to that entry;
otherwise, return a @code{BNULL} pointer.
@end deftypefun
@node Searching the History List
@ -467,8 +470,8 @@ carriage return, and @samp{=}.
@end deftypevar
@deftypevar int history_quotes_inhibit_expansion
If non-zero, single-quoted words are not scanned for the history expansion
character. The default value is 0.
If non-zero, double-quoted words are not scanned for the history expansion
character or the history comment character. The default value is 0.
@end deftypevar
@deftypevar {rl_linebuf_func_t *} history_inhibit_expansion_function

View file

@ -1,7 +1,7 @@
@ignore
This file documents the user interface to the GNU History library.
Copyright (C) 1988--2014 Free Software Foundation, Inc.
Copyright (C) 1988--2016 Free Software Foundation, Inc.
Authored by Brian Fox and Chet Ramey.
Permission is granted to make and distribute verbatim copies of this manual
@ -102,7 +102,7 @@ associated 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.
as timestamps for the following history entry.
The builtin command @code{fc} may be used to list or edit and re-execute
a portion of the history list.
@ -202,9 +202,9 @@ Delete the history entry at position @var{offset}.
displayed.
@item -a
Append the new
history lines (history lines entered since the beginning of the
current Bash session) to the history file.
Append the new history lines to the history file.
These are history lines entered since the beginning of the current
Bash session, but not already appended to the history file.
@item -n
Append the history lines not already read from the history file
@ -249,6 +249,11 @@ the input stream, making it easy to repeat commands, insert the
arguments to a previous command into the current input line, or
fix errors in previous commands quickly.
@ifset BashFeatures
History expansion is performed immediately after a complete line
is read, before the shell breaks it into words.
@end ifset
History expansion takes place in two parts. The first is to determine
which line from the history list should be used during substitution.
The second is to select portions of that line for inclusion into the
@ -262,7 +267,9 @@ History expansions are introduced by the appearance of the
history expansion character, which is @samp{!} by default.
@ifset BashFeatures
Only @samp{\} and @samp{'} may be used to escape the history expansion
character.
character, but the history expansion character is
also treated as quoted if it immediately precedes the closing double quote
in a double-quoted string.
@end ifset
@ifset BashFeatures

View file

@ -13,7 +13,7 @@ This manual describes the GNU Readline Library
consistency of user interface across discrete programs which provide
a command line interface.
Copyright @copyright{} 1988--2014 Free Software Foundation, Inc.
Copyright @copyright{} 1988--2016 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document

View file

@ -7,7 +7,7 @@ This document describes the GNU Readline Library, a utility for aiding
in the consistency of user interface across discrete programs that need
to provide a command line interface.
Copyright (C) 1988--2014 Free Software Foundation, Inc.
Copyright (C) 1988--2016 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@ -282,7 +282,7 @@ At the very least, it should be aware that it can be passed a
negative argument.
A command function should return 0 if its action completes successfully,
and a non-zero value if some error occurs.
and a value greater than zero if some error occurs.
This is the convention obeyed by all of the builtin Readline bindable
command functions.
@ -963,6 +963,10 @@ redisplay.
It should be used after setting @var{rl_already_prompted}.
@end deftypefun
@deftypefun int rl_clear_visible_line (void)
Clear the screen lines corresponding to the current line's contents.
@end deftypefun
@deftypefun int rl_reset_line_state (void)
Reset the display state to a clean state and redisplay the current line
starting on a new line.
@ -1020,7 +1024,7 @@ It returns the number of visible characters on the last line of the
Applications may indicate that the prompt contains characters that take
up no physical screen space when displayed by bracketing a sequence of
such characters with the special markers @code{RL_PROMPT_START_IGNORE}
and @code{RL_PROMPT_END_IGNORE} (declared in @file{readline.h}. This may
and @code{RL_PROMPT_END_IGNORE} (declared in @file{readline.h}). This may
be used to embed terminal-specific escape sequences in prompts.
@end deftypefun
@ -1136,6 +1140,14 @@ that the terminal editing characters are bound to @code{rl_insert}.
The bindings are performed in @var{kmap}.
@end deftypefun
@deftypefun int rl_tty_set_echoing (int value)
Set Readline's idea of whether or not it is echoing output to its output
stream (@var{rl_outstream}). If @var{value} is 0, Readline does not display
output to @var{rl_outstream}; any other value enables output. The initial
value is set when Readline initializes the terminal settings.
This function returns the previous value.
@end deftypefun
@deftypefun int rl_reset_terminal (const char *terminal_name)
Reinitialize Readline's idea of the terminal settings using
@var{terminal_name} as the terminal type (e.g., @code{vt100}).
@ -1307,6 +1319,8 @@ expanded value of @var{prompt}. Save the value of @var{lhandler} to
use as a handler function to call when a complete line of input has been
entered.
The handler function receives the text of the line as an argument.
As with @code{readline()}, the handler function should @code{free} the
line when it it finished with it.
@end deftypefun
@deftypefun void rl_callback_read_char (void)
@ -1326,9 +1340,17 @@ the terminal settings are modified for Readline's use again.
@code{NULL} line.
@end deftypefun
@deftypefun void rl_callback_sigcleanup (void)
Clean up any internal state the callback interface uses to maintain state
between calls to rl_callback_read_char (e.g., the state of any active
incremental searches). This is intended to be used by applications that
wish to perform their own signal handling; Readline's internal signal handler
calls this when appropriate.
@end deftypefun
@deftypefun void rl_callback_handler_remove (void)
Restore the terminal to its initial state and remove the line handler.
This may be called from within a callback as well as independently.
You may call this function from within a callback as well as independently.
If the @var{lhandler} installed by @code{rl_callback_handler_install}
does not exit the program, either this function or the function referred
to by the value of @code{rl_deprep_term_function} should be called before
@ -1413,12 +1435,16 @@ It understands the EOF character or "exit" to exit the program.
@example
/* Standard include files. stdio.h is required. */
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <locale.h>
/* Used for select(2) */
#include <sys/types.h>
#include <sys/select.h>
#include <signal.h>
#include <stdio.h>
/* Standard readline include files. */
@ -1426,10 +1452,20 @@ It understands the EOF character or "exit" to exit the program.
#include <readline/history.h>
static void cb_linehandler (char *);
static void sighandler (int);
int running;
int sigwinch_received;
const char *prompt = "rltest$ ";
/* Handle SIGWINCH and window size changes when readline is not active and
reading a character. */
static void
sighandler (int sig)
@{
sigwinch_received = 1;
@}
/* Callback function called for each line when accept-line executed, EOF
seen, or EOF character read. This sets a flag and returns; it could
also call exit(3). */
@ -1464,6 +1500,13 @@ main (int c, char **v)
fd_set fds;
int r;
/* Set the default locale values according to environment variables. */
setlocale (LC_ALL, "");
/* Handle window size changes when readline is not active and reading
characters. */
signal (SIGWINCH, sighandler);
/* Install the line handler. */
rl_callback_handler_install (prompt, cb_linehandler);
@ -1478,12 +1521,19 @@ main (int c, char **v)
FD_SET (fileno (rl_instream), &fds);
r = select (FD_SETSIZE, &fds, NULL, NULL, NULL);
if (r < 0)
if (r < 0 && errno != EINTR)
@{
perror ("rltest: select");
rl_callback_handler_remove ();
break;
@}
if (sigwinch_received)
@{
rl_resize_terminal ();
sigwinch_received = 0;
@}
if (r < 0)
continue;
if (FD_ISSET (fileno (rl_instream), &fds))
rl_callback_read_char ();
@ -1532,7 +1582,30 @@ resetting the terminal to its original state. If the application's signal
handler does more than update its idea of the terminal size and return (for
example, a @code{longjmp} back to a main processing loop), it @emph{must}
call @code{rl_cleanup_after_signal()} (described below), to restore the
terminal state.
terminal state.
When an application is using the callback interface
(@pxref{Alternate Interface}), Readline installs signal handlers only for
the duration of the call to @code{rl_callback_read_char}. Applications
using the callback interface should be prepared to clean up Readline's
state if they wish to handle the signal before the line handler completes
and restores the terminal state.
If an application using the callback interface wishes to have Readline
install its signal handlers at the time the application calls
@code{rl_callback_handler_install} and remove them only when a complete
line of input has been read, it should set the
@code{rl_persistent_signal_handlers} variable to a non-zero value.
This allows an application to defer all of the handling of the signals
Readline catches to Readline.
Applications should use this variable with care; it can result in Readline
catching signals and not acting on them (or allowing the application to react
to them) until the application calls @code{rl_callback_read_char}. This
can result in an application becoming less responsive to keyboard signals
like SIGINT.
If an application does not want or need to perform any signal handling, or
does not need to do any processing between calls to @code{rl_callback_read_char},
setting this variable may be desirable.
Readline provides two variables that allow application writers to
control whether or not it will catch certain signals and act on them
@ -1555,6 +1628,15 @@ Readline will install a signal handler for @code{SIGWINCH}.
The default value of @code{rl_catch_sigwinch} is 1.
@end deftypevar
@deftypevar int rl_persistent_signal_handlers
If an application using the callback interface wishes Readline's signal
handlers to be installed and active during the set of calls to
@code{rl_callback_read_char} that constitutes an entire single line,
it should set this variable to a non-zero value.
The default value of @code{rl_persistent_signal_handlers} is 0.
@end deftypevar
@deftypevar int rl_change_environment
If this variable is set to a non-zero value,
and Readline is handling @code{SIGWINCH}, Readline will modify the
@ -1570,6 +1652,11 @@ for example),
Readline provides convenience functions to do the necessary terminal
and internal state cleanup upon receipt of a signal.
@deftypefun int rl_pending_signal (void)
Return the signal number of the most recent signal Readline received but
has not yet handled, or 0 if there is no pending signal.
@end deftypefun
@deftypefun void rl_cleanup_after_signal (void)
This function will reset the state of the terminal to what it was before
@code{readline()} was called, and remove the Readline signal handlers for
@ -1942,8 +2029,8 @@ where @var{matches} is the array of matching strings,
@var{num_matches} is the number of strings in that array, and
@var{max_length} is the length of the longest string in that array.
Readline provides a convenience function, @code{rl_display_match_list},
that takes care of doing the display to Readline's output stream. That
function may be called from this hook.
that takes care of doing the display to Readline's output stream.
You may call that function from this hook.
@end deftypevar
@deftypevar {const char *} rl_basic_word_break_characters

View file

@ -9,7 +9,7 @@ use these features. There is a document entitled "readline.texinfo"
which contains both end-user and programmer documentation for the
GNU Readline Library.
Copyright (C) 1988--2014 Free Software Foundation, Inc.
Copyright (C) 1988--2016 Free Software Foundation, Inc.
Authored by Brian Fox and Chet Ramey.
@ -423,9 +423,23 @@ the terminal's bell.
@item bind-tty-special-chars
@vindex bind-tty-special-chars
If set to @samp{on}, Readline attempts to bind the control characters
treated specially by the kernel's terminal driver to their Readline
equivalents.
If set to @samp{on} (the default), Readline attempts to bind the control
characters treated specially by the kernel's terminal driver to their
Readline equivalents.
@item blink-matching-paren
@vindex blink-matching-paren
If set to @samp{on}, Readline attempts to briefly move the cursor to an
opening parenthesis when a closing parenthesis is inserted. The default
is @samp{off}.
@item colored-completion-prefix
@vindex colored-completion-prefix
If set to @samp{on}, when listing completions, Readline displays the
common prefix of the set of possible completions using a different color.
The color definitions are taken from the value of the @env{LS_COLORS}
environment variable.
The default is @samp{off}.
@item colored-stats
@vindex colored-stats
@ -485,7 +499,9 @@ The default limit is @code{100}.
If set to @samp{on}, Readline will convert characters with the
eighth bit set to an @sc{ascii} key sequence by stripping the eighth
bit and prefixing an @key{ESC} character, converting them to a
meta-prefixed key sequence. The default value is @samp{on}.
meta-prefixed key sequence. The default value is @samp{on}, but
will be set to @samp{off} if the locale is one that contains
eight-bit characters.
@item disable-completion
@vindex disable-completion
@ -493,6 +509,12 @@ If set to @samp{On}, Readline will inhibit word completion.
Completion characters will be inserted into the line as if they had
been mapped to @code{self-insert}. The default is @samp{off}.
@item echo-control-characters
@vindex 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 editing-mode
@vindex editing-mode
The @code{editing-mode} variable controls which default set of
@ -500,10 +522,24 @@ 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 emacs-mode-string
@vindex emacs-mode-string
This string is displayed immediately before the last line of the primary
prompt when emacs editing mode is active. The value is expanded like a
key binding, so the standard set of meta- and control prefixes and
backslash escape sequences is available.
Use the @samp{\1} and @samp{\2} escapes to begin and end sequences of
non-printing characters, which can be used to embed a terminal control
sequence into the mode string.
The default is @samp{@@}.
@item enable-bracketed-paste
@vindex enable-bracketed-paste
When set to @samp{On}, Readline will configure the terminal in a way
that will enable it to insert each paste into the editing buffer as a
single string of characters, instead of treating each character as if
it had been read from the keyboard. This can prevent pasted characters
from being interpreted as editing commands. The default is @samp{off}.
@item enable-keypad
@vindex enable-keypad
@ -537,6 +573,8 @@ are saved.
If set to a value less than zero, the number of history entries is not
limited.
By default, the number of history entries is not limited.
If an attempt is made to set @var{history-size} to a non-numeric value,
the maximum number of history entries will be set to 500.
@item horizontal-scroll-mode
@vindex horizontal-scroll-mode
@ -552,8 +590,9 @@ this variable is set to @samp{off}.
If set to @samp{on}, Readline will enable eight-bit input (it
will not clear the eighth bit in the characters it reads),
regardless of what the terminal claims it can support. The
default value is @samp{off}. The name @code{meta-flag} is a
synonym for this variable.
default value is @samp{off}, but Readline will set it to @samp{on} if the
locale contains eight-bit characters.
The name @code{meta-flag} is a synonym for this variable.
@item isearch-terminators
@vindex isearch-terminators
@ -574,8 +613,9 @@ Acceptable @code{keymap} names are
@code{vi-move},
@code{vi-command}, and
@code{vi-insert}.
@code{vi} is equivalent to @code{vi-command}; @code{emacs} is
equivalent to @code{emacs-standard}. The default value is @code{emacs}.
@code{vi} is equivalent to @code{vi-command} (@code{vi-move} is also a
synonym); @code{emacs} is equivalent to @code{emacs-standard}.
The default value is @code{emacs}.
The value of the @code{editing-mode} variable also affects the
default keymap.
@ -631,7 +671,9 @@ the list. The default is @samp{off}.
@vindex output-meta
If set to @samp{on}, Readline will display characters with the
eighth bit set directly rather than as a meta-prefixed escape
sequence. The default is @samp{off}.
sequence.
The default is @samp{off}, but Readline will set it to @samp{on} if the
locale contains eight-bit characters.
@item page-completions
@vindex page-completions
@ -673,8 +715,8 @@ The default value is @samp{off}.
@item show-mode-in-prompt
@vindex show-mode-in-prompt
If set to @samp{on}, add a character to the beginning of the prompt
indicating the editing mode: emacs (@samp{@@}), vi command (@samp{:}),
or vi insertion (@samp{+}).
indicating the editing mode: emacs, vi command, or vi insertion.
The mode strings are user-settable.
The default value is @samp{off}.
@item skip-completed-text
@ -691,6 +733,30 @@ rather than @samp{Makefilefile}, assuming there is a single possible
completion.
The default value is @samp{off}.
@item vi-cmd-mode-string
@vindex vi-cmd-mode-string
This string is displayed immediately before the last line of the primary
prompt when vi editing mode is active and in command mode.
The value is expanded like a
key binding, so the standard set of meta- and control prefixes and
backslash escape sequences is available.
Use the @samp{\1} and @samp{\2} escapes to begin and end sequences of
non-printing characters, which can be used to embed a terminal control
sequence into the mode string.
The default is @samp{(cmd)}.
@item vi-ins-mode-string
@vindex vi-ins-mode-string
This string is displayed immediately before the last line of the primary
prompt when vi editing mode is active and in insertion mode.
The value is expanded like a
key binding, so the standard set of meta- and control prefixes and
backslash escape sequences is available.
Use the @samp{\1} and @samp{\2} escapes to begin and end sequences of
non-printing characters, which can be used to embed a terminal control
sequence into the mode string.
The default is @samp{(ins)}.
@item visible-stats
@vindex visible-stats
If set to @samp{on}, a character denoting a file's type
@ -1122,17 +1188,19 @@ the history as necessary. This is an incremental search.
@item forward-search-history (C-s)
Search forward starting at the current line and moving `down' through
the the history as necessary. This is an incremental search.
the history as necessary. This is an incremental search.
@item non-incremental-reverse-search-history (M-p)
Search backward starting at the current line and moving `up'
through the history as necessary using a non-incremental search
for a string supplied by the user.
The search string may match anywhere in a history line.
@item non-incremental-forward-search-history (M-n)
Search forward starting at the current line and moving `down'
through the the history as necessary using a non-incremental search
through the history as necessary using a non-incremental search
for a string supplied by the user.
The search string may match anywhere in a history line.
@item history-search-forward ()
Search forward through the history for the string of characters
@ -1224,6 +1292,14 @@ Insert a tab character.
@item self-insert (a, b, A, 1, !, @dots{})
Insert yourself.
@item bracketed-paste-begin ()
This function is intended to be bound to the "bracketed paste" escape
sequence sent by some terminals, and such a binding is assigned by default.
It allows Readline to insert the pasted text as a single unit without treating
each character as if it had been read from the keyboard. The characters
are inserted as if each one was bound to @code{self-insert}) instead of
executing any editing commands.
@item transpose-chars (C-t)
Drag the character before the cursor forward over
the character at the cursor, moving the
@ -1275,7 +1351,7 @@ By default, this command is unbound.
Kill the text from point to the end of the line.
@item backward-kill-line (C-x Rubout)
Kill backward to the beginning of the line.
Kill backward from the cursor to the beginning of the current line.
@item unix-line-discard (C-u)
Kill backward from the cursor to the beginning of the current line.
@ -1357,7 +1433,7 @@ leading minus sign, those digits define the argument.
If the command is followed by digits, executing @code{universal-argument}
again ends the numeric argument, but is otherwise ignored.
As a special case, if this command is immediately followed by a
character that is neither a digit or minus sign, the argument count
character that is neither a digit nor minus sign, the argument count
for the next command is multiplied by four.
The argument count is initially one, so executing this function the
first time makes the argument count four, a second time makes the
@ -1788,6 +1864,10 @@ is removed before attempting a match.
Any completion that matches the pattern will be removed from the list.
A leading @samp{!} negates the pattern; in this case any completion
not matching the pattern will be removed.
If the @code{nocasematch} shell option
(see the description of @code{shopt} in @ref{The Shopt Builtin})
is enabled, the match is performed without regard to the case
of alphabetic characters.
Finally, any prefix and suffix specified with the @option{-P} and @option{-S}
options are added to each member of the completion list, and the result is
@ -1941,6 +2021,9 @@ with @option{-F}.
Tell Readline not to quote the completed words if they are filenames
(quoting filenames is the default).
@item nosort
Tell Readline not to sort the list of possible completions alphabetically.
@item nospace
Tell Readline not to append a space (the default) to words completed at
the end of the line.

View file

@ -12,7 +12,7 @@ This manual describes the end user interface of the GNU Readline Library
consistency of user interface across discrete programs which provide
a command line interface.
Copyright @copyright{} 1988--2014 Free Software Foundation, Inc.
Copyright @copyright{} 1988--2016 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document

View file

@ -1,10 +1,10 @@
@ignore
Copyright (C) 1988-2014 Free Software Foundation, Inc.
Copyright (C) 1988-2016 Free Software Foundation, Inc.
@end ignore
@set EDITION 6.3
@set VERSION 6.3
@set UPDATED 6 January 2014
@set UPDATED-MONTH January 2014
@set EDITION 7.0
@set VERSION 7.0
@set UPDATED 16 July 2016
@set UPDATED-MONTH July 2016
@set LASTCHANGE Mon Jan 6 16:26:51 EST 2014
@set LASTCHANGE Sat Jul 16 13:43:15 EDT 2016