From 56f65f858db82c284f8a7ace20e2b2567e05df25 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Sat, 24 Aug 2002 00:11:12 +0000 Subject: [PATCH] dummy commit, get CVS off the branch. --- readline/compat.c | 113 --- readline/doc/history.0 | 660 ------------- readline/doc/history.3 | 640 ------------- readline/doc/history_3.ps | 800 ---------------- readline/doc/readline_3.ps | 1294 -------------------------- readline/examples/readlinebuf.h | 139 --- readline/examples/rlcat.c | 174 ---- readline/mbutil.c | 337 ------- readline/misc.c | 496 ---------- readline/rlmbutil.h | 108 --- readline/rltypedefs.h | 88 -- readline/support/wcwidth.c | 236 ----- readline/text.c | 1540 ------------------------------- 13 files changed, 6625 deletions(-) delete mode 100644 readline/compat.c delete mode 100644 readline/doc/history.0 delete mode 100644 readline/doc/history.3 delete mode 100644 readline/doc/history_3.ps delete mode 100644 readline/doc/readline_3.ps delete mode 100644 readline/examples/readlinebuf.h delete mode 100644 readline/examples/rlcat.c delete mode 100644 readline/mbutil.c delete mode 100644 readline/misc.c delete mode 100644 readline/rlmbutil.h delete mode 100644 readline/rltypedefs.h delete mode 100644 readline/support/wcwidth.c delete mode 100644 readline/text.c diff --git a/readline/compat.c b/readline/compat.c deleted file mode 100644 index a66d210fd2..0000000000 --- a/readline/compat.c +++ /dev/null @@ -1,113 +0,0 @@ -/* compat.c -- backwards compatibility functions. */ - -/* Copyright (C) 2000 Free Software Foundation, Inc. - - This file is part of the GNU Readline Library, a library for - reading lines of text with interactive input and history editing. - - The GNU Readline Library is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2, or - (at your option) any later version. - - The GNU Readline Library is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - The GNU General Public License is often shipped with GNU software, and - is generally kept in a file called COPYING or LICENSE. If you do not - have a copy of the license, write to the Free Software Foundation, - 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ -#define READLINE_LIBRARY - -#if defined (HAVE_CONFIG_H) -# include -#endif - -#include - -#include "rlstdc.h" -#include "rltypedefs.h" - -extern void rl_free_undo_list PARAMS((void)); -extern int rl_maybe_save_line PARAMS((void)); -extern int rl_maybe_unsave_line PARAMS((void)); -extern int rl_maybe_replace_line PARAMS((void)); - -extern int rl_crlf PARAMS((void)); -extern int rl_ding PARAMS((void)); -extern int rl_alphabetic PARAMS((int)); - -extern char **rl_completion_matches PARAMS((const char *, rl_compentry_func_t *)); -extern char *rl_username_completion_function PARAMS((const char *, int)); -extern char *rl_filename_completion_function PARAMS((const char *, int)); - -/* Provide backwards-compatible entry points for old function names. */ - -void -free_undo_list () -{ - rl_free_undo_list (); -} - -int -maybe_replace_line () -{ - return rl_maybe_replace_line (); -} - -int -maybe_save_line () -{ - return rl_maybe_save_line (); -} - -int -maybe_unsave_line () -{ - return rl_maybe_unsave_line (); -} - -int -ding () -{ - return rl_ding (); -} - -int -crlf () -{ - return rl_crlf (); -} - -int -alphabetic (c) - int c; -{ - return rl_alphabetic (c); -} - -char ** -completion_matches (s, f) - const char *s; - rl_compentry_func_t *f; -{ - return rl_completion_matches (s, f); -} - -char * -username_completion_function (s, i) - const char *s; - int i; -{ - return rl_username_completion_function (s, i); -} - -char * -filename_completion_function (s, i) - const char *s; - int i; -{ - return rl_filename_completion_function (s, i); -} diff --git a/readline/doc/history.0 b/readline/doc/history.0 deleted file mode 100644 index 324c363a66..0000000000 --- a/readline/doc/history.0 +++ /dev/null @@ -1,660 +0,0 @@ - - - -HISTORY(3) HISTORY(3) - - -NNAAMMEE - history - GNU History Library - -CCOOPPYYRRIIGGHHTT - The GNU History Library is Copyright (C) 1989-2002 by the - Free Software Foundation, Inc. - -DDEESSCCRRIIPPTTIIOONN - Many programs read input from the user a line at a time. - The GNU History library is able to keep track of those - lines, associate arbitrary data with each line, and uti- - lize information from previous lines in composing new - ones. - - -HHIISSTTOORRYY EEXXPPAANNSSIIOONN - The history library supports a history expansion feature - that is identical to the history expansion in bbaasshh.. This - section describes what syntax features are available. - - History expansions introduce words from the history list - into the input stream, making it easy to repeat commands, - insert the arguments to a previous command into the cur- - rent input line, or fix errors in previous commands - quickly. - - History expansion is usually performed immediately after a - complete line is read. It takes place in two parts. The - first is to determine which line from the history list to - use during substitution. The second is to select portions - of that line for inclusion into the current one. The line - selected from the history is the _e_v_e_n_t, and the portions - of that line that are acted upon are _w_o_r_d_s. Various _m_o_d_i_- - _f_i_e_r_s are available to manipulate the selected words. The - line is broken into words in the same fashion as bbaasshh does - when reading input, so that several words that would oth- - erwise be separated are considered one word when sur- - rounded by quotes (see the description of hhiissttoorryy__ttookk-- - eenniizzee(()) below). History expansions are introduced by the - appearance of the history expansion character, which is !! - by default. Only backslash (\\) and single quotes can - quote the history expansion character. - - EEvveenntt DDeessiiggnnaattoorrss - An event designator is a reference to a command line entry - in the history list. - - !! Start a history substitution, except when followed - by a bbllaannkk, newline, = or (. - !!_n Refer to command line _n. - !!--_n Refer to the current command line minus _n. - !!!! Refer to the previous command. This is a synonym - for `!-1'. - - - - -GNU History 4.3 2002 January 31 1 - - - - - -HISTORY(3) HISTORY(3) - - - !!_s_t_r_i_n_g - Refer to the most recent command starting with - _s_t_r_i_n_g. - !!??_s_t_r_i_n_g[[??]] - Refer to the most recent command containing _s_t_r_i_n_g. - The trailing ?? may be omitted if _s_t_r_i_n_g is followed - immediately by a newline. - ^^_s_t_r_i_n_g_1^^_s_t_r_i_n_g_2^^ - Quick substitution. Repeat the last command, - replacing _s_t_r_i_n_g_1 with _s_t_r_i_n_g_2. Equivalent to - ``!!:s/_s_t_r_i_n_g_1/_s_t_r_i_n_g_2/'' (see MMooddiiffiieerrss below). - !!## The entire command line typed so far. - - WWoorrdd DDeessiiggnnaattoorrss - Word designators are used to select desired words from the - event. A :: separates the event specification from the - word designator. It may be omitted if the word designator - begins with a ^^, $$, **, --, or %%. Words are numbered from - the beginning of the line, with the first word being - denoted by 0 (zero). Words are inserted into the current - line separated by single spaces. - - 00 ((zzeerroo)) - The zeroth word. For the shell, this is the com- - mand word. - _n The _nth word. - ^^ The first argument. That is, word 1. - $$ The last argument. - %% The word matched by the most recent `?_s_t_r_i_n_g?' - search. - _x--_y A range of words; `-_y' abbreviates `0-_y'. - ** All of the words but the zeroth. This is a synonym - for `_1_-_$'. It is not an error to use ** if there is - just one word in the event; the empty string is - returned in that case. - xx** Abbreviates _x_-_$. - xx-- Abbreviates _x_-_$ like xx**, but omits the last word. - - If a word designator is supplied without an event specifi- - cation, the previous command is used as the event. - - MMooddiiffiieerrss - After the optional word designator, there may appear a - sequence of one or more of the following modifiers, each - preceded by a `:'. - - hh Remove a trailing file name component, leaving only - the head. - tt Remove all leading file name components, leaving - the tail. - rr Remove a trailing suffix of the form _._x_x_x, leaving - the basename. - ee Remove all but the trailing suffix. - pp Print the new command but do not execute it. - - - -GNU History 4.3 2002 January 31 2 - - - - - -HISTORY(3) HISTORY(3) - - - qq Quote the substituted words, escaping further sub- - stitutions. - xx Quote the substituted words as with qq, but break - into words at bbllaannkkss and newlines. - ss//_o_l_d//_n_e_w// - Substitute _n_e_w for the first occurrence of _o_l_d in - the event line. Any delimiter can be used in place - of /. The final delimiter is optional if it is the - last character of the event line. The delimiter - may be quoted in _o_l_d and _n_e_w with a single back- - slash. If & appears in _n_e_w, it is replaced by _o_l_d. - A single backslash will quote the &. If _o_l_d is - null, it is set to the last _o_l_d substituted, or, if - no previous history substitutions took place, the - last _s_t_r_i_n_g in a !!??_s_t_r_i_n_g[[??]] search. - && Repeat the previous substitution. - gg Cause changes to be applied over the entire event - line. This is used in conjunction with `::ss' (e.g., - `::ggss//_o_l_d//_n_e_w//') or `::&&'. If used with `::ss', any - delimiter can be used in place of /, and the final - delimiter is optional if it is the last character - of the event line. - -PPRROOGGRRAAMMMMIINNGG WWIITTHH HHIISSTTOORRYY FFUUNNCCTTIIOONNSS - This section describes how to use the History library in - other programs. - - IInnttrroodduuccttiioonn ttoo HHiissttoorryy - The programmer using the History library has available - functions for remembering lines on a history list, associ- - ating arbitrary data with a line, removing lines from the - list, searching through the list for a line containing an - arbitrary text string, and referencing any line in the - list directly. In addition, a history _e_x_p_a_n_s_i_o_n function - is available which provides for a consistent user inter- - face across different programs. - - The user using programs written with the History library - has the benefit of a consistent user interface with a set - of well-known commands for manipulating the text of previ- - ous lines and using that text in new commands. The basic - history manipulation commands are identical to the history - substitution provided by bbaasshh. - - If the programmer desires, he can use the Readline - library, which includes some history manipulation by - default, and has the added advantage of command line edit- - ing. - - Before declaring any functions using any functionality the - History library provides in other code, an application - writer should include the file _<_r_e_a_d_l_i_n_e_/_h_i_s_t_o_r_y_._h_> in any - file that uses the History library's features. It sup- - plies extern declarations for all of the library's public - - - -GNU History 4.3 2002 January 31 3 - - - - - -HISTORY(3) HISTORY(3) - - - functions and variables, and declares all of the public - data structures. - - - HHiissttoorryy SSttoorraaggee - The history list is an array of history entries. A his- - tory entry is declared as follows: - - _t_y_p_e_d_e_f _v_o_i_d _* hhiissttddaattaa__tt;; - - typedef struct _hist_entry { - char *line; - histdata_t data; - } HIST_ENTRY; - - The history list itself might therefore be declared as - - _H_I_S_T___E_N_T_R_Y _*_* tthhee__hhiissttoorryy__lliisstt;; - - The state of the History library is encapsulated into a - single structure: - - /* - * A structure used to pass around the current state of the history. - */ - typedef struct _hist_state { - HIST_ENTRY **entries; /* Pointer to the entries themselves. */ - int offset; /* The location pointer within this array. */ - int length; /* Number of elements within this array. */ - int size; /* Number of slots allocated to this array. */ - int flags; - } HISTORY_STATE; - - If the flags member includes HHSS__SSTTIIFFLLEEDD, the history has - been stifled. - -HHiissttoorryy FFuunnccttiioonnss - This section describes the calling sequence for the vari- - ous functions exported by the GNU History library. - - IInniittiiaalliizziinngg HHiissttoorryy aanndd SSttaattee MMaannaaggeemmeenntt - This section describes functions used to initialize and - manage the state of the History library when you want to - use the history functions in your program. - - _v_o_i_d uussiinngg__hhiissttoorryy (_v_o_i_d) - Begin a session in which the history functions might be - used. This initializes the interactive variables. - - _H_I_S_T_O_R_Y___S_T_A_T_E _* hhiissttoorryy__ggeett__hhiissttoorryy__ssttaattee (_v_o_i_d) - Return a structure describing the current state of the - input history. - - _v_o_i_d hhiissttoorryy__sseett__hhiissttoorryy__ssttaattee (_H_I_S_T_O_R_Y___S_T_A_T_E _*_s_t_a_t_e) - - - -GNU History 4.3 2002 January 31 4 - - - - - -HISTORY(3) HISTORY(3) - - - Set the state of the history list according to _s_t_a_t_e. - - - HHiissttoorryy LLiisstt MMaannaaggeemmeenntt - These functions manage individual entries on the history - list, or set parameters managing the list itself. - - _v_o_i_d aadddd__hhiissttoorryy (_c_o_n_s_t _c_h_a_r _*_s_t_r_i_n_g) - Place _s_t_r_i_n_g at the end of the history list. The associ- - ated data field (if any) is set to NNUULLLL. - - _H_I_S_T___E_N_T_R_Y _* rreemmoovvee__hhiissttoorryy (_i_n_t _w_h_i_c_h) - Remove history entry at offset _w_h_i_c_h from the history. - The removed element is returned so you can free the line, - data, and containing structure. - - _H_I_S_T___E_N_T_R_Y _* rreeppllaaccee__hhiissttoorryy__eennttrryy (_i_n_t _w_h_i_c_h_, _c_o_n_s_t _c_h_a_r - _*_l_i_n_e_, _h_i_s_t_d_a_t_a___t _d_a_t_a) - Make the history entry at offset _w_h_i_c_h have _l_i_n_e and _d_a_t_a. - This returns the old entry so you can dispose of the data. - In the case of an invalid _w_h_i_c_h, a NNUULLLL pointer is - returned. - - _v_o_i_d cclleeaarr__hhiissttoorryy (_v_o_i_d) - Clear the history list by deleting all the entries. - - _v_o_i_d ssttiiffllee__hhiissttoorryy (_i_n_t _m_a_x) - Stifle the history list, remembering only the last _m_a_x - entries. - - _i_n_t uunnssttiiffllee__hhiissttoorryy (_v_o_i_d) - Stop stifling the history. This returns the previously- - set maximum number of history entries (as set by ssttii-- - ffllee__hhiissttoorryy(())). history was stifled. The value is posi- - tive if the history was stifled, negative if it wasn't. - - _i_n_t hhiissttoorryy__iiss__ssttiifflleedd (_v_o_i_d) - Returns non-zero if the history is stifled, zero if it is - not. - - - IInnffoorrmmaattiioonn AAbboouutt tthhee HHiissttoorryy LLiisstt - These functions return information about the entire his- - tory list or individual list entries. - - _H_I_S_T___E_N_T_R_Y _*_* hhiissttoorryy__lliisstt (_v_o_i_d) - Return a NNUULLLL terminated array of _H_I_S_T___E_N_T_R_Y _* which is - the current input history. Element 0 of this list is the - beginning of time. If there is no history, return NNUULLLL. - - _i_n_t wwhheerree__hhiissttoorryy (_v_o_i_d) - Returns the offset of the current history element. - - _H_I_S_T___E_N_T_R_Y _* ccuurrrreenntt__hhiissttoorryy (_v_o_i_d) - - - -GNU History 4.3 2002 January 31 5 - - - - - -HISTORY(3) HISTORY(3) - - - Return the history entry at the current position, as - determined by wwhheerree__hhiissttoorryy(()). If there is no entry - there, return a NNUULLLL pointer. - - _H_I_S_T___E_N_T_R_Y _* hhiissttoorryy__ggeett (_i_n_t _o_f_f_s_e_t) - Return the history entry at position _o_f_f_s_e_t, starting from - hhiissttoorryy__bbaassee. If there is no entry there, or if _o_f_f_s_e_t is - greater than the history length, return a NNUULLLL pointer. - - _i_n_t hhiissttoorryy__ttoottaall__bbyytteess (_v_o_i_d) - Return the number of bytes that the primary history - entries are using. This function returns the sum of the - lengths of all the lines in the history. - - - MMoovviinngg AArroouunndd tthhee HHiissttoorryy LLiisstt - These functions allow the current index into the history - list to be set or changed. - - _i_n_t hhiissttoorryy__sseett__ppooss (_i_n_t _p_o_s) - Set the current history offset to _p_o_s, an absolute index - into the list. Returns 1 on success, 0 if _p_o_s is less - than zero or greater than the number of history entries. - - _H_I_S_T___E_N_T_R_Y _* pprreevviioouuss__hhiissttoorryy (_v_o_i_d) - Back up the current history offset to the previous history - entry, and return a pointer to that entry. If there is no - previous entry, return a NNUULLLL pointer. - - _H_I_S_T___E_N_T_R_Y _* nneexxtt__hhiissttoorryy (_v_o_i_d) - Move the current history offset forward to the next his- - tory entry, and return the a pointer to that entry. If - there is no next entry, return a NNUULLLL pointer. - - - SSeeaarrcchhiinngg tthhee HHiissttoorryy LLiisstt - These functions allow searching of the history list for - entries containing a specific string. Searching may be - performed both forward and backward from the current his- - tory position. The search may be _a_n_c_h_o_r_e_d, meaning that - the string must match at the beginning of the history - entry. - - _i_n_t hhiissttoorryy__sseeaarrcchh (_c_o_n_s_t _c_h_a_r _*_s_t_r_i_n_g_, _i_n_t _d_i_r_e_c_t_i_o_n) - Search the history for _s_t_r_i_n_g, starting at the current - history offset. If _d_i_r_e_c_t_i_o_n is less than 0, then the - search is through previous entries, otherwise through sub- - sequent entries. If _s_t_r_i_n_g is found, then the current - history index is set to that history entry, and the value - returned is the offset in the line of the entry where - _s_t_r_i_n_g was found. Otherwise, nothing is changed, and a -1 - is returned. - - _i_n_t hhiissttoorryy__sseeaarrcchh__pprreeffiixx (_c_o_n_s_t _c_h_a_r _*_s_t_r_i_n_g_, _i_n_t - - - -GNU History 4.3 2002 January 31 6 - - - - - -HISTORY(3) HISTORY(3) - - - _d_i_r_e_c_t_i_o_n) - Search the history for _s_t_r_i_n_g, starting at the current - history offset. The search is anchored: matching lines - must begin with _s_t_r_i_n_g. If _d_i_r_e_c_t_i_o_n is less than 0, then - the search is through previous entries, otherwise through - subsequent entries. If _s_t_r_i_n_g is found, then the current - history index is set to that entry, and the return value - is 0. Otherwise, nothing is changed, and a -1 is - returned. - - _i_n_t hhiissttoorryy__sseeaarrcchh__ppooss (_c_o_n_s_t _c_h_a_r _*_s_t_r_i_n_g_, _i_n_t _d_i_r_e_c_t_i_o_n_, - _i_n_t _p_o_s) - Search for _s_t_r_i_n_g in the history list, starting at _p_o_s, an - absolute index into the list. If _d_i_r_e_c_t_i_o_n is negative, - the search proceeds backward from _p_o_s, otherwise forward. - Returns the absolute index of the history element where - _s_t_r_i_n_g was found, or -1 otherwise. - - - MMaannaaggiinngg tthhee HHiissttoorryy FFiillee - The History library can read the history from and write it - to a file. This section documents the functions for man- - aging a history file. - - _i_n_t rreeaadd__hhiissttoorryy (_c_o_n_s_t _c_h_a_r _*_f_i_l_e_n_a_m_e) - Add the contents of _f_i_l_e_n_a_m_e to the history list, a line - at a time. If _f_i_l_e_n_a_m_e is NNUULLLL, then read from _~_/_._h_i_s_- - _t_o_r_y. Returns 0 if successful, or eerrrrnnoo if not. - - _i_n_t rreeaadd__hhiissttoorryy__rraannggee (_c_o_n_s_t _c_h_a_r _*_f_i_l_e_n_a_m_e_, _i_n_t _f_r_o_m_, - _i_n_t _t_o) - Read a range of lines from _f_i_l_e_n_a_m_e, adding them to the - history list. Start reading at line _f_r_o_m and end at _t_o. - If _f_r_o_m is zero, start at the beginning. If _t_o is less - than _f_r_o_m, then read until the end of the file. If _f_i_l_e_- - _n_a_m_e is NNUULLLL, then read from _~_/_._h_i_s_t_o_r_y. Returns 0 if - successful, or eerrrrnnoo if not. - - _i_n_t wwrriittee__hhiissttoorryy (_c_o_n_s_t _c_h_a_r _*_f_i_l_e_n_a_m_e) - Write the current history to _f_i_l_e_n_a_m_e, overwriting _f_i_l_e_- - _n_a_m_e if necessary. If _f_i_l_e_n_a_m_e is NNUULLLL, then write the - history list to _~_/_._h_i_s_t_o_r_y. Returns 0 on success, or - eerrrrnnoo on a read or write error. - - - _i_n_t aappppeenndd__hhiissttoorryy (_i_n_t _n_e_l_e_m_e_n_t_s_, _c_o_n_s_t _c_h_a_r _*_f_i_l_e_n_a_m_e) - Append the last _n_e_l_e_m_e_n_t_s of the history list to _f_i_l_e_n_a_m_e. - If _f_i_l_e_n_a_m_e is NNUULLLL, then append to _~_/_._h_i_s_t_o_r_y. Returns 0 - on success, or eerrrrnnoo on a read or write error. - - _i_n_t hhiissttoorryy__ttrruunnccaattee__ffiillee (_c_o_n_s_t _c_h_a_r _*_f_i_l_e_n_a_m_e_, _i_n_t - _n_l_i_n_e_s) - Truncate the history file _f_i_l_e_n_a_m_e, leaving only the last - _n_l_i_n_e_s lines. If _f_i_l_e_n_a_m_e is NNUULLLL, then _~_/_._h_i_s_t_o_r_y is - - - -GNU History 4.3 2002 January 31 7 - - - - - -HISTORY(3) HISTORY(3) - - - truncated. Returns 0 on success, or eerrrrnnoo on failure. - - - HHiissttoorryy EExxppaannssiioonn - These functions implement history expansion. - - _i_n_t hhiissttoorryy__eexxppaanndd (_c_h_a_r _*_s_t_r_i_n_g_, _c_h_a_r _*_*_o_u_t_p_u_t) - Expand _s_t_r_i_n_g, placing the result into _o_u_t_p_u_t, a pointer - to a string. Returns: - 0 If no expansions took place (or, if the only - change in the text was the removal of escape - characters preceding the history expansion - character); - 1 if expansions did take place; - -1 if there was an error in expansion; - 2 if the returned line should be displayed, - but not executed, as with the ::pp modifier. - If an error ocurred in expansion, then _o_u_t_p_u_t contains a - descriptive error message. - - _c_h_a_r _* ggeett__hhiissttoorryy__eevveenntt (_c_o_n_s_t _c_h_a_r _*_s_t_r_i_n_g_, _i_n_t _*_c_i_n_d_e_x_, - _i_n_t _q_c_h_a_r) - Returns the text of the history event beginning at _s_t_r_i_n_g - + _*_c_i_n_d_e_x. _*_c_i_n_d_e_x is modified to point to after the - event specifier. At function entry, _c_i_n_d_e_x points to the - index into _s_t_r_i_n_g where the history event specification - begins. _q_c_h_a_r is a character that is allowed to end the - event specification in addition to the ``normal'' termi- - nating characters. - - _c_h_a_r _*_* hhiissttoorryy__ttookkeenniizzee (_c_o_n_s_t _c_h_a_r _*_s_t_r_i_n_g) - Return an array of tokens parsed out of _s_t_r_i_n_g, much as - the shell might. The tokens are split on the characters - in the hhiissttoorryy__wwoorrdd__ddeelliimmiitteerrss variable, and shell quoting - conventions are obeyed. - - _c_h_a_r _* hhiissttoorryy__aarrgg__eexxttrraacctt (_i_n_t _f_i_r_s_t_, _i_n_t _l_a_s_t_, _c_o_n_s_t - _c_h_a_r _*_s_t_r_i_n_g) - Extract a string segment consisting of the _f_i_r_s_t through - _l_a_s_t arguments present in _s_t_r_i_n_g. Arguments are split - using hhiissttoorryy__ttookkeenniizzee(()). - - - HHiissttoorryy VVaarriiaabblleess - This section describes the externally-visible variables - exported by the GNU History Library. - - _i_n_t hhiissttoorryy__bbaassee - The logical offset of the first entry in the history list. - - _i_n_t hhiissttoorryy__lleennggtthh - The number of entries currently stored in the history - list. - - - - -GNU History 4.3 2002 January 31 8 - - - - - -HISTORY(3) HISTORY(3) - - - _i_n_t hhiissttoorryy__mmaaxx__eennttrriieess - The maximum number of history entries. This must be - changed using ssttiiffllee__hhiissttoorryy(()). - - _c_h_a_r hhiissttoorryy__eexxppaannssiioonn__cchhaarr - The character that introduces a history event. The - default is !!. Setting this to 0 inhibits history expan- - sion. - - _c_h_a_r hhiissttoorryy__ssuubbsstt__cchhaarr - The character that invokes word substitution if found at - the start of a line. The default is ^^. - - _c_h_a_r hhiissttoorryy__ccoommmmeenntt__cchhaarr - During tokenization, if this character is seen as the - first character of a word, then it and all subsequent - characters up to a newline are ignored, suppressing his- - tory expansion for the remainder of the line. This is - disabled by default. - - _c_h_a_r _* hhiissttoorryy__wwoorrdd__ddeelliimmiitteerrss - The characters that separate tokens for hhiissttoorryy__ttookk-- - eenniizzee(()). The default value is "" \\tt\\nn(())<<>>;;&&||"". - - _c_h_a_r _* hhiissttoorryy__nnoo__eexxppaanndd__cchhaarrss - The list of characters which inhibit history expansion if - found immediately following hhiissttoorryy__eexxppaannssiioonn__cchhaarr. The - default is space, tab, newline, \\rr, and ==. - - _c_h_a_r _* hhiissttoorryy__sseeaarrcchh__ddeelliimmiitteerr__cchhaarrss - The list of additional characters which can delimit a his- - tory search string, in addition to space, tab, _: and _? in - the case of a substring search. The default is empty. - - _i_n_t hhiissttoorryy__qquuootteess__iinnhhiibbiitt__eexxppaannssiioonn - If non-zero, single-quoted words are not scanned for the - history expansion character. The default value is 0. - - _r_l___l_i_n_e_b_u_f___f_u_n_c___t _* hhiissttoorryy__iinnhhiibbiitt__eexxppaannssiioonn__ffuunnccttiioonn - This should be set to the address of a function that takes - two arguments: a cchhaarr ** (_s_t_r_i_n_g) and an iinntt index into - that string (_i). It should return a non-zero value if the - history expansion starting at _s_t_r_i_n_g_[_i_] should not be per- - formed; zero if the expansion should be done. It is - intended for use by applications like bbaasshh that use the - history expansion character for additional purposes. By - default, this variable is set to NNUULLLL. - -FFIILLEESS - _~_/_._h_i_s_t_o_r_y - Default filename for reading and writing saved his- - tory - - - - - -GNU History 4.3 2002 January 31 9 - - - - - -HISTORY(3) HISTORY(3) - - -SSEEEE AALLSSOO - _T_h_e _G_n_u _R_e_a_d_l_i_n_e _L_i_b_r_a_r_y, Brian Fox and Chet Ramey - _T_h_e _G_n_u _H_i_s_t_o_r_y _L_i_b_r_a_r_y, Brian Fox and Chet Ramey - _b_a_s_h(1) - _r_e_a_d_l_i_n_e(3) - -AAUUTTHHOORRSS - Brian Fox, Free Software Foundation - bfox@gnu.org - - Chet Ramey, Case Western Reserve University - chet@ins.CWRU.Edu - -BBUUGG RREEPPOORRTTSS - If you find a bug in the hhiissttoorryy library, you should - report it. But first, you should make sure that it really - is a bug, and that it appears in the latest version of the - hhiissttoorryy library that you have. - - Once you have determined that a bug actually exists, mail - a bug report to _b_u_g_-_r_e_a_d_l_i_n_e@_g_n_u_._o_r_g. If you have a fix, - you are welcome to mail that as well! Suggestions and - `philosophical' bug reports may be mailed to _b_u_g_-_r_e_a_d_- - _l_i_n_e@_g_n_u_._o_r_g or posted to the Usenet newsgroup - ggnnuu..bbaasshh..bbuugg. - - Comments and bug reports concerning this manual page - should be directed to _c_h_e_t_@_i_n_s_._C_W_R_U_._E_d_u. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -GNU History 4.3 2002 January 31 10 - - diff --git a/readline/doc/history.3 b/readline/doc/history.3 deleted file mode 100644 index ed0cb9f84e..0000000000 --- a/readline/doc/history.3 +++ /dev/null @@ -1,640 +0,0 @@ -.\" -.\" MAN PAGE COMMENTS to -.\" -.\" Chet Ramey -.\" Information Network Services -.\" Case Western Reserve University -.\" chet@ins.CWRU.Edu -.\" -.\" Last Change: Thu Jan 31 16:08:07 EST 2002 -.\" -.TH HISTORY 3 "2002 January 31" "GNU History 4.3" -.\" -.\" File Name macro. This used to be `.PN', for Path Name, -.\" but Sun doesn't seem to like that very much. -.\" -.de FN -\fI\|\\$1\|\fP -.. -.ds lp \fR\|(\fP -.ds rp \fR\|)\fP -.\" FnN return-value fun-name N arguments -.de Fn1 -\fI\\$1\fP \fB\\$2\fP \\*(lp\fI\\$3\fP\\*(rp -.br -.. -.de Fn2 -.if t \fI\\$1\fP \fB\\$2\fP \\*(lp\fI\\$3,\|\\$4\fP\\*(rp -.if n \fI\\$1\fP \fB\\$2\fP \\*(lp\fI\\$3, \\$4\fP\\*(rp -.br -.. -.de Fn3 -.if t \fI\\$1\fP \fB\\$2\fP \\*(lp\fI\\$3,\|\\$4,\|\\$5\fP\|\\*(rp -.if n \fI\\$1\fP \fB\\$2\fP \\*(lp\fI\\$3, \\$4, \\$5\fP\\*(rp -.br -.. -.de Vb -\fI\\$1\fP \fB\\$2\fP -.br -.. -.SH NAME -history \- GNU History Library -.SH COPYRIGHT -.if t The GNU History Library is Copyright \(co 1989-2002 by the Free Software Foundation, Inc. -.if n The GNU History Library is Copyright (C) 1989-2002 by the Free Software Foundation, Inc. -.SH DESCRIPTION -Many programs read input from the user a line at a time. The GNU -History library is able to keep track of those lines, associate arbitrary -data with each line, and utilize information from previous lines in -composing new ones. -.PP -.SH "HISTORY EXPANSION" -.PP -The history library supports a history expansion feature that -is identical to the history expansion in -.BR bash. -This section describes what syntax features are available. -.PP -History expansions introduce words from the history list into -the input stream, making it easy to repeat commands, insert the -arguments to a previous command into the current input line, or -fix errors in previous commands quickly. -.PP -History expansion is usually performed immediately after a complete line -is read. -It takes place in two parts. -The first is to determine which line from the history list -to use during substitution. -The second is to select portions of that line for inclusion into -the current one. -The line selected from the history is the \fIevent\fP, -and the portions of that line that are acted upon are \fIwords\fP. -Various \fImodifiers\fP are available to manipulate the selected words. -The line is broken into words in the same fashion as \fBbash\fP -does when reading input, -so that several words that would otherwise be separated -are considered one word when surrounded by quotes (see the -description of \fBhistory_tokenize()\fP below). -History expansions are introduced by the appearance of the -history expansion character, which is \^\fB!\fP\^ by default. -Only backslash (\^\fB\e\fP\^) and single quotes can quote -the history expansion character. -.SS Event Designators -.PP -An event designator is a reference to a command line entry in the -history list. -.PP -.PD 0 -.TP -.B ! -Start a history substitution, except when followed by a -.BR blank , -newline, = or (. -.TP -.B !\fIn\fR -Refer to command line -.IR n . -.TP -.B !\-\fIn\fR -Refer to the current command line minus -.IR n . -.TP -.B !! -Refer to the previous command. This is a synonym for `!\-1'. -.TP -.B !\fIstring\fR -Refer to the most recent command starting with -.IR string . -.TP -.B !?\fIstring\fR\fB[?]\fR -Refer to the most recent command containing -.IR string . -The trailing \fB?\fP may be omitted if -.I string -is followed immediately by a newline. -.TP -.B \d\s+2^\s-2\u\fIstring1\fP\d\s+2^\s-2\u\fIstring2\fP\d\s+2^\s-2\u -Quick substitution. Repeat the last command, replacing -.I string1 -with -.IR string2 . -Equivalent to -``!!:s/\fIstring1\fP/\fIstring2\fP/'' -(see \fBModifiers\fP below). -.TP -.B !# -The entire command line typed so far. -.PD -.SS Word Designators -.PP -Word designators are used to select desired words from the event. -A -.B : -separates the event specification from the word designator. -It may be omitted if the word designator begins with a -.BR ^ , -.BR $ , -.BR * , -.BR \- , -or -.BR % . -Words are numbered from the beginning of the line, -with the first word being denoted by 0 (zero). -Words are inserted into the current line separated by single spaces. -.PP -.PD 0 -.TP -.B 0 (zero) -The zeroth word. For the shell, this is the command -word. -.TP -.I n -The \fIn\fRth word. -.TP -.B ^ -The first argument. That is, word 1. -.TP -.B $ -The last argument. -.TP -.B % -The word matched by the most recent `?\fIstring\fR?' search. -.TP -.I x\fB\-\fPy -A range of words; `\-\fIy\fR' abbreviates `0\-\fIy\fR'. -.TP -.B * -All of the words but the zeroth. This is a synonym -for `\fI1\-$\fP'. It is not an error to use -.B * -if there is just one -word in the event; the empty string is returned in that case. -.TP -.B x* -Abbreviates \fIx\-$\fP. -.TP -.B x\- -Abbreviates \fIx\-$\fP like \fBx*\fP, but omits the last word. -.PD -.PP -If a word designator is supplied without an event specification, the -previous command is used as the event. -.SS Modifiers -.PP -After the optional word designator, there may appear a sequence of -one or more of the following modifiers, each preceded by a `:'. -.PP -.PD 0 -.PP -.TP -.B h -Remove a trailing file name component, leaving only the head. -.TP -.B t -Remove all leading file name components, leaving the tail. -.TP -.B r -Remove a trailing suffix of the form \fI.xxx\fP, leaving the -basename. -.TP -.B e -Remove all but the trailing suffix. -.TP -.B p -Print the new command but do not execute it. -.TP -.B q -Quote the substituted words, escaping further substitutions. -.TP -.B x -Quote the substituted words as with -.BR q , -but break into words at -.B blanks -and newlines. -.TP -.B s/\fIold\fP/\fInew\fP/ -Substitute -.I new -for the first occurrence of -.I old -in the event line. Any delimiter can be used in place of /. The -final delimiter is optional if it is the last character of the -event line. The delimiter may be quoted in -.I old -and -.I new -with a single backslash. If & appears in -.IR new , -it is replaced by -.IR old . -A single backslash will quote the &. If -.I old -is null, it is set to the last -.I old -substituted, or, if no previous history substitutions took place, -the last -.I string -in a -.B !?\fIstring\fR\fB[?]\fR -search. -.TP -.B & -Repeat the previous substitution. -.TP -.B g -Cause changes to be applied over the entire event line. This is -used in conjunction with `\fB:s\fP' (e.g., `\fB:gs/\fIold\fP/\fInew\fP/\fR') -or `\fB:&\fP'. If used with -`\fB:s\fP', any delimiter can be used -in place of /, and the final delimiter is optional -if it is the last character of the event line. -.PD -.SH "PROGRAMMING WITH HISTORY FUNCTIONS" -This section describes how to use the History library in other programs. -.SS Introduction to History -.PP -The programmer using the History library has available functions -for remembering lines on a history list, associating arbitrary data -with a line, removing lines from the list, searching through the list -for a line containing an arbitrary text string, and referencing any line -in the list directly. In addition, a history \fIexpansion\fP function -is available which provides for a consistent user interface across -different programs. -.PP -The user using programs written with the History library has the -benefit of a consistent user interface with a set of well-known -commands for manipulating the text of previous lines and using that text -in new commands. The basic history manipulation commands are -identical to -the history substitution provided by \fBbash\fP. -.PP -If the programmer desires, he can use the Readline library, which -includes some history manipulation by default, and has the added -advantage of command line editing. -.PP -Before declaring any functions using any functionality the History -library provides in other code, an application writer should include -the file -.FN -in any file that uses the -History library's features. It supplies extern declarations for all -of the library's public functions and variables, and declares all of -the public data structures. - -.SS History Storage -.PP -The history list is an array of history entries. A history entry is -declared as follows: -.PP -.Vb "typedef void *" histdata_t; -.PP -.nf -typedef struct _hist_entry { - char *line; - histdata_t data; -} HIST_ENTRY; -.fi -.PP -The history list itself might therefore be declared as -.PP -.Vb "HIST_ENTRY **" the_history_list; -.PP -The state of the History library is encapsulated into a single structure: -.PP -.nf -/* - * A structure used to pass around the current state of the history. - */ -typedef struct _hist_state { - HIST_ENTRY **entries; /* Pointer to the entries themselves. */ - int offset; /* The location pointer within this array. */ - int length; /* Number of elements within this array. */ - int size; /* Number of slots allocated to this array. */ - int flags; -} HISTORY_STATE; -.fi -.PP -If the flags member includes \fBHS_STIFLED\fP, the history has been -stifled. -.SH "History Functions" -.PP -This section describes the calling sequence for the various functions -exported by the GNU History library. -.SS Initializing History and State Management -This section describes functions used to initialize and manage -the state of the History library when you want to use the history -functions in your program. - -.Fn1 void using_history void -Begin a session in which the history functions might be used. This -initializes the interactive variables. - -.Fn1 "HISTORY_STATE *" history_get_history_state void -Return a structure describing the current state of the input history. - -.Fn1 void history_set_history_state "HISTORY_STATE *state" -Set the state of the history list according to \fIstate\fP. - -.SS History List Management - -These functions manage individual entries on the history list, or set -parameters managing the list itself. - -.Fn1 void add_history "const char *string" -Place \fIstring\fP at the end of the history list. The associated data -field (if any) is set to \fBNULL\fP. - -.Fn1 "HIST_ENTRY *" remove_history "int which" -Remove history entry at offset \fIwhich\fP from the history. The -removed element is returned so you can free the line, data, -and containing structure. - -.Fn3 "HIST_ENTRY *" replace_history_entry "int which" "const char *line" "histdata_t data" -Make the history entry at offset \fIwhich\fP have \fIline\fP and \fIdata\fP. -This returns the old entry so you can dispose of the data. In the case -of an invalid \fIwhich\fP, a \fBNULL\fP pointer is returned. - -.Fn1 void clear_history "void" -Clear the history list by deleting all the entries. - -.Fn1 void stifle_history "int max" -Stifle the history list, remembering only the last \fImax\fP entries. - -.Fn1 int unstifle_history "void" -Stop stifling the history. This returns the previously-set -maximum number of history entries (as set by \fBstifle_history()\fP). -history was stifled. The value is positive if the history was -stifled, negative if it wasn't. - -.Fn1 int history_is_stifled "void" -Returns non-zero if the history is stifled, zero if it is not. - -.SS Information About the History List - -These functions return information about the entire history list or -individual list entries. - -.Fn1 "HIST_ENTRY **" history_list "void" -Return a \fBNULL\fP terminated array of \fIHIST_ENTRY *\fP which is the -current input history. Element 0 of this list is the beginning of time. -If there is no history, return \fBNULL\fP. - -.Fn1 int where_history "void" -Returns the offset of the current history element. - -.Fn1 "HIST_ENTRY *" current_history "void" -Return the history entry at the current position, as determined by -\fBwhere_history()\fP. If there is no entry there, return a \fBNULL\fP -pointer. - -.Fn1 "HIST_ENTRY *" history_get "int offset" -Return the history entry at position \fIoffset\fP, starting from -\fBhistory_base\fP. -If there is no entry there, or if \fIoffset\fP -is greater than the history length, return a \fBNULL\fP pointer. - -.Fn1 int history_total_bytes "void" -Return the number of bytes that the primary history entries are using. -This function returns the sum of the lengths of all the lines in the -history. - -.SS Moving Around the History List - -These functions allow the current index into the history list to be -set or changed. - -.Fn1 int history_set_pos "int pos" -Set the current history offset to \fIpos\fP, an absolute index -into the list. -Returns 1 on success, 0 if \fIpos\fP is less than zero or greater -than the number of history entries. - -.Fn1 "HIST_ENTRY *" previous_history "void" -Back up the current history offset to the previous history entry, and -return a pointer to that entry. If there is no previous entry, return -a \fBNULL\fP pointer. - -.Fn1 "HIST_ENTRY *" next_history "void" -Move the current history offset forward to the next history entry, and -return the a pointer to that entry. If there is no next entry, return -a \fBNULL\fP pointer. - -.SS Searching the History List - -These functions allow searching of the history list for entries containing -a specific string. Searching may be performed both forward and backward -from the current history position. The search may be \fIanchored\fP, -meaning that the string must match at the beginning of the history entry. - -.Fn2 int history_search "const char *string" "int direction" -Search the history for \fIstring\fP, starting at the current history offset. -If \fIdirection\fP is less than 0, then the search is through -previous entries, otherwise through subsequent entries. -If \fIstring\fP is found, then -the current history index is set to that history entry, and the value -returned is the offset in the line of the entry where -\fIstring\fP was found. Otherwise, nothing is changed, and a -1 is -returned. - -.Fn2 int history_search_prefix "const char *string" "int direction" -Search the history for \fIstring\fP, starting at the current history -offset. The search is anchored: matching lines must begin with -\fIstring\fP. If \fIdirection\fP is less than 0, then the search is -through previous entries, otherwise through subsequent entries. -If \fIstring\fP is found, then the -current history index is set to that entry, and the return value is 0. -Otherwise, nothing is changed, and a -1 is returned. - -.Fn3 int history_search_pos "const char *string" "int direction" "int pos" -Search for \fIstring\fP in the history list, starting at \fIpos\fP, an -absolute index into the list. If \fIdirection\fP is negative, the search -proceeds backward from \fIpos\fP, otherwise forward. Returns the absolute -index of the history element where \fIstring\fP was found, or -1 otherwise. - -.SS Managing the History File -The History library can read the history from and write it to a file. -This section documents the functions for managing a history file. - -.Fn1 int read_history "const char *filename" -Add the contents of \fIfilename\fP to the history list, a line at a time. -If \fIfilename\fP is \fBNULL\fP, then read from \fI~/.history\fP. -Returns 0 if successful, or \fBerrno\fP if not. - -.Fn3 int read_history_range "const char *filename" "int from" "int to" -Read a range of lines from \fIfilename\fP, adding them to the history list. -Start reading at line \fIfrom\fP and end at \fIto\fP. -If \fIfrom\fP is zero, start at the beginning. If \fIto\fP is less than -\fIfrom\fP, then read until the end of the file. If \fIfilename\fP is -\fBNULL\fP, then read from \fI~/.history\fP. Returns 0 if successful, -or \fBerrno\fP if not. - -.Fn1 int write_history "const char *filename" -Write the current history to \fIfilename\fP, overwriting \fIfilename\fP -if necessary. -If \fIfilename\fP is \fBNULL\fP, then write the history list to \fI~/.history\fP. -Returns 0 on success, or \fBerrno\fP on a read or write error. - - -.Fn2 int append_history "int nelements" "const char *filename" -Append the last \fInelements\fP of the history list to \fIfilename\fP. -If \fIfilename\fP is \fBNULL\fP, then append to \fI~/.history\fP. -Returns 0 on success, or \fBerrno\fP on a read or write error. - -.Fn2 int history_truncate_file "const char *filename" "int nlines" -Truncate the history file \fIfilename\fP, leaving only the last -\fInlines\fP lines. -If \fIfilename\fP is \fBNULL\fP, then \fI~/.history\fP is truncated. -Returns 0 on success, or \fBerrno\fP on failure. - -.SS History Expansion - -These functions implement history expansion. - -.Fn2 int history_expand "char *string" "char **output" -Expand \fIstring\fP, placing the result into \fIoutput\fP, a pointer -to a string. Returns: -.RS -.PD 0 -.TP -0 -If no expansions took place (or, if the only change in -the text was the removal of escape characters preceding the history expansion -character); -.TP -1 -if expansions did take place; -.TP --1 -if there was an error in expansion; -.TP -2 -if the returned line should be displayed, but not executed, -as with the \fB:p\fP modifier. -.PD -.RE -If an error ocurred in expansion, then \fIoutput\fP contains a descriptive -error message. - -.Fn3 "char *" get_history_event "const char *string" "int *cindex" "int qchar" -Returns the text of the history event beginning at \fIstring\fP + -\fI*cindex\fP. \fI*cindex\fP is modified to point to after the event -specifier. At function entry, \fIcindex\fP points to the index into -\fIstring\fP where the history event specification begins. \fIqchar\fP -is a character that is allowed to end the event specification in addition -to the ``normal'' terminating characters. - -.Fn1 "char **" history_tokenize "const char *string" -Return an array of tokens parsed out of \fIstring\fP, much as the -shell might. -The tokens are split on the characters in the -\fBhistory_word_delimiters\fP variable, -and shell quoting conventions are obeyed. - -.Fn3 "char *" history_arg_extract "int first" "int last" "const char *string" -Extract a string segment consisting of the \fIfirst\fP through \fIlast\fP -arguments present in \fIstring\fP. Arguments are split using -\fBhistory_tokenize()\fP. - -.SS History Variables - -This section describes the externally-visible variables exported by -the GNU History Library. - -.Vb int history_base -The logical offset of the first entry in the history list. - -.Vb int history_length -The number of entries currently stored in the history list. - -.Vb int history_max_entries -The maximum number of history entries. This must be changed using -\fBstifle_history()\fP. - -.Vb char history_expansion_char -The character that introduces a history event. The default is \fB!\fP. -Setting this to 0 inhibits history expansion. - -.Vb char history_subst_char -The character that invokes word substitution if found at the start of -a line. The default is \fB^\fP. - -.Vb char history_comment_char -During tokenization, if this character is seen as the first character -of a word, then it and all subsequent characters up to a newline are -ignored, suppressing history expansion for the remainder of the line. -This is disabled by default. - -.Vb "char *" history_word_delimiters -The characters that separate tokens for \fBhistory_tokenize()\fP. -The default value is \fB"\ \et\en()<>;&|"\fP. - -.Vb "char *" history_no_expand_chars -The list of characters which inhibit history expansion if found immediately -following \fBhistory_expansion_char\fP. The default is space, tab, newline, -\fB\er\fP, and \fB=\fP. - -.Vb "char *" history_search_delimiter_chars -The list of additional characters which can delimit a history search -string, in addition to space, tab, \fI:\fP and \fI?\fP in the case of -a substring search. The default is empty. - -.Vb int history_quotes_inhibit_expansion -If non-zero, single-quoted words are not scanned for the history expansion -character. The default value is 0. - -.Vb "rl_linebuf_func_t *" history_inhibit_expansion_function -This should be set to the address of a function that takes two arguments: -a \fBchar *\fP (\fIstring\fP) -and an \fBint\fP index into that string (\fIi\fP). -It should return a non-zero value if the history expansion starting at -\fIstring[i]\fP should not be performed; zero if the expansion should -be done. -It is intended for use by applications like \fBbash\fP that use the history -expansion character for additional purposes. -By default, this variable is set to \fBNULL\fP. -.SH FILES -.PD 0 -.TP -.FN ~/.history -Default filename for reading and writing saved history -.PD -.SH "SEE ALSO" -.PD 0 -.TP -\fIThe Gnu Readline Library\fP, Brian Fox and Chet Ramey -.TP -\fIThe Gnu History Library\fP, Brian Fox and Chet Ramey -.TP -\fIbash\fP(1) -.TP -\fIreadline\fP(3) -.PD -.SH AUTHORS -Brian Fox, Free Software Foundation -.br -bfox@gnu.org -.PP -Chet Ramey, Case Western Reserve University -.br -chet@ins.CWRU.Edu -.SH BUG REPORTS -If you find a bug in the -.B history -library, you should report it. But first, you should -make sure that it really is a bug, and that it appears in the latest -version of the -.B history -library that you have. -.PP -Once you have determined that a bug actually exists, mail a -bug report to \fIbug\-readline\fP@\fIgnu.org\fP. -If you have a fix, you are welcome to mail that -as well! Suggestions and `philosophical' bug reports may be mailed -to \fPbug-readline\fP@\fIgnu.org\fP or posted to the Usenet -newsgroup -.BR gnu.bash.bug . -.PP -Comments and bug reports concerning -this manual page should be directed to -.IR chet@ins.CWRU.Edu . diff --git a/readline/doc/history_3.ps b/readline/doc/history_3.ps deleted file mode 100644 index f5231a52de..0000000000 --- a/readline/doc/history_3.ps +++ /dev/null @@ -1,800 +0,0 @@ -%!PS-Adobe-3.0 -%%Creator: groff version 1.16.1 -%%CreationDate: Mon Mar 18 10:17:27 2002 -%%DocumentNeededResources: font Times-Roman -%%+ font Times-Bold -%%+ font Times-Italic -%%DocumentSuppliedResources: procset grops 1.16 1 -%%Pages: 7 -%%PageOrder: Ascend -%%Orientation: Portrait -%%EndComments -%%BeginProlog -%%BeginResource: procset grops 1.16 1 -/setpacking where{ -pop -currentpacking -true setpacking -}if -/grops 120 dict dup begin -/SC 32 def -/A/show load def -/B{0 SC 3 -1 roll widthshow}bind def -/C{0 exch ashow}bind def -/D{0 exch 0 SC 5 2 roll awidthshow}bind def -/E{0 rmoveto show}bind def -/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def -/G{0 rmoveto 0 exch ashow}bind def -/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def -/I{0 exch rmoveto show}bind def -/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def -/K{0 exch rmoveto 0 exch ashow}bind def -/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def -/M{rmoveto show}bind def -/N{rmoveto 0 SC 3 -1 roll widthshow}bind def -/O{rmoveto 0 exch ashow}bind def -/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def -/Q{moveto show}bind def -/R{moveto 0 SC 3 -1 roll widthshow}bind def -/S{moveto 0 exch ashow}bind def -/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def -/SF{ -findfont exch -[exch dup 0 exch 0 exch neg 0 0]makefont -dup setfont -[exch/setfont cvx]cvx bind def -}bind def -/MF{ -findfont -[5 2 roll -0 3 1 roll -neg 0 0]makefont -dup setfont -[exch/setfont cvx]cvx bind def -}bind def -/level0 0 def -/RES 0 def -/PL 0 def -/LS 0 def -/MANUAL{ -statusdict begin/manualfeed true store end -}bind def -/PLG{ -gsave newpath clippath pathbbox grestore -exch pop add exch pop -}bind def -/BP{ -/level0 save def -1 setlinecap -1 setlinejoin -72 RES div dup scale -LS{ -90 rotate -}{ -0 PL translate -}ifelse -1 -1 scale -}bind def -/EP{ -level0 restore -showpage -}bind def -/DA{ -newpath arcn stroke -}bind def -/SN{ -transform -.25 sub exch .25 sub exch -round .25 add exch round .25 add exch -itransform -}bind def -/DL{ -SN -moveto -SN -lineto stroke -}bind def -/DC{ -newpath 0 360 arc closepath -}bind def -/TM matrix def -/DE{ -TM currentmatrix pop -translate scale newpath 0 0 .5 0 360 arc closepath -TM setmatrix -}bind def -/RC/rcurveto load def -/RL/rlineto load def -/ST/stroke load def -/MT/moveto load def -/CL/closepath load def -/FL{ -currentgray exch setgray fill setgray -}bind def -/BL/fill load def -/LW/setlinewidth load def -/RE{ -findfont -dup maxlength 1 index/FontName known not{1 add}if dict begin -{ -1 index/FID ne{def}{pop pop}ifelse -}forall -/Encoding exch def -dup/FontName exch def -currentdict end definefont pop -}bind def -/DEFS 0 def -/EBEGIN{ -moveto -DEFS begin -}bind def -/EEND/end load def -/CNT 0 def -/level1 0 def -/PBEGIN{ -/level1 save def -translate -div 3 1 roll div exch scale -neg exch neg exch translate -0 setgray -0 setlinecap -1 setlinewidth -0 setlinejoin -10 setmiterlimit -[]0 setdash -/setstrokeadjust where{ -pop -false setstrokeadjust -}if -/setoverprint where{ -pop -false setoverprint -}if -newpath -/CNT countdictstack def -userdict begin -/showpage{}def -}bind def -/PEND{ -clear -countdictstack CNT sub{end}repeat -level1 restore -}bind def -end def -/setpacking where{ -pop -setpacking -}if -%%EndResource -%%IncludeResource: font Times-Roman -%%IncludeResource: font Times-Bold -%%IncludeResource: font Times-Italic -grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 -def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron -/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef -/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef -/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef -/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent -/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen -/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon -/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O -/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex -/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y -/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft -/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl -/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut -/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash -/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen -/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft -/logicalnot/minus/registered/macron/degree/plusminus/twosuperior -/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior -/ordmasculine/guilsinglright/onequarter/onehalf/threequarters -/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE -/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex -/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis -/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn -/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla -/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis -/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash -/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def -/Times-Italic@0 ENC0/Times-Italic RE/Times-Bold@0 ENC0/Times-Bold RE -/Times-Roman@0 ENC0/Times-Roman RE -%%EndProlog -%%Page: 1 1 -%%BeginPageSetup -BP -%%EndPageSetup -/F0 10/Times-Roman@0 SF(HIST)72 48 Q(OR)-.18 E 357.18(Y\(3\) HIST)-.65 F -(OR)-.18 E(Y\(3\))-.65 E/F1 10.95/Times-Bold@0 SF -.219(NA)72 84 S(ME) -.219 E F0(history \255 GNU History Library)108 96 Q F1(COPYRIGHT)72 -112.8 Q F0(The GNU History Library is Cop)108 124.8 Q -(yright \251 1989-2002 by the Free Softw)-.1 E(are F)-.1 E -(oundation, Inc.)-.15 E F1(DESCRIPTION)72 141.6 Q F0(Man)108 153.6 Q -2.81(yp)-.15 G .31(rograms read input from the user a line at a time.) --2.81 F .309(The GNU History library is able to k)5.309 F .309 -(eep track of)-.1 F .024(those lines, associate arbitrary data with eac\ -h line, and utilize information from pre)108 165.6 R .024 -(vious lines in composing)-.25 F(ne)108 177.6 Q 2.5(wo)-.25 G(nes.)-2.5 -E F1(HIST)72 199.2 Q(OR)-.197 E 2.738(YE)-.383 G(XP)-2.738 E(ANSION)-.81 -E F0 .823(The history library supports a history e)108 211.2 R .822 -(xpansion feature that is identical to the history e)-.15 F .822 -(xpansion in)-.15 F/F2 10/Times-Bold@0 SF(bash.)3.322 E F0 -(This section describes what syntax features are a)108 223.2 Q -.25(va) --.2 G(ilable.).25 E 1.305(History e)108 240 R 1.305 -(xpansions introduce w)-.15 F 1.306(ords from the history list into the\ - input stream, making it easy to repeat)-.1 F .21 -(commands, insert the ar)108 252 R .21(guments to a pre)-.18 F .209 -(vious command into the current input line, or \214x errors in pre)-.25 -F(vious)-.25 E(commands quickly)108 264 Q(.)-.65 E 1.296(History e)108 -280.8 R 1.297(xpansion is usually performed immediately after a complet\ -e line is read.)-.15 F 1.297(It tak)6.297 F 1.297(es place in tw)-.1 F -(o)-.1 E 2.855(parts. The)108 292.8 R .354(\214rst is to determine whic\ -h line from the history list to use during substitution.)2.855 F .354 -(The second is to)5.354 F .116 -(select portions of that line for inclusion into the current one.)108 -304.8 R .117(The line selected from the history is the)5.116 F/F3 10 -/Times-Italic@0 SF -.15(ev)2.617 G(ent).15 E F0(,)A .846 -(and the portions of that line that are acted upon are)108 316.8 R F3 -(wor)3.346 E(ds)-.37 E F0 5.846(.V)C(arious)-6.956 E F3(modi\214er)3.346 -E(s)-.1 E F0 .846(are a)3.346 F -.25(va)-.2 G .845(ilable to manipulate) -.25 F .304(the selected w)108 328.8 R 2.804(ords. The)-.1 F .304 -(line is brok)2.804 F .304(en into w)-.1 F .304(ords in the same f)-.1 F -.304(ashion as)-.1 F F2(bash)2.804 E F0 .305 -(does when reading input, so)2.804 F .539(that se)108 340.8 R -.15(ve) --.25 G .539(ral w).15 F .539(ords that w)-.1 F .539 -(ould otherwise be separated are considered one w)-.1 F .538 -(ord when surrounded by quotes)-.1 F .307(\(see the description of)108 -352.8 R F2(history_tok)2.807 E(enize\(\))-.1 E F0(belo)2.807 E 2.807 -(w\). History)-.25 F -.15(ex)2.807 G .307 -(pansions are introduced by the appearance of).15 F .52(the history e) -108 364.8 R .52(xpansion character)-.15 F 3.02(,w)-.4 G .52(hich is) --3.02 F F2(!)3.853 E F0 .52(by def)3.853 F 3.02(ault. Only)-.1 F .52 -(backslash \()3.02 F F2(\\).833 E F0 3.02(\)a).833 G .52 -(nd single quotes can quote the)-3.02 F(history e)108 376.8 Q -(xpansion character)-.15 E(.)-.55 E F2(Ev)87 393.6 Q(ent Designators)-.1 -E F0(An e)108 405.6 Q -.15(ve)-.25 G(nt designator is a reference to a \ -command line entry in the history list.).15 E F2(!)108 422.4 Q F0 -(Start a history substitution, e)32.67 E(xcept when follo)-.15 E -(wed by a)-.25 E F2(blank)2.5 E F0 2.5(,n)C -.25(ew)-2.5 G -(line, = or \(.).25 E F2(!)108 434.4 Q F3(n)A F0(Refer to command line) -27.67 E F3(n)2.5 E F0(.).24 E F2<21ad>108 446.4 Q F3(n)A F0 -(Refer to the current command line minus)21.97 E F3(n)2.5 E F0(.).24 E -F2(!!)108 458.4 Q F0(Refer to the pre)29.34 E(vious command.)-.25 E -(This is a synon)5 E(ym for `!\2551'.)-.15 E F2(!)108 470.4 Q F3(string) -A F0(Refer to the most recent command starting with)9.33 E F3(string)2.5 -E F0(.).22 E F2(!?)108 482.4 Q F3(string)A F2([?])A F0 1.057 -(Refer to the most recent command containing)144 494.4 R F3(string)3.557 -E F0 6.057(.T).22 G 1.057(he trailing)-6.057 F F2(?)3.557 E F0 1.057 -(may be omitted if)3.557 F F3(string)3.557 E F0(is)3.557 E(follo)144 -506.4 Q(wed immediately by a ne)-.25 E(wline.)-.25 E/F4 12/Times-Bold@0 -SF(^)108 523.4 Q F3(string1)-5 I F4(^)5 I F3(string2)-5 I F4(^)5 I F0 -2.66(Quick substitution.)144 530.4 R 2.66 -(Repeat the last command, replacing)7.66 F F3(string1)5.16 E F0(with) -5.16 E F3(string2)5.16 E F0 7.66(.E).02 G(qui)-7.66 E -.25(va)-.25 G -2.66(lent to).25 F -.74(``)144 542.4 S(!!:s/).74 E F3(string1)A F0(/)A -F3(string2)A F0(/')A 2.5('\()-.74 G(see)-2.5 E F2(Modi\214ers)2.5 E F0 -(belo)2.5 E(w\).)-.25 E F2(!#)108 554.4 Q F0 -(The entire command line typed so f)27.67 E(ar)-.1 E(.)-.55 E F2 -.75 -(Wo)87 571.2 S(rd Designators).75 E F0 -.8(Wo)108 583.2 S 1.313 -(rd designators are used to select desired w).8 F 1.314(ords from the e) --.1 F -.15(ve)-.25 G 3.814(nt. A).15 F F2(:)3.814 E F0 1.314 -(separates the e)3.814 F -.15(ve)-.25 G 1.314(nt speci\214cation).15 F -.53(from the w)108 595.2 R .529(ord designator)-.1 F 5.529(.I)-.55 G -3.029(tm)-5.529 G .529(ay be omitted if the w)-3.029 F .529 -(ord designator be)-.1 F .529(gins with a)-.15 F F2(^)3.029 E F0(,)A F2 -($)3.029 E F0(,)A F2(*)3.029 E F0(,)A F23.029 E F0 3.029(,o)C(r) --3.029 E F2(%)3.029 E F0 5.529(.W)C(ords)-6.329 E 1.3 -(are numbered from the be)108 607.2 R 1.3 -(ginning of the line, with the \214rst w)-.15 F 1.301 -(ord being denoted by 0 \(zero\).)-.1 F -.8(Wo)6.301 G 1.301(rds are).8 -F(inserted into the current line separated by single spaces.)108 619.2 Q -F2 2.5(0\()108 636 S(zer)-2.5 E(o\))-.18 E F0(The zeroth w)144 648 Q 2.5 -(ord. F)-.1 F(or the shell, this is the command w)-.15 E(ord.)-.1 E F3 -(n)108 660 Q F0(The)31 E F3(n)2.5 E F0(th w)A(ord.)-.1 E F2(^)108 672 Q -F0(The \214rst ar)32.67 E 2.5(gument. That)-.18 F(is, w)2.5 E(ord 1.)-.1 -E F2($)108 684 Q F0(The last ar)31 E(gument.)-.18 E F2(%)108 696 Q F0 -(The w)26 E(ord matched by the most recent `?)-.1 E F3(string)A F0 -(?' search.)A F3(x)108 708 Q F2A F3(y)A F0 2.5(Ar)21.42 G(ange of w) --2.5 E(ords; `\255)-.1 E F3(y)A F0 2.5('a)C(bbre)-2.5 E(viates `0\255) --.25 E F3(y)A F0('.)A(GNU History 4.3)72 768 Q(2002 January 31)131.79 E -(1)195.95 E EP -%%Page: 2 2 -%%BeginPageSetup -BP -%%EndPageSetup -/F0 10/Times-Roman@0 SF(HIST)72 48 Q(OR)-.18 E 357.18(Y\(3\) HIST)-.65 F -(OR)-.18 E(Y\(3\))-.65 E/F1 10/Times-Bold@0 SF(*)108 84 Q F0 .316 -(All of the w)31 F .316(ords b)-.1 F .316(ut the zeroth.)-.2 F .315 -(This is a synon)5.315 F .315(ym for `)-.15 F/F2 10/Times-Italic@0 SF -(1\255$)A F0 2.815('. It)B .315(is not an error to use)2.815 F F1(*) -2.815 E F0 .315(if there is)2.815 F(just one w)144 96 Q(ord in the e)-.1 -E -.15(ve)-.25 G(nt; the empty string is returned in that case.).15 E F1 -(x*)108 108 Q F0(Abbre)26 E(viates)-.25 E F2(x\255$)2.5 E F0(.)A F1 -<78ad>108 120 Q F0(Abbre)25.3 E(viates)-.25 E F2(x\255$)2.5 E F0(lik)2.5 -E(e)-.1 E F1(x*)2.5 E F0 2.5(,b)C(ut omits the last w)-2.7 E(ord.)-.1 E -(If a w)108 136.8 Q(ord designator is supplied without an e)-.1 E -.15 -(ve)-.25 G(nt speci\214cation, the pre).15 E -(vious command is used as the e)-.25 E -.15(ve)-.25 G(nt.).15 E F1 -(Modi\214ers)87 153.6 Q F0 .183(After the optional w)108 165.6 R .183 -(ord designator)-.1 F 2.683(,t)-.4 G .184 -(here may appear a sequence of one or more of the follo)-2.683 F .184 -(wing modi\214ers,)-.25 F(each preceded by a `:'.)108 177.6 Q F1(h)108 -194.4 Q F0(Remo)30.44 E .3 -.15(ve a t)-.15 H -(railing \214le name component, lea).15 E(ving only the head.)-.2 E F1 -(t)108 206.4 Q F0(Remo)32.67 E .3 -.15(ve a)-.15 H -(ll leading \214le name components, lea).15 E(ving the tail.)-.2 E F1(r) -108 218.4 Q F0(Remo)31.56 E .3 -.15(ve a t)-.15 H(railing suf).15 E -(\214x of the form)-.25 E F2(.xxx)2.5 E F0 2.5(,l)C(ea)-2.5 E -(ving the basename.)-.2 E F1(e)108 230.4 Q F0(Remo)31.56 E .3 -.15(ve a) --.15 H(ll b).15 E(ut the trailing suf)-.2 E(\214x.)-.25 E F1(p)108 242.4 -Q F0(Print the ne)30.44 E 2.5(wc)-.25 G(ommand b)-2.5 E(ut do not e)-.2 -E -.15(xe)-.15 G(cute it.).15 E F1(q)108 254.4 Q F0 -(Quote the substituted w)30.44 E(ords, escaping further substitutions.) --.1 E F1(x)108 266.4 Q F0(Quote the substituted w)31 E(ords as with)-.1 -E F1(q)2.5 E F0 2.5(,b)C(ut break into w)-2.7 E(ords at)-.1 E F1(blanks) -2.5 E F0(and ne)2.5 E(wlines.)-.25 E F1(s/)108 278.4 Q F2(old)A F1(/)A -F2(ne)A(w)-.15 E F1(/)A F0(Substitute)144 290.4 Q F2(ne)2.814 E(w)-.15 E -F0 .314(for the \214rst occurrence of)2.814 F F2(old)2.814 E F0 .314 -(in the e)2.814 F -.15(ve)-.25 G .314(nt line.).15 F(An)5.314 E 2.814 -(yd)-.15 G .314(elimiter can be used in place)-2.814 F .616(of /.)144 -302.4 R .617 -(The \214nal delimiter is optional if it is the last character of the e) -5.616 F -.15(ve)-.25 G .617(nt line.).15 F .617(The delimiter may)5.617 -F .75(be quoted in)144 314.4 R F2(old)3.25 E F0(and)3.25 E F2(ne)3.25 E -(w)-.15 E F0 .75(with a single backslash.)3.25 F .749(If & appears in) -5.75 F F2(ne)3.249 E(w)-.15 E F0 3.249(,i).31 G 3.249(ti)-3.249 G 3.249 -(sr)-3.249 G .749(eplaced by)-3.249 F F2(old)3.249 E F0 5.749(.A).77 G -.369(single backslash will quote the &.)144 326.4 R(If)5.369 E F2(old) -2.869 E F0 .37(is null, it is set to the last)2.869 F F2(old)2.87 E F0 -.37(substituted, or)2.87 F 2.87(,i)-.4 G 2.87(fn)-2.87 G 2.87(op)-2.87 G -(re)-2.87 E(vi-)-.25 E(ous history substitutions took place, the last) -144 338.4 Q F2(string)2.5 E F0(in a)2.5 E F1(!?)2.5 E F2(string)A F1 -([?])A F0(search.)5 E F1(&)108 350.4 Q F0(Repeat the pre)27.67 E -(vious substitution.)-.25 E F1(g)108 362.4 Q F0 .398 -(Cause changes to be applied o)31 F -.15(ve)-.15 G 2.898(rt).15 G .398 -(he entire e)-2.898 F -.15(ve)-.25 G .398(nt line.).15 F .397 -(This is used in conjunction with `)5.398 F F1(:s)A F0 2.897('\()C -(e.g.,)-2.897 E(`)144 374.4 Q F1(:gs/)A F2(old)A F1(/)A F2(ne)A(w)-.15 E -F1(/)A F0 1.218('\) or `)B F1(:&)A F0 3.718('. If)B 1.218(used with `) -3.718 F F1(:s)A F0 1.218(', an)B 3.718(yd)-.15 G 1.219 -(elimiter can be used in place of /, and the \214nal)-3.718 F -(delimiter is optional if it is the last character of the e)144 386.4 Q --.15(ve)-.25 G(nt line.).15 E/F3 10.95/Times-Bold@0 SF(PR)72 403.2 Q -(OGRAMMING WITH HIST)-.329 E(OR)-.197 E 2.738(YF)-.383 G(UNCTIONS)-2.738 -E F0(This section describes ho)108 415.2 Q 2.5(wt)-.25 G 2.5(ou)-2.5 G -(se the History library in other programs.)-2.5 E F1(Intr)87 432 Q -(oduction to History)-.18 E F0 .797 -(The programmer using the History library has a)108 444 R -.25(va)-.2 G -.796(ilable functions for remembering lines on a history list,).25 F -.307(associating arbitrary data with a line, remo)108 456 R .308 -(ving lines from the list, searching through the list for a line con-) --.15 F .303(taining an arbitrary te)108 468 R .303 -(xt string, and referencing an)-.15 F 2.803(yl)-.15 G .303 -(ine in the list directly)-2.803 F 5.303(.I)-.65 G 2.803(na)-5.303 G -.303(ddition, a history)-2.803 F F2 -.2(ex)2.802 G(pansion).2 E F0 -(function is a)108 480 Q -.25(va)-.2 G(ilable which pro).25 E -(vides for a consistent user interf)-.15 E(ace across dif)-.1 E -(ferent programs.)-.25 E .059(The user using programs written with the \ -History library has the bene\214t of a consistent user interf)108 496.8 -R .059(ace with a)-.1 F .918(set of well-kno)108 508.8 R .917 -(wn commands for manipulating the te)-.25 F .917(xt of pre)-.15 F .917 -(vious lines and using that te)-.25 F .917(xt in ne)-.15 F 3.417(wc)-.25 -G(om-)-3.417 E 4.183(mands. The)108 520.8 R 1.684(basic history manipul\ -ation commands are identical to the history substitution pro)4.183 F -1.684(vided by)-.15 F F1(bash)108 532.8 Q F0(.)A .904 -(If the programmer desires, he can use the Readline library)108 549.6 R -3.403(,w)-.65 G .903(hich includes some history manipulation by)-3.403 F -(def)108 561.6 Q(ault, and has the added adv)-.1 E -(antage of command line editing.)-.25 E .39(Before declaring an)108 -578.4 R 2.89(yf)-.15 G .39(unctions using an)-2.89 F 2.89(yf)-.15 G .39 -(unctionality the History library pro)-2.89 F .39 -(vides in other code, an appli-)-.15 F .067 -(cation writer should include the \214le)108 590.4 R F2()-.55 E F0 .067(in an)4.233 F 2.566<798c>-.15 -G .066(le that uses the History library')-2.566 F 2.566(sf)-.55 G -(eatures.)-2.566 E .538(It supplies e)108 602.4 R .538 -(xtern declarations for all of the library')-.15 F 3.038(sp)-.55 G .538 -(ublic functions and v)-3.038 F .539(ariables, and declares all of the) --.25 F(public data structures.)108 614.4 Q F1(History Storage)87 643.2 Q -F0(The history list is an array of history entries.)108 655.2 Q 2.5(Ah)5 -G(istory entry is declared as follo)-2.5 E(ws:)-.25 E F2(typedef void *) -108 672 Q F1(histdata_t;)2.5 E F0(typedef struct _hist_entry {)108 688.8 -Q(char *line;)113 700.8 Q(histdata_t data;)113 712.8 Q 2.5(}H)108 724.8 -S(IST_ENTR)-2.5 E -.92(Y;)-.65 G(GNU History 4.3)72 768 Q -(2002 January 31)131.79 E(2)195.95 E EP -%%Page: 3 3 -%%BeginPageSetup -BP -%%EndPageSetup -/F0 10/Times-Roman@0 SF(HIST)72 48 Q(OR)-.18 E 357.18(Y\(3\) HIST)-.65 F -(OR)-.18 E(Y\(3\))-.65 E -(The history list itself might therefore be declared as)108 84 Q/F1 10 -/Times-Italic@0 SF(HIST_ENTR)108 100.8 Q 2.5(Y*)-.18 G(*)-2.5 E/F2 10 -/Times-Bold@0 SF(the_history_list;)2.5 E F0(The state of the History li\ -brary is encapsulated into a single structure:)108 117.6 Q(/*)108 134.4 -Q 2.5(*As)110.5 146.4 S -(tructure used to pass around the current state of the history)-2.5 E(.) --.65 E(*/)110.5 158.4 Q(typedef struct _hist_state {)108 170.4 Q -(HIST_ENTR)113 182.4 Q 2.5(Y*)-.65 G -(*entries; /* Pointer to the entries themselv)-2.5 E(es. */)-.15 E -(int of)113 194.4 Q 25(fset; /*)-.25 F -(The location pointer within this array)2.5 E 2.5(.*)-.65 G(/)-2.5 E -(int length;)113 206.4 Q(/* Number of elements within this array)27.5 E -2.5(.*)-.65 G(/)-2.5 E(int size;)113 218.4 Q -(/* Number of slots allocated to this array)32.5 E 2.5(.*)-.65 G(/)-2.5 -E(int \215ags;)113 230.4 Q 2.5(}H)108 242.4 S(IST)-2.5 E(OR)-.18 E(Y_ST) --.65 E -1.11(AT)-.93 G(E;)1.11 E(If the \215ags member includes)108 -259.2 Q F2(HS_STIFLED)2.5 E F0 2.5(,t)C(he history has been sti\215ed.) --2.5 E/F3 10.95/Times-Bold@0 SF(History Functions)72 276 Q F0 -(This section describes the calling sequence for the v)108 288 Q -(arious functions e)-.25 E(xported by the GNU History library)-.15 E(.) --.65 E F2(Initializing History and State Management)87 304.8 Q F0 1.274 -(This section describes functions used to initialize and manage the sta\ -te of the History library when you)108 316.8 R -.1(wa)108 328.8 S -(nt to use the history functions in your program.).1 E F1(void)108 352.8 -Q F2(using_history)2.5 E F0(\()4.166 E F1(void)A F0(\))1.666 E(Be)108 -364.8 Q(gin a session in which the history functions might be used.)-.15 -E(This initializes the interacti)5 E .3 -.15(ve v)-.25 H(ariables.)-.1 E -F1(HIST)108 388.8 Q(OR)-.18 E(Y_ST)-.18 E -.37(AT)-.5 G 2.5(E*).37 G F2 -(history_get_history_state)A F0(\()4.166 E F1(void)A F0(\))1.666 E -(Return a structure describing the current state of the input history) -108 400.8 Q(.)-.65 E F1(void)108 424.8 Q F2(history_set_history_state) -2.5 E F0(\()4.166 E F1(HIST)A(OR)-.18 E(Y_ST)-.18 E -.37(AT)-.5 G 2.5 -(E*).37 G(state)-2.5 E F0(\))1.666 E -(Set the state of the history list according to)108 436.8 Q F1(state)2.5 -E F0(.)A F2(History List Management)87 465.6 Q F0 -(These functions manage indi)108 477.6 Q(vidual entries on the history \ -list, or set parameters managing the list itself.)-.25 E F1(void)108 -501.6 Q F2(add_history)2.5 E F0(\()4.166 E F1(const c)A(har *string)-.15 -E F0(\))1.666 E(Place)108 513.6 Q F1(string)2.5 E F0 -(at the end of the history list.)2.5 E -(The associated data \214eld \(if an)5 E(y\) is set to)-.15 E F2(NULL) -2.5 E F0(.)A F1(HIST_ENTR)108 537.6 Q 2.5(Y*)-.18 G F2 -.18(re)C(mo).18 -E -.1(ve)-.1 G(_history).1 E F0(\()4.166 E F1(int whic)A(h)-.15 E F0(\)) -1.666 E(Remo)108 549.6 Q .352 -.15(ve h)-.15 H .052(istory entry at of) -.15 F(fset)-.25 E F1(whic)2.553 E(h)-.15 E F0 .053(from the history) -2.553 F 5.053(.T)-.65 G .053(he remo)-5.053 F -.15(ve)-.15 G 2.553(de) -.15 G .053(lement is returned so you can free the)-2.553 F -(line, data, and containing structure.)108 561.6 Q F1(HIST_ENTR)108 -585.6 Q 2.5(Y*)-.18 G F2 -.18(re)C(place_history_entry).18 E F0(\()4.166 -E F1(int whic)A -.834(h, const)-.15 F -.15(ch)2.5 G(ar *line).15 E 1.666 -(,h)-.1 G(istdata_t data)-1.666 E F0(\))3.332 E(Mak)108 597.6 Q 2.868 -(et)-.1 G .368(he history entry at of)-2.868 F(fset)-.25 E F1(whic)2.868 -E(h)-.15 E F0(ha)2.868 E -.15(ve)-.2 G F1(line)3.018 E F0(and)2.868 E F1 -(data)2.868 E F0 5.367(.T)C .367 -(his returns the old entry so you can dispose of)-5.367 F(the data.)108 -609.6 Q(In the case of an in)5 E -.25(va)-.4 G(lid).25 E F1(whic)2.5 E -(h)-.15 E F0 2.5(,a)C F2(NULL)A F0(pointer is returned.)2.5 E F1(void) -108 633.6 Q F2(clear_history)2.5 E F0(\()4.166 E F1(void)A F0(\))1.666 E -(Clear the history list by deleting all the entries.)108 645.6 Q F1 -(void)108 669.6 Q F2(sti\215e_history)2.5 E F0(\()4.166 E F1(int max)A -F0(\))1.666 E(Sti\215e the history list, remembering only the last)108 -681.6 Q F1(max)2.5 E F0(entries.)2.5 E F1(int)108 705.6 Q F2 -(unsti\215e_history)2.5 E F0(\()4.166 E F1(void)A F0(\))1.666 E .46 -(Stop sti\215ing the history)108 717.6 R 5.46(.T)-.65 G .46 -(his returns the pre)-5.46 F .46 -(viously-set maximum number of history entries \(as set by)-.25 F F2 -(sti-)2.96 E(\215e_history\(\))108 729.6 Q F0 2.5(\). history)B -.1(wa) -2.5 G 2.5(ss).1 G 2.5(ti\215ed. The)-2.5 F -.25(va)2.5 G(lue is positi) -.25 E .3 -.15(ve i)-.25 H 2.5(ft).15 G(he history w)-2.5 E -(as sti\215ed, ne)-.1 E -.05(ga)-.15 G(ti).05 E .3 -.15(ve i)-.25 H 2.5 -(fi).15 G 2.5(tw)-2.5 G(asn')-2.6 E(t.)-.18 E(GNU History 4.3)72 768 Q -(2002 January 31)131.79 E(3)195.95 E EP -%%Page: 4 4 -%%BeginPageSetup -BP -%%EndPageSetup -/F0 10/Times-Roman@0 SF(HIST)72 48 Q(OR)-.18 E 357.18(Y\(3\) HIST)-.65 F -(OR)-.18 E(Y\(3\))-.65 E/F1 10/Times-Italic@0 SF(int)108 84 Q/F2 10 -/Times-Bold@0 SF(history_is_sti\215ed)2.5 E F0(\()4.166 E F1(void)A F0 -(\))1.666 E -(Returns non-zero if the history is sti\215ed, zero if it is not.)108 96 -Q F2(Inf)87 124.8 Q(ormation About the History List)-.25 E F0(These fun\ -ctions return information about the entire history list or indi)108 -136.8 Q(vidual list entries.)-.25 E F1(HIST_ENTR)108 160.8 Q 2.5(Y*)-.18 -G(*)-2.5 E F2(history_list)2.5 E F0(\()4.166 E F1(void)A F0(\))1.666 E -.708(Return a)108 172.8 R F2(NULL)3.208 E F0 .708(terminated array of) -3.208 F F1(HIST_ENTR)3.208 E 3.208(Y*)-.18 G F0 .708 -(which is the current input history)B 5.707(.E)-.65 G .707 -(lement 0 of this)-5.707 F(list is the be)108 184.8 Q(ginning of time.) --.15 E(If there is no history)5 E 2.5(,r)-.65 G(eturn)-2.5 E F2(NULL)2.5 -E F0(.)A F1(int)108 208.8 Q F2(wher)2.5 E(e_history)-.18 E F0(\()4.166 E -F1(void)A F0(\))1.666 E(Returns the of)108 220.8 Q -(fset of the current history element.)-.25 E F1(HIST_ENTR)108 244.8 Q -2.5(Y*)-.18 G F2(curr)A(ent_history)-.18 E F0(\()4.166 E F1(void)A F0 -(\))1.666 E 1.373 -(Return the history entry at the current position, as determined by)108 -256.8 R F2(wher)3.873 E(e_history\(\))-.18 E F0 6.373(.I)C 3.873(ft) --6.373 G 1.374(here is no entry)-3.873 F(there, return a)108 268.8 Q F2 -(NULL)2.5 E F0(pointer)2.5 E(.)-.55 E F1(HIST_ENTR)108 292.8 Q 2.5(Y*) --.18 G F2(history_get)A F0(\()4.166 E F1(int of)A(fset)-.18 E F0(\)) -1.666 E .288(Return the history entry at position)108 304.8 R F1(of) -2.787 E(fset)-.18 E F0 2.787(,s)C .287(tarting from)-2.787 F F2 -(history_base)2.787 E F0 5.287(.I)C 2.787(ft)-5.287 G .287 -(here is no entry there, or if)-2.787 F F1(of)2.787 E(fset)-.18 E F0 -(is greater than the history length, return a)108 316.8 Q F2(NULL)2.5 E -F0(pointer)2.5 E(.)-.55 E F1(int)108 340.8 Q F2(history_total_bytes)2.5 -E F0(\()4.166 E F1(void)A F0(\))1.666 E .391 -(Return the number of bytes that the primary history entries are using.) -108 352.8 R .392(This function returns the sum of the)5.392 F -(lengths of all the lines in the history)108 364.8 Q(.)-.65 E F2(Mo)87 -393.6 Q(ving Ar)-.1 E(ound the History List)-.18 E F0 -(These functions allo)108 405.6 Q 2.5(wt)-.25 G(he current inde)-2.5 E -2.5(xi)-.15 G(nto the history list to be set or changed.)-2.5 E F1(int) -108 429.6 Q F2(history_set_pos)2.5 E F0(\()4.166 E F1(int pos)A F0(\)) -1.666 E .79(Set the current history of)108 441.6 R .79(fset to)-.25 F F1 -(pos)3.29 E F0 3.29(,a)C 3.29(na)-3.29 G .79(bsolute inde)-3.29 F 3.29 -(xi)-.15 G .79(nto the list.)-3.29 F .79(Returns 1 on success, 0 if)5.79 -F F1(pos)3.29 E F0 .79(is less)3.29 F -(than zero or greater than the number of history entries.)108 453.6 Q F1 -(HIST_ENTR)108 477.6 Q 2.5(Y*)-.18 G F2(pr)A -.15(ev)-.18 G -(ious_history).15 E F0(\()4.166 E F1(void)A F0(\))1.666 E .207 -(Back up the current history of)108 489.6 R .207(fset to the pre)-.25 F -.207(vious history entry)-.25 F 2.708(,a)-.65 G .208 -(nd return a pointer to that entry)-2.708 F 5.208(.I)-.65 G 2.708(ft) --5.208 G .208(here is)-2.708 F(no pre)108 501.6 Q(vious entry)-.25 E 2.5 -(,r)-.65 G(eturn a)-2.5 E F2(NULL)2.5 E F0(pointer)2.5 E(.)-.55 E F1 -(HIST_ENTR)108 525.6 Q 2.5(Y*)-.18 G F2(next_history)A F0(\()4.166 E F1 -(void)A F0(\))1.666 E(Mo)108 537.6 Q 1.047 -.15(ve t)-.15 H .747 -(he current history of).15 F .747(fset forw)-.25 F .746(ard to the ne) --.1 F .746(xt history entry)-.15 F 3.246(,a)-.65 G .746 -(nd return the a pointer to that entry)-3.246 F 5.746(.I)-.65 G(f)-5.746 -E(there is no ne)108 549.6 Q(xt entry)-.15 E 2.5(,r)-.65 G(eturn a)-2.5 -E F2(NULL)2.5 E F0(pointer)2.5 E(.)-.55 E F2(Sear)87 578.4 Q -(ching the History List)-.18 E F0 .005(These functions allo)108 590.4 R -2.505(ws)-.25 G .006(earching of the history list for entries containin\ -g a speci\214c string.)-2.505 F .006(Searching may be)5.006 F 1.452 -(performed both forw)108 602.4 R 1.452(ard and backw)-.1 F 1.451 -(ard from the current history position.)-.1 F 1.451(The search may be) -6.451 F F1(anc)3.951 E(hor)-.15 E(ed)-.37 E F0(,)A -(meaning that the string must match at the be)108 614.4 Q -(ginning of the history entry)-.15 E(.)-.65 E F1(int)108 638.4 Q F2 -(history_sear)2.5 E(ch)-.18 E F0(\()4.166 E F1(const c)A(har *string) --.15 E 1.666(,i)-.1 G(nt dir)-1.666 E(ection)-.37 E F0(\))1.666 E .155 -(Search the history for)108 650.4 R F1(string)2.655 E F0 2.656(,s)C .156 -(tarting at the current history of)-2.656 F 2.656(fset. If)-.25 F F1 -(dir)2.656 E(ection)-.37 E F0 .156(is less than 0, then the search)2.656 -F .802(is through pre)108 662.4 R .802 -(vious entries, otherwise through subsequent entries.)-.25 F(If)5.801 E -F1(string)3.301 E F0 .801(is found, then the current his-)3.301 F .064 -(tory inde)108 674.4 R 2.564(xi)-.15 G 2.564(ss)-2.564 G .064 -(et to that history entry)-2.564 F 2.564(,a)-.65 G .064(nd the v)-2.564 -F .064(alue returned is the of)-.25 F .064 -(fset in the line of the entry where)-.25 F F1(string)2.565 E F0 -.1(wa) -108 686.4 S 2.5(sf).1 G 2.5(ound. Otherwise,)-2.5 F -(nothing is changed, and a -1 is returned.)2.5 E F1(int)108 710.4 Q F2 -(history_sear)2.5 E(ch_pr)-.18 E(e\214x)-.18 E F0(\()4.166 E F1(const c) -A(har *string)-.15 E 1.666(,i)-.1 G(nt dir)-1.666 E(ection)-.37 E F0(\)) -1.666 E .684(Search the history for)108 722.4 R F1(string)3.183 E F0 -3.183(,s)C .683(tarting at the current history of)-3.183 F 3.183 -(fset. The)-.25 F .683(search is anchored: matching lines)3.183 F -(GNU History 4.3)72 768 Q(2002 January 31)131.79 E(4)195.95 E EP -%%Page: 5 5 -%%BeginPageSetup -BP -%%EndPageSetup -/F0 10/Times-Roman@0 SF(HIST)72 48 Q(OR)-.18 E 357.18(Y\(3\) HIST)-.65 F -(OR)-.18 E(Y\(3\))-.65 E 1.063(must be)108 84 R 1.063(gin with)-.15 F/F1 -10/Times-Italic@0 SF(string)3.563 E F0 6.063(.I)C(f)-6.063 E F1(dir) -3.563 E(ection)-.37 E F0 1.064 -(is less than 0, then the search is through pre)3.563 F 1.064 -(vious entries, otherwise)-.25 F 1.115(through subsequent entries.)108 -96 R(If)6.115 E F1(string)3.615 E F0 1.115 -(is found, then the current history inde)3.615 F 3.614(xi)-.15 G 3.614 -(ss)-3.614 G 1.114(et to that entry)-3.614 F 3.614(,a)-.65 G 1.114 -(nd the)-3.614 F(return v)108 108 Q(alue is 0.)-.25 E -(Otherwise, nothing is changed, and a -1 is returned.)5 E F1(int)108 132 -Q/F2 10/Times-Bold@0 SF(history_sear)2.5 E(ch_pos)-.18 E F0(\()4.166 E -F1(const c)A(har *string)-.15 E 1.666(,i)-.1 G(nt dir)-1.666 E -.834 -(ection, int)-.37 F(pos)2.5 E F0(\))3.332 E .603(Search for)108 144 R F1 -(string)3.103 E F0 .603(in the history list, starting at)3.103 F F1(pos) -3.104 E F0 3.104(,a)C 3.104(na)-3.104 G .604(bsolute inde)-3.104 F 3.104 -(xi)-.15 G .604(nto the list.)-3.104 F(If)5.604 E F1(dir)3.104 E(ection) --.37 E F0 .604(is ne)3.104 F -.05(ga)-.15 G(ti).05 E -.15(ve)-.25 G(,) -.15 E .608(the search proceeds backw)108 156 R .608(ard from)-.1 F F1 -(pos)3.108 E F0 3.108(,o)C .608(therwise forw)-3.108 F 3.108 -(ard. Returns)-.1 F .608(the absolute inde)3.108 F 3.108(xo)-.15 G 3.108 -(ft)-3.108 G .608(he history ele-)-3.108 F(ment where)108 168 Q F1 -(string)2.5 E F0 -.1(wa)2.5 G 2.5(sf).1 G(ound, or -1 otherwise.)-2.5 E -F2(Managing the History File)87 196.8 Q F0 .035(The History library can\ - read the history from and write it to a \214le.)108 208.8 R .036 -(This section documents the functions for)5.035 F -(managing a history \214le.)108 220.8 Q F1(int)108 244.8 Q F2 -.18(re) -2.5 G(ad_history).18 E F0(\()4.166 E F1(const c)A(har *\214lename)-.15 E -F0(\))1.666 E .151(Add the contents of)108 256.8 R F1(\214lename)2.651 E -F0 .151(to the history list, a line at a time.)2.651 F(If)5.15 E F1 -(\214lename)2.65 E F0(is)2.65 E F2(NULL)2.65 E F0 2.65(,t)C .15 -(hen read from)-2.65 F F1(~/.his-)2.65 E(tory)108 268.8 Q F0 5(.R)C -(eturns 0 if successful, or)-5 E F2(err)2.5 E(no)-.15 E F0(if not.)2.5 E -F1(int)108 292.8 Q F2 -.18(re)2.5 G(ad_history_range).18 E F0(\()4.166 E -F1(const c)A(har *\214lename)-.15 E 1.666(,i)-.1 G(nt fr)-1.666 E -.834 -(om, int)-.45 F(to)2.5 E F0(\))3.332 E .052(Read a range of lines from) -108 304.8 R F1(\214lename)2.553 E F0 2.553(,a)C .053 -(dding them to the history list.)-2.553 F .053(Start reading at line) -5.053 F F1(fr)2.553 E(om)-.45 E F0 .053(and end at)2.553 F F1(to)2.553 E -F0(.)A(If)108 316.8 Q F1(fr)2.889 E(om)-.45 E F0 .389 -(is zero, start at the be)2.889 F 2.889(ginning. If)-.15 F F1(to)2.889 E -F0 .389(is less than)2.889 F F1(fr)2.889 E(om)-.45 E F0 2.889(,t)C .388 -(hen read until the end of the \214le.)-2.889 F(If)5.388 E F1 -(\214lename)2.888 E F0(is)108 328.8 Q F2(NULL)2.5 E F0 2.5(,t)C -(hen read from)-2.5 E F1(~/.history)2.5 E F0 5(.R)C -(eturns 0 if successful, or)-5 E F2(err)2.5 E(no)-.15 E F0(if not.)2.5 E -F1(int)108 352.8 Q F2(write_history)2.5 E F0(\()4.166 E F1(const c)A -(har *\214lename)-.15 E F0(\))1.666 E .961(Write the current history to) -108 364.8 R F1(\214lename)3.461 E F0 3.461(,o)C -.15(ve)-3.611 G -(rwriting).15 E F1(\214lename)3.461 E F0 .961(if necessary)3.461 F 5.961 -(.I)-.65 G(f)-5.961 E F1(\214lename)3.462 E F0(is)3.462 E F2(NULL)3.462 -E F0 3.462(,t)C .962(hen write)-3.462 F(the history list to)108 376.8 Q -F1(~/.history)2.5 E F0 5(.R)C(eturns 0 on success, or)-5 E F2(err)2.5 E -(no)-.15 E F0(on a read or write error)2.5 E(.)-.55 E F1(int)108 412.8 Q -F2(append_history)2.5 E F0(\()4.166 E F1(int nelements,)A(const c)1.666 -E(har *\214lename)-.15 E F0(\))1.666 E .839(Append the last)108 424.8 R -F1(nelements)3.339 E F0 .839(of the history list to)3.339 F F1 -(\214lename)3.339 E F0 5.839(.I)C(f)-5.839 E F1(\214lename)3.339 E F0 -(is)3.339 E F2(NULL)3.339 E F0 3.339(,t)C .838(hen append to)-3.339 F F1 -(~/.history)3.338 E F0(.)A(Returns 0 on success, or)108 436.8 Q F2(err) -2.5 E(no)-.15 E F0(on a read or write error)2.5 E(.)-.55 E F1(int)108 -460.8 Q F2(history_truncate_\214le)2.5 E F0(\()4.166 E F1(const c)A -(har *\214lename)-.15 E 1.666(,i)-.1 G(nt nlines)-1.666 E F0(\))1.666 E --.35(Tr)108 472.8 S .38(uncate the history \214le).35 F F1(\214lename) -2.88 E F0 2.88(,l)C(ea)-2.88 E .38(ving only the last)-.2 F F1(nlines) -2.881 E F0 2.881(lines. If)2.881 F F1(\214lename)2.881 E F0(is)2.881 E -F2(NULL)2.881 E F0 2.881(,t)C(hen)-2.881 E F1(~/.history)2.881 E F0(is) -2.881 E 2.5(truncated. Returns)108 484.8 R 2.5(0o)2.5 G 2.5(ns)-2.5 G -(uccess, or)-2.5 E F2(err)2.5 E(no)-.15 E F0(on f)2.5 E(ailure.)-.1 E F2 -(History Expansion)87 513.6 Q F0(These functions implement history e)108 -525.6 Q(xpansion.)-.15 E F1(int)108 549.6 Q F2(history_expand)2.5 E F0 -(\()4.166 E F1 -.15(ch)C(ar *string).15 E 1.666(,c)-.1 G(har **output) --1.816 E F0(\))1.666 E(Expand)108 561.6 Q F1(string)2.5 E F0 2.5(,p)C -(lacing the result into)-2.5 E F1(output)2.5 E F0 2.5(,ap)C -(ointer to a string.)-2.5 E(Returns:)5 E 31(0I)144 573.6 S 3.066(fn)-31 -G 3.066(oe)-3.066 G .566(xpansions took place \(or)-3.216 F 3.065(,i)-.4 -G 3.065(ft)-3.065 G .565(he only change in the te)-3.065 F .565(xt w) --.15 F .565(as the remo)-.1 F -.25(va)-.15 G 3.065(lo).25 G 3.065(fe) --3.065 G(scape)-3.065 E(characters preceding the history e)180 585.6 Q -(xpansion character\);)-.15 E 31(1i)144 597.6 S 2.5(fe)-31 G -(xpansions did tak)-2.65 E 2.5(ep)-.1 G(lace;)-2.5 E 25.17(-1 if)144 -609.6 R(there w)2.5 E(as an error in e)-.1 E(xpansion;)-.15 E 31(2i)144 -621.6 S 2.5(ft)-31 G(he returned line should be displayed, b)-2.5 E -(ut not e)-.2 E -.15(xe)-.15 G(cuted, as with the).15 E F2(:p)2.5 E F0 -(modi\214er)2.5 E(.)-.55 E(If an error ocurred in e)108 633.6 Q -(xpansion, then)-.15 E F1(output)2.5 E F0(contains a descripti)2.5 E .3 --.15(ve e)-.25 H(rror message.).15 E F1 -.15(ch)108 657.6 S(ar *).15 E -F2(get_history_e)2.5 E -.1(ve)-.15 G(nt).1 E F0(\()4.166 E F1(const c)A -(har *string)-.15 E 1.666(,i)-.1 G(nt *cinde)-1.666 E -.834(x, int)-.2 F -(qc)2.5 E(har)-.15 E F0(\))3.332 E .262(Returns the te)108 669.6 R .262 -(xt of the history e)-.15 F -.15(ve)-.25 G .262(nt be).15 F .263 -(ginning at)-.15 F F1(string)2.763 E F0(+)2.763 E F1(*cinde)2.763 E(x) --.2 E F0(.)A F1(*cinde)5.263 E(x)-.2 E F0 .263 -(is modi\214ed to point to after the)2.763 F -2.15 -.25(ev e)108 681.6 T -.71(nt speci\214er).25 F 5.71(.A)-.55 G 3.21(tf)-5.71 G .71 -(unction entry)-3.21 F(,)-.65 E F1(cinde)3.21 E(x)-.2 E F0 .709 -(points to the inde)3.21 F 3.209(xi)-.15 G(nto)-3.209 E F1(string)3.209 -E F0 .709(where the history e)3.209 F -.15(ve)-.25 G .709 -(nt speci\214ca-).15 F .527(tion be)108 693.6 R(gins.)-.15 E F1(qc)5.527 -E(har)-.15 E F0 .527(is a character that is allo)3.027 F .527 -(wed to end the e)-.25 F -.15(ve)-.25 G .528 -(nt speci\214cation in addition to the `).15 F(`normal')-.74 E(')-.74 E -(terminating characters.)108 705.6 Q F1 -.15(ch)108 729.6 S(ar **).15 E -F2(history_tok)2.5 E(enize)-.1 E F0(\()4.166 E F1(const c)A(har *string) --.15 E F0(\))1.666 E(GNU History 4.3)72 768 Q(2002 January 31)131.79 E -(5)195.95 E EP -%%Page: 6 6 -%%BeginPageSetup -BP -%%EndPageSetup -/F0 10/Times-Roman@0 SF(HIST)72 48 Q(OR)-.18 E 357.18(Y\(3\) HIST)-.65 F -(OR)-.18 E(Y\(3\))-.65 E .239(Return an array of tok)108 84 R .239 -(ens parsed out of)-.1 F/F1 10/Times-Italic@0 SF(string)2.739 E F0 2.739 -(,m)C .238(uch as the shell might.)-2.739 F .238(The tok)5.238 F .238 -(ens are split on the charac-)-.1 F(ters in the)108 96 Q/F2 10 -/Times-Bold@0 SF(history_w)2.5 E(ord_delimiters)-.1 E F0 -.25(va)2.5 G -(riable, and shell quoting con).25 E -.15(ve)-.4 G(ntions are obe).15 E -(yed.)-.15 E F1 -.15(ch)108 120 S(ar *).15 E F2(history_ar)2.5 E -(g_extract)-.1 E F0(\()4.166 E F1(int \214r)A -.834(st, int)-.1 F -.834 -(last, const)2.5 F -.15(ch)2.5 G(ar *string).15 E F0(\))3.332 E .025 -(Extract a string se)108 132 R .025(gment consisting of the)-.15 F F1 -<8c72>2.526 E(st)-.1 E F0(through)2.526 E F1(last)2.526 E F0(ar)2.526 E -.026(guments present in)-.18 F F1(string)2.526 E F0 5.026(.A)C -.18(rg) --5.026 G .026(uments are split).18 F(using)108 144 Q F2(history_tok)2.5 -E(enize\(\))-.1 E F0(.)A F2(History V)87 172.8 Q(ariables)-.92 E F0 -(This section describes the e)108 184.8 Q(xternally-visible v)-.15 E -(ariables e)-.25 E(xported by the GNU History Library)-.15 E(.)-.65 E F1 -(int)108 208.8 Q F2(history_base)2.5 E F0(The logical of)108 220.8 Q -(fset of the \214rst entry in the history list.)-.25 E F1(int)108 244.8 -Q F2(history_length)2.5 E F0 -(The number of entries currently stored in the history list.)108 256.8 Q -F1(int)108 280.8 Q F2(history_max_entries)2.5 E F0 -(The maximum number of history entries.)108 292.8 Q -(This must be changed using)5 E F2(sti\215e_history\(\))2.5 E F0(.)A F1 --.15(ch)108 316.8 S(ar).15 E F2(history_expansion_char)2.5 E F0 -(The character that introduces a history e)108 328.8 Q -.15(ve)-.25 G -2.5(nt. The).15 F(def)2.5 E(ault is)-.1 E F2(!)2.5 E F0 5(.S)C -(etting this to 0 inhibits history e)-5 E(xpansion.)-.15 E F1 -.15(ch) -108 352.8 S(ar).15 E F2(history_subst_char)2.5 E F0 -(The character that in)108 364.8 Q -.2(vo)-.4 G -.1(ke).2 G 2.5(sw).1 G -(ord substitution if found at the start of a line.)-2.6 E(The def)5 E -(ault is)-.1 E F2(^)2.5 E F0(.)A F1 -.15(ch)108 388.8 S(ar).15 E F2 -(history_comment_char)2.5 E F0 .117(During tok)108 400.8 R .117 -(enization, if this character is seen as the \214rst character of a w) --.1 F .117(ord, then it and all subsequent char)-.1 F(-)-.2 E .276 -(acters up to a ne)108 412.8 R .276 -(wline are ignored, suppressing history e)-.25 F .276 -(xpansion for the remainder of the line.)-.15 F .277(This is dis-)5.276 -F(abled by def)108 424.8 Q(ault.)-.1 E F1 -.15(ch)108 448.8 S(ar *).15 E -F2(history_w)2.5 E(ord_delimiters)-.1 E F0 -(The characters that separate tok)108 460.8 Q(ens for)-.1 E F2 -(history_tok)2.5 E(enize\(\))-.1 E F0 5(.T)C(he def)-5 E(ault v)-.1 E -(alue is)-.25 E F2 2.5("\\)2.5 G(t\\n\(\)<>;&|")-2.5 E F0(.)A F1 -.15 -(ch)108 484.8 S(ar *).15 E F2(history_no_expand_chars)2.5 E F0 2.054 -(The list of characters which inhibit history e)108 496.8 R 2.054 -(xpansion if found immediately follo)-.15 F(wing)-.25 E F2 -(history_expan-)4.554 E(sion_char)108 508.8 Q F0 5(.T)C(he def)-5 E -(ault is space, tab, ne)-.1 E(wline,)-.25 E F2(\\r)2.5 E F0 2.5(,a)C(nd) --2.5 E F2(=)2.5 E F0(.)A F1 -.15(ch)108 532.8 S(ar *).15 E F2 -(history_sear)2.5 E(ch_delimiter_chars)-.18 E F0 .401(The list of addit\ -ional characters which can delimit a history search string, in addition\ - to space, tab,)108 544.8 R F1(:)2.901 E F0(and)2.901 E F1(?)2.902 E F0 -(in the case of a substring search.)108 556.8 Q(The def)5 E -(ault is empty)-.1 E(.)-.65 E F1(int)108 580.8 Q F2 -(history_quotes_inhibit_expansion)2.5 E F0 .625 -(If non-zero, single-quoted w)108 592.8 R .625 -(ords are not scanned for the history e)-.1 F .624(xpansion character) --.15 F 5.624(.T)-.55 G .624(he def)-5.624 F .624(ault v)-.1 F .624 -(alue is)-.25 F(0.)108 604.8 Q F1(rl_lineb)108 628.8 Q(uf_func_t *)-.2 E -F2(history_inhibit_expansion_function)2.5 E F0 .347 -(This should be set to the address of a function that tak)108 640.8 R -.348(es tw)-.1 F 2.848(oa)-.1 G -.18(rg)-2.848 G .348(uments: a).18 F F2 -.348(char *)2.848 F F0(\()2.848 E F1(string)A F0 2.848(\)a)C .348(nd an) --2.848 F F2(int)2.848 E F0(inde)2.848 E(x)-.15 E .228 -(into that string \()108 652.8 R F1(i)A F0 2.728(\). It)B .227 -(should return a non-zero v)2.727 F .227(alue if the history e)-.25 F -.227(xpansion starting at)-.15 F F1(string[i])2.727 E F0 .227 -(should not)2.727 F .019(be performed; zero if the e)108 664.8 R .019 -(xpansion should be done.)-.15 F .019 -(It is intended for use by applications lik)5.019 F(e)-.1 E F2(bash) -2.519 E F0 .019(that use)2.519 F(the history e)108 676.8 Q -(xpansion character for additional purposes.)-.15 E(By def)5 E -(ault, this v)-.1 E(ariable is set to)-.25 E F2(NULL)2.5 E F0(.)A/F3 -10.95/Times-Bold@0 SF(FILES)72 693.6 Q F1(~/.history)109.666 705.6 Q F0 -(Def)144 717.6 Q(ault \214lename for reading and writing sa)-.1 E -.15 -(ve)-.2 G 2.5(dh).15 G(istory)-2.5 E(GNU History 4.3)72 768 Q -(2002 January 31)131.79 E(6)195.95 E EP -%%Page: 7 7 -%%BeginPageSetup -BP -%%EndPageSetup -/F0 10/Times-Roman@0 SF(HIST)72 48 Q(OR)-.18 E 357.18(Y\(3\) HIST)-.65 F -(OR)-.18 E(Y\(3\))-.65 E/F1 10.95/Times-Bold@0 SF(SEE ALSO)72 84 Q/F2 10 -/Times-Italic@0 SF(The Gnu Readline Libr)108 96 Q(ary)-.15 E F0 2.5(,B)C -(rian F)-2.5 E(ox and Chet Rame)-.15 E(y)-.15 E F2(The Gnu History Libr) -108 108 Q(ary)-.15 E F0 2.5(,B)C(rian F)-2.5 E(ox and Chet Rame)-.15 E -(y)-.15 E F2(bash)108 120 Q F0(\(1\))A F2 -.37(re)108 132 S(adline).37 E -F0(\(3\))A F1 -.548(AU)72 148.8 S(THORS).548 E F0(Brian F)108 160.8 Q -(ox, Free Softw)-.15 E(are F)-.1 E(oundation)-.15 E(bfox@gnu.or)108 -172.8 Q(g)-.18 E(Chet Rame)108 189.6 Q 1.3 -.65(y, C)-.15 H(ase W).65 E -(estern Reserv)-.8 E 2.5(eU)-.15 G(ni)-2.5 E -.15(ve)-.25 G(rsity).15 E -(chet@ins.CWR)108 201.6 Q(U.Edu)-.4 E F1 -.11(BU)72 218.4 S 2.738(GR).11 -G(EPOR)-2.738 E(TS)-.438 E F0 .16(If you \214nd a b)108 230.4 R .16 -(ug in the)-.2 F/F3 10/Times-Bold@0 SF(history)2.66 E F0(library)2.66 E -2.66(,y)-.65 G .16(ou should report it.)-2.66 F .16 -(But \214rst, you should mak)5.16 F 2.66(es)-.1 G .16 -(ure that it really is)-2.66 F 2.5(ab)108 242.4 S -(ug, and that it appears in the latest v)-2.7 E(ersion of the)-.15 E F3 -(history)2.5 E F0(library that you ha)2.5 E -.15(ve)-.2 G(.).15 E .704 -(Once you ha)108 259.2 R 1.004 -.15(ve d)-.2 H .704(etermined that a b) -.15 F .704(ug actually e)-.2 F .704(xists, mail a b)-.15 F .705 -(ug report to)-.2 F F2 -.2(bu)3.205 G(g\255r).2 E(eadline)-.37 E F0(@)A -F2(gnu.or)A(g)-.37 E F0 5.705(.I)C 3.205(fy)-5.705 G(ou)-3.205 E(ha)108 -271.2 Q 1.81 -.15(ve a \214)-.2 H 1.51 -(x, you are welcome to mail that as well!).15 F 1.509 -(Suggestions and `philosophical' b)6.509 F 1.509(ug reports may be)-.2 F -(mailed to)108 283.2 Q F2 -.2(bu)2.5 G(g-r).2 E(eadline)-.37 E F0(@)A F2 -(gnu.or)A(g)-.37 E F0(or posted to the Usenet ne)2.5 E(wsgroup)-.25 E F3 -(gnu.bash.b)2.5 E(ug)-.2 E F0(.)A(Comments and b)108 300 Q -(ug reports concerning this manual page should be directed to)-.2 E F2 --.15(ch)2.5 G(et@ins.CWR).15 E -.25(U.)-.4 G(Edu).25 E F0(.).25 E -(GNU History 4.3)72 768 Q(2002 January 31)131.79 E(7)195.95 E EP -%%Trailer -end -%%EOF diff --git a/readline/doc/readline_3.ps b/readline/doc/readline_3.ps deleted file mode 100644 index 7d20e1799c..0000000000 --- a/readline/doc/readline_3.ps +++ /dev/null @@ -1,1294 +0,0 @@ -%!PS-Adobe-3.0 -%%Creator: groff version 1.17.2 -%%CreationDate: Thu Jun 27 13:54:44 2002 -%%DocumentNeededResources: font Times-Roman -%%+ font Times-Bold -%%+ font Times-Italic -%%+ font Courier -%%DocumentSuppliedResources: procset grops 1.17 2 -%%Pages: 14 -%%PageOrder: Ascend -%%Orientation: Portrait -%%EndComments -%%BeginProlog -%%BeginResource: procset grops 1.17 2 -/setpacking where{ -pop -currentpacking -true setpacking -}if -/grops 120 dict dup begin -/SC 32 def -/A/show load def -/B{0 SC 3 -1 roll widthshow}bind def -/C{0 exch ashow}bind def -/D{0 exch 0 SC 5 2 roll awidthshow}bind def -/E{0 rmoveto show}bind def -/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def -/G{0 rmoveto 0 exch ashow}bind def -/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def -/I{0 exch rmoveto show}bind def -/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def -/K{0 exch rmoveto 0 exch ashow}bind def -/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def -/M{rmoveto show}bind def -/N{rmoveto 0 SC 3 -1 roll widthshow}bind def -/O{rmoveto 0 exch ashow}bind def -/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def -/Q{moveto show}bind def -/R{moveto 0 SC 3 -1 roll widthshow}bind def -/S{moveto 0 exch ashow}bind def -/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def -/SF{ -findfont exch -[exch dup 0 exch 0 exch neg 0 0]makefont -dup setfont -[exch/setfont cvx]cvx bind def -}bind def -/MF{ -findfont -[5 2 roll -0 3 1 roll -neg 0 0]makefont -dup setfont -[exch/setfont cvx]cvx bind def -}bind def -/level0 0 def -/RES 0 def -/PL 0 def -/LS 0 def -/MANUAL{ -statusdict begin/manualfeed true store end -}bind def -/PLG{ -gsave newpath clippath pathbbox grestore -exch pop add exch pop -}bind def -/BP{ -/level0 save def -1 setlinecap -1 setlinejoin -72 RES div dup scale -LS{ -90 rotate -}{ -0 PL translate -}ifelse -1 -1 scale -}bind def -/EP{ -level0 restore -showpage -}bind def -/DA{ -newpath arcn stroke -}bind def -/SN{ -transform -.25 sub exch .25 sub exch -round .25 add exch round .25 add exch -itransform -}bind def -/DL{ -SN -moveto -SN -lineto stroke -}bind def -/DC{ -newpath 0 360 arc closepath -}bind def -/TM matrix def -/DE{ -TM currentmatrix pop -translate scale newpath 0 0 .5 0 360 arc closepath -TM setmatrix -}bind def -/RC/rcurveto load def -/RL/rlineto load def -/ST/stroke load def -/MT/moveto load def -/CL/closepath load def -/FL{ -currentgray exch setgray fill setgray -}bind def -/BL/fill load def -/LW/setlinewidth load def -/RE{ -findfont -dup maxlength 1 index/FontName known not{1 add}if dict begin -{ -1 index/FID ne{def}{pop pop}ifelse -}forall -/Encoding exch def -dup/FontName exch def -currentdict end definefont pop -}bind def -/DEFS 0 def -/EBEGIN{ -moveto -DEFS begin -}bind def -/EEND/end load def -/CNT 0 def -/level1 0 def -/PBEGIN{ -/level1 save def -translate -div 3 1 roll div exch scale -neg exch neg exch translate -0 setgray -0 setlinecap -1 setlinewidth -0 setlinejoin -10 setmiterlimit -[]0 setdash -/setstrokeadjust where{ -pop -false setstrokeadjust -}if -/setoverprint where{ -pop -false setoverprint -}if -newpath -/CNT countdictstack def -userdict begin -/showpage{}def -}bind def -/PEND{ -clear -countdictstack CNT sub{end}repeat -level1 restore -}bind def -end def -/setpacking where{ -pop -setpacking -}if -%%EndResource -%%IncludeResource: font Times-Roman -%%IncludeResource: font Times-Bold -%%IncludeResource: font Times-Italic -%%IncludeResource: font Courier -grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 -def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron -/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef -/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef -/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef -/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent -/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen -/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon -/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O -/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex -/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y -/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft -/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl -/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut -/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash -/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen -/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft -/logicalnot/minus/registered/macron/degree/plusminus/twosuperior -/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior -/ordmasculine/guilsinglright/onequarter/onehalf/threequarters -/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE -/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex -/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis -/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn -/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla -/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis -/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash -/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def -/Courier@0 ENC0/Courier RE/Times-Italic@0 ENC0/Times-Italic RE -/Times-Bold@0 ENC0/Times-Bold RE/Times-Roman@0 ENC0/Times-Roman RE -%%EndProlog -%%Page: 1 1 -%%BeginPageSetup -BP -%%EndPageSetup -/F0 10/Times-Roman@0 SF 342.2(READLINE\(3\) READLINE\(3\))72 48 R/F1 -10.95/Times-Bold@0 SF -.219(NA)72 84 S(ME).219 E F0 -(readline \255 get a line from a user with editing)108 96 Q F1(SYNOPSIS) -72 112.8 Q/F2 10/Times-Bold@0 SF(#include )108 124.8 Q -(#include )-.18 E(#include )-.7 E/F3 10/Times-Italic@0 SF --.15(ch)108 165.6 S(ar *).15 E F2 -.18(re)108 177.6 S(adline).18 E F0 -(\()2.5 E F3(const c)A(har *pr)-.15 E(ompt)-.45 E F0(\);)A F1(COPYRIGHT) -72 194.4 Q F0(Readline is Cop)108 206.4 Q -(yright \251 1989\2552002 by the Free Softw)-.1 E(are F)-.1 E -(oundation, Inc.)-.15 E F1(DESCRIPTION)72 223.2 Q F2 -.18(re)108 235.2 S -(adline).18 E F0 .088 -(will read a line from the terminal and return it, using)2.588 F F2(pr) -2.587 E(ompt)-.18 E F0 .087(as a prompt.)2.587 F(If)5.087 E F2(pr)2.587 -E(ompt)-.18 E F0(is)2.587 E F2(NULL)2.587 E F0(or)2.587 E .42 -(the empty string, no prompt is issued.)108 247.2 R .421 -(The line returned is allocated with)5.42 F F3(malloc)2.921 E F0 .421 -(\(3\); the caller must free it).31 F(when \214nished.)108 259.2 Q -(The line returned has the \214nal ne)5 E(wline remo)-.25 E -.15(ve)-.15 -G(d, so only the te).15 E(xt of the line remains.)-.15 E F2 -.18(re)108 -276 S(adline).18 E F0(of)3.79 E 1.29 -(fers editing capabilities while the user is entering the line.)-.25 F -1.289(By def)6.289 F 1.289(ault, the line editing com-)-.1 F -(mands are similar to those of emacs.)108 288 Q 2.5(Av)5 G -(i\255style line editing interf)-2.5 E(ace is also a)-.1 E -.25(va)-.2 G -(ilable.).25 E .272 -(This manual page describes only the most basic use of)108 304.8 R F2 --.18(re)2.772 G(adline).18 E F0 5.272(.M)C .272 -(uch more functionality is a)-5.272 F -.25(va)-.2 G .272(ilable; see).25 -F F3(The GNU Readline Libr)108 316.8 Q(ary)-.15 E F0(and)2.5 E F3 -(The GNU History Libr)2.5 E(ary)-.15 E F0(for additional information.) -2.5 E F1(RETURN V)72 333.6 Q(ALUE)-1.478 E F2 -.18(re)108 345.6 S -(adline).18 E F0 1.09(returns the te)3.59 F 1.09(xt of the line read.) --.15 F 3.589(Ab)6.09 G 1.089(lank line returns the empty string.)-3.589 -F(If)6.089 E F2(EOF)3.589 E F0 1.089(is encountered)3.589 F .283 -(while reading a line, and the line is empty)108 357.6 R(,)-.65 E F2 -(NULL)2.783 E F0 .283(is returned.)2.783 F .283(If an)5.283 F F2(EOF) -2.783 E F0 .283(is read with a non\255empty line, it)2.783 F -(is treated as a ne)108 369.6 Q(wline.)-.25 E F1(NO)72 386.4 Q -.986(TA) --.438 G(TION)-.054 E F0 .181 -(An emacs-style notation is used to denote k)108 398.4 R -.15(ey)-.1 G -(strok).15 E 2.681(es. Control)-.1 F -.1(ke)2.681 G .18 -(ys are denoted by C\255)-.05 F F3 -.1(ke)C(y)-.2 E F0 2.68(,e)C .18 -(.g., C\255n means)-2.68 F 2.625(Control\255N. Similarly)108 410.4 R(,) --.65 E F3(meta)2.625 E F0 -.1(ke)2.625 G .125(ys are denoted by M\255) --.05 F F3 -.1(ke)C(y)-.2 E F0 2.625(,s)C 2.625(oM)-2.625 G .125 -(\255x means Meta\255X.)-2.625 F .126(\(On k)5.126 F -.15(ey)-.1 G .126 -(boards without a).15 F F3(meta)108 422.4 Q F0 -.1(ke)3.309 G 2.109 -.65 -(y, M)-.05 H.65 E F3(x)A F0 .809(means ESC)3.309 F F3(x)3.309 E F0 -3.309(,i)C .809(.e., press the Escape k)-3.309 F 1.108 -.15(ey t)-.1 H -.808(hen the).15 F F3(x)3.308 E F0 -.1(ke)3.308 G 4.608 -.65(y. T)-.05 H -.808(his mak).65 F .808(es ESC the)-.1 F F3 .808(meta pr)3.308 F(e\214x) --.37 E F0(.)A .48(The combination M\255C\255)108 434.4 R F3(x)A F0 .48 -(means ESC\255Control\255)2.98 F F3(x)A F0 2.98(,o)C 2.98(rp)-2.98 G .48 -(ress the Escape k)-2.98 F .78 -.15(ey t)-.1 H .48 -(hen hold the Control k).15 F .78 -.15(ey w)-.1 H(hile).15 E -(pressing the)108 446.4 Q F3(x)2.5 E F0 -.1(ke)2.5 G -.65(y.)-.05 G(\)) -.65 E .62(Readline commands may be gi)108 463.2 R -.15(ve)-.25 G 3.119 -(nn).15 G(umeric)-3.119 E F3(ar)3.119 E(guments)-.37 E F0 3.119(,w).27 G -.619(hich normally act as a repeat count.)-3.119 F(Sometimes,)5.619 E -(ho)108 475.2 Q(we)-.25 E -.15(ve)-.25 G 1.418 -.4(r, i).15 H 3.118(ti) -.4 G 3.119(st)-3.118 G .619(he sign of the ar)-3.119 F .619 -(gument that is signi\214cant.)-.18 F -.15(Pa)5.619 G .619(ssing a ne) -.15 F -.05(ga)-.15 G(ti).05 E .919 -.15(ve a)-.25 H -.18(rg).15 G .619 -(ument to a command that).18 F 1.019(acts in the forw)108 487.2 R 1.018 -(ard direction \(e.g.,)-.1 F F2(kill\255line)3.518 E F0 3.518(\)c)C -1.018(auses that command to act in a backw)-3.518 F 1.018 -(ard direction.)-.1 F(Com-)6.018 E(mands whose beha)108 499.2 Q -(vior with ar)-.2 E(guments de)-.18 E(viates from this are noted.)-.25 E -.811(When a command is described as)108 516 R F3(killing)3.311 E F0(te) -3.311 E .811(xt, the te)-.15 F .811(xt deleted is sa)-.15 F -.15(ve)-.2 -G 3.311(df).15 G .812(or possible future retrie)-3.311 F -.25(va)-.25 G -3.312(l\().25 G F3(yank-)-3.312 E(ing)108 528 Q F0 2.529(\). The)B .029 -(killed te)2.529 F .029(xt is sa)-.15 F -.15(ve)-.2 G 2.529(di).15 G -2.529(na)-2.529 G F3 .029(kill ring)B F0 5.029(.C)C(onsecuti)-5.029 E -.329 -.15(ve k)-.25 H .029(ills cause the te).15 F .029 -(xt to be accumulated into one unit,)-.15 F .567(which can be yank)108 -540 R .567(ed all at once.)-.1 F .567(Commands which do not kill te) -5.567 F .567(xt separate the chunks of te)-.15 F .567(xt on the kill) --.15 F(ring.)108 552 Q F1(INITIALIZA)72 568.8 Q(TION FILE)-1.04 E F0 -.091(Readline is customized by putting commands in an initialization \ -\214le \(the)108 580.8 R F3(inputr)2.591 E(c)-.37 E F0 2.591 -(\214le\). The)2.591 F .091(name of this \214le)2.591 F 1.442(is tak)108 -592.8 R 1.443(en from the v)-.1 F 1.443(alue of the)-.25 F F2(INPUTRC) -3.943 E F0(en)3.943 E 1.443(vironment v)-.4 F 3.943(ariable. If)-.25 F -1.443(that v)3.943 F 1.443(ariable is unset, the def)-.25 F 1.443 -(ault is)-.1 F F3(~/.inputr)108 604.8 Q(c)-.37 E F0 5.359(.W).31 G .359 -(hen a program which uses the readline library starts up, the init \214\ -le is read, and the k)-5.359 F .658 -.15(ey b)-.1 H(ind-).15 E 1.083 -(ings and v)108 616.8 R 1.083(ariables are set.)-.25 F 1.083 -(There are only a fe)6.083 F 3.583(wb)-.25 G 1.083(asic constructs allo) --3.583 F 1.084(wed in the readline init \214le.)-.25 F(Blank)6.084 E -.737(lines are ignored.)108 628.8 R .737(Lines be)5.737 F .737 -(ginning with a)-.15 F F2(#)3.237 E F0 .737(are comments.)3.237 F .737 -(Lines be)5.737 F .737(ginning with a)-.15 F F2($)3.237 E F0 .736 -(indicate conditional)3.236 F 2.614(constructs. Other)108 640.8 R .114 -(lines denote k)2.614 F .414 -.15(ey b)-.1 H .115(indings and v).15 F -.115(ariable settings.)-.25 F .115 -(Each program using this library may add)5.115 F(its o)108 652.8 Q -(wn commands and bindings.)-.25 E -.15(Fo)108 669.6 S 2.5(re).15 G -(xample, placing)-2.65 E(M\255Control\255u: uni)144 686.4 Q -.15(ve)-.25 -G(rsal\255ar).15 E(gument)-.18 E(or)108 698.4 Q(C\255Meta\255u: uni)144 -710.4 Q -.15(ve)-.25 G(rsal\255ar).15 E(gument)-.18 E(GNU Readline 4.3) -72 768 Q(2002 January 22)126.24 E(1)195.95 E EP -%%Page: 2 2 -%%BeginPageSetup -BP -%%EndPageSetup -/F0 10/Times-Roman@0 SF 342.2(READLINE\(3\) READLINE\(3\))72 48 R -(into the)108 84 Q/F1 10/Times-Italic@0 SF(inputr)2.5 E(c)-.37 E F0 -.1 -(wo)2.5 G(uld mak).1 E 2.5(eM)-.1 G(\255C\255u e)-2.5 E -.15(xe)-.15 G -(cute the readline command).15 E F1(univer)2.5 E(sal\255ar)-.1 E(gument) --.37 E F0(.).68 E 2.795(The follo)108 100.8 R 2.795 -(wing symbolic character names are recognized while processing k)-.25 F -3.095 -.15(ey b)-.1 H(indings:).15 E F1(DEL)5.295 E F0(,).53 E F1(ESC) -5.295 E F0(,).72 E F1(ESCAPE)108 112.8 Q F0(,).73 E F1(LFD)2.5 E F0(,) -.28 E F1(NEWLINE)2.5 E F0(,).73 E F1(RET)2.5 E F0(,)1.27 E F1(RETURN)2.5 -E F0(,)1.1 E F1 -.4(RU)2.5 G(BOUT).4 E F0(,)1.27 E F1(SP)2.5 E -.3(AC) --.9 G(E).3 E F0(,).73 E F1(SPC)2.5 E F0 2.5(,a).72 G(nd)-2.5 E F1 -.5 -(TA)2.5 G(B).5 E F0(.).27 E .209 -(In addition to command names, readline allo)108 129.6 R .209(ws k)-.25 -F -.15(ey)-.1 G 2.709(st).15 G 2.709(ob)-2.709 G 2.709(eb)-2.709 G .209 -(ound to a string that is inserted when the k)-2.709 F .509 -.15(ey i) --.1 H(s).15 E(pressed \(a)108 141.6 Q F1(macr)2.5 E(o)-.45 E F0(\).)A/F2 -10/Times-Bold@0 SF -.25(Ke)87 163.2 S 2.5(yB).25 G(indings)-2.5 E F0 -.382(The syntax for controlling k)108 175.2 R .682 -.15(ey b)-.1 H .382 -(indings in the).15 F F1(inputr)2.882 E(c)-.37 E F0 .382 -(\214le is simple.)2.882 F .382(All that is required is the name of the) -5.382 F .382(command or the te)108 187.2 R .383(xt of a macro and a k) --.15 F .683 -.15(ey s)-.1 H .383 -(equence to which it should be bound. The name may be speci-).15 F .853 -(\214ed in one of tw)108 199.2 R 3.353(ow)-.1 G .853 -(ays: as a symbolic k)-3.453 F 1.153 -.15(ey n)-.1 H .853 -(ame, possibly with).15 F F1(Meta\255)3.353 E F0(or)3.353 E F1(Contr) -3.353 E(ol\255)-.45 E F0(pre\214x)3.353 E .853(es, or as a k)-.15 F -.15 -(ey)-.1 G(sequence.)108 211.2 Q 1.766(When using the form)108 228 R F2 --.1(ke)4.266 G(yname).1 E F0(:)A F1(function-name).833 E F0(or)4.266 E -F1(macr)4.267 E(o)-.45 E F0(,)A F1 -.1(ke)4.267 G(yname)-.2 E F0 1.767 -(is the name of a k)4.267 F 2.067 -.15(ey s)-.1 H 1.767(pelled out in) -.15 F 2.5(English. F)108 240 R(or e)-.15 E(xample:)-.15 E -(Control\255u: uni)144 264 Q -.15(ve)-.25 G(rsal\255ar).15 E(gument)-.18 -E(Meta\255Rubout: backw)144 276 Q(ard\255kill\255w)-.1 E(ord)-.1 E -(Control\255o: "> output")144 288 Q .229(In the abo)108 304.8 R .529 --.15(ve ex)-.15 H(ample,).15 E F1(C\255u)2.729 E F0 .229 -(is bound to the function)2.729 F F2(uni)2.729 E -.1(ve)-.1 G -(rsal\255ar).1 E(gument)-.1 E F0(,)A F1(M-DEL)2.729 E F0 .228 -(is bound to the function)2.729 F F2(backward\255kill\255w)108 316.8 Q -(ord)-.1 E F0 3.837(,a)C(nd)-3.837 E F1(C\255o)3.837 E F0 1.337 -(is bound to run the macro e)3.837 F 1.337 -(xpressed on the right hand side \(that is, to)-.15 F(insert the te)108 -328.8 Q(xt)-.15 E/F3 10/Courier@0 SF 6(>o)2.5 G(utput)-6 E F0 -(into the line\).)2.5 E .056(In the second form,)108 345.6 R F2("k)2.556 -E(eyseq")-.1 E F0(:)A F1(function\255name).833 E F0(or)2.556 E F1(macr) -2.556 E(o)-.45 E F0(,)A F2 -.1(ke)2.556 G(yseq).1 E F0(dif)2.555 E .055 -(fers from)-.25 F F2 -.1(ke)2.555 G(yname).1 E F0(abo)2.555 E .355 -.15 -(ve i)-.15 H 2.555(nt).15 G .055(hat strings)-2.555 F 1.284 -(denoting an entire k)108 357.6 R 1.584 -.15(ey s)-.1 H 1.284(equence m\ -ay be speci\214ed by placing the sequence within double quotes.).15 F -(Some)6.284 E .386(GNU Emacs style k)108 369.6 R .686 -.15(ey e)-.1 H -.385(scapes can be used, as in the follo).15 F .385(wing e)-.25 F .385 -(xample, b)-.15 F .385(ut the symbolic character names)-.2 F -(are not recognized.)108 381.6 Q("\\C\255u": uni)144 405.6 Q -.15(ve) --.25 G(rsal\255ar).15 E(gument)-.18 E -("\\C\255x\\C\255r": re\255read\255init\255\214le)144 417.6 Q -("\\e[11~": "Function K)144 429.6 Q .3 -.15(ey 1)-.25 H(").15 E .237 -(In this e)108 446.4 R(xample,)-.15 E F1(C-u)2.737 E F0 .237(is ag)2.737 -F .238(ain bound to the function)-.05 F F2(uni)2.738 E -.1(ve)-.1 G -(rsal\255ar).1 E(gument)-.1 E F0(.)A F1 .238(C-x C-r)5.238 F F0 .238 -(is bound to the function)2.738 F F2 -.18(re)108 458.4 S.18 E -(ead\255init\255\214le)-.18 E F0 2.5(,a)C(nd)-2.5 E F1(ESC [ 1 1 ~)2.5 E -F0(is bound to insert the te)2.5 E(xt)-.15 E F3(Function Key 1)2.5 E F0 -(.)A(The full set of GNU Emacs style escape sequences a)108 475.2 Q -.25 -(va)-.2 G(ilable when specifying k).25 E .3 -.15(ey s)-.1 H(equences is) -.15 E F2<5c43ad>144 487.2 Q F0(control pre\214x)20.3 E F2<5c4dad>144 -499.2 Q F0(meta pre\214x)18.08 E F2(\\e)144 511.2 Q F0 -(an escape character)28.78 E F2(\\\\)144 523.2 Q F0(backslash)30.44 E F2 -(\\")144 535.2 Q F0(literal ", a double quote)27.67 E F2(\\')144 547.2 Q -F0(literal ', a single quote)29.89 E(In addition to the GNU Emacs style\ - escape sequences, a second set of backslash escapes is a)108 564 Q -.25 -(va)-.2 G(ilable:).25 E F2(\\a)144 576 Q F0(alert \(bell\))28.22 E F2 -(\\b)144 588 Q F0(backspace)27.66 E F2(\\d)144 600 Q F0(delete)27.66 E -F2(\\f)144 612 Q F0(form feed)29.89 E F2(\\n)144 624 Q F0(ne)27.66 E -(wline)-.25 E F2(\\r)144 636 Q F0(carriage return)28.78 E F2(\\t)144 648 -Q F0(horizontal tab)29.89 E F2(\\v)144 660 Q F0 -.15(ve)28.22 G -(rtical tab).15 E F2(\\)144 672 Q F1(nnn)A F0 -(the eight-bit character whose v)18.22 E(alue is the octal v)-.25 E -(alue)-.25 E F1(nnn)2.5 E F0(\(one to three digits\))2.5 E F2(\\x)144 -684 Q F1(HH)A F0(the eight-bit character whose v)13.78 E(alue is the he) --.25 E(xadecimal v)-.15 E(alue)-.25 E F1(HH)2.5 E F0(\(one or tw)2.5 E -2.5(oh)-.1 G .3 -.15(ex d)-2.5 H(igits\)).15 E .74(When entering the te) -108 700.8 R .74(xt of a macro, single or double quotes should be used t\ -o indicate a macro de\214nition.)-.15 F .089(Unquoted te)108 712.8 R -.089(xt is assumed to be a function name.)-.15 F .09(In the macro body) -5.089 F 2.59(,t)-.65 G .09(he backslash escapes described abo)-2.59 F --.15(ve)-.15 G(are e)108 724.8 Q 2.5(xpanded. Backslash)-.15 F -(will quote an)2.5 E 2.5(yo)-.15 G(ther character in the macro te)-2.5 E -(xt, including " and '.)-.15 E(GNU Readline 4.3)72 768 Q -(2002 January 22)126.24 E(2)195.95 E EP -%%Page: 3 3 -%%BeginPageSetup -BP -%%EndPageSetup -/F0 10/Times-Roman@0 SF 342.2(READLINE\(3\) READLINE\(3\))72 48 R/F1 10 -/Times-Bold@0 SF(Bash)108 84 Q F0(allo)2.93 E .43 -(ws the current readline k)-.25 F .73 -.15(ey b)-.1 H .429 -(indings to be displayed or modi\214ed with the).15 F F1(bind)2.929 E F0 --.2(bu)2.929 G .429(iltin command.).2 F 1.095 -(The editing mode may be switched during interacti)108 96 R 1.395 -.15 -(ve u)-.25 H 1.095(se by using the).15 F F13.595 E F0 1.095 -(option to the)3.595 F F1(set)3.595 E F0 -.2(bu)3.595 G 1.095 -(iltin com-).2 F 3.097(mand. Other)108 108 R .597 -(programs using this library pro)3.097 F .597(vide similar mechanisms.) --.15 F(The)5.597 E/F2 10/Times-Italic@0 SF(inputr)3.097 E(c)-.37 E F0 -.596(\214le may be edited and)3.096 F(re-read if a program does not pro) -108 120 Q(vide an)-.15 E 2.5(yo)-.15 G(ther means to incorporate ne)-2.5 -E 2.5(wb)-.25 G(indings.)-2.5 E F1 -.92(Va)87 136.8 S(riables).92 E F0 -.043(Readline has v)108 148.8 R .044 -(ariables that can be used to further customize its beha)-.25 F(vior)-.2 -E 5.044(.A)-.55 G -.25(va)-2.5 G .044(riable may be set in the).25 F F2 -(inpu-)2.544 E(tr)108 160.8 Q(c)-.37 E F0 -(\214le with a statement of the form)2.5 E F1(set)144 177.6 Q F2 -(variable\255name value)2.5 E F0 .807(Except where noted, readline v)108 -194.4 R .807(ariables can tak)-.25 F 3.307(et)-.1 G .807(he v)-3.307 F -(alues)-.25 E F1(On)3.307 E F0(or)3.307 E F1(Off)3.307 E F0 .807 -(\(without re)3.307 F -.05(ga)-.15 G .807(rd to case\).).05 F .807 -(The v)5.807 F(ari-)-.25 E(ables and their def)108 206.4 Q(ault v)-.1 E -(alues are:)-.25 E F1(bell\255style \(audible\))108 223.2 Q F0 .01 -(Controls what happens when readline w)144 235.2 R .011 -(ants to ring the terminal bell.)-.1 F .011(If set to)5.011 F F1(none) -2.511 E F0 2.511(,r)C .011(eadline ne)-2.511 F -.15(ve)-.25 G(r).15 E -.94(rings the bell.)144 247.2 R .94(If set to)5.94 F F1(visible)3.44 E -F0 3.44(,r)C .94(eadline uses a visible bell if one is a)-3.44 F -.25 -(va)-.2 G 3.44(ilable. If).25 F .94(set to)3.44 F F1(audible)3.44 E F0 -(,)A(readline attempts to ring the terminal')144 259.2 Q 2.5(sb)-.55 G -(ell.)-2.5 E F1(comment\255begin \(`)108 271.2 Q(`#')-.63 E('\))-.63 E -F0 .062(The string that is inserted in)144 283.2 R F1(vi)2.562 E F0 .062 -(mode when the)2.562 F F1(insert\255comment)2.562 E F0 .062 -(command is e)2.562 F -.15(xe)-.15 G 2.562(cuted. This).15 F(com-)2.562 -E(mand is bound to)144 295.2 Q F1(M\255#)2.5 E F0(in emacs mode and to) -2.5 E F1(#)2.5 E F0(in vi command mode.)2.5 E F1(completion\255ignor)108 -307.2 Q(e\255case \(Off\))-.18 E F0(If set to)144 319.2 Q F1(On)2.5 E F0 -2.5(,r)C(eadline performs \214lename matching and completion in a case\ -\255insensiti)-2.5 E .3 -.15(ve f)-.25 H(ashion.).05 E F1 -(completion\255query\255items \(100\))108 331.2 Q F0 .53 -(This determines when the user is queried about vie)144 343.2 R .529 -(wing the number of possible completions gen-)-.25 F .56(erated by the) -144 355.2 R F1(possible\255completions)3.06 E F0 3.06(command. It)3.06 F -.561(may be set to an)3.061 F 3.061(yi)-.15 G(nte)-3.061 E .561(ger v) --.15 F .561(alue greater than or)-.25 F .783(equal to zero.)144 367.2 R -.783(If the number of possible completions is greater than or equal to \ -the v)5.783 F .782(alue of this)-.25 F -.25(va)144 379.2 S .237 -(riable, the user is ask).25 F .237(ed whether or not he wishes to vie) --.1 F 2.737(wt)-.25 G .237(hem; otherwise the)-2.737 F 2.737(ya)-.15 G -.237(re simply listed)-2.737 F(on the terminal.)144 391.2 Q F1(con)108 -403.2 Q -.1(ve)-.4 G(rt\255meta \(On\)).1 E F0 .613(If set to)144 415.2 -R F1(On)3.113 E F0 3.113(,r)C .613(eadline will con)-3.113 F -.15(ve)-.4 -G .613(rt characters with the eighth bit set to an ASCII k).15 F .912 --.15(ey s)-.1 H .612(equence by).15 F 1.315(stripping the eighth bit an\ -d pre\214xing it with an escape character \(in ef)144 427.2 R 1.316 -(fect, using escape as the)-.25 F F2(meta pr)144 439.2 Q(e\214x)-.37 E -F0(\).)A F1(disable\255completion \(Off\))108 451.2 Q F0 .038(If set to) -144 463.2 R F1(On)2.538 E F0 2.538(,r)C .038(eadline will inhibit w) --2.538 F .038(ord completion.)-.1 F .038 -(Completion characters will be inserted into the)5.038 F(line as if the) -144 475.2 Q 2.5(yh)-.15 G(ad been mapped to)-2.5 E F1(self-insert)2.5 E -F0(.)A F1(editing\255mode \(emacs\))108 487.2 Q F0 .215 -(Controls whether readline be)144 499.2 R .215(gins with a set of k)-.15 -F .515 -.15(ey b)-.1 H .216(indings similar to emacs or vi.).15 F F1 -(editing\255mode)5.216 E F0(can be set to either)144 511.2 Q F1(emacs) -2.5 E F0(or)2.5 E F1(vi)2.5 E F0(.)A F1(enable\255k)108 523.2 Q -(eypad \(Off\))-.1 E F0 .893(When set to)144 535.2 R F1(On)3.393 E F0 -3.393(,r)C .893(eadline will try to enable the application k)-3.393 F --.15(ey)-.1 G .893(pad when it is called.).15 F .892(Some sys-)5.893 F -(tems need this to enable the arro)144 547.2 Q 2.5(wk)-.25 G -.15(ey) --2.6 G(s.).15 E F1(expand\255tilde \(Off\))108 559.2 Q F0(If set to)144 -571.2 Q F1(on)2.5 E F0 2.5(,t)C(ilde e)-2.5 E -(xpansion is performed when readline attempts w)-.15 E(ord completion.) --.1 E F1(history-pr)108 583.2 Q(eser)-.18 E -.1(ve)-.1 G(-point).1 E F0 -1.492(If set to)144 595.2 R F1(on)3.992 E F0 3.992(,t)C 1.493(he histor\ -y code attempts to place point at the same location on each history lin\ -e)-3.992 F(retri)144 607.2 Q -.15(ve)-.25 G 2.5(dw).15 G(ith)-2.5 E F1 -(pr)2.5 E -.15(ev)-.18 G(ious-history).15 E F0(or)2.5 E F1(next-history) -2.5 E F0(.)A F1(horizontal\255scr)108 619.2 Q(oll\255mode \(Off\))-.18 E -F0 .449(When set to)144 631.2 R F1(On)2.949 E F0 2.949(,m)C(ak)-2.949 E -.448(es readline use a single line for display)-.1 F 2.948(,s)-.65 G -.448(crolling the input horizontally on a)-2.948 F 1.194(single screen \ -line when it becomes longer than the screen width rather than wrapping \ -to a ne)144 643.2 R(w)-.25 E(line.)144 655.2 Q F1(input\255meta \(Off\)) -108 667.2 Q F0 .367(If set to)144 679.2 R F1(On)2.867 E F0 2.867(,r)C -.367(eadline will enable eight-bit input \(that is, it will not clear t\ -he eighth bit in the char)-2.867 F(-)-.2 E .956(acters it reads\), re) -144 691.2 R -.05(ga)-.15 G .956 -(rdless of what the terminal claims it can support.).05 F .957(The name) -5.956 F F1(meta\255\215ag)3.457 E F0 .957(is a)3.457 F(synon)144 703.2 Q -(ym for this v)-.15 E(ariable.)-.25 E(GNU Readline 4.3)72 768 Q -(2002 January 22)126.24 E(3)195.95 E EP -%%Page: 4 4 -%%BeginPageSetup -BP -%%EndPageSetup -/F0 10/Times-Roman@0 SF 342.2(READLINE\(3\) READLINE\(3\))72 48 R/F1 10 -/Times-Bold@0 SF(isear)108 84 Q(ch\255terminators \(`)-.18 E -(`C\255[ C\255J')-.63 E('\))-.63 E F0 .439(The string of characters tha\ -t should terminate an incremental search without subsequently e)144 96 R --.15(xe)-.15 G(cut-).15 E .934(ing the character as a command.)144 108 R -.935(If this v)5.935 F .935(ariable has not been gi)-.25 F -.15(ve)-.25 -G 3.435(nav).15 G .935(alue, the characters)-3.685 F/F2 10 -/Times-Italic@0 SF(ESC)3.435 E F0(and)144 120 Q F2(C\255J)2.5 E F0 -(will terminate an incremental search.)2.5 E F1 -.1(ke)108 132 S -(ymap \(emacs\)).1 E F0 2.323(Set the current readline k)144 144 R -.15 -(ey)-.1 G 4.823(map. The).15 F 2.323(set of le)4.823 F -.05(ga)-.15 G -4.823(lk).05 G -.15(ey)-4.923 G 2.323(map names is).15 F F2 2.323 -(emacs, emacs-standar)4.823 F(d,)-.37 E .808 -(emacs-meta, emacs-ctlx, vi, vi-mo)144 156 R(ve)-.1 E 3.308(,v)-.1 G -(i-command)-3.308 E F0 3.308(,a)C(nd)-3.308 E F2(vi-insert)3.308 E F0(.) -.68 E F2(vi)5.808 E F0 .808(is equi)3.308 F -.25(va)-.25 G .809(lent to) -.25 F F2(vi-command)3.309 E F0(;)A F2(emacs)144 168 Q F0 .697(is equi) -3.197 F -.25(va)-.25 G .697(lent to).25 F F2(emacs-standar)3.197 E(d) --.37 E F0 5.697(.T)C .697(he def)-5.697 F .697(ault v)-.1 F .697 -(alue is)-.25 F F2(emacs)3.197 E F0 5.697(.T).27 G .697(he v)-5.697 F -.697(alue of)-.25 F F1(editing\255mode)3.196 E F0(also af)144 180 Q -(fects the def)-.25 E(ault k)-.1 E -.15(ey)-.1 G(map.).15 E F1 -(mark\255dir)108 192 Q(ectories \(On\))-.18 E F0(If set to)144 204 Q F1 -(On)2.5 E F0 2.5(,c)C(ompleted directory names ha)-2.5 E .3 -.15(ve a s) --.2 H(lash appended.).15 E F1(mark\255modi\214ed\255lines \(Off\))108 -216 Q F0(If set to)144 228 Q F1(On)2.5 E F0 2.5(,h)C -(istory lines that ha)-2.5 E .3 -.15(ve b)-.2 H -(een modi\214ed are displayed with a preceding asterisk \().15 E F1(*)A -F0(\).)A F1(mark\255symlink)108 240 Q(ed\255dir)-.1 E(ectories \(Off\)) --.18 E F0 .175(If set to)144 252 R F1(On)2.675 E F0 2.675(,c)C .175 -(ompleted names which are symbolic links to directories ha)-2.675 F .475 --.15(ve a s)-.2 H .175(lash appended \(sub-).15 F(ject to the v)144 264 -Q(alue of)-.25 E F1(mark\255dir)2.5 E(ectories)-.18 E F0(\).)A F1 -(match\255hidden\255\214les \(On\))108 276 Q F0 .193(This v)144 288 R -.193(ariable, when set to)-.25 F F1(On)2.693 E F0 2.693(,c)C .192 -(auses readline to match \214les whose names be)-2.693 F .192 -(gin with a `.)-.15 F 2.692('\()-.7 G(hidden)-2.692 E 1.023 -(\214les\) when performing \214lename completion, unless the leading `.) -144 300 R 3.523('i)-.7 G 3.523(ss)-3.523 G 1.024 -(upplied by the user in the)-3.523 F(\214lename to be completed.)144 312 -Q F1(output\255meta \(Off\))108 324 Q F0 .507(If set to)144 336 R F1(On) -3.007 E F0 3.007(,r)C .507(eadline will display characters with the eig\ -hth bit set directly rather than as a meta-)-3.007 F(pre\214x)144 348 Q -(ed escape sequence.)-.15 E F1(page\255completions \(On\))108 360 Q F0 -.808(If set to)144 372 R F1(On)3.308 E F0 3.308(,r)C .808 -(eadline uses an internal)-3.308 F F2(mor)3.308 E(e)-.37 E F0(-lik)A -3.308(ep)-.1 G .808(ager to display a screenful of possible comple-) --3.308 F(tions at a time.)144 384 Q F1 -(print\255completions\255horizontally \(Off\))108 396 Q F0 1.319 -(If set to)144 408 R F1(On)3.819 E F0 3.819(,r)C 1.318(eadline will dis\ -play completions with matches sorted horizontally in alphabetical)-3.819 -F(order)144 420 Q 2.5(,r)-.4 G(ather than do)-2.5 E(wn the screen.)-.25 -E F1(sho)108 432 Q(w\255all\255if\255ambiguous \(Off\))-.1 E F0 .477 -(This alters the def)144 444 R .477(ault beha)-.1 F .477 -(vior of the completion functions.)-.2 F .478(If set to)5.478 F F1(on) -2.978 E F0 2.978(,w)C .478(ords which ha)-3.078 F .778 -.15(ve m)-.2 H -(ore).15 E 1.264(than one possible completion cause the matches to be l\ -isted immediately instead of ringing the)144 456 R(bell.)144 468 Q F1 -(visible\255stats \(Off\))108 480 Q F0 .846(If set to)144 492 R F1(On) -3.346 E F0 3.346(,ac)C .846(haracter denoting a \214le')-3.346 F 3.346 -(st)-.55 G .846(ype as reported by)-3.346 F F2(stat)3.346 E F0 .846 -(\(2\) is appended to the \214lename)B -(when listing possible completions.)144 504 Q F1(Conditional Constructs) -87 520.8 Q F0 .05(Readline implements a f)108 532.8 R .05(acility simil\ -ar in spirit to the conditional compilation features of the C preproces\ -sor)-.1 F .096(which allo)108 544.8 R .096(ws k)-.25 F .396 -.15(ey b) --.1 H .096(indings and v).15 F .096 -(ariable settings to be performed as the result of tests.)-.25 F .097 -(There are four parser)5.096 F(directi)108 556.8 Q -.15(ve)-.25 G 2.5 -(su).15 G(sed.)-2.5 E F1($if)108 573.6 Q F0(The)24.89 E F1($if)2.963 E -F0 .463(construct allo)2.963 F .462(ws bindings to be made based on the\ - editing mode, the terminal being used,)-.25 F .477 -(or the application using readline.)144 585.6 R .477(The te)5.477 F .477 -(xt of the test e)-.15 F .477 -(xtends to the end of the line; no characters)-.15 F -(are required to isolate it.)144 597.6 Q F1(mode)144 614.4 Q F0(The) -12.67 E F1(mode=)3.712 E F0 1.212(form of the)3.712 F F1($if)3.711 E F0 -(directi)3.711 E 1.511 -.15(ve i)-.25 H 3.711(su).15 G 1.211 -(sed to test whether readline is in emacs or vi)-3.711 F 3.065 -(mode. This)180 626.4 R .565(may be used in conjunction with the)3.065 F -F1 .565(set k)3.065 F(eymap)-.1 E F0 .565(command, for instance, to) -3.065 F .03(set bindings in the)180 638.4 R F2(emacs-standar)2.529 E(d) --.37 E F0(and)2.529 E F2(emacs-ctlx)2.529 E F0 -.1(ke)2.529 G .029 -(ymaps only if readline is starting out)-.05 F(in emacs mode.)180 650.4 -Q F1(term)144 667.2 Q F0(The)15.46 E F1(term=)3.196 E F0 .696 -(form may be used to include terminal-speci\214c k)3.196 F .996 -.15 -(ey b)-.1 H .697(indings, perhaps to bind).15 F .654(the k)180 679.2 R -.954 -.15(ey s)-.1 H .654(equences output by the terminal').15 F 3.154 -(sf)-.55 G .654(unction k)-3.154 F -.15(ey)-.1 G 3.154(s. The).15 F -.1 -(wo)3.154 G .654(rd on the right side of).1 F(the)180 691.2 Q F1(=)3.003 -E F0 .503(is tested ag)3.003 F .504(ainst the full name of the terminal\ - and the portion of the terminal name)-.05 F(before the \214rst)180 -703.2 Q F12.5 E F0 5(.T)C(his allo)-5 E(ws)-.25 E F2(sun)2.5 E F0 -(to match both)2.5 E F2(sun)2.5 E F0(and)2.5 E F2(sun\255cmd)2.5 E F0 -2.5(,f).77 G(or instance.)-2.5 E(GNU Readline 4.3)72 768 Q -(2002 January 22)126.24 E(4)195.95 E EP -%%Page: 5 5 -%%BeginPageSetup -BP -%%EndPageSetup -/F0 10/Times-Roman@0 SF 342.2(READLINE\(3\) READLINE\(3\))72 48 R/F1 10 -/Times-Bold@0 SF(application)144 84 Q F0(The)180 96 Q F1(application) -3.003 E F0 .503 -(construct is used to include application-speci\214c settings.)3.003 F -.503(Each program)5.503 F .114(using the readline library sets the)180 -108 R/F2 10/Times-Italic@0 SF .114(application name)2.614 F F0 2.614(,a) -C .114(nd an initialization \214le can test for a)-2.614 F .501 -(particular v)180 120 R 3.001(alue. This)-.25 F .501 -(could be used to bind k)3.001 F .801 -.15(ey s)-.1 H .5 -(equences to functions useful for a spe-).15 F .396(ci\214c program.)180 -132 R -.15(Fo)5.396 G 2.896(ri).15 G .396(nstance, the follo)-2.896 F -.396(wing command adds a k)-.25 F .696 -.15(ey s)-.1 H .397 -(equence that quotes the).15 F(current or pre)180 144 Q(vious w)-.25 E -(ord in Bash:)-.1 E F1($if)180 168 Q F0(Bash)2.5 E 2.5(#Q)180 180 S -(uote the current or pre)-2.5 E(vious w)-.25 E(ord)-.1 E -("\\C-xq": "\\eb\\"\\ef\\"")180 192 Q F1($endif)180 204 Q($endif)108 -220.8 Q F0(This command, as seen in the pre)9.33 E(vious e)-.25 E -(xample, terminates an)-.15 E F1($if)2.5 E F0(command.)2.5 E F1($else) -108 237.6 Q F0(Commands in this branch of the)15.45 E F1($if)2.5 E F0 -(directi)2.5 E .3 -.15(ve a)-.25 H(re e).15 E -.15(xe)-.15 G -(cuted if the test f).15 E(ails.)-.1 E F1($include)108 254.4 Q F0 .357 -(This directi)144 266.4 R .657 -.15(ve t)-.25 H(ak).15 E .357 -(es a single \214lename as an ar)-.1 F .356 -(gument and reads commands and bindings from that)-.18 F 2.5(\214le. F) -144 278.4 R(or e)-.15 E(xample, the follo)-.15 E(wing directi)-.25 E .3 --.15(ve w)-.25 H(ould read).05 E F2(/etc/inputr)2.5 E(c)-.37 E F0(:)A F1 -($include)144 302.4 Q F2(/etc/inputr)5.833 E(c)-.37 E/F3 10.95 -/Times-Bold@0 SF(SEARCHING)72 319.2 Q F0 1.003(Readline pro)108 331.2 R -1.003(vides commands for searching through the command history for line\ -s containing a speci\214ed)-.15 F 2.5(string. There)108 343.2 R(are tw) -2.5 E 2.5(os)-.1 G(earch modes:)-2.5 E F2(incr)2.5 E(emental)-.37 E F0 -(and)2.5 E F2(non-incr)2.5 E(emental)-.37 E F0(.).51 E .698 -(Incremental searches be)108 360 R .698 -(gin before the user has \214nished typing the search string.)-.15 F -.697(As each character of the)5.697 F .112 -(search string is typed, readline displays the ne)108 372 R .112 -(xt entry from the history matching the string typed so f)-.15 F(ar)-.1 -E 5.113(.A)-.55 G(n)-5.113 E .545 -(incremental search requires only as man)108 384 R 3.045(yc)-.15 G .544 -(haracters as needed to \214nd the desired history entry)-3.045 F 5.544 -(.T)-.65 G 3.044(os)-6.344 G(earch)-3.044 E(backw)108 396 Q .18 -(ard in the history for a particular string, type)-.1 F F1(C\255r)2.681 -E F0 5.181(.T)C(yping)-5.981 E F1(C\255s)2.681 E F0 .181(searches forw) -2.681 F .181(ard through the history)-.1 F(.)-.65 E .354 -(The characters present in the v)108 408 R .354(alue of the)-.25 F F1 -(isear)2.854 E(ch-terminators)-.18 E F0 -.25(va)2.854 G .354 -(riable are used to terminate an incremen-).25 F .6(tal search.)108 420 -R .6(If that v)5.6 F .6(ariable has not been assigned a v)-.25 F .6 -(alue the)-.25 F F2(Escape)3.1 E F0(and)3.1 E F1(C\255J)3.1 E F0 .6 -(characters will terminate an)3.1 F .123(incremental search.)108 432 R -F1(C\255G)5.123 E F0 .123 -(will abort an incremental search and restore the original line.)2.623 F -.122(When the search is)5.122 F(terminated, the history entry containin\ -g the search string becomes the current line.)108 444 Q 2.406 -.8 -(To \214)108 460.8 T .806 -(nd other matching entries in the history list, type).8 F F1(C\255s) -3.306 E F0(or)3.306 E F1(C\255r)3.306 E F0 .806(as appropriate.)3.306 F -.807(This will search back-)5.806 F -.1(wa)108 472.8 S 1.309(rd or forw) -.1 F 1.309(ard in the history for the ne)-.1 F 1.309 -(xt line matching the search string typed so f)-.15 F(ar)-.1 E 6.309(.A) --.55 G 1.609 -.15(ny o)-6.309 H 1.308(ther k).15 F -.15(ey)-.1 G .317 -(sequence bound to a readline command will terminate the search and e) -108 484.8 R -.15(xe)-.15 G .318(cute that command.).15 F -.15(Fo)5.318 G -2.818(ri).15 G(nstance,)-2.818 E 3.481(an)108 496.8 S -.25(ew)-3.481 G -.981(line will terminate the search and accept the line, thereby e).25 F --.15(xe)-.15 G .98(cuting the command from the history).15 F 3.061 -(list. A)108 508.8 R(mo)3.061 E -.15(ve)-.15 G .562 -(ment command will terminate the search, mak).15 F 3.062(et)-.1 G .562 -(he last line found the current line, and be)-3.062 F(gin)-.15 E -(editing.)108 520.8 Q .567(Non-incremental searches read the entire sea\ -rch string before starting to search for matching history lines.)108 -537.6 R(The search string may be typed by the user or be part of the co\ -ntents of the current line.)108 549.6 Q F3(EDITING COMMANDS)72 566.4 Q -F0 1.391(The follo)108 578.4 R 1.391 -(wing is a list of the names of the commands and the def)-.25 F 1.391 -(ault k)-.1 F 1.691 -.15(ey s)-.1 H 1.391(equences to which the).15 F -3.892(ya)-.15 G(re)-3.892 E 2.5(bound. Command)108 590.4 R -(names without an accompan)2.5 E(ying k)-.15 E .3 -.15(ey s)-.1 H -(equence are unbound by def).15 E(ault.)-.1 E .055(In the follo)108 -607.2 R .055(wing descriptions,)-.25 F F2(point)2.555 E F0 .055 -(refers to the current cursor position, and)2.555 F F2(mark)2.555 E F0 -.054(refers to a cursor position)2.554 F(sa)108 619.2 Q -.15(ve)-.2 G -2.5(db).15 G 2.5(yt)-2.5 G(he)-2.5 E F1(set\255mark)2.5 E F0 2.5 -(command. The)2.5 F(te)2.5 E -(xt between the point and mark is referred to as the)-.15 E F2 -.37(re) -2.5 G(gion)-.03 E F0(.)A F1(Commands f)87 636 Q(or Mo)-.25 E(ving)-.1 E -(beginning\255of\255line \(C\255a\))108 648 Q F0(Mo)144 660 Q .3 -.15 -(ve t)-.15 H 2.5(ot).15 G(he start of the current line.)-2.5 E F1 -(end\255of\255line \(C\255e\))108 672 Q F0(Mo)144 684 Q .3 -.15(ve t) --.15 H 2.5(ot).15 G(he end of the line.)-2.5 E F1 -.25(fo)108 696 S -(rward\255char \(C\255f\)).25 E F0(Mo)144 708 Q .3 -.15(ve f)-.15 H(orw) -.15 E(ard a character)-.1 E(.)-.55 E(GNU Readline 4.3)72 768 Q -(2002 January 22)126.24 E(5)195.95 E EP -%%Page: 6 6 -%%BeginPageSetup -BP -%%EndPageSetup -/F0 10/Times-Roman@0 SF 342.2(READLINE\(3\) READLINE\(3\))72 48 R/F1 10 -/Times-Bold@0 SF(backward\255char \(C\255b\))108 84 Q F0(Mo)144 96 Q .3 --.15(ve b)-.15 H(ack a character).15 E(.)-.55 E F1 -.25(fo)108 108 S -(rward\255w).25 E(ord \(M\255f\))-.1 E F0(Mo)144 120 Q .822 -.15(ve f) --.15 H(orw).15 E .522(ard to the end of the ne)-.1 F .523(xt w)-.15 F -3.023(ord. W)-.1 F .523 -(ords are composed of alphanumeric characters \(let-)-.8 F -(ters and digits\).)144 132 Q F1(backward\255w)108 144 Q(ord \(M\255b\)) --.1 E F0(Mo)144 156 Q 1.71 -.15(ve b)-.15 H 1.41 -(ack to the start of the current or pre).15 F 1.41(vious w)-.25 F 3.91 -(ord. W)-.1 F 1.41(ords are composed of alphanumeric)-.8 F -(characters \(letters and digits\).)144 168 Q F1(clear\255scr)108 180 Q -(een \(C\255l\))-.18 E F0 .993(Clear the screen lea)144 192 R .993 -(ving the current line at the top of the screen.)-.2 F -.4(Wi)5.993 G -.993(th an ar).4 F .993(gument, refresh the)-.18 F -(current line without clearing the screen.)144 204 Q F1 -.18(re)108 216 -S(draw\255curr).18 E(ent\255line)-.18 E F0(Refresh the current line.)144 -228 Q F1(Commands f)87 244.8 Q(or Manipulating the History)-.25 E -(accept\255line \(Newline, Retur)108 256.8 Q(n\))-.15 E F0 .365 -(Accept the line re)144 268.8 R -.05(ga)-.15 G .364 -(rdless of where the cursor is.).05 F .364(If this line is non-empty) -5.364 F 2.864(,i)-.65 G 2.864(tm)-2.864 G .364(ay be added to the)-2.864 -F .74(history list for future recall with)144 280.8 R F1 -(add_history\(\))3.24 E F0 5.741(.I)C 3.241(ft)-5.741 G .741 -(he line is a modi\214ed history line, the history)-3.241 F -(line is restored to its original state.)144 292.8 Q F1(pr)108 304.8 Q --.15(ev)-.18 G(ious\255history \(C\255p\)).15 E F0(Fetch the pre)144 -316.8 Q(vious command from the history list, mo)-.25 E -(ving back in the list.)-.15 E F1(next\255history \(C\255n\))108 328.8 Q -F0(Fetch the ne)144 340.8 Q(xt command from the history list, mo)-.15 E -(ving forw)-.15 E(ard in the list.)-.1 E F1 -(beginning\255of\255history \(M\255<\))108 352.8 Q F0(Mo)144 364.8 Q .3 --.15(ve t)-.15 H 2.5(ot).15 G(he \214rst line in the history)-2.5 E(.) --.65 E F1(end\255of\255history \(M\255>\))108 376.8 Q F0(Mo)144 388.8 Q -.3 -.15(ve t)-.15 H 2.5(ot).15 G(he end of the input history)-2.5 E 2.5 -(,i)-.65 G(.e., the line currently being entered.)-2.5 E F1 -2.29 -.18 -(re v)108 400.8 T(erse\255sear).08 E(ch\255history \(C\255r\))-.18 E F0 -1.471(Search backw)144 412.8 R 1.471 -(ard starting at the current line and mo)-.1 F 1.47 -(ving `up' through the history as necessary)-.15 F(.)-.65 E -(This is an incremental search.)144 424.8 Q F1 -.25(fo)108 436.8 S -(rward\255sear).25 E(ch\255history \(C\255s\))-.18 E F0 1.131 -(Search forw)144 448.8 R 1.131(ard starting at the current line and mo) --.1 F 1.132(ving `do)-.15 F 1.132(wn' through the history as necessary) --.25 F(.)-.65 E(This is an incremental search.)144 460.8 Q F1 -(non\255incr)108 472.8 Q(emental\255r)-.18 E -2.3 -.15(ev e)-.18 H -(rse\255sear).15 E(ch\255history \(M\255p\))-.18 E F0 .165(Search backw) -144 484.8 R .164(ard through the history starting at the current line u\ -sing a non-incremental search for)-.1 F 2.5(as)144 496.8 S -(tring supplied by the user)-2.5 E(.)-.55 E F1(non\255incr)108 508.8 Q -(emental\255f)-.18 E(orward\255sear)-.25 E(ch\255history \(M\255n\))-.18 -E F0 1.353(Search forw)144 520.8 R 1.354(ard through the history using \ -a non-incremental search for a string supplied by the)-.1 F(user)144 -532.8 Q(.)-.55 E F1(history\255sear)108 544.8 Q(ch\255f)-.18 E(orward) --.25 E F0 .249(Search forw)144 556.8 R .249(ard through the history for\ - the string of characters between the start of the current line)-.1 F -(and the current cursor position \(the)144 568.8 Q/F2 10/Times-Italic@0 -SF(point)2.5 E F0 2.5(\). This)B(is a non-incremental search.)2.5 E F1 -(history\255sear)108 580.8 Q(ch\255backward)-.18 E F0 .95(Search backw) -144 592.8 R .951(ard through the history for the string of characters b\ -etween the start of the current)-.1 F(line and the point.)144 604.8 Q -(This is a non-incremental search.)5 E F1(yank\255nth\255ar)108 616.8 Q -2.5(g\()-.1 G<4dad43ad7929>-2.5 E F0 .622(Insert the \214rst ar)144 -628.8 R .622(gument to the pre)-.18 F .622 -(vious command \(usually the second w)-.25 F .622(ord on the pre)-.1 F -.622(vious line\))-.25 F .794(at point.)144 640.8 R -.4(Wi)5.794 G .794 -(th an ar).4 F(gument)-.18 E F2(n)3.294 E F0 3.294(,i).24 G .794 -(nsert the)-3.294 F F2(n)3.294 E F0 .794(th w)B .794(ord from the pre) --.1 F .794(vious command \(the w)-.25 F .795(ords in the)-.1 F(pre)144 -652.8 Q .292(vious command be)-.25 F .292(gin with w)-.15 F .291 -(ord 0\).)-.1 F 2.791(An)5.291 G -2.25 -.15(eg a)-2.791 H(ti).15 E .591 --.15(ve a)-.25 H -.18(rg).15 G .291(ument inserts the).18 F F2(n)2.791 E -F0 .291(th w)B .291(ord from the end of)-.1 F(the pre)144 664.8 Q -(vious command.)-.25 E F1(yank\255last\255ar)108 676.8 Q 2.5(g\()-.1 G --1.667(M\255. ,)-2.5 F -1.667(M\255_ \))2.5 F F0 1.307 -(Insert the last ar)144 688.8 R 1.307(gument to the pre)-.18 F 1.307 -(vious command \(the last w)-.25 F 1.308(ord of the pre)-.1 F 1.308 -(vious history entry\).)-.25 F -.4(Wi)144 700.8 S .736(th an ar).4 F -.736(gument, beha)-.18 F 1.036 -.15(ve ex)-.2 H .736(actly lik).15 F(e) --.1 E F1(yank\255nth\255ar)3.235 E(g)-.1 E F0 5.735(.S)C(uccessi)-5.735 -E 1.035 -.15(ve c)-.25 H .735(alls to).15 F F1(yank\255last\255ar)3.235 -E(g)-.1 E F0(mo)3.235 E -.15(ve)-.15 G -(back through the history list, inserting the last ar)144 712.8 Q -(gument of each line in turn.)-.18 E(GNU Readline 4.3)72 768 Q -(2002 January 22)126.24 E(6)195.95 E EP -%%Page: 7 7 -%%BeginPageSetup -BP -%%EndPageSetup -/F0 10/Times-Roman@0 SF 342.2(READLINE\(3\) READLINE\(3\))72 48 R/F1 10 -/Times-Bold@0 SF(Commands f)87 84 Q(or Changing T)-.25 E(ext)-.92 E -(delete\255char \(C\255d\))108 96 Q F0 .357 -(Delete the character at point.)144 108 R .358(If point is at the be) -5.358 F .358(ginning of the line, there are no characters in the)-.15 F -(line, and the last character typed w)144 120 Q(as not bound to)-.1 E F1 -(delete\255char)2.5 E F0 2.5(,t)C(hen return)-2.5 E/F2 9/Times-Bold@0 SF -(EOF)2.5 E/F3 9/Times-Roman@0 SF(.)A F1 -(backward\255delete\255char \(Rubout\))108 132 Q F0 .553 -(Delete the character behind the cursor)144 144 R 5.553(.W)-.55 G .553 -(hen gi)-5.553 F -.15(ve)-.25 G 3.053(nan).15 G .553(umeric ar)-3.053 F -.552(gument, sa)-.18 F .852 -.15(ve t)-.2 H .552(he deleted te).15 F -.552(xt on)-.15 F(the kill ring.)144 156 Q F1 -.25(fo)108 168 S -(rward\255backward\255delete\255char).25 E F0 .473 -(Delete the character under the cursor)144 180 R 2.973(,u)-.4 G .474 -(nless the cursor is at the end of the line, in which case the)-2.973 F -(character behind the cursor is deleted.)144 192 Q F1 -(quoted\255insert \(C\255q, C\255v\))108 204 Q F0 1.229(Add the ne)144 -216 R 1.228(xt character that you type to the line v)-.15 F 3.728 -(erbatim. This)-.15 F 1.228(is ho)3.728 F 3.728(wt)-.25 G 3.728(oi) --3.728 G 1.228(nsert characters lik)-3.728 F(e)-.1 E F1(C\255q)144 228 Q -F0 2.5(,f)C(or e)-2.5 E(xample.)-.15 E F1(tab\255insert \(M-T)108 240 Q -(AB\))-.9 E F0(Insert a tab character)144 252 Q(.)-.55 E F1 -(self\255insert \(a, b, A, 1, !, ...\))108 264 Q F0 -(Insert the character typed.)144 276 Q F1(transpose\255chars \(C\255t\)) -108 288 Q F0 .321(Drag the character before point forw)144 300 R .321 -(ard o)-.1 F -.15(ve)-.15 G 2.821(rt).15 G .321 -(he character at point, mo)-2.821 F .322(ving point forw)-.15 F .322 -(ard as well.)-.1 F 1.182 -(If point is at the end of the line, then this transposes the tw)144 312 -R 3.682(oc)-.1 G 1.182(haracters before point.)-3.682 F(Ne)6.182 E -.05 -(ga)-.15 G(ti).05 E -.15(ve)-.25 G(ar)144 324 Q(guments ha)-.18 E .3 --.15(ve n)-.2 H 2.5(oe).15 G -.25(ff)-2.5 G(ect.).25 E F1 -(transpose\255w)108 336 Q(ords \(M\255t\))-.1 E F0 .023(Drag the w)144 -348 R .023(ord before point past the w)-.1 F .023(ord after point, mo) --.1 F .023(ving point o)-.15 F -.15(ve)-.15 G 2.524(rt).15 G .024(hat w) --2.524 F .024(ord as well.)-.1 F .024(If point)5.024 F -(is at the end of the line, this transposes the last tw)144 360 Q 2.5 -(ow)-.1 G(ords on the line.)-2.6 E F1(upcase\255w)108 372 Q -(ord \(M\255u\))-.1 E F0 1.699(Uppercase the current \(or follo)144 384 -R 1.698(wing\) w)-.25 F 4.198(ord. W)-.1 F 1.698(ith a ne)-.4 F -.05(ga) --.15 G(ti).05 E 1.998 -.15(ve a)-.25 H -.18(rg).15 G 1.698 -(ument, uppercase the pre).18 F(vious)-.25 E -.1(wo)144 396 S(rd, b).1 E -(ut do not mo)-.2 E .3 -.15(ve p)-.15 H(oint.).15 E F1(do)108 408 Q -(wncase\255w)-.1 E(ord \(M\255l\))-.1 E F0(Lo)144 420 Q 1.647 -(wercase the current \(or follo)-.25 F 1.647(wing\) w)-.25 F 4.147 -(ord. W)-.1 F 1.648(ith a ne)-.4 F -.05(ga)-.15 G(ti).05 E 1.948 -.15 -(ve a)-.25 H -.18(rg).15 G 1.648(ument, lo).18 F 1.648(wercase the pre) --.25 F(vious)-.25 E -.1(wo)144 432 S(rd, b).1 E(ut do not mo)-.2 E .3 --.15(ve p)-.15 H(oint.).15 E F1(capitalize\255w)108 444 Q -(ord \(M\255c\))-.1 E F0 1.975(Capitalize the current \(or follo)144 456 -R 1.974(wing\) w)-.25 F 4.474(ord. W)-.1 F 1.974(ith a ne)-.4 F -.05(ga) --.15 G(ti).05 E 2.274 -.15(ve a)-.25 H -.18(rg).15 G 1.974 -(ument, capitalize the pre).18 F(vious)-.25 E -.1(wo)144 468 S(rd, b).1 -E(ut do not mo)-.2 E .3 -.15(ve p)-.15 H(oint.).15 E F1 -.1(ove)108 480 -S(rwrite\255mode).1 E F0 -.8(To)144 492 S .437(ggle o).8 F -.15(ve)-.15 -G .437(rwrite mode.).15 F -.4(Wi)5.437 G .437(th an e).4 F .437 -(xplicit positi)-.15 F .738 -.15(ve n)-.25 H .438(umeric ar).15 F .438 -(gument, switches to o)-.18 F -.15(ve)-.15 G .438(rwrite mode.).15 F -.4 -(Wi)144 504 S .781(th an e).4 F .781(xplicit non-positi)-.15 F 1.081 --.15(ve n)-.25 H .781(umeric ar).15 F .781 -(gument, switches to insert mode.)-.18 F .78(This command af)5.781 F -(fects)-.25 E(only)144 516 Q F1(emacs)4.394 E F0(mode;)4.394 E F1(vi) -4.394 E F0 1.894(mode does o)4.394 F -.15(ve)-.15 G 1.894(rwrite dif).15 -F(ferently)-.25 E 6.894(.E)-.65 G 1.894(ach call to)-6.894 F/F4 10 -/Times-Italic@0 SF -.37(re)4.395 G(adline\(\)).37 E F0 1.895 -(starts in insert)4.395 F 3.969(mode. In)144 528 R -.15(ove)3.969 G -1.469(rwrite mode, characters bound to).15 F F1(self\255insert)3.969 E -F0 1.468(replace the te)3.969 F 1.468(xt at point rather than)-.15 F -.957(pushing the te)144 540 R .957(xt to the right.)-.15 F .958 -(Characters bound to)5.957 F F1(backward\255delete\255char)3.458 E F0 -.958(replace the character)3.458 F(before point with a space.)144 552 Q -(By def)5 E(ault, this command is unbound.)-.1 E F1(Killing and Y)87 -568.8 Q(anking)-.85 E(kill\255line \(C\255k\))108 580.8 Q F0 -(Kill the te)144 592.8 Q(xt from point to the end of the line.)-.15 E F1 -(backward\255kill\255line \(C\255x Rubout\))108 604.8 Q F0(Kill backw) -144 616.8 Q(ard to the be)-.1 E(ginning of the line.)-.15 E F1 -(unix\255line\255discard \(C\255u\))108 628.8 Q F0(Kill backw)144 640.8 -Q(ard from point to the be)-.1 E(ginning of the line.)-.15 E -(The killed te)5 E(xt is sa)-.15 E -.15(ve)-.2 G 2.5(do).15 G 2.5(nt) --2.5 G(he kill-ring.)-2.5 E F1(kill\255whole\255line)108 652.8 Q F0 -(Kill all characters on the current line, no matter where point is.)144 -664.8 Q F1(kill\255w)108 676.8 Q(ord \(M\255d\))-.1 E F0 1.308 -(Kill from point the end of the current w)144 688.8 R 1.308 -(ord, or if between w)-.1 F 1.308(ords, to the end of the ne)-.1 F 1.307 -(xt w)-.15 F(ord.)-.1 E -.8(Wo)144 700.8 S -(rd boundaries are the same as those used by).8 E F1 -.25(fo)2.5 G -(rward\255w).25 E(ord)-.1 E F0(.)A(GNU Readline 4.3)72 768 Q -(2002 January 22)126.24 E(7)195.95 E EP -%%Page: 8 8 -%%BeginPageSetup -BP -%%EndPageSetup -/F0 10/Times-Roman@0 SF 342.2(READLINE\(3\) READLINE\(3\))72 48 R/F1 10 -/Times-Bold@0 SF(backward\255kill\255w)108 84 Q(ord \(M\255Rubout\))-.1 -E F0(Kill the w)144 96 Q(ord behind point.)-.1 E -.8(Wo)5 G -(rd boundaries are the same as those used by).8 E F1(backward\255w)2.5 E -(ord)-.1 E F0(.)A F1(unix\255w)108 108 Q(ord\255rubout \(C\255w\))-.1 E -F0 .364(Kill the w)144 120 R .364 -(ord behind point, using white space as a w)-.1 F .365(ord boundary)-.1 -F 5.365(.T)-.65 G .365(he killed te)-5.365 F .365(xt is sa)-.15 F -.15 -(ve)-.2 G 2.865(do).15 G 2.865(nt)-2.865 G(he)-2.865 E(kill-ring.)144 -132 Q F1(delete\255horizontal\255space \(M\255\\\))108 144 Q F0 -(Delete all spaces and tabs around point.)144 156 Q F1(kill\255r)108 168 -Q(egion)-.18 E F0 1.13(Kill the te)144 180 R 1.13 -(xt between the point and)-.15 F/F2 10/Times-Italic@0 SF(mark)3.63 E F0 -(\(sa)3.63 E -.15(ve)-.2 G 3.63(dc).15 G 1.13(ursor position\).)-3.63 F -1.13(This te)6.13 F 1.13(xt is referred to as the)-.15 F F2 -.37(re)144 -192 S(gion)-.03 E F0(.)A F1(copy\255r)108 204 Q(egion\255as\255kill)-.18 -E F0(Cop)144 216 Q 2.5(yt)-.1 G(he te)-2.5 E(xt in the re)-.15 E -(gion to the kill b)-.15 E(uf)-.2 E(fer)-.25 E(.)-.55 E F1 -(copy\255backward\255w)108 228 Q(ord)-.1 E F0(Cop)144 240 Q 4.8(yt)-.1 G -2.3(he w)-4.8 F 2.3(ord before point to the kill b)-.1 F(uf)-.2 E(fer) --.25 E 7.301(.T)-.55 G 2.301(he w)-7.301 F 2.301 -(ord boundaries are the same as)-.1 F F1(back-)4.801 E(ward\255w)144 252 -Q(ord)-.1 E F0(.)A F1(copy\255f)108 264 Q(orward\255w)-.25 E(ord)-.1 E -F0(Cop)144 276 Q 4.508(yt)-.1 G 2.008(he w)-4.508 F 2.008(ord follo)-.1 -F 2.008(wing point to the kill b)-.25 F(uf)-.2 E(fer)-.25 E 7.007(.T) --.55 G 2.007(he w)-7.007 F 2.007(ord boundaries are the same as)-.1 F F1 --.25(fo)4.507 G -.37(r-).25 G(ward\255w)144 288 Q(ord)-.1 E F0(.)A F1 -(yank \(C\255y\))108 300 Q F0 -1(Ya)144 312 S -(nk the top of the kill ring into the b)1 E(uf)-.2 E(fer at point.)-.25 -E F1(yank\255pop \(M\255y\))108 324 Q F0 -(Rotate the kill ring, and yank the ne)144 336 Q 2.5(wt)-.25 G 2.5 -(op. Only)-2.5 F -.1(wo)2.5 G(rks follo).1 E(wing)-.25 E F1(yank)2.5 E -F0(or)2.5 E F1(yank\255pop)2.5 E F0(.)A F1(Numeric Ar)87 352.8 Q -(guments)-.1 E(digit\255ar)108 364.8 Q -(gument \(M\2550, M\2551, ..., M\255\255\))-.1 E F0 .641 -(Add this digit to the ar)144 376.8 R .641 -(gument already accumulating, or start a ne)-.18 F 3.141(wa)-.25 G -.18 -(rg)-3.141 G 3.142(ument. M\255\255).18 F .642(starts a ne)3.142 F(g-) --.15 E(ati)144 388.8 Q .3 -.15(ve a)-.25 H -.18(rg).15 G(ument.).18 E F1 -(uni)108 400.8 Q -.1(ve)-.1 G(rsal\255ar).1 E(gument)-.1 E F0 .779 -(This is another w)144 412.8 R .779(ay to specify an ar)-.1 F 3.279 -(gument. If)-.18 F .779(this command is follo)3.279 F .778 -(wed by one or more digits,)-.25 F 1.376 -(optionally with a leading minus sign, those digits de\214ne the ar)144 -424.8 R 3.876(gument. If)-.18 F 1.376(the command is fol-)3.876 F(lo)144 -436.8 Q 1.17(wed by digits, e)-.25 F -.15(xe)-.15 G(cuting).15 E F1(uni) -3.67 E -.1(ve)-.1 G(rsal\255ar).1 E(gument)-.1 E F0(ag)3.67 E 1.17 -(ain ends the numeric ar)-.05 F 1.17(gument, b)-.18 F 1.17(ut is other) --.2 F(-)-.2 E .898(wise ignored.)144 448.8 R .898 -(As a special case, if this command is immediately follo)5.898 F .898 -(wed by a character that is)-.25 F .243 -(neither a digit or minus sign, the ar)144 460.8 R .243 -(gument count for the ne)-.18 F .243(xt command is multiplied by four) --.15 F 5.242(.T)-.55 G(he)-5.242 E(ar)144 472.8 Q .378 -(gument count is initially one, so e)-.18 F -.15(xe)-.15 G .378 -(cuting this function the \214rst time mak).15 F .378(es the ar)-.1 F -.378(gument count)-.18 F(four)144 484.8 Q 2.5(,as)-.4 G(econd time mak) --2.5 E(es the ar)-.1 E(gument count sixteen, and so on.)-.18 E F1 -(Completing)87 501.6 Q(complete \(T)108 513.6 Q(AB\))-.9 E F0 1.909 -(Attempt to perform completion on the te)144 525.6 R 1.908 -(xt before point.)-.15 F 1.908(The actual completion performed is)6.908 -F(application-speci\214c.)144 537.6 Q F1(Bash)5.517 E F0 3.017(,f)C .518 -(or instance, attempts completion treating the te)-3.017 F .518 -(xt as a v)-.15 F .518(ariable \(if the)-.25 F(te)144 549.6 Q .657 -(xt be)-.15 F .657(gins with)-.15 F F1($)3.156 E F0 .656 -(\), username \(if the te)B .656(xt be)-.15 F .656(gins with)-.15 F F1 -(~)3.156 E F0 .656(\), hostname \(if the te)B .656(xt be)-.15 F .656 -(gins with)-.15 F F1(@)3.156 E F0 .656(\), or)B .929 -(command \(including aliases and functions\) in turn.)144 561.6 R .93 -(If none of these produces a match, \214lename)5.929 F 1.274 -(completion is attempted.)144 573.6 R F1(Gdb)6.273 E F0 3.773(,o)C 3.773 -(nt)-3.773 G 1.273(he other hand, allo)-3.773 F 1.273 -(ws completion of program functions and)-.25 F -.25(va)144 585.6 S(riab\ -les, and only attempts \214lename completion under certain circumstance\ -s.).25 E F1(possible\255completions \(M\255?\))108 597.6 Q F0 -(List the possible completions of the te)144 609.6 Q(xt before point.) --.15 E F1(insert\255completions \(M\255*\))108 621.6 Q F0 .783 -(Insert all completions of the te)144 633.6 R .783 -(xt before point that w)-.15 F .783(ould ha)-.1 F 1.083 -.15(ve b)-.2 H -.783(een generated by).15 F F1(possible\255com-)3.283 E(pletions)144 -645.6 Q F0(.)A F1(menu\255complete)108 657.6 Q F0 .929(Similar to)144 -669.6 R F1(complete)3.429 E F0 3.429(,b)C .929(ut replaces the w)-3.629 -F .929(ord to be completed with a single match from the list of)-.1 F -1.193(possible completions.)144 681.6 R 1.193(Repeated e)6.193 F -.15 -(xe)-.15 G 1.193(cution of).15 F F1(menu\255complete)3.694 E F0 1.194 -(steps through the list of possible)3.694 F .829 -(completions, inserting each match in turn.)144 693.6 R .828 -(At the end of the list of completions, the bell is rung)5.828 F .965 -(\(subject to the setting of)144 705.6 R F1 .965 -(0and the original text is r)3.465 F(estor)-.18 E 3.465(ed. An)-.18 F -(ar)3.465 E .966(gument of)-.1 F F2(n)3.466 E F1(mo)3.466 E -.1(ve)-.1 G -(s).1 E F2(n)3.466 E F1(posi-)3.466 E 1.249(tions f)144 717.6 R 1.249 -(orward in the list of matches; a negati)-.25 F 1.449 -.1(ve a)-.1 H -.1 -(rg).1 G 1.248(ument may be used to mo).1 F 1.448 -.1(ve b)-.1 H -(ackward).1 E(thr)144 729.6 Q(ough the list.)-.18 E -(This command is intended to be bound to T)5 E(AB, b)-.9 E -(ut is unbound by default.)-.2 E F0(GNU Readline 4.3)72 768 Q -(2002 January 22)126.24 E(8)195.95 E EP -%%Page: 9 9 -%%BeginPageSetup -BP -%%EndPageSetup -/F0 10/Times-Roman@0 SF 342.2(READLINE\(3\) READLINE\(3\))72 48 R/F1 10 -/Times-Bold@0 SF(delete\255char\255or\255list)108 84 Q F0 .373 -(Deletes the character under the cursor if not at the be)144 96 R .374 -(ginning or end of the line \(lik)-.15 F(e)-.1 E F1(delete-char)2.874 E -F0(\).)A(If at the end of the line, beha)144 108 Q -.15(ve)-.2 G 2.5(si) -.15 G(dentically to)-2.5 E F1(possible-completions)2.5 E F0(.)A F1 -.25 -(Ke)87 124.8 S(yboard Macr).25 E(os)-.18 E(start\255kbd\255macr)108 -136.8 Q 2.5(o\()-.18 G(C\255x \()-2.5 E(\)).833 E F0(Be)144 148.8 Q -(gin sa)-.15 E(ving the characters typed into the current k)-.2 E -.15 -(ey)-.1 G(board macro.).15 E F1(end\255kbd\255macr)108 160.8 Q 2.5(o\() --.18 G(C\255x \))-2.5 E(\)).833 E F0(Stop sa)144 172.8 Q -(ving the characters typed into the current k)-.2 E -.15(ey)-.1 G -(board macro and store the de\214nition.).15 E F1 -(call\255last\255kbd\255macr)108 184.8 Q 2.5(o\()-.18 G(C\255x e\))-2.5 -E F0(Re-e)144 196.8 Q -.15(xe)-.15 G 1(cute the last k).15 F -.15(ey)-.1 -G .999(board macro de\214ned, by making the characters in the macro app\ -ear as if).15 F(typed at the k)144 208.8 Q -.15(ey)-.1 G(board.).15 E F1 -(Miscellaneous)87 225.6 Q -.18(re)108 237.6 S.18 E -(ead\255init\255\214le \(C\255x C\255r\))-.18 E F0 1.776 -(Read in the contents of the)144 249.6 R/F2 10/Times-Italic@0 SF(inputr) -4.276 E(c)-.37 E F0 1.777(\214le, and incorporate an)4.276 F 4.277(yb) --.15 G 1.777(indings or v)-4.277 F 1.777(ariable assignments)-.25 F -(found there.)144 261.6 Q F1(abort \(C\255g\))108 273.6 Q F0 3.249 -(Abort the current editing command and ring the terminal')144 285.6 R -5.748(sb)-.55 G 3.248(ell \(subject to the setting of)-5.748 F F1 -(bell\255style)144 297.6 Q F0(\).)A F1(do\255upper)108 309.6 Q -(case\255v)-.18 E(ersion \(M\255a, M\255b, M\255)-.1 E F2(x)A F1 2.5(,.) -C(..\))-2.5 E F0 1.755(If the meta\214ed character)144 321.6 R F2(x) -4.255 E F0 1.755(is lo)4.255 F 1.756 -(wercase, run the command that is bound to the corresponding)-.25 F -(uppercase character)144 333.6 Q(.)-.55 E F1(pr)108 345.6 Q -(e\214x\255meta \(ESC\))-.18 E F0(Metafy the ne)144 357.6 Q -(xt character typed.)-.15 E/F3 9/Times-Bold@0 SF(ESC)5 E F1(f)2.25 E F0 -(is equi)2.5 E -.25(va)-.25 G(lent to).25 E F1(Meta\255f)2.5 E F0(.)A F1 -(undo \(C\255_, C\255x C\255u\))108 369.6 Q F0 -(Incremental undo, separately remembered for each line.)144 381.6 Q F1 --2.29 -.18(re v)108 393.6 T(ert\255line \(M\255r\)).08 E F0 1.095 -(Undo all changes made to this line.)144 405.6 R 1.095(This is lik)6.095 -F 3.595(ee)-.1 G -.15(xe)-3.745 G 1.095(cuting the).15 F F1(undo)3.595 E -F0 1.095(command enough times to)3.595 F -(return the line to its initial state.)144 417.6 Q F1 -(tilde\255expand \(M\255&\))108 429.6 Q F0(Perform tilde e)144 441.6 Q -(xpansion on the current w)-.15 E(ord.)-.1 E F1 -(set\255mark \(C\255@, M\255\))108 453.6 Q F0 -(Set the mark to the point.)144 465.6 Q(If a numeric ar)5 E -(gument is supplied, the mark is set to that position.)-.18 E F1 -(exchange\255point\255and\255mark \(C\255x C\255x\))108 477.6 Q F0(Sw) -144 489.6 Q .282(ap the point with the mark.)-.1 F .283 -(The current cursor position is set to the sa)5.283 F -.15(ve)-.2 G -2.783(dp).15 G .283(osition, and the old)-2.783 F(cursor position is sa) -144 501.6 Q -.15(ve)-.2 G 2.5(da).15 G 2.5(st)-2.5 G(he mark.)-2.5 E F1 -(character\255sear)108 513.6 Q(ch \(C\255]\))-.18 E F0 3.036(Ac)144 -525.6 S .536(haracter is read and point is mo)-3.036 F -.15(ve)-.15 G -3.035(dt).15 G 3.035(ot)-3.035 G .535(he ne)-3.035 F .535 -(xt occurrence of that character)-.15 F 5.535(.A)-.55 G(ne)-2.5 E -.05 -(ga)-.15 G(ti).05 E .835 -.15(ve c)-.25 H(ount).15 E(searches for pre) -144 537.6 Q(vious occurrences.)-.25 E F1(character\255sear)108 549.6 Q -(ch\255backward \(M\255C\255]\))-.18 E F0 3.543(Ac)144 561.6 S 1.043 -(haracter is read and point is mo)-3.543 F -.15(ve)-.15 G 3.544(dt).15 G -3.544(ot)-3.544 G 1.044(he pre)-3.544 F 1.044 -(vious occurrence of that character)-.25 F 6.044(.A)-.55 G(ne)-2.5 E --.05(ga)-.15 G(ti).05 E -.15(ve)-.25 G -(count searches for subsequent occurrences.)144 573.6 Q F1 -(insert\255comment \(M\255#\))108 585.6 Q F0 -.4(Wi)144 597.6 S .481 -(thout a numeric ar).4 F .481(gument, the v)-.18 F .481 -(alue of the readline)-.25 F F1(comment\255begin)2.981 E F0 -.25(va) -2.981 G .48(riable is inserted at the).25 F(be)144 609.6 Q .097 -(ginning of the current line.)-.15 F .098(If a numeric ar)5.097 F .098 -(gument is supplied, this command acts as a toggle:)-.18 F(if)5.098 E -.322(the characters at the be)144 621.6 R .321 -(ginning of the line do not match the v)-.15 F .321(alue of)-.25 F F1 -(comment\255begin)2.821 E F0 2.821(,t)C .321(he v)-2.821 F .321(alue is) --.25 F 1.013(inserted, otherwise the characters in)144 633.6 R F1 -(comment-begin)3.514 E F0 1.014(are deleted from the be)3.514 F 1.014 -(ginning of the line.)-.15 F 1.469 -(In either case, the line is accepted as if a ne)144 645.6 R 1.468 -(wline had been typed.)-.25 F 1.468(The def)6.468 F 1.468(ault v)-.1 F -1.468(alue of)-.25 F F1(com-)3.968 E(ment\255begin)144 657.6 Q F0(mak) -2.982 E .483(es the current line a shell comment.)-.1 F .483 -(If a numeric ar)5.483 F .483(gument causes the comment)-.18 F -(character to be remo)144 669.6 Q -.15(ve)-.15 G(d, the line will be e) -.15 E -.15(xe)-.15 G(cuted by the shell.).15 E F1(dump\255functions)108 -681.6 Q F0 .627(Print all of the functions and their k)144 693.6 R .927 --.15(ey b)-.1 H .626(indings to the readline output stream.).15 F .626 -(If a numeric ar)5.626 F(gu-)-.18 E -(ment is supplied, the output is formatted in such a w)144 705.6 Q -(ay that it can be made part of an)-.1 E F2(inputr)2.5 E(c)-.37 E F0 -(\214le.)2.5 E(GNU Readline 4.3)72 768 Q(2002 January 22)126.24 E(9) -195.95 E EP -%%Page: 10 10 -%%BeginPageSetup -BP -%%EndPageSetup -/F0 10/Times-Roman@0 SF 342.2(READLINE\(3\) READLINE\(3\))72 48 R/F1 10 -/Times-Bold@0 SF(dump\255v)108 84 Q(ariables)-.1 E F0 .283 -(Print all of the settable v)144 96 R .283(ariables and their v)-.25 F -.283(alues to the readline output stream.)-.25 F .283(If a numeric ar) -5.283 F(gu-)-.18 E -(ment is supplied, the output is formatted in such a w)144 108 Q -(ay that it can be made part of an)-.1 E/F2 10/Times-Italic@0 SF(inputr) -2.5 E(c)-.37 E F0(\214le.)2.5 E F1(dump\255macr)108 120 Q(os)-.18 E F0 -.756(Print all of the readline k)144 132 R 1.056 -.15(ey s)-.1 H .756 -(equences bound to macros and the strings the).15 F 3.256(yo)-.15 G -3.256(uput. If)-3.256 F 3.255(an)3.255 G(umeric)-3.255 E(ar)144 144 Q -.528(gument is supplied, the output is formatted in such a w)-.18 F .528 -(ay that it can be made part of an)-.1 F F2(inputr)3.028 E(c)-.37 E F0 -(\214le.)144 156 Q F1(emacs\255editing\255mode \(C\255e\))108 168 Q F0 -(When in)144 180 Q F1(vi)2.5 E F0(command mode, this causes a switch to) -2.5 E F1(emacs)2.5 E F0(editing mode.)2.5 E F1 -(vi\255editing\255mode \(M\255C\255j\))108 192 Q F0(When in)144 204 Q F1 -(emacs)2.5 E F0(editing mode, this causes a switch to)2.5 E F1(vi)2.5 E -F0(editing mode.)2.5 E/F3 10.95/Times-Bold@0 SF(DEF)72 220.8 Q -.548(AU) --.986 G 2.014 -1.007(LT K).548 H(EY BINDINGS)1.007 E F0 .065(The follo) -108 232.8 R .065(wing is a list of the def)-.25 F .065 -(ault emacs and vi bindings.)-.1 F .064 -(Characters with the eighth bit set are written as)5.064 F .615 -(M\255, and are referred to as)108 244.8 R F2(meta\214ed) -3.115 E F0 3.115(characters. The)3.115 F .616 -(printable ASCII characters not mentioned)3.116 F 1.116 -(in the list of emacs standard bindings are bound to the)108 256.8 R F1 -(self\255insert)3.615 E F0 1.115(function, which just inserts the gi) -3.615 F -.15(ve)-.25 G(n).15 E .945(character into the input line.)108 -268.8 R .945(In vi insertion mode, all characters not speci\214cally me\ -ntioned are bound to)5.945 F F1(self\255insert)108 280.8 Q F0 5.359(.C)C -.359(haracters assigned to signal generation by)-5.359 F F2(stty)2.859 E -F0 .359(\(1\) or the terminal dri).32 F -.15(ve)-.25 G 1.159 -.4(r, s) -.15 H .358(uch as C-Z or C-C,).4 F .187(retain that function.)108 292.8 -R .187(Upper and lo)5.187 F .188(wer case meta\214ed characters are bou\ -nd to the same function in the emacs)-.25 F .305(mode meta k)108 304.8 R --.15(ey)-.1 G 2.805(map. The).15 F .305(remaining characters are unboun\ -d, which causes readline to ring the bell \(subject)2.805 F -(to the setting of the)108 316.8 Q F1(bell\255style)2.5 E F0 -.25(va)2.5 -G(riable\).).25 E F1(Emacs Mode)87 333.6 Q F0(Emacs Standard bindings) -151.2 345.6 Q 2.5("C-@" set-mark)151.2 369.6 R 2.5("C-A" be)151.2 381.6 -R(ginning-of-line)-.15 E 2.5("C-B" backw)151.2 393.6 R(ard-char)-.1 E -2.5("C-D" delete-char)151.2 405.6 R 2.5("C-E" end-of-line)151.2 417.6 R -2.5("C-F" forw)151.2 429.6 R(ard-char)-.1 E 2.5("C-G" abort)151.2 441.6 -R 2.5("C-H" backw)151.2 453.6 R(ard-delete-char)-.1 E 2.5 -("C-I" complete)151.2 465.6 R 2.5("C-J" accept-line)151.2 477.6 R 2.5 -("C-K" kill-line)151.2 489.6 R 2.5("C-L" clear)151.2 501.6 R(-screen)-.2 -E 2.5("C-M" accept-line)151.2 513.6 R 2.5("C-N" ne)151.2 525.6 R -(xt-history)-.15 E 2.5("C-P" pre)151.2 537.6 R(vious-history)-.25 E 2.5 -("C-Q" quoted-insert)151.2 549.6 R 2.5("C-R" re)151.2 561.6 R -.15(ve) --.25 G(rse-search-history).15 E 2.5("C-S" forw)151.2 573.6 R -(ard-search-history)-.1 E 2.5("C-T" transpose-chars)151.2 585.6 R 2.5 -("C-U" unix-line-discard)151.2 597.6 R 2.5("C-V" quoted-insert)151.2 -609.6 R 2.5("C-W" unix-w)151.2 621.6 R(ord-rubout)-.1 E 2.5("C-Y" yank) -151.2 633.6 R 2.5("C-]" character)151.2 645.6 R(-search)-.2 E 2.5 -("C-_" undo)151.2 657.6 R 3.333("")151.2 669.6 S(to "/")-.833 E -(self-insert)5 E 2.5("0" to)151.2 681.6 R 2.5("9" self-insert)2.5 F 2.5 -(":" to)151.2 693.6 R 2.5("~" self-insert)2.5 F 2.5("C-?" backw)151.2 -705.6 R(ard-delete-char)-.1 E(Emacs Meta bindings)151.2 722.4 Q -(GNU Readline 4.3)72 768 Q(2002 January 22)126.24 E(10)190.95 E EP -%%Page: 11 11 -%%BeginPageSetup -BP -%%EndPageSetup -/F0 10/Times-Roman@0 SF 342.2(READLINE\(3\) READLINE\(3\))72 48 R 2.5 -("M-C-G" abort)151.2 84 R 2.5("M-C-H" backw)151.2 96 R(ard-kill-w)-.1 E -(ord)-.1 E 2.5("M-C-I" tab-insert)151.2 108 R 2.5 -("M-C-J" vi-editing-mode)151.2 120 R 2.5("M-C-M" vi-editing-mode)151.2 -132 R 2.5("M-C-R" re)151.2 144 R -.15(ve)-.25 G(rt-line).15 E 2.5 -("M-C-Y" yank-nth-ar)151.2 156 R(g)-.18 E 2.5("M-C-[" complete)151.2 168 -R 2.5("M-C-]" character)151.2 180 R(-search-backw)-.2 E(ard)-.1 E 2.5 -("M-space" set-mark)151.2 192 R 2.5("M-#" insert-comment)151.2 204 R 2.5 -("M-&" tilde-e)151.2 216 R(xpand)-.15 E 2.5("M-*" insert-completions) -151.2 228 R 2.5("M--" digit-ar)151.2 240 R(gument)-.18 E 2.5 -("M-." yank-last-ar)151.2 252 R(g)-.18 E 2.5("M-0" digit-ar)151.2 264 R -(gument)-.18 E 2.5("M-1" digit-ar)151.2 276 R(gument)-.18 E 2.5 -("M-2" digit-ar)151.2 288 R(gument)-.18 E 2.5("M-3" digit-ar)151.2 300 R -(gument)-.18 E 2.5("M-4" digit-ar)151.2 312 R(gument)-.18 E 2.5 -("M-5" digit-ar)151.2 324 R(gument)-.18 E 2.5("M-6" digit-ar)151.2 336 R -(gument)-.18 E 2.5("M-7" digit-ar)151.2 348 R(gument)-.18 E 2.5 -("M-8" digit-ar)151.2 360 R(gument)-.18 E 2.5("M-9" digit-ar)151.2 372 R -(gument)-.18 E 2.5("M-<" be)151.2 384 R(ginning-of-history)-.15 E 2.5 -("M-=" possible-completions)151.2 396 R 2.5("M->" end-of-history)151.2 -408 R 2.5("M-?" possible-completions)151.2 420 R 2.5("M-B" backw)151.2 -432 R(ard-w)-.1 E(ord)-.1 E 2.5("M-C" capitalize-w)151.2 444 R(ord)-.1 E -2.5("M-D" kill-w)151.2 456 R(ord)-.1 E 2.5("M-F" forw)151.2 468 R(ard-w) --.1 E(ord)-.1 E 2.5("M-L" do)151.2 480 R(wncase-w)-.25 E(ord)-.1 E 2.5 -("M-N" non-incremental-forw)151.2 492 R(ard-search-history)-.1 E 2.5 -("M-P" non-incremental-re)151.2 504 R -.15(ve)-.25 G(rse-search-history) -.15 E 2.5("M-R" re)151.2 516 R -.15(ve)-.25 G(rt-line).15 E 2.5 -("M-T" transpose-w)151.2 528 R(ords)-.1 E 2.5("M-U" upcase-w)151.2 540 R -(ord)-.1 E 2.5("M-Y" yank-pop)151.2 552 R 2.5 -("M-\\" delete-horizontal-space)151.2 564 R 2.5("M-~" tilde-e)151.2 576 -R(xpand)-.15 E 2.5("M-C-?" backw)151.2 588 R(ard-kill-w)-.1 E(ord)-.1 E -2.5("M-_" yank-last-ar)151.2 600 R(g)-.18 E(Emacs Control-X bindings) -151.2 616.8 Q 2.5("C-XC-G" abort)151.2 640.8 R 2.5 -("C-XC-R" re-read-init-\214le)151.2 652.8 R 2.5("C-XC-U" undo)151.2 -664.8 R 2.5("C-XC-X" e)151.2 676.8 R(xchange-point-and-mark)-.15 E 2.5 -("C-X\(" start-kbd-macro)151.2 688.8 R 2.5("C-X\)" end-kbd-macro)151.2 -700.8 R 2.5("C-XE" call-last-kbd-macro)151.2 712.8 R 2.5("C-XC-?" backw) -151.2 724.8 R(ard-kill-line)-.1 E(GNU Readline 4.3)72 768 Q -(2002 January 22)126.24 E(11)190.95 E EP -%%Page: 12 12 -%%BeginPageSetup -BP -%%EndPageSetup -/F0 10/Times-Roman@0 SF 342.2(READLINE\(3\) READLINE\(3\))72 48 R/F1 10 -/Times-Bold@0 SF(VI Mode bindings)87 84 Q F0(VI Insert Mode functions) -151.2 96 Q 2.5("C-D" vi-eof-maybe)151.2 120 R 2.5("C-H" backw)151.2 132 -R(ard-delete-char)-.1 E 2.5("C-I" complete)151.2 144 R 2.5 -("C-J" accept-line)151.2 156 R 2.5("C-M" accept-line)151.2 168 R 2.5 -("C-R" re)151.2 180 R -.15(ve)-.25 G(rse-search-history).15 E 2.5 -("C-S" forw)151.2 192 R(ard-search-history)-.1 E 2.5 -("C-T" transpose-chars)151.2 204 R 2.5("C-U" unix-line-discard)151.2 216 -R 2.5("C-V" quoted-insert)151.2 228 R 2.5("C-W" unix-w)151.2 240 R -(ord-rubout)-.1 E 2.5("C-Y" yank)151.2 252 R 2.5("C-[" vi-mo)151.2 264 R --.15(ve)-.15 G(ment-mode).15 E 2.5("C-_" undo)151.2 276 R 3.333("")151.2 -288 S(to "~")-.833 E(self-insert)5 E 2.5("C-?" backw)151.2 300 R -(ard-delete-char)-.1 E(VI Command Mode functions)151.2 316.8 Q 2.5 -("C-D" vi-eof-maybe)151.2 340.8 R 2.5("C-E" emacs-editing-mode)151.2 -352.8 R 2.5("C-G" abort)151.2 364.8 R 2.5("C-H" backw)151.2 376.8 R -(ard-char)-.1 E 2.5("C-J" accept-line)151.2 388.8 R 2.5("C-K" kill-line) -151.2 400.8 R 2.5("C-L" clear)151.2 412.8 R(-screen)-.2 E 2.5 -("C-M" accept-line)151.2 424.8 R 2.5("C-N" ne)151.2 436.8 R(xt-history) --.15 E 2.5("C-P" pre)151.2 448.8 R(vious-history)-.25 E 2.5 -("C-Q" quoted-insert)151.2 460.8 R 2.5("C-R" re)151.2 472.8 R -.15(ve) --.25 G(rse-search-history).15 E 2.5("C-S" forw)151.2 484.8 R -(ard-search-history)-.1 E 2.5("C-T" transpose-chars)151.2 496.8 R 2.5 -("C-U" unix-line-discard)151.2 508.8 R 2.5("C-V" quoted-insert)151.2 -520.8 R 2.5("C-W" unix-w)151.2 532.8 R(ord-rubout)-.1 E 2.5("C-Y" yank) -151.2 544.8 R 2.5("C-_" vi-undo)151.2 556.8 R -4.166 3.333("" f)151.2 -568.8 T(orw)-3.333 E(ard-char)-.1 E 2.5("#" insert-comment)151.2 580.8 R -2.5("$" end-of-line)151.2 592.8 R 2.5("%" vi-match)151.2 604.8 R 2.5 -("&" vi-tilde-e)151.2 616.8 R(xpand)-.15 E 2.5("*" vi-complete)151.2 -628.8 R 2.5("+" ne)151.2 640.8 R(xt-history)-.15 E 2.5("," vi-char)151.2 -652.8 R(-search)-.2 E 2.5("-" pre)151.2 664.8 R(vious-history)-.25 E 2.5 -("." vi-redo)151.2 676.8 R 2.5("/" vi-search)151.2 688.8 R 2.5("0" be) -151.2 700.8 R(ginning-of-line)-.15 E("1" to "9")151.2 712.8 Q(vi-ar)5 E -(g-digit)-.18 E 2.5(";" vi-char)151.2 724.8 R(-search)-.2 E -(GNU Readline 4.3)72 768 Q(2002 January 22)126.24 E(12)190.95 E EP -%%Page: 13 13 -%%BeginPageSetup -BP -%%EndPageSetup -/F0 10/Times-Roman@0 SF 342.2(READLINE\(3\) READLINE\(3\))72 48 R 2.5 -("=" vi-complete)151.2 84 R 2.5("?" vi-search)151.2 96 R 2.5 -("A" vi-append-eol)151.2 108 R 2.5("B" vi-pre)151.2 120 R(v-w)-.25 E -(ord)-.1 E 2.5("C" vi-change-to)151.2 132 R 2.5("D" vi-delete-to)151.2 -144 R 2.5("E" vi-end-w)151.2 156 R(ord)-.1 E 2.5("F" vi-char)151.2 168 R -(-search)-.2 E 2.5("G" vi-fetch-history)151.2 180 R 2.5 -("I" vi-insert-be)151.2 192 R(g)-.15 E 2.5("N" vi-search-ag)151.2 204 R -(ain)-.05 E 2.5("P" vi-put)151.2 216 R 2.5("R" vi-replace)151.2 228 R -2.5("S" vi-subst)151.2 240 R 2.5("T" vi-char)151.2 252 R(-search)-.2 E -2.5("U" re)151.2 264 R -.15(ve)-.25 G(rt-line).15 E 2.5("W" vi-ne)151.2 -276 R(xt-w)-.15 E(ord)-.1 E 2.5("X" backw)151.2 288 R(ard-delete-char) --.1 E 2.5("Y" vi-yank-to)151.2 300 R 2.5("\\" vi-complete)151.2 312 R -2.5("^" vi-\214rst-print)151.2 324 R 2.5("_" vi-yank-ar)151.2 336 R(g) --.18 E 2.5("`" vi-goto-mark)151.2 348 R 2.5("a" vi-append-mode)151.2 360 -R 2.5("b" vi-pre)151.2 372 R(v-w)-.25 E(ord)-.1 E 2.5("c" vi-change-to) -151.2 384 R 2.5("d" vi-delete-to)151.2 396 R 2.5("e" vi-end-w)151.2 408 -R(ord)-.1 E 2.5("f" vi-char)151.2 420 R(-search)-.2 E 2.5("h" backw) -151.2 432 R(ard-char)-.1 E 2.5("i" vi-insertion-mode)151.2 444 R 2.5 -("j" ne)151.2 456 R(xt-history)-.15 E 2.5("k" pre)151.2 468 R(v-history) --.25 E 2.5("l" forw)151.2 480 R(ard-char)-.1 E 2.5("m" vi-set-mark)151.2 -492 R 2.5("n" vi-search-ag)151.2 504 R(ain)-.05 E 2.5("p" vi-put)151.2 -516 R 2.5("r" vi-change-char)151.2 528 R 2.5("s" vi-subst)151.2 540 R -2.5("t" vi-char)151.2 552 R(-search)-.2 E 2.5("u" vi-undo)151.2 564 R -2.5("w" vi-ne)151.2 576 R(xt-w)-.15 E(ord)-.1 E 2.5("x" vi-delete)151.2 -588 R 2.5("y" vi-yank-to)151.2 600 R 2.5("|" vi-column)151.2 612 R 2.5 -("~" vi-change-case)151.2 624 R/F1 10.95/Times-Bold@0 SF(SEE ALSO)72 -640.8 Q/F2 10/Times-Italic@0 SF(The Gnu Readline Libr)108 652.8 Q(ary) --.15 E F0 2.5(,B)C(rian F)-2.5 E(ox and Chet Rame)-.15 E(y)-.15 E F2 -(The Gnu History Libr)108 664.8 Q(ary)-.15 E F0 2.5(,B)C(rian F)-2.5 E -(ox and Chet Rame)-.15 E(y)-.15 E F2(bash)108 676.8 Q F0(\(1\))A F1 -(FILES)72 693.6 Q F2(~/.inputr)109.666 705.6 Q(c)-.37 E F0(Indi)144 -717.6 Q(vidual)-.25 E/F3 10/Times-Bold@0 SF -.18(re)2.5 G(adline).18 E -F0(initialization \214le)2.5 E(GNU Readline 4.3)72 768 Q -(2002 January 22)126.24 E(13)190.95 E EP -%%Page: 14 14 -%%BeginPageSetup -BP -%%EndPageSetup -/F0 10/Times-Roman@0 SF 342.2(READLINE\(3\) READLINE\(3\))72 48 R/F1 -10.95/Times-Bold@0 SF -.548(AU)72 84 S(THORS).548 E F0(Brian F)108 96 Q -(ox, Free Softw)-.15 E(are F)-.1 E(oundation)-.15 E(bfox@gnu.or)108 108 -Q(g)-.18 E(Chet Rame)108 124.8 Q 1.3 -.65(y, C)-.15 H(ase W).65 E -(estern Reserv)-.8 E 2.5(eU)-.15 G(ni)-2.5 E -.15(ve)-.25 G(rsity).15 E -(chet@ins.CWR)108 136.8 Q(U.Edu)-.4 E F1 -.11(BU)72 153.6 S 2.738(GR).11 -G(EPOR)-2.738 E(TS)-.438 E F0 .69(If you \214nd a b)108 165.6 R .69 -(ug in)-.2 F/F2 10/Times-Bold@0 SF -.18(re)3.19 G(adline,).18 E F0 .69 -(you should report it.)3.19 F .691(But \214rst, you should mak)5.69 F -3.191(es)-.1 G .691(ure that it really is a b)-3.191 F(ug,)-.2 E -(and that it appears in the latest v)108 177.6 Q(ersion of the)-.15 E F2 --.18(re)2.5 G(adline).18 E F0(library that you ha)2.5 E -.15(ve)-.2 G(.) -.15 E .705(Once you ha)108 194.4 R 1.005 -.15(ve d)-.2 H .705 -(etermined that a b).15 F .704(ug actually e)-.2 F .704(xists, mail a b) --.15 F .704(ug report to)-.2 F/F3 10/Times-Italic@0 SF -.2(bu)3.204 G -(g\255r).2 E(eadline)-.37 E F0(@)A F3(gnu.or)A(g)-.37 E F0 5.704(.I)C -3.204(fy)-5.704 G(ou)-3.204 E(ha)108 206.4 Q 1.809 -.15(ve a \214)-.2 H -1.509(x, you are welcome to mail that as well!).15 F 1.51 -(Suggestions and `philosophical' b)6.51 F 1.51(ug reports may be)-.2 F -(mailed to)108 218.4 Q F3 -.2(bu)2.5 G(g-r).2 E(eadline)-.37 E F0(@)A F3 -(gnu.or)A(g)-.37 E F0(or posted to the Usenet ne)2.5 E(wsgroup)-.25 E F2 -(gnu.bash.b)2.5 E(ug)-.2 E F0(.)A(Comments and b)108 235.2 Q -(ug reports concerning this manual page should be directed to)-.2 E F3 --.15(ch)2.5 G(et@ins.CWR).15 E -.25(U.)-.4 G(Edu).25 E F0(.).25 E F1 --.11(BU)72 252 S(GS).11 E F0(It')108 264 Q 2.5(st)-.55 G -(oo big and too slo)-2.5 E -.65(w.)-.25 G(GNU Readline 4.3)72 768 Q -(2002 January 22)126.24 E(14)190.95 E EP -%%Trailer -end -%%EOF diff --git a/readline/examples/readlinebuf.h b/readline/examples/readlinebuf.h deleted file mode 100644 index 91ef4d64b8..0000000000 --- a/readline/examples/readlinebuf.h +++ /dev/null @@ -1,139 +0,0 @@ -/******************************************************************************* - * $Revision$ - * $Date$ - * $Author$ - * - * Contents: A streambuf which uses the GNU readline library for line I/O - * (c) 2001 by Dimitris Vyzovitis [vyzo@media.mit.edu] - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the Free - * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ******************************************************************************/ - -#ifndef _READLINEBUF_H_ -#define _READLINEBUF_H_ - -#include -#include -#include -#include -#include - -#include -#include - -#if (defined __GNUC__) && (__GNUC__ < 3) -#include -#else -#include -using std::streamsize; -using std::streambuf; -#endif - -class readlinebuf : public streambuf { -public: -#if (defined __GNUC__) && (__GNUC__ < 3) - typedef char char_type; - typedef int int_type; - typedef streampos pos_type; - typedef streamoff off_type; -#endif - static const int_type eof = EOF; // this is -1 - static const int_type not_eof = 0; - -private: - const char* prompt_; - bool history_; - char* line_; - int low_; - int high_; - -protected: - - virtual int_type showmanyc() const { return high_ - low_; } - - virtual streamsize xsgetn( char_type* buf, streamsize n ) { - int rd = n > (high_ - low_)? (high_ - low_) : n; - memcpy( buf, line_, rd ); - low_ += rd; - - if ( rd < n ) { - low_ = high_ = 0; - free( line_ ); // free( NULL ) is a noop - line_ = readline( prompt_ ); - if ( line_ ) { - high_ = strlen( line_ ); - if ( history_ && high_ ) add_history( line_ ); - rd += xsgetn( buf + rd, n - rd ); - } - } - - return rd; - } - - virtual int_type underflow() { - if ( high_ == low_ ) { - low_ = high_ = 0; - free( line_ ); // free( NULL ) is a noop - line_ = readline( prompt_ ); - if ( line_ ) { - high_ = strlen( line_ ); - if ( history_ && high_ ) add_history( line_ ); - } - } - - if ( low_ < high_ ) return line_[low_]; - else return eof; - } - - virtual int_type uflow() { - int_type c = underflow(); - if ( c != eof ) ++low_; - return c; - } - - virtual int_type pbackfail( int_type c = eof ) { - if ( low_ > 0 ) --low_; - else if ( c != eof ) { - if ( high_ > 0 ) { - char* nl = (char*)realloc( line_, high_ + 1 ); - if ( nl ) { - line_ = (char*)memcpy( nl + 1, line_, high_ ); - high_ += 1; - line_[0] = char( c ); - } else return eof; - } else { - assert( !line_ ); - line_ = (char*)malloc( sizeof( char ) ); - *line_ = char( c ); - high_ = 1; - } - } else return eof; - - return not_eof; - } - -public: - readlinebuf( const char* prompt = NULL, bool history = true ) - : prompt_( prompt ), history_( history ), - line_( NULL ), low_( 0 ), high_( 0 ) { - setbuf( 0, 0 ); - } - - -}; - -#endif diff --git a/readline/examples/rlcat.c b/readline/examples/rlcat.c deleted file mode 100644 index 176b9f44b6..0000000000 --- a/readline/examples/rlcat.c +++ /dev/null @@ -1,174 +0,0 @@ -/* - * rlcat - cat(1) using readline - * - * usage: rlcat - */ - -/* Copyright (C) 1987-2002 Free Software Foundation, Inc. - - This file is part of the GNU Readline Library, a library for - reading lines of text with interactive input and history editing. - - The GNU Readline Library is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2, or - (at your option) any later version. - - The GNU Readline Library is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - The GNU General Public License is often shipped with GNU software, and - is generally kept in a file called COPYING or LICENSE. If you do not - have a copy of the license, write to the Free Software Foundation, - 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ - -#if defined (HAVE_CONFIG_H) -# include -#endif - -#ifdef HAVE_UNISTD_H -# include -#endif - -#include -#include "posixstat.h" - -#include -#include -#include -#include - -#ifndef errno -extern int errno; -#endif - -#if defined (READLINE_LIBRARY) -# include "readline.h" -# include "history.h" -#else -# include -# include -#endif - -extern int optind; -extern char *optarg; - -static int stdcat(); - -static char *progname; -static int vflag; - -static void -usage() -{ - fprintf (stderr, "%s: usage: %s [-vEVN] [filename]\n", progname, progname); -} - -int -main (argc, argv) - int argc; - char **argv; -{ - char *temp; - int opt, Vflag, Nflag; - - progname = strrchr(argv[0], '/'); - if (progname == 0) - progname = argv[0]; - else - progname++; - - vflag = Vflag = Nflag = 0; - while ((opt = getopt(argc, argv, "vEVN")) != EOF) - { - switch (opt) - { - case 'v': - vflag = 1; - break; - case 'V': - Vflag = 1; - break; - case 'E': - Vflag = 0; - break; - case 'N': - Nflag = 1; - break; - default: - usage (); - exit (2); - } - } - - argc -= optind; - argv += optind; - - if (isatty(0) == 0 || argc || Nflag) - return stdcat(argc, argv); - - rl_variable_bind ("editing-mode", Vflag ? "vi" : "emacs"); - while (temp = readline ("")) - { - if (*temp) - add_history (temp); - printf ("%s\n", temp); - } - - return (ferror (stdout)); -} - -static int -fcopy(fp) - FILE *fp; -{ - int c; - char *x; - - while ((c = getc(fp)) != EOF) - { - if (vflag && isascii ((unsigned char)c) && isprint((unsigned char)c) == 0) - { - x = rl_untranslate_keyseq (c); - if (fputs (x, stdout) != 0) - return 1; - } - else if (putchar (c) == EOF) - return 1; - } - return (ferror (stdout)); -} - -int -stdcat (argc, argv) - int argc; - char **argv; -{ - int i, fd, r; - char *s; - FILE *fp; - - if (argc == 0) - return (fcopy(stdin)); - - for (i = 0, r = 1; i < argc; i++) - { - if (*argv[i] == '-' && argv[i][1] == 0) - fp = stdin; - else - { - fp = fopen (argv[i], "r"); - if (fp == 0) - { - fprintf (stderr, "%s: %s: cannot open: %s\n", progname, argv[i], strerror(errno)); - continue; - } - } - r = fcopy (fp); - if (fp != stdin) - fclose(fp); - } - return r; -} diff --git a/readline/mbutil.c b/readline/mbutil.c deleted file mode 100644 index 50302f01ba..0000000000 --- a/readline/mbutil.c +++ /dev/null @@ -1,337 +0,0 @@ -/* mbutil.c -- readline multibyte character utility functions */ - -/* Copyright (C) 2001 Free Software Foundation, Inc. - - This file is part of the GNU Readline Library, a library for - reading lines of text with interactive input and history editing. - - The GNU Readline Library is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2, or - (at your option) any later version. - - The GNU Readline Library is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - The GNU General Public License is often shipped with GNU software, and - is generally kept in a file called COPYING or LICENSE. If you do not - have a copy of the license, write to the Free Software Foundation, - 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ -#define READLINE_LIBRARY - -#if defined (HAVE_CONFIG_H) -# include -#endif - -#include -#include -#include "posixjmp.h" - -#if defined (HAVE_UNISTD_H) -# include /* for _POSIX_VERSION */ -#endif /* HAVE_UNISTD_H */ - -#if defined (HAVE_STDLIB_H) -# include -#else -# include "ansi_stdlib.h" -#endif /* HAVE_STDLIB_H */ - -#include -#include - -/* System-specific feature definitions and include files. */ -#include "rldefs.h" -#include "rlmbutil.h" - -#if defined (TIOCSTAT_IN_SYS_IOCTL) -# include -#endif /* TIOCSTAT_IN_SYS_IOCTL */ - -/* Some standard library routines. */ -#include "readline.h" - -#include "rlprivate.h" -#include "xmalloc.h" - -/* Declared here so it can be shared between the readline and history - libraries. */ -#if defined (HANDLE_MULTIBYTE) -int rl_byte_oriented = 0; -#else -int rl_byte_oriented = 1; -#endif - -/* **************************************************************** */ -/* */ -/* Multibyte Character Utility Functions */ -/* */ -/* **************************************************************** */ - -#if defined(HANDLE_MULTIBYTE) - -static int -_rl_find_next_mbchar_internal (string, seed, count, find_non_zero) - char *string; - int seed, count, find_non_zero; -{ - size_t tmp = 0; - mbstate_t ps; - int point = 0; - wchar_t wc; - - memset(&ps, 0, sizeof (mbstate_t)); - if (seed < 0) - seed = 0; - if (count <= 0) - return seed; - - point = seed + _rl_adjust_point(string, seed, &ps); - /* if this is true, means that seed was not pointed character - started byte. So correct the point and consume count */ - if (seed < point) - count --; - - while (count > 0) - { - tmp = mbrtowc (&wc, string+point, strlen(string + point), &ps); - if ((size_t)(tmp) == (size_t)-1 || (size_t)(tmp) == (size_t)-2) - { - /* invalid bytes. asume a byte represents a character */ - point++; - count--; - /* reset states. */ - memset(&ps, 0, sizeof(mbstate_t)); - } - else if (tmp == (size_t)0) - /* found '\0' char */ - break; - else - { - /* valid bytes */ - point += tmp; - if (find_non_zero) - { - if (wcwidth (wc) == 0) - continue; - else - count--; - } - else - count--; - } - } - - if (find_non_zero) - { - tmp = mbrtowc (&wc, string + point, strlen (string + point), &ps); - while (wcwidth (wc) == 0) - { - point += tmp; - tmp = mbrtowc (&wc, string + point, strlen (string + point), &ps); - if (tmp == (size_t)(0) || tmp == (size_t)(-1) || tmp == (size_t)(-2)) - break; - } - } - return point; -} - -static int -_rl_find_prev_mbchar_internal (string, seed, find_non_zero) - char *string; - int seed, find_non_zero; -{ - mbstate_t ps; - int prev, non_zero_prev, point, length; - size_t tmp; - wchar_t wc; - - memset(&ps, 0, sizeof(mbstate_t)); - length = strlen(string); - - if (seed < 0) - return 0; - else if (length < seed) - return length; - - prev = non_zero_prev = point = 0; - while (point < seed) - { - tmp = mbrtowc (&wc, string + point, length - point, &ps); - if ((size_t)(tmp) == (size_t)-1 || (size_t)(tmp) == (size_t)-2) - { - /* in this case, bytes are invalid or shorted to compose - multibyte char, so assume that the first byte represents - a single character anyway. */ - tmp = 1; - /* clear the state of the byte sequence, because - in this case effect of mbstate is undefined */ - memset(&ps, 0, sizeof (mbstate_t)); - } - else if (tmp == 0) - break; /* Found '\0' char. Can this happen? */ - else - { - if (find_non_zero) - { - if (wcwidth (wc) != 0) - prev = point; - } - else - prev = point; - } - - point += tmp; - } - - return prev; -} - -/* return the number of bytes parsed from the multibyte sequence starting - at src, if a non-L'\0' wide character was recognized. It returns 0, - if a L'\0' wide character was recognized. It returns (size_t)(-1), - if an invalid multibyte sequence was encountered. It returns (size_t)(-2) - if it couldn't parse a complete multibyte character. */ -int -_rl_get_char_len (src, ps) - char *src; - mbstate_t *ps; -{ - size_t tmp; - - tmp = mbrlen((const char *)src, (size_t)strlen (src), ps); - if (tmp == (size_t)(-2)) - { - /* shorted to compose multibyte char */ - memset (ps, 0, sizeof(mbstate_t)); - return -2; - } - else if (tmp == (size_t)(-1)) - { - /* invalid to compose multibyte char */ - /* initialize the conversion state */ - memset (ps, 0, sizeof(mbstate_t)); - return -1; - } - else if (tmp == (size_t)0) - return 0; - else - return (int)tmp; -} - -/* compare the specified two characters. If the characters matched, - return 1. Otherwise return 0. */ -int -_rl_compare_chars (buf1, pos1, ps1, buf2, pos2, ps2) - char *buf1, *buf2; - mbstate_t *ps1, *ps2; - int pos1, pos2; -{ - int i, w1, w2; - - if ((w1 = _rl_get_char_len (&buf1[pos1], ps1)) <= 0 || - (w2 = _rl_get_char_len (&buf2[pos2], ps2)) <= 0 || - (w1 != w2) || - (buf1[pos1] != buf2[pos2])) - return 0; - - for (i = 1; i < w1; i++) - if (buf1[pos1+i] != buf2[pos2+i]) - return 0; - - return 1; -} - -/* adjust pointed byte and find mbstate of the point of string. - adjusted point will be point <= adjusted_point, and returns - differences of the byte(adjusted_point - point). - if point is invalied (point < 0 || more than string length), - it returns -1 */ -int -_rl_adjust_point(string, point, ps) - char *string; - int point; - mbstate_t *ps; -{ - size_t tmp = 0; - int length; - int pos = 0; - - length = strlen(string); - if (point < 0) - return -1; - if (length < point) - return -1; - - while (pos < point) - { - tmp = mbrlen (string + pos, length - pos, ps); - if((size_t)(tmp) == (size_t)-1 || (size_t)(tmp) == (size_t)-2) - { - /* in this case, bytes are invalid or shorted to compose - multibyte char, so assume that the first byte represents - a single character anyway. */ - pos++; - /* clear the state of the byte sequence, because - in this case effect of mbstate is undefined */ - memset (ps, 0, sizeof (mbstate_t)); - } - else - pos += tmp; - } - - return (pos - point); -} - -int -_rl_is_mbchar_matched (string, seed, end, mbchar, length) - char *string; - int seed, end; - char *mbchar; - int length; -{ - int i; - - if ((end - seed) < length) - return 0; - - for (i = 0; i < length; i++) - if (string[seed + i] != mbchar[i]) - return 0; - return 1; -} -#endif /* HANDLE_MULTIBYTE */ - -/* Find next `count' characters started byte point of the specified seed. - If flags is MB_FIND_NONZERO, we look for non-zero-width multibyte - characters. */ -#undef _rl_find_next_mbchar -int -_rl_find_next_mbchar (string, seed, count, flags) - char *string; - int seed, count, flags; -{ -#if defined (HANDLE_MULTIBYTE) - return _rl_find_next_mbchar_internal (string, seed, count, flags); -#else - return (seed + count); -#endif -} - -/* Find previous character started byte point of the specified seed. - Returned point will be point <= seed. If flags is MB_FIND_NONZERO, - we look for non-zero-width multibyte characters. */ -#undef _rl_find_prev_mbchar -int -_rl_find_prev_mbchar (string, seed, flags) - char *string; - int seed, flags; -{ -#if defined (HANDLE_MULTIBYTE) - return _rl_find_prev_mbchar_internal (string, seed, flags); -#else - return ((seed == 0) ? seed : seed - 1); -#endif -} diff --git a/readline/misc.c b/readline/misc.c deleted file mode 100644 index f3775d30ec..0000000000 --- a/readline/misc.c +++ /dev/null @@ -1,496 +0,0 @@ -/* misc.c -- miscellaneous bindable readline functions. */ - -/* Copyright (C) 1987-2002 Free Software Foundation, Inc. - - This file is part of the GNU Readline Library, a library for - reading lines of text with interactive input and history editing. - - The GNU Readline Library is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2, or - (at your option) any later version. - - The GNU Readline Library is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - The GNU General Public License is often shipped with GNU software, and - is generally kept in a file called COPYING or LICENSE. If you do not - have a copy of the license, write to the Free Software Foundation, - 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ -#define READLINE_LIBRARY - -#if defined (HAVE_CONFIG_H) -# include -#endif - -#if defined (HAVE_UNISTD_H) -# include -#endif /* HAVE_UNISTD_H */ - -#if defined (HAVE_STDLIB_H) -# include -#else -# include "ansi_stdlib.h" -#endif /* HAVE_STDLIB_H */ - -#if defined (HAVE_LOCALE_H) -# include -#endif - -#include - -/* System-specific feature definitions and include files. */ -#include "rldefs.h" -#include "rlmbutil.h" - -/* Some standard library routines. */ -#include "readline.h" -#include "history.h" - -#include "rlprivate.h" -#include "rlshell.h" -#include "xmalloc.h" - -static int rl_digit_loop PARAMS((void)); -static void _rl_history_set_point PARAMS((void)); - -/* Forward declarations used in this file */ -void _rl_free_history_entry PARAMS((HIST_ENTRY *)); - -/* If non-zero, rl_get_previous_history and rl_get_next_history attempt - to preserve the value of rl_point from line to line. */ -int _rl_history_preserve_point = 0; - -/* Saved target point for when _rl_history_preserve_point is set. Special - value of -1 means that point is at the end of the line. */ -int _rl_history_saved_point = -1; - -/* **************************************************************** */ -/* */ -/* Numeric Arguments */ -/* */ -/* **************************************************************** */ - -/* Handle C-u style numeric args, as well as M--, and M-digits. */ -static int -rl_digit_loop () -{ - int key, c, sawminus, sawdigits; - - rl_save_prompt (); - - RL_SETSTATE(RL_STATE_NUMERICARG); - sawminus = sawdigits = 0; - while (1) - { - if (rl_numeric_arg > 1000000) - { - sawdigits = rl_explicit_arg = rl_numeric_arg = 0; - rl_ding (); - rl_restore_prompt (); - rl_clear_message (); - RL_UNSETSTATE(RL_STATE_NUMERICARG); - return 1; - } - rl_message ("(arg: %d) ", rl_arg_sign * rl_numeric_arg); - RL_SETSTATE(RL_STATE_MOREINPUT); - key = c = rl_read_key (); - RL_UNSETSTATE(RL_STATE_MOREINPUT); - - if (c < 0) - { - _rl_abort_internal (); - return -1; - } - - /* If we see a key bound to `universal-argument' after seeing digits, - it ends the argument but is otherwise ignored. */ - if (_rl_keymap[c].type == ISFUNC && - _rl_keymap[c].function == rl_universal_argument) - { - if (sawdigits == 0) - { - rl_numeric_arg *= 4; - continue; - } - else - { - RL_SETSTATE(RL_STATE_MOREINPUT); - key = rl_read_key (); - RL_UNSETSTATE(RL_STATE_MOREINPUT); - rl_restore_prompt (); - rl_clear_message (); - RL_UNSETSTATE(RL_STATE_NUMERICARG); - return (_rl_dispatch (key, _rl_keymap)); - } - } - - c = UNMETA (c); - - if (_rl_digit_p (c)) - { - rl_numeric_arg = rl_explicit_arg ? (rl_numeric_arg * 10) + c - '0' : c - '0'; - sawdigits = rl_explicit_arg = 1; - } - else if (c == '-' && rl_explicit_arg == 0) - { - rl_numeric_arg = sawminus = 1; - rl_arg_sign = -1; - } - else - { - /* Make M-- command equivalent to M--1 command. */ - if (sawminus && rl_numeric_arg == 1 && rl_explicit_arg == 0) - rl_explicit_arg = 1; - rl_restore_prompt (); - rl_clear_message (); - RL_UNSETSTATE(RL_STATE_NUMERICARG); - return (_rl_dispatch (key, _rl_keymap)); - } - } - - /*NOTREACHED*/ -} - -/* Add the current digit to the argument in progress. */ -int -rl_digit_argument (ignore, key) - int ignore, key; -{ - rl_execute_next (key); - return (rl_digit_loop ()); -} - -/* What to do when you abort reading an argument. */ -int -rl_discard_argument () -{ - rl_ding (); - rl_clear_message (); - _rl_init_argument (); - return 0; -} - -/* Create a default argument. */ -int -_rl_init_argument () -{ - rl_numeric_arg = rl_arg_sign = 1; - rl_explicit_arg = 0; - return 0; -} - -/* C-u, universal argument. Multiply the current argument by 4. - Read a key. If the key has nothing to do with arguments, then - dispatch on it. If the key is the abort character then abort. */ -int -rl_universal_argument (count, key) - int count, key; -{ - rl_numeric_arg *= 4; - return (rl_digit_loop ()); -} - -/* **************************************************************** */ -/* */ -/* History Utilities */ -/* */ -/* **************************************************************** */ - -/* We already have a history library, and that is what we use to control - the history features of readline. This is our local interface to - the history mechanism. */ - -/* While we are editing the history, this is the saved - version of the original line. */ -HIST_ENTRY *_rl_saved_line_for_history = (HIST_ENTRY *)NULL; - -/* Set the history pointer back to the last entry in the history. */ -void -_rl_start_using_history () -{ - using_history (); - if (_rl_saved_line_for_history) - _rl_free_history_entry (_rl_saved_line_for_history); - - _rl_saved_line_for_history = (HIST_ENTRY *)NULL; -} - -/* Free the contents (and containing structure) of a HIST_ENTRY. */ -void -_rl_free_history_entry (entry) - HIST_ENTRY *entry; -{ - if (entry == 0) - return; - if (entry->line) - free (entry->line); - free (entry); -} - -/* Perhaps put back the current line if it has changed. */ -int -rl_maybe_replace_line () -{ - HIST_ENTRY *temp; - - temp = current_history (); - /* If the current line has changed, save the changes. */ - if (temp && ((UNDO_LIST *)(temp->data) != rl_undo_list)) - { - temp = replace_history_entry (where_history (), rl_line_buffer, (histdata_t)rl_undo_list); - free (temp->line); - free (temp); - } - return 0; -} - -/* Restore the _rl_saved_line_for_history if there is one. */ -int -rl_maybe_unsave_line () -{ - if (_rl_saved_line_for_history) - { - rl_replace_line (_rl_saved_line_for_history->line, 0); - rl_undo_list = (UNDO_LIST *)_rl_saved_line_for_history->data; - _rl_free_history_entry (_rl_saved_line_for_history); - _rl_saved_line_for_history = (HIST_ENTRY *)NULL; - rl_point = rl_end; /* rl_replace_line sets rl_end */ - } - else - rl_ding (); - return 0; -} - -/* Save the current line in _rl_saved_line_for_history. */ -int -rl_maybe_save_line () -{ - if (_rl_saved_line_for_history == 0) - { - _rl_saved_line_for_history = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY)); - _rl_saved_line_for_history->line = savestring (rl_line_buffer); - _rl_saved_line_for_history->data = (char *)rl_undo_list; - } - return 0; -} - -int -_rl_free_saved_history_line () -{ - if (_rl_saved_line_for_history) - { - _rl_free_history_entry (_rl_saved_line_for_history); - _rl_saved_line_for_history = (HIST_ENTRY *)NULL; - } - return 0; -} - -static void -_rl_history_set_point () -{ - rl_point = (_rl_history_preserve_point && _rl_history_saved_point != -1) - ? _rl_history_saved_point - : rl_end; - if (rl_point > rl_end) - rl_point = rl_end; - -#if defined (VI_MODE) - if (rl_editing_mode == vi_mode) - rl_point = 0; -#endif /* VI_MODE */ - - if (rl_editing_mode == emacs_mode) - rl_mark = (rl_point == rl_end ? 0 : rl_end); -} - -void -rl_replace_from_history (entry, flags) - HIST_ENTRY *entry; - int flags; /* currently unused */ -{ - rl_replace_line (entry->line, 0); - rl_undo_list = (UNDO_LIST *)entry->data; - rl_point = rl_end; - rl_mark = 0; - -#if defined (VI_MODE) - if (rl_editing_mode == vi_mode) - { - rl_point = 0; - rl_mark = rl_end; - } -#endif -} - -/* **************************************************************** */ -/* */ -/* History Commands */ -/* */ -/* **************************************************************** */ - -/* Meta-< goes to the start of the history. */ -int -rl_beginning_of_history (count, key) - int count, key; -{ - return (rl_get_previous_history (1 + where_history (), key)); -} - -/* Meta-> goes to the end of the history. (The current line). */ -int -rl_end_of_history (count, key) - int count, key; -{ - rl_maybe_replace_line (); - using_history (); - rl_maybe_unsave_line (); - return 0; -} - -/* Move down to the next history line. */ -int -rl_get_next_history (count, key) - int count, key; -{ - HIST_ENTRY *temp; - - if (count < 0) - return (rl_get_previous_history (-count, key)); - - if (count == 0) - return 0; - - rl_maybe_replace_line (); - - /* either not saved by rl_newline or at end of line, so set appropriately. */ - if (_rl_history_saved_point == -1 && (rl_point || rl_end)) - _rl_history_saved_point = (rl_point == rl_end) ? -1 : rl_point; - - temp = (HIST_ENTRY *)NULL; - while (count) - { - temp = next_history (); - if (!temp) - break; - --count; - } - - if (temp == 0) - rl_maybe_unsave_line (); - else - { - rl_replace_from_history (temp, 0); - _rl_history_set_point (); - } - return 0; -} - -/* Get the previous item out of our interactive history, making it the current - line. If there is no previous history, just ding. */ -int -rl_get_previous_history (count, key) - int count, key; -{ - HIST_ENTRY *old_temp, *temp; - - if (count < 0) - return (rl_get_next_history (-count, key)); - - if (count == 0) - return 0; - - /* either not saved by rl_newline or at end of line, so set appropriately. */ - if (_rl_history_saved_point == -1 && (rl_point || rl_end)) - _rl_history_saved_point = (rl_point == rl_end) ? -1 : rl_point; - - /* If we don't have a line saved, then save this one. */ - rl_maybe_save_line (); - - /* If the current line has changed, save the changes. */ - rl_maybe_replace_line (); - - temp = old_temp = (HIST_ENTRY *)NULL; - while (count) - { - temp = previous_history (); - if (temp == 0) - break; - - old_temp = temp; - --count; - } - - /* If there was a large argument, and we moved back to the start of the - history, that is not an error. So use the last value found. */ - if (!temp && old_temp) - temp = old_temp; - - if (temp == 0) - rl_ding (); - else - { - rl_replace_from_history (temp, 0); - _rl_history_set_point (); - } - return 0; -} - -/* **************************************************************** */ -/* */ -/* Editing Modes */ -/* */ -/* **************************************************************** */ -/* How to toggle back and forth between editing modes. */ -int -rl_vi_editing_mode (count, key) - int count, key; -{ -#if defined (VI_MODE) - _rl_set_insert_mode (RL_IM_INSERT, 1); /* vi mode ignores insert mode */ - rl_editing_mode = vi_mode; - rl_vi_insertion_mode (1, key); -#endif /* VI_MODE */ - - return 0; -} - -int -rl_emacs_editing_mode (count, key) - int count, key; -{ - rl_editing_mode = emacs_mode; - _rl_set_insert_mode (RL_IM_INSERT, 1); /* emacs mode default is insert mode */ - _rl_keymap = emacs_standard_keymap; - return 0; -} - -/* Function for the rest of the library to use to set insert/overwrite mode. */ -void -_rl_set_insert_mode (im, force) - int im, force; -{ -#ifdef CURSOR_MODE - _rl_set_cursor (im, force); -#endif - - rl_insert_mode = im; -} - -/* Toggle overwrite mode. A positive explicit argument selects overwrite - mode. A negative or zero explicit argument selects insert mode. */ -int -rl_overwrite_mode (count, key) - int count, key; -{ - if (rl_explicit_arg == 0) - _rl_set_insert_mode (rl_insert_mode ^ 1, 0); - else if (count > 0) - _rl_set_insert_mode (RL_IM_OVERWRITE, 0); - else - _rl_set_insert_mode (RL_IM_INSERT, 0); - - return 0; -} diff --git a/readline/rlmbutil.h b/readline/rlmbutil.h deleted file mode 100644 index 27ca32bfc7..0000000000 --- a/readline/rlmbutil.h +++ /dev/null @@ -1,108 +0,0 @@ -/* rlmbutil.h -- utility functions for multibyte characters. */ - -/* Copyright (C) 2001 Free Software Foundation, Inc. - - This file is part of the GNU Readline Library, a library for - reading lines of text with interactive input and history editing. - - The GNU Readline Library is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2, or - (at your option) any later version. - - The GNU Readline Library is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - The GNU General Public License is often shipped with GNU software, and - is generally kept in a file called COPYING or LICENSE. If you do not - have a copy of the license, write to the Free Software Foundation, - 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ - -#if !defined (_RL_MBUTIL_H_) -#define _RL_MBUTIL_H_ - -#include "rlstdc.h" - -/************************************************/ -/* check multibyte capability for I18N code */ -/************************************************/ - -/* For platforms which support the ISO C amendement 1 functionality we - support user defined character classes. */ - /* Solaris 2.5 has a bug: must be included before . */ -#if defined (HAVE_WCTYPE_H) && defined (HAVE_WCHAR_H) -# include -# include -# if defined (HAVE_MBSRTOWCS) /* system is supposed to support XPG5 */ -# define HANDLE_MULTIBYTE 1 -# endif -#endif - -/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */ -#if HANDLE_MULTIBYTE && !defined (HAVE_MBSTATE_T) -# define wcsrtombs(dest, src, len, ps) (wcsrtombs) (dest, src, len, 0) -# define mbsrtowcs(dest, src, len, ps) (mbsrtowcs) (dest, src, len, 0) -# define wcrtomb(s, wc, ps) (wcrtomb) (s, wc, 0) -# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0) -# define mbrlen(s, n, ps) (mbrlen) (s, n, 0) -# define mbstate_t int -#endif - -/* Make sure MB_LEN_MAX is at least 16 on systems that claim to be able to - handle multibyte chars (some systems define MB_LEN_MAX as 1) */ -#ifdef HANDLE_MULTIBYTE -# include -# if defined(MB_LEN_MAX) && (MB_LEN_MAX < 16) -# undef MB_LEN_MAX -# endif -# if !defined (MB_LEN_MAX) -# define MB_LEN_MAX 16 -# endif -#endif - -/************************************************/ -/* end of multibyte capability checks for I18N */ -/************************************************/ - -/* - * Flags for _rl_find_prev_mbchar and _rl_find_next_mbchar: - * - * MB_FIND_ANY find any multibyte character - * MB_FIND_NONZERO find a non-zero-width multibyte character - */ - -#define MB_FIND_ANY 0x00 -#define MB_FIND_NONZERO 0x01 - -extern int _rl_find_prev_mbchar PARAMS((char *, int, int)); -extern int _rl_find_next_mbchar PARAMS((char *, int, int, int)); - -#ifdef HANDLE_MULTIBYTE - -extern int _rl_compare_chars PARAMS((char *, int, mbstate_t *, char *, int, mbstate_t *)); -extern int _rl_get_char_len PARAMS((char *, mbstate_t *)); -extern int _rl_adjust_point PARAMS((char *, int, mbstate_t *)); - -extern int _rl_read_mbchar PARAMS((char *, int)); -extern int _rl_read_mbstring PARAMS((int, char *, int)); - -extern int _rl_is_mbchar_matched PARAMS((char *, int, int, char *, int)); - -#else /* !HANDLE_MULTIBYTE */ - -#undef MB_LEN_MAX -#undef MB_CUR_MAX - -#define MB_LEN_MAX 1 -#define MB_CUR_MAX 1 - -#define _rl_find_prev_mbchar(b, i, f) (((i) == 0) ? (i) : ((i) - 1)) -#define _rl_find_next_mbchar(b, i1, i2, f) ((i1) + (i2)) - -#endif /* !HANDLE_MULTIBYTE */ - -extern int rl_byte_oriented; - -#endif /* _RL_MBUTIL_H_ */ diff --git a/readline/rltypedefs.h b/readline/rltypedefs.h deleted file mode 100644 index f3280e9fce..0000000000 --- a/readline/rltypedefs.h +++ /dev/null @@ -1,88 +0,0 @@ -/* rltypedefs.h -- Type declarations for readline functions. */ - -/* Copyright (C) 2000 Free Software Foundation, Inc. - - This file is part of the GNU Readline Library, a library for - reading lines of text with interactive input and history editing. - - The GNU Readline Library is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2, or - (at your option) any later version. - - The GNU Readline Library is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - The GNU General Public License is often shipped with GNU software, and - is generally kept in a file called COPYING or LICENSE. If you do not - have a copy of the license, write to the Free Software Foundation, - 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ - -#ifndef _RL_TYPEDEFS_H_ -#define _RL_TYPEDEFS_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Old-style */ - -#if !defined (_FUNCTION_DEF) -# define _FUNCTION_DEF - -typedef int Function (); -typedef void VFunction (); -typedef char *CPFunction (); -typedef char **CPPFunction (); - -#endif /* _FUNCTION_DEF */ - -/* New style. */ - -#if !defined (_RL_FUNCTION_TYPEDEF) -# define _RL_FUNCTION_TYPEDEF - -/* Bindable functions */ -typedef int rl_command_func_t PARAMS((int, int)); - -/* Typedefs for the completion system */ -typedef char *rl_compentry_func_t PARAMS((const char *, int)); -typedef char **rl_completion_func_t PARAMS((const char *, int, int)); - -typedef char *rl_quote_func_t PARAMS((char *, int, char *)); -typedef char *rl_dequote_func_t PARAMS((char *, int)); - -typedef int rl_compignore_func_t PARAMS((char **)); - -typedef void rl_compdisp_func_t PARAMS((char **, int, int)); - -/* Type for input and pre-read hook functions like rl_event_hook */ -typedef int rl_hook_func_t PARAMS((void)); - -/* Input function type */ -typedef int rl_getc_func_t PARAMS((FILE *)); - -/* Generic function that takes a character buffer (which could be the readline - line buffer) and an index into it (which could be rl_point) and returns - an int. */ -typedef int rl_linebuf_func_t PARAMS((char *, int)); - -/* `Generic' function pointer typedefs */ -typedef int rl_intfunc_t PARAMS((int)); -#define rl_ivoidfunc_t rl_hook_func_t -typedef int rl_icpfunc_t PARAMS((char *)); -typedef int rl_icppfunc_t PARAMS((char **)); - -typedef void rl_voidfunc_t PARAMS((void)); -typedef void rl_vintfunc_t PARAMS((int)); -typedef void rl_vcpfunc_t PARAMS((char *)); -typedef void rl_vcppfunc_t PARAMS((char **)); -#endif /* _RL_FUNCTION_TYPEDEF */ - -#ifdef __cplusplus -} -#endif - -#endif /* _RL_TYPEDEFS_H_ */ diff --git a/readline/support/wcwidth.c b/readline/support/wcwidth.c deleted file mode 100644 index ace9a3ab92..0000000000 --- a/readline/support/wcwidth.c +++ /dev/null @@ -1,236 +0,0 @@ -/* - * This is an implementation of wcwidth() and wcswidth() as defined in - * "The Single UNIX Specification, Version 2, The Open Group, 1997" - * - * - * Markus Kuhn -- 2001-09-08 -- public domain - */ - -#include - -struct interval { - unsigned short first; - unsigned short last; -}; - -/* auxiliary function for binary search in interval table */ -static int bisearch(wchar_t ucs, const struct interval *table, int max) { - int min = 0; - int mid; - - if (ucs < table[0].first || ucs > table[max].last) - return 0; - while (max >= min) { - mid = (min + max) / 2; - if (ucs > table[mid].last) - min = mid + 1; - else if (ucs < table[mid].first) - max = mid - 1; - else - return 1; - } - - return 0; -} - - -/* The following functions define the column width of an ISO 10646 - * character as follows: - * - * - The null character (U+0000) has a column width of 0. - * - * - Other C0/C1 control characters and DEL will lead to a return - * value of -1. - * - * - Non-spacing and enclosing combining characters (general - * category code Mn or Me in the Unicode database) have a - * column width of 0. - * - * - Other format characters (general category code Cf in the Unicode - * database) and ZERO WIDTH SPACE (U+200B) have a column width of 0. - * - * - Hangul Jamo medial vowels and final consonants (U+1160-U+11FF) - * have a column width of 0. - * - * - Spacing characters in the East Asian Wide (W) or East Asian - * FullWidth (F) category as defined in Unicode Technical - * Report #11 have a column width of 2. - * - * - All remaining characters (including all printable - * ISO 8859-1 and WGL4 characters, Unicode control characters, - * etc.) have a column width of 1. - * - * This implementation assumes that wchar_t characters are encoded - * in ISO 10646. - */ - -int wcwidth(wchar_t ucs) -{ - /* sorted list of non-overlapping intervals of non-spacing characters */ - static const struct interval combining[] = { - { 0x0300, 0x034E }, { 0x0360, 0x0362 }, { 0x0483, 0x0486 }, - { 0x0488, 0x0489 }, { 0x0591, 0x05A1 }, { 0x05A3, 0x05B9 }, - { 0x05BB, 0x05BD }, { 0x05BF, 0x05BF }, { 0x05C1, 0x05C2 }, - { 0x05C4, 0x05C4 }, { 0x064B, 0x0655 }, { 0x0670, 0x0670 }, - { 0x06D6, 0x06E4 }, { 0x06E7, 0x06E8 }, { 0x06EA, 0x06ED }, - { 0x070F, 0x070F }, { 0x0711, 0x0711 }, { 0x0730, 0x074A }, - { 0x07A6, 0x07B0 }, { 0x0901, 0x0902 }, { 0x093C, 0x093C }, - { 0x0941, 0x0948 }, { 0x094D, 0x094D }, { 0x0951, 0x0954 }, - { 0x0962, 0x0963 }, { 0x0981, 0x0981 }, { 0x09BC, 0x09BC }, - { 0x09C1, 0x09C4 }, { 0x09CD, 0x09CD }, { 0x09E2, 0x09E3 }, - { 0x0A02, 0x0A02 }, { 0x0A3C, 0x0A3C }, { 0x0A41, 0x0A42 }, - { 0x0A47, 0x0A48 }, { 0x0A4B, 0x0A4D }, { 0x0A70, 0x0A71 }, - { 0x0A81, 0x0A82 }, { 0x0ABC, 0x0ABC }, { 0x0AC1, 0x0AC5 }, - { 0x0AC7, 0x0AC8 }, { 0x0ACD, 0x0ACD }, { 0x0B01, 0x0B01 }, - { 0x0B3C, 0x0B3C }, { 0x0B3F, 0x0B3F }, { 0x0B41, 0x0B43 }, - { 0x0B4D, 0x0B4D }, { 0x0B56, 0x0B56 }, { 0x0B82, 0x0B82 }, - { 0x0BC0, 0x0BC0 }, { 0x0BCD, 0x0BCD }, { 0x0C3E, 0x0C40 }, - { 0x0C46, 0x0C48 }, { 0x0C4A, 0x0C4D }, { 0x0C55, 0x0C56 }, - { 0x0CBF, 0x0CBF }, { 0x0CC6, 0x0CC6 }, { 0x0CCC, 0x0CCD }, - { 0x0D41, 0x0D43 }, { 0x0D4D, 0x0D4D }, { 0x0DCA, 0x0DCA }, - { 0x0DD2, 0x0DD4 }, { 0x0DD6, 0x0DD6 }, { 0x0E31, 0x0E31 }, - { 0x0E34, 0x0E3A }, { 0x0E47, 0x0E4E }, { 0x0EB1, 0x0EB1 }, - { 0x0EB4, 0x0EB9 }, { 0x0EBB, 0x0EBC }, { 0x0EC8, 0x0ECD }, - { 0x0F18, 0x0F19 }, { 0x0F35, 0x0F35 }, { 0x0F37, 0x0F37 }, - { 0x0F39, 0x0F39 }, { 0x0F71, 0x0F7E }, { 0x0F80, 0x0F84 }, - { 0x0F86, 0x0F87 }, { 0x0F90, 0x0F97 }, { 0x0F99, 0x0FBC }, - { 0x0FC6, 0x0FC6 }, { 0x102D, 0x1030 }, { 0x1032, 0x1032 }, - { 0x1036, 0x1037 }, { 0x1039, 0x1039 }, { 0x1058, 0x1059 }, - { 0x1160, 0x11FF }, { 0x17B7, 0x17BD }, { 0x17C6, 0x17C6 }, - { 0x17C9, 0x17D3 }, { 0x180B, 0x180E }, { 0x18A9, 0x18A9 }, - { 0x200B, 0x200F }, { 0x202A, 0x202E }, { 0x206A, 0x206F }, - { 0x20D0, 0x20E3 }, { 0x302A, 0x302F }, { 0x3099, 0x309A }, - { 0xFB1E, 0xFB1E }, { 0xFE20, 0xFE23 }, { 0xFEFF, 0xFEFF }, - { 0xFFF9, 0xFFFB } - }; - - /* test for 8-bit control characters */ - if (ucs == 0) - return 0; - if (ucs < 32 || (ucs >= 0x7f && ucs < 0xa0)) - return -1; - - /* binary search in table of non-spacing characters */ - if (bisearch(ucs, combining, - sizeof(combining) / sizeof(struct interval) - 1)) - return 0; - - /* if we arrive here, ucs is not a combining or C0/C1 control character */ - - return 1 + - (ucs >= 0x1100 && - (ucs <= 0x115f || /* Hangul Jamo init. consonants */ - (ucs >= 0x2e80 && ucs <= 0xa4cf && (ucs & ~0x0011) != 0x300a && - ucs != 0x303f) || /* CJK ... Yi */ - (ucs >= 0xac00 && ucs <= 0xd7a3) || /* Hangul Syllables */ - (ucs >= 0xf900 && ucs <= 0xfaff) || /* CJK Compatibility Ideographs */ - (ucs >= 0xfe30 && ucs <= 0xfe6f) || /* CJK Compatibility Forms */ - (ucs >= 0xff00 && ucs <= 0xff5f) || /* Fullwidth Forms */ - (ucs >= 0xffe0 && ucs <= 0xffe6) || - (ucs >= 0x20000 && ucs <= 0x2ffff))); -} - - -int wcswidth(const wchar_t *pwcs, size_t n) -{ - int w, width = 0; - - for (;*pwcs && n-- > 0; pwcs++) - if ((w = wcwidth(*pwcs)) < 0) - return -1; - else - width += w; - - return width; -} - - -/* - * The following function is the same as wcwidth(), except that - * spacing characters in the East Asian Ambiguous (A) category as - * defined in Unicode Technical Report #11 have a column width of 2. - * This experimental variant might be useful for users of CJK legacy - * encodings who want to migrate to UCS. It is not otherwise - * recommended for general use. - */ -static int wcwidth_cjk(wchar_t ucs) -{ - /* sorted list of non-overlapping intervals of East Asian Ambiguous - * characters */ - static const struct interval ambiguous[] = { - { 0x00A1, 0x00A1 }, { 0x00A4, 0x00A4 }, { 0x00A7, 0x00A8 }, - { 0x00AA, 0x00AA }, { 0x00AD, 0x00AE }, { 0x00B0, 0x00B4 }, - { 0x00B6, 0x00BA }, { 0x00BC, 0x00BF }, { 0x00C6, 0x00C6 }, - { 0x00D0, 0x00D0 }, { 0x00D7, 0x00D8 }, { 0x00DE, 0x00E1 }, - { 0x00E6, 0x00E6 }, { 0x00E8, 0x00EA }, { 0x00EC, 0x00ED }, - { 0x00F0, 0x00F0 }, { 0x00F2, 0x00F3 }, { 0x00F7, 0x00FA }, - { 0x00FC, 0x00FC }, { 0x00FE, 0x00FE }, { 0x0101, 0x0101 }, - { 0x0111, 0x0111 }, { 0x0113, 0x0113 }, { 0x011B, 0x011B }, - { 0x0126, 0x0127 }, { 0x012B, 0x012B }, { 0x0131, 0x0133 }, - { 0x0138, 0x0138 }, { 0x013F, 0x0142 }, { 0x0144, 0x0144 }, - { 0x0148, 0x014B }, { 0x014D, 0x014D }, { 0x0152, 0x0153 }, - { 0x0166, 0x0167 }, { 0x016B, 0x016B }, { 0x01CE, 0x01CE }, - { 0x01D0, 0x01D0 }, { 0x01D2, 0x01D2 }, { 0x01D4, 0x01D4 }, - { 0x01D6, 0x01D6 }, { 0x01D8, 0x01D8 }, { 0x01DA, 0x01DA }, - { 0x01DC, 0x01DC }, { 0x0251, 0x0251 }, { 0x0261, 0x0261 }, - { 0x02C4, 0x02C4 }, { 0x02C7, 0x02C7 }, { 0x02C9, 0x02CB }, - { 0x02CD, 0x02CD }, { 0x02D0, 0x02D0 }, { 0x02D8, 0x02DB }, - { 0x02DD, 0x02DD }, { 0x02DF, 0x02DF }, { 0x0300, 0x034E }, - { 0x0360, 0x0362 }, { 0x0391, 0x03A1 }, { 0x03A3, 0x03A9 }, - { 0x03B1, 0x03C1 }, { 0x03C3, 0x03C9 }, { 0x0401, 0x0401 }, - { 0x0410, 0x044F }, { 0x0451, 0x0451 }, { 0x2010, 0x2010 }, - { 0x2013, 0x2016 }, { 0x2018, 0x2019 }, { 0x201C, 0x201D }, - { 0x2020, 0x2022 }, { 0x2024, 0x2027 }, { 0x2030, 0x2030 }, - { 0x2032, 0x2033 }, { 0x2035, 0x2035 }, { 0x203B, 0x203B }, - { 0x203E, 0x203E }, { 0x2074, 0x2074 }, { 0x207F, 0x207F }, - { 0x2081, 0x2084 }, { 0x20AC, 0x20AC }, { 0x2103, 0x2103 }, - { 0x2105, 0x2105 }, { 0x2109, 0x2109 }, { 0x2113, 0x2113 }, - { 0x2116, 0x2116 }, { 0x2121, 0x2122 }, { 0x2126, 0x2126 }, - { 0x212B, 0x212B }, { 0x2153, 0x2155 }, { 0x215B, 0x215E }, - { 0x2160, 0x216B }, { 0x2170, 0x2179 }, { 0x2190, 0x2199 }, - { 0x21B8, 0x21B9 }, { 0x21D2, 0x21D2 }, { 0x21D4, 0x21D4 }, - { 0x21E7, 0x21E7 }, { 0x2200, 0x2200 }, { 0x2202, 0x2203 }, - { 0x2207, 0x2208 }, { 0x220B, 0x220B }, { 0x220F, 0x220F }, - { 0x2211, 0x2211 }, { 0x2215, 0x2215 }, { 0x221A, 0x221A }, - { 0x221D, 0x2220 }, { 0x2223, 0x2223 }, { 0x2225, 0x2225 }, - { 0x2227, 0x222C }, { 0x222E, 0x222E }, { 0x2234, 0x2237 }, - { 0x223C, 0x223D }, { 0x2248, 0x2248 }, { 0x224C, 0x224C }, - { 0x2252, 0x2252 }, { 0x2260, 0x2261 }, { 0x2264, 0x2267 }, - { 0x226A, 0x226B }, { 0x226E, 0x226F }, { 0x2282, 0x2283 }, - { 0x2286, 0x2287 }, { 0x2295, 0x2295 }, { 0x2299, 0x2299 }, - { 0x22A5, 0x22A5 }, { 0x22BF, 0x22BF }, { 0x2312, 0x2312 }, - { 0x2329, 0x232A }, { 0x2460, 0x24BF }, { 0x24D0, 0x24E9 }, - { 0x2500, 0x254B }, { 0x2550, 0x2574 }, { 0x2580, 0x258F }, - { 0x2592, 0x2595 }, { 0x25A0, 0x25A1 }, { 0x25A3, 0x25A9 }, - { 0x25B2, 0x25B3 }, { 0x25B6, 0x25B7 }, { 0x25BC, 0x25BD }, - { 0x25C0, 0x25C1 }, { 0x25C6, 0x25C8 }, { 0x25CB, 0x25CB }, - { 0x25CE, 0x25D1 }, { 0x25E2, 0x25E5 }, { 0x25EF, 0x25EF }, - { 0x2605, 0x2606 }, { 0x2609, 0x2609 }, { 0x260E, 0x260F }, - { 0x261C, 0x261C }, { 0x261E, 0x261E }, { 0x2640, 0x2640 }, - { 0x2642, 0x2642 }, { 0x2660, 0x2661 }, { 0x2663, 0x2665 }, - { 0x2667, 0x266A }, { 0x266C, 0x266D }, { 0x266F, 0x266F }, - { 0x273D, 0x273D }, { 0x3008, 0x300B }, { 0x3014, 0x3015 }, - { 0x3018, 0x301B }, { 0xFFFD, 0xFFFD } - }; - - /* binary search in table of non-spacing characters */ - if (bisearch(ucs, ambiguous, - sizeof(ambiguous) / sizeof(struct interval) - 1)) - return 2; - - return wcwidth(ucs); -} - - -int wcswidth_cjk(const wchar_t *pwcs, size_t n) -{ - int w, width = 0; - - for (;*pwcs && n-- > 0; pwcs++) - if ((w = wcwidth_cjk(*pwcs)) < 0) - return -1; - else - width += w; - - return width; -} diff --git a/readline/text.c b/readline/text.c deleted file mode 100644 index 2a7b724f48..0000000000 --- a/readline/text.c +++ /dev/null @@ -1,1540 +0,0 @@ -/* text.c -- text handling commands for readline. */ - -/* Copyright (C) 1987-2002 Free Software Foundation, Inc. - - This file is part of the GNU Readline Library, a library for - reading lines of text with interactive input and history editing. - - The GNU Readline Library is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2, or - (at your option) any later version. - - The GNU Readline Library is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - The GNU General Public License is often shipped with GNU software, and - is generally kept in a file called COPYING or LICENSE. If you do not - have a copy of the license, write to the Free Software Foundation, - 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ -#define READLINE_LIBRARY - -#if defined (HAVE_CONFIG_H) -# include -#endif - -#if defined (HAVE_UNISTD_H) -# include -#endif /* HAVE_UNISTD_H */ - -#if defined (HAVE_STDLIB_H) -# include -#else -# include "ansi_stdlib.h" -#endif /* HAVE_STDLIB_H */ - -#if defined (HAVE_LOCALE_H) -# include -#endif - -#include - -/* System-specific feature definitions and include files. */ -#include "rldefs.h" -#include "rlmbutil.h" - -#if defined (__EMX__) -# define INCL_DOSPROCESS -# include -#endif /* __EMX__ */ - -/* Some standard library routines. */ -#include "readline.h" -#include "history.h" - -#include "rlprivate.h" -#include "rlshell.h" -#include "xmalloc.h" - -/* Forward declarations. */ -static int rl_change_case PARAMS((int, int)); -static int _rl_char_search PARAMS((int, int, int)); - -/* **************************************************************** */ -/* */ -/* Insert and Delete */ -/* */ -/* **************************************************************** */ - -/* Insert a string of text into the line at point. This is the only - way that you should do insertion. _rl_insert_char () calls this - function. Returns the number of characters inserted. */ -int -rl_insert_text (string) - const char *string; -{ - register int i, l; - - l = (string && *string) ? strlen (string) : 0; - if (l == 0) - return 0; - - if (rl_end + l >= rl_line_buffer_len) - rl_extend_line_buffer (rl_end + l); - - for (i = rl_end; i >= rl_point; i--) - rl_line_buffer[i + l] = rl_line_buffer[i]; - strncpy (rl_line_buffer + rl_point, string, l); - - /* Remember how to undo this if we aren't undoing something. */ - if (_rl_doing_an_undo == 0) - { - /* If possible and desirable, concatenate the undos. */ - if ((l == 1) && - rl_undo_list && - (rl_undo_list->what == UNDO_INSERT) && - (rl_undo_list->end == rl_point) && - (rl_undo_list->end - rl_undo_list->start < 20)) - rl_undo_list->end++; - else - rl_add_undo (UNDO_INSERT, rl_point, rl_point + l, (char *)NULL); - } - rl_point += l; - rl_end += l; - rl_line_buffer[rl_end] = '\0'; - return l; -} - -/* Delete the string between FROM and TO. FROM is inclusive, TO is not. - Returns the number of characters deleted. */ -int -rl_delete_text (from, to) - int from, to; -{ - register char *text; - register int diff, i; - - /* Fix it if the caller is confused. */ - if (from > to) - SWAP (from, to); - - /* fix boundaries */ - if (to > rl_end) - { - to = rl_end; - if (from > to) - from = to; - } - if (from < 0) - from = 0; - - text = rl_copy_text (from, to); - - /* Some versions of strncpy() can't handle overlapping arguments. */ - diff = to - from; - for (i = from; i < rl_end - diff; i++) - rl_line_buffer[i] = rl_line_buffer[i + diff]; - - /* Remember how to undo this delete. */ - if (_rl_doing_an_undo == 0) - rl_add_undo (UNDO_DELETE, from, to, text); - else - free (text); - - rl_end -= diff; - rl_line_buffer[rl_end] = '\0'; - return (diff); -} - -/* Fix up point so that it is within the line boundaries after killing - text. If FIX_MARK_TOO is non-zero, the mark is forced within line - boundaries also. */ - -#define _RL_FIX_POINT(x) \ - do { \ - if (x > rl_end) \ - x = rl_end; \ - else if (x < 0) \ - x = 0; \ - } while (0) - -void -_rl_fix_point (fix_mark_too) - int fix_mark_too; -{ - _RL_FIX_POINT (rl_point); - if (fix_mark_too) - _RL_FIX_POINT (rl_mark); -} -#undef _RL_FIX_POINT - -int -_rl_replace_text (text, start, end) - const char *text; - int start, end; -{ - int n; - - rl_begin_undo_group (); - rl_delete_text (start, end + 1); - rl_point = start; - n = rl_insert_text (text); - rl_end_undo_group (); - - return n; -} - -/* Replace the current line buffer contents with TEXT. If CLEAR_UNDO is - non-zero, we free the current undo list. */ -void -rl_replace_line (text, clear_undo) - const char *text; - int clear_undo; -{ - int len; - - len = strlen (text); - if (len >= rl_line_buffer_len) - rl_extend_line_buffer (len); - strcpy (rl_line_buffer, text); - rl_end = len; - - if (clear_undo) - rl_free_undo_list (); - - _rl_fix_point (1); -} - -/* **************************************************************** */ -/* */ -/* Readline character functions */ -/* */ -/* **************************************************************** */ - -/* This is not a gap editor, just a stupid line input routine. No hair - is involved in writing any of the functions, and none should be. */ - -/* Note that: - - rl_end is the place in the string that we would place '\0'; - i.e., it is always safe to place '\0' there. - - rl_point is the place in the string where the cursor is. Sometimes - this is the same as rl_end. - - Any command that is called interactively receives two arguments. - The first is a count: the numeric arg pased to this command. - The second is the key which invoked this command. -*/ - -/* **************************************************************** */ -/* */ -/* Movement Commands */ -/* */ -/* **************************************************************** */ - -/* Note that if you `optimize' the display for these functions, you cannot - use said functions in other functions which do not do optimizing display. - I.e., you will have to update the data base for rl_redisplay, and you - might as well let rl_redisplay do that job. */ - -/* Move forward COUNT bytes. */ -int -rl_forward_byte (count, key) - int count, key; -{ - if (count < 0) - return (rl_backward_byte (-count, key)); - - if (count > 0) - { - int end = rl_point + count; -#if defined (VI_MODE) - int lend = rl_end > 0 ? rl_end - (rl_editing_mode == vi_mode) : rl_end; -#else - int lend = rl_end; -#endif - - if (end > lend) - { - rl_point = lend; - rl_ding (); - } - else - rl_point = end; - } - - if (rl_end < 0) - rl_end = 0; - - return 0; -} - -#if defined (HANDLE_MULTIBYTE) -/* Move forward COUNT characters. */ -int -rl_forward_char (count, key) - int count, key; -{ - int point; - - if (MB_CUR_MAX == 1 || rl_byte_oriented) - return (rl_forward_byte (count, key)); - - if (count < 0) - return (rl_backward_char (-count, key)); - - if (count > 0) - { - point = _rl_find_next_mbchar (rl_line_buffer, rl_point, count, MB_FIND_NONZERO); - -#if defined (VI_MODE) - if (rl_end <= point && rl_editing_mode == vi_mode) - point = _rl_find_prev_mbchar (rl_line_buffer, rl_end, MB_FIND_NONZERO); -#endif - - if (rl_point == point) - rl_ding (); - - rl_point = point; - - if (rl_end < 0) - rl_end = 0; - } - - return 0; -} -#else /* !HANDLE_MULTIBYTE */ -int -rl_forward_char (count, key) - int count, key; -{ - return (rl_forward_byte (count, key)); -} -#endif /* !HANDLE_MULTIBYTE */ - -/* Backwards compatibility. */ -int -rl_forward (count, key) - int count, key; -{ - return (rl_forward_char (count, key)); -} - -/* Move backward COUNT bytes. */ -int -rl_backward_byte (count, key) - int count, key; -{ - if (count < 0) - return (rl_forward_byte (-count, key)); - - if (count > 0) - { - if (rl_point < count) - { - rl_point = 0; - rl_ding (); - } - else - rl_point -= count; - } - - if (rl_point < 0) - rl_point = 0; - - return 0; -} - -#if defined (HANDLE_MULTIBYTE) -/* Move backward COUNT characters. */ -int -rl_backward_char (count, key) - int count, key; -{ - int point; - - if (MB_CUR_MAX == 1 || rl_byte_oriented) - return (rl_backward_byte (count, key)); - - if (count < 0) - return (rl_forward_char (-count, key)); - - if (count > 0) - { - point = rl_point; - - while (count > 0 && point > 0) - { - point = _rl_find_prev_mbchar (rl_line_buffer, point, MB_FIND_NONZERO); - count--; - } - if (count > 0) - { - rl_point = 0; - rl_ding (); - } - else - rl_point = point; - } - - return 0; -} -#else -int -rl_backward_char (count, key) - int count, key; -{ - return (rl_backward_byte (count, key)); -} -#endif - -/* Backwards compatibility. */ -int -rl_backward (count, key) - int count, key; -{ - return (rl_backward_char (count, key)); -} - -/* Move to the beginning of the line. */ -int -rl_beg_of_line (count, key) - int count, key; -{ - rl_point = 0; - return 0; -} - -/* Move to the end of the line. */ -int -rl_end_of_line (count, key) - int count, key; -{ - rl_point = rl_end; - return 0; -} - -/* XXX - these might need changes for multibyte characters */ -/* Move forward a word. We do what Emacs does. */ -int -rl_forward_word (count, key) - int count, key; -{ - int c; - - if (count < 0) - return (rl_backward_word (-count, key)); - - while (count) - { - if (rl_point == rl_end) - return 0; - - /* If we are not in a word, move forward until we are in one. - Then, move forward until we hit a non-alphabetic character. */ - c = rl_line_buffer[rl_point]; - if (rl_alphabetic (c) == 0) - { - while (++rl_point < rl_end) - { - c = rl_line_buffer[rl_point]; - if (rl_alphabetic (c)) - break; - } - } - - if (rl_point == rl_end) - return 0; - - while (++rl_point < rl_end) - { - c = rl_line_buffer[rl_point]; - if (rl_alphabetic (c) == 0) - break; - } - --count; - } - - return 0; -} - -/* Move backward a word. We do what Emacs does. */ -int -rl_backward_word (count, key) - int count, key; -{ - int c; - - if (count < 0) - return (rl_forward_word (-count, key)); - - while (count) - { - if (!rl_point) - return 0; - - /* Like rl_forward_word (), except that we look at the characters - just before point. */ - - c = rl_line_buffer[rl_point - 1]; - if (rl_alphabetic (c) == 0) - { - while (--rl_point) - { - c = rl_line_buffer[rl_point - 1]; - if (rl_alphabetic (c)) - break; - } - } - - while (rl_point) - { - c = rl_line_buffer[rl_point - 1]; - if (rl_alphabetic (c) == 0) - break; - else - --rl_point; - } - - --count; - } - - return 0; -} - -/* Clear the current line. Numeric argument to C-l does this. */ -int -rl_refresh_line (ignore1, ignore2) - int ignore1, ignore2; -{ - int curr_line; - - curr_line = _rl_current_display_line (); - - _rl_move_vert (curr_line); - _rl_move_cursor_relative (0, rl_line_buffer); /* XXX is this right */ - - _rl_clear_to_eol (0); /* arg of 0 means to not use spaces */ - - rl_forced_update_display (); - rl_display_fixed = 1; - - return 0; -} - -/* C-l typed to a line without quoting clears the screen, and then reprints - the prompt and the current input line. Given a numeric arg, redraw only - the current line. */ -int -rl_clear_screen (count, key) - int count, key; -{ - if (rl_explicit_arg) - { - rl_refresh_line (count, key); - return 0; - } - - _rl_clear_screen (); /* calls termcap function to clear screen */ - rl_forced_update_display (); - rl_display_fixed = 1; - - return 0; -} - -int -rl_arrow_keys (count, c) - int count, c; -{ - int ch; - - RL_SETSTATE(RL_STATE_MOREINPUT); - ch = rl_read_key (); - RL_UNSETSTATE(RL_STATE_MOREINPUT); - - switch (_rl_to_upper (ch)) - { - case 'A': - rl_get_previous_history (count, ch); - break; - - case 'B': - rl_get_next_history (count, ch); - break; - - case 'C': - if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) - rl_forward_char (count, ch); - else - rl_forward_byte (count, ch); - break; - - case 'D': - if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) - rl_backward_char (count, ch); - else - rl_backward_byte (count, ch); - break; - - default: - rl_ding (); - } - - return 0; -} - -/* **************************************************************** */ -/* */ -/* Text commands */ -/* */ -/* **************************************************************** */ - -#ifdef HANDLE_MULTIBYTE -static char pending_bytes[MB_LEN_MAX]; -static int pending_bytes_length = 0; -static mbstate_t ps = {0}; -#endif - -/* Insert the character C at the current location, moving point forward. - If C introduces a multibyte sequence, we read the whole sequence and - then insert the multibyte char into the line buffer. */ -int -_rl_insert_char (count, c) - int count, c; -{ - register int i; - char *string; -#ifdef HANDLE_MULTIBYTE - int string_size; - char incoming[MB_LEN_MAX + 1]; - int incoming_length = 0; - mbstate_t ps_back; - static int stored_count = 0; -#endif - - if (count <= 0) - return 0; - -#if defined (HANDLE_MULTIBYTE) - if (MB_CUR_MAX == 1 || rl_byte_oriented) - { - incoming[0] = c; - incoming[1] = '\0'; - incoming_length = 1; - } - else - { - wchar_t wc; - size_t ret; - - if (stored_count <= 0) - stored_count = count; - else - count = stored_count; - - ps_back = ps; - pending_bytes[pending_bytes_length++] = c; - ret = mbrtowc (&wc, pending_bytes, pending_bytes_length, &ps); - - if (ret == (size_t)-2) - { - /* Bytes too short to compose character, try to wait for next byte. - Restore the state of the byte sequence, because in this case the - effect of mbstate is undefined. */ - ps = ps_back; - return 1; - } - else if (ret == (size_t)-1) - { - /* Invalid byte sequence for the current locale. Treat first byte - as a single character. */ - incoming[0] = pending_bytes[0]; - incoming[1] = '\0'; - incoming_length = 1; - pending_bytes_length--; - memmove (pending_bytes, pending_bytes + 1, pending_bytes_length); - /* Clear the state of the byte sequence, because in this case the - effect of mbstate is undefined. */ - memset (&ps, 0, sizeof (mbstate_t)); - } - else if (ret == (size_t)0) - { - incoming[0] = '\0'; - incoming_length = 0; - pending_bytes_length--; - /* Clear the state of the byte sequence, because in this case the - effect of mbstate is undefined. */ - memset (&ps, 0, sizeof (mbstate_t)); - } - else - { - /* We successfully read a single multibyte character. */ - memcpy (incoming, pending_bytes, pending_bytes_length); - incoming[pending_bytes_length] = '\0'; - incoming_length = pending_bytes_length; - pending_bytes_length = 0; - } - } -#endif /* HANDLE_MULTIBYTE */ - - /* If we can optimize, then do it. But don't let people crash - readline because of extra large arguments. */ - if (count > 1 && count <= 1024) - { -#if defined (HANDLE_MULTIBYTE) - string_size = count * incoming_length; - string = (char *)xmalloc (1 + string_size); - - i = 0; - while (i < string_size) - { - strncpy (string + i, incoming, incoming_length); - i += incoming_length; - } - incoming_length = 0; - stored_count = 0; -#else /* !HANDLE_MULTIBYTE */ - string = (char *)xmalloc (1 + count); - - for (i = 0; i < count; i++) - string[i] = c; -#endif /* !HANDLE_MULTIBYTE */ - - string[i] = '\0'; - rl_insert_text (string); - free (string); - - return 0; - } - - if (count > 1024) - { - int decreaser; -#if defined (HANDLE_MULTIBYTE) - string_size = incoming_length * 1024; - string = (char *)xmalloc (1 + string_size); - - i = 0; - while (i < string_size) - { - strncpy (string + i, incoming, incoming_length); - i += incoming_length; - } - - while (count) - { - decreaser = (count > 1024) ? 1024 : count; - string[decreaser*incoming_length] = '\0'; - rl_insert_text (string); - count -= decreaser; - } - - free (string); - incoming_length = 0; - stored_count = 0; -#else /* !HANDLE_MULTIBYTE */ - char str[1024+1]; - - for (i = 0; i < 1024; i++) - str[i] = c; - - while (count) - { - decreaser = (count > 1024 ? 1024 : count); - str[decreaser] = '\0'; - rl_insert_text (str); - count -= decreaser; - } -#endif /* !HANDLE_MULTIBYTE */ - - return 0; - } - -#if defined (HANDLE_MULTIBYTE) - if (MB_CUR_MAX == 1 || rl_byte_oriented) - { -#endif - /* We are inserting a single character. - If there is pending input, then make a string of all of the - pending characters that are bound to rl_insert, and insert - them all. */ - if (_rl_any_typein ()) - _rl_insert_typein (c); - else - { - /* Inserting a single character. */ - char str[2]; - - str[1] = '\0'; - str[0] = c; - rl_insert_text (str); - } -#if defined (HANDLE_MULTIBYTE) - } - else - { - rl_insert_text (incoming); - stored_count = 0; - } -#endif - - return 0; -} - -/* Overwrite the character at point (or next COUNT characters) with C. - If C introduces a multibyte character sequence, read the entire sequence - before starting the overwrite loop. */ -int -_rl_overwrite_char (count, c) - int count, c; -{ - int i; -#if defined (HANDLE_MULTIBYTE) - char mbkey[MB_LEN_MAX]; - int k; - - /* Read an entire multibyte character sequence to insert COUNT times. */ - if (count > 0 && MB_CUR_MAX > 1 && rl_byte_oriented == 0) - k = _rl_read_mbstring (c, mbkey, MB_LEN_MAX); -#endif - - for (i = 0; i < count; i++) - { - rl_begin_undo_group (); - - if (rl_point < rl_end) - rl_delete (1, c); - -#if defined (HANDLE_MULTIBYTE) - if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) - rl_insert_text (mbkey); - else -#endif - _rl_insert_char (1, c); - - rl_end_undo_group (); - } - - return 0; -} - -int -rl_insert (count, c) - int count, c; -{ - return (rl_insert_mode == RL_IM_INSERT ? _rl_insert_char (count, c) - : _rl_overwrite_char (count, c)); -} - -/* Insert the next typed character verbatim. */ -int -rl_quoted_insert (count, key) - int count, key; -{ - int c; - -#if defined (HANDLE_SIGNALS) - _rl_disable_tty_signals (); -#endif - - RL_SETSTATE(RL_STATE_MOREINPUT); - c = rl_read_key (); - RL_UNSETSTATE(RL_STATE_MOREINPUT); - -#if defined (HANDLE_SIGNALS) - _rl_restore_tty_signals (); -#endif - - return (_rl_insert_char (count, c)); -} - -/* Insert a tab character. */ -int -rl_tab_insert (count, key) - int count, key; -{ - return (_rl_insert_char (count, '\t')); -} - -/* What to do when a NEWLINE is pressed. We accept the whole line. - KEY is the key that invoked this command. I guess it could have - meaning in the future. */ -int -rl_newline (count, key) - int count, key; -{ - rl_done = 1; - - if (_rl_history_preserve_point) - _rl_history_saved_point = (rl_point == rl_end) ? -1 : rl_point; - - RL_SETSTATE(RL_STATE_DONE); - -#if defined (VI_MODE) - if (rl_editing_mode == vi_mode) - { - _rl_vi_done_inserting (); - _rl_vi_reset_last (); - } -#endif /* VI_MODE */ - - /* If we've been asked to erase empty lines, suppress the final update, - since _rl_update_final calls rl_crlf(). */ - if (rl_erase_empty_line && rl_point == 0 && rl_end == 0) - return 0; - - if (readline_echoing_p) - _rl_update_final (); - return 0; -} - -/* What to do for some uppercase characters, like meta characters, - and some characters appearing in emacs_ctlx_keymap. This function - is just a stub, you bind keys to it and the code in _rl_dispatch () - is special cased. */ -int -rl_do_lowercase_version (ignore1, ignore2) - int ignore1, ignore2; -{ - return 0; -} - -/* This is different from what vi does, so the code's not shared. Emacs - rubout in overwrite mode has one oddity: it replaces a control - character that's displayed as two characters (^X) with two spaces. */ -int -_rl_overwrite_rubout (count, key) - int count, key; -{ - int opoint; - int i, l; - - if (rl_point == 0) - { - rl_ding (); - return 1; - } - - opoint = rl_point; - - /* L == number of spaces to insert */ - for (i = l = 0; i < count; i++) - { - rl_backward_char (1, key); - l += rl_character_len (rl_line_buffer[rl_point], rl_point); /* not exactly right */ - } - - rl_begin_undo_group (); - - if (count > 1 || rl_explicit_arg) - rl_kill_text (opoint, rl_point); - else - rl_delete_text (opoint, rl_point); - - /* Emacs puts point at the beginning of the sequence of spaces. */ - opoint = rl_point; - _rl_insert_char (l, ' '); - rl_point = opoint; - - rl_end_undo_group (); - - return 0; -} - -/* Rubout the character behind point. */ -int -rl_rubout (count, key) - int count, key; -{ - if (count < 0) - return (rl_delete (-count, key)); - - if (!rl_point) - { - rl_ding (); - return -1; - } - - if (rl_insert_mode == RL_IM_OVERWRITE) - return (_rl_overwrite_rubout (count, key)); - - return (_rl_rubout_char (count, key)); -} - -int -_rl_rubout_char (count, key) - int count, key; -{ - int orig_point; - unsigned char c; - - /* Duplicated code because this is called from other parts of the library. */ - if (count < 0) - return (rl_delete (-count, key)); - - if (rl_point == 0) - { - rl_ding (); - return -1; - } - - if (count > 1 || rl_explicit_arg) - { - orig_point = rl_point; -#if defined (HANDLE_MULTIBYTE) - if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) - rl_backward_char (count, key); - else -#endif - rl_backward_byte (count, key); - rl_kill_text (orig_point, rl_point); - } - else - { -#if defined (HANDLE_MULTIBYTE) - if (MB_CUR_MAX == 1 || rl_byte_oriented) - { -#endif - c = rl_line_buffer[--rl_point]; - rl_delete_text (rl_point, rl_point + 1); -#if defined (HANDLE_MULTIBYTE) - } - else - { - int orig_point; - - orig_point = rl_point; - rl_point = _rl_find_prev_mbchar (rl_line_buffer, rl_point, MB_FIND_NONZERO); - c = rl_line_buffer[rl_point]; - rl_delete_text (rl_point, orig_point); - } -#endif /* HANDLE_MULTIBYTE */ - - /* I don't think that the hack for end of line is needed for - multibyte chars. */ -#if defined (HANDLE_MULTIBYTE) - if (MB_CUR_MAX == 1 || rl_byte_oriented) -#endif - if (rl_point == rl_end && ISPRINT (c) && _rl_last_c_pos) - { - int l; - l = rl_character_len (c, rl_point); - _rl_erase_at_end_of_line (l); - } - } - - return 0; -} - -/* Delete the character under the cursor. Given a numeric argument, - kill that many characters instead. */ -int -rl_delete (count, key) - int count, key; -{ - int r; - - if (count < 0) - return (_rl_rubout_char (-count, key)); - - if (rl_point == rl_end) - { - rl_ding (); - return -1; - } - - if (count > 1 || rl_explicit_arg) - { - int orig_point = rl_point; -#if defined (HANDLE_MULTIBYTE) - if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) - rl_forward_char (count, key); - else -#endif - rl_forward_byte (count, key); - - r = rl_kill_text (orig_point, rl_point); - rl_point = orig_point; - return r; - } - else - { - int new_point; - if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) - new_point = _rl_find_next_mbchar (rl_line_buffer, rl_point, 1, MB_FIND_NONZERO); - else - new_point = rl_point + 1; - - return (rl_delete_text (rl_point, new_point)); - } -} - -/* Delete the character under the cursor, unless the insertion - point is at the end of the line, in which case the character - behind the cursor is deleted. COUNT is obeyed and may be used - to delete forward or backward that many characters. */ -int -rl_rubout_or_delete (count, key) - int count, key; -{ - if (rl_end != 0 && rl_point == rl_end) - return (_rl_rubout_char (count, key)); - else - return (rl_delete (count, key)); -} - -/* Delete all spaces and tabs around point. */ -int -rl_delete_horizontal_space (count, ignore) - int count, ignore; -{ - int start = rl_point; - - while (rl_point && whitespace (rl_line_buffer[rl_point - 1])) - rl_point--; - - start = rl_point; - - while (rl_point < rl_end && whitespace (rl_line_buffer[rl_point])) - rl_point++; - - if (start != rl_point) - { - rl_delete_text (start, rl_point); - rl_point = start; - } - return 0; -} - -/* Like the tcsh editing function delete-char-or-list. The eof character - is caught before this is invoked, so this really does the same thing as - delete-char-or-list-or-eof, as long as it's bound to the eof character. */ -int -rl_delete_or_show_completions (count, key) - int count, key; -{ - if (rl_end != 0 && rl_point == rl_end) - return (rl_possible_completions (count, key)); - else - return (rl_delete (count, key)); -} - -#ifndef RL_COMMENT_BEGIN_DEFAULT -#define RL_COMMENT_BEGIN_DEFAULT "#" -#endif - -/* Turn the current line into a comment in shell history. - A K*rn shell style function. */ -int -rl_insert_comment (count, key) - int count, key; -{ - char *rl_comment_text; - int rl_comment_len; - - rl_beg_of_line (1, key); - rl_comment_text = _rl_comment_begin ? _rl_comment_begin : RL_COMMENT_BEGIN_DEFAULT; - - if (rl_explicit_arg == 0) - rl_insert_text (rl_comment_text); - else - { - rl_comment_len = strlen (rl_comment_text); - if (STREQN (rl_comment_text, rl_line_buffer, rl_comment_len)) - rl_delete_text (rl_point, rl_point + rl_comment_len); - else - rl_insert_text (rl_comment_text); - } - - (*rl_redisplay_function) (); - rl_newline (1, '\n'); - - return (0); -} - -/* **************************************************************** */ -/* */ -/* Changing Case */ -/* */ -/* **************************************************************** */ - -/* The three kinds of things that we know how to do. */ -#define UpCase 1 -#define DownCase 2 -#define CapCase 3 - -/* Uppercase the word at point. */ -int -rl_upcase_word (count, key) - int count, key; -{ - return (rl_change_case (count, UpCase)); -} - -/* Lowercase the word at point. */ -int -rl_downcase_word (count, key) - int count, key; -{ - return (rl_change_case (count, DownCase)); -} - -/* Upcase the first letter, downcase the rest. */ -int -rl_capitalize_word (count, key) - int count, key; -{ - return (rl_change_case (count, CapCase)); -} - -/* The meaty function. - Change the case of COUNT words, performing OP on them. - OP is one of UpCase, DownCase, or CapCase. - If a negative argument is given, leave point where it started, - otherwise, leave it where it moves to. */ -static int -rl_change_case (count, op) - int count, op; -{ - register int start, end; - int inword, c; - - start = rl_point; - rl_forward_word (count, 0); - end = rl_point; - - if (count < 0) - SWAP (start, end); - - /* We are going to modify some text, so let's prepare to undo it. */ - rl_modifying (start, end); - - for (inword = 0; start < end; start++) - { - c = rl_line_buffer[start]; - switch (op) - { - case UpCase: - rl_line_buffer[start] = _rl_to_upper (c); - break; - - case DownCase: - rl_line_buffer[start] = _rl_to_lower (c); - break; - - case CapCase: - rl_line_buffer[start] = (inword == 0) ? _rl_to_upper (c) : _rl_to_lower (c); - inword = rl_alphabetic (rl_line_buffer[start]); - break; - - default: - rl_ding (); - return -1; - } - } - rl_point = end; - return 0; -} - -/* **************************************************************** */ -/* */ -/* Transposition */ -/* */ -/* **************************************************************** */ - -/* Transpose the words at point. If point is at the end of the line, - transpose the two words before point. */ -int -rl_transpose_words (count, key) - int count, key; -{ - char *word1, *word2; - int w1_beg, w1_end, w2_beg, w2_end; - int orig_point = rl_point; - - if (!count) - return 0; - - /* Find the two words. */ - rl_forward_word (count, key); - w2_end = rl_point; - rl_backward_word (1, key); - w2_beg = rl_point; - rl_backward_word (count, key); - w1_beg = rl_point; - rl_forward_word (1, key); - w1_end = rl_point; - - /* Do some check to make sure that there really are two words. */ - if ((w1_beg == w2_beg) || (w2_beg < w1_end)) - { - rl_ding (); - rl_point = orig_point; - return -1; - } - - /* Get the text of the words. */ - word1 = rl_copy_text (w1_beg, w1_end); - word2 = rl_copy_text (w2_beg, w2_end); - - /* We are about to do many insertions and deletions. Remember them - as one operation. */ - rl_begin_undo_group (); - - /* Do the stuff at word2 first, so that we don't have to worry - about word1 moving. */ - rl_point = w2_beg; - rl_delete_text (w2_beg, w2_end); - rl_insert_text (word1); - - rl_point = w1_beg; - rl_delete_text (w1_beg, w1_end); - rl_insert_text (word2); - - /* This is exactly correct since the text before this point has not - changed in length. */ - rl_point = w2_end; - - /* I think that does it. */ - rl_end_undo_group (); - free (word1); - free (word2); - - return 0; -} - -/* Transpose the characters at point. If point is at the end of the line, - then transpose the characters before point. */ -int -rl_transpose_chars (count, key) - int count, key; -{ -#if defined (HANDLE_MULTIBYTE) - char *dummy; - int i, prev_point; -#else - char dummy[2]; -#endif - int char_length; - - if (count == 0) - return 0; - - if (!rl_point || rl_end < 2) - { - rl_ding (); - return -1; - } - - rl_begin_undo_group (); - - if (rl_point == rl_end) - { - if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) - rl_point = _rl_find_prev_mbchar (rl_line_buffer, rl_point, MB_FIND_NONZERO); - else - --rl_point; - count = 1; - } - -#if defined (HANDLE_MULTIBYTE) - prev_point = rl_point; - if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) - rl_point = _rl_find_prev_mbchar (rl_line_buffer, rl_point, MB_FIND_NONZERO); - else -#endif - rl_point--; - -#if defined (HANDLE_MULTIBYTE) - char_length = prev_point - rl_point; - dummy = (char *)xmalloc (char_length + 1); - for (i = 0; i < char_length; i++) - dummy[i] = rl_line_buffer[rl_point + i]; - dummy[i] = '\0'; -#else - dummy[0] = rl_line_buffer[rl_point]; - dummy[char_length = 1] = '\0'; -#endif - - rl_delete_text (rl_point, rl_point + char_length); - - rl_point = _rl_find_next_mbchar (rl_line_buffer, rl_point, count, MB_FIND_NONZERO); - - _rl_fix_point (0); - rl_insert_text (dummy); - rl_end_undo_group (); - -#if defined (HANDLE_MULTIBYTE) - free (dummy); -#endif - - return 0; -} - -/* **************************************************************** */ -/* */ -/* Character Searching */ -/* */ -/* **************************************************************** */ - -int -#if defined (HANDLE_MULTIBYTE) -_rl_char_search_internal (count, dir, smbchar, len) - int count, dir; - char *smbchar; - int len; -#else -_rl_char_search_internal (count, dir, schar) - int count, dir, schar; -#endif -{ - int pos, inc; -#if defined (HANDLE_MULTIBYTE) - int prepos; -#endif - - pos = rl_point; - inc = (dir < 0) ? -1 : 1; - while (count) - { - if ((dir < 0 && pos <= 0) || (dir > 0 && pos >= rl_end)) - { - rl_ding (); - return -1; - } - -#if defined (HANDLE_MULTIBYTE) - pos = (inc > 0) ? _rl_find_next_mbchar (rl_line_buffer, pos, 1, MB_FIND_ANY) - : _rl_find_prev_mbchar (rl_line_buffer, pos, MB_FIND_ANY); -#else - pos += inc; -#endif - do - { -#if defined (HANDLE_MULTIBYTE) - if (_rl_is_mbchar_matched (rl_line_buffer, pos, rl_end, smbchar, len)) -#else - if (rl_line_buffer[pos] == schar) -#endif - { - count--; - if (dir < 0) - rl_point = (dir == BTO) ? _rl_find_next_mbchar (rl_line_buffer, pos, 1, MB_FIND_ANY) - : pos; - else - rl_point = (dir == FTO) ? _rl_find_prev_mbchar (rl_line_buffer, pos, MB_FIND_ANY) - : pos; - break; - } -#if defined (HANDLE_MULTIBYTE) - prepos = pos; -#endif - } -#if defined (HANDLE_MULTIBYTE) - while ((dir < 0) ? (pos = _rl_find_prev_mbchar (rl_line_buffer, pos, MB_FIND_ANY)) != prepos - : (pos = _rl_find_next_mbchar (rl_line_buffer, pos, 1, MB_FIND_ANY)) != prepos); -#else - while ((dir < 0) ? pos-- : ++pos < rl_end); -#endif - } - return (0); -} - -/* Search COUNT times for a character read from the current input stream. - FDIR is the direction to search if COUNT is non-negative; otherwise - the search goes in BDIR. So much is dependent on HANDLE_MULTIBYTE - that there are two separate versions of this function. */ -#if defined (HANDLE_MULTIBYTE) -static int -_rl_char_search (count, fdir, bdir) - int count, fdir, bdir; -{ - char mbchar[MB_LEN_MAX]; - int mb_len; - - mb_len = _rl_read_mbchar (mbchar, MB_LEN_MAX); - - if (count < 0) - return (_rl_char_search_internal (-count, bdir, mbchar, mb_len)); - else - return (_rl_char_search_internal (count, fdir, mbchar, mb_len)); -} -#else /* !HANDLE_MULTIBYTE */ -static int -_rl_char_search (count, fdir, bdir) - int count, fdir, bdir; -{ - int c; - - RL_SETSTATE(RL_STATE_MOREINPUT); - c = rl_read_key (); - RL_UNSETSTATE(RL_STATE_MOREINPUT); - - if (count < 0) - return (_rl_char_search_internal (-count, bdir, c)); - else - return (_rl_char_search_internal (count, fdir, c)); -} -#endif /* !HANDLE_MULTIBYTE */ - -int -rl_char_search (count, key) - int count, key; -{ - return (_rl_char_search (count, FFIND, BFIND)); -} - -int -rl_backward_char_search (count, key) - int count, key; -{ - return (_rl_char_search (count, BFIND, FFIND)); -} - -/* **************************************************************** */ -/* */ -/* The Mark and the Region. */ -/* */ -/* **************************************************************** */ - -/* Set the mark at POSITION. */ -int -_rl_set_mark_at_pos (position) - int position; -{ - if (position > rl_end) - return -1; - - rl_mark = position; - return 0; -} - -/* A bindable command to set the mark. */ -int -rl_set_mark (count, key) - int count, key; -{ - return (_rl_set_mark_at_pos (rl_explicit_arg ? count : rl_point)); -} - -/* Exchange the position of mark and point. */ -int -rl_exchange_point_and_mark (count, key) - int count, key; -{ - if (rl_mark > rl_end) - rl_mark = -1; - - if (rl_mark == -1) - { - rl_ding (); - return -1; - } - else - SWAP (rl_point, rl_mark); - - return 0; -} -- 2.34.1