X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=vos%2Fconfig.pl;h=c865ba158b6d7def24b68988f7217a4ef73d75a4;hb=1fd3532f9ed8ec7839f29d416bafc4721424c1d9;hp=c6014ade9af40c24404b4dac8739d078111ce7b6;hpb=cb50131aab68ac6dda048612c6e853b8cb08701e;p=p5sagit%2Fp5-mst-13.2.git diff --git a/vos/config.pl b/vos/config.pl index c6014ad..c865ba1 100644 --- a/vos/config.pl +++ b/vos/config.pl @@ -3,6 +3,7 @@ # # Written January 24, 2000 by Jarkko Hietaniemi [jhi@iki.fi] # Modified February 2, 2000 by Paul Green [Paul_Green@stratus.com] +# Modified October 23, 2000 by Paul Green [Paul_Green@stratus.com] # # Read in the definitions file @@ -13,6 +14,7 @@ if (open(CONFIG_DEF, "config.def")) { if (/^([^=]+)='(.*)'$/) { my ($var, $val) = ($1, $2); $define{$var} = $val; + $used{$var} = 0; } else { warn "config.def: $.: illegal line: $_"; } @@ -27,8 +29,9 @@ close (CONFIG_DEF); # Open the template input file. # -unless (open(CONFIG_SH, "config_h.SH_orig")) { - die "$0: Cannot open config_h.SH_orig: $!"; +$lineno = 0; +unless (open(CONFIG_SH, "../config_h.SH")) { + die "$0: Cannot open ../config_h.SH: $!"; } # @@ -44,6 +47,7 @@ unless (open(CONFIG_H, ">config.h.new")) { # while () { + $lineno = $lineno + 1; last if /^sed <) { # while () { + $lineno = $lineno + 1; last if /^!GROK!THIS!/; # +# The definition of SITEARCH and SITEARCH_EXP has to be commented-out. +# The easiest way to do this is to special-case it here. +# + if (/^#define SITEARCH*/) { + s@(^.*$)@/*$1@; + } +# # The case of #$d_foo at the BOL has to be handled carefully. # If $d_foo is "undef", then we must first comment out the entire line. # - if (/^#\$\w+/) { - s@^#(\$\w+)@("$define{$1}" eq "undef")?"/*#define":"#$define{$1}"@e; + if (/^#(\$\w+)/) { + if (exists $define{$1}) { + $used{$1}=1; + s@^#(\$\w+)@("$define{$1}" eq "undef") ? + "/*#define":"#$define{$1}"@e; + } } # # There could be multiple $variables on this line. # Find and replace all of them. # if (/(\$\w+)/) { - s/(\$\w+)/(exists $define{$1}) ? $define{$1} : $1/ge; + s/(\$\w+)/(exists $define{$1}) ? + (($used{$1}=1),$define{$1}) : + ((print "Undefined keyword $1 on line $lineno\n"),$1)/ge; print CONFIG_H; } # @@ -82,3 +100,10 @@ unless (close (CONFIG_H)) { } close (CONFIG_SH); + +while (($key,$value) = each %used) { + if ($value == 0) { + print "Unused keyword definition: $key\n"; + } +} +