summaryrefslogtreecommitdiff
path: root/usr/src/cmd/man/man.c
diff options
context:
space:
mode:
authorYuri Pankov <yuri.pankov@nexenta.com>2016-02-12 06:15:17 +0300
committerDan McDonald <danmcd@omniti.com>2016-02-12 15:14:34 -0500
commitd456640d8a14f0ba35a7ec232f0ce9ebd34541cb (patch)
tree19010e911dbffc05dcfbebd0d36431dd193636ce /usr/src/cmd/man/man.c
parent0803e914d3511e82e0b1cc0c888af873a4aaa7d1 (diff)
downloadillumos-joyent-d456640d8a14f0ba35a7ec232f0ce9ebd34541cb.tar.gz
6647 MANSECTS should not require a trailing comma
Reviewed by: Joshua M. Clulow <josh@sysmgr.org> Approved by: Dan McDonald <danmcd@omniti.com>
Diffstat (limited to 'usr/src/cmd/man/man.c')
-rw-r--r--usr/src/cmd/man/man.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/usr/src/cmd/man/man.c b/usr/src/cmd/man/man.c
index d181c6d374..08ec0f02f3 100644
--- a/usr/src/cmd/man/man.c
+++ b/usr/src/cmd/man/man.c
@@ -23,7 +23,7 @@
* Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012, Josef 'Jeff' Sipek <jeffpc@31bits.net>. All rights reserved.
* Copyright 2014 Garrett D'Amore <garrett@damore.org>
- * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2016 Nexenta Systems, Inc.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T. */
@@ -529,20 +529,22 @@ getsect(struct man_node *manp, char **pv)
manp->secv = NULL;
get_all_sect(manp);
} else if (sargs) {
+ DPRINTF("-- Adding %s: sections=%s\n", manp->path, mansec);
manp->secv = split(mansec, ',');
for (sectp = manp->secv; *sectp; sectp++)
lower(*sectp);
} else if ((sections = strchr(*pv, ',')) != NULL) {
- DPRINTF("-- Adding %s: MANSECTS=%s\n", manp->path, sections);
- manp->secv = split(++sections, ',');
+ sections++;
+ DPRINTF("-- Adding %s: sections=%s\n", manp->path, sections);
+ manp->secv = split(sections, ',');
for (sectp = manp->secv; *sectp; sectp++)
lower(*sectp);
if (*manp->secv == NULL)
get_all_sect(manp);
} else if ((sections = check_config(*pv)) != NULL) {
manp->defsrch = 1;
- DPRINTF("-- Adding %s: from %s, MANSECTS=%s\n", manp->path,
- CONFIG, sections);
+ DPRINTF("-- Adding %s: sections=%s (from %s)\n", manp->path,
+ sections, CONFIG);
manp->secv = split(sections, ',');
for (sectp = manp->secv; *sectp; sectp++)
lower(*sectp);
@@ -550,7 +552,7 @@ getsect(struct man_node *manp, char **pv)
get_all_sect(manp);
} else {
manp->defsrch = 1;
- DPRINTF("-- Adding %s: default sort order\n", manp->path);
+ DPRINTF("-- Adding %s: default search order\n", manp->path);
manp->secv = NULL;
get_all_sect(manp);
}
@@ -1289,9 +1291,10 @@ check_config(char *path)
{
FILE *fp;
char *rc = NULL;
- char *sect;
+ char *sect = NULL;
char fname[MAXPATHLEN];
char *line = NULL;
+ char *nl;
size_t linecap = 0;
(void) snprintf(fname, MAXPATHLEN, "%s/%s", path, CONFIG);
@@ -1300,18 +1303,20 @@ check_config(char *path)
return (NULL);
while (getline(&line, &linecap, fp) > 0) {
- if ((rc = strstr(line, "MANSECTS")) != NULL)
+ if ((rc = strstr(line, "MANSECTS=")) != NULL)
break;
}
(void) fclose(fp);
- if (rc == NULL || (sect = strchr(line, '=')) == NULL)
- return (NULL);
- else
- return (++sect);
-}
+ if (rc != NULL) {
+ if ((nl = strchr(rc, '\n')) != NULL)
+ *nl = '\0';
+ sect = strchr(rc, '=') + 1;
+ }
+ return (sect);
+}
/*
* Initialize the bintoman array with appropriate device and inode info.
@@ -1519,7 +1524,8 @@ path_to_manpath(char *bindir)
* Free a linked list of dupnode structs.
*/
void
-free_dupnode(struct dupnode *dnp) {
+free_dupnode(struct dupnode *dnp)
+{
struct dupnode *dnp2;
struct secnode *snp;