| 645 | */ |
| 646 | |
| 647 | int /* O - Result of comparison (-1, 0, or 1) */ |
| 648 | _cups_strncasecmp(const char *s, /* I - First string */ |
| 649 | const char *t, /* I - Second string */ |
| 650 | size_t n) /* I - Maximum number of characters to compare */ |
| 651 | { |
| 652 | while (*s != '\0' && *t != '\0' && n > 0) |
| 653 | { |
| 654 | if (_cups_tolower(*s) < _cups_tolower(*t)) |
| 655 | return (-1); |
| 656 | else if (_cups_tolower(*s) > _cups_tolower(*t)) |
| 657 | return (1); |
| 658 | |
| 659 | s ++; |
| 660 | t ++; |
| 661 | n --; |
| 662 | } |
| 663 | |
| 664 | if (n == 0) |
| 665 | return (0); |
| 666 | else if (*s == '\0' && *t == '\0') |
| 667 | return (0); |
| 668 | else if (*s != '\0') |
| 669 | return (1); |
| 670 | else |
| 671 | return (-1); |
| 672 | } |
| 673 | |
| 674 | |
| 675 | #ifndef HAVE_STRLCAT |