From c173688dbca74204785c5a354e02730319f334e9 Mon Sep 17 00:00:00 2001
From: slevy <slevy>
Date: Wed, 20 Feb 2013 16:53:41 +0000
Subject: [PATCH] Add Usage message. Add -a (anyway) option: include stars even
 if there's no corresponding radial velocity record.

---
 data/hiprv2speck | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/data/hiprv2speck b/data/hiprv2speck
index a2c9ccd..ee9714d 100755
--- a/data/hiprv2speck
+++ b/data/hiprv2speck
@@ -30,11 +30,23 @@ print "datavar 8 speed\n";
 print "datavar 9 txno\n";
 print "# Space velocities in pc/Myr\n";
 
-while($ARGV[0] =~ /^-[mMyr]/) {
-  shift, $faintmv = shift if $ARGV[0] =~ /^-m/;
-  shift, $faintMv = shift if $ARGV[0] =~ /^-M/;
-  shift, $yalecat = shift if $ARGV[0] =~ /^-y/;
-  shift, $rvelcat = shift if $ARGV[0] =~ /^-r/;
+sub Usage {
+    print STDERR "Usage: $0 [-a] [-m maglim] [-M absmaglim] [-y yale.star] [-r RVelcat]  [hip_main.dat] > stars.speck
+Reads Hipparcos ASCII catalog (hip_main.dat, ADC catalog I/239)
+and General Catalog of Mean Radial Velocities (ADC cat III/3213).
+Writes partiview \".speck\" file.
+";
+    exit(1);
+}
+  
+while($ARGV[0] =~ /^-[amMyr]/) {
+  $_ = shift;
+  $anyway = 1, next if /^-a/;
+  $faintmv = shift, next if /^-m/;
+  $faintMv = shift, next if /^-M/;
+  $yalecat = shift, next if /^-y/;
+  $rvelcat = shift, next if /^-r/;
+  &Usage;
 }
 
 %greek = split(' ', <<EOF);
@@ -190,7 +202,7 @@ while(<>) {
            $rv*$R[1] + $svd*$vd[1] + $sva*$va[1],
            $rv*$R[2] + $svd*$vd[2] + $sva*$va[2] );
   } else {
-    next;
+    next unless $anyway;
     @V = (0,0,0);
   }
 
-- 
GitLab