🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Mic Kaczmarczik Thu, 25 May 1989 17:03
GNU awk 2.10 has trouble reading from pipes on an Encore
#1630
Author: Mic Kaczmarczik
Date: Thu, 25 May 1989 17:03
51 lines
2259 bytes
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)
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads