repo: ngircd
action: commit
revision: 
path_from: 
revision_from: 8b17579e608f60bb48094756107c7e500499ac5f:
path_to: 
revision_to: 
git.thebackupbox.net
ngircd
git clone git://git.thebackupbox.net/ngircd
commit 8b17579e608f60bb48094756107c7e500499ac5f
Author: Florian Westphal 
Date:   Sat Apr 16 09:20:53 2005 +0000

    private strdup() implementation in case libc does not provide it.

diff --git a/src/portab/strdup.c b/src/portab/strdup.c
new file mode 100644
index 0000000000000000000000000000000000000000..e735157043084d633e84ff7a9b578bca4e832a12
--- /dev/null
+++ b/src/portab/strdup.c
@@ -0,0 +1,35 @@
+/*
+ * ngIRCd -- The Next Generation IRC Daemon
+ *
+ * strdup() implementation.  Public domain.
+ *
+ * $Id: strdup.c,v 1.1 2005/04/16 09:20:53 fw Exp $
+ */
+
+#include "portab.h"
+
+#include "imp.h"
+#include 
+#include 
+#include 
+
+#include "exp.h"
+
+#ifndef HAVE_STRDUP
+
+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
+

-----END OF PAGE-----