mceditor: refactoring.
[midnight-commander.git] / lib / unixcompat.h
blobc7ff12ded8e01f94e418defca407af3c4fa1e115
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 #include <unistd.h>
24 /*** typedefs(not structures) and defined constants **********************************************/
26 #ifndef major
27 #warning major() is undefined. Device numbers will not be shown correctly.
28 #define major(devnum) (((devnum) >> 8) & 0xff)
29 #endif
31 #ifndef minor
32 #warning minor() is undefined. Device numbers will not be shown correctly.
33 #define minor(devnum) (((devnum) & 0xff))
34 #endif
36 #ifndef makedev
37 #warning makedev() is undefined. Device numbers will not be shown correctly.
38 #define makedev(major,minor) ((((major) & 0xff) << 8) | ((minor) & 0xff))
39 #endif
41 #ifndef STDIN_FILENO
42 #define STDIN_FILENO 0
43 #endif
45 #ifndef STDOUT_FILENO
46 #define STDOUT_FILENO 1
47 #endif
49 #ifndef STDERR_FILENO
50 #define STDERR_FILENO 2
51 #endif
53 /*** enums ***************************************************************************************/
55 /*** structures declarations (and typedefs of structures)*****************************************/
57 /*** global variables defined in .c file *********************************************************/
59 /*** declarations of public functions ************************************************************/
61 /*** inline functions ****************************************************************************/
63 #endif