diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2016-12-18 12:38:19 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2016-12-18 13:19:04 -0500 |
commit | 4b9592f93a68f88152b390898004e5e54b540cae (patch) | |
tree | 18930e6373e5e75aa2999f405971d7a29e4eebc8 /util.h | |
parent | 2ebbe75a8d272458cd3229b6033b2a5ce19b105b (diff) | |
download | bfs-4b9592f93a68f88152b390898004e5e54b540cae.tar.xz |
Implement -regex, -iregex, and -regextype/-E
Diffstat (limited to 'util.h')
-rw-r--r-- | util.h | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -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 |