Add support for "Duplicate Session", moving back-end selection into
[sgt/putty] / mac / macterm.c
index cbf54f5..4f4a9db 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: macterm.c,v 1.51 2003/01/18 16:54:25 ben Exp $ */
+/* $Id: macterm.c,v 1.53 2003/01/25 15:15:40 ben Exp $ */
 /*
  * Copyright (c) 1999 Simon Tatham
  * Copyright (c) 1999, 2002 Ben Harris
@@ -110,8 +110,23 @@ static RoutineDescriptor do_text_for_device_upp =
 void mac_startsession(Session *s)
 {
     char *errmsg;
+    int i;
 
     init_ucs(s);
+
+    /*
+     * 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");
+
     /* XXX: Own storage management? */
     if (HAVE_COLOR_QD())
        s->window = GetNewCWindow(wTerminal, NULL, (WindowPtr)-1);
@@ -400,6 +415,10 @@ void mac_adjusttermmenus(WindowPtr window) {
     long offset;
 
     s = (Session *)GetWRefCon(window);
+    menu = GetMenuHandle(mFile);
+    DisableItem(menu, iSave); /* XXX enable if modified */
+    EnableItem(menu, iSaveAs);
+    EnableItem(menu, iDuplicate);
     menu = GetMenuHandle(mEdit);
     EnableItem(menu, 0);
     DisableItem(menu, iUndo);