From e204d0a151a0611085510840465ee418cccfefcb Mon Sep 17 00:00:00 2001 From: rsc Date: Wed, 8 Aug 2007 08:56:09 +0000 Subject: [PATCH] atoi, for kill --- ulib.c | 11 +++++++++++ user.h | 1 + 2 files changed, 12 insertions(+) diff --git a/ulib.c b/ulib.c index decab69..ce4e13d 100644 --- a/ulib.c +++ b/ulib.c @@ -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; +} diff --git a/user.h b/user.h index bda6e6c..1bd512d 100644 --- a/user.h +++ b/user.h @@ -31,3 +31,4 @@ unsigned int strlen(char*); void* memset(void*, int, unsigned int); void* malloc(uint); void free(void*); +int atoi(const char*);