diff options
Diffstat (limited to 'lib/readline/doc')
-rw-r--r-- | lib/readline/doc/._fdl.texi | bin | 0 -> 4096 bytes | |||
-rw-r--r-- | lib/readline/doc/Makefile | 25 | ||||
-rw-r--r-- | lib/readline/doc/fdl.texi | 96 | ||||
-rw-r--r-- | lib/readline/doc/history.texi | 27 | ||||
-rw-r--r-- | lib/readline/doc/hstech.texi | 2 | ||||
-rw-r--r-- | lib/readline/doc/hsuser.texi | 17 | ||||
-rw-r--r-- | lib/readline/doc/rlman.texi | 26 | ||||
-rw-r--r-- | lib/readline/doc/rltech.texi | 217 | ||||
-rw-r--r-- | lib/readline/doc/rluser.texi | 195 | ||||
-rw-r--r-- | lib/readline/doc/rluserman.texi | 27 | ||||
-rw-r--r-- | lib/readline/doc/version.texi | 12 |
11 files changed, 487 insertions, 157 deletions
diff --git a/lib/readline/doc/._fdl.texi b/lib/readline/doc/._fdl.texi Binary files differnew file mode 100644 index 0000000..3dd8e43 --- /dev/null +++ b/lib/readline/doc/._fdl.texi diff --git a/lib/readline/doc/Makefile b/lib/readline/doc/Makefile index 817c2af..af5ee3e 100644 --- a/lib/readline/doc/Makefile +++ b/lib/readline/doc/Makefile @@ -2,21 +2,22 @@ # This makefile for Readline library documentation is in -*- text -*- mode. # Emacs likes it that way. -# Copyright (C) 1996-2002 Free Software Foundation, Inc. +# Copyright (C) 1996-2002 Free Software Foundation, Inc. # -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA. +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# + topdir = . srcdir = . diff --git a/lib/readline/doc/fdl.texi b/lib/readline/doc/fdl.texi index 47ead9f..8805f1a 100644 --- a/lib/readline/doc/fdl.texi +++ b/lib/readline/doc/fdl.texi @@ -1,13 +1,12 @@ +@c The GNU Free Documentation License. +@center Version 1.3, 3 November 2008 -@node GNU Free Documentation License -@appendixsec GNU Free Documentation License - -@cindex FDL, GNU Free Documentation License -@center Version 1.2, November 2002 +@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. -59 Temple Place, Suite 330, Boston, MA 02111-1307, 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. @@ -112,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 @@ -344,7 +346,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. @@ -380,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 @@ -404,11 +423,46 @@ 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 -@appendixsubsec ADDENDUM: How to use this License for your documents +@heading ADDENDUM: How to use this License for your documents To use this License in a document you have written, include a copy of the License in the document and put the following copyright and @@ -418,16 +472,16 @@ 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 + with no Invariant Sections, no Front-Cover Texts, and no Back-Cover + Texts. A copy of the license is included in the section entitled ``GNU Free Documentation License''. @end group @end smallexample If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, -replace the ``with...Texts.'' line with this: +replace the ``with@dots{}Texts.'' line with this: @smallexample @group diff --git a/lib/readline/doc/history.texi b/lib/readline/doc/history.texi index 1af40c7..afdb901 100644 --- a/lib/readline/doc/history.texi +++ b/lib/readline/doc/history.texi @@ -4,8 +4,6 @@ @settitle GNU History Library @c %**end of header (This is for running Texinfo on a region.) -@setchapternewpage odd - @include version.texi @copying @@ -14,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-2006 Free Software Foundation, Inc. +Copyright @copyright{} 1988--2009 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -22,15 +20,16 @@ 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,'' +Invariant Sections, with the Front-Cover texts being ``A GNU Manual'', and with the Back-Cover Texts as in (a) below. A copy of the license is -included in the section entitled ``GNU Free Documentation License.'' +included in the section entitled ``GNU Free Documentation License''. + +(a) The FSF's Back-Cover Text is: You are free to copy and modify +this GNU manual. Buying copies from GNU Press supports the FSF in +developing GNU and promoting software freedom.'' -(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify -this GNU Manual, like GNU software. Copies published by the Free -Software Foundation raise funds for GNU development.'' @end quotation @end copying @@ -72,7 +71,7 @@ typed input. @menu * Using History Interactively:: GNU History User's Manual. * Programming with GNU History:: GNU History Programmer's Manual. -* Copying This Manual:: Copying This Manual. +* GNU Free Documentation License:: License for copying this manual. * Concept Index:: Index of concepts described in this manual. * Function and Variable Index:: Index of externally visible functions and variables. @@ -84,12 +83,8 @@ typed input. @include hsuser.texi @include hstech.texi -@node Copying This Manual -@appendix Copying This Manual - -@menu -* GNU Free Documentation License:: License for copying this manual. -@end menu +@node GNU Free Documentation License +@appendix GNU Free Documentation License @include fdl.texi diff --git a/lib/readline/doc/hstech.texi b/lib/readline/doc/hstech.texi index 47ba8a5..c4e5a75 100644 --- a/lib/readline/doc/hstech.texi +++ b/lib/readline/doc/hstech.texi @@ -1,7 +1,7 @@ @ignore This file documents the user interface to the GNU History library. -Copyright (C) 1988-2006 Free Software Foundation, Inc. +Copyright (C) 1988-2007 Free Software Foundation, Inc. Authored by Brian Fox and Chet Ramey. Permission is granted to make and distribute verbatim copies of this manual diff --git a/lib/readline/doc/hsuser.texi b/lib/readline/doc/hsuser.texi index f98983b..87b3541 100644 --- a/lib/readline/doc/hsuser.texi +++ b/lib/readline/doc/hsuser.texi @@ -1,7 +1,7 @@ @ignore This file documents the user interface to the GNU History library. -Copyright (C) 1988-2006 Free Software Foundation, Inc. +Copyright (C) 1988-2007 Free Software Foundation, Inc. Authored by Brian Fox and Chet Ramey. Permission is granted to make and distribute verbatim copies of this manual @@ -97,7 +97,11 @@ to contain no more than @env{$HISTFILESIZE} lines. If @env{HISTFILESIZE} is not set, no truncation is performed. If the @env{HISTTIMEFORMAT} is set, the time stamp information -associated with each history entry is written to the history file. +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. The builtin command @code{fc} may be used to list or edit and re-execute a portion of the history list. @@ -133,7 +137,7 @@ history list and history file. @item fc @btindex fc @example -@code{fc [-e @var{ename}] [-nlr] [@var{first}] [@var{last}]} +@code{fc [-e @var{ename}] [-lnr] [@var{first}] [@var{last}]} @code{fc -s [@var{pat}=@var{rep}] [@var{command}]} @end example @@ -277,7 +281,10 @@ them, so that they are available for subsequent recall. This is most useful in conjunction with Readline. The shell allows control of the various characters used by the -history expansion mechanism with the @code{histchars} variable. +history expansion mechanism with the @code{histchars} variable, +as explained above (@pxref{Bash Variables}). The shell uses +the history comment character to mark history timestamps when +writing the history file. @end ifset @menu @@ -412,7 +419,7 @@ of the following modifiers, each preceded by a @samp{:}. Remove a trailing pathname component, leaving only the head. @item t -Remove all leading pathname components, leaving the tail. +Remove all leading pathname components, leaving the tail. @item r Remove a trailing suffix of the form @samp{.@var{suffix}}, leaving diff --git a/lib/readline/doc/rlman.texi b/lib/readline/doc/rlman.texi index e14c655..be24709 100644 --- a/lib/readline/doc/rlman.texi +++ b/lib/readline/doc/rlman.texi @@ -4,7 +4,6 @@ @settitle GNU Readline Library @comment %**end of header (This is for running Texinfo on a region.) @synindex vr fn -@setchapternewpage odd @include version.texi @@ -14,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-2006 Free Software Foundation, Inc. +Copyright @copyright{} 1988--2009 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -22,15 +21,16 @@ 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,'' +Invariant Sections, with the Front-Cover texts being ``A GNU Manual'', and with the Back-Cover Texts as in (a) below. A copy of the license is -included in the section entitled ``GNU Free Documentation License.'' +included in the section entitled ``GNU Free Documentation License''. + +(a) The FSF's Back-Cover Text is: You are free to copy and modify +this GNU manual. Buying copies from GNU Press supports the FSF in +developing GNU and promoting software freedom.'' -(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify -this GNU Manual, like GNU software. Copies published by the Free -Software Foundation raise funds for GNU development.'' @end quotation @end copying @@ -71,7 +71,7 @@ provide a command line interface. @menu * Command Line Editing:: GNU Readline User's Manual. * Programming with GNU Readline:: GNU Readline Programmer's Manual. -* Copying This Manual:: Copying this manual. +* GNU Free Documentation License:: License for copying this manual. * Concept Index:: Index of concepts described in this manual. * Function and Variable Index:: Index of externally visible functions and variables. @@ -81,12 +81,8 @@ provide a command line interface. @include rluser.texi @include rltech.texi -@node Copying This Manual -@appendix Copying This Manual - -@menu -* GNU Free Documentation License:: License for copying this manual. -@end menu +@node GNU Free Documentation License +@appendix GNU Free Documentation License @include fdl.texi diff --git a/lib/readline/doc/rltech.texi b/lib/readline/doc/rltech.texi index ecff106..04c8489 100644 --- a/lib/readline/doc/rltech.texi +++ b/lib/readline/doc/rltech.texi @@ -1,14 +1,13 @@ @comment %**start of header (This is for running Texinfo on a region.) @setfilename rltech.info @comment %**end of header (This is for running Texinfo on a region.) -@setchapternewpage odd @ifinfo This document describes the GNU Readline Library, a utility for aiding in the consistency of user interface across discrete programs that need to provide a command line interface. -Copyright (C) 1988-2006 Free Software Foundation, Inc. +Copyright (C) 1988-2007 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -351,6 +350,12 @@ The @code{rl_set_prompt()} function (@pxref{Redisplay}) may be used to modify the prompt string after calling @code{readline()}. @end deftypevar +@deftypevar {char *} rl_display_prompt +The string displayed as the prompt. This is usually identical to +@var{rl_prompt}, but may be changed temporarily by functions that +use the prompt string as a message area, such as incremental search. +@end deftypevar + @deftypevar int rl_already_prompted If an application wishes to display the prompt itself, rather than have Readline do it the first time @code{readline()} is called, it should set @@ -518,6 +523,20 @@ Readline is performing word completion. Readline is currently executing the readline signal handler. @item RL_STATE_UNDOING Readline is performing an undo. +@item RL_STATE_INPUTPENDING +Readline has input pending due to a call to @code{rl_execute_next()}. +@item RL_STATE_TTYCSAVED +Readline has saved the values of the terminal's special characters. +@item RL_STATE_CALLBACK +Readline is currently using the alternate (callback) interface +(@pxref{Alternate Interface}). +@item RL_STATE_VIMOTION +Readline is reading the argument to a vi-mode "motion" command. +@item RL_STATE_MULTIKEY +Readline is reading a multiple-keystroke command. +@item RL_STATE_VICMDONCE +Readline has entered vi command (movement) mode at least one time during +the current call to @code{readline()}. @item RL_STATE_DONE Readline has read a key sequence bound to @code{accept-line} and is about to return the line to the caller. @@ -603,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) @@ -617,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 @@ -793,7 +818,8 @@ Print the names of all bindable Readline functions to @code{rl_outstream}. @deftypefun {const char **} rl_funmap_names (void) Return a NULL terminated array of known function names. The array is sorted. The array itself is allocated, but not the strings inside. You -should @code{free()} the array when you are done, but not the pointers. +should free the array, but not the pointers, using @code{free} or +@code{rl_free} when you are done. @end deftypefun @deftypefun int rl_add_funmap_entry (const char *name, rl_command_func_t *function) @@ -1077,6 +1103,26 @@ environment variable is used. @node Utility Functions @subsection Utility Functions +@deftypefun int rl_save_state (struct readline_state *sp) +Save a snapshot of Readline's internal state to @var{sp}. +The contents of the @var{readline_state} structure are documented +in @file{readline.h}. +The caller is responsible for allocating the structure. +@end deftypefun + +@deftypefun int rl_restore_state (struct readline_state *sp) +Restore Readline's internal state to that stored in @var{sp}, which must +have been saved by a call to @code{rl_save_state}. +The contents of the @var{readline_state} structure are documented +in @file{readline.h}. +The caller is responsible for freeing the structure. +@end deftypefun + +@deftypefun void rl_free (void *mem) +Deallocate the memory pointed to by @var{mem}. @var{mem} must have been +allocated by @code{malloc}. +@end deftypefun + @deftypefun void rl_replace_line (const char *text, int clear_undo) Replace the contents of @code{rl_line_buffer} with @var{text}. The point and mark are preserved, if possible. @@ -1084,7 +1130,7 @@ If @var{clear_undo} is non-zero, the undo list associated with the current line is cleared. @end deftypefun -@deftypefun int rl_extend_line_buffer (int len) +@deftypefun void rl_extend_line_buffer (int len) Ensure that @code{rl_line_buffer} has enough space to hold @var{len} characters, possibly reallocating it if necessary. @end deftypefun @@ -1394,6 +1440,13 @@ call @code{rl_resize_terminal()} or @code{rl_set_screen_size()} to force Readline to update its idea of the terminal size when a @code{SIGWINCH} is received. +@deftypefun void rl_echo_signal_char (int sig) +If an application wishes to install its own signal handlers, but still +have readline display characters that generate signals, calling this +function with @var{sig} set to @code{SIGINT}, @code{SIGQUIT}, or +@code{SIGTSTP} will display the character generating that signal. +@end deftypefun + @deftypefun void rl_resize_terminal (void) Update Readline's internal screen size by reading values from the kernel. @end deftypefun @@ -1675,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. @@ -1827,6 +1909,15 @@ if the application's completion function returns no matches. It should be set only by an application's completion function. @end deftypevar +@deftypevar int rl_sort_completion_matches +If an application sets this variable to 0, Readline will not sort the +list of completions (which implies that it cannot remove any duplicate +completions). The default value is 1, which means that Readline will +sort the completions and, depending on the value of +@code{rl_ignore_completion_duplicates}, will attempt to remove duplicate +matches. +@end deftypevar + @deftypevar int rl_completion_type Set to a character describing the type of completion Readline is currently attempting; see the description of @code{rl_complete_internal()} @@ -1836,6 +1927,13 @@ completion function is called, allowing such functions to present the same interface as @code{rl_complete()}. @end deftypevar +@deftypevar int rl_completion_invoking_key +Set to the final character in the key sequence that invoked one of the +completion functions that call @code{rl_complete_internal()}. This is +set to the appropriate value before any application-specific completion +function is called. +@end deftypevar + @deftypevar int rl_inhibit_completion If this variable is non-zero, completion is inhibited. The completion character will be inserted as any other bound to @code{self-insert}. @@ -1856,27 +1954,51 @@ history list. GNU Readline library. This application interactively allows users to manipulate files and their modes. */ -#include <stdio.h> +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + #include <sys/types.h> -#include <sys/file.h> +#ifdef HAVE_SYS_FILE_H +# include <sys/file.h> +#endif #include <sys/stat.h> -#include <sys/errno.h> + +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif + +#include <fcntl.h> +#include <stdio.h> +#include <errno.h> + +#if defined (HAVE_STRING_H) +# include <string.h> +#else /* !HAVE_STRING_H */ +# include <strings.h> +#endif /* !HAVE_STRING_H */ + +#ifdef HAVE_STDLIB_H +# include <stdlib.h> +#endif + +#include <time.h> #include <readline/readline.h> #include <readline/history.h> -extern char *xmalloc (); +extern char *xmalloc PARAMS((size_t)); /* The names of functions that actually do the manipulation. */ -int com_list __P((char *)); -int com_view __P((char *)); -int com_rename __P((char *)); -int com_stat __P((char *)); -int com_pwd __P((char *)); -int com_delete __P((char *)); -int com_help __P((char *)); -int com_cd __P((char *)); -int com_quit __P((char *)); +int com_list PARAMS((char *)); +int com_view PARAMS((char *)); +int com_rename PARAMS((char *)); +int com_stat PARAMS((char *)); +int com_pwd PARAMS((char *)); +int com_delete PARAMS((char *)); +int com_help PARAMS((char *)); +int com_cd PARAMS((char *)); +int com_quit PARAMS((char *)); /* A structure which contains information on the commands this program can understand. */ @@ -1909,12 +2031,12 @@ COMMAND *find_command (); /* The name of this program, as taken from argv[0]. */ char *progname; -/* When non-zero, this means the user is done using this program. */ +/* When non-zero, this global means the user is done using this program. */ int done; char * dupstr (s) - int s; + char *s; @{ char *r; @@ -2039,12 +2161,12 @@ stripwhite (string) /* */ /* **************************************************************** */ -char *command_generator __P((const char *, int)); -char **fileman_completion __P((const char *, int, int)); +char *command_generator PARAMS((const char *, int)); +char **fileman_completion PARAMS((const char *, int, int)); -/* Tell the GNU Readline library how to complete. We want to try to - complete on command names if this is the first word in the line, or - on filenames if not. */ +/* Tell the GNU Readline library how to complete. We want to try to complete + on command names if this is the first word in the line, or on filenames + if not. */ initialize_readline () @{ /* Allow conditional parsing of the ~/.inputrc file. */ @@ -2054,11 +2176,11 @@ initialize_readline () rl_attempted_completion_function = fileman_completion; @} -/* Attempt to complete on the contents of TEXT. START and END - bound the region of rl_line_buffer that contains the word to - complete. TEXT is the word to complete. We can use the entire - contents of rl_line_buffer in case we want to do some simple - parsing. Returnthe array of matches, or NULL if there aren't any. */ +/* Attempt to complete on the contents of TEXT. START and END bound the + region of rl_line_buffer that contains the word to complete. TEXT is + the word to complete. We can use the entire contents of rl_line_buffer + in case we want to do some simple parsing. Return the array of matches, + or NULL if there aren't any. */ char ** fileman_completion (text, start, end) const char *text; @@ -2077,9 +2199,9 @@ fileman_completion (text, start, end) return (matches); @} -/* Generator function for command completion. STATE lets us - know whether to start from scratch; without any state - (i.e. STATE == 0), then we start at the top of the list. */ +/* Generator function for command completion. STATE lets us know whether + to start from scratch; without any state (i.e. STATE == 0), then we + start at the top of the list. */ char * command_generator (text, state) const char *text; @@ -2088,17 +2210,16 @@ command_generator (text, state) static int list_index, len; char *name; - /* If this is a new word to complete, initialize now. This - includes saving the length of TEXT for efficiency, and - initializing the index variable to 0. */ + /* If this is a new word to complete, initialize now. This includes + saving the length of TEXT for efficiency, and initializing the index + variable to 0. */ if (!state) @{ list_index = 0; len = strlen (text); @} - /* Return the next name which partially matches from the - command list. */ + /* Return the next name which partially matches from the command list. */ while (name = commands[list_index].name) @{ list_index++; @@ -2138,7 +2259,12 @@ com_view (arg) if (!valid_argument ("view", arg)) return 1; +#if defined (__MSDOS__) + /* more.com doesn't grok slashes in pathnames */ + sprintf (syscom, "less %s", arg); +#else sprintf (syscom, "more %s", arg); +#endif return (system (syscom)); @} @@ -2165,7 +2291,8 @@ com_stat (arg) printf ("Statistics for `%s':\n", arg); - printf ("%s has %d link%s, and is %d byte%s in length.\n", arg, + printf ("%s has %d link%s, and is %d byte%s in length.\n", + arg, finfo.st_nlink, (finfo.st_nlink == 1) ? "" : "s", finfo.st_size, @@ -2254,8 +2381,7 @@ com_pwd (ignore) return 0; @} -/* The user wishes to quit using this program. Just set DONE - non-zero. */ +/* The user wishes to quit using this program. Just set DONE non-zero. */ com_quit (arg) char *arg; @{ @@ -2268,13 +2394,12 @@ too_dangerous (caller) char *caller; @{ fprintf (stderr, - "%s: Too dangerous for me to distribute.\n", + "%s: Too dangerous for me to distribute. Write it yourself.\n", caller); - fprintf (stderr, "Write it yourself.\n"); @} -/* Return non-zero if ARG is a valid argument for CALLER, - else print an error message and return zero. */ +/* Return non-zero if ARG is a valid argument for CALLER, else print + an error message and return zero. */ int valid_argument (caller, arg) char *caller, *arg; diff --git a/lib/readline/doc/rluser.texi b/lib/readline/doc/rluser.texi index 5c6467a..519c0de 100644 --- a/lib/readline/doc/rluser.texi +++ b/lib/readline/doc/rluser.texi @@ -1,7 +1,6 @@ @comment %**start of header (This is for running Texinfo on a region.) @setfilename rluser.info @comment %**end of header (This is for running Texinfo on a region.) -@setchapternewpage odd @ignore This file documents the end user interface to the GNU command line @@ -10,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-2006 Free Software Foundation, Inc. +Copyright (C) 1988--2009 Free Software Foundation, Inc. Authored by Brian Fox and Chet Ramey. @@ -48,6 +47,16 @@ command line editing interface. @ifset BashFeatures Command line editing is provided by the Readline library, which is used by several different programs, including Bash. +Command line editing is enabled by default when using an interactive shell, +unless the @option{--noediting} option is supplied at shell invocation. +Line editing is also used when using the @option{-e} option to the +@code{read} builtin command (@pxref{Bash Builtins}). +By default, the line editing commands are similar to those of emacs. +A vi-style line editing interface is also available. +Line editing can be enabled at any time using the @option{-o emacs} or +@option{-o vi} options to the @code{set} builtin command +(@pxref{The Set Builtin}), or disabled using the @option{+o emacs} or +@option{+o vi} options to @code{set}. @end ifset @menu @@ -427,6 +436,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 @@ -458,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 @@ -471,10 +498,16 @@ attempts word completion. The default is @samp{off}. @item history-preserve-point @vindex history-preserve-point -If set to @samp{on}, the history code attempts to place point at the +If set to @samp{on}, the history code attempts to place the point (the +current cursor position) at the same location on each history line retrieved with @code{previous-history} or @code{next-history}. The default is @samp{off}. +@item history-size +@vindex history-size +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. + @item horizontal-scroll-mode @vindex horizontal-scroll-mode This variable can be set to either @samp{on} or @samp{off}. Setting it @@ -558,6 +591,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 @@ -577,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 @@ -941,12 +995,22 @@ Move forward a character. Move back a character. @item forward-word (M-f) -Move forward to the end of the next word. Words are composed of -letters and digits. +Move forward to the end of the next word. +Words are composed of letters and digits. @item backward-word (M-b) -Move back to the start of the current or previous word. Words are -composed of letters and digits. +Move back to the start of the current or previous word. +Words are composed of letters and digits. + +@ifset BashFeatures +@item shell-forward-word () +Move forward to the end of the next word. +Words are delimited by non-quoted shell metacharacters. + +@item shell-backward-word () +Move back to the start of the current or previous word. +Words are delimited by non-quoted shell metacharacters. +@end ifset @item clear-screen (C-l) Clear the screen and redraw the current line, @@ -1142,6 +1206,17 @@ Word boundaries are the same as @code{forward-word}. Kill the word behind point. Word boundaries are the same as @code{backward-word}. +@ifset BashFeatures +@item shell-kill-word () +Kill from point to the end of the current word, or if between +words, to the end of the next word. +Word boundaries are the same as @code{shell-forward-word}. + +@item backward-kill-word () +Kill the word behind point. +Word boundaries are the same as @code{shell-backward-word}. +@end ifset + @item unix-word-rubout (C-w) Kill the word behind point, using white space as a word boundary. The killed text is saved on the kill-ring. @@ -1242,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}). @@ -1297,6 +1377,11 @@ Attempt completion on the text before point, comparing the text against lines from the history list for possible completion matches. +@item dabbrev-expand () +Attempt menu completion on the text before point, comparing +the text against lines from the history list for possible +completion matches. + @item complete-into-braces (M-@{) Perform filename completion and insert the list of possible completions enclosed within braces so the list is available to the shell @@ -1376,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. @@ -1519,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. @@ -1559,9 +1658,9 @@ completed, and the matching words become the possible completions. After these matches have been generated, any shell function or command specified with the @option{-F} and @option{-C} options is invoked. -When the command or function is invoked, the @env{COMP_LINE} and -@env{COMP_POINT} variables are assigned values as described above -(@pxref{Bash Variables}). +When the command or function is invoked, the @env{COMP_LINE}, +@env{COMP_POINT}, @env{COMP_KEY}, and @env{COMP_TYPE} variables are +assigned values as described above (@pxref{Bash Variables}). If a shell function is being invoked, the @env{COMP_WORDS} and @env{COMP_CWORD} variables are also set. When the function or command is invoked, the first argument is the @@ -1574,7 +1673,7 @@ the matches. Any function specified with @option{-F} is invoked first. The function may use any of the shell facilities, including the -@code{compgen} builtin described below +@code{compgen} and @code{compopt} builtins described below (@pxref{Programmable Completion Builtins}), to generate the matches. It must put the possible completions in the @env{COMPREPLY} array variable. @@ -1626,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 @@ -1661,10 +1784,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}] -[-P @var{prefix}] [-S @var{suffix}] [-X @var{filterpat}] [-F @var{function}] -[-C @var{command}] @var{name} [@var{name} @dots{}]} -@code{complete -pr [@var{name} @dots{}]} +@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 [-DE] [@var{name} @dots{}]} @end example Specify how arguments to each @var{name} should be completed. @@ -1674,9 +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 @@ -1706,9 +1836,10 @@ Perform directory name completion if the compspec generates no matches. @item filenames Tell Readline that the compspec generates filenames, so it can perform any -filename-specific processing (like adding a slash to directory names or -suppressing trailing spaces). This option is intended to be used with -shell functions specified with @option{-F}. +filename-specific processing (like adding a slash to directory names +quoting special characters, or suppressing trailing spaces). +This option is intended to be used with shell functions specified +with @option{-F}. @item nospace Tell Readline not to append a space (the default) to words completed at @@ -1846,5 +1977,31 @@ 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. +@item compopt +@btindex compopt +@example +@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 +are supplied. +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 +specification exists, or an output error occurs. + @end table + @end ifset diff --git a/lib/readline/doc/rluserman.texi b/lib/readline/doc/rluserman.texi index 086aa83..49d9a2c 100644 --- a/lib/readline/doc/rluserman.texi +++ b/lib/readline/doc/rluserman.texi @@ -4,8 +4,6 @@ @settitle GNU Readline Library @comment %**end of header (This is for running Texinfo on a region.) -@setchapternewpage odd - @include version.texi @copying @@ -14,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-2006 Free Software Foundation, Inc. +Copyright @copyright{} 1988--2009 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -22,15 +20,16 @@ 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,'' +Invariant Sections, with the Front-Cover texts being ``A GNU Manual'', and with the Back-Cover Texts as in (a) below. A copy of the license is -included in the section entitled ``GNU Free Documentation License.'' +included in the section entitled ``GNU Free Documentation License''. + +(a) The FSF's Back-Cover Text is: You are free to copy and modify +this GNU manual. Buying copies from GNU Press supports the FSF in +developing GNU and promoting software freedom.'' -(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify -this GNU Manual, like GNU software. Copies published by the Free -Software Foundation raise funds for GNU development.'' @end quotation @end copying @@ -70,18 +69,14 @@ programs which provide a command line interface. @menu * Command Line Editing:: GNU Readline User's Manual. -* Copying This Manual:: Copying This Manual. +* GNU Free Documentation License:: License for copying this manual. @end menu @end ifnottex @include rluser.texi -@node Copying This Manual -@appendix Copying This Manual - -@menu -* GNU Free Documentation License:: License for copying this manual. -@end menu +@node GNU Free Documentation License +@appendix GNU Free Documentation License @include fdl.texi diff --git a/lib/readline/doc/version.texi b/lib/readline/doc/version.texi index 654e837..823b3ba 100644 --- a/lib/readline/doc/version.texi +++ b/lib/readline/doc/version.texi @@ -1,10 +1,10 @@ @ignore -Copyright (C) 1988-2006 Free Software Foundation, Inc. +Copyright (C) 1988-2009 Free Software Foundation, Inc. @end ignore -@set EDITION 5.2 -@set VERSION 5.2 -@set UPDATED 26 April 2006 -@set UPDATED-MONTH April 2006 +@set EDITION 6.1 +@set VERSION 6.1 +@set UPDATED 9 October 2009 +@set UPDATED-MONTH October 2009 -@set LASTCHANGE Wed Apr 26 09:22:57 EDT 2006 +@set LASTCHANGE Fri Oct 9 12:57:58 EDT 2009 |