On Mon, Feb 19, 2001 at 02:46:31PM -0800, Guy Harris wrote:
> The way to handle this might be to, in Ethereal on Windows, check
> whether it's built as a console or a GUI app (yes, it might be built as
> a console app - I build it as a console app when testing it), and, if
> it's a GUI app, call "g_log_set_handler()" to set a log handler for the
> default domain and all levels, and have that routine
>
> pop up a console if one hasn't already been popped up, and set
> "stdin" and "stdout" as per your patch;
>
> call "g_log_default_handler()" with the arguments passed into
> our handler.
Well, I checked in code to do that - except that calling
"g_log_default_handler()" doesn't actually cause any output to show up
in the console, so our handler just prints the raw message to the
standard output, rather than handing it off to
"g_log_default_handler()". That means it currently leaves all the
"WARNING", "ERROR", etc. tags and other decorations out of the message;
so it goes....
It appears that the Win32 GLib is, in theory, supposed to pop up the
console for you; in practice, it doesn't, which suggests that there's
all sorts of Win32-GUI-app breakage hiding in there.
(It also appears that, somehow, "atexit()" doesn't actually manage to
work, so I have to manually call the "print a 'type any key to exit'
message, wait for the user to press the 'Any' key, and then free the
console" routine before exiting. Sigh....)
The console is also popped up for "ethereal -v".