From 2dc0bf7a60490625d7c01473748f3993528c074e Mon Sep 17 00:00:00 2001
From: Ben Harris <bjh21@bjh21.me.uk>
Date: Sat, 18 Jan 2003 16:54:25 +0000
Subject: [PATCH] Move mac_opensession() from macterm.c to macdlg.c.

[originally from svn r2641]
---
 mac/macdlg.c  | 43 ++++++++++++++++++++++++++++++++++++++++++-
 mac/macterm.c | 45 ++-------------------------------------------
 2 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/mac/macdlg.c b/mac/macdlg.c
index 35b1d6db..ed9b026b 100644
--- a/mac/macdlg.c
+++ b/mac/macdlg.c
@@ -1,4 +1,4 @@
-/* $Id: macdlg.c,v 1.2 2003/01/01 11:45:43 ben Exp $ */
+/* $Id: macdlg.c,v 1.3 2003/01/18 16:54:25 ben Exp $ */
 /*
  * Copyright (c) 2002 Ben Harris
  * All rights reserved.
@@ -31,6 +31,7 @@
 
 #include <MacTypes.h>
 #include <Dialogs.h>
+#include <StandardFile.h>
 #include <Windows.h>
 
 #include <string.h>
@@ -38,6 +39,7 @@
 #include "putty.h"
 #include "mac.h"
 #include "macresid.h"
+#include "storage.h"
 
 void mac_newsession(void)
 {
@@ -55,6 +57,45 @@ void mac_newsession(void)
     ShowWindow(s->settings_window);
 }
 
+void mac_opensession(void) {
+    Session *s;
+    StandardFileReply sfr;
+    static const OSType sftypes[] = { 'Sess', 0, 0, 0 };
+    void *sesshandle;
+    int i;
+
+    s = smalloc(sizeof(*s));
+    memset(s, 0, sizeof(*s));
+
+    StandardGetFile(NULL, 1, sftypes, &sfr);
+    if (!sfr.sfGood) goto fail;
+
+    sesshandle = open_settings_r_fsp(&sfr.sfFile);
+    if (sesshandle == NULL) goto fail;
+    load_open_settings(sesshandle, TRUE, &s->cfg);
+    close_settings_r(sesshandle);
+
+    /*
+     * Select protocol. This is farmed out into a table in a
+     * separate file to enable an ssh-free variant.
+     */
+    s->back = NULL;
+    for (i = 0; backends[i].backend != NULL; i++)
+	if (backends[i].protocol == s->cfg.protocol) {
+	    s->back = backends[i].backend;
+	    break;
+	}
+    if (s->back == NULL) {
+	fatalbox("Unsupported protocol number found");
+    }
+    mac_startsession(s);
+    return;
+
+  fail:
+    sfree(s);
+    return;
+}
+
 void mac_activatedlg(WindowPtr window, EventRecord *event)
 {
     DialogItemType itemtype;
diff --git a/mac/macterm.c b/mac/macterm.c
index 02232a57..cbf54f53 100644
--- a/mac/macterm.c
+++ b/mac/macterm.c
@@ -1,4 +1,4 @@
-/* $Id: macterm.c,v 1.50 2003/01/15 23:30:21 ben Exp $ */
+/* $Id: macterm.c,v 1.51 2003/01/18 16:54:25 ben Exp $ */
 /*
  * Copyright (c) 1999 Simon Tatham
  * Copyright (c) 1999, 2002 Ben Harris
@@ -33,6 +33,7 @@
 #include <MacTypes.h>
 #include <Controls.h>
 #include <ControlDefinitions.h>
+#include <FixMath.h>
 #include <Fonts.h>
 #include <Gestalt.h>
 #include <LowMem.h>
@@ -46,9 +47,7 @@
 #include <Scrap.h>
 #include <Script.h>
 #include <Sound.h>
-#include <StandardFile.h>
 #include <TextCommon.h>
-#include <Threads.h>
 #include <ToolUtils.h>
 #include <UnicodeConverter.h>
 
@@ -62,7 +61,6 @@
 #include "putty.h"
 #include "charset.h"
 #include "mac.h"
-#include "storage.h"
 #include "terminal.h"
 
 #define NCOLOURS (lenof(((Config *)0)->colours))
@@ -109,45 +107,6 @@ static RoutineDescriptor do_text_for_device_upp =
 #define do_text_for_device_upp	do_text_for_device
 #endif /* not TARGET_RT_MAC_CFM */
 
-void mac_opensession(void) {
-    Session *s;
-    StandardFileReply sfr;
-    static const OSType sftypes[] = { 'Sess', 0, 0, 0 };
-    void *sesshandle;
-    int i;
-
-    s = smalloc(sizeof(*s));
-    memset(s, 0, sizeof(*s));
-
-    StandardGetFile(NULL, 1, sftypes, &sfr);
-    if (!sfr.sfGood) goto fail;
-
-    sesshandle = open_settings_r_fsp(&sfr.sfFile);
-    if (sesshandle == NULL) goto fail;
-    load_open_settings(sesshandle, TRUE, &s->cfg);
-    close_settings_r(sesshandle);
-
-    /*
-     * Select protocol. This is farmed out into a table in a
-     * separate file to enable an ssh-free variant.
-     */
-    s->back = NULL;
-    for (i = 0; backends[i].backend != NULL; i++)
-	if (backends[i].protocol == s->cfg.protocol) {
-	    s->back = backends[i].backend;
-	    break;
-	}
-    if (s->back == NULL) {
-	fatalbox("Unsupported protocol number found");
-    }
-    mac_startsession(s);
-    return;
-
-  fail:
-    sfree(s);
-    return;
-}
-
 void mac_startsession(Session *s)
 {
     char *errmsg;