]> granicus.if.org Git - graphviz/commitdiff
Integrate Windows strcasecmp into write.c where it is used.
authorerg <devnull@localhost>
Mon, 12 Mar 2007 17:30:12 +0000 (17:30 +0000)
committererg <devnull@localhost>
Mon, 12 Mar 2007 17:30:12 +0000 (17:30 +0000)
lib/agraph/write.c

index 390de7bd487bdc988b52ec1f5397f3ef1ba26638..005ef783c5a967da8ec0ce94422aea3612cd72a1 100644 (file)
@@ -44,6 +44,24 @@ static void indent(Agraph_t * g, iochan_t * ofile)
        ioput(g, ofile, "\t");
 }
 
+#ifndef HAVE_STRCASECMP
+
+#include <string.h>
+
+int strcasecmp(const char *s1, const char *s2)
+{
+    while ((*s1 != '\0')
+          && (tolower(*(unsigned char *) s1) ==
+              tolower(*(unsigned char *) s2))) {
+       s1++;
+       s2++;
+    }
+
+    return tolower(*(unsigned char *) s1) - tolower(*(unsigned char *) s2);
+}
+
+#endif                         /* HAVE_STRCASECMP */
+
 /* _agcanonstr:
  * Canonicalize ordinary strings. 
  * Assumes buf is large enough to hold output.