src/stdlib/stdstrng.c
/*==================================
 * llstrncpy -- strncpy that always zero-terminates
 * handles UTF-8
 *================================*/
- strncpy that always zero-terminates
handles UTF-8
- strncpy that always zero - terminates handles UTF - 8
char *
llstrncpy (char *dest, const char *src, size_t n, int utf8)
{
	if (!dest || n<1) return dest;
	if (!src || !src[0] || n<2) {
		*dest=0;
		return dest;
	}
	strncpy(dest, src, n);
	if (dest[n-1]) {
		chopstr_utf8(dest, n-1, utf8);
	}
	return dest;
}
char * llstrncpy ( char * dest , const char * src , size_t n , int utf8 ) { if ( ! dest || n < 1 ) return dest ; if ( ! src || ! src [ 0 ] || n < 2 ) { * dest = 0 ; return dest ; } strncpy ( dest , src , n ) ; if ( dest [ n - 1 ] ) { chopstr_utf8 ( dest , n - 1 , utf8 ) ; } return dest ; }
llstrncpy -- strncpy that always zero-terminates
 handles UTF-8
llstrncpy -- strncpy that always zero - terminates handles UTF - 8
/* must have valid strings, and copying at least one byte */