Mercurial > emacs
diff src/unexw32.c @ 14812:bdffcf3b695f
(WinMain): Allocate a console for stdout
and stderr if necessary.
author | Geoff Voelker <voelker@cs.washington.edu> |
---|---|
date | Sun, 17 Mar 1996 00:06:39 +0000 |
parents | ee40177f6c68 |
children | be6560506cce |
line wrap: on
line diff
--- a/src/unexw32.c Sat Mar 16 22:45:08 1996 +0000 +++ b/src/unexw32.c Sun Mar 17 00:06:39 1996 +0000 @@ -75,6 +75,9 @@ LPSTR _lpCmdLine; int _nCmdShow; { + int i, j, new_argc; + char **new_argv; + /* Need to parse command line */ hinst = _hinst; @@ -82,7 +85,26 @@ lpCmdLine = _lpCmdLine; nCmdShow = _nCmdShow; - return (main (__argc,__argv,_environ)); + new_argc = __argc; + new_argv = (char **) xmalloc (sizeof (char *) * new_argc); + if (!new_argv) + return main (__argc, __argv, _environ); + + for (i = j = 0; i < __argc; i++) + { + /* Allocate a console window for stdout and stderr if requested. + We want to allocate as soon as we possibly can to catch + debugging output. */ + if (!strcmp ("-output_console", __argv[i])) + { + AllocConsole (); + new_argc--; + continue; + } + new_argv[j++] = __argv[i]; + } + + return main (new_argc, new_argv, _environ); } #endif /* HAVE_NTGUI */