GNU History Library. Node: Managing the History File
Searching the History List
History Functions
History Expansion
2.3.6: 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.
Searching the History List
History Functions
History Expansion