1 #ifdef HAVE_CONFIG_H
2 #include "config.h"
3 #endif
4 
5 #ifdef STDC_HEADERS
6 # include <string.h>
7 #else
8 # ifndef HAVE_STRCHR
9 #  define strchr index
10 #  define strrchr rindex
11 # endif
12 char *strchr(), *strrchr();
13 # ifndef HAVE_MEMCPY
14 #  define memcpy(d, s, n) bcopy ((s), (d), (n))
15 #  define memmove(d, s, n) bcopy ((s), (d), (n))
16 # endif
17 #endif
18 
19 #ifdef HAVE_UNISTD_H
20 # include <sys/types.h>
21 # include <unistd.h>
22 #endif
23 
24 #ifdef STAT_MACROS_BROKEN
25 # include "posixstat.h"
26 #endif
27 
28 #if STDC_HEADERS
29 # include <stdlib.h>
30 #endif
31 
32 #if defined(HAVE_LIBIBERTY_H) && !defined(NEED_XMALLOC)
33 #include <libiberty.h>		/* Part of libiberty.a that comes with binutils */
34 #else
35 extern void *xmalloc(size_t);
36 extern void *xrealloc(void *ptr, size_t size);
37 #endif
38 
39 #ifndef NULL
40 # ifdef __STDC__
41 #   define NULL ((void *)0)
42 # else
43 #   define NULL (0x0)
44 # endif
45 #endif
46 
47 #ifndef HAVE_GETCWD
48 # ifdef HAVE_GETWD
49 #   define getcwd(a, b) getwd(a)
50 # else
51 #   error "You either need getcwd(3) or getwd(3)"
52 # endif
53 #endif
54