Esempio n. 1
0
static int
compare_string(const unsigned char *a, const unsigned char *b)
{
    int     i = 0;
    int     j = 0;
    int     al;
    int     bl;

    if (locale_sort) return strcoll((const char *)a, (const char *)b);

    while ((a[i] != NUL) || (b[j] != NUL)) {
	if (a[i] == NUL)
	    return (-1);
	if (b[j] == NUL)
	    return (1);
	if (letter_ordering) {
	    if (a[i] == SPC)
		i++;
	    if (b[j] == SPC)
		j++;
	}
	al = TOLOWER(a[i]);
	bl = TOLOWER(b[j]);

	if (al != bl)
	    return (al - bl);
	i++;
	j++;
    }
    if (german_sort)
	return (new_strcmp(a, b, GERMAN));
    else
	return (strcmp((const char*)a, (const char*)b));
}
Esempio n. 2
0
int test_strcmp(char* str1, char* str2, int log)
{
	char *src1, *src2, *dest1, *dest2;
	int return1, return2;

	src1 = src2 = str1;
	dest1 = dest2 = str2;

	return1 = strcmp(src1, dest1);
	return2 = new_strcmp(src2, dest2);

	if(log)
	{
		printf("strcmp:     str1: %s str2: %s rtrn: %d\n", src1, dest1, return1);
		printf("new_strcmp: str1: %s str2: %s rtrn: %d\n", src2, dest2, return2);
	}

	return strcmp(src1, src2)==0 && strcmp(dest1, dest2)==0 && (return1 == return2);
}