| 39 | extern const arch_fnct_t arch_none; |
| 40 | |
| 41 | static 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"); |
no test coverage detected