xref: /haiku/src/system/libroot/posix/string/strncmp.c (revision 3cb015b1ee509d69c643506e8ff573808c86dcfc)
1 /*
2 ** Copyright 2001, Travis Geiselbrecht. All rights reserved.
3 ** Distributed under the terms of the NewOS License.
4 */
5 
6 #include <sys/types.h>
7 #include <string.h>
8 
9 
10 int
11 strncmp(char const *cs, char const *ct, size_t count)
12 {
13 	signed char __res = 0;
14 
15 	while (count > 0) {
16 		if ((__res = *cs - *ct++) != 0 || !*cs++)
17 			break;
18 		count--;
19 	}
20 
21 	return __res;
22 }
23