#!/bin/rc # sdiff - compare files against sources rfork en fn usage { echo >[1=2] usage: `{basename $0} [diff/idiff options] [-f file] [-i] [file ...] exit usage } opts=() files=() iflag=0 while(~ $1 -*){ switch($1){ case '-?' usage case -f if(~ $#* 1) usage files=`{read -m $2} shift case -i iflag=1 case -* opts=($opts $1) } shift } if(~ $iflag 0) if(~ $#opts 0) opts=-cmr if(~ $#files 0) files=($files $*) if(~ $#files 0) files=`{pwd} 9fs sources for(f in $files){ f=`{cleanname -d `{pwd} $f} if(~ $iflag 0) diff $opts /n/sources/plan9^$f $f if not{ tmp=/tmp/`{basename $f}^.$pid idiff $opts /n/sources/plan9^$f $f >$tmp && mv $tmp $f } } exit ''