home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / fte0108.zip / FTE_SRC.ZIP / fte / src / sysdep.h < prev    next >
C/C++ Source or Header  |  2001-08-19  |  4KB  |  173 lines

  1. /*    sysdep.h
  2.  *
  3.  *    Copyright (c) 1994-1996, Marko Macek
  4.  *
  5.  *    You may distribute under the terms of either the GNU General Public
  6.  *    License or the Artistic License, as specified in the README file.
  7.  *
  8.  */
  9.  
  10. #ifndef __SYSDEP_H
  11. #define __SYSDEP_H
  12.  
  13. #include <assert.h>
  14. #include <errno.h>
  15. #include <stdlib.h>
  16. #include <stdarg.h>
  17. #include <string.h>
  18. #if defined(AIX) || defined(SCO) || defined(NCR)
  19. #include <strings.h>
  20. #endif
  21. #include <stdio.h>
  22. #include <fcntl.h>
  23. #include <ctype.h>
  24. #include <sys/types.h>
  25. #include <sys/stat.h>
  26. #include <time.h>
  27.  
  28. #ifdef DBMALLOC
  29. #include <malloc.h>
  30. #endif
  31.  
  32. #if !defined(OS2) && \
  33.     !defined(NT) && \
  34.     !defined(DOSP32) && \
  35.     !defined(LINUX) && \
  36.     !defined(HPUX) && \
  37.     !defined(AIX) && \
  38.     !defined(IRIX) && \
  39.     !defined(SCO) && \
  40.     !defined(SUNOS) && \
  41.     !defined(NCR)
  42. #    error Target not supported.
  43. #endif
  44.  
  45. #if defined(UNIX) || defined(DJGPP)
  46. #    define USE_DIRENT
  47. #endif
  48.  
  49. #if defined(USE_DIRENT) // also needs fnmatch
  50. #    include <dirent.h>
  51. #endif
  52.  
  53. #if defined(UNIX)
  54. #    include <unistd.h>
  55. #    include <pwd.h>
  56. #    if defined(__CYGWIN__)
  57. #        include "fnmatch.h"
  58. #    else
  59. #        include <fnmatch.h>
  60. #    endif
  61. #    define strnicmp strncasecmp
  62. #    define stricmp strcasecmp
  63. #    define filecmp strcmp
  64.      //#    define memicmp strncasecmp   // FIX, fails for nulls
  65.      extern "C" int memicmp(const void *s1, const void *s2, size_t n);
  66. #endif
  67.  
  68. #if defined(OS2)
  69. #    include <malloc.h>
  70. #    if !defined(__TOS_OS2__)
  71. #        include <dos.h>
  72. #    endif
  73. #    include <io.h>
  74. #    include <process.h>
  75. #    if defined(BCPP) || defined(WATCOM) || defined(__TOS_OS2__)
  76. #        include <direct.h>
  77. #    endif
  78. #    if defined(BCPP)
  79. #        include <dir.h>
  80. #    endif
  81. #    define filecmp stricmp
  82. #    if !defined(__EMX__)
  83. #        define NO_NEW_CPP_FEATURES
  84. #    endif
  85. #endif
  86.  
  87. #if defined(DOS) || defined(DOSP32)
  88. #    include <malloc.h>
  89. #    include <dos.h>
  90. #    include <io.h>
  91. #    include <process.h>
  92. #    define NO_NEW_CPP_FEATURES
  93. #    if defined(BCPP)
  94. #        include <dir.h>
  95. #    endif
  96. #    if defined(WATCOM)
  97. #        include <direct.h>
  98. #    endif
  99. #    if defined(DJGPP)
  100. #        include <dir.h>
  101. #        include <unistd.h>
  102. #        undef MAXPATH
  103.          extern "C" int memicmp(const void *s1, const void *s2, size_t n);
  104. #    endif
  105. #    define filecmp stricmp
  106. #endif
  107.  
  108. #if defined(NT)
  109. #    include <malloc.h>
  110. #    include <dos.h>
  111. #    include <io.h>
  112. #    include <process.h>
  113. #    if defined(MSVC)
  114. #        include <direct.h>
  115. #    endif
  116. #    if defined(WATCOM)
  117. #        include <direct.h>
  118. #    endif
  119. #    if defined(BCPP)
  120. #        include <dir.h>
  121. #    endif
  122. #    if defined(MINGW)
  123. #        include <dir.h>
  124. #    endif
  125. #    define filecmp stricmp
  126. #    define popen _popen
  127. #    define pclose _pclose
  128. #endif
  129.  
  130. #ifndef MAXPATH
  131. #    define MAXPATH 1024
  132. #endif
  133.  
  134. #ifndef O_BINARY
  135. #    define O_BINARY 0   /* defined on OS/2, no difference on unix */
  136. #endif
  137.  
  138. #if defined(OS2) || defined(NT)
  139. #    if defined(__EMX__) || defined(WATCOM) || defined(__TOS_OS2__)
  140. #        define FAKE_BEGINTHREAD_NULL NULL,
  141. #    else
  142. #        define FAKE_BEGINTHREAD_NULL
  143. #    endif
  144. #endif
  145.  
  146. #if !defined(__IBMC__) && !defined(__IBMCPP__)
  147. #    define _LNK_CONV
  148. #endif
  149.  
  150. #define PT_UNIXISH   0
  151. #define PT_DOSISH    1
  152.  
  153. #ifndef S_ISDIR  // NT, DOS, DOSP32
  154. #    ifdef S_IFDIR
  155. #        define S_ISDIR(mode)  ((mode) & S_IFDIR)
  156. #    else
  157. #        define S_ISDIR(mode)  ((mode) & _S_IFDIR)
  158. #    endif
  159. #endif
  160.  
  161. #ifndef S_IWGRP
  162. #define S_IWGRP 0
  163. #define S_IWOTH 0
  164. #endif
  165.  
  166. #if defined(OS2) || defined(NT) || defined(DOSP32) || defined(DOS)
  167. #define PATHTYPE   PT_DOSISH
  168. #else
  169. #define PATHTYPE   PT_UNIXISH
  170. #endif
  171.  
  172. #endif
  173.