diff --git a/plugins/plugin.h b/plugins/plugin.h index 65e17a911..a3e1e5426 100644 --- a/plugins/plugin.h +++ b/plugins/plugin.h @@ -22,6 +22,7 @@ void *malloc(int size); void free(void *mem); char *strstr(char *str, const char *sub); void strlcpy(char *d, const char *s, int n); +char *strchr(char *str, char sub); #else diff --git a/plugins/qvm_api.c b/plugins/qvm_api.c index 6b1e13a4d..d6e9c51aa 100644 --- a/plugins/qvm_api.c +++ b/plugins/qvm_api.c @@ -261,12 +261,60 @@ int strncmp (const char *s1, const char *s2, int count) return -1; } +int strnicmp(const char *s1, const char *s2, int count) +{ + char c1, c2; + char ct; + while(*s1) + { + if (!count--) + return 0; + c1 = *s1; + c2 = *s2; + if (c1 != c2) + { + if (c1 >= 'a' && c1 <= 'z') c1 = c1-'a' + 'A'; + if (c2 >= 'a' && c2 <= 'z') c2 = c2-'a' + 'A'; + if (c1 != c2) + return c1= 'a' && c1 <= 'z') c1 = c1-'a' + 'A'; + if (c2 >= 'a' && c2 <= 'z') c2 = c2-'a' + 'A'; + if (c1 != c2) + return c1