1 /* 2 * BEGIN illumos section 3 * This is an unstable interface; changes may be made 4 * without notice. 5 * END illumos section 6 */ 7 /*********************************************************************** 8 * * 9 * This software is part of the ast package * 10 * Copyright (c) 1982-2011 AT&T Intellectual Property * 11 * and is licensed under the * 12 * Eclipse Public License, Version 1.0 * 13 * by AT&T Intellectual Property * 14 * * 15 * A copy of the License is available at * 16 * http://www.eclipse.org/org/documents/epl-v10.html * 17 * (with md5 checksum b35adb5213ca9657e911e9befb180842) * 18 * * 19 * Information and Software Systems Research * 20 * AT&T Research * 21 * Florham Park NJ * 22 * * 23 * David Korn <dgk@research.att.com> * 24 * * 25 ***********************************************************************/ 26 #pragma prototyped 27 #ifndef HIST_VERSION 28 /* 29 * Interface for history mechanism 30 * written by David Korn 31 * 32 */ 33 34 #include <ast.h> 35 36 #define HIST_CHAR '!' 37 #define HIST_VERSION 1 /* history file format version no. */ 38 39 typedef struct 40 { 41 Sfdisc_t histdisc; /* discipline for history */ 42 Sfio_t *histfp; /* history file stream pointer */ 43 char *histname; /* name of history file */ 44 int32_t histind; /* current command number index */ 45 int histsize; /* number of accessible history lines */ 46 #ifdef _HIST_PRIVATE 47 _HIST_PRIVATE 48 #endif /* _HIST_PRIVATE */ 49 } History_t; 50 51 typedef struct 52 { 53 int hist_command; 54 int hist_line; 55 int hist_char; 56 } Histloc_t; 57 58 /* the following are readonly */ 59 extern const char hist_fname[]; 60 61 extern int _Hist; 62 #define hist_min(hp) ((_Hist=((int)((hp)->histind-(hp)->histsize)))>=0?_Hist:0) 63 #define hist_max(hp) ((int)((hp)->histind)) 64 /* these are the history interface routines */ 65 extern int sh_histinit(void *); 66 extern void hist_cancel(History_t*); 67 extern void hist_close(History_t*); 68 extern int hist_copy(char*, int, int, int); 69 extern void hist_eof(History_t*); 70 extern Histloc_t hist_find(History_t*,char*,int, int, int); 71 extern void hist_flush(History_t*); 72 extern void hist_list(History_t*,Sfio_t*, off_t, int, char*); 73 extern int hist_match(History_t*,off_t, char*, int*); 74 extern off_t hist_tell(History_t*,int); 75 extern off_t hist_seek(History_t*,int); 76 extern char *hist_word(char*, int, int); 77 #if SHOPT_ESH 78 extern Histloc_t hist_locate(History_t*,int, int, int); 79 #endif /* SHOPT_ESH */ 80 81 #endif /* HIST_VERSION */ 82