#!/bin/rc -e # patch/update -- update file(s) in patch flagfmt=a args='name file...' if(! ifs=() eval `{aux/getflags $*} || test $#* -lt 2){ aux/usage exit usage } if(! test -d /n/sources/patch){ rfork n 9fs sources } d=/n/sources/patch/$1 shift if(! test -d $d){ echo 'no such patch' $d >[1=2] exit nopatch } for(file in $*){ src=`{cleanname -d `{pwd} $file} dst=`{awk '$1 == ENVIRON["src"] { print $2 }' $d/files} if (~ $dst ''){ echo $src not found in $d/files -- wrong patch? >[1=2] exit 'nofile' } echo cp $src $d/$dst cp $src $d/$dst chmod ug+rw $d/$dst >[2]/dev/null chmod a+r $d/$dst >[2]/dev/null }