use Dpkg::Version;
use POSIX;
use IPC::Open2;
-use File::Temp;
our $our_version = 'UNRELEASED'; ###substituted###
fail "protocol violation; $m not expected";
}
-sub protocol_expect ($&) {
- my ($fh, $match) = @_;
+sub protocol_expect (&$) {
+ my ($match, $fh) = @_;
local $_;
$_ = <$fh>;
defined && chomp or badproto $fh, "eof";
my ($fh, $ourfn) = @_;
open PF, ">", $ourfn or die "$ourfn: $!";
for (;;) {
- protocol_expect \*STDIN, { m/^data-block (.*})$|data-end$/ };
+ protocol_expect { m/^data-block (.*})$|data-end$/ } \*STDIN;
length $1 or last;
my $d = protocol_read_bytes \*STDIN, $1;
print PF $d or die $!;
foreach my $fn (@ourfns) {
protocol_receive_file \*STDIN, $fn;
}
- protocol_expect \*STDIN, { m/^files-end$/ };
+ protocol_expect { m/^files-end$/ } \*STDIN;
}
#---------- remote protocol support, initiator ----------
sub initiator_expect (&) {
my ($match) = @_;
- protocol_expect \*RO, &$match;
+ protocol_expect { &$match } \*RO;
}
#---------- end remote code ----------