]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fdisk: use PAGER for 'l' command.
authorKarel Zak <kzak@redhat.com>
Fri, 26 Aug 2016 10:09:53 +0000 (12:09 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 26 Aug 2016 10:15:38 +0000 (12:15 +0200)
The list of the partition types is too long. Let's try to use $PAGER.

Reported-by: Bruce Dubbs <bruce.dubbs@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
disk-utils/fdisk.c

index 7e8285fe9a8c2302f714710236dc3959e44976d5..1bf5b8290195ebcae33172a6f38ae44b2370faf4 100644 (file)
@@ -37,6 +37,7 @@
 #include "canonicalize.h"
 #include "strutils.h"
 #include "closestream.h"
+#include "pager.h"
 
 #include "fdisk.h"
 
@@ -447,6 +448,7 @@ static struct fdisk_parttype *ask_partition_type(struct fdisk_context *cxt)
        return NULL;
 }
 
+
 void list_partition_types(struct fdisk_context *cxt)
 {
        size_t ntypes = 0;
@@ -507,12 +509,16 @@ void list_partition_types(struct fdisk_context *cxt)
                 */
                size_t i;
 
+               pager_open();
+
                for (i = 0; i < ntypes; i++) {
                        const struct fdisk_parttype *t = fdisk_label_get_parttype(lb, i);
                        printf("%3zu %-30s %s\n", i + 1,
                                        fdisk_parttype_get_name(t),
                                        fdisk_parttype_get_string(t));
                }
+
+               pager_close();
        }
        putchar('\n');
 }