|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT PATCH 1/5] lib/nolibc: Extending the nolibc to support atoi function
Signed-off-by: Sharan Santhanam <sharan.santhanam@xxxxxxxxx>
---
lib/nolibc/include/stdlib.h | 6 ++++++
lib/nolibc/stdlib.c | 5 +++++
2 files changed, 11 insertions(+)
diff --git a/lib/nolibc/include/stdlib.h b/lib/nolibc/include/stdlib.h
index dd6f9f7..12bc086 100644
--- a/lib/nolibc/include/stdlib.h
+++ b/lib/nolibc/include/stdlib.h
@@ -48,6 +48,12 @@ unsigned long strtoul(const char *nptr, char **endptr, int
base);
long long strtoll(const char *nptr, char **endptr, int base);
unsigned long long strtoull(const char *nptr, char **endptr, int base);
+/**
+ * Convert a string to an integer
+ * @s: The start of the string
+ */
+int atoi (const char *s);
+
#if CONFIG_LIBUKALLOC
/* Allocate size bytes of memory. Returns pointer to start of allocated memory,
* or NULL on failure.
diff --git a/lib/nolibc/stdlib.c b/lib/nolibc/stdlib.c
index d48083a..e6d162b 100644
--- a/lib/nolibc/stdlib.c
+++ b/lib/nolibc/stdlib.c
@@ -276,3 +276,8 @@ unsigned long long strtoull(const char *nptr, char
**endptr, int base)
*endptr = __DECONST(char *, any ? s - 1 : nptr);
return acc;
}
+
+int atoi (const char *s)
+{
+ return (int) strtoll (s, NULL, 10);
+}
--
2.7.4
_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |