Dolda2000 GitWeb
/
utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Don't clobber STDIN.
[utils.git]
/
rsc
diff --git
a/rsc
b/rsc
index
a84668d
..
0e96deb
100755
(executable)
--- a/
rsc
+++ b/
rsc
@@
-1,13
+1,20
@@
#!/usr/bin/perl
#!/usr/bin/perl
+use MIME::Base64;
+
if(@ARGV < 1) {
print STDERR "usage: rsc HOST CMD ARG...\n";
exit 1;
}
if($ARGV[0] eq "-s") {
if(@ARGV < 1) {
print STDERR "usage: rsc HOST CMD ARG...\n";
exit 1;
}
if($ARGV[0] eq "-s") {
+ if(!defined($ARGV[1])) {
+ print STDERR "rsc: server side needs arguments\n";
+ exit 1
+ }
+ $arg = decode_base64($ARGV[1]);
$c = "";
$c = "";
-
while(<STDIN>
) {
+
for (split /\n/, $arg
) {
chomp;
s/\\(.)/$1/g;
$c .= $_;
chomp;
s/\\(.)/$1/g;
$c .= $_;
@@
-25,17
+32,11
@@
if($ARGV[0] eq "-s") {
}
} else {
$host = shift @ARGV;
}
} else {
$host = shift @ARGV;
- $pid = open SSH, "|-";
- if($pid == 0) {
- exec "ssh", "$host", "rsc", "-s";
- die "$!";
- }
+ $arg = "";
for (@ARGV) {
s/([\\\n])/\\$1/g;
for (@ARGV) {
s/([\\\n])/\\$1/g;
-
print SSH
"$_\n";
+
$arg .=
"$_\n";
}
}
-
close SSH
;
-
waitpid $pid, 0
;
+
exec "ssh", "$host", "rsc", "-s", encode_base64($arg)
;
+
die "$!"
;
}
}
-
-