rv = nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup, "components");
rv = NS_AutoregisterComponents();
main(int argc, char* argv[]){  nsresult rv;  if (argc < 2) {      printf("usage: %s <host>\n", argv[0]);      return -1;  }  int port;  char* hostName = argv[1];//nsString portString(argv[2]);//port = portString.ToInteger(&rv);  port = 13;  // 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;  nsIEventQueue* eventQ;  rv = eventQService->CreateThreadEventQueue();  if (NS_FAILED(rv)) return rv;  eventQService->GetThreadEventQueue(PR_CurrentThread(), &eventQ);    NS_WITH_SERVICE(nsISocketTransportService, sts, kSocketTransportServiceCID, &rv);  if (NS_FAILED(rv)) return rv;  nsIChannel* transport;  rv = sts->CreateTransport(hostName, port, &transport);  if (NS_SUCCEEDED(rv)) {    transport->AsyncRead(0, -1, nsnull, eventQ, new InputTestConsumer);    NS_RELEASE(transport);  }  // Enter the message pump to allow the URL load to proceed.  while ( gKeepRunning ) {#ifdef WIN32    MSG msg;    if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {      TranslateMessage(&msg);      DispatchMessage(&msg);    }#else#ifdef XP_MAC    /* Mac stuff is missing here! */#else    PLEvent *gEvent;    rv = eventQ->GetEvent(&gEvent);    rv = eventQ->HandleEvent(gEvent);#endif#endif  }  sts->Shutdown();  NS_RELEASE(sts);  NS_RELEASE(eventQService);  return 0;}