aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/lib/string/strncmp.c
blob: 4dbac59488865c0080d2c4a7bea5afaa1689f163 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
int strncmp(const char *s1, const char *s2, int c)
{
	int result = 0;

	while (c) {
		result = *s1 - *s2++;

		if ((result != 0) || (*s1++ == 0)) {
			break;
		}

		c--;
	}

	return result;
}