atoi, for kill

This commit is contained in:
rsc 2007-08-08 08:56:09 +00:00
parent e0924827ee
commit e204d0a151
2 changed files with 12 additions and 0 deletions

11
ulib.c
View file

@ -88,3 +88,14 @@ stat(char *n, struct stat *st)
close(fd);
return r;
}
int
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
n = n*10 + *s++ - '0';
return n;
}

1
user.h
View file

@ -31,3 +31,4 @@ unsigned int strlen(char*);
void* memset(void*, int, unsigned int);
void* malloc(uint);
void free(void*);
int atoi(const char*);