summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ports/bare-arm/lib.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/ports/bare-arm/lib.c b/ports/bare-arm/lib.c
index 6ef450bea..61d3be64e 100644
--- a/ports/bare-arm/lib.c
+++ b/ports/bare-arm/lib.c
@@ -109,16 +109,23 @@ char *strchr(const char *s, int c) {
return NULL;
}
-int strcmp(const char *s1, const char *s2) {
- while (*s1 && *s2) {
+int strncmp(const char *s1, const char *s2, size_t n) {
+ while (*s1 && *s2 && n-- > 0) {
int c = *s1++ - *s2++;
if (c) {
return c;
}
}
+ if (n == 0) {
+ return 0;
+ }
return *s1 - *s2;
}
+int strcmp(const char *s1, const char *s2) {
+ return strncmp(s1, s2, 0x7fffffff);
+}
+
size_t strlen(const char *s) {
const char *ss = s;
while (*ss) {