nsAutoString	queryStr("?");
nsAutoString	queryStr; queryStr.AssignWithConversion("?");
InternetSearchDataSource::FindInternetSearchResults(const char *url){	if (!mInner)	return(NS_OK);	// if the url doesn't look like a HTTP GET query, just return,	// otherwise strip off the query data	nsAutoString		shortURL(url);	PRInt32			optionsOffset;	if ((optionsOffset = shortURL.FindChar(PRUnichar('?'))) < 0)	return(NS_OK);	shortURL.Truncate(optionsOffset);	// if we haven't already, load in the engines	if (mEngineListBuilt == PR_FALSE)	DeferredInit();	// look in available engines to see if any of them appear	// to match this url (minus the GET options)	PRBool				foundEngine = PR_FALSE;	nsresult			rv;	nsAutoString			data;	nsCOMPtr<nsIRDFResource>	engine;	nsCOMPtr<nsISimpleEnumerator>	arcs;	if (NS_SUCCEEDED(rv = mInner->GetTargets(kNC_SearchEngineRoot, kNC_Child,		PR_TRUE, getter_AddRefs(arcs))))	{		PRBool			hasMore = PR_TRUE;		while (hasMore == PR_TRUE)		{			if (NS_FAILED(arcs->HasMoreElements(&hasMore)) || (hasMore == PR_FALSE))				break;			nsCOMPtr<nsISupports>	arc;			if (NS_FAILED(arcs->GetNext(getter_AddRefs(arc))))				break;			engine = do_QueryInterface(arc);			if (!engine)	continue;			if (NS_FAILED(rv = FindData(engine, data)))	continue;			if (data.Length() < 1)				continue;			nsAutoString		action;			if (NS_FAILED(rv = GetData(data, "search", "action", action)))	continue;			if (shortURL.EqualsIgnoreCase(action))			{				foundEngine = PR_TRUE;				break;			}		}	}	if (foundEngine == PR_TRUE)	{		nsAutoString	searchURL(url);		// look for query option which is the string the user is searching for		nsAutoString	userVar, inputUnused;		if (NS_FAILED(rv = GetInputs(data, userVar, "", inputUnused)))	return(rv);		if (userVar.Length() < 1)	return(NS_RDF_NO_VALUE);		nsAutoString	queryStr("?");		queryStr += userVar;		queryStr += "=";		PRInt32		queryOffset;		if ((queryOffset = searchURL.Find(queryStr, PR_TRUE )) < 0)		{			queryStr = "&";			queryStr += userVar;			queryStr += "=";			if ((queryOffset = searchURL.Find(queryStr, PR_TRUE )) < 0)				return(NS_RDF_NO_VALUE);		}				nsAutoString	searchText;		PRInt32		andOffset;		searchURL.Right(searchText, searchURL.Length() - queryOffset - queryStr.Length());		if ((andOffset = searchText.FindChar(PRUnichar('&'))) >= 0)		{			searchText.Truncate(andOffset);		}		if (searchText.Length() < 1)	return(NS_RDF_NO_VALUE);#ifdef	DEBUG_SEARCH_OUTPUT		char	*engineMatch = searchText.ToNewCString();		if (engineMatch)		{			printf("FindInternetSearchResults: found a search engine match: '%s'\n\n", engineMatch);			delete [] engineMatch;			engineMatch = nsnull;		}#endif		// forget about any previous search results		ClearResults();		// do the search		DoSearch(nsnull, engine, searchURL, nsAutoString(""));	}	return(NS_OK);}