diff options
| author | Geoff Voelker | 1996-03-17 00:06:39 +0000 |
|---|---|---|
| committer | Geoff Voelker | 1996-03-17 00:06:39 +0000 |
| commit | 4fd8de53a19ff6f8b19dc4a7ec61d3f04eca0d70 (patch) | |
| tree | 689960135b2fc7a231caf3bd52e6f963eb6665ab /src | |
| parent | 6d511e9ff08ce5e2c893eb041fcef38a740a1955 (diff) | |
| download | emacs-4fd8de53a19ff6f8b19dc4a7ec61d3f04eca0d70.tar.gz emacs-4fd8de53a19ff6f8b19dc4a7ec61d3f04eca0d70.zip | |
(WinMain): Allocate a console for stdout
and stderr if necessary.
Diffstat (limited to 'src')
| -rw-r--r-- | src/unexw32.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/unexw32.c b/src/unexw32.c index 67555b2ad36..e00662a0fea 100644 --- a/src/unexw32.c +++ b/src/unexw32.c | |||
| @@ -75,6 +75,9 @@ WinMain (_hinst, _hPrevInst, _lpCmdLine, _nCmdShow) | |||
| 75 | LPSTR _lpCmdLine; | 75 | LPSTR _lpCmdLine; |
| 76 | int _nCmdShow; | 76 | int _nCmdShow; |
| 77 | { | 77 | { |
| 78 | int i, j, new_argc; | ||
| 79 | char **new_argv; | ||
| 80 | |||
| 78 | /* Need to parse command line */ | 81 | /* Need to parse command line */ |
| 79 | 82 | ||
| 80 | hinst = _hinst; | 83 | hinst = _hinst; |
| @@ -82,7 +85,26 @@ WinMain (_hinst, _hPrevInst, _lpCmdLine, _nCmdShow) | |||
| 82 | lpCmdLine = _lpCmdLine; | 85 | lpCmdLine = _lpCmdLine; |
| 83 | nCmdShow = _nCmdShow; | 86 | nCmdShow = _nCmdShow; |
| 84 | 87 | ||
| 85 | return (main (__argc,__argv,_environ)); | 88 | new_argc = __argc; |
| 89 | new_argv = (char **) xmalloc (sizeof (char *) * new_argc); | ||
| 90 | if (!new_argv) | ||
| 91 | return main (__argc, __argv, _environ); | ||
| 92 | |||
| 93 | for (i = j = 0; i < __argc; i++) | ||
| 94 | { | ||
| 95 | /* Allocate a console window for stdout and stderr if requested. | ||
| 96 | We want to allocate as soon as we possibly can to catch | ||
| 97 | debugging output. */ | ||
| 98 | if (!strcmp ("-output_console", __argv[i])) | ||
| 99 | { | ||
| 100 | AllocConsole (); | ||
| 101 | new_argc--; | ||
| 102 | continue; | ||
| 103 | } | ||
| 104 | new_argv[j++] = __argv[i]; | ||
| 105 | } | ||
| 106 | |||
| 107 | return main (new_argc, new_argv, _environ); | ||
| 86 | } | 108 | } |
| 87 | #endif /* HAVE_NTGUI */ | 109 | #endif /* HAVE_NTGUI */ |
| 88 | 110 | ||