You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
625 B
29 lines
625 B
4 months ago
|
/*
|
||
|
* Copyright (c) Hisilicon Technologies Co., Ltd. 2014-2020. All rights reserved.
|
||
|
* Description: printf function
|
||
|
* Author: SmartMedia_BSP
|
||
|
* Create: 2014-06-04
|
||
|
*/
|
||
|
#include <td_type.h>
|
||
|
|
||
|
int strncmp(const char *cs, const char *ct, size_t count)
|
||
|
{
|
||
|
int res = 0;
|
||
|
const char *d = cs;
|
||
|
const char *s = ct;
|
||
|
if (cs == NULL) {
|
||
|
printf("cs is null\n");
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
if (ct == NULL) {
|
||
|
printf("ct is null\n");
|
||
|
return 0;
|
||
|
}
|
||
|
while (count-- && (res = *d - *s) == 0 && *d != '\0' && *s != '\0') {
|
||
|
d++;
|
||
|
s++;
|
||
|
}
|
||
|
return res;
|
||
|
}
|