From a119a8552b5334b29aae8d71104fc02ce9a86aec Mon Sep 17 00:00:00 2001 From: simon <> Date: Fri, 10 Oct 1997 22:23:21 +0000 Subject: [PATCH] This is the one. Identifies protocol, selects handler, sorts out stdin and stdout, invokes handler. A job well done. Logging would be nice... --- wrapper.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/wrapper.c b/wrapper.c index 5b17e26..d40294f 100644 --- a/wrapper.c +++ b/wrapper.c @@ -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 */