Click to See Complete Forum and Search --> : Can't get 'tbl' to exit when used as filter (in C)


GŠutama
07-31-2003, 04:53 AM
I am writing a program that will format documents a special way. I do this by piping the file via first 'tbl' and then 'eqn'.

However I cant get 'tbl' to exit (with any exitcode) so my program just stops at the waitpid command, I do want to check that 'tbl' exited OK before proceding.

The basic outline of the program is:

setup pipe for "cat -> tbl"
fork of "cat"
fork of "tbl"
setup pipe for "tbl -> eqn"
fork of "eqn"

wait for all the forked processes to finish.

In each fork I close the pipes after changing stdout and stdin.

the "cat" process finishes nicely but not "tbl"

Does "tbl" need a EOF and if so how do I insert it after "cat"?