xref: /plan9/sys/src/cmd/unix/drawterm/libc/runestrncmp.c (revision 8ccd4a6360d974db7bd7bbd4f37e7018419ea908)
1 #include <u.h>
2 #include <libc.h>
3 
4 int
runestrncmp(Rune * s1,Rune * s2,long n)5 runestrncmp(Rune *s1, Rune *s2, long n)
6 {
7 	Rune c1, c2;
8 
9 	while(n > 0) {
10 		c1 = *s1++;
11 		c2 = *s2++;
12 		n--;
13 		if(c1 != c2) {
14 			if(c1 > c2)
15 				return 1;
16 			return -1;
17 		}
18 		if(c1 == 0)
19 			break;
20 	}
21 	return 0;
22 }
23