Autzoo.1456 net.sources utcsrgv!utzoo!henry Tue Mar 2 18:55:20 1982 diff marker Here is the source (shell script) and manual page for a program that puts change bars in the margin of a revised version of a document. The idea is that of PWB's diffmark, but the user interface and implementation are different. This is not Bell code, it carries no nondisclosure restrictions, it may be used on any system. The sed script possibly could be simpler, but this one works. --------- PATH=/bin:/usr/bin ; export PATH case $# in 2) ;; *) echo 'Usage: diffmk file1 file2' >&2 exit 2 ;; esac ab=${ab-'.mc |'} ae=${ae-'.mc'} cb=${cb-'.mc |'} ce=${ce-'.mc'} db=${db-'.mc *'} de=${de-'.mc'} ( diff -e $1 $2 | sed " /d/{ s//c/p a\\ $db\\ $de\\ . d } /a/{ a\\ $ab : ascan n t aclear : aclear s/^\\.\$/./ t aend b ascan : aend i\\ $ae } /c/{ a\\ $cb : cscan n t cclear : cclear s/^\\.\$/./ t cend b cscan : cend i\\ $ce } " echo '1,$p' ) | ed - $1 --------- .TH DIFFMK 1 local .DA 2 March 1982 .SH NAME diffmk \- mark differences between files .SH SYNOPSIS .B diffmk file1 file2 .SH DESCRIPTION .I Diffmk compares two versions of a file and outputs a variant of the second version that contains ``change mark'' commands .RB ( .mc for .I nroff or .IR troff ) that mark the differences from the first version. When the result is formatted, changed or inserted text is shown by .B | at the right margin of each line. The position of deleted text is shown by a single .BR * . .PP If it is desired to change the formatting commands inserted by .IR diffmk , the environment variables .BR ab , .BR ae , .BR cb , .BR ce , .BR db , and .BR de can be used to specify the lines desired at the beginnings and ends of added text, changes, and deletions respectively. .PP Getting a .I diffmk listing of (say) a C program is a bit more involved, but something like this should work about right: .PP .RS .nf ( echo ".pl 1" echo ".ll 77" echo ".nf" echo ".eo" diffmk file1 file2 ) | nroff .fi .RE .PP The .B .ll setting might be altered for different programs. .SH SEE ALSO diff(1), troff(1) .SH HISTORY Local product, written somewhat in imitation of the PWB .IR diffmark . .SH BUGS Some manual tinkering may be needed to maximize output beauty. Specifically, file differences involving only formatting requests may produce spurious change bars. .PP Shell metacharacters like .B \e and .B $ must be used with care in user-specified marker lines. ----------------------------------------------------------------- gopher://quux.org/ conversion by John Goerzen of http://communication.ucsd.edu/A-News/ This Usenet Oldnews Archive article may be copied and distributed freely, provided: 1. There is no money collected for the text(s) of the articles. 2. The following notice remains appended to each copy: The Usenet Oldnews Archive: Compilation Copyright (C) 1981, 1996 Bruce Jones, Henry Spencer, David Wiseman.