+my $f = \*STDIN;
+
+while (@ARGV) {
+ my $arg = shift @ARGV;
+ if ($arg eq '-p') {
+ $state = 1;
+ } elsif ($arg eq '-e') {
+ $state = 0;
+ } elsif ($arg eq '-c') {
+ %keps = ();
+ } elsif ($arg =~ /^-/) {
+ die "Usage: convkeps.pl [-c] [-e|-p] [<filename>]\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;
+ }
+}