version 1.1.1.3, 2013/07/22 10:46:11
|
version 1.1.1.4, 2014/06/15 16:12:54
|
Line 1
|
Line 1
|
/* |
/* |
* Copyright (c) 2010-2012 Todd C. Miller <Todd.Miller@courtesan.com> | * Copyright (c) 2010-2014 Todd C. Miller <Todd.Miller@courtesan.com> |
* |
* |
* Permission to use, copy, modify, and distribute this software for any |
* Permission to use, copy, modify, and distribute this software for any |
* purpose with or without fee is hereby granted, provided that the above |
* purpose with or without fee is hereby granted, provided that the above |
Line 39
|
Line 39
|
|
|
#include "missing.h" |
#include "missing.h" |
#include "sudo_debug.h" |
#include "sudo_debug.h" |
|
#include "sudo_util.h" |
|
|
int |
int |
atobool(const char *str) |
atobool(const char *str) |
Line 49 atobool(const char *str)
|
Line 50 atobool(const char *str)
|
case '0': |
case '0': |
case '1': |
case '1': |
if (str[1] == '\0') |
if (str[1] == '\0') |
return *str - '0'; | debug_return_int(*str - '0'); |
break; |
break; |
case 'y': |
case 'y': |
case 'Y': |
case 'Y': |
if (strcasecmp(str, "yes") == 0) |
if (strcasecmp(str, "yes") == 0) |
return 1; | debug_return_int(1); |
break; |
break; |
case 't': |
case 't': |
case 'T': |
case 'T': |
if (strcasecmp(str, "true") == 0) |
if (strcasecmp(str, "true") == 0) |
return 1; | debug_return_int(1); |
break; |
break; |
case 'o': |
case 'o': |
case 'O': |
case 'O': |
if (strcasecmp(str, "on") == 0) |
if (strcasecmp(str, "on") == 0) |
return 1; | debug_return_int(1); |
if (strcasecmp(str, "off") == 0) |
if (strcasecmp(str, "off") == 0) |
return 0; | debug_return_int(0); |
break; |
break; |
case 'n': |
case 'n': |
case 'N': |
case 'N': |
if (strcasecmp(str, "no") == 0) |
if (strcasecmp(str, "no") == 0) |
return 0; | debug_return_int(0); |
break; |
break; |
case 'f': |
case 'f': |
case 'F': |
case 'F': |
if (strcasecmp(str, "false") == 0) |
if (strcasecmp(str, "false") == 0) |
return 0; | debug_return_int(0); |
break; |
break; |
} |
} |
debug_return_int(-1); |
debug_return_int(-1); |