Index: /trunk/psModules/src/camera/pmFPAfileIO.c
===================================================================
--- /trunk/psModules/src/camera/pmFPAfileIO.c	(revision 16343)
+++ /trunk/psModules/src/camera/pmFPAfileIO.c	(revision 16344)
@@ -914,5 +914,5 @@
 // set the state of the specified pmFPAfile to active (state == true) or inactive
 // if name is NULL, set the state for all pmFPAfiles
-bool pmFPAfileActivate (psMetadata *files, bool state, char *name)
+bool pmFPAfileActivate (psMetadata *files, bool state, const char *name)
 {
     PS_ASSERT_PTR_NON_NULL(files, false);
@@ -963,2 +963,32 @@
     return true;
 }
+
+
+pmFPAfile *pmFPAfileActivateSingle(psMetadata *files, bool state, const char *name, int num)
+{
+    PS_ASSERT_PTR_NON_NULL(files, NULL);
+    PS_ASSERT_STRING_NON_EMPTY(name, NULL);
+    PS_ASSERT_INT_NONNEGATIVE(num, NULL);
+
+    psString regex = NULL;              // Regular expression for psMetadataIteratorAlloc
+    psStringAppend(&regex, "^%s$", name);
+
+    int i = 0;                          // Counter
+    psMetadataItem *item = NULL;        // Item from iteration
+    psMetadataIterator *iter = psMetadataIteratorAlloc(files, PS_LIST_HEAD, regex); // Iterator
+    psFree(regex);
+    while ((item = psMetadataGetAndIncrement(iter))) {
+        if (i++ == num) {
+            pmFPAfile *file = item->data.V; // File of interest
+            if (state) {
+                file->state &= PS_NOT_U8(PM_FPA_STATE_INACTIVE);
+            } else {
+                file->state |= PM_FPA_STATE_INACTIVE;
+            }
+            psFree(iter);
+            return file;
+        }
+    }
+    psFree(iter);
+    return NULL;
+}
Index: /trunk/psModules/src/camera/pmFPAfileIO.h
===================================================================
--- /trunk/psModules/src/camera/pmFPAfileIO.h	(revision 16343)
+++ /trunk/psModules/src/camera/pmFPAfileIO.h	(revision 16344)
@@ -3,7 +3,8 @@
  *
  * @author EAM, IfA
+ * @author PAP, IfA
  *
- * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
- * @date $Date: 2007-04-14 03:22:47 $
+ * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
+ * @date $Date: 2008-02-07 00:09:40 $
  * Copyright 2004-2005 Institute for Astronomy, University of Hawaii
  */
@@ -34,5 +35,14 @@
 // set the state of the specified pmFPAfile to active (state == true) or inactive
 // if name is NULL, set the state for all pmFPAfiles
-bool pmFPAfileActivate (psMetadata *files, bool state, char *name);
+bool pmFPAfileActivate (psMetadata *files, bool state, const char *name);
+
+/// Set the state of a single pmFPAfile (in the case of multiple files with the same name)
+///
+/// Returns file activated
+pmFPAfile *pmFPAfileActivateSingle(psMetadata *files, ///< Files to activate
+                                   bool state, ///< State to set
+                                   const char *name, ///< Name of file to activate
+                                   int num    ///< Sequence numbner of file to activate
+    );
 
 // examine all pmFPAfiles listed in the files and perform the needed I/O operations (open,read,write,close)
