summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-09-22 12:18:17 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-09-22 12:18:17 (GMT)
commita9ba2a08b562e5c0f60b9671df3b4a0c20a23879 (patch)
treedcb4431aa0ef26fbe88d522ed727c04c50bb800b
parentebb520a84937f16bef1ffe4d56ed7f6f542eedc2 (diff)
downloadtcl-a9ba2a08b562e5c0f60b9671df3b4a0c20a23879.zip
tcl-a9ba2a08b562e5c0f60b9671df3b4a0c20a23879.tar.gz
tcl-a9ba2a08b562e5c0f60b9671df3b4a0c20a23879.tar.bz2
When writing script files (like pkgIndex.tcl), always use -translation lf, so they don't cause problems on non-windows.
When reading script files, always use -eofchar \032, as this might be left by Windows editors.
-rw-r--r--library/auto.tcl4
-rw-r--r--library/init.tcl1
-rw-r--r--library/install.tcl3
-rw-r--r--library/package.tcl1
4 files changed, 9 insertions, 0 deletions
diff --git a/library/auto.tcl b/library/auto.tcl
index 2deae05..32da97c 100644
--- a/library/auto.tcl
+++ b/library/auto.tcl
@@ -265,6 +265,7 @@ proc auto_mkindex {dir args} {
auto_mkindex_parser::cleanup
set fid [open "tclIndex" w]
+ fconfigure $fid -translation lf
puts -nonewline $fid $index
close $fid
cd $oldDir
@@ -291,6 +292,7 @@ proc auto_mkindex_old {dir args} {
set f ""
set error [catch {
set f [open $file]
+ fconfigure $f -eofchar \032
while {[gets $f line] >= 0} {
if {[regexp {^proc[ ]+([^ ]*)} $line match procName]} {
set procName [lindex [auto_qualify $procName "::"] 0]
@@ -309,6 +311,7 @@ proc auto_mkindex_old {dir args} {
set f ""
set error [catch {
set f [open tclIndex w]
+ fconfigure $f -translation lf
puts -nonewline $f $index
close $f
cd $oldDir
@@ -401,6 +404,7 @@ proc auto_mkindex_parser::mkindex {file} {
set scriptFile $file
set fid [open $file]
+ fconfigure $fid -eofchar \032
set contents [read $fid]
close $fid
diff --git a/library/init.tcl b/library/init.tcl
index 94f65cf..16d5d67 100644
--- a/library/init.tcl
+++ b/library/init.tcl
@@ -442,6 +442,7 @@ proc auto_load_index {} {
continue
} else {
set error [catch {
+ fconfigure $f -eofchar \032
set id [gets $f]
if {$id eq "# Tcl autoload index file, version 2.0"} {
eval [read $f]
diff --git a/library/install.tcl b/library/install.tcl
index 227d0b8..26e5e68 100644
--- a/library/install.tcl
+++ b/library/install.tcl
@@ -35,6 +35,7 @@ proc ::practcl::_pkgindex_directory {path} {
# Read the file, and override assumptions as needed
###
set fin [open $file r]
+ fconfigure $fin -eofchar \032
set dat [read $fin]
close $fin
# Look for a teapot style Package statement
@@ -58,6 +59,7 @@ proc ::practcl::_pkgindex_directory {path} {
foreach file [glob -nocomplain $path/*.tcl] {
if { [file tail $file] == "version_info.tcl" } continue
set fin [open $file r]
+ fconfigure $fin -eofchar \032
set dat [read $fin]
close $fin
if {![regexp "package provide" $dat]} continue
@@ -77,6 +79,7 @@ proc ::practcl::_pkgindex_directory {path} {
return $buffer
}
set fin [open $pkgidxfile r]
+ fconfigure $fin -eofchar \032
set dat [read $fin]
close $fin
set trace 0
diff --git a/library/package.tcl b/library/package.tcl
index eebe91c..64fac7b 100644
--- a/library/package.tcl
+++ b/library/package.tcl
@@ -409,6 +409,7 @@ proc pkg_mkIndex {args} {
}
set f [open [file join $dir pkgIndex.tcl] w]
+ fconfigure $f -translation lf
puts $f $index
close $f
}