#!/usr/bin/perl # ----------------------------------------------------------------------------- # TWC # Treuwert-Computer GmbH # Schloßbergring 9 # 79098 Freiburg # # ----------------------------------------------------------------------------- # Programm-Daten # ----------------------------------------------------------------------------- # Projekt : Tools # System : Linux # Programm : ImportInDB.pl # Modul : $RCSfile: ScanConfigEntries.pl,v $ # Version : $Revision: 1.1 $ # Stand von: $Date: 2002/02/28 15:43:44 $ # Status : $State: Exp $ # # Description: # Translate perl messages # # ----------------------------------------------------------------------------- # ----------------------------------------------------------------------------- # $Log: ScanConfigEntries.pl,v $ # Revision 1.1 2002/02/28 15:43:44 k_reger # - Scan Source-files for usage of Config-file entries # # # ----------------------------------------------------------------------------- use vars qw(%hConfigGL $opt_D $opt_V); use Text::DelimMatch; use Getopt::Std; use File::Basename; use strict; $main::cVersionMGL = '$Date: 2002/02/28 15:43:44 $$Revision: 1.1 $ '; $main::cProgramMGL = basename($0); getopts("DV") || Usage(); # Print version if ($opt_V) { print "$0: $main::cVersionMGL\n"; exit; } Usage() unless @ARGV; Main(@ARGV); # --- show the usage of the script --------------------------------------------- sub Usage() { print < $hConfigGL{$cSection}{$cValue}\n"; } } } # sub Main sub ScanSource ($) { my $cSourceFileName = shift; my $cLine; my $cFile; my $cMatch; my $cPrefix; my $mc; my @lResult; my $iLine; open SOURCE, "<$cSourceFileName" or die "Can't open $cSourceFileName"; print STDERR "Scan $cSourceFileName ...\n" if $opt_D; while () { chomp; $cFile .= $_; } close SOURCE; $mc = new Text::DelimMatch; $mc->delim("&?(MyVal|MyUserVal)\s*\\(", "\\)"); # $mc->quote('[\"]'); $mc->quote(''); $mc->escape("\\"); $mc->double_escape('"'); $mc->case_sensitive(1); $iLine = 0; # Scan translatable messages out while ($cFile) { $iLine ++; ($cPrefix, $cMatch, $cFile) = $mc->match($cFile); no strict; print STDERR "$cMatch\n"; @lResult = eval $cMatch; $hConfigGL{$lResult[0]}{$lResult[1]} = $lResult[2]; # print STDERR "$lResult[0] - $lResult[1]\n"; use strict; } } sub MyVal($$;$) # ConfigFile { my ($cSectionPI, $cEntryPI, $cDefaultPI) = @_; return @_; } sub MyUserVal($$;$) # ConfigFile { my ($cSectionPI, $cEntryPI, $cDefaultPI) = @_; return @_; }