CString.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* vim: set expandtab ts=4 sw=4: */
  2. /*
  3. * You may redistribute this program and/or modify it under the terms of
  4. * the GNU General Public License as published by the Free Software Foundation,
  5. * either version 3 of the License, or (at your option) any later version.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. * You should have received a copy of the GNU General Public License
  13. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  14. */
  15. #include "util/CString.h"
  16. #include <string.h>
  17. #if defined(Illumos) || defined(__sun)
  18. #define _XPG4_2
  19. #endif
  20. #include <strings.h>
  21. unsigned long CString_strlen(const char* str)
  22. {
  23. return strlen(str);
  24. }
  25. int CString_strcmp(const char* a, const char* b)
  26. {
  27. return strcmp(a,b);
  28. }
  29. int CString_strncmp(const char* a, const char *b, size_t n)
  30. {
  31. return strncmp(a, b, n);
  32. }
  33. char* CString_strchr(const char* a, int b)
  34. {
  35. return strchr(a,b);
  36. }
  37. char* CString_strrchr(const char* a, int b)
  38. {
  39. return strrchr(a,b);
  40. }
  41. int CString_strcasecmp(const char *a, const char *b)
  42. {
  43. return strcasecmp(a,b);
  44. }
  45. char* CString_strstr(const char* haystack, const char* needle)
  46. {
  47. return strstr(haystack,needle);
  48. }
  49. char* CString_strcpy(char* restrict dest, const char* restrict src)
  50. {
  51. return strcpy(dest, src);
  52. }
  53. char* CString_strncpy(char* restrict dest, const char *restrict src, size_t n)
  54. {
  55. return strncpy(dest, src, n);
  56. }