Index: ChangeLog
===================================================================
RCS file: /cvsroot/tcl/tcl/ChangeLog,v
retrieving revision 1.814
diff -u -u -r1.814 ChangeLog
--- ChangeLog	2002/01/25 04:27:26	1.814
+++ ChangeLog	2002/01/25 20:37:58
@@ -1,3 +1,93 @@
+2002-01-25  Don Porter <dgp@users.sourceforge.net>
+
+	* doc/Concat.3:
+	* doc/Encoding.3:
+	* doc/Filesystem.3:
+	* doc/Macintosh.3:
+	* doc/OpenFileChnl.3
+	* doc/SetResult.3:
+	* doc/SetVar.3:
+	* doc/SplitList.3:
+	* doc/SplitPath.3:
+	* doc/Translate.3:
+	* generic/tcl.h (Tcl_FSMatchInDirectoryProc):
+	* generic/tclInt.h (TclpMatchInDirectory):
+	* generic/tcl.decls (Tcl_Concat,Tcl_GetStringResult,Tcl_GetVar,
+	  Tcl_GetVar2,Tcl_JoinPath,Tcl_Merge,Tcl_OpenCommandChannel,Tcl_SetVar,
+	  Tcl_SetVar2,Tcl_SplitList,Tcl_SplitPath,Tcl_TranslateFileName,
+	  Tcl_ExternalToUtfDString,Tcl_GetEncodingName,Tcl_UtfToExternalDString,
+	  Tcl_GetDefaultEncodingDir,Tcl_SetDefaultEncodingDir,
+	  Tcl_FSMatchInDirectory,Tcl_MacEvalResource,Tcl_MacFindResource):
+	* generic/tclInt.decls (TclCreatePipeline,TclGetEnv,TclpGetCwd,
+	  TclpCreateProcess):
+	* mac/tclMacFile.c (TclpGetCwd):
+	* generic/tclEncoding.c (Tcl_GetDefaultEncodingDir,
+	  Tcl_SetDefaultEncodingDir,Tcl_GetEncodingName,
+	  Tcl_ExternalToUtfDString,Tcl_UtfToExternalDString, OpenEncodingFile,
+	  LoadEscapeEncoding):
+	* generic/tclFileName.c (DoTildeSubst,Tcl_JoinPath,Tcl_SplitPath,
+	  Tcl_TranslateFileName): 
+	* generic/tclIOUtil.c (Tcl_FSMatchInDirectory):
+	* generic/tclPipe.c (FileForRedirect,TclCreatePipeline,
+	  Tcl_OpenCommandChannel):
+	* generic/tclResult.c (Tcl_GetStringResult):
+	* generic/tclUtil.c (Tcl_Concat,Tcl_SplitList,Tcl_Merge):
+	* generic/tclVar.c (Tcl_GetVar,Tcl_GetVar2,Tcl_SetVar,Tcl_SetVar2):
+	* mac/tclMacResource.c (Tcl_MacEvalResource,Tcl_MacFindResource):
+	Updated interfaces of generic/tclEncoding, generic/tclFilename.c,
+	generic/tclIOUtil.c, generic/tclPipe.c, generic/tclResult.c,
+	generic/tclUtil.c, generic/tclVar.c and mac/tclMacResource.c according
+	to TIP 27.  Tcl_TranslateFileName rewritten as wrapper around
+	VFS-aware version.
+	***POTENTIAL INCOMPATIBILITY*** 
+	Includes source incompatibilities: argv arguments of Tcl_Concat,
+	Tcl_JoinPath, Tcl_OpenCommandChannel, Tcl_Merge; argvPtr arguments of
+	Tcl_SplitList and Tcl_SplitPath.
+	* generic/tclDecls.h: 
+	* generic/tclIntDecls.h: make genstubs
+
+	* generic/tclCkalloc.c (MemoryCmd):
+	* generic/tclClock.c (FormatClock):
+	* generic/tclCmdAH.c (Tcl_CaseObjCmd,Tcl_EncodingObjCmd,Tcl_FileObjCmd):
+	* generic/tclCmdIL.c (InfoLibraryCmd,InfoPatchLevelCmd,
+	  InfoTclVersionCmd):
+	* generic/tclCompCmds.c (TclCompileForeachCmd):
+	* generic/tclCompCmds.h (TclCompileForeachCmd):
+	* generic/tclCompile.c (TclFindCompiledLocal):
+	* generic/tclEnv.c (TclSetupEnv,TclSetEnv,Tcl_PutEnv,TclGetEnv,
+	  EnvTraceProc):
+	* generic/tclEvent.c (Tcl_BackgroundError):
+	* generic/tclIO.c (Tcl_BadChannelOption,Tcl_SetChannelOption):
+	* generic/tclIOCmd.c (Tcl_ExecObjCmd,Tcl_OpenObjCmd):
+	* generic/tclIOSock.c (TclSockGetPort):
+	* generic/tclIOUtil.c (SetFsPathFromAny):
+	* generic/tclLink.c (LinkTraceProc):
+	* generic/tclMain.c (Tcl_Main):
+	* generic/tclNamesp.c (TclTeardownNamespace):
+	* generic/tclProc.c (TclCreateProc):
+	* generic/tclTest.c (TestregexpObjCmd,TesttranslatefilenameCmd,
+	  TestchmodCmd,GetTimesCmd,TestsetCmd,TestOpenFileChannelProc1,
+	  TestOpenFileChannelProc2,TestOpenFileChannelProc3,AsyncHandlerProc,
+	  TestpanicCmd):
+	* generic/tclThreadTest.c (ThreadErrorProc,ThreadEventProc):
+	* generic/tclUtil.c (TclPrecTraceProc):
+	* mac/tclMacFCmd.c (GetFileSpecs):
+	* mac/tclMacFile.c (TclpMatchInDirectory):
+	* mac/tclMacInit.c (TclpInitLibraryPath,Tcl_SourceRCFile):
+	* mac/tclMacOSA.c (tclOSAStore,tclOSALoad):
+	* mac/tclMacResource.c (Tcl_MacEvalResource):
+	* unix/tclUnixFCmd.c (TclpObjNormalizePath):
+	* unix/tclUnixFile.c (TclpMatchInDirectory,TclpGetUserHome,TclpGetCwd,
+	  TclpReadLink):
+	* unix/tclUnixInit.c (TclpInitLibraryPath,TclpSetVariables,
+	  Tcl_SourceRCFile):
+	* unix/tclUnixPipe.c (TclpOpenFile,TclpCreateTempFile,
+	  TclpCreateProcess):
+	* win/tclWinFile.c (TclpGetCwd,TclpMatchInDirectory):
+	* win/tclWinInit.c (TclpInitLibraryPath,Tcl_SourceRCFile,
+	  TclpSetVariables):
+	* win/tclWinPipe.c (TclpCreateProcess): Updated callers.
+
 2002-01-24  Don Porter <dgp@users.sourceforge.net>
 
 	* generic/tclIOUtil.c (SetFsPathFromAny):  Corrected tilde-substitution
@@ -26,6 +116,7 @@
 	* win/tclWinSerial.c (TclWinSerialReopen):
 	* win/tclWinSock.c (Tcl_OpenTcpServer):  Corrections to earlier
 	TIP 27 changes.  Thanks to Andreas Kupries for the feedback.
+	* generic/tclPlatDecls.h: make genstubs
 
 	* doc/GetHostName.3:
 	* doc/GetOpnFl.3:
Index: doc/Concat.3
===================================================================
RCS file: /cvsroot/tcl/tcl/doc/Concat.3,v
retrieving revision 1.3
diff -u -u -r1.3 Concat.3
--- doc/Concat.3	2001/09/24 21:10:32	1.3
+++ doc/Concat.3	2002/01/25 20:37:58
@@ -21,7 +21,7 @@
 .SH ARGUMENTS
 .AP int argc in
 Number of strings.
-.AP "char * CONST" argv[] in
+.AP "CONST char * CONST" argv[] in
 Array of strings to concatenate.  Must have \fIargc\fR entries.
 .BE
 
Index: doc/Encoding.3
===================================================================
RCS file: /cvsroot/tcl/tcl/doc/Encoding.3,v
retrieving revision 1.7
diff -u -u -r1.7 Encoding.3
--- doc/Encoding.3	1999/10/13 00:32:05	1.7
+++ doc/Encoding.3	2002/01/25 20:37:58
@@ -21,14 +21,14 @@
 void
 \fBTcl_FreeEncoding\fR(\fIencoding\fR)
 .sp
-char *
+CONST char *
 \fBTcl_ExternalToUtfDString\fR(\fIencoding, src, srcLen, dstPtr\fR)
 .sp
 int
 \fBTcl_ExternalToUtf\fR(\fIinterp, encoding, src, srcLen, flags, statePtr, dst, dstLen, srcReadPtr, dstWrotePtr, 
 	dstCharsPtr\fR)
 .sp
-char * 
+CONST char * 
 \fBTcl_UtfToExternalDString\fR(\fIencoding, src, srcLen, dstPtr\fR)
 .sp
 int
@@ -41,7 +41,7 @@
 TCHAR *
 \fBTcl_WinUtfToTChar\fR(\fIsrc, srcLen, dstPtr\fR)
 .sp
-char *
+CONST char *
 \fBTcl_GetEncodingName\fR(\fIencoding\fR)
 .sp
 int
@@ -53,7 +53,7 @@
 Tcl_Encoding
 \fBTcl_CreateEncoding\fR(\fItypePtr\fR)
 .sp
-char *
+CONST char *
 \fBTcl_GetDefaultEncodingDir\fR(\fIvoid\fR)
 .sp
 void
@@ -124,7 +124,7 @@
 stored in the output buffer.  May be NULL.
 .AP Tcl_EncodingType *typePtr in
 Structure that defines a new type of encoding.  
-.AP char *path in
+.AP "CONST char" *path in
 A path to the location of the encoding file.  
 .BE
 .SH INTRODUCTION
Index: doc/FileSystem.3
===================================================================
RCS file: /cvsroot/tcl/tcl/doc/FileSystem.3,v
retrieving revision 1.16
diff -u -u -r1.16 FileSystem.3
--- doc/FileSystem.3	2002/01/17 04:37:32	1.16
+++ doc/FileSystem.3	2002/01/25 20:37:58
@@ -140,7 +140,7 @@
 .AP Tcl_Obj *destPathPtr in
 As for \fBpathPtr\fR, but used for the destination filename for a copy or
 rename operation.
-.AP char *pattern in
+.AP "CONST char" *pattern in
 Only files or directories matching this pattern will be returned by
 \fBTcl_FSMatchInDirectory\fR.
 .AP GlobTypeData *types in
@@ -863,7 +863,7 @@
 	Tcl_Interp* \fIinterp\fR, 
 	Tcl_Obj *\fIresult\fR,
 	Tcl_Obj *\fIpathPtr\fR, 
-	char *\fIpattern\fR, 
+	CONST char *\fIpattern\fR, 
 	Tcl_GlobTypeData * \fItypes\fR);
 .CE
 .PP
Index: doc/Macintosh.3
===================================================================
RCS file: /cvsroot/tcl/tcl/doc/Macintosh.3,v
retrieving revision 1.3
diff -u -u -r1.3 Macintosh.3
--- doc/Macintosh.3	2001/05/03 23:57:10	1.3
+++ doc/Macintosh.3	2002/01/25 20:37:58
@@ -39,17 +39,17 @@
 .AP Tcl_Interp *interp in
 Interpreter to use for error reporting, or NULL if no error reporting is
 desired.
-.AP char *resourceName in
+.AP "CONST char" *resourceName in
 Name of TEXT resource to source, NULL if number should be used.
 .AP int resourceNumber in
 Resource id of source.
-.AP char *fileName in
+.AP "CONST char" *fileName in
 Name of file to process. NULL if application resource.
 .AP Handle resource in
 Handle to TEXT resource.
 .AP long resourceType in
 Type of resource to load.
-.AP char *resFileRef in
+.AP "CONST char" *resFileRef in
 Registered resource file reference, NULL if searching all open resource files.
 .AP int *releaseIt out
 Should we release this resource when done.
Index: doc/OpenFileChnl.3
===================================================================
RCS file: /cvsroot/tcl/tcl/doc/OpenFileChnl.3,v
retrieving revision 1.17
diff -u -u -r1.17 OpenFileChnl.3
--- doc/OpenFileChnl.3	2002/01/15 21:19:06	1.17
+++ doc/OpenFileChnl.3	2002/01/25 20:37:58
@@ -127,7 +127,7 @@
 permissions will be set on the created file.
 .AP int argc in
 The number of elements in \fIargv\fR.
-.AP char **argv in
+.AP "CONST char" **argv in
 Arguments for constructing a command pipeline.  These values have the same
 meaning as the non-switch arguments to the Tcl \fBexec\fR command.
 .AP int flags in
Index: doc/SetResult.3
===================================================================
RCS file: /cvsroot/tcl/tcl/doc/SetResult.3,v
retrieving revision 1.6
diff -u -u -r1.6 SetResult.3
--- doc/SetResult.3	2000/07/24 00:03:02	1.6
+++ doc/SetResult.3	2002/01/25 20:37:58
@@ -23,7 +23,7 @@
 .sp
 \fBTcl_SetResult\fR(\fIinterp, string, freeProc\fR)
 .sp
-char *
+CONST char *
 \fBTcl_GetStringResult\fR(\fIinterp\fR)
 .sp
 \fBTcl_AppendResult\fR(\fIinterp, string, string, ... , \fB(char *) NULL\fR)
Index: doc/SetVar.3
===================================================================
RCS file: /cvsroot/tcl/tcl/doc/SetVar.3,v
retrieving revision 1.3
diff -u -u -r1.3 SetVar.3
--- doc/SetVar.3	1999/04/16 00:46:33	1.3
+++ doc/SetVar.3	2002/01/25 20:37:58
@@ -21,10 +21,10 @@
 \fBTcl_SetVar2Ex\fR(\fIinterp, name1, name2, newValuePtr, flags\fR)
 .VE
 .sp
-char *
+CONST char *
 \fBTcl_SetVar\fR(\fIinterp, varName, newValue, flags\fR)
 .sp
-char *
+CONST char *
 \fBTcl_SetVar2\fR(\fIinterp, name1, name2, newValue, flags\fR)
 .sp
 Tcl_Obj *
@@ -35,10 +35,10 @@
 \fBTcl_GetVar2Ex\fR(\fIinterp, name1, name2, flags\fR)
 .VE
 .sp
-char *
+CONST char *
 \fBTcl_GetVar\fR(\fIinterp, varName, flags\fR)
 .sp
-char *
+CONST char *
 \fBTcl_GetVar2\fR(\fIinterp, name1, name2, flags\fR)
 .sp
 Tcl_Obj *
@@ -78,7 +78,7 @@
 If the name references an element of an array, then the name
 must be in writable memory:  Tcl will make temporary modifications 
 to it while looking up the name.
-.AP char *newValue in
+.AP "CONST char" *newValue in
 New value for variable, specified as a NULL-terminated string.
 A copy of this value is stored in the variable.
 .AP Tcl_Obj *part1Ptr in
Index: doc/SplitList.3
===================================================================
RCS file: /cvsroot/tcl/tcl/doc/SplitList.3,v
retrieving revision 1.5
diff -u -u -r1.5 SplitList.3
--- doc/SplitList.3	2001/09/24 21:10:32	1.5
+++ doc/SplitList.3	2002/01/25 20:37:59
@@ -34,7 +34,7 @@
 int
 \fBTcl_ConvertCountedElement\fR(\fIsrc, length, dst, flags\fR)
 .SH ARGUMENTS
-.AS Tcl_Interp ***argvPtr
+.AS "CONST char * CONST" ***argvPtr
 .AP Tcl_Interp *interp out
 Interpreter to use for error reporting.  If NULL, then no error message
 is left.
@@ -42,14 +42,14 @@
 Pointer to a string with proper list structure.
 .AP int *argcPtr out
 Filled in with number of elements in \fIlist\fR.
-.AP char ***argvPtr out
+.AP "CONST char" ***argvPtr out
 \fI*argvPtr\fR will be filled in with the address of an array of
 pointers to the strings that are the extracted elements of \fIlist\fR.
 There will be \fI*argcPtr\fR valid entries in the array, followed by
 a NULL entry.
 .AP int argc in
 Number of elements in \fIargv\fR.
-.AP "char * CONST" *argv in
+.AP "CONST char * CONST" *argv in
 Array of strings to merge together into a single list.
 Each string will become a separate element of the list.
 .AP "CONST char" *src in
Index: doc/SplitPath.3
===================================================================
RCS file: /cvsroot/tcl/tcl/doc/SplitPath.3,v
retrieving revision 1.4
diff -u -u -r1.4 SplitPath.3
--- doc/SplitPath.3	2001/09/27 00:19:57	1.4
+++ doc/SplitPath.3	2002/01/25 20:37:59
@@ -17,26 +17,26 @@
 .sp
 \fBTcl_SplitPath\fR(\fIpath, argcPtr, argvPtr\fR)
 .sp
-char *
+CONST char *
 \fBTcl_JoinPath\fR(\fIargc, argv, resultPtr\fR)
 .sp
 Tcl_PathType
 \fBTcl_GetPathType\fR(\fIpath\fR)
 .SH ARGUMENTS
 .AS Tcl_DString ***argvPtr
-.AP "CONST char" *path in
+.AP "CONST char * CONST" *argvPtr in
 File path in a form appropriate for the current platform (see the
 \fBfilename\fR manual entry for acceptable forms for path names).
 .AP int *argcPtr out
 Filled in with number of path elements in \fIpath\fR.
-.AP char ***argvPtr out
+.AP CONST char ***argvPtr out
 \fI*argvPtr\fR will be filled in with the address of an array of
 pointers to the strings that are the extracted elements of \fIpath\fR.
 There will be \fI*argcPtr\fR valid entries in the array, followed by
 a NULL entry.
 .AP int argc in
 Number of elements in \fIargv\fR.
-.AP char **argv in
+.AP "CONST char * CONST" *argv in
 Array of path elements to merge together into a single path.
 .AP Tcl_DString *resultPtr in/out
 A pointer to an initialized \fBTcl_DString\fR to which the result of
Index: doc/Translate.3
===================================================================
RCS file: /cvsroot/tcl/tcl/doc/Translate.3,v
retrieving revision 1.4
diff -u -u -r1.4 Translate.3
--- doc/Translate.3	2000/04/14 23:01:54	1.4
+++ doc/Translate.3	2002/01/25 20:37:59
@@ -16,13 +16,13 @@
 .nf
 \fB#include <tcl.h>\fR
 .sp
-char *
+CONST char *
 \fBTcl_TranslateFileName\fR(\fIinterp\fR, \fIname\fR, \fIbufferPtr\fR)
 .SH ARGUMENTS
 .AS Tcl_DString *bufferPtr
 .AP Tcl_Interp *interp in
 Interpreter in which to report an error, if any.
-.AP char *name in
+.AP "CONST char" *name in
 File name, which may start with a ``~''.
 .AP Tcl_DString *bufferPtr in/out
 If needed, this dynamic string is used to store the new file name.
Index: generic/tcl.decls
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tcl.decls,v
retrieving revision 1.77
diff -u -u -r1.77 tcl.decls
--- generic/tcl.decls	2002/01/23 20:46:01	1.77
+++ generic/tcl.decls	2002/01/25 20:37:59
@@ -306,7 +306,7 @@
     int Tcl_CommandComplete(char *cmd)
 }
 declare 83 generic {
-    char * Tcl_Concat(int argc, char * CONST *argv)
+    char * Tcl_Concat(int argc, CONST char * CONST *argv)
 }
 declare 84 generic {
     int Tcl_ConvertElement(CONST char *src, char *dst, int flags)
@@ -624,13 +624,14 @@
     Tcl_Channel Tcl_GetStdChannel(int type)
 }
 declare 174 generic {
-    char * Tcl_GetStringResult(Tcl_Interp *interp)
+    CONST char * Tcl_GetStringResult(Tcl_Interp *interp)
 }
 declare 175 generic {
-    char * Tcl_GetVar(Tcl_Interp *interp, char *varName, int flags)
+    CONST char * Tcl_GetVar(Tcl_Interp *interp, char *varName, int flags)
 }
 declare 176 generic {
-    char * Tcl_GetVar2(Tcl_Interp *interp, char *part1, char *part2, int flags)
+    CONST char * Tcl_GetVar2(Tcl_Interp *interp, char *part1, char *part2, \
+	    int flags)
 }
 declare 177 generic {
     int Tcl_GlobalEval(Tcl_Interp *interp, char *command)
@@ -662,7 +663,8 @@
 }
 # Obsolete, use Tcl_FSJoinPath
 declare 186 generic {
-    char * Tcl_JoinPath(int argc, char **argv, Tcl_DString *resultPtr)
+    CONST char * Tcl_JoinPath(int argc, CONST char * CONST *argv,
+	    Tcl_DString *resultPtr)
 }
 declare 187 generic {
     int Tcl_LinkVar(Tcl_Interp *interp, char *varName, char *addr, int type)
@@ -683,7 +685,7 @@
     Tcl_Channel Tcl_MakeTcpClientChannel(ClientData tcpSocket)
 }
 declare 192 generic {
-    char * Tcl_Merge(int argc, char * CONST *argv)
+    char * Tcl_Merge(int argc, CONST char * CONST *argv)
 }
 declare 193 generic {
     Tcl_HashEntry * Tcl_NextHashEntry(Tcl_HashSearch *searchPtr)
@@ -701,7 +703,7 @@
 }
 declare 197 {unix win} {
     Tcl_Channel Tcl_OpenCommandChannel(Tcl_Interp *interp, int argc, \
-	    char **argv, int flags)
+	    CONST char **argv, int flags)
 }
 # This is obsolete, use Tcl_FSOpenFileChannel
 declare 198 generic {
@@ -833,12 +835,12 @@
     void Tcl_SetStdChannel(Tcl_Channel channel, int type)
 }
 declare 237 generic {
-    char * Tcl_SetVar(Tcl_Interp *interp, char *varName, char *newValue, \
-	    int flags)
+    CONST char * Tcl_SetVar(Tcl_Interp *interp, char *varName, \
+	    CONST char *newValue, int flags)
 }
 declare 238 generic {
-    char * Tcl_SetVar2(Tcl_Interp *interp, char *part1, char *part2, \
-	    char *newValue, int flags)
+    CONST char * Tcl_SetVar2(Tcl_Interp *interp, char *part1, char *part2, \
+	    CONST char *newValue, int flags)
 }
 declare 239 generic {
     CONST char * Tcl_SignalId(int sig)
@@ -851,11 +853,11 @@
 }
 declare 242 generic {
     int Tcl_SplitList(Tcl_Interp *interp, CONST char *listStr, int *argcPtr, \
-	    char ***argvPtr)
+	    CONST char ***argvPtr)
 }
 # Obsolete, use Tcl_FSSplitPath
 declare 243 generic {
-    void Tcl_SplitPath(CONST char *path, int *argcPtr, char ***argvPtr)
+    void Tcl_SplitPath(CONST char *path, int *argcPtr, CONST char ***argvPtr)
 }
 declare 244 generic {
     void Tcl_StaticPackage(Tcl_Interp *interp, CONST char *pkgName, \
@@ -876,7 +878,7 @@
 	    int flags, Tcl_VarTraceProc *proc, ClientData clientData)
 }
 declare 249 generic {
-    char * Tcl_TranslateFileName(Tcl_Interp *interp, char *name, \
+    CONST char * Tcl_TranslateFileName(Tcl_Interp *interp, CONST char *name, \
 	    Tcl_DString *bufferPtr)
 }
 declare 250 generic {
@@ -1060,8 +1062,8 @@
 	    int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr)
 }
 declare 296 generic {
-    char * Tcl_ExternalToUtfDString(Tcl_Encoding encoding, CONST char *src, \
-	    int srcLen, Tcl_DString *dsPtr)
+    CONST char * Tcl_ExternalToUtfDString(Tcl_Encoding encoding, \
+	    CONST char *src, int srcLen, Tcl_DString *dsPtr)
 }
 declare 297 generic {
     void Tcl_FinalizeThread(void)
@@ -1079,7 +1081,7 @@
     Tcl_Encoding Tcl_GetEncoding(Tcl_Interp *interp, CONST char *name)
 }
 declare 302 generic {
-    char * Tcl_GetEncodingName(Tcl_Encoding encoding)
+    CONST char * Tcl_GetEncodingName(Tcl_Encoding encoding)
 }
 declare 303 generic {
     void Tcl_GetEncodingNames(Tcl_Interp *interp)
@@ -1182,8 +1184,8 @@
 	    int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr)
 }
 declare 333 generic {
-    char * Tcl_UtfToExternalDString(Tcl_Encoding encoding, CONST char *src, \
-	    int srcLen, Tcl_DString *dsPtr)
+    CONST char * Tcl_UtfToExternalDString(Tcl_Encoding encoding, \
+	    CONST char *src, int srcLen, Tcl_DString *dsPtr)
 }
 declare 334 generic {
     int Tcl_UtfToLower(char *src)
@@ -1207,10 +1209,10 @@
     char * Tcl_GetString(Tcl_Obj *objPtr)
 }
 declare 341 generic {
-    char * Tcl_GetDefaultEncodingDir(void)
+    CONST char * Tcl_GetDefaultEncodingDir(void)
 }
 declare 342 generic {
-    void Tcl_SetDefaultEncodingDir(char *path)
+    void Tcl_SetDefaultEncodingDir(CONST char *path)
 }
 declare 343 generic {
     void Tcl_AlertNotifier(ClientData clientData)
@@ -1573,7 +1575,7 @@
 declare 445 generic {
     int	Tcl_FSMatchInDirectory(Tcl_Interp *interp, Tcl_Obj * result, \
 		    Tcl_Obj *pathPtr, \
-		    char * pattern, Tcl_GlobTypeData * types)
+		    CONST char * pattern, Tcl_GlobTypeData * types)
 }
 declare 446 generic {
     Tcl_Obj*	Tcl_FSLink(Tcl_Obj *pathPtr, Tcl_Obj *toPtr)
@@ -1733,13 +1735,13 @@
     char * Tcl_MacConvertTextResource(Handle resource)
 }
 declare 2 mac {
-    int Tcl_MacEvalResource(Tcl_Interp *interp, char *resourceName, \
-	    int resourceNumber, char *fileName)
+    int Tcl_MacEvalResource(Tcl_Interp *interp, CONST char *resourceName, \
+	    int resourceNumber, CONST char *fileName)
 }
 declare 3 mac {
     Handle Tcl_MacFindResource(Tcl_Interp *interp, long resourceType, \
-	    char *resourceName, int resourceNumber, char *resFileRef, \
-	    int * releaseIt)
+	    CONST char *resourceName, int resourceNumber, \
+	    CONST char *resFileRef, int * releaseIt)
 }
 
 # These routines support the new OSType object type (i.e. the packed 4
Index: generic/tcl.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tcl.h,v
retrieving revision 1.110
diff -u -u -r1.110 tcl.h
--- generic/tcl.h	2002/01/17 04:37:33	1.110
+++ generic/tcl.h	2002/01/25 20:37:59
@@ -1503,7 +1503,7 @@
 	_ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *pathPtr, 
 	CONST char *modeString, int permissions));
 typedef int (Tcl_FSMatchInDirectoryProc) _ANSI_ARGS_((Tcl_Interp* interp, 
-	Tcl_Obj *result, Tcl_Obj *pathPtr, char *pattern, 
+	Tcl_Obj *result, Tcl_Obj *pathPtr, CONST char *pattern, 
 	Tcl_GlobTypeData * types));
 typedef Tcl_Obj* (Tcl_FSGetCwdProc) _ANSI_ARGS_((Tcl_Interp *interp));
 typedef int (Tcl_FSChdirProc) _ANSI_ARGS_((Tcl_Obj *pathPtr));
Index: generic/tclCkalloc.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclCkalloc.c,v
retrieving revision 1.14
diff -u -u -r1.14 tclCkalloc.c
--- generic/tclCkalloc.c	2001/12/28 23:36:31	1.14
+++ generic/tclCkalloc.c	2002/01/25 20:37:59
@@ -783,7 +783,7 @@
     int         argc;
     char      **argv;
 {
-    char *fileName;
+    CONST char *fileName;
     Tcl_DString buffer;
     int result;
 
Index: generic/tclClock.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclClock.c,v
retrieving revision 1.13
diff -u -u -r1.13 tclClock.c
--- generic/tclClock.c	2002/01/17 04:37:33	1.13
+++ generic/tclClock.c	2002/01/25 20:38:00
@@ -297,7 +297,7 @@
      */
 
     if (useGMT) {
-        char *varValue;
+        CONST char *varValue;
 
         varValue = Tcl_GetVar2(interp, "env", "TZ", TCL_GLOBAL_ONLY);
         if (varValue != NULL) {
Index: generic/tclCmdAH.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclCmdAH.c,v
retrieving revision 1.18
diff -u -u -r1.18 tclCmdAH.c
--- generic/tclCmdAH.c	2002/01/17 04:37:33	1.18
+++ generic/tclCmdAH.c	2002/01/25 20:38:00
@@ -131,7 +131,7 @@
 
     for (i = 0;  i < caseObjc;  i += 2) {
 	int patObjc, j;
-	char **patObjv;
+	CONST char **patObjv;
 	char *pat;
 	unsigned char *p;
 
@@ -512,7 +512,8 @@
 		return TCL_ERROR;
 	    }
 	    if (objc == 2) {
-	        Tcl_SetResult(interp, Tcl_GetEncodingName(NULL), TCL_STATIC);
+		Tcl_SetStringObj(Tcl_GetObjResult(interp),
+			Tcl_GetEncodingName(NULL), -1);
 	    } else {
 	        return Tcl_SetSystemEncoding(interp,
 			Tcl_GetStringFromObj(objv[2], NULL));
@@ -1014,7 +1015,7 @@
 	    return TclFileMakeDirsCmd(interp, objc, objv);
 	}
 	case FILE_NATIVENAME: {
-	    char *fileName;
+	    CONST char *fileName;
 	    Tcl_DString ds;
 
 	    if (objc != 3) {
Index: generic/tclCmdIL.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclCmdIL.c,v
retrieving revision 1.38
diff -u -u -r1.38 tclCmdIL.c
--- generic/tclCmdIL.c	2002/01/23 20:46:01	1.38
+++ generic/tclCmdIL.c	2002/01/25 20:38:01
@@ -1192,7 +1192,7 @@
     int objc;			/* Number of arguments. */
     Tcl_Obj *CONST objv[];	/* Argument objects. */
 {
-    char *libDirName;
+    CONST char *libDirName;
 
     if (objc != 2) {
         Tcl_WrongNumArgs(interp, 2, objv, NULL);
@@ -1454,7 +1454,7 @@
     int objc;			/* Number of arguments. */
     Tcl_Obj *CONST objv[];	/* Argument objects. */
 {
-    char *patchlevel;
+    CONST char *patchlevel;
 
     if (objc != 2) {
         Tcl_WrongNumArgs(interp, 2, objv, NULL);
@@ -1742,7 +1742,7 @@
     int objc;			/* Number of arguments. */
     Tcl_Obj *CONST objv[];	/* Argument objects. */
 {
-    char *version;
+    CONST char *version;
 
     if (objc != 2) {
         Tcl_WrongNumArgs(interp, 2, objv, NULL);
Index: generic/tclCompCmds.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclCompCmds.c,v
retrieving revision 1.20
diff -u -u -r1.20 tclCompCmds.c
--- generic/tclCompCmds.c	2002/01/17 04:37:33	1.20
+++ generic/tclCompCmds.c	2002/01/25 20:38:01
@@ -754,9 +754,9 @@
 
 #define STATIC_VAR_LIST_SIZE 5
     int varcListStaticSpace[STATIC_VAR_LIST_SIZE];
-    char **varvListStaticSpace[STATIC_VAR_LIST_SIZE];
+    CONST char **varvListStaticSpace[STATIC_VAR_LIST_SIZE];
     int *varcList = varcListStaticSpace;
-    char ***varvList = varvListStaticSpace;
+    CONST char ***varvList = varvListStaticSpace;
 
     /*
      * If the foreach command isn't in a procedure, don't compile it inline:
@@ -795,11 +795,11 @@
     numLists = (numWords - 2)/2;
     if (numLists > STATIC_VAR_LIST_SIZE) {
         varcList = (int *) ckalloc(numLists * sizeof(int));
-        varvList = (char ***) ckalloc(numLists * sizeof(char **));
+        varvList = (CONST char ***) ckalloc(numLists * sizeof(char **));
     }
     for (loopIndex = 0;  loopIndex < numLists;  loopIndex++) {
         varcList[loopIndex] = 0;
-        varvList[loopIndex] = (char **) NULL;
+        varvList[loopIndex] = NULL;
     }
     
     /*
@@ -845,7 +845,7 @@
 
 	    numVars = varcList[loopIndex];
 	    for (j = 0;  j < numVars;  j++) {
-		char *varName = varvList[loopIndex][j];
+		CONST char *varName = varvList[loopIndex][j];
 		if (!TclIsLocalScalar(varName, (int) strlen(varName))) {
 		    code = TCL_OUT_LINE_COMPILE;
 		    goto done;
@@ -893,7 +893,7 @@
 	        sizeof(ForeachVarList) + (numVars * sizeof(int)));
 	varListPtr->numVars = numVars;
 	for (j = 0;  j < numVars;  j++) {
-	    char *varName = varvList[loopIndex][j];
+	    CONST char *varName = varvList[loopIndex][j];
 	    int nameChars = strlen(varName);
 	    varListPtr->varIndexes[j] = TclFindCompiledLocal(varName,
 		    nameChars, /*create*/ 1, /*flags*/ VAR_SCALAR, procPtr);
@@ -1029,7 +1029,7 @@
 
     done:
     for (loopIndex = 0;  loopIndex < numLists;  loopIndex++) {
-        if (varvList[loopIndex] != (char **) NULL) {
+        if (varvList[loopIndex] != NULL) {
             ckfree((char *) varvList[loopIndex]);
         }
     }
Index: generic/tclCompile.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclCompile.c,v
retrieving revision 1.30
diff -u -u -r1.30 tclCompile.c
--- generic/tclCompile.c	2001/12/11 19:45:52	1.30
+++ generic/tclCompile.c	2002/01/25 20:38:01
@@ -1711,7 +1711,7 @@
 
 int
 TclFindCompiledLocal(name, nameBytes, create, flags, procPtr)
-    register char *name;	/* Points to first character of the name of
+    register CONST char *name;	/* Points to first character of the name of
 				 * a scalar or array variable. If NULL, a
 				 * temporary var should be created. */
     int nameBytes;		/* Number of bytes in the name. */
Index: generic/tclCompile.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclCompile.h,v
retrieving revision 1.23
diff -u -u -r1.23 tclCompile.h
--- generic/tclCompile.h	2001/12/10 15:44:34	1.23
+++ generic/tclCompile.h	2002/01/25 20:38:02
@@ -786,7 +786,7 @@
 EXTERN void		TclExpandJumpFixupArray _ANSI_ARGS_((
                             JumpFixupArray *fixupArrayPtr));
 EXTERN void		TclFinalizeAuxDataTypeTable _ANSI_ARGS_((void));
-EXTERN int		TclFindCompiledLocal _ANSI_ARGS_((char *name, 
+EXTERN int		TclFindCompiledLocal _ANSI_ARGS_((CONST char *name, 
         		    int nameChars, int create, int flags,
 			    Proc *procPtr));
 EXTERN LiteralEntry *	TclLookupLiteralEntry _ANSI_ARGS_((
Index: generic/tclDecls.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclDecls.h,v
retrieving revision 1.77
diff -u -u -r1.77 tclDecls.h
--- generic/tclDecls.h	2002/01/23 20:46:01	1.77
+++ generic/tclDecls.h	2002/01/25 20:38:03
@@ -274,7 +274,7 @@
 EXTERN int		Tcl_CommandComplete _ANSI_ARGS_((char * cmd));
 /* 83 */
 EXTERN char *		Tcl_Concat _ANSI_ARGS_((int argc, 
-				char * CONST * argv));
+				CONST char * CONST * argv));
 /* 84 */
 EXTERN int		Tcl_ConvertElement _ANSI_ARGS_((CONST char * src, 
 				char * dst, int flags));
@@ -568,12 +568,12 @@
 /* 173 */
 EXTERN Tcl_Channel	Tcl_GetStdChannel _ANSI_ARGS_((int type));
 /* 174 */
-EXTERN char *		Tcl_GetStringResult _ANSI_ARGS_((Tcl_Interp * interp));
+EXTERN CONST char *	Tcl_GetStringResult _ANSI_ARGS_((Tcl_Interp * interp));
 /* 175 */
-EXTERN char *		Tcl_GetVar _ANSI_ARGS_((Tcl_Interp * interp, 
+EXTERN CONST char *	Tcl_GetVar _ANSI_ARGS_((Tcl_Interp * interp, 
 				char * varName, int flags));
 /* 176 */
-EXTERN char *		Tcl_GetVar2 _ANSI_ARGS_((Tcl_Interp * interp, 
+EXTERN CONST char *	Tcl_GetVar2 _ANSI_ARGS_((Tcl_Interp * interp, 
 				char * part1, char * part2, int flags));
 /* 177 */
 EXTERN int		Tcl_GlobalEval _ANSI_ARGS_((Tcl_Interp * interp, 
@@ -599,7 +599,8 @@
 /* 185 */
 EXTERN int		Tcl_IsSafe _ANSI_ARGS_((Tcl_Interp * interp));
 /* 186 */
-EXTERN char *		Tcl_JoinPath _ANSI_ARGS_((int argc, char ** argv, 
+EXTERN CONST char *	Tcl_JoinPath _ANSI_ARGS_((int argc, 
+				CONST char * CONST * argv, 
 				Tcl_DString * resultPtr));
 /* 187 */
 EXTERN int		Tcl_LinkVar _ANSI_ARGS_((Tcl_Interp * interp, 
@@ -614,7 +615,8 @@
 EXTERN Tcl_Channel	Tcl_MakeTcpClientChannel _ANSI_ARGS_((
 				ClientData tcpSocket));
 /* 192 */
-EXTERN char *		Tcl_Merge _ANSI_ARGS_((int argc, char * CONST * argv));
+EXTERN char *		Tcl_Merge _ANSI_ARGS_((int argc, 
+				CONST char * CONST * argv));
 /* 193 */
 EXTERN Tcl_HashEntry *	Tcl_NextHashEntry _ANSI_ARGS_((
 				Tcl_HashSearch * searchPtr));
@@ -632,14 +634,14 @@
 #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
 /* 197 */
 EXTERN Tcl_Channel	Tcl_OpenCommandChannel _ANSI_ARGS_((
-				Tcl_Interp * interp, int argc, char ** argv, 
-				int flags));
+				Tcl_Interp * interp, int argc, 
+				CONST char ** argv, int flags));
 #endif /* UNIX */
 #ifdef __WIN32__
 /* 197 */
 EXTERN Tcl_Channel	Tcl_OpenCommandChannel _ANSI_ARGS_((
-				Tcl_Interp * interp, int argc, char ** argv, 
-				int flags));
+				Tcl_Interp * interp, int argc, 
+				CONST char ** argv, int flags));
 #endif /* __WIN32__ */
 /* 198 */
 EXTERN Tcl_Channel	Tcl_OpenFileChannel _ANSI_ARGS_((Tcl_Interp * interp, 
@@ -764,12 +766,13 @@
 EXTERN void		Tcl_SetStdChannel _ANSI_ARGS_((Tcl_Channel channel, 
 				int type));
 /* 237 */
-EXTERN char *		Tcl_SetVar _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * varName, char * newValue, int flags));
-/* 238 */
-EXTERN char *		Tcl_SetVar2 _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * part1, char * part2, char * newValue, 
+EXTERN CONST char *	Tcl_SetVar _ANSI_ARGS_((Tcl_Interp * interp, 
+				char * varName, CONST char * newValue, 
 				int flags));
+/* 238 */
+EXTERN CONST char *	Tcl_SetVar2 _ANSI_ARGS_((Tcl_Interp * interp, 
+				char * part1, char * part2, 
+				CONST char * newValue, int flags));
 /* 239 */
 EXTERN CONST char *	Tcl_SignalId _ANSI_ARGS_((int sig));
 /* 240 */
@@ -779,10 +782,10 @@
 /* 242 */
 EXTERN int		Tcl_SplitList _ANSI_ARGS_((Tcl_Interp * interp, 
 				CONST char * listStr, int * argcPtr, 
-				char *** argvPtr));
+				CONST char *** argvPtr));
 /* 243 */
 EXTERN void		Tcl_SplitPath _ANSI_ARGS_((CONST char * path, 
-				int * argcPtr, char *** argvPtr));
+				int * argcPtr, CONST char *** argvPtr));
 /* 244 */
 EXTERN void		Tcl_StaticPackage _ANSI_ARGS_((Tcl_Interp * interp, 
 				CONST char * pkgName, 
@@ -804,8 +807,8 @@
 				Tcl_VarTraceProc * proc, 
 				ClientData clientData));
 /* 249 */
-EXTERN char *		Tcl_TranslateFileName _ANSI_ARGS_((
-				Tcl_Interp * interp, char * name, 
+EXTERN CONST char *	Tcl_TranslateFileName _ANSI_ARGS_((
+				Tcl_Interp * interp, CONST char * name, 
 				Tcl_DString * bufferPtr));
 /* 250 */
 EXTERN int		Tcl_Ungets _ANSI_ARGS_((Tcl_Channel chan, 
@@ -959,7 +962,7 @@
 				int dstLen, int * srcReadPtr, 
 				int * dstWrotePtr, int * dstCharsPtr));
 /* 296 */
-EXTERN char *		Tcl_ExternalToUtfDString _ANSI_ARGS_((
+EXTERN CONST char *	Tcl_ExternalToUtfDString _ANSI_ARGS_((
 				Tcl_Encoding encoding, CONST char * src, 
 				int srcLen, Tcl_DString * dsPtr));
 /* 297 */
@@ -975,7 +978,7 @@
 EXTERN Tcl_Encoding	Tcl_GetEncoding _ANSI_ARGS_((Tcl_Interp * interp, 
 				CONST char * name));
 /* 302 */
-EXTERN char *		Tcl_GetEncodingName _ANSI_ARGS_((
+EXTERN CONST char *	Tcl_GetEncodingName _ANSI_ARGS_((
 				Tcl_Encoding encoding));
 /* 303 */
 EXTERN void		Tcl_GetEncodingNames _ANSI_ARGS_((
@@ -1069,7 +1072,7 @@
 				int dstLen, int * srcReadPtr, 
 				int * dstWrotePtr, int * dstCharsPtr));
 /* 333 */
-EXTERN char *		Tcl_UtfToExternalDString _ANSI_ARGS_((
+EXTERN CONST char *	Tcl_UtfToExternalDString _ANSI_ARGS_((
 				Tcl_Encoding encoding, CONST char * src, 
 				int srcLen, Tcl_DString * dsPtr));
 /* 334 */
@@ -1090,9 +1093,10 @@
 /* 340 */
 EXTERN char *		Tcl_GetString _ANSI_ARGS_((Tcl_Obj * objPtr));
 /* 341 */
-EXTERN char *		Tcl_GetDefaultEncodingDir _ANSI_ARGS_((void));
+EXTERN CONST char *	Tcl_GetDefaultEncodingDir _ANSI_ARGS_((void));
 /* 342 */
-EXTERN void		Tcl_SetDefaultEncodingDir _ANSI_ARGS_((char * path));
+EXTERN void		Tcl_SetDefaultEncodingDir _ANSI_ARGS_((
+				CONST char * path));
 /* 343 */
 EXTERN void		Tcl_AlertNotifier _ANSI_ARGS_((ClientData clientData));
 /* 344 */
@@ -1406,7 +1410,7 @@
 /* 445 */
 EXTERN int		Tcl_FSMatchInDirectory _ANSI_ARGS_((
 				Tcl_Interp * interp, Tcl_Obj * result, 
-				Tcl_Obj * pathPtr, char * pattern, 
+				Tcl_Obj * pathPtr, CONST char * pattern, 
 				Tcl_GlobTypeData * types));
 /* 446 */
 EXTERN Tcl_Obj*		Tcl_FSLink _ANSI_ARGS_((Tcl_Obj * pathPtr, 
@@ -1624,7 +1628,7 @@
     void (*tcl_CancelIdleCall) _ANSI_ARGS_((Tcl_IdleProc * idleProc, ClientData clientData)); /* 80 */
     int (*tcl_Close) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Channel chan)); /* 81 */
     int (*tcl_CommandComplete) _ANSI_ARGS_((char * cmd)); /* 82 */
-    char * (*tcl_Concat) _ANSI_ARGS_((int argc, char * CONST * argv)); /* 83 */
+    char * (*tcl_Concat) _ANSI_ARGS_((int argc, CONST char * CONST * argv)); /* 83 */
     int (*tcl_ConvertElement) _ANSI_ARGS_((CONST char * src, char * dst, int flags)); /* 84 */
     int (*tcl_ConvertCountedElement) _ANSI_ARGS_((CONST char * src, int length, char * dst, int flags)); /* 85 */
     int (*tcl_CreateAlias) _ANSI_ARGS_((Tcl_Interp * slave, CONST char * slaveCmd, Tcl_Interp * target, CONST char * targetCmd, int argc, char * CONST * argv)); /* 86 */
@@ -1731,9 +1735,9 @@
     int (*tcl_GetServiceMode) _ANSI_ARGS_((void)); /* 171 */
     Tcl_Interp * (*tcl_GetSlave) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * slaveName)); /* 172 */
     Tcl_Channel (*tcl_GetStdChannel) _ANSI_ARGS_((int type)); /* 173 */
-    char * (*tcl_GetStringResult) _ANSI_ARGS_((Tcl_Interp * interp)); /* 174 */
-    char * (*tcl_GetVar) _ANSI_ARGS_((Tcl_Interp * interp, char * varName, int flags)); /* 175 */
-    char * (*tcl_GetVar2) _ANSI_ARGS_((Tcl_Interp * interp, char * part1, char * part2, int flags)); /* 176 */
+    CONST char * (*tcl_GetStringResult) _ANSI_ARGS_((Tcl_Interp * interp)); /* 174 */
+    CONST char * (*tcl_GetVar) _ANSI_ARGS_((Tcl_Interp * interp, char * varName, int flags)); /* 175 */
+    CONST char * (*tcl_GetVar2) _ANSI_ARGS_((Tcl_Interp * interp, char * part1, char * part2, int flags)); /* 176 */
     int (*tcl_GlobalEval) _ANSI_ARGS_((Tcl_Interp * interp, char * command)); /* 177 */
     int (*tcl_GlobalEvalObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr)); /* 178 */
     int (*tcl_HideCommand) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * cmdName, CONST char * hiddenCmdToken)); /* 179 */
@@ -1743,22 +1747,22 @@
     int (*tcl_InputBuffered) _ANSI_ARGS_((Tcl_Channel chan)); /* 183 */
     int (*tcl_InterpDeleted) _ANSI_ARGS_((Tcl_Interp * interp)); /* 184 */
     int (*tcl_IsSafe) _ANSI_ARGS_((Tcl_Interp * interp)); /* 185 */
-    char * (*tcl_JoinPath) _ANSI_ARGS_((int argc, char ** argv, Tcl_DString * resultPtr)); /* 186 */
+    CONST char * (*tcl_JoinPath) _ANSI_ARGS_((int argc, CONST char * CONST * argv, Tcl_DString * resultPtr)); /* 186 */
     int (*tcl_LinkVar) _ANSI_ARGS_((Tcl_Interp * interp, char * varName, char * addr, int type)); /* 187 */
     void *reserved188;
     Tcl_Channel (*tcl_MakeFileChannel) _ANSI_ARGS_((ClientData handle, int mode)); /* 189 */
     int (*tcl_MakeSafe) _ANSI_ARGS_((Tcl_Interp * interp)); /* 190 */
     Tcl_Channel (*tcl_MakeTcpClientChannel) _ANSI_ARGS_((ClientData tcpSocket)); /* 191 */
-    char * (*tcl_Merge) _ANSI_ARGS_((int argc, char * CONST * argv)); /* 192 */
+    char * (*tcl_Merge) _ANSI_ARGS_((int argc, CONST char * CONST * argv)); /* 192 */
     Tcl_HashEntry * (*tcl_NextHashEntry) _ANSI_ARGS_((Tcl_HashSearch * searchPtr)); /* 193 */
     void (*tcl_NotifyChannel) _ANSI_ARGS_((Tcl_Channel channel, int mask)); /* 194 */
     Tcl_Obj * (*tcl_ObjGetVar2) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * part1Ptr, Tcl_Obj * part2Ptr, int flags)); /* 195 */
     Tcl_Obj * (*tcl_ObjSetVar2) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * part1Ptr, Tcl_Obj * part2Ptr, Tcl_Obj * newValuePtr, int flags)); /* 196 */
 #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
-    Tcl_Channel (*tcl_OpenCommandChannel) _ANSI_ARGS_((Tcl_Interp * interp, int argc, char ** argv, int flags)); /* 197 */
+    Tcl_Channel (*tcl_OpenCommandChannel) _ANSI_ARGS_((Tcl_Interp * interp, int argc, CONST char ** argv, int flags)); /* 197 */
 #endif /* UNIX */
 #ifdef __WIN32__
-    Tcl_Channel (*tcl_OpenCommandChannel) _ANSI_ARGS_((Tcl_Interp * interp, int argc, char ** argv, int flags)); /* 197 */
+    Tcl_Channel (*tcl_OpenCommandChannel) _ANSI_ARGS_((Tcl_Interp * interp, int argc, CONST char ** argv, int flags)); /* 197 */
 #endif /* __WIN32__ */
 #ifdef MAC_TCL
     void *reserved197;
@@ -1810,19 +1814,19 @@
     void (*tcl_SetObjErrorCode) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * errorObjPtr)); /* 234 */
     void (*tcl_SetObjResult) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * resultObjPtr)); /* 235 */
     void (*tcl_SetStdChannel) _ANSI_ARGS_((Tcl_Channel channel, int type)); /* 236 */
-    char * (*tcl_SetVar) _ANSI_ARGS_((Tcl_Interp * interp, char * varName, char * newValue, int flags)); /* 237 */
-    char * (*tcl_SetVar2) _ANSI_ARGS_((Tcl_Interp * interp, char * part1, char * part2, char * newValue, int flags)); /* 238 */
+    CONST char * (*tcl_SetVar) _ANSI_ARGS_((Tcl_Interp * interp, char * varName, CONST char * newValue, int flags)); /* 237 */
+    CONST char * (*tcl_SetVar2) _ANSI_ARGS_((Tcl_Interp * interp, char * part1, char * part2, CONST char * newValue, int flags)); /* 238 */
     CONST char * (*tcl_SignalId) _ANSI_ARGS_((int sig)); /* 239 */
     CONST char * (*tcl_SignalMsg) _ANSI_ARGS_((int sig)); /* 240 */
     void (*tcl_SourceRCFile) _ANSI_ARGS_((Tcl_Interp * interp)); /* 241 */
-    int (*tcl_SplitList) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * listStr, int * argcPtr, char *** argvPtr)); /* 242 */
-    void (*tcl_SplitPath) _ANSI_ARGS_((CONST char * path, int * argcPtr, char *** argvPtr)); /* 243 */
+    int (*tcl_SplitList) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * listStr, int * argcPtr, CONST char *** argvPtr)); /* 242 */
+    void (*tcl_SplitPath) _ANSI_ARGS_((CONST char * path, int * argcPtr, CONST char *** argvPtr)); /* 243 */
     void (*tcl_StaticPackage) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * pkgName, Tcl_PackageInitProc * initProc, Tcl_PackageInitProc * safeInitProc)); /* 244 */
     int (*tcl_StringMatch) _ANSI_ARGS_((CONST char * str, CONST char * pattern)); /* 245 */
     int (*tcl_Tell) _ANSI_ARGS_((Tcl_Channel chan)); /* 246 */
     int (*tcl_TraceVar) _ANSI_ARGS_((Tcl_Interp * interp, char * varName, int flags, Tcl_VarTraceProc * proc, ClientData clientData)); /* 247 */
     int (*tcl_TraceVar2) _ANSI_ARGS_((Tcl_Interp * interp, char * part1, char * part2, int flags, Tcl_VarTraceProc * proc, ClientData clientData)); /* 248 */
-    char * (*tcl_TranslateFileName) _ANSI_ARGS_((Tcl_Interp * interp, char * name, Tcl_DString * bufferPtr)); /* 249 */
+    CONST char * (*tcl_TranslateFileName) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name, Tcl_DString * bufferPtr)); /* 249 */
     int (*tcl_Ungets) _ANSI_ARGS_((Tcl_Channel chan, CONST char * str, int len, int atHead)); /* 250 */
     void (*tcl_UnlinkVar) _ANSI_ARGS_((Tcl_Interp * interp, char * varName)); /* 251 */
     int (*tcl_UnregisterChannel) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Channel chan)); /* 252 */
@@ -1869,13 +1873,13 @@
     int (*tcl_EvalObjEx) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, int flags)); /* 293 */
     void (*tcl_ExitThread) _ANSI_ARGS_((int status)); /* 294 */
     int (*tcl_ExternalToUtf) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Encoding encoding, CONST char * src, int srcLen, int flags, Tcl_EncodingState * statePtr, char * dst, int dstLen, int * srcReadPtr, int * dstWrotePtr, int * dstCharsPtr)); /* 295 */
-    char * (*tcl_ExternalToUtfDString) _ANSI_ARGS_((Tcl_Encoding encoding, CONST char * src, int srcLen, Tcl_DString * dsPtr)); /* 296 */
+    CONST char * (*tcl_ExternalToUtfDString) _ANSI_ARGS_((Tcl_Encoding encoding, CONST char * src, int srcLen, Tcl_DString * dsPtr)); /* 296 */
     void (*tcl_FinalizeThread) _ANSI_ARGS_((void)); /* 297 */
     void (*tcl_FinalizeNotifier) _ANSI_ARGS_((ClientData clientData)); /* 298 */
     void (*tcl_FreeEncoding) _ANSI_ARGS_((Tcl_Encoding encoding)); /* 299 */
     Tcl_ThreadId (*tcl_GetCurrentThread) _ANSI_ARGS_((void)); /* 300 */
     Tcl_Encoding (*tcl_GetEncoding) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name)); /* 301 */
-    char * (*tcl_GetEncodingName) _ANSI_ARGS_((Tcl_Encoding encoding)); /* 302 */
+    CONST char * (*tcl_GetEncodingName) _ANSI_ARGS_((Tcl_Encoding encoding)); /* 302 */
     void (*tcl_GetEncodingNames) _ANSI_ARGS_((Tcl_Interp * interp)); /* 303 */
     int (*tcl_GetIndexFromObjStruct) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, CONST char ** tablePtr, int offset, CONST char * msg, int flags, int * indexPtr)); /* 304 */
     VOID * (*tcl_GetThreadData) _ANSI_ARGS_((Tcl_ThreadDataKey * keyPtr, int size)); /* 305 */
@@ -1906,7 +1910,7 @@
     CONST char * (*tcl_UtfNext) _ANSI_ARGS_((CONST char * src)); /* 330 */
     CONST char * (*tcl_UtfPrev) _ANSI_ARGS_((CONST char * src, CONST char * start)); /* 331 */
     int (*tcl_UtfToExternal) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Encoding encoding, CONST char * src, int srcLen, int flags, Tcl_EncodingState * statePtr, char * dst, int dstLen, int * srcReadPtr, int * dstWrotePtr, int * dstCharsPtr)); /* 332 */
-    char * (*tcl_UtfToExternalDString) _ANSI_ARGS_((Tcl_Encoding encoding, CONST char * src, int srcLen, Tcl_DString * dsPtr)); /* 333 */
+    CONST char * (*tcl_UtfToExternalDString) _ANSI_ARGS_((Tcl_Encoding encoding, CONST char * src, int srcLen, Tcl_DString * dsPtr)); /* 333 */
     int (*tcl_UtfToLower) _ANSI_ARGS_((char * src)); /* 334 */
     int (*tcl_UtfToTitle) _ANSI_ARGS_((char * src)); /* 335 */
     int (*tcl_UtfToUniChar) _ANSI_ARGS_((CONST char * src, Tcl_UniChar * chPtr)); /* 336 */
@@ -1914,8 +1918,8 @@
     int (*tcl_WriteChars) _ANSI_ARGS_((Tcl_Channel chan, CONST char * src, int srcLen)); /* 338 */
     int (*tcl_WriteObj) _ANSI_ARGS_((Tcl_Channel chan, Tcl_Obj * objPtr)); /* 339 */
     char * (*tcl_GetString) _ANSI_ARGS_((Tcl_Obj * objPtr)); /* 340 */
-    char * (*tcl_GetDefaultEncodingDir) _ANSI_ARGS_((void)); /* 341 */
-    void (*tcl_SetDefaultEncodingDir) _ANSI_ARGS_((char * path)); /* 342 */
+    CONST char * (*tcl_GetDefaultEncodingDir) _ANSI_ARGS_((void)); /* 341 */
+    void (*tcl_SetDefaultEncodingDir) _ANSI_ARGS_((CONST char * path)); /* 342 */
     void (*tcl_AlertNotifier) _ANSI_ARGS_((ClientData clientData)); /* 343 */
     void (*tcl_ServiceModeHook) _ANSI_ARGS_((int mode)); /* 344 */
     int (*tcl_UniCharIsAlnum) _ANSI_ARGS_((int ch)); /* 345 */
@@ -2018,7 +2022,7 @@
     int (*tcl_FSCreateDirectory) _ANSI_ARGS_((Tcl_Obj * pathPtr)); /* 442 */
     int (*tcl_FSDeleteFile) _ANSI_ARGS_((Tcl_Obj * pathPtr)); /* 443 */
     int (*tcl_FSLoadFile) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * pathPtr, CONST char * sym1, CONST char * sym2, Tcl_PackageInitProc ** proc1Ptr, Tcl_PackageInitProc ** proc2Ptr, ClientData * clientDataPtr, Tcl_FSUnloadFileProc ** unloadProcPtr)); /* 444 */
-    int (*tcl_FSMatchInDirectory) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * result, Tcl_Obj * pathPtr, char * pattern, Tcl_GlobTypeData * types)); /* 445 */
+    int (*tcl_FSMatchInDirectory) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * result, Tcl_Obj * pathPtr, CONST char * pattern, Tcl_GlobTypeData * types)); /* 445 */
     Tcl_Obj* (*tcl_FSLink) _ANSI_ARGS_((Tcl_Obj * pathPtr, Tcl_Obj * toPtr)); /* 446 */
     int (*tcl_FSRemoveDirectory) _ANSI_ARGS_((Tcl_Obj * pathPtr, int recursive, Tcl_Obj ** errorPtr)); /* 447 */
     int (*tcl_FSRenameFile) _ANSI_ARGS_((Tcl_Obj * srcPathPtr, Tcl_Obj * destPathPtr)); /* 448 */
Index: generic/tclEncoding.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclEncoding.c,v
retrieving revision 1.8
diff -u -u -r1.8 tclEncoding.c
--- generic/tclEncoding.c	2001/09/24 21:10:32	1.8
+++ generic/tclEncoding.c	2002/01/25 20:38:03
@@ -341,7 +341,7 @@
  *-------------------------------------------------------------------------
  */
 
-char *
+CONST char *
 Tcl_GetDefaultEncodingDir()
 {
     return tclDefaultEncodingDir;
@@ -362,7 +362,7 @@
 
 void
 Tcl_SetDefaultEncodingDir(path)
-    char *path;
+    CONST char *path;
 {
     tclDefaultEncodingDir = (char *)ckalloc((unsigned) strlen(path) + 1);
     strcpy(tclDefaultEncodingDir, path);
@@ -505,7 +505,7 @@
  *---------------------------------------------------------------------------
  */
 
-char *
+CONST char *
 Tcl_GetEncodingName(encoding)
     Tcl_Encoding encoding;	/* The encoding whose name to fetch. */
 {
@@ -781,7 +781,7 @@
  *-------------------------------------------------------------------------
  */
 
-char * 
+CONST char * 
 Tcl_ExternalToUtfDString(encoding, src, srcLen, dstPtr)
     Tcl_Encoding encoding;	/* The encoding for the source string, or
 				 * NULL for the default system encoding. */
@@ -944,7 +944,7 @@
  *-------------------------------------------------------------------------
  */
 
-char *
+CONST char *
 Tcl_UtfToExternalDString(encoding, src, srcLen, dstPtr)
     Tcl_Encoding encoding;	/* The encoding for the converted string,
 				 * or NULL for the default system encoding. */
@@ -1280,15 +1280,15 @@
     CONST char *name;
 
 {
-    char *argv[3];
+    CONST char *argv[3];
     Tcl_DString pathString;
     CONST char *path;
     Tcl_Channel chan;
     Tcl_Obj *pathPtr;
     
-    argv[0] = (char *) dir;
+    argv[0] = dir;
     argv[1] = "encoding";
-    argv[2] = (char *) name;
+    argv[2] = name;
 
     Tcl_DStringInit(&pathString);
     Tcl_JoinPath(3, argv, &pathString);
@@ -1584,7 +1584,7 @@
 
     while (1) {
 	int argc;
-	char **argv;
+	CONST char **argv;
 	char *line;
 	Tcl_DString lineString;
 	
Index: generic/tclEnv.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclEnv.c,v
retrieving revision 1.9
diff -u -u -r1.9 tclEnv.c
--- generic/tclEnv.c	2000/08/11 17:42:41	1.9
+++ generic/tclEnv.c	2002/01/25 20:38:03
@@ -84,7 +84,8 @@
 				 * managed. */
 {
     Tcl_DString envString;
-    char *p1, *p2;
+    CONST char *p1;
+    char *p2;
     int i;
 
     /*
@@ -133,7 +134,8 @@
 	    }
 	    p2++;
 	    p2[-1] = '\0';
-	    Tcl_SetVar2(interp, "env", p1, p2, TCL_GLOBAL_ONLY);	
+	    Tcl_SetVar2(interp, "env", Tcl_DStringValue(&envString), p2,
+		   TCL_GLOBAL_ONLY);	
 	    Tcl_DStringFree(&envString);
 	}
 	Tcl_MutexUnlock(&envMutex);
@@ -174,7 +176,8 @@
 {
     Tcl_DString envString;
     int index, length, nameLength;
-    char *p, *p2, *oldValue;
+    char *p, *oldValue;
+    CONST char *p2;
 
     /*
      * Figure out where the entry is going to go.  If the name doesn't
@@ -206,7 +209,7 @@
 	oldValue = NULL;
 	nameLength = strlen(name);
     } else {
-	char *env;
+	CONST char *env;
 
 	/*
 	 * Compare the new value to the existing value.  If they're
@@ -303,7 +306,8 @@
 {
     Tcl_DString nameString;   
     int nameLength;
-    char *name, *value;
+    CONST char *name;
+    char *value;
 
     if (string == NULL) {
 	return 0;
@@ -443,7 +447,7 @@
  *----------------------------------------------------------------------
  */
 
-char *
+CONST char *
 TclGetEnv(name, valuePtr)
     CONST char *name;		/* Name of environment variable to find
 				 * (UTF-8). */
@@ -452,7 +456,7 @@
 				 * stored. */
 {
     int length, index;
-    char *result;
+    CONST char *result;
 
     Tcl_MutexLock(&envMutex);
     index = TclpFindVariable(name, &length);
@@ -530,7 +534,7 @@
      */
 
     if (flags & TCL_TRACE_WRITES) {
-	char *value;
+	CONST char *value;
 	
 	value = Tcl_GetVar2(interp, "env", name2, TCL_GLOBAL_ONLY);
 	TclSetEnv(name2, value);
@@ -542,7 +546,7 @@
 
     if (flags & TCL_TRACE_READS) {
 	Tcl_DString valueString;
-	char *value;
+	CONST char *value;
 
 	value = TclGetEnv(name2, &valueString);
 	if (value == NULL) {
Index: generic/tclEvent.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclEvent.c,v
retrieving revision 1.18
diff -u -u -r1.18 tclEvent.c
--- generic/tclEvent.c	2002/01/17 04:37:33	1.18
+++ generic/tclEvent.c	2002/01/25 20:38:04
@@ -140,7 +140,7 @@
 				 * occurred. */
 {
     BgError *errPtr;
-    char *errResult, *varValue;
+    CONST char *errResult, *varValue;
     ErrAssocData *assocPtr;
     int length;
 
Index: generic/tclFileName.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclFileName.c,v
retrieving revision 1.27
diff -u -u -r1.27 tclFileName.c
--- generic/tclFileName.c	2002/01/17 04:37:33	1.27
+++ generic/tclFileName.c	2002/01/25 20:38:04
@@ -70,7 +70,7 @@
  * Prototypes for local procedures defined in this file:
  */
 
-static char *		DoTildeSubst _ANSI_ARGS_((Tcl_Interp *interp,
+static CONST char *	DoTildeSubst _ANSI_ARGS_((Tcl_Interp *interp,
 			    CONST char *user, Tcl_DString *resultPtr));
 static CONST char *	ExtractWinRoot _ANSI_ARGS_((CONST char *path,
 			    Tcl_DString *resultPtr, int offset, 
@@ -554,7 +554,7 @@
     CONST char *path;		/* Pointer to string containing a path. */
     int *argcPtr;		/* Pointer to location to fill in with
 				 * the number of elements in the path. */
-    char ***argvPtr;		/* Pointer to place to store pointer to array
+    CONST char ***argvPtr;	/* Pointer to place to store pointer to array
 				 * of pointers to path elements. */
 {
     Tcl_Obj *resultPtr = NULL;  /* Needed only to prevent gcc warnings. */
@@ -585,7 +585,7 @@
      * the list plus the argv pointers and the terminating NULL pointer.
      */
 
-    *argvPtr = (char **) ckalloc((unsigned)
+    *argvPtr = (CONST char **) ckalloc((unsigned)
 	    ((((*argcPtr) + 1) * sizeof(char *)) + size));
 
     /*
@@ -1268,10 +1268,10 @@
  *----------------------------------------------------------------------
  */
 
-char *
+CONST char *
 Tcl_JoinPath(argc, argv, resultPtr)
     int argc;
-    char **argv;
+    CONST char * CONST *argv;
     Tcl_DString *resultPtr;	/* Pointer to previously initialized DString */
 {
     int i, len;
@@ -1326,57 +1326,34 @@
  *----------------------------------------------------------------------
  */
 
-char *
+CONST char *
 Tcl_TranslateFileName(interp, name, bufferPtr)
     Tcl_Interp *interp;		/* Interpreter in which to store error
 				 * message (if necessary). */
-    char *name;			/* File name, which may begin with "~" (to
+    CONST char *name;		/* File name, which may begin with "~" (to
 				 * indicate current user's home directory) or
 				 * "~<user>" (to indicate any user's home
 				 * directory). */
     Tcl_DString *bufferPtr;	/* Uninitialized or free DString filled
 				 * with name after tilde substitution. */
 {
-    /*
-     * Handle tilde substitutions, if needed.
-     */
-    if (name[0] == '~') {
-	int argc, length;
-	char **argv;
-	Tcl_DString temp;
-
-	Tcl_SplitPath(name, &argc, (char ***) &argv);
-	
-	/*
-	 * Strip the trailing ':' off of a Mac path before passing the user
-	 * name to DoTildeSubst.
-	 */
-
-	if (tclPlatform == TCL_PLATFORM_MAC) {
-	    length = strlen(argv[0]);
-	    argv[0][length-1] = '\0';
-	}
-	
-	Tcl_DStringInit(&temp);
-	argv[0] = DoTildeSubst(interp, argv[0]+1, &temp);
-	if (argv[0] == NULL) {
-	    Tcl_DStringFree(&temp);
-	    ckfree((char *)argv);
-	    return NULL;
-	}
-	Tcl_DStringInit(bufferPtr);
-	Tcl_JoinPath(argc, argv, bufferPtr);
-	Tcl_DStringFree(&temp);
-	ckfree((char*)argv);
-    } else {
-	Tcl_DStringInit(bufferPtr);
-	Tcl_JoinPath(1, &name, bufferPtr);
-    }
+    Tcl_Obj *path = Tcl_NewStringObj(name, -1);
+    CONST char *result;
+   
+    Tcl_IncrRefCount(path);
+    result = Tcl_FSGetTranslatedStringPath(interp,path);
+    if (result == NULL) {
+	return NULL;
+    }
+    Tcl_DStringInit(bufferPtr);
+    Tcl_DStringAppend(bufferPtr, result, -1);
+    Tcl_DecrRefCount(path);
 
     /*
      * Convert forward slashes to backslashes in Windows paths because
      * some system interfaces don't accept forward slashes.
      */
+
     if (tclPlatform == TCL_PLATFORM_WINDOWS) {
 	register char *p;
 	for (p = Tcl_DStringValue(bufferPtr); *p != '\0'; p++) {
@@ -1480,7 +1457,7 @@
  *----------------------------------------------------------------------
  */
 
-static char *
+static CONST char *
 DoTildeSubst(interp, user, resultPtr)
     Tcl_Interp *interp;		/* Interpreter in which to store error
 				 * message (if necessary). */
@@ -1489,7 +1466,7 @@
     Tcl_DString *resultPtr;	/* Initialized DString filled with name
 				 * after tilde substitution. */
 {
-    char *dir;
+    CONST char *dir;
 
     if (*user == '\0') {
 	Tcl_DString dirString;
@@ -1515,7 +1492,7 @@
 	    return NULL;
 	}
     }
-    return resultPtr->string;
+    return Tcl_DStringValue(resultPtr);
 }
 
 /*
@@ -1968,7 +1945,8 @@
 				 * May be NULL. */
 {
     char *separators;
-    char *head, *tail, *start;
+    CONST char *head;
+    char *tail, *start;
     char c;
     int result, prefixLen;
     Tcl_DString buffer;
Index: generic/tclIO.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclIO.c,v
retrieving revision 1.48
diff -u -u -r1.48 tclIO.c
--- generic/tclIO.c	2002/01/21 20:38:06	1.48
+++ generic/tclIO.c	2002/01/25 20:38:05
@@ -5908,7 +5908,7 @@
     if (interp) {
 	CONST char *genericopt = 
 	    "blocking buffering buffersize encoding eofchar translation";
-	char **argv;
+	CONST char **argv;
 	int  argc, i;
 	Tcl_DString ds;
 
@@ -6192,7 +6192,7 @@
     ChannelState *statePtr = chanPtr->state;	/* state info for channel */
     size_t len;			/* Length of optionName string. */
     int argc;
-    char **argv;
+    CONST char **argv;
 
     /*
      * If the channel is in the middle of a background copy, fail.
@@ -6318,13 +6318,13 @@
                 statePtr->outEofChar = (int) argv[1][0];
             }
         }
-        if (argv != (char **) NULL) {
+        if (argv != NULL) {
             ckfree((char *) argv);
         }
 	return TCL_OK;
     } else if ((len > 1) && (optionName[1] == 't') &&
             (strncmp(optionName, "-translation", len) == 0)) {
-	char *readMode, *writeMode;
+	CONST char *readMode, *writeMode;
 
         if (Tcl_SplitList(interp, newValue, &argc, &argv) == TCL_ERROR) {
             return TCL_ERROR;
Index: generic/tclIOCmd.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclIOCmd.c,v
retrieving revision 1.12
diff -u -u -r1.12 tclIOCmd.c
--- generic/tclIOCmd.c	2002/01/17 20:35:22	1.12
+++ generic/tclIOCmd.c	2002/01/25 20:38:06
@@ -726,10 +726,10 @@
 
 #define NUM_ARGS 20
     Tcl_Obj *resultPtr;
-    char **argv;
+    CONST char **argv;
     char *string;
     Tcl_Channel chan;
-    char *argStorage[NUM_ARGS];
+    CONST char *argStorage[NUM_ARGS];
     int argc, background, i, index, keepNewline, result, skip, length;
     static CONST char *options[] = {
 	"-keepnewline",	"--",		NULL
@@ -784,7 +784,7 @@
     argv = argStorage;
     argc = objc - skip;
     if ((argc + 1) > sizeof(argv) / sizeof(argv[0])) {
-	argv = (char **) ckalloc((unsigned)(argc + 1) * sizeof(char *));
+	argv = (CONST char **) ckalloc((unsigned)(argc + 1) * sizeof(char *));
     }
 
     /*
@@ -976,7 +976,7 @@
 	return TCL_ERROR;
 #else
 	int mode, seekFlag, cmdObjc;
-	char **cmdArgv;
+	CONST char **cmdArgv;
 
         if (Tcl_SplitList(interp, what+1, &cmdObjc, &cmdArgv) != TCL_OK) {
             return TCL_ERROR;
Index: generic/tclIOSock.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclIOSock.c,v
retrieving revision 1.5
diff -u -u -r1.5 tclIOSock.c
--- generic/tclIOSock.c	2000/03/31 08:52:04	1.5
+++ generic/tclIOSock.c	2002/01/25 20:38:06
@@ -43,7 +43,7 @@
 {
     struct servent *sp;		/* Protocol info for named services */
     Tcl_DString ds;
-    char *native;
+    CONST char *native;
 
     if (Tcl_GetInt(NULL, string, portPtr) != TCL_OK) {
 	/*
Index: generic/tclIOUtil.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclIOUtil.c,v
retrieving revision 1.31
diff -u -u -r1.31 tclIOUtil.c
--- generic/tclIOUtil.c	2002/01/25 04:27:26	1.31
+++ generic/tclIOUtil.c	2002/01/25 20:38:06
@@ -984,7 +984,7 @@
                                          * opening of the file. */
 {
     int mode, modeArgc, c, i, gotRW;
-    char **modeArgv, *flag;
+    CONST char **modeArgv, *flag;
 #define RW_MODES (O_RDONLY|O_WRONLY|O_RDWR)
 
     /*
@@ -1596,7 +1596,7 @@
     Tcl_Interp *interp;		/* Interpreter to receive error messages. */
     Tcl_Obj *result;		/* List object to receive results. */
     Tcl_Obj *pathPtr;	        /* Contains path to directory to search. */
-    char *pattern;		/* Pattern to match against. */
+    CONST char *pattern;	/* Pattern to match against. */
     Tcl_GlobTypeData *types;	/* Object containing list of acceptable types.
 				 * May be NULL. In particular the directory
 				 * flag is very important. */
@@ -3502,7 +3502,7 @@
 	/* Do some tilde substitution */
 	if (name[1] == '\0') {
 	    /* We have just '~' */
-	    char *dir;
+	    CONST char *dir;
 	    Tcl_DString dirString;
 	    if (split != len) { name[split] = separator; }
 	    
Index: generic/tclInt.decls
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclInt.decls,v
retrieving revision 1.42
diff -u -u -r1.42 tclInt.decls
--- generic/tclInt.decls	2002/01/17 03:03:12	1.42
+++ generic/tclInt.decls	2002/01/25 20:38:07
@@ -60,7 +60,7 @@
 # TclCreatePipeline unofficially exported for use by BLT.
 
 declare 9 {unix win} {
-    int TclCreatePipeline(Tcl_Interp *interp, int argc, char **argv, \
+    int TclCreatePipeline(Tcl_Interp *interp, int argc, CONST char **argv, \
 	    Tcl_Pid **pidArrayPtr, TclFile *inPipePtr, TclFile *outPipePtr, \
 	    TclFile *errFilePtr)
 }
@@ -530,7 +530,7 @@
 #   int TclpChdir(CONST char *dirName)
 #}
 declare 138 generic {
-    char * TclGetEnv(CONST char *name, Tcl_DString *valuePtr)
+    CONST char * TclGetEnv(CONST char *name, Tcl_DString *valuePtr)
 }
 #declare 139 generic {
 #    int TclpLoadFile(Tcl_Interp *interp, char *fileName, char *sym1, \
@@ -542,7 +542,7 @@
 }
 # This is used by TclX, but should otherwise be considered private
 declare 141 generic {
-    char *TclpGetCwd(Tcl_Interp *interp, Tcl_DString *cwdPtr)
+    CONST char *TclpGetCwd(Tcl_Interp *interp, Tcl_DString *cwdPtr)
 }
 declare 142 generic {
     int TclSetByteCodeFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr, \
@@ -841,7 +841,7 @@
     int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe)
 }
 declare 15 win {
-    int TclpCreateProcess(Tcl_Interp *interp, int argc, char **argv, \
+    int TclpCreateProcess(Tcl_Interp *interp, int argc, CONST char **argv, \
 	    TclFile inputFile, TclFile outputFile, TclFile errorFile, \
 	    Tcl_Pid *pidPtr)
 }
@@ -909,7 +909,7 @@
     int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe)
 }
 declare 4 unix {
-    int TclpCreateProcess(Tcl_Interp *interp, int argc, char **argv, \
+    int TclpCreateProcess(Tcl_Interp *interp, int argc, CONST char **argv, \
 	    TclFile inputFile, TclFile outputFile, TclFile errorFile, \
 	    Tcl_Pid *pidPtr)
 }
Index: generic/tclInt.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclInt.h,v
retrieving revision 1.75
diff -u -u -r1.75 tclInt.h
--- generic/tclInt.h	2002/01/15 21:19:07	1.75
+++ generic/tclInt.h	2002/01/25 20:38:07
@@ -1845,7 +1845,7 @@
 				Tcl_Obj *destPathPtr));
 EXTERN int		TclpMatchInDirectory _ANSI_ARGS_((Tcl_Interp *interp, 
 			        Tcl_Obj *resultPtr, Tcl_Obj *pathPtr, 
-				char *pattern, Tcl_GlobTypeData *types));
+				CONST char *pattern, Tcl_GlobTypeData *types));
 EXTERN Tcl_Obj*		TclpObjGetCwd _ANSI_ARGS_((Tcl_Interp *interp));
 EXTERN Tcl_Obj*		TclpObjLink _ANSI_ARGS_((Tcl_Obj *pathPtr, Tcl_Obj *toPtr));
 EXTERN int		TclpObjChdir _ANSI_ARGS_((Tcl_Obj *pathPtr));
Index: generic/tclIntDecls.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclIntDecls.h,v
retrieving revision 1.35
diff -u -u -r1.35 tclIntDecls.h
--- generic/tclIntDecls.h	2002/01/17 03:03:12	1.35
+++ generic/tclIntDecls.h	2002/01/25 20:38:07
@@ -63,14 +63,14 @@
 #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
 /* 9 */
 EXTERN int		TclCreatePipeline _ANSI_ARGS_((Tcl_Interp * interp, 
-				int argc, char ** argv, 
+				int argc, CONST char ** argv, 
 				Tcl_Pid ** pidArrayPtr, TclFile * inPipePtr, 
 				TclFile * outPipePtr, TclFile * errFilePtr));
 #endif /* UNIX */
 #ifdef __WIN32__
 /* 9 */
 EXTERN int		TclCreatePipeline _ANSI_ARGS_((Tcl_Interp * interp, 
-				int argc, char ** argv, 
+				int argc, CONST char ** argv, 
 				Tcl_Pid ** pidArrayPtr, TclFile * inPipePtr, 
 				TclFile * outPipePtr, TclFile * errFilePtr));
 #endif /* __WIN32__ */
@@ -426,14 +426,14 @@
 /* Slot 136 is reserved */
 /* Slot 137 is reserved */
 /* 138 */
-EXTERN char *		TclGetEnv _ANSI_ARGS_((CONST char * name, 
+EXTERN CONST char *	TclGetEnv _ANSI_ARGS_((CONST char * name, 
 				Tcl_DString * valuePtr));
 /* Slot 139 is reserved */
 /* 140 */
 EXTERN int		TclLooksLikeInt _ANSI_ARGS_((CONST char * bytes, 
 				int length));
 /* 141 */
-EXTERN char *		TclpGetCwd _ANSI_ARGS_((Tcl_Interp * interp, 
+EXTERN CONST char *	TclpGetCwd _ANSI_ARGS_((Tcl_Interp * interp, 
 				Tcl_DString * cwdPtr));
 /* 142 */
 EXTERN int		TclSetByteCodeFromAny _ANSI_ARGS_((
@@ -525,10 +525,10 @@
     int (*tclCopyAndCollapse) _ANSI_ARGS_((int count, CONST char * src, char * dst)); /* 7 */
     int (*tclCopyChannel) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Channel inChan, Tcl_Channel outChan, int toRead, Tcl_Obj * cmdPtr)); /* 8 */
 #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
-    int (*tclCreatePipeline) _ANSI_ARGS_((Tcl_Interp * interp, int argc, char ** argv, Tcl_Pid ** pidArrayPtr, TclFile * inPipePtr, TclFile * outPipePtr, TclFile * errFilePtr)); /* 9 */
+    int (*tclCreatePipeline) _ANSI_ARGS_((Tcl_Interp * interp, int argc, CONST char ** argv, Tcl_Pid ** pidArrayPtr, TclFile * inPipePtr, TclFile * outPipePtr, TclFile * errFilePtr)); /* 9 */
 #endif /* UNIX */
 #ifdef __WIN32__
-    int (*tclCreatePipeline) _ANSI_ARGS_((Tcl_Interp * interp, int argc, char ** argv, Tcl_Pid ** pidArrayPtr, TclFile * inPipePtr, TclFile * outPipePtr, TclFile * errFilePtr)); /* 9 */
+    int (*tclCreatePipeline) _ANSI_ARGS_((Tcl_Interp * interp, int argc, CONST char ** argv, Tcl_Pid ** pidArrayPtr, TclFile * inPipePtr, TclFile * outPipePtr, TclFile * errFilePtr)); /* 9 */
 #endif /* __WIN32__ */
 #ifdef MAC_TCL
     void *reserved9;
@@ -677,10 +677,10 @@
     int (*tclpCheckStackSpace) _ANSI_ARGS_((void)); /* 135 */
     void *reserved136;
     void *reserved137;
-    char * (*tclGetEnv) _ANSI_ARGS_((CONST char * name, Tcl_DString * valuePtr)); /* 138 */
+    CONST char * (*tclGetEnv) _ANSI_ARGS_((CONST char * name, Tcl_DString * valuePtr)); /* 138 */
     void *reserved139;
     int (*tclLooksLikeInt) _ANSI_ARGS_((CONST char * bytes, int length)); /* 140 */
-    char * (*tclpGetCwd) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_DString * cwdPtr)); /* 141 */
+    CONST char * (*tclpGetCwd) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_DString * cwdPtr)); /* 141 */
     int (*tclSetByteCodeFromAny) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, CompileHookProc * hookProc, ClientData clientData)); /* 142 */
     int (*tclAddLiteralObj) _ANSI_ARGS_((struct CompileEnv * envPtr, Tcl_Obj * objPtr, LiteralEntry ** litPtrPtr)); /* 143 */
     void (*tclHideLiteral) _ANSI_ARGS_((Tcl_Interp * interp, struct CompileEnv * envPtr, int index)); /* 144 */
Index: generic/tclIntPlatDecls.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclIntPlatDecls.h,v
retrieving revision 1.14
diff -u -u -r1.14 tclIntPlatDecls.h
--- generic/tclIntPlatDecls.h	2001/11/26 18:06:46	1.14
+++ generic/tclIntPlatDecls.h	2002/01/25 20:38:08
@@ -43,9 +43,9 @@
 				TclFile * writePipe));
 /* 4 */
 EXTERN int		TclpCreateProcess _ANSI_ARGS_((Tcl_Interp * interp, 
-				int argc, char ** argv, TclFile inputFile, 
-				TclFile outputFile, TclFile errorFile, 
-				Tcl_Pid * pidPtr));
+				int argc, CONST char ** argv, 
+				TclFile inputFile, TclFile outputFile, 
+				TclFile errorFile, Tcl_Pid * pidPtr));
 /* Slot 5 is reserved */
 /* 6 */
 EXTERN TclFile		TclpMakeFile _ANSI_ARGS_((Tcl_Channel channel, 
@@ -101,9 +101,9 @@
 				TclFile * writePipe));
 /* 15 */
 EXTERN int		TclpCreateProcess _ANSI_ARGS_((Tcl_Interp * interp, 
-				int argc, char ** argv, TclFile inputFile, 
-				TclFile outputFile, TclFile errorFile, 
-				Tcl_Pid * pidPtr));
+				int argc, CONST char ** argv, 
+				TclFile inputFile, TclFile outputFile, 
+				TclFile errorFile, Tcl_Pid * pidPtr));
 /* Slot 16 is reserved */
 /* Slot 17 is reserved */
 /* 18 */
@@ -209,7 +209,7 @@
     int (*tclpCloseFile) _ANSI_ARGS_((TclFile file)); /* 1 */
     Tcl_Channel (*tclpCreateCommandChannel) _ANSI_ARGS_((TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid * pidPtr)); /* 2 */
     int (*tclpCreatePipe) _ANSI_ARGS_((TclFile * readPipe, TclFile * writePipe)); /* 3 */
-    int (*tclpCreateProcess) _ANSI_ARGS_((Tcl_Interp * interp, int argc, char ** argv, TclFile inputFile, TclFile outputFile, TclFile errorFile, Tcl_Pid * pidPtr)); /* 4 */
+    int (*tclpCreateProcess) _ANSI_ARGS_((Tcl_Interp * interp, int argc, CONST char ** argv, TclFile inputFile, TclFile outputFile, TclFile errorFile, Tcl_Pid * pidPtr)); /* 4 */
     void *reserved5;
     TclFile (*tclpMakeFile) _ANSI_ARGS_((Tcl_Channel channel, int direction)); /* 6 */
     TclFile (*tclpOpenFile) _ANSI_ARGS_((CONST char * fname, int mode)); /* 7 */
@@ -232,7 +232,7 @@
     int (*tclpCloseFile) _ANSI_ARGS_((TclFile file)); /* 12 */
     Tcl_Channel (*tclpCreateCommandChannel) _ANSI_ARGS_((TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid * pidPtr)); /* 13 */
     int (*tclpCreatePipe) _ANSI_ARGS_((TclFile * readPipe, TclFile * writePipe)); /* 14 */
-    int (*tclpCreateProcess) _ANSI_ARGS_((Tcl_Interp * interp, int argc, char ** argv, TclFile inputFile, TclFile outputFile, TclFile errorFile, Tcl_Pid * pidPtr)); /* 15 */
+    int (*tclpCreateProcess) _ANSI_ARGS_((Tcl_Interp * interp, int argc, CONST char ** argv, TclFile inputFile, TclFile outputFile, TclFile errorFile, Tcl_Pid * pidPtr)); /* 15 */
     void *reserved16;
     void *reserved17;
     TclFile (*tclpMakeFile) _ANSI_ARGS_((Tcl_Channel channel, int direction)); /* 18 */
Index: generic/tclLink.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclLink.c,v
retrieving revision 1.3
diff -u -u -r1.3 tclLink.c
--- generic/tclLink.c	1999/04/16 00:46:49	1.3
+++ generic/tclLink.c	2002/01/25 20:38:08
@@ -235,7 +235,8 @@
     Link *linkPtr = (Link *) clientData;
     int changed;
     char buffer[TCL_DOUBLE_SPACE];
-    char *value, **pp, *result;
+    CONST char *value;
+    char **pp, *result;
     Tcl_Obj *objPtr;
 
     /*
@@ -364,7 +365,7 @@
 	    strcpy(*pp, value);
 	    break;
 	default:
-	    return "internal error: bad linked variable type";
+	    result = "internal error: bad linked variable type";
     }
     end:
     Tcl_DecrRefCount(objPtr);
Index: generic/tclMain.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclMain.c,v
retrieving revision 1.16
diff -u -u -r1.16 tclMain.c
--- generic/tclMain.c	2002/01/07 17:54:52	1.16
+++ generic/tclMain.c	2002/01/25 20:38:08
@@ -242,7 +242,14 @@
 	    argv++;
 	}
     }
-    args = Tcl_Merge(argc-1, argv+1);
+
+    /*
+     * The CONST casting is safe, and better we do it here than force
+     * all callers of Tcl_Main to do it.  (Those callers are likely
+     * in a main() that can't easily change its signature.)
+     */
+    
+    args = Tcl_Merge(argc-1, (CONST char **)argv+1);
     Tcl_ExternalToUtfDString(NULL, args, -1, &argString);
     Tcl_SetVar(interp, "argv", Tcl_DStringValue(&argString), TCL_GLOBAL_ONLY);
     Tcl_DStringFree(&argString);
Index: generic/tclNamesp.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclNamesp.c,v
retrieving revision 1.26
diff -u -u -r1.26 tclNamesp.c
--- generic/tclNamesp.c	2002/01/17 04:37:33	1.26
+++ generic/tclNamesp.c	2002/01/25 20:38:09
@@ -720,7 +720,8 @@
 	 * variables, in case they had any traces on them.
 	 */
     
-        char *str, *errorInfoStr, *errorCodeStr;
+        CONST char *str;
+        char *errorInfoStr, *errorCodeStr;
 
         str = Tcl_GetVar((Tcl_Interp *) iPtr, "errorInfo", TCL_GLOBAL_ONLY);
         if (str != NULL) {
Index: generic/tclPipe.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclPipe.c,v
retrieving revision 1.4
diff -u -u -r1.4 tclPipe.c
--- generic/tclPipe.c	2002/01/15 21:19:07	1.4
+++ generic/tclPipe.c	2002/01/25 20:38:09
@@ -39,8 +39,9 @@
  */
 
 static TclFile	FileForRedirect _ANSI_ARGS_((Tcl_Interp *interp,
-	            char *spec, int atOk, char *arg, char *nextArg, 
-		    int flags, int *skipPtr, int *closePtr, int *releasePtr));
+	            CONST char *spec, int atOk, CONST char *arg, 
+		    CONST char *nextArg, int flags, int *skipPtr,
+		    int *closePtr, int *releasePtr));
 
 /*
  *----------------------------------------------------------------------
@@ -67,14 +68,14 @@
 FileForRedirect(interp, spec, atOK, arg, nextArg, flags, skipPtr, closePtr,
 	releasePtr)
     Tcl_Interp *interp;		/* Intepreter to use for error reporting. */
-    char *spec;			/* Points to character just after
+    CONST char *spec;			/* Points to character just after
 				 * redirection character. */
-    char *arg;			/* Pointer to entire argument containing 
+    CONST char *arg;		/* Pointer to entire argument containing 
 				 * spec:  used for error reporting. */
     int atOK;			/* Non-zero means that '@' notation can be 
 				 * used to specify a channel, zero means that
 				 * it isn't. */
-    char *nextArg;		/* Next argument in argc/argv array, if needed 
+    CONST char *nextArg;	/* Next argument in argc/argv array, if needed 
 				 * for file name or channel name.  May be 
 				 * NULL. */
     int flags;			/* Flags to use for opening file or to 
@@ -123,7 +124,7 @@
             Tcl_Flush(chan);
 	}
     } else {
-	char *name;
+	CONST char *name;
 	Tcl_DString nameString;
 
 	if (*spec == '\0') {
@@ -439,7 +440,7 @@
 	outPipePtr, errFilePtr)
     Tcl_Interp *interp;		/* Interpreter to use for error reporting. */
     int argc;			/* Number of entries in argv. */
-    char **argv;		/* Array of strings describing commands in
+    CONST char **argv;		/* Array of strings describing commands in
 				 * pipeline plus I/O redirection with <,
 				 * <<,  >, etc.  Argv[argc] must be NULL. */
     Tcl_Pid **pidArrayPtr;	/* Word at *pidArrayPtr gets filled in with
@@ -476,7 +477,7 @@
 				 * at *pidPtr right now. */
     int cmdCount;		/* Count of number of distinct commands
 				 * found in argc/argv. */
-    char *inputLiteral = NULL;	/* If non-null, then this points to a
+    CONST char *inputLiteral = NULL;	/* If non-null, then this points to a
 				 * string containing input data (specified
 				 * via <<) to be piped to the first process
 				 * in the pipeline. */
@@ -498,7 +499,7 @@
     int errorClose = 0;		/* If non-zero, then errorFile should be 
     				 * closed when cleaning up. */
     int errorRelease = 0;
-    char *p;
+    CONST char *p;
     int skip, lastBar, lastArg, i, j, atOK, flags, errorToOutput;
     Tcl_DString execBuffer;
     TclFile pipeIn;
@@ -802,7 +803,7 @@
     for (i = 0; i < argc; i = lastArg + 1) { 
 	int result, joinThisError;
 	Tcl_Pid pid;
-	char *oldName;
+	CONST char *oldName;
 
 	/*
 	 * Convert the program name into native form. 
@@ -992,7 +993,7 @@
     Tcl_Interp *interp;		/* Interpreter for error reporting. Can
                                  * NOT be NULL. */
     int argc;			/* How many arguments. */
-    char **argv;		/* Array of arguments for command pipe. */
+    CONST char **argv;		/* Array of arguments for command pipe. */
     int flags;			/* Or'ed combination of TCL_STDIN, TCL_STDOUT,
 				 * TCL_STDERR, and TCL_ENFORCE_MODE. */
 {
Index: generic/tclPlatDecls.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclPlatDecls.h,v
retrieving revision 1.12
diff -u -u -r1.12 tclPlatDecls.h
--- generic/tclPlatDecls.h	2001/09/09 22:45:13	1.12
+++ generic/tclPlatDecls.h	2002/01/25 20:38:09
@@ -49,12 +49,12 @@
 				Handle resource));
 /* 2 */
 EXTERN int		Tcl_MacEvalResource _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * resourceName, int resourceNumber, 
-				char * fileName));
+				CONST char * resourceName, 
+				int resourceNumber, CONST char * fileName));
 /* 3 */
 EXTERN Handle		Tcl_MacFindResource _ANSI_ARGS_((Tcl_Interp * interp, 
-				long resourceType, char * resourceName, 
-				int resourceNumber, char * resFileRef, 
+				long resourceType, CONST char * resourceName, 
+				int resourceNumber, CONST char * resFileRef, 
 				int * releaseIt));
 /* 4 */
 EXTERN int		Tcl_GetOSTypeFromObj _ANSI_ARGS_((
@@ -84,8 +84,8 @@
 #ifdef MAC_TCL
     void (*tcl_MacSetEventProc) _ANSI_ARGS_((Tcl_MacConvertEventPtr procPtr)); /* 0 */
     char * (*tcl_MacConvertTextResource) _ANSI_ARGS_((Handle resource)); /* 1 */
-    int (*tcl_MacEvalResource) _ANSI_ARGS_((Tcl_Interp * interp, char * resourceName, int resourceNumber, char * fileName)); /* 2 */
-    Handle (*tcl_MacFindResource) _ANSI_ARGS_((Tcl_Interp * interp, long resourceType, char * resourceName, int resourceNumber, char * resFileRef, int * releaseIt)); /* 3 */
+    int (*tcl_MacEvalResource) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * resourceName, int resourceNumber, CONST char * fileName)); /* 2 */
+    Handle (*tcl_MacFindResource) _ANSI_ARGS_((Tcl_Interp * interp, long resourceType, CONST char * resourceName, int resourceNumber, CONST char * resFileRef, int * releaseIt)); /* 3 */
     int (*tcl_GetOSTypeFromObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, OSType * osTypePtr)); /* 4 */
     void (*tcl_SetOSTypeObj) _ANSI_ARGS_((Tcl_Obj * objPtr, OSType osType)); /* 5 */
     Tcl_Obj * (*tcl_NewOSTypeObj) _ANSI_ARGS_((OSType osType)); /* 6 */
Index: generic/tclProc.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclProc.c,v
retrieving revision 1.35
diff -u -u -r1.35 tclProc.c
--- generic/tclProc.c	2001/12/10 15:44:34	1.35
+++ generic/tclProc.c	2002/01/25 20:38:09
@@ -235,11 +235,11 @@
     Proc **procPtrPtr;          /* returns:  pointer to proc data */
 {
     Interp *iPtr = (Interp*)interp;
-    char **argArray = NULL;
+    CONST char **argArray = NULL;
 
     register Proc *procPtr;
     int i, length, result, numArgs;
-    char *args, *bytes, *p;
+    CONST char *args, *bytes, *p;
     register CompiledLocal *localPtr = NULL;
     Tcl_Obj *defPtr;
     int precompiled = 0;
@@ -335,7 +335,7 @@
     }
     for (i = 0;  i < numArgs;  i++) {
         int fieldCount, nameLength, valueLength;
-        char **fieldValues;
+        CONST char **fieldValues;
 
         /*
          * Now divide the specifier up into name and default.
@@ -375,7 +375,7 @@
         p = fieldValues[0];
         while (*p != '\0') {
             if (*p == '(') {
-                char *q = p;
+                CONST char *q = p;
                 do {
 		    q++;
 		} while (*q != '\0');
Index: generic/tclResult.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclResult.c,v
retrieving revision 1.4
diff -u -u -r1.4 tclResult.c
--- generic/tclResult.c	1999/10/21 02:16:22	1.4
+++ generic/tclResult.c	2002/01/25 20:38:09
@@ -297,7 +297,7 @@
  *----------------------------------------------------------------------
  */
 
-char *
+CONST char *
 Tcl_GetStringResult(interp)
      register Tcl_Interp *interp; /* Interpreter whose result to return. */
 {
Index: generic/tclTest.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclTest.c,v
retrieving revision 1.40
diff -u -u -r1.40 tclTest.c
--- generic/tclTest.c	2002/01/21 21:05:58	1.40
+++ generic/tclTest.c	2002/01/25 20:38:10
@@ -341,7 +341,7 @@
 			    CONST char *modeString, int permissions));
 static int		TestReportMatchInDirectory _ANSI_ARGS_ ((
 			    Tcl_Interp *interp, Tcl_Obj *resultPtr,
-			    Tcl_Obj *dirPtr, char *pattern,
+			    Tcl_Obj *dirPtr, CONST char *pattern,
 			    Tcl_GlobTypeData *types));
 static int		TestReportChdir _ANSI_ARGS_ ((Tcl_Obj *dirName));
 static int		TestReportLstat _ANSI_ARGS_ ((Tcl_Obj *path,
@@ -753,12 +753,12 @@
     int code;			/* Current return code from command. */
 {
     TestAsyncHandler *asyncPtr = (TestAsyncHandler *) clientData;
-    char *listArgv[4];
+    CONST char *listArgv[4];
     char string[TCL_INTEGER_SPACE], *cmd;
 
     TclFormatInt(string, code);
     listArgv[0] = asyncPtr->command;
-    listArgv[1] = Tcl_GetStringResult(interp);
+    listArgv[1] = Tcl_GetString(Tcl_GetObjResult(interp));
     listArgv[2] = string;
     listArgv[3] = NULL;
     cmd = Tcl_Merge(3, listArgv);
@@ -2841,7 +2841,8 @@
 	
 	Tcl_SetIntObj(Tcl_GetObjResult(interp), 0);
 	if (objc > 2 && (cflags&REG_EXPECT) && indices) {
-	    char *varName, *value;
+	    char *varName;
+	    CONST char *value;
 	    int start, end;
 	    char info[TCL_INTEGER_SPACE * 2];
 
@@ -3254,7 +3255,7 @@
     char **argv;			/* Argument strings. */
 {
     Tcl_DString buffer;
-    char *result;
+    CONST char *result;
 
     if (argc != 2) {
 	Tcl_AppendResult(interp, "wrong # arguments: should be \"",
@@ -3466,7 +3467,7 @@
      *  Append all of the arguments together separated by spaces
      */
 
-    argString = Tcl_Merge(argc-1, argv+1);
+    argString = Tcl_Merge(argc-1, (CONST char **) argv+1);
     panic(argString);
     ckfree(argString);
  
@@ -3516,13 +3517,14 @@
 
     for (i = 2; i < argc; i++) {
         Tcl_DString buffer;
+	CONST char *translated;
         
-        argv[i] = Tcl_TranslateFileName(interp, argv[i], &buffer);
-        if (argv[i] == NULL) {
+        translated = Tcl_TranslateFileName(interp, argv[i], &buffer);
+        if (translated == NULL) {
             return TCL_ERROR;
         }
-	if (chmod(argv[i], (unsigned) mode) != 0) {
-	    Tcl_AppendResult(interp, argv[i], ": ", Tcl_PosixError(interp),
+	if (chmod(translated, (unsigned) mode) != 0) {
+	    Tcl_AppendResult(interp, translated, ": ", Tcl_PosixError(interp),
 		    (char *) NULL);
 	    return TCL_ERROR;
 	}
@@ -3707,7 +3709,7 @@
     Tcl_Time start, stop;
     Tcl_Obj *objPtr;
     Tcl_Obj **objv;
-    char *s;
+    CONST char *s;
     char newString[TCL_INTEGER_SPACE];
 
     /* alloc & free 100000 times */
@@ -3937,7 +3939,7 @@
     char **argv;			/* Argument strings. */
 {
     int flags = (int) data;
-    char *value;
+    CONST char *value;
 
     if (argc == 2) {
         Tcl_SetResult(interp, "before get", TCL_STATIC);
@@ -4549,7 +4551,7 @@
                                          * file, with what modes to create
                                          * it? */
 {
-    char *expectname="testOpenFileChannel1%.fil";
+    CONST char *expectname="testOpenFileChannel1%.fil";
     Tcl_DString ds;
     
     Tcl_DStringInit(&ds);
@@ -4577,7 +4579,7 @@
                                          * file, with what modes to create
                                          * it? */
 {
-    char *expectname="testOpenFileChannel2%.fil";
+    CONST char *expectname="testOpenFileChannel2%.fil";
     Tcl_DString ds;
     
     Tcl_DStringInit(&ds);
@@ -4605,7 +4607,7 @@
                                          * file, with what modes to create
                                          * it? */
 {
-    char *expectname="testOpenFileChannel3%.fil";
+    CONST char *expectname="testOpenFileChannel3%.fil";
     Tcl_DString ds;
     
     Tcl_DStringInit(&ds);
@@ -5552,7 +5554,7 @@
     Tcl_Interp *interp;		/* Interpreter to receive results. */
     Tcl_Obj *resultPtr;		/* Directory separators to pass to TclDoGlob. */
     Tcl_Obj *dirPtr;	        /* Contains path to directory to search. */
-    char *pattern;		/* Pattern to match against. */
+    CONST char *pattern;	/* Pattern to match against. */
     Tcl_GlobTypeData *types;	/* Object containing list of acceptable types.
 				 * May be NULL. */
 {
Index: generic/tclThreadTest.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclThreadTest.c,v
retrieving revision 1.14
diff -u -u -r1.14 tclThreadTest.c
--- generic/tclThreadTest.c	2002/01/18 03:22:31	1.14
+++ generic/tclThreadTest.c	2002/01/25 20:38:11
@@ -546,8 +546,8 @@
     Tcl_Interp *interp;		/* Interp that failed */
 {
     Tcl_Channel errChannel;
-    char *errorInfo, *script;
-    char *argv[3];
+    CONST char *errorInfo, *argv[3];
+    char *script;
     char buf[TCL_DOUBLE_SPACE+1];
     sprintf(buf, "%ld", (long) Tcl_GetCurrentThread());
 
@@ -853,7 +853,7 @@
     ThreadEventResult *resultPtr = threadEventPtr->resultPtr;
     Tcl_Interp *interp = tsdPtr->interp;
     int code;
-    char *result, *errorCode, *errorInfo;
+    CONST char *result, *errorCode, *errorInfo;
 
     if (interp == NULL) {
 	code = TCL_ERROR;
Index: generic/tclUtil.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclUtil.c,v
retrieving revision 1.27
diff -u -u -r1.27 tclUtil.c
--- generic/tclUtil.c	2002/01/02 13:52:04	1.27
+++ generic/tclUtil.c	2002/01/25 20:38:11
@@ -420,10 +420,10 @@
     CONST char *list;		/* Pointer to string with list structure. */
     int *argcPtr;		/* Pointer to location to fill in with
 				 * the number of elements in the list. */
-    char ***argvPtr;		/* Pointer to place to store pointer to
+    CONST char ***argvPtr;	/* Pointer to place to store pointer to
 				 * array of pointers to list elements. */
 {
-    char **argv;
+    CONST char **argv;
     CONST char *l;
     char *p;
     int length, size, i, result, elSize, brace;
@@ -442,7 +442,7 @@
 	}
     }
     size++;			/* Leave space for final NULL pointer. */
-    argv = (char **) ckalloc((unsigned)
+    argv = (CONST char **) ckalloc((unsigned)
 	    ((size * sizeof(char *)) + (l - list) + 1));
     length = strlen(list);
     for (i = 0, p = ((char *) argv) + size*sizeof(char *);
@@ -847,7 +847,7 @@
 char *
 Tcl_Merge(argc, argv)
     int argc;			/* How many strings to merge. */
-    char * CONST *argv;		/* Array of string values. */
+    CONST char * CONST *argv;	/* Array of string values. */
 {
 #   define LOCAL_SIZE 20
     int localFlags[LOCAL_SIZE], *flagPtr;
@@ -950,7 +950,7 @@
 char *
 Tcl_Concat(argc, argv)
     int argc;			/* Number of strings to concatenate. */
-    char * CONST *argv;		/* Array of strings to concatenate. */
+    CONST char * CONST *argv;	/* Array of strings to concatenate. */
 {
     int totalSize, i;
     char *p;
@@ -1882,7 +1882,8 @@
     char *name2;		/* Second part of variable name. */
     int flags;			/* Information about what happened. */
 {
-    char *value, *end;
+    CONST char *value;
+    char *end;
     int prec;
 
     /*
Index: generic/tclVar.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclVar.c,v
retrieving revision 1.45
diff -u -u -r1.45 tclVar.c
--- generic/tclVar.c	2002/01/17 04:37:33	1.45
+++ generic/tclVar.c	2002/01/25 20:38:12
@@ -474,7 +474,7 @@
  *----------------------------------------------------------------------
  */
 
-char *
+CONST char *
 Tcl_GetVar(interp, varName, flags)
     Tcl_Interp *interp;		/* Command interpreter in which varName is
 				 * to be looked up. */
@@ -509,7 +509,7 @@
  *----------------------------------------------------------------------
  */
 
-char *
+CONST char *
 Tcl_GetVar2(interp, part1, part2, flags)
     Tcl_Interp *interp;		/* Command interpreter in which variable is
 				 * to be looked up. */
@@ -1063,12 +1063,12 @@
  *----------------------------------------------------------------------
  */
 
-char *
+CONST char *
 Tcl_SetVar(interp, varName, newValue, flags)
     Tcl_Interp *interp;		/* Command interpreter in which varName is
 				 * to be looked up. */
     char *varName;		/* Name of a variable in interp. */
-    char *newValue;		/* New value for varName. */
+    CONST char *newValue;	/* New value for varName. */
     int flags;			/* Various flags that tell how to set value:
 				 * any of TCL_GLOBAL_ONLY,
 				 * TCL_NAMESPACE_ONLY, TCL_APPEND_VALUE,
@@ -1104,7 +1104,7 @@
  *----------------------------------------------------------------------
  */
 
-char *
+CONST char *
 Tcl_SetVar2(interp, part1, part2, newValue, flags)
     Tcl_Interp *interp;         /* Command interpreter in which variable is
                                  * to be looked up. */
@@ -1113,7 +1113,7 @@
                                  * an array. */
     char *part2;                /* Name of an element within an array, or
 				 * NULL. */
-    char *newValue;             /* New value for variable. */
+    CONST char *newValue;       /* New value for variable. */
     int flags;                  /* Various flags that tell how to set value:
 				 * any of TCL_GLOBAL_ONLY,
 				 * TCL_NAMESPACE_ONLY, TCL_APPEND_VALUE,
Index: mac/tclMacFCmd.c
===================================================================
RCS file: /cvsroot/tcl/tcl/mac/tclMacFCmd.c,v
retrieving revision 1.13
diff -u -u -r1.13 tclMacFCmd.c
--- mac/tclMacFCmd.c	2002/01/18 03:22:40	1.13
+++ mac/tclMacFCmd.c	2002/01/25 20:38:12
@@ -1027,7 +1027,7 @@
     char *dirName;
     OSErr err;
     int argc;
-    char **argv;
+    CONST char **argv;
     long d;
     Tcl_DString buffer;
         
Index: mac/tclMacFile.c
===================================================================
RCS file: /cvsroot/tcl/tcl/mac/tclMacFile.c,v
retrieving revision 1.14
diff -u -u -r1.14 tclMacFile.c
--- mac/tclMacFile.c	2002/01/18 03:22:52	1.14
+++ mac/tclMacFile.c	2002/01/25 20:38:13
@@ -128,7 +128,7 @@
     Tcl_Interp *interp;		/* Interpreter to receive errors. */
     Tcl_Obj *resultPtr;		/* List object to lappend results. */
     Tcl_Obj *pathPtr;	        /* Contains path to directory to search. */
-    char *pattern;		/* Pattern to match against. */
+    CONST char *pattern;	/* Pattern to match against. */
     Tcl_GlobTypeData *types;	/* Object containing list of acceptable types.
 				 * May be NULL. In particular the directory
 				 * flag is very important. */
@@ -541,7 +541,7 @@
     }
 }
 
-char *
+CONST char *
 TclpGetCwd(
     Tcl_Interp *interp,		/* If non-NULL, used for error reporting. */
     Tcl_DString *bufferPtr)	/* Uninitialized or free DString filled
Index: mac/tclMacInit.c
===================================================================
RCS file: /cvsroot/tcl/tcl/mac/tclMacInit.c,v
retrieving revision 1.6
diff -u -u -r1.6 tclMacInit.c
--- mac/tclMacInit.c	2001/12/27 22:46:19	1.6
+++ mac/tclMacInit.c	2002/01/25 20:38:13
@@ -354,7 +354,7 @@
 				 * by querying the module handle. */
 {
     Tcl_Obj *objPtr, *pathPtr;
-    char *str;
+    CONST char *str;
     Tcl_DString ds;
     
     TclMacCreateEnv();
@@ -395,7 +395,7 @@
     str = TclGetEnv("EXT_FOLDER", &ds);
     if ((str != NULL) && (str[0] != '\0')) {
 	    Tcl_DString libPath, path;
-	    char *argv[3];
+	    CONST char *argv[3];
 	    
 	    argv[0] = str;
 	    argv[1] = "Tool Command Language";	    
@@ -739,7 +739,7 @@
     Tcl_Interp *interp)		/* Interpreter to source rc file into. */
 {
     Tcl_DString temp;
-    char *fileName;
+    CONST char *fileName;
     Tcl_Channel errChannel;
     Handle h;
 
@@ -747,7 +747,7 @@
 
     if (fileName != NULL) {
         Tcl_Channel c;
-	char *fullName;
+	CONST char *fullName;
 
         Tcl_DStringInit(&temp);
 	fullName = Tcl_TranslateFileName(interp, fileName, &temp);
Index: mac/tclMacOSA.c
===================================================================
RCS file: /cvsroot/tcl/tcl/mac/tclMacOSA.c,v
retrieving revision 1.7
diff -u -u -r1.7 tclMacOSA.c
--- mac/tclMacOSA.c	2001/11/23 01:27:57	1.7
+++ mac/tclMacOSA.c	2002/01/25 20:38:13
@@ -2068,7 +2068,7 @@
     char idStr[16 + TCL_INTEGER_SPACE];
     FSSpec fileSpec;
     Tcl_DString buffer;
-    char *nativeName;
+    CONST char *nativeName;
     OSErr myErr = noErr;
     OSAID scriptID;
     Size scriptSize;
@@ -2287,7 +2287,7 @@
     char idStr[16 + TCL_INTEGER_SPACE];
     FSSpec fileSpec;
     Tcl_DString buffer;
-    char *nativeName;
+    CONST char *nativeName;
 
     saveRef = CurResFile();
 	
Index: mac/tclMacResource.c
===================================================================
RCS file: /cvsroot/tcl/tcl/mac/tclMacResource.c,v
retrieving revision 1.9
diff -u -u -r1.9 tclMacResource.c
--- mac/tclMacResource.c	2002/01/18 03:23:02	1.9
+++ mac/tclMacResource.c	2002/01/25 20:38:14
@@ -1235,10 +1235,10 @@
 int
 Tcl_MacEvalResource(
     Tcl_Interp *interp,		/* Interpreter in which to process file. */
-    char *resourceName,		/* Name of TEXT resource to source,
+    CONST char *resourceName,	/* Name of TEXT resource to source,
 				   NULL if number should be used. */
     int resourceNumber,		/* Resource id of source. */
-    char *fileName)		/* Name of file to process.
+    CONST char *fileName)	/* Name of file to process.
 				   NULL if application resource. */
 {
     Handle sourceText;
@@ -1249,7 +1249,7 @@
     char idStr[64];
     FSSpec fileSpec;
     Tcl_DString buffer;
-    char *nativeName;
+    CONST char *nativeName;
 
     saveRef = CurResFile();
 	
@@ -1420,10 +1420,10 @@
 Tcl_MacFindResource(
     Tcl_Interp *interp,		/* Interpreter in which to process file. */
     long resourceType,		/* Type of resource to load. */
-    char *resourceName,		/* Name of resource to find,
+    CONST char *resourceName,	/* Name of resource to find,
 				 * NULL if number should be used. */
     int resourceNumber,		/* Resource id of source. */
-    char *resFileRef,		/* Registered resource file reference,
+    CONST char *resFileRef,	/* Registered resource file reference,
 				 * NULL if searching all open resource files. */
     int *releaseIt)	        /* Should we release this resource when done. */
 {
@@ -1462,15 +1462,17 @@
 	    resource = GetResource(resourceType, resourceNumber);
 	}
     } else {
-	c2pstr(resourceName);
+	Tcl_DString ds;
+	char *native = Tcl_UtfToExternalDString(NULL, resourceName, -1, &ds);
+	c2pstr(native);
 	if (limitSearch) {
 	    resource = Get1NamedResource(resourceType,
-		    (StringPtr) resourceName);
+		    (StringPtr) native);
 	} else {
 	    resource = GetNamedResource(resourceType,
 		    (StringPtr) resourceName);
 	}
-	p2cstr((StringPtr) resourceName);
+	Tcl_DStringFree(&ds);
     }
     
     if (*resource == NULL) {
Index: unix/tclUnixFCmd.c
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/tclUnixFCmd.c,v
retrieving revision 1.14
diff -u -u -r1.14 tclUnixFCmd.c
--- unix/tclUnixFCmd.c	2002/01/17 04:37:33	1.14
+++ unix/tclUnixFCmd.c	2002/01/25 20:38:15
@@ -1647,7 +1647,7 @@
 	if ((cur == '/' || cur == 0) && (path != currentPathEndPosition)) {
 	    /* Reached directory separator, or end of string */
 	    Tcl_DString ds;
-	    char *nativePath;
+	    CONST char *nativePath;
 	    int accessOk;
 
 	    nativePath = Tcl_UtfToExternalDString(NULL, path, 
Index: unix/tclUnixFile.c
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/tclUnixFile.c,v
retrieving revision 1.14
diff -u -u -r1.14 tclUnixFile.c
--- unix/tclUnixFile.c	2002/01/17 04:37:33	1.14
+++ unix/tclUnixFile.c	2002/01/25 20:38:15
@@ -196,12 +196,12 @@
     Tcl_Interp *interp;		/* Interpreter to receive errors. */
     Tcl_Obj *resultPtr;		/* List object to lappend results. */
     Tcl_Obj *pathPtr;	        /* Contains path to directory to search. */
-    char *pattern;		/* Pattern to match against. */
+    CONST char *pattern;	/* Pattern to match against. */
     Tcl_GlobTypeData *types;	/* Object containing list of acceptable types.
 				 * May be NULL. In particular the directory
 				 * flag is very important. */
 {
-    char *native, *fname, *dirName;
+    CONST char *native, *fname, *dirName;
     DIR *d;
     Tcl_DString ds;
     struct stat statBuf;
@@ -294,7 +294,7 @@
 
     while (1) {
         Tcl_DString utfDs;
-	char *utf;
+	CONST char *utf;
 	struct dirent *entryPtr;
 	
 	entryPtr = readdir(d);				/* INTL: Native. */
@@ -460,7 +460,7 @@
 {
     struct passwd *pwPtr;
     Tcl_DString ds;
-    char *native;
+    CONST char *native;
 
     native = Tcl_UtfToExternalDString(NULL, name, -1, &ds);
     pwPtr = getpwnam(native);				/* INTL: Native. */
@@ -598,7 +598,7 @@
 }
 
 /* Older string based version */
-char *
+CONST char *
 TclpGetCwd(interp, bufferPtr)
     Tcl_Interp *interp;		/* If non-NULL, used for error reporting. */
     Tcl_DString *bufferPtr;	/* Uninitialized or free DString filled
@@ -649,7 +649,7 @@
 {
     char link[MAXPATHLEN];
     int length;
-    char *native;
+    CONST char *native;
     Tcl_DString ds;
 
     native = Tcl_UtfToExternalDString(NULL, path, -1, &ds);
Index: unix/tclUnixInit.c
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/tclUnixInit.c,v
retrieving revision 1.28
diff -u -u -r1.28 tclUnixInit.c
--- unix/tclUnixInit.c	2001/11/20 09:24:55	1.28
+++ unix/tclUnixInit.c	2002/01/25 20:38:15
@@ -236,10 +236,10 @@
 {
 #define LIBRARY_SIZE	    32
     Tcl_Obj *pathPtr, *objPtr;
-    char *str;
+    CONST char *str;
     Tcl_DString buffer, ds;
     int pathc;
-    char **pathv;
+    CONST char **pathv;
     char installLib[LIBRARY_SIZE], developLib[LIBRARY_SIZE];
 
     Tcl_DStringInit(&ds);
@@ -679,7 +679,7 @@
     struct utsname name;
 #endif
     int unameOK;
-    char *user;
+    CONST char *user;
     Tcl_DString ds;
 
     Tcl_SetVar(interp, "tclDefaultLibrary", defaultLibraryDir, TCL_GLOBAL_ONLY);
@@ -688,7 +688,7 @@
     unameOK = 0;
 #ifndef NO_UNAME
     if (uname(&name) >= 0) {
-	char *native;
+	CONST char *native;
 	
 	unameOK = 1;
 
@@ -863,14 +863,14 @@
     Tcl_Interp *interp;		/* Interpreter to source rc file into. */
 {
     Tcl_DString temp;
-    char *fileName;
+    CONST char *fileName;
     Tcl_Channel errChannel;
 
     fileName = Tcl_GetVar(interp, "tcl_rcFileName", TCL_GLOBAL_ONLY);
 
     if (fileName != NULL) {
         Tcl_Channel c;
-	char *fullName;
+	CONST char *fullName;
 
         Tcl_DStringInit(&temp);
 	fullName = Tcl_TranslateFileName(interp, fileName, &temp);
Index: unix/tclUnixPipe.c
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/tclUnixPipe.c,v
retrieving revision 1.18
diff -u -u -r1.18 tclUnixPipe.c
--- unix/tclUnixPipe.c	2002/01/15 17:55:30	1.18
+++ unix/tclUnixPipe.c	2002/01/25 20:38:15
@@ -136,7 +136,7 @@
     int mode;			/* In what mode to open the file? */
 {
     int fd;
-    char *native;
+    CONST char *native;
     Tcl_DString ds;
 
     native = Tcl_UtfToExternalDString(NULL, fname, -1, &ds);
@@ -186,7 +186,8 @@
 TclpCreateTempFile(contents)
     CONST char *contents;	/* String to write into temp file, or NULL. */
 {
-    char fileName[L_tmpnam + 9], *native;
+    char fileName[L_tmpnam + 9];
+    CONST char *native;
     Tcl_DString dstring;
     int fd;
 
@@ -367,7 +368,7 @@
 				 * Error messages from the child process
 				 * itself are sent to errorFile. */
     int argc;			/* Number of arguments in following array. */
-    char **argv;		/* Array of argument strings in UTF-8.
+    CONST char **argv;		/* Array of argument strings in UTF-8.
 				 * argv[0] contains the name of the executable
 				 * translated using Tcl_TranslateFileName
 				 * call).  Additional arguments have not been
@@ -420,7 +421,8 @@
     newArgv = (char **) ckalloc((argc+1) * sizeof(char *));
     newArgv[argc] = NULL;
     for (i = 0; i < argc; i++) {
-	newArgv[i] = Tcl_UtfToExternalDString(NULL, argv[i], -1, &dsArray[i]);
+	Tcl_UtfToExternalDString(NULL, argv[i], -1, &dsArray[i]);
+	newArgv[i] = Tcl_DStringValue(&dsArray[i]);
     }
 
     joinThisError = errorFile && (errorFile == outputFile);
Index: win/tclWinFile.c
===================================================================
RCS file: /cvsroot/tcl/tcl/win/tclWinFile.c,v
retrieving revision 1.22
diff -u -u -r1.22 tclWinFile.c
--- win/tclWinFile.c	2002/01/24 01:34:16	1.22
+++ win/tclWinFile.c	2002/01/25 20:38:15
@@ -114,7 +114,7 @@
     Tcl_Interp *interp;		/* Interpreter to receive errors. */
     Tcl_Obj *resultPtr;		/* List object to lappend results. */
     Tcl_Obj *pathPtr;	        /* Contains path to directory to search. */
-    char *pattern;		/* Pattern to match against. */
+    CONST char *pattern;	/* Pattern to match against. */
     Tcl_GlobTypeData *types;	/* Object containing list of acceptable types.
 				 * May be NULL. In particular the directory
 				 * flag is very important. */
@@ -775,7 +775,7 @@
  *----------------------------------------------------------------------
  */
 
-char *
+CONST char *
 TclpGetCwd(interp, bufferPtr)
     Tcl_Interp *interp;		/* If non-NULL, used for error reporting. */
     Tcl_DString *bufferPtr;	/* Uninitialized or free DString filled
Index: win/tclWinInit.c
===================================================================
RCS file: /cvsroot/tcl/tcl/win/tclWinInit.c,v
retrieving revision 1.31
diff -u -u -r1.31 tclWinInit.c
--- win/tclWinInit.c	2001/10/01 20:58:52	1.31
+++ win/tclWinInit.c	2002/01/25 20:38:16
@@ -172,10 +172,10 @@
 {
 #define LIBRARY_SIZE	    32
     Tcl_Obj *pathPtr, *objPtr;
-    char *str;
+    CONST char *str;
     Tcl_DString ds;
     int pathc;
-    char **pathv;
+    CONST char **pathv;
     char installLib[LIBRARY_SIZE], developLib[LIBRARY_SIZE];
 
     Tcl_DStringInit(&ds);
@@ -562,7 +562,7 @@
 TclpSetVariables(interp)
     Tcl_Interp *interp;		/* Interp to initialize. */	
 {	    
-    char *ptr;
+    CONST char *ptr;
     char buffer[TCL_INTEGER_SPACE * 2];
     SYSTEM_INFO sysInfo;
     OemId *oemId;
@@ -791,14 +791,14 @@
     Tcl_Interp *interp;		/* Interpreter to source rc file into. */
 {
     Tcl_DString temp;
-    char *fileName;
+    CONST char *fileName;
     Tcl_Channel errChannel;
 
     fileName = Tcl_GetVar(interp, "tcl_rcFileName", TCL_GLOBAL_ONLY);
 
     if (fileName != NULL) {
         Tcl_Channel c;
-	char *fullName;
+	CONST char *fullName;
 
         Tcl_DStringInit(&temp);
 	fullName = Tcl_TranslateFileName(interp, fileName, &temp);
Index: win/tclWinPipe.c
===================================================================
RCS file: /cvsroot/tcl/tcl/win/tclWinPipe.c,v
retrieving revision 1.21
diff -u -u -r1.21 tclWinPipe.c
--- win/tclWinPipe.c	2002/01/15 17:55:31	1.21
+++ win/tclWinPipe.c	2002/01/25 20:38:16
@@ -180,7 +180,7 @@
 static int		ApplicationType(Tcl_Interp *interp,
 			    const char *fileName, char *fullName);
 static void		BuildCommandLine(const char *executable, int argc, 
-			    char **argv, Tcl_DString *linePtr);
+			    CONST char **argv, Tcl_DString *linePtr);
 static BOOL		HasConsole(void);
 static int		PipeBlockModeProc(ClientData instanceData, int mode);
 static void		PipeCheckProc(ClientData clientData, int flags);
@@ -949,7 +949,7 @@
 				 * Error messages from the child process
 				 * itself are sent to errorFile. */
     int argc,			/* Number of arguments in following array. */
-    char **argv,		/* Array of argument strings.  argv[0]
+    CONST char **argv,		/* Array of argument strings.  argv[0]
 				 * contains the name of the executable
 				 * converted to native format (using the
 				 * Tcl_TranslateFileName call).  Additional
@@ -1524,7 +1524,7 @@
     CONST char *executable,	/* Full path of executable (including 
 				 * extension).  Replacement for argv[0]. */
     int argc,			/* Number of arguments. */
-    char **argv,		/* Argument strings in UTF. */
+    CONST char **argv,		/* Argument strings in UTF. */
     Tcl_DString *linePtr)	/* Initialized Tcl_DString that receives the
 				 * command line (TCHAR). */
 {
