home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 1 / FFMCD01.bin / useful / dist / gnu / diffutils / diffutils-2.4-amiga / system.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-26  |  3.6 KB  |  193 lines

  1. /* System dependent declarations.
  2.    Copyright (C) 1988, 1989, 1992, 1993 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. #include <config.h>
  21. #include <sys/types.h>
  22. #include <sys/stat.h>
  23.  
  24. #if __STDC__
  25. #define PARAMS(args) args
  26. #define VOID void
  27. #else
  28. #define PARAMS(args) ()
  29. #define VOID char
  30. #endif
  31.  
  32. #ifndef S_ISDIR
  33. #define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
  34. #endif
  35. #ifndef S_ISREG
  36. #define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
  37. #endif
  38.  
  39. #ifndef S_IXOTH
  40. #define S_IXOTH 1
  41. #endif
  42. #ifndef S_IXGRP
  43. #define S_IXGRP (S_IXOTH << 3)
  44. #endif
  45. #ifndef S_IXUSR
  46. #define S_IXUSR (S_IXGRP << 3)
  47. #endif
  48.  
  49. #if HAVE_UNISTD_H
  50. #include <unistd.h>
  51. #endif
  52.  
  53. #ifndef SEEK_SET
  54. #define SEEK_SET 0
  55. #endif
  56. #ifndef SEEK_CUR
  57. #define SEEK_CUR 1
  58. #endif
  59.  
  60. #ifndef STDIN_FILENO
  61. #define STDIN_FILENO 0
  62. #endif
  63. #ifndef STDOUT_FILENO
  64. #define STDOUT_FILENO 1
  65. #endif
  66. #ifndef STDERR_FILENO
  67. #define STDERR_FILENO 2
  68. #endif
  69.  
  70. #if HAVE_TIME_H
  71. #include <time.h>
  72. #else
  73. #include <sys/time.h>
  74. #endif
  75.  
  76. #if HAVE_FCNTL_H
  77. #include <fcntl.h>
  78. #else
  79. #include <sys/file.h>
  80. #endif
  81.  
  82. #if !HAVE_DUP2
  83. #define dup2(f,t)    (close (t),  fcntl (f,F_DUPFD,t))
  84. #endif
  85.  
  86. #ifndef O_RDONLY
  87. #define O_RDONLY 0
  88. #endif
  89.  
  90. #if HAVE_SYS_WAIT_H && !defined (amigados)
  91. #ifndef _POSIX_VERSION
  92. /* Prevent the NeXT prototype using union wait from causing problems.  */
  93. #define wait system_wait
  94. #endif
  95. #include <sys/wait.h>
  96. #ifndef _POSIX_VERSION
  97. #undef wait
  98. #endif
  99. #endif /* HAVE_SYS_WAIT_H */
  100.  
  101. #ifndef WEXITSTATUS
  102. #define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
  103. #undef WIFEXITED        /* Avoid 4.3BSD incompatibility with Posix.  */
  104. #endif
  105. #ifndef WIFEXITED
  106. #define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
  107. #endif
  108.  
  109. #if HAVE_ST_BLKSIZE
  110. #define STAT_BLOCKSIZE(s) (s).st_blksize
  111. #else
  112. #define STAT_BLOCKSIZE(s) (8 * 1024)
  113. #endif
  114.  
  115. #if DIRENT || defined (_POSIX_VERSION)
  116. #include <dirent.h>
  117. #else /* ! (DIRENT || defined (_POSIX_VERSION)) */
  118. #if SYSNDIR
  119. #include <sys/ndir.h>
  120. #else
  121. #if SYSDIR
  122. #include <sys/dir.h>
  123. #else
  124. #include <ndir.h>
  125. #endif
  126. #endif
  127. #ifdef dirent
  128. #undef dirent
  129. #endif
  130. #define dirent direct
  131. #endif /* ! (DIRENT || defined (_POSIX_VERSION)) */
  132.  
  133. #if HAVE_VFORK_H
  134. #include <vfork.h>
  135. #endif
  136.  
  137. #if HAVE_STDLIB_H
  138. #include <stdlib.h>
  139. #else
  140. char *getenv ();
  141. VOID *malloc ();
  142. VOID *realloc ();
  143. #endif
  144.  
  145. #if HAVE_LIMITS_H
  146. #include <limits.h>
  147. #endif
  148. #ifndef INT_MAX
  149. #define INT_MAX 2147483647
  150. #endif
  151. #ifndef CHAR_BIT
  152. #define CHAR_BIT 8
  153. #endif
  154.  
  155. #if HAVE_STRING_H
  156. #include <string.h>
  157. #ifndef bzero
  158. #define bzero(s,n) memset (s,0,n)
  159. #endif
  160. #else /* !HAVE_STRING_H */
  161. #include <strings.h>
  162. #ifndef strchr
  163. #define strchr index
  164. #endif
  165. #ifndef strrchr
  166. #define strrchr rindex
  167. #endif
  168. #ifndef memcpy
  169. #define memcpy(d,s,n) bcopy (s,d,n)
  170. #endif
  171. #ifndef memcmp
  172. #define memcmp(s1,s2,n) bcmp (s1,s2,n)
  173. #endif
  174. #endif /* !HAVE_STRING_H */
  175.  
  176. #if !HAVE_MEMCHR
  177. char *memchr ();
  178. #endif
  179.  
  180. #include <errno.h>
  181. #if !STDC_HEADERS
  182. extern int errno;
  183. #endif
  184.  
  185. #if !__STDC__
  186. #ifndef volatile
  187. #define volatile
  188. #endif
  189. #endif
  190.  
  191. #define min(a,b) ((a) <= (b) ? (a) : (b))
  192. #define max(a,b) ((a) >= (b) ? (a) : (b))
  193.