_print/_doprnt; curses on sys III

Toby Harness toby at gargoyle.UChicago.UUCP
Tue Jun 19 08:34:47 AEST 1984


Geoff Collyer:
> 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.

I agree, avoiding INTERNALS (gee, what is that name supposed to imply?)
like "_print or whatever" is a good thing, and I use sprintf whenever I
need to print to a buffer.  In fact, until I started poking through some
of the unix source, it never occurred to me to make direct calls to
_doprnt/_print (somehow I got it into my head that that was a no-no). 
But there is a difference between writting a program and maintaining it,
especially when it is not your code to begin with.

> Some people may think that deliberately changing the names hurts
> portability; on the contrary, demonstrating that broken programs really
> are broken is a favour to their authors.  The authors can fix their
> programs before they reach a wider audience and are a greater
> embarrassment than they are today.

Embarrassment? yes.  My opinion of Ken Arnold (for what it`s worth) went 
down a notch when I uncovered that crud in _sprintw.  But I doubt that
"deliberately changing the names ... is a favour (sic) to their authors".

Dave Sherman:
> 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.)


Dennis Ritchie (_The Standard I/O Library_):
	The standard I/O library was designed with the following goals
	in mind....

	2.  It must be simple to use, and also free of the magic numbers
	and mysterious calls whose use mars the understandability and 
	portability of many programs using older packages.

	3.  The interface provided should be applicable on all machines,
	whether or not the programs which implement it are directly portable
	to other systems, or to machines other than the PDP-11 running a
	version of UNIX.



Toby Harness		Ogburn/Stouffer Center, University of Chicago
			...inhp4!gargoyle!toby



More information about the Comp.unix.wizards mailing list