summaryrefslogtreecommitdiffstats
path: root/util.h
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2016-12-18 12:38:19 -0500
committerTavian Barnes <tavianator@tavianator.com>2016-12-18 13:19:04 -0500
commit4b9592f93a68f88152b390898004e5e54b540cae (patch)
tree18930e6373e5e75aa2999f405971d7a29e4eebc8 /util.h
parent2ebbe75a8d272458cd3229b6033b2a5ce19b105b (diff)
downloadbfs-4b9592f93a68f88152b390898004e5e54b540cae.tar.xz
Implement -regex, -iregex, and -regextype/-E
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