add agetline, separate estrtod to util
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
This commit is contained in:
18
util/estrtod.c
Normal file
18
util/estrtod.c
Normal file
@@ -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;
|
||||
}
|
Reference in New Issue
Block a user