Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zsh-3.0-pre1: speed up the "list-choices" etc.



> >	% truss zsh
> 
> Why didn't I think of that before?
> 
> I can confirm that output is UNbuffered under Solaris 2, but buffered
> under SunOS 4.  How remarkable.  Does anyone know *why* it's
> unbuffered?  Could this be a SysV thing?

Quote from the Solaris 2.4 fdopen manual:

     When opened, a stream is fully buffered if and  only  if  it
     can  be  determined  not  to refer to an interactive device.
     The error and end-of-file indicators  are  cleared  for  the
     stream.

The patch below should fix this.  Note that here setvbuff is called with
NULL buffer and if _IOFBF is not defined setbuffer is not called.  That's
because this problem seems to affect only SVR4 systems where setvbuf and
_IOFBF is always defined.  And setvbuf used to be called with NULL buffer
but the Linux libc-5.3.6 and earlier versions had a bug that setvbuf with
NULL buffer did not work on unbuffered streams.  But Linux fdopen always
gives a buffered stream so that is not a problem here and libc older than
5.3.12 is obsolate anyway :-).

Zoltan


*** Src/init.c	1996/07/08 01:56:51	2.25
--- Src/init.c	1996/07/08 14:14:18
***************
*** 365,370 ****
--- 365,373 ----
  
      /* Associate terminal file descriptor with a FILE pointer */
      shout = fdopen(SHTTY, "w");
+ #ifdef _IOFBF
+     setvbuf(shout, NULL, _IOFBF, 0);
+ #endif
    
      gettyinfo(&shttyinfo);	/* get tty state */
  #if defined(__sgi)




Messages sorted by: Reverse Date, Date, Thread, Author