summaryrefslogtreecommitdiffstats
path: root/bin/ls
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2004-05-03 11:48:55 +0000
committertjr <tjr@FreeBSD.org>2004-05-03 11:48:55 +0000
commit02199e79066551ed04e93c3565e543f28994bb8d (patch)
tree57b6848934ae1f6a3b0f7e5dfa2f02178c892cc1 /bin/ls
parent978577176877b95751545d834ac6f10bdad0bc71 (diff)
downloadFreeBSD-src-02199e79066551ed04e93c3565e543f28994bb8d.zip
FreeBSD-src-02199e79066551ed04e93c3565e543f28994bb8d.tar.gz
Only add the widths together for printable characters in prn_normal();
unprintable characters have a "width" of -1.
Diffstat (limited to 'bin/ls')
-rw-r--r--bin/ls/util.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/bin/ls/util.c b/bin/ls/util.c
index a7b8208..36122df 100644
--- a/bin/ls/util.c
+++ b/bin/ls/util.c
@@ -79,7 +79,8 @@ prn_normal(const char *s)
for (i = 0; i < (int)clen; i++)
putchar((unsigned char)s[i]);
s += clen;
- n += wcwidth(wc);
+ if (iswprint(wc))
+ n += wcwidth(wc);
}
return (n);
}
OpenPOWER on IntegriCloud