Fix "-v" in the Windows console utilities (plink, pscp, psftp).
authorjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Tue, 21 Jan 2003 19:18:06 +0000 (19:18 +0000)
committerjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Tue, 21 Jan 2003 19:18:06 +0000 (19:18 +0000)
I'm not convinced I've done this the right way (I've introduced a static for
logctx in console.c) but it will do for now.

git-svn-id: svn://svn.tartarus.org/sgt/putty@2674 cda61777-01e9-0310-a592-d414129be87e

console.c
plink.c
psftp.c
putty.h
scp.c

index c9284b1..27366de 100644 (file)
--- a/console.c
+++ b/console.c
@@ -15,6 +15,8 @@
 
 int console_batch_mode = FALSE;
 
+static void *console_logctx = NULL;
+
 /*
  * Clean up and exit.
  */
@@ -259,8 +261,15 @@ void old_keyfile_warning(void)
     fputs(message, stderr);
 }
 
+void console_provide_logctx(void *logctx)
+{
+    console_logctx = logctx;
+}
+
 void logevent(void *frontend, char *string)
 {
+    if (console_logctx)
+       log_eventlog(console_logctx, string);
 }
 
 int console_get_line(const char *prompt, char *str,
diff --git a/plink.c b/plink.c
index 76a974e..7bd1f90 100644 (file)
--- a/plink.c
+++ b/plink.c
@@ -548,6 +548,7 @@ int main(int argc, char **argv)
        }
        logctx = log_init(NULL, &cfg);
        back->provide_logctx(backhandle, logctx);
+       console_provide_logctx(logctx);
        sfree(realhost);
     }
     connopen = 1;
diff --git a/psftp.c b/psftp.c
index 2dc6e4c..2c97db2 100644 (file)
--- a/psftp.c
+++ b/psftp.c
@@ -1836,6 +1836,7 @@ static int psftp_connect(char *userhost, char *user, int portnumber)
     }
     logctx = log_init(NULL, &cfg);
     back->provide_logctx(backhandle, logctx);
+    console_provide_logctx(logctx);
     ssh_sftp_init();
     if (verbose && realhost != NULL)
        printf("Connected to %s\n", realhost);
diff --git a/putty.h b/putty.h
index da1fb87..52157e2 100644 (file)
--- a/putty.h
+++ b/putty.h
@@ -670,6 +670,7 @@ int askappend(void *frontend, char *filename);
  */
 extern int console_batch_mode;
 int console_get_line(const char *prompt, char *str, int maxlen, int is_pw);
+void console_provide_logctx(void *logctx);
 
 /*
  * Exports from printing.c.
diff --git a/scp.c b/scp.c
index c547667..cc09a46 100644 (file)
--- a/scp.c
+++ b/scp.c
@@ -580,6 +580,7 @@ static void do_cmd(char *host, char *user, char *cmd)
        bump("ssh_init: %s", err);
     logctx = log_init(NULL, &cfg);
     back->provide_logctx(backhandle, logctx);
+    console_provide_logctx(logctx);
     ssh_scp_init();
     if (verbose && realhost != NULL)
        tell_user(stderr, "Connected to %s\n", realhost);