Rev 6099 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4349 | Serge | 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 |
||
12 | #include |
||
4921 | Serge | 13 | #include |
4349 | Serge | 14 | |
15 | #define __need_size_t |
||
4921 | Serge | 16 | #define __need_NULL |
4349 | Serge | 17 | #include |
18 | |||
19 | _BEGIN_STD_C |
||
20 | |||
21 | _PTR _EXFUN(memchr,(const _PTR, int, size_t)); |
||
22 | int _EXFUN(memcmp,(const _PTR, const _PTR, size_t)); |
||
4921 | Serge | 23 | _PTR _EXFUN(memcpy,(_PTR __restrict, const _PTR __restrict, size_t)); |
4349 | Serge | 24 | _PTR _EXFUN(memmove,(_PTR, const _PTR, size_t)); |
25 | _PTR _EXFUN(memset,(_PTR, int, size_t)); |
||
4921 | Serge | 26 | char *_EXFUN(strcat,(char *__restrict, const char *__restrict)); |
4349 | Serge | 27 | char *_EXFUN(strchr,(const char *, int)); |
28 | int _EXFUN(strcmp,(const char *, const char *)); |
||
29 | int _EXFUN(strcoll,(const char *, const char *)); |
||
4921 | Serge | 30 | char *_EXFUN(strcpy,(char *__restrict, const char *__restrict)); |
4349 | Serge | 31 | size_t _EXFUN(strcspn,(const char *, const char *)); |
32 | char *_EXFUN(strerror,(int)); |
||
33 | size_t _EXFUN(strlen,(const char *)); |
||
4921 | Serge | 34 | char *_EXFUN(strncat,(char *__restrict, const char *__restrict, size_t)); |
4349 | Serge | 35 | int _EXFUN(strncmp,(const char *, const char *, size_t)); |
4921 | Serge | 36 | char *_EXFUN(strncpy,(char *__restrict, const char *__restrict, size_t)); |
4349 | Serge | 37 | char *_EXFUN(strpbrk,(const char *, const char *)); |
38 | char *_EXFUN(strrchr,(const char *, int)); |
||
39 | size_t _EXFUN(strspn,(const char *, const char *)); |
||
40 | char *_EXFUN(strstr,(const char *, const char *)); |
||
41 | #ifndef _REENT_ONLY |
||
4921 | Serge | 42 | char *_EXFUN(strtok,(char *__restrict, const char *__restrict)); |
4349 | Serge | 43 | #endif |
4921 | Serge | 44 | size_t _EXFUN(strxfrm,(char *__restrict, const char *__restrict, size_t)); |
4349 | Serge | 45 | |
6536 | serge | 46 | #if __MISC_VISIBLE || __POSIX_VISIBLE |
4921 | Serge | 47 | char *_EXFUN(strtok_r,(char *__restrict, const char *__restrict, char **__restrict)); |
6099 | serge | 48 | #endif |
6536 | serge | 49 | #if __BSD_VISIBLE || (__POSIX_VISIBLE && __POSIX_VISIBLE < 200809) |
4349 | Serge | 50 | int _EXFUN(bcmp,(const void *, const void *, size_t)); |
51 | void _EXFUN(bcopy,(const void *, void *, size_t)); |
||
52 | void _EXFUN(bzero,(void *, size_t)); |
||
6536 | serge | 53 | #endif |
54 | #if __BSD_VISIBLE |
||
55 | void _EXFUN(explicit_bzero,(void *, size_t)); |
||
56 | int _EXFUN(timingsafe_bcmp,(const void *, const void *, size_t)); |
||
57 | int _EXFUN(timingsafe_memcmp,(const void *, const void *, size_t)); |
||
58 | #endif |
||
59 | #if __MISC_VISIBLE || __POSIX_VISIBLE >= 200809 |
||
4349 | Serge | 60 | int _EXFUN(ffs,(int)); |
6536 | serge | 61 | #endif |
62 | #if __BSD_VISIBLE || (__POSIX_VISIBLE && __POSIX_VISIBLE < 200809) |
||
4349 | Serge | 63 | char *_EXFUN(index,(const char *, int)); |
6099 | serge | 64 | #endif |
6536 | serge | 65 | #if __MISC_VISIBLE || __POSIX_VISIBLE |
4921 | Serge | 66 | _PTR _EXFUN(memccpy,(_PTR __restrict, const _PTR __restrict, int, size_t)); |
6099 | serge | 67 | #endif |
68 | #if __GNU_VISIBLE |
||
4349 | Serge | 69 | _PTR _EXFUN(mempcpy,(_PTR, const _PTR, size_t)); |
70 | _PTR _EXFUN(memmem, (const _PTR, size_t, const _PTR, size_t)); |
||
4921 | Serge | 71 | _PTR _EXFUN(memrchr,(const _PTR, int, size_t)); |
72 | _PTR _EXFUN(rawmemchr,(const _PTR, int)); |
||
6099 | serge | 73 | #endif |
6536 | serge | 74 | #if __BSD_VISIBLE || (__POSIX_VISIBLE && __POSIX_VISIBLE < 200809) |
4349 | Serge | 75 | char *_EXFUN(rindex,(const char *, int)); |
6099 | serge | 76 | #endif |
4921 | Serge | 77 | char *_EXFUN(stpcpy,(char *__restrict, const char *__restrict)); |
78 | char *_EXFUN(stpncpy,(char *__restrict, const char *__restrict, size_t)); |
||
6099 | serge | 79 | #if __BSD_VISIBLE || __POSIX_VISIBLE |
4349 | Serge | 80 | int _EXFUN(strcasecmp,(const char *, const char *)); |
6099 | serge | 81 | #endif |
82 | #if __GNU_VISIBLE |
||
4349 | Serge | 83 | char *_EXFUN(strcasestr,(const char *, const char *)); |
84 | char *_EXFUN(strchrnul,(const char *, int)); |
||
4921 | Serge | 85 | #endif |
6536 | serge | 86 | #if __MISC_VISIBLE || __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 4 |
4349 | Serge | 87 | char *_EXFUN(strdup,(const char *)); |
4921 | Serge | 88 | #endif |
4349 | Serge | 89 | char *_EXFUN(_strdup_r,(struct _reent *, const char *)); |
6536 | serge | 90 | #if __POSIX_VISIBLE >= 200809 |
4349 | Serge | 91 | char *_EXFUN(strndup,(const char *, size_t)); |
4921 | Serge | 92 | #endif |
4349 | Serge | 93 | char *_EXFUN(_strndup_r,(struct _reent *, const char *, size_t)); |
6099 | serge | 94 | |
95 | #if __GNU_VISIBLE |
||
96 | int _EXFUN(ffsl,(long)); |
||
97 | int _EXFUN(ffsll, (long long)); |
||
98 | #endif |
||
99 | |||
4349 | Serge | 100 | /* There are two common strerror_r variants. If you request |
101 | _GNU_SOURCE, you get the GNU version; otherwise you get the POSIX |
||
102 | version. POSIX requires that #undef strerror_r will still let you |
||
103 | invoke the underlying function, but that requires gcc support. */ |
||
6099 | serge | 104 | #if __GNU_VISIBLE |
105 | char *_EXFUN(strerror_r,(int, char *, size_t)); |
||
6536 | serge | 106 | #elif __POSIX_VISIBLE >= 200112 |
4349 | Serge | 107 | # ifdef __GNUC__ |
6099 | serge | 108 | int _EXFUN(strerror_r,(int, char *, size_t)) |
109 | #ifdef __ASMNAME |
||
110 | __asm__ (__ASMNAME ("__xpg_strerror_r")) |
||
111 | #endif |
||
112 | ; |
||
4349 | Serge | 113 | # else |
6099 | serge | 114 | int _EXFUN(__xpg_strerror_r,(int, char *, size_t)); |
4349 | Serge | 115 | # define strerror_r __xpg_strerror_r |
116 | # endif |
||
117 | #endif |
||
6099 | serge | 118 | |
119 | /* Reentrant version of strerror. */ |
||
120 | char * _EXFUN(_strerror_r, (struct _reent *, int, int, int *)); |
||
121 | |||
122 | #if __BSD_VISIBLE |
||
123 | size_t _EXFUN(strlcat,(char *, const char *, size_t)); |
||
124 | size_t _EXFUN(strlcpy,(char *, const char *, size_t)); |
||
125 | #endif |
||
126 | #if __BSD_VISIBLE || __POSIX_VISIBLE |
||
127 | int _EXFUN(strncasecmp,(const char *, const char *, size_t)); |
||
128 | #endif |
||
6536 | serge | 129 | #if __POSIX_VISIBLE >= 200809 |
4349 | Serge | 130 | size_t _EXFUN(strnlen,(const char *, size_t)); |
6099 | serge | 131 | #endif |
132 | #if __BSD_VISIBLE |
||
4349 | Serge | 133 | char *_EXFUN(strsep,(char **, const char *)); |
6099 | serge | 134 | #endif |
135 | |||
6536 | serge | 136 | #if __MISC_VISIBLE |
4349 | Serge | 137 | char *_EXFUN(strlwr,(char *)); |
138 | char *_EXFUN(strupr,(char *)); |
||
6099 | serge | 139 | #endif |
140 | |||
4349 | Serge | 141 | #ifndef DEFS_H /* Kludge to work around problem compiling in gdb */ |
6099 | serge | 142 | char *_EXFUN(strsignal, (int __signo)); |
4349 | Serge | 143 | #endif |
6099 | serge | 144 | |
4349 | Serge | 145 | #ifdef __CYGWIN__ |
6099 | serge | 146 | int _EXFUN(strtosigno, (const char *__name)); |
4349 | Serge | 147 | #endif |
148 | |||
6536 | serge | 149 | #if __GNU_VISIBLE && defined(__GNUC__) |
4349 | Serge | 150 | #define strdupa(__s) \ |
151 | (__extension__ ({const char *__in = (__s); \ |
||
152 | size_t __len = strlen (__in) + 1; \ |
||
153 | char * __out = (char *) __builtin_alloca (__len); \ |
||
154 | (char *) memcpy (__out, __in, __len);})) |
||
155 | #define strndupa(__s, __n) \ |
||
156 | (__extension__ ({const char *__in = (__s); \ |
||
157 | size_t __len = strnlen (__in, (__n)) + 1; \ |
||
158 | char *__out = (char *) __builtin_alloca (__len); \ |
||
159 | __out[__len-1] = '\0'; \ |
||
160 | (char *) memcpy (__out, __in, __len-1);})) |
||
6536 | serge | 161 | #endif /* __GNU_VISIBLE && __GNUC__ */ |
4349 | Serge | 162 | |
6099 | serge | 163 | /* There are two common basename variants. If you do NOT #include |
164 | and you do |
||
165 | |||
166 | #define _GNU_SOURCE |
||
167 | #include |
||
168 | |||
169 | you get the GNU version. Otherwise you get the POSIX versionfor which you |
||
170 | should #include |
||
171 | #undef basename will still let you invoke the underlying function. However, |
||
172 | this also implies that the POSIX version is used in this case. That's made |
||
173 | sure here. */ |
||
174 | #if __GNU_VISIBLE && !defined(basename) |
||
175 | # define basename basename |
||
176 | char *_EXFUN(__nonnull (1) basename,(const char *)) __asm__(__ASMNAME("__gnu_basename")); |
||
4349 | Serge | 177 | #endif |
178 | |||
179 | #include |
||
180 | |||
181 | _END_STD_C |
||
182 | |||
183 | #endif /* _STRING_H_ */>>> |