tech-userlevel archive

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

Support $MANPAGER in man(1)



Hello,
Attached patch adds support for $MANPAGER environment variable. It's
currently lacking the documentation patch, but I thought I'd post the
change for code first in case the change is rejected.

Thoughts? / ok to commit with man page update?


Sevan
  	Index: usr.bin/man/man.c
===================================================================
RCS file: /cvsroot/src/usr.bin/man/man.c,v
retrieving revision 1.66
diff -u -p -r1.66 man.c
--- usr.bin/man/man.c	2 May 2017 14:19:23 -0000	1.66
+++ usr.bin/man/man.c	10 Sep 2017 17:04:34 -0000
@@ -217,7 +217,10 @@ main(int argc, char **argv)
 		if (!isatty(STDOUT_FILENO)) {
 			m.cat = 1;
 		} else {
-			if ((m.pager = getenv("PAGER")) != NULL &&
+			if ((m.pager = getenv("MANPAGER")) != NULL &&
+			    m.pager[0] != '\0')
+				m.pager = check_pager(m.pager);
+			else if ((m.pager = getenv("PAGER")) != NULL &&
 			    m.pager[0] != '\0')
 				m.pager = check_pager(m.pager);
 			else


Home | Main Index | Thread Index | Old Index