aboutsummaryrefslogtreecommitdiffstats
path: root/com32/hdt/hdt-cli-disk.c
diff options
context:
space:
mode:
authorErwan Velu <erwan.velu@free.fr>2009-11-26 23:44:22 +0100
committerErwan Velu <erwan.velu@free.fr>2009-12-04 10:11:14 +0100
commit0709f91fab7244cef45018d51c33fbe9361a3cc0 (patch)
treeca5e6f82dd80687e12ac33433cad965af7f43007 /com32/hdt/hdt-cli-disk.c
parent45cbbf3d1ea302cc6379c5400186f36f1b03b238 (diff)
downloadhdt-0709f91fab7244cef45018d51c33fbe9361a3cc0.tar.gz
hdt-0709f91fab7244cef45018d51c33fbe9361a3cc0.tar.xz
hdt-0709f91fab7244cef45018d51c33fbe9361a3cc0.zip
hdt: show error message when no disk is found
Impact: Visual Display an error message when no disk is found on the system
Diffstat (limited to 'com32/hdt/hdt-cli-disk.c')
-rw-r--r--com32/hdt/hdt-cli-disk.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/com32/hdt/hdt-cli-disk.c b/com32/hdt/hdt-cli-disk.c
index 1f5fde64..290940c1 100644
--- a/com32/hdt/hdt-cli-disk.c
+++ b/com32/hdt/hdt-cli-disk.c
@@ -114,8 +114,10 @@ void main_show_disk(int argc, char **argv, struct s_hardware *hardware)
detect_disks(hardware);
reset_more_printf();
- if (!hardware->disk_info[i].cbios)
+ if (!hardware->disk_info[i].cbios) {
+ more_printf("No disk found\n");
return; /* Invalid geometry */
+ }
get_mbr_string(hardware->mbr_ids[i], &mbr_name, 50);
@@ -157,12 +159,14 @@ void main_show_disk(int argc, char **argv, struct s_hardware *hardware)
void main_show_disks(int argc __unused, char **argv __unused,
struct s_hardware *hardware)
{
+ bool found = false;
reset_more_printf();
detect_disks(hardware);
int first_one = 0;
for (int drive = 0x80; drive < 0xff; drive++) {
if (hardware->disk_info[drive - 0x80].cbios) {
+ found = true;
if (!first_one) {
first_one = 1;
} else {
@@ -174,12 +178,16 @@ void main_show_disks(int argc __unused, char **argv __unused,
main_show_disk(1, argv, hardware);
}
}
+
+ if (found == false)
+ more_printf("No disk found\n");
}
void disks_summary(int argc __unused, char **argv __unused,
struct s_hardware *hardware)
{
int i = -1;
+ bool found = false;
detect_disks(hardware);
reset_more_printf();
@@ -188,6 +196,8 @@ void disks_summary(int argc __unused, char **argv __unused,
i++;
if (!hardware->disk_info[i].cbios)
continue; /* Invalid geometry */
+
+ found = true;
struct driveinfo *d = &hardware->disk_info[i];
char disk_size[9];
@@ -206,6 +216,9 @@ void disks_summary(int argc __unused, char **argv __unused,
remove_spaces((char *)d->edd_params.host_bus_type),
remove_spaces((char *)d->edd_params.interface_type));
}
+
+ if (found == false)
+ more_printf("No disk found\n");
}
struct cli_callback_descr list_disk_show_modules[] = {