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/guidetoolConfig.c

    r18172 r18468  
    146146    psFree(defineArgs);
    147147
    148     // setup search criterion
    149 #define addWhereStr(name) \
    150     if ((str = psMetadataLookupStr(&status, config->args, "-" #name))) { \
    151         if (!psMetadataAddStr(config->where, PS_LIST_TAIL, #name, 0, "==", str)) {\
    152             psError(PS_ERR_UNKNOWN, false, "failed to add item " #name); \
    153             exit(EXIT_FAILURE); \
    154         } \
    155     }
    156 
    157148    // generate SQL where clause
    158149    config->where = psMetadataAlloc();
    159150
    160 {
    161     psString str = NULL;
    162     int n = 0;
    163     bool status = false;
    164 
    165     addWhereStr(exp_id);
    166     // convert '-inst' to 'camera'
    167     if ((str = psMetadataLookupStr(&status, config->args, "-inst"))) {
    168         if (!psMetadataAddStr(config->where, PS_LIST_TAIL, "camera", 0, "==", str)) {
    169             psError(PS_ERR_UNKNOWN, false, "failed to add item camera");
    170             exit(EXIT_FAILURE);
    171         }
    172     }
    173     addWhereStr(telescope);
    174     addWhereStr(exp_type);
    175     if ((n = psMetadataLookupS32(&status, config->args, "-imfiles"))) {
    176         if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "imfiles", 0, "==", n)) {
    177             psError(PS_ERR_UNKNOWN, false, "failed to add item imfiles");
    178             exit(EXIT_FAILURE);
    179         }
    180     }
    181     addWhereStr(filter);
    182     addWhereStr(stats);
    183     addWhereStr(recipe);
    184     if ((n = psMetadataLookupS32(&status, config->args, "-guide_version"))) {
    185         if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "guide_version", 0, "==", n)) {
    186             psError(PS_ERR_UNKNOWN, false, "failed to add item guide_version");
    187             exit(EXIT_FAILURE);
    188         }
    189     }
    190 }
     151    PXOPT_ADD_WHERE_STR_ALIAS("-inst","camera");
     152    PXOPT_ADD_WHERE_STR(telescope);
     153    PXOPT_ADD_WHERE_STR(exp_type);
     154    PXOPT_ADD_WHERE_S32(imfiles);
     155    PXOPT_ADD_WHERE_STR(filter);
     156    PXOPT_ADD_WHERE_STR(stats);
     157    PXOPT_ADD_WHERE_STR(recipe);
     158    PXOPT_ADD_WHERE_S32(guide_version);
    191159
    192160    if (config->where->list->n < 1) {
Note: See TracChangeset for help on using the changeset viewer.