history: History Expansion

1 
1 2.3.7 History Expansion
1 -----------------------
1 
1 These functions implement history expansion.
1 
1  -- Function: int history_expand (char *string, char **output)
1      Expand STRING, placing the result into OUTPUT, a pointer to a
1      string (⇒History Interaction).  Returns:
1      '0'
1           If no expansions took place (or, if the only change in the
1           text was the removal of escape characters preceding the
1           history expansion character);
1      '1'
1           if expansions did take place;
1      '-1'
1           if there was an error in expansion;
1      '2'
1           if the returned line should be displayed, but not executed, as
1           with the ':p' modifier (⇒Modifiers).
1 
1      If an error occurred in expansion, then OUTPUT contains a
1      descriptive error message.
1 
1  -- Function: char * get_history_event (const char *string, int *cindex,
1           int qchar)
1      Returns the text of the history event beginning at STRING +
1      *CINDEX.  *CINDEX is modified to point to after the event
1      specifier.  At function entry, CINDEX points to the index into
1      STRING where the history event specification begins.  QCHAR is a
1      character that is allowed to end the event specification in
1      addition to the "normal" terminating characters.
1 
1  -- Function: char ** history_tokenize (const char *string)
1      Return an array of tokens parsed out of STRING, much as the shell
1      might.  The tokens are split on the characters in the
1      HISTORY_WORD_DELIMITERS variable, and shell quoting conventions are
1      obeyed.
1 
1  -- Function: char * history_arg_extract (int first, int last, const
1           char *string)
1      Extract a string segment consisting of the FIRST through LAST
1      arguments present in STRING.  Arguments are split using
1      'history_tokenize'.
1