#!/usr/bin/perl

undef $/;
$config = <>;

@tf = qw (Off On);	# True/False labels

@name = (
  ['Start Directory', ['Windows Directory', 'System Directory']],
  'Server Filename',
  'Unused?',
  'S7 Special Method Filename',
  ['Melt Server', [@tf]],
  ['Registry - Run', [@tf]],
  ['Registry - RunServices (2k/XP)', [@tf]],
  ['win.ini', [@tf]],
  ['system.ini', [@tf]],
  ['S7 Special Method', [@tf]],
  'Registry Run Key',
  'ICQ Notification',
  'CGI Notification',
  'MSN Notification',
  'IRC Notification',
  'PHP Notification',
  'SMTP Notification',
  'Specific/Custom .EXEs To Kill',
  'Specific/Custom NT/2k/XP Services To Kill',
  'Firewall .EXEs To Kill',
  'Antivirus .EXEs To Kill',
  'ID Name',
  ['Use Server Password?', [@tf]],
  'Server Port',
  'Server Password',
  'Start Notification Character',
  'End Notification Character',
  'Notification String Format',
  ['Use Fake Error?', [@tf]],
  'Fake Error Message',
  'Unused?',
  'Firewall & Antivirus .EXEs To Kill',
  'Firewall Services To Kill',
  'Antivirus Services To Kill',
  'Firewall & Antivirus Services To Kill',
  'IP Seperator'
);

@a = split /\xfd/, $config;

my $section = 0;
my $array;
$" = "<->";

for $a (@a) {
  #print $name[$section] ? $name[$section] : '*UNKNOWN*', " [$section]\n";
  $array = 0;
  if ($name[$section]) {
    if (ref $name[$section] eq 'ARRAY') {
      $sectionname = ${name[$section]}[0], "\n";
      $array = 1;
    } else {
      $sectionname = "$name[$section]";
    }
  } else {
    $sectionname = "*UNKNOWN*";
  }
  print "--- Section Begin: $sectionname ---\n";
  @b = split /\xfc/, $a;
  for $b (@b) {
    @c = split /\xfb/, $b;
    if ($array) {
      print ${${name[$section]}[1]}[$c[0]], "\n";
    } else {
      print "@c\n";
    }
  }
  print "--- Section End: $sectionname ---\n";
  $section++;
}
