add agetline, separate estrtod to util

Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
This commit is contained in:
Hiltjo Posthuma
2014-06-01 13:57:22 +02:00
committed by sin
parent daad071b31
commit d12e953f18
6 changed files with 41 additions and 20 deletions

13
util/agetline.c Normal file
View File

@@ -0,0 +1,13 @@
/* See LICENSE file for copyright and license details. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../text.h"
#include "../util.h"
ssize_t
agetline(char **p, size_t *size, FILE *fp)
{
return getline(p, size, fp);
}

18
util/estrtod.c Normal file
View 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;
}