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>
Johannes Schindelin committed
May 23, 2009 at 10:04 UTC
0dbbbc1e26c9979e34031c09c641893123d18450
2 files changed
+17
compat/mingw.c
+15
@@ -1156,3 +1156,18 @@ int link(const char *oldpath, const char *newpath)
1156
}
1157
return 0;
1158
}
1159
+
1160
+char *getpass(const char *prompt)
1161
+{
1162
+ struct strbuf buf = STRBUF_INIT;
1163
+
1164
+ fputs(prompt, stderr);
1165
+ for (;;) {
1166
+ char c = _getch();
1167
+ if (c == '\r' || c == '\n')
1168
+ break;
1169
+ strbuf_addch(&buf, c);
1170
+ }
1171
+ fputs("\n", stderr);
1172
+ return strbuf_detach(&buf, NULL);
1173
+}
compat/mingw.h
+2
@@ -38,6 +38,8 @@ struct passwd {
38
char *pw_dir;
39
};
40
41
+extern char *getpass(const char *prompt);
42
+
43
struct pollfd {
44
int fd; /* file descriptor */
45
short events; /* requested events */