This is the one. Identifies protocol, selects handler, sorts out stdin and

stdout, invokes handler. A job well done. Logging would be nice...
This commit is contained in:
simon 1997-10-10 22:23:21 +00:00
parent b5415686db
commit a119a8552b

View file

@ -28,22 +28,20 @@ void wrapper( int conversation)
{
char firstln[ 1024];
char * command;
int i, hear, say = conversation;
FILE * c_rx, * c_tx;
printf( "wrapper started with fdes [%d]\n",
conversation);
#ifdef glubba
hear = dup( conversation); /* creat two handles on conversation */
say = dup( conversation); /* one for reading and one for writing */
#endif
recv( conversation, firstln, 80, MSG_PEEK);
/* get the first thing the client
says, but leave it on the input
stream for the handler. */
if ( dup2( conversation, STDIN_FILENO) == -1)
{
sprintf( errorBuff,
"failed to duplicate conversation [%d] onto stdin: %s",
hear, strerror( errno));
conversation, strerror( errno));
error( FATAL_ERROR);
}
@ -51,12 +49,10 @@ void wrapper( int conversation)
{
sprintf( errorBuff,
"failed to duplicate conversation [%d] onto stdout: %s",
say, strerror( errno));
conversation, strerror( errno));
error( FATAL_ERROR);
}
gets( firstln);
command = get_handler_command( firstln);
/* and find the appropriate handler */
if ( ! command) /* didn't find one */