TestDisk: add 'addpart' in CLI command

This commit is contained in:
Christophe Grenier 2014-02-02 15:14:59 +01:00
parent 5620526c27
commit 880f9a2d40
2 changed files with 14 additions and 1 deletions

View file

@ -29,6 +29,7 @@
#include "common.h" #include "common.h"
#include "parti386.h" #include "parti386.h"
#include "partgpt.h" #include "partgpt.h"
#include "parthumax.h"
#include "partmac.h" #include "partmac.h"
#include "partsun.h" #include "partsun.h"
#include "partxbox.h" #include "partxbox.h"
@ -36,6 +37,7 @@
extern const arch_fnct_t arch_gpt; extern const arch_fnct_t arch_gpt;
extern const arch_fnct_t arch_i386; extern const arch_fnct_t arch_i386;
extern const arch_fnct_t arch_humax;
extern const arch_fnct_t arch_mac; extern const arch_fnct_t arch_mac;
extern const arch_fnct_t arch_sun; extern const arch_fnct_t arch_sun;
extern const arch_fnct_t arch_xbox; extern const arch_fnct_t arch_xbox;
@ -48,6 +50,8 @@ list_part_t *add_partition_cli(disk_t *disk, list_part_t *list_part, char **curr
return add_partition_gpt_cli(disk, list_part, current_cmd); return add_partition_gpt_cli(disk, list_part, current_cmd);
else if(disk->arch==&arch_i386) else if(disk->arch==&arch_i386)
return add_partition_i386_cli(disk, list_part, current_cmd); return add_partition_i386_cli(disk, list_part, current_cmd);
else if(disk->arch==&arch_humax)
return add_partition_humax_cli(disk, list_part, current_cmd);
else if(disk->arch==&arch_mac) else if(disk->arch==&arch_mac)
return add_partition_mac_cli(disk, list_part, current_cmd); return add_partition_mac_cli(disk, list_part, current_cmd);
else if(disk->arch==&arch_sun) else if(disk->arch==&arch_sun)

View file

@ -59,6 +59,7 @@
#include "tntfs.h" #include "tntfs.h"
#include "thfs.h" #include "thfs.h"
#include "askloc.h" #include "askloc.h"
#include "addpart.h"
#include "addpartn.h" #include "addpartn.h"
#include "io_redir.h" #include "io_redir.h"
@ -328,6 +329,11 @@ void interface_adv(disk_t *disk_car, const int verbose,const int dump_ind, const
(*current_cmd)+=4; (*current_cmd)+=4;
command='t'; command='t';
} }
else if(strncmp(*current_cmd,"addpart",7)==0)
{
(*current_cmd)+=7;
command='a';
}
else if(strncmp(*current_cmd,"boot",4)==0) else if(strncmp(*current_cmd,"boot",4)==0)
{ {
(*current_cmd)+=4; (*current_cmd)+=4;
@ -387,7 +393,10 @@ void interface_adv(disk_t *disk_car, const int verbose,const int dump_ind, const
case 'A': case 'A':
if(disk_car->arch!=&arch_none) if(disk_car->arch!=&arch_none)
{ {
list_part=add_partition_ncurses(disk_car, list_part); if(*current_cmd!=NULL)
list_part=add_partition_cli(disk_car, list_part, current_cmd);
else
list_part=add_partition_ncurses(disk_car, list_part);
current_element=list_part; current_element=list_part;
rewrite=1; rewrite=1;
} }