X-Git-Url: http://git.rot13.org/?p=safeq;a=blobdiff_plain;f=terminal-emulator.pl;h=9a91ede0ca9f0a59a18554c0d4c0d8c8b418bc3f;hp=9a4b485f3cf03fed00185123bb1d6c10fee56ad0;hb=83e782d4a74a6638bb9d70c9e55d0da3f090ae85;hpb=7c505ab2d1e25c076a9b922c04ca8de8a0e45fdd diff --git a/terminal-emulator.pl b/terminal-emulator.pl index 9a4b485..9a91ede 100755 --- a/terminal-emulator.pl +++ b/terminal-emulator.pl @@ -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 = ; chomp $r; + print $socket "$r\r\n"; + } + } $socket->close();