+#ifndef HAVE_STRLCAT
+ /*
+ * Macro that does the same thing as strlcat().
+ */
+ #if defined(_MSC_VER) || defined(__MINGW32__)
+ /*
+ * strncat_s() is supported at least back to Visual
+ * Studio 2005.
+ */
+ #define strlcat(x, y, z) \
+ strncat_s((x), (z), (y), _TRUNCATE)
+ #else
+ /*
+ * ANSI C says strncat() always null-terminates its first argument,
+ * so 1) we don't need to explicitly null-terminate the string
+ * ourselves and 2) we need to leave room for the null terminator.
+ */
+ #define strlcat(x, y, z) \
+ strncat((x), (y), (z) - strlen((x)) - 1)
+ #endif
+#endif
+