source: trunk/sys/dietlibc/strdup.c @ 152

Last change on this file since 152 was 1, checked in by alain, 8 years ago

First import

File size: 176 bytes
Line 
1#include <string.h>
2#include <stdlib.h>
3
4char *strdup(const char *s) {
5  size_t l=strlen(s)+1;
6  char *tmp=(char *)malloc(l);
7  if (!tmp) return 0;
8  return memcpy(tmp,s,l);
9}
Note: See TracBrowser for help on using the repository browser.