BSD 4_4 release
[unix-history] / usr / src / old / refer / hunt / hunt5.c
CommitLineData
a860ef9e 1/*-
ad787160
C
2 * This module is believed to contain source code proprietary to AT&T.
3 * Use and redistribution is subject to the Berkeley Software License
4 * Agreement and your Software Agreement with AT&T (Western Electric).
a860ef9e
KB
5 */
6
84417944 7#ifndef lint
ad787160 8static char sccsid[] = "@(#)hunt5.c 4.4 (Berkeley) 4/18/91";
a860ef9e 9#endif /* not lint */
84417944
BT
10
11#include <stdio.h>
12#include <sys/types.h>
13#include <sys/stat.h>
14
15extern char *soutput, *tagout, usedir[];
16
17result(master, nf, fc)
af802d8e 18unsigned *master;
84417944
BT
19FILE *fc;
20{
21 int i, c;
22 char *s;
23 long lp;
24 extern int iflong;
25 char res[100];
af802d8e
KB
26 union ptr {
27 unsigned *a;
28 long *b;
29 } umaster;
84417944 30
af802d8e
KB
31 if (iflong)
32 umaster.b = (long *) master;
33 else
34 umaster.a = master;
84417944
BT
35 for(i=0; i<nf; i++)
36 {
af802d8e 37 lp = iflong ? umaster.b[i] : umaster.a[i];
84417944
BT
38 fseek(fc,lp, 0);
39 fgets(res, 100, fc);
40 for(s=res; c = *s; s++)
41 if (c== ';')
42 {
43 *s=0;
44 break;
45 }
46 if (tagout !=0)
47 {
48 if (res[0]=='/' || usedir[0]==0)
49 sprintf(tagout, "%s", res);
50 else
51 sprintf(tagout, "%s/%s", usedir, res);
52 while (*tagout) tagout++;
53 }
54 else
55 {
56 if (res[0]!='/' || usedir[0]==0)
57 printf("%s/", usedir);
58 printf("%s\n", res);
59 }
60 }
61}
62
63long
64gdate(f)
65FILE *f;
66{
67 struct stat sb;
68 fstat (f->_file, &sb);
69 return (sb . st_mtime);
70}