#!/import/tcl7/bin/tclsh
# Unix chapter
proc read1 { file } {
    set stream [open $file r]
    set i 0
    foreach line [split [read $stream] \n] {
	incr i
    }
    close $stream
}
proc read2 { file } {
    set stream [open $file r]
    set i 0
    while {[gets $stream line] >= 0} {
	incr i
    }
    close $stream
}
set file /tmp/mime.tcl
read1 $file
puts "Read: [time {read1 $file} 10]"
puts "Gets: [time {read2 $file} 10]"
