MCPcopy Create free account
hub / github.com/cgsecurity/testdisk / interface_analyse_ncurses

Function interface_analyse_ncurses

src/tanalyse.c:41–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39extern const arch_fnct_t arch_none;
40
41static list_part_t *interface_analyse_ncurses(disk_t *disk_car, const int verbose, const int saveheader, char**current_cmd)
42{
43 list_part_t *list_part;
44 int command;
45#ifdef HAVE_NCURSES
46 const struct MenuItem menuAnalyse[]=
47 {
48 { 'P', "Previous",""},
49 { 'N', "Next","" },
50 { 'Q',"Quick Search","Try to locate partition"},
51 { 'B', "Backup","Save current partition list to backup.log file and proceed"},
52 { 0, NULL, NULL }
53 };
54#endif
55 screen_buffer_reset();
56 /* ncurses interface */
57#ifdef HAVE_NCURSES
58 aff_copy(stdscr);
59 wmove(stdscr,4,0);
60 wprintw(stdscr,"%s\n",disk_car->description(disk_car));
61 mvwaddstr(stdscr,5,0,"Checking current partition structure");
62 wrefresh(stdscr);
63#endif
64 list_part=disk_car->arch->read_part(disk_car,verbose,saveheader);
65 /*@ assert valid_list_part(list_part); */
66 log_info("Current partition structure:\n");
67 screen_buffer_to_log();
68#ifdef HAVE_NCURSES
69 wmove(stdscr,5,0);
70 wclrtoeol(stdscr); /* before addstr for BSD compatibility */
71 waddstr(stdscr,"Current partition structure:");
72 wmove(stdscr,6,0);
73 wprintw(stdscr,msg_PART_HEADER_LONG);
74 if(disk_car->arch->msg_part_type!=NULL)
75 mvwaddstr(stdscr,LINES-3,0,disk_car->arch->msg_part_type);
76#endif
77 command='Q';
78 if(*current_cmd!=NULL)
79 {
80 skip_comma_in_command(current_cmd);
81 if(check_command(current_cmd,"backup",6)==0)
82 {
83 if(list_part!=NULL)
84 command='B';
85 }
86 }
87 else
88 {
89 log_flush();
90#ifdef HAVE_NCURSES
91 command=screen_buffer_display(stdscr,
92 (list_part!=NULL && disk_car->arch != &arch_none?"QB":"Q"),
93 menuAnalyse);
94#endif
95 }
96 if(command=='B')
97 {
98 log_info("Backup partition structure\n");

Callers 1

interface_analyseFunction · 0.85

Calls 9

screen_buffer_resetFunction · 0.85
screen_buffer_to_logFunction · 0.85
skip_comma_in_commandFunction · 0.85
check_commandFunction · 0.85
log_flushFunction · 0.85
screen_buffer_displayFunction · 0.85
partition_saveFunction · 0.85
display_messageFunction · 0.85
aff_copyFunction · 0.70

Tested by

no test coverage detected