jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [branches/] [HotSaNIC-0.5.0-pre6/] [modules/] [ntp/] [platform/] [common.pm] - Rev 1

Compare with Previous - Blame - Download


package HotSaNICmod::common;

sub version {
  ($VERSION = '$Revision: 1.4 $') =~ s/.*(\d+\.\d+).*/$1/;
  return "common.pm $VERSION";
  }

sub configure {
  my %MODCONF=HotSaNICparser::get_moduleconfig(".",(NTPCOMMAND=>"var",HOST=>"array"));

  if (!@{$MODCONF{HOST}}) { @{$MODCONF{HOST}}=("localhost,local system"); }
  if ($MODCONF{NTPCOMMAND} eq "") {
    my @list=HotSaNICparser::locate_files("bin/ntpdc");
    if (! @list) { @list=HotSaNICparser::locate_files("bin/xntpdc"); }
    $MODCONF{NTPCOMMAND}=pop @list;
    }

  return %MODCONF;
  }

sub get_names {
  my $entry=shift || ",";
  my $item=shift || "";
  my $community="";

  my  %DESCR=(""=>"","stratum"=>"stratum","distance"=>"root distance","dispersion"=>"root dispersion","frequency"=>"frequency error","stability"=>"stability");

  my ($host,$description)=split /,/,$entry;
  if ($host eq "") {
    $dbname="time";
    $file=$item;
    $name=$item;
    $description=$DESCR{$item};
    }
  else {
    ($dbname=$host) =~ s/:/_/g;
    ($file="$host-$item") =~ s/[.:]/_/g;
    $name="$host-$item";
    $description="$DESCR{$item} on $host";
    }
  return ($host,$community,$item,$dbname,$name,$file,$description);
  }
1;


Powered by WebSVN 2.2.1