Embedded Artistry libc
C Standard Library Support for Bare-metal Systems
string.h
Go to the documentation of this file.
1 #ifndef STRING_H_
2 #define STRING_H_
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif //__cplusplus
7 
8 #include <stddef.h>
9 #include <stdint.h>
10 
11 #pragma mark - memory -
12 
29 int memcmp(const void* s1, const void* s2, size_t n);
30 
45 void* memset(void* dest, int c, size_t n);
46 
62 void* memcpy(void* __restrict dest, const void* __restrict src, size_t n);
63 
78 void* memmove(void* dest, const void* src, size_t n);
79 
94 void* memchr(const void* s, int c, size_t n);
95 
111 void* memmem(const void* l, size_t l_len, const void* s, size_t s_len);
112 
113 #pragma mark - string -
114 
127 size_t strlen(const char* str);
128 
144 size_t strnlen(const char* str, size_t maxlen);
145 
164 char* strcpy(char* __restrict dst, const char* __restrict src);
165 
187 char* strncpy(char* __restrict dst, const char* __restrict src, size_t maxlen);
188 
204 char* strstr(const char* string, const char* substring);
205 
222 char* strnstr(const char* s, const char* find, size_t slen);
223 
237 int strcmp(const char* s1, const char* s2);
238 
255 int strncmp(const char* s1, const char* s2, size_t n);
256 
267 char* strdup(const char* str);
268 
280 char* strndup(const char* str, size_t n);
281 
296 char* strchr(const char* s, int c);
297 
312 char* strrchr(const char* s, int c);
313 
332 char* strcat(char* __restrict dst, const char* __restrict src);
333 
355 char* strncat(char* __restrict dst, const char* __restrict src, size_t maxlen);
356 
375 char* strtok(char* s, const char* delim);
376 
377 // TODO: documentation
378 size_t strxfrm(char* __restrict, const char* __restrict, size_t);
379 size_t strcspn(const char*, const char*);
380 size_t strspn(const char*, const char*);
381 char* strpbrk(const char*, const char*);
382 int strcoll(const char*, const char*);
383 char* strerror(int);
384 int strerror_r(int, char*, size_t);
385 
386 #ifdef __cplusplus
387 }
388 #endif //__cplusplus
389 
390 #endif /* STRING_H_ */
size_t strcspn(const char *, const char *)
Definition: strcspn.c:8
size_t strspn(const char *, const char *)
Definition: strspn.c:7
char * strrchr(const char *s, int c)
Finds the last occurrence of c in the null-terminated byte string pointed to by s.
Definition: strrchr.c:7
size_t strnlen(const char *str, size_t maxlen)
Returns the length of the given null-terminated byte string.
Definition: strnlen.c:21
char * strnstr(const char *s, const char *find, size_t slen)
Finds the first occurrence of find in the initial slen characters of the object pointed to by s.
Definition: strnstr.c:48
void * memmove(void *dest, const void *src, size_t n)
Copies n characters from the object pointed to by src to the object pointed to by dest.
char * strndup(const char *str, size_t n)
Duplicate n bytes of the passed in string str.
Definition: strndup.c:41
void * memmem(const void *l, size_t l_len, const void *s, size_t s_len)
Find substring s in memory area l.
Definition: memmem.c:34
int strncmp(const char *s1, const char *s2, size_t n)
Compares at most n characters of two possibly null-terminated arrays.
Definition: strncmp.c:12
int memcmp(const void *s1, const void *s2, size_t n)
Compares the first n characters of the two objects pointed to by s1 and s2.
size_t strlen(const char *str)
Returns the length of the given null-terminated byte string.
Definition: strlen.c:77
char * strncpy(char *__restrict dst, const char *__restrict src, size_t maxlen)
Copies at most maxlen characters of the character array pointed to by src to character array pointed ...
Definition: strncpy.c:26
char * strdup(const char *str)
Duplicate the passed in string str.
Definition: strdup.c:42
char * strchr(const char *s, int c)
Finds the first occurrence of c in the null-terminated byte string pointed to by s.
Definition: strchr.c:7
char * strerror(int)
Definition: strerror.c:17
void * memset(void *dest, int c, size_t n)
Copies the value c into each of the first n characters of the object pointed to by dest.
char * strpbrk(const char *, const char *)
Definition: strpbrk.c:3
int strcoll(const char *, const char *)
Definition: strcoll.c:3
char * strtok(char *s, const char *delim)
Finds the next token in a null-terminated byte string pointed to by s.
Definition: strtok.c:109
void * memcpy(void *__restrict dest, const void *__restrict src, size_t n)
Copies n characters from the object pointed to by src to the object pointed to by dest.
int strcmp(const char *s1, const char *s2)
Compares two null-terminated byte strings lexicographically.
Definition: strcmp.c:12
char * strstr(const char *string, const char *substring)
Finds the first occurrence of the substring in the string.
Definition: strstr.c:38
size_t strxfrm(char *__restrict, const char *__restrict, size_t)
char * strncat(char *__restrict dst, const char *__restrict src, size_t maxlen)
Appends at most maxlen characters from the character array pointed to by src, to the end of the null-...
Definition: strncat.c:26
void * memchr(const void *s, int c, size_t n)
Finds the first occurrence of c in the initial n characters of the object pointed to by s.
Definition: memchr.c:13
int strerror_r(int, char *, size_t)
Definition: strerror_r.c:5
char * strcat(char *__restrict dst, const char *__restrict src)
Appends a copy of the null-terminated byte string pointed to by src to the end of the null-terminated...
Definition: strcat.c:26
char * strcpy(char *__restrict dst, const char *__restrict src)
Copies the null-terminated byte string pointed to by src to the character array whose first element i...
Definition: strcpy.c:26