mirror of https://github.com/MidnightCommander/mc
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
|
||||
#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 "glibcompat.h"
|
||||
|
||||
/* Solaris9 doesn't have PRIXMAX */
|
||||
#ifndef PRIXMAX
|
||||
#define PRIXMAX PRIxMAX
|
||||
#endif
|
||||
#include "unixcompat.h"
|
||||
|
||||
#include "fs.h"
|
||||
#include "shell.h"
|
||||
#include "mcconfig.h"
|
||||
|
||||
/*** typedefs(not structures) and defined constants **********************************************/
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
#include <libintl.h>
|
||||
|
@ -90,9 +37,11 @@
|
|||
#define N_(String) (String)
|
||||
#endif /* !ENABLE_NLS */
|
||||
|
||||
#include "fs.h"
|
||||
#include "shell.h"
|
||||
#include "mcconfig.h"
|
||||
#ifdef HAVE_FUNC_ATTRIBUTE_FALLTHROUGH
|
||||
#define MC_FALLTHROUGH __attribute__((fallthrough))
|
||||
#else
|
||||
#define MC_FALLTHROUGH
|
||||
#endif
|
||||
|
||||
#ifdef USE_MAINTAINER_MODE
|
||||
#include "lib/logging.h"
|
||||
|
@ -109,32 +58,8 @@
|
|||
#define BUF_SMALL 128
|
||||
#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
|
||||
|
||||
/* 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 */
|
||||
/* one caused by typing 'exit' or 'logout' in the subshell */
|
||||
#define SUBSHELL_EXIT 128
|
||||
|
|
|
@ -11,6 +11,10 @@
|
|||
#ifndef 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 */
|
||||
|
||||
#ifdef MAJOR_IN_MKDEV
|
||||
|
@ -19,7 +23,20 @@
|
|||
#include <sys/sysmacros.h>
|
||||
#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 **********************************************/
|
||||
|
||||
|
@ -50,6 +67,59 @@
|
|||
#define STDERR_FILENO 2
|
||||
#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 ***************************************************************************************/
|
||||
|
||||
/*** structures declarations (and typedefs of structures)*****************************************/
|
||||
|
|
Loading…
Reference in New Issue