plan9port/src/lib9/strdup.c

18 lines
174 B
C
Raw Normal View History

2004-06-09 14:15:47 +00:00
#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;
}