aboutsummaryrefslogtreecommitdiff
path: root/compat/mingw.c
diff options
context:
space:
mode:
authorKarsten Blees <blees@dcon.de>2011-01-07 19:47:23 +0100
committerJunio C Hamano <gitster@pobox.com>2014-06-10 13:31:01 -0700
commit13f1df432ea78a9dda2e70036215f754db182934 (patch)
treeba9d167dc6da34fe6ef158e52b14799ee6e1d5ea /compat/mingw.c
parentc2369bdf7ff082d588c4a4efe280bc4a483d0192 (diff)
downloadgit-13f1df432ea78a9dda2e70036215f754db182934.tar.gz
git-13f1df432ea78a9dda2e70036215f754db182934.tar.xz
Win32: move main macro to a function
The code in the MinGW main macro is getting more and more complex, move to a separate initialization function for readabiliy and extensibility. Signed-off-by: Karsten Blees <blees@dcon.de> Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com> Signed-off-by: Stepan Kasal <kasal@ucw.cz> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat/mingw.c')
-rw-r--r--compat/mingw.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/compat/mingw.c b/compat/mingw.c
index a0e13bc86..c03bafa9c 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -1847,3 +1847,18 @@ int mingw_offset_1st_component(const char *path)
return offset + is_dir_sep(path[offset]);
}
+
+void mingw_startup()
+{
+ /* copy executable name to argv[0] */
+ __argv[0] = xstrdup(_pgmptr);
+
+ /* initialize critical section for waitpid pinfo_t list */
+ InitializeCriticalSection(&pinfo_cs);
+
+ /* set up default file mode and file modes for stdin/out/err */
+ _fmode = _O_BINARY;
+ _setmode(_fileno(stdin), _O_BINARY);
+ _setmode(_fileno(stdout), _O_BINARY);
+ _setmode(_fileno(stderr), _O_BINARY);
+}