+/* Compares the SIZE bytes in A to those in B, disregarding case,
+ and returns a strcmp()-type result. */
+int
+buf_compare_case (const char *a_, const char *b_, size_t size)
+{
+ const unsigned char *a = (unsigned char *) a_;
+ const unsigned char *b = (unsigned char *) b_;
+
+ while (size-- > 0)
+ {
+ unsigned char ac = toupper (*a++);
+ unsigned char bc = toupper (*b++);
+
+ if (ac != bc)
+ return ac > bc ? 1 : -1;
+ }
+
+ return 0;
+}
+