diff options
Diffstat (limited to 'bsp/AE210P/libc/string/strcasecmp.c')
| -rw-r--r-- | bsp/AE210P/libc/string/strcasecmp.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/bsp/AE210P/libc/string/strcasecmp.c b/bsp/AE210P/libc/string/strcasecmp.c new file mode 100644 index 0000000000..7e2996e9f4 --- /dev/null +++ b/bsp/AE210P/libc/string/strcasecmp.c @@ -0,0 +1,30 @@ +#include <string.h> + +__attribute__((used)) +int strcasecmp(const char *s1, const char *s2) +{ + while (*s1 == *s2 || (*s1 ^ 0x20) == *s2) { + + if (!*s1) + return 0; + ++s1; + ++s2; + } + + return *(unsigned char *)s1 - *(unsigned char *)s2; +} + +__attribute__((used)) +int strncasecmp(const char *s1, const char *s2, size_t n) +{ + while ((*s1 == *s2 || (*s1 ^ 0x20) == *s2) && --n) { + + if (!*s1) + return 0; + ++s1; + ++s2; + } + + return *(unsigned char *)s1 - *(unsigned char *)s2; +} + |
