diff options
| author | Markus Uhlin <markus@nifty-networks.net> | 2026-03-05 19:16:38 +0100 |
|---|---|---|
| committer | Markus Uhlin <markus@nifty-networks.net> | 2026-03-05 19:16:38 +0100 |
| commit | 0f1d8f3ffffc6e6a63fd57b773f4a8fd1a975a20 (patch) | |
| tree | 8061e92f369a1a659b711b7bebca23a9fc153cde /FICS/playerdb.c | |
| parent | c247927e89f2cf8f5642d54cbc05d96e5b2911a1 (diff) | |
Added get_uint()
Diffstat (limited to 'FICS/playerdb.c')
| -rw-r--r-- | FICS/playerdb.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/FICS/playerdb.c b/FICS/playerdb.c index 5f8dfd6..bdad800 100644 --- a/FICS/playerdb.c +++ b/FICS/playerdb.c @@ -61,6 +61,7 @@ #include <errno.h> #include <fcntl.h> #include <inttypes.h> +#include <limits.h> #include <stdint.h> #include "command.h" @@ -80,6 +81,7 @@ #include "utils.h" #if __linux__ +#include <bsd/stdlib.h> #include <bsd/string.h> #endif @@ -714,6 +716,16 @@ ReadV1PlayerFmt(int p, player *pp, FILE *fp, char *file, int version) } } +PUBLIC unsigned int +get_uint(const char *nptr) +{ + const char *errstr = NULL; + const unsigned int val = (unsigned int) strtonum(nptr, + 0, UINT_MAX, &errstr); + + return (errstr ? 0 : val); +} + PRIVATE int got_attr_value_player(int p, char *attr, char *value, FILE *fp, char *file) { |
