summaryrefslogtreecommitdiffstats
path: root/src/hidden.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2009-01-14 22:13:47 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2009-01-14 22:13:47 +0100
commit1650fe5b8b6cea638c280df13605aea816718a00 (patch)
treefed11bd9361236aba47157d859607c109db05814 /src/hidden.c
parent56e1c29b2c0614b0b3230946d72e1eaf37618bcc (diff)
Split ncurses text interface from functions
Diffstat (limited to 'src/hidden.c')
-rw-r--r--src/hidden.c79
1 files changed, 4 insertions, 75 deletions
diff --git a/src/hidden.c b/src/hidden.c
index 3bdceb7..260784a 100644
--- a/src/hidden.c
+++ b/src/hidden.c
@@ -22,79 +22,14 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
+
+#include <stdio.h>
#include "types.h"
#include "common.h"
-#include "intrf.h"
-#ifdef HAVE_NCURSES
-#include "intrfn.h"
-#else
-#include <stdio.h>
-#endif
#include "log.h"
#include "hidden.h"
-#define INTER_DISK_X 0
-#define INTER_DISK_Y 18
-
-#ifdef HAVE_NCURSES
-static int interface_check_hidden_ncurses(disk_t *disk)
-{
- static const struct MenuItem menuHidden[]=
- {
- { 'C', "Continue", "Continue even if there are hidden data"},
- { 0,NULL,NULL}
- };
- unsigned int menu=0;
- int car;
- int line=8;
- aff_copy(stdscr);
- wmove(stdscr,4,0);
- wprintw(stdscr,"%s\n",disk->description_short(disk));
- wmove(stdscr,6,0);
- wprintw(stdscr,"Hidden sectors are present.");
- if(disk->sector_size!=0)
- {
- wmove(stdscr,line++,0);
- wprintw(stdscr, "size %llu sectors\n", (long long unsigned)(disk->disk_real_size/disk->sector_size));
- }
- if(disk->user_max!=0)
- {
- wmove(stdscr,line++,0);
- wprintw(stdscr, "user_max %llu sectors\n", (long long unsigned)disk->user_max);
- }
- if(disk->native_max!=0)
- {
- wmove(stdscr,line++,0);
- wprintw(stdscr, "native_max %llu sectors\n", (long long unsigned)(disk->native_max+1));
- }
- if(disk->dco!=0)
- {
- wmove(stdscr,line++,0);
- wprintw(stdscr, "dco %llu sectors\n", (long long unsigned)(disk->dco+1));
- }
- if(disk->user_max < disk->native_max+1)
- {
- wmove(stdscr,line++,0);
- wprintw(stdscr, "Host Protected Area (HPA) present.\n");
- }
- if(disk->native_max < disk->dco)
- {
- wmove(stdscr,line,0);
- wprintw(stdscr, "Device Configuration Overlay (DCO) present.\n");
- }
- car= wmenuSelect_ext(stdscr, 23, INTER_DISK_Y, INTER_DISK_X, menuHidden, 10,
- "CQ", MENU_VERT | MENU_VERT_WARN | MENU_BUTTON, &menu,NULL);
- if(car=='c' || car=='C')
- return 0;
- return 1;
-}
-#endif
-
-int interface_check_hidden(disk_t *disk, char **current_cmd)
+int is_hpa_or_dco(const disk_t *disk)
{
if(disk->user_max>0 && (disk->user_max < disk->native_max+1 || disk->native_max < disk->dco))
{
@@ -103,13 +38,7 @@ int interface_check_hidden(disk_t *disk, char **current_cmd)
if(disk->native_max < disk->dco)
log_warning("%s: Device Configuration Overlay (DCO) present.\n", disk->device);
log_flush();
- if(*current_cmd!=NULL)
- return 0;
-#ifdef HAVE_NCURSES
- return interface_check_hidden_ncurses(disk);
-#else
- return 0;
-#endif
+ return 1;
}
return 0;
}