parted/0067-Fix-help-text-for-disk_-set-toggle.patch
Brian C. Lane 0b7af917e2 - Rebase on new upstream master commit cc382c3
- Drop patches incorporated into upstream
- Still adds the various DASD patches
2014-04-08 11:46:37 -07:00

99 lines
3.4 KiB
Diff

From 3e005b4644d2a97da85c251f93d32d93e94bcccf Mon Sep 17 00:00:00 2001
From: Phillip Susi <psusi@ubuntu.com>
Date: Mon, 24 Feb 2014 11:29:43 -0500
Subject: [PATCH 67/89] Fix help text for disk_{set,toggle}
Fix the help text to show *disk* flags instead of partition flags.
---
NEWS | 4 ++++
parted/parted.c | 23 +++++++++++++++++++++--
2 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/NEWS b/NEWS
index 935fa33..40ce370 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,10 @@ GNU parted NEWS -*- outline -*-
boot partition type.
** Bug Fixes
+
+ Fix help text for disk_{set,toggle} to show *disk* flags instead
+ of partition flags.
+
Fix gpt to correctly handle non ASCII charcters in partition names
If a drive was 100 times an even multiple of two, sizes specified as
diff --git a/parted/parted.c b/parted/parted.c
index b20d432..a7d9363 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -144,6 +144,7 @@ static const char* number_msg = N_(
static const char* label_type_msg_start = N_("LABEL-TYPE is one of: ");
static const char* flag_msg_start = N_("FLAG is one of: ");
+static const char* disk_flag_msg_start = N_("FLAG is one of: ");
static const char* unit_msg_start = N_("UNIT is one of: ");
static const char* min_or_opt_msg = N_("desired alignment: minimum or optimal");
static const char* part_type_msg = N_("PART-TYPE is one of: primary, logical, "
@@ -167,6 +168,7 @@ static const char* copyright_msg = N_(
static char* label_type_msg;
static char* flag_msg;
+static char* disk_flag_msg;
static char* unit_msg;
static char* mkpart_fs_type_msg;
@@ -1710,6 +1712,7 @@ _init_messages ()
PedFileSystemAlias* fs_alias;
PedDiskType* disk_type;
PedPartitionFlag part_flag;
+ PedDiskFlag disk_flag;
PedUnit unit;
/* flags */
@@ -1728,6 +1731,22 @@ _init_messages ()
flag_msg = str_list_convert (list);
str_list_destroy (list);
+/* disk flags */
+ first = 1;
+ list = str_list_create (_(disk_flag_msg_start), NULL);
+ for (disk_flag = ped_disk_flag_next (0); disk_flag;
+ disk_flag = ped_disk_flag_next (disk_flag)) {
+ if (first)
+ first = 0;
+ else
+ str_list_append (list, ", ");
+ str_list_append (list,
+ _(ped_disk_flag_get_name (disk_flag)));
+ }
+ str_list_append (list, "\n");
+
+ disk_flag_msg = str_list_convert (list);
+ str_list_destroy (list);
/* units */
first = 1;
@@ -1912,7 +1931,7 @@ command_register (commands, command_create (
str_list_create (
_("disk_set FLAG STATE change the FLAG on selected device"),
NULL),
- str_list_create (flag_msg, _(state_msg), NULL), 1));
+ str_list_create (disk_flag_msg, _(state_msg), NULL), 1));
command_register (commands, command_create (
str_list_create_unique ("disk_toggle", _("disk_toggle"), NULL),
@@ -1921,7 +1940,7 @@ command_register (commands, command_create (
_("disk_toggle [FLAG] toggle the state of FLAG on "
"selected device"),
NULL),
- str_list_create (flag_msg, NULL), 1));
+ str_list_create (disk_flag_msg, NULL), 1));
command_register (commands, command_create (
str_list_create_unique ("set", _("set"), NULL),
--
1.8.5.3