static int decode_switches (int argc, char **argv) { int i; if (cmdline_parser (argc, argv, &args_info) != 0) exit(1) ; if (args_info.help_given) cmdline_parser_print_help(); if (args_info.full_help_given) cmdline_parser_print_full_help(); opt.max_print = args_info.max_arg; opt.minh = args_info.minh_arg; opt.poset = args_info.poset_arg; opt.want_quiet = args_info.quiet_given; opt.want_verbose = args_info.verbose_given; opt.bsize = args_info.bsize_given; opt.ssize = args_info.ssize_given; opt.print_saddles = args_info.saddle_given; opt.rates = args_info.rates_given; opt.microrates = args_info.microrates_given; GRAPH = args_info.graph_arg; if (args_info.moves_given) opt.MOVESET = args_info.moves_arg; if (args_info.temp_given) opt.kT = args_info.temp_arg; for (i = 0; i < args_info.path_given; ++i) { int L1,L2; if (sscanf(args_info.path_arg[i], "%d=%d", &L1, &L2) != 2) nrerror("specifiy paths as e.g. -P 1=3"); } if (args_info.inputs_num>1) nrerror("only one input file allowed"); return 0; }
static void check_display_args() { if( args_info.full_help_given || args_info.help_given ) { gengetopt_args_info_usage = "Usage: " PACKAGE " [OPTION]... [DATA_DIR]"; if( args_info.full_help_given ) { cmdline_parser_print_full_help(); } else { cmdline_parser_print_help(); } printf( "\n" BITSET_HELP_MSG ); } else if( args_info.usage_given ) { printf( "%s\n", gengetopt_args_info_usage ); } else if( args_info.version_given ) { printf( VERSION_MSG ); } else { return; } exit(0); }
static void process_options_gg (int argc, char *argv[]) { struct gengetopt_args_info args_info; if (cmdline_parser (argc, argv, &args_info) != 0) exit(1) ; if (args_info.help_given) cmdline_parser_print_help(); if (args_info.full_help_given) cmdline_parser_print_full_help(); GTV.dangle = args_info.dangle_arg; GSV.Temp = args_info.Temp_arg; strncpy(GAV.ParamFile,255,args_info.Par_arg); GTV.Par = args_info.Par_given; GTV.logML = args_info.logML_flag; GTV.noShift = args_info.noShift_flag; GTV.noLP = args_info.noLP_flag; GTV.start= args_info.start_flag; GTV.stop = args_info.stop_flag; GTV.mc = args_info.met_flag; GTV.lmin = args_info.lmin_flag; GTV.verbose = args_info.verbose_flag; GTV.silent = (GTV.verbose==0)? args_info.silent_flag : 0; if (args_info.seed_given) if (sscanf(args_info.seed_arg, "%hu=%hu=%hu", &GAV.subi[0], &GAV.subi[1], &GAV.subi[2]) != 3) usage(EXIT_FAILURE); else GTV.seed = 1; /* laplace stuff */ if (args_info.phi_given) { if (args_info.phi_arg>0) { GTV.phi = 1; GSV.phi = args_info.phi_arg; } else { fprintf(stderr, "Value of --phi must be > 0 >%lf<\n", args_info.phi_arg); exit(EXIT_FAILURE); } } if (args_info.pbounds_given) { if (sscanf(args_info.pbounds_arg, "%g=%g=%g", &GAV.phi_bounds[0], &GAV.phi_bounds[1], &GAV.phi_bounds[2]) == 0) usage(EXIT_FAILURE); else GTV.phi = 1; /* check if values are proper */ if (GAV.phi_bounds[0] > GAV.phi_bounds[2] || GAV.phi_bounds[1] > GAV.phi_bounds[2]) { fprintf(stderr, "Unmet requirements for pbounds:\n" "phi_min < phi_max && phi_inc < phi_max\n" "phi_min: %g phi_inc: %g phi_max: %g\n", GAV.phi_bounds[0], GAV.phi_bounds[1], GAV.phi_bounds[2]); exit(EXIT_FAILURE); } } GSV.time = args_info.time_arg; GSV.num = args_info.num_arg; strncpy(GAV.BaseName, args_info.log_arg, 255); GSV.cut = args_info.cut_arg; GSV.grow = args_info.grow_arg; GSV.glen = args_info.glen_arg; GTV.lmin = args_info.lmin_flag; GTV.fpt = args_info.fpt_flag; cmdline_parser_free(&args_info); }