Hi people,

the following patch changes the prompt for the 'Partition size' and
'Partition offset' prompts in fdisk to show the range of allowed values
and display the raw value as well when showing an error for out of
bounds values.

Index: misc.c
===================================================================
RCS file: /mnt/media/cvs/src/sbin/fdisk/misc.c,v
retrieving revision 1.52
diff -u -p -u -r1.52 misc.c
--- misc.c      27 Aug 2015 20:58:27 -0000      1.52
+++ misc.c      5 Sep 2015 14:22:13 -0000
@@ -213,7 +213,7 @@ getuint64(char *prompt, u_int64_t oval, 
        secpercyl = disk.sectors * disk.heads;
 
        do {
-               printf("%s: [%llu] ", prompt, oval);
+               printf("%s [0 - %llu]: [%llu] ", prompt, maxval, oval);
 
                if (fgets(buf, sizeof(buf), stdin) == NULL)
                        errx(1, "eof");
@@ -302,8 +302,8 @@ getuint64(char *prompt, u_int64_t oval, 
                }
 
                if (saveerr == ERANGE || d > maxval || d < 0 || d < d2) {
-                       printf("%s is out of range: %c%s%c\n", prompt, operator,
-                           p, unit);
+                       printf("%s is out of range: %c%s%c (%lld)\n", prompt, 
operator,
+                           p, unit, (int64_t)d);
                } else if (*endptr != '\0') {
                        printf("%s is invalid: %c%s%c\n", prompt, operator,
                            p, unit);

-- 
        Gregor

Reply via email to