shithub: sox

Download patch

ref: 8fa8463f38cdfa14f0d2b2330d431f0f96e47402
parent: 19baa672b12aa40b43b2e918f434f75edb8d47fa
author: robs <robs>
date: Thu Nov 30 15:48:53 EST 2006

Added strncasecmp

--- a/src/misc.c
+++ b/src/misc.c
@@ -393,6 +393,18 @@
     }
     return ((*(unsigned char *)s1 < *(unsigned char *)s2) ? -1 : +1);
 }
+
+int strncasecmp(char const * s1, char const * s2, size_t n)
+{
+  for (; n != 0; --n, ++s1, ++s2)
+  {
+    if (toupper(*s1) != toupper(*s2))
+      return toupper(*s1) - toupper(*s2);
+    if (*s1 == '\0')
+      return 0;
+  }
+  return 0;
+}
 #endif
 
 #ifndef HAVE_STRDUP