blob: 905b51de520f489439b4aff8692791dc6e3941b4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
/*
* strdup.c
*/
#include <string.h>
#include <stdlib.h>
char *strdup(const char *s)
{
int l = strlen(s) + 1;
char *d = malloc(l);
if (d)
memcpy(d, s, l);
return d;
}
|