]> Shamusworld >> Repos - rmac/blobdiff - rmac.c
Treat ':' as a path separator on non-Windows platforms
[rmac] / rmac.c
diff --git a/rmac.c b/rmac.c
index 2f12bca48293dc6d946e35f274ec78704adb79b9..ef190ec0fc959434839d45cfb8a7a2c34ab89f46 100644 (file)
--- a/rmac.c
+++ b/rmac.c
@@ -101,6 +101,17 @@ char * fext(char * name, char * extension, int stripp)
        return name;
 }
 
+static int is_sep(char c)
+{
+    const char *seps = PATH_SEPS;
+
+    for (seps = PATH_SEPS; *seps; seps++) {
+        if (*seps == c)
+            return 1;
+    }
+
+    return 0;
+}
 
 //
 // Return 'item'nth element of semicolon-seperated pathnames specified in the
@@ -120,13 +131,13 @@ int nthpath(char * env_var, int itemno, char * buf)
                return 0;
 
        while (itemno--)
-               while (*s != EOS && *s++ != ';')
+               while (*s != EOS && !is_sep(*s++))
                        ;
 
        if (*s == EOS)
                return 0;
 
-       while (*s != EOS && *s != ';')
+       while (*s != EOS && !is_sep(*s))
                *buf++ = *s++;
 
        *buf++ = EOS;