[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pspp-cvs] Changes to pspp/src/str.c
From: |
Ben Pfaff |
Subject: |
[Pspp-cvs] Changes to pspp/src/str.c |
Date: |
Mon, 02 May 2005 02:21:38 -0400 |
Index: pspp/src/str.c
diff -u pspp/src/str.c:1.11 pspp/src/str.c:1.12
--- pspp/src/str.c:1.11 Fri Apr 29 01:02:15 2005
+++ pspp/src/str.c Mon May 2 06:21:21 2005
@@ -95,7 +95,7 @@
HAYSTACK_LEN. Returns a pointer to the needle found. */
char *
mm_find_reverse (const char *haystack, size_t haystack_len,
- const char *needle, size_t needle_len)
+ const char *needle, size_t needle_len)
{
int i;
for (i = haystack_len - needle_len; i >= 0; i--)
@@ -104,6 +104,26 @@
return 0;
}
+/* Compares the SIZE bytes in A to those in B, disregarding case,
+ and returns a strcmp()-type result. */
+int
+mm_case_compare (const void *a_, const void *b_, size_t size)
+{
+ const unsigned char *a = a_;
+ const unsigned char *b = b_;
+
+ while (size-- > 0)
+ {
+ unsigned char ac = toupper (*a++);
+ unsigned char bc = toupper (*b++);
+
+ if (ac != bc)
+ return ac > bc ? 1 : -1;
+ }
+
+ return 0;
+}
+
/* Compares A of length A_LEN to B of length B_LEN. The shorter
string is considered to be padded with spaces to the length of
the longer. */
- [Pspp-cvs] Changes to pspp/src/str.c,
Ben Pfaff <=