sebuf on stdin was called if any std stream was a tty. Bad. (obs from Ashwin Srinivasan).

This commit is contained in:
Vítor Manuel de Morais Santos Costa 2009-11-10 11:25:56 +00:00
parent b5ad71c9c1
commit 8ecac6c2f9
1 changed files with 6 additions and 3 deletions

View File

@ -441,14 +441,14 @@ static void
InitStdStream (int sno, SMALLUNSGN flags, YP_File file)
{
StreamDesc *s = &Stream[sno];
s->u.file.file = file;
s->u.file.file = file;
s->status = flags;
s->linepos = 0;
s->linecount = 1;
s->charcount = 0;
s->encoding = DefaultEncoding();
INIT_LOCK(s->streamlock);
unix_upd_stream_info (s);
unix_upd_stream_info(s);
/* Getting streams to prompt is a mess because we need for cooperation
between readers and writers to the stream :-(
*/
@ -473,10 +473,13 @@ InitStdStream (int sno, SMALLUNSGN flags, YP_File file)
s->status |= Tty_Stream_f|Promptable_Stream_f;
#endif
#if HAVE_SETBUF
if (s->status & Tty_Stream_f)
if (s->status & Tty_Stream_f &&
sno == 0) {
/* make sure input is unbuffered if it comes from stdin, this
makes life simpler for interrupt handling */
YP_setbuf (stdin, NULL);
// fprintf(stderr,"here I am\n");
}
#endif /* HAVE_SETBUF */
}