Each platform's implementation of askappend() is no longer required
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Sun, 12 Jan 2003 13:44:35 +0000 (13:44 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Sun, 12 Jan 2003 13:44:35 +0000 (13:44 +0000)
to consult cfg.logxfovr, because it gets done once in logging.c.
askappend() is now called only when a question _really_ needs to be
asked of the user. Also in this checkin, cleanup_exit() in console.c
no longer consults cfg.protocol to decide whether to save the random
seed, because random_save_seed() can make that decision for itself
and do it better.

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

console.c
logging.c
unix/uxcons.c
windlg.c

index 703e683..c9284b1 100644 (file)
--- a/console.c
+++ b/console.c
@@ -26,12 +26,10 @@ void cleanup_exit(int code)
     sk_cleanup();
     WSACleanup();
 
-    if (cfg.protocol == PROT_SSH) {
-       random_save_seed();
+    random_save_seed();
 #ifdef MSCRYPTOAPI
-       crypto_wrapup();
+    crypto_wrapup();
 #endif
-    }
 
     exit(code);
 }
@@ -212,9 +210,6 @@ int askappend(void *frontend, char *filename)
 
     char line[32];
 
-    if (cfg.logxfovr != LGXF_ASK) {
-       return ((cfg.logxfovr == LGXF_OVR) ? 2 : 1);
-    }
     if (console_batch_mode) {
        fprintf(stderr, msgtemplate_batch, FILENAME_MAX, filename);
        fflush(stderr);
index 9e8b9f8..c2c4ff1 100644 (file)
--- a/logging.c
+++ b/logging.c
@@ -118,7 +118,10 @@ void logfopen(void *handle)
     if (ctx->lgfp) {
        int i;
        fclose(ctx->lgfp);
-       i = askappend(ctx->frontend, ctx->currlogfilename);
+       if (cfg.logxfovr != LGXF_ASK) {
+           i = ((cfg.logxfovr == LGXF_OVR) ? 2 : 1);
+       } else
+           i = askappend(ctx->frontend, ctx->currlogfilename);
        if (i == 1)
            writemod[0] = 'a';         /* set append mode */
        else if (i == 0) {             /* cancelled */
index 779ebf4..579178c 100644 (file)
@@ -204,9 +204,6 @@ int askappend(void *frontend, char *filename)
 
     char line[32];
 
-    if (cfg.logxfovr != LGXF_ASK) {
-       return ((cfg.logxfovr == LGXF_OVR) ? 2 : 1);
-    }
     if (console_batch_mode) {
        fprintf(stderr, msgtemplate_batch, FILENAME_MAX, filename);
        fflush(stderr);
index a8603e6..cb19e76 100644 (file)
--- a/windlg.c
+++ b/windlg.c
@@ -3951,9 +3951,7 @@ int askappend(void *frontend, char *filename)
        "or Cancel to disable logging.";
     char message[sizeof(msgtemplate) + FILENAME_MAX];
     int mbret;
-    if (cfg.logxfovr != LGXF_ASK) {
-       return ((cfg.logxfovr == LGXF_OVR) ? 2 : 1);
-    }
+
     sprintf(message, msgtemplate, FILENAME_MAX, filename);
 
     mbret = MessageBox(NULL, message, mbtitle,