IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 16106


Ignore:
Timestamp:
Jan 16, 2008, 5:33:27 PM (18 years ago)
Author:
jhoblitt
Message:

convert to PXOPT_* macros

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/end_stage/ippTools/src/caltool.c

    r15570 r16106  
    8585    PS_ASSERT_PTR_NON_NULL(config, false);
    8686
    87     // required options
    88     bool status = false;
    89     psString dvodb = psMetadataLookupStr(&status, config->args, "-dvodb");
    90     if (!status) {
    91         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -dvodb");
    92         return false;
    93     }
    94     if (!dvodb) {
    95         psError(PS_ERR_UNKNOWN, true, "-dvodb is required");
    96         return false;
    97     }
     87    // required
     88    PXOPT_LOOKUP_STR(dvodb, config->args, "-set_dvodb", true, false);
    9889
    9990    if (!calDBInsert(config->dbh,
     
    115106    PS_ASSERT_PTR_NON_NULL(config, false);
    116107
    117     bool status = false;
    118     psU64 limit = psMetadataLookupU64(&status, config->args, "-limit");
    119     if (!status) {
    120         psError(PXTOOLS_ERR_PROG, false, "failed to lookup value for -limit");
    121         return false;
    122     }
     108    PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
     109    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
    123110
    124111    psString query = psStringCopy("SELECT * FROM calDB");
     
    164151    }
    165152
    166     bool simple = false;
    167     {
    168         bool status = false;
    169         simple = psMetadataLookupBool(&status, config->args, "-simple");
    170         if (!status) {
    171             psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");
    172             return false;
    173         }
    174     }
    175 
    176153    if (psArrayLength(output)) {
    177154        if (!convertIdToStr(output)) {
     
    199176    PS_ASSERT_PTR_NON_NULL(config, false);
    200177
    201     // required options
    202     bool status = false;
    203     psString cal_id = psMetadataLookupStr(&status, config->args, "-cal_id");
    204     if (!status) {
    205         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -cal_id");
    206         return false;
    207     }
    208     if (!cal_id) {
    209         psError(PS_ERR_UNKNOWN, true, "-cal_id is required");
    210         return false;
    211     }
    212 
    213     psString region = psMetadataLookupStr(&status, config->args, "-region");
    214     if (!status) {
    215         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -region");
    216         return false;
    217     }
    218     if (!region) {
    219         psError(PS_ERR_UNKNOWN, true, "-region is required");
    220         return false;
    221     }
    222 
    223     psString last_step = psMetadataLookupStr(&status, config->args, "-last_step");
    224     if (!status) {
    225         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -last_step");
    226         return false;
    227     }
    228     if (!last_step) {
    229         psError(PS_ERR_UNKNOWN, true, "-last_step is required");
    230         return false;
    231     }
    232 
    233     psString state = psMetadataLookupStr(&status, config->args, "-state");
    234     if (!status) {
    235         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -state");
    236         return false;
    237     }
    238     if (!state) {
    239         psError(PS_ERR_UNKNOWN, true, "-state is required");
    240         return false;
    241     }
     178    // required
     179    PXOPT_LOOKUP_STR(cal_id, config->args, "-cal_id", true, false);
     180    PXOPT_LOOKUP_STR(region, config->args, "-region", true, false);
     181    PXOPT_LOOKUP_STR(last_step, config->args, "-last_step", true, false);
     182    PXOPT_LOOKUP_STR(state, config->args, "-state", true, false);
    242183
    243184    if (!calRunInsert(config->dbh,
     
    260201    PS_ASSERT_PTR_NON_NULL(config, false);
    261202
    262     bool status = false;
    263     psU64 limit = psMetadataLookupU64(&status, config->args, "-limit");
    264     if (!status) {
    265         psError(PXTOOLS_ERR_PROG, false, "failed to lookup value for -limit");
    266         return false;
    267     }
     203    PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
     204    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
    268205
    269206    psString query = psStringCopy("SELECT * FROM calRun");
     
    309246    }
    310247
    311     bool simple = false;
    312     {
    313         bool status = false;
    314         simple = psMetadataLookupBool(&status, config->args, "-simple");
    315         if (!status) {
    316             psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");
    317             return false;
    318         }
    319     }
    320 
    321248    if (psArrayLength(output)) {
    322249        if (!convertIdToStr(output)) {
Note: See TracChangeset for help on using the changeset viewer.