diff options
author | Karel Zak | 2016-08-26 12:09:53 +0200 |
---|---|---|
committer | Karel Zak | 2016-08-26 12:15:38 +0200 |
commit | 8d2f449818df988c1ca100e8f775cf24810a643e (patch) | |
tree | 9bf589b77a7ba662caa90b008cd872202145cc78 /disk-utils/fdisk.c | |
parent | lib/pager: cleanup and extend API (diff) | |
download | kernel-qcow2-util-linux-8d2f449818df988c1ca100e8f775cf24810a643e.tar.gz kernel-qcow2-util-linux-8d2f449818df988c1ca100e8f775cf24810a643e.tar.xz kernel-qcow2-util-linux-8d2f449818df988c1ca100e8f775cf24810a643e.zip |
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 <bruce.dubbs@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'disk-utils/fdisk.c')
-rw-r--r-- | disk-utils/fdisk.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/disk-utils/fdisk.c b/disk-utils/fdisk.c index 7e8285fe9..1bf5b8290 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'); } |