Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin Fall back to more(1) if PAGER is set but null.



details:   https://anonhg.NetBSD.org/src/rev/55946fd4affb
branches:  trunk
changeset: 473664:55946fd4affb
user:      kleink <kleink%NetBSD.org@localhost>
date:      Sun Jun 13 19:38:04 1999 +0000

description:
Fall back to more(1) if PAGER is set but null.

diffstat:

 usr.bin/man/man.1   |  10 ++++++----
 usr.bin/man/man.c   |  14 ++++++++------
 usr.bin/msgs/msgs.1 |  18 ++++++++++++++----
 usr.bin/msgs/msgs.c |   7 ++++---
 4 files changed, 32 insertions(+), 17 deletions(-)

diffs (136 lines):

diff -r 7dc8f0633b01 -r 55946fd4affb usr.bin/man/man.1
--- a/usr.bin/man/man.1 Sun Jun 13 18:52:28 1999 +0000
+++ b/usr.bin/man/man.1 Sun Jun 13 19:38:04 1999 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: man.1,v 1.7 1999/03/22 18:16:39 garbled Exp $
+.\"    $NetBSD: man.1,v 1.8 1999/06/13 19:38:04 kleink Exp $
 .\"
 .\" Copyright (c) 1989, 1990, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -164,10 +164,12 @@
 .Nm
 configuration file.
 .It Ev PAGER
-Any value of the environment variable
+The pagination command used for writing the output.
+If the
 .Ev PAGER
-will be used instead of the standard pagination program,
-.Xr more 1 .
+environment variable is null or not set, the standard pagination program
+.Xr more 1
+will be used.
 .El
 .Sh FILES
 .Bl -tag -width /etc/man.conf -compact
diff -r 7dc8f0633b01 -r 55946fd4affb usr.bin/man/man.c
--- a/usr.bin/man/man.c Sun Jun 13 18:52:28 1999 +0000
+++ b/usr.bin/man/man.c Sun Jun 13 19:38:04 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: man.c,v 1.15 1998/11/06 22:33:47 christos Exp $        */
+/*     $NetBSD: man.c,v 1.16 1999/06/13 19:38:04 kleink Exp $  */
 
 /*
  * Copyright (c) 1987, 1993, 1994, 1995
@@ -44,7 +44,7 @@
 #if 0
 static char sccsid[] = "@(#)man.c      8.17 (Berkeley) 1/31/95";
 #else
-__RCSID("$NetBSD: man.c,v 1.15 1998/11/06 22:33:47 christos Exp $");
+__RCSID("$NetBSD: man.c,v 1.16 1999/06/13 19:38:04 kleink Exp $");
 #endif
 #endif /* not lint */
 
@@ -148,12 +148,14 @@
                usage();
 
        if (!f_cat && !f_how && !f_where) {
-               if (!isatty(1))
+               if (!isatty(STDOUT_FILENO)) {
                        f_cat = 1;
-               else {
-                       if ((pager = getenv("PAGER")) != NULL)
+               } else {
+                       if ((pager = getenv("PAGER")) != NULL &&
+                           pager[0] != '\0')
                                pager = check_pager(pager);
-                       else    pager = _PATH_PAGER;
+                       else
+                               pager = _PATH_PAGER;
                }
        }
        /* Read the configuration file. */
diff -r 7dc8f0633b01 -r 55946fd4affb usr.bin/msgs/msgs.1
--- a/usr.bin/msgs/msgs.1       Sun Jun 13 18:52:28 1999 +0000
+++ b/usr.bin/msgs/msgs.1       Sun Jun 13 19:38:04 1999 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: msgs.1,v 1.8 1999/03/22 18:16:40 garbled Exp $
+.\"    $NetBSD: msgs.1,v 1.9 1999/06/13 19:38:05 kleink Exp $
 .\"
 .\" Copyright (c) 1980, 1990, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -97,7 +97,11 @@
 .Xr mail  1
 is invoked on that mailbox.
 .It Fl p
-The specified message is piped through $PAGER, or, if $PAGER is not defined,
+The specified message is piped through
+.Ev PAGER ,
+or, if
+.Ev PAGER
+is null or not defined,
 .Xr more 1  .
 The commands `m', `p', and `s' all accept a numeric argument in place of the `\-'.
 .El
@@ -163,7 +167,9 @@
 Print the first part of messages only.
 .It Fl r
 Disables the ability to save messages or enter the mailer.  It is
-assumed that $PAGER is set to something secure.
+assumed that
+.Ev PAGER
+is set to something secure.
 .It Fl l
 Option causes only locally originated messages to be reported.
 .It Ar num
@@ -186,7 +192,11 @@
 .Pa \&.msgsrc
 file, useful for reviews of recent messages.
 .It Fl p
-Pipe long messages through $PAGER, or, if $PAGER is not defined,
+Pipe long messages through
+.Ev PAGER ,
+or, if
+.Ev PAGER
+is null or not defined,
 .Xr more  1  .
 .El
 .Pp
diff -r 7dc8f0633b01 -r 55946fd4affb usr.bin/msgs/msgs.c
--- a/usr.bin/msgs/msgs.c       Sun Jun 13 18:52:28 1999 +0000
+++ b/usr.bin/msgs/msgs.c       Sun Jun 13 19:38:04 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msgs.c,v 1.14 1999/04/20 07:24:49 mrg Exp $    */
+/*     $NetBSD: msgs.c,v 1.15 1999/06/13 19:38:05 kleink Exp $ */
 
 /*-
  * Copyright (c) 1980, 1993
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "@(#)msgs.c     8.2 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: msgs.c,v 1.14 1999/04/20 07:24:49 mrg Exp $");
+__RCSID("$NetBSD: msgs.c,v 1.15 1999/06/13 19:38:05 kleink Exp $");
 #endif
 #endif /* not lint */
 
@@ -634,7 +634,8 @@
        if (use_pager && length > Lpp) {
                signal(SIGPIPE, SIG_IGN);
                signal(SIGQUIT, SIG_IGN);
-                if ((env_pager = getenv("PAGER")) == NULL) {
+                if ((env_pager = getenv("PAGER")) == NULL ||
+                   env_pager[0] == '\0') {
                         sprintf(cmdbuf, _PATH_PAGER, Lpp);
                 } else {
                         strcpy(cmdbuf, env_pager);



Home | Main Index | Thread Index | Old Index