summaryrefslogtreecommitdiff
path: root/xen/lib/strcmp.c
blob: f85c1e8741f74fce7dd11d04341b7eedea77a8f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
 *  Copyright (C) 1991, 1992  Linus Torvalds
 */

#include <xen/string.h>

/**
 * strcmp - Compare two strings
 * @cs: One string
 * @ct: Another string
 */
int (strcmp)(const char *cs, const char *ct)
{
	unsigned char *csu = (unsigned char *)cs;
	unsigned char *ctu = (unsigned char *)ct;
	int res;

	while (1) {
		if ((res = *csu - *ctu++) != 0 || !*csu++)
			break;
	}

	return res;
}

/*
 * Local variables:
 * mode: C
 * c-file-style: "BSD"
 * c-basic-offset: 8
 * tab-width: 8
 * indent-tabs-mode: t
 * End:
 */