summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrsc <rsc>2007-08-08 08:56:09 +0000
committerrsc <rsc>2007-08-08 08:56:09 +0000
commite204d0a151a0611085510840465ee418cccfefcb (patch)
tree3639e7f0646a786bca002c405a81b3f5a2300144
parente0924827eef75ac29f17909c6f932222eda72fbd (diff)
downloadxv6-labs-e204d0a151a0611085510840465ee418cccfefcb.tar.gz
xv6-labs-e204d0a151a0611085510840465ee418cccfefcb.tar.bz2
xv6-labs-e204d0a151a0611085510840465ee418cccfefcb.zip
atoi, for kill
-rw-r--r--ulib.c11
-rw-r--r--user.h1
2 files changed, 12 insertions, 0 deletions
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*);