From 4b9592f93a68f88152b390898004e5e54b540cae Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sun, 18 Dec 2016 12:38:19 -0500 Subject: Implement -regex, -iregex, and -regextype/-E --- util.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'util.h') diff --git a/util.h b/util.h index f65e9f5..4fd5962 100644 --- a/util.h +++ b/util.h @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -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 -- cgit v1.2.3