From: Robert Kessl Date: Thu, 24 Jul 2014 06:49:09 +0000 (+0200) Subject: xtypes: bool now supports yes/no strings X-Git-Tag: v6.1~3^2~55 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=3f82df43970c14a075f6590417f6b72ba5d3fe93;p=libucw.git xtypes: bool now supports yes/no strings --- diff --git a/ucw/xtypes-basic.c b/ucw/xtypes-basic.c index 2792cd19..25d9fa84 100644 --- a/ucw/xtypes-basic.c +++ b/ucw/xtypes-basic.c @@ -138,6 +138,16 @@ static const char *xt_bool_parse(const char *str, void *dest, struct mempool *po return NULL; } + if(strcasecmp(str, "no") == 0) { + *((bool *)dest) = false; + return NULL; + } + + if(strcasecmp(str, "yes") == 0) { + *((bool *)dest) = true; + return NULL; + } + return "Could not parse bool."; }