summaryrefslogtreecommitdiff
path: root/compat/mingw.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2015-03-08 17:12:45 +0700
committerJunio C Hamano <gitster@pobox.com>2015-03-12 13:45:18 -0700
commit7b6aff0655c965959a59cc7fa3ed51c2a1fbcd44 (patch)
tree59173940684a1d6cd36d33be590ceac19d8cd927 /compat/mingw.c
parenta3ddcefd97b0e033eca045f07e0a262e1e7bb483 (diff)
downloadgit-7b6aff0655c965959a59cc7fa3ed51c2a1fbcd44.tar.gz
mingw32: add uname()
Helped-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat/mingw.c')
-rw-r--r--compat/mingw.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/compat/mingw.c b/compat/mingw.c
index 70f3191a4f..496e6f8bb0 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -2128,3 +2128,14 @@ void mingw_startup()
/* initialize Unicode console */
winansi_init();
}
+
+int uname(struct utsname *buf)
+{
+ DWORD v = GetVersion();
+ memset(buf, 0, sizeof(*buf));
+ strcpy(buf->sysname, "Windows");
+ sprintf(buf->release, "%u.%u", v & 0xff, (v >> 8) & 0xff);
+ /* assuming NT variants only.. */
+ sprintf(buf->version, "%u", (v >> 16) & 0x7fff);
+ return 0;
+}