From b6829693676c882ecb0d8ebc0a3a083e5e38131e Mon Sep 17 00:00:00 2001 From: Edgar Toernig Date: Sat, 30 Apr 2005 09:51:03 -0700 Subject: [PATCH] compat: missing dirent.d_type field Not everybody has "d_type". diff --git a/cache.h b/cache.h index a10243d..af63458 100644 --- a/cache.h +++ b/cache.h @@ -21,6 +21,15 @@ #define deflateBound(c,s) ((s) + (((s) + 7) >> 3) + (((s) + 63) >> 6) + 11) #endif +#ifdef DT_UNKNOWN +#define DTYPE(de) ((de)->d_type) +#else +#define DT_UNKNOWN 0 +#define DT_DIR 1 +#define DT_REG 2 +#define DTYPE(de) DT_UNKNOWN +#endif + /* * Basic data structures for the directory cache * diff --git a/show-files.c b/show-files.c index d4061f8..c63c7aa 100644 --- a/show-files.c +++ b/show-files.c @@ -129,7 +129,7 @@ static void read_directory(const char *path, const char *base, int baselen) len = strlen(de->d_name); memcpy(fullname + baselen, de->d_name, len+1); - switch (de->d_type) { + switch (DTYPE(de)) { struct stat st; default: continue; -- cgit v0.10.2-6-g49f6