]> git.puffer.fish Git - mirror/frr.git/commitdiff
2005-04-02 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
authorajs <ajs>
Sat, 2 Apr 2005 16:01:05 +0000 (16:01 +0000)
committerajs <ajs>
Sat, 2 Apr 2005 16:01:05 +0000 (16:01 +0000)
* 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.

ChangeLog
configure.ac
lib/ChangeLog
lib/str.c
lib/str.h
lib/zebra.h

index d418bfc3ab378564a1b28af6c1f7e200d8249451..f822d4feba98882181b67dcbda32a308dfa0e314 100644 (file)
--- 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
index 508ba7d37a7c961d492e4528e6d82b2b79819f4f..ccb02a084459d0b7173cbf64e0daf12b2938ee73 100755 (executable)
@@ -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"
index 736e3ae51d8673ebce88bab8e7cfd7ebe87c9aaf..567f603a6159b541ee87cba1ef3e57a1a55905ce 100644 (file)
@@ -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
index 797e9b87033224f2550c3933694c26eda74f404d..18a5d8edd841a9263b27e4fb227e51d83a2ad355 100644 (file)
--- 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
index 4098896a505a305053830058ec4a221c969920e0..c001656572219628afdcbeb5cabb6584905948fb 100644 (file)
--- 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
index d9c28b01a4909dbe77967d711e732ef43b63eee0..7d907ed7e7e08fc7b227013e8bbfb166fc1fcc65 100644 (file)
@@ -228,6 +228,7 @@ typedef int socklen_t;
 #endif  /* !__GNUC__ || VTYSH_EXTRACT_PL */
 
 #include "zassert.h"
+#include "str.h"
 
 
 #ifdef HAVE_BROKEN_CMSG_FIRSTHDR