report total_pages in .COPY and .DONE
[safeq] / terminal-emulator.pl
index 9a4b485..9a91ede 100755 (executable)
@@ -31,25 +31,15 @@ my @send_receive = grep { /^.+$/ } split(/\n/, q{
 .CARD OK Ime Prezime (nobody@example.com)
 
 .ACTION
-.ACTION CMENUS0
+.ACTION CMENUS
 
 .NOP
-.NOP 
-
-
 .NOP
-.NOP 
 
 .NOP
-.NOP 
-
 .NOP
-.NOP 
 
-.NOP
-.NOP
-
-.END 
+.END
 });
 
 #warn "# send_receive=",dump( \@send_receive );
@@ -61,9 +51,15 @@ while ( @send_receive ) {
        print $socket "$send\r\n";
        my $got = <$socket>;
        $got =~ s/[\r\n]+$//;
-warn dump($send,$expect,$got);
+warn "# send/expect/got ",dump($send,$expect,$got);
        warn "<< $got\n";
-       die "ERROR expected [$expect] got [$got]" if $expect ne $got;
+       if ( defined $got && defined $expect && $expect ne substr($got,0,length($expect)) ) {
+               warn "ERROR expected [$expect] got [$got]\n";
+               print "Response>";
+               my $r = <STDIN>; chomp $r;
+               print $socket "$r\r\n";
+       }
+
 }
 
 $socket->close();