summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2011-12-02 01:45:44 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2011-12-02 01:45:44 +0000
commit99cf7c797514031db717ef8a5979400c9d25ffa3 (patch)
tree42f34de13e212b973ef7456d03f93beb99177471 /usr.bin
parentfcc9b4c4e292b712411220c52dbfd514453e0927 (diff)
In man(7), when no explicit volume name is given, use the default
volume name for the respective manual section, just like in mdoc(7). This gives us nicer page headers for cvs(1), lynx(1), tic(1), mkhybrid(8), and many curses(3) manuals. ok kristaps@ To not break compatibility, i wrote a corresponding patch for GNU troff which Werner Lemberg accepted upstream at rev. 1.65 of: http://cvs.savannah.gnu.org/viewvc/groff/tmac/an-old.tmac?root=groff
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/mandoc/libmandoc.h3
-rw-r--r--usr.bin/mandoc/libmdoc.h3
-rw-r--r--usr.bin/mandoc/man_validate.c6
-rw-r--r--usr.bin/mandoc/mdoc_validate.c4
-rw-r--r--usr.bin/mandoc/msec.c7
5 files changed, 13 insertions, 10 deletions
diff --git a/usr.bin/mandoc/libmandoc.h b/usr.bin/mandoc/libmandoc.h
index aca7c573b93..7adf160c34b 100644
--- a/usr.bin/mandoc/libmandoc.h
+++ b/usr.bin/mandoc/libmandoc.h
@@ -1,4 +1,4 @@
-/* $Id: libmandoc.h,v 1.15 2011/09/18 15:54:48 schwarze Exp $ */
+/* $Id: libmandoc.h,v 1.16 2011/12/02 01:45:43 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -49,6 +49,7 @@ char *mandoc_normdate(struct mparse *, char *, int, int);
int mandoc_eos(const char *, size_t, int);
int mandoc_getcontrol(const char *, int *);
int mandoc_strntoi(const char *, size_t, int);
+const char *mandoc_a2msec(const char*);
void mdoc_free(struct mdoc *);
struct mdoc *mdoc_alloc(struct roff *, struct mparse *);
diff --git a/usr.bin/mandoc/libmdoc.h b/usr.bin/mandoc/libmdoc.h
index 1bdc1ab4ccf..81bebbfbfe0 100644
--- a/usr.bin/mandoc/libmdoc.h
+++ b/usr.bin/mandoc/libmdoc.h
@@ -1,4 +1,4 @@
-/* $Id: libmdoc.h,v 1.47 2011/09/18 10:25:28 schwarze Exp $ */
+/* $Id: libmdoc.h,v 1.48 2011/12/02 01:45:43 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -124,7 +124,6 @@ const char *mdoc_a2lib(const char *);
const char *mdoc_a2st(const char *);
const char *mdoc_a2arch(const char *);
const char *mdoc_a2vol(const char *);
-const char *mdoc_a2msec(const char *);
int mdoc_valid_pre(struct mdoc *, struct mdoc_node *);
int mdoc_valid_post(struct mdoc *);
enum margverr mdoc_argv(struct mdoc *, int, enum mdoct,
diff --git a/usr.bin/mandoc/man_validate.c b/usr.bin/mandoc/man_validate.c
index dcdb5e8cc8a..136e9cf110c 100644
--- a/usr.bin/mandoc/man_validate.c
+++ b/usr.bin/mandoc/man_validate.c
@@ -1,4 +1,4 @@
-/* $Id: man_validate.c,v 1.50 2011/11/05 16:02:18 schwarze Exp $ */
+/* $Id: man_validate.c,v 1.51 2011/12/02 01:45:43 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
@@ -409,9 +409,13 @@ post_TH(CHKARGS)
m->meta.source = mandoc_strdup(n->string);
/* TITLE MSEC DATE SOURCE ->VOL<- */
+ /* If missing, use the default VOL name for MSEC. */
if (n && (n = n->next))
m->meta.vol = mandoc_strdup(n->string);
+ else if ('\0' != m->meta.msec[0] &&
+ (NULL != (p = mandoc_a2msec(m->meta.msec))))
+ m->meta.vol = mandoc_strdup(p);
/*
* Remove the `TH' node after we've processed it for our
diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c
index f3e3479a329..236c15271fc 100644
--- a/usr.bin/mandoc/mdoc_validate.c
+++ b/usr.bin/mandoc/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_validate.c,v 1.98 2011/11/19 13:17:44 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.99 2011/12/02 01:45:43 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -2085,7 +2085,7 @@ post_dt(POST_ARGS)
* arch = NULL
*/
- cp = mdoc_a2msec(nn->string);
+ cp = mandoc_a2msec(nn->string);
if (cp) {
mdoc->meta.vol = mandoc_strdup(cp);
mdoc->meta.msec = mandoc_strdup(nn->string);
diff --git a/usr.bin/mandoc/msec.c b/usr.bin/mandoc/msec.c
index e5bbcf0b265..5fc778e9b0f 100644
--- a/usr.bin/mandoc/msec.c
+++ b/usr.bin/mandoc/msec.c
@@ -1,4 +1,4 @@
-/* $Id: msec.c,v 1.6 2011/04/24 16:22:02 schwarze Exp $ */
+/* $Id: msec.c,v 1.7 2011/12/02 01:45:43 schwarze Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -17,15 +17,14 @@
#include <stdlib.h>
#include <string.h>
-#include "mdoc.h"
#include "mandoc.h"
-#include "libmdoc.h"
+#include "libmandoc.h"
#define LINE(x, y) \
if (0 == strcmp(p, x)) return(y);
const char *
-mdoc_a2msec(const char *p)
+mandoc_a2msec(const char *p)
{
#include "msec.in"