string.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #ifndef _STRING_H
  2. #define _STRING_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #include <features.h>
  7. #if __cplusplus >= 201103L
  8. #define NULL nullptr
  9. #elif defined(__cplusplus)
  10. #define NULL 0L
  11. #else
  12. #define NULL ((void*)0)
  13. #endif
  14. #define __NEED_size_t
  15. #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
  16. || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
  17. || defined(_BSD_SOURCE)
  18. #define __NEED_locale_t
  19. #endif
  20. #include <bits/alltypes.h>
  21. void *memcpy (void *__restrict, const void *__restrict, size_t);
  22. void *memmove (void *, const void *, size_t);
  23. void *memset (void *, int, size_t);
  24. int memcmp (const void *, const void *, size_t);
  25. void *memchr (const void *, int, size_t);
  26. char *strcpy (char *__restrict, const char *__restrict);
  27. char *strncpy (char *__restrict, const char *__restrict, size_t);
  28. char *strcat (char *__restrict, const char *__restrict);
  29. char *strncat (char *__restrict, const char *__restrict, size_t);
  30. int strcmp (const char *, const char *);
  31. int strncmp (const char *, const char *, size_t);
  32. int strcoll (const char *, const char *);
  33. size_t strxfrm (char *__restrict, const char *__restrict, size_t);
  34. char *strchr (const char *, int);
  35. char *strrchr (const char *, int);
  36. size_t strcspn (const char *, const char *);
  37. size_t strspn (const char *, const char *);
  38. char *strpbrk (const char *, const char *);
  39. char *strstr (const char *, const char *);
  40. char *strtok (char *__restrict, const char *__restrict);
  41. size_t strlen (const char *);
  42. char *strerror (int);
  43. #if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
  44. #include <strings.h>
  45. #endif
  46. #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
  47. || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
  48. || defined(_BSD_SOURCE)
  49. char *strtok_r (char *__restrict, const char *__restrict, char **__restrict);
  50. int strerror_r (int, char *, size_t);
  51. char *stpcpy(char *__restrict, const char *__restrict);
  52. char *stpncpy(char *__restrict, const char *__restrict, size_t);
  53. size_t strnlen (const char *, size_t);
  54. char *strdup (const char *);
  55. char *strndup (const char *, size_t);
  56. char *strsignal(int);
  57. char *strerror_l (int, locale_t);
  58. int strcoll_l (const char *, const char *, locale_t);
  59. size_t strxfrm_l (char *__restrict, const char *__restrict, size_t, locale_t);
  60. void *memmem(const void *, size_t, const void *, size_t);
  61. #endif
  62. #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
  63. || defined(_BSD_SOURCE)
  64. void *memccpy (void *__restrict, const void *__restrict, int, size_t);
  65. #endif
  66. #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  67. char *strsep(char **, const char *);
  68. size_t strlcat (char *, const char *, size_t);
  69. size_t strlcpy (char *, const char *, size_t);
  70. void explicit_bzero (void *, size_t);
  71. #endif
  72. #ifdef _GNU_SOURCE
  73. #define strdupa(x) strcpy(alloca(strlen(x)+1),x)
  74. int strverscmp (const char *, const char *);
  75. char *strchrnul(const char *, int);
  76. char *strcasestr(const char *, const char *);
  77. void *memrchr(const void *, int, size_t);
  78. void *mempcpy(void *, const void *, size_t);
  79. #endif
  80. #ifdef __cplusplus
  81. }
  82. #endif
  83. #endif