In article <g6**********@netty.york.ac.uk>,
Andrew Greensted <aj****@ohm.york.ac.ukwrote:
>I've written a simple c program that reads stdin, adds highlighting to
particular words and outputs the result to stdout.
>I invoke it as follows (where xil-highlight is my program):
build | xil-highlight
>I'm using this within a make file. The problem is, if the build part
fails, the exit status is not picked up by make and does not exit.
That is not a C issue; it is a make issue or a shell issue.
>Is there some way I can 'read' the exit status of build and forward that
to the exit status of my xil-highlight program.
Not within standard C, not without using operating-system specific
extensions. The C language knows nothing about multiple programs
or pipes.
Either your C program xil-highlight will not get started or it
will get started but will detect EOF when 'build' has nothing to send it.
Your C program should not have to depend upon finding the status of
'build'.
--
"Every intellectual product must be judged from the point of view
of the age and the people in which it was produced."
-- Walter Horatio Pater