diff options
Diffstat (limited to 'src/includes/helpers.h')
-rw-r--r-- | src/includes/helpers.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/includes/helpers.h b/src/includes/helpers.h index c541f99a..1a00d3d0 100644 --- a/src/includes/helpers.h +++ b/src/includes/helpers.h @@ -53,6 +53,9 @@ } while (/* CONSTCOND */ 0) #endif +#include <stdbool.h> +#include <sys/stat.h> + _unused static void *xmalloc (size_t size) { void *value = malloc(size); @@ -104,4 +107,18 @@ _unused static const char *basename_c(const char *path) return (path); } +_unused static bool exists(const char *pathname) +{ + struct stat buf; + + return (stat(pathname, &buf) == 0); +} + +_unused static bool existss(const char *pathname) +{ + struct stat buf; + + return (stat(pathname, &buf) == 0 && buf.st_size != 0); +} + #endif |