NS_InitXPCOM2(nsnull, nsnull, nsnull);
nsCOMPtr<nsIServiceManager> servMan; nsresult rv = NS_InitXPCOM2(getter_AddRefs(servMan), nsnull, nsnull);  if (NS_FAILED(rv)) { printf("Can not initialize XPCOM\n"); return -1; }  nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(servMan); NS_ASSERTION(registrar, "Null nsIComponentRegistrar");
int main(int argc, char *argv[]){    int ret;#ifdef XP_MAC#if DEBUG    InitializeSIOUX(1);#endif#endif    NS_InitXPCOM2(nsnull, nsnull, nsnull);    /* With no arguments, RegFactory will autoregister */    if (argc <= 1)    {        nsresult rv = nsComponentManager::AutoRegister(                                                       nsIComponentManagerObsolete::NS_Startup,                                                       NULL /* default location */);        ret = (NS_FAILED(rv)) ? -1 : 0;    }    else      ret = ProcessArgs(argc, argv);    NS_ShutdownXPCOM(NULL);    return ret;}