nsCOMPtr <nsIHttpProtocolHandler> httpHandler(do_GetService("@mozilla.org/network/protocol;1?name=http", &rv)); NS_ENSURE_SUCCESS(rv,rv);  nsCAutoString agent; httpHandler->GetUserAgent(agent);  printf("%s", agent.get());
printf("Mozilla %s, Copyright (c) 2003 mozilla.org", MOZILLA_VERSION);
static nsresult DumpVersion(char *appname){  nsresult rv = NS_OK;  long buildID = NS_BUILD_ID;  // 10-digit number  // Get httpHandler service.  nsCOMPtr <nsIHttpProtocolHandler> httpHandler(do_GetService("@mozilla.org/network/protocol;1?name=http", &rv));  NS_ENSURE_SUCCESS(rv,rv);  nsCAutoString agent;  httpHandler->GetUserAgent(agent);  printf("%s", agent.get());  if(buildID) {    printf(", build %u\n", (unsigned int)buildID);  } else {    printf(" <developer build>\n");  }  return rv;}