Changeset 6998 for trunk/ppMerge/src/ppMergeConfig.c
- Timestamp:
- Apr 28, 2006, 2:50:52 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ppMerge/src/ppMergeConfig.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppMerge/src/ppMergeConfig.c
r6824 r6998 1 # include "ppMerge.h" 1 #include <stdio.h> 2 #include <pslib.h> 3 #include <psmodules.h> 2 4 3 static void usage (void) { 4 fprintf (stderr, "USAGE: ppMerge [-file INPUT.fits] [-list INPUT.txt] OUTPUT\n"); 5 exit (2); 5 #include "ppMergeConfig.h" 6 7 // Output usage information 8 static void usage(const char *programName // Name of the program 9 ) 10 { 11 printf("Merge multiple calibration frames into a master frame by stacking.\n\n" 12 "Usage:\n" 13 "\t%s OUTPUT.fits [-files FILES] [-list FILE_LIST]\n\n" 14 "where:\n" 15 "FILES is a glob to be interpreted by the program.\n" 16 "FILE_LIST is a list of files (including a glob interpreted by the shell).\n" 17 "\n", programName); 18 exit(EXIT_FAILURE); 6 19 } 7 20 8 pmConfig *ppMergeConfig (intargc, char **argv)21 pmConfig *ppMergeConfig(int *argc, char **argv) 9 22 { 10 bool status; 23 if (*argc == 1) { 24 usage(argv[0]); 25 } 11 26 12 if (argc == 1) usage (); 13 14 // load the site-wide configuration information 15 pmConfig *config = pmConfigRead(&argc, argv); 27 // Load the site-wide configuration information 28 pmConfig *config = pmConfigRead(argc, argv); 16 29 if (! config) { 17 30 psErrorStackPrint(stderr, "Can't find site configuration!\n"); 18 exit(EXIT_FAILURE);31 usage(argv[0]); 19 32 } 20 33 21 // Parse other command-line arguments 34 // Parse other command-line arguments, save for future use 22 35 config->arguments = psMetadataAlloc(); // The arguments, with default values 36 psMetadataAddStr(config->arguments, PS_LIST_TAIL, "-type", 0, "Type of calibration frame", ""); 37 psMetadataAddBool(config->arguments, PS_LIST_TAIL, "-zero", 0, "Subtract background?", false); 38 psMetadataAddBool(config->arguments, PS_LIST_TAIL, "-scale", 0, "Scale by background?", false); 39 psMetadataAddBool(config->arguments, PS_LIST_TAIL, "-exptime", 0, "Scale by the exposure time?", false); 40 psMetadataAddS32(config->arguments, PS_LIST_TAIL, "-onoff", 0, "Number of on/off pairs", 0); 23 41 24 // the input file is a required argument; if not found, we will exit 25 status = pmConfigFileSetsMD (config->arguments, &argc, argv, "INPUT", "-file", "-list"); 26 if (!status) { usage ();} 42 // We require an input file set 43 bool status = pmConfigFileSetsMD(config->arguments, argc, argv, "INPUT", "-files", "-list"); 44 if (!status) { 45 usage(argv[0]); 46 } 27 47 28 if (! psArgumentParse(config->arguments, &argc, argv) || argc != 2) { 29 usage (); 48 // Parse other arguments 49 if (! psArgumentParse(config->arguments, argc, argv) || *argc != 2) { 50 usage(argv[0]); 30 51 } 31 52 … … 33 54 psMetadataAddStr(config->arguments, PS_LIST_TAIL, "OUTPUT", 0, "Name of the output image", argv[1]); 34 55 35 // the input image(s) are required arguments 36 // the first one defines the camera 56 // The input images are required. The first one defines the camera. 37 57 status = false; 38 pmFPAfileFromArgs (&status, config, "PPIMAGE.INPUT", "INPUT");58 pmFPAfileFromArgs(&status, config, "PPMERGE.INPUT", "INPUT"); 39 59 if (!status) { 40 psAbort (__func__, "missing INPUT entry");60 usage(argv[0]); 41 61 } 42 62 43 # if 0 44 // define Database handle, if used 63 64 #if 0 65 // Define database handle, if required 45 66 config->database = pmConfigDB(config->site); 46 # endif67 #endif 47 68 48 return true; 49 } 50 51 /* we require all information needed to determine the scaling 52 to be written in the header. is this reasonable? 53 */ 69 return config; 70 }
Note:
See TracChangeset
for help on using the changeset viewer.
