X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/786ccf058f6e251b99ffc5bce9b6e7b24fdedf67..2e96d5041e9e7a241d14305ae3e89637476c4968:/mac/macterm.c?ds=sidebyside diff --git a/mac/macterm.c b/mac/macterm.c index c91a7349..ff59e551 100644 --- a/mac/macterm.c +++ b/mac/macterm.c @@ -1,4 +1,4 @@ -/* $Id: macterm.c,v 1.37 2003/01/09 22:45:48 ben Exp $ */ +/* $Id: macterm.c,v 1.44 2003/01/12 16:11:27 ben Exp $ */ /* * Copyright (c) 1999 Simon Tatham * Copyright (c) 1999, 2002 Ben Harris @@ -109,35 +109,6 @@ static RoutineDescriptor do_text_for_device_upp = #define do_text_for_device_upp do_text_for_device #endif /* not TARGET_RT_MAC_CFM */ -static void inbuf_putc(Session *s, int c) { - char ch = c; - - from_backend(s->term, 0, &ch, 1); -} - -static void inbuf_putstr(Session *s, const char *c) { - - from_backend(s->term, 0, (char *)c, strlen(c)); -} - -static void display_resource(Session *s, unsigned long type, short id) { - Handle h; - int len; - char *t; - - h = GetResource(type, id); - if (h == NULL) - fatalbox("Can't get test resource"); - len = GetResourceSizeOnDisk(h); - DetachResource(h); - HNoPurge(h); - HLock(h); - t = *h; - from_backend(s->term, 0, t, len); - term_out(s->term); - DisposeHandle(h); -} - void mac_opensession(void) { Session *s; StandardFileReply sfr; @@ -179,8 +150,6 @@ void mac_opensession(void) { void mac_startsession(Session *s) { - UInt32 starttime; - char msg[128]; char *errmsg; /* XXX: Own storage management? */ @@ -200,13 +169,13 @@ void mac_startsession(Session *s) ActivatePalette(s->window); } - s->logctx = log_init(s); + s->logctx = log_init(s, &s->cfg); term_provide_logctx(s->term, s->logctx); - errmsg = s->back->init(s->term, &s->backhandle, s->cfg.host, s->cfg.port, - &s->realhost, s->cfg.tcp_nodelay); + errmsg = s->back->init(s->term, &s->backhandle, &s->cfg, s->cfg.host, + s->cfg.port, &s->realhost, s->cfg.tcp_nodelay); if (errmsg != NULL) - inbuf_putstr(s, errmsg); + fatalbox("%s", errmsg); s->back->provide_logctx(s->backhandle, s->logctx); term_provide_resize_fn(s->term, s->back->size, s->backhandle); @@ -218,14 +187,10 @@ void mac_startsession(Session *s) ldisc_send(s->ldisc, NULL, 0, 0);/* cause ldisc to notice changes */ ShowWindow(s->window); - starttime = TickCount(); - display_resource(s, 'pTST', 128); - sprintf(msg, "Elapsed ticks: %d\015\012", TickCount() - starttime); - inbuf_putstr(s, msg); - term_out(s->term); s->next = sesslist; s->prev = s->next->prev; - s->next->prev = &s->next; + if (s->next != NULL) + s->next->prev = &s->next; sesslist = s; } @@ -238,7 +203,7 @@ static void mac_initfont(Session *s) { OptionBits fbflags; SetPort(s->window); - macfont[0] = sprintf((char *)&macfont[1], "%s", s->cfg.font); + c2pstrcpy(macfont, s->cfg.font); GetFNum(macfont, &s->fontnum); TextFont(s->fontnum); TextFace(s->cfg.fontisbold ? bold : 0); @@ -1269,7 +1234,7 @@ void set_title(void *frontend, char *title) { Session *s = frontend; Str255 mactitle; - mactitle[0] = sprintf((char *)&mactitle[1], "%s", title); + c2pstrcpy(mactitle, title); SetWTitle(s->window, mactitle); } @@ -1402,9 +1367,12 @@ void get_window_pixels(void *frontend, int *x, int *y) char *get_window_title(void *frontend, int icon) { Session *s = frontend; + Str255 ptitle; + static char title[256]; - /* Erm, we don't save this at the moment */ - return ""; + GetWTitle(s->window, ptitle); + p2cstrcpy(title, ptitle); + return title; } /*