Index: trunk/Ohana/src/opihi/cmd.data/read_vectors.c
===================================================================
--- trunk/Ohana/src/opihi/cmd.data/read_vectors.c	(revision 39462)
+++ trunk/Ohana/src/opihi/cmd.data/read_vectors.c	(revision 39463)
@@ -10,5 +10,5 @@
 int read_table_sizes (Header *header);
 int read_table_fields (Header *header, int isCompressed, int VERBOSE);
-void list_extnames (void);
+void list_extnames (int VERBOSE);
 
 int datafile (int argc, char **argv) {
@@ -409,8 +409,29 @@
   }
 
+  // note the order of -v -list-fields -q below:
+  // VERBOSE = FALSE is the natural default, but if -list-fields is given, 
+  // VERBOSE = TRUE becomes the default.  this can be overridden by -q
+  // but to make that sequence work, we need to test for those three
+  // options in that order: -v -list-fields -q
+  // this is also true for -list (listExtnames)
+  int VERBOSE = FALSE;
+  if ((N = get_argument (argc, argv, "-v"))) {
+    remove_argument (N, &argc, argv);
+    VERBOSE = TRUE;
+  }
   int listFields = FALSE;
   if ((N = get_argument (argc, argv, "-list-fields"))) {
     remove_argument (N, &argc, argv);
     listFields = TRUE;
+    VERBOSE = TRUE;
+  }
+  int listExtnames = FALSE;
+  if (!strcmp(extname, "-list")) {
+    listExtnames = TRUE;
+    VERBOSE = TRUE;
+  }
+  if ((N = get_argument (argc, argv, "-q"))) {
+    remove_argument (N, &argc, argv);
+    VERBOSE = FALSE;
   }
 
@@ -419,10 +440,4 @@
     remove_argument (N, &argc, argv);
     Nextend = atoi (extname);
-  }
-
-  int VERBOSE = FALSE;
-  if ((N = get_argument (argc, argv, "-v"))) {
-    remove_argument (N, &argc, argv);
-    VERBOSE = TRUE;
   }
 
@@ -454,9 +469,4 @@
   // }
 
-  int listExtnames = FALSE;
-  if (!strcmp(extname, "-list")) {
-    listExtnames = TRUE;
-  }
-
   if ((argc < 2) && !getSizes && !listFields && !listExtnames) ESCAPE ("USAGE: read -fits extension [-extnum] [-keyword key] name name ...\n");
   if ((argc != 1) && getSizes)   ESCAPE ("USAGE: read -sizes -fits extension [-extnum] (does not read data values)\n");
@@ -469,5 +479,5 @@
 
   if (listExtnames) {
-    list_extnames ();
+    list_extnames (VERBOSE);
     return TRUE;
   }
@@ -764,5 +774,5 @@
     if (!gfits_scan (header, field, "%s", 1, nval)) strcpy (nval, "none");
 
-    if (VERBOSE) gprint (GP_LOG, "%-18s %-18s %-6s %-8s %-8s %-32s\n", type, unit, format, null, nval, comment); 
+    if (VERBOSE) gprint (GP_LOG, "%-18s %-15s %-18s %-6s %-8s %-8s %-32s\n", type, varname, unit, format, null, nval, comment); 
   }
 
@@ -771,14 +781,14 @@
 }
 
-void list_extnames (void) {
+void list_extnames (int VERBOSE) {
 
   off_t Nbytes, Nelem;
   int i, Naxis, Ncomp, extend, status;
-  char extname[82], exttype[82], axisname[32];
+  char extname[82], varname[32], exttype[82], axisname[32];
   Header header;
 
   fseeko (f, 0, SEEK_SET);
 
-  gprint (GP_LOG, "%-30s %-15s NAXIS NAXIS(i)...\n", "extname", "datatype"); 
+  if (VERBOSE) gprint (GP_LOG, "%-30s %-15s %-15s NAXIS NAXIS(i)...\n", "extname", "varname", "datatype"); 
 
   Ncomp = 0;
@@ -793,5 +803,9 @@
       }
     }
-    gprint (GP_LOG, "%-30s ", extname);
+    if (VERBOSE) gprint (GP_LOG, "%-30s ", extname);
+
+    snprintf (varname, 32, "extname:%d", Ncomp);
+    set_str_variable (varname, extname);
+    if (VERBOSE) gprint (GP_LOG, "%-15s ", varname);
 
     /* extract the datatype for this component (IMAGE for 0th component) */
@@ -804,5 +818,5 @@
       }
     }
-    gprint (GP_LOG, "%-15s ", exttype);
+    if (VERBOSE) gprint (GP_LOG, "%-15s ", exttype);
 
     /* extract the rank of the component */
@@ -813,5 +827,5 @@
       continue;
     }
-    gprint (GP_LOG, " %4d", Naxis);
+    if (VERBOSE) gprint (GP_LOG, " %4d", Naxis);
 
     /* extract the individual axes */
@@ -822,7 +836,7 @@
 	gprint (GP_ERR, "missing %s\n", axisname);
       }
-      gprint (GP_LOG, " "OFF_T_FMT,  Nelem);
-    }
-    gprint (GP_LOG, "\n");
+      if (VERBOSE) gprint (GP_LOG, " "OFF_T_FMT,  Nelem);
+    }
+    if (VERBOSE) gprint (GP_LOG, "\n");
 
     /* are extensions identified? (we will scan for them anyway) */
@@ -840,4 +854,5 @@
     Ncomp ++;
   }
+  set_int_variable ("extname:n", Ncomp);
   return;
 }
