mirror of
https://git.suckless.org/9base
synced 2025-08-29 11:23:48 -07:00
initial import
This commit is contained in:
17
lib9/strdup.c
Normal file
17
lib9/strdup.c
Normal file
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user