IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 24, 2007, 12:20:43 PM (19 years ago)
Author:
Paul Price
Message:

Fixing following change to pmConfig

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppSim/src/ppSimArguments.c

    r12976 r12996  
    1111
    1212// Print usage information and die
    13 static void usage(psMetadata *arguments, // Command-line arguments
     13static void usage(const char *program,  // Name of the program
     14                  psMetadata *arguments, // Command-line arguments
    1415                  pmConfig *config      // Configuration
    1516    )
    1617{
    1718    fprintf(stderr, "\nPan-STARRS data simulator\n\n");
    18     fprintf(stderr, "Usage: %s -camera CAMERA_NAME\n", config->argv[0]);
     19    fprintf(stderr, "Usage: %s -camera CAMERA_NAME\n", program);
    1920    fprintf(stderr, "\n");
    2021    psArgumentHelp(arguments);
     
    4748}
    4849
    49 void ppSimArguments(pmConfig *config)
     50void ppSimArguments(int argc, char *argv[], pmConfig *config)
    5051{
    5152    assert(config);
     
    7677    if (!config->camera) {
    7778        psErrorStackPrint(stderr, "A camera name must be specified using the -camera option.");
    78         usage(arguments, config);
    79     }
    80 
    81     if (*config->argc == 1 || !psArgumentParse(arguments, config->argc, config->argv) || *config->argc != 2) {
    82         usage(arguments, config);
     79        usage(argv[0], arguments, config);
     80    }
     81
     82    if (argc == 1 || !psArgumentParse(arguments, &argc, argv) || argc != 2) {
     83        usage(argv[0], arguments, config);
    8384    }
    8485
     
    107108    if (!typeStr) {
    108109        psErrorStackPrint(stderr, "An exposure type must be specified using -type");
    109         usage(arguments, config);
     110        usage(argv[0], arguments, config);
    110111    }
    111112    ppSimType type;                     // Type to simulate
     
    120121    } else {
    121122        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Unrecognised exposure type: %s", typeStr);
    122         usage(arguments, config);
     123        usage(argv[0], arguments, config);
    123124    }
    124125    psMetadataAddS32(config->arguments, PS_LIST_TAIL, "TYPE", 0, "Exposure type", type);
     
    134135        if (isnan(expTime)) {
    135136            psErrorStackPrint(stderr, "The exposure time must be specified using -exptime");
    136             usage(arguments, config);
     137            usage(argv[0], arguments, config);
    137138        }
    138139    }
     
    169170    if (binning <= 0) {
    170171        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Binning (%d) is non-positive.", binning);
    171         usage(arguments, config);
     172        usage(argv[0], arguments, config);
    172173    }
    173174    psMetadataAddS32(config->arguments, PS_LIST_TAIL, "BINNING", 0, "Binning in x and y", binning);
    174175
    175     psMetadataAddStr(config->arguments, PS_LIST_TAIL, "OUTPUT", 0, "Name of the output image",
    176                      config->argv[1]);
     176    psMetadataAddStr(config->arguments, PS_LIST_TAIL, "OUTPUT", 0, "Name of the output image", argv[1]);
    177177
    178178    if (type == PPSIM_TYPE_OBJECT) {
     
    188188            psError(PS_ERR_BAD_PARAMETER_VALUE, false,
    189189                    "-ra, -dec, -pa, -scale, -zp, -seeing must be specified for OBJECT type");
    190             usage(arguments, config);
     190            usage(argv[0], arguments, config);
    191191        }
    192192        psMetadataAddF32(config->arguments, PS_LIST_TAIL, "SCALE", 0, "Plate scale (arcsec/pix)", scale);
Note: See TracChangeset for help on using the changeset viewer.