X-Git-Url: http://www.dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fshow%2Fbands.pl;h=7841764a0e5232f1b92001eb14a2df67a630c49d;hb=64461bf14f8ce1a01d420a01f1cf056f13b7385b;hp=5e71ec0f999b345371ad717940f2c68cf07e452b;hpb=3d29b1a4d4aab997da2deff10470068601744530;p=spider.git diff --git a/cmd/show/bands.pl b/cmd/show/bands.pl index 5e71ec0f..7841764a 100644 --- a/cmd/show/bands.pl +++ b/cmd/show/bands.pl @@ -1,37 +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; -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 $s = sprintf "%10s: ", $band; - 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; - } - 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; - } +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 (@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);