[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Groff] Disabling SGR in grotty(1): gory details
From: |
Ruslan Ermilov |
Subject: |
[Groff] Disabling SGR in grotty(1): gory details |
Date: |
Wed, 23 Oct 2002 20:35:21 +0300 |
User-agent: |
Mutt/1.3.99i |
After a long discussion it was decided (on the architectural
FreeBSD mailing list address@hidden) that we should
disable SGR encoded output from grotty(1) until modern filters
like less(1) and classical filters like colcrt(1) and ul(1)
will be modified to translate ANSI SGR escape sequences to
the terminal's native, similar to what they do now for old
\b sequences.
So I needed to disable SGR in grotty(1). Using GROFF_NO_SGR
was not an option for a number of reasons, so I put the
following at the very end of troffrc:
.if n .do nop \X'tty: sgr 0'\c
This seemed to work at a glance, but later I discovered the
new .output command, and modified this as follows (the new
version produced less noise for ``troff -Tascii /dev/null''):
.if n .do output "x X tty: sgr 0
This seemed to work too, but after a further inspection it
turned out it did not -- it broke horribly with everything
formatted with the -ms package -- try it with this small
chunk of -ms formatted text:
.TL
Title
.AU
Author
.PP
$ groff -b -Tascii -mtty-char -ms <this_chunk>
/usr/share/tmac/s.tmac:1095: backtrace: macro address@hidden'
/usr/share/tmac/s.tmac:172: backtrace: macro `TL'
x:1: warning: number register `0:LL' not defined
/usr/share/tmac/s.tmac:1095: backtrace: macro address@hidden'
/usr/share/tmac/s.tmac:172: backtrace: macro `TL'
x:1: warning: number register `0:ri' not defined
/usr/share/tmac/s.tmac:1095: backtrace: macro address@hidden'
/usr/share/tmac/s.tmac:172: backtrace: macro `TL'
x:1: warning: number register `0:pri' not defined
...
Then I remembered seeing this in the Groff info document:
: This request can't be used before the first page has started - if
: you get an error, simply insert `.br' before the `output' request.
I wondered why I do not get any meaningful error as was promised.
Then I moved the .output version of SGR disabling stuff to
troffrc-end, and it quickly started failing with:
/usr/share/tmac/s.tmac:134: backtrace: trap-invoked macro `cov*first-page-init'
/usr/share/tmac/troffrc-end:21: fatal error: sorry, I didn't manage to begin
the first page in time: use an explicit .br request
I then reverted to using the .nop version in troffrc-end, and it
worked. Moreover, the mysterious
grotty:<standard input>:5: character above first line discarded
warning when SGR was on has gone too.
So I have a bunch of questions here, in the order of importancy:
1. How do I disable the SGR output from troffrc or troffrc-end?
2. Why don't I get the same error from using .output in troffrc
as if I put it in troffrc-end?
3. Why am I getting these spurious ``character above first line
discarded'' warnings from all -ms formatted texts when SGR
encoded output is enabled?
I would appreciate a quick response.
Cheers,
--
Ruslan Ermilov Sysadmin and DBA,
address@hidden Sunbay Software AG,
address@hidden FreeBSD committer,
+380.652.512.251 Simferopol, Ukraine
http://www.FreeBSD.org The Power To Serve
http://www.oracle.com Enabling The Information Age
- [Groff] Disabling SGR in grotty(1): gory details,
Ruslan Ermilov <=
- [Groff] Re: Disabling SGR in grotty(1): gory details, Werner LEMBERG, 2002/10/23
- [Groff] Re: Disabling SGR in grotty(1): gory details, Ruslan Ermilov, 2002/10/24
- [Groff] Re: Disabling SGR in grotty(1): gory details, Werner LEMBERG, 2002/10/24
- [Groff] Re: Disabling SGR in grotty(1): gory details, Ruslan Ermilov, 2002/10/25
- [Groff] Re: Disabling SGR in grotty(1): gory details, Werner LEMBERG, 2002/10/25
- [Groff] Re: Disabling SGR in grotty(1): gory details, Werner LEMBERG, 2002/10/26
- Re: [Groff] Re: Disabling SGR in grotty(1): gory details, Jon Snader, 2002/10/26
- Re: [Groff] Re: Disabling SGR in grotty(1): gory details, Werner LEMBERG, 2002/10/26
- Re: [Groff] Re: Disabling SGR in grotty(1): gory details, Jon Snader, 2002/10/26
- Re: [Groff] Re: Disabling SGR in grotty(1): gory details, Ralph Corderoy, 2002/10/27