IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 4, 2006, 5:37:16 PM (20 years ago)
Author:
Paul Price
Message:

Moving format back into options --- we need to know the camera configuration in order to get the recipe

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppMerge/src/ppMergeConfig.c

    r7067 r7073  
    77
    88// Output usage information
    9 static void usage(const char *programName // Name of the program
     9static void usage(const char *programName, // Name of the program
     10                  pmConfig *config      // Configuration (contains the arguments list)
    1011    )
    1112{
    1213    printf("Merge multiple calibration frames into a master frame by stacking.\n\n"
    1314           "Usage:\n"
    14            "\t%s OUTPUT.fits [-files FILES] [-list FILE_LIST]\n\n"
    15            "where:\n"
    16            "FILES       is a glob to be interpreted by the program.\n"
    17            "FILE_LIST   is a list of files (including a glob interpreted by the shell).\n"
     15           "\t%s OUTPUT.fits INPUT1.fits INPUT2.fits ...\n"
    1816           "\n", programName);
     17    psArgumentHelp(config->arguments);
    1918    exit(EXIT_FAILURE);
    2019}
     
    2221pmConfig *ppMergeConfig(int *argc, char **argv)
    2322{
    24     if (*argc == 1) {
    25         usage(argv[0]);
     23    pmConfig *config = pmConfigRead(argc, argv);
     24    // Load the site-wide configuration information
     25    if (! config) {
     26        psErrorStackPrint(stderr, "Can't find site configuration!\n");
     27        exit(EXIT_FAILURE);
    2628    }
    2729
    28     // Load the site-wide configuration information
    29     pmConfig *config = pmConfigRead(argc, argv);
    30     if (! config) {
    31         psErrorStackPrint(stderr, "Can't find site configuration!\n");
    32         usage(argv[0]);
    33     }
    34 
    35     // Parse other command-line arguments, save for future use
     30    // Command-line arguments
    3631    config->arguments = psMetadataAlloc(); // The arguments, with default values
    3732    psMetadataAddStr(config->arguments, PS_LIST_TAIL, "-type", 0, "Type of calibration frame", "");
     
    4136    psMetadataAddS32(config->arguments, PS_LIST_TAIL, "-onoff", 0, "Number of on/off pairs", 0);
    4237
     38    if (*argc == 1) {
     39        usage(argv[0], config);
     40    }
     41
    4342    // Parse the arguments
    44     if (! psArgumentParse(config->arguments, argc, argv) || *argc != 2) {
    45         usage(argv[0]);
     43    if (! psArgumentParse(config->arguments, argc, argv) || *argc < 3) {
     44        usage(argv[0], config);
    4645    }
    4746
     
    5655    psArray *files = psArrayAlloc(*argc - 2);
    5756    for (int i = 2; i < *argc; i++) {
    58         files->data[i] = psStringCopy(argv[i]);
     57        files->data[i - 2] = psStringCopy(argv[i]);
    5958    }
     59    files->n = *argc - 2;
    6060    psMetadataAddPtr(config->arguments, PS_LIST_TAIL, "INPUT", PS_DATA_ARRAY,
    6161                     "Array of inputs images", files);
Note: See TracChangeset for help on using the changeset viewer.