1 1.1 tls #! /bin/sh 2 1.1 tls # 3 1.4 mrg # $eterna: html_cmp,v 1.9 2011/11/17 22:18:02 mrg Exp $ 4 1.1 tls # 5 1.5 schmonz # like cmp(1)/diff(1) but compares to files after making their 6 1.5 schmonz # `Date: ' headers the same, to allow `now' and `then' to work properly. 7 1.5 schmonz # it also tries to find servername's that might be the local host and 8 1.5 schmonz # converts those as well.. 9 1.1 tls # 10 1.5 schmonz # it must be called like `html_cmp cmp|diff file1 file1' *only*. 11 1.5 schmonz 12 1.5 schmonz if [ "cmp" = "$1" ]; then 13 1.5 schmonz cmd="cmp -s" 14 1.5 schmonz elif [ "diff" = "$1" ]; then 15 1.5 schmonz cmd="diff -u" 16 1.5 schmonz else 17 1.5 schmonz exit 77 18 1.5 schmonz fi 19 1.1 tls 20 1.1 tls h=`hostname || uname -n` 21 1.1 tls 22 1.1 tls sedcmd="s/^Date: .*/Date: nowish/; 23 1.1 tls s/^Last-Modified: .*/Last-Modified: nowish/; 24 1.1 tls s/[a-zA-Z0-9-]*\.eterna\.com\.au/$h/g; 25 1.6 mrg s/[a-zA-Z0-9-]*\.eterna23\.net/$h/g; 26 1.1 tls s/^Server: .*/^Server: bozotic HTTP server version 5.08/; 27 1.1 tls s/^Content-Length: .*/Content-Length: 223/;" 28 1.1 tls 29 1.5 schmonz sed -e "$sedcmd" < "$2" > "f1.tmp.$$" 30 1.5 schmonz sed -e "$sedcmd" < "$3" > "f2.tmp.$$" 31 1.1 tls 32 1.5 schmonz ${cmd} "f1.tmp.$$" "f2.tmp.$$" 33 1.1 tls rv=$? 34 1.4 mrg rm -f "f1.tmp.$$" "f2.tmp.$$" 35 1.1 tls 36 1.1 tls exit $rv 37