scc

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

wcsncmp.c (238B)


      1 #include <wchar.h>
      2 
      3 #undef wcsncmp
      4 
      5 int
      6 wcsncmp(const wchar_t *s1, const wchar_t *s2, size_t n)
      7 {
      8 	unsigned long l1, l2;
      9 
     10 	for ( ; n > 0 && *s1 == *s2; --n)
     11 		++s1, ++s2;
     12 
     13 	if (n == 0)
     14 		return 0;
     15 	l1 = *s1, l2 = *s2;
     16 
     17 	return l1 - l2;
     18 }