diff src/win32.c @ 819:6504113e7c2d

[xemacs-hg @ 2002-04-25 18:03:23 by andyp] sync up windows branch from 21.4
author andyp
date Thu, 25 Apr 2002 18:04:24 +0000
parents a634e3b7acc8
children 6728e641994e
line wrap: on
line diff
--- a/src/win32.c	Thu Apr 25 06:09:18 2002 +0000
+++ b/src/win32.c	Thu Apr 25 18:04:24 2002 +0000
@@ -332,24 +332,38 @@
   if (STRINGP (document))
     {
 #ifdef CYGWIN
-      Intbyte *docint = XSTRING_DATA (document);
-      /* If URL style file, the innards may have Cygwin mount points and
-         the like.  so separate out the innards, process them, and put back
-         together. */
-      if (qxestrncasecmp_c (docint, "file://", 7) == 0)
-	{
-	  Intbyte *fname_windows;
-	  Intbyte *docint_windows;
+      Extbyte *fname1;
+      Extbyte *fname2;
+      int pos, sz;
+      LISP_STRING_TO_TSTR (document, doc);
 
-	  LOCAL_TO_WIN32_FILE_FORMAT (docint + 7, fname_windows);
-	  docint_windows = alloca_intbytes (7 + qxestrlen (fname_windows) + 1);
-	  qxestrcpy_c (docint_windows, "file://");
-	  qxestrcat (docint_windows, fname_windows);
-	  C_STRING_TO_TSTR (docint, doc);
+      if ((fname1 = strchr (doc, ':')) != NULL
+	  && *++fname1 == '/' && *++fname1 == '/')
+	{
+	  /* If URL style file, the innards may have Cygwin mount points and
+	     the like.  so separate out the innards, process them, and put back
+	     together. */
+	  if (qxestrncasecmp (doc, "file://", 7) == 0)
+	    {
+	      fname1++;
+	      pos = fname1 - doc;
+	      if (!(isalpha (fname1[0]) && (IS_DEVICE_SEP (fname1[1]))))
+		{
+		  sz = cygwin_posix_to_win32_path_list_buf_size (fname1);
+		  fname2 = alloca (sz + pos);
+		  qxestrncpy (fname2, doc, pos);
+		  doc = fname2;
+		  fname2 += pos;
+		  cygwin_posix_to_win32_path_list (fname1, fname2);
+		}
+	    }
 	}
-      else
+      else {
+	/* Not URL-style, must be a straight filename. */
+	LOCAL_FILE_FORMAT_TO_TSTR (document, doc);
+      }
 #endif
-	LOCAL_FILE_FORMAT_TO_TSTR (document, doc);
+
     }
 
     ret = (int) qxeShellExecute (NULL, opext, doc, parmext, path,