Attachment "219420.84.diff" to
ticket [219420ffff]
added by
andreas_kupries
2001-09-08 05:06:02.
Index: unix/tclUnixFCmd.c
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/tclUnixFCmd.c,v
retrieving revision 1.12
diff -u -r1.12 tclUnixFCmd.c
--- unix/tclUnixFCmd.c 2001/09/04 18:06:34 1.12
+++ unix/tclUnixFCmd.c 2001/09/07 22:02:40
@@ -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.
*/
@@ -353,19 +369,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;
}