update usage, use sftp -b /dev/stdin

This commit is contained in:
rsc 2005-03-20 23:39:48 +00:00
parent 80097b0182
commit baf7825e82
3 changed files with 7 additions and 7 deletions

View file

@ -7,7 +7,7 @@ if(~ $1 -d){
} }
if(! ~ $#* 2){ if(! ~ $#* 2){
echo 'usage: netget [-d] system path' >[1=2] echo 'usage: netfileget [-d] system path' >[1=2]
exit usage exit usage
} }
@ -20,7 +20,7 @@ fn sigexit { rm -f $t }
fn getfile { fn getfile {
rm -f $t rm -f $t
if(! echo get $2 $t | sftp -b - $1 >/dev/null) if(! echo get $2 $t | sftp -b /dev/stdin $1 >/dev/null)
exit 1 exit 1
cat $t cat $t
} }
@ -31,7 +31,7 @@ fn getfile9p {
} }
fn getdir { fn getdir {
if(! {echo cd $2; echo ls -l} | sftp -b - $1 | sed '1,2d; s/sftp> //g; /^$/d' >$t) if(! {echo cd $2; echo ls -l} | sftp -b /dev/stdin $1 | sed '1,2d; s/sftp> //g; /^$/d' >$t)
exit 1 exit 1
cat $t | awk '$NF == "." || $NF == ".." { next } {s = $NF; if($0 ~ /^d/) s = s "/"; print s}' cat $t | awk '$NF == "." || $NF == ".." { next } {s = $NF; if($0 ~ /^d/) s = s "/"; print s}'
} }

View file

@ -1,7 +1,7 @@
#!/usr/local/plan9/bin/rc #!/usr/local/plan9/bin/rc
if(! ~ $#* 2){ if(! ~ $#* 2){
echo 'usage: netput system path' >[1=2] echo 'usage: netfileput system path' >[1=2]
exit usage exit usage
} }
@ -15,7 +15,7 @@ fn sigexit { rm -f $t }
fn putfile{ fn putfile{
cat >$t cat >$t
if(! echo put $t $2 | sftp -b - $1 >/dev/null) if(! echo put $t $2 | sftp -b /dev/stdin $1 >/dev/null)
exit 1 exit 1
} }
fn putfile9p{ fn putfile9p{

View file

@ -1,7 +1,7 @@
#!/usr/local/plan9/bin/rc #!/usr/local/plan9/bin/rc
if(! ~ $#* 2){ if(! ~ $#* 2){
echo usage: netisdir system path >[1=2] echo usage: netfilestat system path >[1=2]
exit usage exit usage
} }
@ -18,7 +18,7 @@ fn dostat {
echo !echo XXX connected echo !echo XXX connected
echo cd $2 echo cd $2
echo !echo XXX directory exists echo !echo XXX directory exists
} | sftp -b - $1 >$t >[2=1] } | sftp -b /dev/stdin $1 >$t >[2=1]
if(9 grep -s XXX.directory.exists $t){ if(9 grep -s XXX.directory.exists $t){
echo directory echo directory
exit 0 exit 0