#!/bin/rc
#
# sdiff: find difference between two system
# sdiff is mainly designed to look difference
# between /n/sources and our system.
#
# therefore uid and gid parts are neglected in comparison.
#
# usage: sdiff /n/sources/plan9 / sys/src/9/pc
#
# usage: sdiff /n/sources/plan9 / sys/src/9/pc/sd53c8xx.i
#
switch($#*){
case 2
p=/
case 3
p=$3
if(! ~ $p /*)
p=/$p
case *
echo 'usage: dir1 dir2 [path]'
exit usage
}
d1=$1$p
d2=$2$p
f=()
if(! test -e $d1){
echo $d1 is not exist
f=1
}
if(! test -e $d2){
echo $d2 is not exist
f=1
}
if(~ $f 1)
exit error
fn dls { ls -lp $1 | awk '{print $1, $6, $7, $8, $9, $10}'}
if (test -d $d2)
diff <{dls $d1} <{dls $d2}
if not
diff $d1 $d2
|