]> asedeno.scripts.mit.edu Git - PuTTY.git/blobdiff - logging.c
Implement `Restart Session', in both Unix and Windows PuTTY. Largely
[PuTTY.git] / logging.c
index 6c4e1889d508140597c9bcfacfd5a03461cba3b5..5302998fe969b300b4c15b244e038091a5a6148c 100644 (file)
--- a/logging.c
+++ b/logging.c
@@ -34,6 +34,16 @@ void logtraffic(void *handle, unsigned char c, int logmode)
     }
 }
 
+/*
+ * Flush any open log file.
+ */
+void logflush(void *handle) {
+    struct LogContext *ctx = (struct LogContext *)handle;
+    if (ctx->cfg.logtype > 0)
+       if (ctx->lgfp)
+           fflush(ctx->lgfp);
+}
+
 /*
  * Log an Event Log entry. Used in SSH packet logging mode; this is
  * also as convenient a place as any to put the output of Event Log
@@ -43,7 +53,7 @@ void logtraffic(void *handle, unsigned char c, int logmode)
  * platforms. Platforms which don't have a meaningful stderr can
  * just avoid defining FLAG_STDERR.
  */
-void log_eventlog(void *handle, char *event)
+void log_eventlog(void *handle, const char *event)
 {
     struct LogContext *ctx = (struct LogContext *)handle;
     if ((flags & FLAG_STDERR) && (flags & FLAG_VERBOSE)) {
@@ -163,7 +173,7 @@ void logfclose(void *handle)
 
 void *log_init(void *frontend, Config *cfg)
 {
-    struct LogContext *ctx = smalloc(sizeof(struct LogContext));
+    struct LogContext *ctx = snew(struct LogContext);
     ctx->lgfp = NULL;
     ctx->frontend = frontend;
     ctx->cfg = *cfg;                  /* STRUCTURE COPY */
@@ -258,5 +268,5 @@ static void xlatlognam(Filename *dest, Filename src,
     }
     *d = '\0';
 
-    *dest = filename_from_str(d);
+    *dest = filename_from_str(buffer);
 }