]> git.sur5r.net Git - openldap/blob - include/ac/string.h
Update autoconf environment.
[openldap] / include / ac / string.h
1 /* Generic string.h */
2
3 #ifndef _AC_STRING_H
4 #define _AC_STRING_H
5
6 #ifdef STDC_HEADERS
7 #       include <string.h>
8
9 #else
10 #       ifdef HAVE_STRING_H
11 #               include <string.h>
12 #       elif HAVE_STRINGS_H
13 #               include <strings.h>
14 #       endif
15
16 #       ifdef HAVE_MEMORY_H
17 #               include <memory.h>
18 #       endif
19
20 #       ifdef HAVE_MALLOC_H
21 #               include <malloc.h>
22 #       endif
23
24 #       ifndef HAVE_STRCHR
25 #               define strchr index
26 #               define strrchr rindex
27 #       endif
28
29 #       ifndef HAVE_MEMCPY
30 #               define memcpy(d, s, n)                  bcopy ((s), (d), (n))
31 #               define memmove(d, s, n)                 bcopy ((s), (d), (n))
32 #       endif
33 #endif
34
35 /*
36  * provide prototypes for missing functions that we replace.
37  * replacements can be found in -llutil
38  */
39 #ifndef HAVE_STRDUP
40         char *strdup( const char *s );
41 #endif
42
43 #ifndef SAFEMEMCPY
44 #       if defined( HAVE_MEMMOVE )
45 #               define SAFEMEMCPY( d, s, n )    memmove((d), (s), (n))
46 #       elif defined( HAVE_BCOPY )
47 #               define SAFEMEMCPY( d, s, n )    bcopy((s), (d), (n))
48 #       else
49                 /* nothing left but memcpy() */
50 #               define SAFEMEMCPY( d, s, n )    memcpy((d), (s), (n))
51 #       endif
52 #endif
53
54 #endif /* _AC_STRING_H */