diff options
Diffstat (limited to 'doc/readline.info')
-rw-r--r-- | doc/readline.info | 1498 |
1 files changed, 843 insertions, 655 deletions
diff --git a/doc/readline.info b/doc/readline.info index c07a0ca..7f2d0f3 100644 --- a/doc/readline.info +++ b/doc/readline.info @@ -1,9 +1,10 @@ -This is readline.info, produced by makeinfo version 4.5 from -/usr/homes/chet/src/bash/readline-src/doc/rlman.texi. +This is readline.info, produced by makeinfo version 4.7 from +/Users/chet/src/bash/readline-src/doc/rlman.texi. -This manual describes the GNU Readline Library (version 5.0, 28 January -2004), a library which aids in the consistency of user interface across -discrete programs which provide a command line interface. + This manual describes the GNU Readline Library (version 5.1-beta1, +11 November 2005), a library which aids in the consistency of user +interface across discrete programs which provide a command line +interface. Copyright (C) 1988-2004 Free Software Foundation, Inc. @@ -22,7 +23,7 @@ preserved on all copies. (a) The FSF's Back-Cover Text is: "You have freedom to copy and modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development." - + INFO-DIR-SECTION Libraries START-INFO-DIR-ENTRY * Readline: (readline). The GNU readline library API. @@ -34,8 +35,8 @@ File: readline.info, Node: Top, Next: Command Line Editing, Up: (dir) GNU Readline Library ******************** - This document describes the GNU Readline Library, a utility which -aids in the consistency of user interface across discrete programs which +This document describes the GNU Readline Library, a utility which aids +in the consistency of user interface across discrete programs which provide a command line interface. * Menu: @@ -50,10 +51,10 @@ provide a command line interface. File: readline.info, Node: Command Line Editing, Next: Programming with GNU Readline, Prev: Top, Up: Top -Command Line Editing -******************** +1 Command Line Editing +********************** - This chapter describes the basic features of the GNU command line +This chapter describes the basic features of the GNU command line editing interface. * Menu: @@ -69,10 +70,10 @@ editing interface. File: readline.info, Node: Introduction and Notation, Next: Readline Interaction, Up: Command Line Editing -Introduction to Line Editing -============================ +1.1 Introduction to Line Editing +================================ - The following paragraphs describe the notation used to represent +The following paragraphs describe the notation used to represent keystrokes. The text `C-k' is read as `Control-K' and describes the character @@ -105,10 +106,10 @@ some keyboards. File: readline.info, Node: Readline Interaction, Next: Readline Init File, Prev: Introduction and Notation, Up: Command Line Editing -Readline Interaction -==================== +1.2 Readline Interaction +======================== - Often during an interactive session you type in a long line of text, +Often during an interactive session you type in a long line of text, only to notice that the first word on the line is misspelled. The Readline library gives you a set of commands for manipulating the text as you type it in, allowing you to just fix your typo, and not forcing @@ -130,13 +131,13 @@ location of the cursor within the line. File: readline.info, Node: Readline Bare Essentials, Next: Readline Movement Commands, Up: Readline Interaction -Readline Bare Essentials ------------------------- +1.2.1 Readline Bare Essentials +------------------------------ - In order to enter characters into the line, simply type them. The -typed character appears where the cursor was, and then the cursor moves -one space to the right. If you mistype a character, you can use your -erase character to back up and delete the mistyped character. +In order to enter characters into the line, simply type them. The typed +character appears where the cursor was, and then the cursor moves one +space to the right. If you mistype a character, you can use your erase +character to back up and delete the mistyped character. Sometimes you may mistype a character, and not notice the error until you have typed several other characters. In that case, you can @@ -178,10 +179,10 @@ character to the left of the cursor.) File: readline.info, Node: Readline Movement Commands, Next: Readline Killing Commands, Prev: Readline Bare Essentials, Up: Readline Interaction -Readline Movement Commands --------------------------- +1.2.2 Readline Movement Commands +-------------------------------- - The above table describes the most basic keystrokes that you need in +The above table describes the most basic keystrokes that you need in order to do editing of the input line. For your convenience, many other commands have been added in addition to `C-b', `C-f', `C-d', and <DEL>. Here are some commands for moving more rapidly about the line. @@ -209,11 +210,11 @@ operate on characters while meta keystrokes operate on words. File: readline.info, Node: Readline Killing Commands, Next: Readline Arguments, Prev: Readline Movement Commands, Up: Readline Interaction -Readline Killing Commands -------------------------- +1.2.3 Readline Killing Commands +------------------------------- - "Killing" text means to delete the text from the line, but to save -it away for later use, usually by "yanking" (re-inserting) it back into +"Killing" text means to delete the text from the line, but to save it +away for later use, usually by "yanking" (re-inserting) it back into the line. (`Cut' and `paste' are more recent jargon for `kill' and `yank'.) @@ -225,7 +226,7 @@ place later. Any number of consecutive kills save all of the killed text together, so that when you yank it back, you get it all. The kill ring is not line specific; the text that you killed on a previously typed line is -available to be yanked back later, when you are typing another line. +available to be yanked back later, when you are typing another line. Here is the list of commands for killing text. @@ -262,10 +263,10 @@ copy the most-recently-killed text from the kill buffer. File: readline.info, Node: Readline Arguments, Next: Searching, Prev: Readline Killing Commands, Up: Readline Interaction -Readline Arguments ------------------- +1.2.4 Readline Arguments +------------------------ - You can pass numeric arguments to Readline commands. Sometimes the +You can pass numeric arguments to Readline commands. Sometimes the argument acts as a repeat count, other times it is the sign of the argument that is significant. If you pass a negative argument to a command which normally acts in a forward direction, that command will @@ -283,10 +284,10 @@ will delete the next ten characters on the input line. File: readline.info, Node: Searching, Prev: Readline Arguments, Up: Readline Interaction -Searching for Commands in the History -------------------------------------- +1.2.5 Searching for Commands in the History +------------------------------------------- - Readline provides commands for searching through the command history +Readline provides commands for searching through the command history for lines containing a specified string. There are two search modes: "incremental" and "non-incremental". @@ -324,10 +325,10 @@ typed by the user or be part of the contents of the current line. File: readline.info, Node: Readline Init File, Next: Bindable Readline Commands, Prev: Readline Interaction, Up: Command Line Editing -Readline Init File -================== +1.3 Readline Init File +====================== - Although the Readline library comes with a set of Emacs-like +Although the Readline library comes with a set of Emacs-like keybindings installed by default, it is possible to use a different set of keybindings. Any user can customize programs that use Readline by putting commands in an "inputrc" file, conventionally in his home @@ -352,10 +353,10 @@ incorporating any changes that you might have made to it. File: readline.info, Node: Readline Init File Syntax, Next: Conditional Init Constructs, Up: Readline Init File -Readline Init File Syntax -------------------------- +1.3.1 Readline Init File Syntax +------------------------------- - There are only a few basic constructs allowed in the Readline init +There are only a few basic constructs allowed in the Readline init file. Blank lines are ignored. Lines beginning with a `#' are comments. Lines beginning with a `$' indicate conditional constructs (*note Conditional Init Constructs::). Other lines denote variable @@ -374,7 +375,11 @@ Variable Settings set editing-mode vi Variable names and values, where appropriate, are recognized - without regard to case. + without regard to case. Unrecognized variable names are ignored. + + Boolean variables (those that can be set to on or off) are set to + on if the value is null or empty, ON (case-insensitive), or 1. + Any other value results in the variable being set to off. A great deal of run-time behavior is changeable with the following variables. @@ -386,6 +391,11 @@ Variable Settings one is available. If set to `audible' (the default), Readline attempts to ring the terminal's bell. + `bind-tty-special-chars' + If set to `on', Readline attempts to bind the control + characters treated specially by the kernel's terminal driver + to their Readline equivalents. + `comment-begin' The string to insert at the beginning of the line when the `insert-comment' command is executed. The default value is @@ -403,7 +413,8 @@ Variable Settings than this value, Readline will ask the user whether or not he wishes to view them; otherwise, they are simply listed. This variable must be set to an integer value greater than or - equal to 0. The default limit is `100'. + equal to 0. A negative value means Readline should never ask. + The default limit is `100'. `convert-meta' If set to `on', Readline will convert characters with the @@ -431,9 +442,10 @@ Variable Settings If set to `on', tilde expansion is performed when Readline attempts word completion. The default is `off'. + `history-preserve-point' If set to `on', the history code attempts to place point at the same location on each history line retrieved with - `previous-history' or `next-history'. + `previous-history' or `next-history'. The default is `off'. `horizontal-scroll-mode' This variable can be set to either `on' or `off'. Setting it @@ -642,10 +654,10 @@ Key Bindings File: readline.info, Node: Conditional Init Constructs, Next: Sample Init File, Prev: Readline Init File Syntax, Up: Readline Init File -Conditional Init Constructs ---------------------------- +1.3.2 Conditional Init Constructs +--------------------------------- - Readline implements a facility similar in spirit to the conditional +Readline implements a facility similar in spirit to the conditional compilation features of the C preprocessor which allows key bindings and variable settings to be performed as the result of tests. There are four parser directives used. @@ -702,11 +714,11 @@ are four parser directives used. File: readline.info, Node: Sample Init File, Prev: Conditional Init Constructs, Up: Readline Init File -Sample Init File ----------------- +1.3.3 Sample Init File +---------------------- - Here is an example of an INPUTRC file. This illustrates key -binding, variable assignment, and conditional syntax. +Here is an example of an INPUTRC file. This illustrates key binding, +variable assignment, and conditional syntax. # This file controls the behaviour of line input editing for @@ -719,16 +731,16 @@ binding, variable assignment, and conditional syntax. # First, include any systemwide bindings and variable # assignments from /etc/Inputrc $include /etc/Inputrc - + # # Set various bindings for emacs mode. - + set editing-mode emacs - + $if mode=emacs - + Meta-Control-h: backward-kill-word Text after the function name is ignored - + # # Arrow keys in keypad mode # @@ -757,14 +769,14 @@ binding, variable assignment, and conditional syntax. #"\M-\C-[C": forward-char #"\M-\C-[A": previous-history #"\M-\C-[B": next-history - + C-q: quoted-insert - + $endif - + # An old-style binding. This happens to be the default. TAB: complete - + # Macros that are convenient for shell interaction $if Bash # edit the path @@ -783,25 +795,25 @@ binding, variable assignment, and conditional syntax. # Edit variable on current line. "\M-\C-v": "\C-a\C-k$\C-y\M-\C-e\C-a\C-y=" $endif - + # use a visible bell if one is available set bell-style visible - + # don't strip characters to 7 bits when reading set input-meta on - + # allow iso-latin1 characters to be inserted rather # than converted to prefix-meta sequences set convert-meta off - + # display characters with the eighth bit set directly # rather than as meta-prefixed characters set output-meta on - + # if there are more than 150 possible completions for # a word, ask the user if he wants to see all of them set completion-query-items 150 - + # For FTP $if Ftp "\C-xg": "get \M-?" @@ -812,8 +824,8 @@ binding, variable assignment, and conditional syntax. File: readline.info, Node: Bindable Readline Commands, Next: Readline vi Mode, Prev: Readline Init File, Up: Command Line Editing -Bindable Readline Commands -========================== +1.4 Bindable Readline Commands +============================== * Menu: @@ -838,8 +850,8 @@ as the "region". File: readline.info, Node: Commands For Moving, Next: Commands For History, Up: Bindable Readline Commands -Commands For Moving -------------------- +1.4.1 Commands For Moving +------------------------- `beginning-of-line (C-a)' Move to the start of the current line. @@ -872,8 +884,8 @@ Commands For Moving File: readline.info, Node: Commands For History, Next: Commands For Text, Prev: Commands For Moving, Up: Bindable Readline Commands -Commands For Manipulating The History -------------------------------------- +1.4.2 Commands For Manipulating The History +------------------------------------------- `accept-line (Newline or Return)' Accept the line regardless of where the cursor is. If this line is @@ -929,21 +941,24 @@ Commands For Manipulating The History second word on the previous line) at point. With an argument N, insert the Nth word from the previous command (the words in the previous command begin with word 0). A negative argument inserts - the Nth word from the end of the previous command. + the Nth word from the end of the previous command. Once the + argument N is computed, the argument is extracted as if the `!N' + history expansion had been specified. `yank-last-arg (M-. or M-_)' Insert last argument to the previous command (the last word of the previous history entry). With an argument, behave exactly like `yank-nth-arg'. Successive calls to `yank-last-arg' move back through the history list, inserting the last argument of each line - in turn. + in turn. The history expansion facilities are used to extract the + last argument, as if the `!$' history expansion had been specified. File: readline.info, Node: Commands For Text, Next: Commands For Killing, Prev: Commands For History, Up: Bindable Readline Commands -Commands For Changing Text --------------------------- +1.4.3 Commands For Changing Text +-------------------------------- `delete-char (C-d)' Delete the character at point. If point is at the beginning of @@ -1010,8 +1025,8 @@ Commands For Changing Text File: readline.info, Node: Commands For Killing, Next: Numeric Arguments, Prev: Commands For Text, Up: Bindable Readline Commands -Killing And Yanking -------------------- +1.4.4 Killing And Yanking +------------------------- `kill-line (C-k)' Kill the text from point to the end of the line. @@ -1076,8 +1091,8 @@ Killing And Yanking File: readline.info, Node: Numeric Arguments, Next: Commands For Completion, Prev: Commands For Killing, Up: Bindable Readline Commands -Specifying Numeric Arguments ----------------------------- +1.4.5 Specifying Numeric Arguments +---------------------------------- `digit-argument (M-0, M-1, ... M--)' Add this digit to the argument already accumulating, or start a new @@ -1099,8 +1114,8 @@ Specifying Numeric Arguments File: readline.info, Node: Commands For Completion, Next: Keyboard Macros, Prev: Numeric Arguments, Up: Bindable Readline Commands -Letting Readline Type For You ------------------------------ +1.4.6 Letting Readline Type For You +----------------------------------- `complete (<TAB>)' Attempt to perform completion on the text before point. The @@ -1136,8 +1151,8 @@ Letting Readline Type For You File: readline.info, Node: Keyboard Macros, Next: Miscellaneous Commands, Prev: Commands For Completion, Up: Bindable Readline Commands -Keyboard Macros ---------------- +1.4.7 Keyboard Macros +--------------------- `start-kbd-macro (C-x ()' Begin saving the characters typed into the current keyboard macro. @@ -1154,8 +1169,8 @@ Keyboard Macros File: readline.info, Node: Miscellaneous Commands, Prev: Keyboard Macros, Up: Bindable Readline Commands -Some Miscellaneous Commands ---------------------------- +1.4.8 Some Miscellaneous Commands +--------------------------------- `re-read-init-file (C-x C-r)' Read in the contents of the INPUTRC file, and incorporate any @@ -1242,10 +1257,10 @@ Some Miscellaneous Commands File: readline.info, Node: Readline vi Mode, Prev: Bindable Readline Commands, Up: Command Line Editing -Readline vi Mode -================ +1.5 Readline vi Mode +==================== - While the Readline library does not have a full set of `vi' editing +While the Readline library does not have a full set of `vi' editing functions, it does contain enough to allow simple editing of the line. The Readline `vi' mode behaves as specified in the POSIX 1003.2 standard. @@ -1262,10 +1277,10 @@ the standard `vi' movement keys, move to previous history lines with `k' and subsequent lines with `j', and so forth. This document describes the GNU Readline Library, a utility for -aiding in the consitency of user interface across discrete programs +aiding in the consistency of user interface across discrete programs that need to provide a command line interface. - Copyright (C) 1988-2004 Free Software Foundation, Inc. + Copyright (C) 1988-2005 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice pare @@ -1284,14 +1299,14 @@ translation approved by the Foundation. File: readline.info, Node: Programming with GNU Readline, Next: Copying This Manual, Prev: Command Line Editing, Up: Top -Programming with GNU Readline -***************************** +2 Programming with GNU Readline +******************************* - This chapter describes the interface between the GNU Readline -Library and other programs. If you are a programmer, and you wish to -include the features found in GNU Readline such as completion, line -editing, and interactive history manipulation in your own programs, -this section is for you. +This chapter describes the interface between the GNU Readline Library +and other programs. If you are a programmer, and you wish to include +the features found in GNU Readline such as completion, line editing, +and interactive history manipulation in your own programs, this section +is for you. * Menu: @@ -1309,14 +1324,14 @@ this section is for you. File: readline.info, Node: Basic Behavior, Next: Custom Functions, Up: Programming with GNU Readline -Basic Behavior -============== +2.1 Basic Behavior +================== - Many programs provide a command line interface, such as `mail', -`ftp', and `sh'. For such programs, the default behaviour of Readline -is sufficient. This section describes how to use Readline in the -simplest way possible, perhaps to replace calls in your code to -`gets()' or `fgets()'. +Many programs provide a command line interface, such as `mail', `ftp', +and `sh'. For such programs, the default behaviour of Readline is +sufficient. This section describes how to use Readline in the simplest +way possible, perhaps to replace calls in your code to `gets()' or +`fgets()'. The function `readline()' prints a prompt PROMPT and then reads and returns a single line of text from the user. If PROMPT is `NULL' or @@ -1328,9 +1343,8 @@ it has finished with it. The declaration for `readline' in ANSI C is So, one might say `char *line = readline ("Enter a line: ");' - -in order to read a line of text from the user. The line returned has -the final newline removed, so only the text remains. + in order to read a line of text from the user. The line returned +has the final newline removed, so only the text remains. If `readline' encounters an `EOF' while reading the line, and the line is empty at that point, then `(char *)NULL' is returned. @@ -1351,7 +1365,7 @@ function, and has the advantage of no static buffer to overflow: /* A static variable for holding the line. */ static char *line_read = (char *)NULL; - + /* Read a string, and return a pointer to it. Returns NULL on EOF. */ char * @@ -1364,15 +1378,15 @@ function, and has the advantage of no static buffer to overflow: free (line_read); line_read = (char *)NULL; } - + /* Get a line from the user. */ line_read = readline (""); - + /* If the line has any text in it, save it on the history. */ if (line_read && *line_read) add_history (line_read); - + return (line_read); } @@ -1400,14 +1414,14 @@ completers (*note Custom Completers::). File: readline.info, Node: Custom Functions, Next: Readline Variables, Prev: Basic Behavior, Up: Programming with GNU Readline -Custom Functions -================ +2.2 Custom Functions +==================== - Readline provides many functions for manipulating the text of the -line, but it isn't possible to anticipate the needs of all programs. -This section describes the various functions and variables defined -within the Readline library which allow a user program to add -customized functionality to Readline. +Readline provides many functions for manipulating the text of the line, +but it isn't possible to anticipate the needs of all programs. This +section describes the various functions and variables defined within +the Readline library which allow a user program to add customized +functionality to Readline. Before declaring any functions that customize Readline's behavior, or using any functionality Readline provides in other code, an application @@ -1433,10 +1447,10 @@ number. For Readline 4.2, for example, the value of File: readline.info, Node: Readline Typedefs, Next: Function Writing, Up: Custom Functions -Readline Typedefs ------------------ +2.2.1 Readline Typedefs +----------------------- - For readabilty, we declare a number of new object types, all pointers +For readabilty, we declare a number of new object types, all pointers to functions. The reason for declaring these new types is to make it easier to @@ -1499,10 +1513,10 @@ we may write File: readline.info, Node: Function Writing, Prev: Readline Typedefs, Up: Custom Functions -Writing a New Function ----------------------- +2.2.2 Writing a New Function +---------------------------- - In order to write new functions for Readline, you need to know the +In order to write new functions for Readline, you need to know the calling conventions for keyboard-invoked functions, and the names of the variables that describe the current state of the line read so far. @@ -1523,67 +1537,69 @@ negative and positive arguments. At the very least, it should be aware that it can be passed a negative argument. A command function should return 0 if its action completes -successfully, and a non-zero value if some error occurs. +successfully, and a non-zero value if some error occurs. This is the +convention obeyed by all of the builtin Readline bindable command +functions. File: readline.info, Node: Readline Variables, Next: Readline Convenience Functions, Prev: Custom Functions, Up: Programming with GNU Readline -Readline Variables -================== +2.3 Readline Variables +====================== - These variables are available to function writers. +These variables are available to function writers. - - Variable: char * rl_line_buffer + -- Variable: char * rl_line_buffer This is the line gathered so far. You are welcome to modify the contents of the line, but see *Note Allowing Undoing::. The function `rl_extend_line_buffer' is available to increase the memory allocated to `rl_line_buffer'. - - Variable: int rl_point + -- Variable: int rl_point The offset of the current cursor position in `rl_line_buffer' (the _point_). - - Variable: int rl_end + -- Variable: int rl_end The number of characters present in `rl_line_buffer'. When `rl_point' is at the end of the line, `rl_point' and `rl_end' are equal. - - Variable: int rl_mark + -- Variable: int rl_mark The MARK (saved position) in the current line. If set, the mark and point define a _region_. - - Variable: int rl_done + -- Variable: int rl_done Setting this to a non-zero value causes Readline to return the current line immediately. - - Variable: int rl_num_chars_to_read + -- Variable: int rl_num_chars_to_read Setting this to a positive value before calling `readline()' causes Readline to return after accepting that many characters, rather than reading up to a character bound to `accept-line'. - - Variable: int rl_pending_input + -- Variable: int rl_pending_input Setting this to a value makes it the next keystroke read. This is a way to stuff a single character into the input stream. - - Variable: int rl_dispatching + -- Variable: int rl_dispatching Set to a non-zero value if a function is being called from a key binding; zero otherwise. Application functions can test this to discover whether they were called directly or by Readline's dispatching mechanism. - - Variable: int rl_erase_empty_line + -- Variable: int rl_erase_empty_line Setting this to a non-zero value causes Readline to completely erase the current line, including any prompt, any time a newline is typed as the only character on an otherwise-empty line. The cursor is moved to the beginning of the newly-blank line. - - Variable: char * rl_prompt + -- Variable: char * rl_prompt The prompt Readline uses. This is set from the argument to `readline()', and should not be assigned to directly. The `rl_set_prompt()' function (*note Redisplay::) may be used to modify the prompt string after calling `readline()'. - - Variable: int rl_already_prompted + -- Variable: int rl_already_prompted If an application wishes to display the prompt itself, rather than have Readline do it the first time `readline()' is called, it should set this variable to a non-zero value after displaying the @@ -1592,95 +1608,100 @@ Readline Variables properly. The calling application is responsible for managing the value; Readline never sets it. - - Variable: const char * rl_library_version + -- Variable: const char * rl_library_version The version number of this revision of the library. - - Variable: int rl_readline_version + -- Variable: int rl_readline_version An integer encoding the current version of the library. The encoding is of the form 0xMMMM, where MM is the two-digit major version number, and MM is the two-digit minor version number. For example, for Readline-4.2, `rl_readline_version' would have the value 0x0402. - - Variable: int rl_gnu_readline_p + -- Variable: int rl_gnu_readline_p Always set to 1, denoting that this is GNU readline rather than some emulation. - - Variable: const char * rl_terminal_name + -- Variable: const char * rl_terminal_name The terminal type, used for initialization. If not set by the application, Readline sets this to the value of the `TERM' environment variable the first time it is called. - - Variable: const char * rl_readline_name + -- Variable: const char * rl_readline_name This variable is set to a unique name by each application using Readline. The value allows conditional parsing of the inputrc file (*note Conditional Init Constructs::). - - Variable: FILE * rl_instream + -- Variable: FILE * rl_instream The stdio stream from which Readline reads input. If `NULL', Readline defaults to STDIN. - - Variable: FILE * rl_outstream + -- Variable: FILE * rl_outstream The stdio stream to which Readline performs output. If `NULL', Readline defaults to STDOUT. - - Variable: rl_command_func_t * rl_last_func + -- Variable: int rl_prefer_env_winsize + If non-zero, Readline gives values found in the `LINES' and + `COLUMNS' environment variables greater precedence than values + fetched from the kernel when computing the screen dimensions. + + -- Variable: rl_command_func_t * rl_last_func The address of the last command function Readline executed. May be used to test whether or not a function is being executed twice in succession, for example. - - Variable: rl_hook_func_t * rl_startup_hook + -- Variable: rl_hook_func_t * rl_startup_hook If non-zero, this is the address of a function to call just before `readline' prints the first prompt. - - Variable: rl_hook_func_t * rl_pre_input_hook + -- Variable: rl_hook_func_t * rl_pre_input_hook If non-zero, this is the address of a function to call after the first prompt has been printed and just before `readline' starts reading input characters. - - Variable: rl_hook_func_t * rl_event_hook + -- Variable: rl_hook_func_t * rl_event_hook If non-zero, this is the address of a function to call periodically when Readline is waiting for terminal input. By default, this will be called at most ten times a second if there is no keyboard input. - - Variable: rl_getc_func_t * rl_getc_function + -- Variable: rl_getc_func_t * rl_getc_function If non-zero, Readline will call indirectly through this pointer to get a character from the input stream. By default, it is set to `rl_getc', the default Readline character input function (*note Character Input::). - - Variable: rl_voidfunc_t * rl_redisplay_function + -- Variable: rl_voidfunc_t * rl_redisplay_function If non-zero, Readline will call indirectly through this pointer to update the display with the current contents of the editing buffer. By default, it is set to `rl_redisplay', the default Readline redisplay function (*note Redisplay::). - - Variable: rl_vintfunc_t * rl_prep_term_function + -- Variable: rl_vintfunc_t * rl_prep_term_function If non-zero, Readline will call indirectly through this pointer to initialize the terminal. The function takes a single argument, an `int' flag that says whether or not to use eight-bit characters. By default, this is set to `rl_prep_terminal' (*note Terminal Management::). - - Variable: rl_voidfunc_t * rl_deprep_term_function + -- Variable: rl_voidfunc_t * rl_deprep_term_function If non-zero, Readline will call indirectly through this pointer to reset the terminal. This function should undo the effects of `rl_prep_term_function'. By default, this is set to `rl_deprep_terminal' (*note Terminal Management::). - - Variable: Keymap rl_executing_keymap + -- Variable: Keymap rl_executing_keymap This variable is set to the keymap (*note Keymaps::) in which the currently executing readline function was found. - - Variable: Keymap rl_binding_keymap + -- Variable: Keymap rl_binding_keymap This variable is set to the keymap (*note Keymaps::) in which the last key binding occurred. - - Variable: char * rl_executing_macro + -- Variable: char * rl_executing_macro This variable is set to the text of any currently-executing macro. - - Variable: int rl_readline_state + -- Variable: int rl_readline_state A variable with bit values that encapsulate the current Readline state. A bit is set with the `RL_SETSTATE' macro, and unset with the `RL_UNSETSTATE' macro. Use the `RL_ISSTATE' macro to test @@ -1752,16 +1773,16 @@ Readline Variables is about to return the line to the caller. - - Variable: int rl_explicit_arg + -- Variable: int rl_explicit_arg Set to a non-zero value if an explicit numeric argument was specified by the user. Only valid in a bindable command function. - - Variable: int rl_numeric_arg + -- Variable: int rl_numeric_arg Set to the value of any numeric argument explicitly specified by the user before executing the current Readline function. Only valid in a bindable command function. - - Variable: int rl_editing_mode + -- Variable: int rl_editing_mode Set to a value denoting Readline's current editing mode. A value of 1 means Readline is currently in emacs mode; 0 means that vi mode is active. @@ -1769,8 +1790,8 @@ Readline Variables File: readline.info, Node: Readline Convenience Functions, Next: Readline Signal Handling, Prev: Readline Variables, Up: Programming with GNU Readline -Readline Convenience Functions -============================== +2.4 Readline Convenience Functions +================================== * Menu: @@ -1792,10 +1813,10 @@ Readline Convenience Functions File: readline.info, Node: Function Naming, Next: Keymaps, Up: Readline Convenience Functions -Naming a Function ------------------ +2.4.1 Naming a Function +----------------------- - The user can dynamically change the bindings of keys while using +The user can dynamically change the bindings of keys while using Readline. This is done by representing the function with a descriptive name. The user is able to type the descriptive name when referring to the function. Thus, in an init file, one might find @@ -1807,7 +1828,7 @@ _descriptively_ named `backward-kill-word'. You, as the programmer, should bind the functions you write to descriptive names as well. Readline provides a function for doing that: - - Function: int rl_add_defun (const char *name, rl_command_func_t + -- Function: int rl_add_defun (const char *name, rl_command_func_t *function, int key) Add NAME to the list of named functions. Make FUNCTION be the function that gets called. If KEY is not -1, then bind it to @@ -1822,46 +1843,46 @@ functions described below. File: readline.info, Node: Keymaps, Next: Binding Keys, Prev: Function Naming, Up: Readline Convenience Functions -Selecting a Keymap ------------------- +2.4.2 Selecting a Keymap +------------------------ - Key bindings take place on a "keymap". The keymap is the -association between the keys that the user types and the functions that -get run. You can make your own keymaps, copy existing keymaps, and tell -Readline which keymap to use. +Key bindings take place on a "keymap". The keymap is the association +between the keys that the user types and the functions that get run. +You can make your own keymaps, copy existing keymaps, and tell Readline +which keymap to use. - - Function: Keymap rl_make_bare_keymap (void) + -- Function: Keymap rl_make_bare_keymap (void) Returns a new, empty keymap. The space for the keymap is allocated with `malloc()'; the caller should free it by calling `rl_discard_keymap()' when done. - - Function: Keymap rl_copy_keymap (Keymap map) + -- Function: Keymap rl_copy_keymap (Keymap map) Return a new keymap which is a copy of MAP. - - Function: Keymap rl_make_keymap (void) + -- Function: Keymap rl_make_keymap (void) Return a new keymap with the printing characters bound to rl_insert, the lowercase Meta characters bound to run their equivalents, and the Meta digits bound to produce numeric arguments. - - Function: void rl_discard_keymap (Keymap keymap) + -- Function: void rl_discard_keymap (Keymap keymap) Free the storage associated with KEYMAP. Readline has several internal keymaps. These functions allow you to change which keymap is active. - - Function: Keymap rl_get_keymap (void) + -- Function: Keymap rl_get_keymap (void) Returns the currently active keymap. - - Function: void rl_set_keymap (Keymap keymap) + -- Function: void rl_set_keymap (Keymap keymap) Makes KEYMAP the currently active keymap. - - Function: Keymap rl_get_keymap_by_name (const char *name) + -- Function: Keymap rl_get_keymap_by_name (const char *name) Return the keymap matching NAME. NAME is one which would be supplied in a `set keymap' inputrc line (*note Readline Init File::). - - Function: char * rl_get_keymap_name (Keymap keymap) + -- Function: char * rl_get_keymap_name (Keymap keymap) Return the name matching KEYMAP. NAME is one which would be supplied in a `set keymap' inputrc line (*note Readline Init File::). @@ -1869,10 +1890,10 @@ change which keymap is active. File: readline.info, Node: Binding Keys, Next: Associating Function Names and Bindings, Prev: Keymaps, Up: Readline Convenience Functions -Binding Keys ------------- +2.4.3 Binding Keys +------------------ - Key sequences are associate with functions through the keymap. +Key sequences are associate with functions through the keymap. Readline has several internal keymaps: `emacs_standard_keymap', `emacs_meta_keymap', `emacs_ctlx_keymap', `vi_movement_keymap', and `vi_insertion_keymap'. `emacs_standard_keymap' is the default, and the @@ -1887,73 +1908,73 @@ initialization function assigned to the `rl_startup_hook' variable These functions manage key bindings. - - Function: int rl_bind_key (int key, rl_command_func_t *function) + -- Function: int rl_bind_key (int key, rl_command_func_t *function) Binds KEY to FUNCTION in the currently active keymap. Returns non-zero in the case of an invalid KEY. - - Function: int rl_bind_key_in_map (int key, rl_command_func_t + -- Function: int rl_bind_key_in_map (int key, rl_command_func_t *function, Keymap map) Bind KEY to FUNCTION in MAP. Returns non-zero in the case of an invalid KEY. - - Function: int rl_bind_key_if_unbound (int key, rl_command_func_t + -- Function: int rl_bind_key_if_unbound (int key, rl_command_func_t *function) Binds KEY to FUNCTION if it is not already bound in the currently active keymap. Returns non-zero in the case of an invalid KEY or if KEY is already bound. - - Function: int rl_bind_key_if_unbound_in_map (int key, + -- Function: int rl_bind_key_if_unbound_in_map (int key, rl_command_func_t *function, Keymap map) Binds KEY to FUNCTION if it is not already bound in MAP. Returns non-zero in the case of an invalid KEY or if KEY is already bound. - - Function: int rl_unbind_key (int key) + -- Function: int rl_unbind_key (int key) Bind KEY to the null function in the currently active keymap. Returns non-zero in case of error. - - Function: int rl_unbind_key_in_map (int key, Keymap map) + -- Function: int rl_unbind_key_in_map (int key, Keymap map) Bind KEY to the null function in MAP. Returns non-zero in case of error. - - Function: int rl_unbind_function_in_map (rl_command_func_t + -- Function: int rl_unbind_function_in_map (rl_command_func_t *function, Keymap map) Unbind all keys that execute FUNCTION in MAP. - - Function: int rl_unbind_command_in_map (const char *command, Keymap + -- Function: int rl_unbind_command_in_map (const char *command, Keymap map) Unbind all keys that are bound to COMMAND in MAP. - - Function: int rl_bind_keyseq (const char *keyseq, rl_command_func_t + -- Function: int rl_bind_keyseq (const char *keyseq, rl_command_func_t *function) Bind the key sequence represented by the string KEYSEQ to the function FUNCTION, beginning in the current keymap. This makes new keymaps as necessary. The return value is non-zero if KEYSEQ is invalid. - - Function: int rl_bind_keyseq_in_map (const char *keyseq, + -- Function: int rl_bind_keyseq_in_map (const char *keyseq, rl_command_func_t *function, Keymap map) Bind the key sequence represented by the string KEYSEQ to the function FUNCTION. This makes new keymaps as necessary. Initial bindings are performed in MAP. The return value is non-zero if KEYSEQ is invalid. - - Function: int rl_set_key (const char *keyseq, rl_command_func_t + -- Function: int rl_set_key (const char *keyseq, rl_command_func_t *function, Keymap map) Equivalent to `rl_bind_keyseq_in_map'. - - Function: int rl_bind_keyseq_if_unbound (const char *keyseq, + -- Function: int rl_bind_keyseq_if_unbound (const char *keyseq, rl_command_func_t *function) Binds KEYSEQ to FUNCTION if it is not already bound in the currently active keymap. Returns non-zero in the case of an invalid KEYSEQ or if KEYSEQ is already bound. - - Function: int rl_bind_keyseq_if_unbound_in_map (const char *keyseq, + -- Function: int rl_bind_keyseq_if_unbound_in_map (const char *keyseq, rl_command_func_t *function, Keymap map) Binds KEYSEQ to FUNCTION if it is not already bound in MAP. Returns non-zero in the case of an invalid KEYSEQ or if KEYSEQ is already bound. - - Function: int rl_generic_bind (int type, const char *keyseq, char + -- Function: int rl_generic_bind (int type, const char *keyseq, char *data, Keymap map) Bind the key sequence represented by the string KEYSEQ to the arbitrary pointer DATA. TYPE says what kind of data is pointed to @@ -1961,61 +1982,61 @@ initialization function assigned to the `rl_startup_hook' variable a keymap (`ISKMAP'). This makes new keymaps as necessary. The initial keymap in which to do bindings is MAP. - - Function: int rl_parse_and_bind (char *line) + -- Function: int rl_parse_and_bind (char *line) Parse LINE as if it had been read from the `inputrc' file and perform any key bindings and variable assignments found (*note Readline Init File::). - - Function: int rl_read_init_file (const char *filename) + -- Function: int rl_read_init_file (const char *filename) Read keybindings and variable assignments from FILENAME (*note Readline Init File::). File: readline.info, Node: Associating Function Names and Bindings, Next: Allowing Undoing, Prev: Binding Keys, Up: Readline Convenience Functions -Associating Function Names and Bindings ---------------------------------------- +2.4.4 Associating Function Names and Bindings +--------------------------------------------- - These functions allow you to find out what keys invoke named -functions and the functions invoked by a particular key sequence. You -may also associate a new function name with an arbitrary function. +These functions allow you to find out what keys invoke named functions +and the functions invoked by a particular key sequence. You may also +associate a new function name with an arbitrary function. - - Function: rl_command_func_t * rl_named_function (const char *name) + -- Function: rl_command_func_t * rl_named_function (const char *name) Return the function with name NAME. - - Function: rl_command_func_t * rl_function_of_keyseq (const char + -- Function: rl_command_func_t * rl_function_of_keyseq (const char *keyseq, Keymap map, int *type) Return the function invoked by KEYSEQ in keymap MAP. If MAP is `NULL', the current keymap is used. If TYPE is not `NULL', the type of the object is returned in the `int' variable it points to (one of `ISFUNC', `ISKMAP', or `ISMACR'). - - Function: char ** rl_invoking_keyseqs (rl_command_func_t *function) + -- Function: char ** rl_invoking_keyseqs (rl_command_func_t *function) Return an array of strings representing the key sequences used to invoke FUNCTION in the current keymap. - - Function: char ** rl_invoking_keyseqs_in_map (rl_command_func_t + -- Function: char ** rl_invoking_keyseqs_in_map (rl_command_func_t *function, Keymap map) Return an array of strings representing the key sequences used to invoke FUNCTION in the keymap MAP. - - Function: void rl_function_dumper (int readable) + -- Function: void rl_function_dumper (int readable) Print the readline function names and the key sequences currently bound to them to `rl_outstream'. If READABLE is non-zero, the list is formatted in such a way that it can be made part of an `inputrc' file and re-read. - - Function: void rl_list_funmap_names (void) + -- Function: void rl_list_funmap_names (void) Print the names of all bindable Readline functions to `rl_outstream'. - - Function: const char ** rl_funmap_names (void) + -- Function: 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 `free()' the array when you are done, but not the pointers. - - Function: int rl_add_funmap_entry (const char *name, + -- Function: int rl_add_funmap_entry (const char *name, rl_command_func_t *function) Add NAME to the list of bindable Readline command names, and make FUNCTION the function to be called when NAME is invoked. @@ -2023,10 +2044,10 @@ may also associate a new function name with an arbitrary function. File: readline.info, Node: Allowing Undoing, Next: Redisplay, Prev: Associating Function Names and Bindings, Up: Readline Convenience Functions -Allowing Undoing ----------------- +2.4.5 Allowing Undoing +---------------------- - Supporting the undo command is a painless thing, and makes your +Supporting the undo command is a painless thing, and makes your functions much more useful. It is certainly easy to try something if you know you can undo it. @@ -2048,26 +2069,26 @@ one operation. This is done with `rl_begin_undo_group()' and what to undo, not how to undo it. `UNDO_BEGIN' and `UNDO_END' are tags added by `rl_begin_undo_group()' and `rl_end_undo_group()'. - - Function: int rl_begin_undo_group (void) + -- Function: int rl_begin_undo_group (void) Begins saving undo information in a group construct. The undo information usually comes from calls to `rl_insert_text()' and `rl_delete_text()', but could be the result of calls to `rl_add_undo()'. - - Function: int rl_end_undo_group (void) + -- Function: int rl_end_undo_group (void) Closes the current undo group started with `rl_begin_undo_group ()'. There should be one call to `rl_end_undo_group()' for each call to `rl_begin_undo_group()'. - - Function: void rl_add_undo (enum undo_code what, int start, int end, - char *text) + -- Function: void rl_add_undo (enum undo_code what, int start, int + end, char *text) Remember how to undo an event (according to WHAT). The affected text runs from START to END, and encompasses TEXT. - - Function: void rl_free_undo_list (void) + -- Function: void rl_free_undo_list (void) Free the existing undo list. - - Function: int rl_do_undo (void) + -- Function: int rl_do_undo (void) Undo the first thing on the undo list. Returns `0' if there was nothing to undo, non-zero if something was undone. @@ -2076,7 +2097,7 @@ the existing text (e.g., change its case), call `rl_modifying()' once, just before you modify the text. You must supply the indices of the text range that you are going to modify. - - Function: int rl_modifying (int start, int end) + -- Function: int rl_modifying (int start, int end) Tell Readline to save the text between START and END as a single undo unit. It is assumed that you will subsequently modify that text. @@ -2084,61 +2105,67 @@ text range that you are going to modify. File: readline.info, Node: Redisplay, Next: Modifying Text, Prev: Allowing Undoing, Up: Readline Convenience Functions -Redisplay ---------- +2.4.6 Redisplay +--------------- - - Function: void rl_redisplay (void) + -- Function: void rl_redisplay (void) Change what's displayed on the screen to reflect the current contents of `rl_line_buffer'. - - Function: int rl_forced_update_display (void) + -- Function: int rl_forced_update_display (void) Force the line to be updated and redisplayed, whether or not Readline thinks the screen display is correct. - - Function: int rl_on_new_line (void) + -- Function: int rl_on_new_line (void) Tell the update functions that we have moved onto a new (empty) line, usually after ouputting a newline. - - Function: int rl_on_new_line_with_prompt (void) + -- Function: int rl_on_new_line_with_prompt (void) Tell the update functions that we have moved onto a new line, with RL_PROMPT already displayed. This could be used by applications that want to output the prompt string themselves, but still need Readline to know the prompt string length for redisplay. It should be used after setting RL_ALREADY_PROMPTED. - - Function: int rl_reset_line_state (void) + -- Function: int rl_reset_line_state (void) Reset the display state to a clean state and redisplay the current line starting on a new line. - - Function: int rl_crlf (void) + -- Function: int rl_crlf (void) Move the cursor to the start of the next screen line. - - Function: int rl_show_char (int c) + -- Function: int rl_show_char (int c) Display character C on `rl_outstream'. If Readline has not been set to display meta characters directly, this will convert meta characters to a meta-prefixed key sequence. This is intended for use by applications which wish to do their own redisplay. - - Function: int rl_message (const char *, ...) + -- Function: int rl_message (const char *, ...) The arguments are a format string as would be supplied to `printf', possibly containing conversion specifications such as `%d', and any additional arguments necessary to satisfy the conversion specifications. The resulting string is displayed in the "echo area". The echo area is also used to display numeric arguments - and search strings. + and search strings. You should call `rl_save_prompt' to save the + prompt information before calling this function. - - Function: int rl_clear_message (void) - Clear the message in the echo area. + -- Function: int rl_clear_message (void) + Clear the message in the echo area. If the prompt was saved with + a call to `rl_save_prompt' before the last call to `rl_message', + call `rl_restore_prompt' before calling this function. - - Function: void rl_save_prompt (void) + -- Function: void rl_save_prompt (void) Save the local Readline prompt display state in preparation for displaying a new message in the message area with `rl_message()'. - - Function: void rl_restore_prompt (void) + -- Function: void rl_restore_prompt (void) Restore the local Readline prompt display state saved by the most - recent call to `rl_save_prompt'. + recent call to `rl_save_prompt'. if `rl_save_prompt' was called + to save the prompt before a call to `rl_message', this function + should be called before the corresponding call to + `rl_clear_message'. - - Function: int rl_expand_prompt (char *prompt) + -- Function: int rl_expand_prompt (char *prompt) Expand any special character sequences in PROMPT and set up the local Readline prompt redisplay variables. This function is called by `readline()'. It may also be called to expand the @@ -2152,7 +2179,7 @@ Redisplay `readline.h'. This may be used to embed terminal-specific escape sequences in prompts. - - Function: int rl_set_prompt (const char *prompt) + -- Function: int rl_set_prompt (const char *prompt) Make Readline use PROMPT for subsequent redisplay. This calls `rl_expand_prompt()' to expand the prompt and sets `rl_prompt' to the result. @@ -2160,29 +2187,29 @@ Redisplay File: readline.info, Node: Modifying Text, Next: Character Input, Prev: Redisplay, Up: Readline Convenience Functions -Modifying Text --------------- +2.4.7 Modifying Text +-------------------- - - Function: int rl_insert_text (const char *text) + -- Function: int rl_insert_text (const char *text) Insert TEXT into the line at the current cursor position. Returns the number of characters inserted. - - Function: int rl_delete_text (int start, int end) + -- Function: int rl_delete_text (int start, int end) Delete the text between START and END in the current line. Returns the number of characters deleted. - - Function: char * rl_copy_text (int start, int end) + -- Function: char * rl_copy_text (int start, int end) Return a copy of the text between START and END in the current line. - - Function: int rl_kill_text (int start, int end) + -- Function: int rl_kill_text (int start, int end) Copy the text between START and END in the current line to the kill ring, appending or prepending to the last kill if the last command was a kill command. The text is deleted. If START is less than END, the text is appended, otherwise prepended. If the last command was not a kill, a new kill ring slot is used. - - Function: int rl_push_macro_input (char *macro) + -- Function: int rl_push_macro_input (char *macro) Cause MACRO to be inserted into the line, as if it had been invoked by a key bound to a macro. Not especially useful; use `rl_insert_text()' instead. @@ -2190,10 +2217,10 @@ Modifying Text File: readline.info, Node: Character Input, Next: Terminal Management, Prev: Modifying Text, Up: Readline Convenience Functions -Character Input ---------------- +2.4.8 Character Input +--------------------- - - Function: int rl_read_key (void) + -- Function: int rl_read_key (void) Return the next character available from Readline's current input stream. This handles input inserted into the input stream via RL_PENDING_INPUT (*note Readline Variables::) and @@ -2201,27 +2228,27 @@ Character Input While waiting for input, this function will call any function assigned to the `rl_event_hook' variable. - - Function: int rl_getc (FILE *stream) + -- Function: int rl_getc (FILE *stream) Return the next character available from STREAM, which is assumed to be the keyboard. - - Function: int rl_stuff_char (int c) + -- Function: int rl_stuff_char (int c) Insert C into the Readline input stream. It will be "read" before Readline attempts to read characters from the terminal with `rl_read_key()'. Up to 512 characters may be pushed back. `rl_stuff_char' returns 1 if the character was successfully inserted; 0 otherwise. - - Function: int rl_execute_next (int c) + -- Function: int rl_execute_next (int c) Make C be the next command to be executed when `rl_read_key()' is called. This sets RL_PENDING_INPUT. - - Function: int rl_clear_pending_input (void) + -- Function: int rl_clear_pending_input (void) Unset RL_PENDING_INPUT, effectively negating the effect of any previous call to `rl_execute_next()'. This works only if the pending input has not already been read with `rl_read_key()'. - - Function: int rl_set_keyboard_input_timeout (int u) + -- Function: int rl_set_keyboard_input_timeout (int u) While waiting for keyboard input in `rl_read_key()', Readline will wait for U microseconds for input before calling any function assigned to `rl_event_hook'. The default waiting period is @@ -2230,31 +2257,31 @@ Character Input File: readline.info, Node: Terminal Management, Next: Utility Functions, Prev: Character Input, Up: Readline Convenience Functions -Terminal Management -------------------- +2.4.9 Terminal Management +------------------------- - - Function: void rl_prep_terminal (int meta_flag) + -- Function: void rl_prep_terminal (int meta_flag) Modify the terminal settings for Readline's use, so `readline()' can read a single character at a time from the keyboard. The META_FLAG argument should be non-zero if Readline should read eight-bit input. - - Function: void rl_deprep_terminal (void) + -- Function: void rl_deprep_terminal (void) Undo the effects of `rl_prep_terminal()', leaving the terminal in the state in which it was before the most recent call to `rl_prep_terminal()'. - - Function: void rl_tty_set_default_bindings (Keymap kmap) + -- Function: void rl_tty_set_default_bindings (Keymap kmap) Read the operating system's terminal editing characters (as would be displayed by `stty') to their Readline equivalents. The bindings are performed in KMAP. - - Function: void rl_tty_unset_default_bindings (Keymap kmap) + -- Function: void rl_tty_unset_default_bindings (Keymap kmap) Reset the bindings manipulated by `rl_tty_set_default_bindings' so that the terminal editing characters are bound to `rl_insert'. The bindings are performed in KMAP. - - Function: int rl_reset_terminal (const char *terminal_name) + -- Function: int rl_reset_terminal (const char *terminal_name) Reinitialize Readline's idea of the terminal settings using TERMINAL_NAME as the terminal type (e.g., `vt100'). If TERMINAL_NAME is `NULL', the value of the `TERM' environment @@ -2263,30 +2290,30 @@ Terminal Management File: readline.info, Node: Utility Functions, Next: Miscellaneous Functions, Prev: Terminal Management, Up: Readline Convenience Functions -Utility Functions ------------------ +2.4.10 Utility Functions +------------------------ - - Function: void rl_replace_line (const char *text, int clear_undo) + -- Function: void rl_replace_line (const char *text, int clear_undo) Replace the contents of `rl_line_buffer' with TEXT. The point and mark are preserved, if possible. If CLEAR_UNDO is non-zero, the undo list associated with the current line is cleared. - - Function: int rl_extend_line_buffer (int len) + -- Function: int rl_extend_line_buffer (int len) Ensure that `rl_line_buffer' has enough space to hold LEN characters, possibly reallocating it if necessary. - - Function: int rl_initialize (void) + -- Function: int rl_initialize (void) Initialize or re-initialize Readline's internal state. It's not strictly necessary to call this; `readline()' calls it before reading any input. - - Function: int rl_ding (void) + -- Function: int rl_ding (void) Ring the terminal bell, obeying the setting of `bell-style'. - - Function: int rl_alphabetic (int c) + -- Function: int rl_alphabetic (int c) Return 1 if C is an alphabetic character. - - Function: void rl_display_match_list (char **matches, int len, int + -- Function: void rl_display_match_list (char **matches, int len, int max) A convenience function for displaying a list of strings in columnar format on Readline's output stream. `matches' is the list @@ -2299,63 +2326,68 @@ Utility Functions The following are implemented as macros, defined in `chardefs.h'. Applications should refrain from using them. - - Function: int _rl_uppercase_p (int c) + -- Function: int _rl_uppercase_p (int c) Return 1 if C is an uppercase alphabetic character. - - Function: int _rl_lowercase_p (int c) + -- Function: int _rl_lowercase_p (int c) Return 1 if C is a lowercase alphabetic character. - - Function: int _rl_digit_p (int c) + -- Function: int _rl_digit_p (int c) Return 1 if C is a numeric character. - - Function: int _rl_to_upper (int c) + -- Function: int _rl_to_upper (int c) If C is a lowercase alphabetic character, return the corresponding uppercase character. - - Function: int _rl_to_lower (int c) + -- Function: int _rl_to_lower (int c) If C is an uppercase alphabetic character, return the corresponding lowercase character. - - Function: int _rl_digit_value (int c) + -- Function: int _rl_digit_value (int c) If C is a number, return the value it represents. File: readline.info, Node: Miscellaneous Functions, Next: Alternate Interface, Prev: Utility Functions, Up: Readline Convenience Functions -Miscellaneous Functions ------------------------ +2.4.11 Miscellaneous Functions +------------------------------ - - Function: int rl_macro_bind (const char *keyseq, const char *macro, + -- Function: int rl_macro_bind (const char *keyseq, const char *macro, Keymap map) Bind the key sequence KEYSEQ to invoke the macro MACRO. The binding is performed in MAP. When KEYSEQ is invoked, the MACRO will be inserted into the line. This function is deprecated; use `rl_generic_bind()' instead. - - Function: void rl_macro_dumper (int readable) + -- Function: void rl_macro_dumper (int readable) Print the key sequences bound to macros and their values, using the current keymap, to `rl_outstream'. If READABLE is non-zero, the list is formatted in such a way that it can be made part of an `inputrc' file and re-read. - - Function: int rl_variable_bind (const char *variable, const char + -- Function: int rl_variable_bind (const char *variable, const char *value) Make the Readline variable VARIABLE have VALUE. This behaves as if the readline command `set VARIABLE VALUE' had been executed in an `inputrc' file (*note Readline Init File Syntax::). - - Function: void rl_variable_dumper (int readable) + -- Function: char * rl_variable_value (const char *variable) + Return a string representing the value of the Readline variable + VARIABLE. For boolean variables, this string is either `on' or + `off'. + + -- Function: void rl_variable_dumper (int readable) Print the readline variable names and their current values to `rl_outstream'. If READABLE is non-zero, the list is formatted in such a way that it can be made part of an `inputrc' file and re-read. - - Function: int rl_set_paren_blink_timeout (int u) + -- Function: int rl_set_paren_blink_timeout (int u) Set the time interval (in microseconds) that Readline waits when showing a balancing character when `blink-matching-paren' has been enabled. - - Function: char * rl_get_termcap (const char *cap) + -- Function: char * rl_get_termcap (const char *cap) Retrieve the string value of the termcap capability CAP. Readline fetches the termcap entry for the current terminal name and uses those capabilities to move around the screen line and perform other @@ -2366,24 +2398,24 @@ Miscellaneous Functions File: readline.info, Node: Alternate Interface, Next: A Readline Example, Prev: Miscellaneous Functions, Up: Readline Convenience Functions -Alternate Interface -------------------- +2.4.12 Alternate Interface +-------------------------- - An alternate interface is available to plain `readline()'. Some +An alternate interface is available to plain `readline()'. Some applications need to interleave keyboard I/O with file, device, or window system I/O, typically by using a main loop to `select()' on various file descriptors. To accomodate this need, readline can also be invoked as a `callback' function from an event loop. There are functions available to make this easy. - - Function: void rl_callback_handler_install (const char *prompt, + -- Function: void rl_callback_handler_install (const char *prompt, rl_vcpfunc_t *lhandler) Set up the terminal for readline I/O and display the initial expanded value of PROMPT. Save the value of LHANDLER to use as a function to call when a complete line of input has been entered. The function takes the text of the line as an argument. - - Function: void rl_callback_read_char (void) + -- Function: void rl_callback_read_char (void) Whenever an application determines that keyboard input is available, it should call `rl_callback_read_char()', which will read the next character from the current input source. If that @@ -2395,7 +2427,7 @@ functions available to make this easy. the terminal settings are modified for Readline's use again. `EOF' is indicated by calling LHANDLER with a `NULL' line. - - Function: void rl_callback_handler_remove (void) + -- Function: void rl_callback_handler_remove (void) Restore the terminal to its initial state and remove the line handler. This may be called from within a callback as well as independently. If the LHANDLER installed by @@ -2407,14 +2439,14 @@ functions available to make this easy. File: readline.info, Node: A Readline Example, Prev: Alternate Interface, Up: Readline Convenience Functions -A Readline Example ------------------- +2.4.13 A Readline Example +------------------------- - Here is a function which changes lowercase characters to their -uppercase equivalents, and uppercase characters to lowercase. If this -function was bound to `M-c', then typing `M-c' would change the case of -the character under point. Typing `M-1 0 M-c' would change the case of -the following 10 characters, leaving the cursor on the last character +Here is a function which changes lowercase characters to their uppercase +equivalents, and uppercase characters to lowercase. If this function +was bound to `M-c', then typing `M-c' would change the case of the +character under point. Typing `M-1 0 M-c' would change the case of the +following 10 characters, leaving the cursor on the last character changed. /* Invert the case of the COUNT following characters. */ @@ -2423,12 +2455,12 @@ changed. int count, key; { register int start, end, i; - + start = rl_point; - + if (rl_point >= rl_end) return (0); - + if (count < 0) { direction = -1; @@ -2436,30 +2468,30 @@ changed. } else direction = 1; - + /* Find the end of the range to modify. */ end = start + (count * direction); - + /* Force it to be within range. */ if (end > rl_end) end = rl_end; else if (end < 0) end = 0; - + if (start == end) return (0); - + if (start > end) { int temp = start; start = end; end = temp; } - + /* Tell readline that we are modifying the line, so it will save the undo information. */ rl_modifying (start, end); - + for (i = start; i != end; i++) { if (_rl_uppercase_p (rl_line_buffer[i])) @@ -2475,10 +2507,10 @@ changed. File: readline.info, Node: Readline Signal Handling, Next: Custom Completers, Prev: Readline Convenience Functions, Up: Programming with GNU Readline -Readline Signal Handling -======================== +2.5 Readline Signal Handling +============================ - Signals are asynchronous events sent to a process by the Unix kernel, +Signals are asynchronous events sent to a process by the Unix kernel, sometimes on behalf of another process. They are intended to indicate exceptional events, like a user pressing the interrupt key on his terminal, or a network connection being broken. There is a class of @@ -2519,14 +2551,14 @@ when they are received. It is important that applications change the values of these variables only when calling `readline()', not in a signal handler, so Readline's internal signal state is not corrupted. - - Variable: int rl_catch_signals + -- Variable: int rl_catch_signals If this variable is non-zero, Readline will install signal handlers for `SIGINT', `SIGQUIT', `SIGTERM', `SIGALRM', `SIGTSTP', `SIGTTIN', and `SIGTTOU'. The default value of `rl_catch_signals' is 1. - - Variable: int rl_catch_sigwinch + -- Variable: int rl_catch_sigwinch If this variable is non-zero, Readline will install a signal handler for `SIGWINCH'. @@ -2537,13 +2569,13 @@ or to handle signals other than those Readline catches (`SIGHUP', for example), Readline provides convenience functions to do the necessary terminal and internal state cleanup upon receipt of a signal. - - Function: void rl_cleanup_after_signal (void) + -- Function: void rl_cleanup_after_signal (void) This function will reset the state of the terminal to what it was before `readline()' was called, and remove the Readline signal handlers for all signals, depending on the values of `rl_catch_signals' and `rl_catch_sigwinch'. - - Function: void rl_free_line_state (void) + -- Function: void rl_free_line_state (void) This will free any partial state associated with the current input line (undo information, any partial history entry, any partially-entered keyboard macro, and any partially-entered @@ -2551,7 +2583,7 @@ terminal and internal state cleanup upon receipt of a signal. `rl_cleanup_after_signal()'. The Readline signal handler for `SIGINT' calls this to abort the current input line. - - Function: void rl_reset_after_signal (void) + -- Function: void rl_reset_after_signal (void) This will reinitialize the terminal and reinstall any Readline signal handlers, depending on the values of `rl_catch_signals' and `rl_catch_sigwinch'. @@ -2560,42 +2592,47 @@ terminal and internal state cleanup upon receipt of a signal. call `rl_resize_terminal()' or `rl_set_screen_size()' to force Readline to update its idea of the terminal size when a `SIGWINCH' is received. - - Function: void rl_resize_terminal (void) + -- Function: void rl_resize_terminal (void) Update Readline's internal screen size by reading values from the kernel. - - Function: void rl_set_screen_size (int rows, int cols) + -- Function: void rl_set_screen_size (int rows, int cols) Set Readline's idea of the terminal size to ROWS rows and COLS - columns. + columns. If either ROWS or COLUMNS is less than or equal to 0, + Readline's idea of that terminal dimension is unchanged. If an application does not want to install a `SIGWINCH' handler, but is still interested in the screen dimensions, Readline's idea of the screen size may be queried. - - Function: void rl_get_screen_size (int *rows, int *cols) + -- Function: void rl_get_screen_size (int *rows, int *cols) Return Readline's idea of the terminal's size in the variables pointed to by the arguments. + -- Function: void rl_reset_screen_size (void) + Cause Readline to reobtain the screen size and recalculate its + dimensions. + The following functions install and remove Readline's signal handlers. - - Function: int rl_set_signals (void) + -- Function: int rl_set_signals (void) Install Readline's signal handler for `SIGINT', `SIGQUIT', `SIGTERM', `SIGALRM', `SIGTSTP', `SIGTTIN', `SIGTTOU', and `SIGWINCH', depending on the values of `rl_catch_signals' and `rl_catch_sigwinch'. - - Function: int rl_clear_signals (void) + -- Function: int rl_clear_signals (void) Remove all of the Readline signal handlers installed by `rl_set_signals()'. File: readline.info, Node: Custom Completers, Prev: Readline Signal Handling, Up: Programming with GNU Readline -Custom Completers -================= +2.6 Custom Completers +===================== - Typically, a program that reads commands from the user has a way of +Typically, a program that reads commands from the user has a way of disambiguating commands and data. If your program is one of these, then it can provide completion for commands, data, or both. The following sections describe how your program and Readline cooperate to provide @@ -2611,10 +2648,10 @@ this service. File: readline.info, Node: How Completing Works, Next: Completion Functions, Up: Custom Completers -How Completing Works --------------------- +2.6.1 How Completing Works +-------------------------- - In order to complete some text, the full list of possible completions +In order to complete some text, the full list of possible completions must be available. That is, it is not possible to accurately expand a partial word without knowing all of the possible words which make sense in that context. The Readline library provides the user interface to @@ -2656,13 +2693,13 @@ functions must do, and provides an example. completion function". - - Function: int rl_complete (int ignore, int invoking_key) + -- Function: int rl_complete (int ignore, int invoking_key) Complete the word at or before point. You have supplied the function that does the initial simple matching selection algorithm (see `rl_completion_matches()'). The default is to do filename completion. - - Variable: rl_compentry_func_t * rl_completion_entry_function + -- Variable: rl_compentry_func_t * rl_completion_entry_function This is a pointer to the generator function for `rl_completion_matches()'. If the value of `rl_completion_entry_function' is `NULL' then the default filename @@ -2674,13 +2711,13 @@ functions must do, and provides an example. File: readline.info, Node: Completion Functions, Next: Completion Variables, Prev: How Completing Works, Up: Custom Completers -Completion Functions --------------------- +2.6.2 Completion Functions +-------------------------- - Here is the complete list of callable completion functions present in +Here is the complete list of callable completion functions present in Readline. - - Function: int rl_complete_internal (int what_to_do) + -- Function: int rl_complete_internal (int what_to_do) Complete the word at or before point. WHAT_TO_DO says what to do with the completion. A value of `?' means list the possible completions. `TAB' means do standard completion. `*' means @@ -2690,7 +2727,7 @@ Readline. possible completions are not listed if the possible completions share a common prefix. - - Function: int rl_complete (int ignore, int invoking_key) + -- Function: int rl_complete (int ignore, int invoking_key) Complete the word at or before point. You have supplied the function that does the initial simple matching selection algorithm (see `rl_completion_matches()' and `rl_completion_entry_function'). @@ -2698,23 +2735,23 @@ Readline. `rl_complete_internal()' with an argument depending on INVOKING_KEY. - - Function: int rl_possible_completions (int count, int invoking_key) + -- Function: int rl_possible_completions (int count, int invoking_key) List the possible completions. See description of `rl_complete ()'. This calls `rl_complete_internal()' with an argument of `?'. - - Function: int rl_insert_completions (int count, int invoking_key) + -- Function: int rl_insert_completions (int count, int invoking_key) Insert the list of possible completions into the line, deleting the partially-completed word. See description of `rl_complete()'. This calls `rl_complete_internal()' with an argument of `*'. - - Function: int rl_completion_mode (rl_command_func_t *cfunc) + -- Function: int rl_completion_mode (rl_command_func_t *cfunc) Returns the apppriate value to pass to `rl_complete_internal()' depending on whether CFUNC was called twice in succession and the values of the `show-all-if-ambiguous' and `show-all-if-unmodified' variables. Application-specific completion functions may use this function to present the same interface as `rl_complete()'. - - Function: char ** rl_completion_matches (const char *text, + -- Function: char ** rl_completion_matches (const char *text, rl_compentry_func_t *entry_func) Returns an array of strings which is a list of completions for TEXT. If there are no completions, returns `NULL'. The first @@ -2728,14 +2765,14 @@ Readline. ENTRY_FUNC returns a `NULL' pointer to the caller when there are no more matches. - - Function: char * rl_filename_completion_function (const char *text, + -- Function: char * rl_filename_completion_function (const char *text, int state) A generator function for filename completion in the general case. TEXT is a partial filename. The Bash source is a useful reference for writing application-specific completion functions (the Bash completion functions call this and other Readline functions). - - Function: char * rl_username_completion_function (const char *text, + -- Function: char * rl_username_completion_function (const char *text, int state) A completion generator for usernames. TEXT contains a partial username preceded by a random character (usually `~'). As with all @@ -2745,15 +2782,15 @@ Readline. File: readline.info, Node: Completion Variables, Next: A Short Completion Example, Prev: Completion Functions, Up: Custom Completers -Completion Variables --------------------- +2.6.3 Completion Variables +-------------------------- - - Variable: rl_compentry_func_t * rl_completion_entry_function + -- Variable: rl_compentry_func_t * rl_completion_entry_function A pointer to the generator function for `rl_completion_matches()'. `NULL' means to use `rl_filename_completion_function()', the default filename completer. - - Variable: rl_completion_func_t * rl_attempted_completion_function + -- Variable: rl_completion_func_t * rl_attempted_completion_function A pointer to an alternative function to create matches. The function is called with TEXT, START, and END. START and END are indices in `rl_line_buffer' defining the boundaries of TEXT, which @@ -2765,7 +2802,7 @@ Completion Variables a non-zero value, Readline will not perform its default completion even if this function returns no matches. - - Variable: rl_quote_func_t * rl_filename_quoting_function + -- Variable: rl_quote_func_t * rl_filename_quoting_function A pointer to a function that will quote a filename in an application-specific fashion. This is called if filename completion is being attempted and one of the characters in @@ -2778,7 +2815,7 @@ Completion Variables to any opening quote character the user typed. Some functions choose to reset this character. - - Variable: rl_dequote_func_t * rl_filename_dequoting_function + -- Variable: rl_dequote_func_t * rl_filename_dequoting_function A pointer to a function that will remove application-specific quoting characters from a filename before completion is attempted, so those characters do not interfere with matching the text @@ -2787,7 +2824,7 @@ Completion Variables character that delimits the filename (usually `'' or `"'). If QUOTE_CHAR is zero, the filename was not in an embedded string. - - Variable: rl_linebuf_func_t * rl_char_is_quoted_p + -- Variable: rl_linebuf_func_t * rl_char_is_quoted_p A pointer to a function to call that determines whether or not a specific character in the line buffer is quoted, according to whatever quoting mechanism the program calling Readline uses. The @@ -2797,7 +2834,7 @@ Completion Variables `rl_completer_word_break_characters' should be used to break words for the completer. - - Variable: rl_compignore_func_t * rl_ignore_some_completions_function + -- Variable: rl_compignore_func_t * rl_ignore_some_completions_function This function, if defined, is called by the completer when real filename completion is done, after all the matching names have been generated. It is passed a `NULL' terminated array of matches. @@ -2805,7 +2842,7 @@ Completion Variables to all matches. This function can re-arrange the list of matches as required, but each element deleted from the array must be freed. - - Variable: rl_icppfunc_t * rl_directory_completion_hook + -- Variable: rl_icppfunc_t * rl_directory_completion_hook This function, if defined, is allowed to modify the directory portion of filenames Readline completes. It is called with the address of a string (the current directory name) as an argument, @@ -2818,7 +2855,7 @@ Completion Variables argument. It could be used to expand symbolic links or shell variables in pathnames. - - Variable: rl_compdisp_func_t * rl_completion_display_matches_hook + -- Variable: rl_compdisp_func_t * rl_completion_display_matches_hook If non-zero, then this is the address of a function to call when completing a word would normally display the list of possible matches. This function is called in lieu of Readline displaying @@ -2831,21 +2868,21 @@ Completion Variables Readline's output stream. That function may be called from this hook. - - Variable: const char * rl_basic_word_break_characters + -- Variable: const char * rl_basic_word_break_characters The basic list of characters that signal a break between words for the completer routine. The default value of this variable is the characters which break words for completion in Bash: `" \t\n\"\\'`@$><=;|&{("'. - - Variable: const char * rl_basic_quote_characters + -- Variable: const char * rl_basic_quote_characters A list of quote characters which can cause a word break. - - Variable: const char * rl_completer_word_break_characters + -- Variable: const char * rl_completer_word_break_characters The list of characters that signal a break between words for `rl_complete_internal()'. The default list is the value of `rl_basic_word_break_characters'. - - Variable: rl_cpvfunc_t * rl_completion_word_break_hook + -- Variable: rl_cpvfunc_t * rl_completion_word_break_hook If non-zero, this is the address of a function to call when Readline is deciding where to separate words for word completion. It should return a character string like @@ -2854,30 +2891,31 @@ Completion Variables `rl_completer_word_break_characters' itself. If the function returns `NULL', `rl_completer_word_break_characters' is used. - - Variable: const char * rl_completer_quote_characters + -- Variable: const char * rl_completer_quote_characters A list of characters which can be used to quote a substring of the line. Completion occurs on the entire substring, and within the substring `rl_completer_word_break_characters' are treated as any other character, unless they also appear within this list. - - Variable: const char * rl_filename_quote_characters + -- Variable: const char * rl_filename_quote_characters A list of characters that cause a filename to be quoted by the completer when they appear in a completed filename. The default is the null string. - - Variable: const char * rl_special_prefixes + -- Variable: const char * rl_special_prefixes The list of characters that are word break characters, but should be left in TEXT when it is passed to the completion function. Programs can use this to help determine what kind of completing to do. For instance, Bash sets this variable to "$@" so that it can complete shell variables and hostnames. - - Variable: int rl_completion_query_items + -- Variable: int rl_completion_query_items Up to this many items will be displayed in response to a - possible-completions call. After that, we ask the user if she is - sure she wants to see them all. The default value is 100. + possible-completions call. After that, readline asks the user if + she is sure she wants to see them all. The default value is 100. + A negative value indicates that Readline should never ask the user. - - Variable: int rl_completion_append_character + -- Variable: int rl_completion_append_character When a single completion alternative matches at the end of the command line, this character is appended to the inserted completion text. The default is a space character (` '). Setting @@ -2887,32 +2925,32 @@ Completion Variables character" according to an application-specific command line syntax specification. - - Variable: int rl_completion_suppress_append + -- Variable: int rl_completion_suppress_append If non-zero, RL_COMPLETION_APPEND_CHARACTER is not appended to matches at the end of the command line, as described above. It is set to 0 before any application-specific completion function is called, and may only be changed within such a function. - - Variable: int rl_completion_quote_character + -- Variable: int rl_completion_quote_character When Readline is completing quoted text, as delimited by one of the characters in RL_COMPLETER_QUOTE_CHARACTERS, it sets this variable to the quoting character found. This is set before any application-specific completion function is called. - - Variable: int rl_completion_suppress_quote + -- Variable: int rl_completion_suppress_quote If non-zero, Readline does not append a matching quote character when performing completion on a quoted string. It is set to 0 before any application-specific completion function is called, and may only be changed within such a function. - - Variable: int rl_completion_found_quote + -- Variable: int rl_completion_found_quote When Readline is completing quoted text, it sets this variable to a non-zero value if the word being completed contains or is delimited by any quoting characters, including backslashes. This is set before any application-specific completion function is called. - - Variable: int rl_completion_mark_symlink_dirs + -- Variable: int rl_completion_mark_symlink_dirs If non-zero, a slash will be appended to completed filenames that are symbolic links to directory names, subject to the value of the user-settable MARK-DIRECTORIES variable. This variable exists so @@ -2923,11 +2961,11 @@ Completion Variables function is called, so unless that function modifies the value, the user's preferences are honored. - - Variable: int rl_ignore_completion_duplicates + -- Variable: int rl_ignore_completion_duplicates If non-zero, then duplicates in the matches are removed. The default is 1. - - Variable: int rl_filename_completion_desired + -- Variable: int rl_filename_completion_desired Non-zero means that the results of the matches are to be treated as filenames. This is _always_ zero when completion is attempted, and can only be changed within an application-specific completion @@ -2937,7 +2975,7 @@ Completion Variables `rl_filename_quote_characters' and `rl_filename_quoting_desired' is set to a non-zero value. - - Variable: int rl_filename_quoting_desired + -- Variable: int rl_filename_quoting_desired Non-zero means that the results of the matches are to be quoted using double quotes (or an application-specific quoting mechanism) if the completed filename contains any characters in @@ -2947,14 +2985,14 @@ Completion Variables via a call to the function pointed to by `rl_filename_quoting_function'. - - Variable: int rl_attempted_completion_over + -- Variable: int rl_attempted_completion_over If an application-specific completion function assigned to `rl_attempted_completion_function' sets this variable to a non-zero value, Readline will not perform its default filename completion even if the application's completion function returns no matches. It should be set only by an application's completion function. - - Variable: int rl_completion_type + -- Variable: int rl_completion_type Set to a character describing the type of completion Readline is currently attempting; see the description of `rl_complete_internal()' (*note Completion Functions::) for the @@ -2962,7 +3000,7 @@ Completion Variables any application-specific completion function is called, allowing such functions to present the same interface as `rl_complete()'. - - Variable: int rl_inhibit_completion + -- Variable: int rl_inhibit_completion If this variable is non-zero, completion is inhibited. The completion character will be inserted as any other bound to `self-insert'. @@ -2970,10 +3008,10 @@ Completion Variables File: readline.info, Node: A Short Completion Example, Prev: Completion Variables, Up: Custom Completers -A Short Completion Example --------------------------- +2.6.4 A Short Completion Example +-------------------------------- - Here is a small application demonstrating the use of the GNU Readline +Here is a small application demonstrating the use of the GNU Readline library. It is called `fileman', and the source code resides in `examples/fileman.c'. This sample application provides completion of command names, line editing features, and access to the history list. @@ -2981,18 +3019,18 @@ command names, line editing features, and access to the history list. /* fileman.c -- A tiny application which demonstrates how to use the GNU Readline library. This application interactively allows users to manipulate files and their modes. */ - + #include <stdio.h> #include <sys/types.h> #include <sys/file.h> #include <sys/stat.h> #include <sys/errno.h> - + #include <readline/readline.h> #include <readline/history.h> - + extern char *xmalloc (); - + /* The names of functions that actually do the manipulation. */ int com_list __P((char *)); int com_view __P((char *)); @@ -3003,16 +3041,16 @@ command names, line editing features, and access to the history list. int com_help __P((char *)); int com_cd __P((char *)); int com_quit __P((char *)); - + /* A structure which contains information on the commands this program can understand. */ - + typedef struct { char *name; /* User printable name of the function. */ rl_icpfunc_t *func; /* Function to call to do the job. */ char *doc; /* Documentation for this function. */ } COMMAND; - + COMMAND commands[] = { { "cd", com_cd, "Change to directory DIR" }, { "delete", com_delete, "Delete FILE" }, @@ -3027,62 +3065,62 @@ command names, line editing features, and access to the history list. { "view", com_view, "View the contents of FILE" }, { (char *)NULL, (rl_icpfunc_t *)NULL, (char *)NULL } }; - + /* Forward declarations. */ char *stripwhite (); COMMAND *find_command (); - + /* The name of this program, as taken from argv[0]. */ char *progname; - + /* When non-zero, this means the user is done using this program. */ int done; - + char * dupstr (s) int s; { char *r; - + r = xmalloc (strlen (s) + 1); strcpy (r, s); return (r); } - + main (argc, argv) int argc; char **argv; { char *line, *s; - + progname = argv[0]; - + initialize_readline (); /* Bind our completer. */ - + /* Loop reading and executing lines until the user quits. */ for ( ; done == 0; ) { line = readline ("FileMan: "); - + if (!line) break; - + /* Remove leading and trailing whitespace from the line. Then, if there is anything left, add it to the history list and execute it. */ s = stripwhite (line); - + if (*s) { add_history (s); execute_line (s); } - + free (line); } exit (0); } - + /* Execute a command line. */ int execute_line (line) @@ -3091,37 +3129,37 @@ command names, line editing features, and access to the history list. register int i; COMMAND *command; char *word; - + /* Isolate the command word. */ i = 0; while (line[i] && whitespace (line[i])) i++; word = line + i; - + while (line[i] && !whitespace (line[i])) i++; - + if (line[i]) line[i++] = '\0'; - + command = find_command (word); - + if (!command) { fprintf (stderr, "%s: No such command for FileMan.\n", word); return (-1); } - + /* Get argument to command, if any. */ while (whitespace (line[i])) i++; - + word = line + i; - + /* Call the function. */ return ((*(command->func)) (word)); } - + /* Look up NAME as the name of a command, and return a pointer to that command. Return a NULL pointer if NAME isn't a command name. */ COMMAND * @@ -3129,14 +3167,14 @@ command names, line editing features, and access to the history list. char *name; { register int i; - + for (i = 0; commands[i].name; i++) if (strcmp (name, commands[i].name) == 0) return (&commands[i]); - + return ((COMMAND *)NULL); } - + /* Strip whitespace from the start and end of STRING. Return a pointer into STRING. */ char * @@ -3144,30 +3182,30 @@ command names, line editing features, and access to the history list. char *string; { register char *s, *t; - + for (s = string; whitespace (*s); s++) ; - + if (*s == 0) return (s); - + t = s + strlen (s) - 1; while (t > s && whitespace (*t)) t--; *++t = '\0'; - + return s; } - + /* **************************************************************** */ /* */ /* Interface to Readline Completion */ /* */ /* **************************************************************** */ - + char *command_generator __P((const char *, int)); char **fileman_completion __P((const char *, int, int)); - + /* Tell the GNU Readline library how to complete. We want to try to complete on command names if this is the first word in the line, or on filenames if not. */ @@ -3175,11 +3213,11 @@ command names, line editing features, and access to the history list. { /* Allow conditional parsing of the ~/.inputrc file. */ rl_readline_name = "FileMan"; - + /* Tell the completer that we want a crack first. */ rl_attempted_completion_function = fileman_completion; } - + /* Attempt to complete on the contents of TEXT. START and END bound the region of rl_line_buffer that contains the word to complete. TEXT is the word to complete. We can use the entire @@ -3191,18 +3229,18 @@ command names, line editing features, and access to the history list. int start, end; { char **matches; - + matches = (char **)NULL; - + /* If this word is at the start of the line, then it is a command to complete. Otherwise it is the name of a file in the current directory. */ if (start == 0) matches = rl_completion_matches (text, command_generator); - + return (matches); } - + /* Generator function for command completion. STATE lets us know whether to start from scratch; without any state (i.e. STATE == 0), then we start at the top of the list. */ @@ -3213,7 +3251,7 @@ command names, line editing features, and access to the history list. { 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. */ @@ -3222,75 +3260,75 @@ command names, line editing features, and access to the history list. list_index = 0; len = strlen (text); } - + /* Return the next name which partially matches from the command list. */ while (name = commands[list_index].name) { list_index++; - + if (strncmp (name, text, len) == 0) return (dupstr(name)); } - + /* If no names matched, then return NULL. */ return ((char *)NULL); } - + /* **************************************************************** */ /* */ /* FileMan Commands */ /* */ /* **************************************************************** */ - + /* String to pass to system (). This is for the LIST, VIEW and RENAME commands. */ static char syscom[1024]; - + /* List the file(s) named in arg. */ com_list (arg) char *arg; { if (!arg) arg = ""; - + sprintf (syscom, "ls -FClg %s", arg); return (system (syscom)); } - + com_view (arg) char *arg; { if (!valid_argument ("view", arg)) return 1; - + sprintf (syscom, "more %s", arg); return (system (syscom)); } - + com_rename (arg) char *arg; { too_dangerous ("rename"); return (1); } - + com_stat (arg) char *arg; { struct stat finfo; - + if (!valid_argument ("stat", arg)) return (1); - + if (stat (arg, &finfo) == -1) { perror (arg); return (1); } - + printf ("Statistics for `%s':\n", arg); - + printf ("%s has %d link%s, and is %d byte%s in length.\n", arg, finfo.st_nlink, (finfo.st_nlink == 1) ? "" : "s", @@ -3301,14 +3339,14 @@ command names, line editing features, and access to the history list. printf (" Last modified at: %s", ctime (&finfo.st_mtime)); return (0); } - + com_delete (arg) char *arg; { too_dangerous ("delete"); return (1); } - + /* Print out help for ARG, or for all of the commands if ARG is not present. */ com_help (arg) @@ -3316,7 +3354,7 @@ command names, line editing features, and access to the history list. { register int i; int printed = 0; - + for (i = 0; commands[i].name; i++) { if (!*arg || (strcmp (arg, commands[i].name) == 0)) @@ -3325,11 +3363,11 @@ command names, line editing features, and access to the history list. printed++; } } - + if (!printed) { printf ("No commands match `%s'. Possibilties are:\n", arg); - + for (i = 0; commands[i].name; i++) { /* Print in six columns. */ @@ -3338,17 +3376,17 @@ command names, line editing features, and access to the history list. printed = 0; printf ("\n"); } - + printf ("%s\t", commands[i].name); printed++; } - + if (printed) printf ("\n"); } return (0); } - + /* Change to the directory ARG. */ com_cd (arg) char *arg; @@ -3358,28 +3396,28 @@ command names, line editing features, and access to the history list. perror (arg); return 1; } - + com_pwd (""); return (0); } - + /* Print out the current working directory. */ com_pwd (ignore) char *ignore; { char dir[1024], *s; - + s = getcwd (dir, sizeof(dir) - 1); if (s == 0) { printf ("Error getting pwd: %s\n", dir); return 1; } - + printf ("Current directory is %s\n", dir); return 0; } - + /* The user wishes to quit using this program. Just set DONE non-zero. */ com_quit (arg) @@ -3388,17 +3426,17 @@ command names, line editing features, and access to the history list. done = 1; return (0); } - + /* Function which tells you that you can't do this. */ too_dangerous (caller) char *caller; { fprintf (stderr, - "%s: Too dangerous for me to distribute.\n" + "%s: Too dangerous for me to distribute.\n", caller); fprintf (stderr, "Write it yourself.\n"); } - + /* Return non-zero if ARG is a valid argument for CALLER, else print an error message and return zero. */ int @@ -3410,15 +3448,15 @@ command names, line editing features, and access to the history list. fprintf (stderr, "%s: Argument required.\n", caller); return (0); } - + return (1); } File: readline.info, Node: Copying This Manual, Next: Concept Index, Prev: Programming with GNU Readline, Up: Top -Copying This Manual -******************* +Appendix A Copying This Manual +****************************** * Menu: @@ -3427,13 +3465,14 @@ Copying This Manual File: readline.info, Node: GNU Free Documentation License, Up: Copying This Manual -GNU Free Documentation License -============================== +A.1 GNU Free Documentation License +================================== Version 1.2, November 2002 + Copyright (C) 2000,2001,2002 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA - + Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -3824,10 +3863,10 @@ GNU Free Documentation License you may choose any version ever published (not as a draft) by the Free Software Foundation. -ADDENDUM: How to use this License for your documents ----------------------------------------------------- +A.1.1 ADDENDUM: How to use this License for your documents +---------------------------------------------------------- - To use this License in a document you have written, include a copy of +To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page: @@ -3861,20 +3900,30 @@ File: readline.info, Node: Concept Index, Next: Function and Variable Index, Concept Index ************* + * Menu: * application-specific completion functions: Custom Completers. + (line 6) * command editing: Readline Bare Essentials. + (line 6) * editing command lines: Readline Bare Essentials. + (line 6) * FDL, GNU Free Documentation License: GNU Free Documentation License. -* initialization file, readline: Readline Init File. -* interaction, readline: Readline Interaction. + (line 6) +* initialization file, readline: Readline Init File. (line 6) +* interaction, readline: Readline Interaction. (line 6) * kill ring: Readline Killing Commands. + (line 19) * killing text: Readline Killing Commands. + (line 6) * notation, readline: Readline Bare Essentials. -* readline, function: Basic Behavior. + (line 6) +* readline, function: Basic Behavior. (line 12) * variables, readline: Readline Init File Syntax. + (line 34) * yanking text: Readline Killing Commands. + (line 6) File: readline.info, Node: Function and Variable Index, Prev: Concept Index, Up: Top @@ -3882,328 +3931,467 @@ File: readline.info, Node: Function and Variable Index, Prev: Concept Index, Function and Variable Index *************************** + * Menu: -* _rl_digit_p: Utility Functions. -* _rl_digit_value: Utility Functions. -* _rl_lowercase_p: Utility Functions. -* _rl_to_lower: Utility Functions. -* _rl_to_upper: Utility Functions. -* _rl_uppercase_p: Utility Functions. +* _rl_digit_p: Utility Functions. (line 46) +* _rl_digit_value: Utility Functions. (line 57) +* _rl_lowercase_p: Utility Functions. (line 43) +* _rl_to_lower: Utility Functions. (line 53) +* _rl_to_upper: Utility Functions. (line 49) +* _rl_uppercase_p: Utility Functions. (line 40) * abort (C-g): Miscellaneous Commands. + (line 10) * accept-line (Newline or Return): Commands For History. -* backward-char (C-b): Commands For Moving. -* backward-delete-char (Rubout): Commands For Text. + (line 6) +* backward-char (C-b): Commands For Moving. (line 15) +* backward-delete-char (Rubout): Commands For Text. (line 11) * backward-kill-line (C-x Rubout): Commands For Killing. + (line 9) * backward-kill-word (M-<DEL>): Commands For Killing. -* backward-word (M-b): Commands For Moving. + (line 24) +* backward-word (M-b): Commands For Moving. (line 22) * beginning-of-history (M-<): Commands For History. -* beginning-of-line (C-a): Commands For Moving. + (line 19) +* beginning-of-line (C-a): Commands For Moving. (line 6) * bell-style: Readline Init File Syntax. -* call-last-kbd-macro (C-x e): Keyboard Macros. -* capitalize-word (M-c): Commands For Text. + (line 35) +* bind-tty-special-chars: Readline Init File Syntax. + (line 42) +* call-last-kbd-macro (C-x e): Keyboard Macros. (line 13) +* capitalize-word (M-c): Commands For Text. (line 49) * character-search (C-]): Miscellaneous Commands. + (line 41) * character-search-backward (M-C-]): Miscellaneous Commands. -* clear-screen (C-l): Commands For Moving. + (line 46) +* clear-screen (C-l): Commands For Moving. (line 26) * comment-begin: Readline Init File Syntax. + (line 47) * complete (<TAB>): Commands For Completion. + (line 6) * completion-query-items: Readline Init File Syntax. + (line 57) * convert-meta: Readline Init File Syntax. + (line 67) * copy-backward-word (): Commands For Killing. + (line 49) * copy-forward-word (): Commands For Killing. + (line 54) * copy-region-as-kill (): Commands For Killing. -* delete-char (C-d): Commands For Text. + (line 45) +* delete-char (C-d): Commands For Text. (line 6) * delete-char-or-list (): Commands For Completion. + (line 30) * delete-horizontal-space (): Commands For Killing. -* digit-argument (M-0, M-1, ... M--): Numeric Arguments. + (line 37) +* digit-argument (M-0, M-1, ... M--): Numeric Arguments. (line 6) * disable-completion: Readline Init File Syntax. + (line 73) * do-uppercase-version (M-a, M-b, M-X, ...): Miscellaneous Commands. -* downcase-word (M-l): Commands For Text. + (line 14) +* downcase-word (M-l): Commands For Text. (line 45) * dump-functions (): Miscellaneous Commands. + (line 61) * dump-macros (): Miscellaneous Commands. + (line 73) * dump-variables (): Miscellaneous Commands. + (line 67) * editing-mode: Readline Init File Syntax. + (line 78) * enable-keypad: Readline Init File Syntax. -* end-kbd-macro (C-x )): Keyboard Macros. + (line 84) +* end-kbd-macro (C-x )): Keyboard Macros. (line 9) * end-of-history (M->): Commands For History. -* end-of-line (C-e): Commands For Moving. + (line 22) +* end-of-line (C-e): Commands For Moving. (line 9) * exchange-point-and-mark (C-x C-x): Miscellaneous Commands. + (line 36) * expand-tilde: Readline Init File Syntax. -* forward-backward-delete-char (): Commands For Text. -* forward-char (C-f): Commands For Moving. + (line 89) +* forward-backward-delete-char (): Commands For Text. (line 15) +* forward-char (C-f): Commands For Moving. (line 12) * forward-search-history (C-s): Commands For History. -* forward-word (M-f): Commands For Moving. + (line 30) +* forward-word (M-f): Commands For Moving. (line 18) * history-preserve-point: Readline Init File Syntax. + (line 93) * history-search-backward (): Commands For History. + (line 50) * history-search-forward (): Commands For History. + (line 45) * horizontal-scroll-mode: Readline Init File Syntax. + (line 98) * input-meta: Readline Init File Syntax. + (line 105) * insert-comment (M-#): Miscellaneous Commands. + (line 51) * insert-completions (M-*): Commands For Completion. + (line 14) * isearch-terminators: Readline Init File Syntax. + (line 112) * keymap: Readline Init File Syntax. + (line 119) * kill-line (C-k): Commands For Killing. + (line 6) * kill-region (): Commands For Killing. + (line 41) * kill-whole-line (): Commands For Killing. + (line 15) * kill-word (M-d): Commands For Killing. + (line 19) * mark-modified-lines: Readline Init File Syntax. + (line 132) * mark-symlinked-directories: Readline Init File Syntax. + (line 137) * match-hidden-files: Readline Init File Syntax. + (line 142) * menu-complete (): Commands For Completion. + (line 18) * meta-flag: Readline Init File Syntax. + (line 105) * next-history (C-n): Commands For History. + (line 16) * non-incremental-forward-search-history (M-n): Commands For History. + (line 40) * non-incremental-reverse-search-history (M-p): Commands For History. + (line 35) * output-meta: Readline Init File Syntax. -* overwrite-mode (): Commands For Text. + (line 149) +* overwrite-mode (): Commands For Text. (line 53) * page-completions: Readline Init File Syntax. + (line 154) * possible-completions (M-?): Commands For Completion. + (line 11) * prefix-meta (<ESC>): Miscellaneous Commands. + (line 18) * previous-history (C-p): Commands For History. -* quoted-insert (C-q or C-v): Commands For Text. + (line 12) +* quoted-insert (C-q or C-v): Commands For Text. (line 20) * re-read-init-file (C-x C-r): Miscellaneous Commands. -* readline: Basic Behavior. -* redraw-current-line (): Commands For Moving. + (line 6) +* readline: Basic Behavior. (line 12) +* redraw-current-line (): Commands For Moving. (line 30) * reverse-search-history (C-r): Commands For History. + (line 26) * revert-line (M-r): Miscellaneous Commands. -* rl_add_defun: Function Naming. + (line 25) +* rl_add_defun: Function Naming. (line 20) * rl_add_funmap_entry: Associating Function Names and Bindings. -* rl_add_undo: Allowing Undoing. -* rl_alphabetic: Utility Functions. -* rl_already_prompted: Readline Variables. + (line 47) +* rl_add_undo: Allowing Undoing. (line 41) +* rl_alphabetic: Utility Functions. (line 24) +* rl_already_prompted: Readline Variables. (line 59) * rl_attempted_completion_function: Completion Variables. + (line 12) * rl_attempted_completion_over: Completion Variables. + (line 207) * rl_basic_quote_characters: Completion Variables. + (line 96) * rl_basic_word_break_characters: Completion Variables. -* rl_begin_undo_group: Allowing Undoing. -* rl_bind_key: Binding Keys. -* rl_bind_key_if_unbound: Binding Keys. -* rl_bind_key_if_unbound_in_map: Binding Keys. -* rl_bind_key_in_map: Binding Keys. -* rl_bind_keyseq: Binding Keys. -* rl_bind_keyseq_if_unbound: Binding Keys. -* rl_bind_keyseq_if_unbound_in_map: Binding Keys. -* rl_bind_keyseq_in_map: Binding Keys. -* rl_binding_keymap: Readline Variables. -* rl_callback_handler_install: Alternate Interface. -* rl_callback_handler_remove: Alternate Interface. -* rl_callback_read_char: Alternate Interface. + (line 90) +* rl_begin_undo_group: Allowing Undoing. (line 29) +* rl_bind_key: Binding Keys. (line 22) +* rl_bind_key_if_unbound: Binding Keys. (line 32) +* rl_bind_key_if_unbound_in_map: Binding Keys. (line 38) +* rl_bind_key_in_map: Binding Keys. (line 27) +* rl_bind_keyseq: Binding Keys. (line 59) +* rl_bind_keyseq_if_unbound: Binding Keys. (line 77) +* rl_bind_keyseq_if_unbound_in_map: Binding Keys. (line 83) +* rl_bind_keyseq_in_map: Binding Keys. (line 66) +* rl_binding_keymap: Readline Variables. (line 154) +* rl_callback_handler_install: Alternate Interface. (line 15) +* rl_callback_handler_remove: Alternate Interface. (line 33) +* rl_callback_read_char: Alternate Interface. (line 21) * rl_catch_signals: Readline Signal Handling. + (line 48) * rl_catch_sigwinch: Readline Signal Handling. + (line 55) * rl_char_is_quoted_p: Completion Variables. + (line 46) * rl_cleanup_after_signal: Readline Signal Handling. -* rl_clear_message: Redisplay. -* rl_clear_pending_input: Character Input. + (line 66) +* rl_clear_message: Redisplay. (line 48) +* rl_clear_pending_input: Character Input. (line 30) * rl_clear_signals: Readline Signal Handling. -* rl_complete <1>: How Completing Works. -* rl_complete: Completion Functions. + (line 119) +* rl_complete <1>: Completion Functions. + (line 20) +* rl_complete: How Completing Works. + (line 49) * rl_complete_internal: Completion Functions. + (line 10) * rl_completer_quote_characters: Completion Variables. + (line 113) * rl_completer_word_break_characters: Completion Variables. + (line 99) * rl_completion_append_character: Completion Variables. + (line 137) * rl_completion_display_matches_hook: Completion Variables. + (line 77) * rl_completion_entry_function <1>: Completion Variables. + (line 7) * rl_completion_entry_function: How Completing Works. + (line 55) * rl_completion_found_quote: Completion Variables. + (line 165) * rl_completion_mark_symlink_dirs: Completion Variables. + (line 172) * rl_completion_matches: Completion Functions. + (line 45) * rl_completion_mode: Completion Functions. + (line 37) * rl_completion_query_items: Completion Variables. + (line 131) * rl_completion_quote_character: Completion Variables. + (line 153) * rl_completion_suppress_append: Completion Variables. + (line 147) * rl_completion_suppress_quote: Completion Variables. + (line 159) * rl_completion_type: Completion Variables. + (line 214) * rl_completion_word_break_hook: Completion Variables. -* rl_copy_keymap: Keymaps. -* rl_copy_text: Modifying Text. -* rl_crlf: Redisplay. -* rl_delete_text: Modifying Text. -* rl_deprep_term_function: Readline Variables. -* rl_deprep_terminal: Terminal Management. -* rl_ding: Utility Functions. + (line 104) +* rl_copy_keymap: Keymaps. (line 17) +* rl_copy_text: Modifying Text. (line 15) +* rl_crlf: Redisplay. (line 30) +* rl_delete_text: Modifying Text. (line 11) +* rl_deprep_term_function: Readline Variables. (line 144) +* rl_deprep_terminal: Terminal Management. (line 13) +* rl_ding: Utility Functions. (line 21) * rl_directory_completion_hook: Completion Variables. -* rl_discard_keymap: Keymaps. -* rl_dispatching: Readline Variables. -* rl_display_match_list: Utility Functions. -* rl_do_undo: Allowing Undoing. -* rl_done: Readline Variables. -* rl_editing_mode: Readline Variables. -* rl_end: Readline Variables. -* rl_end_undo_group: Allowing Undoing. -* rl_erase_empty_line: Readline Variables. -* rl_event_hook: Readline Variables. -* rl_execute_next: Character Input. -* rl_executing_keymap: Readline Variables. -* rl_executing_macro: Readline Variables. -* rl_expand_prompt: Redisplay. -* rl_explicit_arg: Readline Variables. -* rl_extend_line_buffer: Utility Functions. + (line 64) +* rl_discard_keymap: Keymaps. (line 26) +* rl_dispatching: Readline Variables. (line 41) +* rl_display_match_list: Utility Functions. (line 28) +* rl_do_undo: Allowing Undoing. (line 48) +* rl_done: Readline Variables. (line 28) +* rl_editing_mode: Readline Variables. (line 242) +* rl_end: Readline Variables. (line 19) +* rl_end_undo_group: Allowing Undoing. (line 35) +* rl_erase_empty_line: Readline Variables. (line 47) +* rl_event_hook: Readline Variables. (line 119) +* rl_execute_next: Character Input. (line 26) +* rl_executing_keymap: Readline Variables. (line 150) +* rl_executing_macro: Readline Variables. (line 158) +* rl_expand_prompt: Redisplay. (line 64) +* rl_explicit_arg: Readline Variables. (line 233) +* rl_extend_line_buffer: Utility Functions. (line 12) * rl_filename_completion_desired: Completion Variables. + (line 187) * rl_filename_completion_function: Completion Functions. + (line 59) * rl_filename_dequoting_function: Completion Variables. + (line 37) * rl_filename_quote_characters: Completion Variables. + (line 119) * rl_filename_quoting_desired: Completion Variables. + (line 197) * rl_filename_quoting_function: Completion Variables. -* rl_forced_update_display: Redisplay. + (line 24) +* rl_forced_update_display: Redisplay. (line 11) * rl_free_line_state: Readline Signal Handling. -* rl_free_undo_list: Allowing Undoing. + (line 72) +* rl_free_undo_list: Allowing Undoing. (line 45) * rl_function_dumper: Associating Function Names and Bindings. + (line 30) * rl_function_of_keyseq: Associating Function Names and Bindings. + (line 15) * rl_funmap_names: Associating Function Names and Bindings. -* rl_generic_bind: Binding Keys. -* rl_get_keymap: Keymaps. -* rl_get_keymap_by_name: Keymaps. -* rl_get_keymap_name: Keymaps. + (line 40) +* rl_generic_bind: Binding Keys. (line 89) +* rl_get_keymap: Keymaps. (line 32) +* rl_get_keymap_by_name: Keymaps. (line 38) +* rl_get_keymap_name: Keymaps. (line 43) * rl_get_screen_size: Readline Signal Handling. + (line 102) * rl_get_termcap: Miscellaneous Functions. -* rl_getc: Character Input. -* rl_getc_function: Readline Variables. -* rl_gnu_readline_p: Readline Variables. + (line 42) +* rl_getc: Character Input. (line 15) +* rl_getc_function: Readline Variables. (line 125) +* rl_gnu_readline_p: Readline Variables. (line 78) * rl_ignore_completion_duplicates: Completion Variables. + (line 183) * rl_ignore_some_completions_function: Completion Variables. + (line 56) * rl_inhibit_completion: Completion Variables. -* rl_initialize: Utility Functions. + (line 222) +* rl_initialize: Utility Functions. (line 16) * rl_insert_completions: Completion Functions. -* rl_insert_text: Modifying Text. -* rl_instream: Readline Variables. + (line 32) +* rl_insert_text: Modifying Text. (line 7) +* rl_instream: Readline Variables. (line 92) * rl_invoking_keyseqs: Associating Function Names and Bindings. + (line 21) * rl_invoking_keyseqs_in_map: Associating Function Names and Bindings. -* rl_kill_text: Modifying Text. -* rl_last_func: Readline Variables. -* rl_library_version: Readline Variables. -* rl_line_buffer: Readline Variables. + (line 26) +* rl_kill_text: Modifying Text. (line 19) +* rl_last_func: Readline Variables. (line 105) +* rl_library_version: Readline Variables. (line 68) +* rl_line_buffer: Readline Variables. (line 9) * rl_list_funmap_names: Associating Function Names and Bindings. + (line 36) * rl_macro_bind: Miscellaneous Functions. + (line 8) * rl_macro_dumper: Miscellaneous Functions. -* rl_make_bare_keymap: Keymaps. -* rl_make_keymap: Keymaps. -* rl_mark: Readline Variables. -* rl_message: Redisplay. -* rl_modifying: Allowing Undoing. + (line 14) +* rl_make_bare_keymap: Keymaps. (line 12) +* rl_make_keymap: Keymaps. (line 20) +* rl_mark: Readline Variables. (line 24) +* rl_message: Redisplay. (line 39) +* rl_modifying: Allowing Undoing. (line 57) * rl_named_function: Associating Function Names and Bindings. -* rl_num_chars_to_read: Readline Variables. -* rl_numeric_arg: Readline Variables. -* rl_on_new_line: Redisplay. -* rl_on_new_line_with_prompt: Redisplay. -* rl_outstream: Readline Variables. -* rl_parse_and_bind: Binding Keys. -* rl_pending_input: Readline Variables. -* rl_point: Readline Variables. + (line 11) +* rl_num_chars_to_read: Readline Variables. (line 32) +* rl_numeric_arg: Readline Variables. (line 237) +* rl_on_new_line: Redisplay. (line 15) +* rl_on_new_line_with_prompt: Redisplay. (line 19) +* rl_outstream: Readline Variables. (line 96) +* rl_parse_and_bind: Binding Keys. (line 96) +* rl_pending_input: Readline Variables. (line 37) +* rl_point: Readline Variables. (line 15) * rl_possible_completions: Completion Functions. -* rl_pre_input_hook: Readline Variables. -* rl_prep_term_function: Readline Variables. -* rl_prep_terminal: Terminal Management. -* rl_prompt: Readline Variables. -* rl_push_macro_input: Modifying Text. -* rl_read_init_file: Binding Keys. -* rl_read_key: Character Input. -* rl_readline_name: Readline Variables. -* rl_readline_state: Readline Variables. -* rl_readline_version: Readline Variables. -* rl_redisplay: Redisplay. -* rl_redisplay_function: Readline Variables. -* rl_replace_line: Utility Functions. + (line 28) +* rl_pre_input_hook: Readline Variables. (line 114) +* rl_prefer_env_winsize: Readline Variables. (line 100) +* rl_prep_term_function: Readline Variables. (line 137) +* rl_prep_terminal: Terminal Management. (line 7) +* rl_prompt: Readline Variables. (line 53) +* rl_push_macro_input: Modifying Text. (line 26) +* rl_read_init_file: Binding Keys. (line 101) +* rl_read_key: Character Input. (line 7) +* rl_readline_name: Readline Variables. (line 87) +* rl_readline_state: Readline Variables. (line 161) +* rl_readline_version: Readline Variables. (line 71) +* rl_redisplay: Redisplay. (line 7) +* rl_redisplay_function: Readline Variables. (line 131) +* rl_replace_line: Utility Functions. (line 7) * rl_reset_after_signal: Readline Signal Handling. -* rl_reset_line_state: Redisplay. -* rl_reset_terminal: Terminal Management. + (line 80) +* rl_reset_line_state: Redisplay. (line 26) +* rl_reset_screen_size: Readline Signal Handling. + (line 106) +* rl_reset_terminal: Terminal Management. (line 28) * rl_resize_terminal: Readline Signal Handling. -* rl_restore_prompt: Redisplay. -* rl_save_prompt: Redisplay. -* rl_set_key: Binding Keys. -* rl_set_keyboard_input_timeout: Character Input. -* rl_set_keymap: Keymaps. + (line 89) +* rl_restore_prompt: Redisplay. (line 57) +* rl_save_prompt: Redisplay. (line 53) +* rl_set_key: Binding Keys. (line 73) +* rl_set_keyboard_input_timeout: Character Input. (line 35) +* rl_set_keymap: Keymaps. (line 35) * rl_set_paren_blink_timeout: Miscellaneous Functions. -* rl_set_prompt: Redisplay. + (line 37) +* rl_set_prompt: Redisplay. (line 78) * rl_set_screen_size: Readline Signal Handling. + (line 93) * rl_set_signals: Readline Signal Handling. -* rl_show_char: Redisplay. + (line 113) +* rl_show_char: Redisplay. (line 33) * rl_special_prefixes: Completion Variables. -* rl_startup_hook: Readline Variables. -* rl_stuff_char: Character Input. -* rl_terminal_name: Readline Variables. -* rl_tty_set_default_bindings: Terminal Management. -* rl_tty_unset_default_bindings: Terminal Management. -* rl_unbind_command_in_map: Binding Keys. -* rl_unbind_function_in_map: Binding Keys. -* rl_unbind_key: Binding Keys. -* rl_unbind_key_in_map: Binding Keys. + (line 124) +* rl_startup_hook: Readline Variables. (line 110) +* rl_stuff_char: Character Input. (line 19) +* rl_terminal_name: Readline Variables. (line 82) +* rl_tty_set_default_bindings: Terminal Management. (line 18) +* rl_tty_unset_default_bindings: Terminal Management. (line 23) +* rl_unbind_command_in_map: Binding Keys. (line 55) +* rl_unbind_function_in_map: Binding Keys. (line 51) +* rl_unbind_key: Binding Keys. (line 42) +* rl_unbind_key_in_map: Binding Keys. (line 46) * rl_username_completion_function: Completion Functions. + (line 66) * rl_variable_bind: Miscellaneous Functions. + (line 21) * rl_variable_dumper: Miscellaneous Functions. -* self-insert (a, b, A, 1, !, ...): Commands For Text. + (line 31) +* rl_variable_value: Miscellaneous Functions. + (line 26) +* self-insert (a, b, A, 1, !, ...): Commands For Text. (line 27) * set-mark (C-@): Miscellaneous Commands. + (line 32) * show-all-if-ambiguous: Readline Init File Syntax. + (line 164) * show-all-if-unmodified: Readline Init File Syntax. -* start-kbd-macro (C-x (): Keyboard Macros. -* transpose-chars (C-t): Commands For Text. -* transpose-words (M-t): Commands For Text. + (line 170) +* start-kbd-macro (C-x (): Keyboard Macros. (line 6) +* transpose-chars (C-t): Commands For Text. (line 30) +* transpose-words (M-t): Commands For Text. (line 36) * undo (C-_ or C-x C-u): Miscellaneous Commands. -* universal-argument (): Numeric Arguments. + (line 22) +* universal-argument (): Numeric Arguments. (line 10) * unix-filename-rubout (): Commands For Killing. + (line 32) * unix-line-discard (C-u): Commands For Killing. + (line 12) * unix-word-rubout (C-w): Commands For Killing. -* upcase-word (M-u): Commands For Text. + (line 28) +* upcase-word (M-u): Commands For Text. (line 41) * visible-stats: Readline Init File Syntax. + (line 179) * yank (C-y): Commands For Killing. + (line 59) * yank-last-arg (M-. or M-_): Commands For History. + (line 64) * yank-nth-arg (M-C-y): Commands For History. + (line 55) * yank-pop (M-y): Commands For Killing. + (line 62) Tag Table: -Node: Top1336 +Node: Top1339 Node: Command Line Editing1977 -Node: Introduction and Notation2628 -Node: Readline Interaction4246 -Node: Readline Bare Essentials5433 -Node: Readline Movement Commands7214 -Node: Readline Killing Commands8171 -Node: Readline Arguments10081 -Node: Searching11117 -Node: Readline Init File13260 -Node: Readline Init File Syntax14321 -Node: Conditional Init Constructs25684 -Node: Sample Init File28209 -Node: Bindable Readline Commands31393 -Node: Commands For Moving32443 -Node: Commands For History33293 -Node: Commands For Text36152 -Node: Commands For Killing38867 -Node: Numeric Arguments40998 -Node: Commands For Completion42126 -Node: Keyboard Macros43659 -Node: Miscellaneous Commands44219 -Node: Readline vi Mode47569 -Node: Programming with GNU Readline49387 -Node: Basic Behavior50361 -Node: Custom Functions53791 -Node: Readline Typedefs55269 -Node: Function Writing56899 -Node: Readline Variables58107 -Node: Readline Convenience Functions67530 -Node: Function Naming68512 -Node: Keymaps69764 -Node: Binding Keys71520 -Node: Associating Function Names and Bindings76042 -Node: Allowing Undoing78287 -Node: Redisplay80822 -Node: Modifying Text84256 -Node: Character Input85485 -Node: Terminal Management87265 -Node: Utility Functions88684 -Node: Miscellaneous Functions91023 -Node: Alternate Interface93087 -Node: A Readline Example95232 -Node: Readline Signal Handling97169 -Node: Custom Completers102772 -Node: How Completing Works103487 -Node: Completion Functions106790 -Node: Completion Variables110345 -Node: A Short Completion Example122415 -Node: Copying This Manual134968 -Node: GNU Free Documentation License135208 -Node: Concept Index157602 -Node: Function and Variable Index158551 +Node: Introduction and Notation2629 +Node: Readline Interaction4252 +Node: Readline Bare Essentials5444 +Node: Readline Movement Commands7234 +Node: Readline Killing Commands8200 +Node: Readline Arguments10121 +Node: Searching11166 +Node: Readline Init File13318 +Node: Readline Init File Syntax14384 +Node: Conditional Init Constructs26319 +Node: Sample Init File28853 +Node: Bindable Readline Commands31971 +Node: Commands For Moving33029 +Node: Commands For History33891 +Node: Commands For Text37016 +Node: Commands For Killing39743 +Node: Numeric Arguments41886 +Node: Commands For Completion43026 +Node: Keyboard Macros44571 +Node: Miscellaneous Commands45143 +Node: Readline vi Mode48505 +Node: Programming with GNU Readline50329 +Node: Basic Behavior51304 +Node: Custom Functions54721 +Node: Readline Typedefs56205 +Node: Function Writing57844 +Node: Readline Variables59151 +Node: Readline Convenience Functions68853 +Node: Function Naming69843 +Node: Keymaps71105 +Node: Binding Keys72877 +Node: Associating Function Names and Bindings77424 +Node: Allowing Undoing79686 +Node: Redisplay82236 +Node: Modifying Text86136 +Node: Character Input87382 +Node: Terminal Management89180 +Node: Utility Functions90616 +Node: Miscellaneous Functions92981 +Node: Alternate Interface95278 +Node: A Readline Example97437 +Node: Readline Signal Handling99340 +Node: Custom Completers105208 +Node: How Completing Works105928 +Node: Completion Functions109242 +Node: Completion Variables112814 +Node: A Short Completion Example125004 +Node: Copying This Manual137177 +Node: GNU Free Documentation License137439 +Node: Concept Index159846 +Node: Function and Variable Index161502 End Tag Table |