projects
/
metatoy
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
3dgfx code, untested
[metatoy]
/
src
/
libc
/
string.c
diff --git
a/src/libc/string.c
b/src/libc/string.c
index
06d8f87
..
923d782
100644
(file)
--- a/
src/libc/string.c
+++ b/
src/libc/string.c
@@
-223,6
+223,17
@@
char *strncpy(char *dest, const char *src, int n)
return dest;
}
+char *strdup(const char *s)
+{
+ char *ns;
+ int len = strlen(s);
+ if(!(ns = malloc(len + 1))) {
+ return 0;
+ }
+ memcpy(ns, s, len + 1);
+ return ns;
+}
+
/*
static const char *errstr[] = {
"Success",