diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2016-10-02 16:30:10 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2016-10-02 16:30:10 -0400 |
commit | b2175be362b0a32d06d98369302d55b226b58ab1 (patch) | |
tree | fed6309efab2967279265a990637c38bffa33cc1 /eval.c | |
parent | 34fa233c66d6595e168fe114655857f14accfa3a (diff) | |
download | bfs-b2175be362b0a32d06d98369302d55b226b58ab1.tar.xz |
bftw: Add support for some exotic file types, where available.
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 23 |
1 files changed, 22 insertions, 1 deletions
@@ -26,6 +26,18 @@ #include <time.h> #include <unistd.h> +#ifndef S_ISDOOR +# define S_ISDOOR(mode) false +#endif + +#ifndef S_ISPORT +# define S_ISPORT(mode) false +#endif + +#ifndef S_ISWHT +# define S_ISWHT(mode) false +#endif + struct eval_state { /** Data about the current file. */ struct BFTW *ftwbuf; @@ -722,21 +734,30 @@ bool eval_xtype(const struct expr *expr, struct eval_state *state) { } } - switch (expr->idata) { + switch ((enum bftw_typeflag)expr->idata) { + case BFTW_UNKNOWN: + case BFTW_ERROR: + break; case BFTW_BLK: return S_ISBLK(sb.st_mode); case BFTW_CHR: return S_ISCHR(sb.st_mode); case BFTW_DIR: return S_ISDIR(sb.st_mode); + case BFTW_DOOR: + return S_ISDOOR(sb.st_mode); case BFTW_FIFO: return S_ISFIFO(sb.st_mode); case BFTW_LNK: return S_ISLNK(sb.st_mode); + case BFTW_PORT: + return S_ISPORT(sb.st_mode); case BFTW_REG: return S_ISREG(sb.st_mode); case BFTW_SOCK: return S_ISSOCK(sb.st_mode); + case BFTW_WHT: + return S_ISWHT(sb.st_mode); } return false; |