Root/
Source at commit 1308 created 12 years 8 months ago. By meklort, Add a few placeholders for file io | |
---|---|
1 | /*␊ |
2 | * strdup.c␊ |
3 | */␊ |
4 | ␊ |
5 | #include <string.h>␊ |
6 | #include <stdlib.h>␊ |
7 | ␊ |
8 | char *strdup(const char *s)␊ |
9 | {␊ |
10 | ␉int l = strlen(s) + 1;␊ |
11 | ␉char *d = malloc(l);␊ |
12 | ␊ |
13 | ␉if (d)␊ |
14 | ␉␉memcpy(d, s, l);␊ |
15 | ␊ |
16 | ␉return d;␊ |
17 | }␊ |
18 |