8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / refer / hunt5.c
blob90e086e5580d2ec73e4d8deff352bd1018ef3383
1 /*
2 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
4 */
6 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
7 /* All Rights Reserved */
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.
15 #pragma ident "%Z%%M% %I% %E% SMI"
17 #include <stdio.h>
18 #include <sys/types.h>
19 #include <sys/stat.h>
21 extern char *soutput, *tagout, usedir[];
22 union ptr {
23 unsigned *a;
24 long *b;
27 void
28 result(unsigned *mptr, int nf, FILE *fc)
30 int i, c;
31 char *s;
32 long lp;
33 extern int iflong;
34 char res[100];
35 union ptr master;
37 if (iflong) {
38 master.b = (long *)mptr;
39 } else {
40 master.a = mptr;
43 for (i = 0; i < nf; i++) {
44 lp = iflong ? master.b[i] : master.a[i];
45 fseek(fc, lp, 0);
46 fgets(res, 100, fc);
47 for (s = res; c = *s; s++)
48 if (c == ';') {
49 *s = 0;
50 break;
52 if (tagout != 0) {
53 if (res[0] == '/' || usedir[0] == 0)
54 sprintf(tagout, "%s", res);
55 else
56 sprintf(tagout, "%s/%s", usedir, res);
57 while (*tagout) tagout++;
58 } else {
59 if (res[0] != '/' || usedir[0] == 0)
60 printf("%s/", usedir);
61 printf("%s\n", res);
66 long
67 gdate(f)
68 FILE *f;
70 struct stat sb;
71 fstat(fileno(f), &sb);
72 return (sb . st_mtime);