source:
trunk/minix/lib/other/strdup.c@
10
Last change on this file since 10 was 9, checked in by , 14 years ago | |
---|---|
File size: 231 bytes |
Line | |
---|---|
1 | /* |
2 | lib/other/strdup.c |
3 | */ |
4 | |
5 | #include <stdlib.h> |
6 | #include <string.h> |
7 | |
8 | char *strdup(s1) |
9 | const char *s1; |
10 | { |
11 | size_t len; |
12 | char *s2; |
13 | |
14 | len= strlen(s1)+1; |
15 | |
16 | s2= malloc(len); |
17 | if (s2 == NULL) |
18 | return NULL; |
19 | strcpy(s2, s1); |
20 | |
21 | return s2; |
22 | } |
23 |
Note:
See TracBrowser
for help on using the repository browser.