From fa5a15eeb283a27ea4f03ee581856930e60a7ca0 Mon Sep 17 00:00:00 2001
From: Eric Andersen <andersen@codepoet.org>
Date: Fri, 24 Aug 2001 21:05:39 +0000
Subject: atoi, atol, atoll, and atof are supposed to be functions, not macros.
  -Erik

---
 libc/stdlib/Makefile   |  4 ++--
 libc/stdlib/strto_l.c  | 17 ++++++++++++++++-
 libc/stdlib/strto_ll.c | 10 ++++++++++
 libc/stdlib/strtod.c   |  7 +++++++
 4 files changed, 35 insertions(+), 3 deletions(-)

(limited to 'libc/stdlib')

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));
+
+}
-- 
cgit v1.2.3