From fea6d56777a3063b5af8b262df2a4a2573142962 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 8 Apr 2017 13:52:18 -0500 Subject: Fix the ls -m test (which is just a whitespace issue, but eh). While we're at it, ls -m wordwrap was one column early. --- toys/posix/ls.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'toys/posix/ls.c') diff --git a/toys/posix/ls.c b/toys/posix/ls.c index d2a2e466..da0a142d 100644 --- a/toys/posix/ls.c +++ b/toys/posix/ls.c @@ -388,7 +388,6 @@ static void listfiles(int dirfd, struct dirtree *indir) } // Loop through again to produce output. - memset(toybuf, ' ', 256); width = 0; for (ul = 0; ul TT.screen_width) { + } else if ((flags & FLAG_1) || width+1+*len > TT.screen_width) { xputc('\n'); width = 0; } else { - printf(" "); - width += 2; + printf(" "+mm); + width += 2-mm; } } width += *len; @@ -498,7 +499,7 @@ static void listfiles(int dirfd, struct dirtree *indir) // Pad columns if (flags & (FLAG_C|FLAG_x)) { curcol = colsizes[curcol]-(*len)-totpad; - if (curcol < 255) printf("%s", toybuf+255-curcol); + if (curcol < 255) printf("%*c", curcol, ' '); } } -- cgit v1.2.3