Fixes recursion bug in disambiguate_in().
[ohcount] / test / expected_dir / tcl1.tcl
1 tcl     comment #!/usr/local/bin/tclsh
2 tcl     blank   
3 tcl     comment # Dos2Unix
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.
7 tcl     comment #
8 tcl     comment # Arguments
9 tcl     comment #       f       The name of a file or directory.
10 tcl     comment #
11 tcl     comment # Side Effects:
12 tcl     comment #       Rewrites the file to have LF line-endings
13 tcl     blank   
14 tcl     code    proc Dos2Unix {f} {
15 tcl     code        puts $f
16 tcl     code        if {[file isdirectory $f]} {
17 tcl     code            foreach g [glob [file join $f *]] {
18 tcl     code                Dos2Unix $g
19 tcl     code            }
20 tcl     code        } else {
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]
25 tcl     code            close $out
26 tcl     code            close $in
27 tcl     code            file rename -force $f.new $f
28 tcl     code        }
29 tcl     code    }
30 tcl     blank   
31 tcl     comment # Process each command-line argument
32 tcl     blank   
33 tcl     code    foreach f $argv {
34 tcl     code        Dos2Unix $f
35 tcl     code    }