1 tcl comment #!/usr/local/bin/tclsh
4 tcl comment # Convert a file to Unix-style line endings
5 tcl comment # If the file is a directory, then recursively
6 tcl comment # convert all the files in the directory and below.
8 tcl comment # Arguments
9 tcl comment # f The name of a file or directory.
11 tcl comment # Side Effects:
12 tcl comment # Rewrites the file to have LF line-endings
14 tcl code proc Dos2Unix {f} {
16 tcl code if {[file isdirectory $f]} {
17 tcl code foreach g [glob [file join $f *]] {
21 tcl code set in [open $f]
22 tcl code set out [open $f.new w]
23 tcl code fconfigure $out -translation lf
24 tcl code puts -nonewline $out [read $in]
27 tcl code file rename -force $f.new $f
31 tcl comment # Process each command-line argument
33 tcl code foreach f $argv {