xref: /nrf52832-nimble/rt-thread/components/libc/compilers/minilibc/string.h (revision 042d53a763ad75cb1465103098bb88c245d95138)
1 /*
2  * Copyright (c) 2006-2018, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2008-08-14     Bernard      the first version
9  */
10 #ifndef __STRING_H__
11 #define __STRING_H__
12 
13 #include <rtthread.h>
14 #include <sys/types.h>
15 
16 /* replace for standard string library */
17 #if !defined (RT_USING_NEWLIB) && defined (RT_USING_MINILIBC)
18 
19 #define ZEROPAD 	(1 << 0)	/* pad with zero */
20 #define SIGN 		(1 << 1)	/* unsigned/signed long */
21 #define PLUS 		(1 << 2)	/* show plus */
22 #define SPACE 		(1 << 3)	/* space if plus */
23 #define LEFT 		(1 << 4)	/* left justified */
24 #define SPECIAL 	(1 << 5)	/* 0x */
25 #define LARGE		(1 << 6)	/* use 'ABCDEF' instead of 'abcdef' */
26 
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 
36 void* memset(void *s, int c, size_t n);
37 void* memcpy(void *dest, const void *src, size_t n);
38 void* memmove(void *dest, const void *src, size_t n);
39 int memcmp(const void *s1, const void *s2, size_t n);
40 
41 int tolower(int c);
42 int toupper(int c);
43 
44 int strcmp (const char *s1, const char *s2);
45 int strncmp(const char *cs,const char *ct, size_t count);
46 int strcasecmp(const char *a, const char *b);
47 int strncasecmp(const char *cs, const char *ct, size_t count);
48 int sscanf(const char * buf, const char * fmt, ...);
49 size_t strlen(const char *s);
50 char *strstr(const char * s1,const char * s2);
51 char *strcpy(char *dest, const char *src);
52 char *strncpy(char *dest, const char *src, size_t n);
53 size_t strlcpy(char *dst, const char *src, size_t siz);
54 char *strncat(char *dest, const char *src, size_t count);
55 char *strcat(char * dest, const char * src);
56 char *strchr(const char *s1, int i);
57 char *strrchr(const char *t, int c);
58 char *strdup(const char *s);
59 char *strtok(char *s, const char *delim);
60 char*strtok_r(char*s, const char*delim, char**ptrptr);
61 
62 size_t strcspn(const char *s, const char *reject);
63 size_t strspn (const char *s, const char *accept);
64 
65 long strtol(const char *str, char **endptr, int base);
66 long long strtoll(const char *str, char **endptr, int base);
67 #endif
68 
69 #endif
70