sbase

suckless unix tools
git clone git://git.suckless.org/sbase
Log | Files | Refs | README | LICENSE

commit db1dc984c3c4b492d9b3e20fbed30d06100d084a
parent 0d42b4f3d14bc2a4bf87e25d464772b9c8222ed0
Author: Richard Ipsum <richardipsum@vx21.xyz>
Date:   Fri,  9 Oct 2020 15:52:09 +0100

fold: don't putchar('\n') if last byte is '\n'

Diffstat:
Mfold.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fold.c b/fold.c @@ -23,7 +23,8 @@ foldline(struct line *l) { len = ((sflag && spacesect) ? spacesect : i) - last; if (fwrite(l->data + last, 1, len, stdout) != len) eprintf("fwrite <stdout>:"); - putchar('\n'); + if (l->data[i] != '\n') + putchar('\n'); last = (sflag && spacesect) ? spacesect : i; col = 0; spacesect = 0;