1998-10-25 09:41:42 +08:00
|
|
|
/* Generic string.h */
|
1999-08-30 16:08:00 +08:00
|
|
|
/* $OpenLDAP$ */
|
1998-12-29 03:51:35 +08:00
|
|
|
/*
|
2000-05-13 10:25:54 +08:00
|
|
|
* Copyright 1998-2000 The OpenLDAP Foundation, Redwood City, California, USA
|
1998-12-29 03:51:35 +08:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms are permitted only
|
|
|
|
* as authorized by the OpenLDAP Public License. A copy of this
|
|
|
|
* license is available at http://www.OpenLDAP.org/license.html or
|
|
|
|
* in file LICENSE in the top-level directory of the distribution.
|
|
|
|
*/
|
1998-10-25 09:41:42 +08:00
|
|
|
|
|
|
|
#ifndef _AC_STRING_H
|
|
|
|
#define _AC_STRING_H
|
|
|
|
|
|
|
|
#ifdef STDC_HEADERS
|
|
|
|
# include <string.h>
|
1998-11-18 03:05:48 +08:00
|
|
|
|
1998-10-25 09:41:42 +08:00
|
|
|
#else
|
1998-11-16 10:02:45 +08:00
|
|
|
# ifdef HAVE_STRING_H
|
|
|
|
# include <string.h>
|
1998-11-17 12:07:31 +08:00
|
|
|
# elif HAVE_STRINGS_H
|
1998-11-16 10:02:45 +08:00
|
|
|
# include <strings.h>
|
|
|
|
# endif
|
|
|
|
|
1998-11-18 03:05:48 +08:00
|
|
|
# ifdef HAVE_MEMORY_H
|
|
|
|
# include <memory.h>
|
|
|
|
# endif
|
|
|
|
|
1998-11-20 15:04:20 +08:00
|
|
|
# ifndef HAVE_STRRCHR
|
1999-02-21 02:31:56 +08:00
|
|
|
# undef strchr
|
1998-10-25 09:41:42 +08:00
|
|
|
# define strchr index
|
1999-02-21 02:31:56 +08:00
|
|
|
# undef strrchr
|
1998-10-25 09:41:42 +08:00
|
|
|
# define strrchr rindex
|
|
|
|
# endif
|
|
|
|
|
|
|
|
# ifndef HAVE_MEMCPY
|
1999-02-21 02:31:56 +08:00
|
|
|
# undef memcpy
|
1998-11-23 12:29:01 +08:00
|
|
|
# define memcpy(d, s, n) ((void) bcopy ((s), (d), (n)))
|
1999-02-21 02:31:56 +08:00
|
|
|
# undef memmove
|
1998-11-23 12:29:01 +08:00
|
|
|
# define memmove(d, s, n) ((void) bcopy ((s), (d), (n)))
|
1998-10-25 09:41:42 +08:00
|
|
|
# endif
|
1998-11-18 03:05:48 +08:00
|
|
|
#endif
|
1998-11-16 10:02:45 +08:00
|
|
|
|
1999-02-21 04:12:03 +08:00
|
|
|
/* use ldap_pvt_strtok instead of strtok or strtok_r! */
|
2000-06-19 03:48:07 +08:00
|
|
|
LDAP_F(char *) ldap_pvt_strtok LDAP_P(( char *str, const char *delim,
|
1999-11-28 07:40:08 +08:00
|
|
|
char **pos ));
|
1999-06-08 02:35:30 +08:00
|
|
|
|
1998-11-18 03:05:48 +08:00
|
|
|
#ifndef HAVE_STRDUP
|
1998-11-20 15:04:20 +08:00
|
|
|
/* strdup() is missing, declare our own version */
|
1999-02-21 02:31:56 +08:00
|
|
|
# undef strdup
|
2000-06-07 13:17:29 +08:00
|
|
|
# define strdup(s) ber_strdup(s)
|
1999-01-17 23:27:30 +08:00
|
|
|
#else
|
1999-05-25 07:01:57 +08:00
|
|
|
/* some systems fail to declare strdup */
|
2000-06-19 03:48:07 +08:00
|
|
|
LDAP_LIBC_F(char *) (strdup)();
|
1998-10-25 09:41:42 +08:00
|
|
|
#endif
|
|
|
|
|
1998-11-20 15:04:20 +08:00
|
|
|
/*
|
|
|
|
* some systems fail to declare strcasecmp() and strncasecmp()
|
1998-11-23 12:29:01 +08:00
|
|
|
* we need them declared so we can obtain pointers to them
|
1998-11-20 15:04:20 +08:00
|
|
|
*/
|
1999-11-28 07:40:08 +08:00
|
|
|
|
|
|
|
/* In Mingw32, strcasecmp is not in the C library, so we don't LIBC_F it */
|
|
|
|
int (strcasecmp)();
|
|
|
|
int (strncasecmp)();
|
1998-11-20 15:04:20 +08:00
|
|
|
|
1998-10-25 09:41:42 +08:00
|
|
|
#ifndef SAFEMEMCPY
|
|
|
|
# if defined( HAVE_MEMMOVE )
|
|
|
|
# define SAFEMEMCPY( d, s, n ) memmove((d), (s), (n))
|
1998-11-17 12:07:31 +08:00
|
|
|
# elif defined( HAVE_BCOPY )
|
1998-10-25 09:41:42 +08:00
|
|
|
# define SAFEMEMCPY( d, s, n ) bcopy((s), (d), (n))
|
1998-11-17 12:07:31 +08:00
|
|
|
# else
|
1998-10-25 09:41:42 +08:00
|
|
|
/* nothing left but memcpy() */
|
|
|
|
# define SAFEMEMCPY( d, s, n ) memcpy((d), (s), (n))
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* _AC_STRING_H */
|