aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
diff options
context:
space:
mode:
Diffstat (limited to 'toys/posix')
-rw-r--r--toys/posix/ls.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/toys/posix/ls.c b/toys/posix/ls.c
index b955c41d..3a7de63d 100644
--- a/toys/posix/ls.c
+++ b/toys/posix/ls.c
@@ -75,12 +75,12 @@ int strwidth(char *s)
len = mbrtowc(&c, s, MB_CUR_MAX, 0);
if (len < 1 || (width = wcwidth(c)) < 0) {
total++;
- if (toys.optflags & FLAG_q) *(s++) = '?';
-
- continue;
+ if (toys.optflags & FLAG_q) *s = '?';
+ s++;
+ } else {
+ s += len;
+ total += width;
}
- s += len;
- total += width;
}
return total;