]>
diplodocus.org Git - nmh/blob - sbr/fdcompare.c
3 * fdcompare.c -- are two files identical?
7 * This code is Copyright (c) 2002, by the authors of nmh. See the
8 * COPYRIGHT file in the root directory of the nmh distribution for
9 * complete copyright information.
16 fdcompare (int fd1
, int fd2
)
18 register int i
, n1
, n2
, resp
;
19 register char *c1
, *c2
;
20 char b1
[BUFSIZ
], b2
[BUFSIZ
];
23 while ((n1
= read (fd1
, b1
, sizeof(b1
))) >= 0
24 && (n2
= read (fd2
, b2
, sizeof(b2
))) >= 0
28 for (i
= n1
< sizeof(b1
) ? n1
: sizeof(b1
); i
--;)
39 lseek (fd1
, (off_t
) 0, SEEK_SET
);
40 lseek (fd2
, (off_t
) 0, SEEK_SET
);