summaryrefslogtreecommitdiff
path: root/missing
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-05-06 08:31:50 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-05-06 08:31:50 +0000
commite8505b64725b10f92e828d289ad0995bb23c1c8a (patch)
tree5c256f0d6b5f496ef0b348c4d3ebdb2988ba7e2b /missing
parentcae09e71e575608c039212d8b1273bd14695f88c (diff)
small fixes
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'missing')
-rw-r--r--missing/strcasecmp.c1
-rw-r--r--missing/strncasecmp.c18
2 files changed, 18 insertions, 1 deletions
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 <ctype.h>
-#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 <ctype.h>
+
+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;
+}