summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2016-10-02 16:30:10 -0400
committerTavian Barnes <tavianator@tavianator.com>2016-10-02 16:30:10 -0400
commitb2175be362b0a32d06d98369302d55b226b58ab1 (patch)
treefed6309efab2967279265a990637c38bffa33cc1 /eval.c
parent34fa233c66d6595e168fe114655857f14accfa3a (diff)
downloadbfs-b2175be362b0a32d06d98369302d55b226b58ab1.tar.xz
bftw: Add support for some exotic file types, where available.
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/eval.c b/eval.c
index dfc04ce..65a9186 100644
--- a/eval.c
+++ b/eval.c
@@ -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;