tProper handling of startup messages under Win32 - vaccinewars - be a doctor and try to vaccinate the world
 (HTM) git clone git://src.adamsgaard.dk/vaccinewars
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 77dac8e5d09edd00cafc3553dc81f837d13f6887
 (DIR) parent 73f41fda91d2f4173ab3984a795aedf7fa1d7de2
 (HTM) Author: Ben Webb <ben@salilab.org>
       Date:   Sat, 28 Apr 2001 17:46:06 +0000
       
       Proper handling of startup messages under Win32
       
       
       Diffstat:
         M src/winmain.c                       |      26 ++++++++++++++++++++++++--
       
       1 file changed, 24 insertions(+), 2 deletions(-)
       ---
 (DIR) diff --git a/src/winmain.c b/src/winmain.c
       t@@ -76,6 +76,20 @@ static void WindowPrintEnd() {
           TextOutput=NULL;
        }
        
       +static FILE *LogFile=NULL;
       +
       +static void LogFileStart() {
       +   LogFile=fopen("dopewars-log.txt","w");
       +}
       +
       +static void LogFilePrintFunc(const gchar *string) {
       +   if (LogFile) fprintf(LogFile,string);
       +}
       +
       +static void LogFileEnd() {
       +   if (LogFile) fclose(LogFile);
       +}
       +
        int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,
                             LPSTR lpszCmdParam,int nCmdShow) {
           gchar **split;
       t@@ -85,12 +99,18 @@ int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,
           bindtextdomain(PACKAGE,LOCALEDIR);
           textdomain(PACKAGE);
        #endif
       -   g_log_set_handler(NULL,G_LOG_LEVEL_MESSAGE|G_LOG_LEVEL_WARNING,
       -                     LogMessage,NULL);
       +   g_log_set_handler(NULL,G_LOG_LEVEL_MESSAGE|G_LOG_LEVEL_WARNING|
       +                     G_LOG_LEVEL_CRITICAL,LogMessage,NULL);
           split=g_strsplit(lpszCmdParam," ",0);
           argc=0;
           while (split[argc] && split[argc][0]) argc++;
       +   LogFileStart();
       +   g_set_print_handler(LogFilePrintFunc);
       +   g_print(_("# This is the dopewars startup log, containing any\n"
       +             "# informative messages resulting from configuration\n"
       +             "# file processing and the like.\n\n"));
           if (GeneralStartup(argc,split)==0) {
       +      LogFileEnd();
              if (WantVersion || WantHelp) {
                 WindowPrintStart();
                 g_set_print_handler(WindowPrintFunc);
       t@@ -129,6 +149,8 @@ int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,
                 }
                 StopNetworking();
              }
       +   } else {
       +      LogFileEnd();
           }
           g_strfreev(split);
           CloseHighScoreFile();