From e8505b64725b10f92e828d289ad0995bb23c1c8a Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 6 May 1999 08:31:50 +0000 Subject: small fixes git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- missing/strcasecmp.c | 1 - missing/strncasecmp.c | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 missing/strncasecmp.c (limited to 'missing') diff --git a/missing/strcasecmp.c b/missing/strcasecmp.c index 83aa50d9c3..ba7bf78ea4 100644 --- a/missing/strcasecmp.c +++ b/missing/strcasecmp.c @@ -1,6 +1,5 @@ #include -#define min(a,b) (((a)>(b))?(b):(a)) int strcasecmp(p1, p2) char *p1, *p2; diff --git a/missing/strncasecmp.c b/missing/strncasecmp.c new file mode 100644 index 0000000000..c136703415 --- /dev/null +++ b/missing/strncasecmp.c @@ -0,0 +1,18 @@ +#include + +int +strncasecmp(p1, p2, len) + char *p1; + char *p2; + int len; +{ + for (; len != 0; len--, p1++, p2++) { + if (toupper(*p1) != toupper(*p2)) { + return toupper(*p1) - toupper(*p2); + } + if (*p1 == '\0') { + return 0; + } + } + return 0; +} -- cgit v1.2.3