]> git.sur5r.net Git - openldap/blobdiff - include/ac/string.h
streamline group attr specification/diagnostics
[openldap] / include / ac / string.h
index dbe1262d49bd8b6987c90de9d597cd094a328a5b..1791ee6af56f4b238e1fb032803294b53a10f89d 100644 (file)
@@ -1,7 +1,8 @@
 /* Generic string.h */
 /* $OpenLDAP$ */
-/*
- * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 1998-2007 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -88,4 +89,31 @@ int (strncasecmp)();
                else AC_MEMCPY( (d), (s), (n) ); \
        } while(0)
 
+#ifdef NEED_MEMCMP_REPLACEMENT
+       int (lutil_memcmp)(const void *b1, const void *b2, size_t len);
+#define memcmp lutil_memcmp
+#endif
+
+/* GNU extension (glibc >= 2.1.91), only declared when defined(_GNU_SOURCE) */
+#ifndef HAVE_MEMRCHR
+#undef memrchr
+#define memrchr lutil_memrchr
+#endif /* ! HAVE_MEMRCHR */
+void * memrchr(const void *b, int c, size_t len);
+
+#define STRLENOF(s)    (sizeof(s)-1)
+
+#if defined( HAVE_NONPOSIX_STRERROR_R )
+#      define AC_STRERROR_R(e,b,l)             (strerror_r((e), (b), (l)))
+#elif defined( HAVE_STRERROR_R )
+#      define AC_STRERROR_R(e,b,l)             (strerror_r((e), (b), (l)) == 0 ? (b) : "Unknown error")
+#elif defined( HAVE_SYS_ERRLIST )
+#      define AC_STRERROR_R(e,b,l)             ((e) > -1 && (e) < sys_nerr \
+                                                       ? sys_errlist[(e)] : "Unknown error" )
+#elif defined( HAVE_STRERROR )
+#      define AC_STRERROR_R(e,b,l)             (strerror(e))   /* NOTE: may be NULL */
+#else
+#      define AC_STRERROR_R(e,b,l)             ("Unknown error")
+#endif
+
 #endif /* _AC_STRING_H */