]> git.sur5r.net Git - openldap/blob - include/ac/string.h
Kill off #elif in ldap/include/. K&R does not support it.
[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 #else
9 #       ifdef HAVE_STRING_H
10 #               include <string.h>
11 #       else
12 #         ifdef HAVE_STRINGS_H
13 #               include <strings.h>
14 #         endif
15 #       endif
16
17 #       ifndef HAVE_STRCHR
18 #               define strchr index
19 #               define strrchr rindex
20 #       endif
21
22 #       ifndef HAVE_MEMCPY
23 #               define memcpy(d, s, n)                  bcopy ((s), (d), (n))
24 #               define memmove(d, s, n)                 bcopy ((s), (d), (n))
25 #       endif
26
27 #       if !defined(HAVE_STRING_H) && !defined(HAVE_STRINGS_H)
28         /* define prototypes for string functions */
29         /* this could cause problems on some odd ball systems */
30         char    *strchr(), *strrchr();
31         char    *strcpy(), *strncpy();
32         char    *strcat (), *strncat ();
33         int             strcmp(), strncmp();
34         int             strcasecmp(), strncasecmp();
35         char    *strdup();
36         char    *strtok();
37         char    *strpbrk();
38         int             memcmp();
39 #       endif
40
41 #endif
42
43 #ifndef SAFEMEMCPY
44 #       if defined( HAVE_MEMMOVE )
45 #               define SAFEMEMCPY( d, s, n )    memmove((d), (s), (n))
46 #       else
47 #         if defined( HAVE_BCOPY )
48 #               define SAFEMEMCPY( d, s, n )    bcopy((s), (d), (n))
49 #         else
50 #           if defined( MACOS )
51 #               define SAFEMEMCPY( d, s, n )    BlockMoveData((Ptr)(s), (Ptr)(d), (n))
52 #           else
53                 /* nothing left but memcpy() */
54 #               define SAFEMEMCPY( d, s, n )    memcpy((d), (s), (n))
55 #           endif
56 #         endif
57 #       endif
58 #endif
59
60 #endif /* _AC_STRING_H */