home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / developm / librarie / posix10.sit / POSIX / diff-2.0.patch / system.h < prev   
Encoding:
C/C++ Source or Header  |  1992-09-28  |  3.3 KB  |  158 lines

  1. /* System dependent declarations.
  2.    Copyright (C) 1988, 1989, 1992 Free Software Foundation, Inc.
  3.  
  4. This file is part of GNU DIFF.
  5.  
  6. GNU DIFF is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2, or (at your option)
  9. any later version.
  10.  
  11. GNU DIFF is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with GNU DIFF; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. #ifdef THINK_C
  21. #include <stdlib.h>
  22. #include <unix.h>
  23. #include "ThinkCPosix.h"
  24. #undef _POSIX_VERSION
  25. #undef __STDC__
  26. #define __STDC__ 1
  27. #define USG 1
  28. #define STDC_HEADERS 1
  29. #define HAVE_MEMCHR 1
  30. #define HAVE_DUP2 1
  31. #define perror Perror
  32. #define open Open
  33. #define vfork fork
  34. #endif /* THINK_C */
  35.  
  36. #include <sys/types.h>
  37. #include <sys/stat.h>
  38.  
  39. #ifndef S_ISDIR
  40. #define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
  41. #endif
  42. #ifndef S_ISREG
  43. #define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
  44. #endif
  45.  
  46. #ifdef HAVE_UNISTD_H
  47. #include <unistd.h>
  48. #endif
  49.  
  50. #if defined (USG) || defined (_POSIX_VERSION)
  51. #include <time.h>
  52. #include <fcntl.h>
  53. #else
  54. #include <sys/time.h>
  55. #include <sys/file.h>
  56. #endif
  57.  
  58. #ifndef HAVE_DUP2
  59. #define dup2(f,t)    (close (t),  fcntl (f,F_DUPFD,t))
  60. #endif
  61.  
  62. #ifndef O_RDONLY
  63. #define O_RDONLY 0
  64. #endif
  65.  
  66. #if !defined (USG) || defined (_POSIX_VERSION)
  67. #include <sys/wait.h>
  68. #endif
  69.  
  70. #ifndef WEXITSTATUS
  71. #define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
  72. #undef WIFEXITED        /* Avoid 4.3BSD incompatibility with Posix.  */
  73. #endif
  74. #ifndef WIFEXITED
  75. #define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
  76. #endif
  77.  
  78. #if HAVE_ST_BLKSIZE
  79. #define STAT_BLOCKSIZE(s) (s).st_blksize
  80. #else
  81. #define STAT_BLOCKSIZE(s) (S_ISREG ((s).st_mode) ? 8192 : 4096)
  82. #endif
  83.  
  84. #if defined (DIRENT) || defined (_POSIX_VERSION)
  85. #include <dirent.h>
  86. #ifdef direct
  87. #undef direct
  88. #endif
  89. #define direct dirent
  90. #else /* not (DIRENT or _POSIX_VERSION) */
  91. #ifdef USG
  92. #ifdef SYSNDIR
  93. #include <sys/ndir.h>
  94. #else /* !SYSNDIR */
  95. #ifndef THINK_C
  96. #include <ndir.h>
  97. #endif /* THINK_C */
  98. #endif /* SYSNDIR */
  99. #else /* !USG */
  100. #include <sys/dir.h>
  101. #endif /* USG */
  102. #endif /* DIRENT or _POSIX_VERSION */
  103.  
  104. #ifdef HAVE_VFORK_H
  105. #include <vfork.h>
  106. #endif
  107.  
  108. #if defined (USG) || defined (STDC_HEADERS)
  109. #include <string.h>
  110. #define index    strchr
  111. #define rindex    strrchr
  112. #define bcopy(s,d,n)    memcpy (d,s,n)
  113. #define bcmp(s1,s2,n)    memcmp (s1,s2,n)
  114. #define bzero(s,n)    memset (s,0,n)
  115. #else
  116. #include <strings.h>
  117. #endif
  118. #if !HAVE_MEMCHR || (!STDC_HEADERS && !USG)
  119. char *memchr ();
  120. #endif
  121.  
  122. #if defined (STDC_HEADERS)
  123. #include <stdlib.h>
  124. #include <limits.h>
  125. #else
  126. char *getenv ();
  127. char *malloc ();
  128. char *realloc ();
  129. #if __STDC__ || __GNUC__
  130. #include "limits.h"
  131. #else
  132. #define INT_MAX 2147483647
  133. #define CHAR_BIT 8
  134. #endif
  135. #endif
  136.  
  137. #include <errno.h>
  138. #ifndef STDC_HEADERS
  139. extern int errno;
  140. #endif
  141.  
  142. #ifdef TRUE
  143. #undef TRUE
  144. #endif
  145. #ifdef FALSE
  146. #undef FALSE
  147. #endif
  148. #define TRUE        1
  149. #define    FALSE        0
  150.  
  151. #if !__STDC__
  152. #define const
  153. #define volatile
  154. #endif
  155.  
  156. #define min(a,b) ((a) <= (b) ? (a) : (b))
  157. #define max(a,b) ((a) >= (b) ? (a) : (b))
  158.