platform/macclassic.c
changeset 622 c8e67ca63ad6
parent 596 381b6ca0dd85
child 657 dad3b5c307a9
child 704 f3c79a07201f
--- a/platform/macclassic.c	Mon Dec 29 08:49:58 2003 +0000
+++ b/platform/macclassic.c	Mon Dec 29 08:50:21 2003 +0000
@@ -13,6 +13,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <ctype.h>
 #include <alloca.h>
 
 /*
@@ -345,16 +346,42 @@
 
 int __PHYSFS_platformStricmp(const char *x, const char *y)
 {
-    extern int _stricmp(const char *, const char *);
-    return(_stricmp(x, y));  /* (*shrug*) */
+    int ux, uy;
+
+    do
+    {
+        ux = toupper((int) *x);
+        uy = toupper((int) *y);
+        if (ux != uy)
+            return((ux > uy) ? 1 : -1);
+        x++;
+        y++;
+    } while ((ux) && (uy));
+
+    return(0);
 } /* __PHYSFS_platformStricmp */
 
 
-int __PHYSFS_platformStrnicmp(const char *x, const char *y, PHYSFS_uint32 l)
+int __PHYSFS_platformStrnicmp(const char *x, const char *y, PHYSFS_uint32 len)
 {
-    extern int _strnicmp(const char *, const char *, int);
-    return(_strnicmp(x, y, (int) l));  /* (*shrug*) */
-} /* __PHYSFS_platformStricmp */
+    int ux, uy;
+
+    if (!len)
+        return(0);
+
+    do
+    {
+        ux = toupper((int) *x);
+        uy = toupper((int) *y);
+        if (ux != uy)
+            return((ux > uy) ? 1 : -1);
+        x++;
+        y++;
+        len--;
+    } while ((ux) && (uy) && (len));
+
+    return(0);
+} /* __PHYSFS_platformStrnicmp */
 
 
 static OSErr fnameToFSSpecNoAlias(const char *fname, FSSpec *spec)