Subject: Re: How to translate this stdio code to netbsd?
To: None <current-users@NetBSD.ORG>
From: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>
Date: 03/12/1996 13:21:57
> It is axiomatic that no code which uses stdio internals *really*
> needs to except the library...
Only to the extent that all of stdio can be reimplemented in user code.
While you can certainly do your own buffering and such, reimplementing
complicated pieces of stdio like printf is a mess.
> Perhaps we should offer a defined interface to those internals, so we
> can change the internals without losing code that tries to depend on
> them... :)
As far as I can recall, all the code I've seen which tries to get under
the hood of stdio could be satisifed with a single call: a call which,
when applied to a readable FILE pointer, returns the number of bytes
currently buffered, that is, the number of bytes readable before stdio
tries to make a read() call.
At least until this last thing, when I saw the poster who started this
off send something indicating that the code was just too lazy to buffer
input to provide context, instead peeking into the stdio buffer for the
purpose. That particular bit of code I have little pity for.