commit f437e56d1d5c8180ee2f93273f78393426efd5f9 parent ca9b36624f0a8074e65cebfbabfee8a824a4d312 Author: rsc <devnull@localhost> Date: Wed, 9 Jun 2004 14:15:47 +0000 add strdup for debugging. Diffstat:
M | src/lib9/mkfile | | | 1 | + |
A | src/lib9/strdup.c | | | 17 | +++++++++++++++++ |
2 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/src/lib9/mkfile b/src/lib9/mkfile @@ -137,6 +137,7 @@ LIB9OFILES=\ seek.$O\ sendfd.$O\ sleep.$O\ + strdup.$O\ strecpy.$O\ sysfatal.$O\ sysname.$O\ diff --git a/src/lib9/strdup.c 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; +} +