From 0f1d8f3ffffc6e6a63fd57b773f4a8fd1a975a20 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Thu, 5 Mar 2026 19:16:38 +0100 Subject: Added get_uint() --- FICS/playerdb.c | 12 ++++++++++++ FICS/playerdb.h | 1 + 2 files changed, 13 insertions(+) (limited to 'FICS') 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 #include #include +#include #include #include "command.h" @@ -80,6 +81,7 @@ #include "utils.h" #if __linux__ +#include #include #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 */ -- cgit v1.2.3