static void copypart( CHAR_TYPE *buf, const CHAR_TYPE *p, int len, int maxlen ) { if( buf != NULL ) { if( len > maxlen ) len = maxlen; #if defined( __WIDECHAR__ ) || defined( __UNIX__ ) || defined( __RDOS__ ) || defined( __RDOSDEV__ ) memcpy( buf, p, len * CHARSIZE ); /*strncpy( buf, p, len ); */ buf[len ] = NULLCHAR; #else len = _mbsnccnt( (unsigned char *)p, len ); /* # chars in len bytes */ _mbsncpy( (unsigned char *)buf, (unsigned char *)p, len ); /* copy the chars */ buf[_mbsnbcnt( (unsigned char *)buf, len )] = NULLCHAR; #endif } }
static void copypart( CHAR_TYPE *buf, const CHAR_TYPE *p, int len, int maxlen ) { if( buf != NULL ) { if( len > maxlen ) len = maxlen; #ifdef __WIDECHAR__ memcpy( buf, p, len * CHARSIZE ); /* 07-jul-91 DJG */ /*strncpy( buf, p, len ); */ buf[ len ] = NULLCHAR; #else #ifdef __UNIX__ memcpy( buf, p, len * CHARSIZE ); buf[ len ] = NULLCHAR; #else len = _mbsnccnt( p, len ); /* # chars in len bytes */ _mbsncpy( buf, p, len ); /* copy the chars */ buf[ _mbsnbcnt( buf, len ) ] = NULLCHAR; #endif #endif } }
static CHAR_TYPE *pcopy( CHAR_TYPE **pdst, CHAR_TYPE *dst, const CHAR_TYPE *b_src, const CHAR_TYPE *e_src ) { /*========================================================================*/ unsigned len; if( pdst == NULL ) return( dst ); *pdst = dst; len = e_src - b_src; if( len >= _MAX_PATH2 ) { len = _MAX_PATH2 - 1; } #if defined( __WIDECHAR__ ) || defined( __UNIX__ ) memcpy( dst, b_src, len * CHARSIZE ); dst[ len ] = NULLCHAR; return( dst + len + 1 ); #else len = _mbsnccnt( (unsigned char *)b_src, len ); /* # chars in len bytes */ _mbsncpy( (unsigned char *)dst, (unsigned char *)b_src, len ); /* copy the chars */ dst[ _mbsnbcnt( (unsigned char *)dst, len ) ] = NULLCHAR; return( dst + _mbsnbcnt( (unsigned char *)dst, len ) + 1 ); #endif }