Changeset 7073 for trunk/ppMerge/src/ppMergeConfig.c
- Timestamp:
- May 4, 2006, 5:37:16 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ppMerge/src/ppMergeConfig.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppMerge/src/ppMergeConfig.c
r7067 r7073 7 7 8 8 // Output usage information 9 static void usage(const char *programName // Name of the program 9 static void usage(const char *programName, // Name of the program 10 pmConfig *config // Configuration (contains the arguments list) 10 11 ) 11 12 { 12 13 printf("Merge multiple calibration frames into a master frame by stacking.\n\n" 13 14 "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" 18 16 "\n", programName); 17 psArgumentHelp(config->arguments); 19 18 exit(EXIT_FAILURE); 20 19 } … … 22 21 pmConfig *ppMergeConfig(int *argc, char **argv) 23 22 { 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); 26 28 } 27 29 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 36 31 config->arguments = psMetadataAlloc(); // The arguments, with default values 37 32 psMetadataAddStr(config->arguments, PS_LIST_TAIL, "-type", 0, "Type of calibration frame", ""); … … 41 36 psMetadataAddS32(config->arguments, PS_LIST_TAIL, "-onoff", 0, "Number of on/off pairs", 0); 42 37 38 if (*argc == 1) { 39 usage(argv[0], config); 40 } 41 43 42 // 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); 46 45 } 47 46 … … 56 55 psArray *files = psArrayAlloc(*argc - 2); 57 56 for (int i = 2; i < *argc; i++) { 58 files->data[i ] = psStringCopy(argv[i]);57 files->data[i - 2] = psStringCopy(argv[i]); 59 58 } 59 files->n = *argc - 2; 60 60 psMetadataAddPtr(config->arguments, PS_LIST_TAIL, "INPUT", PS_DATA_ARRAY, 61 61 "Array of inputs images", files);
Note:
See TracChangeset
for help on using the changeset viewer.
