Commit 45553c19 authored by deuce's avatar deuce
Browse files

Redefine snprintf() to use BSD semantics... via safe_snprintf()

parent 7fc4555d
......@@ -58,6 +58,21 @@
#include "genwrap.h" /* Verify prototypes */
/****************************************************************************/
/* Used to replace snprintf() guarantees to terminate. */
/****************************************************************************/
static int safe_snprintf(char *dst, size_t size, char *fmt, ...)
{
va_list argptr;
int numchars;
va_start(argptr,fmt);
numchars= vsnprintf(dst,size,fmt,argptr);
va_end(argptr);
dst[size-1]=0;
return(numchars);
}
/****************************************************************************/
/* Return last character of string */
/****************************************************************************/
......
......@@ -139,8 +139,9 @@ extern "C" {
/* String Functionss */
/*********************/
#define snprintf safe_snprintf
#if defined(_MSC_VER) || defined(__MINGW32__)
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment