2 * \brief Header: collects differences between the various Unix
4 * This header file collects differences between the various Unix
5 * variants that are supported by the Midnight Commander and provides
6 * replacement routines if they are not natively available.
7 * The major/minor macros are not specified in SUSv3, so we can only hope
8 * they are provided by the operating system or emulate it.
11 #ifndef MC_UNIXCOMPAT_H
12 #define MC_UNIXCOMPAT_H
14 #include <fcntl.h> /* O_* macros */
15 #include <signal.h> /* sig_atomic_t */
18 #include <sys/types.h> /* BSD */
21 #include <sys/mkdev.h>
22 #elif defined MAJOR_IN_SYSMACROS
23 #include <sys/sysmacros.h>
26 #if defined(HAVE_STRING_H)
28 /* An ANSI string.h and pre-ANSI memory.h might conflict */
29 #elif defined(HAVE_MEMORY_H)
33 /* memory and strings.h conflict on other systems */
34 #endif /* !STDC_HEADERS & !HAVE_STRING_H */
36 #if defined(__QNX__) && !defined(__QNXNTO__)
37 /* exec*() from <process.h> */
41 /*** typedefs(not structures) and defined constants **********************************************/
44 #warning major() is undefined. Device numbers will not be shown correctly.
45 #define major(devnum) (((devnum) >> 8) & 0xff)
49 #warning minor() is undefined. Device numbers will not be shown correctly.
50 #define minor(devnum) (((devnum) & 0xff))
54 #warning makedev() is undefined. Device numbers will not be shown correctly.
55 #define makedev(major,minor) ((((major) & 0xff) << 8) | ((minor) & 0xff))
59 #define STDIN_FILENO 0
63 #define STDOUT_FILENO 1
67 #define STDERR_FILENO 2
70 /* The O_BINARY definition was taken from gettext */
71 #if !defined O_BINARY && defined _O_BINARY
72 /* For MSC-compatible compilers. */
73 #define O_BINARY _O_BINARY
76 /* BeOS 5 has O_BINARY, but it has no effect. */
79 /* On reasonable systems, binary I/O is the default. */
84 /* Replacement for O_NONBLOCK */
86 #ifdef O_NDELAY /* SYSV */
87 #define O_NONBLOCK O_NDELAY
89 #define O_NONBLOCK FNDELAY
90 #endif /* !O_NDELAY */
91 #endif /* !O_NONBLOCK */
93 /* Solaris9 doesn't have PRIXMAX */
95 #define PRIXMAX PRIxMAX
98 /* ESC_CHAR is defined in /usr/include/langinfo.h in some systems */
102 /* AIX compiler doesn't understand '\e' */
103 #define ESC_CHAR '\033'
104 #define ESC_STR "\033"
106 /* OS specific defines */
108 #define PATH_SEP_STR "/"
109 #define IS_PATH_SEP(c) ((c) == PATH_SEP)
110 #define PATH_ENV_SEP ':'
111 #define TMPDIR_DEFAULT "/tmp"
112 #define SCRIPT_SUFFIX ""
113 #define get_default_editor() "vi"
114 #define OS_SORT_CASE_SENSITIVE_DEFAULT TRUE
116 /* struct stat members */
118 #define st_atim st_atimespec
119 #define st_ctim st_ctimespec
120 #define st_mtim st_mtimespec
123 /*** enums ***************************************************************************************/
125 /*** structures declarations (and typedefs of structures)*****************************************/
127 /*** global variables defined in .c file *********************************************************/
129 /*** declarations of public functions ************************************************************/
131 /*** inline functions ****************************************************************************/