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

Function adv_string_to_command

src/adv.c:207–259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205#endif
206
207static int adv_string_to_command(char**current_cmd, list_part_t **current_element, list_part_t *list_part)
208{
209 int keep_asking;
210 int command='q';
211 assert(current_cmd!=NULL);
212 do
213 {
214 keep_asking=0;
215 skip_comma_in_command(current_cmd);
216 if(check_command(current_cmd,"type",4)==0)
217 {
218 command='t';
219 }
220 else if(check_command(current_cmd,"addpart",7)==0)
221 {
222 command='a';
223 }
224 else if(check_command(current_cmd,"boot",4)==0)
225 {
226 command='b';
227 }
228 else if(check_command(current_cmd,"copy",4)==0)
229 {
230 command='c';
231 }
232 else if(check_command(current_cmd,"list",4)==0)
233 {
234 command='l';
235 }
236 else if(check_command(current_cmd,"undelete",8)==0)
237 {
238 command='u';
239 }
240 else if(check_command(current_cmd,"superblock",10)==0)
241 {
242 command='s';
243 }
244 else if(isdigit(*current_cmd[0]))
245 {
246 list_part_t *element;
247 const unsigned int order= get_int_from_command(current_cmd);
248 for(element=list_part;
249 element!=NULL && element->part->order!=order;
250 element=element->next);
251 if(element!=NULL)
252 {
253 *current_element=element;
254 keep_asking=1;
255 }
256 }
257 } while(keep_asking>0);
258 return command;
259}
260
261#ifdef HAVE_NCURSES
262static const char *adv_get_boot_description(const partition_t *partition)

Callers 1

interface_advFunction · 0.85

Calls 3

skip_comma_in_commandFunction · 0.85
check_commandFunction · 0.85
get_int_from_commandFunction · 0.85

Tested by

no test coverage detected