(void) PR_PutEnv("NSPR_LOG_MODULES=nsSocketTransport:5"); (void) PR_PutEnv("NSPR_LOG_FILE=nspr.log");
(void) PR_SetEnv("NSPR_LOG_MODULES=nsSocketTransport:5"); (void) PR_SetEnv("NSPR_LOG_FILE=nspr.log");
main(int argc, char* argv[]){  nsresult rv;  // -----  //  // Parse the command line args...  //  // -----///  if (argc < 3) {///      printf("usage: %s [-sync|-silent] <host> <path>\n", argv[0]);///      return -1;///  }  PRBool bIsAsync = PR_TRUE;  const char* hostName = nsnull;  int i;  for (i=1; i<argc; i++) {    // Turn on synchronous mode...    if (PL_strcasecmp(argv[i], "-sync") == 0) {      bIsAsync = PR_FALSE;      continue;    }     if (PL_strcasecmp(argv[i], "-silent") == 0) {      gVerbose = PR_FALSE;      continue;    }    hostName = argv[i];  }  if (!hostName) {    hostName = "chainsaw";  }  printf("Using %s as echo server...\n", hostName);#ifdef XP_MAC	(void) PR_PutEnv("NSPR_LOG_MODULES=nsSocketTransport:5");	(void) PR_PutEnv("NSPR_LOG_FILE=nspr.log");	PR_Init_Log();#endif  // -----  //  // Initialize XPCom...  //  // -----  rv = NS_AutoregisterComponents();  if (NS_FAILED(rv)) return rv;  // Create the Event Queue for this thread...  nsCOMPtr<nsIEventQueueService> eventQService =            do_GetService(kEventQueueServiceCID, &rv);  if (NS_FAILED(rv)) return rv;  rv = eventQService->CreateThreadEventQueue();  if (NS_FAILED(rv)) return rv;  //  // Create the connections and threads...  //  for (i=0; i<NUM_TEST_THREADS; i++) {    gConnections[i] = new TestConnection(hostName, 7, bIsAsync);    rv = NS_NewThread(&gThreads[i], gConnections[i], 0, PR_JOINABLE_THREAD);  }#if defined(USE_TIMERS)  //  // Start up the timer to test Suspend/Resume APIs on the transport...  //  nsresult rv;  gPeriodicTimer = do_CreateInstance("@mozilla.org/timer;1", &rv);  if (NS_SUCCEEDED(rv)) {    gPeriodicTimer->Init(TimerCallback, nsnull, 1000);  }#endif /* USE_TIMERS */    // Enter the message pump to allow the URL load to proceed.  Pump_PLEvents(eventQService);  PRTime endTime;  endTime = PR_Now();//  printf("Elapsed time: %d\n", (PRInt32)(endTime/1000UL - gElapsedTime/1000UL));  return 0;}