From a9ba2a08b562e5c0f60b9671df3b4a0c20a23879 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 22 Sep 2020 12:18:17 +0000 Subject: 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. --- library/auto.tcl | 4 ++++ library/init.tcl | 1 + library/install.tcl | 3 +++ library/package.tcl | 1 + 4 files changed, 9 insertions(+) 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 } -- cgit v0.12