diff options
Diffstat (limited to 'lib/convert.c')
-rw-r--r-- | lib/convert.c | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/lib/convert.c b/lib/convert.c index c3e011d..899b5fd 100644 --- a/lib/convert.c +++ b/lib/convert.c @@ -67,66 +67,3 @@ bool prefix(const char* pre, const char* str) { return strncmp(pre, str, strlen(pre)) == 0; } -static char fs_types[5] = {'K','M','G','T','P'}; -void print_file_size(size_t bytes, char buf[5]) { - int index, n; - float next; - - index = 0; - next = bytes; - - while (true) { - if (next < 1000) { - break; - } - - if (index == 5) { - printf("999P"); - return; - } - - next /= 1024; - index++; - } - - n = snprintf(buf, 4, "%u", (int)(next+.5)); - - if (index > 0) { - buf[n] = (fs_types[index - 1]); - n++; - } - - buf[n] = '\0'; -} - -static char* months[12] = - {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; -void print_date_time(time_t mills, char buf[13]) { - struct tm* info; - int n; - - info = localtime(&mills); - n = snprintf(buf, 5, "%s ", months[info->tm_mon]); - - if (info->tm_mday < 10) { - buf[n] = ' '; - n++; - } - - snprintf(buf + n, 13 - n, "%d %02d:%02d ", info->tm_mday, info->tm_hour, info->tm_sec); -} - -void print_file_path(char* path) { - if (streql("-", path)) { - printf("(standard input)"); - } else { - printf("%s", path); - } -} - -void nuke_str(char* type) { - *type = 0; - while(*(++type)) { - *type = 0; - } -} |