#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
+#include <time.h>
#include "ssh.h"
#include "putty.h"
switch (msg) {
case WM_INITDIALOG:
+ {
+ static int tabs[4] = {78, 108};
+ SendDlgItemMessage (hwnd, IDN_LIST, LB_SETTABSTOPS, 2,
+ (LPARAM) tabs);
+ }
for (i=0; i<nevents; i++)
SendDlgItemMessage (hwnd, IDN_LIST, LB_ADDSTRING,
0, (LPARAM)events[i]);
}
void logevent (char *string) {
+ char timebuf[40];
+ time_t t;
+
if (nevents >= negsize) {
negsize += 64;
events = srealloc (events, negsize * sizeof(*events));
}
- events[nevents] = smalloc(1+strlen(string));
- strcpy (events[nevents], string);
- nevents++;
+
+ time(&t);
+ strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S\t", localtime(&t));
+
+ events[nevents] = smalloc(strlen(timebuf)+strlen(string)+1);
+ strcpy(events[nevents], timebuf);
+ strcat(events[nevents], string);
if (logbox) {
int count;
SendDlgItemMessage (logbox, IDN_LIST, LB_ADDSTRING,
- 0, (LPARAM)string);
+ 0, (LPARAM)events[nevents]);
count = SendDlgItemMessage (logbox, IDN_LIST, LB_GETCOUNT, 0, 0);
SendDlgItemMessage (logbox, IDN_LIST, LB_SETTOPINDEX, count-1, 0);
}
+ nevents++;
}
void showeventlog (HWND hwnd) {