TestDisk: ask confirmation to stop searching for more partitions

This commit is contained in:
Christophe Grenier 2021-04-16 17:02:54 +02:00
parent 9601788a27
commit 190b0c17d3

View file

@ -586,6 +586,7 @@ static list_part_t *search_part(disk_t *disk_car, const list_part_t *list_part_o
while(ind_stop!=INDSTOP_QUIT && search_location < search_location_max) while(ind_stop!=INDSTOP_QUIT && search_location < search_location_max)
{ {
CHS_t start; CHS_t start;
int ask=0;
offset2CHS_inline(disk_car,search_location,&start); offset2CHS_inline(disk_car,search_location,&start);
#ifdef HAVE_NCURSES #ifdef HAVE_NCURSES
if(disk_car->geom.heads_per_cylinder>1) if(disk_car->geom.heads_per_cylinder>1)
@ -598,16 +599,7 @@ static list_part_t *search_part(disk_t *disk_car, const list_part_t *list_part_o
wprintw(stdscr, "Analyse cylinder %5lu/%lu: %02u%%", wprintw(stdscr, "Analyse cylinder %5lu/%lu: %02u%%",
start.cylinder, disk_car->geom.cylinders-1, start.cylinder, disk_car->geom.cylinders-1,
(unsigned int)(search_location*100/disk_car->disk_size)); (unsigned int)(search_location*100/disk_car->disk_size));
wrefresh(stdscr); ask=1;
switch(check_enter_key_or_s(stdscr))
{
case 1:
ind_stop=INDSTOP_STOP;
break;
case 2:
ind_stop=INDSTOP_SKIP;
break;
}
} }
} }
else if((start.cylinder & 0x7FFF)==0) else if((start.cylinder & 0x7FFF)==0)
@ -619,10 +611,20 @@ static list_part_t *search_part(disk_t *disk_car, const list_part_t *list_part_o
(long long unsigned)((disk_car->disk_size-1)/disk_car->sector_size), (long long unsigned)((disk_car->disk_size-1)/disk_car->sector_size),
(unsigned int)(search_location*100/disk_car->disk_size)); (unsigned int)(search_location*100/disk_car->disk_size));
wrefresh(stdscr); wrefresh(stdscr);
ask=1;
}
if(ask!=0)
{
wrefresh(stdscr);
switch(check_enter_key_or_s(stdscr)) switch(check_enter_key_or_s(stdscr))
{ {
case 1: case 1:
if(ask_confirmation("Stop searching for more partitions ? (Y/N)")!=0)
ind_stop=INDSTOP_STOP; ind_stop=INDSTOP_STOP;
else
{
screen_buffer_to_interface();
}
break; break;
case 2: case 2:
ind_stop=INDSTOP_SKIP; ind_stop=INDSTOP_SKIP;