]>
diplodocus.org Git - nmh/blob - sbr/fdcompare.c
1 /* fdcompare.c -- are two files identical?
3 * This code is Copyright (c) 2002, by the authors of nmh. See the
4 * COPYRIGHT file in the root directory of the nmh distribution for
5 * complete copyright information.
12 fdcompare (int fd1
, int fd2
)
16 char b1
[BUFSIZ
], b2
[BUFSIZ
];
19 while ((n1
= read (fd1
, b1
, sizeof(b1
))) >= 0
20 && (n2
= read (fd2
, b2
, sizeof(b2
))) >= 0
24 for (i
= n1
< (int) sizeof(b1
) ? n1
: (int) sizeof(b1
); i
--;)
29 if (n1
< (int) sizeof(b1
))
35 lseek(fd1
, 0, SEEK_SET
);
36 lseek(fd2
, 0, SEEK_SET
);