summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-08-24 21:05:39 +0000
committerEric Andersen <andersen@codepoet.org>2001-08-24 21:05:39 +0000
commitfa5a15eeb283a27ea4f03ee581856930e60a7ca0 (patch)
treefcbc3b65c4653105ebc54f2c756851379add0237 /libc
parentfb35042521e6e4b0dcee32ca7e0ce33b18f9523d (diff)
atoi, atol, atoll, and atof are supposed to be functions, not macros.
-Erik
Diffstat (limited to 'libc')
-rw-r--r--libc/stdlib/Makefile4
-rw-r--r--libc/stdlib/strto_l.c17
-rw-r--r--libc/stdlib/strto_ll.c10
-rw-r--r--libc/stdlib/strtod.c7
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));
+
+}