9diff, adiff, basediff - new commands for diffing with sources/9atom Reference: /n/atom/patch/applied2013/basediff Date: Thu Sep 12 17:11:49 CES 2013 Signed-off-by: quanstro@quanstro.net --- /sys/man/1/9diff Thu Jan 1 00:00:00 1970 +++ /sys/man/1/9diff Thu Sep 12 17:11:17 2013 @@ -0,0 +1,66 @@ +.TH 9diff 1 +.SH NAME +9diff, adiff, basediff \- diff with remote trees +.SH SYNOPSIS +.B 9diff +.I file +... +.br +.B adiff +.I file +... +.br +.BI t= 9fsname +.BI b= boundname +.B basediff +[ +.I diff-flags +] +.SH DESCRIPTION +.I Basediff +provides a template for recursively running +.IR diff (1) +against +the remote tree specified through environment variables. +The +.I 9fs +(see +.IR srv (4)) +name for the remote tree is specified with +.BR $t , +and its mount point with +.BR $b . +If the remote is not mounted, +.I basediff +will mount it. +.I Diff +is then run recursively with the specified flags (default +.BR -c ) +on the specified trees against the +corresponding remote files. +.P +The scripts +.I 9diff +and +.I adiff +are scripts that use +.I basediff +with remote trees of +.B sources +and +.BR 9atom , +respectively. +.SH EXAMPLES +To diff the kernel's IP stack with sources, +.IP +.EX +9diff /sys/src/9/ip +.EE +.SH "SEE ALSO" +.IR diff (1), +.IR srv (4) +.SH BUGS +.I Adiff +conflicts with the +.IR acme (1) +program of the same name. --- /rc/bin/basediff Thu Jan 1 00:00:00 1970 +++ /rc/bin/basediff Thu Sep 12 17:11:18 2013 @@ -0,0 +1,22 @@ +#!/bin/rc +if(! test -d $b/386) + 9fs $t +ptflagfmt='a,b,c,e,f,m,n,r,w' +args='...' +if(! ifs=() eval `{aux/getflags $*}){ + aux/usage + exit usage +} +if(~ $ptflag '') + ptflag = -c +p = `{pwd | sed s:.*/sys/src/:/sys/src/:g} +for(i){ + if(~ $i /*) + diff $ptflag $b$i $i + if not{ + if(test -d $i) + basediff $ptflag $i/* + if not + diff $ptflag $b$p/$i $i + } +} --- /rc/bin/9diff Thu Jan 1 00:00:00 1970 +++ /rc/bin/9diff Thu Sep 12 17:11:18 2013 @@ -0,0 +1,2 @@ +#!/bin/rc +t=sources b=/n/$t/plan9 basediff $* --- /rc/bin/adiff Thu Jan 1 00:00:00 1970 +++ /rc/bin/adiff Thu Sep 12 17:11:19 2013 @@ -0,0 +1,2 @@ +#!/bin/rc +t=atom b=/n/$t/plan9 basediff $*