1
0

runestrncmp.c 250 B

12345678910111213141516171819202122
  1. #include <u.h>
  2. #include <libc.h>
  3. int
  4. runestrncmp(Rune *s1, Rune *s2, long n)
  5. {
  6. Rune c1, c2;
  7. while(n > 0) {
  8. c1 = *s1++;
  9. c2 = *s2++;
  10. n--;
  11. if(c1 != c2) {
  12. if(c1 > c2)
  13. return 1;
  14. return -1;
  15. }
  16. if(c1 == 0)
  17. break;
  18. }
  19. return 0;
  20. }