From feb349458e8ae17ede636716ccfa9d97e63f30b1 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sat, 6 Mar 2021 14:06:01 -0500 Subject: Support -flags on all the BSDs --- util.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'util.h') diff --git a/util.h b/util.h index ed47aa2..ca90494 100644 --- a/util.h +++ b/util.h @@ -74,6 +74,10 @@ # define BFS_HAS_SYS_XATTR BFS_HAS_INCLUDE(, __linux__) #endif +#ifndef BFS_HAS_UTIL +# define BFS_HAS_UTIL BFS_HAS_INCLUDE(, __NetBSD__) +#endif + #if !defined(FNM_CASEFOLD) && defined(FNM_IGNORECASE) # define FNM_CASEFOLD FNM_IGNORECASE #endif @@ -179,6 +183,21 @@ const char *xbasename(const char *path); */ int xfaccessat(int fd, const char *path, int amode); +/** + * Portability wrapper for strtofflags(). + * + * @param str + * The string to parse. The pointee will be advanced to the first + * invalid position on error. + * @param set + * The flags that are set in the string. + * @param clear + * The flags that are cleared in the string. + * @return + * 0 on success, -1 on failure. + */ +int xstrtofflags(const char **str, unsigned long long *set, unsigned long long *clear); + /** * Return whether an error code is due to a path not existing. */ -- cgit v1.2.3