---
 Makefile        | 2 +-
 filter/indent.c | 7 +++----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index bb41165..be708ad 100644
--- a/Makefile
+++ b/Makefile
@@ -31,7 +31,7 @@ lchat.o: lchat.c
 
 filter: filter/indent
 filter/indent: filter/indent.c util.o util.h
-       $(CC) $(CFLAGS) -o $@ filter/indent.c util.o
+       $(CC) $(CFLAGS) -D_BSD_SOURCE -o $@ filter/indent.c util.o
 
 sl_test.o: sl_test.c slackline.h
        $(CC) $(CFLAGS) -Wno-sign-compare -c -o $@ sl_test.c
diff --git a/filter/indent.c b/filter/indent.c
index c9be0e9..9360281 100644
--- a/filter/indent.c
+++ b/filter/indent.c
@@ -68,11 +68,10 @@ main(void)
                /* print indented text */
                while ((word = strsep(&next, " ")) != NULL) {
                        tw -= strlen(word) + 1;
-                       if (tw < 0 && !first) {
+                       if (tw < 0 && !first)
                                fputs("\n                  ", stdout);
-                               tw = cols - pw;
-                               first = true;
-                       }
+                       if (tw < 0)
+                               tw = cols - pw - strlen(word);
 
                        fputc(' ', stdout);
                        fputs(word, stdout);
-- 
2.51.2


Reply via email to