xref: /original-bsd/old/refer/hunt/hunt5.c (revision a0a7d8f4)
1 #ifndef lint
2 static char *sccsid = "@(#)hunt5.c	4.2 (Berkeley) 01/09/85";
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 union ptr {
13 	unsigned *a;
14 	long *b;
15 } master;
16 FILE *fc;
17 {
18 	int i, c;
19 	char *s;
20 	long lp;
21 	extern int iflong;
22 	char res[100];
23 
24 	for(i=0; i<nf; i++)
25 	{
26 		lp = iflong ? master.b[i] : master.a[i];
27 		fseek(fc,lp, 0);
28 		fgets(res, 100, fc);
29 		for(s=res; c = *s; s++)
30 			if (c== ';')
31 			{
32 				*s=0;
33 				break;
34 			}
35 		if (tagout !=0)
36 		{
37 			if (res[0]=='/' || usedir[0]==0)
38 				sprintf(tagout, "%s", res);
39 			else
40 				sprintf(tagout, "%s/%s", usedir, res);
41 			while (*tagout) tagout++;
42 		}
43 		else
44 		{
45 			if (res[0]!='/' || usedir[0]==0)
46 				printf("%s/", usedir);
47 			printf("%s\n", res);
48 		}
49 	}
50 }
51 
52 long
53 gdate(f)
54 FILE *f;
55 {
56 	struct stat sb;
57 	fstat (f->_file, &sb);
58 	return  (sb . st_mtime);
59 }
60