1
0
mirror of https://github.com/osmarks/ngircd.git synced 2025-10-05 02:02:24 +00:00
Files
ngircd/src/portab/strdup.c
Alexander Barton 259c314d14 Remove imp.h and exp.h header files
These include files don't have a function any more, remove them.
2014-03-17 00:17:02 +01:00

35 lines
437 B
C

/*
* ngIRCd -- The Next Generation IRC Daemon
*/
#include "portab.h"
/**
* @file
* strdup() implementation. Public domain.
*/
#ifndef HAVE_STRDUP
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
GLOBAL char *
strdup(const char *s)
{
char *dup;
size_t len = strlen(s);
size_t alloc = len + 1;
if (len >= alloc)
return NULL;
dup = malloc(alloc);
if (dup)
strlcpy(dup, s, alloc );
return dup;
}
#endif