summaryrefslogtreecommitdiff
path: root/util/sbase/libutil/estrtod.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/sbase/libutil/estrtod.c')
-rw-r--r--util/sbase/libutil/estrtod.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/util/sbase/libutil/estrtod.c b/util/sbase/libutil/estrtod.c
new file mode 100644
index 00000000..24e4fdce
--- /dev/null
+++ b/util/sbase/libutil/estrtod.c
@@ -0,0 +1,18 @@
+/* See LICENSE file for copyright and license details. */
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "../util.h"
+
+double
+estrtod(const char *s)
+{
+ char *end;
+ double d;
+
+ d = strtod(s, &end);
+ if (end == s || *end != '\0')
+ eprintf("%s: not a real number\n", s);
+ return d;
+}