SysTutorials

Linux Manual Pages › Section 9

kstrtobool(9)

kstrtobool - convert common user inputs into boolean values

Synopsis

int kstrtobool(const char *s, bool *res);

Arguments

s

input string

res

result

Description

This routine returns 0 iff the first character is one of ‘Yy1Nn0’, or [oO][NnFf] for “on” and “off”. Otherwise it will return -EINVAL. Value pointed to by res is updated upon finding a match.

Copyright