Changeset 12996 for trunk/ppSim/src/ppSimArguments.c
- Timestamp:
- Apr 24, 2007, 12:20:43 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ppSim/src/ppSimArguments.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppSim/src/ppSimArguments.c
r12976 r12996 11 11 12 12 // Print usage information and die 13 static void usage(psMetadata *arguments, // Command-line arguments 13 static void usage(const char *program, // Name of the program 14 psMetadata *arguments, // Command-line arguments 14 15 pmConfig *config // Configuration 15 16 ) 16 17 { 17 18 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); 19 20 fprintf(stderr, "\n"); 20 21 psArgumentHelp(arguments); … … 47 48 } 48 49 49 void ppSimArguments( pmConfig *config)50 void ppSimArguments(int argc, char *argv[], pmConfig *config) 50 51 { 51 52 assert(config); … … 76 77 if (!config->camera) { 77 78 psErrorStackPrint(stderr, "A camera name must be specified using the -camera option."); 78 usage(arg uments, config);79 } 80 81 if ( *config->argc == 1 || !psArgumentParse(arguments, config->argc, config->argv) || *config->argc != 2) {82 usage(arg uments, 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); 83 84 } 84 85 … … 107 108 if (!typeStr) { 108 109 psErrorStackPrint(stderr, "An exposure type must be specified using -type"); 109 usage(arg uments, config);110 usage(argv[0], arguments, config); 110 111 } 111 112 ppSimType type; // Type to simulate … … 120 121 } else { 121 122 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Unrecognised exposure type: %s", typeStr); 122 usage(arg uments, config);123 usage(argv[0], arguments, config); 123 124 } 124 125 psMetadataAddS32(config->arguments, PS_LIST_TAIL, "TYPE", 0, "Exposure type", type); … … 134 135 if (isnan(expTime)) { 135 136 psErrorStackPrint(stderr, "The exposure time must be specified using -exptime"); 136 usage(arg uments, config);137 usage(argv[0], arguments, config); 137 138 } 138 139 } … … 169 170 if (binning <= 0) { 170 171 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Binning (%d) is non-positive.", binning); 171 usage(arg uments, config);172 usage(argv[0], arguments, config); 172 173 } 173 174 psMetadataAddS32(config->arguments, PS_LIST_TAIL, "BINNING", 0, "Binning in x and y", binning); 174 175 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]); 177 177 178 178 if (type == PPSIM_TYPE_OBJECT) { … … 188 188 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 189 189 "-ra, -dec, -pa, -scale, -zp, -seeing must be specified for OBJECT type"); 190 usage(arg uments, config);190 usage(argv[0], arguments, config); 191 191 } 192 192 psMetadataAddF32(config->arguments, PS_LIST_TAIL, "SCALE", 0, "Plate scale (arcsec/pix)", scale);
Note:
See TracChangeset
for help on using the changeset viewer.
