patch/create: make email address an explicit argument
[rsc] --rwxrwxr-x M 192988 glenda sys 1509 Mar 7 08:42 rc/bin/patch/create
/n/sourcesdump/2006/0307/plan9/rc/bin/patch/create:1,7 -
/n/sourcesdump/2006/0308/plan9/rc/bin/patch/create:1,12
#!/bin/rc
rfork e
- if(~ $#* 0 1){
- echo 'usage: patch/create name file... [< description]' >[1=2]
+
+ fn xchmod {
+ chmod $* >[2]/dev/null
+ }
+
+ if(~ $#* 0 1 2){
+ echo 'usage: patch/create name email file... [< description]' >[1=2]
exit usage
}
/n/sourcesdump/2006/0307/plan9/rc/bin/patch/create:9,14 -
/n/sourcesdump/2006/0308/plan9/rc/bin/patch/create:14,23
echo 'bad name: [a-z0-9._\-]+ only' >[1=2]
exit usage
}
+ if(! echo $2 | grep -s '^(-|[A-Za-z0-9.\-+]+@[A-Za-z0-9.\-+]+)$'){
+ echo 'bad email: [a-z0-9.-+] only; use ''-'' to not leave an email address.' >[1=2]
+ exit usage
+ }
if(! test -d /n/sources/patch){
rfork n
/n/sourcesdump/2006/0307/plan9/rc/bin/patch/create:16,32 -
/n/sourcesdump/2006/0308/plan9/rc/bin/patch/create:25,46
}
patch=$1
+ email=$2
+ shift
+ shift
d=/n/sources/patch/$patch
if(! mkdir $d){
echo mkdir $d failed >[1=2]
exit mkdir
}
+ if(! ~ $email -){
+ echo $email >$d/email
+ }
- chmod o-w $d
+ xchmod o-w $d
>$d/readme
>$d/files
>$d/notes
- shift
for(i in $*){
i=`{cleanname -d `{pwd} $i}
if(! test -f $i){
/n/sourcesdump/2006/0307/plan9/rc/bin/patch/create:50,57 -
/n/sourcesdump/2006/0308/plan9/rc/bin/patch/create:64,71
if not
echo warning: new file $i not on sources >[1=2]
echo $i $uniq >>$d/files
- chmod ug+rw $d/*
- chmod a+r $d/*
+ xchmod ug+rw $d/*
+ xchmod a+r $d/*
}
if(~ `{cat /proc/$pid/fd | awk 'NR==2{print $NF}'} */dev/cons && test -w /dev/consctl){
/n/sourcesdump/2006/0307/plan9/rc/bin/patch/create:69,77 -
/n/sourcesdump/2006/0308/plan9/rc/bin/patch/create:83,86
exit oops
}
-
- echo >[1=2] please run patch/email $patch your-email-address
- echo >[1=2] so that 9trouble can mail you if there are questions. thanks.
- echo >[1=2] the email address will not be readable by other sources users.
- echo >[1=2]
echo $d
[rsc] --rw-rw-r-- M 192988 glenda sys 2361 Mar 7 08:42 sys/man/1/patch
/n/sourcesdump/2006/0307/plan9/sys/man/1/patch:4,9 -
/n/sourcesdump/2006/0308/plan9/sys/man/1/patch:4,10
.SH SYNOPSIS
.B patch/create
.I name
+ .I email
.I files ...
[
.B <
/n/sourcesdump/2006/0307/plan9/sys/man/1/patch:43,48 -
/n/sourcesdump/2006/0308/plan9/sys/man/1/patch:44,55
creates a new patch consisting of the changes to
the listed files, reading
a description of the patch from standard input.
+ The
+ .I email
+ address, if not
+ .LR - ,
+ will be sent notification messages when the patch is applied
+ or commented on.
.PP
.I Patch/list
displays information about the named patches,
|