+/** Returns TRUE if for the host the two path characters are
+ equivalent.
+*/
+static bool
+pathCharsEquivalent(char c1, char c2)
+{
+#if NATIVE_WIN32
+ /* win32 is case insensitive */
+ if (tolower(c1) == tolower(c2))
+ {
+ return TRUE;
+ }
+ /* And / is equivalent to \ */
+ else if (c1 == '/' && c2 == '\\')
+ {
+ return TRUE;
+ }
+ else if (c1 == '\\' && c2 == '/')
+ {
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
+#else
+ /* Assume a Unix host where they must match exactly. */
+ return c1 == c2;
+#endif
+}
+
+static bool
+pathEquivalent(const char *p1, const char *p2)
+{
+ while (*p1 != '\0' && *p2 != '\0')
+ {
+ if (pathCharsEquivalent (*p1, *p2) == FALSE)
+ {
+ break;
+ }
+ p1++;
+ p2++;
+ }
+
+ return *p1 == *p2;
+}
+
+static char
+pathCharTransform(char c)
+{
+#if NATIVE_WIN32
+ if (c == '/')
+ {
+ return DIR_SEPARATOR_CHAR;
+ }
+ else
+ {
+ return c;
+ }
+#else
+ return c;
+#endif
+}
+
+/** Fixes up a potentially mixed path to the proper representation for
+ the host. Fixes up in place.
+*/
+static char *
+fixupPath(char *pin)
+{
+ char *p = pin;
+
+ while (*p)
+ {
+ *p = pathCharTransform(*p);
+ p++;
+ }
+ *p = '\0';
+
+ return pin;
+}
+