|
|
1.1 root 1: /*
2: * libc/string/strdup.c
3: * Not in ANSI draft standard.
4: * Return a malloc()'ed copy of a string.
5: */
6:
7: #include <stddef.h>
8: #include <stdlib.h>
9: #include <string.h>
10:
11: char *
12: strdup(s) register char *s;
13: {
14: register char *cp;
15:
16: return ((cp = malloc(strlen(s) + 1)) == NULL) ? cp : strcpy(cp, s);
17: }
18:
19: /* end of strdup.c */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.