{
int i, c;
NodeList *l;
+ char *p;
localpkg = mkpkg(strlit(""));
localpkg->prefix = "\"\"";
if(getwd(pathname, 999) == 0)
strcpy(pathname, "/???");
+ if(systemtype(SysWindows)) {
+ // Canonicalize path by converting \ to / (Windows accepts both).
+ for(p=pathname; *p; p++)
+ if(*p == '\\')
+ *p = '/';
+ }
+
fmtinstall('O', Oconv); // node opcodes
fmtinstall('E', Econv); // etype opcodes
fmtinstall('J', Jconv); // all the node flags
int
islocalname(Strlit *name)
{
- if(name->len >= 1 && name->s[0] == '/')
+ if(systemtype(SysUnix) && name->len >= 1 && name->s[0] == '/')
return 1;
+ if(systemtype(SysWindows) && name->len >= 3 &&
+ isalpha(name->s[0]) && name->s[1] == ':' && name->s[2] == '/')
+ return 1;
if(name->len >= 2 && strncmp(name->s, "./", 2) == 0)
return 1;
if(name->len >= 3 && strncmp(name->s, "../", 3) == 0)
outfile = smprint("%s.%c", namebuf, thechar);
}
}
+
+int
+systemtype(int sys)
+{
+#ifdef __MINGW32__
+ return sys&SysWindows;
+#else
+ return sys&SysUnix;
+#endif
+}