string.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * GRUB -- GRand Unified Bootloader
  3. * Copyright (C) 2009, 2010 Free Software Foundation, Inc.
  4. *
  5. * GRUB is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * GRUB is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef GRUB_POSIX_STRING_H
  19. #define GRUB_POSIX_STRING_H 1
  20. #include <grub/misc.h>
  21. #include <sys/types.h>
  22. #define HAVE_STRCASECMP 1
  23. static inline grub_size_t
  24. strlen (const char *s)
  25. {
  26. return grub_strlen (s);
  27. }
  28. static inline int
  29. strcmp (const char *s1, const char *s2)
  30. {
  31. return grub_strcmp (s1, s2);
  32. }
  33. static inline int
  34. strcasecmp (const char *s1, const char *s2)
  35. {
  36. return grub_strcasecmp (s1, s2);
  37. }
  38. static inline void
  39. bcopy (const void *src, void *dest, grub_size_t n)
  40. {
  41. grub_memcpy (dest, src, n);
  42. }
  43. static inline char *
  44. strcpy (char *dest, const char *src)
  45. {
  46. return grub_strcpy (dest, src);
  47. }
  48. static inline char *
  49. strstr (const char *haystack, const char *needle)
  50. {
  51. return grub_strstr (haystack, needle);
  52. }
  53. static inline char *
  54. strchr (const char *s, int c)
  55. {
  56. return grub_strchr (s, c);
  57. }
  58. static inline char *
  59. strncpy (char *dest, const char *src, grub_size_t n)
  60. {
  61. return grub_strncpy (dest, src, n);
  62. }
  63. static inline int
  64. strcoll (const char *s1, const char *s2)
  65. {
  66. return grub_strcmp (s1, s2);
  67. }
  68. static inline void *
  69. memchr (const void *s, int c, grub_size_t n)
  70. {
  71. return grub_memchr (s, c, n);
  72. }
  73. #define memcmp grub_memcmp
  74. #define memcpy grub_memcpy
  75. #define memmove grub_memmove
  76. #define memset grub_memset
  77. #endif