Plan 9 from Bell Labs’s /usr/web/sources/contrib/steve/root/sys/src/cmd/refer/hunt8.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


# 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;
}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.