if ( *p == 0 || ( !quoted && isspace( *p ) ) ) {
if ( *p == 0 || ( !quoted && isspace( *p ) && !StringBeginsWith(arg, mailtoUrlScheme, nsCaseInsensitiveCStringComparator()) ) ) {
nsNativeAppSupportWin::GetCmdLineArgs( LPBYTE request, nsICmdLineService **aResult ) {    nsresult rv = NS_OK;    int justCounting = 1;    char **argv = 0;    // Flags, etc.    int init = 1;    int between, quoted, bSlashCount;    int argc;    char *p;    nsCAutoString arg;    // We loop if we've not finished the second pass through.    while ( 1 ) {        // Initialize if required.        if ( init ) {            p = (char*)request;            between = 1;            argc = quoted = bSlashCount = 0;            init = 0;        }        if ( between ) {            // We are traversing whitespace between args.            // Check for start of next arg.            if (  *p != 0 && !isspace( *p ) ) {                // Start of another arg.                between = 0;                arg = "";                switch ( *p ) {                    case '\\':                        // Count the backslash.                        bSlashCount = 1;                        break;                    case '"':                        // Remember we're inside quotes.                        quoted = 1;                        break;                    default:                        // Add character to arg.                        arg += *p;                        break;                }            } else {                // Another space between args, ignore it.            }        } else {            // We are processing the contents of an argument.            // Check for whitespace or end.            if ( *p == 0 || ( !quoted && isspace( *p ) ) ) {                // Process pending backslashes (interpret them                // literally since they're not followed by a ").                while( bSlashCount ) {                    arg += '\\';                    bSlashCount--;                }                // End current arg.                if ( !justCounting ) {                    argv[argc] = new char[ arg.Length() + 1 ];                    strcpy( argv[argc], arg.get() );                }                argc++;                // We're now between args.                between = 1;            } else {                // Still inside argument, process the character.                switch ( *p ) {                    case '"':                        // First, digest preceding backslashes (if any).                        while ( bSlashCount > 1 ) {                            // Put one backsplash in arg for each pair.                            arg += '\\';                            bSlashCount -= 2;                        }                        if ( bSlashCount ) {                            // Quote is literal.                            arg += '"';                            bSlashCount = 0;                        } else {                            // Quote starts or ends a quoted section.                            if ( quoted ) {                                // Check for special case of consecutive double                                // quotes inside a quoted section.                                if ( *(p+1) == '"' ) {                                    // This implies a literal double-quote.  Fake that                                    // out by causing next double-quote to look as                                    // if it was preceded by a backslash.                                    bSlashCount = 1;                                } else {                                    quoted = 0;                                }                            } else {                                quoted = 1;                            }                        }                        break;                    case '\\':                        // Add to count.                        bSlashCount++;                        break;                    default:                        // Accept any preceding backslashes literally.                        while ( bSlashCount ) {                            arg += '\\';                            bSlashCount--;                        }                        // Just add next char to the current arg.                        arg += *p;                        break;                }            }        }        // Check for end of input.        if ( *p ) {            // Go to next character.            p++;        } else {            // If on first pass, go on to second.            if ( justCounting ) {                // Allocate argv array.                argv = new char*[ argc ];                // Start second pass                justCounting = 0;                init = 1;            } else {                // Quit.                break;            }        }    }    // OK, now create nsICmdLineService object from argc/argv.    static NS_DEFINE_CID( kCmdLineServiceCID,    NS_COMMANDLINE_SERVICE_CID );    nsCOMPtr<nsIComponentManager> compMgr;    NS_GetComponentManager(getter_AddRefs(compMgr));    rv = compMgr->CreateInstance( kCmdLineServiceCID,                                  0,                                  NS_GET_IID( nsICmdLineService ),                                  (void**)aResult );    if ( NS_FAILED( rv ) || NS_FAILED( ( rv = (*aResult)->Initialize( argc, argv ) ) ) ) {#if MOZ_DEBUG_DDE        printf( "Error creating command line service = 0x%08X (argc=%d, argv=0x%08X)\n", (int)rv, (int)argc, (void*)argv );#endif    }    // Cleanup.    while ( argc ) {        delete [] argv[ --argc ];    }    delete [] argv;    return rv;}