fi
fi
-for ac_func in strerror strlcpy
+for ac_func in strerror strlcpy strlcat
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
/*
* Macro that does the same thing as strlcpy().
*/
- #ifdef _MSC_VER
+ #if defined(_MSC_VER) || defined(__MINGW32__)
/*
* strncpy_s() is supported at least back to Visual
* Studio 2005.
#endif
#endif
+#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
+
/*
* For flagging arguments as format strings in MSVC.
*/
FILE *fopen_safe(const char *filename, const char* mode);
#endif
-#if defined(_MSC_VER) || defined(__MINGW32__)
- #define strlcat(x, y, z) \
- strncat_s((x), (z), (y), _TRUNCATE)
-#endif
-
#ifdef _MSC_VER
/*
* MSVC.