wm: teppich

ref: a1d3f868bb87c80eb1defda679142d0c3b59b23c
dir: /libc/atoi.c/

View raw version
#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;
}