4 * Copyright 1998-2002 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.
24 # if defined(HAVE_STRINGS_H) && (!defined(HAVE_STRING_H) || defined(BOTH_STRINGS_H))
36 # define strrchr rindex
41 # define memcpy(d, s, n) ((void) bcopy ((s), (d), (n)))
43 # define memmove(d, s, n) ((void) bcopy ((s), (d), (n)))
47 /* use ldap_pvt_strtok instead of strtok or strtok_r! */
48 LDAP_F(char *) ldap_pvt_strtok LDAP_P(( char *str,
49 const char *delim, char **pos ));
52 /* strdup() is missing, declare our own version */
54 # define strdup(s) ber_strdup(s)
55 #elif !defined(_WIN32)
56 /* some systems fail to declare strdup */
57 /* Windows does not require this declaration */
58 LDAP_LIBC_F(char *) (strdup)();
62 * some systems fail to declare strcasecmp() and strncasecmp()
63 * we need them declared so we can obtain pointers to them
66 /* we don't want these declared for Windows or Mingw */
73 # if defined( HAVE_MEMMOVE )
74 # define SAFEMEMCPY( d, s, n ) memmove((d), (s), (n))
75 # elif defined( HAVE_BCOPY )
76 # define SAFEMEMCPY( d, s, n ) bcopy((s), (d), (n))
78 /* nothing left but memcpy() */
79 # define SAFEMEMCPY( d, s, n ) memcpy((d), (s), (n))
83 #define AC_MEMCPY( d, s, n ) (SAFEMEMCPY((d),(s),(n)))
84 #define AC_FMEMCPY( d, s, n ) do { \
85 if((n) == 1) *((char*)(d)) = *((char*)(s)); \
86 else AC_MEMCPY( (d), (s), (n) ); \
89 #endif /* _AC_STRING_H */