Home | History | Annotate | Line # | Download | only in testsuite
html_cmp revision 1.4
      1 #! /bin/sh
      2 #
      3 #	$eterna: html_cmp,v 1.9 2011/11/17 22:18:02 mrg Exp $
      4 #
      5 # like cmp(1) but compares to files after making their `Date: ' headers
      6 # the same, to allow `now' and `then' to work properly.  it also tries
      7 # to find servername's that might be the local host and converts those
      8 # as well..
      9 #
     10 # it must be called like `cmp file1 file1' *only*.  
     11 
     12 h=`hostname || uname -n`
     13 
     14 sedcmd="s/^Date: .*/Date: nowish/;
     15 	s/^Last-Modified: .*/Last-Modified: nowish/;
     16 	s/[a-zA-Z0-9-]*\.eterna\.com\.au/$h/g;
     17 	s/^Server: .*/^Server: bozotic HTTP server version 5.08/;
     18 	s/^Content-Length: .*/Content-Length: 223/;"
     19 
     20 sed -e "$sedcmd" < "$1" > "f1.tmp.$$"
     21 sed -e "$sedcmd" < "$2" > "f2.tmp.$$"
     22 
     23 cmp -s "f1.tmp.$$" "f2.tmp.$$"
     24 rv=$?
     25 rm -f "f1.tmp.$$" "f2.tmp.$$"
     26 
     27 exit $rv
     28