mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
[svn] Fixed bugs in Windows console event handling.
Submitted by David Fritz.
This commit is contained in:
parent
dd9a354756
commit
1b6479a39a
@ -1,3 +1,13 @@
|
|||||||
|
2004-03-19 David Fritz <zeroxdf@att.net>
|
||||||
|
|
||||||
|
* mswindows.c (ws_hangup): Incorporate old fork_to_background()
|
||||||
|
code. Add event name argument.
|
||||||
|
(fork_to_backgorund): Now a simple wrapper around ws_hangup().
|
||||||
|
(ws_handler): Correctly handle the case when neither CTRLC_BACKGND
|
||||||
|
nor CTRLBREAK_BACKGND are defined. Don't bother handling close,
|
||||||
|
logoff, or shutdown events. Call ws_hangup() with the correct
|
||||||
|
event name; don't assume it was CTRL+Break.
|
||||||
|
|
||||||
2004-03-19 Hrvoje Niksic <hniksic@xemacs.org>
|
2004-03-19 Hrvoje Niksic <hniksic@xemacs.org>
|
||||||
|
|
||||||
* url.c (url_parse): Decode %HH sequences in host name.
|
* url.c (url_parse): Decode %HH sequences in host name.
|
||||||
|
@ -70,8 +70,6 @@ extern int errno;
|
|||||||
/* Defined in log.c. */
|
/* Defined in log.c. */
|
||||||
void log_request_redirect_output PARAMS ((const char *));
|
void log_request_redirect_output PARAMS ((const char *));
|
||||||
|
|
||||||
static int windows_nt_p;
|
|
||||||
|
|
||||||
/* Windows version of xsleep in utils.c. */
|
/* Windows version of xsleep in utils.c. */
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -109,13 +107,7 @@ ws_cleanup (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ws_hangup (void)
|
ws_hangup (const char *reason)
|
||||||
{
|
|
||||||
log_request_redirect_output ("CTRL+Break");
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
fork_to_background (void)
|
|
||||||
{
|
{
|
||||||
/* Whether we arrange our own version of opt.lfilename here. */
|
/* Whether we arrange our own version of opt.lfilename here. */
|
||||||
int changedp = 0;
|
int changedp = 0;
|
||||||
@ -129,11 +121,22 @@ fork_to_background (void)
|
|||||||
if (changedp)
|
if (changedp)
|
||||||
printf (_("Output will be written to `%s'.\n"), opt.lfilename);
|
printf (_("Output will be written to `%s'.\n"), opt.lfilename);
|
||||||
|
|
||||||
ws_hangup ();
|
log_request_redirect_output (reason);
|
||||||
if (!windows_nt_p)
|
|
||||||
|
/* Detach process from the current console. Under Windows 9x, if we
|
||||||
|
were launched from a 16-bit process (which is usually the case;
|
||||||
|
command.com is 16-bit) the parent process should resume right away.
|
||||||
|
Under NT or if launched from a 32-process under 9x, this is a futile
|
||||||
|
gesture as the parent will wait for us to terminate before resuming. */
|
||||||
FreeConsole ();
|
FreeConsole ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
fork_to_background (void)
|
||||||
|
{
|
||||||
|
ws_hangup ("fork");
|
||||||
|
}
|
||||||
|
|
||||||
static BOOL WINAPI
|
static BOOL WINAPI
|
||||||
ws_handler (DWORD dwEvent)
|
ws_handler (DWORD dwEvent)
|
||||||
{
|
{
|
||||||
@ -141,20 +144,17 @@ ws_handler (DWORD dwEvent)
|
|||||||
{
|
{
|
||||||
#ifdef CTRLC_BACKGND
|
#ifdef CTRLC_BACKGND
|
||||||
case CTRL_C_EVENT:
|
case CTRL_C_EVENT:
|
||||||
|
ws_hangup ("CTRL+C");
|
||||||
|
return TRUE;
|
||||||
#endif
|
#endif
|
||||||
#ifdef CTRLBREAK_BACKGND
|
#ifdef CTRLBREAK_BACKGND
|
||||||
case CTRL_BREAK_EVENT:
|
case CTRL_BREAK_EVENT:
|
||||||
|
ws_hangup ("CTRL+Break");
|
||||||
|
return TRUE;
|
||||||
#endif
|
#endif
|
||||||
fork_to_background ();
|
|
||||||
break;
|
|
||||||
case CTRL_SHUTDOWN_EVENT:
|
|
||||||
case CTRL_CLOSE_EVENT:
|
|
||||||
case CTRL_LOGOFF_EVENT:
|
|
||||||
default:
|
default:
|
||||||
ws_cleanup ();
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *title_buf = NULL;
|
static char *title_buf = NULL;
|
||||||
@ -257,11 +257,6 @@ ws_startup (void)
|
|||||||
WORD requested;
|
WORD requested;
|
||||||
WSADATA data;
|
WSADATA data;
|
||||||
int err;
|
int err;
|
||||||
OSVERSIONINFO os;
|
|
||||||
|
|
||||||
if (GetVersionEx (&os) == TRUE
|
|
||||||
&& os.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
|
|
||||||
windows_nt_p = 1;
|
|
||||||
|
|
||||||
requested = MAKEWORD (1, 1);
|
requested = MAKEWORD (1, 1);
|
||||||
err = WSAStartup (requested, &data);
|
err = WSAStartup (requested, &data);
|
||||||
|
Loading…
Reference in New Issue
Block a user