diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-04-01 22:04:55 +0200 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-04-01 22:04:55 +0200 |
commit | c4ae4dffb68bbb6a3fec7a42b886c1a397658297 (patch) | |
tree | 983925b1bf74e44b280ef702e5e9152df7dafba4 /FICS | |
parent | a8d9674d3d0de1287107ebdc60e17f766693cd77 (diff) |
Reformatted set_boolean_var()
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 |