Re: XForms: Receiving data through pipe

Matthias Rarey (Matthias.Rarey@gmd.de)
Wed, 19 Nov 1997 17:41:30 +0100 (MET)

To subscribers of the xforms list from Matthias Rarey <Matthias.Rarey@gmd.de> :

Hi,

I have three application programs communicating via named pipes
with each other, two of them have an xforms gui and contain an
io_callback function. Everthing works without any problems on
SUN/SGI/Linux. My message handler looks like:

void parent_process_handler( int fd, void *data )
/* handling of input over the pipe from parent process */
{ char *routine = "parent_process_handler";
int i, n;
char msg[256], tmp_msg[256], *first;
char command, *part;
int objno, objid, switch_on, com_error;
vector cen;

command = receive_from_p( parproc, tmp_msg, 256 );
for( first = tmp_msg; *first == ' '; first++);
strcpy(msg, first);

com_error = FALSE;
switch(command)
{ case '.': /* last command */
break;
case 'x': /* EXIT: parent enforces termination */
:
:
:

receive_from_p contains the read() command, the pipe is already open.

The main program contains

/* add parent process handler */
/*-----------------------------------------------------------------------*/
if( parproc )
fl_add_io_callback( parproc->fd_from_p, FL_READ, parent_process_handler,
NULL );

:
:

Matthias

_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/