]> git.sur5r.net Git - openldap/blobdiff - include/ac/string.h
streamline group attr specification/diagnostics
[openldap] / include / ac / string.h
index 791bb009c9ea090051c2d4371bc419a3d23de72a..1791ee6af56f4b238e1fb032803294b53a10f89d 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2004 The OpenLDAP Foundation.
+ * Copyright 1998-2007 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -89,6 +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 */