X-Git-Url: http://www.dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fshow%2Fbands.pl;h=7841764a0e5232f1b92001eb14a2df67a630c49d;hb=64461bf14f8ce1a01d420a01f1cf056f13b7385b;hp=d2b818aa0ce9ba5f433db5c090a25d1bc04cd719;hpb=1994ae9ca216a19bf373948c5e8d79a9d58369d6;p=spider.git diff --git a/cmd/show/bands.pl b/cmd/show/bands.pl index d2b818aa..7841764a 100644 --- a/cmd/show/bands.pl +++ b/cmd/show/bands.pl @@ -3,37 +3,46 @@ # # Copyright (c) 1998 - Dirk Koopman G1TLH # -# $Id$ +# # -#$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(); +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 $band (@bands) { - my $ref = Bands::get($band)->band; - my $s = sprintf "%10s: ", $band; - for ($i = 0; $i < $#{$ref}; $i += 2) { + 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:-"; - @bands = Bands::get_region_keys(); - foreach $band (@bands) { - my $ref = Bands::get_region($band); - my $s = sprintf("%10s: ", $band ) . join(' ', @{$ref}); + @regs = sort @regs; + foreach my $region (@regs) { + my $ref = Bands::get_region($region); + my $s = sprintf("%10s: ", $region ) . join(' ', @{$ref}); push @out, $s; } }