IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 7344


Ignore:
Timestamp:
Jun 5, 2006, 11:57:27 AM (20 years ago)
Author:
rhl
Message:

1/ Move psLogSetFormat() to psphot.c
2/ Return NULL rather than exiting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotArguments.c

    r6851 r7344  
    11# include "psphot.h"
    22# include <glob.h>
    3 
    4 static void usage (void) {
    5     fprintf (stderr, "USAGE: psphot [-file image(s)] [-list imagelist] (output)\n");
    6     exit (2);
    7 }
    83
    94pmConfig *psphotArguments (int *argc, char **argv) {
     
    127    bool status;
    138
    14     if (*argc == 1) usage ();
    15 
    16     // basic pslib options
    17     psLogSetFormat ("M");
     9    if (*argc == 1) {
     10        psError(PSPHOT_ERR_ARGUMENTS, true, "Too few arguments: %d", *argc);
     11        return NULL;
     12    }
    1813
    1914    // these other options override the PSPHOT recipe options
     
    105100    pmConfig *config = pmConfigRead(argc, argv);
    106101
     102    if (config == NULL) {
     103        psError(PSPHOT_ERR_CONFIG, false, "pmConfigRead returns NULL");
     104        psFree(options);
     105        return NULL;
     106    }
     107
    107108    // Storage for other command-line arguments
    108109    config->arguments = psMetadataAlloc ();
     
    121122    // the input file is a required argument; if not found, we will exit
    122123    status = pmConfigFileSetsMD (config->arguments, argc, argv, "INPUT", "-file", "-list");
    123     if (!status) { usage ();}
     124    if (!status) {
     125        psError(PSPHOT_ERR_ARGUMENTS, false, "pmConfigFileSetsMD failed to parse arguments");
     126        return NULL;
     127    }
    124128
    125     if (*argc != 2) usage ();
    126 
     129    if (*argc != 2) {
     130        psError(PSPHOT_ERR_ARGUMENTS, true, "Expected to see one more argument; saw %d", *argc - 1);
     131        return NULL;
     132    }
     133   
    127134    // output position is fixed
    128135    psMetadataAddStr (config->arguments, PS_LIST_TAIL, "OUTPUT", 0, "", argv[1]);
Note: See TracChangeset for help on using the changeset viewer.