sbase

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

commit 10049d33a55ba7de87b15f720dc2c9dcb32859d9
parent 6be3e82218829fae7e9443c699d02a1a4757971f
Author: Connor Lane Smith <cls@lubutu.com>
Date:   Fri, 10 Jun 2011 04:22:59 +0100

fold: fix empty lines
Diffstat:
Mfold.c | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fold.c b/fold.c @@ -62,9 +62,9 @@ void foldline(const char *str, long width) { bool space; - long col, i, j, n; + long col, j, i = 0, n = 0; - for(i = n = 0; str[i] && str[i] != '\n'; i = n) { + do { space = false; for(j = i, col = 0; str[j] && col <= width; j++) { if(!UTF8_POINT(str[j]) && !bflag) @@ -95,5 +95,5 @@ foldline(const char *str, long width) eprintf("<stdout>: write error:"); if(str[n]) putchar('\n'); - } + } while(str[i = n] && str[i] != '\n'); }