# include "stdio.h"
#include "refer.h"
#include <sys/types.h>
#include <sys/stat.h>
# define unopen(fil) {if (fil!=NULL) {fclose(fil); fil=NULL;}}
void runbib(char *s)
{
/* make a file suitable for fgrep */
char tmp[200];
sprintf(tmp, "%s/mkey %s >%s.ig", referlib, s, s);
system(tmp);
}
int ckexist(char *s, char *t)
{
char fnam[DIRLEN+5];
struct stat sb;
strcpy(fnam, s);
strcat(fnam, t);
return stat(fnam, &sb) >= 0;
}
FILE *iopen(char *s, char *t)
{
char fnam[DIRLEN+5];
FILE *f;
strcpy(fnam, s);
strcat(fnam, t);
f = fopen(fnam, "r");
if (f == NULL)
err("missing required%s file %s - rerun pubindex?",
*t? " index": "", fnam);
return f;
}
|