summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-02-27 10:55:16 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-02-27 10:55:16 +0000
commit1b1e02d4acd11f96e061ac04ae243ab0589d2f8a (patch)
treeaacd84e9909dbc35bcd0716bef7ee3f216a0796f
parent3cd681acae540f380510bee14cd2ef802fbf4706 (diff)
downloadmandoc-1b1e02d4acd11f96e061ac04ae243ab0589d2f8a.tar.gz
mandoc-1b1e02d4acd11f96e061ac04ae243ab0589d2f8a.tar.zst
mandoc-1b1e02d4acd11f96e061ac04ae243ab0589d2f8a.zip
Slowly decoupling mdoc(3) from being OpenBSD-only.VERSION_1_3_6
-rw-r--r--action.c4
-rw-r--r--index.sgml23
-rw-r--r--mdocterm.112
-rw-r--r--mdocterm.c34
-rw-r--r--strings.c20
5 files changed, 53 insertions, 40 deletions
diff --git a/action.c b/action.c
index 2934750b..df5b6769 100644
--- a/action.c
+++ b/action.c
@@ -1,4 +1,4 @@
-/* $Id: action.c,v 1.21 2009/02/27 09:39:40 kristaps Exp $ */
+/* $Id: action.c,v 1.22 2009/02/27 10:55:16 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -271,7 +271,7 @@ post_os(struct mdoc *mdoc)
if ( ! xstrlcats(buf, mdoc->last->child, 64))
return(mdoc_err(mdoc, "macro parameters too long"));
- mdoc->meta.os = xstrdup(buf[0] ? buf : "local");
+ mdoc->meta.os = xstrdup(buf[0] ? buf : "LOCAL");
mdoc->lastnamed = SEC_BODY;
return(post_prologue(mdoc));
diff --git a/index.sgml b/index.sgml
index 94325393..1d576e14 100644
--- a/index.sgml
+++ b/index.sgml
@@ -24,11 +24,16 @@
</h1>
<p>
- <span class="nm">mdocml</span> is a suite of tools that compile &#8220;mdoc&#8221;, the roff macro
- package of the BSD manual pages. The mission of <span class="nm">mdocml</span> is to deprecate <a
+ <span class="nm">mdocml</span> is a suite of tools compiling &#8220;mdoc&#8221;, the roff macro
+ package for BSD manual pages. The mission of <span class="nm">mdocml</span> is to deprecate <a
href="http://www.gnu.org/software/groff/" class="external">groff</a>, the GNU roff implementation, for
- displaying BSD mdoc pages. groff amounts to over 60 000 lines of GPL C++ source, which is a
- considerable encumbrance to BSD operating systems.
+ displaying BSD mdoc pages.
+ </p>
+
+ <p>
+ Why? groff amounts to roughly 5,2 MB of source code (OpenBSD 4.2), some of which is C++ and all of
+ which is GPL. It runs slowly, produces uncertain output, and varies in operation from system
+ to system. mdocml strives to fix this (respectively small, C, ISC-licensed, fast and regular).
</p>
<p>
@@ -44,7 +49,7 @@
<ul>
<li><span class="man">mdocterm(1)</span> &#8211; formats mdoc input for display on the terminal
- <li><span class="man">mdochtml(1)</span> &#8211; formats mdoc input as strict HTML (nascent)
+ <li><span class="man">mdochtml(1)</span> &#8211; formats mdoc input as HTML/CSS (nascent)
<li><span class="man">mdoclint(1)</span> &#8211; validates mdoc input
<li><span class="man">mdoctree(1)</span> &#8211; prints input abstract syntax tree
</ul>
@@ -79,11 +84,11 @@
</p>
<h2>
- snapshotted source
+ Snapshot source
</h2>
<p>
- CVS sources are checkedout and snapshotted with big updates. These may be found in the <a
+ CVS sources are checkedout and snapshotted with version updates. These may be found in the <a
href="/snapshots/">/snapshots/</a> directory.
</p>
@@ -97,7 +102,7 @@
</p>
<h2>
- nightly port
+ Snapshot port
</h2>
<p>
@@ -141,7 +146,7 @@
<tr>
<td>
<div class="foot">
- Copyright &#169; 2009 Kristaps D&#382;onsons, $Date: 2009/02/25 12:46:27 $
+ Copyright &#169; 2009 Kristaps D&#382;onsons, $Date: 2009/02/27 10:55:16 $
</div>
</td>
</tr>
diff --git a/mdocterm.1 b/mdocterm.1
index 0782dd42..f350c336 100644
--- a/mdocterm.1
+++ b/mdocterm.1
@@ -1,4 +1,4 @@
-.\" $Id: mdocterm.1,v 1.7 2009/02/27 09:14:02 kristaps Exp $
+.\" $Id: mdocterm.1,v 1.8 2009/02/27 10:55:16 kristaps Exp $
.\"
.\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se>
.\"
@@ -111,8 +111,6 @@ Enclosures:
.Bl -tag -width "OutputXXXX" -offset "XXXX" -compact
.It Em Output
.Em Input (Name)
-.El
-.Bl -tag -width "OutputXXXX" -offset "XXXX" -compact
.It \(rB
\\(rB (right bracket)
.It \(lB
@@ -133,8 +131,6 @@ Indicatives:
.Bl -tag -width "OutputXXXX" -offset "XXXX" -compact
.It Em Output
.Em Input (Name)
-.El
-.Bl -tag -width "OutputXXXX" -offset "XXXX" -compact
.It \(<-
\\(<- (left arrow)
.It \(->
@@ -151,8 +147,6 @@ Mathematical:
.Bl -tag -width "OutputXXXX" -offset "XXXX" -compact
.It Em Output
.Em Input (Name)
-.El
-.Bl -tag -width "OutputXXXX" -offset "XXXX" -compact
.It \(<=
\\(<= (less-than-equal)
.It \(>=
@@ -179,8 +173,6 @@ Diacritics:
.Bl -tag -width "OutputXXXX" -offset "XXXX" -compact
.It Em Output
.Em Input (Name)
-.El
-.Bl -tag -width "OutputXXXX" -offset "XXXX" -compact
.It \(ga
\\(ga (accent grave)
.It \(aa
@@ -193,8 +185,6 @@ Special symbols:
.Bl -tag -width "OutputXXXX" -offset "XXXX" -compact
.It Em Output
.Em Input (Name)
-.El
-.Bl -tag -width "OutputXXXX" -offset "XXXX" -compact
.It \(bu
\\(bu (bullet)
.It \(ba
diff --git a/mdocterm.c b/mdocterm.c
index d7fbc69a..3e2f70f0 100644
--- a/mdocterm.c
+++ b/mdocterm.c
@@ -1,4 +1,4 @@
-/* $Id: mdocterm.c,v 1.17 2009/02/27 09:14:02 kristaps Exp $ */
+/* $Id: mdocterm.c,v 1.18 2009/02/27 10:55:16 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -16,6 +16,8 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
+#include <sys/utsname.h>
+
#include <assert.h>
#include <ctype.h>
#include <err.h>
@@ -674,15 +676,21 @@ footer(struct termp *p, const struct mdoc_meta *meta)
static void
header(struct termp *p, const struct mdoc_meta *meta)
{
- char *buf, *title, *bufp;
+ char *buf, *title, *bufp, *vbuf;
const char *pp;
+ struct utsname uts;
+
+ p->rmargin = p->maxrmargin;
+ p->offset = 0;
if (NULL == (buf = malloc(p->rmargin)))
err(1, "malloc");
if (NULL == (title = malloc(p->rmargin)))
err(1, "malloc");
+ if (NULL == (vbuf = malloc(p->rmargin)))
+ err(1, "malloc");
- if (NULL == (pp = mdoc_vol2a(meta->vol)))
+ if (NULL == (pp = mdoc_vol2a(meta->vol))) {
switch (meta->msec) {
case (MSEC_1):
/* FALLTHROUGH */
@@ -707,11 +715,20 @@ header(struct termp *p, const struct mdoc_meta *meta)
pp = mdoc_vol2a(VOL_KM);
break;
default:
- /* FIXME: capitalise. */
- if (NULL == (pp = mdoc_msec2a(meta->msec)))
- pp = mdoc_msec2a(MSEC_local);
break;
}
+ }
+ vbuf[0] = 0;
+
+ if (pp) {
+ if (-1 == uname(&uts))
+ err(1, "uname");
+ (void)strlcat(vbuf, uts.sysname, p->rmargin);
+ (void)strlcat(vbuf, " ", p->rmargin);
+ } else if (NULL == (pp = mdoc_msec2a(meta->msec)))
+ pp = mdoc_msec2a(MSEC_local);
+
+ (void)strlcat(vbuf, pp, p->rmargin);
/*
* The header is strange. It has three components, which are
@@ -728,9 +745,9 @@ header(struct termp *p, const struct mdoc_meta *meta)
if (mdoc_arch2a(meta->arch))
(void)snprintf(buf, p->rmargin, "%s (%s)",
- pp, mdoc_arch2a(meta->arch));
+ vbuf, mdoc_arch2a(meta->arch));
else
- (void)strlcpy(buf, pp, p->rmargin);
+ (void)strlcpy(buf, vbuf, p->rmargin);
pp = mdoc_msec2a(meta->msec);
@@ -767,5 +784,6 @@ header(struct termp *p, const struct mdoc_meta *meta)
p->flags &= ~TERMP_NOSPACE;
free(title);
+ free(vbuf);
free(buf);
}
diff --git a/strings.c b/strings.c
index 87a9b35e..896971a9 100644
--- a/strings.c
+++ b/strings.c
@@ -1,4 +1,4 @@
-/* $Id: strings.c,v 1.21 2009/02/27 08:20:15 kristaps Exp $ */
+/* $Id: strings.c,v 1.22 2009/02/27 10:55:16 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -472,23 +472,23 @@ mdoc_vol2a(enum mdoc_vol vol)
switch (vol) {
case (VOL_AMD):
- return("OpenBSD Ancestral Manual Documents");
+ return("Ancestral Manual Documents");
case (VOL_IND):
- return("OpenBSD Manual Master Index");
+ return("Manual Master Index");
case (VOL_KM):
- return("OpenBSD Kernel Manual");
+ return("Kernel Manual");
case (VOL_LOCAL):
- return("OpenBSD Local Manual");
+ return("Local Manual");
case (VOL_PRM):
- return("OpenBSD Programmer's Manual");
+ return("Programmer's Manual");
case (VOL_PS1):
- return("OpenBSD Programmer's Supplementary Documents");
+ return("Programmer's Supplementary Documents");
case (VOL_SMM):
- return("OpenBSD System Manager's Manual");
+ return("System Manager's Manual");
case (VOL_URM):
- return("OpenBSD Reference Manual");
+ return("Reference Manual");
case (VOL_USD):
- return("OpenBSD User's Supplementary Documents");
+ return("User's Supplementary Documents");
case (VOL_DEFAULT):
return(NULL);
default: