void test_read_erroneous_gen_kw_file() { const char * parameter_filename = "MULTFLT_with_errors.txt"; const char * tmpl_filename = "MULTFLT.tmpl"; { FILE * stream = util_fopen(parameter_filename, "w"); const char * data = util_alloc_sprintf("MULTFLT1 NORMAL 0\nMULTFLT2 RAW\nMULTFLT3 NORMAL 0"); util_fprintf_string(data, 30, true, stream); util_fclose(stream); FILE * tmpl_stream = util_fopen(tmpl_filename, "w"); const char * tmpl_data = util_alloc_sprintf("<MULTFLT1> <MULTFLT2> <MULTFLT3>\n"); util_fprintf_string(tmpl_data, 30, true, tmpl_stream); util_fclose(tmpl_stream); } gen_kw_config_type * gen_kw_config = gen_kw_config_alloc_empty("MULTFLT", "<%s>"); vector_type * arg = vector_alloc_new(); vector_append_ref( arg , gen_kw_config ); vector_append_ref(arg, parameter_filename); test_assert_util_abort("arg_pack_fscanf", read_erroneous_gen_kw_file, arg); vector_free(arg); gen_kw_config_free(gen_kw_config); }
static void menu_display(const menu_type * menu) { int i; int length = strlen(menu->title); for (i = 0; i < vector_get_size(menu->items); i++) { const menu_item_type * item = vector_iget_const( menu->items , i); if(!item->helptext) length = util_int_max(length , item->label_length); if(item->helptext) length = util_int_max(length , 60); /* Hardcoded length for helptext*/ } printf("\n"); __print_line(length + 10 , 0); printf("| "); util_fprintf_string(menu->title , length + 6 , center_pad , stdout); printf(" |\n"); __print_line(length + 10 , 1); for (i=0; i < vector_get_size(menu->items); i++) { const menu_item_type * item = vector_iget_const( menu->items , i); if (item->separator) __print_sep(length + 6); else if (item->helptext) __print_helptext(item->label,length); else { printf("| %c: ", menu_item_get_key( item )); util_fprintf_string(item->label , length + 3 , right_pad , stdout); printf(" |\n"); } } __print_sep(length + 6); printf("| %c: ",menu->quit_keys[0]); util_fprintf_string(menu->quit_label , length + 3 , right_pad , stdout); printf(" |\n"); __print_line(length + 10 , 2); printf("\n"); }