wm: teppich

ref: 3b735b0c7ea632cc7c861cfe85b161da5cce5e36
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;
}