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>
1 parent 941056d commit 22b8e9415d29c1e11cef0efb0aafd5ebd78cb51b
@Sascha Hauer Sascha Hauer authored on 29 Apr 2016
Showing 2 changed files
View
include/string.h
View
lib/string.c