blob: 2bc25d251e0f6052888c67533a89aa528e8ec748 [file] [log] [blame]
xiaohu.huang1fd6f112022-05-24 11:02:05 +08001/*
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
10int 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}