Using Pipes

Using Pipes

Post by David Whi » Sun, 27 Feb 1994 01:13:37



I have written a program which chains a call to the c preprocessor (cpp) to
a parser written in lex/yacc.  My current arrangement uses a temporary file
between cpp and my lexer.  I would like to use a pipe (socketpair or whatever)

I think that I need to connect the stdout of my cpp process to the stdin of
my lexer process.  How do I do this.  (I've read the man pages for pipe and
socket pair, but they haven't helped)

             |                               |    
            fork                            fork
            /  \                           /    \
           |    |                        /        \
          cpp   |                    cpp-->pipe-->lexer
         / |    |                      |            |
        |  |    |      ------>        end      rest-of-program
 tempfile   ->wait                        
        |      |                            
         \___lexer                          
               |                    
           rest-of-program

(I'm using acc on a sun; I'm calling cpp using execlp(...) from a process
forked from main)


|  | |  | | | |   ------------------------------------------------------------
|  | +--  | | |   Due to transcription  and  transmission  errors,  the  views
---  |     | |    expressed  here  may  not  reflect  even  my  own  opinions!

 
 
 

1. Exit status of first command when using pipe

I'm using a pipe to get the output of the first command to an other
application.

Example (ksh):
diff file1 file2|pager
print $?

The exit status is (probably) the exit status of the last application.
However I want to know the exit status (return value) of the first command.
Any ideas how to do this?

2. Compuserve access under Linux

3. using pipe to place message content into mailx?

4. some problems with Solaris 2.3

5. looking for an example that uses pipes and exec

6. Configuring a Speedrunner 204

7. Limited buffer size using pipes?

8. STLport on AIX4.3.3 with Visual Age 5.0 batch compiler

9. compress using pipe

10. Apache 1.3.4 hangs trying to HUP when using pipes.

11. using pipe() and dup2??????

12. Using Pipes to Copy Tapes

13. compress using pipe