aboutsummaryrefslogtreecommitdiff
path: root/src/lib9/strdup.c
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2004-06-09 14:15:47 +0000
committerrsc <devnull@localhost>2004-06-09 14:15:47 +0000
commitf437e56d1d5c8180ee2f93273f78393426efd5f9 (patch)
tree61e6ed23e29f65b077c6cb1c2a80f266eab9f6d7 /src/lib9/strdup.c
parentca9b36624f0a8074e65cebfbabfee8a824a4d312 (diff)
downloadplan9port-f437e56d1d5c8180ee2f93273f78393426efd5f9.tar.gz
plan9port-f437e56d1d5c8180ee2f93273f78393426efd5f9.tar.bz2
plan9port-f437e56d1d5c8180ee2f93273f78393426efd5f9.zip
add strdup for debugging.
Diffstat (limited to 'src/lib9/strdup.c')
-rw-r--r--src/lib9/strdup.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/lib9/strdup.c b/src/lib9/strdup.c
new file mode 100644
index 00000000..5ca31866
--- /dev/null
+++ b/src/lib9/strdup.c
@@ -0,0 +1,17 @@
+#include <u.h>
+#include <libc.h>
+
+char*
+strdup(char *s)
+{
+ char *t;
+ int l;
+
+ l = strlen(s);
+ t = malloc(l+1);
+ if(t == nil)
+ return nil;
+ memmove(t, s, l+1);
+ return t;
+}
+