Import of readline-2.2.1
This commit is contained in:
parent
94228bd3ca
commit
d7fa6e206d
20 changed files with 20149 additions and 2357 deletions
16
readline/MANIFEST.doc
Normal file
16
readline/MANIFEST.doc
Normal file
|
@ -0,0 +1,16 @@
|
|||
#
|
||||
# Master Manifest file for documentation-only distribution
|
||||
#
|
||||
doc d
|
||||
MANIFEST.doc f
|
||||
doc/readline.ps f
|
||||
doc/history.ps f
|
||||
doc/readline.dvi f
|
||||
doc/history.dvi f
|
||||
doc/readline.info f
|
||||
doc/history.info f
|
||||
doc/readline.html f
|
||||
doc/readline_toc.html f
|
||||
doc/history.html f
|
||||
doc/history_toc.html f
|
||||
doc/readline.0 f
|
30
readline/acconfig.h
Normal file
30
readline/acconfig.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
/* acconfig.h
|
||||
This file is in the public domain.
|
||||
|
||||
Descriptive text for the C preprocessor macros that
|
||||
the distributed Autoconf macros can define.
|
||||
No software package will use all of them; autoheader copies the ones
|
||||
your configure.in uses into your configuration header file templates.
|
||||
|
||||
The entries are in sort -df order: alphabetical, case insensitive,
|
||||
ignoring punctuation (such as underscores). Although this order
|
||||
can split up related entries, it makes it easier to check whether
|
||||
a given entry is in the file.
|
||||
|
||||
Leave the following blank line there!! Autoheader needs it. */
|
||||
|
||||
|
||||
/* Definitions pulled in from aclocal.m4. */
|
||||
#undef VOID_SIGHANDLER
|
||||
|
||||
#undef TIOCGWINSZ_IN_SYS_IOCTL
|
||||
|
||||
#undef TIOCSTAT_IN_SYS_IOCTL
|
||||
|
||||
#undef HAVE_GETPW_DECLS
|
||||
|
||||
|
||||
/* Leave that blank line there!! Autoheader needs it.
|
||||
If you're adding to this file, keep in mind:
|
||||
The entries are in sort -df order: alphabetical, case insensitive,
|
||||
ignoring punctuation (such as underscores). */
|
|
@ -1,17 +1,31 @@
|
|||
\input texinfo @c -*-texinfo-*-
|
||||
@comment %**start of header (This is for running Texinfo on a region.)
|
||||
@c %**start of header (This is for running Texinfo on a region.)
|
||||
@setfilename history.info
|
||||
@settitle GNU Readline Library
|
||||
@comment %**end of header (This is for running Texinfo on a region.)
|
||||
@synindex vr fn
|
||||
@settitle GNU History Library
|
||||
@c %**end of header (This is for running Texinfo on a region.)
|
||||
|
||||
@setchapternewpage odd
|
||||
|
||||
@ignore
|
||||
last change: Thu Apr 2 14:38:22 EST 1998
|
||||
@end ignore
|
||||
|
||||
@set EDITION 2.2
|
||||
@set VERSION 2.2
|
||||
@set UPDATED 2 April 1998
|
||||
@set UPDATE-MONTH April 1998
|
||||
|
||||
@dircategory Libraries
|
||||
@direntry
|
||||
* History: (history). The GNU history library API
|
||||
@end direntry
|
||||
|
||||
@ifinfo
|
||||
This document describes the GNU History library, a programming tool that
|
||||
provides a consistent user interface for recalling lines of previously
|
||||
typed input.
|
||||
|
||||
Copyright (C) 1988, 1991 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988, 1991, 1993, 1995, 1996, 1998 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
|
@ -36,18 +50,13 @@ by the Foundation.
|
|||
@end ifinfo
|
||||
|
||||
@titlepage
|
||||
@sp 10
|
||||
@center @titlefont{GNU History Library}
|
||||
@center Brian Fox
|
||||
@center Free Software Foundation
|
||||
@center Version 1.1
|
||||
@center April 1991
|
||||
|
||||
@c Include the Distribution inside the titlepage environment so
|
||||
@c that headings are turned off.
|
||||
@title GNU History Library
|
||||
@subtitle Edition @value{EDITION}, for @code{History Library} Version @value{VERSION}.
|
||||
@subtitle @value{UPDATE-MONTH}
|
||||
@author Brian Fox, Free Software Foundation
|
||||
@author Chet Ramey, Case Western Reserve University
|
||||
|
||||
@page
|
||||
|
||||
This document describes the GNU History library, a programming tool that
|
||||
provides a consistent user interface for recalling lines of previously
|
||||
typed input.
|
||||
|
@ -91,6 +100,8 @@ typed input.
|
|||
@end menu
|
||||
@end ifinfo
|
||||
|
||||
@syncodeindex fn vr
|
||||
|
||||
@include hsuser.texinfo
|
||||
@include hstech.texinfo
|
||||
|
||||
|
@ -101,6 +112,6 @@ typed input.
|
|||
@node Function and Variable Index
|
||||
@appendix Function and Variable Index
|
||||
@printindex vr
|
||||
@contents
|
||||
|
||||
@contents
|
||||
@bye
|
||||
|
|
BIN
readline/doc/history.dvi
Normal file
BIN
readline/doc/history.dvi
Normal file
Binary file not shown.
1069
readline/doc/history.html
Normal file
1069
readline/doc/history.html
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,15 +1,21 @@
|
|||
Info file history.info, produced by Makeinfo, -*- Text -*- from input
|
||||
file hist.texinfo.
|
||||
This is Info file history.info, produced by Makeinfo version 1.67 from
|
||||
the input file /usr/homes/chet/src/bash/readline-2.2/doc/hist.texinfo.
|
||||
|
||||
INFO-DIR-SECTION Libraries
|
||||
START-INFO-DIR-ENTRY
|
||||
* History: (history). The GNU history library API
|
||||
END-INFO-DIR-ENTRY
|
||||
|
||||
This document describes the GNU History library, a programming tool
|
||||
that provides a consistent user interface for recalling lines of
|
||||
previously typed input.
|
||||
|
||||
Copyright (C) 1988, 1991 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988, 1991, 1993, 1995, 1996 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
pare preserved on all copies.
|
||||
Permission is granted to make and distribute verbatim copies of this
|
||||
manual provided the copyright notice and this permission notice pare
|
||||
preserved on all copies.
|
||||
|
||||
Permission is granted to copy and distribute modified versions of
|
||||
this manual under the conditions for verbatim copying, provided that
|
||||
|
@ -22,7 +28,7 @@ versions, except that this permission notice may be stated in a
|
|||
translation approved by the Foundation.
|
||||
|
||||
|
||||
File: history.info, Node: Top, Next: Using History Interactively, Prev: (DIR), Up: (DIR)
|
||||
File: history.info, Node: Top, Next: Using History Interactively, Up: (dir)
|
||||
|
||||
GNU History Library
|
||||
*******************
|
||||
|
@ -47,8 +53,8 @@ Using History Interactively
|
|||
|
||||
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, *note Programming with GNU History::..
|
||||
user's guide. For information on using the GNU History Library in your
|
||||
own programs, *note Programming with GNU History::..
|
||||
|
||||
* Menu:
|
||||
|
||||
|
@ -57,27 +63,34 @@ your own programs, *note Programming with GNU History::..
|
|||
|
||||
File: history.info, Node: History Interaction, Up: Using History Interactively
|
||||
|
||||
History Interaction
|
||||
===================
|
||||
History Expansion
|
||||
=================
|
||||
|
||||
The History library provides a history expansion feature that is
|
||||
similar to the history expansion in Csh. The following text describes
|
||||
the sytax that you use to manipulate the history information.
|
||||
similar to the history expansion provided by `csh'. This section
|
||||
describes the syntax used to manipulate the history information.
|
||||
|
||||
History expansions introduce words from the history list into the
|
||||
input stream, making it easy to repeat commands, insert the arguments
|
||||
to a previous command into the current input line, or fix errors in
|
||||
previous commands quickly.
|
||||
|
||||
History expansion takes place in two parts. The first is to
|
||||
determine which line from the previous history should be used during
|
||||
determine which line from the history list should be used during
|
||||
substitution. The second is to select portions of that line for
|
||||
inclusion into the current one. The line selected from the previous
|
||||
history is called the "event", and the portions of that line that are
|
||||
acted upon are called "words". The line is broken into words in the
|
||||
same fashion that the Bash shell does, so that several English (or
|
||||
Unix) words surrounded by quotes are considered as one word.
|
||||
inclusion into the current one. The line selected from the history is
|
||||
called the "event", and the portions of that line that are acted upon
|
||||
are called "words". Various "modifiers" are available to manipulate
|
||||
the selected words. The line is broken into words in the same fashion
|
||||
that Bash does, so that several words surrounded by quotes are
|
||||
considered one word. History expansions are introduced by the
|
||||
appearance of the history expansion character, which is `!' by default.
|
||||
|
||||
* Menu:
|
||||
|
||||
* Event Designators:: How to specify which history line to use.
|
||||
* Word Designators:: Specifying which words are of interest.
|
||||
* Modifiers:: Modifying the results of susbstitution.
|
||||
* Modifiers:: Modifying the results of substitution.
|
||||
|
||||
|
||||
File: history.info, Node: Event Designators, Next: Word Designators, Up: History Interaction
|
||||
|
@ -89,23 +102,32 @@ Event Designators
|
|||
history list.
|
||||
|
||||
`!'
|
||||
Start a history subsititution, except when followed by a space,
|
||||
tab, or the end of the line... = or (.
|
||||
Start a history substitution, except when followed by a space, tab,
|
||||
the end of the line, `=' or `('.
|
||||
|
||||
`!N'
|
||||
Refer to command line N.
|
||||
|
||||
`!-N'
|
||||
Refer to the command N lines back.
|
||||
|
||||
`!!'
|
||||
Refer to the previous command. This is a synonym for `!-1'.
|
||||
|
||||
`!n'
|
||||
Refer to command line N.
|
||||
|
||||
`!-n'
|
||||
Refer to the command line N lines back.
|
||||
|
||||
`!string'
|
||||
`!STRING'
|
||||
Refer to the most recent command starting with STRING.
|
||||
|
||||
`!?string'[`?']
|
||||
Refer to the most recent command containing STRING.
|
||||
`!?STRING[?]'
|
||||
Refer to the most recent command containing STRING. The trailing
|
||||
`?' may be omitted if the STRING is followed immediately by a
|
||||
newline.
|
||||
|
||||
`^STRING1^STRING2^'
|
||||
Quick Substitution. Repeat the last command, replacing STRING1
|
||||
with STRING2. Equivalent to `!!:s/STRING1/STRING2/'.
|
||||
|
||||
`!#'
|
||||
The entire command line typed so far.
|
||||
|
||||
|
||||
File: history.info, Node: Word Designators, Next: Modifiers, Prev: Event Designators, Up: History Interaction
|
||||
|
@ -113,34 +135,44 @@ File: history.info, Node: Word Designators, Next: Modifiers, Prev: Event Desi
|
|||
Word Designators
|
||||
----------------
|
||||
|
||||
A : separates the event specification from the word designator. It
|
||||
can be omitted if the word designator begins with a ^, $, * or %.
|
||||
Words are numbered from the beginning of the line, with the first word
|
||||
being denoted by a 0 (zero).
|
||||
Word designators are used to select desired words from the event. A
|
||||
`:' separates the event specification from the word designator. It may
|
||||
be omitted if the word designator begins with a `^', `$', `*', `-', or
|
||||
`%'. Words are numbered from the beginning of the line, with the first
|
||||
word being denoted by 0 (zero). Words are inserted into the current
|
||||
line separated by single spaces.
|
||||
|
||||
`0 (zero)'
|
||||
The zero'th word. For many applications, this is the command
|
||||
word.
|
||||
The `0'th word. For many applications, this is the command word.
|
||||
|
||||
`n'
|
||||
The N'th word.
|
||||
`N'
|
||||
The Nth word.
|
||||
|
||||
`^'
|
||||
The first argument. that is, word 1.
|
||||
The first argument; that is, word 1.
|
||||
|
||||
`$'
|
||||
The last argument.
|
||||
|
||||
`%'
|
||||
The word matched by the most recent `?string?' search.
|
||||
The word matched by the most recent `?STRING?' search.
|
||||
|
||||
`x-y'
|
||||
A range of words; `-Y' Abbreviates `0-Y'.
|
||||
`X-Y'
|
||||
A range of words; `-Y' abbreviates `0-Y'.
|
||||
|
||||
`*'
|
||||
All of the words, excepting the zero'th. This is a synonym for
|
||||
`1-$'. It is not an error to use * if there is just one word in
|
||||
the event. The empty string is returned in that case.
|
||||
All of the words, except the `0'th. This is a synonym for `1-$'.
|
||||
It is not an error to use `*' if there is just one word in the
|
||||
event; the empty string is returned in that case.
|
||||
|
||||
`X*'
|
||||
Abbreviates `X-$'
|
||||
|
||||
`X-'
|
||||
Abbreviates `X-$' like `X*', but omits the last word.
|
||||
|
||||
If a word designator is supplied without an event specification, the
|
||||
previous command is used as the event.
|
||||
|
||||
|
||||
File: history.info, Node: Modifiers, Prev: Word Designators, Up: History Interaction
|
||||
|
@ -148,38 +180,48 @@ File: history.info, Node: Modifiers, Prev: Word Designators, Up: History Inte
|
|||
Modifiers
|
||||
---------
|
||||
|
||||
After the optional word designator, you can add a sequence of one
|
||||
or more of the following modifiers, each preceded by a :.
|
||||
|
||||
`#'
|
||||
The entire command line typed so far. This means the current
|
||||
command, not the previous command, so it really isn't a word
|
||||
designator, and doesn't belong in this section.
|
||||
After the optional word designator, you can add a sequence of one or
|
||||
more of the following modifiers, each preceded by a `:'.
|
||||
|
||||
`h'
|
||||
Remove a trailing pathname component, leaving only the head.
|
||||
|
||||
`r'
|
||||
Remove a trailing suffix of the form `.'SUFFIX, leaving the
|
||||
basename.
|
||||
|
||||
`e'
|
||||
Remove all but the suffix.
|
||||
|
||||
`t'
|
||||
Remove all leading pathname components, leaving the tail.
|
||||
|
||||
`r'
|
||||
Remove a trailing suffix of the form `.SUFFIX', leaving the
|
||||
basename.
|
||||
|
||||
`e'
|
||||
Remove all but the trailing suffix.
|
||||
|
||||
`p'
|
||||
Print the new command but do not execute it.
|
||||
|
||||
`s/OLD/NEW/'
|
||||
Substitute NEW for the first occurrence of OLD in the event line.
|
||||
Any delimiter may be used in place of `/'. The delimiter may be
|
||||
quoted in OLD and NEW with a single backslash. If `&' appears in
|
||||
NEW, it is replaced by OLD. A single backslash will quote the
|
||||
`&'. The final delimiter is optional if it is the last character
|
||||
on the input line.
|
||||
|
||||
`&'
|
||||
Repeat the previous substitution.
|
||||
|
||||
`g'
|
||||
Cause changes to be applied over the entire event line. Used in
|
||||
conjunction with `s', as in `gs/OLD/NEW/', or with `&'.
|
||||
|
||||
|
||||
File: history.info, Node: Programming with GNU History, Next: Concept Index, Prev: Using History Interactively, Up: Top
|
||||
|
||||
Programming with GNU History
|
||||
****************************
|
||||
|
||||
This chapter describes how to interface the GNU History Library with
|
||||
programs that you write. It should be considered a technical guide.
|
||||
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, *note Using
|
||||
History Interactively::..
|
||||
|
||||
|
@ -198,27 +240,27 @@ 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
|
||||
History library is able to keep track of those lines, associate
|
||||
arbitrary data with each line, and utilize information from previous
|
||||
lines in making up new ones.
|
||||
lines in composing new ones.
|
||||
|
||||
The programmer using the History library has available to him
|
||||
functions for remembering lines on a history stack, associating
|
||||
arbitrary data with a line, removing lines from the stack, searching
|
||||
through the stack for a line containing an arbitrary text string, and
|
||||
referencing any line on the stack directly. In addition, a history
|
||||
"expansion" function is available which provides for a consistent user
|
||||
interface across many different programs.
|
||||
The programmer using the History library has available functions for
|
||||
remembering lines on a history list, associating arbitrary data with a
|
||||
line, removing lines from the list, searching through the list for a
|
||||
line containing an arbitrary text string, and referencing any line in
|
||||
the list directly. In addition, a history "expansion" function is
|
||||
available which provides for a consistent user interface across
|
||||
different programs.
|
||||
|
||||
The end-user using programs written with the History library has the
|
||||
benifit of a consistent user interface, with a set of well-known
|
||||
commands for manipulating the text of previous lines and using that
|
||||
text in new commands. The basic history manipulation commands are
|
||||
similar to the history substitution used by `Csh'.
|
||||
The user using programs written with the History library has the
|
||||
benefit of a consistent user interface with a set of well-known
|
||||
commands for manipulating the text of previous lines and using that text
|
||||
in new commands. The basic history manipulation commands are similar to
|
||||
the history substitution provided by `csh'.
|
||||
|
||||
If the programmer desires, he can use the Readline library, which
|
||||
includes some history manipulation by default, and has the added
|
||||
advantage of Emacs style command line editing.
|
||||
advantage of command line editing.
|
||||
|
||||
|
||||
File: history.info, Node: History Storage, Next: History Functions, Prev: Introduction to History, Up: Programming with GNU History
|
||||
|
@ -226,139 +268,290 @@ File: history.info, Node: History Storage, Next: History Functions, Prev: Int
|
|||
History Storage
|
||||
===============
|
||||
|
||||
The history list is an array of history entries. A history entry is
|
||||
declared as follows:
|
||||
|
||||
typedef struct _hist_entry {
|
||||
char *line;
|
||||
char *data;
|
||||
} HIST_ENTRY;
|
||||
|
||||
The history list itself might therefore be declared as
|
||||
|
||||
HIST_ENTRY **the_history_list;
|
||||
|
||||
The state of the History library is encapsulated into a single
|
||||
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;
|
||||
|
||||
If the flags member includes `HS_STIFLED', the history has been
|
||||
stifled.
|
||||
|
||||
|
||||
File: history.info, Node: History Functions, Next: History Variables, Prev: History Storage, Up: Programming with GNU History
|
||||
|
||||
History Functions
|
||||
=================
|
||||
|
||||
This section describes the calling sequence for the various
|
||||
functions present in GNU History.
|
||||
This section describes the calling sequence for the various functions
|
||||
present in GNU History.
|
||||
|
||||
* Function: void using_history ()
|
||||
Begin a session in which the history functions might be used.
|
||||
This just initializes the interactive variables.
|
||||
* Menu:
|
||||
|
||||
* Function: void add_history (CHAR *STRING)
|
||||
* Initializing History and State Management:: Functions to call when you
|
||||
want to use history in a
|
||||
program.
|
||||
* History List Management:: Functions used to manage the list
|
||||
of history entries.
|
||||
* Information About the History List:: Functions returning information about
|
||||
the history list.
|
||||
* Moving Around the History List:: Functions used to change the position
|
||||
in the history list.
|
||||
* Searching the History List:: Functions to search the history list
|
||||
for entries containing a string.
|
||||
* Managing the History File:: Functions that read and write a file
|
||||
containing the history list.
|
||||
* History Expansion:: Functions to perform csh-like history
|
||||
expansion.
|
||||
|
||||
|
||||
File: history.info, Node: Initializing History and State Management, Next: History List Management, Up: History Functions
|
||||
|
||||
Initializing History and State Management
|
||||
-----------------------------------------
|
||||
|
||||
This section describes functions used to initialize and manage the
|
||||
state of the History library when you want to use the history functions
|
||||
in your program.
|
||||
|
||||
- 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.
|
||||
|
||||
- Function: void history_set_history_state (HISTORY_STATE *state)
|
||||
Set the state of the history list according to STATE.
|
||||
|
||||
|
||||
File: history.info, Node: History List Management, Next: Information About the History List, Prev: Initializing History and State Management, Up: History Functions
|
||||
|
||||
History List Management
|
||||
-----------------------
|
||||
|
||||
These functions manage individual entries on the history list, or set
|
||||
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'.
|
||||
|
||||
* Function: int where_history ()
|
||||
Returns the number which says what history element we are now
|
||||
looking at.
|
||||
|
||||
* Function: int history_set_pos (INT POS)
|
||||
Set the position in the history list to POS.
|
||||
|
||||
* 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. DIRECTION, if negative, says to
|
||||
search backwards from POS, else forwards. Returns the absolute
|
||||
index of the history element where STRING was found, or -1
|
||||
otherwise.
|
||||
|
||||
* Function: HIST_ENTRY *remove_history ();
|
||||
Remove history element WHICH from the history. The removed
|
||||
element is returned to you so you can free the line, data, and
|
||||
- Function: HIST_ENTRY * remove_history (int which)
|
||||
Remove history entry at offset WHICH from the history. The
|
||||
removed element is returned so you can free the line, data, and
|
||||
containing structure.
|
||||
|
||||
* Function: void stifle_history (INT MAX)
|
||||
Stifle the history list, remembering only MAX number of entries.
|
||||
- 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: int unstifle_history ();
|
||||
- Function: void clear_history ()
|
||||
Clear the history list by deleting all the entries.
|
||||
|
||||
- Function: void stifle_history (int max)
|
||||
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 by. The value is positive if the history was
|
||||
history was stifled. The value is positive if the history was
|
||||
stifled, negative if it wasn't.
|
||||
|
||||
* 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 history_is_stifled ()
|
||||
Returns non-zero if the history is stifled, zero if it is 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 the FROM'th line and end at the TO'th. If
|
||||
FROM is zero, start at the beginning. If TO is less than FROM,
|
||||
then read until the end of the file. If FILENAME is `NULL', then
|
||||
read from `~/.history'. Returns 0 if successful, or `errno' if
|
||||
not.
|
||||
|
||||
File: history.info, Node: Information About the History List, Next: Moving Around the History List, Prev: History List Management, Up: History Functions
|
||||
|
||||
* Function: int write_history (CHAR *FILENAME)
|
||||
Append the current history to FILENAME. If FILENAME is `NULL',
|
||||
then append the history list to `~/.history'. Values returned
|
||||
are as in `read_history ()'.
|
||||
Information About the History List
|
||||
----------------------------------
|
||||
|
||||
* Function: int append_history (INT NELEMENTS, CHAR *FILENAME)
|
||||
Append NELEMENT entries to FILENAME. The entries appended are
|
||||
from the end of the list minus NELEMENTS up to the end of the
|
||||
list.
|
||||
These functions return information about the entire history list or
|
||||
individual list entries.
|
||||
|
||||
* Function: HIST_ENTRY *replace_history_entry ()
|
||||
Make the history entry at 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: 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: HIST_ENTRY *current_history ()
|
||||
- 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
|
||||
`history_offset'. If there is no entry there, return a `NULL'
|
||||
`where_history ()'. If there is no entry there, return a `NULL'
|
||||
pointer.
|
||||
|
||||
* Function: HIST_ENTRY *previous_history ()
|
||||
Back up 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 * 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: HIST_ENTRY *next_history ()
|
||||
Move `history_offset' forward to the next history entry, and
|
||||
return the a pointer to that entry. If there is no next entry,
|
||||
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
|
||||
lines in the history.
|
||||
|
||||
* 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'.
|
||||
|
||||
File: history.info, Node: Moving Around the History List, Next: Searching the History List, Prev: Information About the History List, Up: History Functions
|
||||
|
||||
* Function: int history_search (CHAR *STRING, INT DIRECTION)
|
||||
Search the history for STRING, starting at `history_offset'. If
|
||||
DIRECTION < 0, then the search is through previous entries, else
|
||||
through subsequent. If STRING is found, then `current_history
|
||||
()' is the history entry, and the value of this function is the
|
||||
offset in the line of that history entry that the STRING was
|
||||
found in. Otherwise, nothing is changed, and a -1 is returned.
|
||||
Moving Around the History List
|
||||
------------------------------
|
||||
|
||||
* Function: int history_expand (CHAR *STRING, CHAR **OUTPUT)
|
||||
These functions allow the current index into the history list to be
|
||||
set or changed.
|
||||
|
||||
- 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
|
||||
entry, return a `NULL' pointer.
|
||||
|
||||
|
||||
File: history.info, Node: Searching the History List, Next: Managing the History File, Prev: Moving Around the History List, Up: History Functions
|
||||
|
||||
Searching the History List
|
||||
--------------------------
|
||||
|
||||
These functions allow searching of the history list for entries
|
||||
containing a specific string. Searching may be performed both forward
|
||||
and backward from the current history position. The search may be
|
||||
"anchored", meaning that the string must match at the beginning of the
|
||||
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
|
||||
proceeds backward from POS, otherwise forward. Returns the
|
||||
absolute index of the history element where STRING was found, or
|
||||
-1 otherwise.
|
||||
|
||||
|
||||
File: history.info, Node: Managing the History File, Next: History Expansion, Prev: Searching the History List, Up: History Functions
|
||||
|
||||
Managing the History File
|
||||
-------------------------
|
||||
|
||||
The History library can read the history from and write it to a file.
|
||||
This section documents the functions for managing a history file.
|
||||
|
||||
- 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,
|
||||
start at the beginning. If TO is less than FROM, then read until
|
||||
the end of the file. If FILENAME is `NULL', then read from
|
||||
`~/.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.
|
||||
|
||||
|
||||
File: history.info, Node: History Expansion, Prev: Managing the History File, Up: History Functions
|
||||
|
||||
History Expansion
|
||||
-----------------
|
||||
|
||||
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. Returns:
|
||||
|
||||
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),
|
||||
character);
|
||||
|
||||
`1'
|
||||
if expansions did take place, or
|
||||
if expansions did take place;
|
||||
|
||||
`-1'
|
||||
if there was an error in expansion.
|
||||
if there was an error in expansion;
|
||||
|
||||
If an error ocurred in expansion, then OUTPUT contains a
|
||||
`2'
|
||||
if the returned line should only 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)
|
||||
- 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 the
|
||||
GNU Bash shell.
|
||||
arguments present in STRING. Arguments are broken up as in Bash.
|
||||
|
||||
* Function: int history_total_bytes ();
|
||||
Return the number of bytes that the primary history entries are
|
||||
using. This just adds up the lengths of `the_history->lines'.
|
||||
- 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
|
||||
specifier. At function entry, CINDEX points to the index into
|
||||
STRING where the history event specification begins. QCHAR is a
|
||||
character that is allowed to end the event specification in
|
||||
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.
|
||||
|
||||
|
||||
File: history.info, Node: History Variables, Next: History Programming Example, Prev: History Functions, Up: Programming with GNU History
|
||||
|
@ -366,12 +559,54 @@ File: history.info, Node: History Variables, Next: History Programming Example
|
|||
History Variables
|
||||
=================
|
||||
|
||||
This section describes the variables in GNU History that are
|
||||
externally visible.
|
||||
This section describes the externally visible variables exported by
|
||||
the GNU History Library.
|
||||
|
||||
* Variable: int history_base
|
||||
For convenience only. You set this when interpreting history
|
||||
commands. It is the logical offset of the first history element.
|
||||
- Variable: int history_base
|
||||
The logical offset of the first entry in the history list.
|
||||
|
||||
- Variable: int history_length
|
||||
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
|
||||
The character that invokes word substitution if found at the start
|
||||
of a line. The default is `^'.
|
||||
|
||||
- Variable: char history_comment_char
|
||||
During tokenization, if this character is seen as the first
|
||||
character of a word, then it and all subsequent characters up to a
|
||||
newline are ignored, suppressing history expansion for the
|
||||
remainder of the line. This is disabled by default.
|
||||
|
||||
- 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.
|
||||
|
||||
- Variable: int history_quotes_inhibit_expansion
|
||||
If non-zero, single-quoted words are not scanned for the history
|
||||
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.
|
||||
|
||||
|
||||
File: history.info, Node: History Programming Example, Prev: History Variables, Up: Programming with GNU History
|
||||
|
@ -379,20 +614,28 @@ File: history.info, Node: History Programming Example, Prev: History Variables
|
|||
History Programming Example
|
||||
===========================
|
||||
|
||||
The following snippet of code demonstrates simple use of the GNU
|
||||
History Library.
|
||||
The following program demonstrates simple use of the GNU History
|
||||
Library.
|
||||
|
||||
main ()
|
||||
{
|
||||
char line[1024], *t;
|
||||
int done = 0;
|
||||
int len, done = 0;
|
||||
|
||||
line[0] = 0;
|
||||
|
||||
using_history ();
|
||||
while (!done)
|
||||
{
|
||||
fprintf (stdout, "history%% ");
|
||||
t = gets (line);
|
||||
printf ("history$ ");
|
||||
fflush (stdout);
|
||||
t = fgets (line, sizeof (line) - 1, stdin);
|
||||
if (t && *t)
|
||||
{
|
||||
len = strlen (t);
|
||||
if (t[len - 1] == '\n')
|
||||
t[len - 1] = '\0';
|
||||
}
|
||||
|
||||
if (!t)
|
||||
strcpy (line, "quit");
|
||||
|
@ -402,37 +645,41 @@ History Library.
|
|||
char *expansion;
|
||||
int result;
|
||||
|
||||
using_history ();
|
||||
|
||||
result = history_expand (line, &expansion);
|
||||
strcpy (line, expansion);
|
||||
free (expansion);
|
||||
if (result)
|
||||
fprintf (stderr, "%s\n", line);
|
||||
fprintf (stderr, "%s\n", expansion);
|
||||
|
||||
if (result < 0)
|
||||
continue;
|
||||
if (result < 0 || result == 2)
|
||||
{
|
||||
free (expansion);
|
||||
continue;
|
||||
}
|
||||
|
||||
add_history (line);
|
||||
add_history (expansion);
|
||||
strncpy (line, expansion, sizeof (line) - 1);
|
||||
free (expansion);
|
||||
}
|
||||
|
||||
if (strcmp (line, "quit") == 0) done = 1;
|
||||
if (strcmp (line, "save") == 0) write_history (0);
|
||||
if (strcmp (line, "read") == 0) read_history (0);
|
||||
if (strcmp (line, "list") == 0)
|
||||
if (strcmp (line, "quit") == 0)
|
||||
done = 1;
|
||||
else if (strcmp (line, "save") == 0)
|
||||
write_history ("history_file");
|
||||
else if (strcmp (line, "read") == 0)
|
||||
read_history ("history_file");
|
||||
else if (strcmp (line, "list") == 0)
|
||||
{
|
||||
register HIST_ENTRY **the_list = history_list ();
|
||||
register HIST_ENTRY **the_list;
|
||||
register int i;
|
||||
|
||||
the_list = history_list ();
|
||||
if (the_list)
|
||||
for (i = 0; the_list[i]; i++)
|
||||
fprintf (stdout, "%d: %s\n",
|
||||
i + history_base, the_list[i]->line);
|
||||
printf ("%d: %s\n", i + history_base, the_list[i]->line);
|
||||
}
|
||||
if (strncmp (line, "delete", strlen ("delete")) == 0)
|
||||
else if (strncmp (line, "delete", 6) == 0)
|
||||
{
|
||||
int which;
|
||||
if ((sscanf (line + strlen ("delete"), "%d", &which)) == 1)
|
||||
if ((sscanf (line + 6, "%d", &which)) == 1)
|
||||
{
|
||||
HIST_ENTRY *entry = remove_history (which);
|
||||
if (!entry)
|
||||
|
@ -459,8 +706,11 @@ Concept Index
|
|||
|
||||
* Menu:
|
||||
|
||||
* event designators: Event Designators.
|
||||
* expansion: History Interaction.
|
||||
* anchored search: Searching the History List.
|
||||
* event designators: Event Designators.
|
||||
* history events: Event Designators.
|
||||
* history expansion: History Interaction.
|
||||
* History Searching: Searching the History List.
|
||||
|
||||
|
||||
File: history.info, Node: Function and Variable Index, Prev: Concept Index, Up: Top
|
||||
|
@ -470,45 +720,70 @@ Function and Variable Index
|
|||
|
||||
* Menu:
|
||||
|
||||
* HIST_ENTRY **history_list: History Functions.
|
||||
* HIST_ENTRY *current_history: History Functions.
|
||||
* HIST_ENTRY *next_history: History Functions.
|
||||
* HIST_ENTRY *previous_history: History Functions.
|
||||
* HIST_ENTRY *remove_history: History Functions.
|
||||
* HIST_ENTRY *replace_history_entry: History Functions.
|
||||
* char *history_arg_extract: History Functions.
|
||||
* int append_history: History Functions.
|
||||
* int history_base: History Variables.
|
||||
* int history_expand: History Functions.
|
||||
* int history_search: History Functions.
|
||||
* int history_search_pos: History Functions.
|
||||
* int history_set_pos: History Functions.
|
||||
* int history_total_bytes: History Functions.
|
||||
* int read_history: History Functions.
|
||||
* int read_history_range: History Functions.
|
||||
* int unstifle_history: History Functions.
|
||||
* int where_history: History Functions.
|
||||
* int write_history: History Functions.
|
||||
* void add_history: History Functions.
|
||||
* void stifle_history: History Functions.
|
||||
* void using_history: History Functions.
|
||||
* add_history: History List Management.
|
||||
* append_history: Managing the History File.
|
||||
* clear_history: History List Management.
|
||||
* current_history: Information About the History List.
|
||||
* get_history_event: History Expansion.
|
||||
* history_arg_extract: History Expansion.
|
||||
* history_base: History Variables.
|
||||
* history_comment_char: History Variables.
|
||||
* history_expand: History Expansion.
|
||||
* history_expansion_char: History Variables.
|
||||
* history_get: Information About the History List.
|
||||
* history_get_history_state: Initializing History and State Management.
|
||||
* history_inhibit_expansion_function: History Variables.
|
||||
* history_is_stifled: History List Management.
|
||||
* history_length: History Variables.
|
||||
* history_list: Information About the History List.
|
||||
* history_no_expand_chars: History Variables.
|
||||
* history_quotes_inhibit_expansion: History Variables.
|
||||
* history_search: Searching the History List.
|
||||
* history_search_delimiter_chars: History Variables.
|
||||
* history_search_pos: Searching the History List.
|
||||
* history_search_prefix: Searching the History List.
|
||||
* history_set_history_state: Initializing History and State Management.
|
||||
* history_set_pos: Moving Around the History List.
|
||||
* history_subst_char: History Variables.
|
||||
* history_tokenize: History Expansion.
|
||||
* 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.
|
||||
* read_history: Managing the History File.
|
||||
* read_history_range: Managing the History File.
|
||||
* remove_history: History List Management.
|
||||
* replace_history_entry: History List Management.
|
||||
* stifle_history: History List Management.
|
||||
* unstifle_history: History List Management.
|
||||
* using_history: Initializing History and State Management.
|
||||
* where_history: Information About the History List.
|
||||
* write_history: Managing the History File.
|
||||
|
||||
|
||||
|
||||
Tag Table:
|
||||
Node: Top973
|
||||
Node: Using History Interactively1567
|
||||
Node: History Interaction2075
|
||||
Node: Event Designators3127
|
||||
Node: Word Designators3770
|
||||
Node: Modifiers4676
|
||||
Node: Programming with GNU History5425
|
||||
Node: Introduction to History6152
|
||||
Node: History Storage7502
|
||||
Node: History Functions7766
|
||||
Node: History Variables13063
|
||||
Node: History Programming Example13499
|
||||
Node: Concept Index15744
|
||||
Node: Function and Variable Index16030
|
||||
Node: Top1167
|
||||
Node: Using History Interactively1747
|
||||
Node: History Interaction2255
|
||||
Node: Event Designators3674
|
||||
Node: Word Designators4601
|
||||
Node: Modifiers5850
|
||||
Node: Programming with GNU History6988
|
||||
Node: Introduction to History7714
|
||||
Node: History Storage9035
|
||||
Node: History Functions10128
|
||||
Node: Initializing History and State Management11099
|
||||
Node: History List Management11891
|
||||
Node: Information About the History List13412
|
||||
Node: Moving Around the History List14718
|
||||
Node: Searching the History List15603
|
||||
Node: Managing the History File17435
|
||||
Node: History Expansion18941
|
||||
Node: History Variables20785
|
||||
Node: History Programming Example23103
|
||||
Node: Concept Index25707
|
||||
Node: Function and Variable Index26193
|
||||
|
||||
End Tag Table
|
||||
|
|
2071
readline/doc/history.ps
Normal file
2071
readline/doc/history.ps
Normal file
File diff suppressed because it is too large
Load diff
51
readline/doc/history_toc.html
Normal file
51
readline/doc/history_toc.html
Normal file
|
@ -0,0 +1,51 @@
|
|||
<HTML>
|
||||
<HEAD>
|
||||
<!-- This HTML file has been created by texi2html 1.51
|
||||
from /usr/homes/chet/src/bash/readline-2.2/doc/hist.texinfo on 2 April 1998 -->
|
||||
|
||||
<TITLE>GNU History Library - Table of Contents</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<H1>GNU History Library</H1>
|
||||
<H2>Edition 2.1, for <CODE>History Library</CODE> Version 2.1.</H2>
|
||||
<H2>March 1996</H2>
|
||||
<ADDRESS>Brian Fox, Free Software Foundation</ADDRESS>
|
||||
<ADDRESS>Chet Ramey, Case Western Reserve University</ADDRESS>
|
||||
<P>
|
||||
<P><HR><P>
|
||||
<UL>
|
||||
<LI><A NAME="TOC1" HREF="history.html#SEC1">Using History Interactively</A>
|
||||
<UL>
|
||||
<LI><A NAME="TOC2" HREF="history.html#SEC2">History Expansion</A>
|
||||
<UL>
|
||||
<LI><A NAME="TOC3" HREF="history.html#SEC3">Event Designators</A>
|
||||
<LI><A NAME="TOC4" HREF="history.html#SEC4">Word Designators</A>
|
||||
<LI><A NAME="TOC5" HREF="history.html#SEC5">Modifiers</A>
|
||||
</UL>
|
||||
</UL>
|
||||
<LI><A NAME="TOC6" HREF="history.html#SEC6">Programming with GNU History</A>
|
||||
<UL>
|
||||
<LI><A NAME="TOC7" HREF="history.html#SEC7">Introduction to History</A>
|
||||
<LI><A NAME="TOC8" HREF="history.html#SEC8">History Storage</A>
|
||||
<LI><A NAME="TOC9" HREF="history.html#SEC9">History Functions</A>
|
||||
<UL>
|
||||
<LI><A NAME="TOC10" HREF="history.html#SEC10">Initializing History and State Management</A>
|
||||
<LI><A NAME="TOC11" HREF="history.html#SEC11">History List Management</A>
|
||||
<LI><A NAME="TOC12" HREF="history.html#SEC12">Information About the History List</A>
|
||||
<LI><A NAME="TOC13" HREF="history.html#SEC13">Moving Around the History List</A>
|
||||
<LI><A NAME="TOC14" HREF="history.html#SEC14">Searching the History List</A>
|
||||
<LI><A NAME="TOC15" HREF="history.html#SEC15">Managing the History File</A>
|
||||
<LI><A NAME="TOC16" HREF="history.html#SEC16">History Expansion</A>
|
||||
</UL>
|
||||
<LI><A NAME="TOC17" HREF="history.html#SEC17">History Variables</A>
|
||||
<LI><A NAME="TOC18" HREF="history.html#SEC18">History Programming Example</A>
|
||||
</UL>
|
||||
<LI><A NAME="TOC19" HREF="history.html#SEC19">Concept Index</A>
|
||||
<LI><A NAME="TOC20" HREF="history.html#SEC20">Function and Variable Index</A>
|
||||
</UL>
|
||||
<P><HR><P>
|
||||
This document was generated on 2 April 1998 using the
|
||||
<A HREF="http://wwwcn.cern.ch/dci/texi2html/">texi2html</A>
|
||||
translator version 1.51.</P>
|
||||
</BODY>
|
||||
</HTML>
|
|
@ -1,8 +1,8 @@
|
|||
@ignore
|
||||
This file documents the user interface to the GNU History library.
|
||||
|
||||
Copyright (C) 1988, 1991 Free Software Foundation, Inc.
|
||||
Authored by Brian Fox.
|
||||
Copyright (C) 1988, 1991, 1994, 1996 Free Software Foundation, Inc.
|
||||
Authored by Brian Fox and Chet Ramey.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of this manual
|
||||
provided the copyright notice and this permission notice are preserved on
|
||||
|
@ -26,8 +26,9 @@ into another language, under the above conditions for modified versions.
|
|||
@node Programming with GNU History
|
||||
@chapter Programming with GNU History
|
||||
|
||||
This chapter describes how to interface the GNU History Library with
|
||||
programs that you write. It should be considered a technical guide.
|
||||
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}.
|
||||
|
||||
|
@ -42,32 +43,35 @@ History Interactively}.
|
|||
@node Introduction to History
|
||||
@section Introduction to History
|
||||
|
||||
Many programs read input from the user a line at a time. The GNU 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 making up new
|
||||
each line, and utilize information from previous lines in composing new
|
||||
ones.
|
||||
|
||||
The programmer using the History library has available to him functions
|
||||
for remembering lines on a history stack, associating arbitrary data
|
||||
with a line, removing lines from the stack, searching through the stack
|
||||
The programmer using the History library has available functions
|
||||
for remembering lines on a history list, associating arbitrary data
|
||||
with a line, removing lines from the list, searching through the list
|
||||
for a line containing an arbitrary text string, and referencing any line
|
||||
on the stack directly. In addition, a history @dfn{expansion} function
|
||||
is available which provides for a consistent user interface across many
|
||||
in the list directly. In addition, a history @dfn{expansion} function
|
||||
is available which provides for a consistent user interface across
|
||||
different programs.
|
||||
|
||||
The end-user using programs written with the History library has the
|
||||
benifit of a consistent user interface, with a set of well-known
|
||||
The user using programs written with the History library has the
|
||||
benefit of a consistent user interface with a set of well-known
|
||||
commands for manipulating the text of previous lines and using that text
|
||||
in new commands. The basic history manipulation commands are similar to
|
||||
the history substitution used by @code{Csh}.
|
||||
the history substitution provided by @code{csh}.
|
||||
|
||||
If the programmer desires, he can use the Readline library, which
|
||||
includes some history manipulation by default, and has the added
|
||||
advantage of Emacs style command line editing.
|
||||
advantage of command line editing.
|
||||
|
||||
@node History Storage
|
||||
@section History Storage
|
||||
|
||||
The history list is an array of history entries. A history entry is
|
||||
declared as follows:
|
||||
|
||||
@example
|
||||
typedef struct _hist_entry @{
|
||||
char *line;
|
||||
|
@ -75,179 +79,378 @@ typedef struct _hist_entry @{
|
|||
@} HIST_ENTRY;
|
||||
@end example
|
||||
|
||||
The history list itself might therefore be declared as
|
||||
|
||||
@example
|
||||
HIST_ENTRY **the_history_list;
|
||||
@end example
|
||||
|
||||
The state of the History library is encapsulated into a single structure:
|
||||
|
||||
@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;
|
||||
@end example
|
||||
|
||||
If the flags member includes @code{HS_STIFLED}, the history has been
|
||||
stifled.
|
||||
|
||||
@node History Functions
|
||||
@section History Functions
|
||||
|
||||
This section describes the calling sequence for the various functions
|
||||
present in GNU History.
|
||||
|
||||
@defun {void using_history} ()
|
||||
Begin a session in which the history functions might be used. This
|
||||
just initializes the interactive variables.
|
||||
@end defun
|
||||
@menu
|
||||
* Initializing History and State Management:: Functions to call when you
|
||||
want to use history in a
|
||||
program.
|
||||
* History List Management:: Functions used to manage the list
|
||||
of history entries.
|
||||
* Information About the History List:: Functions returning information about
|
||||
the history list.
|
||||
* Moving Around the History List:: Functions used to change the position
|
||||
in the history list.
|
||||
* Searching the History List:: Functions to search the history list
|
||||
for entries containing a string.
|
||||
* Managing the History File:: Functions that read and write a file
|
||||
containing the history list.
|
||||
* History Expansion:: Functions to perform csh-like history
|
||||
expansion.
|
||||
@end menu
|
||||
|
||||
@defun {void add_history} (char *string)
|
||||
@node Initializing History and State Management
|
||||
@subsection Initializing History and State Management
|
||||
|
||||
This section describes functions used to initialize and manage
|
||||
the state of the History library when you want to use the history
|
||||
functions in your program.
|
||||
|
||||
@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
|
||||
|
||||
@deftypefun void history_set_history_state (HISTORY_STATE *state)
|
||||
Set the state of the history list according to @var{state}.
|
||||
@end deftypefun
|
||||
|
||||
@node History List Management
|
||||
@subsection History List Management
|
||||
|
||||
These functions manage individual entries on the history list, or set
|
||||
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}.
|
||||
@end defun
|
||||
@end deftypefun
|
||||
|
||||
@defun {int where_history} ()
|
||||
Returns the number which says what history element we are now looking
|
||||
at.
|
||||
@end defun
|
||||
|
||||
@defun {int history_set_pos} (int pos)
|
||||
Set the position in the history list to @var{pos}.
|
||||
@end defun
|
||||
|
||||
@defun {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. @var{direction}, if negative, says to search
|
||||
backwards from @var{pos}, else forwards. Returns the absolute index of
|
||||
the history element where @var{string} was found, or -1 otherwise.
|
||||
@end defun
|
||||
|
||||
@defun {HIST_ENTRY *remove_history} ();
|
||||
Remove history element @var{which} from the history. The removed
|
||||
element is returned to you so you can free the line, data,
|
||||
@deftypefun {HIST_ENTRY *} remove_history (int which)
|
||||
Remove history entry at offset @var{which} from the history. The
|
||||
removed element is returned so you can free the line, data,
|
||||
and containing structure.
|
||||
@end defun
|
||||
@end deftypefun
|
||||
|
||||
@defun {void stifle_history} (int max)
|
||||
Stifle the history list, remembering only @var{max} number of entries.
|
||||
@end defun
|
||||
@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
|
||||
of an invalid @var{which}, a @code{NULL} pointer is returned.
|
||||
@end deftypefun
|
||||
|
||||
@defun {int unstifle_history} ();
|
||||
@deftypefun void clear_history ()
|
||||
Clear the history list by deleting all the entries.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void stifle_history (int max)
|
||||
Stifle the history list, remembering only the last @var{max} entries.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun int unstifle_history ()
|
||||
Stop stifling the history. This returns the previous amount the
|
||||
history was stifled by. The value is positive if the history was
|
||||
history was stifled. The value is positive if the history was
|
||||
stifled, negative if it wasn't.
|
||||
@end defun
|
||||
@end deftypefun
|
||||
|
||||
@defun {int read_history} (char *filename)
|
||||
@deftypefun int history_is_stifled ()
|
||||
Returns non-zero if the history is stifled, zero if it is not.
|
||||
@end deftypefun
|
||||
|
||||
@node Information About the History List
|
||||
@subsection Information About the History List
|
||||
|
||||
These functions return information about the entire history list or
|
||||
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
|
||||
|
||||
@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
|
||||
history.
|
||||
@end deftypefun
|
||||
|
||||
@node Moving Around the History List
|
||||
@subsection Moving Around the History List
|
||||
|
||||
These functions allow the current index into the history list to be
|
||||
set or changed.
|
||||
|
||||
@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
|
||||
a @code{NULL} pointer.
|
||||
@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
|
||||
a @code{NULL} pointer.
|
||||
@end deftypefun
|
||||
|
||||
@node Searching the History List
|
||||
@subsection Searching the History List
|
||||
@cindex History Searching
|
||||
|
||||
These functions allow searching of the history list for entries containing
|
||||
a specific string. Searching may be performed both forward and backward
|
||||
from the current history position. The search may be @dfn{anchored},
|
||||
meaning that the string must match at the beginning of the history entry.
|
||||
@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
|
||||
@var{string} was found. Otherwise, nothing is changed, and a -1 is
|
||||
returned.
|
||||
@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
|
||||
proceeds backward from @var{pos}, otherwise forward. Returns the absolute
|
||||
index of the history element where @var{string} was found, or -1 otherwise.
|
||||
@end deftypefun
|
||||
|
||||
@node Managing the History File
|
||||
@subsection Managing the History File
|
||||
|
||||
The History library can read the history from and write it to a file.
|
||||
This section documents the functions for managing a history file.
|
||||
|
||||
@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 defun
|
||||
@end deftypefun
|
||||
|
||||
@defun {int read_history_range} (char *filename, int from, int to)
|
||||
@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 the @var{from}'th line and end at the @var{to}'th. If
|
||||
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,
|
||||
or @code{errno} if not.
|
||||
@end defun
|
||||
@end deftypefun
|
||||
|
||||
@defun {int write_history} (char *filename)
|
||||
Append the current history to @var{filename}. If @var{filename} is
|
||||
@code{NULL}, then append the history list to @file{~/.history}. Values
|
||||
@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 defun
|
||||
@end deftypefun
|
||||
|
||||
@defun {int append_history} (int nelements, char *filename)
|
||||
Append @var{nelement} entries to @var{filename}. The entries appended
|
||||
are from the end of the list minus @var{nelements} up to the end of the
|
||||
list.
|
||||
@end defun
|
||||
@deftypefun int append_history (int nelements, char *filename)
|
||||
Append the last @var{nelements} of the history list to @var{filename}.
|
||||
@end deftypefun
|
||||
|
||||
@defun {HIST_ENTRY *replace_history_entry} ()
|
||||
Make the history entry at @var{which} have @var{line} and @var{data}.
|
||||
This returns the old entry so you can dispose of the data. In the case
|
||||
of an invalid @var{which}, a @code{NULL} pointer is returned.
|
||||
@end defun
|
||||
@deftypefun int history_truncate_file (char *filename, int nlines)
|
||||
Truncate the history file @var{filename}, leaving only the last
|
||||
@var{nlines} lines.
|
||||
@end deftypefun
|
||||
|
||||
@defun {HIST_ENTRY *current_history} ()
|
||||
Return the history entry at the current position, as determined by
|
||||
@code{history_offset}. If there is no entry there, return a @code{NULL}
|
||||
pointer.
|
||||
@end defun
|
||||
@node History Expansion
|
||||
@subsection History Expansion
|
||||
|
||||
@defun {HIST_ENTRY *previous_history} ()
|
||||
Back up @var{history_offset} to the previous history entry, and return a
|
||||
pointer to that entry. If there is no previous entry, return a
|
||||
@code{NULL} pointer.
|
||||
@end defun
|
||||
These functions implement @code{csh}-like history expansion.
|
||||
|
||||
@defun {HIST_ENTRY *next_history} ()
|
||||
Move @code{history_offset} forward to the next history entry, and return
|
||||
the a pointer to that entry. If there is no next entry, return a
|
||||
@code{NULL} pointer.
|
||||
@end defun
|
||||
|
||||
@defun {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 defun
|
||||
|
||||
@defun {int history_search} (char *string, int direction)
|
||||
Search the history for @var{string}, starting at @code{history_offset}.
|
||||
If @var{direction} < 0, then the search is through previous entries,
|
||||
else through subsequent. If @var{string} is found, then
|
||||
@code{current_history ()} is the history entry, and the value of this
|
||||
function is the offset in the line of that history entry that the
|
||||
@var{string} was found in. Otherwise, nothing is changed, and a -1 is
|
||||
returned.
|
||||
@end defun
|
||||
|
||||
@defun {int history_expand} (char *string, char **output)
|
||||
@deftypefun int history_expand (char *string, char **output)
|
||||
Expand @var{string}, placing the result into @var{output}, a pointer
|
||||
to a string. Returns:
|
||||
to a string (@pxref{History Interaction}). Returns:
|
||||
@table @code
|
||||
@item 0
|
||||
If no expansions took place (or, if the only change in
|
||||
the text was the de-slashifying of the history expansion
|
||||
character),
|
||||
character);
|
||||
@item 1
|
||||
if expansions did take place, or
|
||||
if expansions did take place;
|
||||
@item -1
|
||||
if there was an error in expansion.
|
||||
if there was an error in expansion;
|
||||
@item 2
|
||||
if the returned line should only be displayed, but not executed,
|
||||
as with the @code{:p} modifier (@pxref{Modifiers}).
|
||||
@end table
|
||||
|
||||
If an error ocurred in expansion, then @var{output} contains a descriptive
|
||||
error message.
|
||||
@end defun
|
||||
@end deftypefun
|
||||
|
||||
@defun {char *history_arg_extract} (int first, int last, char *string)
|
||||
@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
|
||||
the GNU Bash shell.
|
||||
@end defun
|
||||
arguments present in @var{string}. Arguments are broken up as in Bash.
|
||||
@end deftypefun
|
||||
|
||||
@defun {int history_total_bytes} ();
|
||||
Return the number of bytes that the primary history entries are using.
|
||||
This just adds up the lengths of @code{the_history->lines}.
|
||||
@end defun
|
||||
@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
|
||||
specifier. At function entry, @var{cindex} points to the index into
|
||||
@var{string} where the history event specification begins. @var{qchar}
|
||||
is a character that is allowed to end the event specification in addition
|
||||
to the ``normal'' terminating characters.
|
||||
@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
|
||||
|
||||
@node History Variables
|
||||
@section History Variables
|
||||
|
||||
This section describes the variables in GNU History that are externally
|
||||
visible.
|
||||
This section describes the externally visible variables exported by
|
||||
the GNU History Library.
|
||||
|
||||
@defvar {int history_base}
|
||||
For convenience only. You set this when interpreting history commands.
|
||||
It is the logical offset of the first history element.
|
||||
@end defvar
|
||||
@deftypevar int history_base
|
||||
The logical offset of the first entry in the history list.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar int history_length
|
||||
The number of entries currently stored in the history list.
|
||||
@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
|
||||
|
||||
@deftypevar char history_subst_char
|
||||
The character that invokes word substitution if found at the start of
|
||||
a line. The default is @samp{^}.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar char history_comment_char
|
||||
During tokenization, if this character is seen as the first character
|
||||
of a word, then it and all subsequent characters up to a newline are
|
||||
ignored, suppressing history expansion for the remainder of the line.
|
||||
This is disabled by default.
|
||||
@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
|
||||
|
||||
@deftypevar int history_quotes_inhibit_expansion
|
||||
If non-zero, single-quoted words are not scanned for the history expansion
|
||||
character. The default value is 0.
|
||||
@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
|
||||
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.
|
||||
@end deftypevar
|
||||
|
||||
@node History Programming Example
|
||||
@section History Programming Example
|
||||
|
||||
The following snippet of code demonstrates simple use of the GNU History
|
||||
Library.
|
||||
The following program demonstrates simple use of the GNU History Library.
|
||||
|
||||
@smallexample
|
||||
main ()
|
||||
@{
|
||||
char line[1024], *t;
|
||||
int done = 0;
|
||||
int len, done = 0;
|
||||
|
||||
line[0] = 0;
|
||||
|
||||
using_history ();
|
||||
while (!done)
|
||||
@{
|
||||
fprintf (stdout, "history%% ");
|
||||
t = gets (line);
|
||||
printf ("history$ ");
|
||||
fflush (stdout);
|
||||
t = fgets (line, sizeof (line) - 1, stdin);
|
||||
if (t && *t)
|
||||
@{
|
||||
len = strlen (t);
|
||||
if (t[len - 1] == '\n')
|
||||
t[len - 1] = '\0';
|
||||
@}
|
||||
|
||||
if (!t)
|
||||
strcpy (line, "quit");
|
||||
|
@ -257,37 +460,41 @@ main ()
|
|||
char *expansion;
|
||||
int result;
|
||||
|
||||
using_history ();
|
||||
|
||||
result = history_expand (line, &expansion);
|
||||
strcpy (line, expansion);
|
||||
free (expansion);
|
||||
if (result)
|
||||
fprintf (stderr, "%s\n", line);
|
||||
fprintf (stderr, "%s\n", expansion);
|
||||
|
||||
if (result < 0)
|
||||
continue;
|
||||
if (result < 0 || result == 2)
|
||||
@{
|
||||
free (expansion);
|
||||
continue;
|
||||
@}
|
||||
|
||||
add_history (line);
|
||||
add_history (expansion);
|
||||
strncpy (line, expansion, sizeof (line) - 1);
|
||||
free (expansion);
|
||||
@}
|
||||
|
||||
if (strcmp (line, "quit") == 0) done = 1;
|
||||
if (strcmp (line, "save") == 0) write_history (0);
|
||||
if (strcmp (line, "read") == 0) read_history (0);
|
||||
if (strcmp (line, "list") == 0)
|
||||
if (strcmp (line, "quit") == 0)
|
||||
done = 1;
|
||||
else if (strcmp (line, "save") == 0)
|
||||
write_history ("history_file");
|
||||
else if (strcmp (line, "read") == 0)
|
||||
read_history ("history_file");
|
||||
else if (strcmp (line, "list") == 0)
|
||||
@{
|
||||
register HIST_ENTRY **the_list = history_list ();
|
||||
register HIST_ENTRY **the_list;
|
||||
register int i;
|
||||
|
||||
the_list = history_list ();
|
||||
if (the_list)
|
||||
for (i = 0; the_list[i]; i++)
|
||||
fprintf (stdout, "%d: %s\n",
|
||||
i + history_base, the_list[i]->line);
|
||||
printf ("%d: %s\n", i + history_base, the_list[i]->line);
|
||||
@}
|
||||
if (strncmp (line, "delete", strlen ("delete")) == 0)
|
||||
else if (strncmp (line, "delete", 6) == 0)
|
||||
@{
|
||||
int which;
|
||||
if ((sscanf (line + strlen ("delete"), "%d", &which)) == 1)
|
||||
if ((sscanf (line + 6, "%d", &which)) == 1)
|
||||
@{
|
||||
HIST_ENTRY *entry = remove_history (which);
|
||||
if (!entry)
|
||||
|
@ -306,6 +513,3 @@ main ()
|
|||
@}
|
||||
@}
|
||||
@end smallexample
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
@ignore
|
||||
This file documents the user interface to the GNU History library.
|
||||
|
||||
Copyright (C) 1988, 1991 Free Software Foundation, Inc.
|
||||
Authored by Brian Fox.
|
||||
Copyright (C) 1988, 1991, 1996 Free Software Foundation, Inc.
|
||||
Authored by Brian Fox and Chet Ramey.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of this manual
|
||||
provided the copyright notice and this permission notice are preserved on
|
||||
|
@ -26,36 +26,236 @@ into another language, under the above conditions for modified versions.
|
|||
@node Using History Interactively
|
||||
@chapter Using History Interactively
|
||||
|
||||
@ifset 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 other programs,
|
||||
see the GNU Readline Library Manual.
|
||||
@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
|
||||
|
||||
@ifset BashFeatures
|
||||
@menu
|
||||
* Bash History Facilities:: How Bash lets you manipulate your command
|
||||
history.
|
||||
* Bash History Builtins:: The Bash builtin commands that manipulate
|
||||
the command history.
|
||||
* History Interaction:: What it feels like using History as a user.
|
||||
@end menu
|
||||
@end ifset
|
||||
@ifclear BashFeatures
|
||||
@menu
|
||||
* History Interaction:: What it feels like using History as a user.
|
||||
@end menu
|
||||
@end ifclear
|
||||
|
||||
@ifset BashFeatures
|
||||
@node Bash History Facilities
|
||||
@section Bash History Facilities
|
||||
@cindex command history
|
||||
@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 text of the last
|
||||
@code{HISTSIZE}
|
||||
commands (default 500) is saved in a history list. The shell
|
||||
stores each command in the history list prior to parameter and
|
||||
variable expansion
|
||||
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}).
|
||||
@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 @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
|
||||
a portion of the history list.
|
||||
The @code{history} builtin can be used to display or modify the history
|
||||
list and manipulate the history file.
|
||||
When using the command-line editing, search commands
|
||||
are available in each editing mode that provide access to the
|
||||
history list.
|
||||
|
||||
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.
|
||||
The @code{cmdhist}
|
||||
shell option, if enabled, causes the shell to attempt to save each
|
||||
line of a multi-line command in the same history entry, adding
|
||||
semicolons where necessary to preserve syntactic correctness.
|
||||
The @code{lithist}
|
||||
shell option causes the shell to save the command with embedded newlines
|
||||
instead of semicolons.
|
||||
@xref{Bash Builtins}, for a description of @code{shopt}.
|
||||
|
||||
@node Bash History Builtins
|
||||
@section Bash History Builtins
|
||||
@cindex history builtins
|
||||
|
||||
Bash provides two builtin commands that allow you to manipulate the
|
||||
history list and history file.
|
||||
|
||||
@table @code
|
||||
|
||||
@item fc
|
||||
@btindex fc
|
||||
@example
|
||||
@code{fc [-e @var{ename}] [-nlr] [@var{first}] [@var{last}]}
|
||||
@code{fc -s [@var{pat}=@var{rep}] [@var{command}]}
|
||||
@end example
|
||||
|
||||
Fix Command. In the first form, a range of commands from @var{first} to
|
||||
@var{last} is selected from the history list. Both @var{first} and
|
||||
@var{last} may be specified as a string (to locate the most recent
|
||||
command beginning with that string) or as a number (an index into the
|
||||
history list, where a negative number is used as an offset from the
|
||||
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.
|
||||
|
||||
In the second form, @var{command} is re-executed after each instance
|
||||
of @var{pat} in the selected command is replaced by @var{rep}.
|
||||
|
||||
A useful alias to use with the @code{fc} command is @code{r='fc -s'}, so
|
||||
that typing @samp{r cc} runs the last command beginning with @code{cc}
|
||||
and typing @samp{r} re-executes the last command (@pxref{Aliases}).
|
||||
|
||||
@item history
|
||||
@btindex history
|
||||
@example
|
||||
history [-c] [@var{n}]
|
||||
history [-anrw] [@var{filename}]
|
||||
history -ps @var{arg}
|
||||
@end example
|
||||
|
||||
Display the history list with line numbers. Lines prefixed with
|
||||
with a @samp{*} have been modified. An argument of @var{n} says
|
||||
to list only the last @var{n} lines. Options, if supplied, have
|
||||
the following meanings:
|
||||
|
||||
@table @code
|
||||
@item -w
|
||||
Write out the current history to the history file.
|
||||
|
||||
@item -r
|
||||
Read the current history file and append its contents to
|
||||
the history list.
|
||||
|
||||
@item -a
|
||||
Append the new
|
||||
history lines (history lines entered since the beginning of the
|
||||
current Bash session) to the history file.
|
||||
|
||||
@item -n
|
||||
Append the history lines not already read from the history file
|
||||
to the current history list. These are lines appended to the history
|
||||
file since the beginning of the current Bash session.
|
||||
|
||||
@item -c
|
||||
Clear the history list. This may be combined
|
||||
with the other options to replace the history list completely.
|
||||
|
||||
@item -s
|
||||
The @var{arg}s are added to the end of
|
||||
the history list as a single entry.
|
||||
|
||||
@item -p
|
||||
Perform history substitution on the @var{arg}s and display the result
|
||||
on the standard output, without storing the results in the history list.
|
||||
@end table
|
||||
|
||||
When the @samp{-w}, @samp{-r}, @samp{-a}, or @samp{-n} option 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
|
||||
@end ifset
|
||||
|
||||
@node History Interaction
|
||||
@section History Interaction
|
||||
@cindex expansion
|
||||
@section History Expansion
|
||||
@cindex history expansion
|
||||
|
||||
The History library provides a history expansion feature that is similar
|
||||
to the history expansion in Csh. The following text describes the sytax
|
||||
that you use to manipulate the history information.
|
||||
to the history expansion provided by @code{csh}. This section
|
||||
describes the syntax used to manipulate the history information.
|
||||
|
||||
History expansions introduce words from the history list into
|
||||
the input stream, making it easy to repeat commands, insert the
|
||||
arguments to a previous command into the current input line, or
|
||||
fix errors in previous commands quickly.
|
||||
|
||||
History expansion takes place in two parts. The first is to determine
|
||||
which line from the previous history should be used during substitution.
|
||||
which line from the history list should be used during substitution.
|
||||
The second is to select portions of that line for inclusion into the
|
||||
current one. The line selected from the previous history is called the
|
||||
current one. The line selected from the history is called the
|
||||
@dfn{event}, and the portions of that line that are acted upon are
|
||||
called @dfn{words}. The line is broken into words in the same fashion
|
||||
that the Bash shell does, so that several English (or Unix) words
|
||||
surrounded by quotes are considered as one word.
|
||||
called @dfn{words}. Various @dfn{modifiers} are available to manipulate
|
||||
the selected words. The line is broken into words in the same fashion
|
||||
that Bash does, so that several words
|
||||
surrounded by quotes are considered one word.
|
||||
History expansions are introduced by the appearance of the
|
||||
history expansion character, which is @samp{!} by default.
|
||||
@ifset BashFeatures
|
||||
Only @samp{\} and @samp{'} may be used to escape the history expansion
|
||||
character.
|
||||
@end ifset
|
||||
|
||||
@ifset BashFeatures
|
||||
Several shell options settable with the @code{shopt}
|
||||
builtin (@pxref{Bash Builtins}) may be used to tailor
|
||||
the behavior of history expansion. If the
|
||||
@code{histverify} shell option is enabled, and Readline
|
||||
is being used, history substitutions are not immediately passed to
|
||||
the shell parser.
|
||||
Instead, the expanded line is reloaded into the Readline
|
||||
editing buffer for further modification.
|
||||
If Readline is being used, and the @code{histreedit}
|
||||
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.
|
||||
This is most useful in conjunction with Readline.
|
||||
|
||||
The shell allows control of the various characters used by the
|
||||
history expansion mechanism with the @code{histchars} variable.
|
||||
@end ifset
|
||||
|
||||
@menu
|
||||
* Event Designators:: How to specify which history line to use.
|
||||
* Word Designators:: Specifying which words are of interest.
|
||||
* Modifiers:: Modifying the results of susbstitution.
|
||||
* Modifiers:: Modifying the results of substitution.
|
||||
@end menu
|
||||
|
||||
@node Event Designators
|
||||
|
@ -64,90 +264,135 @@ surrounded by quotes are considered as one word.
|
|||
|
||||
An event designator is a reference to a command line entry in the
|
||||
history list.
|
||||
@cindex history events
|
||||
|
||||
@table @asis
|
||||
|
||||
@item @code{!}
|
||||
Start a history subsititution, except when followed by a space, tab, or
|
||||
the end of the line... @key{=} or @key{(}.
|
||||
Start a history substitution, except when followed by a space, tab,
|
||||
the end of the line, @samp{=} or @samp{(}.
|
||||
|
||||
@item @code{!!}
|
||||
Refer to the previous command. This is a synonym for @code{!-1}.
|
||||
|
||||
@item @code{!n}
|
||||
@item @code{!@var{n}}
|
||||
Refer to command line @var{n}.
|
||||
|
||||
@item @code{!-n}
|
||||
Refer to the command line @var{n} lines back.
|
||||
@item @code{!-@var{n}}
|
||||
Refer to the command @var{n} lines back.
|
||||
|
||||
@item @code{!string}
|
||||
@item @code{!!}
|
||||
Refer to the previous command. This is a synonym for @samp{!-1}.
|
||||
|
||||
@item @code{!@var{string}}
|
||||
Refer to the most recent command starting with @var{string}.
|
||||
|
||||
@item @code{!?string}[@code{?}]
|
||||
Refer to the most recent command containing @var{string}.
|
||||
@item @code{!?@var{string}[?]}
|
||||
Refer to the most recent command containing @var{string}. The trailing
|
||||
@samp{?} may be omitted if the @var{string} is followed immediately by
|
||||
a newline.
|
||||
|
||||
@item @code{^@var{string1}^@var{string2}^}
|
||||
Quick Substitution. Repeat the last command, replacing @var{string1}
|
||||
with @var{string2}. Equivalent to
|
||||
@code{!!:s/@var{string1}/@var{string2}/}.
|
||||
|
||||
@item @code{!#}
|
||||
The entire command line typed so far.
|
||||
|
||||
@end table
|
||||
|
||||
@node Word Designators
|
||||
@subsection Word Designators
|
||||
|
||||
A @key{:} separates the event specification from the word designator. It
|
||||
can be omitted if the word designator begins with a @key{^}, @key{$},
|
||||
@key{*} or @key{%}. Words are numbered from the beginning of the line,
|
||||
with the first word being denoted by a 0 (zero).
|
||||
Word designators are used to select desired words from the event.
|
||||
A @samp{:} separates the event specification from the word designator. It
|
||||
may be omitted if the word designator begins with a @samp{^}, @samp{$},
|
||||
@samp{*}, @samp{-}, or @samp{%}. Words are numbered from the beginning
|
||||
of the line, with the first word being denoted by 0 (zero). Words are
|
||||
inserted into the current line separated by single spaces.
|
||||
|
||||
@table @code
|
||||
|
||||
@item 0 (zero)
|
||||
The zero'th word. For many applications, this is the command word.
|
||||
The @code{0}th word. For many applications, this is the command word.
|
||||
|
||||
@item n
|
||||
The @var{n}'th word.
|
||||
@item @var{n}
|
||||
The @var{n}th word.
|
||||
|
||||
@item ^
|
||||
The first argument. that is, word 1.
|
||||
The first argument; that is, word 1.
|
||||
|
||||
@item $
|
||||
The last argument.
|
||||
|
||||
@item %
|
||||
The word matched by the most recent @code{?string?} search.
|
||||
The word matched by the most recent @samp{?@var{string}?} search.
|
||||
|
||||
@item x-y
|
||||
A range of words; @code{-@var{y}} Abbreviates @code{0-@var{y}}.
|
||||
@item @var{x}-@var{y}
|
||||
A range of words; @samp{-@var{y}} abbreviates @samp{0-@var{y}}.
|
||||
|
||||
@item *
|
||||
All of the words, excepting the zero'th. This is a synonym for @code{1-$}.
|
||||
It is not an error to use @key{*} if there is just one word in the event.
|
||||
The empty string is returned in that case.
|
||||
All of the words, except the @code{0}th. This is a synonym for @samp{1-$}.
|
||||
It is not an error to use @samp{*} if there is just one word in the event;
|
||||
the empty string is returned in that case.
|
||||
|
||||
@item @var{x}*
|
||||
Abbreviates @samp{@var{x}-$}
|
||||
|
||||
@item @var{x}-
|
||||
Abbreviates @samp{@var{x}-$} like @samp{@var{x}*}, but omits the last word.
|
||||
|
||||
@end table
|
||||
|
||||
If a word designator is supplied without an event specification, the
|
||||
previous command is used as the event.
|
||||
|
||||
@node Modifiers
|
||||
@subsection Modifiers
|
||||
|
||||
After the optional word designator, you can add a sequence of one or more
|
||||
of the following modifiers, each preceded by a @key{:}.
|
||||
of the following modifiers, each preceded by a @samp{:}.
|
||||
|
||||
@table @code
|
||||
|
||||
@item #
|
||||
The entire command line typed so far. This means the current command,
|
||||
not the previous command, so it really isn't a word designator, and doesn't
|
||||
belong in this section.
|
||||
|
||||
@item h
|
||||
Remove a trailing pathname component, leaving only the head.
|
||||
|
||||
@item r
|
||||
Remove a trailing suffix of the form @samp{.}@var{suffix}, leaving the basename.
|
||||
|
||||
@item e
|
||||
Remove all but the suffix.
|
||||
|
||||
@item t
|
||||
Remove all leading pathname components, leaving the tail.
|
||||
|
||||
@item r
|
||||
Remove a trailing suffix of the form @samp{.@var{suffix}}, leaving
|
||||
the basename.
|
||||
|
||||
@item e
|
||||
Remove all but the trailing suffix.
|
||||
|
||||
@item p
|
||||
Print the new command but do not execute it.
|
||||
|
||||
@ifset BashFeatures
|
||||
@item q
|
||||
Quote the substituted words, escaping further substitutions.
|
||||
|
||||
@item x
|
||||
Quote the substituted words as with @samp{q},
|
||||
but break into words at spaces, tabs, and newlines.
|
||||
@end ifset
|
||||
|
||||
@item s/@var{old}/@var{new}/
|
||||
Substitute @var{new} for the first occurrence of @var{old} in the
|
||||
event line. Any delimiter may be used in place of @samp{/}.
|
||||
The delimiter may be quoted in @var{old} and @var{new}
|
||||
with a single backslash. If @samp{&} appears in @var{new},
|
||||
it is replaced by @var{old}. A single backslash will quote
|
||||
the @samp{&}. The final delimiter is optional if it is the last
|
||||
character on the input line.
|
||||
|
||||
@item &
|
||||
Repeat the previous substitution.
|
||||
|
||||
@item g
|
||||
Cause changes to be applied over the entire event line. Used in
|
||||
conjunction with @samp{s}, as in @code{gs/@var{old}/@var{new}/},
|
||||
or with @samp{&}.
|
||||
|
||||
@end table
|
||||
|
|
1122
readline/doc/readline.0
Normal file
1122
readline/doc/readline.0
Normal file
File diff suppressed because it is too large
Load diff
BIN
readline/doc/readline.dvi
Normal file
BIN
readline/doc/readline.dvi
Normal file
Binary file not shown.
3482
readline/doc/readline.html
Normal file
3482
readline/doc/readline.html
Normal file
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
4946
readline/doc/readline.ps
Normal file
4946
readline/doc/readline.ps
Normal file
File diff suppressed because it is too large
Load diff
77
readline/doc/readline_toc.html
Normal file
77
readline/doc/readline_toc.html
Normal file
|
@ -0,0 +1,77 @@
|
|||
<HTML>
|
||||
<HEAD>
|
||||
<!-- This HTML file has been created by texi2html 1.51
|
||||
from /usr/homes/chet/src/bash/readline-2.2/doc/rlman.texinfo on 2 April 1998 -->
|
||||
|
||||
<TITLE>GNU Readline Library - Table of Contents</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<H1>GNU Readline Library</H1>
|
||||
<H2>Edition 2.2, for <CODE>Readline Library</CODE> Version 2.1.</H2>
|
||||
<H2>September 1997</H2>
|
||||
<ADDRESS>Brian Fox, Free Software Foundation</ADDRESS>
|
||||
<ADDRESS>Chet Ramey, Case Western Reserve University</ADDRESS>
|
||||
<P>
|
||||
<P><HR><P>
|
||||
<UL>
|
||||
<LI><A NAME="TOC1" HREF="readline.html#SEC1">Command Line Editing</A>
|
||||
<UL>
|
||||
<LI><A NAME="TOC2" HREF="readline.html#SEC2">Introduction to Line Editing</A>
|
||||
<LI><A NAME="TOC3" HREF="readline.html#SEC3">Readline Interaction</A>
|
||||
<UL>
|
||||
<LI><A NAME="TOC4" HREF="readline.html#SEC4">Readline Init File Syntax</A>
|
||||
<LI><A NAME="TOC5" HREF="readline.html#SEC5">Conditional Init Constructs</A>
|
||||
<LI><A NAME="TOC6" HREF="readline.html#SEC6">Sample Init File</A>
|
||||
</UL>
|
||||
<LI><A NAME="TOC7" HREF="readline.html#SEC7">Bindable Readline Commands</A>
|
||||
<UL>
|
||||
<LI><A NAME="TOC8" HREF="readline.html#SEC8">Commands For Moving</A>
|
||||
<LI><A NAME="TOC9" HREF="readline.html#SEC9">Commands For Manipulating The History</A>
|
||||
<LI><A NAME="TOC10" HREF="readline.html#SEC10">Commands For Changing Text</A>
|
||||
<LI><A NAME="TOC11" HREF="readline.html#SEC11">Killing And Yanking</A>
|
||||
<LI><A NAME="TOC12" HREF="readline.html#SEC12">Specifying Numeric Arguments</A>
|
||||
<LI><A NAME="TOC13" HREF="readline.html#SEC13">Letting Readline Type For You</A>
|
||||
<LI><A NAME="TOC14" HREF="readline.html#SEC14">Keyboard Macros</A>
|
||||
<LI><A NAME="TOC15" HREF="readline.html#SEC15">Some Miscellaneous Commands</A>
|
||||
</UL>
|
||||
<LI><A NAME="TOC16" HREF="readline.html#SEC16">Readline vi Mode</A>
|
||||
</UL>
|
||||
<LI><A NAME="TOC17" HREF="readline.html#SEC17">Programming with GNU Readline</A>
|
||||
<UL>
|
||||
<LI><A NAME="TOC18" HREF="readline.html#SEC18">Basic Behavior</A>
|
||||
<LI><A NAME="TOC19" HREF="readline.html#SEC19">Custom Functions</A>
|
||||
<UL>
|
||||
<LI><A NAME="TOC20" HREF="readline.html#SEC20">The Function Type</A>
|
||||
<LI><A NAME="TOC21" HREF="readline.html#SEC21">Writing a New Function</A>
|
||||
</UL>
|
||||
<LI><A NAME="TOC22" HREF="readline.html#SEC22">Readline Variables</A>
|
||||
<LI><A NAME="TOC23" HREF="readline.html#SEC23">Readline Convenience Functions</A>
|
||||
<UL>
|
||||
<LI><A NAME="TOC24" HREF="readline.html#SEC24">Naming a Function</A>
|
||||
<LI><A NAME="TOC25" HREF="readline.html#SEC25">Selecting a Keymap</A>
|
||||
<LI><A NAME="TOC26" HREF="readline.html#SEC26">Binding Keys</A>
|
||||
<LI><A NAME="TOC27" HREF="readline.html#SEC27">Associating Function Names and Bindings</A>
|
||||
<LI><A NAME="TOC28" HREF="readline.html#SEC28">Allowing Undoing</A>
|
||||
<LI><A NAME="TOC29" HREF="readline.html#SEC29">Redisplay</A>
|
||||
<LI><A NAME="TOC30" HREF="readline.html#SEC30">Modifying Text</A>
|
||||
<LI><A NAME="TOC31" HREF="readline.html#SEC31">Utility Functions</A>
|
||||
<LI><A NAME="TOC32" HREF="readline.html#SEC32">Alternate Interface</A>
|
||||
<LI><A NAME="TOC33" HREF="readline.html#SEC33">An Example</A>
|
||||
</UL>
|
||||
<LI><A NAME="TOC34" HREF="readline.html#SEC34">Custom Completers</A>
|
||||
<UL>
|
||||
<LI><A NAME="TOC35" HREF="readline.html#SEC35">How Completing Works</A>
|
||||
<LI><A NAME="TOC36" HREF="readline.html#SEC36">Completion Functions</A>
|
||||
<LI><A NAME="TOC37" HREF="readline.html#SEC37">Completion Variables</A>
|
||||
<LI><A NAME="TOC38" HREF="readline.html#SEC38">A Short Completion Example</A>
|
||||
</UL>
|
||||
</UL>
|
||||
<LI><A NAME="TOC39" HREF="readline.html#SEC39">Concept Index</A>
|
||||
<LI><A NAME="TOC40" HREF="readline.html#SEC40">Function and Variable Index</A>
|
||||
</UL>
|
||||
<P><HR><P>
|
||||
This document was generated on 2 April 1998 using the
|
||||
<A HREF="http://wwwcn.cern.ch/dci/texi2html/">texi2html</A>
|
||||
translator version 1.51.</P>
|
||||
</BODY>
|
||||
</HTML>
|
|
@ -6,12 +6,26 @@
|
|||
@synindex vr fn
|
||||
@setchapternewpage odd
|
||||
|
||||
@ignore
|
||||
last change: Thu Apr 2 14:39:03 EST 1998
|
||||
@end ignore
|
||||
|
||||
@set EDITION 2.2
|
||||
@set VERSION 2.2
|
||||
@set UPDATED 2 April 1998
|
||||
@set UPDATE-MONTH April 1998
|
||||
|
||||
@dircategory Libraries
|
||||
@direntry
|
||||
* Readline: (readline). The GNU readline library API
|
||||
@end direntry
|
||||
|
||||
@ifinfo
|
||||
This document describes the GNU Readline Library, a utility which aids
|
||||
in the consistency of user interface across discrete programs that need
|
||||
to provide a command line interface.
|
||||
|
||||
Copyright (C) 1988, 1991 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988, 1991, 1993, 1996, 1998 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
|
@ -35,13 +49,12 @@ except that this permission notice may be stated in a translation approved
|
|||
by the Foundation.
|
||||
@end ifinfo
|
||||
|
||||
@titlepage
|
||||
@sp 10
|
||||
@center @titlefont{GNU Readline Library}
|
||||
@center Brian Fox
|
||||
@center Free Software Foundation
|
||||
@center Version 1.1
|
||||
@center April 1991
|
||||
@titlepage
|
||||
@title GNU Readline Library
|
||||
@subtitle Edition @value{EDITION}, for @code{Readline Library} Version @value{VERSION}.
|
||||
@subtitle @value{UPDATE-MONTH}
|
||||
@author Brian Fox, Free Software Foundation
|
||||
@author Chet Ramey, Case Western Reserve University
|
||||
|
||||
@page
|
||||
This document describes the GNU Readline Library, a utility which aids
|
||||
|
@ -100,4 +113,3 @@ to provide a command line interface.
|
|||
|
||||
@contents
|
||||
@bye
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue