GNU Info

Info Node: (history.info)Searching the History List

(history.info)Searching the History List


Next: Managing the History File Prev: Moving Around the History List Up: History Functions
Enter node , (file) or (file)node

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 (const char *string, int direction)
     Search the history for STRING, starting at the current history
     offset.  If DIRECTION is less than 0, then the search is through
     previous entries, otherwise through subsequent entries.  If STRING
     is found, then the current history index is set to that history
     entry, and the value returned is the offset in the line of the
     entry where STRING was found.  Otherwise, nothing is changed, and
     a -1 is returned.

 - Function: int history_search_prefix (const char *string, int
          direction)
     Search the history for STRING, starting at the current history
     offset.  The search is anchored: matching lines must begin with
     STRING.  If DIRECTION is less than 0, then the search is through
     previous entries, otherwise through subsequent entries.  If STRING
     is found, then the current history index is set to that entry, and
     the return value is 0.  Otherwise, nothing is changed, and a -1 is
     returned.

 - Function: int history_search_pos (const char *string, int direction,
          int pos)
     Search for STRING in the history list, starting at POS, an
     absolute index into the list.  If DIRECTION is negative, the search
     proceeds backward from POS, otherwise forward.  Returns the
     absolute index of the history element where STRING was found, or
     -1 otherwise.


automatically generated by info2www version 1.2.2.9