Commit Diff


commit - c247927e89f2cf8f5642d54cbc05d96e5b2911a1
commit + 0f1d8f3ffffc6e6a63fd57b773f4a8fd1a975a20
blob - 5f8dfd631c2b683a4af093c2b8c21c606a306e6b
blob + bdad8007768d5689706551b79b0caa0b1ed904c6
--- FICS/playerdb.c
+++ 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 *fil
 	}
 }
 
+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)
 {
blob - 1ccae619deb254fd74fb7edd8a95ed72a1626551
blob + 56f90075d5fa32696f8b94b9d5e57377568516e5
--- FICS/playerdb.h
+++ 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 */