diff options
author | ajs <ajs> | 2005-04-02 16:01:05 +0000 |
---|---|---|
committer | ajs <ajs> | 2005-04-02 16:01:05 +0000 |
commit | e699d4ce6b5f2b2841d33be42f7286986e4f23ae (patch) | |
tree | 0bf7949149c681f06cfdfc32b28fbf2d18a4bd7a /lib/str.c | |
parent | c4f3f62342d171aaaeee81760d28793e1dc2e9bf (diff) | |
download | quagga-e699d4ce6b5f2b2841d33be42f7286986e4f23ae.tar.bz2 quagga-e699d4ce6b5f2b2841d33be42f7286986e4f23ae.tar.xz |
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.
Diffstat (limited to 'lib/str.c')
-rw-r--r-- | lib/str.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -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 |