Ticket #2021 (MarkFileDown/MarkFileUp)
[midnight-commander.git] / lib / fs.h
blob9fa0c01973e7aaad883f7388440874be82c32fad
2 /** \file fs.h
3 * \brief Header: fs compatibility definitions
4 */
6 /* Include file to use opendir/closedir/readdir */
8 #ifndef MC_FS_H
9 #define MC_FS_H
11 #include <sys/types.h>
12 #include <unistd.h>
13 #include <sys/stat.h>
16 /* Replacement for permission bits missing in sys/stat.h */
17 #ifndef S_ISLNK
18 # define S_ISLNK(x) 0
19 #endif
21 #ifndef S_ISSOCK
22 # define S_ISSOCK(x) 0
23 #endif
25 #ifndef S_ISFIFO
26 # define S_ISFIFO(x) 0
27 #endif
29 #ifndef S_ISCHR
30 # define S_ISCHR(x) 0
31 #endif
33 #ifndef S_ISBLK
34 # define S_ISBLK(x) 0
35 #endif
37 /* Door is something that only exists on Solaris */
38 #ifndef S_ISDOOR
39 # define S_ISDOOR(x) 0
40 #endif
42 /* Special named files are widely used in QNX6 */
43 #ifndef S_ISNAM
44 # define S_ISNAM(x) 0
45 #endif
48 #ifndef MAXPATHLEN
49 # define MC_MAXPATHLEN 4096
50 #else
51 # define MC_MAXPATHLEN MAXPATHLEN
52 #endif
54 /* unistd.h defines _POSIX_VERSION on POSIX.1 systems. */
55 #include <dirent.h>
56 #define NLENGTH(dirent) (strlen ((dirent)->d_name))
57 #define DIRENT_LENGTH_COMPUTED 1
59 static inline void
60 compute_namelen (struct dirent *dent __attribute__ ((unused)))
62 #ifdef DIRENT_LENGTH_COMPUTED
63 return;
64 #else
65 dent->d_namlen = strlen (dent);
66 #endif
69 #endif