summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2016-04-29 11:05:50 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2016-04-29 11:29:25 +0200
commit22b8e9415d29c1e11cef0efb0aafd5ebd78cb51b (patch)
tree7ebb91e869322cda6ff04a190db6ed8ab32b1188 /include
parent941056dad1cb46f200b3268d003460db2bd02604 (diff)
downloadbarebox-22b8e9415d29c1e11cef0efb0aafd5ebd78cb51b.tar.gz
barebox-22b8e9415d29c1e11cef0efb0aafd5ebd78cb51b.tar.xz
string: Introduce strtobool
We have at least two places which convert a string to a boolean type, so create a common function for this. strtobool treats - any positive (nonzero) number as true - "0" as false - "true" (case insensitive) as true - "false" (case insensitive) as false Every other value results in an error and the input *val is not modified. The caller is expected to initialize *val with the correct default before calling strtobool. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/string.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/string.h b/include/string.h
index a833da131b..0c557d6f15 100644
--- a/include/string.h
+++ b/include/string.h
@@ -4,5 +4,6 @@
#include <linux/string.h>
void *memdup(const void *, size_t);
+int strtobool(const char *str, int *val);
#endif /* __STRING_H */