#include <stdarg.h>
#include "stdio.h"
#define NITEM 100
#define TXTLEN 32700
#define DIRLEN 1024
extern char *progname;
typedef long Fpos; /* file position */
extern char *todir(char *);
extern int setfrom(int);
extern void savedir(void);
extern void restodir(void);
extern void corout(char *, char *, char *, char *, int);
extern void callhunt(char *, char *, char *, int);
extern void dodeliv(char *, char *, char *, int);
extern int grepcall(char *, char *, char *);
extern void clfgrep(void);
extern void huntmain(int, char **);
extern long int indexdate;
extern char *tagout;
extern char *soutput;
extern char *sinput;
extern char gfile[];
extern char *referlib;
extern char usedir[];
extern int prfreqs;
extern int reached;
extern int soutlen;
extern int measure;
extern int colevel;
extern FILE *fd;
extern int taglen;
extern int typeindex;
/*
* misc. low level functions
*/
FILE *iopen(char *, char *);
extern long int getl(FILE *);
extern void putl(long int, FILE *);
int hash(char *);
void trailspace(int, char *);
void *zalloc(unsigned int, unsigned int);
int prefix(char *, char *);
long getl(FILE *);
void putl(long, FILE *);
void trimnl(char *);
char *mindex(char *, int);
int fullread(int, char *, int);
void xseek(FILE *, Fpos, int);
void tick(void), tock(void);
#include "err.h"
/*
* built-in commands to corout; end with null cmd
*/
typedef struct Builtin {
char *cmd;
void (*fn)(char *, char *, char *, int);
} Builtin;
extern Builtin builtins[];
typedef struct List {
int n;
int avail;
long *el;
} List;
void initlist(List *);
void growlist(List *, long);
void applist(List *, long);
void emptylist(List *);
void listfree(List *);
void copylist(List *, List *);
#define new(type,n) (type *)zalloc(n,sizeof(type))
typedef struct Index {
int n; /* index (hash table) size */
List hash; /* file pointer for each hash code */
List freq; /* frequency table; null if not present */
} Index;
void initindex(Index *);
int getindex(Index *, FILE *);
void putindex(Index *, FILE *);
void growindex(Index *, long);
void emptyindex(Index *); /* frees contents, not pointer */
#define REFMAGIC (((long)'R'<<24)|((long)'E'<<16)|('F'<<8)|0x7f)
|