🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #3364

Can't pipe stdout into 'cat', using g++/libg++ on SunOS 4.1

#3364
From: Sean Burke22
Date: Tue, 03 Aug 1993 07:22
40 lines
2193 bytes
  I have written a filter program,  one which reads from standard
input and writes to standard output.  The output works OK when
printing to the console, or when redirected via the shell to a file,
but fails when piped into the standard input of another program,
such as 'cat'.

  I am running SunOS 4.1, using libg++ 2.3 (I believe).  The test 
program below tries to act like cat, copying its input verbatim to
the output.

	#include <String.h>

	int main (int argc, char ** argv, char **env)
	{
	    String line;
	     // keep terminator, or cannot tell eof
	    while (readline(cin,line,'\n',0)) cout << line ;
	}

  Call the program above 'acat'.  I can do the following tests:

	cat foo.txt | cat		- prints foo.txt
	cat foo.txt | acat		- prints foo.txt
	cat foo.txt | acat | cat	- NO output!
	cat foo.txt | cat | cat		- prints foo.txt
	cat foo.txt | acat > bar.txt	- bar.txt contains foo.txt

  Other variations convince me that I cannot pipe the output of
this program into itself or any other "filter" program. What gives?
This is a very disquieting thing to have happen.

  BTW, the executable for this program is 524K.  Also disquieting.

-Sean

	  

-- 

Sean Burke			sean@netcom.com
Technical Details
Message-ID: <seanCB69u5.B7D@netcom.com>
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!sol.ctr.columbia.edu!usc!cs.utexas.edu!uunet!olivea!grapevine.lcs.mit.edu!ai-lab!prep.ai.mit.edu!gnulists

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 109fba,f10b1293b4c55089,start
X-Google-Attributes: gid109fba,public
X-Google-Thread: fc89c,f10b1293b4c55089,start
X-Google-Attributes: gidfc89c,public
X-Google-Thread: 112afc,f10b1293b4c55089,start
X-Google-Attributes: gid112afc,public
X-Google-ArrivalTime: 1993-08-03 06:04:58 PST
Newsgroups: comp.unix.programmer,comp.lang.c++,gnu.g++.bug
From: sean@netcom.com (Sean Burke22)
Subject: Can't pipe stdout into 'cat', using g++/libg++ on SunOS 4.1
Message-ID: <seanCB69u5.B7D@netcom.com>
Followup-To: poster
Keywords: pipe C++ bug libg++
Organization: NETCOM On-line Communication Services (408 241-9760 guest)
Date: Tue, 3 Aug 1993 07:22:52 GMT
Apparently-To: gnu-g++-bug@uunet.uu.net
Distribution: world
Approved: info-gnu@prep.ai.mit.edu
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!sol.ctr.columbia.edu!usc!cs.utexas.edu!uunet!olivea!grapevine.lcs.mit.edu!ai-lab!prep.ai.mit.edu!gnulists
Lines: 41