_print/_doprnt; curses on sys III

Dave Sherman dave at utcsrgv.UUCP
Mon Jun 18 00:01:50 AEST 1984


In article <1973 at utcsstat.UUCP> geoff at utcsstat.UUCP (Geoff Collyer) writes:
~| Any program that calls _doprnt (or _print or whatever) directly is
~| *broken*.  The internals of a given stdio implementation are the
~| business of no one but its author(s) and maintainer(s).  If you think
~| you need to call _doprnt or whatever, try sprintf'ing into a buffer and
~| passing the buffer.
~| 
Geoff, you would be correct to call such programs "non-portable".
I think "broken" is going a little too far. I have some implementations
which "work" just fine.

sprintf'ing into a buffer isn't always the answer. For one, it
requires two or more lines of code for what is conceptually one
action. Secondly, it may not work for the particular need. In
my code which interposes termcap interpretation at the output
level, for example, "putc" is redefined. For this to work, _strout
(called by _doprnt which is called by printf) has to be recompiled
with "putc" #undef'ed from being a macro.

Sure it's non-portable, when I next hit a system which uses some
other stdio. When the time comes I'll make whatever trivial changes
are needed to make it run on such a system. So far I've ported it
from PDP-11 (v7) to a Perkin-Elmer 3220 and an IBM-PC running
Venix/86, and it runs like a charm. So don't tell me it's "broken".

(If you persist, I will define my programs as "written for v7 UNIX"
rather than "written for UNIX". So there.)

Dave Sherman
Toronto
-- 
 {allegra,cornell,decvax,ihnp4,linus,utzoo}!utcsrgv!dave



More information about the Comp.unix.wizards mailing list