xiaohu.huang | 1fd6f11 | 2022-05-24 11:02:05 +0800 | [diff] [blame] | 1 | /* |
2 | * Copyright (c) 2021-2022 Amlogic, Inc. All rights reserved. | ||||
3 | * | ||||
4 | * SPDX-License-Identifier: MIT | ||||
5 | */ | ||||
6 | |||||
7 | #include "aml_strncasecmp.h" | ||||
8 | #include <ctype.h> | ||||
9 | |||||
10 | int strncasecmp(const char *s1, const char *s2, size_t n) | ||||
11 | { | ||||
12 | int diff; | ||||
13 | |||||
14 | if (!n) | ||||
15 | return 0; | ||||
16 | |||||
17 | do { | ||||
18 | diff = tolower(*s1) - tolower(*s2); | ||||
19 | if (diff) | ||||
20 | return diff; | ||||
21 | } while (*(s1++) && *(s2++) && --n); | ||||
22 | |||||
23 | return 0; | ||||
24 | } |