#!/proj/tcl/install/5.x-sparc/bin/wish4.1 set f [open "bg.c" w] puts $f {#include main(){printf("Hello\n");}} close $f set f [open "/tmp/junk.out" w+] pack [frame .bb] -side top -fill x #Note that the '-#' flag is how I turn on verbose compilation. # adjust accordingly for your compiler. button .bb.b -text "Compile it." -command {\ after 1000 tail $f;\ exec cc -# bg.c >>& /tmp/junk.out &\ } pack .bb.b -side left pack [label .bb.l -text "\\"] -side right pack [scrollbar .sb -command ".t yview"] -side right -fill y pack [text .t -yscrollc ".sb set"] -fill both -expand 1 set size 0 set state 0 proc tail {f} { global size file stat /tmp/junk.out stats if {$stats(size) != $size} { .t insert end [read $f [expr $stats(size)-$size]];.t yview 100 set size $stats(size) } after 500 tail $f } proc rotate {} { global state .bb.l config -text [string index "\|/-" $state] set state [expr ($state>3?0:$state+1)] after 100 rotate } rotate