summaryrefslogtreecommitdiffstats
path: root/tcl8.6/tools/eolFix.tcl
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2016-12-21 22:13:18 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2016-12-21 22:13:18 (GMT)
commit07e464099b99459d0a37757771791598ef3395d9 (patch)
tree4ba7d8aad13735e52f59bdce7ca5ba3151ebd7e3 /tcl8.6/tools/eolFix.tcl
parentdeb3650e37f26f651f280e480c4df3d7dde87bae (diff)
downloadblt-07e464099b99459d0a37757771791598ef3395d9.zip
blt-07e464099b99459d0a37757771791598ef3395d9.tar.gz
blt-07e464099b99459d0a37757771791598ef3395d9.tar.bz2
new subtree for tcl/tk
Diffstat (limited to 'tcl8.6/tools/eolFix.tcl')
-rw-r--r--tcl8.6/tools/eolFix.tcl80
1 files changed, 0 insertions, 80 deletions
diff --git a/tcl8.6/tools/eolFix.tcl b/tcl8.6/tools/eolFix.tcl
deleted file mode 100644
index 3f35ed4..0000000
--- a/tcl8.6/tools/eolFix.tcl
+++ /dev/null
@@ -1,80 +0,0 @@
-## Super aggressive EOL-fixer!
-##
-## Will even understand screwed up ones like CRCRLF.
-## (found in bad CVS repositories, caused by spacey developers
-## abusing CVS)
-##
-## davygrvy@pobox.com 3:41 PM 10/12/2001
-##
-
-package provide EOL-fix 1.1
-
-namespace eval ::EOL {
- variable outMode crlf
-}
-
-proc EOL::fix {filename {newfilename {}}} {
- variable outMode
-
- if {![file exists $filename]} {
- return
- }
- puts "EOL Fixing: $filename"
-
- file rename ${filename} ${filename}.o
- set fhnd [open ${filename}.o r]
-
- if {$newfilename ne ""} {
- set newfhnd [open ${newfilename} w]
- } else {
- set newfhnd [open ${filename} w]
- }
-
- fconfigure $newfhnd -translation [list auto $outMode]
- seek $fhnd 0 end
- set theEnd [tell $fhnd]
- seek $fhnd 0 start
-
- fconfigure $fhnd -translation binary -buffersize $theEnd
- set rawFile [read $fhnd $theEnd]
- close $fhnd
-
- regsub -all {(\r)|(\r){1,2}(\n)} $rawFile "\n" rawFile
-
- set lineList [split $rawFile \n]
-
- foreach line $lineList {
- puts $newfhnd $line
- }
-
- close $newfhnd
- file delete ${filename}.o
-}
-
-proc EOL::fixall {args} {
- if {[llength $args] == 0} {
- puts stderr "no files to fix"
- exit 1
- } else {
- set cmd [lreplace $args -1 -1 glob -nocomplain]
- }
-
- foreach f [eval $cmd] {
- if {[file isfile $f]} {fix $f}
- }
-}
-
-if {$tcl_interactive == 0 && $argc > 0} {
- if {[string index [lindex $argv 0] 0] eq "-"} {
- switch -- [lindex $argv 0] {
- -cr {set ::EOL::outMode cr}
- -crlf {set ::EOL::outMode crlf}
- -lf {set ::EOL::outMode lf}
- default {puts stderr "improper mode switch"; exit 1}
- }
- set argv [lrange $argv 1 end]
- }
- eval EOL::fixall $argv
-} else {
- return
-}