[CC updated]

Hi folks,

This thread started on the groff@gnu list, so I'm looping it back in.

https://lists.gnu.org/archive/html/groff/2025-02/msg00088.html
https://lists.gnu.org/archive/html/groff/2025-03/msg00070.html

The formatter, GNU troff:

* catenates its input into a single stream, disregarding any file
  "boundaries" except the first and the last;
* does not generally require the input to end with a newline;
* throws a warning diagnostic if the input ends with the *roff escape
  character (and ignores that character);
* warns about and discards NUL characters from the input (along with
  several others that are invalid as input);
* always terminates its _output_ files (whether in Kernighan's "trout"
  format [originally seen in CSTR #97], or "approximate" [`troff -a`]
  format) with newlines (ASCII LF);
* and writes only printable ASCII characters and the space in
  "trout"/"grout" or approximate outputs, with one esoteric
  exception.[1]

I'd like to know what, specifically, this program should be doing
differently.

Regards,
Branden

[1] The `cf` request permits the copying of abritrary bytes from the
    input file named by it to "grout" output.  In the forthcoming
    _groff_ 1.24.0, the formatter handles this request only in the
    non-default "unsafe mode" enabled by the `-U` command-line option.

Quoting groff's Texinfo manual:

 -- Request: .trf ["]file
 -- Request: .cf ["]file
     Copy FILE as "throughput" to GNU 'troff' output.  Each line of FILE
     is output as if preceded by '\!', but is not interpreted by the
     formatter.  If FILE does not end with a newline, 'trf' appends one.
     Both requests break the line before reading FILE, unless invoked
     with the no-break control character.

     When used in a diversion, these requests embed a node (*note Gtroff
     Internals::) in it that, when interpolated, causes the contents of
     FILE to be copied to the output.  In AT&T 'troff', 'cf' does so
     even if a diversion is in use; this behavior is so anomalous that
     it must be considered a bug.

     'cf' copies the contents of FILE completely unprocessed; it is
     therefore an error to use this request in safer mode, which is the
     default.  Invoke GNU 'troff' or a front end with the '-U' option to
     enable unsafe mode.

     'trf' discards invalid input characters; recall *note
     Identifiers::.

     For 'cf', within a diversion, "completely unprocessed" means that
     each line of a file to be inserted is handled as if it were
     preceded by '\!\\!'.

     *Caution:* Use of these requests can put syntactically invalid
     content into the formatter's output, which 'groff''s output drivers
     then fail to process.  One application is to pass instructions to a
     postprocessor that interprets FILE's contents and filters it out
     before sending it to the output device.

Attachment: signature.asc
Description: PGP signature

Reply via email to