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

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

Post by Sean Burke » Wed, 04 Aug 1993 16:22:52



  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

--


 
 
 

1. WANTED: Solaris 2 equivalent to SunOS 4.1.X's 'showfh' cmd

I am looking for a Solaris equivalent program to the SunOS 'showfh'
command.

I would like a way of viewing NFS filehandles and the file path they
are pointing to.

eg.

client-machine %> showfh 6830
                "/var/mail"

I have been looking everywhere for something for Solaris and cannot
find it!.

The best I can do at the moment is try to catch a MOUNT request
using SNOOP which shows the file handle and requested remote path.

Any ideas?


7 Arabian Avenue, West Beach, South Australia 5024  Ph: +61-8-235-2735

2. Different kernel boot problem

3. Using 'cat' with 'tee' - Input error?

4. Solarix x86 & SMC EtherPower II 100Meg Full Duplex

5. Is there something like 'shutdownrc' at SunOS 4.1 ?

6. Use pppd to connect to Slirp, HOW?

7. pipe '|' character not working under Xfree (RedHat 4.1)

8. setscheduler resched bug

9. Where is the 'kernel configuration file' for SunOS 4.1?

10. SunOS 4.1 / 4.1.1 / 4.1.1U_1 /usr/etc/rpc.yppasswdd doesn't work.

11. 'Unknown PCI device' and 'Keyboard timeout' with RedHat 4.1

12. read()'ing from a child's piped stdout

13. mp3 'cat' and 'split' commands