diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 17:44:12 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 17:44:12 +0000 |
commit | 8ccb487c21368a7fdc8c7c72315325bf0aa06147 (patch) | |
tree | b2056fae01d325924508a41731edfbd4c3cddd23 /lib/unixcompat.h | |
parent | Initial commit. (diff) | |
download | mc-8ccb487c21368a7fdc8c7c72315325bf0aa06147.tar.xz mc-8ccb487c21368a7fdc8c7c72315325bf0aa06147.zip |
Adding upstream version 3:4.8.29.upstream/3%4.8.29upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | lib/unixcompat.h | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/lib/unixcompat.h b/lib/unixcompat.h new file mode 100644 index 0000000..c7ff12d --- /dev/null +++ b/lib/unixcompat.h @@ -0,0 +1,63 @@ +/** \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 */ + +#ifdef MAJOR_IN_MKDEV +#include <sys/mkdev.h> +#elif defined MAJOR_IN_SYSMACROS +#include <sys/sysmacros.h> +#endif + +#include <unistd.h> + +/*** 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 + +#ifndef STDIN_FILENO +#define STDIN_FILENO 0 +#endif + +#ifndef STDOUT_FILENO +#define STDOUT_FILENO 1 +#endif + +#ifndef STDERR_FILENO +#define STDERR_FILENO 2 +#endif + +/*** enums ***************************************************************************************/ + +/*** structures declarations (and typedefs of structures)*****************************************/ + +/*** global variables defined in .c file *********************************************************/ + +/*** declarations of public functions ************************************************************/ + +/*** inline functions ****************************************************************************/ + +#endif |