summaryrefslogtreecommitdiffstats
path: root/util.h
diff options
context:
space:
mode:
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