Index: /trunk/ppImage/src/ppImageArguments.c
===================================================================
--- /trunk/ppImage/src/ppImageArguments.c	(revision 19398)
+++ /trunk/ppImage/src/ppImageArguments.c	(revision 19399)
@@ -132,4 +132,11 @@
     }
 
+    if ((argnum = psArgumentGet(argc, argv, "-dumpconfig"))) {
+        psArgumentRemove(argnum, &argc, argv);
+        psMetadataAddStr(config->arguments, PS_LIST_TAIL, "DUMP_CONFIG", PS_META_REPLACE,
+                         "Filename for configuration dump", argv[argnum]);
+        psArgumentRemove(argnum, &argc, argv);
+    }
+
     if (argc != 2) usage ();
 
Index: /trunk/ppImage/src/ppImageLoop.c
===================================================================
--- /trunk/ppImage/src/ppImageLoop.c	(revision 19398)
+++ /trunk/ppImage/src/ppImageLoop.c	(revision 19399)
@@ -28,11 +28,10 @@
     }
 
-    {
+    psString dump_file = psMetadataLookupStr(&status, config->arguments, "DUMP_CONFIG");
+    if (dump_file) {
         pmConfigCamerasCull(config, NULL);
         pmConfigRecipesCull(config, "PPIMAGE,PPSTATS,PSPHOT,MASKS,PSASTRO");
 
-        const char *outroot = psMetadataLookupStr(NULL, config->arguments, "OUTPUT"); // Output root name
-        psAssert(outroot, "Should be there, we put it there!");
-        pmConfigDump(config, input->fpa, outroot);
+        pmConfigDump(config, input->fpa, dump_file);
     }
 
Index: /trunk/ppStack/src/ppStackArguments.c
===================================================================
--- /trunk/ppStack/src/ppStackArguments.c	(revision 19398)
+++ /trunk/ppStack/src/ppStackArguments.c	(revision 19399)
@@ -145,4 +145,13 @@
 
     pmConfigFileSetsMD(config->arguments, &argc, argv, "PPSTACK.SOURCES", "-sources", NULL);
+
+    if ((argNum = psArgumentGet(argc, argv, "-dumpconfig"))) {
+        psArgumentRemove(argNum, &argc, argv);
+        psMetadataAddStr(config->arguments, PS_LIST_TAIL, "DUMP_CONFIG", PS_META_REPLACE,
+                         "Filename for configuration dump", argv[argNum]);
+        psArgumentRemove(argNum, &argc, argv);
+    }
+
+
 
     psMetadata *arguments = config->arguments; // Command-line arguments
@@ -288,13 +297,12 @@
 
     // Dump configuration, now that's it's settled
-    {
+    bool status;
+    psString dump_file =  psMetadataLookupStr(&status, config->arguments, "DUMP_CONFIG");
+    if (dump_file) {
         pmConfigCamerasCull(config, NULL);
         pmConfigRecipesCull(config, "PPSTACK,PPSUB,PPSTATS,PSPHOT,MASKS");
 
-        const char *outroot = psMetadataLookupStr(NULL, arguments, "OUTPUT"); // Output root name
-        psAssert(outroot, "Should be there, we put it there!");
-
         pmFPAfile *input = psMetadataLookupPtr(NULL, config->files, "PPSTACK.INPUT"); // Input file
-        pmConfigDump(config, input->fpa, outroot);
+        pmConfigDump(config, input->fpa, dump_file);
     }
 
Index: /trunk/ppSub/src/ppSubArguments.c
===================================================================
--- /trunk/ppSub/src/ppSubArguments.c	(revision 19398)
+++ /trunk/ppSub/src/ppSubArguments.c	(revision 19399)
@@ -219,4 +219,5 @@
     psMetadataAddBool(arguments, PS_LIST_TAIL, "-photometry", 0, "Perform photometry?", false);
     psMetadataAddS32(arguments, PS_LIST_TAIL, "-threads", 0, "Number of threads", 0);
+    psMetadataAddStr(arguments, PS_LIST_TAIL, "-dumpconfig", 0, "file to dump configuration to", NULL);
 
     if (argc == 1 || !psArgumentParse(arguments, &argc, argv) || argc != 4) {
@@ -345,13 +346,12 @@
 
     // Dump configuration, now that's it's settled
-    {
+    psBool status;
+    psString dump_file =  psMetadataLookupStr(&status, config->arguments, "-dumpconfig");
+    if (dump_file) {
         pmConfigCamerasCull(config, NULL);
         pmConfigRecipesCull(config, "PPSUB,PPSTATS,PSPHOT,MASKS");
 
-        const char *outroot = psMetadataLookupStr(NULL, arguments, "OUTPUT"); // Output root name
-        psAssert(outroot, "Should be there, we put it there!");
-
         pmFPAfile *input = psMetadataLookupPtr(NULL, config->files, "PPSUB.INPUT"); // Input file
-        pmConfigDump(config, input->fpa, outroot);
+        pmConfigDump(config, input->fpa, dump_file);
     }
 
Index: /trunk/psModules/src/config/pmConfigDump.c
===================================================================
--- /trunk/psModules/src/config/pmConfigDump.c	(revision 19398)
+++ /trunk/psModules/src/config/pmConfigDump.c	(revision 19399)
@@ -106,75 +106,8 @@
 
 
-bool pmConfigDump(const pmConfig *config, const pmFPA *source, const char *outroot)
+bool pmConfigDump(const pmConfig *config, const pmFPA *source, const char *filename)
 {
     PS_ASSERT_PTR_NON_NULL(config, false);
-    PS_ASSERT_STRING_NON_EMPTY(outroot, false);
-
-    pmFPAview *view = source ? pmFPAviewTop(source) : pmFPAviewAlloc(0);// View to top level
-    if (!view) {
-        psError(PS_ERR_UNKNOWN, false, "Unable to determine top view for FPA.");
-        return false;
-    }
-
-    pmFPALevel level = pmFPAviewLevel(view); // Level for view
-    const char *levelString;    // String for level
-    switch (level) {
-      case PM_FPA_LEVEL_FPA:
-        levelString = "FPA";
-        break;
-      case PM_FPA_LEVEL_CHIP:
-        levelString = "CHIP";
-        break;
-      case PM_FPA_LEVEL_CELL:
-        levelString = "CELL";
-        break;
-      default:
-        psError(PS_ERR_UNKNOWN, false, "Bad FPA level: %x", level);
-        psFree(view);
-        return false;
-    }
-
-    psMetadata *dumpRules = psMetadataLookupMetadata(NULL, config->system, "CONFIG.DUMP"); // Name rules
-    if (!dumpRules) {
-        psError(PS_ERR_UNKNOWN, false, "Unable to find CONFIG.DUMP in system configuration");
-        psFree(view);
-        return false;
-    }
-
-    const char *rule = psMetadataLookupStr(NULL, dumpRules, levelString); // Rule for output file name
-    if (!rule) {
-        psError(PS_ERR_UNKNOWN, false, "Unable to find %s in CONFIG.DUMP in system configuration",
-                levelString);
-        psFree(view);
-        return false;
-    }
-
-    psString ruleCopy = psStringCopy(rule); // Copy of rule, so we can have our way with it
-
-    psStringSubstitute(&ruleCopy, outroot, "{OUTPUT}");
-
-    if (strstr(ruleCopy, "{PROGRAM}")) {
-        // basename() is allowed to muck with the values, so need to copy
-        psString program = psStringCopy(config->program); // Copy of program name
-        const char *progName = basename(program); // Basename of program
-        psStringSubstitute(&ruleCopy, progName, "{PROGRAM}");
-        psFree(program);
-    }
-
-    if (strstr(ruleCopy, "{TIMESTAMP}")) {
-        psTime *time = psTimeGetNow(PS_TIME_UTC); // Current time
-        psString timeString = psTimeToISO(time); // ISO-formatted time
-        psFree(time);
-        psStringSubstitute(&ruleCopy, timeString, "{TIMESTAMP}");
-        psFree(timeString);
-    }
-
-    psString filename = pmFPANameFromRule(ruleCopy, source, view); // Filename for dump
-    psFree(ruleCopy);
-    psFree(view);
-    if (!filename) {
-        psError(PS_ERR_UNKNOWN, false, "Unable to determine dump filename");
-        return false;
-    }
+    PS_ASSERT_STRING_NON_EMPTY(filename, false);
 
     psString resolved = pmConfigConvertFilename(filename, config, true, false); // Resolved filename
@@ -182,10 +115,8 @@
     if (!psMetadataConfigWrite(config->user, resolved)) {
         psError(PS_ERR_IO, false, "Unable to dump configuration to %s", filename);
-        psFree(filename);
         psFree(resolved);
         return false;
     }
 
-    psFree(filename);
     psFree(resolved);
 
Index: /trunk/psModules/src/config/pmConfigDump.h
===================================================================
--- /trunk/psModules/src/config/pmConfigDump.h	(revision 19398)
+++ /trunk/psModules/src/config/pmConfigDump.h	(revision 19399)
@@ -4,6 +4,6 @@
  *  @author Paul Price, IfA
  *
- *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2008-08-13 02:32:35 $
+ *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2008-09-05 22:41:58 $
  *  Copyright 2005-2006 Institute for Astronomy, University of Hawaii
  */
@@ -30,11 +30,7 @@
 /// Dump the configuration to a file
 ///
-/// The output file is designated by the CONFIG.DUMP metadata in the system configuration, keyed by the FPA
-/// level of the supplied source.  In addition to the standard concept interpolation, additional
-/// interpolations are defined: "{PROGRAM}" is interpolated to the program name, "{TIMESTAMP}" is interpolated
-/// to the current time (ISO format).
 bool pmConfigDump(const pmConfig *config, ///< Configuration to dump
-                  const pmFPA *source,  ///< Source FPA, defines the level for the file rule
-                  const char *outroot   ///< Output root name
+                  const pmFPA *source,    ///< Source FPA, defines the level for the file rule
+                  const char *filename    ///< Output file name
     );
 
Index: /trunk/pswarp/src/pswarpArguments.c
===================================================================
--- /trunk/pswarp/src/pswarpArguments.c	(revision 19398)
+++ /trunk/pswarp/src/pswarpArguments.c	(revision 19399)
@@ -59,4 +59,11 @@
         psMetadataAddBool(config->arguments, PS_LIST_TAIL, "PSF", 0, "Do PSF determination?", true);
     }
+    if ((N = psArgumentGet(argc, argv, "-dumpconfig"))) {
+        psArgumentRemove(N, &argc, argv);
+        psMetadataAddStr(config->arguments, PS_LIST_TAIL, "DUMP_CONFIG", PS_META_REPLACE,
+                         "Filename for configuration dump", argv[N]);
+        psArgumentRemove(N, &argc, argv);
+    }
+
 
     if (!pmConfigFileSetsMD (config->arguments, &argc, argv, "INPUT", "-file", "-list")) {
@@ -166,5 +173,6 @@
 
     // Dump configuration, now that's it's settled
-    {
+    psString dump_file =  psMetadataLookupStr(&status, config->arguments, "DUMP_CONFIG");
+    if (dump_file) {
         const char *skyCamera = psMetadataLookupStr(NULL, config->arguments,
                                                     "SKYCELL.CAMERA");  // Name of camera for skycell
@@ -172,9 +180,6 @@
         pmConfigRecipesCull(config, "PSWARP,PPSTATS,PSPHOT,MASKS");
 
-        const char *outroot = psMetadataLookupStr(NULL, config->arguments, "OUTPUT"); // Output root name
-        psAssert(outroot, "Should be there, we put it there!");
-
         pmFPAfile *input = psMetadataLookupPtr(NULL, config->files, "PSWARP.INPUT"); // Input file
-        pmConfigDump(config, input->fpa, outroot);
+        pmConfigDump(config, input->fpa, dump_file);
     }
 
