diff options
Diffstat (limited to 'libc/stdlib')
-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 |
4 files changed, 35 insertions, 3 deletions
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)); + +} |