delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/02/03/13:31:08

Date: Thu, 3 Feb 2000 19:27:10 +0200 (WET)
From: Andris Pavenis <pavenis AT lanet DOT lv>
To: Mumit Khan <khan AT NanoTech DOT Wisc DOT EDU>, djgpp-workers AT delorie DOT com
Subject: Re: (patch) updated protoize patch
In-Reply-To: <B0000118036@stargate.astr.lu.lv>
Message-ID: <Pine.A41.4.05.10002031922340.137990-100000@ieva01.lanet.lv>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: dj-admin AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

Here is patch to avoids trying to generate relative paths in
shortpath() in protoize.c on DOS based file systems when files
are on different drives. Currently I still treated /foo/bar and 
c:/foo/bar as different when C: is current drive (perhaps there 
is no harm from that). Patch is for gcc-2.95.2   

Andris

--- protoize.c~1	Tue Feb  1 10:57:44 2000
+++ protoize.c	Thu Feb  3 19:30:00 2000
@@ -1471,6 +1471,23 @@ shortpath (cwd, filename)
       cwd_p++;
       path_p++;
     }
+
+#ifdef HAVE_DOS_BASED_FILE_SYSTEM
+  /* For DOS based file system we should chech whether cwd_p and path_p
+     points to the same drive. Only then we can look for relative paths  */
+  if ((cwd_p[0] && cwd_p[1]==':' && IS_DIR_SEPARATOR(cwd_p[2])) ||
+      (path_p[0] && path_p[1]==':' && IS_DIR_SEPARATOR(path_p[2])))
+    {
+        if (!IS_SAME_PATH_CHAR(cwd_p[0],path_p[0]) ||
+            cwd_p[1]!=path_p[1] ||
+            !IS_DIR_SEPARATOR(cwd_p[2]) ||
+            !IS_DIR_SEPARATOR(path_p[2]))
+          {
+             return filename;
+	  }
+    }  
+#endif
+
   if (!*cwd_p && (!*path_p || IS_DIR_SEPARATOR (*path_p)))
     {
       /* whole pwd matched */


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019