(blocking_factor, record_size): change type.
[midnight-commander.git] / lib / unixcompat.h
blobc5d3aac88b104adee63c704078e335325418c815
1 /** \file unixcompat.h
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.
9 */
11 #ifndef MC_UNIXCOMPAT_H
12 #define MC_UNIXCOMPAT_H
14 #include <fcntl.h> /* O_* macros */
15 #include <signal.h> /* sig_atomic_t */
16 #include <unistd.h>
18 #include <sys/types.h> /* BSD */
20 #ifdef MAJOR_IN_MKDEV
21 #include <sys/mkdev.h>
22 #elif defined MAJOR_IN_SYSMACROS
23 #include <sys/sysmacros.h>
24 #endif
26 #if defined(HAVE_STRING_H)
27 #include <string.h>
28 /* An ANSI string.h and pre-ANSI memory.h might conflict */
29 #elif defined(HAVE_MEMORY_H)
30 #include <memory.h>
31 #else
32 #include <strings.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> */
38 #include <unix.h>
39 #endif
41 /*** typedefs(not structures) and defined constants **********************************************/
43 #ifndef major
44 #warning major() is undefined. Device numbers will not be shown correctly.
45 #define major(devnum) (((devnum) >> 8) & 0xff)
46 #endif
48 #ifndef minor
49 #warning minor() is undefined. Device numbers will not be shown correctly.
50 #define minor(devnum) (((devnum) & 0xff))
51 #endif
53 #ifndef makedev
54 #warning makedev() is undefined. Device numbers will not be shown correctly.
55 #define makedev(major,minor) ((((major) & 0xff) << 8) | ((minor) & 0xff))
56 #endif
58 #ifndef STDIN_FILENO
59 #define STDIN_FILENO 0
60 #endif
62 #ifndef STDOUT_FILENO
63 #define STDOUT_FILENO 1
64 #endif
66 #ifndef STDERR_FILENO
67 #define STDERR_FILENO 2
68 #endif
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
74 #endif
75 #ifdef __BEOS__
76 /* BeOS 5 has O_BINARY, but it has no effect. */
77 #undef O_BINARY
78 #endif
79 /* On reasonable systems, binary I/O is the default. */
80 #ifndef O_BINARY
81 #define O_BINARY 0
82 #endif
84 /* Replacement for O_NONBLOCK */
85 #ifndef O_NONBLOCK
86 #ifdef O_NDELAY /* SYSV */
87 #define O_NONBLOCK O_NDELAY
88 #else /* BSD */
89 #define O_NONBLOCK FNDELAY
90 #endif /* !O_NDELAY */
91 #endif /* !O_NONBLOCK */
93 /* Solaris9 doesn't have PRIXMAX */
94 #ifndef PRIXMAX
95 #define PRIXMAX PRIxMAX
96 #endif
98 /* ESC_CHAR is defined in /usr/include/langinfo.h in some systems */
99 #ifdef ESC_CHAR
100 #undef ESC_CHAR
101 #endif
102 /* AIX compiler doesn't understand '\e' */
103 #define ESC_CHAR '\033'
104 #define ESC_STR "\033"
106 /* OS specific defines */
107 #define PATH_SEP '/'
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 /*** enums ***************************************************************************************/
118 /*** structures declarations (and typedefs of structures)*****************************************/
120 /*** global variables defined in .c file *********************************************************/
122 /*** declarations of public functions ************************************************************/
124 /*** inline functions ****************************************************************************/
126 #endif