Follow-up Comment #5, bug #68668 (group groff):

It occurs to me that one could write a postprocessor to censor or rewrite
undesired device extension commands.

I'll illustrate how simple that can be.

First, let's see what GNU _troff_ loads up the _neqn_(1) man page with when
formatting for a terminal.


$ nroff -man -Z ./build/src/preproc/eqn/neqn.1 | grep 'x X'
x X devtag:.NH 1
x X devtag:.eo.h
x X devtag:.NH 1
x X devtag:.eo.h
x X devtag:.NH 1
x X devtag:.eo.h
x X tty: link man:eqn(1)
x X tty: link
x X devtag:.NH 1
x X devtag:.eo.h
x X devtag:.NH 1
x X devtag:.eo.h
x X tty: link man:eqn(1)
x X tty: link


Now let's get a dump of the rendered contents...


$ nroff -man -Z ./build/src/preproc/eqn/neqn.1 | grotty -i | cat -v >|
UNSTRIPPED


Apply our highly complex postprocessor...


$ nroff -man -Z ./build/src/preproc/eqn/neqn.1 | grep -v '^x X' | grotty -i |
cat -v >| STRIPPED


...and observe the difference.


$ diff -U0 UNSTRIPPED STRIPPED 
--- UNSTRIPPED  2026-10-13 17:31:36.254888488 -0500
+++ STRIPPED    2026-10-13 17:31:42.430876492 -0500
@@ -10 +10 @@
-     ^[[3mneqn^[[23m invokes the
^[]8;;man:eqn(1)^[\^[[3meqn^[[23m(1)^[]8;;^[\ command with the ^[[1mascii
^[[22moutput device.
+     ^[[3mneqn^[[23m invokes the ^[[3meqn^[[23m(1) command with the
^[[1mascii ^[[22moutput device.
@@ -26 +26 @@
-     ^[]8;;man:eqn(1)^[\^[[3meqn^[[23m(1)^[]8;;^[\
+     ^[[3meqn^[[23m(1)


Danger averted!


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?68668>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature

Reply via email to