string.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * File : string.h
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2008, RT-Thread Development Team
  5. *
  6. * The license and distribution terms for this file may be
  7. * found in the file LICENSE in this distribution or at
  8. * http://www.rt-thread.org/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. * 2008-08-14 Bernard the first version
  13. */
  14. #ifndef __STRING_H__
  15. #define __STRING_H__
  16. #include <rtthread.h>
  17. #include <sys/types.h>
  18. /* replace for standard string library */
  19. #if !defined (RT_USING_NEWLIB) && defined (RT_USING_MINILIBC)
  20. #define ZEROPAD (1 << 0) /* pad with zero */
  21. #define SIGN (1 << 1) /* unsigned/signed long */
  22. #define PLUS (1 << 2) /* show plus */
  23. #define SPACE (1 << 3) /* space if plus */
  24. #define LEFT (1 << 4) /* left justified */
  25. #define SPECIAL (1 << 5) /* 0x */
  26. #define LARGE (1 << 6) /* use 'ABCDEF' instead of 'abcdef' */
  27. #define _U 0x01 /* upper */
  28. #define _L 0x02 /* lower */
  29. #define _D 0x04 /* digit */
  30. #define _C 0x08 /* cntrl */
  31. #define _P 0x10 /* punct */
  32. #define _S 0x20 /* white space (space/lf/tab) */
  33. #define _X 0x40 /* hex digit */
  34. #define _SP 0x80 /* hard space (0x20) */
  35. void* memset(void *s, int c, size_t n);
  36. void* memcpy(void *dest, const void *src, size_t n);
  37. void* memmove(void *dest, const void *src, size_t n);
  38. int memcmp(const void *s1, const void *s2, size_t n);
  39. int tolower(int c);
  40. int toupper(int c);
  41. int strcmp (const char *s1, const char *s2);
  42. int strncmp(const char *cs,const char *ct, size_t count);
  43. int strcasecmp(const char *a, const char *b);
  44. int strncasecmp(const char *cs, const char *ct, size_t count);
  45. int sscanf(const char * buf, const char * fmt, ...);
  46. size_t strlen(const char *s);
  47. char *strstr(const char * s1,const char * s2);
  48. char *strcpy(char *dest, const char *src);
  49. char *strncpy(char *dest, const char *src, size_t n);
  50. size_t strlcpy(char *dst, const char *src, size_t siz);
  51. char *strncat(char *dest, const char *src, size_t count);
  52. char *strcat(char * dest, const char * src);
  53. char *strchr(const char *s1, int i);
  54. char *strrchr(const char *t, int c);
  55. char *strdup(const char *s);
  56. char *strtok(char *s, const char *delim);
  57. char*strtok_r(char*s, const char*delim, char**ptrptr);
  58. size_t strcspn(const char *s, const char *reject);
  59. size_t strspn (const char *s, const char *accept);
  60. long strtol(const char *str, char **endptr, int base);
  61. long long strtoll(const char *str, char **endptr, int base);
  62. #endif
  63. #endif