Mercurial > hg > toybox
comparison lib/lib.h @ 916:b92cb3cc9696
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.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sun, 02 Jun 2013 00:24:24 -0500 |
parents | 463a7b796e61 |
children | 07693eb46e26 |
comparison
equal
deleted
inserted
replaced
915:463a7b796e61 | 916:b92cb3cc9696 |
---|---|
178 void sigatexit(void *handler); | 178 void sigatexit(void *handler); |
179 int sig_to_num(char *pidstr); | 179 int sig_to_num(char *pidstr); |
180 char *num_to_sig(int sig); | 180 char *num_to_sig(int sig); |
181 | 181 |
182 mode_t string_to_mode(char *mode_str, mode_t base); | 182 mode_t string_to_mode(char *mode_str, mode_t base); |
183 void format_mode(char (*buf)[11], mode_t mode); | 183 void mode_to_string(mode_t mode, char *buf); |
184 | 184 |
185 // password helper functions | 185 // password helper functions |
186 int read_password(char * buff, int buflen, char* mesg); | 186 int read_password(char * buff, int buflen, char* mesg); |
187 int update_password(char *filename, char* username, char* encrypted); | 187 int update_password(char *filename, char* username, char* encrypted); |
188 | 188 |