rv = nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup, "components");
rv = NS_AutoregisterComponents();
main(int argc, char* argv[]){  nsresult rv;  // -----  //  // Parse the command line args...  //  // -----///  if (argc < 3) {///      printf("usage: %s <host> <path>\n", argv[0]);///      return -1;///  }  char* hostName = argv[1];  char* fileName = argv[2];  int port = 80;   // -----  //  // Initialize XPCom...  //  // -----  // XXX why do I have to do this?!  rv = nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup,                                        "components");  if (NS_FAILED(rv)) return rv;  // Create the Event Queue for this thread...  NS_WITH_SERVICE(nsIEventQueueService, eventQService, kEventQueueServiceCID, &rv);  if (NS_FAILED(rv)) return rv;  rv = eventQService->CreateThreadEventQueue();  if (NS_FAILED(rv)) return rv;  eventQService->GetThreadEventQueue(PR_CurrentThread(), &gEventQ);  int i;  //  // Create the connections and threads...  //  for (i=0; i<NUM_TEST_THREADS; i++) {    gConnections[i] = new TestConnection("chainsaw", 7, PR_TRUE);    rv = NS_NewThread(&gThreads[i], gConnections[i]);  }#if defined(USE_TIMERS)  //  // Start up the timer to test Suspend/Resume APIs on the transport...  //  if (NS_OK == NS_NewTimer(&gPeriodicTimer)) {    gPeriodicTimer->Init(TimerCallback, nsnull, 1000);  }#endif /* USE_TIMERS */    // Enter the message pump to allow the URL load to proceed.  while ( gKeepRunning ) {#ifdef WIN32    MSG msg;    if (GetMessage(&msg, NULL, 0, 0)) {      TranslateMessage(&msg);      DispatchMessage(&msg);    } else {      gKeepRunning = FALSE;    }#else#ifdef XP_MAC    /* Mac stuff is missing here! */#else    PLEvent *gEvent;    rv = gEventQ->GetEvent(&gEvent);    rv = gEventQ->HandleEvent(gEvent);#endif /* XP_UNIX */#endif /* !WIN32 */  }  PRTime endTime;  endTime = PR_Now();  printf("Elapsed time: %ld\n", (PRInt32)(endTime/1000UL-gElapsedTime/1000UL));  NS_RELEASE(eventQService);  return 0;}