/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 1984-2011 AT&T Intellectual Property *4* and is licensed under the *5* Eclipse Public License, Version 1.0 *6* by AT&T Intellectual Property *7* *8* A copy of the License is available at *9* http://www.eclipse.org/org/documents/epl-v10.html *10* (with md5 checksum b35adb5213ca9657e911e9befb180842) *11* *12* Information and Software Systems Research *13* AT&T Research *14* Florham Park NJ *15* *16* David Korn <[email protected]> *17* Pat Sullivan *18* *19***********************************************************************/20/*21* UNIX shell22* Header File for history mechanism23* written by David Korn24*25*/26272829#ifndef IOBSIZE30# define IOBSIZE 102431#endif32#define FC_CHAR '!'33#define HIS_DFLT 128 /* default size of history list */34#define HISMAX (sizeof(int)*IOBSIZE)35#define HISBIG (0100000-1024) /* 1K less than maximum short */36#define HISLINE 16 /* estimate of average sized history line */37#define MAXLINE 258 /* longest history line permitted */3839#define H_UNDO 0201 /* invalidate previous command */40#define H_CMDNO 0202 /* next 3 bytes give command number */41#define H_VERSION 1 /* history file format version no. */4243struct history44{45struct fileblk *fixfp; /* file descriptor for history file */46int fixfd; /* file number for history file */47char *fixname; /* name of history file */48off_t fixcnt; /* offset into history file */49int fixind; /* current command number index */50int fixmax; /* number of accessible history lines */51int fixflush; /* set if flushed outside of hflush() */52off_t fixcmds[1]; /* byte offset for recent commands */53};5455typedef struct56{57int his_command;58int his_line;59} histloc;6061extern struct history *hist_ptr;6263#ifndef KSHELL64extern void p_flush();65extern void p_setout();66extern void p_char();67extern void p_str();68# ifdef __STDC__69# define nam_strval(s) getenv(#s)70# else71# define nam_strval(s) getenv("s")72# endif /* __STDC__ */73# define NIL ((char*)0)74# define sh_fail ed_failed75# define sh_copy ed_movstr76#ifdef PROTO77extern char *ed_movstr(const char*, char*);78#else79extern char *ed_movstr();80#endif /* PROTO */81#endif /* KSHELL */8283/* the following are readonly */84extern const char hist_fname[];85extern const char e_history[];8687/* these are the history interface routines */88#ifdef PROTO89extern int hist_open(void);90extern void hist_cancel(void);91extern void hist_close(void);92extern int hist_copy(char*,int,int);93extern void hist_eof(void);94extern histloc hist_find(char*,int,int,int);95extern void hist_flush(void);96extern void hist_list(off_t,int,char*);97extern int hist_match(off_t,char*,int);98extern off_t hist_position(int);99extern void hist_subst(const char*,int,char*);100extern char *hist_word(char*,int);101# ifdef ESH102extern histloc hist_locate(int,int,int);103# endif /* ESH */104#else105extern int hist_open();106extern void hist_cancel();107extern void hist_close();108extern int hist_copy();109extern void hist_eof();110extern histloc hist_find();111extern void hist_flush();112extern void hist_list();113extern int hist_match();114extern off_t hist_position();115extern void hist_subst();116extern char *hist_word();117# ifdef ESH118extern histloc hist_locate();119# endif /* ESH */120#endif /* PROTO */121122123