* Copyright (c) 1991 The Regents of the University of California.
* %sccs.include.redist.c%
static char sccsid
[] = "@(#)regular.c 5.1 (Berkeley) %G%";
c_regular(fd1
, file1
, skip1
, len1
, fd2
, file2
, skip2
, len2
)
off_t skip1
, len1
, skip2
, len2
;
register u_char ch
, *p1
, *p2
;
register off_t byte
, length
, line
;
if (sflag
&& len1
!= len2
)
length
= MIN(len1
, len2
);
if ((p1
= (u_char
*)mmap(NULL
,
length
, PROT_READ
, MAP_FILE
, fd1
, skip1
)) == (u_char
*)-1)
err("%s: %s", file1
, strerror(errno
));
if ((p2
= (u_char
*)mmap(NULL
,
length
, PROT_READ
, MAP_FILE
, fd2
, skip2
)) == (u_char
*)-1)
err("%s: %s", file2
, strerror(errno
));
for (byte
= line
= 1; length
--; ++p1
, ++p2
, ++byte
) {
(void)printf("%6ld %3o %3o\n", byte
, ch
, *p2
);
diffmsg(file1
, file2
, byte
, line
);
eofmsg (len1
> len2
? file2
: file1
);