Index: branches/cleanup/ippTools/src/warptool.c
===================================================================
--- branches/cleanup/ippTools/src/warptool.c	(revision 18076)
+++ branches/cleanup/ippTools/src/warptool.c	(revision 18357)
@@ -111,5 +111,5 @@
 
     // required options
-    PXOPT_LOOKUP_STR(fake_id, config->args, "-fake_id", true, false);
+    PXOPT_LOOKUP_S64(fake_id, config->args, "-fake_id", true, false);
     PXOPT_LOOKUP_STR(mode, config->args, "-mode", true, false);
     // check mode
@@ -133,5 +133,5 @@
     warpRunRow *warpRun = warpRunRowAlloc(
             0,          // ID
-            (psS64)atoll(fake_id),
+            fake_id,
             mode,
             "run",      // state
@@ -175,46 +175,9 @@
     PS_ASSERT_PTR_NON_NULL(config, false);
 
-    PXOPT_LOOKUP_STR(warp_id, config->args, "-warp_id", false, false);
-    PXOPT_LOOKUP_STR(fake_id, config->args, "-fake_id", false, false);
-    PXOPT_LOOKUP_STR(chip_id, config->args, "-chip_id", false, false);
-    PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", false, false);
-
     psMetadata *where = psMetadataAlloc();
-    // convert warp_id into a psS64
-    if (warp_id) {
-        if (!psMetadataAddS64(where, PS_LIST_TAIL, "warp_id", 0, "==", (psS64)atoll(warp_id))) {
-            psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id");
-            psFree(where);
-            return false;
-        }
-    }
-
-    // convert fake_id into a psS64
-    if (fake_id) {
-        if (!psMetadataAddS64(where, PS_LIST_TAIL, "fake_id", 0, "==", (psS64)atoll(fake_id))) {
-            psError(PS_ERR_UNKNOWN, false, "failed to add item fake_id");
-            psFree(where);
-            return false;
-        }
-    }
-
-    // convert chip_id into a psS64
-    if (chip_id) {
-        if (!psMetadataAddS64(where, PS_LIST_TAIL, "chip_id", 0, "==", (psS64)atoll(chip_id))) {
-            psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id");
-            psFree(where);
-            return false;
-        }
-    }
-
-    // convert exp_id into a psS64
-    if (exp_id) {
-        if (!psMetadataAddS64(where, PS_LIST_TAIL, "exp_id", 0, "==", (psS64)atoll(exp_id))) {
-            psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
-            psFree(where);
-            return false;
-        }
-    }
-
+    PXOPT_COPY_S64(config->args, where, "-warp_id", "warp_id", "==");
+    PXOPT_COPY_S64(config->args, where, "-fake_id", "fake_id", "==");
+    PXOPT_COPY_S64(config->args, where, "-chip_id", "chip_id", "==");
+    PXOPT_COPY_S64(config->args, where, "-exp_id", "exp_id", "==");
     PXOPT_COPY_STR(config->args, where, "-exp_name", "exp_name", "==");
     PXOPT_COPY_STR(config->args, where, "-inst", "camera", "==");
@@ -350,10 +313,4 @@
 
     if (psArrayLength(output)) {
-        if (!convertIdToStr(output)) {
-            psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
-            psFree(output);
-            return false;
-        }
-
         // negative simple so the default is true
         if (!ippdbPrintMetadatas(stdout, output, "warpRun", !simple)) {
@@ -425,10 +382,4 @@
 
     if (psArrayLength(output)) {
-        if (!convertIdToStr(output)) {
-            psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
-            psFree(output);
-            return false;
-        }
-
         // negative simple so the default is true
         if (!ippdbPrintMetadatas(stdout, output, "warpInputImfile", !simple)) {
@@ -500,10 +451,4 @@
 
     if (psArrayLength(output)) {
-        if (!convertIdToStr(output)) {
-            psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
-            psFree(output);
-            return false;
-        }
-
         // negative simple so the default is true
         if (!ippdbPrintMetadatas(stdout, output, "warpRun", !simple)) {
@@ -525,5 +470,5 @@
 
     PXOPT_LOOKUP_STR(mapfile, config->args, "-mapfile", false, false);
-    PXOPT_LOOKUP_STR(warp_id, config->args, "-warp_id", false, false);
+    PXOPT_LOOKUP_S64(warp_id, config->args, "-warp_id", false, false);
     PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
 
@@ -544,5 +489,5 @@
     } else {
         warpSkyCellMapInsert(config->dbh,
-            (psS64)atoll(warp_id),
+            warp_id,
             NULL,   // skycell_id
             NULL,   // tess_id
@@ -677,10 +622,4 @@
 
     if (psArrayLength(output)) {
-        if (!convertIdToStr(output)) {
-            psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
-            psFree(output);
-            return false;
-        }
-
         // negative simple so the default is true
         if (!ippdbPrintMetadatas(stdout, output, "warpSkyCellMap", !simple)) {
@@ -752,10 +691,4 @@
 
     if (psArrayLength(output)) {
-        if (!convertIdToStr(output)) {
-            psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
-            psFree(output);
-            return false;
-        }
-
         // negative simple so the default is true
         if (!ippdbPrintMetadatas(stdout, output, "warpPendingSkyCell", !simple)) {
@@ -776,5 +709,5 @@
     PS_ASSERT_PTR_NON_NULL(config, false);
 
-    PXOPT_LOOKUP_STR(warp_id, config->args, "-warp_id", true, false);
+    PXOPT_LOOKUP_S64(warp_id, config->args, "-warp_id", true, false);
     PXOPT_LOOKUP_STR(skycell_id, config->args, "-skycell_id", true, false);
     PXOPT_LOOKUP_STR(tess_id, config->args, "-tess_id", true, false);
@@ -806,5 +739,5 @@
     // XXX need to validate that this coresponds to an warpInputImfile
     if (!warpSkyfileInsert(config->dbh,
-                           (psS64)atoll(warp_id),
+                           warp_id,
                            skycell_id,
                            tess_id,
@@ -1009,10 +942,4 @@
 
     if (psArrayLength(output)) {
-        if (!convertIdToStr(output)) {
-            psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
-            psFree(output);
-            return false;
-        }
-
         // negative simple so the default is true
         if (!ippdbPrintMetadatas(stdout, output, "warpSkyfile", !simple)) {
@@ -1033,48 +960,11 @@
     PS_ASSERT_PTR_NON_NULL(config, false);
 
-    PXOPT_LOOKUP_STR(warp_id, config->args, "-warp_id", false, false);
-    PXOPT_LOOKUP_STR(fake_id, config->args, "-fake_id", false, false);
-    PXOPT_LOOKUP_STR(chip_id, config->args, "-chip_id", false, false);
-    PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", false, false);
-
     psMetadata *where = psMetadataAlloc();
-    // convert warp_id into a psS64
-    if (warp_id) {
-        if (!psMetadataAddS64(where, PS_LIST_TAIL, "warpRun.warp_id", 0, "==", (psS64)atoll(warp_id))) {
-            psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id");
-            psFree(where);
-            return false;
-        }
-    }
-
+    PXOPT_COPY_S64(config->args, where, "-warp_id", "warp_id", "==");
+    PXOPT_COPY_S64(config->args, where, "-fake_id", "fake_id", "==");
+    PXOPT_COPY_S64(config->args, where, "-chip_id", "chip_id", "==");
+    PXOPT_COPY_S64(config->args, where, "-exp_id", "exp_id", "==");
     PXOPT_COPY_STR(config->args, where, "-skycell_id", "skycell_id", "==");
     PXOPT_COPY_STR(config->args, where, "-tess_id", "tess_id", "==");
-
-    // convert fake_id into a psS64
-    if (fake_id) {
-        if (!psMetadataAddS64(where, PS_LIST_TAIL, "fakeRun.fake_id", 0, "==", (psS64)atoll(fake_id))) {
-            psError(PS_ERR_UNKNOWN, false, "failed to add item fake_id");
-            psFree(where);
-            return false;
-        }
-    }
-
-    // convert chip_id into a psS64
-    if (chip_id) {
-        if (!psMetadataAddS64(where, PS_LIST_TAIL, "chipRun.chip_id", 0, "==", (psS64)atoll(chip_id))) {
-            psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id");
-            psFree(where);
-            return false;
-        }
-    }
-
-    // convert exp_id into a psS64
-    if (exp_id) {
-        if (!psMetadataAddS64(where, PS_LIST_TAIL, "rawExp.exp_id", 0, "==", (psS64)atoll(exp_id))) {
-            psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
-            psFree(where);
-            return false;
-        }
-    }
 
     // XXX These may need to be updated with the table name?
@@ -1193,10 +1083,4 @@
     }
 
-    if (!convertIdToStr(output)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
-        psFree(output);
-        return false;
-    }
-
     // negative simple so the default is true
     if (!ippdbPrintMetadatas(stdout, output, "warpMask", !simple)) {
