home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / utils / disk-man / mtools-3.000 / mtools-3 / mtools-3.0 / sysincludes.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-08  |  4.0 KB  |  245 lines

  1. /* System includes for mtools */
  2.  
  3. #ifndef SYSINCLUDES_H
  4. #define SYSINCLUDES_H
  5.  
  6. #include "config.h"
  7.  
  8. #ifndef __GNUC__
  9. #define __const const
  10. #define UNUSED(x) /**/
  11. #else
  12. #define UNUSED(x) x __attribute__ ((unused))
  13. #endif
  14.  
  15. #include <sys/types.h>
  16.  
  17. #ifdef HAVE_STDLIB_H
  18. #include <stdlib.h>
  19. #endif
  20.  
  21. #include <stdio.h>
  22. #include <ctype.h>
  23.  
  24. #ifdef HAVE_UNISTD_H
  25. #include <unistd.h>
  26. #endif
  27.  
  28. #ifdef HAVE_GETOPT_H
  29. #include <getopt.h>
  30. #else
  31. int getopt();
  32. extern char *optarg;
  33. extern int optind, opterr;
  34. #endif
  35.  
  36. #ifdef HAVE_FCNTL_H
  37. #include <fcntl.h>
  38. #endif
  39.  
  40. #ifdef HAVE_LIMITS_H
  41. #include <limits.h>
  42. #endif
  43.  
  44. #ifdef HAVE_SYS_FILE_H
  45. #include <sys/file.h>
  46. #endif
  47.  
  48. #ifdef HAVE_SYS_IOCTL_H
  49. #ifndef sunos
  50. #include <sys/ioctl.h>
  51. #endif
  52. #endif
  53. /* if we don't have sys/ioctl.h, we rely on unistd to supply a prototype
  54.  * for it. If it doesn't, we'll only get a (harmless) warning. The idea
  55.  * is to get mtools compile on as many platforms as possible, but to not
  56.  * suppress warnings if the platform is broken, as long as these warnings do
  57.  * not prevent compilation */
  58.  
  59. #if TIME_WITH_SYS_TIME
  60. # include <sys/time.h>
  61. # include <time.h>
  62. #else
  63. # if HAVE_SYS_TIME_H
  64. #  include <sys/time.h>
  65. # else
  66. #  include <time.h>
  67. # endif
  68. #endif
  69.  
  70. #ifndef NO_TERMIO
  71. #ifdef HAVE_TERMIOS_H
  72. #include <termios.h>
  73. #endif
  74.  
  75. #ifdef HAVE_SYS_TERMIOS_H
  76. #include <sys/termios.h>
  77. #endif
  78.  
  79. #ifdef HAVE_TERMIO_H
  80. #include <termio.h>
  81. #endif
  82.  
  83.  
  84. #ifdef HAVE_SYS_TERMIO_H
  85. #include <sys/termio.h>
  86. #endif
  87. #endif
  88.  
  89. #ifdef HAVE_SYS_PARAM_H
  90. #include <sys/param.h>
  91. #endif
  92.  
  93. #include <sys/stat.h>
  94.  
  95. #include <errno.h>
  96. extern int errno;
  97. extern char *sys_errlist[];
  98. #include <pwd.h>
  99.  
  100. /* On AIX, we have to prefer strings.h, as string.h lacks a prototype 
  101.  * for strcasecmp. On most other architectures, it's string.h which seems
  102.  * to be more complete */
  103. #if (defined(aix) && defined (HAVE_STRINGS_H))
  104. # undef HAVE_STRING_H
  105. #endif
  106.  
  107. #ifdef HAVE_STRING_H
  108. # include <string.h>
  109. #else
  110. # ifdef HAVE_STRINGS_H
  111. #  include <strings.h>
  112. # endif
  113. #endif
  114.  
  115. #ifdef HAVE_MEMORY_H
  116. #include <memory.h>
  117. #endif
  118.  
  119. #ifdef HAVE_MALLOC_H
  120. #include <malloc.h>
  121. #endif
  122.  
  123. #ifdef HAVE_SYS_SIGNAL_H
  124. #include <sys/signal.h>
  125. #endif
  126.  
  127.  
  128. #ifdef HAVE_UTIME_H
  129. #include <utime.h>
  130. #endif
  131.  
  132. #ifdef HAVE_SYS_WAIT_H
  133. #include <sys/wait.h>
  134. #endif
  135.  
  136. #ifdef linux
  137. #include <linux/fd.h>
  138. #endif
  139.  
  140.  
  141. /* missing functions */
  142. #ifndef HAVE_SRANDOM
  143. #define srandom srand48
  144. #endif
  145.  
  146. #ifndef HAVE_RANDOM
  147. #define random lrand48
  148. #endif
  149.  
  150. #ifndef HAVE_STRCHR
  151. #define strchr index
  152. #endif
  153.  
  154. #ifndef HAVE_STRRCHR
  155. #define strrchr rindex
  156. #endif
  157.  
  158.  
  159. #define SIG_CAST RETSIGTYPE(*)()
  160.  
  161. #ifndef HAVE_STRDUP
  162. extern char *strdup(__const char *str);
  163. #endif /* HAVE_STRDUP */
  164.  
  165.  
  166. #ifndef HAVE_MEMCPY
  167. extern char *memcpy(char *s1, __const char *s2, size_t n);
  168. #endif
  169.  
  170. #ifndef HAVE_MEMSET
  171. extern char *memset(char *s, char c, size_t n);
  172. #endif /* HAVE_MEMSET */
  173.  
  174.  
  175. #ifndef HAVE_STRPBRK
  176. extern char *strpbrk(__const char *string, __const char *brkset);
  177. #endif /* HAVE_STRPBRK */
  178.  
  179.  
  180. #ifndef HAVE_STRTOUL
  181. unsigned long strtoul(const char *string, char **eptr, int base);
  182. #endif /* HAVE_STRTOUL */
  183.  
  184. #ifndef HAVE_STRSPN
  185. size_t strspn(__const char *s, __const char *accept);
  186. #endif /* HAVE_STRSPN */
  187.  
  188. #ifndef HAVE_STRCSPN
  189. size_t strcspn(__const char *s, __const char *reject);
  190. #endif /* HAVE_STRCSPN */
  191.  
  192. #ifndef HAVE_STRERROR
  193. char *strerror(int errno);
  194. #endif
  195.  
  196. #ifndef HAVE_STRCASECMP
  197. int strcasecmp(const char *, const char *);
  198. #endif
  199. #ifndef HAVE_STRCASECMP
  200. int strncasecmp(const char *, const char *, int);
  201. #endif
  202.  
  203. #ifndef linux
  204. #undef USE_XDF
  205. #endif
  206.  
  207. #ifdef NO_XDF
  208. #undef USE_XDF
  209. #endif
  210.  
  211.  
  212. #ifndef __STDC__
  213. #define signed /**/
  214. int fflush(FILE *);
  215.  
  216. #ifdef HAVE_STRDUP
  217. char *strdup(char *);
  218. #endif
  219.  
  220. #ifdef HAVE_STRCASECMP
  221. int strcasecmp(/* const char *, const char * */);
  222. #endif
  223. #ifdef HAVE_STRCASECMP
  224. int strncasecmp(/* const char *, const char *, int */);
  225. #endif
  226. char *getenv(char *);
  227. #ifdef HAVE_STRTOUL
  228. unsigned long strtoul(const char *, char **, int);
  229. #endif
  230. int pclose(FILE *);
  231. #ifdef HAVE_RANDOM
  232. long int random(void);
  233. #endif
  234.  
  235. #ifdef HAVE_SRANDOM
  236. void srandom(unsigned int);
  237. #endif
  238.  
  239. int atoi(char *);
  240. FILE *fdopen(int, const char *);
  241. FILE *popen(const char *, const char *);
  242. #endif
  243.  
  244. #endif
  245.