X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/deed9e2553ba99e7cd912c924482ba468cab61a1..faf5762875a834c660fb6a8d89c23cb7bb3f6082:/mac/mac.c diff --git a/mac/mac.c b/mac/mac.c index 632b6a41..6335aabe 100644 --- a/mac/mac.c +++ b/mac/mac.c @@ -1,4 +1,4 @@ -/* $Id: mac.c,v 1.24 2003/01/11 19:43:59 ben Exp $ */ +/* $Id: mac.c,v 1.29 2003/01/14 19:42:00 ben Exp $ */ /* * Copyright (c) 1999 Ben Harris * All rights reserved. @@ -169,13 +169,21 @@ static void mac_startup(void) { mac_gestalts.uncvattr = (*ti)->tecUnicodeConverterFeatures; DisposeHandle((Handle)ti); } - /* MacTCP? */ - if (Gestalt(FOUR_CHAR_CODE('mtcp'), &mac_gestalts.mtcpvers) != noErr) - mac_gestalts.mtcpvers = 0; - if (mac_gestalts.mtcpvers > 0) { - if (mactcp_init() != noErr) + /* 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) @@ -196,14 +204,6 @@ static void mac_startup(void) { default_port = DEFAULT_PORT; flags = FLAG_INTERACTIVE; - /* - * Really grotty hack to ensure that anything that looks at the - * global "cfg" variable gets something vaguely sensible. - * Obviously, nothing should actually be using it, but that will - * take a while to arrange. - */ - do_defaults(NULL, &cfg); - { short vol; long dirid; @@ -215,7 +215,6 @@ static void mac_startup(void) { LMSetCurDirStore(dirid); } } - init_ucs(); } static void mac_eventloop(void) { @@ -232,6 +231,8 @@ static void mac_eventloop(void) { mac_event(&event); if (mac_gestalts.mtcpvers != 0) mactcp_poll(); + if (mac_gestalts.otptattr != 0) + ot_poll(); mac_pollterm(); } DisposeRgn(cursrgn); @@ -623,8 +624,7 @@ void cleanup_exit(int status) if (mac_gestalts.encvvers != 0) TerminateUnicodeConverter(); #endif - if (mac_gestalts.mtcpvers != 0) - mactcp_shutdown(); + sk_cleanup(); exit(status); } @@ -638,7 +638,7 @@ void fatalbox(char *fmt, ...) { va_end(ap); ParamText(stuff, NULL, NULL, NULL); StopAlert(128, NULL); - exit(1); + cleanup_exit(1); } void modalfatalbox(char *fmt, ...) { @@ -651,7 +651,7 @@ void modalfatalbox(char *fmt, ...) { va_end(ap); ParamText(stuff, NULL, NULL, NULL); StopAlert(128, NULL); - exit(1); + cleanup_exit(1); } /* This should only kill the current session, not the whole application. */ @@ -665,7 +665,7 @@ void connection_fatal(void *fontend, char *fmt, ...) { va_end(ap); ParamText(stuff, NULL, NULL, NULL); StopAlert(128, NULL); - exit(1); + cleanup_exit(1); } /* Null SSH agent client -- never finds an agent. */ @@ -701,7 +701,7 @@ void old_keyfile_warning(void) } -char *platform_default_s(char *name) +char *platform_default_s(char const *name) { long smfs; Str255 pname; @@ -723,7 +723,7 @@ char *platform_default_s(char *name) return NULL; } -int platform_default_i(char *name, int def) +int platform_default_i(char const *name, int def) { long smfs;