IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 13, 2008, 4:56:38 PM (18 years ago)
Author:
eugene
Message:

substantial work on argument handling to support externally supplied images

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20080511/ppSim/src/ppSim.c

    r17615 r17672  
    11# include "ppSim.h"
     2
     3int failure (pmConfig *config, psExit status, char *message) {
     4    psErrorStackPrint(stderr, message);
     5    psFree(config);
     6    pmModelClassCleanup();
     7    psLibFinalize();
     8    exit (status);
     9}
    210
    311int main(int argc, char *argv[])
     
    816    pmConfig *config = pmConfigRead(&argc, argv, PPSIM_RECIPE); // Configuration
    917    if (!config) {
    10         psErrorStackPrint(stderr, "Unable to read configurations.");
    11         exit(PS_EXIT_CONFIG_ERROR);
     18        failure (config, PS_EXIT_CONFIG_ERROR, "Unable to read configurations.");
    1219    }
    1320
    14     ppSimArguments(argc, argv, config);
     21    if (!ppSimArguments(argc, argv, config)) {
     22        failure (config, PS_EXIT_CONFIG_ERROR, "Error parsing command-line arguments");
     23    }
    1524
    1625    if (!ppSimCreate(config)) {
    17         psErrorStackPrint(stderr, "Unable to create output file.");
    18         psFree(config);
    19         exit(PS_EXIT_CONFIG_ERROR);
     26        failure (config, PS_EXIT_CONFIG_ERROR, "Unable to create output file.");
    2027    }
    2128
    2229    if (!ppSimLoop(config)) {
    23         psErrorStackPrint(stderr, "Unable to generate data.");
    24         psFree(config);
    25         exit(PS_EXIT_SYS_ERROR);
     30        failure (config, PS_EXIT_SYS_ERROR, "Unable to generate data.");
    2631    }
    2732
     
    3237    psLibFinalize();
    3338
    34     return PS_EXIT_SUCCESS;
     39    exit (PS_EXIT_SUCCESS);
    3540}
Note: See TracChangeset for help on using the changeset viewer.