/programs/develop/libraries/menuetlibc/src/libc/compat/string/strdup.c |
---|
0,0 → 1,16 |
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ |
#include <string.h> |
#include <stdlib.h> |
char * |
strdup(const char *_s) |
{ |
char *rv; |
if (_s == 0) |
return 0; |
rv = (char *)malloc(strlen(_s) + 1); |
if (rv == 0) |
return 0; |
strcpy(rv, _s); |
return rv; |
} |