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 /bftw.c | |
parent | 34fa233c66d6595e168fe114655857f14accfa3a (diff) | |
download | bfs-b2175be362b0a32d06d98369302d55b226b58ab1.tar.xz |
bftw: Add support for some exotic file types, where available.
Diffstat (limited to 'bftw.c')
-rw-r--r-- | bftw.c | 60 |
1 files changed, 59 insertions, 1 deletions
@@ -464,29 +464,58 @@ static void dirqueue_free(struct dirqueue *queue) { /** Fill in ftwbuf fields with information from a struct dirent. */ static void ftwbuf_use_dirent(struct BFTW *ftwbuf, const struct dirent *de) { -#if defined(_DIRENT_HAVE_D_TYPE) || defined(DT_DIR) +#if defined(_DIRENT_HAVE_D_TYPE) || defined(DT_UNKNOWN) switch (de->d_type) { +#ifdef DT_BLK case DT_BLK: ftwbuf->typeflag = BFTW_BLK; break; +#endif +#ifdef DT_CHR case DT_CHR: ftwbuf->typeflag = BFTW_CHR; break; +#endif +#ifdef DT_DIR case DT_DIR: ftwbuf->typeflag = BFTW_DIR; break; +#endif +#ifdef DT_DOOR + case DT_DOOR: + ftwbuf->typeflag = BFTW_DOOR; + break; +#endif +#ifdef DT_FIFO case DT_FIFO: ftwbuf->typeflag = BFTW_FIFO; break; +#endif +#ifdef DT_LNK case DT_LNK: ftwbuf->typeflag = BFTW_LNK; break; +#endif +#ifdef DT_PORT + case DT_PORT: + ftwbuf->typeflag = BFTW_PORT; + break; +#endif +#ifdef DT_REG case DT_REG: ftwbuf->typeflag = BFTW_REG; break; +#endif +#ifdef DT_SOCK case DT_SOCK: ftwbuf->typeflag = BFTW_SOCK; break; +#endif +#ifdef DT_WHT + case DT_WHT: + ftwbuf->typeflag = BFTW_WHT; + break; +#endif } #endif } @@ -501,27 +530,56 @@ static int ftwbuf_stat(struct BFTW *ftwbuf, struct stat *sb, int flags) { ftwbuf->statbuf = sb; switch (sb->st_mode & S_IFMT) { +#ifdef S_IFBLK case S_IFBLK: ftwbuf->typeflag = BFTW_BLK; break; +#endif +#ifdef S_IFCHR case S_IFCHR: ftwbuf->typeflag = BFTW_CHR; break; +#endif +#ifdef S_IFDIR case S_IFDIR: ftwbuf->typeflag = BFTW_DIR; break; +#endif +#ifdef S_IFDOOR + case S_IFDOOR: + ftwbuf->typeflag = BFTW_DOOR; + break; +#endif +#ifdef S_IFIFO case S_IFIFO: ftwbuf->typeflag = BFTW_FIFO; break; +#endif +#ifdef S_IFLNK case S_IFLNK: ftwbuf->typeflag = BFTW_LNK; break; +#endif +#ifdef S_IFPORT + case S_IFPORT: + ftwbuf->typeflag = BFTW_PORT; + break; +#endif +#ifdef S_IFREG case S_IFREG: ftwbuf->typeflag = BFTW_REG; break; +#endif +#ifdef S_IFSOCK case S_IFSOCK: ftwbuf->typeflag = BFTW_SOCK; break; +#endif +#ifdef S_IFWHT + case S_IFWHT: + ftwbuf->typeflag = BFTW_WHT; + break; +#endif } return 0; |