string.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /* $OpenBSD: string.h,v 1.20 2010/09/24 13:33:00 matthew Exp $ */
  2. /* $NetBSD: string.h,v 1.6 1994/10/26 00:56:30 cgd Exp $ */
  3. /*-
  4. * Copyright (c) 1990 The Regents of the University of California.
  5. * All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions
  9. * are met:
  10. * 1. Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * 2. Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. * 3. Neither the name of the University nor the names of its contributors
  16. * may be used to endorse or promote products derived from this software
  17. * without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  20. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  21. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  22. * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  23. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  24. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  25. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  26. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  27. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  28. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  29. * SUCH DAMAGE.
  30. *
  31. * @(#)string.h 5.10 (Berkeley) 3/9/91
  32. */
  33. #ifndef _STRING_H_
  34. #define _STRING_H_
  35. #include <sys/cdefs.h>
  36. #include <sys/_types.h>
  37. #ifndef _SIZE_T_DEFINED_
  38. typedef __size_t size_t;
  39. #define _SIZE_T_DEFINED_
  40. #endif
  41. #ifndef _ERRNO_T_DEFINED
  42. #define _ERRNO_T_DEFINED
  43. typedef int errno_t;
  44. #endif
  45. #ifndef NULL
  46. #ifdef __cplusplus
  47. #define NULL 0
  48. #else
  49. #define NULL ((void *)0)
  50. #endif
  51. #endif
  52. __BEGIN_DECLS
  53. void * _TLIBC_CDECL_ memchr(const void *, int, size_t);
  54. int _TLIBC_CDECL_ memcmp(const void *, const void *, size_t);
  55. void * _TLIBC_CDECL_ memcpy(void *, const void *, size_t);
  56. void * _TLIBC_CDECL_ memmove(void *, const void *, size_t);
  57. void * _TLIBC_CDECL_ memset(void *, int, size_t);
  58. char * _TLIBC_CDECL_ strchr(const char *, int);
  59. int _TLIBC_CDECL_ strcmp(const char *, const char *);
  60. int _TLIBC_CDECL_ strcoll(const char *, const char *);
  61. size_t _TLIBC_CDECL_ strcspn(const char *, const char *);
  62. char * _TLIBC_CDECL_ strerror(int);
  63. size_t _TLIBC_CDECL_ strlen(const char *);
  64. char * _TLIBC_CDECL_ strncat(char *, const char *, size_t);
  65. int _TLIBC_CDECL_ strncmp(const char *, const char *, size_t);
  66. char * _TLIBC_CDECL_ strncpy(char *, const char *, size_t);
  67. char * _TLIBC_CDECL_ strpbrk(const char *, const char *);
  68. char * _TLIBC_CDECL_ strrchr(const char *, int);
  69. size_t _TLIBC_CDECL_ strspn(const char *, const char *);
  70. char * _TLIBC_CDECL_ strstr(const char *, const char *);
  71. char * _TLIBC_CDECL_ strtok(char *, const char *);
  72. size_t _TLIBC_CDECL_ strxfrm(char *, const char *, size_t);
  73. size_t _TLIBC_CDECL_ strlcpy(char *, const char *, size_t);
  74. errno_t _TLIBC_CDECL_ memset_s(void *s, size_t smax, int c, size_t n);
  75. /*
  76. * Deprecated C99.
  77. */
  78. _TLIBC_DEPRECATED_FUNCTION_(char * _TLIBC_CDECL_, strcat, char *, const char *);
  79. _TLIBC_DEPRECATED_FUNCTION_(char * _TLIBC_CDECL_, strcpy, char *, const char *);
  80. /*
  81. * Common used non-C99 functions.
  82. */
  83. char * _TLIBC_CDECL_ strndup(const char *, size_t);
  84. size_t _TLIBC_CDECL_ strnlen(const char *, size_t);
  85. int _TLIBC_CDECL_ consttime_memequal(const void *b1, const void *b2, size_t len);
  86. /*
  87. * Non-C99
  88. */
  89. int _TLIBC_CDECL_ bcmp(const void *, const void *, size_t);
  90. void _TLIBC_CDECL_ bcopy(const void *, void *, size_t);
  91. void _TLIBC_CDECL_ bzero(void *, size_t);
  92. char * _TLIBC_CDECL_ index(const char *, int);
  93. void * _TLIBC_CDECL_ mempcpy(void *, const void *, size_t);
  94. char * _TLIBC_CDECL_ rindex(const char *, int);
  95. char * _TLIBC_CDECL_ stpncpy(char *dest, const char *src, size_t n);
  96. int _TLIBC_CDECL_ strcasecmp(const char *, const char *);
  97. int _TLIBC_CDECL_ strncasecmp(const char *, const char *, size_t);
  98. int _TLIBC_CDECL_ ffs(int);
  99. int _TLIBC_CDECL_ ffsl(long int);
  100. int _TLIBC_CDECL_ ffsll(long long int);
  101. char * _TLIBC_CDECL_ strtok_r(char *, const char *, char **);
  102. int _TLIBC_CDECL_ strerror_r(int, char *, size_t);
  103. /*
  104. * Deprecated Non-C99.
  105. */
  106. _TLIBC_DEPRECATED_FUNCTION_(char * _TLIBC_CDECL_, strdup, const char *);
  107. _TLIBC_DEPRECATED_FUNCTION_(char * _TLIBC_CDECL_, stpcpy, char *dest, const char *src);
  108. __END_DECLS
  109. #endif /* _STRING_H_ */