mic@EMX.UTEXAS.EDU (Mic Kaczmarczik) (05/26/89)
After we installed GNU Awk 2.10 on an Encore Multimax running UMAX
3.2, we found that commands of the form
cat file | gawk '{print $0}'
would produce no output, instead of copying standard input to standard
output. Redirecting standard input from a normal file worked fine,
however.
I found that iop_alloc() in awk7.c uses fstat() to determine the input
buffer size to be used for a file descriptor. Under UMAX 3.2, fstat()
on a pipe returns 0 for both the file and block size, so the input
buffer size was being set to 0. I modified the DEFBLKSIZE macro to
fall back to BUFSIZ if the block size was 0, and the program works
fine now. A context diff is enclosed below.
Mic Kaczmarczik
UT Austin Computation Center
mic@emx.utexas.edu
--------------------------CUT HERE-------------------------------------
*** awk7.c.dist Wed Apr 5 10:57:03 1989
--- awk7.c Thu May 25 11:13:06 1989
***************
*** 754,764 ****
* stat structure. So we have to make some sort of reasonable
* guess. We use stdio's BUFSIZ, since that what it was
* meant for in the first place.
*/
#if defined(USG) || defined(MSDOS)
#define DEFBLKSIZE BUFSIZ
#else
! #define DEFBLKSIZE stb.st_blksize
#endif
if (fd == -1)
--- 754,767 ----
* stat structure. So we have to make some sort of reasonable
* guess. We use stdio's BUFSIZ, since that what it was
* meant for in the first place.
+ *
+ * If stb.st_blksize is 0, make the default block size BUFSIZ.
+ * This happens when you fstat() a pipe under UMAX 3.2 on an Encore.
*/
#if defined(USG) || defined(MSDOS)
#define DEFBLKSIZE BUFSIZ
#else
! #define DEFBLKSIZE (stb.st_blksize ? stb.st_blksize : BUFSIZ)
#endif
if (fd == -1)