IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 8, 2007, 3:42:25 PM (19 years ago)
Author:
Paul Price
Message:

Adding exit status codes.

File:
1 edited

Legend:

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

    r10441 r10983  
    1515int main(int argc, char *argv[])
    1616{
    17     int status = EXIT_SUCCESS;
     17    psExit status = PS_EXIT_SUCCESS;
    1818
    1919    psLibInit(NULL);
     
    2222    // Parse the configuration and arguments
    2323    pmConfig *config = pmConfigRead(&argc, argv, PPSTATS_RECIPE);
     24    if (!config) {
     25        psError(PS_ERR_UNKNOWN, false, "Unable to read configuration.\n");
     26        exit(PS_EXIT_CONFIG_ERROR);
     27    }
    2428
    2529    // Get the options, open the files
    2630    ppStatsData *data = ppStatsSetupFromArgs(config);
     31    if (!data) {
     32        psError(PS_ERR_UNKNOWN, false, "Unable to parse command-line arguments.\n");
     33        exit(PS_EXIT_CONFIG_ERROR);
     34    }
    2735
    2836    // Output filename is optional
     
    3543            if (!outFile) {
    3644                psLogMsg("ppStats", PS_LOG_ERROR, "Unable to open output file %s\n", outName);
    37                 status = EXIT_FAILURE;
     45                status = PS_EXIT_DATA_ERROR;
    3846                goto die;
    3947            }
    4048        } else {
    4149            psLogMsg("ppStats", PS_LOG_ERROR, "Unable to open output file.\n");
    42             status = EXIT_FAILURE;
     50            status = PS_EXIT_DATA_ERROR;
    4351            goto die;
    4452        }
     
    5159        psLogMsg("ppStats", PS_LOG_ERROR, "No output.\n");
    5260        psFree(results);
    53         status = EXIT_FAILURE;
     61        status = PS_EXIT_UNKNOWN_ERROR;
    5462        goto die;
    5563    }
     
    6068        psLogMsg("ppStats", PS_LOG_ERROR, "Unable to generate configuration file with result.\n");
    6169        psFree(results);
    62         status = EXIT_FAILURE;
     70        status = PS_EXIT_SYS_ERROR;
    6371        goto die;
    6472    }
Note: See TracChangeset for help on using the changeset viewer.