MCPcopy Index your code
hub / github.com/cgsecurity/testdisk / interface_write

Function interface_write

src/tpartwr.c:40–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38#include "tpartwr.h"
39
40int interface_write(disk_t *disk_car,list_part_t *list_part,const int can_search_deeper, const int can_ask_minmax_ext, int *no_confirm, char **current_cmd, unsigned int *menu)
41{
42 list_part_t *parts;
43#ifdef HAVE_NCURSES
44 const struct MenuItem menuWrite[]=
45 {
46 { 'P', "Previous",""},
47 { 'N', "Next","" },
48 { 'Q', "Quit","Return to main menu"},
49 { 'R', "Return", "Return to partition selection"},
50 { 'S', "Deeper Search","Try to find more partitions"},
51 { 'W', "Write","Write partition structure to disk"},
52 { 'E', "Extd Part","Maximize/Minimize extended partition"},
53 { 0, NULL, NULL }
54 };
55#endif
56 int command;
57 log_info("\ninterface_write()\n");
58 screen_buffer_reset();
59#ifdef HAVE_NCURSES
60 aff_copy(stdscr);
61 wmove(stdscr,4,0);
62 wprintw(stdscr,"%s",disk_car->description(disk_car));
63 wmove(stdscr,5,0);
64 mvwaddstr(stdscr,6,0,msg_PART_HEADER_LONG);
65#endif
66 for(parts=list_part;parts!=NULL;parts=parts->next)
67 if(parts->part->status!=STATUS_LOG)
68 aff_part_buffer(AFF_PART_ORDER|AFF_PART_STATUS,disk_car,parts->part);
69 for(parts=list_part;parts!=NULL;parts=parts->next)
70 if(parts->part->status==STATUS_LOG)
71 aff_part_buffer(AFF_PART_ORDER|AFF_PART_STATUS,disk_car,parts->part);
72 command='Q';
73 if(list_part==NULL)
74 {
75 screen_buffer_add(" \nNo partition found or selected for recovery");
76 screen_buffer_to_log();
77 if(*current_cmd!=NULL)
78 {
79 skip_comma_in_command(current_cmd);
80 if(check_command(current_cmd,"search",6)==0)
81 {
82 command='S';
83 }
84 }
85 else
86 {
87 char options[10];
88 options[0]='R';
89 options[1]=0;
90 if(can_search_deeper)
91 strcat(options,"S");
92 log_flush();
93#ifdef HAVE_NCURSES
94 command=screen_buffer_display_ext(stdscr, options, menuWrite,menu);
95#endif
96 }
97 }

Callers 1

Calls 9

screen_buffer_resetFunction · 0.85
aff_part_bufferFunction · 0.85
screen_buffer_addFunction · 0.85
screen_buffer_to_logFunction · 0.85
skip_comma_in_commandFunction · 0.85
check_commandFunction · 0.85
log_flushFunction · 0.85
aff_copyFunction · 0.70

Tested by

no test coverage detected