aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/string.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/lib/string.c b/tools/lib/string.c
index 93b3d4b6feac..50d400822bb3 100644
--- a/tools/lib/string.c
+++ b/tools/lib/string.c
@@ -17,6 +17,7 @@
17#include <string.h> 17#include <string.h>
18#include <errno.h> 18#include <errno.h>
19#include <linux/string.h> 19#include <linux/string.h>
20#include <linux/ctype.h>
20#include <linux/compiler.h> 21#include <linux/compiler.h>
21 22
22/** 23/**
@@ -106,3 +107,16 @@ size_t __weak strlcpy(char *dest, const char *src, size_t size)
106 } 107 }
107 return ret; 108 return ret;
108} 109}
110
111/**
112 * skip_spaces - Removes leading whitespace from @str.
113 * @str: The string to be stripped.
114 *
115 * Returns a pointer to the first non-whitespace character in @str.
116 */
117char *skip_spaces(const char *str)
118{
119 while (isspace(*str))
120 ++str;
121 return (char *)str;
122}