SC in "finding an actual bug" shocker! Set the port number before passing
[sgt/putty] / mac / mac.c
index c86f6d9..9c1abdf 100644 (file)
--- a/mac/mac.c
+++ b/mac/mac.c
@@ -1,4 +1,4 @@
-/* $Id: mac.c,v 1.16 2003/01/04 00:31:04 ben Exp $ */
+/* $Id: mac.c,v 1.19 2003/01/05 12:53:38 ben Exp $ */
 /*
  * Copyright (c) 1999 Ben Harris
  * All rights reserved.
@@ -118,7 +118,7 @@ static void mac_startup(void) {
     /* Init TextEdit */
     TEInit();
     /* Init Dialog Manager */
-    InitDialogs(nil);
+    InitDialogs(NULL);
     cold = 0;
     
     /* Get base system version (only used if there's no better selector) */
@@ -167,6 +167,8 @@ static void mac_startup(void) {
        DisposeHandle((Handle)ti);
     }
 
+    mactcp_init();
+
     /* We've been tested with the Appearance Manager */
     if (mac_gestalts.apprvers != 0)
        RegisterAppearanceClient();
@@ -182,6 +184,9 @@ static void mac_startup(void) {
     windows.about = NULL;
     windows.licence = NULL;
 
+    default_protocol = DEFAULT_PROTOCOL;
+    default_port = DEFAULT_PORT;
+
     {
        short vol;
        long dirid;
@@ -208,6 +213,7 @@ static void mac_eventloop(void) {
        mac_adjustcursor(cursrgn);
        if (gotevent)
            mac_event(&event);
+       mactcp_poll();
     }
     DisposeRgn(cursrgn);
 }
@@ -597,6 +603,7 @@ static void mac_shutdown(void) {
     if (mac_gestalts.encvvers != 0)
        TerminateUnicodeConverter();
 #endif
+    mactcp_shutdown();
     exit(0);
 }
 
@@ -609,7 +616,7 @@ void fatalbox(char *fmt, ...) {
     stuff[0] = vsprintf((char *)(&stuff[1]), fmt, ap);
     va_end(ap);
     ParamText(stuff, NULL, NULL, NULL);
-    StopAlert(128, nil);
+    StopAlert(128, NULL);
     exit(1);
 }
 
@@ -622,7 +629,21 @@ void modalfatalbox(char *fmt, ...) {
     stuff[0] = vsprintf((char *)(&stuff[1]), fmt, ap);
     va_end(ap);
     ParamText(stuff, NULL, NULL, NULL);
-    StopAlert(128, nil);
+    StopAlert(128, NULL);
+    exit(1);
+}
+
+/* This should only kill the current session, not the whole application. */
+void connection_fatal(void *fontend, char *fmt, ...) {
+    va_list ap;
+    Str255 stuff;
+    
+    va_start(ap, fmt);
+    /* We'd like stuff to be a Pascal string */
+    stuff[0] = vsprintf((char *)(&stuff[1]), fmt, ap);
+    va_end(ap);
+    ParamText(stuff, NULL, NULL, NULL);
+    StopAlert(128, NULL);
     exit(1);
 }