2000-02-18 03:39:52 +08:00
|
|
|
/*
|
|
|
|
* string.h
|
|
|
|
*
|
|
|
|
* Definitions for memory and string functions.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _STRING_H_
|
|
|
|
#define _STRING_H_
|
|
|
|
|
|
|
|
#include "_ansi.h"
|
|
|
|
#include <sys/reent.h>
|
2011-03-03 19:11:41 +08:00
|
|
|
#include <sys/cdefs.h>
|
2000-02-18 03:39:52 +08:00
|
|
|
|
|
|
|
#define __need_size_t
|
|
|
|
#include <stddef.h>
|
|
|
|
|
|
|
|
#ifndef NULL
|
|
|
|
#define NULL 0
|
|
|
|
#endif
|
|
|
|
|
2002-06-28 07:58:38 +08:00
|
|
|
_BEGIN_STD_C
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
_PTR _EXFUN(memchr,(const _PTR, int, size_t));
|
|
|
|
int _EXFUN(memcmp,(const _PTR, const _PTR, size_t));
|
|
|
|
_PTR _EXFUN(memcpy,(_PTR, const _PTR, size_t));
|
|
|
|
_PTR _EXFUN(memmove,(_PTR, const _PTR, size_t));
|
|
|
|
_PTR _EXFUN(memset,(_PTR, int, size_t));
|
|
|
|
char *_EXFUN(strcat,(char *, const char *));
|
|
|
|
char *_EXFUN(strchr,(const char *, int));
|
|
|
|
int _EXFUN(strcmp,(const char *, const char *));
|
|
|
|
int _EXFUN(strcoll,(const char *, const char *));
|
|
|
|
char *_EXFUN(strcpy,(char *, const char *));
|
|
|
|
size_t _EXFUN(strcspn,(const char *, const char *));
|
|
|
|
char *_EXFUN(strerror,(int));
|
|
|
|
size_t _EXFUN(strlen,(const char *));
|
|
|
|
char *_EXFUN(strncat,(char *, const char *, size_t));
|
|
|
|
int _EXFUN(strncmp,(const char *, const char *, size_t));
|
|
|
|
char *_EXFUN(strncpy,(char *, const char *, size_t));
|
|
|
|
char *_EXFUN(strpbrk,(const char *, const char *));
|
|
|
|
char *_EXFUN(strrchr,(const char *, int));
|
|
|
|
size_t _EXFUN(strspn,(const char *, const char *));
|
|
|
|
char *_EXFUN(strstr,(const char *, const char *));
|
|
|
|
|
|
|
|
#ifndef _REENT_ONLY
|
|
|
|
char *_EXFUN(strtok,(char *, const char *));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
size_t _EXFUN(strxfrm,(char *, const char *, size_t));
|
|
|
|
|
|
|
|
#ifndef __STRICT_ANSI__
|
|
|
|
char *_EXFUN(strtok_r,(char *, const char *, char **));
|
|
|
|
|
2002-05-24 02:46:04 +08:00
|
|
|
int _EXFUN(bcmp,(const void *, const void *, size_t));
|
|
|
|
void _EXFUN(bcopy,(const void *, void *, size_t));
|
|
|
|
void _EXFUN(bzero,(void *, size_t));
|
2000-02-18 03:39:52 +08:00
|
|
|
int _EXFUN(ffs,(int));
|
|
|
|
char *_EXFUN(index,(const char *, int));
|
|
|
|
_PTR _EXFUN(memccpy,(_PTR, const _PTR, int, size_t));
|
2002-07-24 05:38:00 +08:00
|
|
|
_PTR _EXFUN(mempcpy,(_PTR, const _PTR, size_t));
|
2008-01-12 12:25:55 +08:00
|
|
|
_PTR _EXFUN(memmem, (const _PTR, size_t, const _PTR, size_t));
|
2012-05-10 16:34:08 +08:00
|
|
|
_PTR _EXFUN(memrchr,(const _PTR, int, size_t));
|
2000-02-18 03:39:52 +08:00
|
|
|
char *_EXFUN(rindex,(const char *, int));
|
2007-06-29 01:07:23 +08:00
|
|
|
char *_EXFUN(stpcpy,(char *, const char *));
|
|
|
|
char *_EXFUN(stpncpy,(char *, const char *, size_t));
|
2000-02-18 03:39:52 +08:00
|
|
|
int _EXFUN(strcasecmp,(const char *, const char *));
|
2007-06-09 02:38:51 +08:00
|
|
|
char *_EXFUN(strcasestr,(const char *, const char *));
|
2011-03-28 22:51:28 +08:00
|
|
|
char *_EXFUN(strchrnul,(const char *, int));
|
2000-02-18 03:39:52 +08:00
|
|
|
char *_EXFUN(strdup,(const char *));
|
|
|
|
char *_EXFUN(_strdup_r,(struct _reent *, const char *));
|
2002-07-24 05:38:00 +08:00
|
|
|
char *_EXFUN(strndup,(const char *, size_t));
|
|
|
|
char *_EXFUN(_strndup_r,(struct _reent *, const char *, size_t));
|
2011-02-11 00:48:18 +08:00
|
|
|
/* There are two common strerror_r variants. If you request
|
|
|
|
_GNU_SOURCE, you get the GNU version; otherwise you get the POSIX
|
|
|
|
version. POSIX requires that #undef strerror_r will still let you
|
|
|
|
invoke the underlying function, but that requires gcc support. */
|
|
|
|
#ifdef _GNU_SOURCE
|
|
|
|
char *_EXFUN(strerror_r,(int, char *, size_t));
|
|
|
|
#else
|
|
|
|
# ifdef __GNUC__
|
2011-03-03 18:37:09 +08:00
|
|
|
int _EXFUN(strerror_r,(int, char *, size_t)) __asm__ (__ASMNAME ("__xpg_strerror_r"));
|
2011-02-11 00:48:18 +08:00
|
|
|
# else
|
|
|
|
int _EXFUN(__xpg_strerror_r,(int, char *, size_t));
|
|
|
|
# define strerror_r __xpg_strerror_r
|
|
|
|
# endif
|
|
|
|
#endif
|
2002-05-14 03:33:01 +08:00
|
|
|
size_t _EXFUN(strlcat,(char *, const char *, size_t));
|
|
|
|
size_t _EXFUN(strlcpy,(char *, const char *, size_t));
|
2000-02-18 03:39:52 +08:00
|
|
|
int _EXFUN(strncasecmp,(const char *, const char *, size_t));
|
2002-05-25 07:44:39 +08:00
|
|
|
size_t _EXFUN(strnlen,(const char *, size_t));
|
2000-02-18 03:39:52 +08:00
|
|
|
char *_EXFUN(strsep,(char **, const char *));
|
|
|
|
char *_EXFUN(strlwr,(char *));
|
|
|
|
char *_EXFUN(strupr,(char *));
|
2000-06-03 11:03:03 +08:00
|
|
|
#ifndef DEFS_H /* Kludge to work around problem compiling in gdb */
|
2008-06-18 23:27:41 +08:00
|
|
|
char *_EXFUN(strsignal, (int __signo));
|
2000-06-03 11:03:03 +08:00
|
|
|
#endif
|
2011-01-10 18:59:42 +08:00
|
|
|
#ifdef __CYGWIN__
|
2000-02-18 03:39:52 +08:00
|
|
|
int _EXFUN(strtosigno, (const char *__name));
|
|
|
|
#endif
|
|
|
|
|
2011-05-26 02:41:10 +08:00
|
|
|
/* Recursive version of strerror. */
|
|
|
|
char * _EXFUN(_strerror_r, (struct _reent *, int, int, int *));
|
|
|
|
|
2011-06-11 02:30:38 +08:00
|
|
|
#if defined _GNU_SOURCE && defined __GNUC__
|
|
|
|
#define strdupa(__s) \
|
|
|
|
(__extension__ ({const char *__in = (__s); \
|
|
|
|
size_t __len = strlen (__in) + 1; \
|
|
|
|
char * __out = (char *) __builtin_alloca (__len); \
|
|
|
|
(char *) memcpy (__out, __in, __len);}))
|
|
|
|
#define strndupa(__s, __n) \
|
|
|
|
(__extension__ ({const char *__in = (__s); \
|
|
|
|
size_t __len = strnlen (__in, (__n)) + 1; \
|
|
|
|
char *__out = (char *) __builtin_alloca (__len); \
|
|
|
|
__out[__len-1] = '\0'; \
|
|
|
|
(char *) memcpy (__out, __in, __len-1);}))
|
|
|
|
#endif /* _GNU_SOURCE && __GNUC__ */
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
/* These function names are used on Windows and perhaps other systems. */
|
|
|
|
#ifndef strcmpi
|
|
|
|
#define strcmpi strcasecmp
|
|
|
|
#endif
|
|
|
|
#ifndef stricmp
|
|
|
|
#define stricmp strcasecmp
|
|
|
|
#endif
|
|
|
|
#ifndef strncmpi
|
|
|
|
#define strncmpi strncasecmp
|
|
|
|
#endif
|
|
|
|
#ifndef strnicmp
|
|
|
|
#define strnicmp strncasecmp
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* ! __STRICT_ANSI__ */
|
|
|
|
|
2005-01-25 02:46:09 +08:00
|
|
|
#include <sys/string.h>
|
|
|
|
|
2002-06-28 07:58:38 +08:00
|
|
|
_END_STD_C
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
#endif /* _STRING_H_ */
|