blob: 8eef0680cbc8e145faa98d0f7ff08ffda25358e3 [file] [log] [blame]
Joel Kitchinga1b15172020-03-12 18:15:34 +08001/* SPDX-License-Identifier: GPL-2.0-only */
2
Eric Biederman8ca8d762003-04-22 19:02:15 +00003#ifndef STRING_H
4#define STRING_H
5
Joel Kitchinga1b15172020-03-12 18:15:34 +08006#include <stdarg.h>
Eric Biederman8ca8d762003-04-22 19:02:15 +00007#include <stddef.h>
Joel Kitchinga1b15172020-03-12 18:15:34 +08008#include <stdio.h>
David Hendricks6053a9c2018-01-28 18:01:10 -08009
Aaron Durbinac4b00e2013-04-26 11:58:35 -050010/* Stringify a token */
11#ifndef STRINGIFY
12#define _STRINGIFY(x) #x
13#define STRINGIFY(x) _STRINGIFY(x)
14#endif
15
Stefan Reinauera91e0fe2008-08-01 11:39:35 +000016void *memcpy(void *dest, const void *src, size_t n);
17void *memmove(void *dest, const void *src, size_t n);
18void *memset(void *s, int c, size_t n);
19int memcmp(const void *s1, const void *s2, size_t n);
Gabe Black1025f3a2011-09-16 02:18:56 -070020void *memchr(const void *s, int c, size_t n);
Thomas Heijligen92043552019-01-29 12:48:01 +010021char *strdup(const char *s);
22char *strconcat(const char *s1, const char *s2);
Julius Wernera66c9b82019-05-20 14:53:47 -070023size_t strnlen(const char *src, size_t max);
24size_t strlen(const char *src);
25char *strchr(const char *s, int c);
26char *strncpy(char *to, const char *from, int count);
27char *strcpy(char *dst, const char *src);
28int strcmp(const char *s1, const char *s2);
29int strncmp(const char *s1, const char *s2, int maxlen);
Yuji Sasaki6b212d82019-06-12 17:42:19 -070030int strspn(const char *str, const char *spn);
31int strcspn(const char *str, const char *spn);
harshit7a6f27c2020-05-15 10:40:02 +053032char *strtok_r(char *str, const char *delim, char **ptr);
33char *strtok(char *str, const char *delim);
Yuji Sasaki6b212d82019-06-12 17:42:19 -070034long atol(const char *str);
Eric Biederman8ca8d762003-04-22 19:02:15 +000035
Patrick Rudolph03c7b052018-03-29 10:05:34 +020036/**
37 * Find a character in a string.
38 *
39 * @param s The string.
40 * @param c The character.
41 * @return A pointer to the last occurrence of the character in the
42 * string, or NULL if the character was not encountered within the string.
43 */
Julius Wernera66c9b82019-05-20 14:53:47 -070044char *strrchr(const char *s, int c);
Patrick Rudolph03c7b052018-03-29 10:05:34 +020045
Julius Wernera66c9b82019-05-20 14:53:47 -070046/*
47 * Parses an unsigned integer and moves the input pointer forward to the first
48 * character that's not a valid digit. s and *s must not be NULL. Result
49 * undefined if it overruns the return type size.
50 */
51unsigned int skip_atoi(char **s);
Stefan Reinauer36c83402009-03-01 10:16:01 +000052
Eric Biederman8ca8d762003-04-22 19:02:15 +000053#endif /* STRING_H */