summaryrefslogtreecommitdiffstats
path: root/src/intrface.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2008-02-28 13:36:23 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2008-02-28 13:37:32 +0100
commit2aa0acbdec2f9ad63f612a5ac6a5e644e45a63ed (patch)
treee62a5d05b317c90fd1bcfe45479a1511a8b015ce /src/intrface.c
parent30e5494daac64f4d916f7efed60123f07733dc18 (diff)
Remove the possibility to add a partition for non-partionned disk
Diffstat (limited to 'src/intrface.c')
-rw-r--r--src/intrface.c47
1 files changed, 28 insertions, 19 deletions
diff --git a/src/intrface.c b/src/intrface.c
index 63082d9..29044f1 100644
--- a/src/intrface.c
+++ b/src/intrface.c
@@ -744,7 +744,9 @@ static list_part_t *interface_analyse_ncurses(disk_t *disk_car, const int verbos
{
log_flush();
#ifdef HAVE_NCURSES
- command=screen_buffer_display(stdscr,(list_part!=NULL?"QB":"Q"),menuAnalyse);
+ command=screen_buffer_display(stdscr,
+ (list_part!=NULL && disk_car->arch->add_partition!=NULL?"QB":"Q"),
+ menuAnalyse);
#endif
}
if(command=='B')
@@ -1084,19 +1086,22 @@ static list_part_t *ask_structure_ncurses(disk_t *disk_car,list_part_t *list_par
wmove(stdscr,22,0);
wclrtoeol(stdscr); /* before addstr for BSD compatibility */
waddstr(stdscr,"Keys ");
- if(has_colors())
- wbkgdset(stdscr,' ' | A_BOLD | COLOR_PAIR(0));
- waddstr(stdscr,"A");
- if(has_colors())
- wbkgdset(stdscr,' ' | COLOR_PAIR(0));
- waddstr(stdscr,": add partition, ");
- if(has_colors())
- wbkgdset(stdscr,' ' | A_BOLD | COLOR_PAIR(0));
- waddstr(stdscr,"L");
- if(has_colors())
- wbkgdset(stdscr,' ' | COLOR_PAIR(0));
- waddstr(stdscr,": load backup, ");
-
+ /* If the disk can't be partionned, there is no partition to add and no partition to save */
+ if(disk_car->arch->add_partition!=NULL)
+ {
+ if(has_colors())
+ wbkgdset(stdscr,' ' | A_BOLD | COLOR_PAIR(0));
+ waddstr(stdscr,"A");
+ if(has_colors())
+ wbkgdset(stdscr,' ' | COLOR_PAIR(0));
+ waddstr(stdscr,": add partition, ");
+ if(has_colors())
+ wbkgdset(stdscr,' ' | A_BOLD | COLOR_PAIR(0));
+ waddstr(stdscr,"L");
+ if(has_colors())
+ wbkgdset(stdscr,' ' | COLOR_PAIR(0));
+ waddstr(stdscr,": load backup, ");
+ }
if(list_part==NULL)
{
waddstr(stdscr,"Enter: to continue");
@@ -1215,6 +1220,7 @@ static list_part_t *ask_structure_ncurses(disk_t *disk_car,list_part_t *list_par
break;
case 'a':
case 'A':
+ if(disk_car->arch->add_partition!=NULL)
{
list_part=disk_car->arch->add_partition(disk_car,list_part, verbose, current_cmd);
rewrite=1;
@@ -1252,11 +1258,14 @@ static list_part_t *ask_structure_ncurses(disk_t *disk_car,list_part_t *list_par
break;
case 'l':
case 'L':
- list_part=interface_load(disk_car,list_part,verbose);
- rewrite=1;
- offset=0;
- pos_num=0;
- pos=list_part;
+ if(disk_car->arch->add_partition!=NULL)
+ {
+ list_part=interface_load(disk_car,list_part,verbose);
+ rewrite=1;
+ offset=0;
+ pos_num=0;
+ pos=list_part;
+ }
break;
case 'q':
case '\r':