1998-10-24 21:41:42 -04:00
|
|
|
/* Generic string.h */
|
1998-12-28 14:51:35 -05:00
|
|
|
/*
|
|
|
|
|
* Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
|
|
|
|
|
* 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-24 21:41:42 -04:00
|
|
|
|
|
|
|
|
#ifndef _AC_STRING_H
|
|
|
|
|
#define _AC_STRING_H
|
|
|
|
|
|
|
|
|
|
#ifdef STDC_HEADERS
|
|
|
|
|
# include <string.h>
|
1998-11-17 14:05:48 -05:00
|
|
|
|
1998-10-24 21:41:42 -04:00
|
|
|
#else
|
1998-11-15 21:02:45 -05:00
|
|
|
# ifdef HAVE_STRING_H
|
|
|
|
|
# include <string.h>
|
1998-11-16 23:07:31 -05:00
|
|
|
# elif HAVE_STRINGS_H
|
1998-11-15 21:02:45 -05:00
|
|
|
# include <strings.h>
|
|
|
|
|
# endif
|
|
|
|
|
|
1998-11-17 14:05:48 -05:00
|
|
|
# ifdef HAVE_MEMORY_H
|
|
|
|
|
# include <memory.h>
|
|
|
|
|
# endif
|
|
|
|
|
|
1998-11-20 02:04:20 -05:00
|
|
|
/* we should actually create <ac/stdlib.h> */
|
1998-11-17 14:05:48 -05:00
|
|
|
# ifdef HAVE_MALLOC_H
|
|
|
|
|
# include <malloc.h>
|
|
|
|
|
# endif
|
|
|
|
|
|
1998-11-20 02:04:20 -05:00
|
|
|
# ifndef HAVE_STRRCHR
|
1999-02-20 13:31:56 -05:00
|
|
|
# undef strchr
|
1998-10-24 21:41:42 -04:00
|
|
|
# define strchr index
|
1999-02-20 13:31:56 -05:00
|
|
|
# undef strrchr
|
1998-10-24 21:41:42 -04:00
|
|
|
# define strrchr rindex
|
|
|
|
|
# endif
|
|
|
|
|
|
|
|
|
|
# ifndef HAVE_MEMCPY
|
1999-02-20 13:31:56 -05:00
|
|
|
# undef memcpy
|
1998-11-22 23:29:01 -05:00
|
|
|
# define memcpy(d, s, n) ((void) bcopy ((s), (d), (n)))
|
1999-02-20 13:31:56 -05:00
|
|
|
# undef memmove
|
1998-11-22 23:29:01 -05:00
|
|
|
# define memmove(d, s, n) ((void) bcopy ((s), (d), (n)))
|
1998-10-24 21:41:42 -04:00
|
|
|
# endif
|
1998-11-17 14:05:48 -05:00
|
|
|
#endif
|
1998-11-15 21:02:45 -05:00
|
|
|
|
1999-02-20 15:12:03 -05:00
|
|
|
/* use ldap_pvt_strtok instead of strtok or strtok_r! */
|
1999-01-21 23:33:29 -05:00
|
|
|
extern char *ldap_pvt_strtok( char *str, const char *delim, char **pos );
|
|
|
|
|
|
|
|
|
|
extern char *ldap_pvt_strdup( const char * s );
|
1998-11-17 14:05:48 -05:00
|
|
|
#ifndef HAVE_STRDUP
|
1998-11-20 02:04:20 -05:00
|
|
|
/* strdup() is missing, declare our own version */
|
1999-02-20 13:31:56 -05:00
|
|
|
# undef strdup
|
1999-01-21 23:33:29 -05:00
|
|
|
# define strdup(s) ldap_pvt_strdup(s)
|
1999-01-17 10:27:30 -05:00
|
|
|
#else
|
1999-03-14 19:19:46 -05:00
|
|
|
# ifdef DECL_STRDUP
|
|
|
|
|
/* some systems fail to declare strdup */
|
1999-05-18 16:52:36 -04:00
|
|
|
extern char *(strdup)();
|
1999-03-14 19:19:46 -05:00
|
|
|
# endif
|
1998-10-24 21:41:42 -04:00
|
|
|
#endif
|
|
|
|
|
|
1998-11-20 02:04:20 -05:00
|
|
|
/*
|
|
|
|
|
* some systems fail to declare strcasecmp() and strncasecmp()
|
1998-11-22 23:29:01 -05:00
|
|
|
* we need them declared so we can obtain pointers to them
|
1998-11-20 02:04:20 -05:00
|
|
|
*/
|
1999-05-20 23:10:52 -04:00
|
|
|
extern int (strcasecmp)();
|
|
|
|
|
extern int (strncasecmp)();
|
1998-11-20 02:04:20 -05:00
|
|
|
|
1998-10-24 21:41:42 -04:00
|
|
|
#ifndef SAFEMEMCPY
|
|
|
|
|
# if defined( HAVE_MEMMOVE )
|
|
|
|
|
# define SAFEMEMCPY( d, s, n ) memmove((d), (s), (n))
|
1998-11-16 23:07:31 -05:00
|
|
|
# elif defined( HAVE_BCOPY )
|
1998-10-24 21:41:42 -04:00
|
|
|
# define SAFEMEMCPY( d, s, n ) bcopy((s), (d), (n))
|
1998-11-16 23:07:31 -05:00
|
|
|
# else
|
1998-10-24 21:41:42 -04:00
|
|
|
/* nothing left but memcpy() */
|
|
|
|
|
# define SAFEMEMCPY( d, s, n ) memcpy((d), (s), (n))
|
|
|
|
|
# endif
|
|
|
|
|
#endif
|
|
|
|
|
|
1998-11-20 02:04:20 -05:00
|
|
|
|
1998-10-24 21:41:42 -04:00
|
|
|
#endif /* _AC_STRING_H */
|