TheGNUGeneralPublicLicenseisoftenshippedwithGNUsoftware,and isgenerallykeptinafilecalledCOPYINGorLICENSE.Ifyoudonot haveacopyofthelicense,writetotheFreeSoftwareFoundation,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA. */
#ifndef _HISTORY_H_ #define _HISTORY_H_
#ifdef __cplusplus extern"C" { #endif
#include <time.h> /* XXX - for history timestamp code */
#ifdefined READLINE_LIBRARY # include "rlstdc.h" # include "rltypedefs.h" #else # include <rlstdc.h> # include <rltypedefs.h> #endif
/* The structure used to store a history entry. */ typedefstruct _hist_entry { char *line; char *timestamp; /* char * rather than time_t for read/write */
histdata_t data;
} HIST_ENTRY;
/* Size of the history-library-managed space in history entry HS. */ #define HISTENT_BYTES(hs) (strlen ((hs)->line) + strlen ((hs)->timestamp))
/* A structure used to pass the current state of the history stuff around. */ typedefstruct _hist_state {
HIST_ENTRY **entries; /* Pointer to the entries themselves. */ int offset; /* The location pointer within this array. */ int length; /* Number of elements within this array. */ int size; /* Number of slots allocated to this array. */ int flags;
} HISTORY_STATE;
/* Flag values for the `flags' member of HISTORY_STATE. */ #define HS_STIFLED 0x01
/* Initialization and state management. */
/* Begin a session in which the history functions might be used. This
just initializes the interactive variables. */ externvoid using_history PARAMS((void));
/* Return the current HISTORY_STATE of the history. */ extern HISTORY_STATE *history_get_history_state PARAMS((void));
/* Set the state of the current history array to STATE. */ externvoid history_set_history_state PARAMS((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. */ externvoid add_history PARAMS((constchar *));
/* Change the timestamp associated with the most recent history entry to
STRING. */ externvoid add_history_time PARAMS((constchar *));
/* A reasonably useless function, only here for completeness. WHICH isthemagicnumberthattellsuswhichelementtodelete.The
elements are numbered from 0. */ extern HIST_ENTRY *remove_history PARAMS((int));
/* Free the history entry H and return any application-specific data
associated with it. */ extern histdata_t free_history_entry PARAMS((HIST_ENTRY *));
/* Make the history entry at WHICH have LINE and DATA. This returns theoldentrysoyoucandisposeofthedata.Inthecaseofan
invalid WHICH, a NULL pointer is returned. */ extern HIST_ENTRY *replace_history_entry PARAMS((int, constchar *, histdata_t));
/* Clear the history list and start over. */ externvoid clear_history PARAMS((void));
/* Stifle the history list, remembering only MAX number of entries. */ externvoid stifle_history PARAMS((int));
/* Stop stifling the history. This returns the previous amount the historywasstifledby.Thevalueispositiveifthehistorywas
stifled, negative if it wasn't. */ externint unstifle_history PARAMS((void));
/* Return 1 if the history is stifled, 0 if it is not. */ externint history_is_stifled PARAMS((void));
/* Information about the history list. */
/* Return a NULL terminated array of HIST_ENTRY which is the current input history.Element0ofthislististhebeginningoftime.Ifthere
is no history, return NULL. */ extern HIST_ENTRY **history_list PARAMS((void));
/* Returns the number which says what history element we are now
looking at. */ externint where_history PARAMS((void));
/* Return the history entry at the current position, as determined by
history_offset. If there is no entry there, return a NULL pointer. */ extern HIST_ENTRY *current_history PARAMS((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 PARAMS((int));
/* Return the timestamp associated with the HIST_ENTRY * passed as an
argument */ extern time_t history_get_time PARAMS((HIST_ENTRY *));
/* Return the number of bytes that the primary history entries are using.
This just adds up the lengths of the_history->lines. */ externint history_total_bytes PARAMS((void));
/* Moving around the history list. */
/* Set the position in the history list to POS. */ externint history_set_pos PARAMS((int));
/* Back up history_offset to the previous history entry, and return apointertothatentry.Ifthereisnopreviousentry,return
a NULL pointer. */ extern HIST_ENTRY *previous_history PARAMS((void));
/* Move history_offset forward to the next item in the input_history, andreturntheapointertothatentry.Ifthereisnonextentry,
return a NULL pointer. */ extern HIST_ENTRY *next_history PARAMS((void));
/* Searching the history list. */
/* Search the history for STRING, starting at history_offset. IfDIRECTION<0,thenthesearchisthroughpreviousentries, elsethroughsubsequent.Ifthestringisfound,then current_history()isthehistoryentry,andthevalueofthisfunction istheoffsetinthelineofthathistoryentrythatthestringwas
found in. Otherwise, nothing is changed, and a -1 is returned. */ externint history_search PARAMS((constchar *, int));
/* Search the history for STRING, starting at history_offset. Thesearchisanchored:matchinglinesmustbeginwithstring.
DIRECTION is as in history_search(). */ externint history_search_prefix PARAMS((constchar *, int));
/* Search for STRING in the history list, starting at POS, an absoluteindexintothelist.DIR,ifnegative,saystosearch backwardsfromPOS,elseforwards. ReturnstheabsoluteindexofthehistoryelementwhereSTRING
was found, or -1 otherwise. */ externint history_search_pos PARAMS((constchar *, int, int));
/* Managing the history file. */
/* Add the contents of FILENAME to the history list, a line at a time. IfFILENAMEisNULL,thenreadfrom~/.history.Returns0if
successful, or errno if not. */ externint read_history PARAMS((constchar *));
/* Read a range of lines from FILENAME, adding them to the history list. StartreadingattheFROM'thlineandendattheTO'th.IfFROM iszero,startatthebeginning.IfTOislessthanFROM,read untiltheendofthefile.IfFILENAMEisNULL,thenreadfrom
~/.history. Returns 0 if successful, or errno if not. */ externint read_history_range PARAMS((constchar *, int, int));
/* Write the current history to FILENAME. If FILENAME is NULL, thenwritethehistorylistto~/.history.Valuesreturned
are as in read_history (). */ externint write_history PARAMS((constchar *));
/* Append NELEMENT entries to FILENAME. The entries appended are from
the end of the list minus NELEMENTs up to the end of the list. */ externint append_history PARAMS((int, constchar *));
/* Truncate the history file, leaving only the last NLINES lines. */ externint history_truncate_file PARAMS((constchar *, int));
/* History expansion. */
/* Expand the string STRING, placing the result into OUTPUT, a pointer toastring.Returns:
/* Extract a string segment consisting of the FIRST through LAST argumentspresentinSTRING.Argumentsarebrokenupasin
the shell. */ externchar *history_arg_extract PARAMS((int, int, constchar *));
/* Return the text of the history event beginning at the current offsetintoSTRING.PassSTRINGwith*INDEXequaltothe history_expansion_charthatbeginsthisspecification. DELIMITING_QUOTEisacharacterthatisallowedtoendthestring specificationforwhattosearchforinadditiontothenormal
characters `:', ` ', `\t', `\n', and sometimes `?'. */ externchar *get_history_event PARAMS((constchar *, int *, int));
/* Return an array of tokens, much as the shell might. The tokens are
parsed out of STRING. */ externchar **history_tokenize PARAMS((constchar *));
/* If set, this function is called to decide whether or not a particular historyexpansionshouldbetreatedasaspecialcaseforthecalling
application and not expanded. */ extern rl_linebuf_func_t *history_inhibit_expansion_function;
#ifdef __cplusplus
} #endif
#endif/* !_HISTORY_H_ */
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.15 Sekunden
(vorverarbeitet am 2026-10-08)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.