summary refs log blame commit diff
path: root/num.h
blob: 64347d1cd4c1de14379ad0dd856fd2f5e40e91ca (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12











                                                                      
// SPDX-License-Identifier: GPL-2.0-or-later
// SPDX-FileCopyrightText: 2020 Alyssa Ross <hi@alyssa.is>

#include <stdint.h>

// Strictly parse an integer from a string.  The integer must span the
// whole string, not have any leading + or zeros, and be between min
// and max (inclusive).

int getu32(const char *s, uint32_t min, uint32_t max, uint32_t *out);
int getul(const char *s, unsigned long min, unsigned long max,
	  unsigned long *out);