blob: 8267af75153ac25c1fe6e3c011605d84777ef56b [file] [log] [blame]
Olivier Deprez157378f2022-04-04 15:47:50 +02001/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _SKC_LINUX_STRING_H
3#define _SKC_LINUX_STRING_H
4
5#include <string.h>
6
7/* Copied from lib/string.c */
8static inline char *skip_spaces(const char *str)
9{
10 while (isspace(*str))
11 ++str;
12 return (char *)str;
13}
14
15static inline char *strim(char *s)
16{
17 size_t size;
18 char *end;
19
20 size = strlen(s);
21 if (!size)
22 return s;
23
24 end = s + size - 1;
25 while (end >= s && isspace(*end))
26 end--;
27 *(end + 1) = '\0';
28
29 return skip_spaces(s);
30}
31
32#endif