From: Karel Zak Date: Fri, 26 Aug 2016 10:09:53 +0000 (+0200) Subject: fdisk: use PAGER for 'l' command. X-Git-Tag: v2.29-rc1~101 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8d2f449818df988c1ca100e8f775cf24810a643e;p=thirdparty%2Futil-linux.git 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 --- 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'); }