
# Usage: wish tail_standalone.tcl filename

set file [lindex $argv 0]

scrollbar .yscroll -command ".text yview" -orient v
text .text -yscroll ".yscroll set" -exportselection 1 -wrap word 
button .done -text Done -command "exit 0"

pack .done -side bottom
pack .yscroll -side right -fill y
pack .text -side right -fill both -expand 1
wm title . "Contents of $file"
wm geometry . +300+300

set fp [open $file r]

while 1 {
    if [eof $fp] {
	after 1000 "set wait_var 1"
	vwait wait_var
	seek $fp 0 current ;# Reset the error flag on the file.
	continue
    }
    set data [read $fp]
    .text insert end $data
}
