From 0e1609c2f918547a3bde0bde7a53f5177a1e4b0b Mon Sep 17 00:00:00 2001 From: Roland Illig Date: Tue, 25 Jan 2005 22:54:41 +0000 Subject: [PATCH] * unixcompat.h: Provides macros and functions that are missing in some Unix variants. * Makefile.am: Added unixcompat.h. --- src/ChangeLog | 6 ++++++ src/Makefile.am | 2 +- src/unixcompat.h | 25 +++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 src/unixcompat.h diff --git a/src/ChangeLog b/src/ChangeLog index e4e8ee1a0..c5903ec8a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2005-01-25 Roland Illig + + * unixcompat.h: Provides macros and functions that are missing in + some Unix variants. + * Makefile.am: Added unixcompat.h. + 2005-01-25 Roland Illig * dialog.h (widget_msg_t): Added WIDGET_RESIZED to inform widgets diff --git a/src/Makefile.am b/src/Makefile.am index 680f161d0..9ccd0ed5b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -59,7 +59,7 @@ SRCS = achown.c achown.h background.c background.h boxes.c boxes.h \ slint.c subshell.c subshell.h textconf.c textconf.h \ tree.c tree.h treestore.c treestore.h tty.h user.c user.h \ util.c util.h utilunix.c view.c view.h vfsdummy.h widget.c \ - widget.h win.c win.h wtools.c wtools.h + widget.h win.c win.h wtools.c wtools.h unixcompat.h if CHARSET mc_SOURCES = $(SRCS) $(CHARSET_SRC) diff --git a/src/unixcompat.h b/src/unixcompat.h new file mode 100644 index 000000000..434d2ea39 --- /dev/null +++ b/src/unixcompat.h @@ -0,0 +1,25 @@ +#ifndef MC_UNIXCOMPAT_H +#define MC_UNIXCOMPAT_H + +/* 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. + */ + +#include /* BSD */ +#ifdef HAVE_SYS_MKDEV_H +# include /* Solaris 9 */ +#endif + +#ifndef major +# define major(devnum) (((devnum) >> 8) & 0xff) +#endif +#ifndef minor +# define minor(devnum) (((devnum) & 0xff) +#endif + +#endif