Blob
1 /*2 * ngIRCd -- The Next Generation IRC Daemon3 *4 * strdup() implementation. Public domain.5 *6 * $Id: strdup.c,v 1.1 2005/04/16 09:20:53 fw Exp $7 */9 #include "portab.h"11 #include "imp.h"12 #include <string.h>13 #include <stdlib.h>14 #include <sys/types.h>16 #include "exp.h"18 #ifndef HAVE_STRDUP20 GLOBAL char *21 strdup( const char *s )22 {23 char *dup;24 size_t len = strlen( s );25 size_t alloc = len + 1;27 if (len >= alloc ) return NULL;28 dup = malloc( alloc );29 if (dup) strlcpy(dup, s, alloc );31 return dup;32 }34 #endif