X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=mac%2Fmacevlog.c;h=9c99f69f19fc6fbeaac16231f3bef059ad3af2a6;hb=12e019bafc75cb441e965c63e15dfceeaf71ca1e;hp=5e3cf12392f1d7ba05f5fbe674fe25793c59917a;hpb=502d5b4e501a273bd4c30c8b24c58cdce3053e8c;p=PuTTY.git diff --git a/mac/macevlog.c b/mac/macevlog.c index 5e3cf123..9c99f69f 100644 --- a/mac/macevlog.c +++ b/mac/macevlog.c @@ -1,4 +1,4 @@ -/* $Id: macevlog.c,v 1.7 2003/04/12 21:06:34 ben Exp $ */ +/* $Id$ */ /* * Copyright (c) 2003 Ben Harris * All rights reserved. @@ -101,11 +101,21 @@ void mac_freeeventlog(Session *s) } } -void logevent(void *frontend, char *str) +void logevent(void *frontend, const char *str) { Session *s = frontend; ListBounds bounds, visible; Cell cell = { 0, 0 }; + char timebuf[40]; + struct tm tm; + char *string; + + tm=ltime(); + strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S\t", &tm); + + string=snewn(strlen(timebuf) + strlen(str) +1, char); + strcpy(string, timebuf); + strcat(string, str); if (s->eventlog == NULL) mac_createeventlog(s); @@ -122,10 +132,11 @@ void logevent(void *frontend, char *str) cell.v = bounds.bottom; LAddRow(1, cell.v, s->eventlog); - LSetCell(str, strlen(str), cell, s->eventlog); + LSetCell(string, strlen(string), cell, s->eventlog); /* ">=" and "2" because there can be a blank cell below the last one. */ if (visible.bottom >= bounds.bottom) LScroll(0, 2, s->eventlog); + sfree(string); } static void mac_draweventloggrowicon(Session *s)