Index: trunk/psModules/src/config/pmConfig.c
===================================================================
--- trunk/psModules/src/config/pmConfig.c	(revision 7576)
+++ trunk/psModules/src/config/pmConfig.c	(revision 7589)
@@ -3,6 +3,6 @@
  *  @author PAP, IfA
  *
- *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-06-15 02:24:19 $
+ *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-06-17 01:50:43 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -332,5 +332,5 @@
             // XXX: Only stdout and stderr are provided for now; this section should be
             // expanded in the future to do files, and perhaps even sockets.
-            if (!!psLogSetDestination(psMessageDestination(argv[argNum]))) {
+            if (!psLogSetDestination(psMessageDestination(logDest))) {
                 psLogMsg(__func__, PS_LOG_WARN, "Unable to set log destination to %s\n", argv[argNum]);
             }
@@ -546,4 +546,37 @@
     }
     return format;
+}
+
+// Work out what camera we have, based on the FITS header and a set of rules specified in the IPP
+// configuration; return the camera configuration and format
+psMetadata *pmConfigCameraByName(
+    pmConfig *config,                   // The configuration
+    const char *cameraName   // The camera name header
+)
+{
+    PS_ASSERT_PTR_NON_NULL(cameraName, NULL);
+    PS_ASSERT_PTR_NON_NULL(config, NULL);
+
+    psMetadata *cameras = psMetadataLookupMD(NULL, config->site, "CAMERAS");
+    if (!cameras) {
+        psError(PS_ERR_IO, true, "Unable to find CAMERAS in the configuration.");
+        return NULL;
+    }
+
+    char *cameraPath = psMetadataLookupStr(NULL, cameras, cameraName);
+    if (!cameraPath) {
+        psError(PS_ERR_IO, true, "Unable to find requested CAMERA in the configuration.");
+        return NULL;
+    }
+
+    psMetadata *camera = NULL; // Camera to test against what we've got:
+
+    if (!readConfig(&camera, cameraPath, cameraName)) {
+        psLogMsg(__func__, PS_LOG_WARN, "Trouble reading reading camera configuration %s", cameraName);
+        psFree(camera);
+        return NULL;
+    }
+
+    return camera;
 }
 
