Esempio n. 1
0
char* enkf_main_read_alloc_current_case_name(const enkf_main_type * enkf_main) {
    char * current_case = NULL;
    const char * ens_path = model_config_get_enspath( enkf_main->model_config);
    char * current_case_file = util_alloc_filename(ens_path, CURRENT_CASE_FILE, NULL);
    if (enkf_main_current_case_file_exists(enkf_main)) {
        FILE * stream = util_fopen( current_case_file  , "r");
        current_case = util_fscanf_alloc_token(stream);
        util_fclose(stream);
    } else {
        util_abort("%s: File: storage/current_case not found, aborting! \n",__func__);
    }
    free(current_case_file);
    return current_case;
}
Esempio n. 2
0
trans_func_type * trans_func_fscanf_alloc( FILE * stream ) {
  trans_func_type * trans_func;
  char            * func_name;

  func_name = util_fscanf_alloc_token(stream);
  if (func_name == NULL) {
    char * filename = "????";
#ifdef HAVE_FORK
      filename = util_alloc_filename_from_stream( stream );
#endif
    fprintf(stderr,"Problem at file:line: %s:%d \n", filename, util_get_current_linenr( stream ));
    util_abort("%s: could not locate name of transformation - aborting \n",__func__);
  }
  
  trans_func = trans_func_alloc( func_name );
  arg_pack_fscanf( trans_func->params , stream );
  
  free( func_name );
  return trans_func;
}