From f900298d7932af7930da362b0d5b92fef5545b01 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 9 Sep 2017 22:05:10 -0500 Subject: Last commit used xstrtod(), forgot to check it in. --- lib/xwrap.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/xwrap.c') diff --git a/lib/xwrap.c b/lib/xwrap.c index 83f54a0a..74da0ed1 100644 --- a/lib/xwrap.c +++ b/lib/xwrap.c @@ -755,6 +755,19 @@ long long xsendfile(int in, int out) return total; } +double xstrtod(char *s) +{ + char *end; + double d; + + errno = 0; + d = strtod(s, &end); + if (!errno && *end) errno = E2BIG; + if (errno) perror_exit("strtod %s", s); + + return d; +} + // parse fractional seconds with optional s/m/h/d suffix long xparsetime(char *arg, long units, long *fraction) { -- cgit v1.2.3