xref: /csrg-svn/local/toolchest/ksh/sh/history.h (revision 35145)
1*35145Smarc /*
2*35145Smarc 
3*35145Smarc  *      Copyright (c) 1984, 1985, 1986 AT&T
4*35145Smarc  *      All Rights Reserved
5*35145Smarc 
6*35145Smarc  *      THIS IS UNPUBLISHED PROPRIETARY SOURCE
7*35145Smarc  *      CODE OF AT&T.
8*35145Smarc  *      The copyright notice above does not
9*35145Smarc  *      evidence any actual or intended
10*35145Smarc  *      publication of such source code.
11*35145Smarc 
12*35145Smarc  */
13*35145Smarc /* @(#)history.h	1.1 */
14*35145Smarc 
15*35145Smarc /*
16*35145Smarc  *	UNIX shell
17*35145Smarc  *	Header File for history mechanism
18*35145Smarc  *	written by David Korn
19*35145Smarc  *
20*35145Smarc  */
21*35145Smarc 
22*35145Smarc 
23*35145Smarc 
24*35145Smarc /* structure for fix command files */
25*35145Smarc 
26*35145Smarc #define HIS_DFLT	128		/* default size of history list */
27*35145Smarc #define HISMAX		(sizeof(int)*BUFSIZ)
28*35145Smarc #define HISBIG		(0100000-1024)	/* 1K less than maximum short */
29*35145Smarc #define HISLINE		16		/* estimate of average sized history line */
30*35145Smarc #define MAXLINE		258		/* longest history line permitted */
31*35145Smarc 
32*35145Smarc #define H_UNDO		0201		/* invalidate previous command */
33*35145Smarc #define H_CMDNO		0202		/* next 3 bytes give command number */
34*35145Smarc #define H_VERSION	1		/* history file format version no. */
35*35145Smarc 
36*35145Smarc struct fixcmd
37*35145Smarc {
38*35145Smarc 	FILE	*fixfd;			/* file descriptor for history file */
39*35145Smarc 	int	fixind;			/* current command number index */
40*35145Smarc 	long	fixcnt;			/* offset into history file */
41*35145Smarc 	int	fixmax;			/* number of accessible history lines */
42*35145Smarc 	int	fixline;		/* line number within command */
43*35145Smarc 	long	fixcmds[1];		/* byte offset for recent commands */
44*35145Smarc };
45*35145Smarc 
46*35145Smarc typedef struct
47*35145Smarc {
48*35145Smarc 	short his_command;
49*35145Smarc 	short his_line;
50*35145Smarc } histloc;
51*35145Smarc 
52*35145Smarc extern struct fixcmd	*fc_fix;
53*35145Smarc extern void hist_close();
54*35145Smarc 
55*35145Smarc #ifndef KSHELL
56*35145Smarc #define FCIO	19
57*35145Smarc typedef char	MSG[];
58*35145Smarc extern char *getenv();
59*35145Smarc #define valup(s)		getenv("s")
60*35145Smarc 
61*35145Smarc # ifdef BSD
62*35145Smarc # define	strchr	index
63*35145Smarc # define	strrchr	rindex
64*35145Smarc # endif /* BSD */
65*35145Smarc 
66*35145Smarc #define NIL	((char*)0)
67*35145Smarc #define	setalt	e_setalt
68*35145Smarc #define setraw	e_setraw
69*35145Smarc #define setcooked e_setcooked
70*35145Smarc #define failed	e_failed
71*35145Smarc #define	hread	emacs_read
72*35145Smarc #define vread	vi_read
73*35145Smarc #define movstr	e_movstr
74*35145Smarc #define ungetchar	e_ungetchar
75*35145Smarc #endif	/* KSHELL */
76*35145Smarc 
77*35145Smarc /* the following are readonly */
78*35145Smarc extern MSG	histfname;
79*35145Smarc extern MSG	nohistory;
80*35145Smarc extern MSG	badcooked;
81