Artifact
43082cdd8daae346755db92232f82286407197bd:
Attachment "fixnl.tcl" to
ticket [219409ffff]
added by
dkf
2001-09-10 17:03:32.
#! /usr/local/bin/tclsh
proc convert {translation file} {
set tmp $file.fixnltmp
set f [open $file r]
set content [read $f]
close $f
# File might get shorter (if go from CRLF to LF only, for example)
# so can't just open/read/seek/write/close, but must reopen
set f [open $tmp w]
fconfigure $f -translation $translation
puts -nonewline $f $content
close $f
file rename $tmp $file
}
set translation crlf
switch -exact -- [lindex $argv 0] {
-lf - -cr - -crlf {
set translation [string range [lindex $argv 0] 1 end]
set argv [lrange $argv 1 end]
}
}
foreach filename $argv {
convert $translation $filename
}
exit