GNU Info

Info Node: (history.info)History Expansion

(history.info)History Expansion


Prev: Managing the History File Up: History Functions
Enter node , (file) or (file)node

History Expansion
-----------------

   These functions implement history expansion.

 - Function: int history_expand (char *string, char **output)
     Expand STRING, placing the result into OUTPUT, a pointer to a
     string (Note: History Interaction).  Returns:
    `0'
          If no expansions took place (or, if the only change in the
          text was the removal of escape characters preceding the
          history expansion character);

    `1'
          if expansions did take place;

    `-1'
          if there was an error in expansion;

    `2'
          if the returned line should be displayed, but not executed,
          as with the `:p' modifier (Note: Modifiers).

     If an error ocurred in expansion, then OUTPUT contains a
     descriptive error message.

 - Function: char * get_history_event (const char *string, int *cindex,
          int qchar)
     Returns the text of the history event beginning at STRING +
     *CINDEX.  *CINDEX is modified to point to after the event
     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 (const char *string)
     Return an array of tokens parsed out of STRING, much as the shell
     might.  The tokens are split on the characters in the
     HISTORY_WORD_DELIMITERS variable, and shell quoting conventions
     are obeyed.

 - Function: char * history_arg_extract (int first, int last, const
          char *string)
     Extract a string segment consisting of the FIRST through LAST
     arguments present in STRING.  Arguments are split using
     `history_tokenize'.


automatically generated by info2www version 1.2.2.9