The default response is 'p' until three primary partitions are created, then 'e'. The original idea is from Karel Zak. Signed-off-by: Francesco Cosoleto <cosoleto@xxxxxxxxx> --- fdisk/fdisk.c | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-) diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c index 9356356..ac9035c 100644 --- a/fdisk/fdisk.c +++ b/fdisk/fdisk.c @@ -2532,17 +2532,25 @@ new_partition(void) { printf(_("Adding a primary partition\n")); add_partition(get_partition(0, 4), LINUX_NATIVE); } else { - char c, line[LINE_LENGTH]; + char c, dflt, line[LINE_LENGTH]; + + while (1) { + dflt = (free_primary == 1 && !extended_offset) ? 'e' : 'p'; snprintf(line, sizeof(line), _("Partition type:\n" " p primary (%d primary, %d extended, %d free)\n" "%s\n" - "Select: "), + "Select (default %c): "), 4 - (extended_offset ? 1 : 0) - free_primary, extended_offset ? 1 : 0, free_primary, - extended_offset ? _(" l logical (numbered from 5)") : _(" e extended")); + extended_offset ? _(" l logical (numbered from 5)") : _(" e extended"), + dflt); - while (1) { - if ((c = tolower(read_char(line))) == 'p') { + c = tolower(read_chars(line)); + if (c == '\n') { + c = dflt; + printf(_("Using default response %c\n"), c); + } + if (c == 'p') { int i = get_nonexisting_partition(0, 4); if (i >= 0) add_partition(i, LINUX_NATIVE); -- 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