Reverted the use of bool in favour of gboolean
[midnight-commander.git] / src / fs.h
blobb4ebe73153c0d832f141d9a35ad9aca0ff56c900
1 /* Include file to use opendir/closedir/readdir */
3 #ifndef MC_FS_H
4 #define MC_FS_H
6 #include <sys/types.h>
7 #ifdef HAVE_UNISTD_H
8 # include <unistd.h>
9 #endif
10 #include <sys/stat.h>
13 /* Replacement for permission bits missing in sys/stat.h */
14 #ifndef S_ISLNK
15 # define S_ISLNK(x) 0
16 #endif
18 #ifndef S_ISSOCK
19 # define S_ISSOCK(x) 0
20 #endif
22 #ifndef S_ISFIFO
23 # define S_ISFIFO(x) 0
24 #endif
26 #ifndef S_ISCHR
27 # define S_ISCHR(x) 0
28 #endif
30 #ifndef S_ISBLK
31 # define S_ISBLK(x) 0
32 #endif
34 /* Door is something that only exists on Solaris */
35 #ifndef S_ISDOOR
36 # define S_ISDOOR(x) 0
37 #endif
39 /* Special named files are widely used in QNX6 */
40 #ifndef S_ISNAM
41 # define S_ISNAM(x) 0
42 #endif
45 #ifndef MAXPATHLEN
46 # define MC_MAXPATHLEN 4096
47 #else
48 # define MC_MAXPATHLEN MAXPATHLEN
49 #endif
51 /* unistd.h defines _POSIX_VERSION on POSIX.1 systems. */
52 #ifdef HAVE_DIRENT_H
53 # include <dirent.h>
54 # define NLENGTH(dirent) (strlen ((dirent)->d_name))
55 # define DIRENT_LENGTH_COMPUTED 1
56 #elif defined(_MSC_VER)
57 /* dirent provided by glib */
58 # define NLENGTH(dirent) (strlen ((dirent)->d_name))
59 # define DIRENT_LENGTH_COMPUTED 1
60 #else
61 # define dirent direct
62 # define NLENGTH(dirent) ((dirent)->d_namlen)
64 # ifdef HAVE_SYS_NDIR_H
65 # include <sys/ndir.h>
66 # endif /* HAVE_SYS_NDIR_H */
68 # ifdef HAVE_SYS_DIR_H
69 # include <sys/dir.h>
70 # endif /* HAVE_SYS_DIR_H */
72 # ifdef HAVE_NDIR_H
73 # include <ndir.h>
74 # endif /* HAVE_NDIR_H */
75 #endif /* not (HAVE_DIRENT_H or _POSIX_VERSION) */
77 static inline void
78 compute_namelen (struct dirent *dent __attribute__ ((unused)))
80 #ifdef DIRENT_LENGTH_COMPUTED
81 return;
82 #else
83 dent->d_namlen = strlen (dent);
84 #endif
87 #endif