From eb18f806da9d39e21362080ab4f4ab816eeeb0d5 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sat, 11 Mar 2017 16:41:37 -0500 Subject: Implement -ls and -fls --- util.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'util.h') diff --git a/util.h b/util.h index 8fa775d..553f37d 100644 --- a/util.h +++ b/util.h @@ -18,6 +18,7 @@ #include #include #include +#include // Some portability concerns @@ -101,4 +102,25 @@ int dup_cloexec(int fd); */ char *xregerror(int err, const regex_t *regex); +/** + * localtime_r() wrapper that calls tzset() first. + * + * @param timep + * The time_t to convert. + * @param result + * Buffer to hold the result. + * @return 0 on success, -1 on failure. + */ +int xlocaltime(const time_t *timep, struct tm *result); + +/** + * Format a mode like ls -l (e.g. -rw-r--r--). + * + * @param mode + * The mode to format. + * @param str + * The string to hold the formatted mode. + */ +void format_mode(mode_t mode, char str[11]); + #endif // BFS_UTIL_H -- cgit v1.2.3