#!/bin/rc rfork n if(~ $#* 0) { echo usage: sorig file1 ... >[1=2] echo example: sorig /sys/src/cmd/ls.c /sys/src/cmd/acme '|' rc >[1=2] exit usage } b=/n/sources/plan9 if(! test -d $b){ 9fs sources echo 9fs sources } for(i in $*){ s=`{cleanname $b/$i} if(test -d $s){ echo rm -rf $i echo mkdir $i t=`{mtime $s | awk '{print $1}'} echo touch -t $t $i echo dircp $s $i } if not if(test -f $s){ echo rm -f $i echo cp -x $s $i } if not{ # file does not exist on server echo $s does not exist >[1=2] echo rm -rf $i } }