Index: /branches/eam_branches/ipp-20110213/psModules/src/camera/pmFPAfileDefine.c
===================================================================
--- /branches/eam_branches/ipp-20110213/psModules/src/camera/pmFPAfileDefine.c	(revision 30681)
+++ /branches/eam_branches/ipp-20110213/psModules/src/camera/pmFPAfileDefine.c	(revision 30682)
@@ -282,8 +282,11 @@
               case PS_FITS_SCALE_NONE:
               case PS_FITS_SCALE_RANGE:
+	      case PS_FITS_SCALE_LOG_RANGE:
                 // No options required
                 break;
               case PS_FITS_SCALE_STDEV_POSITIVE:
               case PS_FITS_SCALE_STDEV_NEGATIVE:
+	      case PS_FITS_SCALE_LOG_STDEV_POSITIVE:
+  	      case PS_FITS_SCALE_LOG_STDEV_NEGATIVE:
                 options->stdevNum = parseOptionFloat(scheme, "STDEV.NUM", source); // Padding to edge
                 if (!isfinite(options->stdevNum)) {
@@ -295,4 +298,5 @@
                 // Flow through
               case PS_FITS_SCALE_STDEV_BOTH:
+	      case PS_FITS_SCALE_LOG_STDEV_BOTH:
                 options->stdevBits = parseOptionInt(scheme, "STDEV.BITS", source, 0); // Bits for stdev
                 if (options->stdevBits <= 0) {
@@ -308,4 +312,9 @@
                 options->bzero = parseOptionDouble(scheme, "BZERO", source); // Zero point
                 break;
+	    case PS_FITS_SCALE_LOG_MANUAL:
+	      options->bscale = parseOptionDouble(scheme, "BSCALE", source); // Scaling
+	      options->bzero = parseOptionDouble(scheme, "BZERO", source); // Zero point
+	      options->boffset = parseOptionDouble(scheme, "BOFFSET", source); // Log offset
+	      break;	      
               default:
                 psAbort("Should never get here.");
Index: /branches/eam_branches/ipp-20110213/psModules/src/config/pmConfig.c
===================================================================
--- /branches/eam_branches/ipp-20110213/psModules/src/config/pmConfig.c	(revision 30681)
+++ /branches/eam_branches/ipp-20110213/psModules/src/config/pmConfig.c	(revision 30682)
@@ -897,4 +897,71 @@
             psMetadataAddMetadata(filerules, PS_LIST_TAIL, old, PS_META_REPLACE,
                                   "Original replaced by -F option", newRule);
+        }
+        psFree(camerasIter);
+    }
+
+    // Look for command-line options for files to replace
+    while ((argNum = psArgumentGet(*argc, argv, "-R")) > 0) {
+        psArgumentRemove(argNum, argc, argv);
+        if (argNum + 2 >= *argc) {
+            psError(PM_ERR_CONFIG, true,
+                    "Filerule element switch (-R) provided without filerule element and value.");
+            psFree(config);
+            return NULL;
+        }
+
+        const char *rulename = argv[argNum]; // The filerule, to be modified
+        psArgumentRemove(argNum, argc, argv);
+        const char *element  = argv[argNum]; // The element, to be modified
+        psArgumentRemove(argNum, argc, argv);
+	const char *value    = argv[argNum]; // The value, to be set
+	psArgumentRemove(argNum, argc, argv);
+
+        psMetadata *cameras = psMetadataLookupMetadata(NULL, config->system, "CAMERAS"); // List of cameras
+        if (!cameras) {
+            psError(PM_ERR_CONFIG, false, "Unable to find CAMERAS in the site configuration.\n");
+            return false;
+        }
+
+        psMetadataIterator *camerasIter = psMetadataIteratorAlloc(cameras, PS_LIST_HEAD, NULL); // Iterator
+        psMetadataItem *cameraItem;     // Item from iteration
+        while ((cameraItem = psMetadataGetAndIncrement(camerasIter))) {
+            // Silently ignore problems --- they will be caught later, because if the user wants the nominated
+            // file and it's not available for that camera, then they will know.
+
+            if (cameraItem->type != PS_DATA_METADATA) {
+                psTrace("psModules.config", 2,
+                        "Entry %s in CAMERAS is not of type METADATA --- ignored.", cameraItem->name);
+                continue;
+            }
+            psMetadata *camera = cameraItem->data.md; // Camera configuration
+
+            psMetadata *newRule = pmConfigFileRule(config, camera, rulename); // The rule of interest
+            if (!newRule) {
+                psTrace("psModules.config", 2,
+                        "Unable to find filerule %s in camera %s --- ignored.", rulename, cameraItem->name);
+                continue;
+            }
+
+            // By calling pmConfigFileRule, we've assured that the FILERULES is now a metadata
+            psMetadata *filerules = psMetadataLookupMetadata(NULL, camera, "FILERULES"); // File rules
+            if (!filerules) {
+                psTrace("psModules.config", 2,
+                        "Can't find FILERULES of type METADATA in camera %s --- ignored.", cameraItem->name);
+                continue;
+            }
+
+	    // Convert newRule to have the element value requested.
+	    if (!psMetadataLookupStr(NULL,newRule,element)) {
+	      psTrace("psModules.config", 2,
+		      "Unable to find filerule element %s in filerule %s in camera %s --- ignored.",
+		      element,rulename,cameraItem->name);
+	      continue;
+	    }
+	    psMetadataAddStr(newRule, PS_LIST_TAIL, element, PS_META_REPLACE,
+			     "Original replaced by -R option", value);
+	    
+            psMetadataAddMetadata(filerules, PS_LIST_TAIL, rulename, PS_META_REPLACE,
+                                  "Original replaced by -R option", newRule);
         }
         psFree(camerasIter);
