xref: /onnv-gate/usr/src/lib/libshell/amd64/include/ast/history.h (revision 12068:08a39a083754)
14887Schin 
24887Schin /* : : generated by proto : : */
34887Schin /***********************************************************************
44887Schin *                                                                      *
54887Schin *               This software is part of the ast package               *
6*12068SRoger.Faulkner@Oracle.COM *          Copyright (c) 1982-2010 AT&T Intellectual Property          *
74887Schin *                      and is licensed under the                       *
84887Schin *                  Common Public License, Version 1.0                  *
98462SApril.Chin@Sun.COM *                    by AT&T Intellectual Property                     *
104887Schin *                                                                      *
114887Schin *                A copy of the License is available at                 *
124887Schin *            http://www.opensource.org/licenses/cpl1.0.txt             *
134887Schin *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
144887Schin *                                                                      *
154887Schin *              Information and Software Systems Research               *
164887Schin *                            AT&T Research                             *
174887Schin *                           Florham Park NJ                            *
184887Schin *                                                                      *
194887Schin *                  David Korn <dgk@research.att.com>                   *
204887Schin *                                                                      *
214887Schin ***********************************************************************/
224887Schin 
234887Schin #ifndef HIST_VERSION
244887Schin #if !defined(__PROTO__)
254887Schin #include <prototyped.h>
264887Schin #endif
274887Schin #if !defined(__LINKAGE__)
284887Schin #define __LINKAGE__		/* 2004-08-11 transition */
294887Schin #endif
304887Schin 
314887Schin /*
324887Schin  *	Interface for history mechanism
334887Schin  *	written by David Korn
344887Schin  *
354887Schin  */
364887Schin 
374887Schin #include	<ast.h>
384887Schin 
394887Schin #define HIST_CHAR	'!'
404887Schin #define HIST_VERSION	1		/* history file format version no. */
414887Schin 
424887Schin typedef struct
434887Schin {
444887Schin 	Sfdisc_t	histdisc;	/* discipline for history */
454887Schin 	Sfio_t		*histfp;	/* history file stream pointer */
464887Schin 	char		*histname;	/* name of history file */
474887Schin 	int32_t		histind;	/* current command number index */
484887Schin 	int		histsize;	/* number of accessible history lines */
494887Schin #ifdef _HIST_PRIVATE
504887Schin 	_HIST_PRIVATE
514887Schin #endif /* _HIST_PRIVATE */
524887Schin } History_t;
534887Schin 
544887Schin typedef struct
554887Schin {
564887Schin 	int hist_command;
574887Schin 	int hist_line;
584887Schin 	int hist_char;
594887Schin } Histloc_t;
604887Schin 
614887Schin /* the following are readonly */
624887Schin extern __MANGLE__ const char	hist_fname[];
634887Schin 
644887Schin extern __MANGLE__ int _Hist;
654887Schin #define	hist_min(hp)	((_Hist=((int)((hp)->histind-(hp)->histsize)))>=0?_Hist:0)
664887Schin #define	hist_max(hp)	((int)((hp)->histind))
674887Schin /* these are the history interface routines */
688462SApril.Chin@Sun.COM extern __MANGLE__ int		sh_histinit __PROTO__((__V_ *));
694887Schin extern __MANGLE__ void 		hist_cancel __PROTO__((History_t*));
704887Schin extern __MANGLE__ void 		hist_close __PROTO__((History_t*));
714887Schin extern __MANGLE__ int		hist_copy __PROTO__((char*, int, int, int));
724887Schin extern __MANGLE__ void 		hist_eof __PROTO__((History_t*));
734887Schin extern __MANGLE__ Histloc_t	hist_find __PROTO__((History_t*,char*,int, int, int));
744887Schin extern __MANGLE__ void 		hist_flush __PROTO__((History_t*));
754887Schin extern __MANGLE__ void 		hist_list __PROTO__((History_t*,Sfio_t*, off_t, int, char*));
764887Schin extern __MANGLE__ int		hist_match __PROTO__((History_t*,off_t, char*, int*));
774887Schin extern __MANGLE__ off_t		hist_tell __PROTO__((History_t*,int));
784887Schin extern __MANGLE__ off_t		hist_seek __PROTO__((History_t*,int));
794887Schin extern __MANGLE__ char 		*hist_word __PROTO__((char*, int, int));
804887Schin #if SHOPT_ESH
814887Schin     extern __MANGLE__ Histloc_t	hist_locate __PROTO__((History_t*,int, int, int));
824887Schin #endif	/* SHOPT_ESH */
834887Schin 
844887Schin #endif /* HIST_VERSION */
85