Add a strtoul() wrapper

This commit is contained in:
2014-07-13 05:56:30 +02:00
parent 51909edc76
commit 03ec980f26
2 changed files with 11 additions and 4 deletions

View File

@@ -1417,6 +1417,15 @@ set_boolean_if_valid (bool *out, const char *s)
return true;
}
static bool
xstrtoul (unsigned long *out, const char *s, int base)
{
char *end;
errno = 0;
*out = strtoul (s, &end, base);
return errno == 0 && !*end && end != s;
}
static bool
read_line (FILE *fp, struct str *s)
{