Index: trunk/ippTools/src/regtool.c
===================================================================
--- trunk/ippTools/src/regtool.c	(revision 10671)
+++ trunk/ippTools/src/regtool.c	(revision 10972)
@@ -31,4 +31,5 @@
 static bool updateexpMode(pxConfig *config);
 static bool updateimfileMode(pxConfig *config);
+static bool faultimfileMode(pxConfig *config);
 static bool rawimfileMode(pxConfig *config);
 // static p1PendingExpRow *newToP1PendingExp(newExpRow *newExp);
@@ -38,4 +39,5 @@
 static rawDetrendExpRow *newToRawDetrendExp(pxConfig *config, newExpRow *exp);
 static rawImfileRow *newToRawImfile(pxConfig *config, newImfileRow *exp);
+static psU32 mapCodeStrToInt(char *codeStr);
 
 
@@ -58,4 +60,5 @@
         MODECASE(P0TOOL_MODE_UPDATEEXP,       updateexpMode);
         MODECASE(P0TOOL_MODE_UPDATEIMFILE,    updateimfileMode);
+        MODECASE(P0TOOL_MODE_FAULTIMFILE,     faultimfileMode);
         MODECASE(P0TOOL_MODE_RAWIMFILE,       rawimfileMode);
         default:
@@ -234,4 +237,50 @@
 
     psFree(output);
+
+    return true;
+}
+
+static bool faultimfileMode(pxConfig *config)
+{
+    PS_ASSERT_PTR_NON_NULL(config, false);
+
+    bool status = false;
+    psString codeStr = psMetadataLookupStr(&status, config->args, "-code");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -code");
+        return false;
+    }
+    if (!codeStr) {
+        psError(PS_ERR_UNKNOWN, true, "-code is required");
+        return false;
+    }
+
+    // map code string to numeric fault code
+    psU32 code = mapCodeStrToInt(codeStr);
+    if (code == (psU32)-1) {
+        psError(PS_ERR_UNKNOWN, false, "error resolving error code");
+        return false;
+    }
+
+    // update the database
+    psMetadata *values = psMetadataAlloc();
+    if (!psMetadataAddU32(values, PS_LIST_HEAD, "flags", 0, NULL, code)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add metadata item flags");
+        psFree(values);
+        return false;
+    }
+    psFree(values);
+
+    long rowsAffected = psDBUpdateRows(config->dbh, "newImfile", config->where, values); 
+    if (rowsAffected < 0) {
+        // database error
+        psError(PS_ERR_UNKNOWN, false, "database error");
+        return false;
+    }
+    if (rowsAffected < 1) {
+        // we didn't do anything
+        psError(PS_ERR_UNKNOWN, false, "zero rows were affected - either the search criteria didn't match any rows or the field already had the value being set.");
+        return false;
+    }
 
     return true;
@@ -1025,2 +1074,18 @@
 }
 
+static psU32 mapCodeStrToInt(char *codeStr)
+{
+    if (strcasestr(codeStr, "none")) {
+        return PX_ERROR_NONE;
+    } else if (strcasestr(codeStr, "unknown")) {
+        return PX_ERROR_UNKNOWN;
+    } else if (strcasestr(codeStr, "bad_data")) {
+        return PX_ERROR_BAD_DATA;
+    } else if (strcasestr(codeStr, "id10t")) {
+        return PX_ERROR_ID10T;
+    }
+
+    psError(PS_ERR_UNKNOWN, true, "invalid fault code string");
+
+    return (psU32) -1;
+}
