summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/lib/strdup.c
blob: 6a2ea5f950eb753af2ca1acc78aa3a00ee90a49d (plain)
1
2
3
4
5
6
7
8
9
#include <string.h>
#include <stdlib.h>

char *strdup(const char *s) {
  char *tmp=(char *)malloc(strlen(s)+1);
  if (!tmp) return 0;
  strcpy(tmp,s);
  return tmp;
}