diff options
Diffstat (limited to 'FICS')
| -rw-r--r-- | FICS/playerdb.c | 12 | ||||
| -rw-r--r-- | FICS/playerdb.h | 1 |
2 files changed, 13 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) { diff --git a/FICS/playerdb.h b/FICS/playerdb.h index 1ccae61..56f9007 100644 --- a/FICS/playerdb.h +++ b/FICS/playerdb.h @@ -278,4 +278,5 @@ extern void player_pend_print(int, pending *); extern void player_write_login(int); extern void player_write_logout(int); +extern unsigned int get_uint(const char *); #endif /* _PLAYERDB_H */ |
