#!/bin/rc rfork e fn xchmod { chmod $* >[2]/dev/null } if(~ $#* 0 1){ echo 'usage: issue/create name email [< description]' >[1=2] exit usage } if(! echo $1 | grep -s '^[a-z_0-9.\-]+$'){ 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 } #tracker=/n/sources/issue tracker=./test # Doesn't (yet?) exist #if(~ $tracker /n/sources/issue){ # if(! test -d /n/sources/issue){ # rfork n # 9fs sources # } #} issue=$1 email=$2 d=$tracker/unconfirmed/$issue if(! mkdir $d){ echo mkdir $d failed >[1=2] exit mkdir } if(! ~ $email -){ echo $email >$d/email } xchmod o-w $d >$d/readme >$d/notes if(~ `{cat /proc/$pid/fd | awk 'NR==2{print $NF}'} */dev/cons && test -w /dev/consctl){ >/dev/consctl { echo holdon cat >$d/readme } } if not cat >$d/readme if(! test -s $d/readme){ echo 'no description given; aborting' >[1=2] rm -rf $d exit oops } echo $d