Blame src/cmd/ksh93/include/history.h

Packit Service a8c26c
/***********************************************************************
Packit Service a8c26c
*                                                                      *
Packit Service a8c26c
*               This software is part of the ast package               *
Packit Service a8c26c
*          Copyright (c) 1982-2011 AT&T Intellectual Property          *
Packit Service a8c26c
*                      and is licensed under the                       *
Packit Service a8c26c
*                 Eclipse Public License, Version 1.0                  *
Packit Service a8c26c
*                    by AT&T Intellectual Property                     *
Packit Service a8c26c
*                                                                      *
Packit Service a8c26c
*                A copy of the License is available at                 *
Packit Service a8c26c
*          http://www.eclipse.org/org/documents/epl-v10.html           *
Packit Service a8c26c
*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
Packit Service a8c26c
*                                                                      *
Packit Service a8c26c
*              Information and Software Systems Research               *
Packit Service a8c26c
*                            AT&T Research                             *
Packit Service a8c26c
*                           Florham Park NJ                            *
Packit Service a8c26c
*                                                                      *
Packit Service a8c26c
*                  David Korn <dgk@research.att.com>                   *
Packit Service a8c26c
*                                                                      *
Packit Service a8c26c
***********************************************************************/
Packit Service a8c26c
#pragma prototyped
Packit Service a8c26c
#ifndef HIST_VERSION
Packit Service a8c26c
/*
Packit Service a8c26c
 *	Interface for history mechanism
Packit Service a8c26c
 *	written by David Korn
Packit Service a8c26c
 *
Packit Service a8c26c
 */
Packit Service a8c26c
Packit Service a8c26c
#include	<ast.h>
Packit Service a8c26c
Packit Service a8c26c
#define HIST_CHAR	'!'
Packit Service a8c26c
#define HIST_VERSION	1		/* history file format version no. */
Packit Service a8c26c
Packit Service a8c26c
typedef struct 
Packit Service a8c26c
{
Packit Service a8c26c
	Sfdisc_t	histdisc;	/* discipline for history */
Packit Service a8c26c
	Sfio_t		*histfp;	/* history file stream pointer */
Packit Service a8c26c
	char		*histname;	/* name of history file */
Packit Service a8c26c
	int32_t		histind;	/* current command number index */
Packit Service a8c26c
	int		histsize;	/* number of accessible history lines */
Packit Service a8c26c
#ifdef _HIST_PRIVATE
Packit Service a8c26c
	_HIST_PRIVATE
Packit Service a8c26c
#endif /* _HIST_PRIVATE */
Packit Service a8c26c
} History_t;
Packit Service a8c26c
Packit Service a8c26c
typedef struct
Packit Service a8c26c
{
Packit Service a8c26c
	int hist_command;
Packit Service a8c26c
	int hist_line;
Packit Service a8c26c
	int hist_char;
Packit Service a8c26c
} Histloc_t;
Packit Service a8c26c
Packit Service a8c26c
/* the following are readonly */
Packit Service a8c26c
extern const char	hist_fname[];
Packit Service a8c26c
Packit Service a8c26c
extern int _Hist;
Packit Service a8c26c
#define	hist_min(hp)	((_Hist=((int)((hp)->histind-(hp)->histsize)))>=0?_Hist:0)
Packit Service a8c26c
#define	hist_max(hp)	((int)((hp)->histind))
Packit Service a8c26c
/* these are the history interface routines */
Packit Service a8c26c
extern int		sh_histinit(void *);
Packit Service a8c26c
extern void 		hist_cancel(History_t*);
Packit Service a8c26c
extern void 		hist_close(History_t*);
Packit Service a8c26c
extern int		hist_copy(char*, int, int, int);
Packit Service a8c26c
extern void 		hist_eof(History_t*);
Packit Service a8c26c
extern Histloc_t	hist_find(History_t*,char*,int, int, int);
Packit Service a8c26c
extern void 		hist_flush(History_t*);
Packit Service a8c26c
extern void 		hist_list(History_t*,Sfio_t*, off_t, int, char*);
Packit Service a8c26c
extern int		hist_match(History_t*,off_t, char*, int*);
Packit Service a8c26c
extern off_t		hist_tell(History_t*,int);
Packit Service a8c26c
extern off_t		hist_seek(History_t*,int);
Packit Service a8c26c
extern char 		*hist_word(char*, int, int);
Packit Service a8c26c
#if SHOPT_ESH
Packit Service a8c26c
    extern Histloc_t	hist_locate(History_t*,int, int, int);
Packit Service a8c26c
#endif	/* SHOPT_ESH */
Packit Service a8c26c
Packit Service a8c26c
#endif /* HIST_VERSION */