* Compare two strings. * * @param s1 The first string. * @param s2 The second string. * @return Returns a value less than zero, if s1 is shorter than s2. Returns * zero, if s1 equals s2. Returns a value greater than zero, if * s1 is longer than s2. */
| 45 | * s1 is longer than s2. |
| 46 | */ |
| 47 | int strcasecmp(const char *s1, const char *s2) |
| 48 | { |
| 49 | int res; |
| 50 | |
| 51 | for (size_t i = 0; 1; i++) { |
| 52 | res = tolower(s1[i]) - tolower(s2[i]); |
| 53 | if (res || (s1[i] == '\0')) |
| 54 | break; |
| 55 | } |
| 56 | |
| 57 | return res; |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * Compare two strings with fixed length. |
no test coverage detected