xref: /csrg-svn/old/refer/hunt/hunt5.c (revision 48296)
1*48296Sbostic /*-
2*48296Sbostic  * %sccs.include.proprietary.c%
3*48296Sbostic  */
4*48296Sbostic 
512286Stut #ifndef lint
6*48296Sbostic static char sccsid[] = "@(#)hunt5.c	4.4 (Berkeley) 04/18/91";
7*48296Sbostic #endif /* not lint */
812286Stut 
912286Stut #include <stdio.h>
1012286Stut #include <sys/types.h>
1112286Stut #include <sys/stat.h>
1212286Stut 
1312286Stut extern char *soutput, *tagout, usedir[];
1412286Stut 
result(master,nf,fc)1512286Stut result(master, nf, fc)
1632269Sbostic unsigned *master;
1712286Stut FILE *fc;
1812286Stut {
1912286Stut 	int i, c;
2012286Stut 	char *s;
2112286Stut 	long lp;
2212286Stut 	extern int iflong;
2312286Stut 	char res[100];
2432269Sbostic 	union ptr {
2532269Sbostic 		unsigned *a;
2632269Sbostic 		long *b;
2732269Sbostic 	} umaster;
2812286Stut 
2932269Sbostic 	if (iflong)
3032269Sbostic 		umaster.b = (long *) master;
3132269Sbostic 	else
3232269Sbostic 		umaster.a = master;
3312286Stut 	for(i=0; i<nf; i++)
3412286Stut 	{
3532269Sbostic 		lp = iflong ? umaster.b[i] : umaster.a[i];
3612286Stut 		fseek(fc,lp, 0);
3712286Stut 		fgets(res, 100, fc);
3812286Stut 		for(s=res; c = *s; s++)
3912286Stut 			if (c== ';')
4012286Stut 			{
4112286Stut 				*s=0;
4212286Stut 				break;
4312286Stut 			}
4412286Stut 		if (tagout !=0)
4512286Stut 		{
4612286Stut 			if (res[0]=='/' || usedir[0]==0)
4712286Stut 				sprintf(tagout, "%s", res);
4812286Stut 			else
4912286Stut 				sprintf(tagout, "%s/%s", usedir, res);
5012286Stut 			while (*tagout) tagout++;
5112286Stut 		}
5212286Stut 		else
5312286Stut 		{
5412286Stut 			if (res[0]!='/' || usedir[0]==0)
5512286Stut 				printf("%s/", usedir);
5612286Stut 			printf("%s\n", res);
5712286Stut 		}
5812286Stut 	}
5912286Stut }
6012286Stut 
6112286Stut long
gdate(f)6212286Stut gdate(f)
6312286Stut FILE *f;
6412286Stut {
6512286Stut 	struct stat sb;
6612286Stut 	fstat (f->_file, &sb);
6712286Stut 	return  (sb . st_mtime);
6812286Stut }
69