[hackers] [sbase] fold: fix empty lines || Connor Lane Smith

From: <hg_AT_suckless.org>
Date: Fri, 10 Jun 2011 05:23:04 +0200 (CEST)

changeset: 69:a4b68ba0c52f
tag: tip
user: Connor Lane Smith <cls_AT_lubutu.com>
date: Fri Jun 10 04:22:59 2011 +0100
files: fold.c
description:
fold: fix empty lines

diff -r 4dabdab840dc -r a4b68ba0c52f fold.c
--- a/fold.c Fri Jun 10 04:14:05 2011 +0100
+++ b/fold.c Fri Jun 10 04:22:59 2011 +0100
@@ -62,9 +62,9 @@
 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 @@
                         eprintf("<stdout>: write error:");
                 if(str[n])
                         putchar('\n');
- }
+ } while(str[i = n] && str[i] != '\n');
 }
Received on Fri Jun 10 2011 - 05:23:04 CEST

This archive was generated by hypermail 2.2.0 : Fri Jun 10 2011 - 05:24:04 CEST