put dx.pl into an explicit handle sub
[spider.git] / perl / convkeps.pl
index a7f3e0ae8ec53753dd0b6180027c4211d7a38bc2..5c8cc077a740d86e66d5e0ad4cec45c3376174d3 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
 #
 # Convert an Amsat 2 line keps bull into Sun.pm format
 #
@@ -32,7 +32,7 @@
 #
 # Copyright (c) 2000 Dirk Koopman G1TLH
 #
-# $Id$
+#
 #
 
 require 5.004;
@@ -61,6 +61,14 @@ my $ref;
 my $line;
 my $count = 0;
 
+my %lookup = (
+       'AO-5' => 'AO-05',
+       'AO-6' => 'AO-06',
+       'AO-7' => 'AO-07',
+       'AO-8' => 'AO-08',
+       
+);
+
 my $f = \*STDIN;
 
 while (@ARGV) {
@@ -96,9 +104,11 @@ while (<$f>) {
                last if m{^-};
                next if m{^To\s+all}i;
                
-               if (/^[- \w]+$/) {
-                       s/\s/-/g;
-                       $name = uc $_;
+               if (/^([- \w]+)(?:\s+\[[-+\w]\])?$/) {
+                       my $n = uc $1;
+                       $n =~ s/\s/-/g;
+                       $name = $lookup{$n};
+                       $name ||= $n;
                        $ref = $keps{$name} = {}; 
                        $state = 2;
                }