Index: trunk/ippTools/src/dettoolConfig.c
===================================================================
--- trunk/ippTools/src/dettoolConfig.c	(revision 7367)
+++ trunk/ippTools/src/dettoolConfig.c	(revision 7369)
@@ -188,4 +188,6 @@
     psMetadataAddStr(residArgs, PS_LIST_TAIL, "-iter",  0,
         "search for iteration number", NULL);
+    psMetadataAddStr(addresidArgs, PS_LIST_TAIL, "-exp_id",  0,
+        "define detrend ID (required)", NULL);
     psMetadataAddStr(residArgs, PS_LIST_TAIL, "-class_id",  0,
         "search for class ID", NULL);
@@ -209,4 +211,19 @@
     psMetadataAddBool(addresidexpArgs, PS_LIST_TAIL, "-accept",  0,
         "define as having acceptable residuals", false);
+
+    // -residexp
+    psMetadata *residexpArgs = psMetadataAlloc();
+    psMetadataAddStr(residexpArgs, PS_LIST_TAIL, "-det_id",  0,
+        "search for detrend ID (required)", NULL);
+    psMetadataAddStr(residexpArgs, PS_LIST_TAIL, "-iter",  0,
+        "search for iteration number", NULL);
+    psMetadataAddStr(residexpArgs, PS_LIST_TAIL, "-class_id",  0,
+        "search for class ID", NULL);
+    psMetadataAddStr(residexpArgs, PS_LIST_TAIL, "-stats",  0,
+        "search for stats", NULL);
+    psMetadataAddStr(residexpArgs, PS_LIST_TAIL, "-recipe",  0,
+        "search for recipe", NULL);
+    psMetadataAddBool(residexpArgs, PS_LIST_TAIL, "-accept",  0,
+        "search for acceptable residuals", false);
 
 #define PXTOOL_MODE(option, modeval, argset) \
@@ -245,4 +262,5 @@
     PXTOOL_MODE("-resid",           DETTOOL_MODE_RESID,         residArgs);
     PXTOOL_MODE("-addresidexp",     DETTOOL_MODE_ADDRESIDEXP,  addresidexpArgs);
+    PXTOOL_MODE("-residexp",        DETTOOL_MODE_RESIDEXP,     residexpArgs);
 
     bool argErr = false;
@@ -258,5 +276,5 @@
         printf("\nPan-STARRS Detrend Tool\n");
         printf("Usage: %s <mode> [<options>]\n\n", argv[0]);
-        printf(" <mode> : [-define|-raw|-addprocessed|-processed|-addstacked|-stacked|-stackedframe|-addnormalized|-normalized|-normalizedframe|-addresid|-resid|-addresidexp]\n\n");
+        printf(" <mode> : [-define|-raw|-addprocessed|-processed|-addstacked|-stacked|-stackedframe|-addnormalized|-normalized|-normalizedframe|-addresid|-resid|-addresidexp|-residexp]\n\n");
         fprintf (stdout, "-define ");
         psArgumentHelp(defineArgs);
@@ -304,4 +322,7 @@
         psArgumentHelp(addresidexpArgs);
         psFree(addresidexpArgs);
+        fprintf (stdout, "-residexp ");
+        psArgumentHelp(residexpArgs);
+        psFree(residexpArgs);
 
         exit(EXIT_FAILURE);
@@ -321,4 +342,5 @@
     psFree(residArgs);
     psFree(addresidexpArgs);
+    psFree(residexpArgs);
 
     // setup search criterion
@@ -338,4 +360,5 @@
     int n = 0;
     bool status = false;
+    bool boolean = false;
 
     addWhereStr(det_id);
@@ -367,4 +390,10 @@
         }
     }
+    if ((boolean = psMetadataLookupBool(&status, config->args, "-accept"))) {
+        if (!psMetadataAddBool(config->where, PS_LIST_TAIL, "accept", 0, "==", boolean)) {
+            psError(PS_ERR_UNKNOWN, false, "failed to add item accept");
+            exit(EXIT_FAILURE);
+        }
+    }
 }
 
