2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS system libraries
4 * FILE: lib/msvcrt/mbstring/mbsncpy.c
5 * PURPOSE: Copies a string to a maximum of n bytes or characters
7 * Copyright 1999 Ariadne
8 * Copyright 1999 Alexandre Julliard
9 * Copyright 2000 Jon Griffths
15 extern int g_mbcp_is_multibyte
;
20 unsigned char* _mbsncpy(unsigned char *dst
, const unsigned char *src
, size_t n
)
22 unsigned char* ret
= dst
;
25 if (g_mbcp_is_multibyte
)
50 if (!(*dst
++ = *src
++)) break;
53 while (n
--) *dst
++ = 0;
59 * The _mbsnbcpy function copies count bytes from src to dest. If src is shorter
60 * than dest, the string is padded with null characters. If dest is less than or
61 * equal to count it is not terminated with a null character.
65 unsigned char * _mbsnbcpy(unsigned char *dst
, const unsigned char *src
, size_t n
)
67 unsigned char* ret
= dst
;
70 if(g_mbcp_is_multibyte
)
75 is_lead
= (!is_lead
&& _ismbblead(*src
));
80 if (is_lead
) /* if string ends with a lead, remove it */
88 if (!(*dst
++ = *src
++)) break;
91 while (n
--) *dst
++ = 0;