mirror of
https://github.com/drasko/codezero.git
synced 2026-01-24 16:53:14 +01:00
16 lines
200 B
C
16 lines
200 B
C
#define _USE_XOPEN
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
|
|
char *
|
|
strdup(const char *s)
|
|
{
|
|
int len = strlen(s);
|
|
char *d;
|
|
d = malloc(len);
|
|
if (d == NULL)
|
|
return NULL;
|
|
strcpy(d, s);
|
|
return d;
|
|
}
|