Tcl Source Code

Artifact [7c364feea3]
Login

Artifact 7c364feea3ccf915fe3594bc538cff57b28c1f6a:

Attachment "219420.833.diff" to ticket [219420ffff] added by andreas_kupries 2001-09-08 05:05:34.
Index: unix/tclUnixFCmd.c
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/tclUnixFCmd.c,v
retrieving revision 1.6
diff -u -r1.6 tclUnixFCmd.c
--- unix/tclUnixFCmd.c	2000/04/04 08:05:57	1.6
+++ unix/tclUnixFCmd.c	2001/09/07 22:00:51
@@ -93,6 +93,22 @@
 			    mode_t *modePtr));
 
 /*
+ * CRAY/UNICOS support. Seems that the native cray cc and its headers
+ * first declare readlink, mknod and symlink to take <char*> as their
+ * path argument and then dutifully fails to compile code which gives
+ * these functions the <const char*> expected by everyone else.
+ *
+ * See SF [ #219420 ] Cray Unicos build problems for tcl8.3.2 reported
+ * by Len Makin.
+ */
+
+#ifdef _UNICOS
+#define PATH_STRING(s) ((char*) (s)) /* de-CONST the argument :( */
+#else
+#define PATH_STRING(s) (s)
+#endif
+
+/*
  * Prototype for the TraverseUnixTree callback function.
  */
 
@@ -373,19 +389,19 @@
 	    char link[MAXPATHLEN];
 	    int length;
 
-	    length = readlink(src, link, sizeof(link)); /* INTL: Native. */
+	    length = readlink(PATH_STRING (src), link, sizeof(link)); /* INTL: Native. */
 	    if (length == -1) {
 		return TCL_ERROR;
 	    }
 	    link[length] = '\0';
-	    if (symlink(link, dst) < 0) {		/* INTL: Native. */
+	    if (symlink(link, PATH_STRING (dst)) < 0) {		/* INTL: Native. */
 		return TCL_ERROR;
 	    }
 	    break;
 	}
         case S_IFBLK:
         case S_IFCHR: {
-	    if (mknod(dst, srcStatBuf.st_mode,		/* INTL: Native. */
+	    if (mknod(PATH_STRING(dst), srcStatBuf.st_mode,		/* INTL: Native. */
 		    srcStatBuf.st_rdev) < 0) {
 		return TCL_ERROR;
 	    }