summaryrefslogtreecommitdiff
path: root/debugfs/util.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2003-12-25 14:28:55 -0500
committerTheodore Ts'o <tytso@mit.edu>2003-12-25 14:28:55 -0500
commit2b696a98569339287894df4a40676745f6111d7e (patch)
tree673b1c121442c99d77b90d86daf8267fd3f9dc30 /debugfs/util.c
parent94ed67eb470b3fa9f7068db2fdb70d4e1fa32137 (diff)
downloade2fsprogs-2b696a98569339287894df4a40676745f6111d7e.tar.gz
Try to use the DEBUGFS_PAGER environment
variable first, and then fall back to the PAGER environment variable. Finally, search for an appropriate pager executable.
Diffstat (limited to 'debugfs/util.c')
-rw-r--r--debugfs/util.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/debugfs/util.c b/debugfs/util.c
index 319d4fba..4da7f6e2 100644
--- a/debugfs/util.c
+++ b/debugfs/util.c
@@ -80,20 +80,15 @@ FILE *open_pager(void)
char buf[80];
signal(SIGPIPE, SIG_IGN);
- if (pager) {
- if (strcmp(pager, "__none__") == 0) {
- return stdout;
- }
- } else
+ if (!pager)
+ pager = getenv("DEBUGFS_PAGER");
+ if (!pager)
pager = find_pager(buf);
-
- if (pager)
- outfile = popen(pager, "w");
-
- if (!outfile)
- outfile = stdout;
-
- return (outfile);
+ if (!pager ||
+ (strcmp(pager, "__none__") == 0) ||
+ ((outfile = popen(pager, "w")) == 0))
+ return stdout;
+ return outfile;
}
void close_pager(FILE *stream)