mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-18 09:19:24 +03:00
Move OS-specific stuff from lib/global.h to lib/unixcompat.h.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
a2f65852e3
commit
1bae2c678f
99
lib/global.h
99
lib/global.h
@ -7,69 +7,16 @@
|
|||||||
#ifndef MC_GLOBAL_H
|
#ifndef MC_GLOBAL_H
|
||||||
#define MC_GLOBAL_H
|
#define MC_GLOBAL_H
|
||||||
|
|
||||||
#if defined(HAVE_STRING_H)
|
|
||||||
#include <string.h>
|
|
||||||
/* An ANSI string.h and pre-ANSI memory.h might conflict */
|
|
||||||
#elif defined(HAVE_MEMORY_H)
|
|
||||||
#include <memory.h>
|
|
||||||
#else
|
|
||||||
#include <strings.h>
|
|
||||||
/* memory and strings.h conflict on other systems */
|
|
||||||
#endif /* !STDC_HEADERS & !HAVE_STRING_H */
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_PARAM_H
|
|
||||||
#include <sys/param.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* for O_* macros */
|
|
||||||
#include <fcntl.h>
|
|
||||||
|
|
||||||
/* for sig_atomic_t */
|
|
||||||
#include <signal.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_FUNC_ATTRIBUTE_FALLTHROUGH
|
|
||||||
#define MC_FALLTHROUGH __attribute__((fallthrough))
|
|
||||||
#else
|
|
||||||
#define MC_FALLTHROUGH
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*** typedefs(not structures) and defined constants **********************************************/
|
|
||||||
|
|
||||||
/* The O_BINARY definition was taken from gettext */
|
|
||||||
#if !defined O_BINARY && defined _O_BINARY
|
|
||||||
/* For MSC-compatible compilers. */
|
|
||||||
#define O_BINARY _O_BINARY
|
|
||||||
#endif
|
|
||||||
#ifdef __BEOS__
|
|
||||||
/* BeOS 5 has O_BINARY, but is has no effect. */
|
|
||||||
#undef O_BINARY
|
|
||||||
#endif
|
|
||||||
/* On reasonable systems, binary I/O is the default. */
|
|
||||||
#ifndef O_BINARY
|
|
||||||
#define O_BINARY 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Replacement for O_NONBLOCK */
|
|
||||||
#ifndef O_NONBLOCK
|
|
||||||
#ifdef O_NDELAY /* SYSV */
|
|
||||||
#define O_NONBLOCK O_NDELAY
|
|
||||||
#else /* BSD */
|
|
||||||
#define O_NONBLOCK FNDELAY
|
|
||||||
#endif /* !O_NDELAY */
|
|
||||||
#endif /* !O_NONBLOCK */
|
|
||||||
|
|
||||||
#if defined(__QNX__) && !defined(__QNXNTO__)
|
|
||||||
/* exec*() from <process.h> */
|
|
||||||
#include <unix.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include "glibcompat.h"
|
#include "glibcompat.h"
|
||||||
|
|
||||||
/* Solaris9 doesn't have PRIXMAX */
|
#include "unixcompat.h"
|
||||||
#ifndef PRIXMAX
|
|
||||||
#define PRIXMAX PRIxMAX
|
#include "fs.h"
|
||||||
#endif
|
#include "shell.h"
|
||||||
|
#include "mcconfig.h"
|
||||||
|
|
||||||
|
/*** typedefs(not structures) and defined constants **********************************************/
|
||||||
|
|
||||||
#ifdef ENABLE_NLS
|
#ifdef ENABLE_NLS
|
||||||
#include <libintl.h>
|
#include <libintl.h>
|
||||||
@ -90,9 +37,11 @@
|
|||||||
#define N_(String) (String)
|
#define N_(String) (String)
|
||||||
#endif /* !ENABLE_NLS */
|
#endif /* !ENABLE_NLS */
|
||||||
|
|
||||||
#include "fs.h"
|
#ifdef HAVE_FUNC_ATTRIBUTE_FALLTHROUGH
|
||||||
#include "shell.h"
|
#define MC_FALLTHROUGH __attribute__((fallthrough))
|
||||||
#include "mcconfig.h"
|
#else
|
||||||
|
#define MC_FALLTHROUGH
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef USE_MAINTAINER_MODE
|
#ifdef USE_MAINTAINER_MODE
|
||||||
#include "lib/logging.h"
|
#include "lib/logging.h"
|
||||||
@ -109,32 +58,8 @@
|
|||||||
#define BUF_SMALL 128
|
#define BUF_SMALL 128
|
||||||
#define BUF_TINY 64
|
#define BUF_TINY 64
|
||||||
|
|
||||||
/* ESC_CHAR is defined in /usr/include/langinfo.h in some systems */
|
|
||||||
#ifdef ESC_CHAR
|
|
||||||
#undef ESC_CHAR
|
|
||||||
#endif
|
|
||||||
/* AIX compiler doesn't understand '\e' */
|
|
||||||
#define ESC_CHAR '\033'
|
|
||||||
#define ESC_STR "\033"
|
|
||||||
|
|
||||||
/* OS specific defines */
|
|
||||||
#define PATH_SEP '/'
|
|
||||||
#define PATH_SEP_STR "/"
|
|
||||||
#define IS_PATH_SEP(c) ((c) == PATH_SEP)
|
|
||||||
#define PATH_ENV_SEP ':'
|
|
||||||
#define TMPDIR_DEFAULT "/tmp"
|
|
||||||
#define SCRIPT_SUFFIX ""
|
|
||||||
#define get_default_editor() "vi"
|
|
||||||
#define OS_SORT_CASE_SENSITIVE_DEFAULT TRUE
|
|
||||||
#define UTF8_CHAR_LEN 6
|
#define UTF8_CHAR_LEN 6
|
||||||
|
|
||||||
/* struct stat members */
|
|
||||||
#ifdef __APPLE__
|
|
||||||
#define st_atim st_atimespec
|
|
||||||
#define st_ctim st_ctimespec
|
|
||||||
#define st_mtim st_mtimespec
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Used to distinguish between a normal MC termination and */
|
/* Used to distinguish between a normal MC termination and */
|
||||||
/* one caused by typing 'exit' or 'logout' in the subshell */
|
/* one caused by typing 'exit' or 'logout' in the subshell */
|
||||||
#define SUBSHELL_EXIT 128
|
#define SUBSHELL_EXIT 128
|
||||||
|
@ -11,6 +11,10 @@
|
|||||||
#ifndef MC_UNIXCOMPAT_H
|
#ifndef MC_UNIXCOMPAT_H
|
||||||
#define MC_UNIXCOMPAT_H
|
#define MC_UNIXCOMPAT_H
|
||||||
|
|
||||||
|
#include <fcntl.h> /* O_* macros */
|
||||||
|
#include <signal.h> /* sig_atomic_t */
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <sys/types.h> /* BSD */
|
#include <sys/types.h> /* BSD */
|
||||||
|
|
||||||
#ifdef MAJOR_IN_MKDEV
|
#ifdef MAJOR_IN_MKDEV
|
||||||
@ -19,7 +23,20 @@
|
|||||||
#include <sys/sysmacros.h>
|
#include <sys/sysmacros.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <unistd.h>
|
#if defined(HAVE_STRING_H)
|
||||||
|
#include <string.h>
|
||||||
|
/* An ANSI string.h and pre-ANSI memory.h might conflict */
|
||||||
|
#elif defined(HAVE_MEMORY_H)
|
||||||
|
#include <memory.h>
|
||||||
|
#else
|
||||||
|
#include <strings.h>
|
||||||
|
/* memory and strings.h conflict on other systems */
|
||||||
|
#endif /* !STDC_HEADERS & !HAVE_STRING_H */
|
||||||
|
|
||||||
|
#if defined(__QNX__) && !defined(__QNXNTO__)
|
||||||
|
/* exec*() from <process.h> */
|
||||||
|
#include <unix.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/*** typedefs(not structures) and defined constants **********************************************/
|
/*** typedefs(not structures) and defined constants **********************************************/
|
||||||
|
|
||||||
@ -50,6 +67,59 @@
|
|||||||
#define STDERR_FILENO 2
|
#define STDERR_FILENO 2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* The O_BINARY definition was taken from gettext */
|
||||||
|
#if !defined O_BINARY && defined _O_BINARY
|
||||||
|
/* For MSC-compatible compilers. */
|
||||||
|
#define O_BINARY _O_BINARY
|
||||||
|
#endif
|
||||||
|
#ifdef __BEOS__
|
||||||
|
/* BeOS 5 has O_BINARY, but is has no effect. */
|
||||||
|
#undef O_BINARY
|
||||||
|
#endif
|
||||||
|
/* On reasonable systems, binary I/O is the default. */
|
||||||
|
#ifndef O_BINARY
|
||||||
|
#define O_BINARY 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Replacement for O_NONBLOCK */
|
||||||
|
#ifndef O_NONBLOCK
|
||||||
|
#ifdef O_NDELAY /* SYSV */
|
||||||
|
#define O_NONBLOCK O_NDELAY
|
||||||
|
#else /* BSD */
|
||||||
|
#define O_NONBLOCK FNDELAY
|
||||||
|
#endif /* !O_NDELAY */
|
||||||
|
#endif /* !O_NONBLOCK */
|
||||||
|
|
||||||
|
/* Solaris9 doesn't have PRIXMAX */
|
||||||
|
#ifndef PRIXMAX
|
||||||
|
#define PRIXMAX PRIxMAX
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ESC_CHAR is defined in /usr/include/langinfo.h in some systems */
|
||||||
|
#ifdef ESC_CHAR
|
||||||
|
#undef ESC_CHAR
|
||||||
|
#endif
|
||||||
|
/* AIX compiler doesn't understand '\e' */
|
||||||
|
#define ESC_CHAR '\033'
|
||||||
|
#define ESC_STR "\033"
|
||||||
|
|
||||||
|
/* OS specific defines */
|
||||||
|
#define PATH_SEP '/'
|
||||||
|
#define PATH_SEP_STR "/"
|
||||||
|
#define IS_PATH_SEP(c) ((c) == PATH_SEP)
|
||||||
|
#define PATH_ENV_SEP ':'
|
||||||
|
#define TMPDIR_DEFAULT "/tmp"
|
||||||
|
#define SCRIPT_SUFFIX ""
|
||||||
|
#define get_default_editor() "vi"
|
||||||
|
#define OS_SORT_CASE_SENSITIVE_DEFAULT TRUE
|
||||||
|
|
||||||
|
/* struct stat members */
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#define st_atim st_atimespec
|
||||||
|
#define st_ctim st_ctimespec
|
||||||
|
#define st_mtim st_mtimespec
|
||||||
|
#endif
|
||||||
|
|
||||||
/*** enums ***************************************************************************************/
|
/*** enums ***************************************************************************************/
|
||||||
|
|
||||||
/*** structures declarations (and typedefs of structures)*****************************************/
|
/*** structures declarations (and typedefs of structures)*****************************************/
|
||||||
|
Loading…
Reference in New Issue
Block a user