Index: /trunk/psLib/src/dataIO/psFits.c
===================================================================
--- /trunk/psLib/src/dataIO/psFits.c	(revision 2966)
+++ /trunk/psLib/src/dataIO/psFits.c	(revision 2967)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-01-13 01:54:25 $
+ *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-01-13 02:08:30 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -313,4 +313,6 @@
 int psFitsGetExtNum(psFits* fits)
 {
+    int hdunum;
+
     if (fits == NULL) {
         psError(PS_ERR_BAD_PARAMETER_NULL, true,
@@ -319,17 +321,6 @@
     }
 
-    int hdutype = ANY_HDU;
-    int status = 0;
-
-    if (fits_get_hdu_type(fits->p_fd, &hdutype, &status) != 0) {
-        char fitsErr[MAX_STRING_LENGTH];
-        fits_get_errstatus(status, fitsErr);
-        psError(PS_ERR_LOCATION_INVALID, true,
-                PS_ERRORTEXT_psFits_GET_EXTNUM_FAILED,
-                fits->filename, fitsErr);
-        return -1;
-    }
-
-    return hdutype;
+
+    return fits_get_hdu_num(fits->p_fd,&hdunum) - 1;
 }
 
Index: /trunk/psLib/src/fileUtils/psFits.c
===================================================================
--- /trunk/psLib/src/fileUtils/psFits.c	(revision 2966)
+++ /trunk/psLib/src/fileUtils/psFits.c	(revision 2967)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-01-13 01:54:25 $
+ *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-01-13 02:08:30 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -313,4 +313,6 @@
 int psFitsGetExtNum(psFits* fits)
 {
+    int hdunum;
+
     if (fits == NULL) {
         psError(PS_ERR_BAD_PARAMETER_NULL, true,
@@ -319,17 +321,6 @@
     }
 
-    int hdutype = ANY_HDU;
-    int status = 0;
-
-    if (fits_get_hdu_type(fits->p_fd, &hdutype, &status) != 0) {
-        char fitsErr[MAX_STRING_LENGTH];
-        fits_get_errstatus(status, fitsErr);
-        psError(PS_ERR_LOCATION_INVALID, true,
-                PS_ERRORTEXT_psFits_GET_EXTNUM_FAILED,
-                fits->filename, fitsErr);
-        return -1;
-    }
-
-    return hdutype;
+
+    return fits_get_hdu_num(fits->p_fd,&hdunum) - 1;
 }
 
Index: /trunk/psLib/src/fits/psFits.c
===================================================================
--- /trunk/psLib/src/fits/psFits.c	(revision 2966)
+++ /trunk/psLib/src/fits/psFits.c	(revision 2967)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-01-13 01:54:25 $
+ *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-01-13 02:08:30 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -313,4 +313,6 @@
 int psFitsGetExtNum(psFits* fits)
 {
+    int hdunum;
+
     if (fits == NULL) {
         psError(PS_ERR_BAD_PARAMETER_NULL, true,
@@ -319,17 +321,6 @@
     }
 
-    int hdutype = ANY_HDU;
-    int status = 0;
-
-    if (fits_get_hdu_type(fits->p_fd, &hdutype, &status) != 0) {
-        char fitsErr[MAX_STRING_LENGTH];
-        fits_get_errstatus(status, fitsErr);
-        psError(PS_ERR_LOCATION_INVALID, true,
-                PS_ERRORTEXT_psFits_GET_EXTNUM_FAILED,
-                fits->filename, fitsErr);
-        return -1;
-    }
-
-    return hdutype;
+
+    return fits_get_hdu_num(fits->p_fd,&hdunum) - 1;
 }
 
Index: /trunk/psLib/test/dataIO/tst_psFits.c
===================================================================
--- /trunk/psLib/test/dataIO/tst_psFits.c	(revision 2966)
+++ /trunk/psLib/test/dataIO/tst_psFits.c	(revision 2967)
@@ -6,6 +6,6 @@
 *  @author Robert DeSonia, MHPCC
 *
-*  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-01-13 01:54:26 $
+*  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-01-13 02:08:30 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -16,4 +16,5 @@
 
 #include <unistd.h>
+#include <string.h>
 
 static bool makeMulti(void);
@@ -21,6 +22,6 @@
 
 static psS32 tst_psFitsAlloc( void );
-static psS32 tst_psFitsMoveExtName( void );
-static psS32 tst_psFitsMoveExtNum( void );
+static psS32 tst_psFitsMoveExtName( void ); // also tests psFitsGetExtName
+static psS32 tst_psFitsMoveExtNum( void );  // also tests psFitsGetExtNum
 
 testDescription tests[] = {
@@ -125,4 +126,14 @@
         }
 
+        // check to see if I can retrieve the name back from the psFits object.
+        char* nameFromFile = psFitsGetExtName(fits);
+        if (strcmp(nameFromFile,extName) != 0) { // hey, it didn't move?
+            psError(PS_ERR_UNKNOWN, false,
+                    "Failed to retrieve the extension name back ('%s' vs '%s'",
+                    nameFromFile, extName);
+            return 3;
+        }
+        psFree(nameFromFile);
+
         // check that the image is associated to the extension moved, i.e.,
         // did we really move to the proper extension?
@@ -148,4 +159,14 @@
         }
 
+        // check to see if I can retrieve the name back from the psFits object.
+        char* nameFromFile = psFitsGetExtName(fits);
+        if (strcmp(nameFromFile,extName) != 0) { // hey, it didn't move?
+            psError(PS_ERR_UNKNOWN, false,
+                    "Failed to retrieve the extension name back ('%s' vs '%s'",
+                    nameFromFile, extName);
+            return 5;
+        }
+        psFree(nameFromFile);
+
         // check that the image is associated to the extension moved, i.e.,
         // did we really move to the proper extension?
@@ -217,4 +238,12 @@
                     lcv);
             return 3;
+        }
+
+        // check to see if I can retrieve the number back from the psFits object.
+        if (psFitsGetExtNum(fits) != lcv) { // hey, it didn't move?
+            psError(PS_ERR_UNKNOWN, false,
+                    "Failed to retrieve the extension number back (%d vs %d)",
+                    psFitsGetExtNum(fits), lcv);
+            return 5;
         }
 
@@ -265,4 +294,12 @@
         }
 
+        // check to see if I can retrieve the number back from the psFits object.
+        if (psFitsGetExtNum(fits) != lcv) { // hey, it didn't move?
+            psError(PS_ERR_UNKNOWN, false,
+                    "Failed to retrieve the extension number back (%d vs %d)",
+                    psFitsGetExtNum(fits), lcv);
+            return 13;
+        }
+
         // check that the image is associated to the extension moved, i.e.,
         // did we really move to the proper extension?
@@ -284,4 +321,12 @@
                     "Failed to move to extension %d.",
                     lcv);
+            return 15;
+        }
+
+        // check to see if I can retrieve the number back from the psFits object.
+        if (psFitsGetExtNum(fits) != lcv) { // hey, it didn't move?
+            psError(PS_ERR_UNKNOWN, false,
+                    "Failed to retrieve the extension number back (%d vs %d)",
+                    psFitsGetExtNum(fits), lcv);
             return 15;
         }
Index: /trunk/psLib/test/fileUtils/tst_psFits.c
===================================================================
--- /trunk/psLib/test/fileUtils/tst_psFits.c	(revision 2966)
+++ /trunk/psLib/test/fileUtils/tst_psFits.c	(revision 2967)
@@ -6,6 +6,6 @@
 *  @author Robert DeSonia, MHPCC
 *
-*  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-01-13 01:54:26 $
+*  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-01-13 02:08:30 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -16,4 +16,5 @@
 
 #include <unistd.h>
+#include <string.h>
 
 static bool makeMulti(void);
@@ -21,6 +22,6 @@
 
 static psS32 tst_psFitsAlloc( void );
-static psS32 tst_psFitsMoveExtName( void );
-static psS32 tst_psFitsMoveExtNum( void );
+static psS32 tst_psFitsMoveExtName( void ); // also tests psFitsGetExtName
+static psS32 tst_psFitsMoveExtNum( void );  // also tests psFitsGetExtNum
 
 testDescription tests[] = {
@@ -125,4 +126,14 @@
         }
 
+        // check to see if I can retrieve the name back from the psFits object.
+        char* nameFromFile = psFitsGetExtName(fits);
+        if (strcmp(nameFromFile,extName) != 0) { // hey, it didn't move?
+            psError(PS_ERR_UNKNOWN, false,
+                    "Failed to retrieve the extension name back ('%s' vs '%s'",
+                    nameFromFile, extName);
+            return 3;
+        }
+        psFree(nameFromFile);
+
         // check that the image is associated to the extension moved, i.e.,
         // did we really move to the proper extension?
@@ -148,4 +159,14 @@
         }
 
+        // check to see if I can retrieve the name back from the psFits object.
+        char* nameFromFile = psFitsGetExtName(fits);
+        if (strcmp(nameFromFile,extName) != 0) { // hey, it didn't move?
+            psError(PS_ERR_UNKNOWN, false,
+                    "Failed to retrieve the extension name back ('%s' vs '%s'",
+                    nameFromFile, extName);
+            return 5;
+        }
+        psFree(nameFromFile);
+
         // check that the image is associated to the extension moved, i.e.,
         // did we really move to the proper extension?
@@ -217,4 +238,12 @@
                     lcv);
             return 3;
+        }
+
+        // check to see if I can retrieve the number back from the psFits object.
+        if (psFitsGetExtNum(fits) != lcv) { // hey, it didn't move?
+            psError(PS_ERR_UNKNOWN, false,
+                    "Failed to retrieve the extension number back (%d vs %d)",
+                    psFitsGetExtNum(fits), lcv);
+            return 5;
         }
 
@@ -265,4 +294,12 @@
         }
 
+        // check to see if I can retrieve the number back from the psFits object.
+        if (psFitsGetExtNum(fits) != lcv) { // hey, it didn't move?
+            psError(PS_ERR_UNKNOWN, false,
+                    "Failed to retrieve the extension number back (%d vs %d)",
+                    psFitsGetExtNum(fits), lcv);
+            return 13;
+        }
+
         // check that the image is associated to the extension moved, i.e.,
         // did we really move to the proper extension?
@@ -284,4 +321,12 @@
                     "Failed to move to extension %d.",
                     lcv);
+            return 15;
+        }
+
+        // check to see if I can retrieve the number back from the psFits object.
+        if (psFitsGetExtNum(fits) != lcv) { // hey, it didn't move?
+            psError(PS_ERR_UNKNOWN, false,
+                    "Failed to retrieve the extension number back (%d vs %d)",
+                    psFitsGetExtNum(fits), lcv);
             return 15;
         }
