1
2
3
4
5
6
7#ifdef USE_HOSTCC
8#include <stdio.h>
9#endif
10
11#include <linux/ctype.h>
12#include <linux/string.h>
13
14
15
16
17
18
19
20char *skip_spaces(const char *str)
21{
22 while (isspace(*str))
23 ++str;
24 return (char *)str;
25}
26
27
28
29
30
31
32
33
34
35char *strim(char *s)
36{
37 size_t size;
38 char *end;
39
40 s = skip_spaces(s);
41 size = strlen(s);
42 if (!size)
43 return s;
44
45 end = s + size - 1;
46 while (end >= s && isspace(*end))
47 end--;
48 *(end + 1) = '\0';
49
50 return s;
51}
52