plan9port/src/cmd/netfiles/netfileput

30 lines
365 B
Text
Raw Normal View History

2005-03-18 19:30:22 +00:00
#!/usr/local/plan9/bin/rc
if(! ~ $#* 2){
2005-03-20 23:39:48 +00:00
echo 'usage: netfileput system path' >[1=2]
2005-03-18 19:30:22 +00:00
exit usage
}
f=putfile
2005-03-21 07:37:34 +00:00
. netfilelib.rc $1
2005-03-18 19:30:22 +00:00
fn putfile{
cat >$t
2005-03-21 07:37:34 +00:00
if(! 9 echo -put $t $2 | mysftp $1 >$t.e >[2=1])
2005-03-18 19:30:22 +00:00
exit 1
2005-03-21 07:37:34 +00:00
egrep -v '^Uploading' $t.e >$t.e2
if(test -s $t.e2){
cat $t.e >[1=2]
exit 1
}
2005-03-18 19:30:22 +00:00
}
fn putfile9p{
if(! 9p write $1/$2)
exit 1
}
$f $1 $2
exit 0
2005-03-21 07:37:34 +00:00