Beispiel #1
0
int		opt2(t_specs opt, char *c, int *i, char **str)
{
	if (*str[0] == 0)
	{
		if (!(opt.flags & 0x04))
		{
			*str = treat_options(*str, opt, c[*i], 1);
			ft_putstr(*str);
		}
		ft_putchar(0);
		if (opt.flags & 0x04)
		{
			*str = treat_options(*str, opt, c[*i], 1);
			ft_putstr(*str);
		}
		(*i)++;
		return (ft_strlen(*str) + 1);
	}
	else
		*str = treat_options(*str, opt, c[*i], 0);
	return (0);
}
Beispiel #2
0
int main( int argc, char *argv[] ) {  
  int argindex = treat_options( argc, argv );
  if( argindex != argc - 2 ){
    perr( "You must provide two filenames as arguments\n" );
    usage();
  }
  perr( "Reading input profiles into hashmap...\n" );
  read_profiles_file( argv[ argindex + 1 ] );  
  perr( "Generalizing...\n" );
  sim_file = open_file_read( argv[ argindex ] );
  sim_index = get_index_column_name( sim_file, score_name );
  if( sim_index < 4 ) {
    fprintf( stderr, "Column named \"%s\" not found!\nYou must ", score_name );
    perr( "specify a valid -s option. Chose among SIM-FILE column headers.\n");
    perr( "Remember that the 1st 4 fields cannot be used as scores.\n" ); 
    usage();  
  }
  if( nb_threads > 1 ) {
    run_multi_threaded( &read_sim_and_generalize, nb_threads );    
  }
  else {
    perr( "Not using threads\n" );
    read_sim_and_generalize_serial();
  }
  // Clean and free to avoid memory leaks
  perr( "Finished, cleaning up...\n" );
  fclose( sim_file );
  g_hash_table_destroy( c_dict );  
  g_hash_table_destroy( t_dict );
  if( t_filter ) {
    g_hash_table_destroy( t_filter );
  }
  if( n_filter ) {
    g_hash_table_destroy( n_filter );
  }
  if( c_filter ) {
    g_hash_table_destroy( c_filter );
  }
  return 0;
}