bSuccess = false; for (i = 0; i < gControls->cfg->redirect.numURLs; i++) {  HLock(gControls->cfg->redirect.url[i]); leaf = strrchr(*(gControls->cfg->redirect.url[i]), '/'); if (!leaf) { bSuccess = false; goto BAIL; } pLeaf = CToPascal(leaf+1); HUnlock(gControls->cfg->redirect.url[i]);  err = FSMakeFSSpec(vRefNum, dirID, pLeaf, redirectINI); if (err == noErr) { bSuccess = true; break; } }
bSuccess = false;
DownloadRedirect(short vRefNum, long dirID, FSSpecPtr redirectINI){	Boolean 	bSuccess = true;	char 		*buf = NULL, *idx = NULL, *leaf = NULL;;	int			i;	FSSpec		getRedirectIDI;	short		refNum;	long		count;	SDISTRUCT	sdistruct;	StringPtr	pLeaf = NULL;	OSErr		err = noErr;		buf = NewPtrClear(2048);	if (!buf)		return false;			/* generate IDI */		/*	 [Netscape Install]	  no_ads=true	  silent=false	  confirm_install=true	  execution=false	*/	strcpy(buf, "[Netscape Install]\r");	strcat(buf, "no_ads=true\r");	strcat(buf, "silent=false\r");	strcat(buf, "confirm_install=true\r");	strcat(buf, "execution=false\r\r");		/* [File0] */	strcat(buf, "[File0]\r");	strcat(buf, "desc=");	HLock(gControls->cfg->redirect.desc);	strcat(buf, *(gControls->cfg->redirect.desc));	HUnlock(gControls->cfg->redirect.desc);	strcat(buf, "\r");		/* iterate <n>=URLn */	for (i = 0; i < gControls->cfg->redirect.numURLs; i++)	{		idx = ltoa(i);				strcat(buf, idx);		strcat(buf, "=");		HLock(gControls->cfg->redirect.url[i]);		strcat(buf, *(gControls->cfg->redirect.url[i]));		HUnlock(gControls->cfg->redirect.url[i]);		strcat(buf, "\r");				if (idx)			free(idx);		idx = NULL;	}		/* write out buffer to temp location */	err = FSMakeFSSpec(vRefNum, dirID, "\pGetRedirect.idi", &getRedirectIDI);	if (err == noErr)		FSpDelete(&getRedirectIDI);	err = FSpCreate(&getRedirectIDI, 'NSCP', 'TEXT', smSystemScript);	if ((err != noErr) && (err != dupFNErr))	{		ErrorHandler(err);		return false;	}	err = FSpOpenDF(&getRedirectIDI, fsRdWrPerm, &refNum);	if (err != noErr)	{		bSuccess = false;		goto BAIL;	}	count = strlen(buf);	if (count <= 0)	{		bSuccess = false;		goto BAIL;	}	err = FSWrite(refNum, &count, (void*) buf);	if (err != noErr)		bSuccess = false;	FSClose(refNum);		/* populate SDI struct */	sdistruct.dwStructSize 	= sizeof(SDISTRUCT);	sdistruct.fsIDIFile 	= getRedirectIDI;	sdistruct.dlDirVRefNum 	= vRefNum;	sdistruct.dlDirID 		= dirID;	sdistruct.hwndOwner    	= NULL;		/* call SDI_NetInstall */#if MOZILLA == 0	#if SDINST_IS_DLL == 1		gInstFunc(&sdistruct);#else		SDI_NetInstall(&sdistruct);#endif /* SDINST_IS_DLL */#endif /* MOZILLA */		bSuccess = false;	for (i = 0; i < gControls->cfg->redirect.numURLs; i++)	{    	/* verify redirect.ini existence */    	HLock(gControls->cfg->redirect.url[i]);    	leaf = strrchr(*(gControls->cfg->redirect.url[i]), '/');    	if (!leaf)    	{    		bSuccess = false;    		goto BAIL;    	}    	pLeaf = CToPascal(leaf+1);    	HUnlock(gControls->cfg->redirect.url[i]);    	    	err = FSMakeFSSpec(vRefNum, dirID, pLeaf, redirectINI);    	if (err == noErr)    	{    		bSuccess = true;    		break;    	}	}		if (!bSuccess)	    FSMakeFSSpec(0, 0, "\p", redirectINI);	BAIL:	if (buf)		DisposePtr((Ptr)buf);	if (pLeaf)		DisposePtr((Ptr)pLeaf);			return bSuccess;}