зеркало из https://github.com/microsoft/git.git
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>
This commit is contained in:
Родитель
27e3219f1a
Коммит
0dbbbc1e26
|
@ -1156,3 +1156,18 @@ int link(const char *oldpath, const char *newpath)
|
||||||
}
|
}
|
||||||
return 0;
|
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);
|
||||||
|
}
|
||||||
|
|
|
@ -38,6 +38,8 @@ struct passwd {
|
||||||
char *pw_dir;
|
char *pw_dir;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern char *getpass(const char *prompt);
|
||||||
|
|
||||||
struct pollfd {
|
struct pollfd {
|
||||||
int fd; /* file descriptor */
|
int fd; /* file descriptor */
|
||||||
short events; /* requested events */
|
short events; /* requested events */
|
||||||
|
|
Загрузка…
Ссылка в новой задаче