Ticket #2434: fixed source file name of file operation.
[midnight-commander.git] / lib / fs.h
blobc3200dc7aa0f347a5f9fd4e50fdb32d0e388e2b1
1 /** \file fs.h
2 * \brief Header: fs compatibility definitions
3 */
5 /* Include file to use opendir/closedir/readdir */
7 #ifndef MC_FS_H
8 #define MC_FS_H
10 #include <sys/types.h>
11 #include <unistd.h>
12 #include <sys/stat.h>
13 #include <dirent.h>
15 /*** typedefs(not structures) and defined constants **********************************************/
17 /* Replacement for permission bits missing in sys/stat.h */
18 #ifndef S_ISLNK
19 #define S_ISLNK(x) 0
20 #endif
22 #ifndef S_ISSOCK
23 #define S_ISSOCK(x) 0
24 #endif
26 #ifndef S_ISFIFO
27 #define S_ISFIFO(x) 0
28 #endif
30 #ifndef S_ISCHR
31 #define S_ISCHR(x) 0
32 #endif
34 #ifndef S_ISBLK
35 #define S_ISBLK(x) 0
36 #endif
38 /* Door is something that only exists on Solaris */
39 #ifndef S_ISDOOR
40 #define S_ISDOOR(x) 0
41 #endif
43 /* Special named files are widely used in QNX6 */
44 #ifndef S_ISNAM
45 #define S_ISNAM(x) 0
46 #endif
48 #ifndef PATH_MAX
49 #ifdef _POSIX_VERSION
50 #define PATH_MAX _POSIX_PATH_MAX
51 #else
52 #ifdef MAXPATHLEN
53 #define PATH_MAX MAXPATHLEN
54 #else
55 #define PATH_MAX 1024
56 #endif
57 #endif
58 #endif
60 #ifndef MAXPATHLEN
61 #define MC_MAXPATHLEN 4096
62 #else
63 #define MC_MAXPATHLEN MAXPATHLEN
64 #endif
66 /* unistd.h defines _POSIX_VERSION on POSIX.1 systems. */
67 #define NLENGTH(dirent) (strlen ((dirent)->d_name))
68 #define DIRENT_LENGTH_COMPUTED 1
70 #ifndef MAXNAMLEN
71 #define MC_MAXFILENAMELEN 256
72 #else
73 #define MC_MAXFILENAMELEN MAXNAMLEN
74 #endif
76 /*** enums ***************************************************************************************/
78 /*** structures declarations (and typedefs of structures)*****************************************/
80 /*** global variables defined in .c file *********************************************************/
82 /*** declarations of public functions ************************************************************/
84 /*** inline functions ****************************************************************************/
86 static inline void
87 compute_namelen (struct dirent *dent __attribute__ ((unused)))
89 #ifdef DIRENT_LENGTH_COMPUTED
90 return;
91 #else
92 dent->d_namlen = strlen (dent);
93 #endif
96 #endif