Mail Archives: djgpp-workers/1999/07/14/10:18:43
On Wed, 14 Jul 1999, Michel de Ruiter wrote:
> > I
> > wrote all that docs in the hope that my experience will be useful to
> > someone, some day...
>
> I understand, but somehow it wasn't :-)
Well, if after this discussion you think something in the docs needs to
be done to make it more clear, please tell me.
> Now I see my problem was in using `getchar' or `getc' instead of
> `getch' or `read'. I didn't realize/know the former were buffered
> where the latter are not.
There are two levels of ``buffering'' involved. One is part of the
buffered stdio functions, those which use FILE objects; the other is
inside DOS. The former doesn't care about binary/text and raw/cooked
mode differences; the latter does.
> So the use of *buffered* input functions is useless with a tty in
> binary mode...
``Useless'' is too extreme. It is true that if you want to read tty
character by character, naive use of buffered input functions won't do
what you want, while `read' will. However, please note that if you call
any of the termios functions, e.g. by requesting raw input mode with a
call to tcsetattr, then the termios machinery will hook stdio functions
and even getc will then read character by character.
> You (Eli) also wrote:
> > > All problems disappeared when I set stdin to _IONBF (not buffered)
> > I'm worried about the possible implications of turning off the
> > buffering just because somebody reads in binary mode. Can anybody
> > think of any downside to this change? If not, let's do it.
>
> I now understand this is not worth the hassle? Or should it only wait
> for 2.04?
I'm still worried ;-). And since termios is the right (and portable)
solution anyway, and will Do The Right Thing in v2.03, I'm not sure we
need to disable buffering in binary mode at all.
> > What's scheck.c? I don't think I ever saw that file.
>
> The file `zoneinfo/src/scheck.c'
Oh, yeah. The zoneinfo sources aren't anywhere as clean as libc ones, we
only use them to produce the zoneinfo files. They do emit a few
warnings.
- Raw text -