Esempio n. 1
0
void output_table_init( const ecl_sum_type * refcase, hash_type * output_table , const config_type * config ) {
  int i,j;
  for (i=0; i < config_get_occurences( config , "OUTPUT" ); i++) {
    const stringlist_type * tokens = config_iget_stringlist_ref( config , "OUTPUT" , i);
    const char * file              = stringlist_iget( tokens , 0 );
    const char * format_string     = stringlist_iget( tokens , 1 );
    output_type * output           = output_alloc( file , format_string );
    
    /* All the keys are just added - without any check. */
    for (j = 2; j < stringlist_get_size( tokens ); j++)
      output_add_key( refcase , output , stringlist_iget( tokens , j));
    
    hash_insert_hash_owned_ref( output_table , file , output , output_free__ );
  }
}
Esempio n. 2
0
void output_table_init( const ecl_sum_type * refcase, hash_type * output_table , const config_content_type * config ) {
  int i,j;
  if (config_content_has_item( config , "OUTPUT")) {
    const config_content_item_type * output_item = config_content_get_item( config , "OUTPUT");
    for (i = 0; i < config_content_item_get_size( output_item ); i++) {
      const config_content_node_type * output_node = config_content_item_iget_node( output_item , i );

      const char * file              = config_content_node_iget( output_node , 0 );
      const char * format_string     = config_content_node_iget( output_node , 1 );
      output_type * output           = output_alloc( file , format_string );

      /* All the keys are just added - without any check. */
      for (j = 2; j < config_content_node_get_size( output_node ); j++)
        output_add_key( refcase , output , config_content_node_iget( output_node , j));

      hash_insert_hash_owned_ref( output_table , file , output , output_free__ );
    }
  }
}
Esempio n. 3
0
/* Output a stripped prx file */
int output_prx(const char *prxfile)
{
	int size;
	unsigned char *data;
	FILE *fp;

	do
	{
		size = calculate_outsize();
		data = (unsigned char *) malloc(size);
		if(data == NULL)
		{
			fprintf(stderr, "Error, couldn't allocate output data\n");
			break;
		}

		memset(data, 0, size);

		output_header(data);
		output_ph(data + g_phbase);
		output_alloc(data + g_allocbase);
		output_sh(data + g_shbase);
		output_relocs(data + g_relocbase);
		output_shstrtab(data + g_shstrbase);

		fp = fopen(prxfile, "wb");
		if(fp != NULL)
		{
			fwrite(data, 1, size, fp);
			fclose(fp);
		}
		else
		{
			fprintf(stderr, "Error, could not open output file %s\n", prxfile);
		}

		free(data);
	}
	while(0);

	return 0;
}