diff -Nrc2 readline-4.1/CHANGELOG readline-4.2/CHANGELOG
*** readline-4.1/CHANGELOG Fri Feb 4 12:30:39 2000
--- readline-4.2/CHANGELOG Fri Apr 6 15:15:12 2001
***************
*** 338,339 ****
--- 338,465 ----
configure.in
- changed LIBVERSION to 4.1-beta5
+
+ 3/17/2000
+ ---------
+ [readline-4.1 released]
+
+ 3/23
+ ----
+ Makefile.in
+ - remove the `-t' argument to ranlib in the install recipe; some
+ ranlibs don't have it and attempt to create a file named `-t'
+
+ 3/27
+ ----
+ support/shlib-install
+ - install shared libraries unwritable by anyone on HP-UX
+ - changed symlinks to relative pathnames on all platforms
+
+ shlib/Makefile.in
+ - added missing `includedir' assignment, substituted by configure
+
+ Makefile.in
+ - added missing @SET_MAKE@ so configure can set $MAKE appropriately
+
+ configure.in
+ - add call to AC_PROG_MAKE_SET
+
+ 8/30
+ ----
+ shlib/Makefile.in
+ - change the soname bound into the shared libraries, so it includes
+ only the major version number. If it includes the minor version,
+ programs depending on it must be rebuilt (which may or may not be
+ a bad thing)
+
+ 9/6
+ ---
+ examples/rlfe.c
+ - add -l option to log input and output (-a option appends to logfile)
+ - add -n option to set readline application name
+ - add -v, -h options for version and help information
+ - change a few things because getopt() is now used to parse arguments
+
+ 9/12
+ ----
+ support/shlib-install
+ - fix up the libname on HPUX 11
+
+ 10/18
+ -----
+ configure.in
+ - changed library version to 4.2-alpha
+
+ 10/30
+ -----
+ configure.in
+ - add -fsigned-char to LOCAL_CFLAGS for Linux running on the IBM
+ S/390
+
+ Makefile.in
+ - added new file, rltypedefs.h, installed by default with `make install'
+
+ 11/2
+ ----
+ compat.c
+ - new file, with backwards-compatibility function definitions
+
+ Makefile.in,shlib/Makefile.in
+ - make sure that compat.o/compat.so are built and linked apppropriately
+
+ support/shobj-conf
+ - picked up bash version, which means that shared libs built on
+ linux and BSD/OS 4.x will have an soname that does not include
+ the minor version number
+
+ 11/13
+ -----
+ examples/rlfe.c
+ - rlfe can perform filename completion for relative pathnames in the
+ inferior process's context if the OS supports /proc/PID/cwd (linux
+ does it OK, Solaris is slightly warped, none of the BSDs have it)
+
+ 11/17/2000
+ ----------
+ [readline-4.2-alpha released]
+
+ 11/27
+ -----
+ Makefile.in,shlib/Makefile.in
+ - added dependencies for rltypedefs.h
+
+ shlib/Makefile.in
+ - changed dependencies on histlib.h to $(topdir)/histlib.h
+
+ 1/22
+ ----
+ configure.in
+ - changed release version to 4.2-beta
+
+ 2/2
+ ---
+ examples/Makefile.in
+ - build histexamp as part of the examples
+
+ 2/5
+ ---
+ doc/Makefile.in
+ - don't remove the dvi, postscript, html, info, and text `objects'
+ on a `make distclean', only on a `make maintainer-clean'
+
+ 3/6
+ ---
+ doc/history.{0,3}, doc/history_3.ps
+ - new manual page for history library
+
+ doc/Makefile.in
+ - rules to install and uninstall history.3 in ${man3dir}
+ - rules to build history.0 and history_3.ps
+
+ 4/2
+ ---
+ configure.in
+ - changed LIBVERSION to `4.2'
+
+ 4/5
+ ---
+ [readline-4.2 frozen]
diff -Nrc2 readline-4.1/CHANGES readline-4.2/CHANGES
*** readline-4.1/CHANGES Wed Sep 22 12:07:50 1999
--- readline-4.2/CHANGES Tue Apr 3 10:34:07 2001
***************
*** 1,2 ****
--- 1,155 ----
+ This document details the changes between this version, readline-4.2,
+ and the previous version, readline-4.1.
+
+ 1. Changes to Readline
+
+ a. When setting the terminal attributes on systems using `struct termio',
+ readline waits for output to drain before changing the attributes.
+
+ b. A fix was made to the history word tokenization code to avoid attempts to
+ dereference a null pointer.
+
+ c. Readline now defaults rl_terminal_name to $TERM if the calling application
+ has left it unset, and tries to initialize with the resultant value.
+
+ d. Instead of calling (*rl_getc_function)() directly to get input in certain
+ places, readline now calls rl_read_key() consistently.
+
+ e. Fixed a bug in the completion code that allowed a backslash to quote a
+ single quote inside a single-quoted string.
+
+ f. rl_prompt is no longer assigned directly from the argument to readline(),
+ but uses memory allocated by readline. This allows constant strings to
+ be passed to readline without problems arising when the prompt processing
+ code wants to modify the string.
+
+ g. Fixed a bug that caused non-interactive history searches to return the
+ wrong line when performing multiple searches backward for the same string.
+
+ h. Many variables, function arguments, and function return values are now
+ declared `const' where appropriate, to improve behavior when linking with
+ C++ code.
+
+ i. The control character detection code now works better on systems where
+ `char' is unsigned by default.
+
+ j. The vi-mode numeric argument is now capped at 999999, just like emacs mode.
+
+ k. The Function, CPFunction, CPPFunction, and VFunction typedefs have been
+ replaced with a set of specific prototyped typedefs, though they are
+ still in the readline header files for backwards compatibility.
+
+ m. Nearly all of the (undocumented) internal global variables in the library
+ now have an _rl_ prefix -- there were a number that did not, like
+ screenheight, screenwidth, alphabetic, etc.
+
+ n. The ding() convenience function has been renamed to rl_ding(), though the
+ old function is still defined for backwards compatibility.
+
+ o. The completion convenience functions filename_completion_function,
+ username_completion_function, and completion_matches now have an rl_
+ prefix, though the old names are still defined for backwards compatibility.
+
+ p. The functions shared by readline and bash (linkage is satisfied from bash
+ when compiling with bash, and internally otherwise) now have an sh_ prefix.
+
+ q. Changed the shared library creation procedure on Linux and BSD/OS 4.x so
+ that the `soname' contains only the major version number rather than the
+ major and minor numbers.
+
+ r. Fixed a redisplay bug that occurred when the prompt spanned more than one
+ physical line and contained invisible characters.
+
+ s. Added a missing `includedir' variable to the Makefile.
+
+ t. When installing the shared libraries, make sure symbolic links are relative.
+
+ u. Added configure test so that it can set `${MAKE}' appropriately.
+
+ v. Fixed a bug in rl_forward that could cause the point to be set to before
+ the beginning of the line in vi mode.
+
+ w. Fixed a bug in the callback read-char interface to make it work when a
+ readline function pushes some input onto the input stream with
+ rl_execute_next (like the incremental search functions).
+
+ x. Fixed a file descriptor leak in the history file manipulation code that
+ was tripped when attempting to truncate a non-regular file (like
+ /dev/null).
+
+ y. Changes to make all of the exported readline functions declared in
+ readline.h have an rl_ prefix (rltty_set_default_bindings is now
+ rl_tty_set_default_bindings, crlf is now rl_crlf, etc.)
+
+ z. The formatted documentation included in the base readline distribution
+ is no longer removed on a `make distclean'.
+
+ aa. Some changes were made to avoid gcc warnings with -Wall.
+
+ bb. rl_get_keymap_by_name now finds keymaps case-insensitively, so
+ `set keymap EMACS' works.
+
+ cc. The history file writing and truncation functions now return a useful
+ status on error.
+
+ dd. Fixed a bug that could cause applications to dereference a NULL pointer
+ if a NULL second argument was passed to history_expand().
+
+ ee. If a hook function assigned to rl_event_hook sets rl_done to a non-zero
+ value, rl_read_key() now immediately returns '\n' (which is assumed to
+ be bound to accept-line).
+
+ 2. New Features in Readline
+
+ a. The blink timeout for paren matching is now settable by applications,
+ via the rl_set_paren_blink_timeout() function.
+
+ b. _rl_executing_macro has been renamed to rl_executing_macro, which means
+ it's now part of the public interface.
+
+ c. Readline has a new variable, rl_readline_state, which is a bitmap that
+ encapsulates the current state of the library; intended for use by
+ callbacks and hook functions.
+
+ d. rlfe has a new -l option to log input and output (-a appends to logfile),
+ a new -n option to set the readline application name, and -v and -h
+ options for version and help information.
+
+ e. rlfe can now perform filename completion for the inferior process if the
+ OS has a /proc/GNU History Library
! Edition 4.1, for
! History Library
Version 4.1.January 2000
Brian Fox, Free Software Foundation
Chet Ramey, Case Western Reserve University
--- 8,13 ----
GNU History Library
! Edition 4.2, for
! History Library
Version 4.2.Apr 2001
Brian Fox, Free Software Foundation
Chet Ramey, Case Western Reserve University
***************
*** 80,84 ****
! Copyright (C) 1988-1999 Free Software Foundation, Inc.
--- 80,84 ----! Copyright (C) 1988-2001 Free Software Foundation, Inc.
*************** *** 360,367 ****! 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.
--- 360,367 ----! 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.
*************** *** 410,416 ****typedef struct _hist_entry { char *line; ! char *data; } HIST_ENTRY;--- 410,418 ----
+ typedef void *histdata_t; + typedef struct _hist_entry { char *line; ! histdata_t data; } HIST_ENTRY;*************** *** 431,440 ****
! /* A structure used to pass the current state of the history stuff around. */ 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; --- 433,444 ----! /* ! * 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; *************** *** 452,456 ****This section describes the calling sequence for the various functions ! present in GNU History.
--- 456,460 ----This section describes the calling sequence for the various functions ! exported by the GNU History library.
*************** *** 486,490 ****
NULL
terminated array of HIST_ENTRY
which is the
current input history. Element 0 of this list is the beginning of time.
If there is no history, return NULL
.
--- 596,602 ----
NULL
terminated array of HIST_ENTRY *
which is the
current input history. Element 0 of this list is the beginning of time.
If there is no history, return NULL
.
***************
*** 602,606 ****
where_history ()
. If there is no entry there, return a NULL
pointer.
where_history()
. If there is no entry there, return a NULL
pointer.
history_base
. If there is no entry there, or if offset
is greater than the history length, return a NULL
pointer.
history_base
(see section History Variables).
! If there is no entry there, or if offset
is greater than the history length, return a NULL
pointer.
NULL
, then read from
! `~/.history'. Returns 0 if successful, or errno if not.
NULL
, then read from `~/.history'.
! Returns 0 if successful, or errno
if not.
NULL
, then read from `~/.history'. Returns 0 if successful,
--- 759,767 ----
NULL
, then read from `~/.history'. Returns 0 if successful,
***************
*** 763,772 ****
NULL
, then write the history list to `~/.history'. Values
! returned are as in read_history ()
.
NULL
, then write the history list to
! `~/.history'.
! Returns 0 on success, or errno
on a read or write error.
NULL
, then append to `~/.history'.
+ Returns 0 on success, or errno
on a read or write error.
NULL
, then `~/.history' is truncated.
+ Returns 0 on success, or errno
on failure.
! These functions implement csh
-like history expansion.
! These functions implement history expansion.
*************** *** 808,812 ****1
--- 822,826 ----
1
***************
*** 830,844 ****
-
()<>;&|$
, and shell quoting conventions are
! obeyed.
!
history_tokenize
.
! This section describes the externally visible variables exported by the GNU History Library. --- 881,885 ----
! This section describes the externally-visible variables exported by the GNU History Library. *************** *** 888,895 ****
stifle_history ()
.
stifle_history()
.
" \t\n()<>;&|"
.
+ +
char *
(string) and an integer index into that string (i).
It should return a non-zero value if the history expansion starting at
string[i] should not be performed; zero if the expansion should
--- 979,987 ----
char *
(string)
! and an int
index into that string (i).
It should return a non-zero value if the history expansion starting at
string[i] should not be performed; zero if the expansion should
***************
*** 963,967 ****
It is intended for use by applications like Bash that use the history
expansion character for additional purposes.
! By default, this variable is set to NULL.
NULL
.
! main () { char line[1024], *t; --- 1003,1012 ----! #include <stdio.h> ! #include <readline/history.h> ! ! main (argc, argv) ! int argc; ! char **argv; { char line[1024], *t; *************** *** 1099,1104 **** h - - m - - n - --- 1130,1133 ---- *************** *** 1125,1133 ****g
! - get_history_event
h
! - history_arg_extract
- history_base
- history_comment_char --- 1154,1162 ----
g
! - get_history_event
h
! !- history_arg_extract
- history_base
- history_comment_char *************** *** 1136,1147 ****
- history_get
- history_get_history_state !
- history_inhibit_expansion_function
- history_is_stifled
- history_length
- history_list !
- history_no_expand_chars !
- history_quotes_inhibit_expansion
- history_search !
- history_search_delimiter_chars
- history_search_pos
- history_search_prefix --- 1165,1177 ----
- history_get
- history_get_history_state !
- history_inhibit_expansion_function
- history_is_stifled
- history_length
- history_list !
- history_max_entries !
- history_no_expand_chars !
- history_quotes_inhibit_expansion
- history_search !
- history_search_delimiter_chars
- history_search_pos
- history_search_prefix *************** *** 1149,1159 ****
- history_set_pos
- history_subst_char !
- history_tokenize
- history_total_bytes
- history_truncate_file !
m
!! - max_input_history
n
--- 1179,1186 ----- history_set_pos
- history_subst_char !
- history_tokenize
- history_total_bytes
- history_truncate_file !
- history_word_delimiters
n
*************** *** 1189,1193 ****! This document was generated on 19 January 2000 using the texi2html translator version 1.52.
--- 1216,1220 ----! This document was generated on 16 April 2001 using the texi2html translator version 1.52.
diff -Nrc2 readline-4.1/doc/history.info readline-4.2/doc/history.info *** readline-4.1/doc/history.info Wed Jan 19 12:17:44 2000 --- readline-4.2/doc/history.info Mon Apr 16 11:05:39 2001 *************** *** 1,4 **** ! This is Info file history.info, produced by Makeinfo version 1.68 from ! the input file /usr/homes/chet/src/bash/readline-src/doc/hist.texinfo. INFO-DIR-SECTION Libraries --- 1,4 ---- ! This is history.info, produced by makeinfo version 4.0 from ! /usr/homes/chet/src/bash/readline-src/doc/hist.texinfo. INFO-DIR-SECTION Libraries *************** *** 11,15 **** previously typed input. ! Copyright (C) 1988-1999 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this --- 11,15 ---- previously typed input. ! Copyright (C) 1988-2001 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this *************** *** 54,58 **** interactively, from a user's standpoint. It should be considered a user's guide. For information on using the GNU History Library in your ! own programs, *note Programming with GNU History::.. * Menu: --- 54,58 ---- interactively, from a user's standpoint. It should be considered a user's guide. For information on using the GNU History Library in your ! own programs, *note Programming with GNU History::. * Menu: *************** *** 239,243 **** the GNU History Library. It should be considered a technical guide. For information on the interactive use of GNU History, *note Using ! History Interactively::.. * Menu: --- 239,243 ---- the GNU History Library. It should be considered a technical guide. For information on the interactive use of GNU History, *note Using ! History Interactively::. * Menu: *************** *** 294,300 **** declared as follows: typedef struct _hist_entry { char *line; ! char *data; } HIST_ENTRY; --- 294,302 ---- declared as follows: + typedef void *histdata_t; + typedef struct _hist_entry { char *line; ! histdata_t data; } HIST_ENTRY; *************** *** 306,315 **** structure: ! /* A structure used to pass the current state of the history stuff around. */ 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; --- 308,319 ---- 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; *************** *** 325,329 **** This section describes the calling sequence for the various functions ! present in GNU History. * Menu: --- 329,333 ---- This section describes the calling sequence for the various functions ! exported by the GNU History library. * Menu: *************** *** 355,363 **** in your program. ! - Function: void using_history () Begin a session in which the history functions might be used. This initializes the interactive variables. ! - Function: HISTORY_STATE * history_get_history_state () Return a structure describing the current state of the input history. --- 359,367 ---- in your program. ! - Function: void using_history (void) Begin a session in which the history functions might be used. This initializes the interactive variables. ! - Function: HISTORY_STATE * history_get_history_state (void) Return a structure describing the current state of the input history. *************** *** 375,379 **** parameters managing the list itself. ! - Function: void add_history (char *string) Place STRING at the end of the history list. The associated data field (if any) is set to `NULL'. --- 379,383 ---- parameters managing the list itself. ! - Function: void add_history (const char *string) Place STRING at the end of the history list. The associated data field (if any) is set to `NULL'. *************** *** 384,394 **** containing structure. ! - Function: HIST_ENTRY * replace_history_entry (int which, char *line, ! char *data) Make the history entry at offset WHICH have LINE and DATA. This returns the old entry so you can dispose of the data. In the case of an invalid WHICH, a `NULL' pointer is returned. ! - Function: void clear_history () Clear the history list by deleting all the entries. --- 388,398 ---- containing structure. ! - Function: HIST_ENTRY * replace_history_entry (int which, const char ! *line, histdata_t data) Make the history entry at offset WHICH have LINE and DATA. This returns the old entry so you can dispose of the data. In the case of an invalid WHICH, a `NULL' pointer is returned. ! - Function: void clear_history (void) Clear the history list by deleting all the entries. *************** *** 396,405 **** Stifle the history list, remembering only the last MAX entries. ! - Function: int unstifle_history () Stop stifling the history. This returns the previous amount the history was stifled. The value is positive if the history was stifled, negative if it wasn't. ! - Function: int history_is_stifled () Returns non-zero if the history is stifled, zero if it is not. --- 400,409 ---- Stifle the history list, remembering only the last MAX entries. ! - Function: int unstifle_history (void) Stop stifling the history. This returns the previous amount the history was stifled. The value is positive if the history was stifled, negative if it wasn't. ! - Function: int history_is_stifled (void) Returns non-zero if the history is stifled, zero if it is not. *************** *** 413,435 **** individual list entries. ! - Function: HIST_ENTRY ** history_list () ! Return a `NULL' terminated array of `HIST_ENTRY' which is the current input history. Element 0 of this list is the beginning of time. If there is no history, return `NULL'. ! - Function: int where_history () Returns the offset of the current history element. ! - Function: HIST_ENTRY * current_history () Return the history entry at the current position, as determined by ! `where_history ()'. If there is no entry there, return a `NULL' pointer. - Function: HIST_ENTRY * history_get (int offset) Return the history entry at position OFFSET, starting from ! `history_base'. If there is no entry there, or if OFFSET is ! greater than the history length, return a `NULL' pointer. ! - Function: int history_total_bytes () Return the number of bytes that the primary history entries are using. This function returns the sum of the lengths of all the --- 417,440 ---- individual list entries. ! - Function: HIST_ENTRY ** history_list (void) ! Return a `NULL' terminated array of `HIST_ENTRY *' which is the current input history. Element 0 of this list is the beginning of time. If there is no history, return `NULL'. ! - Function: int where_history (void) Returns the offset of the current history element. ! - Function: HIST_ENTRY * current_history (void) Return the history entry at the current position, as determined by ! `where_history()'. If there is no entry there, return a `NULL' pointer. - Function: HIST_ENTRY * history_get (int offset) Return the history entry at position OFFSET, starting from ! `history_base' (*note History Variables::). If there is no entry ! there, or if OFFSET is greater than the history length, return a ! `NULL' pointer. ! - Function: 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 *************** *** 446,458 **** - Function: int history_set_pos (int pos) ! Set the position in the history list to POS, an absolute index ! into the list. ! - Function: HIST_ENTRY * previous_history () 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 `NULL' pointer. ! - Function: HIST_ENTRY * next_history () Move the current history offset forward to the next history entry, and return the a pointer to that entry. If there is no next --- 451,464 ---- - Function: int history_set_pos (int pos) ! Set the current history offset to POS, an absolute index into the ! list. Returns 1 on success, 0 if POS is less than zero or greater ! than the number of history entries. ! - Function: 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 `NULL' pointer. ! - Function: 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 *************** *** 471,492 **** history entry. ! - Function: int history_search (char *string, int direction) Search the history for STRING, starting at the current history ! offset. If DIRECTION < 0, then the search is through previous ! entries, else through subsequent. If STRING 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 STRING was ! found. Otherwise, nothing is changed, and a -1 is returned. ! - Function: int history_search_prefix (char *string, int direction) Search the history for STRING, starting at the current history offset. The search is anchored: matching lines must begin with ! STRING. If DIRECTION < 0, then the search is through previous ! entries, else through subsequent. If STRING 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. ! - Function: int history_search_pos (char *string, int direction, int ! pos) Search for STRING in the history list, starting at POS, an absolute index into the list. If DIRECTION is negative, the search --- 477,501 ---- history entry. ! - Function: int history_search (const char *string, int direction) Search the history for STRING, starting at the current history ! offset. If DIRECTION is less than 0, then the search is through ! previous entries, otherwise through subsequent entries. If STRING ! 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 STRING was found. Otherwise, nothing is changed, and ! a -1 is returned. ! - Function: int history_search_prefix (const char *string, int ! direction) Search the history for STRING, starting at the current history offset. The search is anchored: matching lines must begin with ! STRING. If DIRECTION is less than 0, then the search is through ! previous entries, otherwise through subsequent entries. If STRING ! 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. ! - Function: int history_search_pos (const char *string, int direction, ! int pos) Search for STRING in the history list, starting at POS, an absolute index into the list. If DIRECTION is negative, the search *************** *** 504,513 **** This section documents the functions for managing a history file. ! - Function: int read_history (char *filename) ! Add the contents of FILENAME to the history list, a line at a ! time. If FILENAME is `NULL', then read from `~/.history'. ! Returns 0 if successful, or errno if not. ! - Function: int read_history_range (char *filename, int from, int to) Read a range of lines from FILENAME, adding them to the history list. Start reading at line FROM and end at TO. If FROM is zero, --- 513,523 ---- This section documents the functions for managing a history file. ! - Function: int read_history (const char *filename) ! Add the contents of FILENAME to the history list, a line at a time. ! If FILENAME is `NULL', then read from `~/.history'. Returns 0 if ! successful, or `errno' if not. ! - Function: int read_history_range (const char *filename, int from, ! int to) Read a range of lines from FILENAME, adding them to the history list. Start reading at line FROM and end at TO. If FROM is zero, *************** *** 516,530 **** `~/.history'. Returns 0 if successful, or `errno' if not. ! - Function: int write_history (char *filename) Write the current history to FILENAME, overwriting FILENAME if necessary. If FILENAME is `NULL', then write the history list to ! `~/.history'. Values returned are as in `read_history ()'. ! - Function: int append_history (int nelements, char *filename) ! Append the last NELEMENTS of the history list to FILENAME. ! - Function: int history_truncate_file (char *filename, int nlines) Truncate the history file FILENAME, leaving only the last NLINES ! lines. --- 526,545 ---- `~/.history'. Returns 0 if successful, or `errno' if not. ! - Function: int write_history (const char *filename) Write the current history to FILENAME, overwriting FILENAME if necessary. If FILENAME is `NULL', then write the history list to ! `~/.history'. Returns 0 on success, or `errno' on a read or write ! error. ! - Function: int append_history (int nelements, const char *filename) ! Append the last NELEMENTS of the history list to FILENAME. If ! FILENAME is `NULL', then append to `~/.history'. Returns 0 on ! success, or `errno' on a read or write error. ! - Function: int history_truncate_file (const char *filename, int ! nlines) Truncate the history file FILENAME, leaving only the last NLINES ! lines. If FILENAME is `NULL', then `~/.history' is truncated. ! Returns 0 on success, or `errno' on failure. *************** *** 534,546 **** ----------------- ! These functions implement `csh'-like history expansion. - Function: int history_expand (char *string, char **output) Expand STRING, placing the result into OUTPUT, a pointer to a ! string (*note History Interaction::.). Returns: `0' If no expansions took place (or, if the only change in the ! text was the de-slashifying of the history expansion ! character); `1' --- 549,561 ---- ----------------- ! These functions implement history expansion. - Function: int history_expand (char *string, char **output) Expand STRING, placing the result into OUTPUT, a pointer to a ! string (*note History Interaction::). 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' *************** *** 552,567 **** `2' if the returned line should be displayed, but not executed, ! as with the `:p' modifier (*note Modifiers::.). If an error ocurred in expansion, then OUTPUT contains a descriptive error message. ! - Function: char * history_arg_extract (int first, int last, char ! *string) ! Extract a string segment consisting of the FIRST through LAST ! arguments present in STRING. Arguments are broken up as in Bash. ! ! - Function: char * get_history_event (char *string, int *cindex, int ! qchar) Returns the text of the history event beginning at STRING + *CINDEX. *CINDEX is modified to point to after the event --- 567,577 ---- `2' if the returned line should be displayed, but not executed, ! as with the `:p' modifier (*note Modifiers::). If an error ocurred in expansion, then OUTPUT contains a descriptive error message. ! - Function: char * get_history_event (const char *string, int *cindex, ! int qchar) Returns the text of the history event beginning at STRING + *CINDEX. *CINDEX is modified to point to after the event *************** *** 571,578 **** addition to the "normal" terminating characters. ! - Function: char ** history_tokenize (char *string) Return an array of tokens parsed out of STRING, much as the shell ! might. The tokens are split on white space and on the characters ! `()<>;&|$', and shell quoting conventions are obeyed. --- 581,595 ---- addition to the "normal" terminating characters. ! - Function: char ** history_tokenize (const char *string) Return an array of tokens parsed out of STRING, much as the shell ! might. The tokens are split on the characters in the ! HISTORY_WORD_DELIMITERS variable, and shell quoting conventions ! are obeyed. ! ! - Function: char * history_arg_extract (int first, int last, const ! char *string) ! Extract a string segment consisting of the FIRST through LAST ! arguments present in STRING. Arguments are split using ! `history_tokenize'. *************** *** 582,586 **** ================= ! This section describes the externally visible variables exported by the GNU History Library. --- 599,603 ---- ================= ! This section describes the externally-visible variables exported by the GNU History Library. *************** *** 591,600 **** The number of entries currently stored in the history list. ! - Variable: int max_input_history The maximum number of history entries. This must be changed using ! `stifle_history ()'. - Variable: char history_expansion_char ! The character that starts a history event. The default is `!'. - Variable: char history_subst_char --- 608,618 ---- The number of entries currently stored in the history list. ! - Variable: int history_max_entries The maximum number of history entries. This must be changed using ! `stifle_history()'. - Variable: char history_expansion_char ! The character that introduces a history event. The default is `!'. ! Setting this to 0 inhibits history expansion. - Variable: char history_subst_char *************** *** 608,619 **** remainder of the line. This is disabled by default. - Variable: char * history_no_expand_chars The list of characters which inhibit history expansion if found immediately following HISTORY_EXPANSION_CHAR. The default is ! whitespace and `='. - Variable: char * history_search_delimiter_chars The list of additional characters which can delimit a history ! search string, in addition to whitespace, `:' and `?' in the case of a substring search. The default is empty. --- 626,641 ---- remainder of the line. This is disabled by default. + - Variable: char * history_word_delimiters + The characters that separate tokens for \fBhistory_tokenize()\fP. + The default value is `" \t\n()<>;&|"'. + - Variable: char * history_no_expand_chars The list of characters which inhibit history expansion if found immediately following HISTORY_EXPANSION_CHAR. The default is ! space, tab, newline, carriage return, and `='. - Variable: char * history_search_delimiter_chars The list of additional characters which can delimit a history ! search string, in addition to space, TAB, `:' and `?' in the case of a substring search. The default is empty. *************** *** 622,633 **** expansion character. The default value is 0. ! - Variable: Function * history_inhibit_expansion_function This should be set to the address of a function that takes two ! arguments: a `char *' (STRING) and an integer index into that ! string (I). It should return a non-zero value if the history ! expansion starting at STRING[I] should not be performed; zero if ! the expansion should be done. It is intended for use by ! applications like Bash that use the history expansion character ! for additional purposes. By default, this variable is set to NULL. --- 644,655 ---- expansion character. The default value is 0. ! - Variable: rl_linebuf_func_t * history_inhibit_expansion_function This should be set to the address of a function that takes two ! arguments: a `char *' (STRING) and an `int' index into that string ! (I). It should return a non-zero value if the history expansion ! starting at STRING[I] should not be performed; zero if the ! expansion should be done. It is intended for use by applications ! like Bash that use the history expansion character for additional ! purposes. By default, this variable is set to `NULL'. *************** *** 640,644 **** Library. ! main () { char line[1024], *t; --- 662,671 ---- Library. ! #include! #include ! ! main (argc, argv) ! int argc; ! char **argv; { char line[1024], *t; *************** *** 759,762 **** --- 786,790 ---- * history_length: History Variables. * history_list: Information About the History List. + * history_max_entries: History Variables. * history_no_expand_chars: History Variables. * history_quotes_inhibit_expansion: History Variables. *************** *** 771,775 **** * history_total_bytes: Information About the History List. * history_truncate_file: Managing the History File. ! * max_input_history: History Variables. * next_history: Moving Around the History List. * previous_history: Moving Around the History List. --- 799,803 ---- * history_total_bytes: Information About the History List. * history_truncate_file: Managing the History File. ! * history_word_delimiters: History Variables. * next_history: Moving Around the History List. * previous_history: Moving Around the History List. *************** *** 787,811 **** Tag Table: ! Node: Top1162 ! Node: Using History Interactively1742 ! Node: History Interaction2250 ! Node: Event Designators3669 ! Node: Word Designators4596 ! Node: Modifiers6225 ! Node: Programming with GNU History7363 ! Node: Introduction to History8089 ! Node: History Storage9774 ! Node: History Functions10867 ! Node: Initializing History and State Management11838 ! Node: History List Management12630 ! Node: Information About the History List14151 ! Node: Moving Around the History List15457 ! Node: Searching the History List16342 ! Node: Managing the History File18174 ! Node: History Expansion19680 ! Node: History Variables21519 ! Node: History Programming Example23837 ! Node: Concept Index26441 ! Node: Function and Variable Index26927 End Tag Table --- 815,839 ---- Tag Table: ! Node: Top1136 ! Node: Using History Interactively1716 ! Node: History Interaction2223 ! Node: Event Designators3642 ! Node: Word Designators4569 ! Node: Modifiers6198 ! Node: Programming with GNU History7336 ! Node: Introduction to History8061 ! Node: History Storage9746 ! Node: History Functions10857 ! Node: Initializing History and State Management11841 ! Node: History List Management12641 ! Node: Information About the History List14191 ! Node: Moving Around the History List15547 ! Node: Searching the History List16536 ! Node: Managing the History File18454 ! Node: History Expansion20260 ! Node: History Variables22155 ! Node: History Programming Example24725 ! Node: Concept Index27447 ! Node: Function and Variable Index27933 End Tag Table diff -Nrc2 readline-4.1/doc/history.ps readline-4.2/doc/history.ps *** readline-4.1/doc/history.ps Wed Jan 19 12:18:06 2000 --- readline-4.2/doc/history.ps Mon Apr 16 11:05:46 2001 *************** *** 1,4 **** %!PS-Adobe-2.0 ! %%Creator: dvips(k) 5.82 Copyright 1998 Radical Eye Software %%Title: history.dvi %%Pages: 20 --- 1,4 ---- %!PS-Adobe-2.0 ! %%Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software %%Title: history.dvi %%Pages: 20 *************** *** 9,13 **** %DVIPSCommandLine: dvips -D 300 -t letter -o history.ps history.dvi %DVIPSParameters: dpi=300, compressed ! %DVIPSSource: TeX output 2000.01.19:1217 %%BeginProcSet: texc.pro %! --- 9,13 ---- %DVIPSCommandLine: dvips -D 300 -t letter -o history.ps history.dvi %DVIPSParameters: dpi=300, compressed ! %DVIPSSource: TeX output 2001.04.16:1105 %%BeginProcSet: texc.pro %! *************** *** 21,27 **** exch round exch]setmatrix}N/@landscape{/isls true N}B/@manualfeed{ statusdict/manualfeed true put}B/@copies{/#copies X}B/FMat[1 0 0 -1 0 0] ! N/FBB[0 0 0 0]N/nn 0 N/IE 0 N/ctr 0 N/df-tail{/nn 8 dict N nn begin /FontType 3 N/FontMatrix fntrx N/FontBBox FBB N string/base X array ! /BitMaps X/BuildChar{CharBuilder}N/Encoding IE N end A{/foo setfont}2 array copy cvx N load 0 nn put/ctr 0 N[}B/sf 0 N/df{/sf 1 N/fntrx FMat N df-tail}B/dfs{div/sf X/fntrx[sf 0 0 sf neg 0 0]N df-tail}B/E{pop nn A --- 21,27 ---- exch round exch]setmatrix}N/@landscape{/isls true N}B/@manualfeed{ statusdict/manualfeed true put}B/@copies{/#copies X}B/FMat[1 0 0 -1 0 0] ! N/FBB[0 0 0 0]N/nn 0 N/IEn 0 N/ctr 0 N/df-tail{/nn 8 dict N nn begin /FontType 3 N/FontMatrix fntrx N/FontBBox FBB N string/base X array ! /BitMaps X/BuildChar{CharBuilder}N/Encoding IEn N end A{/foo setfont}2 array copy cvx N load 0 nn put/ctr 0 N[}B/sf 0 N/df{/sf 1 N/fntrx FMat N df-tail}B/dfs{div/sf X/fntrx[sf 0 0 sf neg 0 0]N df-tail}B/E{pop nn A *************** *** 51,55 **** SI restore userdict/eop-hook known{eop-hook}if showpage}N/@start{ userdict/start-hook known{start-hook}if pop/VResolution X/Resolution X ! 1000 div/DVImag X/IE 256 array N 2 string 0 1 255{IE S A 360 add 36 4 index cvrs cvn put}for pop 65781.76 div/vsize X 65781.76 div/hsize X}N /p{show}N/RMat[1 0 0 -1 0 0]N/BDot 260 string N/Rx 0 N/Ry 0 N/V{}B/RV/v{ --- 51,55 ---- SI restore userdict/eop-hook known{eop-hook}if showpage}N/@start{ userdict/start-hook known{start-hook}if pop/VResolution X/Resolution X ! 1000 div/DVImag X/IEn 256 array N 2 string 0 1 255{IEn S A 360 add 36 4 index cvrs cvn put}for pop 65781.76 div/vsize X 65781.76 div/hsize X}N /p{show}N/RMat[1 0 0 -1 0 0]N/BDot 260 string N/Rx 0 N/Ry 0 N/V{}B/RV/v{ *************** *** 108,113 **** 70B5FCA210107F8F14>I E %EndDVIPSBitmapFont ! %DVIPSBitmapFont: Fd cmsl9 9 1 ! /Fd 1 47 df<1270A212F0126004047D830B>46 D E %EndDVIPSBitmapFont %DVIPSBitmapFont: Fe cmr9 9 24 --- 108,113 ---- 70B5FCA210107F8F14>I E %EndDVIPSBitmapFont ! %DVIPSBitmapFont: Fd cmti9 9 1 ! /Fd 1 47 df<1230127812F0126005047C830C>46 D E %EndDVIPSBitmapFont %DVIPSBitmapFont: Fe cmr9 9 24 *************** *** 195,208 **** 00E0EA7E03B5FCA214167E9519>I E %EndDVIPSBitmapFont ! %DVIPSBitmapFont: Fh cmtt10 12 24 ! /Fh 24 119 df<13E0A538F0E1E0EAFCE7387EEFC0381FFF00EA07FCEA01F0EA07FCEA1F FF387EEFC038FCE7E0EAF0E13800E000A513157D991A>42 D<1338137CA2136C13EEA313 C6A2EA01C7A438038380A4380701C0A213FFA24813E0EA0E00A4481370387F01FC38FF83 FE387F01FC171E7F9D1A>65 D 69 D<387FFFFCB5FC7E380E001CA51400A2EB03 ! 80A3EA0FFFA3EA0E03A390C7FCA8EA7FE012FF127F161E7F9D1A>I<38FF83FEA3381C00 ! 70AA381FFFF0A3381C0070AB38FF83FEA3171E7F9D1A>72 D I<38FE03FE12FFA2381D8070A213C0121CA213E0A213601370A213 ! 301338A21318131CA2130C130EA21306A213071303A238FF81F0A21380171E7F9D1A>78 D I I E %EndDVIPSBitmapFont ! %DVIPSBitmapFont: Fh cmtt10 12 27 ! /Fh 27 119 df<13E0A538F0E1E0EAFCE7387EEFC0381FFF00EA07FCEA01F0EA07FCEA1F FF387EEFC038FCE7E0EAF0E13800E000A513157D991A>42 D<1338137CA2136C13EEA313 C6A2EA01C7A438038380A4380701C0A213FFA24813E0EA0E00A4481370387F01FC38FF83 FE387F01FC171E7F9D1A>65 D 69 D<38FF83FEA3381C0070AA381FFFF0A3381C ! 0070AB38FF83FEA3171E7F9D1A>72 D ! I<38FE03FE12FFA2381D8070A213C0121CA213E0A213601370A213301338A21318131CA2 ! 130C130EA21306A213071303A238FF81F0A21380171E7F9D1A>78 D I 95 D 97 D 99 ! D I<12FEA3120EA6133EEBFF80000F ! 13C013C1EB80E01300120EAC38FFE3FE13E713E3171E7F9D1A>104 ! D I< ! EAFE3EEBFF80B512C0EA0FC1EB80E01300120EAC38FFE3FE13E713E317157F941A>110 ! D I<387F81F838FF8FFC38 ! 7F9FFE3803FE1EEBF80CEBE000A25B5BAAEA7FFFB5FC7E17157F941A>114 D<487E1203A6387FFFE0B5FCA238038000AA1470A43801C1E013FF6C1380EB3F00141C7F 9B1A>116 D<38FE0FE0A3EA0E00AD1301EA0F033807FFFE7EEA00FC17157F941A>I<387F --- 214,232 ---- D<387FFFC0B512E0A26C13C013047D7E1A>95 D 97 D<12FEA3120EA6133EEBFF80000F13E0EBC1F0EB8070EB0038120E14 ! 1CA7000F13381478EB80F0EBC1E0EBFFC0000E138038063E00161E7F9D1A>I I I I I<12FEA3120EA6133EEBFF80000F13C013C1EB80E01300120EAC38FFE3 ! FE13E713E3171E7F9D1A>104 D I 108 ! D ! 110 D I<387F81F838FF8F ! FC387F9FFE3803FE1EEBF80CEBE000A25B5BAAEA7FFFB5FC7E17157F941A>114 D<487E1203A6387FFFE0B5FCA238038000AA1470A43801C1E013FF6C1380EB3F00141C7F 9B1A>116 D<38FE0FE0A3EA0E00AD1301EA0F033807FFFE7EEA00FC17157F941A>I<387F *************** *** 326,330 **** D<1438EB01F8EB00781438A21470A614E013FCEA0382EA0601121CEA3C00383801C01278 12F0A438E00380A412F0EA700738380F00381C37803807C7E015207D9F19>I<13F8EA07 ! 0EEA0E07121C383803801278127012F0A2B5FC00F0C7FC5AA46C5AEA7002EA3004EA1C18 EA07E011147D9314>I I<140EEB3E11EBE1A33801C1C238 --- 330,334 ---- D<1438EB01F8EB00781438A21470A614E013FCEA0382EA0601121CEA3C00383801C01278 12F0A438E00380A412F0EA700738380F00381C37803807C7E015207D9F19>I<13F8EA07 ! 0EEA0E07381C038012381278127012F0B5FC00F0C7FCA25AA46C5AEA7002EA3004EA1C18 EA07E011147D9314>I I<140EEB3E11EBE1A33801C1C238 *************** *** 357,362 **** 191D809318>I E %EndDVIPSBitmapFont ! %DVIPSBitmapFont: Fk cmbx12 17.28 36 ! /Fk 36 122 df 49 D I E %EndDVIPSBitmapFont ! %DVIPSBitmapFont: Fk cmcsc10 10.95 3 ! /Fk 3 118 df 103 ! D<38FC01FC381E007014201217EA1380A2EA11C0EA10E0A213701338A2131C130E1307A2 ! EB03A0EB01E0A213001460123800FE132016177E961C>110 D<38FF81FC381C00701420 ! B0000C1340120E6C138038018300EA007C16177E961C>117 D E ! %EndDVIPSBitmapFont ! %DVIPSBitmapFont: Fl cmbx12 17.28 36 ! /Fl 36 122 df 49 D I E %EndDVIPSBitmapFont ! %DVIPSBitmapFont: Fl cmsy10 10.95 1 ! /Fl 1 14 df<14FF010713E090381F00F80178131E01E01307D80180EB018048C812C000 ! 061560481530A248151848150CA2481506A4481503A900601506A46C150CA26C15186C15 ! 30A26C15606C15C06C6CEB0180D800E0EB07000178131E011F13F8903807FFE0010090C7 ! FC282B7EA02D>13 D E %EndDVIPSBitmapFont ! %DVIPSBitmapFont: Fm cmbx12 14.4 45 ! /Fm 45 122 df<123C127FEAFF80A213C0A3127F123E1200A2EA0180A3EA0300A2120612 0E5A5A12100A157B8813>44 D<121C127FA2EAFF80A3EA7F00A2121C09097B8813>46 D<130E131E137EEA07FE12FFA212F81200B3ABB512FEA317277BA622>49 --- 456,467 ---- 1EEA787CEA3FF0EA0FC0262E7E9F2B>I E %EndDVIPSBitmapFont ! %DVIPSBitmapFont: Fm cmsy10 10.95 1 ! /Fm 1 14 df<14FE903807FFC090381F01F0903878003C01E0130ED80180130348C7EA01 ! 800006EC00C0481560A2481530481518A248150CA4481506A90060150CA46C1518A26C15 ! 306C1560A26C15C06CEC01806C6CEB0300D800E0130E0178133C90381F01F0903807FFC0 ! D900FEC7FC272B7DA02E>13 D E %EndDVIPSBitmapFont ! %DVIPSBitmapFont: Fn cmbx12 14.4 44 ! /Fn 44 122 df<123C127FEAFF80A213C0A3127F123E1200A2EA0180A3EA0300A2120612 0E5A5A12100A157B8813>44 D<121C127FA2EAFF80A3EA7F00A2121C09097B8813>46 D<130E131E137EEA07FE12FFA212F81200B3ABB512FEA317277BA622>49 *************** *** 482,554 **** B45B90387FF007011FB5129F0107EBFE0F9039007FF0032D297CA835>I I I 77 ! D I 80 ! D 82 D<9038FF80600003EBF0E0000F13F8381F80FD383F ! 001F003E1307481303A200FC1301A214007EA26C140013C0EA7FFCEBFFE06C13F86C13FE ! 80000714806C14C0C6FC010F13E0EB007FEC1FF0140F140700E01303A46C14E0A26C1307 ! 6C14C0B4EB0F80EBE03F39E3FFFE0000E15B38C01FF01C297CA825>I 85 D I I<3803FF80000F13F0381F01FC383F80 ! FE147F801580EA1F00C7FCA4EB3FFF3801FC3FEA0FE0EA1F80EA3F00127E5AA4145F007E ! 13DF393F839FFC381FFE0F3803FC031E1B7E9A21>97 D I I I I< ! EB07F8EB3FFCEB7E3E3801FC7FEA03F813F01207143E1400A7B512C0A33807F000B3A338 ! 7FFF80A3182A7EA915>I<9038FF80F00003EBE3F8390FC1FE1C391F007C7C48137E003E ! EB3E10007EEB3F00A6003E133E003F137E6C137C380FC1F8380BFFE00018138090C8FC12 ! 38A2123C383FFFF814FF6C14C06C14E06C14F0121F383C0007007CEB01F8481300A4007C ! EB01F0A2003FEB07E0390FC01F806CB5120038007FF01E287E9A22>I I<1207EA0F80EA1FC0EA3FE0A3EA1FC0EA0F80EA0700C7FCA7EAFFE0A3120F ! B3A3EAFFFEA30F2B7EAA12>I 108 ! D<26FFC07FEB1FC0903AC1FFC07FF0903AC307E0C1F8D80FC49038F101FC9039C803F200 ! 01D801FE7F01D05BA201E05BB03CFFFE3FFF8FFFE0A3331B7D9A38>I<38FFC07E9038C1 ! FF809038C30FC0D80FC413E0EBC80701D813F013D0A213E0B039FFFE3FFFA3201B7D9A25 ! >I I<38FFE1FE9038EFFF809038FE0FE0390FF803F09038F001F801E013FC ! 140015FEA2157FA8157E15FEA215FC140101F013F89038F807F09038FC0FE09038EFFF80 ! 9038E1FC0001E0C7FCA9EAFFFEA320277E9A25>I<38FFC1F0EBC7FCEBC63E380FCC7F13 ! D813D0A2EBF03EEBE000B0B5FCA3181B7F9A1B>114 D<3803FE30380FFFF0EA3E03EA78 ! 00127000F01370A27E00FE1300EAFFE06CB4FC14C06C13E06C13F0000713F8C6FCEB07FC ! 130000E0137C143C7E14387E6C137038FF01E038E7FFC000C11300161B7E9A1B>I<13E0 ! A41201A31203A21207120F381FFFE0B5FCA2380FE000AD1470A73807F0E0000313C03801 ! FF8038007F0014267FA51A>I<39FFE07FF0A3000F1307B2140FA2000713173903F067FF ! 3801FFC738007F87201B7D9A25>I<39FFFC03FFA3390FF000F0000714E07F0003EB01C0 ! A2EBFC0300011480EBFE070000140013FFEB7F0EA2149EEB3F9C14FC6D5AA26D5AA36D5A ! A26D5AA2201B7F9A23>I<3BFFFC7FFC1FFCA33B0FE00FE001C02607F007EB0380A201F8 ! EBF00700031600EC0FF801FC5C0001150EEC1FFC2600FE1C5B15FE9039FF387E3C017F14 ! 38EC787F6D486C5A16F0ECE01F011F5CA26D486C5AA2EC800701075CA22E1B7F9A31>I< ! 39FFFC1FFEA33907F003803803F8079038FC0F003801FE1E00005BEB7F3814F86D5A6D5A ! 130F806D7E130F497EEB3CFEEB38FFEB787F9038F03F803901E01FC0D803C013E0EB800F ! 39FFF03FFFA3201B7F9A23>I<39FFFC03FFA3390FF000F0000714E07F0003EB01C0A2EB ! FC0300011480EBFE070000140013FFEB7F0EA2149EEB3F9C14FC6D5AA26D5AA36D5AA26D ! 5AA25CA21307003890C7FCEA7C0FEAFE0E131E131C5BEA74F0EA3FE0EA0F8020277F9A23 ! >I E %EndDVIPSBitmapFont ! %DVIPSBitmapFont: Fn cmtt10 10.95 75 ! /Fn 75 127 df<127012F8B012701200A5127012F8A31270051C779B18>33 D I --- 493,561 ---- B45B90387FF007011FB5129F0107EBFE0F9039007FF0032D297CA835>I I I 78 D 80 D 82 D<9038FF80600003EBF0E0 ! 000F13F8381F80FD383F001F003E1307481303A200FC1301A214007EA26C140013C0EA7F ! FCEBFFE06C13F86C13FE80000714806C14C0C6FC010F13E0EB007FEC1FF0140F140700E0 ! 1303A46C14E0A26C13076C14C0B4EB0F80EBE03F39E3FFFE0000E15B38C01FF01C297CA8 ! 25>I 85 ! D I I<3803FF80000F13F0381F01FC383F80FE147F801580EA1F00C7FCA4EB3FFF3801 ! FC3FEA0FE0EA1F80EA3F00127E5AA4145F007E13DF393F839FFC381FFE0F3803FC031E1B ! 7E9A21>97 D I I I I I<9038FF80F000 ! 03EBE3F8390FC1FE1C391F007C7C48137E003EEB3E10007EEB3F00A6003E133E003F137E ! 6C137C380FC1F8380BFFE00018138090C8FC1238A2123C383FFFF814FF6C14C06C14E06C ! 14F0121F383C0007007CEB01F8481300A4007CEB01F0A2003FEB07E0390FC01F806CB512 ! 0038007FF01E287E9A22>I I<1207EA0F80EA1FC0EA3FE0 ! A3EA1FC0EA0F80EA0700C7FCA7EAFFE0A3120FB3A3EAFFFEA30F2B7EAA12>I 108 D<26FFC07FEB1FC0903AC1FFC07FF0903AC307E0 ! C1F8D80FC49038F101FC9039C803F20001D801FE7F01D05BA201E05BB03CFFFE3FFF8FFF ! E0A3331B7D9A38>I<38FFC07E9038C1FF809038C30FC0D80FC413E0EBC80701D813F013 ! D0A213E0B039FFFE3FFFA3201B7D9A25>I I<38FFE1FE9038EFFF809038FE ! 0FE0390FF803F09038F001F801E013FC140015FEA2157FA8157E15FEA215FC140101F013 ! F89038F807F09038FC0FE09038EFFF809038E1FC0001E0C7FCA9EAFFFEA320277E9A25> ! I<38FFC1F0EBC7FCEBC63E380FCC7F13D813D0A2EBF03EEBE000B0B5FCA3181B7F9A1B> ! 114 D<3803FE30380FFFF0EA3E03EA7800127000F01370A27E00FE1300EAFFE06CB4FC14 ! C06C13E06C13F0000713F8C6FCEB07FC130000E0137C143C7E14387E6C137038FF01E038 ! E7FFC000C11300161B7E9A1B>I<13E0A41201A31203A21207120F381FFFE0B5FCA2380F ! E000AD1470A73807F0E0000313C03801FF8038007F0014267FA51A>I<39FFE07FF0A300 ! 0F1307B2140FA2000713173903F067FF3801FFC738007F87201B7D9A25>I<39FFFC03FF ! A3390FF000F0000714E07F0003EB01C0A2EBFC0300011480EBFE070000140013FFEB7F0E ! A2149EEB3F9C14FC6D5AA26D5AA36D5AA26D5AA2201B7F9A23>I<3BFFFC7FFC1FFCA33B ! 0FE00FE001C02607F007EB0380A201F8EBF00700031600EC0FF801FC5C0001150EEC1FFC ! 2600FE1C5B15FE9039FF387E3C017F1438EC787F6D486C5A16F0ECE01F011F5CA26D486C ! 5AA2EC800701075CA22E1B7F9A31>I<39FFFC1FFEA33907F003803803F8079038FC0F00 ! 3801FE1E00005BEB7F3814F86D5A6D5A130F806D7E130F497EEB3CFEEB38FFEB787F9038 ! F03F803901E01FC0D803C013E0EB800F39FFF03FFFA3201B7F9A23>I<39FFFC03FFA339 ! 0FF000F0000714E07F0003EB01C0A2EBFC0300011480EBFE070000140013FFEB7F0EA214 ! 9EEB3F9C14FC6D5AA26D5AA36D5AA26D5AA25CA21307003890C7FCEA7C0FEAFE0E131E13 ! 1C5BEA74F0EA3FE0EA0F8020277F9A23>I E %EndDVIPSBitmapFont ! %DVIPSBitmapFont: Fo cmtt10 10.95 76 ! /Fo 76 127 df<127012F8B012701200A5127012F8A31270051C779B18>33 D I *************** *** 590,595 **** D 68 D I I<387F07F038FF 8FF8387F07F0381C01C0A9EA1FFFA3EA1C01AA387F07F038FF8FF8387F07F0151C7F9B18 >72 D I 68 D I I<387F07F038FF 8FF8387F07F0381C01C0A9EA1FFFA3EA1C01AA387F07F038FF8FF8387F07F0151C7F9B18 >72 D I I I 108 D<38F9C1C038FFF7F013FF383E3E ! 38EA3C3CA2EA3838AB38FE3E3EEB7E7EEB3E3E1714809318>I I I I<3801F380EA07FBEA1FFFEA3E1FEA380FEA7007A2EAE003A6EA7007A2 ! EA380FEA3C1FEA1FFFEA0FFBEA03E3EA0003A7EB1FF0EB3FF8EB1FF0151E7E9318>I<38 ! FF0FC0EB3FE0EB7FF0EA07F0EBE060EBC0005BA290C7FCA9EAFFFC7F5B14147E9318>I< ! EA07F7EA3FFF5AEA780FEAE007A3007CC7FCEA7FE0EA1FFCEA03FEEA001F38600780EAE0 ! 03A212F038F80F00B5FC13FCEAE7F011147D9318>I<487E1203A4387FFFC0B5FCA23803 ! 8000A9144014E0A33801C1C013FF6C1380EB3E0013197F9818>I<387E07E0EAFE0FEA7E ! 07EA0E00AC1301EA0F033807FFFC6C13FE3801FCFC1714809318>I<387F8FF000FF13F8 ! 007F13F0381C01C0380E0380A338070700A3138FEA038EA3EA01DCA3EA00F8A213701514 ! 7F9318>I<38FF07F8138F1307383800E0A4381C01C0137113F9A213D9EA1DDD000D1380 ! A3138DEA0F8FA23807070015147F9318>I<387F8FF0139F138F380F0700EA078EEA039E ! EA01DC13F81200137013F07FEA01DCEA039E138EEA0707000E1380387F8FF000FF13F800 ! 7F13F015147F9318>I<387F8FF000FF13F8007F13F0380E01C0EB0380A21207EB0700A2 ! EA0387A2138EEA01CEA213CC120013DC1378A31370A313F05B1279EA7BC0EA7F806CC7FC ! 121E151E7F9318>I<383FFFF05AA2387001E0EB03C0EB078038000F00131E5B13F8485A ! EA03C0485A380F0070121E5A5AB512F0A314147F9318>I I<126012 ! F0B3B012600424769F18>I<127CB4FC13C01203C67EAB7FEB7FC0EB3FE0A2EB7FC0EBF0 ! 005BABEA03C012FF90C7FC127C13247E9F18>I I E %EndDVIPSBitmapFont ! %DVIPSBitmapFont: Fo cmr10 10.95 75 ! /Fo 75 123 df<90381F83E09038F06E303901C07878380380F8903800F03048EB7000A7 B612803907007000B2383FE3FF1D20809F1B>11 D<133FEBE0C0EA01C0380381E0EA0701 A290C7FCA6B512E0EA0700B2383FC3FC1620809F19>I I I<127E12FE127E120EA5EB3FF0A3EB0780EB0F00131E5B5B5BEA0FF87F139C130EEA ! 0E0F7FEB038014C0387FC7F812FF127F151C7F9B18>107 D I<38F9C1C038FFF7F013FF383E3E38EA3C3CA2EA3838AB38FE3E3EEB7E ! 7EEB3E3E1714809318>I I I I<3801F380EA07FB ! EA1FFFEA3E1FEA380FEA7007A2EAE003A6EA7007A2EA380FEA3C1FEA1FFFEA0FFBEA03E3 ! EA0003A7EB1FF0EB3FF8EB1FF0151E7E9318>I<38FF0FC0EB3FE0EB7FF0EA07F0EBE060 ! EBC0005BA290C7FCA9EAFFFC7F5B14147E9318>I I<487E1203A4387FFFC0B5FCA238038000A9144014E0A33801C1C013FF6C ! 1380EB3E0013197F9818>I<387E07E0EAFE0FEA7E07EA0E00AC1301EA0F033807FFFC6C ! 13FE3801FCFC1714809318>I<387F8FF000FF13F8007F13F0381C01C0380E0380A33807 ! 0700A3138FEA038EA3EA01DCA3EA00F8A2137015147F9318>I<38FF07F8138F13073838 ! 00E0A4381C01C0137113F9A213D9EA1DDD000D1380A3138DEA0F8FA23807070015147F93 ! 18>I<387F8FF0139F138F380F0700EA078EEA039EEA01DC13F81200137013F07FEA01DC ! EA039E138EEA0707000E1380387F8FF000FF13F8007F13F015147F9318>I<387F8FF000 ! FF13F8007F13F0380E01C0EB0380A21207EB0700A2EA0387A2138EEA01CEA213CC120013 ! DC1378A31370A313F05B1279EA7BC0EA7F806CC7FC121E151E7F9318>I<383FFFF05AA2 ! 387001E0EB03C0EB078038000F00131E5B13F8485AEA03C0485A380F0070121E5A5AB512 ! F0A314147F9318>I I<126012F0B3B012600424769F18>I<127CB4FC ! 13C01203C67EAB7FEB7FC0EB3FE0A2EB7FC0EBF0005BABEA03C012FF90C7FC127C13247E ! 9F18>I I ! E %EndDVIPSBitmapFont ! %DVIPSBitmapFont: Fp cmr10 10.95 74 ! /Fp 74 123 df<90381F83E09038F06E303901C07878380380F8903800F03048EB7000A7 B612803907007000B2383FE3FF1D20809F1B>11 D<133FEBE0C0EA01C0380381E0EA0701 A290C7FCA6B512E0EA0700B2383FC3FC1620809F19>I I<127012F8A3127005057C840D>I 48 D<13801203120F12F31203B3A6EA07C0EAFFFE0F1E7C9D17>I I I<127012F8A3127005057C840D>I 48 D<13801203120F12F31203B3A6EA07C0EA7FFE0F1E7C9D17>I I I I<90380FE01090 ! 38381C309038E002703803C00139078000F048C71270121E15305A1510127C127800F814 ! 00A7EC3FFEEC01F000781300127C123CA27EA27E6C7E3903C001703900E002309038380C ! 1090380FF0001F217E9F24>I<39FFF07FF8390F000780AD90B5FCEB0007AF39FFF07FF8 ! 1D1F7E9E22>I I<3807FFC038003E00131EB3A3 ! 122012F8A3EAF01CEA403CEA6038EA1070EA0FC012207F9E17>I 76 D I I I I I I<3803F040 ! 380C0CC0EA1803EA3001EA6000A212E01440A36C13007E127CEA7F80EA3FF86CB4FC0007 ! 1380C613C0EB1FE013031301EB00F014707EA46C136014E06C13C038F8018038C60300EA ! 81FC14217E9F19>I<007FB512E038780F010060EB006000401420A200C0143000801410 ! A400001400B3497E3803FFFC1C1F7E9E21>I<39FFF00FF8390F0003E0EC0080B3A46CEB ! 01001380120314026C6C5A6C6C5AEB3830EB0FC01D207E9E22>I<39FFF003FE391F8000 ! F86CC7126015206C6C1340A36C6C1380A2EBE00100011400A23800F002A213F8EB7804A2 ! 6D5AA36D5AA2131F6D5AA2EB07C0A36D5AA36DC7FC1F207F9E22>I<3BFFF07FF81FF03B ! 1F000FC007C06C903907800180170015C001805C00071502EC09E013C000035DEC19F014 ! 10D801E05CA2EC2078D800F05CA2EC403C01785CA2EC801E017C1460013C144090383D00 ! 0F133F6D5CA2011E1307010E91C7FCA2010C7F010413022C207F9E2F>I<12FFA212C0B3 ! B3A512FFA2082D7CA10D>91 D I<12FFA21203B3B3A512FFA2082D80A10D>I<12081210 ! 1220A21240A21280A312B812FCA2127C1238060E7D9F0D>96 D I<121C12FC121CAA137CEA1D87381E0180EB00C0001C13E01470A21478A6 ! 147014F014E0001E13C0381A018038198700EA107C15207E9F19>I I I I<13 ! 7CEA01C6EA030F1207EA0E061300A7EAFFF0EA0E00B2EA7FE01020809F0E>I<14E03803 ! E330EA0E3CEA1C1C38380E00EA780FA5EA380E6C5AEA1E38EA33E00020C7FCA21230A2EA ! 3FFE381FFF8014C0383001E038600070481330A4006013606C13C0381C03803803FC0014 ! 1F7F9417>I<121C12FC121CAA137C1386EA1D03001E1380A2121CAE38FF8FF014207E9F ! 19>I<1238127CA31238C7FCA6121C12FC121CB1EAFF80091F7F9E0C>I<13E0EA01F0A3EA ! 00E01300A61370EA07F012001370B3A31260EAF06013C0EA6180EA3F000C28829E0E>I< ! 121C12FC121CAAEB1FE0EB0780EB060013045B5B5B136013E0EA1DF0EA1E70EA1C38133C ! 131C7F130F7F148014C038FF9FF014207E9F18>I<121C12FC121CB3ABEAFF8009207F9F ! 0C>I<391C3E03E039FCC30C30391D039038391E01E01CA2001C13C0AE3AFF8FF8FF8021 ! 147E9326>I I I I<3801 ! F04038070CC0EA0E02EA1C03EA38011278127012F0A6127012781238EA1C03EA0C05EA07 ! 09EA01F1EA0001A8EB0FF8151D7F9318>I I I<1202A31206A2120E ! A2123EEAFFF8EA0E00AB1304A5EA07081203EA01F00E1C7F9B12>I<381C0380EAFC1FEA ! 1C03AE1307120CEA061B3803E3F014147E9319>I<38FF83F8383E00E0001C13C06C1380 ! A338070100A21383EA0382A2EA01C4A213E4EA00E8A21370A3132015147F9318>I<39FF ! 9FE1FC393C078070391C030060EC8020000E1440A214C0D80704138014E0A23903886100 ! 1471A23801D032143A143E3800E01CA2EB6018EB40081E147F9321>I<38FF87F8381E03 ! C0380E0180EB0300EA0702EA0384EA01C813D8EA00F01370137813F8139CEA010E1202EA ! 060738040380000C13C0003C13E038FE07FC16147F9318>I<38FF83F8383E00E0001C13 ! C06C1380A338070100A21383EA0382A2EA01C4A213E4EA00E8A21370A31320A25BA3EAF0 ! 80A200F1C7FC1262123C151D7F9318>I ! I E %EndDVIPSBitmapFont ! %DVIPSBitmapFont: Fp cmbx12 20.736 13 ! /Fp 13 122 df I I<90380FE02090 ! 387818609038E004E03803800238070001481300001E1460A25A1520127C127800F81400 ! A7EC7FFCEC03E000781301127C123CA27EA27E7E380380023900E0046090387818209038 ! 0FE0001E217D9F24>I<39FFF07FF8390F000780AD90B5FCEB0007AF39FFF07FF81D1F7E ! 9E22>I I 76 D I I I I I I<38 ! 03F040380C0CC0EA1803EA3001EA6000A212E01440A36C13007E127CEA7F80EA3FF86CB4 ! FC00071380C613C0EB1FE013031301EB00F014707EA46C136014E06C13C038F8018038C6 ! 0300EA81FC14217E9F19>I<007FB512E038780F010060EB006000401420A200C0143000 ! 801410A400001400B3497E3803FFFC1C1F7E9E21>I<39FFF00FF8390F0003E0EC0080B3 ! A46CEB01001380120314026C6C5A6C6C5AEB3830EB0FC01D207E9E22>I<39FFF003FE39 ! 1F8000F86CC7126015206C6C1340A36C6C1380A2EBE00100011400A23800F002A213F8EB ! 7804A26D5AA36D5AA2131F6D5AA2EB07C0A36D5AA36DC7FC1F207F9E22>I<3BFFF07FF8 ! 1FF03B1F000FC007C06C903907800180170015C001805C00071502EC09E013C000035DEC ! 19F01410D801E05CA2EC2078D800F05CA2EC403C01785CA2EC801E017C1460013C144090 ! 383D000F133F6D5CA2011E1307010E91C7FCA2010C7F010413022C207F9E2F>I<12FFA2 ! 12C0B3B3A512FFA2082D7CA10D>91 D I<12FFA21203B3B3A512FFA2082D80A10D>I<12 ! 0812101220A21240A21280A312B812FCA2127C1238060E7D9F0D>96 ! D I<121C12FC121CAA137CEA1D87381E0180EB00 ! C0001C13E01470A21478A6147014F014E0001E13C0381A018038198700EA107C15207E9F ! 19>I I I I<137CEA01C6EA030F1207EA0E061300A7EAFFF0EA0E00B2EA7FE010 ! 20809F0E>I<14E03803E330EA0E3CEA1C1C38380E00EA780FA5EA380E6C5AEA1E38EA33 ! E00020C7FCA21230A2EA3FFE381FFF8014C0383001E038600070481330A4006013606C13 ! C0381C03803803FC00141F7F9417>I<121C12FC121CAA137C1386EA1D03001E1380A212 ! 1CAE38FF8FF014207E9F19>I<1238127CA31238C7FCA6121C12FC121CB1EAFF80091F7F ! 9E0C>I<13E0EA01F0A3EA00E01300A61370EA07F012001370B3A31260EAF06013C0EA61 ! 80EA3F000C28829E0E>I<121C12FC121CAAEB1FE0EB0780EB060013045B5B5B136013E0 ! EA1DF0EA1E70EA1C38133C131C7F130F7F148014C038FF9FF014207E9F18>I<121C12FC ! 121CB3ABEAFF8009207F9F0C>I<391C3E03E039FCC30C30391D019018001EEBE01CA200 ! 1C13C0AE3AFF8FF8FF8021147E9326>I I I I<3801F04038070CC0EA0E02EA1C03EA38011278127012F0A61270 ! 12781238EA1C03EA0C05EA0709EA01F1EA0001A8EB0FF8151D7F9318>I I I<1202A31206A2120EA2123EEAFFF8EA0E00AB1304A5EA07081203EA01F00E1C7F ! 9B12>I<381C0380EAFC1FEA1C03AE1307120CEA061B3803E3F014147E9319>I<38FF83F8 ! 383E00E0001C13C06C1380A338070100A21383EA0382A2EA01C4A213E4EA00E8A21370A3 ! 132015147F9318>I<39FF9FE1FC393C078070391C030060EC8020000E1440A214C0D807 ! 04138014E0A239038861001471A23801D032143A143E3800E01CA2EB6018EB40081E147F ! 9321>I<38FF87F8381E03C0380E0180EB0300EA0702EA0384EA01C813D8EA00F0137013 ! 7813F8139CEA010E1202EA060738040380000C13C0003C13E038FE07FC16147F9318>I< ! 38FF83F8383E00E0001C13C06C1380A338070100A21383EA0382A2EA01C4A213E4EA00E8 ! A21370A31320A25BA3EAF080A200F1C7FC1262123C151D7F9318>I I E %EndDVIPSBitmapFont ! %DVIPSBitmapFont: Fq cmbx12 20.736 13 ! /Fq 13 122 df )d ! Fo(in)j(an)o(y)f(\014le)75 1513 y(that)d(uses)h(the)h(History)e (library's)i(features.)18 b(It)12 b(supplies)i(extern)e(declarations)h ! (for)e(all)i(of)f(the)g(library's)75 1568 y(public)17 b(functions)f(and)g(v)m(ariables,)g(and)f(declares)h(all)g(of)f(the)h ! (public)h(data)d(structures.)75 1686 y Fm(2.2)33 b(History)22 ! b(Storage)137 1778 y Fo(The)16 b(history)f(list)h(is)g(an)f(arra)o(y)f (of)g(history)i(en)o(tries.)k(A)15 b(history)g(en)o(try)g(is)h ! (declared)g(as)f(follo)o(ws:)195 1839 y Fn(typedef)23 ! b(struct)g(_hist_entry)f({)243 1891 y(char)h(*line;)243 ! 1943 y(char)g(*data;)195 1995 y(})h(HIST_ENTRY;)137 2058 ! y Fo(The)16 b(history)f(list)h(itself)g(migh)o(t)f(therefore)g(b)q(e)h ! (declared)g(as)195 2119 y Fn(HIST_ENTRY)22 b(**the_history_list;)137 ! 2183 y Fo(The)16 b(state)e(of)h(the)g(History)g(library)h(is)g ! (encapsulated)g(in)o(to)f(a)g(single)i(structure:)195 ! 2243 y Fn(/*)24 b(A)f(structure)g(used)g(to)h(pass)f(the)h(current)f ! (state)g(of)g(the)h(history)f(stuff)g(around.)g(*/)p ! 2033 2253 21 42 v 195 2295 a(typedef)g(struct)g(_hist_state)f({)243 ! 2347 y(HIST_ENTRY)g(**entries;)214 b(/*)23 b(Pointer)g(to)h(the)f ! (entries)g(themselves.)f(*/)243 2399 y(int)h(offset;)453 ! b(/*)23 b(The)h(location)e(pointer)h(within)g(this)h(array.)f(*/)p ! 2033 2409 V 243 2451 a(int)g(length;)453 b(/*)23 b(Number)g(of)h ! (elements)f(within)g(this)g(array.)g(*/)p 1985 2461 V ! 243 2503 a(int)g(size;)501 b(/*)23 b(Number)g(of)h(slots)f(allocated)g ! (to)g(this)h(array.)f(*/)p 2057 2513 V 243 2555 a(int)g(flags;)195 ! 2606 y(})h(HISTORY_STATE;)137 2670 y Fo(If)16 b(the)f(\015ags)g(mem)o ! (b)q(er)g(includes)j Fn(HS_STIFLED)p Fo(,)13 b(the)i(history)h(has)f(b) ! q(een)h(sti\015ed.)p eop %%Page: 6 8 ! 6 7 bop 75 -58 a Fo(6)1347 b(GNU)15 b(History)g(Library)75 ! 183 y Fm(2.3)33 b(History)22 b(F)-6 b(unctions)137 278 ! y Fo(This)21 b(section)g(describ)q(es)h(the)f(calling)h(sequence)g(for) ! e(the)g(v)m(arious)h(functions)g(presen)o(t)g(in)g(GNU)75 ! 333 y(History)l(.)75 441 y Fi(2.3.1)30 b(Initializing)20 ! b(History)h(and)f(State)g(Managemen)n(t)137 536 y Fo(This)e(section)g ! (describ)q(es)h(functions)f(used)g(to)e(initialize)21 ! b(and)c(manage)g(the)g(state)g(of)g(the)g(History)75 ! 591 y(library)f(when)g(y)o(ou)f(w)o(an)o(t)f(to)g(use)i(the)f(history)g ! (functions)h(in)g(y)o(our)f(program.)1650 679 y(F)l(unction)-1749 ! b Fh(void)20 b Fg(using)p 333 679 18 3 v 20 w(history)j ! Ff(\(\))195 734 y Fo(Begin)18 b(a)f(session)h(in)g(whic)o(h)g(the)g ! (history)f(functions)h(migh)o(t)f(b)q(e)h(used.)27 b(This)18 ! b(initializes)195 788 y(the)d(in)o(teractiv)o(e)h(v)m(ariables.)1650 ! 877 y(F)l(unction)-1749 b Fh(HISTORY_STATE)21 b(*)e Fg(history)p ! 657 877 V 21 w(get)p 755 877 V 21 w(history)p 951 877 ! V 21 w(state)j Ff(\(\))195 931 y Fo(Return)16 b(a)f(structure)g ! (describing)i(the)e(curren)o(t)g(state)f(of)h(the)g(input)i(history)l ! (.)1650 1019 y(F)l(unction)-1749 b Fh(void)20 b Fg(history)p ! 377 1019 V 20 w(set)p 468 1019 V 21 w(history)p 664 1019 ! V 21 w(state)j Ff(\()p Fn(HISTORY_STATE)13 b(*state)p ! Ff(\))195 1074 y Fo(Set)i(the)h(state)e(of)h(the)g(history)g(list)h ! (according)g(to)e Fj(state)p Fo(.)75 1182 y Fi(2.3.2)30 ! b(History)20 b(List)h(Managemen)n(t)137 1277 y Fo(These)11 b(functions)h(manage)e(individual)k(en)o(tries)d(on)g(the)g(history)f ! (list,)i(or)f(set)f(parameters)g(managing)75 1332 y(the)15 ! b(list)h(itself.)1650 1420 y(F)l(unction)-1749 b Fh(void)20 ! b Fg(add)p 294 1420 V 20 w(history)j Ff(\()p Fn(char)14 ! b(*string)p Ff(\))195 1475 y Fo(Place)i Fj(string)j Fo(at)c(the)g(end)i ! (of)d(the)i(history)f(list.)22 b(The)15 b(asso)q(ciated)h(data)f ! (\014eld)h(\(if)g(an)o(y\))e(is)195 1530 y(set)h(to)g ! Fn(NULL)p Fo(.)1650 1618 y(F)l(unction)-1749 b Fh(HIST_ENTRY)21 ! b(*)e Fg(remo)n(v)n(e)p 584 1618 V 20 w(history)k Ff(\()p ! Fn(int)14 b(which)p Ff(\))195 1673 y Fo(Remo)o(v)o(e)g(history)g(en)o ! (try)f(at)h(o\013set)f Fj(whic)o(h)h Fo(from)g(the)g(history)l(.)19 ! b(The)14 b(remo)o(v)o(ed)g(elemen)o(t)g(is)195 1727 y(returned)i(so)e ! (y)o(ou)h(can)h(free)f(the)g(line,)i(data,)d(and)h(con)o(taining)h ! (structure.)1650 1816 y(F)l(unction)-1749 b Fh(HIST_ENTRY)21 ! b(*)e Fg(replace)p 580 1816 V 22 w(history)p 777 1816 ! V 20 w(en)n(try)24 b Ff(\()p Fn(int)14 b(which,)g(char)283 ! 1870 y(*line,)g(char)g(*data)p Ff(\))195 1925 y Fo(Mak)o(e)f(the)h ! (history)f(en)o(try)g(at)g(o\013set)g Fj(whic)o(h)h Fo(ha)o(v)o(e)g ! Fj(line)k Fo(and)13 b Fj(data)p Fo(.)19 b(This)14 b(returns)g(the)f ! (old)195 1980 y(en)o(try)k(so)g(y)o(ou)g(can)g(disp)q(ose)i(of)d(the)i ! (data.)25 b(In)18 b(the)f(case)h(of)f(an)g(in)o(v)m(alid)i ! Fj(whic)o(h)p Fo(,)g(a)e Fn(NULL)195 2035 y Fo(p)q(oin)o(ter)f(is)f ! (returned.)1650 2123 y(F)l(unction)-1749 b Fh(void)20 ! b Fg(clear)p 320 2123 V 21 w(history)j Ff(\(\))195 2178 ! y Fo(Clear)15 b(the)h(history)f(list)h(b)o(y)f(deleting)i(all)f(the)f ! (en)o(tries.)1650 2266 y(F)l(unction)-1749 b Fh(void)20 ! b Fg(sti\015e)p 320 2266 V 21 w(history)j Ff(\()p Fn(int)14 ! b(max)p Ff(\))195 2321 y Fo(Sti\015e)i(the)f(history)h(list,)f(remem)o ! (b)q(ering)h(only)g(the)f(last)g Fj(max)j Fo(en)o(tries.)1650 ! 2409 y(F)l(unction)-1749 b Fh(int)20 b Fg(unsti\015e)p ! 358 2409 V 21 w(history)i Ff(\(\))195 2463 y Fo(Stop)e(sti\015ing)i ! (the)f(history)l(.)36 b(This)21 b(returns)g(the)f(previous)i(amoun)o(t) ! e(the)g(history)h(w)o(as)195 2518 y(sti\015ed.)g(The)15 ! b(v)m(alue)i(is)e(p)q(ositiv)o(e)i(if)e(the)g(history)h(w)o(as)e ! (sti\015ed,)i(negativ)o(e)f(if)h(it)f(w)o(asn't.)1650 ! 2606 y(F)l(unction)-1749 b Fh(int)20 b Fg(history)p 351 ! 2606 V 20 w(is)p 409 2606 V 21 w(sti\015ed)k Ff(\(\))195 ! 2661 y Fo(Returns)16 b(non-zero)f(if)h(the)f(history)g(is)h(sti\015ed,) ! g(zero)f(if)g(it)h(is)g(not.)p eop %%Page: 7 9 ! 7 8 bop 75 -58 a Fo(Chapter)15 b(2:)k(Programming)c(with)g(GNU)g ! (History)889 b(7)75 183 y Fi(2.3.3)30 b(Information)19 ! b(Ab)r(out)i(the)f(History)h(List)137 279 y Fo(These)13 ! b(functions)h(return)f(information)g(ab)q(out)f(the)h(en)o(tire)h ! (history)e(list)i(or)e(individual)k(list)e(en)o(tries.)1650 ! 371 y(F)l(unction)-1749 b Fh(HIST_ENTRY)21 b(**)e Fg(history)p ! 605 371 18 3 v 21 w(list)24 b Ff(\(\))195 426 y Fo(Return)f(a)g ! Fn(NULL)f Fo(terminated)g(arra)o(y)g(of)g Fn(HIST_ENTRY)f ! Fo(whic)o(h)j(is)f(the)f(curren)o(t)h(input)195 481 y(history)l(.)j ! (Elemen)o(t)18 b(0)e(of)h(this)h(list)g(is)f(the)h(b)q(eginning)h(of)e ! (time.)26 b(If)17 b(there)g(is)h(no)f(history)l(,)195 ! 535 y(return)e Fn(NULL)p Fo(.)1650 627 y(F)l(unction)-1749 ! b Fh(int)20 b Fg(where)p 325 627 V 20 w(history)j Ff(\(\))195 ! 682 y Fo(Returns)16 b(the)f(o\013set)f(of)h(the)g(curren)o(t)g(history) ! g(elemen)o(t.)1650 773 y(F)l(unction)-1749 b Fh(HIST_ENTRY)21 ! b(*)e Fg(curren)n(t)p 587 773 V 21 w(history)k Ff(\(\))195 ! 828 y Fo(Return)g(the)f(history)g(en)o(try)g(at)f(the)h(curren)o(t)g(p) ! q(osition,)j(as)c(determined)j(b)o(y)e Fn(where_)195 ! 883 y(history)14 b(\(\))p Fo(.)20 b(If)15 b(there)g(is)h(no)f(en)o(try) ! g(there,)g(return)g(a)g Fn(NULL)g Fo(p)q(oin)o(ter.)1650 ! 975 y(F)l(unction)-1749 b Fh(HIST_ENTRY)21 b(*)e Fg(history)p ! 579 975 V 21 w(get)j Ff(\()p Fn(int)15 b(offset)p Ff(\))195 ! 1029 y Fo(Return)21 b(the)g(history)g(en)o(try)f(at)g(p)q(osition)i ! Fj(o\013set)p Fo(,)e(starting)g(from)g Fn(history_base)p ! Fo(.)35 b(If)195 1084 y(there)16 b(is)h(no)g(en)o(try)f(there,)g(or)g ! (if)g Fj(o\013set)h Fo(is)g(greater)e(than)h(the)h(history)f(length,)h ! (return)f(a)195 1139 y Fn(NULL)f Fo(p)q(oin)o(ter.)1650 ! 1231 y(F)l(unction)-1749 b Fh(int)20 b Fg(history)p 351 ! 1231 V 20 w(total)p 487 1231 V 22 w(b)n(ytes)j Ff(\(\))195 ! 1285 y Fo(Return)c(the)f(n)o(um)o(b)q(er)g(of)g(b)o(ytes)g(that)f(the)h ! (primary)h(history)f(en)o(tries)g(are)g(using.)29 b(This)195 ! 1340 y(function)16 b(returns)f(the)g(sum)h(of)e(the)i(lengths)f(of)g ! (all)h(the)g(lines)g(in)g(the)g(history)l(.)75 1452 y Fi(2.3.4)30 b(Mo)n(ving)21 b(Around)f(the)h(History)g(List)137 ! 1548 y Fo(These)16 b(functions)g(allo)o(w)f(the)g(curren)o(t)h(index)g (in)o(to)f(the)h(history)f(list)h(to)e(b)q(e)i(set)f(or)g(c)o(hanged.) ! 1650 1640 y(F)l(unction)-1749 b Fh(int)20 b Fg(history)p ! 351 1640 V 20 w(set)p 442 1640 V 21 w(p)r(os)h Ff(\()p ! Fn(int)15 b(pos)p Ff(\))195 1694 y Fo(Set)g(the)h(p)q(osition)g(in)g ! (the)f(history)g(list)h(to)f Fj(p)q(os)p Fo(,)g(an)g(absolute)g(index)i ! (in)o(to)e(the)g(list.)1650 1786 y(F)l(unction)-1749 ! b Fh(HIST_ENTRY)21 b(*)e Fg(previous)p 615 1786 V 20 ! w(history)k Ff(\(\))195 1841 y Fo(Bac)o(k)17 b(up)h(the)f(curren)o(t)g ! (history)g(o\013set)f(to)h(the)g(previous)h(history)f(en)o(try)l(,)g ! (and)g(return)g(a)195 1896 y(p)q(oin)o(ter)f(to)e(that)h(en)o(try)l(.)k ! (If)d(there)f(is)h(no)f(previous)h(en)o(try)l(,)f(return)g(a)g ! Fn(NULL)f Fo(p)q(oin)o(ter.)1650 1987 y(F)l(unction)-1749 ! b Fh(HIST_ENTRY)21 b(*)e Fg(next)p 514 1987 V 21 w(history)k ! Ff(\(\))195 2042 y Fo(Mo)o(v)o(e)17 b(the)h(curren)o(t)g(history)f ! (o\013set)g(forw)o(ard)g(to)g(the)h(next)g(history)g(en)o(try)l(,)g ! (and)g(return)195 2097 y(the)d(a)g(p)q(oin)o(ter)h(to)e(that)h(en)o ! (try)l(.)20 b(If)15 b(there)g(is)h(no)f(next)g(en)o(try)l(,)g(return)g ! (a)g Fn(NULL)g Fo(p)q(oin)o(ter.)75 2208 y Fi(2.3.5)30 ! b(Searc)n(hing)21 b(the)f(History)h(List)137 2304 y Fo(These)14 ! b(functions)g(allo)o(w)g(searc)o(hing)g(of)e(the)i(history)f(list)h ! (for)f(en)o(tries)h(con)o(taining)g(a)f(sp)q(eci\014c)i(string.)75 ! 2359 y(Searc)o(hing)f(ma)o(y)g(b)q(e)g(p)q(erformed)g(b)q(oth)g(forw)o ! (ard)e(and)i(bac)o(kw)o(ard)f(from)g(the)h(curren)o(t)g(history)f(p)q ! (osition.)75 2414 y(The)j(searc)o(h)f(ma)o(y)g(b)q(e)i ! Fj(anc)o(hored)p Fo(,)e(meaning)h(that)f(the)h(string)g(m)o(ust)f(matc) ! o(h)g(at)g(the)h(b)q(eginning)i(of)d(the)75 2469 y(history)g(en)o(try)l ! (.)1650 2560 y(F)l(unction)-1749 b Fh(int)20 b Fg(history)p ! 351 2560 V 20 w(searc)n(h)j Ff(\()p Fn(char)14 b(*string,)g(int)h ! (direction)p Ff(\))195 2615 y Fo(Searc)o(h)g(the)h(history)f(for)f ! Fj(string)p Fo(,)h(starting)f(at)h(the)g(curren)o(t)g(history)g ! (o\013set.)k(If)d Fj(direction)195 2670 y Fn(<)j Fo(0,)g(then)g(the)h ! (searc)o(h)e(is)i(through)e(previous)i(en)o(tries,)g(else)g(through)f ! (subsequen)o(t.)32 b(If)p eop %%Page: 8 10 ! 8 9 bop 75 -58 a Fo(8)1347 b(GNU)15 b(History)g(Library)195 ! 183 y Fj(string)k Fo(is)d(found,)f(then)h(the)f(curren)o(t)g(history)g ! (index)i(is)f(set)f(to)f(that)h(history)g(en)o(try)l(,)g(and)195 ! 238 y(the)g(v)m(alue)h(returned)f(is)g(the)g(o\013set)f(in)h(the)g ! (line)h(of)e(the)h(en)o(try)g(where)g Fj(string)j Fo(w)o(as)c(found.) ! 195 293 y(Otherwise,)i(nothing)f(is)h(c)o(hanged,)f(and)h(a)e(-1)h(is)h ! (returned.)1650 396 y(F)l(unction)-1749 b Fh(int)20 b ! Fg(history)p 351 396 18 3 v 20 w(searc)n(h)p 527 396 ! V 21 w(pre\014x)i Ff(\()p Fn(char)15 b(*string,)f(int)g(direction)p ! Ff(\))195 451 y Fo(Searc)o(h)i(the)f(history)g(for)g ! Fj(string)p Fo(,)g(starting)g(at)g(the)g(curren)o(t)h(history)f ! (o\013set.)k(The)d(searc)o(h)195 506 y(is)h(anc)o(hored:)23 ! b(matc)o(hing)17 b(lines)h(m)o(ust)e(b)q(egin)i(with)f ! Fj(string)p Fo(.)25 b(If)17 b Fj(direction)h Fn(<)e Fo(0,)h(then)g(the) ! 195 560 y(searc)o(h)f(is)g(through)f(previous)i(en)o(tries,)f(else)g ! (through)g(subsequen)o(t.)22 b(If)16 b Fj(string)k Fo(is)c(found,)195 ! 615 y(then)i(the)g(curren)o(t)g(history)g(index)h(is)g(set)e(to)h(that) ! f(en)o(try)l(,)h(and)g(the)g(return)g(v)m(alue)h(is)g(0.)195 ! 670 y(Otherwise,)d(nothing)f(is)h(c)o(hanged,)f(and)h(a)e(-1)h(is)h ! (returned.)1650 773 y(F)l(unction)-1749 b Fh(int)20 b ! Fg(history)p 351 773 V 20 w(searc)n(h)p 527 773 V 21 ! w(p)r(os)h Ff(\()p Fn(char)15 b(*string,)f(int)g(direction,)g(int)283 ! 828 y(pos)p Ff(\))195 883 y Fo(Searc)o(h)h(for)g Fj(string)k ! Fo(in)d(the)f(history)g(list,)g(starting)g(at)f Fj(p)q(os)p ! Fo(,)h(an)g(absolute)g(index)i(in)o(to)e(the)195 937 ! y(list.)21 b(If)15 b Fj(direction)h Fo(is)g(negativ)o(e,)f(the)g(searc) ! o(h)g(pro)q(ceeds)g(bac)o(kw)o(ard)g(from)f Fj(p)q(os)p ! Fo(,)h(otherwise)195 992 y(forw)o(ard.)27 b(Returns)18 ! b(the)g(absolute)g(index)h(of)f(the)g(history)f(elemen)o(t)i(where)f ! Fj(string)k Fo(w)o(as)195 1047 y(found,)15 b(or)g(-1)g(otherwise.)75 ! 1170 y Fi(2.3.6)30 b(Managing)20 b(the)g(History)h(File)137 ! 1272 y Fo(The)16 b(History)g(library)h(can)e(read)h(the)g(history)g ! (from)f(and)h(write)g(it)g(to)f(a)h(\014le.)22 b(This)17 ! b(section)f(do)q(cu-)75 1327 y(men)o(ts)f(the)g(functions)h(for)f ! (managing)g(a)g(history)g(\014le.)1650 1430 y(F)l(unction)-1749 ! b Fh(int)20 b Fg(read)p 286 1430 V 20 w(history)i Ff(\()p ! Fn(char)15 b(*filename)p Ff(\))195 1485 y Fo(Add)h(the)f(con)o(ten)o ! (ts)f(of)h Fj(\014lename)j Fo(to)d(the)g(history)g(list,)g(a)g(line)h ! (at)f(a)f(time.)21 b(If)15 b Fj(\014lename)j Fo(is)195 ! 1539 y Fn(NULL)p Fo(,)c(then)i(read)f(from)f(`)p Fn(~/.history)p ! Fo('.)k(Returns)e(0)f(if)g(successful,)i(or)d(errno)h(if)h(not.)1650 ! 1643 y(F)l(unction)-1749 b Fh(int)20 b Fg(read)p 286 ! 1643 V 20 w(history)p 481 1643 V 20 w(range)i Ff(\()p ! Fn(char)15 b(*filename,)e(int)i(from,)g(int)f(to)p Ff(\))195 ! 1697 y Fo(Read)21 b(a)f(range)g(of)g(lines)i(from)e Fj(\014lename)p ! Fo(,)i(adding)f(them)g(to)f(the)g(history)h(list.)36 ! b(Start)195 1752 y(reading)15 b(at)e(line)j Fj(from)e ! Fo(and)g(end)h(at)e Fj(to)p Fo(.)19 b(If)c Fj(from)e ! Fo(is)i(zero,)f(start)f(at)g(the)h(b)q(eginning.)22 b(If)15 ! b Fj(to)195 1807 y Fo(is)i(less)g(than)f Fj(from)p Fo(,)g(then)h(read)f ! (un)o(til)i(the)e(end)h(of)f(the)h(\014le.)24 b(If)17 ! b Fj(\014lename)j Fo(is)d Fn(NULL)p Fo(,)f(then)195 1862 ! y(read)f(from)g(`)p Fn(~/.history)p Fo('.)i(Returns)f(0)f(if)h ! (successful,)g(or)e Fn(errno)h Fo(if)h(not.)1650 1965 ! y(F)l(unction)-1749 b Fh(int)20 b Fg(write)p 304 1965 ! V 22 w(history)i Ff(\()p Fn(char)15 b(*filename)p Ff(\))195 ! 2020 y Fo(W)l(rite)23 b(the)f(curren)o(t)g(history)h(to)f ! Fj(\014lename)p Fo(,)j(o)o(v)o(erwriting)d Fj(\014lename)k ! Fo(if)d(necessary)l(.)42 b(If)195 2074 y Fj(\014lename)20 ! b Fo(is)d Fn(NULL)p Fo(,)f(then)g(write)h(the)f(history)h(list)g(to)f ! (`)p Fn(~/.history)p Fo('.)21 b(V)l(alues)d(returned)195 ! 2129 y(are)d(as)g(in)h Fn(read_history)d(\(\))p Fo(.)1650 ! 2232 y(F)l(unction)-1749 b Fh(int)20 b Fg(app)r(end)p ! 360 2232 V 19 w(history)j Ff(\()p Fn(int)14 b(nelements,)g(char)h ! (*filename)p Ff(\))195 2287 y Fo(App)q(end)i(the)e(last)g ! Fj(nelemen)o(ts)j Fo(of)d(the)g(history)g(list)h(to)f ! Fj(\014lename)p Fo(.)1650 2390 y(F)l(unction)-1749 b ! Fh(int)20 b Fg(history)p 351 2390 V 20 w(truncate)p 582 ! 2390 V 21 w(\014le)k Ff(\()p Fn(char)14 b(*filename,)g(int)h(nlines)p ! Ff(\))195 2445 y Fo(T)l(runcate)g(the)h(history)f(\014le)h ! Fj(\014lename)p Fo(,)g(lea)o(ving)g(only)g(the)f(last)g ! Fj(nlines)k Fo(lines.)75 2568 y Fi(2.3.7)30 b(History)20 ! b(Expansion)137 2670 y Fo(These)c(functions)g(implemen)o(t)g ! Fn(csh)p Fo(-lik)o(e)g(history)g(expansion.)p eop %%Page: 9 11 ! 9 10 bop 75 -58 a Fo(Chapter)15 b(2:)k(Programming)c(with)g(GNU)g ! (History)889 b(9)1650 183 y(F)l(unction)-1749 b Fh(int)20 ! b Fg(history)p 351 183 18 3 v 20 w(expand)j Ff(\()p Fn(char)14 ! b(*string,)g(char)h(**output)p Ff(\))195 238 y Fo(Expand)k ! Fj(string)p Fo(,)g(placing)h(the)e(result)h(in)o(to)g ! Fj(output)p Fo(,)g(a)f(p)q(oin)o(ter)h(to)f(a)g(string)h(\(see)f(Sec-) ! 195 293 y(tion)d(1.1)g([History)f(In)o(teraction],)h(page)g(1\).)k ! (Returns:)195 370 y Fn(0)216 b Fo(If)16 b(no)g(expansions)h(to)q(ok)e ! (place)i(\(or,)d(if)j(the)f(only)g(c)o(hange)g(in)h(the)e(text)h(w)o ! (as)435 425 y(the)f(de-slashifying)j(of)c(the)i(history)f(expansion)h ! (c)o(haracter\);)195 502 y Fn(1)216 b Fo(if)16 b(expansions)g(did)g ! (tak)o(e)e(place;)195 580 y Fn(-1)192 b Fo(if)16 b(there)f(w)o(as)f(an) ! h(error)g(in)h(expansion;)195 657 y Fn(2)216 b Fo(if)16 ! b(the)g(returned)f(line)j(should)e(b)q(e)g(displa)o(y)o(ed,)h(but)e ! (not)g(executed,)i(as)e(with)435 712 y(the)g Fn(:p)g ! Fo(mo)q(di\014er)h(\(see)f(Section)i(1.1.3)c([Mo)q(di\014ers],)i(page)g ! (2\).)195 789 y(If)g(an)g(error)f(o)q(curred)i(in)g(expansion,)f(then)h ! Fj(output)f Fo(con)o(tains)g(a)g(descriptiv)o(e)i(error)d(mes-)195 ! 844 y(sage.)1650 932 y(F)l(unction)-1749 b Fh(char)20 ! b(*)f Fg(history)p 422 932 V 21 w(arg)p 524 932 V 19 ! w(extract)24 b Ff(\()p Fn(int)14 b(first,)h(int)g(last,)f(char)283 ! 987 y(*string)p Ff(\))195 1042 y Fo(Extract)g(a)g(string)g(segmen)o(t)g ! (consisting)i(of)e(the)g Fj(\014rst)i Fo(through)e Fj(last)h ! Fo(argumen)o(ts)f(presen)o(t)195 1097 y(in)i Fj(string)p ! Fo(.)k(Argumen)o(ts)15 b(are)f(brok)o(en)i(up)f(as)g(in)h(Bash.)1650 ! 1185 y(F)l(unction)-1749 b Fh(char)20 b(*)f Fg(get)p ! 324 1185 V 21 w(history)p 520 1185 V 20 w(ev)n(en)n(t)25 ! b Ff(\()p Fn(char)14 b(*string,)g(int)h(*cindex,)f(int)283 ! 1240 y(qchar)p Ff(\))195 1295 y Fo(Returns)h(the)g(text)f(of)g(the)h ! (history)g(ev)o(en)o(t)f(b)q(eginning)j(at)d Fj(string)k ! Fn(+)d Fj(*cindex)p Fo(.)20 b Fj(*cindex)f Fo(is)195 ! 1350 y(mo)q(di\014ed)e(to)e(p)q(oin)o(t)h(to)f(after)g(the)h(ev)o(en)o ! (t)f(sp)q(eci\014er.)23 b(A)o(t)16 b(function)g(en)o(try)l(,)f ! Fj(cindex)21 b Fo(p)q(oin)o(ts)195 1404 y(to)16 b(the)h(index)h(in)o ! (to)e Fj(string)21 b Fo(where)c(the)g(history)f(ev)o(en)o(t)h(sp)q ! (eci\014cation)h(b)q(egins.)26 b Fj(qc)o(har)19 b Fo(is)195 ! 1459 y(a)h(c)o(haracter)g(that)g(is)h(allo)o(w)o(ed)f(to)g(end)h(the)g ! (ev)o(en)o(t)f(sp)q(eci\014cation)i(in)g(addition)f(to)f(the)195 ! 1514 y(\\normal")15 b(terminating)g(c)o(haracters.)1650 ! 1602 y(F)l(unction)-1749 b Fh(char)20 b(**)f Fg(history)p ! 448 1602 V 21 w(tok)n(enize)25 b Ff(\()p Fn(char)14 b(*string)p ! Ff(\))195 1657 y Fo(Return)j(an)g(arra)o(y)f(of)g(tok)o(ens)g(parsed)h ! (out)g(of)f Fj(string)p Fo(,)h(m)o(uc)o(h)g(as)f(the)h(shell)h(migh)o ! (t.)25 b(The)195 1712 y(tok)o(ens)d(are)g(split)i(on)f(white)g(space)g ! (and)f(on)h(the)g(c)o(haracters)f Fn(\(\)<>;&|$)p Fo(,)h(and)f(shell) ! 195 1767 y(quoting)15 b(con)o(v)o(en)o(tions)h(are)e(ob)q(ey)o(ed.)75 ! 1892 y Fm(2.4)33 b(History)22 b(V)-6 b(ariables)137 1987 ! y Fo(This)23 b(section)f(describ)q(es)h(the)f(externally)h(visible)h(v) ! m(ariables)f(exp)q(orted)f(b)o(y)g(the)g(GNU)f(History)75 ! 2042 y(Library)l(.)1661 2130 y(V)l(ariable)-1749 b Fh(int)20 ! b Fg(history)p 351 2130 V 20 w(base)195 2185 y Fo(The)15 b(logical)i(o\013set)d(of)h(the)g(\014rst)g(en)o(try)g(in)h(the)f ! (history)g(list.)1661 2274 y(V)l(ariable)-1749 b Fh(int)20 ! b Fg(history)p 351 2274 V 20 w(length)195 2329 y Fo(The)15 b(n)o(um)o(b)q(er)h(of)f(en)o(tries)g(curren)o(tly)h(stored)f(in)h(the) ! f(history)g(list.)1661 2417 y(V)l(ariable)-1749 b Fh(int)20 ! b Fg(max)p 283 2417 V 19 w(input)p 435 2417 V 21 w(history)195 ! 2472 y Fo(The)14 b(maxim)o(um)f(n)o(um)o(b)q(er)h(of)e(history)i(en)o ! (tries.)19 b(This)14 b(m)o(ust)f(b)q(e)h(c)o(hanged)g(using)g ! Fn(stifle_)195 2527 y(history)g(\(\))p Fo(.)1661 2615 ! y(V)l(ariable)-1749 b Fh(char)20 b Fg(history)p 377 2615 ! V 20 w(expansion)p 644 2615 V 21 w(c)n(har)195 2670 y ! Fo(The)15 b(c)o(haracter)g(that)f(starts)g(a)h(history)g(ev)o(en)o(t.) ! 20 b(The)15 b(default)h(is)g(`)p Fn(!)p Fo('.)p eop ! %%Page: 10 12 ! 10 11 bop 75 -58 a Fo(10)1324 b(GNU)15 b(History)g(Library)1661 ! 183 y(V)l(ariable)-1749 b Fh(char)20 b Fg(history)p 377 ! 183 18 3 v 20 w(subst)p 529 183 V 20 w(c)n(har)195 238 ! y Fo(The)13 b(c)o(haracter)e(that)h(in)o(v)o(ok)o(es)g(w)o(ord)g ! (substitution)h(if)g(found)g(at)e(the)i(start)e(of)h(a)g(line.)21 ! b(The)195 293 y(default)16 b(is)f(`)p Fn(^)p Fo('.)1661 ! 388 y(V)l(ariable)-1749 b Fh(char)20 b Fg(history)p 377 ! 388 V 20 w(commen)n(t)p 627 388 V 19 w(c)n(har)195 443 ! y Fo(During)e(tok)o(enization,)h(if)f(this)h(c)o(haracter)e(is)i(seen)f ! (as)g(the)g(\014rst)g(c)o(haracter)f(of)g(a)h(w)o(ord,)195 ! 498 y(then)e(it)g(and)g(all)h(subsequen)o(t)g(c)o(haracters)e(up)h(to)g ! (a)f(newline)j(are)e(ignored,)g(suppressing)195 553 y(history)f ! (expansion)h(for)f(the)g(remainder)h(of)f(the)g(line.)22 ! b(This)15 b(is)h(disabled)h(b)o(y)e(default.)1661 648 ! y(V)l(ariable)-1749 b Fh(char)20 b(*)f Fg(history)p 422 ! 648 V 21 w(no)p 504 648 V 20 w(expand)p 704 648 V 20 ! w(c)n(hars)195 703 y Fo(The)j(list)h(of)f(c)o(haracters)f(whic)o(h)i ! (inhibit)h(history)e(expansion)h(if)g(found)f(immediately)195 ! 758 y(follo)o(wing)16 b Fj(history)p 528 758 14 2 v 16 ! w(expansion)p 739 758 V 18 w(c)o(har)p Fo(.)j(The)d(default)f(is)h ! (whitespace)g(and)g(`)p Fn(=)p Fo('.)1661 853 y(V)l(ariable)-1749 ! b Fh(char)20 b(*)f Fg(history)p 422 853 18 3 v 21 w(searc)n(h)p ! 599 853 V 20 w(delimiter)p 843 853 V 23 w(c)n(hars)195 ! 908 y Fo(The)f(list)h(of)e(additional)i(c)o(haracters)e(whic)o(h)i(can) ! f(delimit)h(a)f(history)g(searc)o(h)f(string,)h(in)195 ! 963 y(addition)c(to)d(whitespace,)j(`)p Fn(:)p Fo(')d(and)i(`)p ! Fn(?)p Fo(')f(in)h(the)f(case)h(of)f(a)g(substring)h(searc)o(h.)19 ! b(The)12 b(default)195 1018 y(is)k(empt)o(y)l(.)1661 ! 1113 y(V)l(ariable)-1749 b Fh(int)20 b Fg(history)p 351 ! 1113 V 20 w(quotes)p 533 1113 V 21 w(inhibit)p 717 1113 ! V 23 w(expansion)195 1168 y Fo(If)13 b(non-zero,)f(single-quoted)i(w)o ! (ords)e(are)g(not)g(scanned)h(for)f(the)g(history)h(expansion)g(c)o ! (har-)195 1223 y(acter.)19 b(The)d(default)g(v)m(alue)g(is)g(0.)1661 ! 1318 y(V)l(ariable)-1749 b Fh(Function)20 b(*)g Fg(history)p ! 527 1318 V 20 w(inhibit)p 710 1318 V 23 w(expansion)p ! 980 1318 V 21 w(function)195 1373 y Fo(This)12 b(should)g(b)q(e)g(set)f ! (to)f(the)i(address)f(of)g(a)g(function)h(that)e(tak)o(es)h(t)o(w)o(o)f ! (argumen)o(ts:)17 b(a)11 b Fn(char)195 1428 y(*)j Fo(\()p ! Fj(string)t Fo(\))f(and)i(an)f(in)o(teger)g(index)h(in)o(to)f(that)g ! (string)g(\()p Fj(i)r Fo(\).)20 b(It)14 b(should)h(return)f(a)g ! (non-zero)195 1482 y(v)m(alue)g(if)e(the)h(history)f(expansion)h ! (starting)f(at)g Fj(string[i])i Fo(should)f(not)f(b)q(e)h(p)q ! (erformed;)g(zero)195 1537 y(if)g(the)h(expansion)f(should)h(b)q(e)g ! (done.)20 b(It)13 b(is)g(in)o(tended)i(for)d(use)h(b)o(y)g ! (applications)i(lik)o(e)f(Bash)195 1592 y(that)j(use)h(the)g(history)f ! (expansion)i(c)o(haracter)e(for)g(additional)i(purp)q(oses.)28 ! b(By)18 b(default,)195 1647 y(this)e(v)m(ariable)g(is)g(set)f(to)f ! (NULL.)75 1780 y Fm(2.5)33 b(History)22 b(Programming)h(Example)137 ! 1878 y Fo(The)16 b(follo)o(wing)g(program)e(demonstrates)g(simple)j ! (use)e(of)g(the)g(GNU)g(History)g(Library)l(.)195 1944 ! y Fn(main)23 b(\(\))195 1995 y({)243 2047 y(char)g(line[1024],)f(*t;) ! 243 2099 y(int)h(len,)g(done)h(=)g(0;)243 2203 y(line[0])f(=)g(0;)243 ! 2307 y(using_history)f(\(\);)243 2359 y(while)h(\(!done\))290 ! 2411 y({)338 2462 y(printf)g(\("history$)g("\);)338 2514 ! y(fflush)g(\(stdout\);)338 2566 y(t)h(=)g(fgets)f(\(line,)g(sizeof)g ! (\(line\))g(-)h(1,)f(stdin\);)338 2618 y(if)h(\(t)f(&&)h(*t\))386 ! 2670 y({)p eop %%Page: 11 13 ! 11 12 bop 75 -58 a Fo(Chapter)15 b(2:)k(Programming)c(with)g(GNU)g ! (History)867 b(11)434 183 y Fn(len)23 b(=)h(strlen)f(\(t\);)434 ! 235 y(if)g(\(t[len)g(-)h(1])g(==)f('\\n'\))481 287 y(t[len)h(-)f(1])h ! (=)g('\\0';)386 339 y(})338 443 y(if)g(\(!t\))386 495 ! y(strcpy)f(\(line,)g("quit"\);)338 598 y(if)h(\(line[0]\))386 ! 650 y({)434 702 y(char)f(*expansion;)434 754 y(int)g(result;)434 ! 858 y(result)g(=)g(history_expand)f(\(line,)h(&expansion\);)434 ! 910 y(if)g(\(result\))481 962 y(fprintf)g(\(stderr,)g("\045s\\n",)g ! (expansion\);)434 1065 y(if)g(\(result)g(<)h(0)g(||)f(result)g(==)h ! (2\))481 1117 y({)529 1169 y(free)f(\(expansion\);)529 ! 1221 y(continue;)481 1273 y(})434 1377 y(add_history)f(\(expansion\);) ! 434 1429 y(strncpy)h(\(line,)g(expansion,)f(sizeof)h(\(line\))g(-)h ! (1\);)434 1480 y(free)f(\(expansion\);)386 1532 y(})338 ! 1636 y(if)h(\(strcmp)f(\(line,)g("quit"\))g(==)g(0\))386 ! 1688 y(done)g(=)h(1;)338 1740 y(else)f(if)h(\(strcmp)f(\(line,)g ! ("save"\))g(==)h(0\))386 1792 y(write_history)e(\("history_file"\);)338 ! 1844 y(else)h(if)h(\(strcmp)f(\(line,)g("read"\))g(==)h(0\))386 ! 1896 y(read_history)e(\("history_file"\);)338 1947 y(else)h(if)h ! (\(strcmp)f(\(line,)g("list"\))g(==)h(0\))386 1999 y({)434 ! 2051 y(register)e(HIST_ENTRY)h(**the_list;)434 2103 y(register)f(int)i ! (i;)434 2207 y(the_list)e(=)i(history_list)e(\(\);)434 ! 2259 y(if)h(\(the_list\))481 2311 y(for)h(\(i)f(=)h(0;)g(the_list[i];)e ! (i++\))529 2363 y(printf)h(\("\045d:)g(\045s\\n",)g(i)h(+)g ! (history_base,)e(the_list[i]->line\);)386 2414 y(})338 ! 2466 y(else)h(if)h(\(strncmp)f(\(line,)g("delete",)g(6\))g(==)h(0\))386 ! 2518 y({)434 2570 y(int)f(which;)434 2622 y(if)g(\(\(sscanf)g(\(line)g ! (+)h(6,)f("\045d",)h(&which\)\))e(==)i(1\))p eop %%Page: 12 14 ! 12 13 bop 75 -58 a Fo(12)1324 b(GNU)15 b(History)g(Library)481 ! 183 y Fn({)529 235 y(HIST_ENTRY)23 b(*entry)g(=)g(remove_history)f ! (\(which\);)529 287 y(if)i(\(!entry\))577 339 y(fprintf)f(\(stderr,)f ! ("No)i(such)f(entry)g(\045d\\n",)g(which\);)529 391 y(else)577 ! 443 y({)625 495 y(free)g(\(entry->line\);)625 546 y(free)g(\(entry\);) ! 577 598 y(})481 650 y(})434 702 y(else)481 754 y({)529 ! 806 y(fprintf)g(\(stderr,)g("non-numeric)f(arg)h(given)h(to)f ! (`delete'\\n"\);)481 858 y(})386 910 y(})290 962 y(})195 ! 1013 y(})p eop %%Page: 13 15 ! 13 14 bop 75 -58 a Fo(App)q(endix)17 b(A:)e(Concept)g(Index)1196 ! b(13)75 183 y Fk(App)r(endix)25 b(A)41 b(Concept)27 b(Index)75 ! 359 y Fm(A)75 417 y Fe(anc)o(hored)14 b(searc)o(h)s Fd(.)7 ! b(.)f(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g ! (.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)16 ! b Fe(7)75 517 y Fm(E)75 575 y Fe(ev)o(en)o(t)d(designators)c ! Fd(.)g(.)d(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g ! (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)21 ! b Fe(1)1012 359 y Fm(H)1012 417 y Fe(history)15 b(ev)o(en)o(ts)s ! Fd(.)7 b(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.) ! g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g ! (.)16 b Fe(1)1012 467 y(history)f(expansion)6 b Fd(.)j(.)d(.)g(.)g(.)g ! (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) ! g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)19 b Fe(1)1012 517 y(History)14 ! b(Searc)o(hing)5 b Fd(.)j(.)e(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g ! (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) ! g(.)18 b Fe(7)p eop %%Page: 14 16 ! 14 15 bop 75 -58 a Fo(14)1324 b(GNU)15 b(History)g(Library)p eop %%Page: 15 17 ! 15 16 bop 75 -58 a Fo(App)q(endix)17 b(B:)e(F)l(unction)h(and)g(V)l ! (ariable)g(Index)919 b(15)75 183 y Fk(App)r(endix)25 b(B)41 b(F)-7 b(unction)26 b(and)h(V)-7 b(ariable)26 ! b(Index)75 359 y Fm(A)75 417 y Fc(add)p 137 417 12 2 ! v 13 w(history)6 b Fd(.)s(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g ! (.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) ! g(.)g(.)g(.)g(.)g(.)h(.)18 b Fe(6)75 467 y Fc(append)p ! 197 467 V 12 w(history)8 b Fd(.)e(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g ! (.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.) ! g(.)g(.)g(.)g(.)23 b Fe(8)75 567 y Fm(C)75 625 y Fc(clear)p ! 177 625 V 12 w(history)s Fd(.)t(.)6 b(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f ! (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.) ! g(.)g(.)g(.)g(.)g(.)g(.)16 b Fe(6)75 675 y Fc(current)p ! 217 675 V 11 w(history)7 b Fd(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g ! (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.) ! g(.)g(.)g(.)22 b Fe(7)75 774 y Fm(G)75 832 y Fc(get)p ! 137 832 V 13 w(history)p 290 832 V 11 w(event)8 b Fd(.)e(.)g(.)g(.)g(.) ! g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h ! (.)f(.)g(.)g(.)g(.)g(.)g(.)22 b Fe(9)75 932 y Fm(H)75 ! 990 y Fc(history)p 217 990 V 11 w(arg)p 288 990 V 13 ! w(extract)7 b Fd(.)t(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.) ! g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)20 ! b Fe(9)75 1040 y Fc(history)p 217 1040 V 11 w(base)f ! Fd(.)6 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.) ! g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)19 ! b Fe(9)75 1090 y Fc(history_co)o(mm)o(ent)o(_c)o(har)g ! Fd(.)6 b(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) ! g(.)g(.)g(.)g(.)g(.)g(.)23 b Fe(10)75 1139 y Fc(history)p ! 217 1139 V 11 w(expand)9 b Fd(.)d(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g ! (.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.) ! g(.)g(.)g(.)g(.)23 b Fe(9)75 1189 y Fc(history)p 217 ! 1189 V 11 w(expansion)p 408 1189 V 11 w(char)17 b Fd(.)6 ! b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g ! (.)g(.)g(.)g(.)g(.)18 b Fe(9)75 1239 y Fc(history)p 217 ! 1239 V 11 w(get)6 b Fd(.)f(.)h(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g ! (.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) ! g(.)g(.)g(.)g(.)g(.)h(.)18 b Fe(7)75 1289 y Fc(history)p ! 217 1289 V 11 w(get)p 288 1289 V 13 w(history)p 441 1289 ! V 12 w(state)9 b Fd(.)d(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g ! (.)h(.)f(.)g(.)g(.)g(.)g(.)23 b Fe(6)75 1339 y Fc(history_in)o(hi)o ! (bit)o(_e)o(xpa)o(nsi)o(on)o(_fu)o(nc)o(tio)o(n)c Fd(.)6 ! b(.)g(.)g(.)g(.)g(.)g(.)22 b Fe(10)75 1389 y Fc(history)p ! 217 1389 V 11 w(is)p 268 1389 V 14 w(stifled)8 b Fd(.)s(.)f(.)f(.)g(.)g ! (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.) ! g(.)g(.)g(.)g(.)g(.)21 b Fe(6)75 1438 y Fc(history)p ! 217 1438 V 11 w(length)15 b Fd(.)6 b(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.) ! g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g ! (.)g(.)g(.)g(.)g(.)17 b Fe(9)75 1488 y Fc(history)p 217 ! 1488 V 11 w(list)5 b Fd(.)g(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g ! (.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.) ! f(.)g(.)g(.)g(.)g(.)17 b Fe(7)75 1538 y Fc(history_no)o(_e)o(xpa)o(nd)o ! (_ch)o(ars)e Fd(.)6 b(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g ! (.)g(.)g(.)g(.)g(.)g(.)g(.)19 b Fe(10)75 1588 y Fc(history_qu)o(ot)o ! (es_)o(in)o(hib)o(it_)o(ex)o(pan)o(si)o(on)13 b Fd(.)6 ! b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)16 b Fe(10)75 1638 ! y Fc(history)p 217 1638 V 11 w(search)9 b Fd(.)d(.)g(.)g(.)g(.)g(.)g(.) ! g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g ! (.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)23 b Fe(7)75 1687 y Fc(history_se)o(ar)o ! (ch_)o(de)o(lim)o(ite)o(r_)o(cha)o(rs)15 b Fd(.)6 b(.)g(.)g(.)g(.)g(.)g ! (.)g(.)g(.)h(.)f(.)g(.)18 b Fe(10)75 1737 y Fc(history)p ! 217 1737 V 11 w(search)p 348 1737 V 12 w(pos)8 b Fd(.)d(.)i(.)f(.)g(.)g ! (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.) ! g(.)g(.)g(.)g(.)g(.)21 b Fe(8)75 1787 y Fc(history)p ! 217 1787 V 11 w(search)p 348 1787 V 12 w(prefix)5 b Fd(.)t(.)h(.)g(.)g ! (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.) ! g(.)g(.)g(.)17 b Fe(8)75 1837 y Fc(history)p 217 1837 ! V 11 w(set)p 288 1837 V 13 w(history)p 441 1837 V 12 ! w(state)9 b Fd(.)d(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h ! (.)f(.)g(.)g(.)g(.)g(.)23 b Fe(6)75 1887 y Fc(history)p ! 217 1887 V 11 w(set)p 288 1887 V 13 w(pos)t Fd(.)5 b(.)h(.)g(.)g(.)g(.) ! g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g ! (.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)16 b Fe(7)1012 359 ! y Fc(history_sub)o(st)o(_ch)o(ar)d Fd(.)6 b(.)g(.)g(.)g(.)g(.)h(.)f(.)g ! (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.) ! 17 b Fe(10)1012 409 y Fc(history)p 1154 409 V 12 w(tokenize)8 ! b Fd(.)s(.)e(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.) ! g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)21 ! b Fe(9)1012 459 y Fc(history)p 1154 459 V 12 w(total)p ! 1266 459 V 12 w(bytes)7 b Fd(.)t(.)f(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.) ! g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)20 ! b Fe(7)1012 509 y Fc(history)p 1154 509 V 12 w(truncate)p ! 1326 509 V 11 w(file)5 b Fd(.)t(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h ! (.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)18 ! b Fe(8)1012 612 y Fm(M)1012 670 y Fc(max)p 1074 670 V ! 13 w(input)p 1187 670 V 13 w(history)13 b Fd(.)6 b(.)g(.)g(.)g(.)g(.)g ! (.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) ! g(.)h(.)f(.)g(.)g(.)16 b Fe(9)1012 773 y Fm(N)1012 831 ! y Fc(next)p 1094 831 V 13 w(history)5 b Fd(.)s(.)h(.)g(.)g(.)g(.)g(.)g ! (.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.) ! f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)18 b Fe(7)1012 ! 934 y Fm(P)1012 992 y Fc(previous)p 1174 992 V 11 w(history)8 ! b Fd(.)t(.)e(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.) ! g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)21 ! b Fe(7)1012 1096 y Fm(R)1012 1154 y Fc(read)p 1094 1154 ! V 13 w(history)5 b Fd(.)s(.)h(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g ! (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.) ! g(.)g(.)g(.)g(.)g(.)18 b Fe(8)1012 1204 y Fc(read)p 1094 ! 1204 V 13 w(history)p 1247 1204 V 11 w(range)8 b Fd(.)d(.)h(.)g(.)g(.)g ! (.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) ! g(.)g(.)g(.)h(.)f(.)21 b Fe(8)1012 1253 y Fc(remove)p ! 1134 1253 V 12 w(history)8 b Fd(.)e(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g ! (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.) ! g(.)g(.)g(.)g(.)24 b Fe(6)1012 1303 y Fc(replace)p 1154 ! 1303 V 12 w(history)p 1306 1303 V 11 w(entry)5 b Fd(.)t(.)h(.)g(.)g(.)g ! (.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) ! g(.)g(.)18 b Fe(6)1012 1406 y Fm(S)1012 1464 y Fc(stifle)p ! 1134 1464 V 12 w(history)8 b Fd(.)e(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g ! (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.) ! g(.)g(.)g(.)g(.)24 b Fe(6)1012 1568 y Fm(U)1012 1626 ! y Fc(unstifle)p 1174 1626 V 11 w(history)8 b Fd(.)t(.)e(.)g(.)g(.)g(.)g ! (.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) ! g(.)h(.)f(.)g(.)g(.)g(.)21 b Fe(6)1012 1676 y Fc(using)p ! 1114 1676 V 13 w(history)s Fd(.)s(.)6 b(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g ! (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) ! g(.)g(.)g(.)g(.)g(.)g(.)17 b Fe(6)1012 1779 y Fm(W)1012 ! 1837 y Fc(where)p 1114 1837 V 13 w(history)s Fd(.)s(.)6 ! b(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f ! (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)17 ! b Fe(7)1012 1887 y Fc(write)p 1114 1887 V 13 w(history)s ! Fd(.)s(.)6 b(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) ! g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)17 b Fe(8)p eop %%Page: 16 18 ! 16 17 bop 75 -58 a Fo(16)1324 b(GNU)15 b(History)g(Library)p eop %%Page: -1 19 ! -1 18 bop 1862 -58 a Fo(i)75 183 y Fk(T)-7 b(able)27 ! b(of)f(Con)n(ten)n(ts)75 354 y Fm(1)67 b(Using)22 b(History)h(In)n (teractiv)n(ely)9 b Fb(.)k(.)d(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)h ! (.)f(.)g(.)g(.)h(.)31 b Fm(1)224 423 y Fo(1.1)45 b(History)15 b(Expansion)5 b Fa(.)j(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.) ! f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)19 b Fo(1)374 478 y(1.1.1)44 b(Ev)o(en)o(t)14 b(Designators)e Fa(.)7 b(.)h(.)f(.)h(.)f(.)h(.)f(.)h (.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.) ! f(.)h(.)f(.)h(.)26 b Fo(1)374 532 y(1.1.2)44 b(W)l(ord)15 b(Designators)5 b Fa(.)h(.)i(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.) f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h ! (.)19 b Fo(2)374 587 y(1.1.3)44 b(Mo)q(di\014ers)t Fa(.)8 b(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.) ! f(.)h(.)f(.)19 b Fo(2)75 708 y Fm(2)67 b(Programming)23 b(with)g(GNU)f(History)16 b Fb(.)10 b(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f ! (.)g(.)38 b Fm(5)224 777 y Fo(2.1)45 b(In)o(tro)q(duction)16 b(to)f(History)10 b Fa(.)d(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f (.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.) ! f(.)h(.)f(.)h(.)24 b Fo(5)224 832 y(2.2)45 b(History)15 b(Storage)c Fa(.)d(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f (.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.) ! g(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)26 b Fo(5)224 886 y(2.3)45 b(History)15 b(F)l(unctions)d Fa(.)c(.)f(.)h(.)f(.)h(.)f(.)h (.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.) f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)26 ! b Fo(6)374 941 y(2.3.1)44 b(Initializing)18 b(History)d(and)h(State)e (Managemen)o(t)g Fa(.)7 b(.)h(.)g(.)f(.)h(.)f(.)29 b ! Fo(6)374 996 y(2.3.2)44 b(History)15 b(List)h(Managemen)o(t)d Fa(.)7 b(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.) ! h(.)f(.)h(.)f(.)h(.)f(.)29 b Fo(6)374 1051 y(2.3.3)44 b(Information)15 b(Ab)q(out)g(the)h(History)f(List)c Fa(.)d(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)26 ! b Fo(7)374 1106 y(2.3.4)44 b(Mo)o(ving)15 b(Around)g(the)g(History)g (List)c Fa(.)d(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f ! (.)h(.)25 b Fo(7)374 1160 y(2.3.5)44 b(Searc)o(hing)16 b(the)f(History)g(List)7 b Fa(.)h(.)g(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f (.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)22 ! b Fo(7)374 1215 y(2.3.6)44 b(Managing)15 b(the)g(History)g(File)6 b Fa(.)i(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.) ! f(.)h(.)f(.)h(.)f(.)h(.)20 b Fo(8)374 1270 y(2.3.7)44 b(History)15 b(Expansion)9 b Fa(.)f(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h (.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.) ! h(.)f(.)24 b Fo(8)224 1325 y(2.4)45 b(History)15 b(V)l(ariables)6 ! b Fa(.)j(.)e(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.) ! f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h ! (.)f(.)h(.)f(.)h(.)f(.)21 b Fo(9)224 1380 y(2.5)45 b(History)15 b(Programming)f(Example)7 b Fa(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h (.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)22 ! b Fo(10)75 1501 y Fm(App)r(endix)i(A)67 b(Concept)22 b(Index)17 b Fb(.)10 b(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)h(.)f(.)g(.)g ! (.)h(.)f(.)g(.)38 b Fm(13)75 1636 y(App)r(endix)24 b(B)67 b(F)-6 b(unction)25 b(and)e(V)-6 b(ariable)24 b(Index)16 ! b Fb(.)10 b(.)g(.)g(.)38 b Fm(15)p eop %%Page: -2 20 ! -2 19 bop 75 -58 a Fo(ii)1346 b(GNU)15 b(History)g(Library)p eop %%Trailer --- 820,1655 ---- %%EndSetup %%Page: 1 1 ! 1 0 bop 75 659 a Fq(GNU)33 b(History)f(Library)p 75 709 ! 1800 17 v 960 757 a Fp(Edition)16 b(4.2,)e(for)h Fo(History)f(Library)g ! Fp(V)l(ersion)i(4.2.)1692 811 y(Apr)f(2001)75 2467 y ! Fn(Brian)23 b(F)-6 b(o)n(x,)23 b(F)-6 b(ree)23 b(Soft)n(w)n(are)f(F)-6 ! b(oundation)75 2534 y(Chet)22 b(Ramey)-6 b(,)23 b(Case)e(W)-6 ! b(estern)23 b(Reserv)n(e)f(Univ)n(ersit)n(y)p 75 2570 ! 1800 9 v eop %%Page: 2 2 ! 2 1 bop 75 217 a Fp(This)21 b(do)q(cumen)o(t)g(describ)q(es)h(the)f (GNU)f(History)g(library)l(,)j(a)d(programming)g(to)q(ol)g(that)g(pro)o ! (vides)h(a)75 271 y(consisten)o(t)15 b(user)h(in)o(terface)f(for)g (recalling)i(lines)f(of)f(previously)i(t)o(yp)q(ed)e(input.)75 ! 339 y(Published)i(b)o(y)f(the)f(F)l(ree)g(Soft)o(w)o(are)f(F)l ! (oundation)75 394 y(59)h(T)l(emple)h(Place,)f(Suite)i(330,)75 ! 448 y(Boston,)d(MA)h(02111)f(USA)75 516 y(P)o(ermission)j(is)f(gran)o (ted)g(to)f(mak)o(e)h(and)g(distribute)i(v)o(erbatim)d(copies)i(of)f ! (this)h(man)o(ual)f(pro)o(vided)h(the)75 570 y(cop)o(yrigh)o(t)e (notice)h(and)f(this)h(p)q(ermission)g(notice)g(are)f(preserv)o(ed)h ! (on)f(all)h(copies.)75 638 y(P)o(ermission)c(is)h(gran)o(ted)e(to)g (cop)o(y)h(and)g(distribute)h(mo)q(di\014ed)g(v)o(ersions)f(of)f(this)h ! (man)o(ual)g(under)h(the)f(con-)75 692 y(ditions)k(for)e(v)o(erbatim)h (cop)o(ying,)g(pro)o(vided)h(that)e(the)h(en)o(tire)h(resulting)g ! (deriv)o(ed)g(w)o(ork)e(is)h(distributed)75 747 y(under)h(the)f(terms)g (of)g(a)f(p)q(ermission)j(notice)f(iden)o(tical)h(to)e(this)g(one.)75 ! 814 y(P)o(ermission)i(is)g(gran)o(ted)f(to)g(cop)o(y)h(and)f (distribute)i(translations)f(of)f(this)h(man)o(ual)g(in)o(to)f(another) ! g(lan-)75 869 y(guage,)e(under)h(the)f(ab)q(o)o(v)o(e)g(conditions)i (for)d(mo)q(di\014ed)j(v)o(ersions,)e(except)h(that)f(this)h(p)q ! (ermission)g(notice)75 924 y(ma)o(y)f(b)q(e)i(stated)f(in)h(a)f (translation)g(appro)o(v)o(ed)g(b)o(y)g(the)g(F)l(ree)h(Soft)o(w)o(are) d(F)l(oundation.)75 2661 y(Cop)o(yrigh)o(t)301 2660 y(c)289 ! 2661 y Fm(\015)h Fp(1988-2001)f(F)l(ree)i(Soft)o(w)o(are)f(F)l (oundation,)h(Inc.)p eop %%Page: 1 3 ! 1 2 bop 75 -58 a Fp(Chapter)15 b(1:)k(Using)d(History)f(In)o(teractiv)o ! (ely)1007 b(1)75 149 y Fl(1)41 b(Using)26 b(History)h(In)n(teractiv)n ! (ely)137 289 y Fp(This)17 b(c)o(hapter)g(describ)q(es)h(ho)o(w)e(to)g ! (use)h(the)g Fk(gnu)f Fp(History)g(Library)h(in)o(teractiv)o(ely)l(,)h ! (from)e(a)g(user's)75 344 y(standp)q(oin)o(t.)38 b(It)21 ! b(should)h(b)q(e)g(considered)g(a)f(user's)g(guide.)38 ! b(F)l(or)21 b(information)g(on)g(using)h(the)f Fk(gnu)75 ! 398 y Fp(History)c(Library)h(in)h(y)o(our)e(o)o(wn)g(programs,)f(see)i ! (Chapter)f(2)h([Programming)e(with)i(GNU)f(History],)75 ! 453 y(page)e(5.)75 600 y Fn(1.1)33 b(History)22 b(Expansion)137 ! 704 y Fp(The)c(History)g(library)h(pro)o(vides)f(a)f(history)h (expansion)h(feature)e(that)h(is)g(similar)h(to)e(the)h(history)75 ! 759 y(expansion)12 b(pro)o(vided)g(b)o(y)f Fo(csh)p Fp(.)18 b(This)11 b(section)h(describ)q(es)g(the)g(syn)o(tax)e(used)h(to)g ! (manipulate)h(the)f(history)75 814 y(information.)137 ! 888 y(History)k(expansions)h(in)o(tro)q(duce)h(w)o(ords)d(from)g(the)i (history)f(list)h(in)o(to)f(the)h(input)g(stream,)e(making)75 ! 943 y(it)h(easy)g(to)g(rep)q(eat)g(commands,)g(insert)h(the)f(argumen)o (ts)f(to)h(a)g(previous)h(command)f(in)o(to)g(the)g(curren)o(t)75 ! 998 y(input)h(line,)h(or)d(\014x)i(errors)e(in)i(previous)g(commands)f ! (quic)o(kly)l(.)137 1072 y(History)j(expansion)i(tak)o(es)d(place)i(in) h(t)o(w)o(o)d(parts.)28 b(The)19 b(\014rst)f(is)g(to)g(determine)i ! (whic)o(h)f(line)h(from)75 1127 y(the)h(history)f(list)i(should)g(b)q (e)f(used)g(during)h(substitution.)37 b(The)21 b(second)g(is)g(to)f ! (select)i(p)q(ortions)e(of)75 1182 y(that)15 b(line)i(for)d(inclusion)k (in)o(to)d(the)h(curren)o(t)f(one.)20 b(The)c(line)g(selected)h(from)e ! (the)g(history)g(is)h(called)h(the)75 1237 y Fj(ev)o(en)o(t)p ! Fp(,)c(and)h(the)g(p)q(ortions)g(of)f(that)g(line)i(that)e(are)g(acted) ! h(up)q(on)g(are)f(called)j Fj(w)o(ords)p Fp(.)i(V)l(arious)c ! Fj(mo)q(di\014ers)75 1292 y Fp(are)i(a)o(v)m(ailable)i(to)e(manipulate) i(the)e(selected)i(w)o(ords.)23 b(The)17 b(line)h(is)f(brok)o(en)f(in)o ! (to)h(w)o(ords)e(in)j(the)e(same)75 1346 y(fashion)c(that)e(Bash)i(do)q (es,)g(so)f(that)g(sev)o(eral)g(w)o(ords)g(surrounded)h(b)o(y)f(quotes) ! h(are)f(considered)h(one)g(w)o(ord.)75 1401 y(History)18 b(expansions)h(are)g(in)o(tro)q(duced)g(b)o(y)f(the)h(app)q(earance)g ! (of)f(the)g(history)h(expansion)g(c)o(haracter,)75 1456 ! y(whic)o(h)d(is)g(`)p Fo(!)p Fp(')e(b)o(y)h(default.)75 ! 1583 y Fi(1.1.1)30 b(Ev)n(en)n(t)21 b(Designators)137 ! 1687 y Fp(An)16 b(ev)o(en)o(t)f(designator)g(is)g(a)g(reference)h(to)f (a)g(command)g(line)i(en)o(try)d(in)i(the)g(history)f(list.)75 ! 1777 y Fo(!)216 b Fp(Start)16 b(a)g(history)h(substitution,)g(except)h (when)f(follo)o(w)o(ed)g(b)o(y)f(a)h(space,)g(tab,)f(the)h(end)g(of)315 ! 1832 y(the)e(line,)i(`)p Fo(=)p Fp(')d(or)h(`)p Fo(\()p ! Fp('.)75 1919 y Fo(!)p Fj(n)191 b Fp(Refer)15 b(to)f(command)h(line)i ! Fj(n)p Fp(.)75 2006 y Fo(!-)p Fj(n)167 b Fp(Refer)15 ! b(to)f(the)i(command)f Fj(n)g Fp(lines)i(bac)o(k.)75 ! 2094 y Fo(!!)192 b Fp(Refer)15 b(to)f(the)i(previous)f(command.)20 ! b(This)c(is)g(a)f(synon)o(ym)g(for)f(`)p Fo(!-1)p Fp('.)75 ! 2181 y Fo(!)p Fj(string)102 b Fp(Refer)15 b(to)f(the)i(most)e(recen)o ! (t)h(command)g(starting)g(with)g Fj(string)p Fp(.)75 ! 2268 y Fo(!?)p Fj(string)t Fo([?])315 2323 y Fp(Refer)h(to)g(the)h (most)f(recen)o(t)h(command)g(con)o(taining)g Fj(string)p ! Fp(.)25 b(The)17 b(trailing)g(`)p Fo(?)p Fp(')f(ma)o(y)g(b)q(e)315 ! 2377 y(omitted)f(if)h(the)f Fj(string)k Fp(is)d(follo)o(w)o(ed)f ! (immediately)i(b)o(y)e(a)g(newline.)75 2464 y Fo(^)p ! Fj(string1)t Fo(^)p Fj(string2)t Fo(^)315 2519 y Fp(Quic)o(k)i ! (Substitution.)23 b(Rep)q(eat)16 b(the)g(last)f(command,)h(replacing)h ! Fj(string1)i Fp(with)e Fj(string2)p Fp(.)315 2574 y(Equiv)m(alen)o(t)g ! (to)d Fo(!!:s/)p Fj(string1)t Fo(/)p Fj(string2)t Fo(/)p ! Fp(.)75 2661 y Fo(!#)192 b Fp(The)15 b(en)o(tire)h(command)f(line)i(t)o (yp)q(ed)f(so)e(far.)p eop %%Page: 2 4 ! 2 3 bop 75 -58 a Fp(2)1347 b(GNU)15 b(History)g(Library)75 ! 149 y Fi(1.1.2)30 b(W)-5 b(ord)20 b(Designators)137 247 ! y Fp(W)l(ord)d(designators)g(are)g(used)h(to)f(select)h(desired)h(w)o ! (ords)d(from)h(the)g(ev)o(en)o(t.)26 b(A)18 b(`)p Fo(:)p ! Fp(')e(separates)h(the)75 302 y(ev)o(en)o(t)j(sp)q(eci\014cation)h (from)e(the)h(w)o(ord)f(designator.)34 b(It)20 b(ma)o(y)f(b)q(e)h ! (omitted)g(if)g(the)g(w)o(ord)f(designator)75 357 y(b)q(egins)f(with)g ! (a)e(`)p Fo(^)p Fp(',)h(`)p Fo($)p Fp(',)f(`)p Fo(*)p ! Fp(',)g(`)p Fo(-)p Fp(',)g(or)h(`)p Fo(\045)p Fp('.)24 b(W)l(ords)17 b(are)g(n)o(um)o(b)q(ered)g(from)g(the)g(b)q(eginning)i ! (of)e(the)g(line,)75 411 y(with)j(the)g(\014rst)f(w)o(ord)h(b)q(eing)h (denoted)f(b)o(y)g(0)f(\(zero\).)33 b(W)l(ords)20 b(are)f(inserted)i ! (in)o(to)f(the)g(curren)o(t)f(line)75 466 y(separated)c(b)o(y)g(single) ! i(spaces.)137 535 y(F)l(or)e(example,)75 616 y Fo(!!)192 ! b Fp(designates)18 b(the)g(preceding)i(command.)28 b(When)18 b(y)o(ou)g(t)o(yp)q(e)g(this,)h(the)f(preceding)h(com-)315 ! 671 y(mand)c(is)h(rep)q(eated)g(in)g(toto.)75 752 y Fo(!!:$)144 ! b Fp(designates)12 b(the)f(last)g(argumen)o(t)f(of)h(the)g(preceding)i (command.)19 b(This)11 b(ma)o(y)g(b)q(e)h(shortened)315 ! 807 y(to)j Fo(!$)p Fp(.)75 887 y Fo(!fi:2)120 b Fp(designates)15 b(the)g(second)g(argumen)o(t)f(of)g(the)h(most)f(recen)o(t)g(command)h ! (starting)f(with)h(the)315 942 y(letters)g Fo(fi)p Fp(.)137 ! 1024 y(Here)h(are)f(the)g(w)o(ord)f(designators:)75 1105 ! y Fo(0)h(\(zero\))57 b Fp(The)15 b Fo(0)p Fp(th)g(w)o(ord.)20 b(F)l(or)14 b(man)o(y)h(applications,)h(this)g(is)g(the)f(command)g(w)o ! (ord.)75 1186 y Fj(n)215 b Fp(The)15 b Fj(n)p Fp(th)h(w)o(ord.)75 ! 1267 y Fo(^)216 b Fp(The)15 b(\014rst)g(argumen)o(t;)f(that)h(is,)g(w)o ! (ord)g(1.)75 1348 y Fo($)216 b Fp(The)15 b(last)h(argumen)o(t.)75 ! 1429 y Fo(\045)216 b Fp(The)15 b(w)o(ord)g(matc)o(hed)g(b)o(y)g(the)g ! (most)g(recen)o(t)g(`)p Fo(?)p Fj(string)t Fo(?)p Fp(')f(searc)o(h.)75 ! 1510 y Fj(x)p Fo(-)p Fj(y)168 b Fp(A)15 b(range)g(of)g(w)o(ords;)f(`)p ! Fo(-)p Fj(y)t Fp(')g(abbreviates)i(`)p Fo(0-)p Fj(y)t ! Fp('.)75 1591 y Fo(*)216 b Fp(All)15 b(of)f(the)f(w)o(ords,)g(except)i ! (the)f Fo(0)p Fp(th.)19 b(This)14 b(is)h(a)e(synon)o(ym)h(for)f(`)p ! Fo(1-$)p Fp('.)18 b(It)c(is)g(not)g(an)g(error)315 1645 ! y(to)g(use)h(`)p Fo(*)p Fp(')f(if)i(there)e(is)i(just)e(one)h(w)o(ord)f (in)i(the)f(ev)o(en)o(t;)f(the)h(empt)o(y)g(string)g(is)g(returned)g ! (in)315 1700 y(that)f(case.)75 1781 y Fj(x)s Fo(*)189 ! b Fp(Abbreviates)16 b(`)p Fj(x)p Fo(-$)p Fp(')75 1862 ! y Fj(x)p Fo(-)192 b Fp(Abbreviates)16 b(`)p Fj(x)p Fo(-$)p ! Fp(')e(lik)o(e)i(`)p Fj(x)s Fo(*)p Fp(',)e(but)i(omits)f(the)g(last)g ! (w)o(ord.)137 1943 y(If)i(a)g(w)o(ord)f(designator)h(is)h(supplied)h (without)e(an)g(ev)o(en)o(t)f(sp)q(eci\014cation,)j(the)e(previous)h ! (command)75 1998 y(is)e(used)f(as)g(the)h(ev)o(en)o(t.)75 ! 2113 y Fi(1.1.3)30 b(Mo)r(di\014ers)137 2210 y Fp(After)10 b(the)h(optional)g(w)o(ord)e(designator,)i(y)o(ou)f(can)h(add)f(a)g (sequence)i(of)e(one)g(or)g(more)g(of)g(the)g(follo)o(wing)75 ! 2265 y(mo)q(di\014ers,)16 b(eac)o(h)f(preceded)i(b)o(y)e(a)g(`)p ! Fo(:)p Fp('.)75 2346 y Fo(h)216 b Fp(Remo)o(v)o(e)14 ! b(a)h(trailing)h(pathname)f(comp)q(onen)o(t,)g(lea)o(ving)h(only)g(the) ! f(head.)75 2427 y Fo(t)216 b Fp(Remo)o(v)o(e)14 b(all)i(leading)h (pathname)e(comp)q(onen)o(ts,)g(lea)o(ving)h(the)f(tail.)75 ! 2508 y Fo(r)216 b Fp(Remo)o(v)o(e)14 b(a)h(trailing)h(su\016x)f(of)g ! (the)g(form)g(`)p Fo(.)p Fj(su\016x)s Fp(',)f(lea)o(ving)i(the)f ! (basename.)75 2589 y Fo(e)216 b Fp(Remo)o(v)o(e)14 b(all)i(but)g(the)f ! (trailing)h(su\016x.)75 2670 y Fo(p)216 b Fp(Prin)o(t)15 b(the)g(new)h(command)f(but)g(do)g(not)g(execute)h(it.)p eop %%Page: 3 5 ! 3 4 bop 75 -58 a Fp(Chapter)15 b(1:)k(Using)d(History)f(In)o(teractiv)o ! (ely)1007 b(3)75 149 y Fo(s/)p Fj(old)r Fo(/)p Fj(new)t ! Fo(/)315 204 y Fp(Substitute)17 b Fj(new)j Fp(for)c(the)h(\014rst)e(o)q ! (ccurrence)j(of)e Fj(old)i Fp(in)f(the)g(ev)o(en)o(t)f(line.)25 ! b(An)o(y)16 b(delimiter)315 259 y(ma)o(y)c(b)q(e)h(used)g(in)g(place)g ! (of)f(`)p Fo(/)p Fp('.)18 b(The)13 b(delimiter)h(ma)o(y)e(b)q(e)h ! (quoted)f(in)i Fj(old)g Fp(and)f Fj(new)k Fp(with)12 ! b(a)315 314 y(single)j(bac)o(kslash.)20 b(If)15 b(`)p ! Fo(&)p Fp(')e(app)q(ears)h(in)h Fj(new)p Fp(,)f(it)g(is)h(replaced)g(b) ! o(y)f Fj(old)p Fp(.)20 b(A)14 b(single)i(bac)o(kslash)315 ! 369 y(will)j(quote)e(the)h(`)p Fo(&)p Fp('.)25 b(The)17 b(\014nal)i(delimiter)g(is)f(optional)g(if)f(it)h(is)g(the)f(last)g(c)o ! (haracter)g(on)315 423 y(the)e(input)h(line.)75 503 y ! Fo(&)216 b Fp(Rep)q(eat)15 b(the)g(previous)h(substitution.)75 ! 583 y Fo(g)216 b Fp(Cause)19 b(c)o(hanges)h(to)e(b)q(e)i(applied)h(o)o (v)o(er)e(the)g(en)o(tire)h(ev)o(en)o(t)f(line.)34 b(Used)20 ! b(in)g(conjunction)315 638 y(with)c(`)p Fo(s)p Fp(',)d(as)i(in)h ! Fo(gs/)p Fj(old)r Fo(/)p Fj(new)t Fo(/)p Fp(,)f(or)g(with)g(`)p ! Fo(&)p Fp('.)p eop %%Page: 4 6 ! 4 5 bop 75 -58 a Fp(4)1347 b(GNU)15 b(History)g(Library)p eop %%Page: 5 7 ! 5 6 bop 75 -58 a Fp(Chapter)15 b(2:)k(Programming)c(with)g(GNU)g ! (History)889 b(5)75 149 y Fl(2)41 b(Programming)28 b(with)e(GNU)i ! (History)137 269 y Fp(This)17 b(c)o(hapter)f(describ)q(es)i(ho)o(w)e ! (to)f(in)o(terface)i(programs)e(that)g(y)o(ou)h(write)g(with)h(the)f ! Fk(gnu)g Fp(History)75 324 y(Library)l(.)24 b(It)17 b(should)g(b)q(e)g (considered)h(a)e(tec)o(hnical)i(guide.)25 b(F)l(or)15 b(information)i(on)f(the)h(in)o(teractiv)o(e)g(use)75 ! 379 y(of)e Fk(gnu)g Fp(History)l(,)g(see)g(Chapter)g(1)g([Using)g ! (History)g(In)o(teractiv)o(ely],)h(page)f(1.)75 509 y ! Fn(2.1)33 b(In)n(tro)r(duction)24 b(to)e(History)137 ! 607 y Fp(Man)o(y)11 b(programs)f(read)h(input)i(from)d(the)i(user)f(a)g ! (line)i(at)e(a)g(time.)19 b(The)12 b Fk(gnu)f Fp(History)g(library)h ! (is)g(able)75 661 y(to)i(k)o(eep)g(trac)o(k)g(of)g(those)g(lines,)i ! (asso)q(ciate)e(arbitrary)g(data)g(with)g(eac)o(h)h(line,)h(and)e ! (utilize)j(information)75 716 y(from)d(previous)i(lines)h(in)f(comp)q ! (osing)g(new)f(ones.)137 784 y(The)f(programmer)f(using)h(the)g ! (History)g(library)g(has)g(a)o(v)m(ailable)h(functions)g(for)e(remem)o ! (b)q(ering)h(lines)75 839 y(on)c(a)g(history)h(list,)g(asso)q(ciating)g ! (arbitrary)f(data)f(with)i(a)f(line,)j(remo)o(ving)d(lines)i(from)d ! (the)i(list,)h(searc)o(hing)75 894 y(through)17 b(the)h(list)g(for)f(a) ! h(line)h(con)o(taining)f(an)g(arbitrary)f(text)g(string,)h(and)g ! (referencing)h(an)o(y)e(line)i(in)75 949 y(the)c(list)i(directly)l(.)22 ! b(In)16 b(addition,)g(a)f(history)g Fj(expansion)h Fp(function)h(is)e (a)o(v)m(ailable)i(whic)o(h)g(pro)o(vides)f(for)e(a)75 ! 1003 y(consisten)o(t)h(user)h(in)o(terface)f(across)g(di\013eren)o(t)g ! (programs.)137 1072 y(The)f(user)h(using)f(programs)f(written)h(with)g (the)g(History)g(library)h(has)f(the)g(b)q(ene\014t)h(of)e(a)h ! (consisten)o(t)75 1126 y(user)20 b(in)o(terface)f(with)h(a)f(set)h(of)f (w)o(ell-kno)o(wn)h(commands)g(for)e(manipulating)k(the)d(text)g(of)g ! (previous)75 1181 y(lines)c(and)f(using)h(that)e(text)g(in)i(new)f (commands.)19 b(The)14 b(basic)h(history)e(manipulation)j(commands)d ! (are)75 1236 y(similar)j(to)f(the)g(history)g(substitution)h(pro)o ! (vided)g(b)o(y)g Fo(csh)p Fp(.)137 1304 y(If)f(the)g(programmer)f ! (desires,)h(he)g(can)g(use)g(the)g(Readline)h(library)l(,)g(whic)o(h)f ! (includes)j(some)c(history)75 1359 y(manipulation)j(b)o(y)e(default,)g (and)h(has)f(the)g(added)h(adv)m(an)o(tage)f(of)f(command)h(line)i ! (editing.)137 1427 y(Before)i(declaring)i(an)o(y)d(functions)i(using)g (an)o(y)f(functionalit)o(y)h(the)f(History)g(library)h(pro)o(vides)f ! (in)75 1482 y(other)14 b(co)q(de,)h(an)f(application)i(writer)e(should) ! i(include)g(the)f(\014le)g Fo( )d ! Fp(in)j(an)o(y)f(\014le)75 1537 y(that)d(uses)h(the)h(History)e (library's)i(features.)18 b(It)12 b(supplies)i(extern)e(declarations)h ! (for)e(all)i(of)f(the)g(library's)75 1591 y(public)17 b(functions)f(and)g(v)m(ariables,)g(and)f(declares)h(all)g(of)f(the)h ! (public)h(data)d(structures.)75 1722 y Fn(2.2)33 b(History)22 ! b(Storage)137 1819 y Fp(The)16 b(history)f(list)h(is)g(an)f(arra)o(y)f (of)g(history)i(en)o(tries.)k(A)15 b(history)g(en)o(try)g(is)h ! (declared)g(as)f(follo)o(ws:)195 1885 y Fo(typedef)23 ! b(void)g(*histdata_t;)195 1988 y(typedef)g(struct)g(_hist_entry)f({)243 ! 2040 y(char)h(*line;)243 2092 y(histdata_t)f(data;)195 ! 2144 y(})i(HIST_ENTRY;)137 2212 y Fp(The)16 b(history)f(list)h(itself)g ! (migh)o(t)f(therefore)g(b)q(e)h(declared)g(as)195 2277 ! y Fo(HIST_ENTRY)22 b(**the_history_list;)137 2345 y Fp(The)16 ! b(state)e(of)h(the)g(History)g(library)h(is)g(encapsulated)g(in)o(to)f ! (a)g(single)i(structure:)195 2411 y Fo(/*)219 2462 y(*)24 ! b(A)f(structure)g(used)g(to)h(pass)f(around)g(the)h(current)f(state)g ! (of)g(the)h(history.)219 2514 y(*/)195 2566 y(typedef)f(struct)g ! (_hist_state)f({)243 2618 y(HIST_ENTRY)g(**entries;)h(/*)g(Pointer)g ! (to)h(the)f(entries)g(themselves.)g(*/)243 2670 y(int)g(offset;)262 ! b(/*)23 b(The)h(location)f(pointer)f(within)h(this)h(array.)f(*/)p ! eop %%Page: 6 8 ! 6 7 bop 75 -58 a Fp(6)1347 b(GNU)15 b(History)g(Library)243 ! 149 y Fo(int)23 b(length;)262 b(/*)23 b(Number)g(of)h(elements)f ! (within)g(this)g(array.)g(*/)243 201 y(int)g(size;)310 ! b(/*)23 b(Number)g(of)h(slots)f(allocated)g(to)g(this)h(array.)f(*/)243 ! 253 y(int)g(flags;)195 305 y(})h(HISTORY_STATE;)137 372 ! y Fp(If)16 b(the)f(\015ags)g(mem)o(b)q(er)g(includes)j ! Fo(HS_STIFLED)p Fp(,)13 b(the)i(history)h(has)f(b)q(een)h(sti\015ed.)75 ! 498 y Fn(2.3)33 b(History)22 b(F)-6 b(unctions)137 593 ! y Fp(This)13 b(section)g(describ)q(es)h(the)e(calling)i(sequence)g(for) ! e(the)g(v)m(arious)h(functions)g(exp)q(orted)f(b)o(y)h(the)f ! Fk(gnu)75 648 y Fp(History)j(library)l(.)75 758 y Fi(2.3.1)30 ! b(Initializing)20 b(History)h(and)f(State)g(Managemen)n(t)137 ! 853 y Fp(This)e(section)g(describ)q(es)h(functions)f(used)g(to)e ! (initialize)21 b(and)c(manage)g(the)g(state)g(of)g(the)g(History)75 ! 908 y(library)f(when)g(y)o(ou)f(w)o(an)o(t)f(to)g(use)i(the)f(history)g ! (functions)h(in)g(y)o(our)f(program.)1762 1021 y(F)l(unction)-1861 ! b Fh(void)20 b Fg(using)p 333 1021 18 3 v 20 w(history)j ! Ff(\()p Fo(void)p Ff(\))195 1075 y Fp(Begin)e(a)f(session)g(in)h(whic)o ! (h)g(the)f(history)g(functions)g(migh)o(t)g(b)q(e)h(used.)34 ! b(This)21 b(initializes)i(the)195 1130 y(in)o(teractiv)o(e)16 ! b(v)m(ariables.)1762 1243 y(F)l(unction)-1861 b Fh(HISTORY_STATE)21 ! b(*)e Fg(history)p 657 1243 V 21 w(get)p 755 1243 V 21 ! w(history)p 951 1243 V 21 w(state)j Ff(\()p Fo(void)p ! Ff(\))195 1298 y Fp(Return)15 b(a)g(structure)g(describing)i(the)e ! (curren)o(t)g(state)f(of)h(the)g(input)i(history)l(.)1762 ! 1411 y(F)l(unction)-1861 b Fh(void)20 b Fg(history)p ! 377 1411 V 20 w(set)p 468 1411 V 21 w(history)p 664 1411 ! V 21 w(state)j Ff(\()p Fo(HISTORY_STATE)13 b(*state)p ! Ff(\))195 1466 y Fp(Set)i(the)h(state)e(of)h(the)g(history)g(list)h ! (according)g(to)e Fj(state)p Fp(.)75 1575 y Fi(2.3.2)30 ! b(History)20 b(List)h(Managemen)n(t)137 1671 y Fp(These)11 b(functions)h(manage)e(individual)k(en)o(tries)d(on)g(the)g(history)f ! (list,)i(or)f(set)f(parameters)g(managing)75 1725 y(the)15 ! b(list)h(itself.)1762 1838 y(F)l(unction)-1861 b Fh(void)20 ! b Fg(add)p 294 1838 V 20 w(history)j Ff(\()p Fo(const)14 ! b(char)g(*string)p Ff(\))195 1893 y Fp(Place)i Fj(string)i ! Fp(at)d(the)g(end)h(of)e(the)h(history)g(list.)21 b(The)15 ! b(asso)q(ciated)g(data)g(\014eld)h(\(if)f(an)o(y\))f(is)i(set)f(to)195 ! 1948 y Fo(NULL)p Fp(.)1762 2061 y(F)l(unction)-1861 b ! Fh(HIST_ENTRY)21 b(*)e Fg(remo)n(v)n(e)p 584 2061 V 20 ! w(history)k Ff(\()p Fo(int)14 b(which)p Ff(\))195 2115 ! y Fp(Remo)o(v)o(e)22 b(history)g(en)o(try)h(at)f(o\013set)g ! Fj(whic)o(h)h Fp(from)f(the)h(history)l(.)43 b(The)23 ! b(remo)o(v)o(ed)f(elemen)o(t)h(is)195 2170 y(returned)16 ! b(so)e(y)o(ou)h(can)h(free)f(the)g(line,)i(data,)d(and)h(con)o(taining) ! h(structure.)1762 2283 y(F)l(unction)-1861 b Fh(HIST_ENTRY)21 ! b(*)e Fg(replace)p 580 2283 V 22 w(history)p 777 2283 ! V 20 w(en)n(try)24 b Ff(\()p Fo(int)14 b(which,)g(const)h(char)283 ! 2338 y(*line,)f(histdata_t)g(data)p Ff(\))195 2393 y ! Fp(Mak)o(e)f(the)h(history)g(en)o(try)f(at)g(o\013set)g ! Fj(whic)o(h)i Fp(ha)o(v)o(e)e Fj(line)18 b Fp(and)c Fj(data)p ! Fp(.)19 b(This)14 b(returns)g(the)g(old)g(en)o(try)195 ! 2448 y(so)19 b(y)o(ou)f(can)i(disp)q(ose)g(of)e(the)i(data.)30 ! b(In)20 b(the)f(case)g(of)g(an)g(in)o(v)m(alid)i Fj(whic)o(h)p ! Fp(,)g(a)d Fo(NULL)h Fp(p)q(oin)o(ter)g(is)195 2502 y(returned.)1762 ! 2615 y(F)l(unction)-1861 b Fh(void)20 b Fg(clear)p 320 ! 2615 V 21 w(history)j Ff(\()p Fo(void)p Ff(\))195 2670 ! y Fp(Clear)15 b(the)h(history)f(list)h(b)o(y)f(deleting)i(all)f(the)f ! (en)o(tries.)p eop %%Page: 7 9 ! 7 8 bop 75 -58 a Fp(Chapter)15 b(2:)k(Programming)c(with)g(GNU)g ! (History)889 b(7)1762 149 y(F)l(unction)-1861 b Fh(void)20 ! b Fg(sti\015e)p 320 149 18 3 v 21 w(history)j Ff(\()p ! Fo(int)14 b(max)p Ff(\))195 204 y Fp(Sti\015e)i(the)f(history)h(list,)f ! (remem)o(b)q(ering)h(only)g(the)f(last)g Fj(max)j Fp(en)o(tries.)1762 ! 307 y(F)l(unction)-1861 b Fh(int)20 b Fg(unsti\015e)p ! 358 307 V 21 w(history)i Ff(\()p Fo(void)p Ff(\))195 ! 361 y Fp(Stop)c(sti\015ing)i(the)e(history)l(.)29 b(This)19 ! b(returns)f(the)h(previous)g(amoun)o(t)e(the)i(history)f(w)o(as)f ! (sti\015ed.)195 416 y(The)e(v)m(alue)i(is)f(p)q(ositiv)o(e)g(if)f(the)h ! (history)f(w)o(as)f(sti\015ed,)i(negativ)o(e)f(if)h(it)f(w)o(asn't.) ! 1762 518 y(F)l(unction)-1861 b Fh(int)20 b Fg(history)p ! 351 518 V 20 w(is)p 409 518 V 21 w(sti\015ed)k Ff(\()p ! Fo(void)p Ff(\))195 573 y Fp(Returns)15 b(non-zero)g(if)h(the)f ! (history)g(is)h(sti\015ed,)g(zero)f(if)g(it)h(is)g(not.)75 ! 676 y Fi(2.3.3)30 b(Information)19 b(Ab)r(out)i(the)f(History)h(List) ! 137 770 y Fp(These)13 b(functions)h(return)f(information)g(ab)q(out)f ! (the)h(en)o(tire)h(history)e(list)i(or)e(individual)k(list)e(en)o ! (tries.)1762 872 y(F)l(unction)-1861 b Fh(HIST_ENTRY)21 ! b(**)e Fg(history)p 605 872 V 21 w(list)24 b Ff(\()p ! Fo(void)p Ff(\))195 927 y Fp(Return)15 b(a)g Fo(NULL)f ! Fp(terminated)i(arra)o(y)e(of)h Fo(HIST_ENTRY)f(*)h Fp(whic)o(h)h(is)f ! (the)h(curren)o(t)f(input)h(history)l(.)195 982 y(Elemen)o(t)g(0)f(of)f ! (this)i(list)g(is)g(the)f(b)q(eginning)i(of)e(time.)20 ! b(If)c(there)f(is)h(no)f(history)l(,)g(return)g Fo(NULL)p ! Fp(.)1762 1084 y(F)l(unction)-1861 b Fh(int)20 b Fg(where)p ! 325 1084 V 20 w(history)j Ff(\()p Fo(void)p Ff(\))195 ! 1139 y Fp(Returns)15 b(the)g(o\013set)f(of)h(the)g(curren)o(t)g ! (history)g(elemen)o(t.)1762 1241 y(F)l(unction)-1861 ! b Fh(HIST_ENTRY)21 b(*)e Fg(curren)n(t)p 587 1241 V 21 ! w(history)k Ff(\()p Fo(void)p Ff(\))195 1296 y Fp(Return)12 ! b(the)h(history)f(en)o(try)g(at)g(the)g(curren)o(t)h(p)q(osition,)g(as) ! f(determined)i(b)o(y)e Fo(where_history\(\))p Fp(.)195 ! 1350 y(If)j(there)h(is)f(no)h(en)o(try)e(there,)h(return)g(a)g ! Fo(NULL)g Fp(p)q(oin)o(ter.)1762 1453 y(F)l(unction)-1861 ! b Fh(HIST_ENTRY)21 b(*)e Fg(history)p 579 1453 V 21 w(get)j ! Ff(\()p Fo(int)15 b(offset)p Ff(\))195 1508 y Fp(Return)20 ! b(the)h(history)g(en)o(try)f(at)h(p)q(osition)g Fj(o\013set)p ! Fp(,)g(starting)f(from)g Fo(history_base)f Fp(\(see)i(Sec-)195 ! 1562 y(tion)15 b(2.4)f([History)g(V)l(ariables],)h(page)g(10\).)j(If)d ! (there)g(is)g(no)g(en)o(try)f(there,)h(or)f(if)h Fj(o\013set)g ! Fp(is)g(greater)195 1617 y(than)g(the)g(history)g(length,)h(return)f(a) ! g Fo(NULL)g Fp(p)q(oin)o(ter.)1762 1719 y(F)l(unction)-1861 ! b Fh(int)20 b Fg(history)p 351 1719 V 20 w(total)p 487 ! 1719 V 22 w(b)n(ytes)j Ff(\()p Fo(void)p Ff(\))195 1774 ! y Fp(Return)13 b(the)h(n)o(um)o(b)q(er)g(of)g(b)o(ytes)f(that)g(the)h ! (primary)g(history)g(en)o(tries)g(are)g(using.)20 b(This)14 ! b(function)195 1829 y(returns)h(the)g(sum)h(of)e(the)i(lengths)f(of)g ! (all)h(the)g(lines)g(in)g(the)g(history)l(.)75 1932 y Fi(2.3.4)30 b(Mo)n(ving)21 b(Around)f(the)h(History)g(List)137 ! 2026 y Fp(These)16 b(functions)g(allo)o(w)f(the)g(curren)o(t)h(index)g (in)o(to)f(the)h(history)f(list)h(to)e(b)q(e)i(set)f(or)g(c)o(hanged.) ! 1762 2128 y(F)l(unction)-1861 b Fh(int)20 b Fg(history)p ! 351 2128 V 20 w(set)p 442 2128 V 21 w(p)r(os)h Ff(\()p ! Fo(int)15 b(pos)p Ff(\))195 2183 y Fp(Set)j(the)h(curren)o(t)f(history) ! g(o\013set)g(to)f Fj(p)q(os)p Fp(,)i(an)f(absolute)h(index)h(in)o(to)e ! (the)g(list.)30 b(Returns)18 b(1)g(on)195 2237 y(success,)d(0)g(if)h ! Fj(p)q(os)h Fp(is)f(less)g(than)f(zero)g(or)g(greater)f(than)h(the)g(n) ! o(um)o(b)q(er)h(of)e(history)i(en)o(tries.)1762 2340 ! y(F)l(unction)-1861 b Fh(HIST_ENTRY)21 b(*)e Fg(previous)p ! 615 2340 V 20 w(history)k Ff(\()p Fo(void)p Ff(\))195 ! 2394 y Fp(Bac)o(k)14 b(up)h(the)g(curren)o(t)f(history)g(o\013set)g(to) ! f(the)i(previous)g(history)f(en)o(try)l(,)g(and)h(return)f(a)g(p)q(oin) ! o(ter)195 2449 y(to)h(that)f(en)o(try)l(.)20 b(If)15 ! b(there)g(is)h(no)f(previous)h(en)o(try)l(,)f(return)g(a)g ! Fo(NULL)g Fp(p)q(oin)o(ter.)1762 2552 y(F)l(unction)-1861 ! b Fh(HIST_ENTRY)21 b(*)e Fg(next)p 514 2552 V 21 w(history)k ! Ff(\()p Fo(void)p Ff(\))195 2606 y Fp(Mo)o(v)o(e)17 b(the)h(curren)o(t) ! f(history)h(o\013set)f(forw)o(ard)f(to)h(the)h(next)g(history)g(en)o ! (try)l(,)g(and)g(return)f(the)h(a)195 2661 y(p)q(oin)o(ter)e(to)e(that) ! h(en)o(try)l(.)k(If)d(there)f(is)h(no)f(next)g(en)o(try)l(,)g(return)g ! (a)g Fo(NULL)g Fp(p)q(oin)o(ter.)p eop %%Page: 8 10 ! 8 9 bop 75 -58 a Fp(8)1347 b(GNU)15 b(History)g(Library)75 ! 149 y Fi(2.3.5)30 b(Searc)n(hing)21 b(the)f(History)h(List)137 ! 245 y Fp(These)14 b(functions)g(allo)o(w)g(searc)o(hing)g(of)e(the)i ! (history)f(list)h(for)f(en)o(tries)h(con)o(taining)g(a)f(sp)q(eci\014c) ! i(string.)75 300 y(Searc)o(hing)f(ma)o(y)g(b)q(e)g(p)q(erformed)g(b)q ! (oth)g(forw)o(ard)e(and)i(bac)o(kw)o(ard)f(from)g(the)h(curren)o(t)g ! (history)f(p)q(osition.)75 355 y(The)j(searc)o(h)f(ma)o(y)g(b)q(e)i ! Fj(anc)o(hored)p Fp(,)e(meaning)h(that)f(the)h(string)g(m)o(ust)f(matc) ! o(h)g(at)g(the)h(b)q(eginning)i(of)d(the)75 410 y(history)g(en)o(try)l ! (.)1762 524 y(F)l(unction)-1861 b Fh(int)20 b Fg(history)p ! 351 524 18 3 v 20 w(searc)n(h)j Ff(\()p Fo(const)14 b(char)h(*string,)f ! (int)h(direction)p Ff(\))195 578 y Fp(Searc)o(h)g(the)f(history)g(for)g ! Fj(string)p Fp(,)g(starting)g(at)g(the)h(curren)o(t)f(history)g ! (o\013set.)19 b(If)c Fj(direction)g Fp(is)g(less)195 ! 633 y(than)20 b(0,)g(then)h(the)f(searc)o(h)f(is)i(through)f(previous)g ! (en)o(tries,)i(otherwise)e(through)f(subsequen)o(t)195 ! 688 y(en)o(tries.)h(If)c Fj(string)j Fp(is)d(found,)f(then)g(the)h ! (curren)o(t)f(history)g(index)h(is)g(set)f(to)g(that)f(history)h(en)o ! (try)l(,)195 743 y(and)i(the)g(v)m(alue)h(returned)f(is)g(the)g ! (o\013set)e(in)j(the)f(line)h(of)e(the)h(en)o(try)g(where)g ! Fj(string)j Fp(w)o(as)c(found.)195 798 y(Otherwise,)g(nothing)f(is)h(c) ! o(hanged,)f(and)h(a)e(-1)h(is)h(returned.)1762 912 y(F)l(unction)-1861 ! b Fh(int)20 b Fg(history)p 351 912 V 20 w(searc)n(h)p ! 527 912 V 21 w(pre\014x)i Ff(\()p Fo(const)14 b(char)h(*string,)f(int)h ! (direction)p Ff(\))195 966 y Fp(Searc)o(h)20 b(the)h(history)f(for)g ! Fj(string)p Fp(,)h(starting)e(at)h(the)g(curren)o(t)h(history)f ! (o\013set.)34 b(The)20 b(searc)o(h)g(is)195 1021 y(anc)o(hored:)g(matc) ! o(hing)14 b(lines)j(m)o(ust)d(b)q(egin)i(with)f Fj(string)p ! Fp(.)20 b(If)15 b Fj(direction)h Fp(is)f(less)g(than)g(0,)f(then)h(the) ! 195 1076 y(searc)o(h)g(is)i(through)e(previous)h(en)o(tries,)g ! (otherwise)g(through)f(subsequen)o(t)h(en)o(tries.)22 ! b(If)16 b Fj(string)j Fp(is)195 1131 y(found,)e(then)g(the)f(curren)o ! (t)h(history)f(index)i(is)f(set)f(to)g(that)g(en)o(try)l(,)g(and)h(the) ! f(return)h(v)m(alue)h(is)f(0.)195 1186 y(Otherwise,)f(nothing)f(is)h(c) ! o(hanged,)f(and)h(a)e(-1)h(is)h(returned.)1762 1300 y(F)l(unction)-1861 ! b Fh(int)20 b Fg(history)p 351 1300 V 20 w(searc)n(h)p ! 527 1300 V 21 w(p)r(os)h Ff(\()p Fo(const)14 b(char)h(*string,)f(int)h ! (direction,)f(int)283 1355 y(pos)p Ff(\))195 1409 y Fp(Searc)o(h)j(for) ! g Fj(string)k Fp(in)d(the)f(history)g(list,)h(starting)e(at)h ! Fj(p)q(os)p Fp(,)g(an)g(absolute)h(index)g(in)o(to)f(the)h(list.)195 ! 1464 y(If)g Fj(direction)i Fp(is)e(negativ)o(e,)h(the)f(searc)o(h)g ! (pro)q(ceeds)g(bac)o(kw)o(ard)g(from)f Fj(p)q(os)p Fp(,)h(otherwise)h ! (forw)o(ard.)195 1519 y(Returns)j(the)g(absolute)g(index)h(of)f(the)g ! (history)g(elemen)o(t)h(where)f Fj(string)k Fp(w)o(as)21 ! b(found,)j(or)d(-1)195 1574 y(otherwise.)75 1684 y Fi(2.3.6)30 ! b(Managing)20 b(the)g(History)h(File)137 1780 y Fp(The)16 ! b(History)g(library)h(can)e(read)h(the)g(history)g(from)f(and)h(write)g ! (it)g(to)f(a)h(\014le.)22 b(This)17 b(section)f(do)q(cu-)75 ! 1835 y(men)o(ts)f(the)g(functions)h(for)f(managing)g(a)g(history)g ! (\014le.)1762 1949 y(F)l(unction)-1861 b Fh(int)20 b ! Fg(read)p 286 1949 V 20 w(history)i Ff(\()p Fo(const)15 ! b(char)f(*filename)p Ff(\))195 2003 y Fp(Add)h(the)g(con)o(ten)o(ts)f ! (of)h Fj(\014lename)j Fp(to)c(the)h(history)g(list,)g(a)g(line)h(at)f ! (a)f(time.)20 b(If)15 b Fj(\014lename)k Fp(is)c Fo(NULL)p ! Fp(,)195 2058 y(then)h(read)f(from)f(`)p Fo(~/.history)p ! Fp('.)k(Returns)d(0)f(if)i(successful,)g(or)f Fo(errno)f ! Fp(if)i(not.)1762 2172 y(F)l(unction)-1861 b Fh(int)20 ! b Fg(read)p 286 2172 V 20 w(history)p 481 2172 V 20 w(range)i ! Ff(\()p Fo(const)14 b(char)h(*filename,)f(int)h(from,)f(int)h(to)p ! Ff(\))195 2227 y Fp(Read)f(a)f(range)h(of)f(lines)j(from)d ! Fj(\014lename)p Fp(,)i(adding)g(them)f(to)f(the)h(history)g(list.)20 ! b(Start)13 b(reading)i(at)195 2282 y(line)g Fj(from)d ! Fp(and)h(end)h(at)f Fj(to)p Fp(.)18 b(If)c Fj(from)e ! Fp(is)i(zero,)f(start)f(at)g(the)h(b)q(eginning.)22 b(If)13 ! b Fj(to)i Fp(is)e(less)h(than)f Fj(from)p Fp(,)195 2337 ! y(then)i(read)g(un)o(til)i(the)e(end)g(of)g(the)g(\014le.)21 ! b(If)15 b Fj(\014lename)k Fp(is)d Fo(NULL)p Fp(,)e(then)h(read)g(from)f ! (`)p Fo(~/.history)p Fp('.)195 2392 y(Returns)h(0)g(if)g(successful,)h ! (or)f Fo(errno)g Fp(if)g(not.)1762 2506 y(F)l(unction)-1861 ! b Fh(int)20 b Fg(write)p 304 2506 V 22 w(history)i Ff(\()p ! Fo(const)15 b(char)f(*filename)p Ff(\))195 2560 y Fp(W)l(rite)k(the)f ! (curren)o(t)g(history)h(to)f Fj(\014lename)p Fp(,)h(o)o(v)o(erwriting)f ! Fj(\014lename)k Fp(if)d(necessary)l(.)27 b(If)18 b Fj(\014lename)195 ! 2615 y Fp(is)f Fo(NULL)p Fp(,)e(then)h(write)h(the)f(history)g(list)h ! (to)e(`)p Fo(~/.history)p Fp('.)21 b(Returns)16 b(0)f(on)h(success,)h ! (or)f Fo(errno)195 2670 y Fp(on)f(a)g(read)g(or)g(write)g(error.)p ! eop %%Page: 9 11 ! 9 10 bop 75 -58 a Fp(Chapter)15 b(2:)k(Programming)c(with)g(GNU)g ! (History)889 b(9)1762 149 y(F)l(unction)-1861 b Fh(int)20 ! b Fg(app)r(end)p 360 149 18 3 v 19 w(history)j Ff(\()p ! Fo(int)14 b(nelements,)g(const)h(char)f(*filename)p Ff(\))195 ! 204 y Fp(App)q(end)19 b(the)e(last)g Fj(nelemen)o(ts)k ! Fp(of)16 b(the)i(history)f(list)h(to)f Fj(\014lename)p ! Fp(.)27 b(If)18 b Fj(\014lename)j Fp(is)d Fo(NULL)p Fp(,)f(then)195 ! 259 y(app)q(end)f(to)f(`)p Fo(~/.history)p Fp('.)j(Returns)c(0)h(on)g ! (success,)h(or)e Fo(errno)h Fp(on)g(a)g(read)g(or)g(write)g(error.)1762 ! 404 y(F)l(unction)-1861 b Fh(int)20 b Fg(history)p 351 ! 404 V 20 w(truncate)p 582 404 V 21 w(\014le)k Ff(\()p ! Fo(const)14 b(char)h(*filename,)e(int)i(nlines)p Ff(\))195 ! 459 y Fp(T)l(runcate)k(the)h(history)f(\014le)h Fj(\014lename)p ! Fp(,)h(lea)o(ving)f(only)g(the)f(last)g Fj(nlines)k Fp(lines.)34 ! b(If)20 b Fj(\014lename)i Fp(is)195 513 y Fo(NULL)p Fp(,)14 ! b(then)i(`)p Fo(~/.history)p Fp(')d(is)j(truncated.)j(Returns)c(0)g(on) ! g(success,)h(or)e Fo(errno)h Fp(on)g(failure.)75 644 ! y Fi(2.3.7)30 b(History)20 b(Expansion)137 750 y Fp(These)c(functions)g ! (implemen)o(t)g(history)f(expansion.)1762 895 y(F)l(unction)-1861 ! b Fh(int)20 b Fg(history)p 351 895 V 20 w(expand)j Ff(\()p ! Fo(char)14 b(*string,)g(char)h(**output)p Ff(\))195 949 ! y Fp(Expand)j Fj(string)p Fp(,)f(placing)h(the)g(result)f(in)o(to)g ! Fj(output)p Fp(,)h(a)e(p)q(oin)o(ter)i(to)f(a)g(string)g(\(see)g ! (Section)h(1.1)195 1004 y([History)d(In)o(teraction],)f(page)h(1\).)20 ! b(Returns:)195 1098 y Fo(0)216 b Fp(If)19 b(no)g(expansions)g(to)q(ok)f ! (place)i(\(or,)e(if)i(the)e(only)i(c)o(hange)e(in)i(the)f(text)f(w)o ! (as)g(the)435 1152 y(remo)o(v)m(al)d(of)g(escap)q(e)h(c)o(haracters)e ! (preceding)i(the)f(history)g(expansion)h(c)o(haracter\);)195 ! 1241 y Fo(1)216 b Fp(if)16 b(expansions)g(did)g(tak)o(e)e(place;)195 ! 1330 y Fo(-1)192 b Fp(if)16 b(there)f(w)o(as)f(an)h(error)g(in)h ! (expansion;)195 1419 y Fo(2)216 b Fp(if)14 b(the)g(returned)g(line)i ! (should)f(b)q(e)f(displa)o(y)o(ed,)h(but)f(not)f(executed,)i(as)e(with) ! h(the)g Fo(:p)435 1474 y Fp(mo)q(di\014er)i(\(see)f(Section)h(1.1.3)e ! ([Mo)q(di\014ers],)h(page)g(2\).)195 1568 y(If)g(an)h(error)e(o)q ! (curred)i(in)g(expansion,)f(then)h Fj(output)g Fp(con)o(tains)f(a)g ! (descriptiv)o(e)i(error)d(message.)1762 1713 y(F)l(unction)-1861 ! b Fh(char)20 b(*)f Fg(get)p 324 1713 V 21 w(history)p ! 520 1713 V 20 w(ev)n(en)n(t)25 b Ff(\()p Fo(const)14 ! b(char)h(*string,)f(int)g(*cindex,)g(int)283 1767 y(qchar)p ! Ff(\))195 1822 y Fp(Returns)22 b(the)h(text)f(of)h(the)f(history)h(ev)o ! (en)o(t)g(b)q(eginning)h(at)f Fj(string)j Fo(+)d Fj(*cindex)p ! Fp(.)43 b Fj(*cindex)27 b Fp(is)195 1877 y(mo)q(di\014ed)16 ! b(to)e(p)q(oin)o(t)h(to)f(after)g(the)h(ev)o(en)o(t)f(sp)q(eci\014er.) ! 22 b(A)o(t)14 b(function)h(en)o(try)l(,)g Fj(cindex)k ! Fp(p)q(oin)o(ts)c(to)f(the)195 1932 y(index)19 b(in)o(to)f ! Fj(string)k Fp(where)c(the)g(history)g(ev)o(en)o(t)g(sp)q ! (eci\014cation)h(b)q(egins.)30 b Fj(qc)o(har)21 b Fp(is)d(a)g(c)o ! (haracter)195 1987 y(that)13 b(is)h(allo)o(w)o(ed)g(to)e(end)i(the)g ! (ev)o(en)o(t)f(sp)q(eci\014cation)j(in)e(addition)g(to)f(the)h ! (\\normal")f(terminating)195 2041 y(c)o(haracters.)1762 ! 2186 y(F)l(unction)-1861 b Fh(char)20 b(**)f Fg(history)p ! 448 2186 V 21 w(tok)n(enize)25 b Ff(\()p Fo(const)14 ! b(char)h(*string)p Ff(\))195 2241 y Fp(Return)g(an)g(arra)o(y)g(of)g ! (tok)o(ens)g(parsed)g(out)g(of)g Fj(string)p Fp(,)g(m)o(uc)o(h)h(as)f ! (the)g(shell)i(migh)o(t.)k(The)15 b(tok)o(ens)195 2296 ! y(are)h(split)h(on)e(the)h(c)o(haracters)g(in)g(the)g ! Fj(history)p 1007 2296 14 2 v 17 w(w)o(ord)p 1122 2296 ! V 15 w(delimiters)k Fp(v)m(ariable,)d(and)f(shell)i(quoting)195 ! 2351 y(con)o(v)o(en)o(tions)d(are)g(ob)q(ey)o(ed.)1762 ! 2496 y(F)l(unction)-1861 b Fh(char)20 b(*)f Fg(history)p ! 422 2496 18 3 v 21 w(arg)p 524 2496 V 19 w(extract)24 ! b Ff(\()p Fo(int)14 b(first,)h(int)g(last,)f(const)g(char)283 ! 2550 y(*string)p Ff(\))195 2605 y Fp(Extract)19 b(a)h(string)g(segmen)o ! (t)g(consisting)h(of)f(the)g Fj(\014rst)h Fp(through)f ! Fj(last)h Fp(argumen)o(ts)e(presen)o(t)h(in)195 2660 ! y Fj(string)p Fp(.)g(Argumen)o(ts)15 b(are)f(split)j(using)f ! Fo(history_tokenize)p Fp(.)p eop ! %%Page: 10 12 ! 10 11 bop 75 -58 a Fp(10)1324 b(GNU)15 b(History)g(Library)75 ! 149 y Fn(2.4)33 b(History)22 b(V)-6 b(ariables)137 251 ! y Fp(This)18 b(section)f(describ)q(es)i(the)e(externally-visible)k(v)m ! (ariables)d(exp)q(orted)f(b)o(y)g(the)g Fk(gnu)g Fp(History)g(Li-)75 ! 306 y(brary)l(.)1773 438 y(V)l(ariable)-1861 b Fh(int)20 ! b Fg(history)p 351 438 18 3 v 20 w(base)195 493 y Fp(The)15 b(logical)i(o\013set)d(of)h(the)g(\014rst)g(en)o(try)g(in)h(the)f ! (history)g(list.)1773 625 y(V)l(ariable)-1861 b Fh(int)20 ! b Fg(history)p 351 625 V 20 w(length)195 680 y Fp(The)15 b(n)o(um)o(b)q(er)h(of)f(en)o(tries)g(curren)o(tly)h(stored)f(in)h(the) ! f(history)g(list.)1773 812 y(V)l(ariable)-1861 b Fh(int)20 ! b Fg(history)p 351 812 V 20 w(max)p 478 812 V 20 w(en)n(tries)195 ! 867 y Fp(The)j(maxim)o(um)g(n)o(um)o(b)q(er)g(of)g(history)g(en)o ! (tries.)43 b(This)24 b(m)o(ust)e(b)q(e)i(c)o(hanged)f(using)h ! Fo(stifle_)195 922 y(history\(\))p Fp(.)1773 1054 y(V)l(ariable)-1861 ! b Fh(char)20 b Fg(history)p 377 1054 V 20 w(expansion)p ! 644 1054 V 21 w(c)n(har)195 1109 y Fp(The)e(c)o(haracter)f(that)g(in)o ! (tro)q(duces)h(a)f(history)h(ev)o(en)o(t.)27 b(The)18 ! b(default)g(is)g(`)p Fo(!)p Fp('.)26 b(Setting)18 b(this)g(to)f(0)195 ! 1164 y(inhibits)g(history)f(expansion.)1773 1296 y(V)l(ariable)-1861 ! b Fh(char)20 b Fg(history)p 377 1296 V 20 w(subst)p 529 ! 1296 V 20 w(c)n(har)195 1351 y Fp(The)h(c)o(haracter)e(that)h(in)o(v)o ! (ok)o(es)g(w)o(ord)g(substitution)h(if)g(found)f(at)g(the)h(start)e(of) ! h(a)g(line.)37 b(The)195 1406 y(default)16 b(is)f(`)p ! Fo(^)p Fp('.)1773 1538 y(V)l(ariable)-1861 b Fh(char)20 ! b Fg(history)p 377 1538 V 20 w(commen)n(t)p 627 1538 ! V 19 w(c)n(har)195 1593 y Fp(During)f(tok)o(enization,)h(if)f(this)h(c) ! o(haracter)e(is)h(seen)h(as)e(the)h(\014rst)g(c)o(haracter)f(of)g(a)h ! (w)o(ord,)g(then)195 1648 y(it)j(and)g(all)g(subsequen)o(t)h(c)o ! (haracters)d(up)j(to)e(a)g(newline)i(are)f(ignored,)h(suppressing)g ! (history)195 1702 y(expansion)16 b(for)f(the)g(remainder)h(of)f(the)g ! (line.)21 b(This)16 b(is)g(disabled)h(b)o(y)e(default.)1773 ! 1835 y(V)l(ariable)-1861 b Fh(char)20 b(*)f Fg(history)p ! 422 1835 V 21 w(w)n(ord)p 567 1835 V 20 w(delimiters)195 ! 1889 y Fp(The)e(c)o(haracters)g(that)f(separate)h(tok)o(ens)g(for)f ! Fo(\\)p Fp(fBhistory)p 1217 1889 14 2 v 17 w(tok)o(enize\(\))p ! Fo(\\)p Fp(fP)l(.)g(The)i(default)g(v)m(alue)195 1944 ! y(is)e Fo(")f(\\t\\n\(\)<>;&|")p Fp(.)1773 2077 y(V)l(ariable)-1861 ! b Fh(char)20 b(*)f Fg(history)p 422 2077 18 3 v 21 w(no)p ! 504 2077 V 20 w(expand)p 704 2077 V 20 w(c)n(hars)195 ! 2131 y Fp(The)c(list)h(of)e(c)o(haracters)g(whic)o(h)i(inhibit)h ! (history)e(expansion)h(if)f(found)h(immediately)g(follo)o(wing)195 ! 2186 y Fj(history)p 336 2186 14 2 v 16 w(expansion)p ! 547 2186 V 18 w(c)o(har)p Fp(.)j(The)d(default)f(is)h(space,)f(tab,)g ! (newline,)h(carriage)f(return,)g(and)h(`)p Fo(=)p Fp('.)1773 ! 2318 y(V)l(ariable)-1861 b Fh(char)20 b(*)f Fg(history)p ! 422 2318 18 3 v 21 w(searc)n(h)p 599 2318 V 20 w(delimiter)p ! 843 2318 V 23 w(c)n(hars)195 2373 y Fp(The)13 b(list)h(of)f(additional) ! h(c)o(haracters)e(whic)o(h)i(can)g(delimit)g(a)f(history)g(searc)o(h)g ! (string,)g(in)h(addition)195 2428 y(to)h(space,)g(T)l(AB,)g(`)p ! Fo(:)p Fp(')f(and)h(`)p Fo(?)p Fp(')g(in)h(the)f(case)g(of)g(a)g ! (substring)g(searc)o(h.)20 b(The)c(default)f(is)h(empt)o(y)l(.)1773 ! 2560 y(V)l(ariable)-1861 b Fh(int)20 b Fg(history)p 351 ! 2560 V 20 w(quotes)p 533 2560 V 21 w(inhibit)p 717 2560 ! V 23 w(expansion)195 2615 y Fp(If)15 b(non-zero,)f(single-quoted)j(w)o ! (ords)c(are)i(not)f(scanned)h(for)f(the)h(history)g(expansion)g(c)o ! (haracter.)195 2670 y(The)g(default)h(v)m(alue)h(is)e(0.)p ! eop %%Page: 11 13 ! 11 12 bop 75 -58 a Fp(Chapter)15 b(2:)k(Programming)c(with)g(GNU)g ! (History)867 b(11)1773 149 y(V)l(ariable)-1861 b Fh(rl_linebuf_func_t) ! 22 b(*)d Fg(history)p 762 149 18 3 v 21 w(inhibit)p 946 ! 149 V 23 w(expansion)p 1216 149 V 20 w(function)195 204 ! y Fp(This)e(should)h(b)q(e)f(set)g(to)f(the)g(address)h(of)f(a)h ! (function)g(that)f(tak)o(es)g(t)o(w)o(o)f(argumen)o(ts:)22 ! b(a)17 b Fo(char)d(*)195 259 y Fp(\()p Fj(string)t Fp(\))e(and)i(an)f ! Fo(int)g Fp(index)i(in)o(to)e(that)f(string)i(\()p Fj(i)r ! Fp(\).)19 b(It)14 b(should)g(return)f(a)g(non-zero)h(v)m(alue)g(if)g ! (the)195 314 y(history)h(expansion)g(starting)f(at)g ! Fj(string[i])i Fp(should)g(not)e(b)q(e)h(p)q(erformed;)g(zero)f(if)h ! (the)g(expansion)195 369 y(should)i(b)q(e)g(done.)22 ! b(It)16 b(is)h(in)o(tended)g(for)e(use)i(b)o(y)f(applications)h(lik)o ! (e)g(Bash)f(that)g(use)g(the)g(history)195 423 y(expansion)g(c)o ! (haracter)f(for)f(additional)j(purp)q(oses.)j(By)c(default,)f(this)h(v) ! m(ariable)g(is)g(set)f(to)f Fo(NULL)p Fp(.)75 543 y Fn(2.5)33 ! b(History)22 b(Programming)h(Example)137 637 y Fp(The)16 ! b(follo)o(wing)g(program)e(demonstrates)g(simple)j(use)e(of)g(the)g ! Fk(gnu)g Fp(History)g(Library)l(.)195 698 y Fo(#include)23 ! b( )195 750 y(#include)g( )195 ! 854 y(main)g(\(argc,)g(argv\))314 906 y(int)h(argc;)314 ! 958 y(char)g(**argv;)195 1010 y({)243 1061 y(char)f(line[1024],)f(*t;) ! 243 1113 y(int)h(len,)g(done)h(=)g(0;)243 1217 y(line[0])f(=)g(0;)243 ! 1321 y(using_history)f(\(\);)243 1373 y(while)h(\(!done\))290 ! 1425 y({)338 1477 y(printf)g(\("history$)g("\);)338 1528 ! y(fflush)g(\(stdout\);)338 1580 y(t)h(=)g(fgets)f(\(line,)g(sizeof)g ! (\(line\))g(-)h(1,)f(stdin\);)338 1632 y(if)h(\(t)f(&&)h(*t\))386 ! 1684 y({)434 1736 y(len)f(=)h(strlen)f(\(t\);)434 1788 ! y(if)g(\(t[len)g(-)h(1])g(==)f('\\n'\))481 1840 y(t[len)h(-)f(1])h(=)g ! ('\\0';)386 1892 y(})338 1995 y(if)g(\(!t\))386 2047 ! y(strcpy)f(\(line,)g("quit"\);)338 2151 y(if)h(\(line[0]\))386 ! 2203 y({)434 2255 y(char)f(*expansion;)434 2307 y(int)g(result;)434 ! 2411 y(result)g(=)g(history_expand)f(\(line,)h(&expansion\);)434 ! 2462 y(if)g(\(result\))481 2514 y(fprintf)g(\(stderr,)g("\045s\\n",)g ! (expansion\);)434 2618 y(if)g(\(result)g(<)h(0)g(||)f(result)g(==)h ! (2\))481 2670 y({)p eop %%Page: 12 14 ! 12 13 bop 75 -58 a Fp(12)1324 b(GNU)15 b(History)g(Library)529 ! 149 y Fo(free)23 b(\(expansion\);)529 201 y(continue;)481 ! 253 y(})434 357 y(add_history)f(\(expansion\);)434 409 ! y(strncpy)h(\(line,)g(expansion,)f(sizeof)h(\(line\))g(-)h(1\);)434 ! 461 y(free)f(\(expansion\);)386 513 y(})338 616 y(if)h(\(strcmp)f ! (\(line,)g("quit"\))g(==)g(0\))386 668 y(done)g(=)h(1;)338 ! 720 y(else)f(if)h(\(strcmp)f(\(line,)g("save"\))g(==)h(0\))386 ! 772 y(write_history)e(\("history_file"\);)338 824 y(else)h(if)h ! (\(strcmp)f(\(line,)g("read"\))g(==)h(0\))386 876 y(read_history)e ! (\("history_file"\);)338 928 y(else)h(if)h(\(strcmp)f(\(line,)g ! ("list"\))g(==)h(0\))386 980 y({)434 1032 y(register)e(HIST_ENTRY)h ! (**the_list;)434 1083 y(register)f(int)i(i;)434 1187 ! y(the_list)e(=)i(history_list)e(\(\);)434 1239 y(if)h(\(the_list\))481 ! 1291 y(for)h(\(i)f(=)h(0;)g(the_list[i];)e(i++\))529 ! 1343 y(printf)h(\("\045d:)g(\045s\\n",)g(i)h(+)g(history_base,)e ! (the_list[i]->line\);)386 1395 y(})338 1447 y(else)h(if)h(\(strncmp)f ! (\(line,)g("delete",)g(6\))g(==)h(0\))386 1499 y({)434 ! 1550 y(int)f(which;)434 1602 y(if)g(\(\(sscanf)g(\(line)g(+)h(6,)f ! ("\045d",)h(&which\)\))e(==)i(1\))481 1654 y({)529 1706 ! y(HIST_ENTRY)f(*entry)g(=)g(remove_history)f(\(which\);)529 ! 1758 y(if)i(\(!entry\))577 1810 y(fprintf)f(\(stderr,)f("No)i(such)f ! (entry)g(\045d\\n",)g(which\);)529 1862 y(else)577 1914 ! y({)625 1966 y(free)g(\(entry->line\);)625 2017 y(free)g(\(entry\);)577 ! 2069 y(})481 2121 y(})434 2173 y(else)481 2225 y({)529 ! 2277 y(fprintf)g(\(stderr,)g("non-numeric)f(arg)h(given)h(to)f ! (`delete'\\n"\);)481 2329 y(})386 2381 y(})290 2433 y(})195 ! 2484 y(})p eop %%Page: 13 15 ! 13 14 bop 75 -58 a Fp(App)q(endix)17 b(A:)e(Concept)g(Index)1196 ! b(13)75 149 y Fl(App)r(endix)25 b(A)41 b(Concept)27 b(Index)75 ! 321 y Fn(A)75 383 y Fe(anc)o(hored)14 b(searc)o(h)s Fd(.)8 ! b(.)e(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g ! (.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)16 ! b Fe(8)75 507 y Fn(E)75 568 y Fe(ev)o(en)o(t)d(designators)g ! Fd(.)6 b(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.) ! h(.)f(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)23 b ! Fe(1)1012 321 y Fn(H)1012 431 y Fe(history)15 b(ev)o(en)o(ts)d ! Fd(.)6 b(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.) ! g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)h(.)24 ! b Fe(1)1012 500 y(history)15 b(expansion)8 b Fd(.)g(.)e(.)g(.)g(.)h(.)f ! (.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.) ! f(.)g(.)g(.)g(.)g(.)21 b Fe(1)1012 568 y(History)14 b(Searc)o(hing)6 ! b Fd(.)j(.)d(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.) ! g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)19 b ! Fe(8)p eop %%Page: 14 16 ! 14 15 bop 75 -58 a Fp(14)1324 b(GNU)15 b(History)g(Library)p eop %%Page: 15 17 ! 15 16 bop 75 -58 a Fp(App)q(endix)17 b(B:)e(F)l(unction)h(and)g(V)l ! (ariable)g(Index)919 b(15)75 149 y Fl(App)r(endix)25 b(B)41 b(F)-7 b(unction)26 b(and)h(V)-7 b(ariable)26 ! b(Index)75 321 y Fn(A)75 382 y Fc(add_histor)o(y)8 b ! Fd(.)e(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g ! (.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)23 ! b Fe(6)75 428 y Fc(append_his)o(to)o(ry)8 b Fd(.)s(.)f(.)f(.)g(.)g(.)g ! (.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.) ! g(.)g(.)g(.)h(.)f(.)g(.)21 b Fe(9)75 557 y Fn(C)75 618 ! y Fc(clear_hist)o(or)o(y)6 b Fd(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g ! (.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)h(.) ! f(.)g(.)g(.)22 b Fe(6)75 664 y Fc(current_hi)o(st)o(ory)7 ! b Fd(.)s(.)f(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)h(.) ! f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)20 b ! Fe(7)75 793 y Fn(G)75 854 y Fc(get_histor)o(y_)o(eve)o(nt)5 ! b Fd(.)t(.)h(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.) ! h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)19 b Fe(9)75 ! 984 y Fn(H)75 1044 y Fc(history_ar)o(g_)o(ext)o(ra)o(ct)5 ! b Fd(.)s(.)h(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.) ! g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)18 b Fe(9)75 1090 y Fc(history_ba)o(se) ! 6 b Fd(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g ! (.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)22 ! b Fe(10)75 1136 y Fc(history_co)o(mm)o(ent)o(_c)o(har)s ! Fd(.)s(.)6 b(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.) ! f(.)g(.)g(.)g(.)g(.)h(.)16 b Fe(10)75 1182 y Fc(history_ex)o(pa)o(nd)8 ! b Fd(.)s(.)f(.)f(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.) ! g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)21 ! b Fe(9)75 1227 y Fc(history_ex)o(pa)o(nsi)o(on)o(_ch)o(ar)8 ! b Fd(.)e(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.) ! h(.)f(.)g(.)24 b Fe(10)75 1273 y Fc(history_ge)o(t)8 ! b Fd(.)e(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.) ! g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)23 ! b Fe(7)75 1319 y Fc(history_ge)o(t_)o(his)o(to)o(ry_)o(sta)o(te)6 ! b Fd(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.) ! f(.)22 b Fe(6)75 1364 y Fc(history_in)o(hi)o(bit)o(_e)o(xpa)o(nsi)o(on) ! o(_fu)o(nc)o(tio)o(n)9 b Fd(.)d(.)g(.)g(.)g(.)g(.)h(.)24 ! b Fe(11)75 1410 y Fc(history_is)o(_s)o(tif)o(le)o(d)6 ! b Fd(.)s(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.) ! g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)18 b Fe(7)75 1456 ! y Fc(history_le)o(ng)o(th)8 b Fd(.)s(.)e(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.) ! g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g ! (.)g(.)21 b Fe(10)75 1501 y Fc(history_li)o(st)6 b Fd(.)h(.)f(.)g(.)g ! (.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.) ! g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)23 b Fe(7)75 ! 1547 y Fc(history_ma)o(x_)o(ent)o(ri)o(es)t Fd(.)s(.)6 ! b(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g ! (.)g(.)g(.)h(.)f(.)17 b Fe(10)75 1593 y Fc(history_no)o(_e)o(xpa)o(nd)o ! (_ch)o(ars)7 b Fd(.)f(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g ! (.)g(.)g(.)g(.)g(.)h(.)23 b Fe(10)75 1638 y Fc(history_qu)o(ot)o(es_)o ! (in)o(hib)o(it_)o(ex)o(pan)o(si)o(on)t Fd(.)s(.)6 b(.)g(.)g(.)h(.)f(.)g ! (.)g(.)g(.)17 b Fe(10)75 1684 y Fc(history_se)o(ar)o(ch)8 ! b Fd(.)s(.)f(.)f(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.) ! g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)21 ! b Fe(8)75 1730 y Fc(history_se)o(ar)o(ch_)o(de)o(lim)o(ite)o(r_)o(cha)o ! (rs)5 b Fd(.)s(.)h(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)18 ! b Fe(10)75 1776 y Fc(history_se)o(ar)o(ch_)o(po)o(s)6 ! b Fd(.)s(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.) ! g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)18 b Fe(8)75 1821 ! y Fc(history_se)o(ar)o(ch_)o(pr)o(efi)o(x)s Fd(.)t(.)6 ! b(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g ! (.)h(.)f(.)g(.)16 b Fe(8)75 1867 y Fc(history_se)o(t_)o(his)o(to)o(ry_) ! o(sta)o(te)6 b Fd(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g ! (.)g(.)g(.)h(.)f(.)22 b Fe(6)75 1913 y Fc(history_se)o(t_)o(pos)7 ! b Fd(.)s(.)f(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)h(.) ! f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)20 b ! Fe(7)1012 321 y Fc(history_sub)o(st)o(_ch)o(ar)t Fd(.)t(.)6 ! b(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f ! (.)g(.)g(.)g(.)g(.)g(.)19 b Fe(10)1012 368 y Fc(history_tok)o(en)o(ize) ! 6 b Fd(.)t(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g ! (.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)20 b Fe(9)1012 ! 414 y Fc(history_tot)o(al)o(_by)o(te)o(s)5 b Fd(.)s(.)h(.)g(.)h(.)f(.)g ! (.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.) ! g(.)18 b Fe(7)1012 460 y Fc(history_tru)o(nc)o(ate)o(_f)o(ile)s ! Fd(.)s(.)6 b(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.) ! h(.)f(.)g(.)g(.)g(.)g(.)17 b Fe(9)1012 507 y Fc(history_wor)o(d_)o(del) ! o(im)o(ite)o(rs)7 b Fd(.)f(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g ! (.)g(.)g(.)h(.)f(.)g(.)g(.)24 b Fe(10)1012 640 y Fn(N)1012 ! 702 y Fc(next_histor)o(y)7 b Fd(.)f(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g ! (.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.) ! g(.)g(.)h(.)f(.)23 b Fe(7)1012 836 y Fn(P)1012 898 y ! Fc(previous_hi)o(st)o(ory)6 b Fd(.)t(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.) ! g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f ! (.)20 b Fe(7)1012 1031 y Fn(R)1012 1094 y Fc(read_histor)o(y)7 ! b Fd(.)f(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.) ! h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)23 ! b Fe(8)1012 1140 y Fc(read_histor)o(y_)o(ran)o(ge)5 b ! Fd(.)s(.)h(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g ! (.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)19 b Fe(8)1012 1186 ! y Fc(remove_hist)o(or)o(y)9 b Fd(.)s(.)d(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.) ! g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g ! (.)g(.)g(.)22 b Fe(6)1012 1233 y Fc(replace_his)o(to)o(ry_)o(en)o(try)s ! Fd(.)s(.)6 b(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.) ! h(.)f(.)g(.)g(.)g(.)g(.)17 b Fe(6)1012 1366 y Fn(S)1012 ! 1429 y Fc(stifle_hist)o(or)o(y)9 b Fd(.)s(.)d(.)g(.)g(.)g(.)h(.)f(.)g ! (.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.) ! f(.)g(.)g(.)g(.)22 b Fe(7)1012 1562 y Fn(U)1012 1624 ! y Fc(unstifle_hi)o(st)o(ory)6 b Fd(.)t(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f ! (.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.) ! f(.)20 b Fe(7)1012 1671 y Fc(using_histo)o(ry)6 b Fd(.)g(.)g(.)g(.)g(.) ! g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g ! (.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)22 b Fe(6)1012 1804 ! y Fn(W)1012 1866 y Fc(where_histo)o(ry)6 b Fd(.)g(.)g(.)g(.)g(.)g(.)h ! (.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.) ! h(.)f(.)g(.)g(.)g(.)g(.)h(.)22 b Fe(7)1012 1913 y Fc(write_histo)o(ry)6 ! b Fd(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.) ! g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)h(.)22 b Fe(8)p eop %%Page: 16 18 ! 16 17 bop 75 -58 a Fp(16)1324 b(GNU)15 b(History)g(Library)p eop %%Page: -1 19 ! -1 18 bop 1862 -58 a Fp(i)75 149 y Fl(T)-7 b(able)27 ! b(of)f(Con)n(ten)n(ts)75 320 y Fn(1)67 b(Using)22 b(History)h(In)n (teractiv)n(ely)9 b Fb(.)k(.)d(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)h ! (.)f(.)g(.)g(.)h(.)31 b Fn(1)224 389 y Fp(1.1)45 b(History)15 b(Expansion)5 b Fa(.)j(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.) ! f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)19 b Fp(1)374 444 y(1.1.1)44 b(Ev)o(en)o(t)14 b(Designators)e Fa(.)7 b(.)h(.)f(.)h(.)f(.)h(.)f(.)h (.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.) ! f(.)h(.)f(.)h(.)26 b Fp(1)374 499 y(1.1.2)44 b(W)l(ord)15 b(Designators)5 b Fa(.)h(.)i(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.) f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h ! (.)19 b Fp(2)374 553 y(1.1.3)44 b(Mo)q(di\014ers)t Fa(.)8 b(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.) ! f(.)h(.)f(.)19 b Fp(2)75 675 y Fn(2)67 b(Programming)23 b(with)g(GNU)f(History)16 b Fb(.)10 b(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f ! (.)g(.)38 b Fn(5)224 743 y Fp(2.1)45 b(In)o(tro)q(duction)16 b(to)f(History)10 b Fa(.)d(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f (.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.) ! f(.)h(.)f(.)h(.)24 b Fp(5)224 798 y(2.2)45 b(History)15 b(Storage)c Fa(.)d(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f (.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.) ! g(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)26 b Fp(5)224 853 y(2.3)45 b(History)15 b(F)l(unctions)d Fa(.)c(.)f(.)h(.)f(.)h(.)f(.)h (.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.) f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)26 ! b Fp(6)374 907 y(2.3.1)44 b(Initializing)18 b(History)d(and)h(State)e (Managemen)o(t)g Fa(.)7 b(.)h(.)g(.)f(.)h(.)f(.)29 b ! Fp(6)374 962 y(2.3.2)44 b(History)15 b(List)h(Managemen)o(t)d Fa(.)7 b(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.) ! h(.)f(.)h(.)f(.)h(.)f(.)29 b Fp(6)374 1017 y(2.3.3)44 b(Information)15 b(Ab)q(out)g(the)h(History)f(List)c Fa(.)d(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)26 ! b Fp(7)374 1072 y(2.3.4)44 b(Mo)o(ving)15 b(Around)g(the)g(History)g (List)c Fa(.)d(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f ! (.)h(.)25 b Fp(7)374 1127 y(2.3.5)44 b(Searc)o(hing)16 b(the)f(History)g(List)7 b Fa(.)h(.)g(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f (.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)22 ! b Fp(8)374 1181 y(2.3.6)44 b(Managing)15 b(the)g(History)g(File)6 b Fa(.)i(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.) ! f(.)h(.)f(.)h(.)f(.)h(.)20 b Fp(8)374 1236 y(2.3.7)44 b(History)15 b(Expansion)9 b Fa(.)f(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h (.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.) ! h(.)f(.)24 b Fp(9)224 1291 y(2.4)45 b(History)15 b(V)l(ariables)6 ! b Fa(.)i(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.) ! f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f ! (.)h(.)f(.)h(.)f(.)21 b Fp(10)224 1346 y(2.5)45 b(History)15 b(Programming)f(Example)7 b Fa(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h (.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)22 ! b Fp(11)75 1467 y Fn(App)r(endix)i(A)67 b(Concept)22 b(Index)17 b Fb(.)10 b(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)h(.)f(.)g(.)g ! (.)h(.)f(.)g(.)38 b Fn(13)75 1602 y(App)r(endix)24 b(B)67 b(F)-6 b(unction)25 b(and)e(V)-6 b(ariable)24 b(Index)16 ! b Fb(.)10 b(.)g(.)g(.)38 b Fn(15)p eop %%Page: -2 20 ! -2 19 bop 75 -58 a Fp(ii)1346 b(GNU)15 b(History)g(Library)p eop %%Trailer diff -Nrc2 readline-4.1/doc/history_3.ps readline-4.2/doc/history_3.ps *** readline-4.1/doc/history_3.ps Wed Dec 31 19:00:00 1969 --- readline-4.2/doc/history_3.ps Mon Apr 16 10:53:07 2001 *************** *** 0 **** --- 1,798 ---- + %!PS-Adobe-3.0 + %%Creator: groff version 1.16.1 + %%CreationDate: Mon Apr 16 10:53:07 2001 + %%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-2001 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 F2 3.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 F2 A 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.2)72 768 Q(2001 Mar 6)141.51 E(1) + 205.67 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.2)72 768 Q(2001 Mar 6) + 141.51 E(2)205.67 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 .655 + (Stop sti\215ing the history)108 717.6 R 5.656(.T)-.65 G .656 + (his returns the pre)-5.656 F .656(vious amount the history w)-.25 F + .656(as sti\215ed.)-.1 F .656(The v)5.656 F .656(alue is positi)-.25 F + .956 -.15(ve i)-.25 H(f).15 E(the history w)108 729.6 Q + (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.2)72 768 Q + (2001 Mar 6)141.51 E(3)205.67 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.2)72 768 Q(2001 Mar 6)141.51 E(4)205.67 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.2)72 768 Q(2001 Mar 6)141.51 E(5) + 205.67 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.2)72 768 Q + (2001 Mar 6)141.51 E(6)205.67 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.2)72 768 Q(2001 Mar 6)141.51 E(7)205.67 E EP + %%Trailer + end + %%EOF diff -Nrc2 readline-4.1/doc/hstech.texinfo readline-4.2/doc/hstech.texinfo *** readline-4.1/doc/hstech.texinfo Tue Sep 21 10:43:27 1999 --- readline-4.2/doc/hstech.texinfo Mon Mar 12 05:37:38 2001 *************** *** 2,6 **** This file documents the user interface to the GNU History library. ! Copyright (C) 1988, 1991, 1994, 1996 Free Software Foundation, Inc. Authored by Brian Fox and Chet Ramey. --- 2,6 ---- This file documents the user interface to the GNU History library. ! Copyright (C) 1988-2001 Free Software Foundation, Inc. Authored by Brian Fox and Chet Ramey. *************** *** 28,34 **** This chapter describes how to interface programs that you write ! with the GNU History Library. It should be considered a technical guide. ! For information on the interactive use of GNU History, @pxref{Using History Interactively}. --- 28,34 ---- This chapter describes how to interface programs that you write ! with the @sc{gnu} History Library. It should be considered a technical guide. ! For information on the interactive use of @sc{gnu} History, @pxref{Using History Interactively}. *************** *** 44,51 **** @section Introduction to History ! 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. The programmer using the History library has available functions --- 44,51 ---- @section Introduction to History ! Many programs read input from the user a line at a time. The @sc{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. The programmer using the History library has available functions *************** *** 81,87 **** @example typedef struct _hist_entry @{ char *line; ! char *data; @} HIST_ENTRY; @end example --- 81,89 ---- @example + typedef void *histdata_t; + typedef struct _hist_entry @{ char *line; ! histdata_t data; @} HIST_ENTRY; @end example *************** *** 96,105 **** @example ! /* A structure used to pass the current state of the history stuff around. */ 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; --- 98,109 ---- @example ! /* ! * 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; *************** *** 113,117 **** This section describes the calling sequence for the various functions ! present in GNU History. @menu --- 117,121 ---- This section describes the calling sequence for the various functions ! exported by the @sc{gnu} History library. @menu *************** *** 140,149 **** functions in your program. ! @deftypefun void using_history () Begin a session in which the history functions might be used. This initializes the interactive variables. @end deftypefun ! @deftypefun {HISTORY_STATE *} history_get_history_state () Return a structure describing the current state of the input history. @end deftypefun --- 144,153 ---- functions in your program. ! @deftypefun void using_history (void) Begin a session in which the history functions might be used. This initializes the interactive variables. @end deftypefun ! @deftypefun {HISTORY_STATE *} history_get_history_state (void) Return a structure describing the current state of the input history. @end deftypefun *************** *** 159,163 **** parameters managing the list itself. ! @deftypefun void add_history (char *string) Place @var{string} at the end of the history list. The associated data field (if any) is set to @code{NULL}. --- 163,167 ---- parameters managing the list itself. ! @deftypefun void add_history (const char *string) Place @var{string} at the end of the history list. The associated data field (if any) is set to @code{NULL}. *************** *** 170,174 **** @end deftypefun ! @deftypefun {HIST_ENTRY *} replace_history_entry (int which, char *line, char *data) Make the history entry at offset @var{which} have @var{line} and @var{data}. This returns the old entry so you can dispose of the data. In the case --- 174,178 ---- @end deftypefun ! @deftypefun {HIST_ENTRY *} replace_history_entry (int which, const char *line, histdata_t data) Make the history entry at offset @var{which} have @var{line} and @var{data}. This returns the old entry so you can dispose of the data. In the case *************** *** 176,180 **** @end deftypefun ! @deftypefun void clear_history () Clear the history list by deleting all the entries. @end deftypefun --- 180,184 ---- @end deftypefun ! @deftypefun void clear_history (void) Clear the history list by deleting all the entries. @end deftypefun *************** *** 184,188 **** @end deftypefun ! @deftypefun int unstifle_history () Stop stifling the history. This returns the previous amount the history was stifled. The value is positive if the history was --- 188,192 ---- @end deftypefun ! @deftypefun int unstifle_history (void) Stop stifling the history. This returns the previous amount the history was stifled. The value is positive if the history was *************** *** 190,194 **** @end deftypefun ! @deftypefun int history_is_stifled () Returns non-zero if the history is stifled, zero if it is not. @end deftypefun --- 194,198 ---- @end deftypefun ! @deftypefun int history_is_stifled (void) Returns non-zero if the history is stifled, zero if it is not. @end deftypefun *************** *** 200,216 **** individual list entries. ! @deftypefun {HIST_ENTRY **} history_list () ! Return a @code{NULL} terminated array of @code{HIST_ENTRY} which is the current input history. Element 0 of this list is the beginning of time. If there is no history, return @code{NULL}. @end deftypefun ! @deftypefun int where_history () Returns the offset of the current history element. @end deftypefun ! @deftypefun {HIST_ENTRY *} current_history () Return the history entry at the current position, as determined by ! @code{where_history ()}. If there is no entry there, return a @code{NULL} pointer. @end deftypefun --- 204,220 ---- individual list entries. ! @deftypefun {HIST_ENTRY **} history_list (void) ! Return a @code{NULL} terminated array of @code{HIST_ENTRY *} which is the current input history. Element 0 of this list is the beginning of time. If there is no history, return @code{NULL}. @end deftypefun ! @deftypefun int where_history (void) Returns the offset of the current history element. @end deftypefun ! @deftypefun {HIST_ENTRY *} current_history (void) Return the history entry at the current position, as determined by ! @code{where_history()}. If there is no entry there, return a @code{NULL} pointer. @end deftypefun *************** *** 218,226 **** @deftypefun {HIST_ENTRY *} history_get (int offset) Return the history entry at position @var{offset}, starting from ! @code{history_base}. If there is no entry there, or if @var{offset} is greater than the history length, return a @code{NULL} pointer. @end deftypefun ! @deftypefun int history_total_bytes () 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 --- 222,231 ---- @deftypefun {HIST_ENTRY *} history_get (int offset) Return the history entry at position @var{offset}, starting from ! @code{history_base} (@pxref{History Variables}). ! If there is no entry there, or if @var{offset} is greater than the history length, return a @code{NULL} pointer. @end deftypefun ! @deftypefun 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 *************** *** 235,243 **** @deftypefun int history_set_pos (int pos) ! Set the position in the history list to @var{pos}, an absolute index into the list. @end deftypefun ! @deftypefun {HIST_ENTRY *} previous_history () 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 --- 240,250 ---- @deftypefun int history_set_pos (int pos) ! Set the current history offset to @var{pos}, an absolute index into the list. + Returns 1 on success, 0 if @var{pos} is less than zero or greater + than the number of history entries. @end deftypefun ! @deftypefun {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 *************** *** 245,249 **** @end deftypefun ! @deftypefun {HIST_ENTRY *} next_history () 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 --- 252,256 ---- @end deftypefun ! @deftypefun {HIST_ENTRY *} next_history (void) Move the current history offset forward to the next history entry, and return the a pointer to that entry. If there is no next entry, return *************** *** 261,268 **** @cindex anchored search ! @deftypefun int history_search (char *string, int direction) ! Search the history for @var{string}, starting at the current history ! offset. If @var{direction} < 0, then the search is through previous entries, ! else through subsequent. If @var{string} 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 --- 268,276 ---- @cindex anchored search ! @deftypefun int history_search (const char *string, int direction) ! Search the history for @var{string}, starting at the current history offset. ! If @var{direction} is less than 0, then the search is through ! previous entries, otherwise through subsequent entries. ! If @var{string} 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 *************** *** 271,284 **** @end deftypefun ! @deftypefun int history_search_prefix (char *string, int direction) Search the history for @var{string}, starting at the current history offset. The search is anchored: matching lines must begin with ! @var{string}. If @var{direction} < 0, then the search is through previous ! entries, else through subsequent. If @var{string} 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. @end deftypefun ! @deftypefun int history_search_pos (char *string, int direction, int pos) Search for @var{string} in the history list, starting at @var{pos}, an absolute index into the list. If @var{direction} is negative, the search --- 279,293 ---- @end deftypefun ! @deftypefun int history_search_prefix (const char *string, int direction) Search the history for @var{string}, starting at the current history offset. The search is anchored: matching lines must begin with ! @var{string}. If @var{direction} is less than 0, then the search is ! through previous entries, otherwise through subsequent entries. ! If @var{string} 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. @end deftypefun ! @deftypefun int history_search_pos (const char *string, int direction, int pos) Search for @var{string} in the history list, starting at @var{pos}, an absolute index into the list. If @var{direction} is negative, the search *************** *** 293,306 **** This section documents the functions for managing a history file. ! @deftypefun int read_history (char *filename) ! Add the contents of @var{filename} to the history list, a line at a ! time. If @var{filename} is @code{NULL}, then read from ! @file{~/.history}. Returns 0 if successful, or errno if not. @end deftypefun ! @deftypefun int read_history_range (char *filename, int from, int to) Read a range of lines from @var{filename}, adding them to the history list. ! Start reading at line @var{from} and end at @var{to}. If ! @var{from} is zero, start at the beginning. If @var{to} is less than @var{from}, then read until the end of the file. If @var{filename} is @code{NULL}, then read from @file{~/.history}. Returns 0 if successful, --- 302,315 ---- This section documents the functions for managing a history file. ! @deftypefun int read_history (const char *filename) ! Add the contents of @var{filename} to the history list, a line at a time. ! If @var{filename} is @code{NULL}, then read from @file{~/.history}. ! Returns 0 if successful, or @code{errno} if not. @end deftypefun ! @deftypefun int read_history_range (const char *filename, int from, int to) Read a range of lines from @var{filename}, adding them to the history list. ! Start reading at line @var{from} and end at @var{to}. ! If @var{from} is zero, start at the beginning. If @var{to} is less than @var{from}, then read until the end of the file. If @var{filename} is @code{NULL}, then read from @file{~/.history}. Returns 0 if successful, *************** *** 308,325 **** @end deftypefun ! @deftypefun int write_history (char *filename) Write the current history to @var{filename}, overwriting @var{filename} ! if necessary. If @var{filename} is ! @code{NULL}, then write the history list to @file{~/.history}. Values ! returned are as in @code{read_history ()}. @end deftypefun ! @deftypefun int append_history (int nelements, char *filename) Append the last @var{nelements} of the history list to @var{filename}. @end deftypefun ! @deftypefun int history_truncate_file (char *filename, int nlines) Truncate the history file @var{filename}, leaving only the last @var{nlines} lines. @end deftypefun --- 317,339 ---- @end deftypefun ! @deftypefun int write_history (const char *filename) Write the current history to @var{filename}, overwriting @var{filename} ! if necessary. ! If @var{filename} is @code{NULL}, then write the history list to ! @file{~/.history}. ! Returns 0 on success, or @code{errno} on a read or write error. @end deftypefun ! @deftypefun int append_history (int nelements, const char *filename) Append the last @var{nelements} of the history list to @var{filename}. + If @var{filename} is @code{NULL}, then append to @file{~/.history}. + Returns 0 on success, or @code{errno} on a read or write error. @end deftypefun ! @deftypefun int history_truncate_file (const char *filename, int nlines) Truncate the history file @var{filename}, leaving only the last @var{nlines} lines. + If @var{filename} is @code{NULL}, then @file{~/.history} is truncated. + Returns 0 on success, or @code{errno} on failure. @end deftypefun *************** *** 327,331 **** @subsection History Expansion ! These functions implement @code{csh}-like history expansion. @deftypefun int history_expand (char *string, char **output) --- 341,345 ---- @subsection History Expansion ! These functions implement history expansion. @deftypefun int history_expand (char *string, char **output) *************** *** 335,339 **** @item 0 If no expansions took place (or, if the only change in ! the text was the de-slashifying of the history expansion character); @item 1 --- 349,353 ---- @item 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); @item 1 *************** *** 350,359 **** @end deftypefun ! @deftypefun {char *} history_arg_extract (int first, int last, char *string) ! Extract a string segment consisting of the @var{first} through @var{last} ! arguments present in @var{string}. Arguments are broken up as in Bash. ! @end deftypefun ! ! @deftypefun {char *} get_history_event (char *string, int *cindex, int qchar) Returns the text of the history event beginning at @var{string} + @var{*cindex}. @var{*cindex} is modified to point to after the event --- 364,368 ---- @end deftypefun ! @deftypefun {char *} get_history_event (const char *string, int *cindex, int qchar) Returns the text of the history event beginning at @var{string} + @var{*cindex}. @var{*cindex} is modified to point to after the event *************** *** 364,372 **** @end deftypefun ! @deftypefun {char **} history_tokenize (char *string) Return an array of tokens parsed out of @var{string}, much as the ! shell might. The tokens are split on white space and on the ! characters @code{()<>;&|$}, and shell quoting conventions are ! obeyed. @end deftypefun --- 373,387 ---- @end deftypefun ! @deftypefun {char **} history_tokenize (const char *string) Return an array of tokens parsed out of @var{string}, much as the ! shell might. The tokens are split on the characters in the ! @var{history_word_delimiters} variable, ! and shell quoting conventions are obeyed. ! @end deftypefun ! ! @deftypefun {char *} history_arg_extract (int first, int last, const char *string) ! Extract a string segment consisting of the @var{first} through @var{last} ! arguments present in @var{string}. Arguments are split using ! @code{history_tokenize}. @end deftypefun *************** *** 374,379 **** @section History Variables ! This section describes the externally visible variables exported by ! the GNU History Library. @deftypevar int history_base --- 389,394 ---- @section History Variables ! This section describes the externally-visible variables exported by ! the @sc{gnu} History Library. @deftypevar int history_base *************** *** 385,395 **** @end deftypevar ! @deftypevar int max_input_history The maximum number of history entries. This must be changed using ! @code{stifle_history ()}. @end deftypevar @deftypevar char history_expansion_char ! The character that starts a history event. The default is @samp{!}. @end deftypevar --- 400,411 ---- @end deftypevar ! @deftypevar int history_max_entries The maximum number of history entries. This must be changed using ! @code{stifle_history()}. @end deftypevar @deftypevar char history_expansion_char ! The character that introduces a history event. The default is @samp{!}. ! Setting this to 0 inhibits history expansion. @end deftypevar *************** *** 406,418 **** @end deftypevar @deftypevar {char *} history_no_expand_chars The list of characters which inhibit history expansion if found immediately ! following @var{history_expansion_char}. The default is whitespace and ! @samp{=}. @end deftypevar @deftypevar {char *} history_search_delimiter_chars The list of additional characters which can delimit a history search ! string, in addition to whitespace, @samp{:} and @samp{?} in the case of a substring search. The default is empty. @end deftypevar --- 422,439 ---- @end deftypevar + @deftypevar {char *} history_word_delimiters + The characters that separate tokens for \fBhistory_tokenize()\fP. + The default value is @code{" \t\n()<>;&|"}. + @end deftypevar + @deftypevar {char *} history_no_expand_chars The list of characters which inhibit history expansion if found immediately ! following @var{history_expansion_char}. The default is space, tab, newline, ! carriage return, and @samp{=}. @end deftypevar @deftypevar {char *} history_search_delimiter_chars The list of additional characters which can delimit a history search ! string, in addition to space, TAB, @samp{:} and @samp{?} in the case of a substring search. The default is empty. @end deftypevar *************** *** 423,429 **** @end deftypevar ! @deftypevar {Function *} history_inhibit_expansion_function This should be set to the address of a function that takes two arguments: ! a @code{char *} (@var{string}) and an integer index into that string (@var{i}). It should return a non-zero value if the history expansion starting at @var{string[i]} should not be performed; zero if the expansion should --- 444,451 ---- @end deftypevar ! @deftypevar {rl_linebuf_func_t *} history_inhibit_expansion_function This should be set to the address of a function that takes two arguments: ! a @code{char *} (@var{string}) ! and an @code{int} index into that string (@var{i}). It should return a non-zero value if the history expansion starting at @var{string[i]} should not be performed; zero if the expansion should *************** *** 431,435 **** It is intended for use by applications like Bash that use the history expansion character for additional purposes. ! By default, this variable is set to NULL. @end deftypevar --- 453,457 ---- It is intended for use by applications like Bash that use the history expansion character for additional purposes. ! By default, this variable is set to @code{NULL}. @end deftypevar *************** *** 437,444 **** @section History Programming Example ! The following program demonstrates simple use of the GNU History Library. @smallexample ! main () @{ char line[1024], *t; --- 459,471 ---- @section History Programming Example ! The following program demonstrates simple use of the @sc{gnu} History Library. @smallexample ! #include ! #include ! ! main (argc, argv) ! int argc; ! char **argv; @{ char line[1024], *t; diff -Nrc2 readline-4.1/doc/hsuser.texinfo readline-4.2/doc/hsuser.texinfo *** readline-4.1/doc/hsuser.texinfo Fri Dec 17 07:01:17 1999 --- readline-4.2/doc/hsuser.texinfo Wed Nov 22 12:42:50 2000 *************** *** 39,45 **** @end ifset @ifclear BashFeatures ! This chapter describes how to use the GNU History Library interactively, from a user's standpoint. It should be considered a user's guide. For ! information on using the GNU History Library in your own programs, @pxref{Programming with GNU History}. @end ifclear --- 39,45 ---- @end ifset @ifclear BashFeatures ! This chapter describes how to use the @sc{gnu} History Library interactively, from a user's standpoint. It should be considered a user's guide. For ! information on using the @sc{gnu} History Library in your own programs, @pxref{Programming with GNU History}. @end ifclear *************** *** 66,76 **** @cindex history list ! When the @samp{-o history} option to the @code{set} builtin is enabled (@pxref{The Set Builtin}), ! the shell provides access to the @var{command history}, the list of commands previously typed. ! The value of the @code{HISTSIZE} shell variable is used as the number of commands to save in a history list. ! The text of the last @code{$HISTSIZE} commands (default 500) is saved. The shell stores each command in the history list prior to --- 66,76 ---- @cindex history list ! When the @option{-o history} option to the @code{set} builtin is enabled (@pxref{The Set Builtin}), ! the shell provides access to the @dfn{command history}, the list of commands previously typed. ! The value of the @env{HISTSIZE} shell variable is used as the number of commands to save in a history list. ! The text of the last @env{$HISTSIZE} commands (default 500) is saved. The shell stores each command in the history list prior to *************** *** 78,99 **** but after history expansion is performed, subject to the values of the shell variables ! @code{HISTIGNORE} and @code{HISTCONTROL}. When the shell starts up, the history is initialized from the ! file named by the @code{HISTFILE} variable (default @file{~/.bash_history}). ! The file named by the value of @code{HISTFILE} is truncated, if necessary, to contain no more than the number of lines specified by ! the value of the @code{HISTFILESIZE} variable. When an interactive shell exits, the last ! @code{$HISTSIZE} lines are copied from the history list to the file ! named by @code{$HISTFILE}. If the @code{histappend} shell option is set (@pxref{Bash Builtins}), the lines are appended to the history file, otherwise the history file is overwritten. ! If @code{HISTFILE} is unset, or if the history file is unwritable, the history is not saved. After saving the history, the history file is truncated ! to contain no more than @code{$HISTFILESIZE} ! lines. If @code{HISTFILESIZE} is not set, no truncation is performed. The builtin command @code{fc} may be used to list or edit and re-execute --- 78,99 ---- but after history expansion is performed, subject to the values of the shell variables ! @env{HISTIGNORE} and @env{HISTCONTROL}. When the shell starts up, the history is initialized from the ! file named by the @env{HISTFILE} variable (default @file{~/.bash_history}). ! The file named by the value of @env{HISTFILE} is truncated, if necessary, to contain no more than the number of lines specified by ! the value of the @env{HISTFILESIZE} variable. When an interactive shell exits, the last ! @env{$HISTSIZE} lines are copied from the history list to the file ! named by @env{$HISTFILE}. If the @code{histappend} shell option is set (@pxref{Bash Builtins}), the lines are appended to the history file, otherwise the history file is overwritten. ! If @env{HISTFILE} is unset, or if the history file is unwritable, the history is not saved. After saving the history, the history file is truncated ! to contain no more than @env{$HISTFILESIZE} ! lines. If @env{HISTFILESIZE} is not set, no truncation is performed. The builtin command @code{fc} may be used to list or edit and re-execute *************** *** 106,110 **** The shell allows control over which commands are saved on the history ! list. The @code{HISTCONTROL} and @code{HISTIGNORE} variables may be set to cause the shell to save only a subset of the commands entered. --- 106,110 ---- The shell allows control over which commands are saved on the history ! list. The @env{HISTCONTROL} and @env{HISTIGNORE} variables may be set to cause the shell to save only a subset of the commands entered. *************** *** 142,154 **** current command number). If @var{last} is not specified it is set to @var{first}. If @var{first} is not specified it is set to the previous ! command for editing and @minus{}16 for listing. If the @samp{-l} flag is ! given, the commands are listed on standard output. The @samp{-n} flag ! suppresses the command numbers when listing. The @samp{-r} flag reverses the order of the listing. Otherwise, the editor given by @var{ename} is invoked on a file containing those commands. If @var{ename} is not given, the value of the following variable expansion is used: @code{$@{FCEDIT:-$@{EDITOR:-vi@}@}}. This says to use the ! value of the @code{FCEDIT} variable if set, or the value of the ! @code{EDITOR} variable if that is set, or @code{vi} if neither is set. When editing is complete, the edited commands are echoed and executed. --- 142,154 ---- current command number). If @var{last} is not specified it is set to @var{first}. If @var{first} is not specified it is set to the previous ! command for editing and @minus{}16 for listing. If the @option{-l} flag is ! given, the commands are listed on standard output. The @option{-n} flag ! suppresses the command numbers when listing. The @option{-r} flag reverses the order of the listing. Otherwise, the editor given by @var{ename} is invoked on a file containing those commands. If @var{ename} is not given, the value of the following variable expansion is used: @code{$@{FCEDIT:-$@{EDITOR:-vi@}@}}. This says to use the ! value of the @env{FCEDIT} variable if set, or the value of the ! @env{EDITOR} variable if that is set, or @code{vi} if neither is set. When editing is complete, the edited commands are echoed and executed. *************** *** 171,175 **** With no options, display the history list with line numbers. ! Lines prefixed with with a @samp{*} have been modified. An argument of @var{n} lists only the last @var{n} lines. Options, if supplied, have the following meanings: --- 171,175 ---- With no options, display the history list with line numbers. ! Lines prefixed with a @samp{*} have been modified. An argument of @var{n} lists only the last @var{n} lines. Options, if supplied, have the following meanings: *************** *** 212,219 **** @end table ! When any of the @samp{-w}, @samp{-r}, @samp{-a}, or @samp{-n} options is used, if @var{filename} is given, then it is used as the history file. If not, then ! the value of the @code{HISTFILE} variable is used. @end table --- 212,219 ---- @end table ! When any of the @option{-w}, @option{-r}, @option{-a}, or @option{-n} options is used, if @var{filename} is given, then it is used as the history file. If not, then ! the value of the @env{HISTFILE} variable is used. @end table *************** *** 261,267 **** shell option is enabled, a failed history expansion will be reloaded into the Readline editing buffer for correction. ! The @samp{-p} option to the @code{history} builtin command may be used to see what a history expansion will do before using it. ! The @samp{-s} option to the @code{history} builtin may be used to add commands to the end of the history list without actually executing them, so that they are available for subsequent recall. --- 261,267 ---- shell option is enabled, a failed history expansion will be reloaded into the Readline editing buffer for correction. ! The @option{-p} option to the @code{history} builtin command may be used to see what a history expansion will do before using it. ! The @option{-s} option to the @code{history} builtin may be used to add commands to the end of the history list without actually executing them, so that they are available for subsequent recall. diff -Nrc2 readline-4.1/doc/manvers.texinfo readline-4.2/doc/manvers.texinfo *** readline-4.1/doc/manvers.texinfo Wed Jan 19 12:16:33 2000 --- readline-4.2/doc/manvers.texinfo Mon Apr 16 10:54:00 2001 *************** *** 1,6 **** ! @set EDITION 4.1 ! @set VERSION 4.1 ! @set UPDATED 2000 January 19 ! @set UPDATE-MONTH January 2000 ! @set LASTCHANGE Wed Jan 19 12:16:30 EST 2000 --- 1,6 ---- ! @set EDITION 4.2 ! @set VERSION 4.2 ! @set UPDATED 2001 Apr 16 ! @set UPDATE-MONTH Apr 2001 ! @set LASTCHANGE Mon Apr 16 10:53:58 EDT 2001 diff -Nrc2 readline-4.1/doc/readline.0 readline-4.2/doc/readline.0 *** readline-4.1/doc/readline.0 Fri Aug 6 16:00:41 1999 --- readline-4.2/doc/readline.0 Mon Mar 5 11:20:23 2001 *************** *** 10,30 **** SSYYNNOOPPSSIISS ##iinncclluuddee < > ! ##iinncclluuddee <> ! ##iinncclluuddee < > ! cchhaarr **rreeaaddlliinnee ((pprroommpptt)) ! cchhaarr **pprroommpptt;; CCOOPPYYRRIIGGHHTT ! Readline is Copyright (C) 1989, 1991, 1993, 1995, 1996 by ! the Free Software Foundation, Inc. DDEESSCCRRIIPPTTIIOONN rreeaaddlliinnee will read a line from the terminal and return it, ! using pprroommpptt as a prompt. If pprroommpptt is null, no prompt is ! issued. The line returned is allocated with _m_a_l_l_o_c(3), so ! the caller must free it when finished. The line returned ! has the final newline removed, so only the text of the ! line remains. rreeaaddlliinnee offers editing capabilities while the user is --- 10,30 ---- SSYYNNOOPPSSIISS ##iinncclluuddee < > ! ##iinncclluuddee <> ! ##iinncclluuddee < > ! _c_h_a_r _* ! rreeaaddlliinnee (_c_o_n_s_t _c_h_a_r _*_p_r_o_m_p_t); CCOOPPYYRRIIGGHHTT ! Readline is Copyright (C) 1989-2001 by the Free Software ! Foundation, Inc. DDEESSCCRRIIPPTTIIOONN rreeaaddlliinnee will read a line from the terminal and return it, ! using pprroommpptt as a prompt. If pprroommpptt is NNUULLLL or the empty ! string, no prompt is issued. The line returned is allo- ! cated with _m_a_l_l_o_c(3); the caller must free it when fin- ! ished. The line returned has the final newline removed, ! so only the text of the line remains. rreeaaddlliinnee offers editing capabilities while the user is *************** *** 33,66 **** interface is also available. RREETTUURRNN VVAALLUUEE ! rreeaaddlliinnee returns the text of the line read. A blank line ! returns the empty string. If EEOOFF is encountered while ! reading a line, and the line is empty, NNUULLLL is returned. ! If an EEOOFF is read with a non-empty line, it is treated as a newline. NNOOTTAATTIIOONN ! An emacs-style notation is used to denote keystrokes. ! Control keys are denoted by C-_k_e_y, e.g., C-n means Con- trol-N. Similarly, _m_e_t_a keys are denoted by M-_k_e_y, so M-x means Meta-X. (On keyboards without a _m_e_t_a key, M-_x means ! ESC _x, i.e., press the Escape key then the _x key. This ! makes ESC the _m_e_t_a _p_r_e_f_i_x. The combination M-C-_x means ! ESC-Control-_x, or press the Escape key then hold the Con- trol key while pressing the _x key.) ! Readline commands may be given numeric _a_r_g_u_m_e_n_t_s, which normally act as a repeat count. Sometimes, however, it is ! the sign of the argument that is significant. Passing a ! negative argument to a command that acts in the forward ! direction (e.g., kkiillll--lliinnee) causes that command to act in ! a backward direction. Commands whose behavior with argu- ! ments deviates from this are noted. ! ! When a command is described as _k_i_l_l_i_n_g text, the text ! GNU 1999 Jun 1 1 --- 33,66 ---- interface is also available. + This manual page describes only the most basic use of + rreeaaddlliinnee. Much more functionality is available; see _T_h_e + _G_N_U _R_e_a_d_l_i_n_e _L_i_b_r_a_r_y and _T_h_e _G_N_U _H_i_s_t_o_r_y _L_i_b_r_a_r_y for addi- + tional information. + RREETTUURRNN VVAALLUUEE ! rreeaaddlliinnee returns the text of the line read. A blank line ! returns the empty string. If EEOOFF is encountered while ! reading a line, and the line is empty, NNUULLLL is returned. ! If an EEOOFF is read with a non-empty line, it is treated as a newline. NNOOTTAATTIIOONN ! An emacs-style notation is used to denote keystrokes. ! Control keys are denoted by C-_k_e_y, e.g., C-n means Con- trol-N. Similarly, _m_e_t_a keys are denoted by M-_k_e_y, so M-x means Meta-X. (On keyboards without a _m_e_t_a key, M-_x means ! ESC _x, i.e., press the Escape key then the _x key. This ! makes ESC the _m_e_t_a _p_r_e_f_i_x. The combination M-C-_x means ! ESC-Control-_x, or press the Escape key then hold the Con- trol key while pressing the _x key.) ! Readline commands may be given numeric _a_r_g_u_m_e_n_t_s, which normally act as a repeat count. Sometimes, however, it is ! the sign of the argument that is significant. Passing a ! negative argument to a command that acts in the forward ! GNU Readline 4.2 2001 Mar 5 1 *************** *** 71,92 **** ! deleted is saved for possible future retrieval (_y_a_n_k_i_n_g). ! The killed text is saved in a _k_i_l_l _r_i_n_g. Consecutive ! kills cause the text to be accumulated into one unit, ! which can be yanked all at once. Commands which do not kill text separate the chunks of text on the kill ring. IINNIITTIIAALLIIZZAATTIIOONN FFIILLEE ! Readline is customized by putting commands in an initial- ization file (the _i_n_p_u_t_r_c file). The name of this file is ! taken from the value of the IINNPPUUTTRRCC environment variable. ! If that variable is unset, the default is _~_/_._i_n_p_u_t_r_c. ! When a program which uses the readline library starts up, ! the init file is read, and the key bindings and variables are set. There are only a few basic constructs allowed in ! the readline init file. Blank lines are ignored. Lines beginning with a ## are comments. Lines beginning with a $$ ! indicate conditional constructs. Other lines denote key ! bindings and variable settings. Each program using this library may add its own commands and bindings. --- 71,97 ---- ! direction (e.g., kkiillll--lliinnee) causes that command to act in ! a backward direction. Commands whose behavior with argu- ! ments deviates from this are noted. ! ! When a command is described as _k_i_l_l_i_n_g text, the text ! deleted is saved for possible future retrieval (_y_a_n_k_i_n_g). ! The killed text is saved in a _k_i_l_l _r_i_n_g. Consecutive ! kills cause the text to be accumulated into one unit, ! which can be yanked all at once. Commands which do not kill text separate the chunks of text on the kill ring. IINNIITTIIAALLIIZZAATTIIOONN FFIILLEE ! Readline is customized by putting commands in an initial- ization file (the _i_n_p_u_t_r_c file). The name of this file is ! taken from the value of the IINNPPUUTTRRCC environment variable. ! If that variable is unset, the default is _~_/_._i_n_p_u_t_r_c. ! When a program which uses the readline library starts up, ! the init file is read, and the key bindings and variables are set. There are only a few basic constructs allowed in ! the readline init file. Blank lines are ignored. Lines beginning with a ## are comments. Lines beginning with a $$ ! indicate conditional constructs. Other lines denote key ! bindings and variable settings. Each program using this library may add its own commands and bindings. *************** *** 96,107 **** or C-Meta-u: universal-argument ! into the _i_n_p_u_t_r_c would make M-C-u execute the readline command _u_n_i_v_e_r_s_a_l_-_a_r_g_u_m_e_n_t. ! The following symbolic character names are recognized ! while processing key bindings: _R_U_B_O_U_T, _D_E_L, _E_S_C, _L_F_D, _N_E_W_- ! _L_I_N_E, _R_E_T, _R_E_T_U_R_N, _S_P_C, _S_P_A_C_E, and _T_A_B. ! In addition to command names, readline allows keys to be bound to a string that is inserted when the key is pressed (a _m_a_c_r_o). --- 101,113 ---- or C-Meta-u: universal-argument ! ! into the _i_n_p_u_t_r_c would make M-C-u execute the readline command _u_n_i_v_e_r_s_a_l_-_a_r_g_u_m_e_n_t. ! The following symbolic character names are recognized ! while processing key bindings: _D_E_L, _E_S_C, _E_S_C_A_P_E, _L_F_D, _N_E_W_- ! _L_I_N_E, _R_E_T, _R_E_T_U_R_N, _R_U_B_O_U_T, _S_P_A_C_E, _S_P_C, and _T_A_B. ! In addition to command names, readline allows keys to be bound to a string that is inserted when the key is pressed (a _m_a_c_r_o). *************** *** 109,132 **** KKeeyy BBiinnddiinnggss ! The syntax for controlling key bindings in the _i_n_p_u_t_r_c ! file is simple. All that is required is the name of the command or the text of a macro and a key sequence to which ! it should be bound. The name may be specified in one of ! two ways: as a symbolic key name, possibly with _M_e_t_a_- or ! _C_o_n_t_r_o_l_- prefixes, or as a key sequence. When using the ! form kkeeyynnaammee:_f_u_n_c_t_i_o_n_-_n_a_m_e or _m_a_c_r_o, _k_e_y_n_a_m_e is the name ! of a key spelled out in English. For example: ! Control-u: universal-argument ! Meta-Rubout: backward-kill-word ! Control-o: ">&output" - In the above example, _C_-_u is bound to the function uunniivveerr-- - ssaall--aarrgguummeenntt, _M_-_D_E_L is bound to the function bbaacckk-- - wwaarrdd--kkiillll--wwoorrdd, and _C_-_o is bound to run the macro ! ! GNU 1999 Jun 1 2 --- 115,132 ---- KKeeyy BBiinnddiinnggss ! The syntax for controlling key bindings in the _i_n_p_u_t_r_c ! file is simple. All that is required is the name of the command or the text of a macro and a key sequence to which ! it should be bound. The name may be specified in one of ! two ways: as a symbolic key name, possibly with _M_e_t_a_- or ! _C_o_n_t_r_o_l_- prefixes, or as a key sequence. ! When using the form kkeeyynnaammee:_f_u_n_c_t_i_o_n_-_n_a_m_e or _m_a_c_r_o, _k_e_y_- ! _n_a_m_e is the name of a key spelled out in English. For ! example: ! GNU Readline 4.2 2001 Mar 5 2 *************** *** 137,148 **** ! expressed on the right hand side (that is, to insert the ! text _>_&_o_u_t_p_u_t into the line). ! In the second form, ""kkeeyysseeqq"":_f_u_n_c_t_i_o_n_-_n_a_m_e or _m_a_c_r_o, kkeeyy-- sseeqq differs from kkeeyynnaammee above in that strings denoting an ! entire key sequence may be specified by placing the ! sequence within double quotes. Some GNU Emacs style key ! escapes can be used, as in the following example. "\C-u": universal-argument --- 137,156 ---- ! Control-u: universal-argument ! Meta-Rubout: backward-kill-word ! Control-o: "> output" ! ! In the above example, _C_-_u is bound to the function uunniivveerr-- ! ssaall--aarrgguummeenntt, _M_-_D_E_L is bound to the function bbaacckk-- ! wwaarrdd--kkiillll--wwoorrdd, and _C_-_o is bound to run the macro ! expressed on the right hand side (that is, to insert the ! text ``> output'' into the line). ! In the second form, ""kkeeyysseeqq"":_f_u_n_c_t_i_o_n_-_n_a_m_e or _m_a_c_r_o, kkeeyy-- sseeqq differs from kkeeyynnaammee above in that strings denoting an ! entire key sequence may be specified by placing the ! sequence within double quotes. Some GNU Emacs style key ! escapes can be used, as in the following example, but the ! symbolic character names are not recognized. "\C-u": universal-argument *************** *** 153,164 **** vveerrssaall--aarrgguummeenntt. _C_-_x _C_-_r is bound to the function rree--rreeaadd--iinniitt--ffiillee, and _E_S_C _[ _1 _1 _~ is bound to insert the ! text FFuunnccttiioonn KKeeyy 11. The full set of GNU Emacs style ! escape sequences is \\CC-- control prefix \\MM-- meta prefix \\ee an escape character \\\\ backslash ! \\"" literal " ! \\'' literal ' In addition to the GNU Emacs style escape sequences, a --- 161,174 ---- vveerrssaall--aarrgguummeenntt. _C_-_x _C_-_r is bound to the function rree--rreeaadd--iinniitt--ffiillee, and _E_S_C _[ _1 _1 _~ is bound to insert the ! text ``Function Key 1''. ! ! The full set of GNU Emacs style escape sequences available ! when specifying key sequences is \\CC-- control prefix \\MM-- meta prefix \\ee an escape character \\\\ backslash ! \\"" literal ", a double quote ! \\'' literal ', a single quote In addition to the GNU Emacs style escape sequences, a *************** *** 180,198 **** should be used to indicate a macro definition. Unquoted text is assumed to be a function name. In the macro body, ! the backslash escapes described above are expanded. Back- ! slash will quote any other character in the macro text, ! including " and '. - BBaasshh allows the current readline key bindings to be dis- - played or modified with the bbiinndd builtin command. The - editing mode may be switched during interactive use by - using the --oo option to the sseett builtin command. Other - programs using this library provide similar mechanisms. - The _i_n_p_u_t_r_c file may be edited and re-read if a program - does not provide any other means to incorporate new ! ! GNU 1999 Jun 1 3 --- 190,198 ---- should be used to indicate a macro definition. Unquoted text is assumed to be a function name. In the macro body, ! the backslash escapes described above are expanded. ! GNU Readline 4.2 2001 Mar 5 3 *************** *** 203,207 **** ! bindings. VVaarriiaabblleess --- 203,217 ---- ! Backslash will quote any other character in the macro ! text, including " and '. ! ! BBaasshh allows the current readline key bindings to be dis- ! played or modified with the bbiinndd builtin command. The ! editing mode may be switched during interactive use by ! using the --oo option to the sseett builtin command. Other ! programs using this library provide similar mechanisms. ! The _i_n_p_u_t_r_c file may be edited and re-read if a program ! does not provide any other means to incorporate new bind- ! ings. VVaarriiaabblleess *************** *** 213,264 **** Except where noted, readline variables can take the values ! OOnn or OOffff. The variables and their default values are: bbeellll--ssttyyllee ((aauuddiibbllee)) ! Controls what happens when readline wants to ring ! the terminal bell. If set to nnoonnee, readline never rings the bell. If set to vviissiibbllee, readline uses a ! visible bell if one is available. If set to aauuddii-- bbllee, readline attempts to ring the terminal's bell. ccoommmmeenntt--bbeeggiinn ((````##'''')) ! The string that is inserted in vvii mode when the ! iinnsseerrtt--ccoommmmeenntt command is executed. This command ! is bound to MM--## in emacs mode and to ## in vi com- mand mode. ccoommpplleettiioonn--iiggnnoorree--ccaassee ((OOffff)) ! If set to OOnn, readline performs filename matching and completion in a case-insensitive fashion. ccoommpplleettiioonn--qquueerryy--iitteemmss ((110000)) ! This determines when the user is queried about ! viewing the number of possible completions gener- ! ated by the ppoossssiibbllee--ccoommpplleettiioonnss command. It may ! be set to any integer value greater than or equal ! to zero. If the number of possible completions is ! greater than or equal to the value of this vari- able, the user is asked whether or not he wishes to ! view them; otherwise they are simply listed on the terminal. ccoonnvveerrtt--mmeettaa ((OOnn)) If set to OOnn, readline will convert characters with ! the eighth bit set to an ASCII key sequence by ! stripping the eighth bit and prepending an escape ! character (in effect, using escape as the _m_e_t_a _p_r_e_- ! _f_i_x). ! ddiissaabbllee--ccoommpplleettiioonn ((OOffff)) ! If set to OOnn, readline will inhibit word comple- ! tion. Completion characters will be inserted into ! the line as if they had been mapped to sseellff--iinnsseerrtt. ! eeddiittiinngg--mmooddee ((eemmaaccss)) ! Controls whether readline begins with a set of key ! bindings similar to _e_m_a_c_s or _v_i. eeddiittiinngg--mmooddee can ! be set to either eemmaaccss or vvii. ! eennaabbllee--kkeeyyppaadd ((OOffff)) ! When set to OOnn, readline will try to enable the ! application keypad when it is called. Some systems ! need this to enable the arrow keys. ! GNU 1999 Jun 1 4 --- 223,264 ---- Except where noted, readline variables can take the values ! OOnn or OOffff (without regard to case). The variables and ! their default values are: bbeellll--ssttyyllee ((aauuddiibbllee)) ! Controls what happens when readline wants to ring ! the terminal bell. If set to nnoonnee, readline never rings the bell. If set to vviissiibbllee, readline uses a ! visible bell if one is available. If set to aauuddii-- bbllee, readline attempts to ring the terminal's bell. ccoommmmeenntt--bbeeggiinn ((````##'''')) ! The string that is inserted in vvii mode when the ! iinnsseerrtt--ccoommmmeenntt command is executed. This command ! is bound to MM--## in emacs mode and to ## in vi com- mand mode. ccoommpplleettiioonn--iiggnnoorree--ccaassee ((OOffff)) ! If set to OOnn, readline performs filename matching and completion in a case-insensitive fashion. ccoommpplleettiioonn--qquueerryy--iitteemmss ((110000)) ! This determines when the user is queried about ! viewing the number of possible completions gener- ! ated by the ppoossssiibbllee--ccoommpplleettiioonnss command. It may ! be set to any integer value greater than or equal ! to zero. If the number of possible completions is ! greater than or equal to the value of this vari- able, the user is asked whether or not he wishes to ! view them; otherwise they are simply listed on the terminal. ccoonnvveerrtt--mmeettaa ((OOnn)) If set to OOnn, readline will convert characters with ! the eighth bit set to an ASCII key sequence by ! stripping the eighth bit and prefixing it with an ! escape character (in effect, using escape as the ! _m_e_t_a _p_r_e_f_i_x). ! ! GNU Readline 4.2 2001 Mar 5 4 *************** *** 269,302 **** eexxppaanndd--ttiillddee ((OOffff)) ! If set to oonn, tilde expansion is performed when readline attempts word completion. hhoorriizzoonnttaall--ssccrroollll--mmooddee ((OOffff)) ! When set to OOnn, makes readline use a single line ! for display, scrolling the input horizontally on a ! single screen line when it becomes longer than the screen width rather than wrapping to a new line. iinnppuutt--mmeettaa ((OOffff)) ! If set to OOnn, readline will enable eight-bit input ! (that is, it will not strip the high bit from the characters it reads), regardless of what the termi- nal claims it can support. The name mmeettaa--ffllaagg is a synonym for this variable. ! iisseeaarrcchh--tteerrmmiinnaattoorrss ((````CC--[[CC--JJ'''')) ! The string of characters that should terminate an ! incremental search without subsequently executing ! the character as a command. If this variable has ! not been given a value, the characters _E_S_C and _C_-_J will terminate an incremental search. kkeeyymmaapp ((eemmaaccss)) ! Set the current readline keymap. The set of legal ! keymap names is _e_m_a_c_s_, _e_m_a_c_s_-_s_t_a_n_d_a_r_d_, _e_m_a_c_s_-_m_e_t_a_, _e_m_a_c_s_-_c_t_l_x_, _v_i_, _v_i_-_m_o_v_e_, _v_i_-_c_o_m_m_a_n_d, and _v_i_-_i_n_s_e_r_t. _v_i is equivalent to _v_i_-_c_o_m_m_a_n_d; _e_m_a_c_s is equivalent ! to _e_m_a_c_s_-_s_t_a_n_d_a_r_d. The default value is _e_m_a_c_s; the ! value of eeddiittiinngg--mmooddee also affects the default keymap. mmaarrkk--ddiirreeccttoorriieess ((OOnn)) ! If set to OOnn, complete >)) ! Set the mark to the current point. If a numeric ! argument is supplied, the mark is set to that posi- ! tion. ! eexxcchhaannggee--ppooiinntt--aanndd--mmaarrkk ((CC--xx CC--xx)) ! Swap the point with the mark. The current cursor ! position is set to the saved position, and the old ! GNU 1999 Jun 1 12 --- 780,792 ---- bbeellll--ssttyyllee). ddoo--uuppppeerrccaassee--vveerrssiioonn ((MM--aa,, MM--bb,, MM--_x,, ......)) ! If the metafied character _x is lowercase, run the ! command that is bound to the corresponding upper- case character. pprreeffiixx--mmeettaa ((EESSCC)) ! Metafy the next character typed. EESSCC ff is ! GNU Readline 4.2 2001 Mar 5 12 *************** *** 797,800 **** --- 797,816 ---- + equivalent to MMeettaa--ff. + uunnddoo ((CC--__,, CC--xx CC--uu)) + Incremental undo, separately remembered for each + line. + rreevveerrtt--lliinnee ((MM--rr)) + Undo all changes made to this line. This is like + executing the uunnddoo command enough times to return + the line to its initial state. + ttiillddee--eexxppaanndd ((MM--&&)) + Perform tilde expansion on the current word. + sseett--mmaarrkk ((CC--@@,, MM--< >)) + Set the mark to the point. If a numeric argument + is supplied, the mark is set to that position. + eexxcchhaannggee--ppooiinntt--aanndd--mmaarrkk ((CC--xx CC--xx)) + Swap the point with the mark. The current cursor + position is set to the saved position, and the old cursor position is saved as the mark. cchhaarraacctteerr--sseeaarrcchh ((CC--]])) *************** *** 810,815 **** inserted at the beginning of the current line, and the line is accepted as if a newline had been ! typed. This makes the current line a shell com- ! ment. dduummpp--ffuunnccttiioonnss Print all of the functions and their key bindings --- 826,831 ---- inserted at the beginning of the current line, and the line is accepted as if a newline had been ! typed. The default value of ccoommmmeenntt--bbeeggiinn makes ! the current line a shell comment. dduummpp--ffuunnccttiioonnss Print all of the functions and their key bindings *************** *** 836,858 **** vvii editing mode. - DDEEFFAAUULLTT KKEEYY BBIINNDDIINNGGSS - The following is a list of the default emacs and vi bind- - ings. Characters with the 8th bit set are written as - M-, and are referred to as _m_e_t_a_f_i_e_d characters. - The printable ASCII characters not mentioned in the list - of emacs standard bindings are bound to the _s_e_l_f_-_i_n_s_e_r_t - function, which just inserts the given character into the - input line. In vi insertion mode, all characters not - specifically mentioned are bound to _s_e_l_f_-_i_n_s_e_r_t. Charac- - ters assigned to signal generation by _s_t_t_y(1) or the ter- - minal driver, such as C-Z or C-C, retain that function. - Upper and lower case _m_e_t_a_f_i_e_d characters are bound to the - same function in the emacs mode meta keymap. The remain- - ing characters are unbound, which causes readline to ring - the bell (subject to the setting of the bbeellll--ssttyyllee - ! GNU 1999 Jun 1 13 --- 852,858 ---- vvii editing mode. ! GNU Readline 4.2 2001 Mar 5 13 *************** *** 863,867 **** ! variable). EEmmaaccss MMooddee --- 863,882 ---- ! DDEEFFAAUULLTT KKEEYY BBIINNDDIINNGGSS ! The following is a list of the default emacs and vi bind- ! ings. Characters with the eighth bit set are written as ! M- , and are referred to as _m_e_t_a_f_i_e_d characters. ! The printable ASCII characters not mentioned in the list ! of emacs standard bindings are bound to the sseellff--iinnsseerrtt ! function, which just inserts the given character into the ! input line. In vi insertion mode, all characters not ! specifically mentioned are bound to sseellff--iinnsseerrtt. Charac- ! ters assigned to signal generation by _s_t_t_y(1) or the ter- ! minal driver, such as C-Z or C-C, retain that function. ! Upper and lower case metafied characters are bound to the ! same function in the emacs mode meta keymap. The remain- ! ing characters are unbound, which causes readline to ring ! the bell (subject to the setting of the bbeellll--ssttyyllee vari- ! able). EEmmaaccss MMooddee *************** *** 902,905 **** --- 917,932 ---- "M-C-G" abort "M-C-H" backward-kill-word + + + + GNU Readline 4.2 2001 Mar 5 14 + + + + + + READLINE(3) READLINE(3) + + "M-C-I" tab-insert "M-C-J" vi-editing-mode *************** *** 917,932 **** "M-0" digit-argument "M-1" digit-argument - - - - GNU 1999 Jun 1 14 - - - - - - READLINE(3) READLINE(3) - - "M-2" digit-argument "M-3" digit-argument --- 944,947 ---- *************** *** 954,958 **** "M-\" delete-horizontal-space "M-~" tilde-expand ! "M-C-?" backward-delete-word "M-_" yank-last-arg --- 969,973 ---- "M-\" delete-horizontal-space "M-~" tilde-expand ! "M-C-?" backward-kill-word "M-_" yank-last-arg *************** *** 969,972 **** --- 984,998 ---- + + + GNU Readline 4.2 2001 Mar 5 15 + + + + + + READLINE(3) READLINE(3) + + VVII MMooddee bbiinnddiinnggss VI Insert Mode functions *************** *** 983,998 **** "C-V" quoted-insert "C-W" unix-word-rubout - - - - GNU 1999 Jun 1 15 - - - - - - READLINE(3) READLINE(3) - - "C-Y" yank "C-[" vi-movement-mode --- 1009,1012 ---- *************** *** 1021,1024 **** --- 1035,1039 ---- "C-W" unix-word-rubout "C-Y" yank + "C-_" vi-undo " " forward-char "#" insert-comment *************** *** 1034,1037 **** --- 1049,1064 ---- "0" beginning-of-line "1" to "9" vi-arg-digit + + + + GNU Readline 4.2 2001 Mar 5 16 + + + + + + READLINE(3) READLINE(3) + + ";" vi-char-search "=" vi-complete *************** *** 1049,1064 **** "R" vi-replace "S" vi-subst - - - - GNU 1999 Jun 1 16 - - - - - - READLINE(3) READLINE(3) - - "T" vi-char-search "U" revert-line --- 1076,1079 ---- *************** *** 1087,1091 **** "s" vi-subst "t" vi-char-search ! "u" undo "w" vi-next-word "x" vi-delete --- 1102,1106 ---- "s" vi-subst "t" vi-char-search ! "u" vi-undo "w" vi-next-word "x" vi-delete *************** *** 1099,1102 **** --- 1114,1130 ---- _b_a_s_h(1) + + + + + GNU Readline 4.2 2001 Mar 5 17 + + + + + + READLINE(3) READLINE(3) + + FFIILLEESS _~_/_._i_n_p_u_t_r_c *************** *** 1116,1130 **** library that you have. - - - GNU 1999 Jun 1 17 - - - - - - READLINE(3) READLINE(3) - - 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, --- 1144,1147 ---- *************** *** 1167,1188 **** ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! GNU 1999 Jun 1 18 --- 1184,1188 ---- ! GNU Readline 4.2 2001 Mar 5 18 diff -Nrc2 readline-4.1/doc/readline.3 readline-4.2/doc/readline.3 *** readline-4.1/doc/readline.3 Fri Aug 6 15:43:04 1999 --- readline-4.2/doc/readline.3 Mon Mar 5 11:11:38 2001 *************** *** 7,13 **** .\" chet@ins.CWRU.Edu .\" ! .\" Last Change: Tue Jun 1 13:28:03 EDT 1999 .\" ! .TH READLINE 3 "1999 Jun 1" GNU .\" .\" File Name macro. This used to be `.PN', for Path Name, --- 7,13 ---- .\" chet@ins.CWRU.Edu .\" ! .\" Last Change: Mon Mar 5 09:58:38 EST 2001 .\" ! .TH READLINE 3 "2001 Mar 5" "GNU Readline 4.2" .\" .\" File Name macro. This used to be `.PN', for Path Name, *************** *** 24,41 **** .ft B #include ! #include ! #include .ft .fi .LP .nf ! .ft B ! char *readline (prompt) ! char *prompt; ! .ft .fi .SH COPYRIGHT ! .if n Readline is Copyright (C) 1989, 1991, 1993, 1995, 1996 by the Free Software Foundation, Inc. ! .if t Readline is Copyright \(co 1989, 1991, 1993, 1995, 1996 by the Free Software Foundation, Inc. .SH DESCRIPTION .LP --- 24,40 ---- .ft B #include ! #include ! #include .ft .fi .LP .nf ! \fIchar *\fP ! .br ! \fBreadline\fP (\fIconst char *prompt\fP); .fi .SH COPYRIGHT ! .if n Readline is Copyright (C) 1989\-2001 by the Free Software Foundation, Inc. ! .if t Readline is Copyright \(co 1989\-2001 by the Free Software Foundation, Inc. .SH DESCRIPTION .LP *************** *** 46,52 **** as a prompt. If .B prompt ! is null, no prompt is issued. The line returned is allocated with ! .IR malloc (3), ! so the caller must free it when finished. The line returned has the final newline removed, so only the text of the line remains. --- 45,52 ---- as a prompt. If .B prompt ! is \fBNULL\fP or the empty string, no prompt is issued. ! The line returned is allocated with ! .IR malloc (3); ! the caller must free it when finished. The line returned has the final newline removed, so only the text of the line remains. *************** *** 58,61 **** --- 58,66 ---- are similar to those of emacs. A vi\-style line editing interface is also available. + .LP + This manual page describes only the most basic use of \fBreadline\fP. + Much more functionality is available; see + \fIThe GNU Readline Library\fP and \fIThe GNU History Library\fP + for additional information. .SH RETURN VALUE .LP *************** *** 131,134 **** --- 136,140 ---- C\-Meta\-u: universal\-argument .RE + .sp into the .I inputrc *************** *** 138,150 **** The following symbolic character names are recognized while processing key bindings: - .IR RUBOUT , .IR DEL , .IR ESC , .IR LFD , .IR NEWLINE , .IR RET , .IR RETURN , ! .IR SPC , .IR SPACE , and .IR TAB . --- 144,157 ---- The following symbolic character names are recognized while processing key bindings: .IR DEL , .IR ESC , + .IR ESCAPE , .IR LFD , .IR NEWLINE , .IR RET , .IR RETURN , ! .IR RUBOUT , .IR SPACE , + .IR SPC , and .IR TAB . *************** *** 162,165 **** --- 169,173 ---- as a symbolic key name, possibly with \fIMeta\-\fP or \fIControl\-\fP prefixes, or as a key sequence. + .PP When using the form \fBkeyname\fP:\^\fIfunction-name\fP or \fImacro\fP, .I keyname *************** *** 171,175 **** Meta\-Rubout: backward\-kill\-word .br ! Control\-o: ">&output" .RE .LP --- 179,183 ---- Meta\-Rubout: backward\-kill\-word .br ! Control\-o: "> output" .RE .LP *************** *** 185,189 **** is bound to run the macro expressed on the right hand side (that is, to insert the text ! .I >&output into the line). .PP --- 193,198 ---- is bound to run the macro expressed on the right hand side (that is, to insert the text ! .if t \f(CW> output\fP ! .if n ``> output'' into the line). .PP *************** *** 195,199 **** an entire key sequence may be specified by placing the sequence within double quotes. Some GNU Emacs style key escapes can be ! used, as in the following example. .sp .RS --- 204,209 ---- an entire key sequence may be specified by placing the sequence within double quotes. Some GNU Emacs style key escapes can be ! used, as in the following example, but the symbolic character names ! are not recognized. .sp .RS *************** *** 215,220 **** .I "ESC [ 1 1 ~" is bound to insert the text ! .BR "Function Key 1" . ! The full set of GNU Emacs style escape sequences is .RS .PD 0 --- 225,233 ---- .I "ESC [ 1 1 ~" is bound to insert the text ! .if t \f(CWFunction Key 1\fP. ! .if n ``Function Key 1''. ! .PP ! The full set of GNU Emacs style escape sequences available when specifying ! key sequences is .RS .PD 0 *************** *** 233,240 **** .TP .B \e" ! literal " .TP .B \e' ! literal ' .RE .PD --- 246,253 ---- .TP .B \e" ! literal ", a double quote .TP .B \e' ! literal ', a single quote .RE .PD *************** *** 314,318 **** .B On or ! .BR Off . The variables and their default values are: .PP --- 327,332 ---- .B On or ! .B Off ! (without regard to case). The variables and their default values are: .PP *************** *** 352,356 **** If set to \fBOn\fP, readline will convert characters with the eighth bit set to an ASCII key sequence ! by stripping the eighth bit and prepending an escape character (in effect, using escape as the \fImeta prefix\fP). .TP --- 366,370 ---- If set to \fBOn\fP, readline will convert characters with the eighth bit set to an ASCII key sequence ! by stripping the eighth bit and prefixing it with an escape character (in effect, using escape as the \fImeta prefix\fP). .TP *************** *** 362,366 **** .B editing\-mode (emacs) Controls whether readline begins with a set of key bindings similar ! to \fIemacs\fP or \fIvi\fP. .B editing\-mode can be set to either --- 376,380 ---- .B editing\-mode (emacs) Controls whether readline begins with a set of key bindings similar ! to emacs or vi. .B editing\-mode can be set to either *************** *** 385,394 **** .B input\-meta (Off) If set to \fBOn\fP, readline will enable eight-bit input (that is, ! it will not strip the high bit from the characters it reads), regardless of what the terminal claims it can support. The name .B meta\-flag is a synonym for this variable. .TP ! .B isearch\-terminators (``C\-[C\-J'') The string of characters that should terminate an incremental search without subsequently executing the character as a command. --- 399,408 ---- .B input\-meta (Off) If set to \fBOn\fP, readline will enable eight-bit input (that is, ! it will not clear the eighth bit in the characters it reads), regardless of what the terminal claims it can support. The name .B meta\-flag is a synonym for this variable. .TP ! .B isearch\-terminators (``C\-[ C\-J'') The string of characters that should terminate an incremental search without subsequently executing the character as a command. *************** *** 403,413 **** \fIvi\fP is equivalent to \fIvi-command\fP; \fIemacs\fP is equivalent to \fIemacs-standard\fP. The default value is ! .IR emacs ; ! the value of .B editing\-mode also affects the default keymap. .TP .B mark\-directories (On) ! If set to \fBOn\fP, complete ) ! Set the mark to the current point. If a numeric argument is supplied, the mark is set to that position. .TP --- 901,906 ---- Perform tilde expansion on the current word. .TP ! .B set\-mark (C\-@, M\- ) ! Set the mark to the point. If a numeric argument is supplied, the mark is set to that position. .TP *************** *** 895,900 **** .B comment\-begin variable is inserted at the beginning of the current line, and the line ! is accepted as if a newline had been typed. This makes the current line ! a shell comment. .TP .B dump\-functions --- 921,927 ---- .B comment\-begin variable is inserted at the beginning of the current line, and the line ! is accepted as if a newline had been typed. The default value of ! .B comment\-begin ! makes the current line a shell comment. .TP .B dump\-functions *************** *** 933,937 **** .LP The following is a list of the default emacs and vi bindings. ! Characters with the 8th bit set are written as M\- , and are referred to as .I metafied --- 960,964 ---- .LP The following is a list of the default emacs and vi bindings. ! Characters with the eighth bit set are written as M\- , and are referred to as .I metafied *************** *** 939,955 **** The printable ASCII characters not mentioned in the list of emacs standard bindings are bound to the ! .I self\-insert function, which just inserts the given character into the input line. In vi insertion mode, all characters not specifically mentioned are bound to ! .IR self\-insert . Characters assigned to signal generation by .IR stty (1) or the terminal driver, such as C-Z or C-C, retain that function. ! Upper and lower case ! .I metafied ! characters are bound to the same function in the emacs mode ! meta keymap. The remaining characters are unbound, which causes readline to ring the bell (subject to the setting of the --- 966,980 ---- The printable ASCII characters not mentioned in the list of emacs standard bindings are bound to the ! .B self\-insert function, which just inserts the given character into the input line. In vi insertion mode, all characters not specifically mentioned are bound to ! .BR self\-insert . Characters assigned to signal generation by .IR stty (1) or the terminal driver, such as C-Z or C-C, retain that function. ! Upper and lower case metafied characters are bound to the same function in ! the emacs mode meta keymap. The remaining characters are unbound, which causes readline to ring the bell (subject to the setting of the *************** *** 1037,1041 **** "M-\e" delete-horizontal-space "M-~" tilde-expand ! "M-C-?" backward-delete-word "M-_" yank-last-arg .PP --- 1062,1066 ---- "M-\e" delete-horizontal-space "M-~" tilde-expand ! "M-C-?" backward-kill-word "M-_" yank-last-arg .PP *************** *** 1097,1100 **** --- 1122,1126 ---- "C-W" unix-word-rubout "C-Y" yank + "C-_" vi-undo "\^ " forward-char "#" insert-comment *************** *** 1151,1155 **** "s" vi-subst "t" vi-char-search ! "u" undo "w" vi-next-word "x" vi-delete --- 1177,1181 ---- "s" vi-subst "t" vi-char-search ! "u" vi-undo "w" vi-next-word "x" vi-delete Binary files readline-4.1/doc/readline.dvi and readline-4.2/doc/readline.dvi differ diff -Nrc2 readline-4.1/doc/readline.html readline-4.2/doc/readline.html *** readline-4.1/doc/readline.html Wed Mar 1 14:53:12 2000 --- readline-4.2/doc/readline.html Mon Apr 16 11:05:45 2001 *************** *** 2,6 **** GNU Readline Library --- 2,6 ----GNU Readline Library *************** *** 8,13 ****GNU Readline Library
!Edition 4.1, for
!Readline Library
Version 4.1.January 2000
Brian Fox, Free Software Foundation Chet Ramey, Case Western Reserve University --- 8,13 ----GNU Readline Library
!Edition 4.2, for
!Readline Library
Version 4.2.Apr 2001
Brian Fox, Free Software Foundation Chet Ramey, Case Western Reserve University *************** *** 51,55 ****- Custom Functions --- 51,55 ----
- Custom Functions *************** *** 64,82 ****
- Redisplay
- Modifying Text !
- Utility Functions !
- Alternate Interface !
- An Example !
- Readline Signal Handling !
- Custom Completers !
- Concept Index !
- Function and Variable Index
--- 64,85 ----
- Redisplay
- Modifying Text !
- Character Input !
- Terminal Management !
- Utility Functions !
- Miscellaneous Functions !
- Alternate Interface !
- A Readline Example !
- Readline Signal Handling !
- Custom Completers !
- Concept Index !
- Function and Variable Index
*************** *** 115,119 ****
! Copyright (C) 1988-1999 Free Software Foundation, Inc.
--- 118,122 ----! Copyright (C) 1988-2001 Free Software Foundation, Inc.
*************** *** 170,174 **** If you do not have a Meta or ALT key, or another key working as a Meta key, the identical keystroke can be generated by typing ESC ! first, and then typing k. Either process is known as metafying the k key. --- 173,177 ---- If you do not have a Meta or ALT key, or another key working as a Meta key, the identical keystroke can be generated by typing ESC ! first, and then typing k. Either process is known as metafying the k key. *************** *** 205,210 **** you move the cursor to the place that needs correction, and delete or insert the text of the corrections. Then, when you are satisfied with ! the line, you simply press RETURN. You do not have to be at the ! end of the line to press RETURN; the entire line is accepted regardless of the location of the cursor within the line. --- 208,213 ---- you move the cursor to the place that needs correction, and delete or insert the text of the corrections. Then, when you are satisfied with ! the line, you simply press RET. You do not have to be at the ! end of the line to press RET; the entire line is accepted regardless of the location of the cursor within the line. *************** *** 367,371 **** Word boundaries are the same as those used by M-f. !- M-DEL
- Kill from the cursor the start of the previous word, or, if between --- 370,374 ---- Word boundaries are the same as those used by M-f. !
- M-DEL
- Kill from the cursor the start of the previous word, or, if between *************** *** 376,380 ****
- Kill from the cursor to the previous whitespace. This is different than ! M-DEL because the word boundaries differ.
INPUTRC
. If
that variable is unset, the default is `~/.inputrc'.
--- 484,488 ----
commands in an inputrc file, conventionally in his home directory.
The name of this
! file is taken from the value of the environment variable @env{INPUTRC}. If
that variable is unset, the default is `~/.inputrc'.
***************
*** 520,524 ****
You can modify the run-time behavior of Readline by
altering the values of variables in Readline
! using the set
command within the init file. Here is how to
change from the default Emacs-like key binding to use
vi
line editing commands:
--- 526,538 ----
You can modify the run-time behavior of Readline by
altering the values of variables in Readline
! using the set
command within the init file.
! The syntax is simple:
!
!
! ! set variable value !! ! Here, for example, is how to change from the default Emacs-like key binding to use
vi
line editing commands:
***************
*** 529,540 ****
A great deal of run-time behavior is changeable with the following
variables.
bell-style
bell-style
comment-begin
insert-comment
command is executed. The default value
--- 563,567 ----
comment-begin
insert-comment
command is executed. The default value
***************
*** 558,572 ****
completion-query-items
100
.
convert-meta
completion-query-items
100
.
convert-meta
disable-completion
disable-completion
editing-mode
editing-mode
variable controls which default set of
key bindings is used. By default, Readline starts up in Emacs editing
--- 602,606 ----
editing-mode
editing-mode
variable controls which default set of
key bindings is used. By default, Readline starts up in Emacs editing
***************
*** 591,595 ****
enable-keypad
enable-keypad
expand-tilde
expand-tilde
horizontal-scroll-mode
horizontal-scroll-mode
input-meta
meta-flag
is a
--- 632,639 ----
input-meta
meta-flag
is a
***************
*** 623,627 ****
isearch-terminators
isearch-terminators
keymap
keymap
names are
--- 650,654 ----
keymap
keymap
names are
***************
*** 639,642 ****
--- 658,662 ----
emacs-ctlx
,
vi
,
+ vi-move
,
vi-command
, and
vi-insert
.
***************
*** 653,657 ****
mark-modified-lines
mark-modified-lines
output-meta
output-meta
show-all-if-ambiguous
show-all-if-ambiguous
visible-stats
visible-stats
universal-argument
, and C-o is bound to run the macro
expressed on the right hand side (that is, to insert the text
`> output' into the line).
universal-argument
,
! M-DEL is bound to the function backward-kill-word
, and
! C-o is bound to run the macro
expressed on the right hand side (that is, to insert the text
`> output' into the line).
+ A number of symbolic character names are recognized while
+ processing this key binding syntax:
+ DEL,
+ ESC,
+ ESCAPE,
+ LFD,
+ NEWLINE,
+ RET,
+ RETURN,
+ RUBOUT,
+ SPACE,
+ SPC,
+ and
+ TAB.
+
universal-argument
(just as it was in the first example),
`C-x C-r' is bound to the function re-read-init-file
,
--- 776,780 ----
! In the above example, C-u is again bound to the function
universal-argument
(just as it was in the first example),
`C-x C-r' is bound to the function re-read-init-file
,
***************
*** 799,807 ****
\nnn
ASCII
code is the octal value nnn
(one to three digits)
\xnnn
ASCII
code is the hexadecimal value nnn
(one to three digits)
\nnn
\xnnn
*************** *** 907,911 ****! Here is an example of an inputrc file. This illustrates key binding, variable assignment, and conditional syntax. --- 950,954 ----
! Here is an example of an inputrc file. This illustrates key binding, variable assignment, and conditional syntax. *************** *** 1031,1042 **** This section describes Readline commands that may be bound to key sequences.
! Command names without an accompanying key sequence are unbound by default. ! In the following descriptions, point refers to the current cursor ! position, and mark refers to a cursor position saved by the
--- 1074,1085 ---- This section describes Readline commands that may be bound to key sequences. + Command names without an accompanying key sequence are unbound by default.set-mark
command. ! The text between the point and mark is referred to as the region.! In the following descriptions, point refers to the current cursor ! position, and mark refers to a cursor position saved by the
*************** *** 1048,1072 ****set-mark
command. ! The text between the point and mark is referred to as the region.
beginning-of-line (C-a)
end-of-line (C-e)
forward-char (C-f)
backward-char (C-b)
forward-word (M-f)
beginning-of-line (C-a)
end-of-line (C-e)
forward-char (C-f)
backward-char (C-b)
forward-word (M-f)
backward-word (M-b)
backward-word (M-b)
clear-screen (C-l)
clear-screen (C-l)
redraw-current-line ()
redraw-current-line ()
accept-line (Newline, Return)
previous-history (C-p)
next-history (C-n)
beginning-of-history (M-<)
end-of-history (M->)
accept-line (Newline or Return)
add_history()
.
! If this line is a modified history line, the history line is restored
! to its original state.
previous-history (C-p)
next-history (C-n)
beginning-of-history (M-<)
end-of-history (M->)
reverse-search-history (C-r)
reverse-search-history (C-r)
forward-search-history (C-s)
forward-search-history (C-s)
non-incremental-reverse-search-history (M-p)
non-incremental-reverse-search-history (M-p)
non-incremental-forward-search-history (M-n)
non-incremental-forward-search-history (M-n)
history-search-forward ()
history-search-forward ()
history-search-backward ()
history-search-backward ()
yank-nth-arg (M-C-y)
yank-last-arg (M-., M-_)
yank-nth-arg (M-C-y)
yank-last-arg (M-. or M-_)
delete-char (C-d)
delete-char
, then
! return EOF
.
backward-delete-char (Rubout)
delete-char (C-d)
delete-char
, then
! return EOF.
backward-delete-char (Rubout)
forward-backward-delete-char ()
quoted-insert (C-q, C-v)
tab-insert (M-TAB)
self-insert (a, b, A, 1, !, ...)
transpose-chars (C-t)
forward-backward-delete-char ()
quoted-insert (C-q or C-v)
tab-insert (M-TAB)
self-insert (a, b, A, 1, !, ...)
transpose-chars (C-t)
transpose-words (M-t)
transpose-words (M-t)
upcase-word (M-u)
upcase-word (M-u)
downcase-word (M-l)
downcase-word (M-l)
capitalize-word (M-c)
capitalize-word (M-c)
kill-line (C-k)
backward-kill-line (C-x Rubout)
unix-line-discard (C-u)
kill-whole-line ()
kill-word (M-d)
forward-word
.
! backward-kill-word (M-DEL)
backward-word
.
--- 1320,1352 ----
kill-line (C-k)
backward-kill-line (C-x Rubout)
unix-line-discard (C-u)
kill-whole-line ()
kill-word (M-d)
forward-word
.
! backward-kill-word (M-DEL)
backward-word
.
***************
*** 1307,1311 ****
unix-word-rubout (C-w)
unix-word-rubout (C-w)
delete-horizontal-space ()
kill-region ()
delete-horizontal-space ()
kill-region ()
copy-region-as-kill ()
copy-region-as-kill ()
copy-backward-word ()
backward-word
.
--- 1377,1381 ----
copy-backward-word ()
backward-word
.
***************
*** 1337,1341 ****
copy-forward-word ()
forward-word
.
--- 1384,1388 ----
copy-forward-word ()
forward-word
.
***************
*** 1344,1356 ****
yank (C-y)
yank-pop (M-y)
yank (C-y)
yank-pop (M-y)
yank
or yank-pop
.
digit-argument (M-0, M-1, ... M--)
digit-argument (M-0, M-1, ... M--)
universal-argument ()
universal-argument ()
complete (TAB)
possible-completions (M-?)
insert-completions (M-*)
possible-completions
.
--- 1435,1453 ----
complete (TAB)
possible-completions (M-?)
insert-completions (M-*)
possible-completions
.
***************
*** 1412,1431 ****
menu-complete ()
complete
, but replaces the word to be completed
with a single match from the list of possible completions.
Repeated execution of menu-complete
steps through the list
of possible completions, inserting each match in turn.
! At the end of the list of completions, the bell is rung and the
! original text is restored.
An argument of n moves n positions forward in the list
of matches; a negative argument may be used to move backward
through the list.
! This command is intended to be bound to TAB
, but is unbound
by default.
delete-char-or-list ()
delete-char
).
--- 1455,1475 ----
menu-complete ()
complete
, but replaces the word to be completed
with a single match from the list of possible completions.
Repeated execution of menu-complete
steps through the list
of possible completions, inserting each match in turn.
! At the end of the list of completions, the bell is rung
! (subject to the setting of bell-style
)
! and the original text is restored.
An argument of n moves n positions forward in the list
of matches; a negative argument may be used to move backward
through the list.
! This command is intended to be bound to TAB, but is unbound
by default.
delete-char-or-list ()
delete-char
).
***************
*** 1443,1452 ****
start-kbd-macro (C-x ()
end-kbd-macro (C-x ))
start-kbd-macro (C-x ()
end-kbd-macro (C-x ))
call-last-kbd-macro (C-x e)
call-last-kbd-macro (C-x e)
re-read-init-file (C-x C-r)
re-read-init-file (C-x C-r)
abort (C-g)
abort (C-g)
do-uppercase-version (M-a, M-b, M-x, ...)
prefix-meta (ESC)
undo (C-_, C-x C-u)
revert-line (M-r)
undo
command enough times to get back to the beginning.
--- 1524,1546 ----
do-uppercase-version (M-a, M-b, M-x, ...)
prefix-meta (ESC)
undo (C-_ or C-x C-u)
revert-line (M-r)
undo
command enough times to get back to the beginning.
***************
*** 1504,1519 ****
tilde-expand (M-~)
set-mark (C-@)
exchange-point-and-mark (C-x C-x)
tilde-expand (M-~)
set-mark (C-@)
exchange-point-and-mark (C-x C-x)
character-search (C-])
character-search (C-])
character-search-backward (M-C-])
character-search-backward (M-C-])
insert-comment (M-#)
comment-begin
variable is inserted at the beginning of the current line,
--- 1578,1582 ----
insert-comment (M-#)
comment-begin
variable is inserted at the beginning of the current line,
***************
*** 1541,1545 ****
dump-functions ()
dump-functions ()
dump-variables ()
dump-variables ()
dump-macros ()
dump-macros ()
In order to switch interactively between emacs
and vi
! editing modes, use the command M-C-j (toggle-editing-mode).
The Readline default is emacs
mode.
--- 1622,1627 ----
In order to switch interactively between emacs
and vi
! editing modes, use the command M-C-j (bound to emacs-editing-mode
! when in vi
mode and to vi-editing-mode in emacs
mode).
The Readline default is emacs
mode.
***************
*** 1613,1618 ****
aid in writing your own custom
functions.
!
gets()
or fgets ()
.
-
! The function readline ()
prints a prompt and then reads and returns
! a single line of text from the user. The line readline
! returns is allocated with malloc ()
; you should free ()
! the line when you are done with it. The declaration for readline
! in ANSI C is
! char *readline (char *prompt);
--- 1672,1695 ----
Readline is sufficient. This section describes how to use Readline in
the simplest way possible, perhaps to replace calls in your code to
! gets()
or fgets()
.
!
! The function readline()
prints a prompt prompt
! and then reads and returns a single line of text from the user.
! If prompt is NULL
or the empty string, no prompt is displayed.
! The line readline
returns is allocated with malloc()
;
! the caller should free()
the line when it has finished with it.
! The declaration for readline
in ANSI C is
! char *readline (const char *prompt);
***************
*** 1666,1670 ****
If you want the user to be able to get at the line later, (with
! C-p for example), you must call add_history ()
to save the
line away in a history list of such lines.
--- 1715,1719 ----
If you want the user to be able to get at the line later, (with
! C-p for example), you must call add_history()
to save the
line away in a history list of such lines.
***************
*** 1682,1686 ****
It is preferable to avoid saving empty lines on the history list, since
users rarely have a burning need to reuse a blank line. Here is
! a function which usefully replaces the standard gets ()
library
function, and has the advantage of no static buffer to overflow:
--- 1731,1735 ----
It is preferable to avoid saving empty lines on the history list, since
users rarely have a burning need to reuse a blank line. Here is
! a function which usefully replaces the standard gets()
library
function, and has the advantage of no static buffer to overflow:
***************
*** 1718,1735 ****
completion: completion on file names. If you do not want Readline to
complete on filenames, you can change the binding of the TAB key
! with rl_bind_key ()
.
! int rl_bind_key (int key, int (*function)());
! rl_bind_key ()
takes two arguments: key is the character that
you want to bind, and function is the address of the function to
! call when key is pressed. Binding TAB to rl_insert ()
makes TAB insert itself.
! rl_bind_key ()
returns non-zero if key is not a valid
ASCII character code (between 0 and 255).
--- 1767,1784 ----
completion: completion on file names. If you do not want Readline to
complete on filenames, you can change the binding of the TAB key
! with rl_bind_key()
.
! int rl_bind_key (int key, rl_command_func_t *function);
! rl_bind_key()
takes two arguments: key is the character that
you want to bind, and function is the address of the function to
! call when key is pressed. Binding TAB to rl_insert()
makes TAB insert itself.
! rl_bind_key()
returns non-zero if key is not a valid
ASCII character code (between 0 and 255).
***************
*** 1744,1750 ****
This code should be executed once at the start of your program; you
! might write a function called initialize_readline ()
which
performs this and other desired initializations, such as installing
! custom completers (see section Custom Completers).
This code should be executed once at the start of your program; you
! might write a function called initialize_readline()
which
performs this and other desired initializations, such as installing
! custom completers (see section Custom Completers).
! For readabilty, we declare a new type of object, called
! Function. A Function
is a C function which
! returns an int
. The type declaration for Function
is:
! typedef int Function ();
! The reason for declaring this new type is to make it easier to write ! code describing pointers to C functions. Let us say we had a variable ! called func which was a pointer to a function. Instead of the ! classic C declaration
! int (*)()func;
! we may write
! Function *func;
! Similarly, there are
!! typedef void VFunction (); ! typedef char *CPFunction (); and ! typedef char **CPPFunction (); !!
! for functions returning no value, pointer to char
, and
! pointer to pointer to char
, respectively.
! For readabilty, we declare a number of new object types, all pointers ! to functions.
! The reason for declaring these new types is to make it easier to write ! code describing pointers to C functions with appropriately prototyped ! arguments and return values.
! For instance, say we want to declare a variable func as a pointer
! to a function which takes two int
arguments and returns an
! int
(this is the type of all of the Readline bindable functions).
! Instead of the classic C declaration
! int (*func)();
! or the ANSI-C style declaration
! int (*func)(int, int);
! we may write
+
+ rl_command_func_t *func;
!
! The full list of function pointer types available is
+typedef int rl_command_func_t (int, int);
+ typedef char *rl_compentry_func_t (const char *, int);
+ typedef char **rl_completion_func_t (const char *, int, int);
+ typedef char *rl_quote_func_t (char *, int, char *);
+ typedef char *rl_dequote_func_t (char *, int);
+ typedef int rl_compignore_func_t (char **);
+ typedef void rl_compdisp_func_t (char **, int, int);
+ typedef int rl_hook_func_t (void);
+ typedef int rl_getc_func_t (FILE *);
+ typedef int rl_linebuf_func_t (char *, int);
+ typedef int rl_intfunc_t (int);
+ #define rl_ivoidfunc_t rl_hook_func_t
+ typedef int rl_icpfunc_t (char *);
+ typedef int rl_icppfunc_t (char **);
+ typedef void rl_voidfunc_t (void);
+ typedef void rl_vintfunc_t (int);
+ typedef void rl_vcpfunc_t (char *);
+ typedef void rl_vcppfunc_t (char **);
+ rl_line_buffer
(the point).
--- 1969,1973 ----
rl_line_buffer
(the point).
***************
*** 1892,1896 ****
rl_line_buffer
. When
rl_point
is at the end of the line, rl_point
and
--- 1978,1982 ----
rl_line_buffer
. When
rl_point
is at the end of the line, rl_point
and
***************
*** 1902,1907 ****
readline()
causes
+ Readline to return after accepting that many characters, rather
+ than reading up to a character bound to accept-line
.
+ +
+
readline ()
, and should not be assigned to directly.
readline()
, and should not be assigned to directly.
! The rl_set_prompt()
function (see section Redisplay) may
! be used to modify the prompt string after calling readline()
.
readline()
is called, it should set
--- 2057,2061 ----
readline()
is called, it should set
***************
*** 1962,1967 ****
--- 2070,2075 ----
*************** *** 1970,1976 ****
--- 2078,2085 ----
!
readline
prints the first prompt.
--- 2123,2138 ----
!
readline
prints the first prompt.
***************
*** 2013,2018 ****
readline
--- 2142,2147 ----
readline
***************
*** 2023,2030 ****
readline
will call indirectly through this pointer
to get a character from the input stream. By default, it is set to
! rl_getc
, the default readline
character input function
! (see section Utility Functions).
rl_getc
, the default Readline character input function
! (see section Character Input).
readline
will call indirectly through this pointer
to update the display with the current contents of the editing buffer.
! By default, it is set to rl_redisplay
, the default readline
redisplay function (see section Redisplay).
rl_redisplay
, the default Readline
redisplay function (see section Redisplay).
int
flag that says whether or not to use eight-bit characters.
+ By default, this is set to rl_prep_terminal
+ (see section Terminal Management).
+ +
rl_prep_term_function
.
+ By default, this is set to rl_deprep_terminal
+ (see section Terminal Management).
+ +
+
+
RL_SETSTATE
macro, and unset with the
+ RL_UNSETSTATE
macro. Use the RL_ISSTATE
macro to test
+ whether a particular state bit is set. Current state bits include:
+
+
+ RL_STATE_NONE
+ RL_STATE_INITIALIZING
+ RL_STATE_INITIALIZED
+ RL_STATE_TERMPREPPED
+ RL_STATE_READCMD
+ RL_STATE_METANEXT
+ RL_STATE_DISPATCHING
+ RL_STATE_MOREINPUT
+ RL_STATE_ISEARCH
+ RL_STATE_NSEARCH
+ RL_STATE_SEARCH
+ RL_STATE_NUMERICARG
+ RL_STATE_MACROINPUT
+ RL_STATE_MACRODEF
+ RL_STATE_OVERWRITE
+ RL_STATE_COMPLETING
+ RL_STATE_SIGHANDLER
+ RL_STATE_UNDOING
+ RL_STATE_DONE
+ accept-line
+ and is about to return the line to the caller.
+ +
+
+
rl_line_buffer
.
! rl_line_buffer
.
!
rl_bind_key ()
.
rl_bind_key()
.
malloc ()
; you should free ()
it when you are done.
malloc()
; the caller should free it by calling
! rl_discard_keymap()
when done.
--- 2455,2460 ----
*************** *** 2191,2195 **** --- 2464,2468 ---- *************** *** 2198,2203 ****
set keymap
inputrc line (see section Readline Init File).
--- 2471,2476 ----
set keymap
inputrc line (see section Readline Init File).
***************
*** 2208,2212 ****
set keymap
inputrc line (see section Readline Init File).
--- 2481,2485 ----
set keymap
inputrc line (see section Readline Init File).
***************
*** 2219,2224 ****
! You associate keys with functions through the keymap. Readline has
! several internal keymaps: emacs_standard_keymap
,
emacs_meta_keymap
, emacs_ctlx_keymap
,
vi_movement_keymap
, and vi_insertion_keymap
.
--- 2492,2497 ----
! Key sequences are associate with functions through the keymap.
! Readline has several internal keymaps: emacs_standard_keymap
,
emacs_meta_keymap
, emacs_ctlx_keymap
,
vi_movement_keymap
, and vi_insertion_keymap
.
***************
*** 2228,2234 ****
! Since readline
installs a set of default key bindings the first
time it is called, there is always the danger that a custom binding
! installed before the first call to readline
will be overridden.
An alternate mechanism is to install custom key bindings in an
initialization function assigned to the rl_startup_hook
variable
--- 2501,2507 ----
! Since readline()
installs a set of default key bindings the first
time it is called, there is always the danger that a custom binding
! installed before the first call to readline()
will be overridden.
An alternate mechanism is to install custom key bindings in an
initialization function assigned to the rl_startup_hook
variable
***************
*** 2242,2247 ****
!
inputrc
file and
perform any key bindings and variable assignments found
--- 2590,2594 ----
inputrc
file and
perform any key bindings and variable assignments found
***************
*** 2316,2321 ****
These functions allow you to find out what keys invoke named functions ! and the functions invoked by a particular key sequence.
--- 2612,2623 ----
These functions allow you to find out what keys invoke named functions ! and the functions invoked by a particular key sequence. You may also ! associate a new function name with an arbitrary function.
ISFUNC
,
! ISKMAP
, or ISMACR
).
NULL
, the current keymap is used. If type is
! not NULL
, the type of the object is returned in the int
variable
! it points to (one of ISFUNC
, ISKMAP
, or ISMACR
).
rl_outstream
. If readable is non-zero,
--- 2656,2660 ----
rl_outstream
. If readable is non-zero,
***************
*** 2382,2387 ****
rl_outstream
.
rl_outstream
.
free()
the array when you are done, but not the pointers.
! !
If your function simply inserts text once, or deletes text once, and
! uses rl_insert_text ()
or rl_delete_text ()
to do it, then
undoing is already done for you automatically.
--- 2698,2707 ----
Supporting the undo command is a painless thing, and makes your
functions much more useful. It is certainly easy to try
! something if you know you can undo it.
If your function simply inserts text once, or deletes text once, and
! uses rl_insert_text()
or rl_delete_text()
to do it, then
undoing is already done for you automatically.
***************
*** 2418,2423 ****
If you do multiple insertions or multiple deletions, or any combination
of these operations, you should group them together into one operation.
! This is done with rl_begin_undo_group ()
and
! rl_end_undo_group ()
.
rl_begin_undo_group()
and
! rl_end_undo_group()
.
***************
*** 2434,2450 ****
Notice that UNDO_DELETE
means to insert some text, and
UNDO_INSERT
means to delete some text. That is, the undo code
! tells undo what to undo, not how to undo it. UNDO_BEGIN
and
! UNDO_END
are tags added by rl_begin_undo_group ()
and
! rl_end_undo_group ()
.
rl_insert_text ()
and
! rl_delete_text ()
, but could be the result of calls to
! rl_add_undo ()
.
UNDO_DELETE
means to insert some text, and
UNDO_INSERT
means to delete some text. That is, the undo code
! tells what to undo, not how to undo it. UNDO_BEGIN
and
! UNDO_END
are tags added by rl_begin_undo_group()
and
! rl_end_undo_group()
.
rl_insert_text()
and
! rl_delete_text()
, but could be the result of calls to
! rl_add_undo()
.
rl_begin_undo_group
! ()
. There should be one call to rl_end_undo_group ()
! for each call to rl_begin_undo_group ()
.
rl_begin_undo_group
! ()
. There should be one call to rl_end_undo_group()
! for each call to rl_begin_undo_group()
.
--- 2763,2768 ----
*************** *** 2479,2484 ****
0
if there was
nothing to undo, non-zero if something was undone.
--- 2771,2776 ----
0
if there was
nothing to undo, non-zero if something was undone.
***************
*** 2488,2492 ****
Finally, if you neither insert nor delete text, but directly modify the
! existing text (e.g., change its case), call rl_modifying ()
once, just before you modify the text. You must supply the indices of
the text range that you are going to modify.
--- 2780,2784 ----
Finally, if you neither insert nor delete text, but directly modify the
! existing text (e.g., change its case), call rl_modifying()
once, just before you modify the text. You must supply the indices of
the text range that you are going to modify.
***************
*** 2496,2500 ****
rl_line_buffer
.
--- 2801,2806 ----
rl_line_buffer
.
***************
*** 2518,2523 ****
printf
. The
! resulting string is displayed in the echo area. The echo area
is also used to display numeric arguments and search strings.
! ! !
!
rl_outstream
.
! If Readline has not been set to display meta characters directly, this
! will convert meta characters to a meta-prefixed key sequence.
! This is intended for use by applications which wish to do their own
! redisplay.
! !
printf
,
! possibly containing conversion specifications such as `%d', and
! any additional arguments necessary to satisfy the conversion specifications.
! The resulting string is displayed in the echo area. The echo area
is also used to display numeric arguments and search strings.
--- 2882,2887 ----
*************** *** 2576,2583 ****
rl_message
.
rl_message()
.
rl_save_prompt
.
--- 2899,2904 ----
rl_save_prompt
.
***************
*** 2592,2595 ****
--- 2906,2933 ----
+ +
readline()
. It may also be called to
+ expand the primary prompt if the rl_on_new_line_with_prompt()
+ function or rl_already_prompted
variable is used.
+ It returns the number of visible characters on the last line of the
+ (possibly multi-line) prompt.
+ +
rl_expand_prompt()
to expand the prompt and sets rl_prompt
+ to the result.
+
rl_stuff_char ()
, macros, and characters read from the keyboard.
+
rl_insert_text()
instead.
+
rl_stuff_char()
, macros, and characters read from the keyboard.
! While waiting for input, this function will call any function assigned to
! the rl_event_hook
variable.
--- 3001,3008 ----
rl_read_key ()
.
rl_read_key()
.
rl_line_buffer
has enough space to hold len
! characters, possibly reallocating it if necessary.
rl_read_key()
! is called. This sets rl_pending_input.
--- 3029,3037 ----
rl_execute_next()
. This works only if the
! pending input has not already been read with rl_read_key()
.
vt100
).
! If terminal_name is NULL, the value of the TERM
environment variable is used.
--- 3039,3107 ----
rl_read_key()
, Readline will
! wait for u microseconds for input before calling any function
! assigned to rl_event_hook
. The default waiting period is
! one-tenth of a second. Returns the old timeout value.
! !
readline()
! can read a single character at a time from the keyboard.
! The meta_flag argument should be non-zero if Readline should
! read eight-bit input.
! !
rl_prep_terminal()
, leaving the terminal in
! the state in which it was before the most recent call to
! rl_prep_terminal()
.
! !
stty
) to their Readline equivalents. The bindings are performed
! in kmap.
! !
vt100
).
! If terminal_name is NULL
, the value of the TERM
environment variable is used.
rl_line_buffer
has enough space to hold len
! characters, possibly reallocating it if necessary.
--- 3109,3117 ----
readline()
calls it before
! reading any input.
--- 3119,3124 ----
*************** *** 2720,2725 ****
matches
is the list
--- 3127,3140 ----
+ + +
+
matches
is the list
***************
*** 2733,2743 ****
! The following are implemented as macros, defined in chartypes.h
.
--- 3148,3159 ----
! The following are implemented as macros, defined in chardefs.h
.
! Applications should refrain from using them.
*************** *** 2746,2751 ****
--- 3162,3167 ----
*************** *** 2754,2759 ****
--- 3170,3175 ----
*************** *** 2762,2767 ****
--- 3196,3201 ----
*************** *** 2788,2792 **** !
--- 3204,3265 ---- !
!
rl_generic_bind()
instead.
! !
rl_outstream
.
! If readable is non-zero, the list is formatted in such a way
! that it can be made part of an inputrc
file and re-read.
! !
inputrc
! file (see section Readline Init File Syntax).
! !
rl_outstream
.
! If readable is non-zero, the list is formatted in such a way
! that it can be made part of an inputrc
file and re-read.
! !
blink-matching-paren
has been enabled.
! *************** *** 2801,2809 ****
rl_callback_read_char()
, which will read the next
--- 3285,3290 ----
rl_callback_read_char()
, which will read the next
***************
*** 2825,2830 ****
--- 3308,3312 ---- !
*************** *** 2892,2899 **** for (i = start; i != end; i++) { ! if (uppercase_p (rl_line_buffer[i])) ! rl_line_buffer[i] = to_lower (rl_line_buffer[i]); ! else if (lowercase_p (rl_line_buffer[i])) ! rl_line_buffer[i] = to_upper (rl_line_buffer[i]); } /* Move point to on top of the last character changed. */ --- 3366,3373 ---- for (i = start; i != end; i++) { ! if (_rl_uppercase_p (rl_line_buffer[i])) ! rl_line_buffer[i] = _rl_to_lower (rl_line_buffer[i]); ! else if (_rl_lowercase_p (rl_line_buffer[i])) ! rl_line_buffer[i] = _rl_to_upper (rl_line_buffer[i]); } /* Move point to on top of the last character changed. */ *************** *** 2905,2920 **** !
Signals are asynchronous events sent to a process by the Unix kernel, sometimes on behalf of another process. They are intended to indicate ! exceptional events, like a user pressing the interrupt key on his ! terminal, or a network connection being broken. There is a class of ! signals that can be sent to the process currently reading input from ! the keyboard. Since Readline changes the terminal attributes when it ! is called, it needs to perform special processing when a signal is ! received to restore the terminal to a sane state, or provide application ! writers with functions to do so manually.
--- 3379,3394 ---- !Signals are asynchronous events sent to a process by the Unix kernel, sometimes on behalf of another process. They are intended to indicate ! exceptional events, like a user pressing the interrupt key on his terminal, ! or a network connection being broken. There is a class of signals that can ! be sent to the process currently reading input from the keyboard. Since ! Readline changes the terminal attributes when it is called, it needs to ! perform special processing when such a signal is received in order to ! restore the terminal to a sane state, or provide application writers with ! functions to do so manually.
*************** *** 2925,2930 **** When one of these signals is received, the signal handler will reset the terminal attributes to those that were in effect before !readline ()
was called, reset the signal handling to what it was
! before readline ()
was called, and resend the signal to the calling
application.
If and when the calling application's signal handler returns, Readline
--- 3399,3404 ----
When one of these signals is received, the signal handler
will reset the terminal attributes to those that were in effect before
! readline()
was called, reset the signal handling to what it was
! before readline()
was called, and resend the signal to the calling
application.
If and when the calling application's signal handler returns, Readline
***************
*** 2932,2936 ****
When a SIGINT
is received, the Readline signal handler performs
some additional work, which will cause any partially-entered line to be
! aborted (see the description of rl_free_line_state ()
).
--- 3406,3410 ----
When a SIGINT
is received, the Readline signal handler performs
some additional work, which will cause any partially-entered line to be
! aborted (see the description of rl_free_line_state()
below).
***************
*** 2939,2949 ****
the kernel sends to a process whenever the terminal's size changes (for
example, if a user resizes an xterm
). The Readline SIGWINCH
! handler updates Readline's internal screen size state, and then calls any
! SIGWINCH
signal handler the calling application has installed.
Readline calls the application's SIGWINCH
signal handler without
resetting the terminal to its original state. If the application's signal
handler does more than update its idea of the terminal size and return (for
example, a longjmp
back to a main processing loop), it must
! call rl_cleanup_after_signal ()
(described below), to restore the
terminal state.
--- 3413,3423 ----
the kernel sends to a process whenever the terminal's size changes (for
example, if a user resizes an xterm
). The Readline SIGWINCH
! handler updates Readline's internal screen size information, and then calls
! any SIGWINCH
signal handler the calling application has installed.
Readline calls the application's SIGWINCH
signal handler without
resetting the terminal to its original state. If the application's signal
handler does more than update its idea of the terminal size and return (for
example, a longjmp
back to a main processing loop), it must
! call rl_cleanup_after_signal()
(described below), to restore the
terminal state.
***************
*** 2953,2957 ****
control whether or not it will catch certain signals and act on them
when they are received. It is important that applications change the
! values of these variables only when calling readline ()
, not in
a signal handler, so Readline's internal signal state is not corrupted.
--- 3427,3431 ----
control whether or not it will catch certain signals and act on them
when they are received. It is important that applications change the
! values of these variables only when calling readline()
, not in
a signal handler, so Readline's internal signal state is not corrupted.
***************
*** 2960,2964 ****
SIGINT
, SIGQUIT
, SIGTERM
, SIGALRM
,
--- 3434,3438 ----
SIGINT
, SIGQUIT
, SIGTERM
, SIGALRM
,
***************
*** 2974,2978 ****
SIGWINCH
.
--- 3448,3452 ----
SIGWINCH
.
***************
*** 2995,3001 ****
readline ()
was called, and remove the Readline signal handlers for
all signals, depending on the values of rl_catch_signals
and
rl_catch_sigwinch
.
--- 3469,3475 ----
readline()
was called, and remove the Readline signal handlers for
all signals, depending on the values of rl_catch_signals
and
rl_catch_sigwinch
.
***************
*** 3006,3014 ****
rl_cleanup_after_signal ()
. The
Readline signal handler for SIGINT
calls this to abort the
current input line.
--- 3480,3488 ----
rl_cleanup_after_signal()
. The
Readline signal handler for SIGINT
calls this to abort the
current input line.
***************
*** 3019,3023 ****
rl_catch_signals
and
--- 3493,3497 ----
rl_catch_signals
and
***************
*** 3028,3033 ****
If an application does not wish Readline to catch SIGWINCH
, it may
! call rl_resize_terminal ()
to force Readline to update its idea of
! the terminal size when a SIGWINCH
is received.
If an application does not wish Readline to catch SIGWINCH
, it may
! call rl_resize_terminal()
or rl_set_screen_size()
to force
! Readline to update its idea of the terminal size when a SIGWINCH
! is received.