[PATCH 1/3] fdisk: change primary or extended partition type dialog

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mainly this appends a colon for the prompt, reverses order of the list,
reports the number of primary partitions used and unused.

Old version:
 Command action
    e   extended
    p   primary partition (1-4)
 p

New version:
 Partition type:
    p   primary (0 used, 4 free)
    e   extended
 Select: p

Old version:
 Command action
    l   logical (5 or over)
    p   primary partition (1-4)
 l

New version:
 Partition type:
    p   primary (0 used, 3 free)
    l   logical
 Select: l

Signed-off-by: Francesco Cosoleto <cosoleto@xxxxxxxxx>
---
 fdisk/fdisk.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c
index f0f8061..55e2ac9 100644
--- a/fdisk/fdisk.c
+++ b/fdisk/fdisk.c
@@ -2534,9 +2534,12 @@ new_partition(void) {
 	} else {
 		char c, line[LINE_LENGTH];
 		snprintf(line, sizeof(line),
-			 _("Command action\n   %s\n   p   primary "
-			   "partition (1-4)\n"), extended_offset ?
-			 _("l   logical (5 or over)") : _("e   extended"));
+			 _("Partition type:\n"
+			   "   p   primary (%d used, %d free)\n"
+			   "%s\n"
+			   "Select: "), 4 - (extended_offset ? 1 : 0) - free_primary, free_primary,
+			 extended_offset ? _("   l   logical") : _("   e   extended"));
+
 		while (1) {
 			if ((c = tolower(read_char(line))) == 'p') {
 				int i = get_nonexisting_partition(0, 4);
-- 
1.7.3.4

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux