diff options
author | ache <ache@FreeBSD.org> | 1999-05-28 01:59:23 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1999-05-28 01:59:23 +0000 |
commit | 2fbece35f71145c1c63d12046e54a9c059114d69 (patch) | |
tree | b727625e73f35f475e06719785a6f7a2d5126754 /contrib/libreadline/history.h | |
parent | 27ef633cd3f7fd5fb6cb033edd2c1747a6e59acb (diff) | |
download | FreeBSD-src-2fbece35f71145c1c63d12046e54a9c059114d69.zip FreeBSD-src-2fbece35f71145c1c63d12046e54a9c059114d69.tar.gz |
readline v4.0
Diffstat (limited to 'contrib/libreadline/history.h')
-rw-r--r-- | contrib/libreadline/history.h | 91 |
1 files changed, 58 insertions, 33 deletions
diff --git a/contrib/libreadline/history.h b/contrib/libreadline/history.h index e49a341..8ecce72 100644 --- a/contrib/libreadline/history.h +++ b/contrib/libreadline/history.h @@ -22,6 +22,16 @@ #ifndef _HISTORY_H_ #define _HISTORY_H_ +#ifdef __cplusplus +extern "C" { +#endif + +#if defined READLINE_LIBRARY +# include "rlstdc.h" +#else +# include <readline/rlstdc.h> +#endif + #if !defined (_FUNCTION_DEF) # define _FUNCTION_DEF typedef int Function (); @@ -30,10 +40,16 @@ typedef char *CPFunction (); typedef char **CPPFunction (); #endif +#ifdef __STDC__ +typedef void *histdata_t; +#else +typedef char *histdata_t; +#endif + /* The structure used to store a history entry. */ typedef struct _hist_entry { char *line; - char *data; + histdata_t data; } HIST_ENTRY; /* A structure used to pass the current state of the history stuff around. */ @@ -52,81 +68,81 @@ typedef struct _hist_state { /* Begin a session in which the history functions might be used. This just initializes the interactive variables. */ -extern void using_history (); +extern void using_history __P((void)); /* Return the current HISTORY_STATE of the history. */ -extern HISTORY_STATE *history_get_history_state (); +extern HISTORY_STATE *history_get_history_state __P((void)); /* Set the state of the current history array to STATE. */ -extern void history_set_history_state (); +extern void history_set_history_state __P((HISTORY_STATE *)); /* Manage the history list. */ /* Place STRING at the end of the history list. The associated data field (if any) is set to NULL. */ -extern void add_history (); +extern void add_history __P((char *)); /* A reasonably useless function, only here for completeness. WHICH is the magic number that tells us which element to delete. The elements are numbered from 0. */ -extern HIST_ENTRY *remove_history (); +extern HIST_ENTRY *remove_history __P((int)); /* Make the history entry at WHICH have LINE and DATA. This returns the old entry so you can dispose of the data. In the case of an invalid WHICH, a NULL pointer is returned. */ -extern HIST_ENTRY *replace_history_entry (); +extern HIST_ENTRY *replace_history_entry __P((int, char *, histdata_t)); /* Clear the history list and start over. */ -extern void clear_history (); +extern void clear_history __P((void)); /* Stifle the history list, remembering only MAX number of entries. */ -extern void stifle_history (); +extern void stifle_history __P((int)); /* Stop stifling the history. This returns the previous amount the history was stifled by. The value is positive if the history was stifled, negative if it wasn't. */ -extern int unstifle_history (); +extern int unstifle_history __P((void)); /* Return 1 if the history is stifled, 0 if it is not. */ -extern int history_is_stifled (); +extern int history_is_stifled __P((void)); /* Information about the history list. */ /* Return a NULL terminated array of HIST_ENTRY which is the current input history. Element 0 of this list is the beginning of time. If there is no history, return NULL. */ -extern HIST_ENTRY **history_list (); +extern HIST_ENTRY **history_list __P((void)); /* Returns the number which says what history element we are now looking at. */ -extern int where_history (); +extern int where_history __P((void)); /* Return the history entry at the current position, as determined by history_offset. If there is no entry there, return a NULL pointer. */ -HIST_ENTRY *current_history (); +HIST_ENTRY *current_history __P((void)); /* Return the history entry which is logically at OFFSET in the history array. OFFSET is relative to history_base. */ -extern HIST_ENTRY *history_get (); +extern HIST_ENTRY *history_get __P((int)); /* Return the number of bytes that the primary history entries are using. This just adds up the lengths of the_history->lines. */ -extern int history_total_bytes (); +extern int history_total_bytes __P((void)); /* Moving around the history list. */ /* Set the position in the history list to POS. */ -int history_set_pos (); +int history_set_pos __P((int)); /* Back up history_offset to the previous history entry, and return a pointer to that entry. If there is no previous entry, return a NULL pointer. */ -extern HIST_ENTRY *previous_history (); +extern HIST_ENTRY *previous_history __P((void)); /* Move history_offset forward to the next item in the input_history, and return the a pointer to that entry. If there is no next entry, return a NULL pointer. */ -extern HIST_ENTRY *next_history (); +extern HIST_ENTRY *next_history __P((void)); /* Searching the history list. */ @@ -136,44 +152,45 @@ extern HIST_ENTRY *next_history (); current_history () is the history entry, and the value of this function is the offset in the line of that history entry that the string was found in. Otherwise, nothing is changed, and a -1 is returned. */ -extern int history_search (); +extern int history_search __P((char *, int)); /* Search the history for STRING, starting at history_offset. - The search is anchored: matching lines must begin with string. */ -extern int history_search_prefix (); + The search is anchored: matching lines must begin with string. + DIRECTION is as in history_search(). */ +extern int history_search_prefix __P((char *, int)); /* Search for STRING in the history list, starting at POS, an absolute index into the list. DIR, if negative, says to search backwards from POS, else forwards. Returns the absolute index of the history element where STRING was found, or -1 otherwise. */ -extern int history_search_pos (); +extern int history_search_pos __P((char *, int, int)); /* Managing the history file. */ /* 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. */ -extern int read_history (); +extern int read_history __P((char *)); /* Read a range of lines from FILENAME, adding them to the history list. Start reading at the FROM'th line and end at the TO'th. If FROM is zero, start at the beginning. If TO is less than FROM, read until the end of the file. If FILENAME is NULL, then read from ~/.history. Returns 0 if successful, or errno if not. */ -extern int read_history_range (); +extern int read_history_range __P((char *, int, int)); /* Write the current history to FILENAME. If FILENAME is NULL, then write the history list to ~/.history. Values returned are as in read_history (). */ -extern int write_history (); +extern int write_history __P((char *)); /* Append NELEMENT entries to FILENAME. The entries appended are from the end of the list minus NELEMENTs up to the end of the list. */ -int append_history (); +int append_history __P((int, char *)); /* Truncate the history file, leaving only the last NLINES lines. */ -extern int history_truncate_file (); +extern int history_truncate_file __P((char *, int)); /* History expansion. */ @@ -189,20 +206,24 @@ extern int history_truncate_file (); If an error ocurred in expansion, then OUTPUT contains a descriptive error message. */ -extern int history_expand (); +extern int history_expand __P((char *, char **)); /* Extract a string segment consisting of the FIRST through LAST arguments present in STRING. Arguments are broken up as in the shell. */ -extern char *history_arg_extract (); +extern char *history_arg_extract __P((int, int, char *)); /* Return the text of the history event beginning at the current - offset into STRING. */ -extern char *get_history_event (); + offset into STRING. Pass STRING with *INDEX equal to the + history_expansion_char that begins this specification. + DELIMITING_QUOTE is a character that is allowed to end the string + specification for what to search for in addition to the normal + characters `:', ` ', `\t', `\n', and sometimes `?'. */ +extern char *get_history_event __P((char *, int *, int)); /* Return an array of tokens, much as the shell might. The tokens are parsed out of STRING. */ -extern char **history_tokenize (); +extern char **history_tokenize __P((char *)); /* Exported history variables. */ extern int history_base; @@ -220,4 +241,8 @@ extern int history_quotes_inhibit_expansion; application and not expanded. */ extern Function *history_inhibit_expansion_function; +#ifdef __cplusplus +} +#endif + #endif /* !_HISTORY_H_ */ |