default_protocol = DEFAULT_PROTOCOL; default_port = DEFAULT_PORT;
default_protocol = be_default_protocol;  { default_port = 0;  int i; for (i = 0; backends[i].backend != NULL; i++) if (backends[i].protocol == default_protocol) { default_port = backends[i].backend->default_port; break; } }
static void mac_startup(void) {    Handle menuBar;    TECInfoHandle ti;    /* Init Memory Manager */    MaxApplZone();    /* Init QuickDraw */    InitGraf(&qd.thePort);    /* Init Font Manager */    InitFonts();    /* Init Window Manager */    InitWindows();    /* Init Menu Manager */    InitMenus();    /* Init TextEdit */    TEInit();    /* Init Dialog Manager */    InitDialogs(NULL);    cold = 0;        /* Get base system version (only used if there's no better selector) */    if (Gestalt(gestaltSystemVersion, &mac_gestalts.sysvers) != noErr ||	(mac_gestalts.sysvers &= 0xffff) < 0x700)	fatalbox("PuTTY requires System 7 or newer");    /* Find out if we've got Color Quickdraw */    if (Gestalt(gestaltQuickdrawVersion, &mac_gestalts.qdvers) != noErr)    	mac_gestalts.qdvers = gestaltOriginalQD;    /* ... and the Appearance Manager? */    if (Gestalt(gestaltAppearanceVersion, &mac_gestalts.apprvers) != noErr)	if (Gestalt(gestaltAppearanceAttr, NULL) == noErr)	    mac_gestalts.apprvers = 0x0100;	else	    mac_gestalts.apprvers = 0;#if TARGET_RT_MAC_CFM    /* Paranoia: Did we manage to pull in AppearanceLib? */    if (&RegisterAppearanceClient == kUnresolvedCFragSymbolAddress)	mac_gestalts.apprvers = 0;#endif#if TARGET_CPU_68K    mac_gestalts.cntlattr = 0;    mac_gestalts.windattr = 0;#else    /* Mac OS 8.5 Control Manager (proportional scrollbars)? */    if (Gestalt(gestaltControlMgrAttr, &mac_gestalts.cntlattr) != noErr ||	&SetControlViewSize == kUnresolvedCFragSymbolAddress)	mac_gestalts.cntlattr = 0;    /* Mac OS 8.5 Window Manager? */    if (Gestalt(gestaltWindowMgrAttr, &mac_gestalts.windattr) != noErr ||	&SetWindowContentColor == kUnresolvedCFragSymbolAddress)	mac_gestalts.windattr = 0;#endif    /* Text Encoding Conversion Manager? */    if (#if TARGET_RT_MAC_CFM	&TECGetInfo == kUnresolvedCFragSymbolAddress ||#else	InitializeUnicodeConverter(NULL) != noErr ||#endif	TECGetInfo(&ti) != noErr)	mac_gestalts.encvvers = 0;    else {	mac_gestalts.encvvers = (*ti)->tecVersion;	mac_gestalts.uncvattr = (*ti)->tecUnicodeConverterFeatures;	DisposeHandle((Handle)ti);    }    /* OpenTransport? */    if (Gestalt(gestaltOpenTpt, &mac_gestalts.otptattr) != noErr ||	(mac_gestalts.otptattr & gestaltOpenTptTCPPresentMask) == 0 ||	ot_init() != noErr)	mac_gestalts.otptattr = 0;    if (mac_gestalts.otptattr == 0) {	/* MacTCP? */	if (Gestalt(FOUR_CHAR_CODE('mtcp'), &mac_gestalts.mtcpvers) != noErr)	    mac_gestalts.mtcpvers = 0;	if (mac_gestalts.mtcpvers > 0) {	    if (mactcp_init() != noErr)		mac_gestalts.mtcpvers = 0;	}    } else	mac_gestalts.mtcpvers = 0;    /* We've been tested with the Appearance Manager */    if (mac_gestalts.apprvers != 0)	RegisterAppearanceClient();    menuBar = GetNewMBar(128);    if (menuBar == NULL)	fatalbox("Unable to create menu bar.");    SetMenuBar(menuBar);    AppendResMenu(GetMenuHandle(mApple), 'DRVR');    mac_adjustmenus();    DrawMenuBar();    InitCursor();    windows.about = NULL;    windows.licence = NULL;    default_protocol = DEFAULT_PROTOCOL;    default_port = DEFAULT_PORT;    flags = FLAG_INTERACTIVE;    {	short vol;	long dirid;	/* Set the default directory for loading and saving settings. */	/* XXX Should we create it? */	if (get_session_dir(FALSE, &vol, &dirid) == noErr) {	    LMSetSFSaveDisk(-vol);	    LMSetCurDirStore(dirid);	}    }}