summaryrefslogtreecommitdiffstats
path: root/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'util.h')
-rw-r--r--util.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/util.h b/util.h
index f65e9f5..4fd5962 100644
--- a/util.h
+++ b/util.h
@@ -15,6 +15,7 @@
#include <dirent.h>
#include <fcntl.h>
#include <fnmatch.h>
+#include <regex.h>
#include <stdbool.h>
#include <sys/stat.h>
@@ -30,10 +31,6 @@
# define FNM_CASEFOLD FNM_IGNORECASE
#endif
-#ifndef O_DIRECTORY
-# define O_DIRECTORY 0
-#endif
-
#ifndef S_ISDOOR
# define S_ISDOOR(mode) false
#endif
@@ -80,4 +77,15 @@ int redirect(int fd, const char *path, int flags, ...);
*/
int dup_cloexec(int fd);
+/**
+ * Dynamically allocate a regex error message.
+ *
+ * @param err
+ * The error code to stringify.
+ * @param regex
+ * The (partially) compiled regex.
+ * @return A human-readable description of the error, allocated with malloc().
+ */
+char *xregerror(int err, const regex_t *regex);
+
#endif // BFS_UTIL_H