diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-02-27 10:55:16 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-02-27 10:55:16 +0000 |
commit | 69daad351ec2ab2069748a5a0139dae5f65642aa (patch) | |
tree | edcb375f2efa22c6b45d526b4e34453dd6fb03fc | |
parent | 79f971e5f7cb6c69d1b2ed2d38a5bccd604a24f5 (diff) | |
download | mandoc-69daad351ec2ab2069748a5a0139dae5f65642aa.tar.gz |
Slowly decoupling mdoc(3) from being OpenBSD-only.VERSION.1.3.6
-rw-r--r-- | action.c | 2 | ||||
-rw-r--r-- | index.sgml | 21 | ||||
-rw-r--r-- | mdocterm.1 | 10 | ||||
-rw-r--r-- | mdocterm.c | 32 | ||||
-rw-r--r-- | strings.c | 18 |
5 files changed, 48 insertions, 35 deletions
@@ -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)); @@ -24,11 +24,16 @@ </h1> <p> - <span class="nm">mdocml</span> is a suite of tools that compile “mdoc”, 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 “mdoc”, 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> – formats mdoc input for display on the terminal - <li><span class="man">mdochtml(1)</span> – formats mdoc input as strict HTML (nascent) + <li><span class="man">mdochtml(1)</span> – formats mdoc input as HTML/CSS (nascent) <li><span class="man">mdoclint(1)</span> – validates mdoc input <li><span class="man">mdoctree(1)</span> – 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> @@ -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 @@ -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); } @@ -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: |