From: minima <minima>
Date: Thu, 15 Feb 2007 11:11:21 +0000 (+0000)
Subject: allow norad keps to be translated
X-Git-Url: http://dxspider.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=6b7ac21fdac4eca77d744520ae59d2e668a9ad8b;p=spider.git

allow norad keps to be translated
---

diff --git a/Changes b/Changes
index f6a8dfb7..da1e831c 100644
--- a/Changes
+++ b/Changes
@@ -1,16 +1,18 @@
-22Jan06=======================================================================
+15Feb07=======================================================================
+1. allow convkeps.pl to parse NORAD keps files.
+22Jan07=======================================================================
 1. disable default propagation of PC9x sentences
 2. simplify PC17 handling 
-16Jan06=======================================================================
+16Jan07=======================================================================
 1. back ported a change to PC16 handling so that a locally connected node's
 info clears out and generally overrides any residual PC16 info gathered from
 elsewhere.
-15Jan06=======================================================================
+15Jan07=======================================================================
 1. added CTY-1701
-07Jan06=======================================================================
+07Jan07=======================================================================
 1. use IO::Socket blocking where available and switch off or ignore all 
 attempts to block.
-05Jan06=======================================================================
+05Jan07=======================================================================
 1. increase default ephemeral deduping on PC15 to 6 minutes (from 2).
 23Nov06=======================================================================
 1. added wrapping to over length lines in console.pl.
diff --git a/perl/convkeps.pl b/perl/convkeps.pl
index a7f3e0ae..5b546ca7 100755
--- a/perl/convkeps.pl
+++ b/perl/convkeps.pl
@@ -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;
 		}