scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

wcsncpy.c (232B)


      1 #include <wchar.h>
      2 
      3 #undef wcsncpy
      4 
      5 wchar_t *
      6 wcsncpy(wchar_t *restrict s1, const wchar_t *restrict s2, size_t n)
      7 {
      8 	wchar_t *ret = s1;
      9 
     10 	for (; n > 0 && *s2; --n)
     11 		*s1++ = *s2++;
     12 
     13 	while (n-- > 0)
     14 		*s1++ = '\0';
     15 
     16 	return ret;
     17 
     18 }