4 * Copyright 1998-2001 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
9 * Public License. A copy of this license is available at
10 * http://www.OpenLDAP.org/license.html or in file LICENSE in the
11 * top-level directory of the distribution.
35 # define strrchr rindex
40 # define memcpy(d, s, n) ((void) bcopy ((s), (d), (n)))
42 # define memmove(d, s, n) ((void) bcopy ((s), (d), (n)))
46 /* use ldap_pvt_strtok instead of strtok or strtok_r! */
47 LDAP_F(char *) ldap_pvt_strtok LDAP_P(( char *str,
48 const char *delim, char **pos ));
51 /* strdup() is missing, declare our own version */
53 # define strdup(s) ber_strdup(s)
55 /* some systems fail to declare strdup */
56 LDAP_LIBC_F(char *) (strdup)();
60 * some systems fail to declare strcasecmp() and strncasecmp()
61 * we need them declared so we can obtain pointers to them
64 /* In Mingw32, strcasecmp is not in the C library, so we don't LIBC_F it */
69 # if defined( HAVE_MEMMOVE )
70 # define SAFEMEMCPY( d, s, n ) memmove((d), (s), (n))
71 # elif defined( HAVE_BCOPY )
72 # define SAFEMEMCPY( d, s, n ) bcopy((s), (d), (n))
74 /* nothing left but memcpy() */
75 # define SAFEMEMCPY( d, s, n ) memcpy((d), (s), (n))
79 #define AC_MEMCPY( d, s, n ) (SAFEMEMCPY((d),(s),(n)))
80 #define AC_FMEMCPY( d, s, n ) do { \
81 if((n) == 1) *((char*)(d)) = *((char*)(s)); \
82 else AC_MEMCPY( (d), (s), (n) ); \
85 #endif /* _AC_STRING_H */