about summary refs log tree commit diff
path: root/src/usr.bin/vis/foldit.c
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2020-09-03 18:34:44 +0200
committerLeah Neukirchen <leah@vuxu.org>2020-09-03 18:34:44 +0200
commit35e59b1734c8f4fd7e5fff7619b3fefa280f7702 (patch)
treeed561dd6cb5e0de429ed1fbe8e219af40e743482 /src/usr.bin/vis/foldit.c
parent76350683f4cb7bca8176a1a843066bd14741ee82 (diff)
downloadoutils-35e59b1734c8f4fd7e5fff7619b3fefa280f7702.tar.gz
outils-35e59b1734c8f4fd7e5fff7619b3fefa280f7702.tar.xz
outils-35e59b1734c8f4fd7e5fff7619b3fefa280f7702.zip
cvs update
Diffstat (limited to 'src/usr.bin/vis/foldit.c')
-rw-r--r--src/usr.bin/vis/foldit.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/usr.bin/vis/foldit.c b/src/usr.bin/vis/foldit.c
index f9abd99..aaa0592 100644
--- a/src/usr.bin/vis/foldit.c
+++ b/src/usr.bin/vis/foldit.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: foldit.c,v 1.7 2013/11/12 22:51:18 deraadt Exp $	*/
+/*	$OpenBSD: foldit.c,v 1.8 2020/08/17 18:41:23 martijn Exp $	*/
 /*	$NetBSD: foldit.c,v 1.4 1994/12/20 16:13:02 jtc Exp $	*/
 
 /*-
@@ -38,6 +38,7 @@ int
 foldit(char *chunk, int col, int max)
 {
 	char *cp;
+	int first = (col != 0);
 
 	/*
 	 * Keep track of column position. Insert hidden newline
@@ -61,8 +62,11 @@ again:
 			col++;
 		}
 		if (col > (max - 2)) {
+			if (!first)
+				return (col);
 			printf("\\\n");
 			col = 0;
+			first = 0;
 			goto again;
 		} 
 		cp++;