source: trunk/src/emx/include/string.h@ 2285

Last change on this file since 2285 was 2285, checked in by bird, 20 years ago

_memcpy_amd.

  • Property cvs2svn:cvs-rev set to 1.18
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 7.5 KB
Line 
1/* string.h,v 1.13 2004/09/14 22:27:36 bird Exp */
2/** @file
3 * FreeBSD 5.1
4 * @changed bird: EMXifications.
5 * @changed bird: GNU extension(s).
6 */
7
8/*-
9 * Copyright (c) 1990, 1993
10 * The Regents of the University of California. All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. All advertising materials mentioning features or use of this software
21 * must display the following acknowledgement:
22 * This product includes software developed by the University of
23 * California, Berkeley and its contributors.
24 * 4. Neither the name of the University nor the names of its contributors
25 * may be used to endorse or promote products derived from this software
26 * without specific prior written permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
29 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
32 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 * SUCH DAMAGE.
39 *
40 * @(#)string.h 8.1 (Berkeley) 6/2/93
41 * $FreeBSD: src/include/string.h,v 1.18 2002/10/14 20:38:40 mike Exp $
42 */
43
44#ifndef _STRING_H_
45#define _STRING_H_
46
47#include <sys/cdefs.h>
48#include <sys/_types.h>
49
50/*
51 * Prototype functions which were historically defined in <string.h>, but
52 * are required by POSIX to be prototyped in <strings.h>.
53 */
54#if __BSD_VISIBLE
55#include <strings.h>
56#endif
57
58#if !defined(_SIZE_T_DECLARED) && !defined(_SIZE_T) /* bird: EMX */
59typedef __size_t size_t;
60#define _SIZE_T_DECLARED
61#define _SIZE_T /* bird: EMX */
62#endif
63
64#ifndef NULL
65#define NULL 0
66#endif
67
68__BEGIN_DECLS
69#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
70void *memccpy(void * __restrict, const void * __restrict, int, size_t);
71#endif
72void *memchr(const void *, int, size_t);
73int memcmp(const void *, const void *, size_t);
74void *memcpy(void * __restrict, const void * __restrict, size_t);
75void *memmove(void *, const void *, size_t);
76void *memset(void *, int, size_t);
77#if __BSD_VISIBLE
78char *stpcpy(char *, const char *);
79char *strcasestr(const char *, const char *);
80#endif
81char *strcat(char * __restrict, const char * __restrict);
82char *strchr(const char *, int);
83int strcmp(const char *, const char *);
84int strcoll(const char *, const char *);
85char *strcpy(char * __restrict, const char * __restrict);
86size_t strcspn(const char *, const char *);
87#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
88char *strdup(const char *);
89#endif
90char *strerror(int);
91#if __POSIX_VISIBLE >= 200112
92int strerror_r(int, char *, size_t);
93#endif
94#if __BSD_VISIBLE
95size_t strlcat(char *, const char *, size_t);
96size_t strlcpy(char *, const char *, size_t);
97#endif
98size_t strlen(const char *);
99#if __BSD_VISIBLE
100void strmode(int, char *);
101#endif
102char *strncat(char * __restrict, const char * __restrict, size_t);
103int strncmp(const char *, const char *, size_t);
104char *strncpy(char * __restrict, const char * __restrict, size_t);
105#if __BSD_VISIBLE
106char *strnstr(const char *, const char *, size_t);
107#endif
108char *strpbrk(const char *, const char *);
109char *strrchr(const char *, int);
110#if __BSD_VISIBLE
111char *strsep(char **, const char *);
112 char *strsignal(int);
113#endif
114size_t strspn(const char *, const char *);
115char *strstr(const char *, const char *);
116char *strtok(char * __restrict, const char * __restrict);
117#if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE >= 500
118char *strtok_r(char *, const char *, char **);
119#endif
120size_t strxfrm(char * __restrict, const char * __restrict, size_t);
121#if __BSD_VISIBLE
122void swab(const void *, void *, size_t);
123#endif
124
125
126/* bird: EMX stuff - start */
127
128#if !defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE) || defined(__USE_EMX)
129#if !defined (_MEMDIF_EQ)
130#define _MEMDIF_EQ 0xffffffff
131#endif
132int memicmp(__const__ void *, __const__ void *, size_t);
133int stricmp(__const__ char *, __const__ char *);
134char * strlwr(char *);
135int strnicmp(__const__ char *, __const__ char *, size_t);
136char * strnset(char *, int, size_t);
137char * strrev(char *);
138char * strset(char *, int);
139char * strupr(char *);
140#endif
141
142#if (!defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE)) || defined (_WITH_UNDERSCORE) || defined(__USE_EMX)
143size_t _memcount (__const__ void *, int, size_t);
144size_t _memdif (__const__ void *, __const__ void *, size_t);
145void *_memrchr (const void *, int, size_t);
146void _memswap (void *, void *, size_t);
147char *_strncpy (char *, __const__ char *, size_t);
148void *_memccpy (void *, __const__ void *, int, size_t);
149int _memicmp (__const__ void *, __const__ void *, size_t);
150char *_strdup (__const__ char *);
151int _stricmp (__const__ char *, __const__ char *);
152char *_strlwr (char *);
153int _strnicmp (__const__ char *, __const__ char *, size_t);
154char *_strnset (char *, int, size_t);
155char *_strrev (char *);
156char *_strset (char *, int);
157char *_strupr (char *);
158char *_strsep (char **, __const__ char *);
159#endif
160
161/* bird: EMX stuff - end */
162
163/* bird: LIBC extensions - start */
164#ifdef __USE_EMX
165void *_memcpy_amd(void *, const void *, size_t);
166#endif
167
168/* bird: LIBC extensions - end */
169
170/* bird: GNU stuff - start */
171#ifdef __USE_GNU
172char *basename(const char *);
173size_t strnlen(const char *, size_t);
174void *mempcpy(void *, const void *, size_t);
175char *strndup(const char *, size_t);
176void *memrchr(const void *, int, size_t);
177#define memrchr(pach, ch, cch) _memrchr(pach, ch, cch)
178int strverscmp(const char *, const char *);
179char *strchrnul(const char *, int);
180void *rawmemchr(const void *, int);
181char *stpncpy(char *, const char *, int);
182
183size_t __strnlen(const char *, size_t);
184void *__mempcpy(void *, const void *, size_t);
185char *__strndup(const char *, size_t);
186void *_memrchr(const void *, int, size_t);
187void *__memrchr(const void *, int, size_t);
188#define __memrchr(pach, ch, cch) _memrchr(pach, ch, cch)
189int __strverscmp(const char *, const char *);
190char *__strchrnul(const char *, int);
191void *__rawmemchr(const void *, int);
192char *__stpncpy(char *, const char *, int);
193
194#define strdupa(psz) \
195 (__extension__({ \
196 __const__ char *__pszInput = (psz); \
197 size_t __cchInput = strlen(__pszInput) + 1; \
198 char *__pszReturn = __builtin_alloca(__cchInput); \
199 (char *)memcpy(__pszReturn, __pszInput, __cchInput); \
200 }))
201
202#define strndupa(psz, cch) \
203 (__extension__({ \
204 __const__ char *__pszInput = (psz); \
205 size_t __cchInput = strnlen(__pszInput, (cch)); \
206 char *__pszReturn = __builtin_alloca(__cchInput + 1); \
207 __pszReturn[__cchInput] = '\0'; \
208 (char *)memcpy(__pszReturn, __pszInput, __cchInput); \
209 }))
210
211#endif
212/* bird: GNU stuff - end */
213
214__END_DECLS
215
216#endif /* _STRING_H_ */
217
Note: See TracBrowser for help on using the repository browser.