update for HEAD-2003021201
[reactos.git] / lib / crtdll / mbstring / mbsncpy.c
index 41fe445..2090c48 100644 (file)
@@ -8,7 +8,8 @@
  *              12/04/99: Created
  */
 
-#include <crtdll/mbstring.h>
+#include <msvcrt/mbstring.h>
+
 
 unsigned char *_mbsncpy(unsigned char *str1, const unsigned char *str2, size_t n)
 {
@@ -43,6 +44,13 @@ unsigned char *_mbsncpy(unsigned char *str1, const unsigned char *str2, size_t n
        return str1;
 }
 
+
+//
+//The _mbsnbcpy function copies count bytes from src to dest. If src is shorter 
+//than dest, the string is padded with null characters. If dest is less than or 
+//equal to count it is not terminated with a null character.
+//
+
 unsigned char * _mbsnbcpy(unsigned char *str1, const unsigned char *str2, size_t n)
 {
        unsigned char *s1 = (unsigned char *)str1;
@@ -54,8 +62,10 @@ unsigned char * _mbsnbcpy(unsigned char *str1, const unsigned char *str2, size_t
                return 0;
        do {
                
-               if (*s2 == 0)
+        if (*s2 == 0) {
+                       *s1 = *s2;
                        break;  
+        }
 
                if (  !_ismbblead(*s2) ) {