src/stdlib/stdstrng.c
/*==================================
 * llvsnprintf -- vsnprintf which backs up to last whole character
 * handles UTF-8
 *================================*/
- vsnprintf which backs up to last whole character
handles UTF-8
- vsnprintf which backs up to last whole character handles UTF - 8
static INT
llvsnprintf (char *dest, size_t len, int utf8, const char * fmt, va_list args)
{
	INT rtn;
	rtn = vsnprintf(dest, len, fmt, args);
	if (rtn >= (int)(len-1) || rtn == -1) {
		INT width=0;
		STRING prev;
		dest[len-1] = 0; 
		prev = find_prev_char(&dest[len-1], &width, dest, utf8);
		prev[width]=0;
	}
	return rtn;
}
static INT llvsnprintf ( char * dest , size_t len , int utf8 , const char * fmt , va_list args ) { INT rtn ; rtn = vsnprintf ( dest , len , fmt , args ) ; if ( rtn >= ( int ) ( len - 1 ) || rtn == -1 ) { INT width = 0 ; STRING prev ; dest [ len - 1 ] = 0 ; prev = find_prev_char ( & dest [ len - 1 ] , & width , dest , utf8 ) ; prev [ width ] = 0 ; } return rtn ; }
llvsnprintf -- vsnprintf which backs up to last whole character
 handles UTF-8
llvsnprintf -- vsnprintf which backs up to last whole character handles UTF - 8
/* overflowed -- back up to last character that fits */ /* ensure zero-termination */