]> git.saurik.com Git - apple/libc.git/blob - include/string.h
b32f28a01034c9001b111a259914b32b7ba997bb
[apple/libc.git] / include / string.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25 /*-
26 * Copyright (c) 1990, 1993
27 * The Regents of the University of California. All rights reserved.
28 *
29 * Redistribution and use in source and binary forms, with or without
30 * modification, are permitted provided that the following conditions
31 * are met:
32 * 1. Redistributions of source code must retain the above copyright
33 * notice, this list of conditions and the following disclaimer.
34 * 2. Redistributions in binary form must reproduce the above copyright
35 * notice, this list of conditions and the following disclaimer in the
36 * documentation and/or other materials provided with the distribution.
37 * 3. All advertising materials mentioning features or use of this software
38 * must display the following acknowledgement:
39 * This product includes software developed by the University of
40 * California, Berkeley and its contributors.
41 * 4. Neither the name of the University nor the names of its contributors
42 * may be used to endorse or promote products derived from this software
43 * without specific prior written permission.
44 *
45 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
46 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
47 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
48 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
49 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
50 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
51 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
52 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
53 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
54 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
55 * SUCH DAMAGE.
56 *
57 * @(#)string.h 8.1 (Berkeley) 6/2/93
58 */
59
60 #ifndef _STRING_H_
61 #define _STRING_H_
62 #include <machine/ansi.h>
63
64 #ifndef _BSD_SIZE_T_DEFINED_
65 #define _BSD_SIZE_T_DEFINED_
66 typedef _BSD_SIZE_T_ size_t;
67 #endif
68
69 #ifndef NULL
70 #ifdef __GNUG__
71 #define NULL __null
72 #else /* ! __GNUG__ */
73 #ifndef __cplusplus
74 #define NULL ((void *)0)
75 #else /* __cplusplus */
76 #define NULL 0
77 #endif /* ! __cplusplus */
78 #endif /* __GNUG__ */
79 #endif /* ! NULL */
80
81 #include <sys/cdefs.h>
82
83 __BEGIN_DECLS
84 void *memchr(const void *, int, size_t);
85 int memcmp(const void *, const void *, size_t);
86 void *memcpy(void *, const void *, size_t);
87 void *memmove(void *, const void *, size_t);
88 void *memset(void *, int, size_t);
89 #ifndef _POSIX_SOURCE
90 char *stpcpy(char *, const char *);
91 char *strcasestr(const char *, const char *);
92 #endif /* !_POSIX_SOURCE */
93 char *strcat(char *, const char *);
94 char *strchr(const char *, int);
95 int strcmp(const char *, const char *);
96 int strcoll(const char *, const char *);
97 char *strcpy(char *, const char *);
98 size_t strcspn(const char *, const char *);
99 char *strerror(int);
100 int strerror_r(int, char *, size_t);
101 size_t strlen(const char *);
102 char *strncat(char *, const char *, size_t);
103 int strncmp(const char *, const char *, size_t);
104 char *strncpy(char *, const char *, size_t);
105 #ifndef _POSIX_SOURCE
106 char *strnstr(const char *, const char *, size_t);
107 #endif /* !_POSIX_SOURCE */
108 char *strpbrk(const char *, const char *);
109 char *strrchr(const char *, int);
110 size_t strspn(const char *, const char *);
111 char *strstr(const char *, const char *);
112 char *strtok(char *, const char *);
113 size_t strxfrm(char *, const char *, size_t);
114
115 /* Nonstandard routines */
116 #ifndef _ANSI_SOURCE
117 void *memccpy(void *, const void *, int, size_t);
118 char *strtok_r(char *, const char *, char **);
119 char *strdup(const char *);
120 #ifndef _POSIX_SOURCE
121 int bcmp(const void *, const void *, size_t);
122 void bcopy(const void *, void *, size_t);
123 void bzero(void *, size_t);
124 int ffs(int);
125 char *index(const char *, int);
126 char *rindex(const char *, int);
127 int strcasecmp(const char *, const char *);
128 size_t strlcat(char *, const char *, size_t);
129 size_t strlcpy(char *, const char *, size_t);
130 void strmode(int, char *);
131 int strncasecmp(const char *, const char *, size_t);
132 char *strsep(char **, const char *);
133 char *strsignal(int sig);
134 void swab(const void *, void *, size_t);
135 #endif /* !_POSIX_SOURCE */
136 #endif /* !_ANSI_SOURCE */
137 __END_DECLS
138
139 #endif /* _STRING_H_ */