]> diplodocus.org Git - nmh/blob - docs/historical/mh-nov-1983/subs/fdcompare.c
Update XOAUTH2 documentation.
[nmh] / docs / historical / mh-nov-1983 / subs / fdcompare.c
1 fdcompare(fd1, fd2)
2 {
3 int n1, n2, resp;
4 register int i;
5 register char *c1, *c2;
6 char b1[512], b2[512];
7
8 resp = 1;
9 while((n1 = read(fd1, b1, 512)) >= 0 &&
10 (n2 = read(fd2, b2, 512)) >= 0 &&
11 n1 == n2) {
12
13 c1 = b1; c2 = b2;
14 for(i = n1 < 512? n1 : 512; i--; )
15 if(*c1++ != *c2++) {
16 resp = 0;
17 goto leave;
18 }
19 if(n1 < 512)
20 goto leave;
21 }
22 resp = 0;
23 leave:
24 lseek(fd1, 0l, 0);
25 lseek(fd2, 0l, 0);
26 return(resp);
27 }