aboutsummaryrefslogtreecommitdiff
path: root/compat/mingw.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2009-05-23 10:04:50 +0200
committerJunio C Hamano <gitster@pobox.com>2009-05-23 01:54:45 -0700
commit0dbbbc1e26c9979e34031c09c641893123d18450 (patch)
tree4640176da8771b27fa2adb80206319233d1360eb /compat/mingw.c
parent27e3219f1a78d2d7035565aa7ace882dbc2baa97 (diff)
downloadgit-0dbbbc1e26c9979e34031c09c641893123d18450.tar.gz
git-0dbbbc1e26c9979e34031c09c641893123d18450.tar.xz
MinGW: Add a simple getpass()
We need getpass() to activate curl on MinGW. Although the default Makefile currently has 'NO_CURL = YesPlease', msysgit releases do provide curl support, so getpass() is used. [spr: - edited commit message. - squashed commit that provides getpass() declaration.] Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Steffen Prohaska <prohaska@zib.de> 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 b723c4dfd..e190fddf4 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -1156,3 +1156,18 @@ int link(const char *oldpath, const char *newpath)
}
return 0;
}
+
+char *getpass(const char *prompt)
+{
+ struct strbuf buf = STRBUF_INIT;
+
+ fputs(prompt, stderr);
+ for (;;) {
+ char c = _getch();
+ if (c == '\r' || c == '\n')
+ break;
+ strbuf_addch(&buf, c);
+ }
+ fputs("\n", stderr);
+ return strbuf_detach(&buf, NULL);
+}