string.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * Copyright (c) 2008 Travis Geiselbrecht
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining
  5. * a copy of this software and associated documentation files
  6. * (the "Software"), to deal in the Software without restriction,
  7. * including without limitation the rights to use, copy, modify, merge,
  8. * publish, distribute, sublicense, and/or sell copies of the Software,
  9. * and to permit persons to whom the Software is furnished to do so,
  10. * subject to the following conditions:
  11. *
  12. * The above copyright notice and this permission notice shall be
  13. * included in all copies or substantial portions of the Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  16. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  17. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  18. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  19. * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  20. * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  21. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22. */
  23. #ifndef __LIB_STRING_H
  24. #define __LIB_STRING_H
  25. #include <sys/types.h>
  26. #include <compiler.h>
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. void *memchr (void const *, int, size_t) __PURE;
  31. int memcmp (void const *, const void *, size_t) __PURE;
  32. void *memcpy (void *, void const *, size_t);
  33. void *memmove(void *, void const *, size_t);
  34. void *memset (void *, int, size_t);
  35. char *strcat(char *, char const *);
  36. char *strchr(char const *, int) __PURE;
  37. int strcmp(char const *, char const *) __PURE;
  38. char *strcpy(char *, char const *);
  39. char const *strerror(int) __CONST;
  40. size_t strlen(char const *) __PURE;
  41. char *strncat(char *, char const *, size_t);
  42. int strncmp(char const *, char const *, size_t) __PURE;
  43. char *strncpy(char *, char const *, size_t);
  44. char *strpbrk(char const *, char const *) __PURE;
  45. char *strrchr(char const *, int) __PURE;
  46. size_t strspn(char const *, char const *) __PURE;
  47. size_t strcspn(const char *s, const char *) __PURE;
  48. char *strstr(char const *, char const *) __PURE;
  49. char *strtok(char *, char const *);
  50. int strcoll(const char *s1, const char *s2) __PURE;
  51. size_t strxfrm(char *dest, const char *src, size_t n) __PURE;
  52. char *strdup(const char *str) __MALLOC;
  53. #ifdef __cplusplus
  54. } /* extern "C" */
  55. #endif
  56. #ifdef __cplusplus
  57. extern "C"
  58. {
  59. #endif
  60. /* non standard */
  61. void *bcopy(void const *, void *, size_t);
  62. void bzero(void *, size_t);
  63. size_t strlcat(char *, char const *, size_t);
  64. size_t strlcpy(char *, char const *, size_t);
  65. int strncasecmp(char const *, char const *, size_t) __PURE;
  66. int strnicmp(char const *, char const *, size_t) __PURE;
  67. size_t strnlen(char const *s, size_t count) __PURE;
  68. #ifdef __cplusplus
  69. }
  70. #endif
  71. #endif