| 60 | #define INTER_NOTE_Y (LINES-4) |
| 61 | |
| 62 | static int testdisk_disk_selection_ncurses(int verbose,int dump_ind, const list_disk_t *list_disk, const int saveheader, char **current_cmd) |
| 63 | { |
| 64 | int command='Q'; |
| 65 | unsigned int menu=0; |
| 66 | int offset=0; |
| 67 | int pos_num=0; |
| 68 | #ifdef SUDO_BIN |
| 69 | int use_sudo=0; |
| 70 | #endif |
| 71 | const list_disk_t *element_disk; |
| 72 | const list_disk_t *current_disk; |
| 73 | static const struct MenuItem menuMain[]= |
| 74 | { |
| 75 | { 'P', "Previous", ""}, |
| 76 | { 'N', "Next", "" }, |
| 77 | { 'O', "Proceed", ""}, |
| 78 | { 'S', "Sudo", "Use the sudo command to restart as root"}, |
| 79 | { 'Q', "Quit", "Quit program"}, |
| 80 | { 0, NULL, NULL} |
| 81 | }; |
| 82 | if(list_disk==NULL) |
| 83 | { |
| 84 | log_critical("No disk found\n"); |
| 85 | return intrf_no_disk_ncurses("TestDisk"); |
| 86 | } |
| 87 | current_disk=list_disk; |
| 88 | /* ncurses interface */ |
| 89 | while(1) |
| 90 | { |
| 91 | const char *options; |
| 92 | int i; |
| 93 | aff_copy(stdscr); |
| 94 | wmove(stdscr,4,0); |
| 95 | wprintw(stdscr," TestDisk is free software, and"); |
| 96 | wmove(stdscr,5,0); |
| 97 | wprintw(stdscr,"comes with ABSOLUTELY NO WARRANTY."); |
| 98 | wmove(stdscr,7,0); |
| 99 | wprintw(stdscr,"Select a media and choose 'Proceed' using arrow keys:"); |
| 100 | for(i=0,element_disk=list_disk; |
| 101 | element_disk!=NULL && i<offset+NBR_DISK_MAX; |
| 102 | i++, element_disk=element_disk->next) |
| 103 | { |
| 104 | if(i<offset) |
| 105 | continue; |
| 106 | wmove(stdscr,8+i-offset,0); |
| 107 | if(element_disk!=current_disk) |
| 108 | wprintw(stdscr," %s\n",element_disk->disk->description_short(element_disk->disk)); |
| 109 | else |
| 110 | { |
| 111 | wattrset(stdscr, A_REVERSE); |
| 112 | wprintw(stdscr,">%s\n",element_disk->disk->description_short(element_disk->disk)); |
| 113 | wattroff(stdscr, A_REVERSE); |
| 114 | } |
| 115 | } |
| 116 | { |
| 117 | mvwaddstr(stdscr, INTER_NOTE_Y, 0, "Note: "); |
| 118 | #if defined(HAVE_GETEUID) && !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(DJGPP) |
| 119 | if(geteuid()!=0) |
no test coverage detected