/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 1982-2011 AT&T Intellectual Property *4* and is licensed under the *5* Eclipse Public License, Version 1.0 *6* by AT&T Intellectual Property *7* *8* A copy of the License is available at *9* http://www.eclipse.org/org/documents/epl-v10.html *10* (with md5 checksum b35adb5213ca9657e911e9befb180842) *11* *12* Information and Software Systems Research *13* AT&T Research *14* Florham Park NJ *15* *16* David Korn <[email protected]> *17* *18***********************************************************************/19#pragma prototyped20#ifndef HIST_VERSION21/*22* Interface for history mechanism23* written by David Korn24*25*/2627#include <ast.h>2829#define HIST_CHAR '!'30#define HIST_VERSION 1 /* history file format version no. */3132typedef struct33{34Sfdisc_t histdisc; /* discipline for history */35Sfio_t *histfp; /* history file stream pointer */36char *histname; /* name of history file */37int32_t histind; /* current command number index */38int histsize; /* number of accessible history lines */39#ifdef _HIST_PRIVATE40_HIST_PRIVATE41#endif /* _HIST_PRIVATE */42} History_t;4344typedef struct45{46int hist_command;47int hist_line;48int hist_char;49} Histloc_t;5051/* the following are readonly */52extern const char hist_fname[];5354extern int _Hist;55#define hist_min(hp) ((_Hist=((int)((hp)->histind-(hp)->histsize)))>=0?_Hist:0)56#define hist_max(hp) ((int)((hp)->histind))57/* these are the history interface routines */58extern int sh_histinit(void *);59extern void hist_cancel(History_t*);60extern void hist_close(History_t*);61extern int hist_copy(char*, int, int, int);62extern void hist_eof(History_t*);63extern Histloc_t hist_find(History_t*,char*,int, int, int);64extern void hist_flush(History_t*);65extern void hist_list(History_t*,Sfio_t*, off_t, int, char*);66extern int hist_match(History_t*,off_t, char*, int*);67extern off_t hist_tell(History_t*,int);68extern off_t hist_seek(History_t*,int);69extern char *hist_word(char*, int, int);70#if SHOPT_ESH71extern Histloc_t hist_locate(History_t*,int, int, int);72#endif /* SHOPT_ESH */7374#endif /* HIST_VERSION */757677