From 5a26a86cec424d728d43523988ca70aa56ee76c9 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sun, 2 Jun 2013 00:24:24 -0500 Subject: 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.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/lib.h') diff --git a/lib/lib.h b/lib/lib.h index b5c308c6..131f9c44 100644 --- a/lib/lib.h +++ b/lib/lib.h @@ -180,7 +180,7 @@ int sig_to_num(char *pidstr); char *num_to_sig(int sig); mode_t string_to_mode(char *mode_str, mode_t base); -void format_mode(char (*buf)[11], mode_t mode); +void mode_to_string(mode_t mode, char *buf); // password helper functions int read_password(char * buff, int buflen, char* mesg); -- cgit v1.2.3