diff options
Diffstat (limited to 'FICS')
-rw-r--r-- | FICS/variable.c | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/FICS/variable.c b/FICS/variable.c index 0f74d72..1ec48d7 100644 --- a/FICS/variable.c +++ b/FICS/variable.c @@ -47,28 +47,31 @@ #include <bsd/string.h> #endif -PRIVATE int set_boolean_var(int *var, char *val) -{ - int v = -1; - - if (val == NULL) - return (*var = !*var); - - if (sscanf(val, "%d", &v) != 1) { - stolower(val); - if (!strcmp(val, "off")) - v = 0; - if (!strcmp(val, "false")) - v = 0; - if (!strcmp(val, "on")) - v = 1; - if (!strcmp(val, "true")) - v = 1; - } - if ((v == 0) || (v == 1)) - return (*var = v); - else - return (-1); +PRIVATE int +set_boolean_var(int *var, char *val) +{ + int v = -1; + + if (val == NULL) + return (*var = !*var); + + if (sscanf(val, "%d", &v) != 1) { + stolower(val); + + if (!strcmp(val, "off")) + v = 0; + if (!strcmp(val, "false")) + v = 0; + if (!strcmp(val, "on")) + v = 1; + if (!strcmp(val, "true")) + v = 1; + } + + if (v == 0 || v == 1) + return (*var = v); + else + return (-1); } PRIVATE int |