Sign in
plan9port
/
plan9
/
32c6e78c6c4c13b63d8dc30aa395cfcc6e686c0a
/
.
/
src
/
lib9
/
strdup.c
blob: 5ca31866fedf265fcf534e508e5be2a6e7107a47 [
file
] [
log
] [
blame
]
#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
;
}