On Mon, Feb 18, 2008 at 02:35:01PM +0100, Pieter Verberne wrote:
> Why is Groff not updated? OpenBSD 4.2 has Groff 1.15 from 1999.
> Some compatability issues?

I've been thinking this too, and went ahead and tried doing it...
It's a bit of a pain actually, some problems: the directory layout
has changed, and as there are some patches in the current OpenBSD version,
one should track how those map into new files.  New Groff (1.19.2)
enforces ``-R'' option for more/less for manpage viewing, that breaks
makewhatis, NetBSD tree has a fix (for Groff) for that.  I tried building
release(8) with it, got some errors on mdoc-macros, as I tried using
the current mdoc-macros in OpenBSD.  In short: it's not a trivial update,
brings new code into the tree (with unsafe string functions, should be
audited), and it's more GPL which some may find offensive.

As there's only two things that I want from new Groff, I figured taking
another route.  One thing is a missing euro-symbol (which would be nice),
and the other issue is fixed with the following patch (haven't tested this
extensively, but seems okay and I'm building release(8) with it right now).

----------------------------------------------------------------------

This modifies default manpage handling: one long page for ttys,
instead of with page breaks sprinkled.  Default for nroff.
Code basically backported from groff 1.19.2.

        cd /usr/src && patch < /path/to/groff_nomanpage_breaks.patch
        cd gnu/usr.bin/groff
        make -f Makefile.bsd-wrapper obj
        make -f Makefile.bsd-wrapper
        make -f Makefile.bsd-wrapper install


Index: gnu/usr.bin/groff/tmac/tmac.an
===================================================================
RCS file: /cvs/src/gnu/usr.bin/groff/tmac/tmac.an,v
retrieving revision 1.1.1.2
diff -u -p -r1.1.1.2 tmac.an
--- gnu/usr.bin/groff/tmac/tmac.an      9 Apr 2000 07:58:30 -0000       1.1.1.2
+++ gnu/usr.bin/groff/tmac/tmac.an      18 Feb 2008 12:17:18 -0000
@@ -17,6 +17,9 @@
 .\"with groff; see the file COPYING.  If not, write to the Free Software
 .\"Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 .\"
+.\" -rcR=1 => Create a single, very long page instead of multiple pages.
+.\"           Useful for online display.  Default in nroff mode.
+.\"           Deactivate with -rcR=0.
 .\" -rC1 => number pages continuously, rather than start each at 1
 .\" -rD1 => double-sided printing, ie different odd and even page footers
 .\" -rPnnn => number first page nnn
@@ -31,6 +34,36 @@
 .if !rD .nr D 0
 .if !rC .nr C 0
 .if rP .pn 0\nP
+.if !r cR \{\
+.  ie n .nr cR 1
+.  el   .nr cR 0
+.\}
+.
+.nr an-first 1
+.
+.\" we redefine .ne to avoid page breaks if cR is set; instead, the page
+.\" length is increased to the necessary amount (this is needed for tables)
+.\"
+.\" similarly, we redefine .bp if cR is set, adjusting the page length to
+.\" the current position so that no empty lines are inserted
+.if \n[cR] \{\
+.de ne
+.  ie \\n[.$] \
+.    nr an-ne (v;\\$*)
+.  el \
+.    nr an-ne 1v
+.  if (\\n[an-ne] >= \\n[.t]) \
+.    pl +(\\n[an-ne]u - \\n[.t]u + 1v)
+..
+.
+.rn bp an-bp
+.de bp
+.  br
+.  pl \\n[nl]u
+.  an-bp \\$*
+..
+.\}
+.
 .de set-an-margin
 .  ie '\*(.T'html' \{\
 .    nr an-margin 0i
@@ -70,12 +103,17 @@
 .nr an-no-space-flag 0
 .nr an-break-flag 0
 .nr an-div? 0
-.wh 0 an-header
-.wh -1i an-footer
-.wh -.5i an-p-footer
-.if \\n[nl]>0 \{\
-.      ie \\nC .bp \\n%+1
-.      el .bp 1
+.
+.ie \\n[cR] \
+.  an-header
+.el \{\
+.  wh 0 an-header
+.  wh -1i an-footer
+.  wh -.5i an-p-footer
+.  if \\n[nl]>0 \{\
+.    ie \\nC .bp \\n%+1
+.    el .bp 1
+.  \}
 .\}
 ..
 .de DT
@@ -85,16 +123,37 @@
 .ie \\n[.$] .nr PD (v;\\$1)
 .el .nr PD .4v>?\n[.V]
 ..
+.de PT
+.  tl 
'\\*[an-title](\\*[an-section])'\\*[an-extra3]'\\*[an-title](\\*[an-section])'
+..
+.de BT
+.  ie \\n[D] \{\
+.    if o .tl '\\*[an-extra2]'\\*[an-extra1]'\\*[an-page-string]'
+.    if e .tl '\\*[an-page-string]'\\*[an-extra1]'\\*[an-extra2]'
+.  \}
+.  el \
+.    tl '\\*[an-extra2]'\\*[an-extra1]'\\*[an-page-string]'
+..
 .de an-header
 .an-init
-.ev 1
-.ie '\*(.T'html' \{\
-.   tl ''''
+.if \\n[cR] \{\
+.  ie \\n[an-first] \
+.    nr an-first 0
+.  el \
+.    sp .5i
 .\}
+.ev 1
+.ps \\n[PS]
+.ie '\*(.T'html' \
+.  tl ''''
 .el \{\
-.   sp .5i
-.   tl 
'\\*[an-title](\\*[an-section])'\\*[an-extra3]'\\*[an-title](\\*[an-section])'
-.   sp |1i
+.  if !\\n[cR] \
+.    sp .5i
+.  PT
+.  ie !\\n[cR] \
+.    sp |1i
+.  el \
+.    sp .5i
 .\}
 .ev
 .ns
@@ -105,27 +164,42 @@
 .af an-page-letter a
 .de an-p-footer
 .ev 1
+.ps \\n[PS]
 .ie '\*(.T'html' \{\
 .   ds an-page-string "
 .   ds an-extra1      "
 .   ds an-extra2      "
 .\}
-.el .ds an-page-string \\n%
-.if rX \{\
-.      if \\n%>\\nX \{\
-.              nr an-page-letter \\n%-\\nX
-.              ds an-page-string \\nX\\n[an-page-letter]
-.\}\}
-.ie \\nD \{\
-.      if o .tl '\\*[an-extra2]'\\*[an-extra1]'\\*[an-page-string]'
-.      if e .tl '\\*[an-page-string]'\\*[an-extra1]'\\*[an-extra2]'
+.el \{\
+.  ie r X \{\
+.    if (\\n[%] > \\n[X]) \{\
+.      nr an-page-letter (\\n[%] - \\n[X])
+.      ds an-page-string \\n[X]\\n[an-page-letter]
+.    \}
+.  \}
+.  el \{\
+.    ie \\n[cR] \
+.      ds an-page-string "\\*[an-title](\\*[an-section])
+.    el \
+.      ds an-page-string \\n[%]
+.  \}
 .\}
-.el .tl '\\*[an-extra2]'\\*[an-extra1]'\\*[an-page-string]'
+.BT
 .if '\*(.T'html' \{\
 .      tl ''''
 .\}
 .ev
 ..
+.de an-end
+.  nr % 1
+.  pl +4v
+.  fl
+.  sp 3
+.  an-p-footer
+.  pl \\n[nl]u
+..
+.if \n[cR] .em an-end
+.
 .de SH
 .sp \\n[PD]u
 .nr an-level 1

Reply via email to