string.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 INT_MAX ((int)(~0U>>1))
  28. #define INT_MIN (-INT_MAX - 1)
  29. #define UINT_MAX (~0U)
  30. #define LONG_MAX ((long)(~0UL>>1))
  31. #define LONG_MIN (-LONG_MAX - 1)
  32. #define ULONG_MAX (~0UL)
  33. #define _U 0x01 /* upper */
  34. #define _L 0x02 /* lower */
  35. #define _D 0x04 /* digit */
  36. #define _C 0x08 /* cntrl */
  37. #define _P 0x10 /* punct */
  38. #define _S 0x20 /* white space (space/lf/tab) */
  39. #define _X 0x40 /* hex digit */
  40. #define _SP 0x80 /* hard space (0x20) */
  41. void* memset(void *s, int c, size_t n);
  42. void* memcpy(void *dest, const void *src, size_t n);
  43. void* memmove(void *dest, const void *src, size_t n);
  44. int memcmp(const void *s1, const void *s2, size_t n);
  45. int tolower(int c);
  46. int toupper(int c);
  47. int strcmp (const char *s1, const char *s2);
  48. int strncmp(const char *cs,const char *ct, size_t count);
  49. int strcasecmp(const char *a, const char *b);
  50. int strncasecmp(const char *cs, const char *ct, size_t count);
  51. int sscanf(const char * buf, const char * fmt, ...);
  52. size_t strlen(const char *s);
  53. char *strstr(const char * s1,const char * s2);
  54. char *strcpy(char *dest, const char *src);
  55. char *strncpy(char *dest, const char *src, size_t n);
  56. size_t strlcpy(char *dst, const char *src, size_t siz);
  57. char *strncat(char *dest, const char *src, size_t count);
  58. char *strcat(char * dest, const char * src);
  59. char *strchr(const char *s1, int i);
  60. char *strrchr(const char *t, int c);
  61. char *strdup(const char *s);
  62. char *strtok(char *s, const char *delim);
  63. char*strtok_r(char*s, const char*delim, char**ptrptr);
  64. size_t strcspn(const char *s, const char *reject);
  65. size_t strspn (const char *s, const char *accept);
  66. #endif
  67. #endif