jolly has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmocom-bb/+/34473?usp=email )
Change subject: HACK, DON'T MERGE! strncasecmp for firmware
......................................................................
HACK, DON'T MERGE! strncasecmp for firmware
Change-Id: Ia8c201fcfcc6ad1766dcff032f0cac76f53f2fb3
---
M src/target/firmware/include/string.h
M src/target/firmware/lib/Makefile
A src/target/firmware/lib/strcasecmp.c
3 files changed, 26 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/73/34473/1
diff --git a/src/target/firmware/include/string.h b/src/target/firmware/include/string.h
index ecef13d..7724b36 100644
--- a/src/target/firmware/include/string.h
+++ b/src/target/firmware/include/string.h
@@ -11,5 +11,6 @@
int memcmp(const void *s1, const void *s2, size_t n);
int strcmp(const char *s1, const char *s2);
+int strcasecmp(const char *s1, const char *s2);
#endif
diff --git a/src/target/firmware/lib/Makefile b/src/target/firmware/lib/Makefile
index 7546198..84c9061 100644
--- a/src/target/firmware/lib/Makefile
+++ b/src/target/firmware/lib/Makefile
@@ -4,5 +4,5 @@
LIB_mini_SRCS=vsprintf.c string.c ctype.c printf.c console.c ctors.c \
changebit.S clearbit.S delay.c div64.S lib1funcs.S memcpy.S \
memset.S setbit.S testchangebit.S testclearbit.S testsetbit.S \
- memcmp.S index.c strcmp.c
+ memcmp.S index.c strcmp.c strcasecmp.c
diff --git a/src/target/firmware/lib/strcasecmp.c b/src/target/firmware/lib/strcasecmp.c
new file mode 100644
index 0000000..1105d72
--- /dev/null
+++ b/src/target/firmware/lib/strcasecmp.c
@@ -0,0 +1,15 @@
+/*
+ * Compare strings but ignore case: s1>s2: >0 s1==s2: 0 s1<s2: <0
+ */
+
+#include <ctype.h>
+
+strcasecmp(s1, s2)
+ register char *s1, *s2;
+{
+
+ while (toupper(*s1) == toupper(*s2++))
+ if (*s1++=='\0')
+ return(0);
+ return(toupper(*s1) - toupper(*--s2));
+}
--
To view, visit
https://gerrit.osmocom.org/c/osmocom-bb/+/34473?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: Ia8c201fcfcc6ad1766dcff032f0cac76f53f2fb3
Gerrit-Change-Number: 34473
Gerrit-PatchSet: 1
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-MessageType: newchange