From ad547a6b5986815fda458221149728d9d9ab1d87 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 25 Feb 2021 19:22:25 +0000 Subject: restore Build,TODO from r57911 git-svn-id: svn://tug.org/texlive/trunk@57915 c570f23f-e606-0410-a88d-b1316a301751 --- Build/tests/checkdvi.pl | 123 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100755 Build/tests/checkdvi.pl (limited to 'Build/tests/checkdvi.pl') diff --git a/Build/tests/checkdvi.pl b/Build/tests/checkdvi.pl new file mode 100755 index 00000000000..9c6eff2172d --- /dev/null +++ b/Build/tests/checkdvi.pl @@ -0,0 +1,123 @@ +#!/usr/local/bin/perl +# dvicheck -- DVI autotest helper. +# $Id: //depot/Master/support/tests/checkdvi.pl#1 $ +# +# Public domain. +# Originally written as a shell script by Patrice Dumas. +# Revised version written in Perl by Karl Berry. +# +# (Although it's much simpler and more functional in sh, Perl makes it +# possible to run on Windows, for TeX Live, etc. I hope someone cares +# some day.) + +exit (&main ()); + +sub main +{ + if (@ARGV != 2) { + print <; +#warn "read lines from $program @args:\n@lines"; + close (PROG) || warn "close($program @args |) failed: $!"; + + return &clean_dvitype (@lines); +} + + +# +# Read file, run through clean_dvitype, and return as a string. +# +sub clean_file +{ + my ($file) = @_; + + local *FILE; + open (FILE, $file) || die "open($file) failed: $!"; + # read whole file. + my @lines = ; + close (FILE) || warn "close($file) failed: $!"; + + return &clean_dvitype (@lines); +} + + +# +# Clean dvitype output. Make the first element of LINES be the empty +# string (this contains the version number), and excise the first '...' +# string (this is the DVI comment, which typically contains the date). +# Return resulting string. +# +sub clean_dvitype +{ + my (@lines) = @_; + + $lines[0] = ""; + for my $line (@lines) { + last if $line =~ s/^'.*'//; + } + + my $clean = join ("", @lines); +#warn "cleaned lines:\n@lines\ninto:$clean"; + return $clean; +} + + +# +# Save STRING into FILE. This will be the cleaned version, but that's ok. +# +sub save_file +{ + my ($file,$string) = @_; + local *FILE; + open (FILE, ">$file") || die "open(>$FILE) failed: $!"; + print FILE $string; + close (FILE) || warn "close(>$FILE) failed: $!"; +} -- cgit v1.2.3