Joel Kitching | a1b1517 | 2020-03-12 18:15:34 +0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 3 | #ifndef STRING_H |
| 4 | #define STRING_H |
| 5 | |
| 6 | #include <stddef.h> |
Elyes Haouas | 35c3ae3b | 2022-10-27 12:25:12 +0200 | [diff] [blame] | 7 | #include <stdio.h> /* IWYU pragma: export */ |
David Hendricks | 6053a9c | 2018-01-28 18:01:10 -0800 | [diff] [blame] | 8 | |
Stefan Reinauer | a91e0fe | 2008-08-01 11:39:35 +0000 | [diff] [blame] | 9 | void *memcpy(void *dest, const void *src, size_t n); |
| 10 | void *memmove(void *dest, const void *src, size_t n); |
| 11 | void *memset(void *s, int c, size_t n); |
| 12 | int memcmp(const void *s1, const void *s2, size_t n); |
Gabe Black | 1025f3a | 2011-09-16 02:18:56 -0700 | [diff] [blame] | 13 | void *memchr(const void *s, int c, size_t n); |
Thomas Heijligen | 9204355 | 2019-01-29 12:48:01 +0100 | [diff] [blame] | 14 | char *strdup(const char *s); |
| 15 | char *strconcat(const char *s1, const char *s2); |
Julius Werner | a66c9b8 | 2019-05-20 14:53:47 -0700 | [diff] [blame] | 16 | size_t strnlen(const char *src, size_t max); |
| 17 | size_t strlen(const char *src); |
| 18 | char *strchr(const char *s, int c); |
| 19 | char *strncpy(char *to, const char *from, int count); |
| 20 | char *strcpy(char *dst, const char *src); |
| 21 | int strcmp(const char *s1, const char *s2); |
| 22 | int strncmp(const char *s1, const char *s2, int maxlen); |
Yuji Sasaki | 6b212d8 | 2019-06-12 17:42:19 -0700 | [diff] [blame] | 23 | int strspn(const char *str, const char *spn); |
| 24 | int strcspn(const char *str, const char *spn); |
Jes Klinke | 683ac6f | 2020-07-31 09:58:49 -0700 | [diff] [blame] | 25 | char *strstr(const char *haystack, const char *needle); |
harshit | 7a6f27c | 2020-05-15 10:40:02 +0530 | [diff] [blame] | 26 | char *strtok_r(char *str, const char *delim, char **ptr); |
| 27 | char *strtok(char *str, const char *delim); |
Yuji Sasaki | 6b212d8 | 2019-06-12 17:42:19 -0700 | [diff] [blame] | 28 | long atol(const char *str); |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 29 | |
Patrick Rudolph | 03c7b05 | 2018-03-29 10:05:34 +0200 | [diff] [blame] | 30 | /** |
| 31 | * Find a character in a string. |
| 32 | * |
| 33 | * @param s The string. |
| 34 | * @param c The character. |
| 35 | * @return A pointer to the last occurrence of the character in the |
| 36 | * string, or NULL if the character was not encountered within the string. |
| 37 | */ |
Julius Werner | a66c9b8 | 2019-05-20 14:53:47 -0700 | [diff] [blame] | 38 | char *strrchr(const char *s, int c); |
Patrick Rudolph | 03c7b05 | 2018-03-29 10:05:34 +0200 | [diff] [blame] | 39 | |
Julius Werner | a66c9b8 | 2019-05-20 14:53:47 -0700 | [diff] [blame] | 40 | /* |
| 41 | * Parses an unsigned integer and moves the input pointer forward to the first |
| 42 | * character that's not a valid digit. s and *s must not be NULL. Result |
| 43 | * undefined if it overruns the return type size. |
| 44 | */ |
| 45 | unsigned int skip_atoi(char **s); |
Stefan Reinauer | 36c8340 | 2009-03-01 10:16:01 +0000 | [diff] [blame] | 46 | |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 47 | #endif /* STRING_H */ |