4 * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted only as authorized by the OpenLDAP
11 * A copy of this license is available in file LICENSE in the
12 * top-level directory of the distribution or, alternatively, at
13 * <http://www.OpenLDAP.org/license.html>.
26 # if defined(HAVE_STRINGS_H) && (!defined(HAVE_STRING_H) || defined(BOTH_STRINGS_H))
38 # define strrchr rindex
43 # define memcpy(d, s, n) ((void) bcopy ((s), (d), (n)))
45 # define memmove(d, s, n) ((void) bcopy ((s), (d), (n)))
49 /* use ldap_pvt_strtok instead of strtok or strtok_r! */
50 LDAP_F(char *) ldap_pvt_strtok LDAP_P(( char *str,
51 const char *delim, char **pos ));
54 /* strdup() is missing, declare our own version */
56 # define strdup(s) ber_strdup(s)
57 #elif !defined(_WIN32)
58 /* some systems fail to declare strdup */
59 /* Windows does not require this declaration */
60 LDAP_LIBC_F(char *) (strdup)();
64 * some systems fail to declare strcasecmp() and strncasecmp()
65 * we need them declared so we can obtain pointers to them
68 /* we don't want these declared for Windows or Mingw */
75 # if defined( HAVE_MEMMOVE )
76 # define SAFEMEMCPY( d, s, n ) memmove((d), (s), (n))
77 # elif defined( HAVE_BCOPY )
78 # define SAFEMEMCPY( d, s, n ) bcopy((s), (d), (n))
80 /* nothing left but memcpy() */
81 # define SAFEMEMCPY( d, s, n ) memcpy((d), (s), (n))
85 #define AC_MEMCPY( d, s, n ) (SAFEMEMCPY((d),(s),(n)))
86 #define AC_FMEMCPY( d, s, n ) do { \
87 if((n) == 1) *((char*)(d)) = *((char*)(s)); \
88 else AC_MEMCPY( (d), (s), (n) ); \
91 #endif /* _AC_STRING_H */