IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 24, 2006, 3:01:43 PM (20 years ago)
Author:
Paul Price
Message:

Output filename is optional; default to stdout.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppStats/src/ppStatsSetup.c

    r7924 r7959  
    1313    printf("Return headers, concepts and/or image statistics.\n\n"
    1414           "Usage:\n"
    15            "\t%s INPUT.fits OUTPUT_NAME\n"
     15           "\t%s INPUT.fits [OUTPUT_NAME]\n"
    1616           "\n", config->argv[0]);
    1717    psArgumentHelp(config->arguments);
     
    154154        usageAndDie(config);
    155155    }
    156     if (!psArgumentParse(arguments, config->argc, config->argv) || *config->argc < 2) {
     156    if (!psArgumentParse(arguments, config->argc, config->argv) ||
     157        (*config->argc != 2 && *config->argc != 3)) {
    157158        printf("Unable to parse command-line arguments.\n\n");
    158159        usageAndDie(config);
     
    162163    ppStatsData *data = ppStatsDataAlloc(); // The data
    163164    data->inName = config->argv[1];
    164     data->outName = config->argv[2];
     165    // Output filename is optional
     166    if (*config->argc == 3) {
     167        data->outName = config->argv[2];
     168    }
    165169
    166170    listFromArguments(arguments, "Chip", "-chip", data->chips);
     
    218222
    219223    // Open the output file
    220     data->outFile = fopen(data->outName, "w");
    221     if (!data->outFile) {
    222         psError(PS_ERR_IO, false, "Unable to open output file %s\n", data->outName);
    223         goto die;
    224     }
    225 
     224    if (data->outName && strlen(data->outName) > 0) {
     225        data->outFile = fopen(data->outName, "w");
     226        if (!data->outFile) {
     227            psError(PS_ERR_IO, false, "Unable to open output file %s\n", data->outName);
     228            goto die;
     229        }
     230    } else {
     231        data->outFile = stdout;
     232    }
    226233
    227234    // Determine recipe parameters
Note: See TracChangeset for help on using the changeset viewer.