IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 13, 2006, 5:10:34 PM (20 years ago)
Author:
eugene
Message:

all sorts of error handling fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psastro/src/psastroArguments.c

    r9373 r9574  
    11# include "psastro.h"
    22# include <glob.h>
    3 // XXX leak free 2006.04.27
    4 
    5 static void usage (void) {
    6     fprintf (stderr, "USAGE: psastro [-file image(s)] [-list imagelist] (output)\n");
    7     exit (2);
    8 }
    93
    104pmConfig *psastroArguments (int argc, char **argv) {
     
    137    int N;
    148
    15     if (argc == 1) usage ();
     9    if (argc == 1) {
     10        psError(PSASTRO_ERR_ARGUMENTS, true, "No arguments supplied");
     11        return NULL;
     12    }
    1613
    1714    // basic pslib options
     
    5047
    5148    status = pmConfigFileSetsMD (config->arguments, config, "INPUT", "-file", "-list");
    52     if (!status) { usage ();}
    53 
    54     if (argc != 2) usage ();
    55 
     49    if (!status) {
     50        psError(PSASTRO_ERR_ARGUMENTS, true, "Missing -file (input) or -list (input)");
     51        return NULL;
     52    }
     53   
     54    if (argc != 2) {
     55        psError(PSASTRO_ERR_ARGUMENTS, true, "Incorrect arguments supplied");
     56        return NULL;
     57    }
     58   
    5659    // output positions is fixed
    5760    psMetadataAddStr (config->arguments, PS_LIST_TAIL, "OUTPUT", 0, "", argv[1]);
    5861
    59     psTrace(__func__, 1, "Done with psastroArguments...\n");
     62    psTrace("psastro", 1, "Done with psastroArguments...\n");
    6063    return (config);
    6164}
Note: See TracChangeset for help on using the changeset viewer.