root/lib/unixcompat.h

/* [previous][next][first][last][top][bottom][index][help]  */

INCLUDED FROM


   1 /** \file unixcompat.h
   2  *  \brief Header: collects differences between the various Unix
   3  *
   4  *  This header file collects differences between the various Unix
   5  *  variants that are supported by the Midnight Commander and provides
   6  *  replacement routines if they are not natively available.
   7  *  The major/minor macros are not specified in SUSv3, so we can only hope
   8  *  they are provided by the operating system or emulate it.
   9  */
  10 
  11 #ifndef MC_UNIXCOMPAT_H
  12 #define MC_UNIXCOMPAT_H
  13 
  14 #include <fcntl.h>              /* O_* macros */
  15 #include <signal.h>             /* sig_atomic_t */
  16 #include <unistd.h>
  17 
  18 #include <sys/types.h>          /* BSD */
  19 
  20 #ifdef MAJOR_IN_MKDEV
  21 #include <sys/mkdev.h>
  22 #elif defined MAJOR_IN_SYSMACROS
  23 #include <sys/sysmacros.h>
  24 #endif
  25 
  26 #if defined(HAVE_STRING_H)
  27 #include <string.h>
  28    /* An ANSI string.h and pre-ANSI memory.h might conflict */
  29 #elif defined(HAVE_MEMORY_H)
  30 #include <memory.h>
  31 #else
  32 #include <strings.h>
  33     /* memory and strings.h conflict on other systems */
  34 #endif /* !STDC_HEADERS & !HAVE_STRING_H */
  35 
  36 #if defined(__QNX__) && !defined(__QNXNTO__)
  37 /* exec*() from <process.h> */
  38 #include <unix.h>
  39 #endif
  40 
  41 /*** typedefs(not structures) and defined constants **********************************************/
  42 
  43 #ifndef major
  44 #warning major() is undefined. Device numbers will not be shown correctly.
  45 #define major(devnum) (((devnum) >> 8) & 0xff)
  46 #endif
  47 
  48 #ifndef minor
  49 #warning minor() is undefined. Device numbers will not be shown correctly.
  50 #define minor(devnum) (((devnum) & 0xff))
  51 #endif
  52 
  53 #ifndef makedev
  54 #warning makedev() is undefined. Device numbers will not be shown correctly.
  55 #define makedev(major,minor) ((((major) & 0xff) << 8) | ((minor) & 0xff))
  56 #endif
  57 
  58 #ifndef STDIN_FILENO
  59 #define STDIN_FILENO 0
  60 #endif
  61 
  62 #ifndef STDOUT_FILENO
  63 #define STDOUT_FILENO 1
  64 #endif
  65 
  66 #ifndef STDERR_FILENO
  67 #define STDERR_FILENO 2
  68 #endif
  69 
  70 /* The O_BINARY definition was taken from gettext */
  71 #if !defined O_BINARY && defined _O_BINARY
  72   /* For MSC-compatible compilers.  */
  73 #define O_BINARY _O_BINARY
  74 #endif
  75 #ifdef __BEOS__
  76   /* BeOS 5 has O_BINARY, but it has no effect.  */
  77 #undef O_BINARY
  78 #endif
  79 /* On reasonable systems, binary I/O is the default.  */
  80 #ifndef O_BINARY
  81 #define O_BINARY 0
  82 #endif
  83 
  84 /* Replacement for O_NONBLOCK */
  85 #ifndef O_NONBLOCK
  86 #ifdef O_NDELAY                 /* SYSV */
  87 #define O_NONBLOCK O_NDELAY
  88 #else /* BSD */
  89 #define O_NONBLOCK FNDELAY
  90 #endif /* !O_NDELAY */
  91 #endif /* !O_NONBLOCK */
  92 
  93 /* Solaris9 doesn't have PRIXMAX */
  94 #ifndef PRIXMAX
  95 #define PRIXMAX PRIxMAX
  96 #endif
  97 
  98 /* ESC_CHAR is defined in /usr/include/langinfo.h in some systems */
  99 #ifdef ESC_CHAR
 100 #undef ESC_CHAR
 101 #endif
 102 /* AIX compiler doesn't understand '\e' */
 103 #define ESC_CHAR '\033'
 104 #define ESC_STR  "\033"
 105 
 106 /* OS specific defines */
 107 #define PATH_SEP '/'
 108 #define PATH_SEP_STR "/"
 109 #define IS_PATH_SEP(c) ((c) == PATH_SEP)
 110 #define PATH_ENV_SEP ':'
 111 #define TMPDIR_DEFAULT "/tmp"
 112 #define SCRIPT_SUFFIX ""
 113 #define get_default_editor() "vi"
 114 #define OS_SORT_CASE_SENSITIVE_DEFAULT TRUE
 115 
 116 /*** enums ***************************************************************************************/
 117 
 118 /*** structures declarations (and typedefs of structures)*****************************************/
 119 
 120 /*** global variables defined in .c file *********************************************************/
 121 
 122 /*** declarations of public functions ************************************************************/
 123 
 124 /*** inline functions ****************************************************************************/
 125 
 126 #endif

/* [previous][next][first][last][top][bottom][index][help]  */