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: intread_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: intread_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: intwrite_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 ().