mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-15 11:20:03 +00:00
18 lines
174 B
C
18 lines
174 B
C
|
#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;
|
||
|
}
|
||
|
|