[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-wget] [Win32 Patch] console-close events
From: |
Darshit Shah |
Subject: |
Re: [Bug-wget] [Win32 Patch] console-close events |
Date: |
Wed, 18 Jun 2014 15:31:42 +0530 |
On Tue, Jun 17, 2014 at 4:36 AM, Gisle Vanem <address@hidden> wrote:
> "Ángel González" <address@hidden> wrote:
>
>>> + event == CTRL_SHUTDOWN_EVENT ? "CTRL_SHUTDOWN_EVENT" :
>>> + "?");
>>
>> Better something like "UNKNOWN EVENT" ?
>
>
> Ok. That seems better.
>
>
>>> PS. The above Sleep() seems to be ignored by WinCon. At least I failed to
>>> make it sleep more than ~500 msec.
>>
>> There may be a timeout on how long you can stay processing the event.
>>
>> Why do you need that Sleep() call at all? I would remove it.
>
>
> When logging to the console (no '-o log-file' option), the Sleep(500) will
> make
> the final "... cleanup." message stay a tiny bit longer (but barely
> readable).
> Without a Sleep(), the console gets closed with only a message-beep.
>
>
>> Thanks for sharing your patch!
>
>
> Thanks for the interest. Do you build Wget on Win32? Anybody else
> except me build and care about Wget/Win32 here?
>
Hi Gisle,
I don't really use Windows any more, but I do care to see Wget ported
to as many systems as possible. Some time ago, I did try to build Wget
on a Win32 system, but failed miserably.I just couldn't understand the
build process. The only reason I intend to build Wget on Windows is to
test it out for bugs and other things. If you have some klnd of a
guide one can follow to build Wget on a Windows system, I'll be glad
to have it.
> Revised patch:
>
> --- mswindows.c.orig 2014-06-12 13:02:44 +0000
> +++ mswindows.c 2014-06-17 00:58:08 +0000
>
> @@ -42,6 +42,7 @@
>
> #include "utils.h"
> #include "url.h"
> +#include "init.h"
>
> #ifndef ES_SYSTEM_REQUIRED
> #define ES_SYSTEM_REQUIRED 0x00000001
> @@ -337,6 +338,17 @@
> /* If we get here, we're the child. */
> }
>
> +/* Return the name for the console-events we might receive. */
> +static const char *ws_event_name (DWORD event)
> +{
> + return (event == CTRL_C_EVENT ? "CTRL_C_EVENT" :
> + event == CTRL_BREAK_EVENT ? "CTRL_BREAK_EVENT" :
> + event == CTRL_CLOSE_EVENT ? "CTRL_CLOSE_EVENT" :
> + event == CTRL_LOGOFF_EVENT ? "CTRL_LOGOFF_EVENT" :
> + event == CTRL_SHUTDOWN_EVENT ? "CTRL_SHUTDOWN_EVENT" :
> + "UNKNOWN EVENT");
> +}
>
> +
> static BOOL WINAPI
> ws_handler (DWORD dwEvent)
> {
> @@ -352,6 +364,16 @@
> ws_hangup ("CTRL+Break");
> return TRUE;
> #endif
> + case CTRL_CLOSE_EVENT:
> + case CTRL_LOGOFF_EVENT:
> + case CTRL_SHUTDOWN_EVENT:
> + MessageBeep (MB_OK);
> + logprintf (LOG_NOTQUIET, _("\nGot %s. Performing cleanup.\n"),
>
> + ws_event_name(dwEvent));
> + cleanup();
> + Sleep(500);
> + return TRUE;
> +
> default:
> return FALSE;
> }
>
> ----------------------------------
>
> --gv
>
>
--
Thanking You,
Darshit Shah