summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/Eval.36
-rw-r--r--doc/source.n12
-rw-r--r--generic/tclIOUtil.c8
-rw-r--r--tests/source.test10
4 files changed, 30 insertions, 6 deletions
diff --git a/doc/Eval.3 b/doc/Eval.3
index b395f75..73fe429 100644
--- a/doc/Eval.3
+++ b/doc/Eval.3
@@ -1,11 +1,12 @@
'\"
'\" Copyright (c) 1989-1993 The Regents of the University of California.
'\" Copyright (c) 1994-1997 Sun Microsystems, Inc.
+'\" Copyright (c) 2000 Scriptics Corporation.
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: Eval.3,v 1.6 2000/04/14 23:01:50 hobbs Exp $
+'\" RCS: @(#) $Id: Eval.3,v 1.7 2000/05/11 00:16:52 hobbs Exp $
'\"
.so man.macros
.TH Tcl_Eval 3 8.1 Tcl "Tcl Library Procedures"
@@ -101,6 +102,9 @@ its contents as a Tcl script. It returns the same information as
\fBTcl_EvalObjEx\fR.
If the file couldn't be read then a Tcl error is returned to describe
why the file couldn't be read.
+.VS 8.4
+The eofchar for files is '\\32' (^Z) for all platforms.
+.VE 8.4
.PP
\fBTcl_EvalObjv\fR executes a single pre-parsed command instead of a
script. The \fIobjc\fR and \fIobjv\fR arguments contain the values
diff --git a/doc/source.n b/doc/source.n
index 024ab7b..6a78622 100644
--- a/doc/source.n
+++ b/doc/source.n
@@ -1,11 +1,12 @@
'\"
'\" Copyright (c) 1993 The Regents of the University of California.
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
+'\" Copyright (c) 2000 Scriptics Corporation.
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: source.n,v 1.2 1998/09/14 18:39:55 stanton Exp $
+'\" RCS: @(#) $Id: source.n,v 1.3 2000/05/11 00:16:52 hobbs Exp $
'\"
.so man.macros
.TH source n "" Tcl "Tcl Built-In Commands"
@@ -31,7 +32,14 @@ of the script then the \fBsource\fR command will return that error.
If a \fBreturn\fR command is invoked from within the script then the
remainder of the file will be skipped and the \fBsource\fR command
will return normally with the result from the \fBreturn\fR command.
-
+.PP
+.VS 8.4
+The end-of-file character for files is '\\32' (^Z) for all platforms.
+The source command will read files up to this character. This
+restriction does not exist for the \fBread\fR or \fBgets\fR commands,
+allowing for files containing code and data segments (scripted documents).
+.VE 8.4
+.PP
The \fI\-rsrc\fR and \fI\-rsrcid\fR forms of this command are only
available on Macintosh computers. These versions of the command
allow you to source a script from a \fBTEXT\fR resource. You may specify
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index 65dca78..41db745 100644
--- a/generic/tclIOUtil.c
+++ b/generic/tclIOUtil.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclIOUtil.c,v 1.9 1999/11/10 02:51:56 hobbs Exp $
+ * RCS: @(#) $Id: tclIOUtil.c,v 1.10 2000/05/11 00:16:53 hobbs Exp $
*/
#include "tclInt.h"
@@ -306,6 +306,12 @@ Tcl_EvalFile(interp, fileName)
"\": ", Tcl_PosixError(interp), (char *) NULL);
goto end;
}
+ /*
+ * The eofchar is \32 (^Z). This is the usual on Windows, but we
+ * effect this cross-platform to allow for scripted documents.
+ * [Bug: 2040]
+ */
+ Tcl_SetChannelOption(interp, chan, "-eofchar", "\32");
if (Tcl_ReadChars(chan, objPtr, -1, 0) < 0) {
Tcl_Close(interp, chan);
Tcl_AppendResult(interp, "couldn't read file \"", fileName,
diff --git a/tests/source.test b/tests/source.test
index 30b69a5..1718aa6 100644
--- a/tests/source.test
+++ b/tests/source.test
@@ -6,12 +6,12 @@
#
# Copyright (c) 1991-1993 The Regents of the University of California.
# Copyright (c) 1994-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright (c) 1998-2000 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: source.test,v 1.6 2000/04/10 17:19:04 ericm Exp $
+# RCS: @(#) $Id: source.test,v 1.7 2000/05/11 00:16:53 hobbs Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -179,6 +179,12 @@ test source-6.1 {source is binary ok} {
source source.file
string length $x
} 5
+test source-6.2 {source skips everything after Ctrl-Z: Bug 2040} {
+ set x {}
+ makeFile [list set x "ab\32c"] source.file
+ source source.file
+ string length $x
+} 2
# cleanup
catch {::tcltest::removeFile source.file}