1/*
2 * string.h
3 *
4 * Definitions for memory and string functions.
5 */
6
7#ifndef _STRING_H_
8#define	_STRING_H_
9
10#include "_ansi.h"
11#include <sys/reent.h>
12#include <sys/cdefs.h>
13#include <sys/features.h>
14
15#define __need_size_t
16#define __need_NULL
17#include <stddef.h>
18
19_BEGIN_STD_C
20
21_PTR 	 _EXFUN(memchr,(const _PTR, int, size_t));
22int 	 _EXFUN(memcmp,(const _PTR, const _PTR, size_t));
23_PTR 	 _EXFUN(memcpy,(_PTR, const _PTR, size_t));
24_PTR	 _EXFUN(memmove,(_PTR, const _PTR, size_t));
25_PTR	 _EXFUN(memset,(_PTR, int, size_t));
26char 	*_EXFUN(strcat,(char *, const char *));
27char 	*_EXFUN(strchr,(const char *, int));
28int	 _EXFUN(strcmp,(const char *, const char *));
29int	 _EXFUN(strcoll,(const char *, const char *));
30char 	*_EXFUN(strcpy,(char *, const char *));
31size_t	 _EXFUN(strcspn,(const char *, const char *));
32char 	*_EXFUN(strerror,(int));
33size_t	 _EXFUN(strlen,(const char *));
34char 	*_EXFUN(strncat,(char *, const char *, size_t));
35int	 _EXFUN(strncmp,(const char *, const char *, size_t));
36char 	*_EXFUN(strncpy,(char *, const char *, size_t));
37char 	*_EXFUN(strpbrk,(const char *, const char *));
38char 	*_EXFUN(strrchr,(const char *, int));
39size_t	 _EXFUN(strspn,(const char *, const char *));
40char 	*_EXFUN(strstr,(const char *, const char *));
41
42#ifndef _REENT_ONLY
43char 	*_EXFUN(strtok,(char *, const char *));
44#endif
45
46size_t	 _EXFUN(strxfrm,(char *, const char *, size_t));
47
48#if !defined __STRICT_ANSI__ && !defined _AEABI_PORTABLE
49char 	*_EXFUN(strtok_r,(char *, const char *, char **));
50
51int	 _EXFUN(bcmp,(const void *, const void *, size_t));
52void	 _EXFUN(bcopy,(const void *, void *, size_t));
53void	 _EXFUN(bzero,(void *, size_t));
54int	 _EXFUN(ffs,(int));
55char 	*_EXFUN(index,(const char *, int));
56_PTR	 _EXFUN(memccpy,(_PTR, const _PTR, int, size_t));
57_PTR	 _EXFUN(mempcpy,(_PTR, const _PTR, size_t));
58_PTR	 _EXFUN(memmem, (const _PTR, size_t, const _PTR, size_t));
59_PTR 	 _EXFUN(memrchr,(const _PTR, int, size_t));
60_PTR 	 _EXFUN(rawmemchr,(const _PTR, int));
61char 	*_EXFUN(rindex,(const char *, int));
62char 	*_EXFUN(stpcpy,(char *, const char *));
63char 	*_EXFUN(stpncpy,(char *, const char *, size_t));
64int	 _EXFUN(strcasecmp,(const char *, const char *));
65char	*_EXFUN(strcasestr,(const char *, const char *));
66char 	*_EXFUN(strchrnul,(const char *, int));
67#endif
68#if !defined(__STRICT_ANSI__) || (_XOPEN_SOURCE - 0) >= 500
69char 	*_EXFUN(strdup,(const char *));
70#endif
71#ifndef __STRICT_ANSI__
72char 	*_EXFUN(_strdup_r,(struct _reent *, const char *));
73#endif
74#if !defined(__STRICT_ANSI__) || (_XOPEN_SOURCE - 0) >= 700
75char 	*_EXFUN(strndup,(const char *, size_t));
76#endif
77#ifndef __STRICT_ANSI__
78char 	*_EXFUN(_strndup_r,(struct _reent *, const char *, size_t));
79/* There are two common strerror_r variants.  If you request
80   _GNU_SOURCE, you get the GNU version; otherwise you get the POSIX
81   version.  POSIX requires that #undef strerror_r will still let you
82   invoke the underlying function, but that requires gcc support.  */
83#ifdef _GNU_SOURCE
84char    *_EXFUN(strerror_r,(int, char *, size_t));
85#else
86# ifdef __GNUC__
87int      _EXFUN(strerror_r,(int, char *, size_t)) __asm__ (__ASMNAME ("__xpg_strerror_r"));
88# else
89int      _EXFUN(__xpg_strerror_r,(int, char *, size_t));
90#  define strerror_r __xpg_strerror_r
91# endif
92#endif
93size_t	 _EXFUN(strlcat,(char *, const char *, size_t));
94size_t	 _EXFUN(strlcpy,(char *, const char *, size_t));
95int	 _EXFUN(strncasecmp,(const char *, const char *, size_t));
96size_t	 _EXFUN(strnlen,(const char *, size_t));
97char 	*_EXFUN(strsep,(char **, const char *));
98char	*_EXFUN(strlwr,(char *));
99char	*_EXFUN(strupr,(char *));
100#ifndef DEFS_H	/* Kludge to work around problem compiling in gdb */
101char  *_EXFUN(strsignal, (int __signo));
102#endif
103#ifdef __CYGWIN__
104int     _EXFUN(strtosigno, (const char *__name));
105#endif
106
107/* Recursive version of strerror.  */
108char *	_EXFUN(_strerror_r, (struct _reent *, int, int, int *));
109
110#if defined _GNU_SOURCE && defined __GNUC__
111#define strdupa(__s) \
112	(__extension__ ({const char *__in = (__s); \
113			 size_t __len = strlen (__in) + 1; \
114			 char * __out = (char *) __builtin_alloca (__len); \
115			 (char *) memcpy (__out, __in, __len);}))
116#define strndupa(__s, __n) \
117	(__extension__ ({const char *__in = (__s); \
118			 size_t __len = strnlen (__in, (__n)) + 1; \
119			 char *__out = (char *) __builtin_alloca (__len); \
120			 __out[__len-1] = '\0'; \
121			 (char *) memcpy (__out, __in, __len-1);}))
122#endif /* _GNU_SOURCE && __GNUC__ */
123
124/* These function names are used on Windows and perhaps other systems.  */
125#ifndef strcmpi
126#define strcmpi strcasecmp
127#endif
128#ifndef stricmp
129#define stricmp strcasecmp
130#endif
131#ifndef strncmpi
132#define strncmpi strncasecmp
133#endif
134#ifndef strnicmp
135#define strnicmp strncasecmp
136#endif
137
138#endif /* ! __STRICT_ANSI__ && !_AEABI_PORTABLE */
139
140#include <sys/string.h>
141
142_END_STD_C
143
144#endif /* _STRING_H_ */
145