xref: /original-bsd/old/refer/hunt/hunt5.c (revision 241757c4)
1 #ifndef lint
2 static char *sccsid = "@(#)hunt5.c	4.3 (Berkeley) 09/28/87";
3 #endif
4 
5 #include <stdio.h>
6 #include <sys/types.h>
7 #include <sys/stat.h>
8 
9 extern char *soutput, *tagout, usedir[];
10 
11 result(master, nf, fc)
12 unsigned *master;
13 FILE *fc;
14 {
15 	int i, c;
16 	char *s;
17 	long lp;
18 	extern int iflong;
19 	char res[100];
20 	union ptr {
21 		unsigned *a;
22 		long *b;
23 	} umaster;
24 
25 	if (iflong)
26 		umaster.b = (long *) master;
27 	else
28 		umaster.a = master;
29 	for(i=0; i<nf; i++)
30 	{
31 		lp = iflong ? umaster.b[i] : umaster.a[i];
32 		fseek(fc,lp, 0);
33 		fgets(res, 100, fc);
34 		for(s=res; c = *s; s++)
35 			if (c== ';')
36 			{
37 				*s=0;
38 				break;
39 			}
40 		if (tagout !=0)
41 		{
42 			if (res[0]=='/' || usedir[0]==0)
43 				sprintf(tagout, "%s", res);
44 			else
45 				sprintf(tagout, "%s/%s", usedir, res);
46 			while (*tagout) tagout++;
47 		}
48 		else
49 		{
50 			if (res[0]!='/' || usedir[0]==0)
51 				printf("%s/", usedir);
52 			printf("%s\n", res);
53 		}
54 	}
55 }
56 
57 long
58 gdate(f)
59 FILE *f;
60 {
61 	struct stat sb;
62 	fstat (f->_file, &sb);
63 	return  (sb . st_mtime);
64 }
65