Skip to content

Commit 33b9041

Browse files
committed
Show what the problematic byte is in Windows
1 parent 43ecb4c commit 33b9041

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

bacmp.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,21 @@ int main(int argc, char *argv[]) {
7878
offset_b = cb1 + (cb2<<8);
7979
delta = offset_b - offset_a;
8080

81-
while (ca1 != EOF && cb1 != EOF) {
81+
while ( (ca1 != EOF) && (cb1 != EOF) ) {
8282
count++;
8383
ca0 = ca1; cb0 = cb1; /* stash old value for lineptr check */
8484
ca1 = fgetc(fa);
8585
cb1 = fgetc(fb);
8686
if (ca1 == cb1) continue;
8787

8888
if ( ca1 == EOF ) {
89-
fprintf(stderr, "EOF on %s after byte %d\n", argv[1], count-2);
89+
fprintf(stderr, "EOF on %s after byte %d. %s has %c.\n",
90+
argv[1], count-2, argv[2], cb1);
9091
exit(1);
9192
}
9293
else if ( cb1 == EOF ) {
93-
fprintf(stderr, "EOF on %s after byte %d\n", argv[2], count-2);
94+
fprintf(stderr, "EOF on %s after byte %d. %s has %c.\n",
95+
argv[2], count-2, argv[1], ca1);
9496
exit(2);
9597
}
9698

0 commit comments

Comments
 (0)