Index: trunk/ippTools/src/pxinject.c
===================================================================
--- trunk/ippTools/src/pxinject.c	(revision 11854)
+++ trunk/ippTools/src/pxinject.c	(revision 14018)
@@ -24,11 +24,12 @@
 #include <stdlib.h>
 #include <ippdb.h>
+#include <string.h>
 
 #include "pxtools.h"
-#include "pxtag.h"
 #include "pxinject.h"
 
 static bool newExpMode(pxConfig *config);
 static bool newImfileMode(pxConfig *config);
+static bool updatenewExpMode(pxConfig *config);
 
 # define MODECASE(caseName, func) \
@@ -52,4 +53,5 @@
         MODECASE(PXINJECT_MODE_NEWEXP, newExpMode);
         MODECASE(PXINJECT_MODE_NEWIMFILE, newImfileMode);
+        MODECASE(PXINJECT_MODE_UPDATENEWEXP, updatenewExpMode);
         default:
             psAbort("invalid option (this should not happen)");
@@ -134,8 +136,10 @@
                 exp_tag,
                 exp_id,
+                "reg", // state
                 camera,
                 telescope,
                 imfiles,
-                workdir
+                workdir,
+                "dirty"
             )
         ) {
@@ -191,4 +195,5 @@
         return false;
     }
+#if 0
     psString class = psMetadataLookupStr(&status, config->args, "-class");
     if (!status) {
@@ -200,4 +205,5 @@
         return false;
     }
+#endif
     psString class_id = psMetadataLookupStr(&status, config->args, "-class_id");
     if (!status) {
@@ -220,5 +226,5 @@
 
     // insert with error flag state set to 0 (no errors)
-    if (!newImfileInsert(config->dbh, exp_tag, class, class_id, uri)) {
+    if (!newImfileInsert(config->dbh, exp_tag, class_id, uri)) {
         psError(PS_ERR_UNKNOWN, false, "database error");
         return false;
@@ -227,2 +233,36 @@
     return true;
 }
+
+
+static bool updatenewExpMode(pxConfig *config)
+{
+    PS_ASSERT_PTR_NON_NULL(config, false);
+
+    bool status = false;
+    psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
+        return false;
+    }
+    if (!exp_tag) {
+        psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
+        return false;
+    }
+
+    psString state = psMetadataLookupStr(&status, config->args, "-state");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -state");
+        return false;
+    }
+    if (!state) {
+        psError(PS_ERR_UNKNOWN, true, "-state is required");
+        return false;
+    }
+
+    if (state) {
+        // set detRun.state to state
+        return pxnewExpSetState(config, exp_tag, state);
+    }
+
+    return true;
+}
