use DXVars;
use DXDebug;
use DXM;
+use DXLog;
use CmdAlias;
use FileHandle;
use Carp;
my $nchan = DXChannel->get($main::mycall);
my @pc16 = DXProt::pc16($nchan, $cuser);
DXProt::broadcast_ak1a(@pc16);
+ Log('DXCommand', "$call connected");
}
#
my $nchan = DXChannel->get($main::mycall);
my $pc17 = $nchan->pc17($self);
DXProt::broadcast_ak1a($pc17);
-
+
+ Log('DXCommand', "$call disconnected");
$ref->del() if $ref;
}
delete $self->{mode};
}
- $self->{fn} = sprintf "$self->{prefix}/$year/%03d", $thing;
+ $self->{fn} = sprintf "$self->{prefix}/$year/%02d", $thing if $self->{sort} eq 'm';
+ $self->{fn} = sprintf "$self->{prefix}/$year/%03d", $thing if $self->{sort} eq 'd';
$self->{fn} .= ".$self->{suffix}" if $self->{suffix};
$mode = 'r' if !$mode;
sub writenow
{
my ($self, $line) = @_;
- my @date = $self->unixtoj(time);
+ my $t = time;
+ my @date = $self->unixtoj($t);
return $self->write(@date, $line);
}
# The user is responsible for making sense of this!
sub Log
{
- $log->writeunix($main::systime, join('^', $main::systime, @_) );
+ my $t = time;
+ $log->writeunix($t, join('^', $t, @_) );
}
sub DESTROY # catch undefs and do what is required further do the tree
use DXProtVars;
use DXProtout;
use DXDebug;
+use DXLog;
use FileHandle;
use Carp;
}
$fh->close;
dbg('msg', "file $ref->{to} stored\n");
+ Log('msg', "file $ref->{to} from $ref->{from} stored" );
} else {
confess "can't open file $ref->{to} $!";
}
}
$fh->close;
dbg('msg', "msg $ref->{msgno} stored\n");
+ Log('msg', "msg $ref->{msgno} from $ref->{from} to $ref->{to} stored" );
} else {
confess "can't open msg file $fn $!";
}
use DXCluster;
use DXProtVars;
use DXCommandmode;
+use DXLog;
use Spot;
use DXProtout;
use Carp;
$self->send(pc18());
$self->state('init');
$self->pc50_t(time);
+ Log('DXProt', "$call connected");
}
#
# now broadcast to all other ak1a nodes that I have gone
broadcast_ak1a(pc21($self->call, 'Gone.'), $self);
+ Log('DXProt', $self->call . " Disconnected");
$ref->del() if $ref;
}
# take a unix date and transform it into a julian day (ie (1998, 13) = 13th day of 1998)
sub unixtoj
{
- my $t = shift;
- my ($year, $day) = (gmtime($t))[5,7];
-
- if ($year < 100) {
- $year += ($year < 50) ? 2000 : 1900;
- }
- return ($year, $day+1);
+ my $t = shift;
+ my ($year, $day) = (gmtime($t))[5,7];
+
+ if ($year < 100) {
+ $year += ($year < 50) ? 2000 : 1900;
+ }
+ return ($year, $day+1);
}
# take a unix and return a julian month from it
{
my $t = shift;
my ($mon, $year) = (gmtime($t))[4..5];
- return ($year, $mon);
+ if ($year < 100) {
+ $year += ($year < 50) ? 2000 : 1900;
+ }
+ return ($year, $mon + 1);
}
# take a julian date and subtract a number of days from it, returning the julian date
sub sub
{
- my ($year, $day, $amount) = @_;
- my $diny = isleap($year) ? 366 : 365;
- $day -= $amount;
- while ($day <= 0) {
- $day += $diny;
- $year -= 1;
- $diny = isleap($year) ? 366 : 365;
- }
- return ($year, $day);
+ my ($year, $day, $amount) = @_;
+ my $diny = isleap($year) ? 366 : 365;
+ $day -= $amount;
+ while ($day <= 0) {
+ $day += $diny;
+ $year -= 1;
+ $diny = isleap($year) ? 366 : 365;
+ }
+ return ($year, $day);
}
sub add
{
- my ($year, $day, $amount) = @_;
- my $diny = isleap($year) ? 366 : 365;
- $day += $amount;
- while ($day > $diny) {
- $day -= $diny;
- $year += 1;
- $diny = isleap($year) ? 366 : 365;
- }
- return ($year, $day);
+ my ($year, $day, $amount) = @_;
+ my $diny = isleap($year) ? 366 : 365;
+ $day += $amount;
+ while ($day > $diny) {
+ $day -= $diny;
+ $year += 1;
+ $diny = isleap($year) ? 366 : 365;
+ }
+ return ($year, $day);
}
# take a julian month and subtract a number of months from it, returning the julian month
sub subm
{
- my ($year, $mon, $amount) = @_;
- $mon -= $amount;
- while ($mon <= 0) {
- $mon += 12;
- $year -= 1;
- }
- return ($year, $mon);
+ my ($year, $mon, $amount) = @_;
+ $mon -= $amount;
+ while ($mon <= 0) {
+ $mon += 12;
+ $year -= 1;
+ }
+ return ($year, $mon);
}
sub addm
{
- my ($year, $mon, $amount) = @_;
- $mon += $amount;
- while ($mon > 12) {
- $mon -= 12;
- $year += 1;
- }
- return ($year, $mon);
+ my ($year, $mon, $amount) = @_;
+ $mon += $amount;
+ while ($mon > 12) {
+ $mon -= 12;
+ $year += 1;
+ }
+ return ($year, $mon);
}
sub cmp
{
- my ($y1, $d1, $y2, $d2) = @_;
- return $d1 - $d2 if ($y1 == $y2);
- return $y1 - $y2;
+ my ($y1, $d1, $y2, $d2) = @_;
+ return $d1 - $d2 if ($y1 == $y2);
+ return $y1 - $y2;
}
# is it a leap year?
sub isleap
{
- my $year = shift;
- return ($year % 4 == 0 && ($year % 100 != 0 || $year % 400 == 0)) ? 1 : 0;
+ my $year = shift;
+ return ($year % 4 == 0 && ($year % 100 != 0 || $year % 400 == 0)) ? 1 : 0;
}
{
my @dx = @_;
my $t = ztime($dx[2]);
- return sprintf "DX de %-7.7s: %13.1f %-12.12s %-30s<%s>", $dx[4], $dx[0], $dx[1], $dx[3], $t ;
+ return sprintf "DX de %-7.7s%11.1f %-12.12s %-30s %s", "$dx[4]:", $dx[0], $dx[1], $dx[3], $t ;
}
# format a spot for user output in list mode
my @dx = @_;
my $t = ztime($dx[2]);
my $d = cldate($dx[2]);
- return sprintf "%9.1f %-12s %s %s %-30s<%s>", $dx[0], $dx[1], $d, $t, $dx[3], $dx[4] ;
-}
+ return sprintf "%8.1f %-11s %s %s %-28.28s%7s>", $dx[0], $dx[1], $d, $t, $dx[3], "<$dx[4]" ;
+}
1;
my $snl = $mynl;
my $newsavenl = "";
$snl = "" if $mode == 0;
- if ($mode && $line =~ />$/) {
+ if ($mode == 2 && $line =~ />$/) {
$newsavenl = $snl;
$snl = ' ';
}
@inqueue = (); # the main input queue, an array of hashes
$systime = 0; # the time now (in seconds)
-$version = 1.3; # the version no of the software
+$version = 1.4; # the version no of the software
# handle disconnections
sub disconnect
foreach $dxchan (DXChannel->get_all()) {
disconnect($dxchan);
}
+ Log('cluster', "DXSpider V$version stopped");
exit(0);
}
}
STDOUT->autoflush(1);
+Log('cluster', "DXSpider V$version started");
+
# banner
print "DXSpider DX Cluster Version $version\nCopyright (c) 1998 Dirk Koopman G1TLH\n";