aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre-Alexandre Meyer <pierre@mouraf.org>2009-08-05 19:19:59 -0700
committerPierre-Alexandre Meyer <pierre@mouraf.org>2009-08-05 19:26:49 -0700
commit22a679c93b85c064844b0a12cb1e59eba1cf4aa4 (patch)
tree892162689773a3870b91e718fb6f1a4b3efb3e51
parentf8ac660c0fae6328bde62164f8f01b17b9dc5522 (diff)
downloadlwip-22a679c93b85c064844b0a12cb1e59eba1cf4aa4.tar.gz
lwip-22a679c93b85c064844b0a12cb1e59eba1cf4aa4.tar.xz
lwip-22a679c93b85c064844b0a12cb1e59eba1cf4aa4.zip
hdt: Don't show partition header if not needed
Don't blindly print the partition header: check if we are able to iterate through them first. Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
-rw-r--r--com32/hdt/hdt-cli-disk.c4
-rw-r--r--com32/hdt/hdt-menu-disk.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/com32/hdt/hdt-cli-disk.c b/com32/hdt/hdt-cli-disk.c
index 197d1703..07f72930 100644
--- a/com32/hdt/hdt-cli-disk.c
+++ b/com32/hdt/hdt-cli-disk.c
@@ -78,6 +78,9 @@ static void show_partition_information(struct driveinfo *drive_info,
else
memset(size, 0, sizeof size);
+ if (i == 1)
+ more_printf(" # B Start End Size Id Type\n");
+
get_label(ptab->ostype, &parttype);
more_printf(" %2d %s %11d %11d %s %02X %s",
i, (ptab->active_flag == 0x80) ? "x" : " ",
@@ -143,7 +146,6 @@ void main_show_disk(int argc, char **argv,
remove_spaces(d->edd_params.host_bus_type),
remove_spaces(d->edd_params.interface_type));
- more_printf(" # B Start End Size Id Type\n");
if (parse_partition_table(d, &show_partition_information) == -1) {
get_error(&error_buffer);
more_printf("%s\n", error_buffer);
diff --git a/com32/hdt/hdt-menu-disk.c b/com32/hdt/hdt-menu-disk.c
index 05aef70a..487d1e45 100644
--- a/com32/hdt/hdt-menu-disk.c
+++ b/com32/hdt/hdt-menu-disk.c
@@ -48,6 +48,9 @@ static void show_partition_information(struct driveinfo *drive_info,
char menu_title[MENULEN + 1];
char menu_title_ref[MENULEN + 1];
+ if (nb_partitions_seen == 1)
+ add_sep();
+
memset(menu_title,0,sizeof menu_title);
memset(menu_title_ref,0,sizeof menu_title_ref);
snprintf(menu_title_ref, sizeof menu_title_ref, "disk_%x_part_%d",
@@ -204,7 +207,6 @@ static int compute_disk_module(struct s_my_menu *menu, int nb_sub_disk_menu,
add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu[nb_sub_disk_menu].items_count++;
- add_sep();
dn=disk_number;
parse_partition_table(&d[disk_number], &show_partition_information);