Fix rc_env_bool

This commit is contained in:
Roy Marples 2007-09-26 07:52:48 +00:00
parent e24d808fc5
commit ef0df58761
2 changed files with 9 additions and 9 deletions

View File

@ -7,7 +7,7 @@
* Released under the GPLv2
*/
#define getoptstring_COMMON "Chq"
#define getoptstring_COMMON "Chqv"
#define longopts_COMMON \
{ "help", 0, NULL, 'h'}, \

View File

@ -69,16 +69,16 @@ bool rc_env_bool (const char *var)
return (false);
}
if (strcasecmp (var, "true") == 0 ||
strcasecmp (var, "y") == 0 ||
strcasecmp (var, "yes") == 0 ||
strcasecmp (var, "1") == 0)
if (strcasecmp (v, "true") == 0 ||
strcasecmp (v, "y") == 0 ||
strcasecmp (v, "yes") == 0 ||
strcasecmp (v, "1") == 0)
return (true);
if (strcasecmp (var, "false") != 0 &&
strcasecmp (var, "n") != 0 &&
strcasecmp (var, "no") != 0 &&
strcasecmp (var, "0") != 0)
if (strcasecmp (v, "false") != 0 &&
strcasecmp (v, "n") != 0 &&
strcasecmp (v, "no") != 0 &&
strcasecmp (v, "0") != 0)
errno = EINVAL;
return (false);