args_t::args_t( int argc, const char * argv[] ) : output( stdout ), input1( stdin ), input2( NULL ), distance( DEFAULT_DISTANCE ), min_distance( DEFAULT_MIN_DISTANCE ), ambig( DEFAULT_AMBIG ), format ( DEFAULT_FORMAT ), overlap ( DEFAULT_OVERLAP ), do_bootstrap( false ), do_bootstrap_two_files ( false ), do_count( false ), quiet( false ), do_fst( false ), report_self ( false ), counts_in_name ( DEFAULT_COUNTS_IN_NAME ), include_prob( DEFAULT_INCLUDE_PROB ), ambigs_to_resolve(NULL), resolve_fraction(DEFAULT_FRACTION) { // skip arg[0], it's just the program name for (int i = 1; i < argc; ++i ) { const char * arg = argv[i]; if ( arg[0] == '-' && arg[1] == '-' ) { if ( !strcmp( &arg[2], "help" ) ) help(); else if ( !strcmp( &arg[2], "version" ) ) version(); else ERROR( "unknown argument: %s", arg ); } else if ( arg[0] == '-' ) { if ( !strcmp( &arg[1], "h" ) ) help(); else if ( arg[1] == 'v' ) version(); else if ( arg[1] == 'o' ) parse_output( next_arg (i, argc, argv) ); else if ( arg[1] == 't' ) parse_distance ( next_arg (i, argc, argv) ); else if ( arg[1] == 'w' ) parse_min_distance ( next_arg (i, argc, argv) ); else if ( arg[1] == 'l') parse_overlap( next_arg (i, argc, argv) ); else if ( arg[1] == 'f') parse_format( next_arg (i, argc, argv) ); else if ( arg[1] == 'a') parse_ambig( next_arg (i, argc, argv) ); else if ( arg[1] == 's') parse_second_in( next_arg (i, argc, argv) ); else if ( arg[1] == 'd') parse_counts_in_name( next_arg (i, argc, argv) ); else if ( arg[1] == 'u') parse_include_prob( next_arg (i, argc, argv) ); else if ( arg[1] == 'b') parse_bootstrap(); else if ( arg[1] == 'r') parse_bootstrap_two_files (); else if ( arg[1] == 'c') parse_count(); else if ( arg[1] == 'q') parse_quiet(); else if ( arg[1] == 'm') parse_fst(); else if ( arg[1] == '0') parse_report_self(); else if ( arg[1] == 'g') parse_fraction( next_arg (i, argc, argv) ); else ERROR( "unknown argument: %s", arg ); } else if (i == argc-1) { parse_input (arg); } else { ERROR( "unknown argument: %s", arg ); } } }
args_t::args_t( int argc, const char * argv[] ) : output( stdout ), input( stdin ), ambig( DEFAULT_AMBIG ), data ( DEFAULT_DATA ), counts_in_name ( DEFAULT_COUNTS_IN_NAME ), quiet (false) { // skip arg[0], it's just the program name for (int i = 1; i < argc; ++i ) { const char * arg = argv[i]; if ( arg[0] == '-' && arg[1] == '-' ) { if ( !strcmp( &arg[2], "help" ) ) help(); else ERROR( "unknown argument: %s", arg ); } else if ( arg[0] == '-' ) { if ( !strcmp( &arg[1], "h" ) ) help(); else if ( arg[1] == 'o' ) parse_output( next_arg (i, argc, argv) ); else if ( arg[1] == 'a') parse_ambig( next_arg (i, argc, argv) ); else if ( arg[1] == 't') parse_data ( next_arg (i, argc, argv) ); else if ( arg[1] == 'd') parse_counts_in_name( next_arg (i, argc, argv) ); else if ( arg[1] == 'q') parse_quiet ( ); else ERROR( "unknown argument: %s", arg ); } else if (i == argc-1) { parse_input (arg); } else { ERROR( "unknown argument: %s", arg ); } } }