sbase

suckless unix tools
git clone git://git.suckless.org/sbase
Log | Files | Refs | README | LICENSE

estrtod.c (302B)


      1 /* See LICENSE file for copyright and license details. */
      2 #include <errno.h>
      3 #include <stdio.h>
      4 #include <stdlib.h>
      5 
      6 #include "../util.h"
      7 
      8 double
      9 estrtod(const char *s)
     10 {
     11 	char *end;
     12 	double d;
     13 
     14 	d = strtod(s, &end);
     15 	if (end == s || *end != '\0')
     16 		eprintf("%s: not a real number\n", s);
     17 	return d;
     18 }