wm: teppich

Download patch

ref: 3b735b0c7ea632cc7c861cfe85b161da5cce5e36
parent: bf8045ae53625a05a91049f7757ae4036b2d91cd
author: mkf <mkf@cloud9p.org>
date: Sun May 26 20:42:40 EDT 2024

add atoi2

--- a/include/libc.h
+++ b/include/libc.h
@@ -15,6 +15,7 @@
 char* strncpy(char *dst, const char *src, size_t num);
 char* strncat(char *s1, char *s2, long n);
 char* strdup(char *s);
+char* strchar(char *s, char c);
 
 /* mem */
 void* memset(void* src, char c, unsigned int len);
--- /dev/null
+++ b/libc/atoi.c
@@ -1,0 +1,14 @@
+#include <u.h>
+#include <libc.h>
+
+/* doesn't handle - */
+int
+atoi(char *s)
+{
+	int n = 0;
+	while(*s > '9' || *s < '0')
+	{
+		n += *s - '0';
+	}
+	return n;
+}