Files
kolibrios/programs/develop/ktcc/trunk/libc.obj/source/string/strdup.c
2026-01-19 21:34:18 +05:00

12 lines
211 B
C

#include <stdlib.h>
#include <string.h>
char* strdup(const char* str)
{
char* buf = malloc(strlen(str) + 1);
if (buf) {
buf[strlen(str)] = '\0';
strcpy(buf, str);
}
return buf;
}