summaryrefslogtreecommitdiff
path: root/usr.bin/man/man.c
diff options
context:
space:
mode:
authorJeremie Courreges-Anglas <jca@cvs.openbsd.org>2013-07-01 17:16:04 +0000
committerJeremie Courreges-Anglas <jca@cvs.openbsd.org>2013-07-01 17:16:04 +0000
commitf59b55192919cbddd6ed9241f80e73fd38b88bc0 (patch)
tree02759a3ac1d203bfe838e748fe714ff7b5650593 /usr.bin/man/man.c
parentbf329b19ae9dfe1ea493372b98ada56778e6d704 (diff)
Kill off some code that undocumently added an "-s" switch if user had
specified "more" as (MAN)PAGER. Document the default pager used while here. Discussed with schwarze@, ok schwarze@ millert@, jasper@ agrees. Users can get the previous behaviour by specifying eg. export MANPAGER="more -s".
Diffstat (limited to 'usr.bin/man/man.c')
-rw-r--r--usr.bin/man/man.c47
1 files changed, 8 insertions, 39 deletions
diff --git a/usr.bin/man/man.c b/usr.bin/man/man.c
index 5243cc2c933..5d250334738 100644
--- a/usr.bin/man/man.c
+++ b/usr.bin/man/man.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: man.c,v 1.46 2013/06/26 19:56:45 jca Exp $ */
+/* $OpenBSD: man.c,v 1.47 2013/07/01 17:16:03 jca Exp $ */
/* $NetBSD: man.c,v 1.7 1995/09/28 06:05:34 tls Exp $ */
/*
@@ -78,7 +78,6 @@ static void parse_path(TAG *, const char *);
static void append_subdirs(TAG *, const char *);
static void build_page(char *, char **);
static void cat(char *);
-static char *check_pager(char *);
static int cleanup(int);
static void how(char *);
static void jump(char **, char *, char *);
@@ -167,13 +166,13 @@ main(int argc, char *argv[])
if (!f_cat && !f_how && !f_where) {
if (!isatty(1))
f_cat = 1;
- else if ((pager = getenv("MANPAGER")) != NULL &&
- (*pager != '\0'))
- pager = check_pager(pager);
- else if ((pager = getenv("PAGER")) != NULL && (*pager != '\0'))
- pager = check_pager(pager);
- else
- pager = _PATH_PAGER;
+ else {
+ pager = getenv("MANPAGER");
+ if (pager == NULL || *pager == '\0')
+ pager = getenv("PAGER");
+ if (pager == NULL || *pager == '\0')
+ pager = _PATH_PAGER;
+ }
}
/* Read the configuration file. */
@@ -854,36 +853,6 @@ cat(char *fname)
}
/*
- * check_pager --
- * check the user supplied page information
- */
-static char *
-check_pager(char *name)
-{
- char *p, *save;
-
- /*
- * if the user uses "more", we make it "more -s"; watch out for
- * PAGER = "mypager /usr/bin/more"
- */
- for (p = name; *p && !isspace(*p); ++p)
- ;
- for (; p > name && *p != '/'; --p)
- ;
- if (p != name)
- ++p;
-
- /* make sure it's "more", not "morex" */
- if (!strncmp(p, "more", 4) && (p[4] == '\0' || isspace(p[4]))){
- save = name;
- /* allocate space to add the "-s" */
- if (asprintf(&name, "%s -s", save) == -1)
- err(1, "asprintf");
- }
- return(name);
-}
-
-/*
* jump --
* strip out flag argument and jump
*/