summaryrefslogtreecommitdiffstats
path: root/util.h
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2017-03-11 16:41:37 -0500
committerTavian Barnes <tavianator@tavianator.com>2017-03-11 16:41:37 -0500
commiteb18f806da9d39e21362080ab4f4ab816eeeb0d5 (patch)
treec75df495cc6a32cb55847f3cbc3dac89d3ad7758 /util.h
parent74bd445d659bd619d76e109f7b02bb7714eed95f (diff)
downloadbfs-eb18f806da9d39e21362080ab4f4ab816eeeb0d5.tar.xz
Implement -ls and -fls
Diffstat (limited to 'util.h')
-rw-r--r--util.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/util.h b/util.h
index 8fa775d..553f37d 100644
--- a/util.h
+++ b/util.h
@@ -18,6 +18,7 @@
#include <regex.h>
#include <stdbool.h>
#include <sys/stat.h>
+#include <time.h>
// 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