pipes and stderr

Anshuman Razdan razdan at chanakya.oakhill.uucp
Sat Mar 17 08:01:33 AEST 1990



I have an application in X Windows that takes care of the keyboard
interface thru a text widget.  I go one step further and do the following

I fork the parent process and execlp a shell from the child process doing
the routine closing of stdin and stdout on the child and parent sites so
that the shell can communicate with the application.  This provides me with the
ability to pass the shell commands to the shell itself and saves me from writing 
all that parsing code myself in trying to emulate the shell. This works fine as
the stout from the shell come back to my application and I listen on the stdin on
parent side and so print out the result on the text indow of my application.  What
I described is pretty simple and the usual (unless there is a more sophisticated way
of communicating with the shell and let the user have its full capability).  Any ways,
My problem is how to trap the the stderr coming from the child and direct them to
stdin of the parent.  Since the pipe calls opens only two file pointers and there is 
nothing for the error for say, you type in ls app.c where app.c does not exist.  Right now
the error message just gets printed in the parent window(shell) from where I had the application
started in the first place.

I am using Sun 4.0.3 on a 3/470 if that helps.

Thanx a bunch for anybody who can guide me to a solution on this one.


--

Anshuman Razdan					Motorola
						Sector CAD
Internal: razdan at chanakya			Austin Tx
Internet: razdan at chanakya.sps.mot.com

******************************************************************
*								 *
* PS: All opinions are my own and my employers have their own    *
*   which of course, most probably, in all honesty, as far       *
*   as I know, which sure is a guess, do not coincide with mine. *
*								 *
******************************************************************



More information about the Comp.unix.questions mailing list