Thu Jan 9 11:25:11 2014 UTC ()
Make strnlen implementation usable from src/tools/compat.


(apb)
diff -r1.1 -r1.2 src/common/lib/libc/string/strnlen.c

cvs diff -r1.1 -r1.2 src/common/lib/libc/string/strnlen.c (expand / switch to context diff)
--- src/common/lib/libc/string/strnlen.c 2011/09/01 22:35:18 1.1
+++ src/common/lib/libc/string/strnlen.c 2014/01/09 11:25:11 1.2
@@ -1,4 +1,4 @@
-/*	$NetBSD: strnlen.c,v 1.1 2011/09/01 22:35:18 jym Exp $	*/
+/*	$NetBSD: strnlen.c,v 1.2 2014/01/09 11:25:11 apb Exp $	*/
 
 /*-
  * Copyright (c) 2009 David Schultz <das@FreeBSD.org>
@@ -26,9 +26,13 @@
  * SUCH DAMAGE.
  */
 
+#if HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#endif
+
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: strnlen.c,v 1.1 2011/09/01 22:35:18 jym Exp $");
+__RCSID("$NetBSD: strnlen.c,v 1.2 2014/01/09 11:25:11 apb Exp $");
 #endif /* LIBC_SCCS and not lint */
 /* FreeBSD: src/lib/libc/string/strnlen.c,v 1.1 2009/02/28 06:00:58 das Exp */
 
@@ -38,6 +42,7 @@
 #include <lib/libkern/libkern.h>
 #endif
 
+#if !HAVE_STRNLEN
 size_t
 strnlen(const char *s, size_t maxlen)
 {
@@ -49,3 +54,4 @@
 	}
 	return (len);
 }
+#endif /* !HAVE_STRNLEN */