X-Git-Url: http://www.dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fshow%2Fbands.pl;h=7841764a0e5232f1b92001eb14a2df67a630c49d;hb=64461bf14f8ce1a;hp=158238f3d13c3dbd01b6f5433a8873ab5d1ee94c;hpb=6a0068ec3df1dca0c6ae2714af3c0a4a62998dcf;p=spider.git diff --git a/cmd/show/bands.pl b/cmd/show/bands.pl index 158238f3..7841764a 100644 --- a/cmd/show/bands.pl +++ b/cmd/show/bands.pl @@ -1,31 +1,50 @@ # # display the band data # +# Copyright (c) 1998 - Dirk Koopman G1TLH +# +# +# -#$DB::single = 1; +#DB::single = 1; my ($self, $line) = @_; my @f = split /\s+/, $line; -my @bands; +my @bands = grep {Bands::get($_)?$_:()} @f; +my @regs = grep {Bands::get_region($_)?$_:()} @f; my $band; my @out; +my $i; + +unless (@f) { + @bands = Bands::get_keys(); + @regs = Bands::get_region_keys(); +} +if (@bands) { + @bands = sort { Bands::get($a)->band->[0] <=> Bands::get($b)->band->[0] } @bands; + push @out, "Bands Available:-"; + foreach my $name (@bands) { + my $band = Bands::get($name); + my $ref = $band->band; + my $s = sprintf "%10s: ", $name; + for ($i = 0; $i < @$ref; $i += 2) { + my $from = $ref->[$i]; + my $to = $ref->[$i+1]; + $s .= ", " if $i; + $s .= "$from -> $to"; + } + push @out, $s; + } +} -if (!$line) { - @bands = sort { Bands::get($a)->band->[0] <=> Bands::get($b)->band->[0] } Bands::get_keys(); - push @out, "Bands Available:-"; - foreach $band (@bands) { - my $ref = Bands::get($band)->band; - my $from = $ref->[0]; - my $to = $ref->[1]; - push @out, sprintf "%10s: %d -> %d", $band, $from, $to; - } - push @out, "Regions Available:-"; - @bands = Bands::get_region_keys(); - foreach $band (@bands) { - my $ref = Bands::get_region($band); - my $s = sprintf("%10s: ", $band ) . join(' ', @{$ref}); - push @out, $s; - } +if (@regs) { + push @out, "Regions Available:-"; + @regs = sort @regs; + foreach my $region (@regs) { + my $ref = Bands::get_region($region); + my $s = sprintf("%10s: ", $region ) . join(' ', @{$ref}); + push @out, $s; + } } return (1, @out);