Changeset View
Changeset View
Standalone View
Standalone View
usr.bin/cmp/regular.c
Show First 20 Lines • Show All 121 Lines • ▼ Show 20 Lines | c_regular(int fd1, const char *file1, off_t skip1, off_t len1, | ||||
for (byte = line = 1; length--; ++byte) { | for (byte = line = 1; length--; ++byte) { | ||||
if ((ch = *p1) != *p2) { | if ((ch = *p1) != *p2) { | ||||
if (xflag) { | if (xflag) { | ||||
dfound = 1; | dfound = 1; | ||||
(void)printf("%08llx %02x %02x\n", | (void)printf("%08llx %02x %02x\n", | ||||
(long long)byte - 1, ch, *p2); | (long long)byte - 1, ch, *p2); | ||||
} else if (lflag) { | } else if (lflag) { | ||||
dfound = 1; | dfound = 1; | ||||
if (bflag) | |||||
(void)printf("%6lld %3o %c %3o %c\n", | |||||
markj: Why `%6o`? Isn't 3 enough?
Hmm looks like this is what gcmp does. | |||||
Done Inline ActionsRight, %6o to be compatible with gcmp's output, but gcmp also (IIRC) had the first field only 3-wide. kevans: Right, `%6o` to be compatible with gcmp's output, but gcmp also (IIRC) had the first field only… | |||||
(long long)byte, ch, ch, *p2, *p2); | |||||
else | |||||
(void)printf("%6lld %3o %3o\n", | (void)printf("%6lld %3o %3o\n", | ||||
(long long)byte, ch, *p2); | (long long)byte, ch, *p2); | ||||
} else | } else | ||||
diffmsg(file1, file2, byte, line); | diffmsg(file1, file2, byte, line, ch, *p2); | ||||
/* NOTREACHED */ | /* NOTREACHED */ | ||||
} | } | ||||
if (ch == '\n') | if (ch == '\n') | ||||
++line; | ++line; | ||||
if (++p1 == e1) { | if (++p1 == e1) { | ||||
off1 += MMAP_CHUNK; | off1 += MMAP_CHUNK; | ||||
if ((p1 = m1 = remmap(m1, fd1, off1)) == NULL) { | if ((p1 = m1 = remmap(m1, fd1, off1)) == NULL) { | ||||
munmap(m2, MMAP_CHUNK); | munmap(m2, MMAP_CHUNK); | ||||
▲ Show 20 Lines • Show All 44 Lines • Show Last 20 Lines |
Why %6o? Isn't 3 enough?
Hmm looks like this is what gcmp does.