2 ** fdcompare.c -- are two files identical?
4 ** This code is Copyright (c) 2002, by the authors of nmh. See the
5 ** COPYRIGHT file in the root directory of the nmh distribution for
6 ** complete copyright information.
13 fdcompare(int fd1, int fd2)
15 register int i, n1, n2, resp;
16 register char *c1, *c2;
17 char b1[BUFSIZ], b2[BUFSIZ];
20 while ((n1 = read(fd1, b1, sizeof(b1))) >= 0
21 && (n2 = read(fd2, b2, sizeof(b2))) >= 0
25 for (i = n1 < sizeof(b1) ? n1 : sizeof(b1); i--;)
36 lseek(fd1, (off_t) 0, SEEK_SET);
37 lseek(fd2, (off_t) 0, SEEK_SET);