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

Function testdisk_disk_selection_cli

src/tdisksel.c:231–270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

229#endif
230
231static int testdisk_disk_selection_cli(int verbose,int dump_ind, const list_disk_t *list_disk, const int saveheader, const char *cmd_device, char **current_cmd)
232{
233 const list_disk_t *element_disk;
234 const list_disk_t *current_disk=NULL;
235 if(cmd_device!=NULL)
236 {
237 for(element_disk=list_disk;element_disk!=NULL;element_disk=element_disk->next)
238 {
239 if(strcmp(element_disk->disk->device,cmd_device)==0)
240 current_disk=element_disk;
241 }
242 }
243 else
244 current_disk=list_disk;
245 if(current_disk==NULL)
246 {
247 log_critical("No disk found\n");
248 return 0;
249 }
250 if(*current_cmd!=NULL)
251 {
252 skip_comma_in_command(current_cmd);
253 {
254 disk_t *disk=current_disk->disk;
255 autodetect_arch(disk, NULL);
256 autoset_unit(disk);
257 if(interface_check_disk_capacity(disk)==0 &&
258 interface_check_disk_access(disk, current_cmd)==0 &&
259 (change_arch_type_cli(disk, verbose, current_cmd)==0
260#ifdef HAVE_NCURSES
261 || change_arch_type_ncurses(disk, verbose)==0
262#endif
263 ))
264 {
265 menu_disk(disk, verbose, dump_ind, saveheader, current_cmd);
266 }
267 }
268 }
269 return 0;
270}
271
272int do_curses_testdisk(int verbose,int dump_ind, const list_disk_t *list_disk, const int saveheader, const char *cmd_device, char **current_cmd)
273{

Callers 1

do_curses_testdiskFunction · 0.85

Calls 8

skip_comma_in_commandFunction · 0.85
autodetect_archFunction · 0.85
autoset_unitFunction · 0.85
change_arch_type_cliFunction · 0.85
change_arch_type_ncursesFunction · 0.85
menu_diskFunction · 0.85

Tested by

no test coverage detected