Index: /branches/eam_branches/ipp-20150625/Ohana/src/tools/Makefile
===================================================================
--- /branches/eam_branches/ipp-20150625/Ohana/src/tools/Makefile	(revision 38941)
+++ /branches/eam_branches/ipp-20150625/Ohana/src/tools/Makefile	(revision 38942)
@@ -15,5 +15,5 @@
 DVO_INCS  = $(DESTINC)/dvo.h $(DESTINC)/gfitsio.h $(DESTINC)/ohana.h $(DESTINC)/autocode.h 
 
-PROGRAMS = gconfig fhead ftable fields list_astro glockfile \
+PROGRAMS = gconfig fhead pspsconvert ftable fields list_astro glockfile \
 radec mktemp precess csystem fits_insert \
 medianfilter mefhead ckfits roc random
Index: /branches/eam_branches/ipp-20150625/Ohana/src/tools/src/pspsconvert.c
===================================================================
--- /branches/eam_branches/ipp-20150625/Ohana/src/tools/src/pspsconvert.c	(revision 38942)
+++ /branches/eam_branches/ipp-20150625/Ohana/src/tools/src/pspsconvert.c	(revision 38942)
@@ -0,0 +1,77 @@
+# include <ohana.h>
+# include <gfitsio.h>
+# include "inttypes.h"
+
+void usage();
+
+int main (int argc, char **argv) {
+
+  if (argc != 2) usage ();
+  char *input = argv[1];
+
+  FTable table;
+  Header header;
+  table.header = &header;
+
+  FILE *f = fopen (input, "r");
+  if (f == (FILE *) NULL) {
+    fprintf (stderr, "can't open file %s\n", input);
+    exit (1);
+  }
+
+  int Nsection = 0;
+  while (gfits_fread_header (f, &header)) {
+
+    /* extract the EXTNAME for this component (set to PHU for 0th component) */
+    char extname[80];
+    int status = gfits_scan (&header, "EXTNAME", "%s", 1, extname);
+    if (!status) {
+      if (Nsection == 0) {
+	strcpy (extname, "PHU");
+      } else {
+	strcpy (extname, "UNKNOWN");
+      }
+    }
+    fprintf (stdout, "%-30s ", extname);
+
+    /* extract the datatype for this component (IMAGE for 0th component) */
+    char exttype[80];
+    if (Nsection == 0) {
+      strcpy (exttype, "IMAGE");
+    } else {
+      status = gfits_scan (&header, "XTENSION", "%s", 1, exttype);
+      if (!status) {
+	strcpy (exttype, "UNKNOWN");
+      }
+    }
+    fprintf (stdout, "%-15s ", exttype);
+
+    fprintf (stdout, " %4d", header.Naxes);
+
+    /* extract the individual axes */
+    int i;
+    for (i = 0; i < header.Naxes; i++) {
+      fprintf (stdout, " "OFF_T_FMT, header.Naxis[i]);
+    }
+    fprintf (stdout, "\n");
+
+    int Nrows = 1000;
+    int start = 0;
+    while (start < header.Naxis[1]) {
+      if (!gfits_fread_ftable_range (f, FALSE, &table, start, Nrows)) {
+	fprintf (stderr, "error reading table for extension %d\n", Nsection);
+	exit (1);
+      }
+      fprintf (stderr, "read "OFF_T_FMT" rows\n", header.Naxis[1]);
+      start += Nrows;
+    }
+    Nsection ++;
+  }
+  fclose (f);
+  exit (0);
+}
+
+void usage () {
+    fprintf (stderr, "USAGE: pspsconvert [-h] (table.fits) (outroot)\n");
+    exit (2);
+}
