projects
/
safeq
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added IP address as first column
[safeq]
/
terminal-emulator.pl
diff --git
a/terminal-emulator.pl
b/terminal-emulator.pl
index
9a4b485
..
9a91ede
100755
(executable)
--- 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
.CARD OK Ime Prezime (nobody@example.com)
.ACTION
-.ACTION CMENUS
0
+.ACTION CMENUS
.NOP
.NOP
-.NOP
-
-
.NOP
.NOP
-.NOP
.NOP
.NOP
-.NOP
-
.NOP
.NOP
-.NOP
-.NOP
-.NOP
-
-.END
+.END
});
#warn "# send_receive=",dump( \@send_receive );
});
#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]+$//;
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";
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();
}
$socket->close();