OSDN Git Service

Stat cleanup.
authorRob Landley <rob@landley.net>
Sun, 2 Jun 2013 05:24:24 +0000 (00:24 -0500)
committerRob Landley <rob@landley.net>
Sun, 2 Jun 2013 05:24:24 +0000 (00:24 -0500)
commit5a26a86cec424d728d43523988ca70aa56ee76c9
tree1fe0b2b665800d0cb25d3ab0a78f31cbe85e2acd
parent085f23692575e93142df2347cfe76dd173f23e16
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.
lib/lib.c
lib/lib.h
toys/pending/stat.c
toys/posix/ls.c