comparison th_string.c @ 169:a06a87b771ce

Add on/off to valid boolean values.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 18 Feb 2015 21:44:28 +0200
parents 7638fa9d191f
children 7d5707438333
comparison
equal deleted inserted replaced
168:a2cd862315c5 169:a06a87b771ce
575 575
576 576
577 BOOL th_get_boolean(const char *str, BOOL *value) 577 BOOL th_get_boolean(const char *str, BOOL *value)
578 { 578 {
579 if (!th_strcasecmp(str, "yes") || 579 if (!th_strcasecmp(str, "yes") ||
580 !th_strcasecmp(str, "on") ||
580 !th_strcasecmp(str, "true") || 581 !th_strcasecmp(str, "true") ||
581 !th_strcasecmp(str, "1")) 582 !th_strcasecmp(str, "1"))
582 { 583 {
583 *value = TRUE; 584 *value = TRUE;
584 return TRUE; 585 return TRUE;
585 } 586 }
586 else 587 else
587 if (!th_strcasecmp(str, "no") || 588 if (!th_strcasecmp(str, "no") ||
589 !th_strcasecmp(str, "off") ||
588 !th_strcasecmp(str, "false") || 590 !th_strcasecmp(str, "false") ||
589 !th_strcasecmp(str, "0")) 591 !th_strcasecmp(str, "0"))
590 { 592 {
591 *value = FALSE; 593 *value = FALSE;
592 return TRUE; 594 return TRUE;