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