diff options
-rw-r--r-- | toys/posix/ls.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/toys/posix/ls.c b/toys/posix/ls.c index 44915fa7..f9511989 100644 --- a/toys/posix/ls.c +++ b/toys/posix/ls.c @@ -422,6 +422,13 @@ static void listfiles(int dirfd, struct dirtree *indir) mode_to_string(mode, perm); printf("%s% *ld", perm, totals[2]+1, (long)st->st_nlink); + // print user + if (!(flags&FLAG_g)) { + if (flags&FLAG_n) sprintf(ss = thyme, "%u", (unsigned)st->st_uid); + else strwidth(ss = getusername(st->st_uid)); + printf(" %*s", (int)totals[3], ss); + } + // print group if (!(flags&FLAG_o)) { if (flags&FLAG_n) sprintf(ss = thyme, "%u", (unsigned)st->st_gid); @@ -429,12 +436,6 @@ static void listfiles(int dirfd, struct dirtree *indir) printf(" %*s", (int)totals[4], ss); } - if (!(flags&FLAG_g)) { - if (flags&FLAG_n) sprintf(ss = thyme, "%u", (unsigned)st->st_uid); - else strwidth(ss = getusername(st->st_uid)); - printf(" %*s", (int)totals[3], ss); - } - if (flags & FLAG_Z) printf(" %*s", -(int)totals[7], (char *)sort[next]->extra); |