From 4dcb68ccd25eb670f2dbbcbfa0919a1ed7b402be Mon Sep 17 00:00:00 2001 From: joerg Date: Wed, 15 Feb 2012 23:35:00 +0000 Subject: Be a bit more friendly to man pages using the roff .so command by changing the current directory to the parent of the man -p entry, e.g. /usr/share/man for /usr/share/man1. --- usr.sbin/makemandb/makemandb.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/usr.sbin/makemandb/makemandb.c b/usr.sbin/makemandb/makemandb.c index c413eadabce..e860b65c68b 100644 --- a/usr.sbin/makemandb/makemandb.c +++ b/usr.sbin/makemandb/makemandb.c @@ -1,4 +1,4 @@ -/* $NetBSD: makemandb.c,v 1.2 2012/02/07 19:17:16 joerg Exp $ */ +/* $NetBSD: makemandb.c,v 1.3 2012/02/15 23:35:00 joerg Exp $ */ /* * Copyright (c) 2011 Abhinav Upadhyay * Copyright (c) 2011 Kristaps Dzonsons @@ -17,7 +17,7 @@ */ #include -__RCSID("$NetBSD: makemandb.c,v 1.2 2012/02/07 19:17:16 joerg Exp $"); +__RCSID("$NetBSD: makemandb.c,v 1.3 2012/02/15 23:35:00 joerg Exp $"); #include #include @@ -26,6 +26,7 @@ __RCSID("$NetBSD: makemandb.c,v 1.2 2012/02/07 19:17:16 joerg Exp $"); #include #include #include +#include #include #include #include @@ -291,7 +292,7 @@ main(int argc, char *argv[]) { FILE *file; const char *sqlstr, *manconf = NULL; - char *line, *command; + char *line, *command, *parent; char *errmsg; int ch; struct mparse *mp; @@ -397,6 +398,9 @@ main(int argc, char *argv[]) while ((len = getline(&line, &linesize, file)) != -1) { /* Replace the new line character at the end of string with '\0' */ line[len - 1] = '\0'; + parent = estrdup(line); + chdir(dirname(parent)); + free(parent); /* Traverse the man page directories and parse the pages */ traversedir(line, db, mp); } -- cgit