mc/lib/unixcompat.h
Andrew Borodin 14973bfe79 Use AC_HEADER_MAJOR.
Instead of checking for sys/mkdev.h headerfile, there is the
AC_HEADER_MAJOR helper for how to get major(), minor(), makedev().

Sinc with GLib efb1701bf3baf6f5b05fd1a7a5a4ff990a7dc460.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-11-25 13:47:40 +04:00

54 lines
1.7 KiB
C

/** \file unixcompat.h
* \brief Header: collects differences between the various Unix
*
* This header file collects differences between the various Unix
* variants that are supported by the Midnight Commander and provides
* replacement routines if they are not natively available.
* The major/minor macros are not specified in SUSv3, so we can only hope
* they are provided by the operating system or emulate it.
*/
#ifndef MC_UNIXCOMPAT_H
#define MC_UNIXCOMPAT_H
#include <sys/types.h> /* BSD */
#if MAJOR_IN_MKDEV
#include <sys/mkdev.h>
#elif MAJOR_IN_SYSMACROS
#include <sys/sysmacros.h>
#endif
#if defined(_AIX)
#include <time.h> /* AIX for tm */
#endif
/*** typedefs(not structures) and defined constants **********************************************/
#ifndef major
#warning major() is undefined. Device numbers will not be shown correctly.
#define major(devnum) (((devnum) >> 8) & 0xff)
#endif
#ifndef minor
#warning minor() is undefined. Device numbers will not be shown correctly.
#define minor(devnum) (((devnum) & 0xff))
#endif
#ifndef makedev
#warning makedev() is undefined. Device numbers will not be shown correctly.
#define makedev(major,minor) ((((major) & 0xff) << 8) | ((minor) & 0xff))
#endif
/*** enums ***************************************************************************************/
/*** structures declarations (and typedefs of structures)*****************************************/
/*** global variables defined in .c file *********************************************************/
/*** declarations of public functions ************************************************************/
/*** inline functions ****************************************************************************/
#endif