int fu_get_param (int argc, char *argv[], fpstate *fpptr) { int gottype=0, gottile=0, wholetile=0, iarg, len, ndim, ii; char tmp[SZ_STR], tile[SZ_STR]; if (fpptr->initialized != FP_INIT_MAGIC) { fp_msg ("Error: internal initialization error\n"); exit (-1); } tile[0] = (char) NULL; /* by default, .fz suffix characters to be deleted from compressed file */ fpptr->delete_suffix = 1; /* flags must come first and be separately specified */ for (iarg = 1; iarg < argc; iarg++) { if (argv[iarg][0] == '-' && strlen (argv[iarg]) == 2) { if (argv[iarg][1] == 'F') { fpptr->clobber++; fpptr->delete_suffix = 0; /* no suffix in this case */ } else if (argv[iarg][1] == 'D') { fpptr->delete_input++; } else if (argv[iarg][1] == 'P') { if (++iarg >= argc) { fu_usage (); fu_hint (); exit (-1); } else strncpy (fpptr->prefix, argv[iarg], SZ_STR); } else if (argv[iarg][1] == 'S') { fpptr->to_stdout++; } else if (argv[iarg][1] == 'L') { fpptr->listonly++; } else if (argv[iarg][1] == 'C') { fpptr->do_checksums = 0; } else if (argv[iarg][1] == 'H') { fu_help (); exit (0); } else if (argv[iarg][1] == 'V') { fp_version (); exit (0); } else if (argv[iarg][1] == 'Z') { fpptr->do_gzip_file++; } else if (argv[iarg][1] == 'v') { fpptr->verbose = 1; } else if (argv[iarg][1] == 'O') { if (++iarg >= argc) { fu_usage (); fu_hint (); exit (-1); } else strncpy (fpptr->outfile, argv[iarg], SZ_STR); } else { fp_msg ("Error: unknown command line flag `"); fp_msg (argv[iarg]); fp_msg ("'\n"); fu_usage (); fu_hint (); exit (-1); } } else break; } if (iarg >= argc) { fp_msg ("Error: no FITS files to uncompress\n"); fu_usage (); exit (-1); } else fpptr->firstfile = iarg; return(0); }
int fu_get_param (int argc, char *argv[], fpstate *fpptr) { int iarg; char tile[SZ_STR]; if (fpptr->initialized != FP_INIT_MAGIC) { fp_msg ("Error: internal initialization error\n"); exit (-1); } tile[0] = 0; /* by default, .fz suffix characters to be deleted from compressed file */ fpptr->delete_suffix = 1; /* flags must come first and be separately specified */ for (iarg = 1; iarg < argc; iarg++) { if (argv[iarg][0] == '-' && strlen (argv[iarg]) == 2) { if (argv[iarg][1] == 'F') { fpptr->clobber++; fpptr->delete_suffix = 0; /* no suffix in this case */ } else if (argv[iarg][1] == 'D') { fpptr->delete_input++; } else if (argv[iarg][1] == 'P') { if (++iarg >= argc) { fu_usage (); fu_hint (); exit (-1); } else strncpy (fpptr->prefix, argv[iarg], SZ_STR); } else if (argv[iarg][1] == 'E') { if (++iarg >= argc) { fu_usage (); fu_hint (); exit (-1); } else strncpy (fpptr->extname, argv[iarg], SZ_STR); } else if (argv[iarg][1] == 'S') { fpptr->to_stdout++; } else if (argv[iarg][1] == 'L') { fpptr->listonly++; } else if (argv[iarg][1] == 'C') { fpptr->do_checksums = 0; } else if (argv[iarg][1] == 'H') { fu_help (); exit (0); } else if (argv[iarg][1] == 'V') { fp_version (); exit (0); } else if (argv[iarg][1] == 'Z') { fpptr->do_gzip_file++; } else if (argv[iarg][1] == 'v') { fpptr->verbose = 1; } else if (argv[iarg][1] == 'O') { if (++iarg >= argc) { fu_usage (); fu_hint (); exit (-1); } else strncpy (fpptr->outfile, argv[iarg], SZ_STR); } else { fp_msg ("Error: unknown command line flag `"); fp_msg (argv[iarg]); fp_msg ("'\n"); fu_usage (); fu_hint (); exit (-1); } } else break; } if (fpptr->extname[0] && (fpptr->clobber || fpptr->delete_input)) { fp_msg ("Error: -E option may not be used with -F or -D\n"); fu_usage (); exit (-1); } if (fpptr->to_stdout && (fpptr->outfile[0] || fpptr->prefix[0]) ) { fp_msg ("Error: -S option may not be used with -P or -O\n"); fu_usage (); exit (-1); } if (fpptr->outfile[0] && fpptr->prefix[0] ) { fp_msg ("Error: -P and -O options may not be used together\n"); fu_usage (); exit (-1); } if (iarg >= argc) { fp_msg ("Error: no FITS files to uncompress\n"); fu_usage (); exit (-1); } else fpptr->firstfile = iarg; return(0); }