fix console.pl max scroll depth
[spider.git] / cmd / dxqsl_export.pl
1 #
2 # Export QSL information from the local database
3 #
4 # Copyright (c) 2010 Dirk Koopman G1TLH
5 #
6
7 my ($self, $line) = @_;
8 my ($fn) = $line;
9 return (1, $self->msg('e5')) if $self->priv < 9;
10 return (1, "export_dxqsl: <pathname to export to>") unless $fn;
11
12 #$DB::single=1;
13
14 return (1, $self->msg('db3', 'QSL')) unless $QSL::dbm;
15
16 my $of = IO::File->new(">$fn") or return(1, $self->msg('e30', $fn));
17 $of->print(q{"call","manager","spots","unix timet","last spotter"}."\n");
18
19 my ($r, $k, $v, $flg, $count, $q);
20 for ($flg = R_FIRST; !$QSL::dbm->seq($k, $v, $flg); $flg = R_NEXT) {
21         next unless $k;
22
23         $q = QSL::get($k);
24         if ($q) {
25                 for (@{$q->[1]}) {
26                         $of->print(join(',', $k, $_->[0], $_->[1], $_->[2], $_->[3]). "\n");
27                         ++$count;
28                 }
29         }
30 }
31 $of->close;
32 return(0, $self->msg("db13", $count, 'dxqsl', $fn));