summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorajs <ajs>2005-04-02 18:01:05 +0200
committerajs <ajs>2005-04-02 18:01:05 +0200
commit3cb98dee9067372756964f461eb2c931a1c75138 (patch)
tree726827878765c01c45e5be08b909974ae54ce79f
parent2005-04-02 Paul Jakma <paul@dishone.st> (diff)
downloadfrr-3cb98dee9067372756964f461eb2c931a1c75138.tar.xz
frr-3cb98dee9067372756964f461eb2c931a1c75138.zip
2005-04-02 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* configure.ac: Add strnlen to AC_CHECK_FUNCS. * zebra.h: Should include str.h to pick up missing functions. * str.h: Declare strnlen if needed. * str.c: Do not include str.h since zebra.h now includes it. (strnlen) New function.
-rw-r--r--ChangeLog4
-rwxr-xr-xconfigure.ac4
-rw-r--r--lib/ChangeLog7
-rw-r--r--lib/str.c11
-rw-r--r--lib/str.h6
-rw-r--r--lib/zebra.h1
6 files changed, 28 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index d418bfc3a..f822d4feb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2005-04-02 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
+
+ * configure.ac: Add strnlen to AC_CHECK_FUNCS.
+
2005-03-28 Hasso Tepper <hasso at quagga.net>
* configure.ac, */Makefile.am: Fix previous commit. SNMP includes
diff --git a/configure.ac b/configure.ac
index 508ba7d37..ccb02a084 100755
--- a/configure.ac
+++ b/configure.ac
@@ -5,7 +5,7 @@
## Copyright (c) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro <kunihiro@zebra.org>
## Portions Copyright (c) 2003 Paul Jakma <paul@dishone.st>
##
-## $Id: configure.ac,v 1.94 2005/03/28 15:29:07 hasso Exp $
+## $Id: configure.ac,v 1.95 2005/04/02 16:01:05 ajs Exp $
AC_PREREQ(2.53)
AC_INIT(Quagga, 0.99.0, [http://bugzilla.quagga.net])
@@ -454,7 +454,7 @@ dnl check existance of functions
dnl ----------------------------
AC_CHECK_FUNCS(memset memcpy strerror inet_aton daemon snprintf vsnprintf \
strlcat strlcpy if_nametoindex if_indextoname getifaddrs \
- fcntl)
+ fcntl strnlen)
AC_CHECK_FUNCS(setproctitle, ,
[AC_CHECK_LIB(util, setproctitle,
[LIBS="$LIBS -lutil"
diff --git a/lib/ChangeLog b/lib/ChangeLog
index 736e3ae51..567f603a6 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,3 +1,10 @@
+2005-04-02 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
+
+ * zebra.h: Should include str.h to pick up missing functions.
+ * str.h: Declare strnlen if needed.
+ * str.c: Do not include str.h since zebra.h now includes it.
+ (strnlen) New function.
+
2005-03-16 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* zebra.h: Must check whether __attribute__ should be defined before
diff --git a/lib/str.c b/lib/str.c
index 797e9b870..18a5d8edd 100644
--- a/lib/str.c
+++ b/lib/str.c
@@ -8,8 +8,6 @@
#include <zebra.h>
-#include "str.h"
-
#ifndef HAVE_SNPRINTF
/*
* snprint() is a real basic wrapper around the standard sprintf()
@@ -60,3 +58,12 @@ strlcat(char *dst, const char *src, size_t size)
return (strlen(dst));
}
#endif
+
+#ifndef HAVE_STRNLEN
+size_t
+strnlen(const char *s, size_t maxlen)
+{
+ const char *p;
+ return (p = (const char *)memchr(s, '\0', maxlen)) ? (size_t)(p-s) : maxlen;
+}
+#endif
diff --git a/lib/str.h b/lib/str.h
index 4098896a5..c00165657 100644
--- a/lib/str.h
+++ b/lib/str.h
@@ -1,5 +1,5 @@
/*
- * $Id: str.h,v 1.1 2002/12/13 20:15:29 paul Exp $
+ * $Id: str.h,v 1.2 2005/04/02 16:01:05 ajs Exp $
*/
#ifndef _ZEBRA_STR_H
@@ -21,4 +21,8 @@ size_t strlcpy(char *, const char *, size_t);
size_t strlcat(char *, const char *, size_t);
#endif
+#ifndef HAVE_STRNLEN
+extern size_t strnlen(const char *s, size_t maxlen);
+#endif
+
#endif
diff --git a/lib/zebra.h b/lib/zebra.h
index d9c28b01a..7d907ed7e 100644
--- a/lib/zebra.h
+++ b/lib/zebra.h
@@ -228,6 +228,7 @@ typedef int socklen_t;
#endif /* !__GNUC__ || VTYSH_EXTRACT_PL */
#include "zassert.h"
+#include "str.h"
#ifdef HAVE_BROKEN_CMSG_FIRSTHDR