diff options
author | Malfurious <m@lfurio.us> | 2023-10-02 02:34:50 -0400 |
---|---|---|
committer | Malfurious <m@lfurio.us> | 2024-04-24 13:31:08 -0400 |
commit | 67a0755a248c9793a1e7a3cf73f4041b2103ebf7 (patch) | |
tree | 60cfbd20036f13cb78cc6062ae38b6f06978fd0f | |
parent | d6add3a39a71081efe8b5b45ba2ed8a4f5075969 (diff) | |
download | misplays-67a0755a248c9793a1e7a3cf73f4041b2103ebf7.tar.gz misplays-67a0755a248c9793a1e7a3cf73f4041b2103ebf7.zip |
Add strict_strtoul
Signed-off-by: Malfurious <m@lfurio.us>
-rw-r--r-- | helpers.c | 6 | ||||
-rw-r--r-- | helpers.h | 1 |
2 files changed, 7 insertions, 0 deletions
@@ -11,6 +11,12 @@ void *xmalloc(size_t size) { return ptr; } +unsigned long strict_strtoul(const char *nptr, int base) { + char *endptr; + unsigned long ret = strtoul(nptr, &endptr, base); + return (*endptr ? 0 : ret); +} + void cursinit(void) { setlocale(LC_ALL, ""); initscr(); @@ -7,6 +7,7 @@ #define KEY_ESCAPE 0x1b extern void *xmalloc(size_t size); +extern unsigned long strict_strtoul(const char *nptr, int base); extern void cursinit(void); extern void cursupdate(void); |