174dbf40eSmrg#! /bin/sh 274dbf40eSmrg# 341f9e942Smrg# $eterna: html_cmp,v 1.9 2011/11/17 22:18:02 mrg Exp $ 474dbf40eSmrg# 510c3be53Sschmonz# like cmp(1)/diff(1) but compares to files after making their 610c3be53Sschmonz# `Date: ' headers the same, to allow `now' and `then' to work properly. 710c3be53Sschmonz# it also tries to find servername's that might be the local host and 810c3be53Sschmonz# converts those as well.. 974dbf40eSmrg# 1010c3be53Sschmonz# it must be called like `html_cmp cmp|diff file1 file1' *only*. 1110c3be53Sschmonz 1210c3be53Sschmonzif [ "cmp" = "$1" ]; then 1310c3be53Sschmonz cmd="cmp -s" 1410c3be53Sschmonzelif [ "diff" = "$1" ]; then 1510c3be53Sschmonz cmd="diff -u" 1610c3be53Sschmonzelse 1710c3be53Sschmonz exit 77 1810c3be53Sschmonzfi 1974dbf40eSmrg 2074dbf40eSmrgh=`hostname || uname -n` 2174dbf40eSmrg 2274dbf40eSmrgsedcmd="s/^Date: .*/Date: nowish/; 2374dbf40eSmrg s/^Last-Modified: .*/Last-Modified: nowish/; 2474dbf40eSmrg s/[a-zA-Z0-9-]*\.eterna\.com\.au/$h/g; 25*a3912675Smrg s/[a-zA-Z0-9-]*\.eterna23\.net/$h/g; 2674dbf40eSmrg s/^Server: .*/^Server: bozotic HTTP server version 5.08/; 2774dbf40eSmrg s/^Content-Length: .*/Content-Length: 223/;" 2874dbf40eSmrg 2910c3be53Sschmonzsed -e "$sedcmd" < "$2" > "f1.tmp.$$" 3010c3be53Sschmonzsed -e "$sedcmd" < "$3" > "f2.tmp.$$" 3174dbf40eSmrg 3210c3be53Sschmonz${cmd} "f1.tmp.$$" "f2.tmp.$$" 3374dbf40eSmrgrv=$? 3441f9e942Smrgrm -f "f1.tmp.$$" "f2.tmp.$$" 3574dbf40eSmrg 3674dbf40eSmrgexit $rv 37