Cover V05, I10
Article
Listing 1
Listing 10
Listing 2
Listing 3
Listing 4
Listing 5
Listing 6
Listing 7
Listing 8
Listing 9

oct96.tar


Listing 3: cdiff.sh

:
#######################################################
# cdiff.sh - show changes using diff
#######################################################
# This is an fchange.sh support program.  fchange.sh
# uses this program to diff the last two entries in the
# track file.

# filename is passed on command-line
test -f "$1" || exit 1

# cleanup first
rm -f tag_?

awk 'BEGIN { y=0; depth=2; }
/^#_change: / {
y++
if ( y == 2 )
y=0
newtag=sprintf("tag_%d", y)
count[newtag]=1
}
{
line[newtag count[newtag]]=$0
count[newtag]++
}
END {
for (m=0; m < depth; m++) {
newtag=sprintf("tag_%d", m)

print "" > newtag
for (i=1; i < count[newtag]; i++)
printf("%s\n", line[newtag i]) >> newtag
close(newtag)
}
}' $1

# now diff the two files
diff tag_?