1 /*
2 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
4 */
5
6 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
7 /* All Rights Reserved */
8
9 /*
10 * Copyright (c) 1980 Regents of the University of California.
11 * All rights reserved. The Berkeley software License Agreement
12 * specifies the terms and conditions for redistribution.
13 */
14
15 #include <stdio.h>
16 #include <sys/types.h>
17 #include <sys/stat.h>
18
19 extern char *soutput, *tagout, usedir[];
20 union ptr {
21 unsigned *a;
22 long *b;
23 };
24
25 void
result(unsigned * mptr,int nf,FILE * fc)26 result(unsigned *mptr, int nf, FILE *fc)
27 {
28 int i, c;
29 char *s;
30 long lp;
31 extern int iflong;
32 char res[100];
33 union ptr master;
34
35 if (iflong) {
36 master.b = (long *)mptr;
37 } else {
38 master.a = mptr;
39 }
40
41 for (i = 0; i < nf; i++) {
42 lp = iflong ? master.b[i] : master.a[i];
43 fseek(fc, lp, 0);
44 fgets(res, 100, fc);
45 for (s = res; c = *s; s++)
46 if (c == ';') {
47 *s = 0;
48 break;
49 }
50 if (tagout != 0) {
51 if (res[0] == '/' || usedir[0] == 0)
52 sprintf(tagout, "%s", res);
53 else
54 sprintf(tagout, "%s/%s", usedir, res);
55 while (*tagout) tagout++;
56 } else {
57 if (res[0] != '/' || usedir[0] == 0)
58 printf("%s/", usedir);
59 printf("%s\n", res);
60 }
61 }
62 }
63
64 long
gdate(f)65 gdate(f)
66 FILE *f;
67 {
68 struct stat sb;
69 fstat(fileno(f), &sb);
70 return (sb . st_mtime);
71 }
72