IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 10020


Ignore:
Timestamp:
Nov 16, 2006, 2:22:32 PM (20 years ago)
Author:
jhoblitt
Message:

init/cleanup pslib & psmodules
convert to psTrace() for debugging statements

File:
1 edited

Legend:

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

    r10013 r10020  
    3131#define PRODUCT_LS_CMD "dsproductls"
    3232
     33static bool go (pxConfig *config);
    3334static psArray *parseFileSets(pxConfig *config, const char *str);
    3435
    3536int main(int argc, char **argv)
    3637{
     38    psLibInit(NULL);
     39
    3740    pxConfig *config = pzgetexpConfig(NULL, argc, argv);
    3841
     42    if (!go(config)) {
     43        goto FAIL;
     44    }
     45
     46    psFree(config);
     47    pmConfigDone();
     48    psLibFinalize();
     49
     50    exit(EXIT_SUCCESS);
     51
     52FAIL:
     53    psFree(config);
     54    pmConfigDone();
     55    psLibFinalize();
     56
     57    exit(EXIT_FAILURE);
     58}
     59
     60static bool go(pxConfig *config)
     61{
     62    PS_ASSERT_PTR_NON_NULL(config, NULL);
    3963    // find last fileset/exp_id (if we have one)
    4064    bool haveLastFileSet = false;
     
    7599    }
    76100
    77     // XXX debugging
    78     fprintf(stderr, "cmd is: %s\n", cmd);
     101    psTrace("pzgetexp", PS_LOG_INFO, "cmd is: %s\n", cmd);
    79102
    80103    FILE *output = popen(cmd, "r");
     
    214237    psString line;
    215238    while ((line = psListGetAndIncrement(lineCursor))) {
     239        psTrace("pzgetimfile", PS_LOG_INFO, "parsing line: %s\n", line);
     240
    216241        // split line into tokens
    217242        psList *tokens = psStringSplit(line, " ", false);
     
    286311        }
    287312
     313        // must be freed after the new metadata is built -- holds the strings
     314        psFree(tokenCursor);
     315        psFree(tokens);
     316
    288317        // add the new metadata to the result set
    289318        psArrayAdd(summitExps, 0, md);
    290319
    291         psFree(tokenCursor);
    292         psFree(tokens);
     320        // debugging
     321        if (psTraceGetLevel("pzgetexp") == PS_LOG_INFO) {
     322            psString doc = psMetadataConfigFormat(md);
     323            psTrace("pzgetexp", PS_LOG_INFO, "parsed line as:\n %s\n", doc);
     324            psFree(doc);
     325        }
     326
     327        psFree(md);
    293328
    294329    }
Note: See TracChangeset for help on using the changeset viewer.