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