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