1 #include <lib9.h> 2 3 static int strtodf(void * vp)4strtodf(void *vp) 5 { 6 return *(*((char**)vp))++; 7 } 8 9 double strtod(char * s,char ** end)10strtod(char *s, char **end) 11 { 12 double d; 13 char *ss; 14 int c; 15 16 ss = s; 17 d = charstod(strtodf, &s); 18 /* 19 * Fix cases like 2.3e+ , which charstod will consume 20 */ 21 if(end){ 22 *end = --s; 23 while(s > ss){ 24 c = *--s; 25 if(c!='-' && c!='+' && c!='e' && c!='E') 26 break; 27 (*end)--; 28 } 29 } 30 return d; 31 } 32