aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/diff/diffreg.c
diff options
context:
space:
mode:
authorKyle Evans <kevans@FreeBSD.org>2022-12-14 01:31:21 +0000
committerKyle Evans <kevans@FreeBSD.org>2022-12-14 01:31:21 +0000
commit54d65fdd5643f61a816c1d028b53039290ed1d92 (patch)
tree3dba0ceab24a4246bd3f1340f038aa47d83debd9 /usr.bin/diff/diffreg.c
parent8bf187f35b6298b7848c5ecf45b0b714327090d9 (diff)
Diffstat (limited to 'usr.bin/diff/diffreg.c')
-rw-r--r--usr.bin/diff/diffreg.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c
index 1247317951d3..971f640fa05f 100644
--- a/usr.bin/diff/diffreg.c
+++ b/usr.bin/diff/diffreg.c
@@ -1246,9 +1246,9 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile, int flags)
else if (diff_format != D_UNIFIED)
printf(" ");
}
- col = 0;
- for (j = 0, lastc = '\0'; j < nc && (hw == 0 || col < hw);
- j++, lastc = c) {
+ col = j = 0;
+ lastc = '\0';
+ while (j < nc && (hw == 0 || col < hw)) {
c = getc(lb);
if (flags & D_STRIPCR && c == '\r') {
if ((c = getc(lb)) == '\n')
@@ -1313,6 +1313,9 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile, int flags)
col++;
}
}
+
+ j++;
+ lastc = c;
}
}
if (color && diff_format == D_SIDEBYSIDE)