Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/makemandb Be a bit more friendly to man pages using...
details: https://anonhg.NetBSD.org/src/rev/10ed8bb10216
branches: trunk
changeset: 777344:10ed8bb10216
user: joerg <joerg%NetBSD.org@localhost>
date: Wed Feb 15 23:35:00 2012 +0000
description:
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.
diffstat:
usr.sbin/makemandb/makemandb.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diffs (45 lines):
diff -r b931d25d0574 -r 10ed8bb10216 usr.sbin/makemandb/makemandb.c
--- a/usr.sbin/makemandb/makemandb.c Wed Feb 15 23:32:27 2012 +0000
+++ b/usr.sbin/makemandb/makemandb.c Wed Feb 15 23:35:00 2012 +0000
@@ -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 <er.abhinav.upadhyay%gmail.com@localhost>
* Copyright (c) 2011 Kristaps Dzonsons <kristaps%bsd.lv@localhost>
@@ -17,7 +17,7 @@
*/
#include <sys/cdefs.h>
-__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 <sys/stat.h>
#include <sys/types.h>
@@ -26,6 +26,7 @@
#include <ctype.h>
#include <dirent.h>
#include <err.h>
+#include <libgen.h>
#include <md5.h>
#include <stdio.h>
#include <stdlib.h>
@@ -291,7 +292,7 @@
{
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 @@
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);
}
Home |
Main Index |
Thread Index |
Old Index