From 8d2f449818df988c1ca100e8f775cf24810a643e Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 26 Aug 2016 12:09:53 +0200 Subject: [PATCH] fdisk: use PAGER for 'l' command. The list of the partition types is too long. Let's try to use $PAGER. Reported-by: Bruce Dubbs Signed-off-by: Karel Zak --- disk-utils/fdisk.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/disk-utils/fdisk.c b/disk-utils/fdisk.c index 7e8285fe9a..1bf5b82901 100644 --- a/disk-utils/fdisk.c +++ b/disk-utils/fdisk.c @@ -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'); } -- 2.47.2