#!/usr/local/bin/perl

# phase 1: read prod.cnf
$config="prod.cnf";
open (CONFIG,$config) || open (CONFIG,"prod.cnf") || die "Can't open $config.\n";
while (<CONFIG>)
{
  chop;
  if (substr($_,0,1) eq "#") {next;}
  if (length==0) {next;}
  split(/:/);
  if (@_ < 2) {next;}
  $cfig[$_[0]]=$_[1];
}

while (<>)
{
  print "-----------------------------------------------\n";
  chop;
  if (/^[^0-9]/) {s/:/\t/;s/^/50:/;}
  split(/\t/);
  if (@_)
  {
    foreach $f (@_)
    {
      @pair = split(/:/,$f,2);
      @lines = split(/\\n/,$pair[1]);
      $label = $cfig[$pair[0]];
      while ($l=shift(@lines))
      {
        printf "%20s: %s\n", $label,$l;
	$label = "";
      }
    }
  }
}
print "-----------------------------------------------\n";
