cout << "------------------" << endl << endl;
printf("------------------\n\n");
int main(int argc, char **argv){    int rv = -1;    if (argc < 2) {        printusage();        return NS_OK;    }    {        nsCOMPtr<nsIServiceManager> servMan;        NS_InitXPCOM2(getter_AddRefs(servMan), nsnull, nsnull);        nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(servMan);        NS_ASSERTION(registrar, "Null nsIComponentRegistrar");        if (registrar)            registrar->AutoRegister(nsnull);        // end of all messages from register components...        cout << "------------------" << endl << endl;        PRInt32 urlFactory = URL_FACTORY_DEFAULT;        PRBool bMakeAbs= PR_FALSE;        char* relativePath = 0;        char* url = 0;        for (int i=1; i<argc; i++) {            if (PL_strcasecmp(argv[i], "-std") == 0)            {                urlFactory = URL_FACTORY_STDURL;                if (i+1 >= argc)                {                    printusage();                    return NS_OK;                }            }            else if (PL_strcasecmp(argv[i], "-abs") == 0)            {                if (!gFileIO)                {                    relativePath = argv[i+1];                    i++;                }                bMakeAbs = PR_TRUE;            }            else if (PL_strcasecmp(argv[i], "-file") == 0)            {                if (i+1 >= argc)                {                    printusage();                    return NS_OK;                }                gFileIO = argv[i+1];                i++;            }            else            {                url = argv[i];            }        }        PRTime startTime = PR_Now();        if (bMakeAbs)        {            rv = (url && relativePath)               ? doMakeAbsTest(url, relativePath)               : doMakeAbsTest();        }        else        {            rv = gFileIO ? testURL(0, urlFactory) : testURL(url, urlFactory);        }        if (gFileIO)        {            PRTime endTime = PR_Now();            printf("Elapsed time: %d micros.\n", (PRInt32)                (endTime - startTime));        }    } // this scopes the nsCOMPtrs    // no nsCOMPtrs are allowed to be alive when you call NS_ShutdownXPCOM    rv = NS_ShutdownXPCOM(nsnull);    return rv;}