compare two strings, ignoring whitespace, except between two letters or ** digits (and treat all of these as equal) */
| 73 | /* compare two strings, ignoring whitespace, except between two letters or |
| 74 | ** digits (and treat all of these as equal) */ |
| 75 | int strnscmp(const char *a, const char *b) |
| 76 | { |
| 77 | while(1) { |
| 78 | while (isspace(*a)) a++; |
| 79 | while (isspace(*b)) b++; |
| 80 | while (*a && *a == *b) a++,b++; |
| 81 | if (isspace(*a)) { |
| 82 | if (isalnum(a[-1]) && isalnum(*b)) |
| 83 | break; } |
| 84 | else if (isspace(*b)) { |
| 85 | if (isalnum(b[-1]) && isalnum(*a)) |
| 86 | break; } |
| 87 | else |
| 88 | break; } |
| 89 | return *a - *b; |
| 90 | } |
| 91 | |
| 92 | unsigned int strnshash(const char *s) |
| 93 | { |