#!/usr/bin/tclsh
package require Expect

# Description: unbuffer stdout of a program
# Author: Don Libes, NIST

if {[string compare [lindex $argv 0] "-p"] == 0} {
    # pipeline
    set stty_init "-echo"
    eval [list spawn -noecho] [lrange $argv 1 end]
    interact
} else {
    set stty_init "-opost"
    eval [list spawn -noecho] $argv
    set timeout -1
    expect
}
