Ethereal-dev: [Ethereal-dev] Patch to fix DnD of files on X

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Ilya Konstantinov <future@xxxxxxxxxxx>
Date: Sat, 02 Apr 2005 19:12:58 +0300
Hi,

The attached patch fixes the string processing of the URI to support Unix-style paths. This fixes DnD on X.

(Please CC me when this patch is applied, since I'm not subscribed to the list.)

Index: drag_and_drop.c
===================================================================
--- drag_and_drop.c	(revision 14003)
+++ drag_and_drop.c	(working copy)
@@ -72,16 +72,22 @@
      * file:/dir1/dir2/capture-file.cap
      * we have to remove the file: to get a valid filename.
      */ 
+#ifdef _WIN32
     if (strncmp("file:////", cf_name, 9) == 0) {
         /* win32 UNC: now becoming: //servername/sharename/dir1/dir2/capture-file.cap */
         cf_name += 7;
     } else if (strncmp("file:///", cf_name, 8) == 0) {
         /* win32 local: now becoming: d:/dir1/dir2/capture-file.cap */
         cf_name += 8;
-    } else if (strncmp("file:", cf_name, 5) == 0) {
+    }
+#else
+    if (strncmp("file:", cf_name, 5) == 0) {
         /* unix local: now becoming: /dir1/dir2/capture-file.cap */
         cf_name += 5;
+        /* shorten //////thing to /thing */
+        for(; cf_name[1] == '/'; ++cf_name);
     }
+#endif
 
     /* 
      * unescape the escaped URI characters (spaces, ...)