OSDN Git Service

More updates. Implement strsignal. Add pwd_grp tests
[uclinux-h8/uClibc.git] / include / string.h
1
2 #ifndef __STRING_H
3 #define __STRING_H
4 #include <features.h>
5 #include <sys/types.h>
6 #include <stddef.h>
7
8 /* Basic string functions */
9
10 /* Return the length of S.  */
11 extern size_t strlen __P ((__const char *__s));
12 /* Append SRC onto DEST.  */
13 extern char *strcat __P ((char *__restrict __dest,
14                           __const char *__restrict __src));
15 /* Append no more than N characters from SRC onto DEST.  */
16 extern char *strncat __P ((char *__restrict __dest,
17                            __const char *__restrict __src, size_t __n));
18
19 /* Copy SRC to DEST.  */
20 extern char *strcpy __P ((char *__restrict __dest,
21                           __const char *__restrict __src));
22 /* Copy no more than N characters of SRC to DEST.  */
23 extern char *strncpy __P ((char *__restrict __dest,
24                            __const char *__restrict __src, size_t __n));
25
26 /* Compare S1 and S2.  */
27 extern int strcmp __P ((__const char *__s1, __const char *__s2));
28 /* Compare N characters of S1 and S2.  */
29 extern int strncmp __P ((__const char *__s1, __const char *__s2, size_t __n));
30
31 /* Find the first occurrence of C in S.  */
32 extern char *strchr __P ((__const char *__s, int __c));
33 /* Find the last occurrence of C in S.  */
34 extern char *strrchr __P ((__const char *__s, int __c));
35 /* Duplicate S, returning an identical malloc'd string.  */
36 extern char *strdup __P ((__const char *__s));
37
38 /* Basic mem functions */
39
40 /* Copy N bytes of SRC to DEST.  */
41 extern __ptr_t memcpy __P ((__ptr_t __restrict __dest,
42                             __const __ptr_t __restrict __src, size_t __n));
43 /* Copy no more than N bytes of SRC to DEST, stopping when C is found.
44    Return the position in DEST one byte past where C was copied,
45    or NULL if C was not found in the first N bytes of SRC.  */
46 extern __ptr_t memccpy __P ((__ptr_t __dest, __const __ptr_t __src,
47                              int __c, size_t __n));
48 /* Search N bytes of S for C.  */
49 extern __ptr_t memchr __P ((__const __ptr_t __s, int __c, size_t __n));
50 /* Set N bytes of S to C.  */
51 extern __ptr_t memset __P ((__ptr_t __s, int __c, size_t __n));
52 /* Compare N bytes of S1 and S2.  */
53 extern int memcmp __P ((__const __ptr_t __s1, __const __ptr_t __s2,
54                         size_t __n));
55 /* Copy N bytes of SRC to DEST, guaranteeing
56    correct behavior for overlapping strings.  */
57 extern __ptr_t memmove __P ((__ptr_t __dest, __const __ptr_t __src,
58                              size_t __n));
59
60
61 /* Minimal (very!) locale support */
62 #define strcoll strcmp
63 #define strxfrm strncpy
64
65 /* BSDisms */
66 #define index strchr
67 #define rindex strrchr
68
69 /* Other common BSD functions */
70 /* Set N bytes of S to 0.  */
71 extern void bzero __P ((__ptr_t __s, size_t __n));
72 /* Copy N bytes of SRC to DEST (like memmove, but args reversed).  */
73 extern void bcopy __P ((__const __ptr_t __src, __ptr_t __dest, size_t __n));
74
75 /* Compare S1 and S2, ignoring case.  */
76 extern int strcasecmp __P ((__const char *__s1, __const char *__s2));
77 /* Compare no more than N chars of S1 and S2, ignoring case.  */
78 extern int strncasecmp __P ((__const char *__s1, __const char *__s2,
79                              size_t __n));
80 /* Find the first occurrence in S of any character in ACCEPT.  */
81 extern char *strpbrk __P ((__const char *__s, __const char *__accept));
82 /* Return the next DELIM-delimited token from *STRINGP,
83    terminating it with a '\0', and update *STRINGP to point past it.  */
84 extern char *strsep __P ((char **__restrict __stringp,
85                           __const char *__restrict __delim));
86 /* Find the first occurrence of NEEDLE in HAYSTACK.  */
87 extern char *strstr __P ((__const char *__haystack, __const char *__needle));
88 /* Divide S into tokens separated by characters in DELIM.  */
89 extern char *strtok __P ((char *__restrict __s,
90                           __const char *__restrict __delim));
91 /* Return the length of the initial segment of S which
92    consists entirely of characters not in REJECT.  */
93 extern size_t strcspn __P ((__const char *__s, __const char *__reject));
94 /* Return the length of the initial segment of S which
95    consists entirely of characters in ACCEPT.  */
96 extern size_t strspn __P ((__const char *__s, __const char *__accept));
97
98 /* Return a string describing the meaning of the signal number in SIG.  */
99 extern char *strsignal __P ((int __sig));
100
101 /* More BSD compatabilty */
102 #define bcmp    memcmp
103
104 /* Linux silly hour */
105 char *strfry __P ((char *));
106
107 #endif