diff options
| author | Markus Uhlin <markus@nifty-networks.net> | 2026-03-02 22:54:43 +0100 |
|---|---|---|
| committer | Markus Uhlin <markus@nifty-networks.net> | 2026-03-02 22:54:43 +0100 |
| commit | c9ec87701e1c5dc9c3bb615eeacb96931535b4e5 (patch) | |
| tree | beac8d840dd673935fe622c74c858b8daad3a0f2 /FICS | |
| parent | ee6e5db30e28576274d66cd5b617cd4bf003a36a (diff) | |
Replaced atoi() with strtol()
Diffstat (limited to 'FICS')
| -rw-r--r-- | FICS/matchproc.c | 6 | ||||
| -rw-r--r-- | FICS/obsproc.c | 2 | ||||
| -rw-r--r-- | FICS/variable.c | 2 |
3 files changed, 6 insertions, 4 deletions
diff --git a/FICS/matchproc.c b/FICS/matchproc.c index 36f6a4a..1601c5d 100644 --- a/FICS/matchproc.c +++ b/FICS/matchproc.c @@ -42,6 +42,7 @@ #include <sys/resource.h> #include <err.h> +#include <stdlib.h> #include <string.h> #include "board.h" @@ -725,7 +726,7 @@ com_match(int p, param_list param) } if (param[1].type != TYPE_NULL) { - int numba; // temp for atoi() + int numba; val = param[1].val.string; @@ -737,7 +738,8 @@ com_match(int p, param_list param) if (category[0] != '\0' && board[0] == '\0') { strlcpy(board, parsebuf, sizeof board); } else if (isdigit(*parsebuf)) { - if ((numba = atoi(parsebuf)) < 0) { + if ((numba = (int)strtol(parsebuf, + (char **)NULL, 10)) < 0) { pprintf(p, "You can't specify " "negative time controls." "\n"); diff --git a/FICS/obsproc.c b/FICS/obsproc.c index 375ced3..eed4bf3 100644 --- a/FICS/obsproc.c +++ b/FICS/obsproc.c @@ -144,7 +144,7 @@ com_games(int p, param_list param) s = param[0].val.word; slen = strlen(s); - if ((selected = atoi(s)) < 0) + if ((selected = (int)strtol(s, (char **)NULL, 10)) < 0) selected = 0; } diff --git a/FICS/variable.c b/FICS/variable.c index e004eca..ee3f16c 100644 --- a/FICS/variable.c +++ b/FICS/variable.c @@ -738,7 +738,7 @@ set_plan(int p, char *var, char *val) if (val && !printablestring(val)) return VAR_BADVAL; - if ((which = atoi(var)) > MAX_PLAN) + if ((which = (int)strtol(var, (char **)NULL, 10)) > MAX_PLAN) return VAR_BADVAL; if (which > parray[p].num_plan) which = parray[p].num_plan + 1; |
