#!/usr/athena/bin/perl
$WafeLib = $ENV{'WAFELIB'} || "/mit/sipb/lib/wafe";
require "$WafeLib/perl/wafe.pl";

&UI( <<"End of TCL");
### BEGIN wafedesign TCL ###
form form1 topLevel  \\
	sensitive true \\
	background blue
command command2 form1  \\
	pointerColor chartreuse \\
	horizDistance 3 \\
	label {Nuke Nathan} \\
	vertDistance 5 \\
	callback {echo nuke-nath} \\
	cornerRoundPercent 100 \\
	background purple \\
	borderColor green
command command3 form1  \\
	callback {echo znol-long} \\
	background brown \\
	label {Znol, lmf} \\
	vertDistance 29 \\
	horizDistance 4
command command4 form1  \\
	vertDistance 52 \\
	background navy \\
	callback {echo znol-shor} \\
	horizDistance 4 \\
	label {Znol, short}
label label2 form1  \\
	label Blah \\
	height 45 \\
	vertDistance 78 \\
	horizDistance 6 \\
	width 80 \\
	font -*-*-*-*-*-*-33-*-*-*-*-*-*-*
stripChart stripChart1 form1  \\
	horizDistance 97 \\
	vertDistance 4 \\
	background red
realize
### END wafedesign TCL ###
End of TCL
    while(1){
	select('', '', '', 3);
	read(STDIN, $_, 10);
	chop;
	    print "---> <$_>\n";
	    if(/znol/){
		if(/long/){
		    &z('mkgray', `znol -f /mit/mkgray/.lmf`);
		}
		else{
		    &z('mkgray', "Wait...\n");
		    print("Sending znol...\n");
		    &z('mkgray', `znol -f /mit/mkgray/.anyone`);
		    print("Done\n");
		}
	    }
	    elsif(/nuke/){
		foreach $fasdf (1..10){
		    &z('nsanders', `cat /mit/mkgray/Text/blscr`);
		    print("Done\n");
		}
	    }
	$uptime = `uptime`;
	@parts = split(/[ \t]+/, $uptime);
	$parts[$#parts-2] =~ s/\,//;
	$x = $parts[$#parts-2];
	int($x);
#	print("Value: $x\n");
	&Xui("scSet stripChart1 $x\n");
	
}
&wafe'cleanup; 


sub z {
    local($user, $message) = @_;

    open(ZWR, "|zwrite -d -n -q $user");
    print(ZWR $message);
    close(ZWR);
}
