summaryrefslogtreecommitdiff
path: root/com32/lib/strdup.c
blob: 766958b10f405bd505fc686c1cdbf5a0a141b1f9 (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;
}