Home | History | Annotate | Line # | Download | only in testsuite
html_cmp revision 1.4.2.1
      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.4.2.1  snj # like cmp(1)/diff(1) but compares to files after making their
      6  1.4.2.1  snj # `Date: ' headers the same, to allow `now' and `then' to work properly.
      7  1.4.2.1  snj # it also tries to find servername's that might be the local host and
      8  1.4.2.1  snj # converts those as well..
      9      1.1  tls #
     10  1.4.2.1  snj # it must be called like `html_cmp cmp|diff file1 file1' *only*.
     11  1.4.2.1  snj 
     12  1.4.2.1  snj if [ "cmp" = "$1" ]; then
     13  1.4.2.1  snj 	cmd="cmp -s"
     14  1.4.2.1  snj elif [ "diff" = "$1" ]; then
     15  1.4.2.1  snj 	cmd="diff -u"
     16  1.4.2.1  snj else
     17  1.4.2.1  snj 	exit 77
     18  1.4.2.1  snj 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.1  tls 	s/^Server: .*/^Server: bozotic HTTP server version 5.08/;
     26      1.1  tls 	s/^Content-Length: .*/Content-Length: 223/;"
     27      1.1  tls 
     28  1.4.2.1  snj sed -e "$sedcmd" < "$2" > "f1.tmp.$$"
     29  1.4.2.1  snj sed -e "$sedcmd" < "$3" > "f2.tmp.$$"
     30      1.1  tls 
     31  1.4.2.1  snj ${cmd} "f1.tmp.$$" "f2.tmp.$$"
     32      1.1  tls rv=$?
     33      1.4  mrg rm -f "f1.tmp.$$" "f2.tmp.$$"
     34      1.1  tls 
     35      1.1  tls exit $rv
     36