git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 4/5] MinGW: Add a simple getpass()

From
Steffen Prohaska <prohaska@zib.de>
Date
May 23, 2009, 08:04 UTC
Message-ID
<1243065891-13270-5-git-send-email-prohaska@zib.de>
In-Reply-To
<1243065891-13270-4-git-send-email-prohaska@zib.de>
From: Johannes Schindelin <johannes.schindelin@gmx.de>

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>
---
 compat/mingw.c |   15 +++++++++++++++
 compat/mingw.h |    2 ++
 2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/compat/mingw.c b/compat/mingw.c
index b723c4d..e190fdd 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);
+}
diff --git a/compat/mingw.h b/compat/mingw.h
index b1156b8..4c50f5b 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -38,6 +38,8 @@ struct passwd {
 	char *pw_dir;
 };
 
+extern char *getpass(const char *prompt);
+
 struct pollfd {
 	int fd;           /* file descriptor */
 	short events;     /* requested events */
-- 
1.6.3.1.54.g99dd
Previous: Steffen ProhaskaNext: Steffen Prohaska
Message 5 of 6 in “A few minor MinGW changes”
  1. 0/5 A few minor MinGW changesSteffen Prohaska, May 23, 2009
  2. 1/5 MinGW: Scan for \r in addition to \n when reading shbang linesSteffen Prohaska, May 23, 2009
  3. 2/5 MinGW: the path separator to split GITPERLLIB is ';' on Win32Steffen Prohaska, May 23, 2009
  4. 3/5 MinGW: use POSIX signature of waitpid()Steffen Prohaska, May 23, 2009
  5. 4/5 MinGW: Add a simple getpass()Steffen Prohaska, May 23, 2009
  6. 5/5 MinGW: Fix compiler warning in merge-recursiveSteffen Prohaska, May 23, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.