compare two strings for equality, ignoring the presence of specified characters (typically whitespace) and possibly ignoring case */
| 782 | /* compare two strings for equality, ignoring the presence of specified |
| 783 | characters (typically whitespace) and possibly ignoring case */ |
| 784 | boolean |
| 785 | fuzzymatch( |
| 786 | const char *s1, const char *s2, |
| 787 | const char *ignore_chars, |
| 788 | boolean caseblind) |
| 789 | { |
| 790 | char c1, c2; |
| 791 | |
| 792 | do { |
| 793 | while ((c1 = *s1++) != '\0' && strchr(ignore_chars, c1) != 0) |
| 794 | continue; |
| 795 | while ((c2 = *s2++) != '\0' && strchr(ignore_chars, c2) != 0) |
| 796 | continue; |
| 797 | if (!c1 || !c2) |
| 798 | break; /* stop when end of either string is reached */ |
| 799 | |
| 800 | if (caseblind) { |
| 801 | c1 = lowc(c1); |
| 802 | c2 = lowc(c2); |
| 803 | } |
| 804 | } while (c1 == c2); |
| 805 | |
| 806 | /* match occurs only when the end of both strings has been reached */ |
| 807 | return (boolean) (!c1 && !c2); |
| 808 | } |
| 809 | |
| 810 | /* |
| 811 | * Time routines |
no test coverage detected