fixed minor bugs in demo scripts and run_stem
[urisagit/Stem.git] / bin / chat2_demo
index a2006a9..9a4ec6f 100755 (executable)
@@ -5,6 +5,13 @@ $offset = 175 ;
 $base_off = 0 ;
 $xskip = ( $^O eq 'solaris' ) ? 600 : 500 ;
 
+use File::Basename qw( basename );
+$ENV{PATH} .= ':' . basename( $0 ) . ':.';
+for my $prog qw( run_stem xterm telnet ) {
+    die "Can't find $prog in PATH\n" if
+        system( "which $prog >/dev/null 2>&1" ) != 0;
+}
+
 my @children ;
 
 $SIG{ 'INT' } = \&cleanup ;
@@ -41,12 +48,11 @@ print "$cmd\n" ;
        sleep 2 unless $cmd =~ /localhost/ ;
 }
 
-while( <STDIN> ) {
+1 while wait() != -1;
+
+exit;
 
-       next unless /^q/i ;
 
-       cleanup() ;
-}
 
 sub cleanup {