Index: /trunk/src/kmk/dir.c
===================================================================
--- /trunk/src/kmk/dir.c	(revision 3185)
+++ /trunk/src/kmk/dir.c	(revision 3186)
@@ -585,4 +585,5 @@
 
 #ifdef WINDOWS32
+          PATH_VAR (w32_fullpath);
           char *w32_path;
 #endif
@@ -593,11 +594,11 @@
           dc_key.dev = st.st_dev;
 #ifdef WINDOWS32
+          w32_path = unix_slashes_resolved (name, w32_fullpath, GET_PATH_MAX);
 # ifndef CONFIG_WITH_STRCACHE2
-	  dc_key.path_key = w32_path = w32ify (name, 1);
+          dc_key.path_key = w32_path; /* = w32ify (name, 1); - bird */
 # else  /* CONFIG_WITH_STRCACHE2 */
-	  w32_path = w32ify (name, 1);
-	  dc_key.path_key = strcache_add (w32_path);
+          dc_key.path_key = strcache_add (w32_path);
 # endif /* CONFIG_WITH_STRCACHE2 */
-	  dc_key.ctime = st.st_ctime;
+          dc_key.ctime = st.st_ctime;
 #else
 # ifdef VMS_INO_T
Index: /trunk/src/kmk/function.c
===================================================================
--- /trunk/src/kmk/function.c	(revision 3185)
+++ /trunk/src/kmk/function.c	(revision 3186)
@@ -2876,12 +2876,8 @@
 
 #ifdef WINDOWS32                                                    /* bird */
-  dest = w32ify((char *)name, 1);
+  dest = unix_slashes_resolved (name, apath, GET_PATH_MAX);
   if (!dest)
     return NULL;
-  {
-  size_t len = strlen(dest);
-  memcpy(apath, dest, len);
-  dest = apath + len;
-  }
+  dest = strchr(apath, '\0');
 
   (void)end; (void)start; (void)apath_limit;
Index: /trunk/src/kmk/job.c
===================================================================
--- /trunk/src/kmk/job.c	(revision 3185)
+++ /trunk/src/kmk/job.c	(revision 3186)
@@ -3830,6 +3830,10 @@
     if (shell)
       {
+# if 1 /* bird */
+        unix_slashes (shell);
+# else
         char *p = w32ify (shell, 0);
         strcpy (shell, p);
+# endif
       }
 #endif
Index: /trunk/src/kmk/main.c
===================================================================
--- /trunk/src/kmk/main.c	(revision 3185)
+++ /trunk/src/kmk/main.c	(revision 3186)
@@ -1242,6 +1242,10 @@
       batch_mode_shell = 1;
       unixy_shell = 0;
+# if 1  /* bird: sprintf? wtf. */
+      default_shell = unix_slashes (xstrdup (search_token));
+# else
       sprintf (sh_path, "%s", search_token);
       default_shell = xstrdup (w32ify (sh_path, 0));
+# endif
       DB (DB_VERBOSE, (_("find_and_set_shell() setting default_shell = %s\n"),
                        default_shell));
@@ -1257,6 +1261,10 @@
     {
       /* search token path was found */
+# if 1  /* bird: sprintf? wtf. */
+      default_shell = unix_slashes (xstrdup (search_token));
+# else
       sprintf (sh_path, "%s", search_token);
       default_shell = xstrdup (w32ify (sh_path, 0));
+# endif
       DB (DB_VERBOSE, (_("find_and_set_shell() setting default_shell = %s\n"),
                        default_shell));
@@ -1280,8 +1288,16 @@
               *ep = '\0';
 
+# if 1 /* bird: insanity insurance */
+              _snprintf (sh_path, GET_PATH_MAX, "%s/%s", p, search_token);
+# else
               sprintf (sh_path, "%s/%s", p, search_token);
+# endif
               if (_access (sh_path, 0) == 0)
                 {
+# if 1  /* bird: we can modify sh_path directly. */
+                  default_shell = xstrdup (unix_slashes (sh_path));
+# else
                   default_shell = xstrdup (w32ify (sh_path, 0));
+# endif
                   sh_found = 1;
                   *ep = PATH_SEPARATOR_CHAR;
@@ -1302,8 +1318,16 @@
           if (p && *p)
             {
+# if 1 /* bird: insanity insurance */
+              _snprintf (sh_path, GET_PATH_MAX, "%s/%s", p, search_token);
+# else
               sprintf (sh_path, "%s/%s", p, search_token);
+# endif
               if (_access (sh_path, 0) == 0)
                 {
+# if 1  /* bird: we can modify sh_path directly. */
+                  default_shell = xstrdup (unix_slashes (sh_path));
+# else
                   default_shell = xstrdup (w32ify (sh_path, 0));
+# endif
                   sh_found = 1;
                 }
@@ -2130,5 +2154,13 @@
   if (strpbrk (argv[0], "/:\\") || strstr (argv[0], "..")
       || strneq (argv[0], "//", 2))
-    argv[0] = xstrdup (w32ify (argv[0], 1));
+# if 1  /* bird */
+    {
+      PATH_VAR (tmp_path_buf);
+      argv[0] = xstrdup (unix_slashes_resolved (argv[0], tmp_path_buf,
+                                                GET_PATH_MAX));
+    }
+# else  /* bird */
+      //argv[0] = xstrdup (w32ify (argv[0], 1));
+# endif /* bird */
 #else /* WINDOWS32 */
 #if defined (__MSDOS__) || defined (__EMX__)
Index: /trunk/src/kmk/w32/include/pathstuff.h
===================================================================
--- /trunk/src/kmk/w32/include/pathstuff.h	(revision 3185)
+++ /trunk/src/kmk/w32/include/pathstuff.h	(revision 3186)
@@ -20,5 +20,10 @@
 char *convert_Path_to_windows32(char *Path, char to_delim);
 char *convert_vpath_to_windows32(char *Path, char to_delim);
+#if 1
+char *unix_slashes(char *filename); /* bird */
+char *unix_slashes_resolved(const char *src, char *dst, unsigned len); /* bird */
+#else
 char *w32ify(const char *filename, int resolve);
+#endif
 char *getcwd_fs(char *buf, int len);
 
Index: /trunk/src/kmk/w32/pathstuff.c
===================================================================
--- /trunk/src/kmk/w32/pathstuff.c	(revision 3185)
+++ /trunk/src/kmk/w32/pathstuff.c	(revision 3186)
@@ -21,4 +21,5 @@
 #if 1 /* bird */
 # include "nt_fullpath.h"
+# include <assert.h>
 #endif
 
@@ -95,4 +96,33 @@
 
 /*
+ * Convert to forward slashes directly (w32ify(filename, 0)).
+ */
+char *unix_slashes(char *filename) /* bird */
+{
+    char *slash = filename ;
+    while ((slash = strchr(slash, '\\')) != NULL)
+        *slash++ = '/';
+    return filename;
+}
+
+/*
+ * Resolve and convert to forward slashes directly (w32ify(filename, 1)).
+ * Returns if out of buffer space.
+ */
+char *unix_slashes_resolved(const char *src, char *dst, unsigned len)
+{
+    assert(len >= FILENAME_MAX);
+    *dst = '\0'; /** @todo nt_fullpath_cached needs to return some indication of overflow. */
+#if 1
+    nt_fullpath_cached(src, dst, len);
+#else
+    _fullpath(dst, src, len);
+#endif
+
+    return unix_slashes(dst);
+}
+
+#if 0 /* bird: replaced by unix_slashes and unix_slahes_resolved. */
+/*
  * Convert to forward slashes. Resolve to full pathname optionally
  */
@@ -101,7 +131,6 @@
 {
     static char w32_path[FILENAME_MAX];
-    char *p;
-
 #if 1 /* bird */
+
     if (resolve) {
         nt_fullpath_cached(filename, w32_path, sizeof(w32_path));
@@ -110,10 +139,13 @@
         strncat(w32_path, filename, sizeof(w32_path));
     }
+    return unix_slashes(w32_path);
+
 #else   /* !bird */
+    char *p;
+
     if (resolve) {
         _fullpath(w32_path, filename, sizeof (w32_path));
     } else
         strncpy(w32_path, filename, sizeof (w32_path));
-#endif  /* !bird */
 
     for (p = w32_path; p && *p; p++)
@@ -122,5 +154,7 @@
 
     return w32_path;
-}
+#endif  /* !bird */
+}
+#endif
 
 char *
@@ -130,10 +164,14 @@
 
         if (p) {
+#if 1
+                p = unix_slashes(p);
+#else
                 char *q = w32ify(buf, 0);
 #if 1  /* bird - UPSTREAM? */
-		buf[0] = '\0';
-		strncat(buf, q, len);
+                buf[0] = '\0';
+                strncat(buf, q, len);
 #else  /* !bird */
                 strncpy(buf, q, len);
+#endif
 #endif
         }
