summaryrefslogtreecommitdiff
path: root/deprecated-ngircd/src/portab/strdup.c
diff options
context:
space:
mode:
authorMistivia <i@mistivia.com>2025-11-02 15:29:28 +0800
committerMistivia <i@mistivia.com>2025-11-02 15:29:28 +0800
commit9f42c2d5f911cb4e215d7873221e642ce7df4d61 (patch)
tree6dac90a889a7402a9556d3d1bcc5cb53cdb9f123 /deprecated-ngircd/src/portab/strdup.c
parentfb2d9de539b660a261af19b1cbcceb7ee7980cb1 (diff)
deprecate webircdateway and ngircd
Diffstat (limited to 'deprecated-ngircd/src/portab/strdup.c')
-rw-r--r--deprecated-ngircd/src/portab/strdup.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/deprecated-ngircd/src/portab/strdup.c b/deprecated-ngircd/src/portab/strdup.c
new file mode 100644
index 0000000..adb19e7
--- /dev/null
+++ b/deprecated-ngircd/src/portab/strdup.c
@@ -0,0 +1,34 @@
+/*
+ * 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