blob: 7c0ee8fd26d34b5746267f0da0f7d73cd9216101 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
/*
* ngIRCd -- The Next Generation IRC Daemon
*/
#include "portab.h"
/**
* @file
* strdup() implementation. Public domain.
*/
#ifndef HAVE_STRDUP
#include "imp.h"
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include "exp.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
|