diff options
author | Rob Landley <rob@landley.net> | 2013-06-02 00:24:24 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2013-06-02 00:24:24 -0500 |
commit | 5a26a86cec424d728d43523988ca70aa56ee76c9 (patch) | |
tree | 1fe0b2b665800d0cb25d3ab0a78f31cbe85e2acd /toys/posix/ls.c | |
parent | 085f23692575e93142df2347cfe76dd173f23e16 (diff) | |
download | toybox-5a26a86cec424d728d43523988ca70aa56ee76c9.tar.gz |
Stat cleanup.
lib: rename format_mode() to mode_to_string() (echoing string_to_mode), make it
take a normal char * argument.
stat: collapse big switch/case statements that only have one line each
into if/else staircase (much fewer lines of code). Remove return type
(other stat implementations print ? for unknown escapes, so do that here).
Inline do_stat() and do_statfs(). Set default string in normal local
variable "format". Remove unnecessary struct d. Restructure stat logic to
"if (flagf && !statfs()) else if (!flagf && !stat()) else perror_msg();"
Teach %N to add -> symlink. Judicious use of putchar() instead of xputc to
let FILE * do its job collating output.
Diffstat (limited to 'toys/posix/ls.c')
-rw-r--r-- | toys/posix/ls.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/toys/posix/ls.c b/toys/posix/ls.c index 76fb7947..caabe7df 100644 --- a/toys/posix/ls.c +++ b/toys/posix/ls.c @@ -337,7 +337,7 @@ static void listfiles(int dirfd, struct dirtree *indir) struct tm *tm; char perm[11], thyme[64], *usr, *upad, *grp, *grpad; - format_mode(&perm, mode); + mode_to_string(mode, perm); tm = localtime(&(st->st_mtime)); strftime(thyme, sizeof(thyme), "%F %H:%M", tm); |