aboutsummaryrefslogtreecommitdiffstats
path: root/shell/main.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-07-11 02:11:48 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-07-11 02:11:48 +0800
commit31fd01398cc76d3c00abbc05d419dfe873bc04c6 (patch)
tree35c238cdb2a8a68936fa659e5269e75ee0042b49 /shell/main.c
parentf9049cded460a9e316fa83ff1941970abfe0fd09 (diff)
parent10fef4ac0f4ef7dc907e8bfae9844d4e8be3d80d (diff)
downloadgsoc2013-evolution-31fd01398cc76d3c00abbc05d419dfe873bc04c6.tar
gsoc2013-evolution-31fd01398cc76d3c00abbc05d419dfe873bc04c6.tar.gz
gsoc2013-evolution-31fd01398cc76d3c00abbc05d419dfe873bc04c6.tar.bz2
gsoc2013-evolution-31fd01398cc76d3c00abbc05d419dfe873bc04c6.tar.lz
gsoc2013-evolution-31fd01398cc76d3c00abbc05d419dfe873bc04c6.tar.xz
gsoc2013-evolution-31fd01398cc76d3c00abbc05d419dfe873bc04c6.tar.zst
gsoc2013-evolution-31fd01398cc76d3c00abbc05d419dfe873bc04c6.zip
Merge branch 'master' into kill-bonobo
Conflicts: addressbook/util/addressbook.h calendar/gui/e-week-view-main-item.c configure.ac e-util/Makefile.am mail/em-account-editor.c mail/em-folder-selection-button.c shell/e-shell.c
Diffstat (limited to 'shell/main.c')
-rw-r--r--shell/main.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/shell/main.c b/shell/main.c
index 7a04cee149..b921dd87ec 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -28,6 +28,12 @@
#ifdef G_OS_WIN32
#define WIN32_LEAN_AND_MEAN
+#ifdef DATADIR
+#undef DATADIR
+#endif
+#include <io.h>
+#include <conio.h>
+#define _WIN32_WINNT 0x0500
#include <windows.h>
#endif
@@ -640,6 +646,28 @@ gint
main (gint argc, gchar **argv)
{
#ifdef G_OS_WIN32
+ if (fileno (stdout) != -1 &&
+ _get_osfhandle (fileno (stdout)) != -1)
+ {
+ /* stdout is fine, presumably redirected to a file or pipe */
+ }
+ else
+ {
+ typedef BOOL (* WINAPI AttachConsole_t) (DWORD);
+
+ AttachConsole_t p_AttachConsole =
+ (AttachConsole_t) GetProcAddress (GetModuleHandle ("kernel32.dll"), "AttachConsole");
+
+ if (p_AttachConsole != NULL && p_AttachConsole (ATTACH_PARENT_PROCESS))
+ {
+ freopen ("CONOUT$", "w", stdout);
+ dup2 (fileno (stdout), 1);
+ freopen ("CONOUT$", "w", stderr);
+ dup2 (fileno (stderr), 2);
+
+ }
+ }
+
extern void link_shutdown (void);
#endif