Index: trunk/ippTools/src/pzgetimfiles.c
===================================================================
--- trunk/ippTools/src/pzgetimfiles.c	(revision 15287)
+++ trunk/ippTools/src/pzgetimfiles.c	(revision 16170)
@@ -2,5 +2,5 @@
  * pzgetimfiles.c
  *
- * Copyright (C) 2006  Joshua Hoblitt
+ * Copyright (C) 2006-2008  Joshua Hoblitt
  *
  * This program is free software; you can redistribute it and/or modify it
@@ -70,44 +70,9 @@
     PS_ASSERT_PTR_NON_NULL(config, NULL);
 
-    bool status = false;
-    psString uri = psMetadataLookupStr(&status, config->args, "-uri");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -uri");
-        return false;
-    }
-    if (!uri) {
-        psError(PS_ERR_UNKNOWN, true, "-uri is required");
-        return false;
-    }
-
-    psString filesetid = psMetadataLookupStr(&status, config->args, "-filesetid");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -filesetid");
-        return false;
-    }
-    if (!filesetid) {
-        psError(PS_ERR_UNKNOWN, true, "-filesetid is required");
-        return false;
-    }
-
-    psString camera = psMetadataLookupStr(&status, config->args, "-inst");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -inst");
-        return NULL;
-    }
-    if (!camera) {
-        psError(PS_ERR_UNKNOWN, true, "-inst is required");
-        return NULL;
-    }
-
-    psString telescope = psMetadataLookupStr(&status, config->args, "-telescope");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -telescope");
-        return NULL;
-    }
-    if (!telescope) {
-        psError(PS_ERR_UNKNOWN, true, "-telescope is required");
-        return NULL;
-    }
+    // required
+    PXOPT_LOOKUP_STR(uri, config->args, "-uri", true, false);
+    PXOPT_LOOKUP_STR(filesetid, config->args, "-filesetid", true, false);
+    PXOPT_LOOKUP_STR(camera, config->args, "-inst", true, false);
+    PXOPT_LOOKUP_STR(telescope, config->args, "-telescope", true, false);
 
     // invoke dsfilesetls
@@ -429,34 +394,7 @@
     // these are constants for all records parsed -- look them up before we do
     // any work
-    bool status = false;
-    psString exp_name = psMetadataLookupStr(&status, config->args, "-filesetid");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for '-filesetid'");
-        return NULL;
-    }
-    if (!exp_name) {
-        psError(PS_ERR_UNKNOWN, true, "-filesetid is required");
-        return NULL;
-    }
-
-    psString camera = psMetadataLookupStr(&status, config->args, "-inst");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -inst");
-        return NULL;
-    }
-    if (!camera) {
-        psError(PS_ERR_UNKNOWN, true, "-inst is required");
-        return NULL;
-    }
-
-    psString telescope = psMetadataLookupStr(&status, config->args, "-telescope");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -telescope");
-        return NULL;
-    }
-    if (!telescope) {
-        psError(PS_ERR_UNKNOWN, true, "-telescope is required");
-        return NULL;
-    }
+    PXOPT_LOOKUP_STR(exp_name, config->args, "-filesetid", true, false);
+    PXOPT_LOOKUP_STR(camera, config->args, "-inst", true, false);
+    PXOPT_LOOKUP_STR(telescope, config->args, "-telescope", true, false);
 
     // split the string into lines
