summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdgit11
1 files changed, 5 insertions, 6 deletions
diff --git a/dgit b/dgit
index 6a3f7b7..08ecca6 100755
--- a/dgit
+++ b/dgit
@@ -28,7 +28,6 @@ use File::Basename;
use Dpkg::Version;
use POSIX;
use IPC::Open2;
-use File::Temp;
our $our_version = 'UNRELEASED'; ###substituted###
@@ -172,8 +171,8 @@ sub badproto ($$) {
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";
@@ -209,7 +208,7 @@ sub protocol_receive_file ($$) {
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 $!;
@@ -240,14 +239,14 @@ sub responder_receive_files ($@) {
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 ----------