1 /* $NetBSD: strdup.c,v 1.1.1.1 2009/04/12 15:33:26 christos Exp $ */ 2 3 #include "port_before.h" 4 5 #include <stdlib.h> 6 7 #include "port_after.h" 8 9 #ifndef NEED_STRDUP 10 int __bind_strdup_unneeded; 11 #else 12 char * 13 strdup(const char *src) { 14 char *dst = malloc(strlen(src) + 1); 15 16 if (dst) 17 strcpy(dst, src); 18 return (dst); 19 } 20 #endif 21 22 /*! \file */ 23