xref: /plan9-contrib/rc/bin/patch/move (revision ec59a3ddbfceee0efe34584c2c9981a5e5ff1ec4)
1#!/bin/rc
2
3rfork e
4if(~ $#* 0 1){
5	echo 'usage: patch/move dst patch-name...' >[1=2]
6	exit usage
7}
8
9if(! test -d /n/sources/patch){
10	rfork n
11	9fs sources
12}
13
14dst=$1
15shift
16for(i){
17	j=`{basename $i}
18	if(! test -d /n/sources/patch/$i)
19		echo 'no such patch' /n/sources/patch/$i >[1=2]
20	if not if(test -d /n/sources/patch/$dst/$j)
21		echo 'already have' /n/sources/patch/$dst/$j >[1=2]
22	if not
23		ls -ldp /n/sources/patch/$i >/n/sources/patch/$i/origls &&
24		mkdir /n/sources/patch/$dst/$j &&
25		dircp /n/sources/patch/$i /n/sources/patch/$dst/$j &&
26		rm -rf /n/sources/patch/$i &&
27		test -s /n/sources/patch/$dst/$j/email &&
28		patch/notify $dst/$j
29}
30