blob: ff9badb9c307fc687c18d53c3ed64a64aacdcabd [file] [log] [blame]
Rich Felker0b44a032011-02-12 00:22:29 -05001#ifndef _STRING_H
2#define _STRING_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
Rich Felkerc1a96582012-09-07 23:13:55 -04008#include <features.h>
Rich Felker400c5e52012-09-06 22:44:55 -04009
Rich Felkerc8a9c222013-11-24 21:42:55 -050010#ifdef __cplusplus
Rich Felker41d7c772013-01-18 20:35:26 -050011#define NULL 0L
Rich Felkerc8a9c222013-11-24 21:42:55 -050012#else
13#define NULL ((void*)0)
14#endif
Rich Felker0b44a032011-02-12 00:22:29 -050015
16#define __NEED_size_t
Rich Felker36bf5692012-02-06 21:51:02 -050017#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
Rich Felker419ae6d2012-05-22 21:52:08 -040018 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
19 || defined(_BSD_SOURCE)
Rich Felker36bf5692012-02-06 21:51:02 -050020#define __NEED_locale_t
21#endif
22
Rich Felker0b44a032011-02-12 00:22:29 -050023#include <bits/alltypes.h>
24
Rich Felker400c5e52012-09-06 22:44:55 -040025void *memcpy (void *__restrict, const void *__restrict, size_t);
Rich Felker0b44a032011-02-12 00:22:29 -050026void *memmove (void *, const void *, size_t);
Rich Felker0b44a032011-02-12 00:22:29 -050027void *memset (void *, int, size_t);
28int memcmp (const void *, const void *, size_t);
29void *memchr (const void *, int, size_t);
30
Rich Felker400c5e52012-09-06 22:44:55 -040031char *strcpy (char *__restrict, const char *__restrict);
32char *strncpy (char *__restrict, const char *__restrict, size_t);
Rich Felker0b44a032011-02-12 00:22:29 -050033
Rich Felker400c5e52012-09-06 22:44:55 -040034char *strcat (char *__restrict, const char *__restrict);
35char *strncat (char *__restrict, const char *__restrict, size_t);
Rich Felker0b44a032011-02-12 00:22:29 -050036
37int strcmp (const char *, const char *);
38int strncmp (const char *, const char *, size_t);
39
40int strcoll (const char *, const char *);
Rich Felker400c5e52012-09-06 22:44:55 -040041size_t strxfrm (char *__restrict, const char *__restrict, size_t);
Rich Felker0b44a032011-02-12 00:22:29 -050042
Rich Felker0b44a032011-02-12 00:22:29 -050043char *strchr (const char *, int);
44char *strrchr (const char *, int);
45
46size_t strcspn (const char *, const char *);
47size_t strspn (const char *, const char *);
48char *strpbrk (const char *, const char *);
49char *strstr (const char *, const char *);
Rich Felker400c5e52012-09-06 22:44:55 -040050char *strtok (char *__restrict, const char *__restrict);
Rich Felker0b44a032011-02-12 00:22:29 -050051
52size_t strlen (const char *);
53
54char *strerror (int);
Rich Felkerca1aa5b2011-02-14 20:53:15 -050055
Rich Felker419ae6d2012-05-22 21:52:08 -040056#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
57#include <strings.h>
58#endif
Rich Felkerca1aa5b2011-02-14 20:53:15 -050059
60#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
Rich Felker419ae6d2012-05-22 21:52:08 -040061 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
62 || defined(_BSD_SOURCE)
Rich Felker400c5e52012-09-06 22:44:55 -040063char *strtok_r (char *__restrict, const char *__restrict, char **__restrict);
Rich Felker0b44a032011-02-12 00:22:29 -050064int strerror_r (int, char *, size_t);
Rich Felker400c5e52012-09-06 22:44:55 -040065char *stpcpy(char *__restrict, const char *__restrict);
66char *stpncpy(char *__restrict, const char *__restrict, size_t);
Rich Felker0b44a032011-02-12 00:22:29 -050067size_t strnlen (const char *, size_t);
Rich Felkerca1aa5b2011-02-14 20:53:15 -050068char *strdup (const char *);
69char *strndup (const char *, size_t);
Rich Felker2a195dd2011-02-26 23:50:26 -050070char *strsignal(int);
Rich Felker36bf5692012-02-06 21:51:02 -050071char *strerror_l (int, locale_t);
72int strcoll_l (const char *, const char *, locale_t);
Rich Felker400c5e52012-09-06 22:44:55 -040073size_t strxfrm_l (char *__restrict, const char *__restrict, size_t, locale_t);
Rich Felkerca1aa5b2011-02-14 20:53:15 -050074#endif
75
Rich Felker419ae6d2012-05-22 21:52:08 -040076#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
77 || defined(_BSD_SOURCE)
Rich Felker400c5e52012-09-06 22:44:55 -040078void *memccpy (void *__restrict, const void *__restrict, int, size_t);
Rich Felker73d310e2011-02-24 12:36:04 -050079#endif
80
Rich Felkere2f6a322012-09-13 21:01:30 -040081#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
82char *strsep(char **, const char *);
Rich Felkerca1aa5b2011-02-14 20:53:15 -050083size_t strlcat (char *, const char *, size_t);
84size_t strlcpy (char *, const char *, size_t);
85#endif
Rich Felker0b44a032011-02-12 00:22:29 -050086
87#ifdef _GNU_SOURCE
Rich Felker419ae6d2012-05-22 21:52:08 -040088#define strdupa(x) strcpy(alloca(strlen(x)+1),x)
Rich Felkera6540172011-09-11 22:45:56 -040089int strverscmp (const char *, const char *);
Rich Felker419ae6d2012-05-22 21:52:08 -040090int strcasecmp_l (const char *, const char *, locale_t);
91int strncasecmp_l (const char *, const char *, size_t, locale_t);
Rich Felker0b44a032011-02-12 00:22:29 -050092char *strchrnul(const char *, int);
Rich Felker26f35512011-02-15 16:08:19 -050093char *strcasestr(const char *, const char *);
Rich Felkerc86f2972012-10-15 23:02:57 -040094void *memmem(const void *, size_t, const void *, size_t);
Rich Felker6597f9a2011-04-13 08:36:29 -040095void *memrchr(const void *, int, size_t);
Rich Felkerb5b41212011-04-26 12:28:41 -040096void *mempcpy(void *, const void *, size_t);
Rich Felker37bb3cc2012-05-09 11:47:06 -040097#ifndef __cplusplus
Rich Felker06aec8d2012-02-24 23:23:47 -050098char *basename();
Rich Felker0b44a032011-02-12 00:22:29 -050099#endif
Rich Felker37bb3cc2012-05-09 11:47:06 -0400100#endif
Rich Felker0b44a032011-02-12 00:22:29 -0500101
102#ifdef __cplusplus
103}
104#endif
105
106#endif