X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/d1580b2186e981a63dab625aeccca85edee2fcc2..ce2832135394f17cf34a9ca00db3c7394b591d46:/mac/macterm.c diff --git a/mac/macterm.c b/mac/macterm.c index 19ba7fa5..2e0f25d9 100644 --- a/mac/macterm.c +++ b/mac/macterm.c @@ -1,4 +1,4 @@ -/* $Id: macterm.c,v 1.25 2002/12/28 22:25:31 ben Exp $ */ +/* $Id: macterm.c,v 1.26 2002/12/30 18:21:17 ben Exp $ */ /* * Copyright (c) 1999 Simon Tatham * Copyright (c) 1999, 2002 Ben Harris @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -60,6 +61,7 @@ #include "macresid.h" #include "putty.h" #include "mac.h" +#include "storage.h" #include "terminal.h" #define NCOLOURS (lenof(((Config *)0)->colours)) @@ -138,15 +140,45 @@ static void display_resource(Session *s, unsigned long type, short id) { void mac_newsession(void) { Session *s; - UInt32 starttime; - char msg[128]; /* This should obviously be initialised by other means */ s = smalloc(sizeof(*s)); memset(s, 0, sizeof(*s)); do_defaults(NULL, &s->cfg); s->back = &loop_backend; - + mac_startsession(s); +} + +void mac_opensession(void) { + Session *s; + StandardFileReply sfr; + static const OSType sftypes[] = { 'Sess', 0, 0, 0 }; + void *sesshandle; + + 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); + s->back = &loop_backend; + mac_startsession(s); + return; + + fail: + sfree(s); + return; +} + +void mac_startsession(Session *s) +{ + UInt32 starttime; + char msg[128]; + /* XXX: Own storage management? */ if (HAVE_COLOR_QD()) s->window = GetNewCWindow(wTerminal, NULL, (WindowPtr)-1);