aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/netfiles/netfileput
blob: 84cdf610aa94660a003387eb82deccea145f5297 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/local/plan9/bin/rc

if(! ~ $#* 2){
	echo 'usage: netfileput system path' >[1=2]
	exit usage
}

f=putfile

. netfilelib.rc $1

fn putfile{
	cat >$t
	if(! 9 echo -put $t $2 | mysftp $1 >$t.e >[2=1])
		exit 1
	egrep -v '^Uploading' $t.e >$t.e2
	if(test -s $t.e2){
		cat $t.e >[1=2]
		exit 1
	}
}
fn putfile9p{
	if(! 9p write $1/$2)
		exit 1
}

$f $1 $2
exit 0