diff options
-rw-r--r-- | include/stdlib.h | 8 | ||||
-rw-r--r-- | libc/stdlib/Makefile | 4 | ||||
-rw-r--r-- | libc/stdlib/strto_l.c | 17 | ||||
-rw-r--r-- | libc/stdlib/strto_ll.c | 10 | ||||
-rw-r--r-- | libc/stdlib/strtod.c | 7 |
5 files changed, 39 insertions, 7 deletions
diff --git a/include/stdlib.h b/include/stdlib.h index e5588cb3b..17afbe9d3 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -42,10 +42,10 @@ typedef __compar_fn_t comparison_fn_t; /* String to number conversion functions */ -#define atof(x) strtod((x),(char**)0) -#define atoi(x) (int)strtol((x),(char**)0,10) -#define atol(x) strtol((x),(char**)0,10) -#define atoll(x) strtoll((x),(char**)0,10) +extern double atof(const char *nptr); +extern int atoi(const char *nptr); +extern long atol(const char *nptr); +extern long long atoll(const char *nptr); extern long strtol __P ((const char * nptr, char ** endptr, int base)); extern unsigned long strtoul __P ((const char * nptr, char ** endptr, int base)); extern long long strtoll __P ((const char * nptr, char ** endptr, int base)); diff --git a/libc/stdlib/Makefile b/libc/stdlib/Makefile index 6a5db9f34..cff8ada0a 100644 --- a/libc/stdlib/Makefile +++ b/libc/stdlib/Makefile @@ -27,10 +27,10 @@ DIRS = $(MALLOC) ALL_SUBDIRS = malloc malloc-930716 malloc-simple MSRC=strto_l.c -MOBJ=strtol.o strtoul.o strto_l.o +MOBJ=strtol.o strtoul.o strto_l.o atoi.o atol.o MSRC1=strto_ll.c -MOBJ1=strtoll.o strtoull.o strto_ll.o +MOBJ1=strtoll.o strtoull.o strto_ll.o atoll.o MSRC2=atexit.c MOBJ2=atexit.o exit.o diff --git a/libc/stdlib/strto_l.c b/libc/stdlib/strto_l.c index aed6ef346..666433927 100644 --- a/libc/stdlib/strto_l.c +++ b/libc/stdlib/strto_l.c @@ -183,10 +183,25 @@ unsigned long strtoul(const char *str, char **endptr, int base) #endif #if L_strtol - long strtol(const char *str, char **endptr, int base) { return _strto_l(str, endptr, base, 0); } #endif + +#ifdef L_atoi +int atoi(const char *str) +{ + return((int)_strto_l((str),(char**)0,10, 0)); + +} +#endif + +#ifdef L_atol +long atol(const char *str) +{ + return(_strto_l((str),(char**)0,10, 0)); +} +#endif + diff --git a/libc/stdlib/strto_ll.c b/libc/stdlib/strto_ll.c index e127b181d..c3a5439b3 100644 --- a/libc/stdlib/strto_ll.c +++ b/libc/stdlib/strto_ll.c @@ -190,3 +190,13 @@ long long strtoll(const char *str, char **endptr, int base) } #endif + +#ifdef L_atoll +long long atoll(const char *str) +{ + return(_strto_ll((str),(char**)0,10,0)); +} +#endif + + + diff --git a/libc/stdlib/strtod.c b/libc/stdlib/strtod.c index 7359d5cf9..629d412b6 100644 --- a/libc/stdlib/strtod.c +++ b/libc/stdlib/strtod.c @@ -261,3 +261,10 @@ double strtod(const char *str, char **endptr) return number; } + +/* This should probably be in its own .o file. Oh well. */ +double atof(const char *str) +{ + return(strtod((str),(char**)0)); + +} |