aboutsummaryrefslogtreecommitdiff
path: root/src/common.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2014-07-13 05:56:30 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2014-07-13 05:56:30 +0200
commit03ec980f269c8222eaeeb3bbae8c3cab20595bfd (patch)
tree25246d529543e24dc60050f267181c23fa92ba54 /src/common.c
parent51909edc767966cd677cb65a8c8ca978a97ec655 (diff)
downloadxK-03ec980f269c8222eaeeb3bbae8c3cab20595bfd.tar.gz
xK-03ec980f269c8222eaeeb3bbae8c3cab20595bfd.tar.xz
xK-03ec980f269c8222eaeeb3bbae8c3cab20595bfd.zip
Add a strtoul() wrapper
Diffstat (limited to 'src/common.c')
-rw-r--r--src/common.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/common.c b/src/common.c
index fcb9742..8ec6646 100644
--- a/src/common.c
+++ b/src/common.c
@@ -1418,6 +1418,15 @@ set_boolean_if_valid (bool *out, const char *s)
}
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)
{
int c;