summaryrefslogtreecommitdiff
path: root/src/stdlib/atoi.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdlib/atoi.c')
-rw-r--r--src/stdlib/atoi.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/stdlib/atoi.c b/src/stdlib/atoi.c
new file mode 100644
index 00000000..6e58dd22
--- /dev/null
+++ b/src/stdlib/atoi.c
@@ -0,0 +1,19 @@
+#include <stdlib.h>
+
+/** convert string to integer **/
+
+int atoi(const char * nptr)
+{
+ return (int)strtol(nptr, (char**)NULL, 10);
+}
+
+/***
+converts the string at ARGUMENT(nptr) to an TYPE(int) value,
+using base 10. The conversion goes until the first non-digit character.
+***/
+
+/*
+LC_CTYPE
+RETURN_SUCCESS(the converted value)
+STDC(1)
+*/