diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-04-01 19:36:01 +0200 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-04-01 19:36:01 +0200 |
commit | 7cb9f448daaaec4a6da6ca09acb845f65c55266c (patch) | |
tree | d218d30434809b25d91c909b4d13d20dc39e83cb /FICS/variable.c | |
parent | 3d7feff71bb8b5878c497ddd46d3d6998fd006c8 (diff) |
Reformatted set_language()
Diffstat (limited to 'FICS/variable.c')
-rw-r--r-- | FICS/variable.c | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/FICS/variable.c b/FICS/variable.c index f00079b..4040f2a 100644 --- a/FICS/variable.c +++ b/FICS/variable.c @@ -418,25 +418,32 @@ PUBLIC char *Language(int i) return Lang[i]; } -PRIVATE int set_language (int p, char *var, char *val) +PRIVATE int +set_language(int p, char *var, char *val) { - int i, len, gotIt = -1; + int len, gotIt = -1; - if (!val) - return VAR_BADVAL; - len = strlen(val); - for (i=0; i < NUM_LANGS; i++) { - if (strncasecmp(val, Language(i), len)) - continue; - if (gotIt >= 0) - return VAR_BADVAL; - else gotIt = i; - } - if (gotIt < 0) - return VAR_BADVAL; - parray[p].language = gotIt; - pprintf(p, "Language set to %s.\n", Language(gotIt)); - return VAR_OK; + if (!val) + return VAR_BADVAL; + + len = strlen(val); + + for (int i = 0; i < NUM_LANGS; i++) { + if (strncasecmp(val, Language(i), len)) + continue; + if (gotIt >= 0) + return VAR_BADVAL; + else + gotIt = i; + } + + if (gotIt < 0) + return VAR_BADVAL; + + parray[p].language = gotIt; + + pprintf(p, "Language set to %s.\n", Language(gotIt)); + return VAR_OK; } PRIVATE int |