an inquiry about 4.2 stdio.h

Guy Harris guy at sun.uucp
Wed Jun 26 19:12:57 AEST 1985


> 	In stdio.h on 4.2BSD, this line appears
> 
> #define	_IOSTRG	0100
> 
> 	This isn't in (at least I havn't been able to find it) in either
> 2.9BSD or sysV.
> 
> 	Can someone please tell me what effect _IOSTRG has so that I
> can (attempt) to emulate it?

It tells the standard I/O library that what it thinks is a stream is really
a fake stream set up temporarily by "sprintf" or "sscanf".  The fake
stream's "buffer" is the string being scanned or printed into.  "IOSTRG"
tells it not to do something dumb with that stream, like trying to do real
live I/O into or from the buffer.

There's no need to simulate it.  The only semi-valid reason why *anybody*
should be using that flag is if they're duplicating the code in "sprintf" or
"sscanf".  Your best bet is to rewrite the code so it doesn't use
undocumented internal interfaces to standard I/O which are 1) not guaranteed
to be the same in all implementations of the standard I/O library and 2) not
even guaranteed to stay the same in different releases of the same
implementation.  Barring that, if you really must sneak in through the back
door you should rip off the code from the 2.9BSD/SysV standard I/O library
and use it (if you don't have the source, do some disassembly; if you can't
do that, reconsider whether you shouldn't just rewrite it not to use the
back door).

	Guy Harris



More information about the Comp.unix mailing list