Whamcloud - gitweb
Try to use the DEBUGFS_PAGER environment
authorTheodore Ts'o <tytso@mit.edu>
Thu, 25 Dec 2003 19:28:55 +0000 (14:28 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 25 Dec 2003 19:28:55 +0000 (14:28 -0500)
variable first, and then fall back to the PAGER
environment variable.  Finally, search for an appropriate
pager executable.

debugfs/ChangeLog
debugfs/util.c

index 839c04e..4ca40ed 100644 (file)
@@ -1,3 +1,10 @@
+2003-12-25  Theodore Ts'o  <tytso@mit.edu>
+
+       * util.c (open_pager): 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.
+
 2003-12-11  Theodore Ts'o  <tytso@thunk.org>
 
        * debugfs.c (do_write, do_mkdir): If the directory is full,
index 319d4fb..4da7f6e 100644 (file)
@@ -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)