summaryrefslogtreecommitdiffstats
path: root/lib/libc/locale
diff options
context:
space:
mode:
authortrhodes <trhodes@FreeBSD.org>2004-08-17 04:45:52 +0000
committertrhodes <trhodes@FreeBSD.org>2004-08-17 04:45:52 +0000
commitd78838150270c66b44c82589786bdba7408ee7a1 (patch)
tree015e77b3171998ebde4ac6ed57871bf5e6d7341a /lib/libc/locale
parent6dcf7eb45e20535578508ee51978e5e72e4b2a63 (diff)
downloadFreeBSD-src-d78838150270c66b44c82589786bdba7408ee7a1.zip
FreeBSD-src-d78838150270c66b44c82589786bdba7408ee7a1.tar.gz
Fix incorrect code in an example. The previous example would produce
19 column positions wide in the first line and 20 in the rest of the lines. This fixes the example to provide the correct output. PR: 53454 Noticed by: Kuang-che Wu <kcwu@kcwu.homeip.net> Submitted by: Marc Silver <marcs@draenor.org> Approved by: re (scottl)
Diffstat (limited to 'lib/libc/locale')
-rw-r--r--lib/libc/locale/wcwidth.310
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/libc/locale/wcwidth.3 b/lib/libc/locale/wcwidth.3
index 06c0067..c87c7ed 100644
--- a/lib/libc/locale/wcwidth.3
+++ b/lib/libc/locale/wcwidth.3
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd August 12, 2004
+.Dd August 17, 2004
.Dt WCWIDTH 3
.Os
.Sh NAME
@@ -65,10 +65,16 @@ int column, w;
column = 0;
while ((ch = getwchar()) != WEOF) {
+<<<<<<< wcwidth.3
+ if ((w = wcwidth(ch)) > 0)
+ column += w;
+ if (column > 20) {
+=======
w = wcwidth(ch);
if (w > 0 && column + w >= 20) {
+>>>>>>> 1.4
putwchar(L'\en');
- column = 0;
+ column = w;
}
putwchar(ch);
if (ch == L'\en')
OpenPOWER on IntegriCloud