IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 11, 2008, 8:30:31 AM (18 years ago)
Author:
eugene
Message:

make argument handling consistent across all tools

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20080706/ippTools/src/pztoolConfig.c

    r18314 r18468  
    222222    psFree(modes);
    223223
    224     // setup search criterion
    225 #define addWhereStr(name) \
    226 { \
    227     psString str = NULL; \
    228     bool status = false; \
    229     if ((str = psMetadataLookupStr(&status, config->args, "-" #name))) { \
    230         if (!psMetadataAddStr(config->where, PS_LIST_TAIL, #name, 0, "==", str)) {\
    231             psError(PS_ERR_UNKNOWN, false, "failed to add item " #name); \
    232             psFree(config); \
    233             return NULL; \
    234         } \
    235     } \
    236 }
    237 
    238224    // generate SQL where clause
    239225    config->where = psMetadataAlloc();
    240226
    241     addWhereStr(exp_name);
    242     addWhereStr(telescope);
    243     // convert '-inst' to 'camera'
    244     {
    245         psString str = NULL;
    246         bool status = false;
    247         if ((str = psMetadataLookupStr(&status, config->args, "-inst"))) {
    248             if (!psMetadataAddStr(config->where, PS_LIST_TAIL, "camera", 0, "==", str)) {
    249                 psError(PS_ERR_UNKNOWN, false, "failed to add item camera");
    250                 psFree(config);
    251                 return NULL;
    252             }
    253         }
    254     }
    255     addWhereStr(exp_type);
    256     addWhereStr(class);
    257     addWhereStr(class_id);
     227    PXOPT_ADD_WHERE_STR(exp_name);
     228    PXOPT_ADD_WHERE_STR(telescope);
     229    PXOPT_ADD_WHERE_STR_ALIAS("-inst", "camera");
     230    PXOPT_ADD_WHERE_STR(exp_type);
     231    PXOPT_ADD_WHERE_STR(class);
     232    PXOPT_ADD_WHERE_STR(class_id);
    258233
    259234    if (config->where->list->n < 1) {
Note: See TracChangeset for help on using the changeset viewer.