Mail Archives: djgpp-workers/2001/02/19/08:36:53
On Sun, 18 Feb 2001, Eli Zaretskii wrote:
> > Date: Sun, 18 Feb 2001 11:15:53 -0600
> > From: JT Williams <jeffw AT darwin DOT sfbr DOT org>
> >
> > -: I'd argue that, once printed text is anything beyond simple ASCII text, a
> > -: text-mode application such as Grep should use specialized functions to
> > -: print the text with whatever markup it wants.
> >
> > are you saying that individual programs
> > (e.g., `grep') should know how to handle screen-specific stuff like colors?
>
> They should know that screen-specific stuff requires screen-specific
> functions. Magic escape sequences printed via fprintf are
> non-portable to any system whose terminal driver doesn't include ANSI
> support.
Exactly. That's why Unixists invented termcap, in the first place ---
ANSI standard escape sequences are a good idea, but obviously that
standard came too late to be fully effective, so lots of terminals the
serial terminals that were actually used (some may still be) had ever
so slightly different codes.
I.e. instead of individual programs having to know all the fine details,
they just have to know and accept the guidance provided by the 'termcap'
or 'terminfo' database and associated library (curses).
> > Isn't this sort of thing properly handled by termio/termcap/whatever?
In principle: yes. But we don't have a working termcap library for DJGPP.
Well, actually waaay back in DJGPP 1.09 times, I made one as part of the
initial port of 'info', but that relied on ANSI.SYS, too. For
screen-oriented programs, there'd be PDCurses on DJGPP, but for
stream-based markup like we need it here, I think we really need termcap.
> It is. But please note that even termcap requires that you call
> specialized functions, such as tgetent, tputs, etc.
Exactly. So 'grep' should do that anyway, instead of assuming the terminal
is ANSI-compatible and color-capable. I.e. it already may have to be
considered broken or at least badly implemented on Unix, too, not just for
the purpose of the DJGPP port.
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -