summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2004-08-12 12:32:14 +0000
committertjr <tjr@FreeBSD.org>2004-08-12 12:32:14 +0000
commita1081fe7381236089cd6c8e3fb4c03c2efd99eac (patch)
treee51b636482225480086360551066b362f28ac0d6 /lib/libc
parentd093c6fa50f1d7145f8c2a730a42e9c6749c866e (diff)
downloadFreeBSD-src-a1081fe7381236089cd6c8e3fb4c03c2efd99eac.zip
FreeBSD-src-a1081fe7381236089cd6c8e3fb4c03c2efd99eac.tar.gz
Fix example.
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/locale/wcwidth.39
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/libc/locale/wcwidth.3 b/lib/libc/locale/wcwidth.3
index 6e9dcd6..06c0067 100644
--- a/lib/libc/locale/wcwidth.3
+++ b/lib/libc/locale/wcwidth.3
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd October 3, 2002
+.Dd August 12, 2004
.Dt WCWIDTH 3
.Os
.Sh NAME
@@ -65,15 +65,16 @@ int column, w;
column = 0;
while ((ch = getwchar()) != WEOF) {
- if ((w = wcwidth(ch)) > 0)
- column += w;
- if (column >= 20) {
+ w = wcwidth(ch);
+ if (w > 0 && column + w >= 20) {
putwchar(L'\en');
column = 0;
}
putwchar(ch);
if (ch == L'\en')
column = 0;
+ else if (w > 0)
+ column += w;
}
.Ed
.Sh SEE ALSO
OpenPOWER on IntegriCloud