summaryrefslogtreecommitdiff
path: root/pkgtools/libnbcompat/files/strdup.c
diff options
context:
space:
mode:
Diffstat (limited to 'pkgtools/libnbcompat/files/strdup.c')
-rw-r--r--pkgtools/libnbcompat/files/strdup.c34
1 files changed, 31 insertions, 3 deletions
diff --git a/pkgtools/libnbcompat/files/strdup.c b/pkgtools/libnbcompat/files/strdup.c
index 5758b452685..a756ba2c7f1 100644
--- a/pkgtools/libnbcompat/files/strdup.c
+++ b/pkgtools/libnbcompat/files/strdup.c
@@ -1,4 +1,4 @@
-/* $NetBSD: strdup.c,v 1.3 2003/09/06 23:03:05 grant Exp $ */
+/* $NetBSD: strdup.c,v 1.4 2004/08/23 03:32:12 jlam Exp $ */
/*
* Copyright (c) 1988, 1993
@@ -29,14 +29,42 @@
* SUCH DAMAGE.
*/
-#include "nbcompat.h"
+#include <nbcompat.h>
+#include <nbcompat/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)strdup.c 8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: strdup.c,v 1.4 2004/08/23 03:32:12 jlam Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#if 0
+#include "namespace.h"
+#endif
+
+#include <nbcompat/assert.h>
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#include <nbcompat/stdlib.h>
+#include <nbcompat/string.h>
+
+#if 0
+#ifdef __weak_alias
+__weak_alias(strdup,_strdup)
+#endif
+#endif
char *
-strdup(const char *str)
+strdup(str)
+ const char *str;
{
size_t len;
char *copy;
+ _DIAGASSERT(str != NULL);
+
len = strlen(str) + 1;
if (!(copy = malloc(len)))
return (NULL);