IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 17, 2006, 3:03:37 PM (20 years ago)
Author:
jhoblitt
Message:

change to popen() exec of dsproductls

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTools/src/pzgetexpConfig.c

    r6837 r6876  
    2121        "telescope name", "");
    2222
    23     bool argErr = false;
    24     if (! psArgumentParse(args, &argc, argv) || argc != 2) {
    25         argErr = true;
    26         fprintf (stderr, "error parsing arguments\n");
    27     }
    28 
    29     if (argErr) {
     23    bool status = false;
     24    if (!psArgumentParse(args, &argc, argv)
     25        || argc != 1
     26        || strcmp(psMetadataLookupStr(&status, args, "-uri"), "") == 0
     27        || strcmp(psMetadataLookupStr(&status, args, "-inst"), "") == 0
     28        || strcmp(psMetadataLookupStr(&status, args, "-telescope"), "") == 0
     29    ) {
     30        fprintf(stderr, "error parsing arguments\n");
    3031        printf("\nPan-STARRS Phase Z Search Tool\n");
    3132        printf("Usage: %s -uri -inst -telescope\n\n", argv[0]);
    3233        psArgumentHelp(args);
    33         psFree(args);
     34        psFree(config);
    3435        exit(EXIT_FAILURE);
    3536    }
    3637
    3738    config->args = args;
     39    // don't free args here as it's silly to increment the ref count then
     40    // "free" it
    3841
    3942    // define Database handle, if used
    4043    config->dbh = pmConfigDB(config->site);
     44    if(!config->dbh) {
     45        psError(PS_ERR_UNKNOWN, false, "Can't connect to db\n");
     46        psFree(config);
     47        exit(EXIT_FAILURE);
     48    }
    4149
    4250    return config;
Note: See TracChangeset for help on using the changeset viewer.