int main(int argc, char **argv) { char meta_name[255]; char envi_name[255]; meta_parameters *meta=NULL; envi_header *envi=NULL; extern int currArg; /* from cla.h in asf.h... initialized to 1 */ logflag = 0; if (argc > 1) { check_for_help(argc, argv); handle_license_and_version_args(argc, argv, TOOL_NAME); } if (argc < 3) { asfPrintStatus("\nNot enough arguments.\n"); usage(); return 1; } /* Parse command line args */ while (currArg < (argc-2)) { char *key=argv[currArg++]; if (strmatch(key,"-log")) { sprintf(logFile, "%s", argv[currArg]); logflag = 1; } else { printf("\n ***Invalid option: %s\n\n", argv[currArg-1]); usage(argv[0]); } } if ((argc-currArg) < 2) { printf("Insufficient arguments.\n"); usage(argv[0]); } create_name(envi_name, argv[currArg], ".hdr"); create_name(meta_name, argv[currArg+1], ".meta"); asfSplashScreen(argc, argv); // Read ENVI header envi = read_envi(envi_name); // Fill metadata structure with valid data meta = envi2meta(envi); // Write metadata file meta_write(meta, meta_name); // Clean and report meta_free(meta); asfPrintStatus(" Converted ENVI header (%s) to metadata file (%s)\n\n", envi_name, meta_name); return 0; }
int main(int argl, char** argv) { if (check_for_help(argv + 1, argl - 1)) { if (argl == 1) run_all_tests(); else run_tests(argv + 1, argl - 1); } return 0; }
int main(int argc,char *argv[]) { char infile[255], outfile[255]; if (argc > 1) { check_for_help(argc, argv); handle_license_and_version_args(argc, argv, TOOL_NAME); } if (argc != 3) { usage(); exit(1); } create_name(infile, argv[1], ".img"); create_name(outfile, argv[2], ".img"); deskew(infile, outfile); return 0; }
int main(int argc,char *argv[]) { if (argc > 1) { check_for_help(argc, argv); handle_common_asf_args(&argc, &argv, TOOL_NAME); } if (argc != 4) { usage(); return 1; } float grPixSize= -1; /* output pixel size */ /* Make sure we've got the right amount of arguments */ if (argc != 4) {usage(argv[0]);} asfPrintStatus("Converting from slant to ground range...\n"); /* Get required arguments */ grPixSize = atof(argv[3]); sr2gr_pixsiz(argv[1], argv[2], grPixSize); return 0; }
int isis_process_options (Isis_Option_Type *opt, Isis_Option_Table_Type *table, void *client_data, int err_on_unsupported) { char **names; char **values; char *subsystem; unsigned int i, n; if (opt == NULL) return 0; subsystem = opt->subsystem; names = opt->option_names; values = opt->option_values; n = opt->num_options; if ((table == NULL) && (opt->num_options != 0)) { isis_vmesg (WARN, I_ERROR, __FILE__, __LINE__, "Subsystem \"%s\" does not permit options.", subsystem); if (err_on_unsupported) return -1; return 0; } if (check_for_help (opt, table)) return -1; if (check_for_keyword (opt, table, client_data, "DEFAULT", &set_defaults)) return 0; for (i = 0; i < n; i++) { Isis_Option_Table_Type *t; char *name; char *value; name = names[i]; if (*name == 0) continue; if (NULL == (t = find_option (name, table))) { isis_vmesg (WARN, I_ERROR, __FILE__, __LINE__, "%s option `%s' is unknown.", subsystem, name); if (err_on_unsupported) return -1; continue; } if (t->fun == NULL) { isis_vmesg (WARN, I_NOT_IMPLEMENTED, __FILE__, __LINE__, "%s option `%s'.", subsystem, name); if (err_on_unsupported) return -1; continue; } value = values[i]; if (value == NULL) { if (t->value_flags & ISIS_OPT_REQUIRES_VALUE) { isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__, "\"%s\" option \"%s\" requires a value.", subsystem, name); return -1; } } else if (t->value_flags & ISIS_OPT_NO_VALUE) { isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__, "\"%s\" option \"%s\" does not permit a value.", subsystem, name); return -1; } if (-1 == t->fun (subsystem, name, value, client_data)) { static char *fmt = "processing \"%s\" option \"%s=%s\"."; isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__, fmt, subsystem, name, (value ? value : "(null)")); return -1; } #if 0 if (value != NULL) _ardlib_add_to_history ("%s used option %s=%s", subsystem, name, value); else _ardlib_add_to_history ("%s used option %s", subsystem, name); #endif } return 0; }