From 439d724ce5939cab7a5c858d1829f212e01e0402 Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Sun, 1 Feb 2015 11:33:16 -0500 Subject: first real commit --- libc/string.c | 19 +++++++++++++++++++ libc/string.h | 3 +++ 2 files changed, 22 insertions(+) create mode 100644 libc/string.c create mode 100644 libc/string.h (limited to 'libc') diff --git a/libc/string.c b/libc/string.c new file mode 100644 index 0000000..33ccad9 --- /dev/null +++ b/libc/string.c @@ -0,0 +1,19 @@ +#include +#include "string.h" + +int strlen(const char *str) +{ + int len = 0; + while(s++) + len++; + return len; +} + +void* memset(void *buf, int val, size_t sz) +{ + for(size_t i = 0; i < sz; ++i) + { + buf[i] = (uint8_t) val; + } + return buf; +} diff --git a/libc/string.h b/libc/string.h new file mode 100644 index 0000000..8606fab --- /dev/null +++ b/libc/string.h @@ -0,0 +1,3 @@ +#include +int strlen(const char*); +void* memset(void*, int, size_t); -- cgit v1.1