"tabs" and "tput" assume TERM is set
Guy Harris
guy at sun.uucp
Wed Jul 31 11:17:23 AEST 1985
> In article <2484 at sun.uucp> guy at sun.uucp (Guy Harris) writes:
> >Both of them assume, at some point, that getenv("TERM") will never return a
> >NULL. Regardless of whether the S5 Interface Definition says it'll always
> >be set or not, it's really dumb to assume it'll never happen... (Also,
> >"tput" didn't declare "getenv".)
>
> Actually, both of these programs pass that work on to setupterm() to notice
> that getenv() may have returned a NULL. Setupterm() then handles it
> gracefully.
By handing an error code back to "tput", instead of printing a message.
"Tput" then proceeds to print an error message using "getenv" *WITHOUT*
checking for "getenv" being null. It should do this check if for no other
reason than to give a meaningful error message:
No such terminal: unknown
(as "setupterm" would print if no error return were specified) or
tput: unknown terminal "unknown"
just won't do;
TERM not specified in environment
or some translation of that into a human language is required (so the user
knows *why* the program is complaining and can correct the problem
immediately, instead of having to call in a guru and engaging in a 5-minute
dialogue the result of which is that the guru, rather annoyed by getting
dragged in on a trivial matter like this, finally figures out that the guy
didn't set TERM - or that the system can't do it for them). Since it has to
call "getenv" anyway (unless a "-T" flag was specified), it might as well
pass the result on to "setupterm" and save it the trouble.
Guy Harris
More information about the Net.bugs.usg
mailing list