Merge branch '3867_mcedit_c_macro'
[midnight-commander.git] / lib / unixcompat.h
blob627dc4b1797748c8f335c7260b2af1854d68160d
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 <sys/types.h> /* BSD */
16 #ifdef MAJOR_IN_MKDEV
17 #include <sys/mkdev.h>
18 #elif defined MAJOR_IN_SYSMACROS
19 #include <sys/sysmacros.h>
20 #endif
22 #if defined(_AIX)
23 #include <time.h> /* AIX for tm */
24 #endif
26 #include <unistd.h>
28 /*** typedefs(not structures) and defined constants **********************************************/
30 #ifndef major
31 #warning major() is undefined. Device numbers will not be shown correctly.
32 #define major(devnum) (((devnum) >> 8) & 0xff)
33 #endif
35 #ifndef minor
36 #warning minor() is undefined. Device numbers will not be shown correctly.
37 #define minor(devnum) (((devnum) & 0xff))
38 #endif
40 #ifndef makedev
41 #warning makedev() is undefined. Device numbers will not be shown correctly.
42 #define makedev(major,minor) ((((major) & 0xff) << 8) | ((minor) & 0xff))
43 #endif
45 #ifndef STDIN_FILENO
46 #define STDIN_FILENO 0
47 #endif
49 #ifndef STDOUT_FILENO
50 #define STDOUT_FILENO 1
51 #endif
53 #ifndef STDERR_FILENO
54 #define STDERR_FILENO 2
55 #endif
57 /*** enums ***************************************************************************************/
59 /*** structures declarations (and typedefs of structures)*****************************************/
61 /*** global variables defined in .c file *********************************************************/
63 /*** declarations of public functions ************************************************************/
65 /*** inline functions ****************************************************************************/
67 #endif