This is the mail archive of the
insight@sourceware.org
mailing list for the Insight project.
[PATCH] Support Cygwin network paths in tcl
- From: Thiemo Seufer <ths at networkno dot de>
- To: insight at sources dot redhat dot com
- Date: Mon, 7 Aug 2006 17:48:12 +0100
- Subject: [PATCH] Support Cygwin network paths in tcl
Hello All,
the appended patch adds support for //-prefixed cygwin network paths.
Thiemo
2006-08-07 Thiemo Seufer <ths@mips.com>
Maciej W. Rozycki <macro@mips.com>
* generic/tclFileName.c (TclpGetNativePathType): Handle Cygwin //
network path prefix.
(SplitUnixPath): Likewise.
(TclDoGlob): Likewise.
Index: generic/tclFileName.c
===================================================================
RCS file: /cvs/src/src/tcl/generic/tclFileName.c,v
retrieving revision 1.10
diff -u -p -r1.10 tclFileName.c
--- generic/tclFileName.c 12 Feb 2003 04:20:58 -0000 1.10
+++ generic/tclFileName.c 7 Aug 2006 11:35:58 -0000
@@ -348,10 +348,17 @@ TclpGetNativePathType(pathObjPtr, driveN
}
#endif
if (path[0] == '/') {
+#ifdef __CYGWIN__
+ /*
+ * Check for Cygwin // network path prefix
+ */
+ if (path[1] == '/')
+ path++;
+#endif
if (driveNameLengthPtr != NULL) {
/*
- * We need this addition in case the QNX code
- * was used
+ * We need this addition in case the QNX
+ * or Cygwin code was used
*/
*driveNameLengthPtr = (1 + path - origPath);
}
@@ -662,11 +669,20 @@ SplitUnixPath(path)
}
#endif
+ p = path;
if (path[0] == '/') {
- Tcl_ListObjAppendElement(NULL, result, Tcl_NewStringObj("/",1));
- p = path+1;
- } else {
- p = path;
+ Tcl_Obj *rootElt = Tcl_NewStringObj("/", 1);
+ p++;
+#ifdef __CYGWIN__
+ /*
+ * Check for Cygwin // network path prefix
+ */
+ if (path[1] == '/') {
+ Tcl_AppendToObj(rootElt, "/", 1);
+ p++;
+ }
+#endif
+ Tcl_ListObjAppendElement(NULL, result, rootElt);
}
/*
@@ -2344,6 +2360,11 @@ TclDoGlob(interp, separators, headPtr, t
&& (strchr(separators, lastChar) == NULL))
|| ((length == 0) && (count > 0)))) {
Tcl_DStringAppend(headPtr, "/", 1);
+#ifdef __CYGWIN__
+ if ((length == 0) && (count > 1)) {
+ Tcl_DStringAppend(headPtr, "/", 1);
+ }
+#endif
}
break;
}