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