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