Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/share/tmac



On Mon, Dec 23, 2019 at 22:13:23 +0100, Steffen Nurpmeso wrote:

> Valeriy E. Ushakov wrote in <20191223201734.0E415FA98%cvs.NetBSD.org@localhost>:
>
>  |Modified Files:
>  | src/share/tmac: doc2html
>  |
>  |Log Message:
>  |Fix if/else syntax in previous.
> 
> What was wrong with that?
> 
> .   ie 'utf8'\*[.T]' \
> .     ds mx:istty
> .   el .ie 'latin1'\*[.T]' \
> .     ds mx:istty
> .   el .ie 'ascii'\*[.T]' \
> .     ds mx:istty
> .   el .ie 'pdf'\*[.T]' \
> .     mx:dump-init-pdf
> .   el .ie 'html'\*[.T]' \
> .     mx:dump-init-html
> .   el \
> .     rm mx:gogogo
> 
> is perfectly valid roff code.

Try running it with warnings (-ww), as the build process does.  You'll
get

    warning: unbalanced .el request

Consider

  .ie     '\*(.T'ascii'  .ds html-charset US-ASCII
  .el .ie '\*(.T'latin1' .ds html-charset ISO-8859-1
  .el .ie '\*(.T'utf8'   .ds html-charset UTF-8
  .el .ab unsupported encoding \*(.T

executed with -Tascii.

Troff reads .ie and checks the condition.  The condition is true and
so the rest of the line is executed.  Then troff reads .el that
matches successful .ie, so the .el is discarded.

Then it reads .el which is not matched with any .ie that troff has
seen.  It's usually silently discarded, but since we run with -ww we
get the warning about an unbalanced .el

The the same happens again for the next .el, the number of warnings
depends on which .ie in the chain was successful (no warnings for
utf-8, 1 warning for latin1, two for ascii).

-uwe


Home | Main Index | Thread Index | Old Index