#include "common.h"

static long MEM[ 2500000 ];
// ретранслятор c fork
int main( int argc, char *argv[] ) {
   int ls = getsocket( FORK_LARGE_PORT ), rs;      
   setv( argc, argv );
   while( true ) {
      int rs = accept( ls, NULL, NULL );
      if( rs < 0 ) { perror( "accept error" ); cout << "-" << flush; continue; }
      pid_t pid = fork();
      if( pid < 0 ) errx( "fork error" );
      if( pid == 0 ) {
         close( ls );
         retrans( rs );
         close( rs );
         if( debug ) cout << "*" << flush;                  
         exit( EXIT_SUCCESS );
      }
      else close( rs );
   };
   exit( EXIT_SUCCESS );
};

