X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2Fconvkeps.pl;h=4c05d05a04d2b49d6970fcd3e350d40ad85d4a96;hb=ff8c77ef8bad7d4ff4433ca233a1dc8f0203983d;hp=3b08e64db62c2a8997a2f8873812cb74983fedd1;hpb=3c2bce62e2acf1128bb09ce0ad1225986cf2de7f;p=spider.git diff --git a/perl/convkeps.pl b/perl/convkeps.pl index 3b08e64d..4c05d05a 100755 --- a/perl/convkeps.pl +++ b/perl/convkeps.pl @@ -27,6 +27,9 @@ # email | convkeps.pl (in amsat email format) # convkeps.pl -p keps.in (a file with just plain keps) # +# if you add the -c flag then the %keps hash will be cleared down +# before adding the new ones. +# # Copyright (c) 2000 Dirk Koopman G1TLH # # $Id$ @@ -49,7 +52,7 @@ use strict; use vars qw($root %keps); use Data::Dumper; -use Keps; +require Keps; my $fn = "$root/local/Keps.pm"; my $state = 0; @@ -64,13 +67,16 @@ while (@ARGV) { $state = 1; } elsif ($arg eq '-e') { $state = 0; + } elsif ($arg eq '-c') { + %keps = (); } elsif ($arg =~ /^-/) { - die "Usage: convkeps.pl [-e|-p] []\n\t-p - plain file just containing keps\n\t-e - amsat email format input file (default)\n"; + die "Usage: convkeps.pl [-c] [-e|-p] []\n\t-p - plain file just containing keps\n\t-e - amsat email format input file (default)\n\t-c - clear Keps data before adding this lot\n"; } else { open (IN, $arg) or die "cannot open $arg (!$)"; $f = \*IN; } } + while (<$f>) { ++$line; chomp; @@ -101,8 +107,8 @@ while (<$f>) { $ref->{mm2} = genenum($mm2); $ref->{bstar} = genenum($bstar); $ref->{elset} = $elset - 0; -# print "$id $number $epoch $decay $mm2 $bstar $elset\n"; -# print "mm2: $ref->{mm2} bstar: $ref->{bstar}\n"; + #print "$id $number $epoch $decay $mm2 $bstar $elset\n"; + #print "mm2: $ref->{mm2} bstar: $ref->{bstar}\n"; $state = 3; } else { @@ -138,7 +144,7 @@ print OUT "#\n# this file is automatically produced by convkeps.pl\n#\n"; print OUT "# Last update: ", scalar gmtime, "\n#\n"; print OUT "\npackage Sun;\n\n"; print OUT $dd->Dumpxs; -print OUT "\n"; +print OUT "1;\n"; close(OUT); @@ -146,6 +152,7 @@ close(OUT); sub genenum { my ($sign, $frac, $esign, $exp) = unpack "aa5aa", shift; + $esign = '+' if $esign eq ' '; my $n = $sign . "." . $frac . 'e' . $esign . $exp; return $n - 0; }