head 1.4; access; symbols; locks; strict; comment @ * @; 1.4 date 93.08.25.18.29.28; author jromine; state Exp; branches; next 1.3; 1.3 date 93.08.25.17.43.26; author jromine; state Exp; branches; next 1.2; 1.2 date 93.08.25.17.19.34; author jromine; state Exp; branches; next 1.1; 1.1 date 93.08.25.17.19.21; author jromine; state Exp; branches; next ; desc @@ 1.4 log @need sys/types.h @ text @/* fdcompare.c - are two files identical? */ #ifndef lint static char Id[] = "@@(#)$Id: fdcompare.c,v 1.3 1993/08/25 17:43:26 jromine Exp jromine $"; #endif #include "../h/mh.h" #include #include /* for off_t */ off_t lseek(); fdcompare (fd1, fd2) register int fd1, fd2; { register int i, n1, n2, resp; register char *c1, *c2; char b1[BUFSIZ], b2[BUFSIZ]; resp = 1; while ((n1 = read (fd1, b1, sizeof b1)) >= 0 && (n2 = read (fd2, b2, sizeof b2)) >= 0 && n1 == n2) { c1 = b1; c2 = b2; for (i = n1 < sizeof b1 ? n1 : sizeof b1; i--;) if (*c1++ != *c2++) { resp = 0; goto leave; } if (n1 < sizeof b1) goto leave; } resp = 0; leave: ; (void) lseek (fd1, (off_t)0, 0); (void) lseek (fd2, (off_t)0, 0); return resp; } @ 1.3 log @add id @ text @d3 1 a3 1 static char Id[] = "@@(#)$Id:$"; d8 1 @ 1.2 log @off_t fixes for BSD44 @ text @d2 3 @ 1.1 log @Initial revision @ text @d6 1 a6 1 long lseek(); d39 2 a40 2 (void) lseek (fd1, 0L, 0); (void) lseek (fd2, 0L, 0); @