9 echo 'usage: patch/create name email file... [< description]' >[1=2]
13 if(! echo $1 | grep -s '^[a-z_0-9.\-]+$'){
14 echo 'bad name: [a-z0-9._\-]+ only' >[1=2]
17 if(! echo $2 | grep -s '^(-|[A-Za-z0-9.\-+]+@[A-Za-z0-9.\-+]+)$'){
18 echo 'bad email: [a-z0-9.-+] only; use ''-'' to not leave an email address.' >[1=2]
22 if(! test -d /n/sources/patch){
31 d=/n/sources/patch/$patch
33 echo mkdir $d failed >[1=2]
45 i=`{cleanname -d `{pwd} $i}
47 echo error: cannot find $i >[1=2]
54 while(test -f $d/$uniq){
59 if(test -f /n/sources/plan9/$i){
60 if(cmp -s /n/sources/plan9/$i $i)
61 echo warning: new file $i does not differ from sources >[1=2]
62 cp /n/sources/plan9/$i $d/$uniq.orig
65 echo warning: new file $i not on sources >[1=2]
66 echo $i $uniq >>$d/files
68 @{builtin cd $d && xchmod ug+rw * && xchmod a+r *}
70 if(~ `{cat /proc/$pid/fd | awk 'NR==2{print $NF}'} */dev/cons && test -w /dev/consctl){
79 if(! test -s $d/readme){
80 echo 'no description given; aborting' >[1=2]