From d5ca9eccd970cb8488176f1d4eb6f266e07c5492 Mon Sep 17 00:00:00 2001 From: Norman Walsh Date: Tue, 4 Dec 2001 18:34:30 +0000 Subject: [PATCH] Tool to check param files --- cvstools/paramchk | 118 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100755 cvstools/paramchk diff --git a/cvstools/paramchk b/cvstools/paramchk new file mode 100755 index 000000000..cadfc2811 --- /dev/null +++ b/cvstools/paramchk @@ -0,0 +1,118 @@ +#!/usr/bin/perl -- # -*- Perl -*- + +# This script checks the param.ent and param.xweb files for consistency + +use strict; +use Getopt::Std; +use vars qw($opt_m); + +my $usage = "$0 [-m makefrag ] param.xweb\n"; + +die $usage if ! getopts('m:'); + +my $file = shift @ARGV || die $usage; +my $dir = "."; + +$dir = $1 if $file =~ /^(.*)\/[^\/]+$/; + +my $entfile = $file; +$entfile =~ s/\.xweb$/.ent/; + +my $ok = 1; +my %params = (); +my %builtin = ("lt"=>1,"gt"=>1,"amp"=>1,"quot"=>1,"apos"=>1); +my @paramfiles = (); + +open (F, $file) || die $usage; +while () { + chop; + if (/&(.*?);/) { + my $param = $1; + + if (!$builtin{$param}) { + if (defined $params{$param}) { + warn "Duplicate parameter: $param\n"; + $ok = 0; + } + if (! -f "$dir/../params/$param.xml") { + warn "No parameter definition: $dir/../params/$param.xml\n"; + $ok = 0; + } + $params{$param} = 0; + } + } + + if (/) { + next if ! /$opt_m"); + print F "PARAMS=$param"; + while (@paramfiles) { + $param = shift @paramfiles; + print F " \\\n $param"; + } + print F "\n"; + close (F); +} + +exit 0 if $ok; +exit 1; + -- 2.40.0