{"thread":{"id":"32266","subject":"[PATCH v2 0/6] win32: support echo for terminal-prompt","startedAt":"2012-12-04T08:10:36Z","lastAt":"2012-12-04T08:10:42Z","messageCount":7,"participants":["Erik Faye-Lund"],"isPatch":true,"patchVersion":2,"patchTotal":6},"messages":[{"id":"204477","messageId":"1354608642-5316-1-git-send-email-kusmabite@gmail.com","threadId":"32266","inReplyTo":null,"subject":"[PATCH v2 0/6] win32: support echo for terminal-prompt","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2012-12-04T08:10:36Z","receivedAt":"2012-12-04T08:10:36Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"So here's v2 of this series. For reference, you can find v1 and\nit's discussions here: \n\nhttp://mid.gmane.org/1352815288-3996-1-git-send-email-kusmabite@gmail.com\n\nThe changes since the last round:\n * 1/6: This patch has been added. It was missing in the last round,\n        due to stupidity on my behalf. I'm sorry about that.\n * 3/6: This patch got a fixup for the disable_echo function signature\n        squashed in. I forgot \"void\" for the empty parameter list.\n\tThanks to Junio for noticing.\n\nOtherwise, things are unchanged.\n\nErik Faye-Lund (6):\n  mingw: correct exit-code for SIGALRM's SIG_DFL\n  mingw: make fgetc raise SIGINT if apropriate\n  compat/terminal: factor out echo-disabling\n  compat/terminal: separate input and output handles\n  mingw: reuse tty-version of git_terminal_prompt\n  mingw: get rid of getpass implementation\n\n compat/mingw.c    |  88 +++++++++++++++++++++++++++----------\n compat/mingw.h    |   8 +++-\n compat/terminal.c | 129 ++++++++++++++++++++++++++++++++++++++++--------------\n 3 files changed, 169 insertions(+), 56 deletions(-)\n\n-- \n1.8.0.4.g3c6fb4f.dirty\n\n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n"},{"id":"204478","messageId":"1354608642-5316-2-git-send-email-kusmabite@gmail.com","threadId":"32266","inReplyTo":"1354608642-5316-1-git-send-email-kusmabite@gmail.com","subject":"[PATCH v2 1/6] mingw: correct exit-code for SIGALRM's SIG_DFL","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2012-12-04T08:10:37Z","receivedAt":"2012-12-04T08:10:37Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"Make sure SIG_DFL for SIGALRM exits with 128 + SIGALRM so other\nprocesses can diagnose why it exits.\n\nWhile we're at it, make sure we only write to stderr if it's a\nterminal, and  change the output to match that of Linux.\n\nSigned-off-by: Erik Faye-Lund <kusmabite@gmail.com>\n---\n compat/mingw.c | 7 +++++--\n 1 file changed, 5 insertions(+), 2 deletions(-)\n\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex afc892d..78e8f54 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -1538,8 +1538,11 @@ static sig_handler_t timer_fn = SIG_DFL;\n static unsigned __stdcall ticktack(void *dummy)\n {\n \twhile (WaitForSingleObject(timer_event, timer_interval) == WAIT_TIMEOUT) {\n-\t\tif (timer_fn == SIG_DFL)\n-\t\t\tdie(\"Alarm\");\n+\t\tif (timer_fn == SIG_DFL) {\n+\t\t\tif (isatty(STDERR_FILENO))\n+\t\t\t\tfputs(\"Alarm clock\\n\", stderr);\n+\t\t\texit(128 + SIGALRM);\n+\t\t}\n \t\tif (timer_fn != SIG_IGN)\n \t\t\ttimer_fn(SIGALRM);\n \t\tif (one_shot)\n-- \n1.8.0.4.g3c6fb4f.dirty\n\n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n"},{"id":"204479","messageId":"1354608642-5316-3-git-send-email-kusmabite@gmail.com","threadId":"32266","inReplyTo":"1354608642-5316-1-git-send-email-kusmabite@gmail.com","subject":"[PATCH v2 2/6] mingw: make fgetc raise SIGINT if apropriate","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2012-12-04T08:10:38Z","receivedAt":"2012-12-04T08:10:38Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"Set a control-handler to prevent the process from terminating, and\nsimulate SIGINT so it can be handled by a signal-handler as usual.\n\nSigned-off-by: Erik Faye-Lund <kusmabite@gmail.com>\n---\n compat/mingw.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++--------\n compat/mingw.h |  6 +++++\n 2 files changed, 72 insertions(+), 10 deletions(-)\n\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex 78e8f54..33ddfdf 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -319,6 +319,31 @@ ssize_t mingw_write(int fd, const void *buf, size_t count)\n \treturn write(fd, buf, min(count, 31 * 1024 * 1024));\n }\n \n+static BOOL WINAPI ctrl_ignore(DWORD type)\n+{\n+\treturn TRUE;\n+}\n+\n+#undef fgetc\n+int mingw_fgetc(FILE *stream)\n+{\n+\tint ch;\n+\tif (!isatty(_fileno(stream)))\n+\t\treturn fgetc(stream);\n+\n+\tSetConsoleCtrlHandler(ctrl_ignore, TRUE);\n+\twhile (1) {\n+\t\tch = fgetc(stream);\n+\t\tif (ch != EOF || GetLastError() != ERROR_OPERATION_ABORTED)\n+\t\t\tbreak;\n+\n+\t\t/* Ctrl+C was pressed, simulate SIGINT and retry */\n+\t\tmingw_raise(SIGINT);\n+\t}\n+\tSetConsoleCtrlHandler(ctrl_ignore, FALSE);\n+\treturn ch;\n+}\n+\n #undef fopen\n FILE *mingw_fopen (const char *filename, const char *otype)\n {\n@@ -1524,7 +1549,7 @@ static HANDLE timer_event;\n static HANDLE timer_thread;\n static int timer_interval;\n static int one_shot;\n-static sig_handler_t timer_fn = SIG_DFL;\n+static sig_handler_t timer_fn = SIG_DFL, sigint_fn = SIG_DFL;\n \n /* The timer works like this:\n  * The thread, ticktack(), is a trivial routine that most of the time\n@@ -1538,13 +1563,7 @@ static sig_handler_t timer_fn = SIG_DFL;\n static unsigned __stdcall ticktack(void *dummy)\n {\n \twhile (WaitForSingleObject(timer_event, timer_interval) == WAIT_TIMEOUT) {\n-\t\tif (timer_fn == SIG_DFL) {\n-\t\t\tif (isatty(STDERR_FILENO))\n-\t\t\t\tfputs(\"Alarm clock\\n\", stderr);\n-\t\t\texit(128 + SIGALRM);\n-\t\t}\n-\t\tif (timer_fn != SIG_IGN)\n-\t\t\ttimer_fn(SIGALRM);\n+\t\tmingw_raise(SIGALRM);\n \t\tif (one_shot)\n \t\t\tbreak;\n \t}\n@@ -1635,12 +1654,49 @@ int sigaction(int sig, struct sigaction *in, struct sigaction *out)\n sig_handler_t mingw_signal(int sig, sig_handler_t handler)\n {\n \tsig_handler_t old = timer_fn;\n-\tif (sig != SIGALRM)\n+\n+\tswitch (sig) {\n+\tcase SIGALRM:\n+\t\ttimer_fn = handler;\n+\t\tbreak;\n+\n+\tcase SIGINT:\n+\t\tsigint_fn = handler;\n+\t\tbreak;\n+\n+\tdefault:\n \t\treturn signal(sig, handler);\n-\ttimer_fn = handler;\n+\t}\n+\n \treturn old;\n }\n \n+#undef raise\n+int mingw_raise(int sig)\n+{\n+\tswitch (sig) {\n+\tcase SIGALRM:\n+\t\tif (timer_fn == SIG_DFL) {\n+\t\t\tif (isatty(STDERR_FILENO))\n+\t\t\t\tfputs(\"Alarm clock\\n\", stderr);\n+\t\t\texit(128 + SIGALRM);\n+\t\t} else if (timer_fn != SIG_IGN)\n+\t\t\ttimer_fn(SIGALRM);\n+\t\treturn 0;\n+\n+\tcase SIGINT:\n+\t\tif (sigint_fn == SIG_DFL)\n+\t\t\texit(128 + SIGINT);\n+\t\telse if (sigint_fn != SIG_IGN)\n+\t\t\tsigint_fn(SIGINT);\n+\t\treturn 0;\n+\n+\tdefault:\n+\t\treturn raise(sig);\n+\t}\n+}\n+\n+\n static const char *make_backslash_path(const char *path)\n {\n \tstatic char buf[PATH_MAX + 1];\ndiff --git a/compat/mingw.h b/compat/mingw.h\nindex 61a6521..6b9e69a 100644\n--- a/compat/mingw.h\n+++ b/compat/mingw.h\n@@ -179,6 +179,9 @@ int mingw_open (const char *filename, int oflags, ...);\n ssize_t mingw_write(int fd, const void *buf, size_t count);\n #define write mingw_write\n \n+int mingw_fgetc(FILE *stream);\n+#define fgetc mingw_fgetc\n+\n FILE *mingw_fopen (const char *filename, const char *otype);\n #define fopen mingw_fopen\n \n@@ -287,6 +290,9 @@ static inline unsigned int git_ntohl(unsigned int x)\n sig_handler_t mingw_signal(int sig, sig_handler_t handler);\n #define signal mingw_signal\n \n+int mingw_raise(int sig);\n+#define raise mingw_raise\n+\n /*\n  * ANSI emulation wrappers\n  */\n-- \n1.8.0.4.g3c6fb4f.dirty\n\n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n"},{"id":"204480","messageId":"1354608642-5316-4-git-send-email-kusmabite@gmail.com","threadId":"32266","inReplyTo":"1354608642-5316-1-git-send-email-kusmabite@gmail.com","subject":"[PATCH v2 3/6] compat/terminal: factor out echo-disabling","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2012-12-04T08:10:39Z","receivedAt":"2012-12-04T08:10:39Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"By moving the echo-disabling code to a separate function, we can\nimplement OS-specific versions of it for non-POSIX platforms.\n\nSigned-off-by: Erik Faye-Lund <kusmabite@gmail.com>\n---\n compat/terminal.c | 43 +++++++++++++++++++++++++------------------\n 1 file changed, 25 insertions(+), 18 deletions(-)\n\ndiff --git a/compat/terminal.c b/compat/terminal.c\nindex bbb038d..a6212ca 100644\n--- a/compat/terminal.c\n+++ b/compat/terminal.c\n@@ -14,6 +14,7 @@ static void restore_term(void)\n \t\treturn;\n \n \ttcsetattr(term_fd, TCSAFLUSH, &old_term);\n+\tclose(term_fd);\n \tterm_fd = -1;\n }\n \n@@ -24,6 +25,27 @@ static void restore_term_on_signal(int sig)\n \traise(sig);\n }\n \n+static int disable_echo(void)\n+{\n+\tstruct termios t;\n+\n+\tterm_fd = open(\"/dev/tty\", O_RDWR);\n+\tif (tcgetattr(term_fd, &t) < 0)\n+\t\tgoto error;\n+\n+\told_term = t;\n+\tsigchain_push_common(restore_term_on_signal);\n+\n+\tt.c_lflag &= ~ECHO;\n+\tif (!tcsetattr(term_fd, TCSAFLUSH, &t))\n+\t\treturn 0;\n+\n+error:\n+\tclose(term_fd);\n+\tterm_fd = -1;\n+\treturn -1;\n+}\n+\n char *git_terminal_prompt(const char *prompt, int echo)\n {\n \tstatic struct strbuf buf = STRBUF_INIT;\n@@ -34,24 +56,9 @@ char *git_terminal_prompt(const char *prompt, int echo)\n \tif (!fh)\n \t\treturn NULL;\n \n-\tif (!echo) {\n-\t\tstruct termios t;\n-\n-\t\tif (tcgetattr(fileno(fh), &t) < 0) {\n-\t\t\tfclose(fh);\n-\t\t\treturn NULL;\n-\t\t}\n-\n-\t\told_term = t;\n-\t\tterm_fd = fileno(fh);\n-\t\tsigchain_push_common(restore_term_on_signal);\n-\n-\t\tt.c_lflag &= ~ECHO;\n-\t\tif (tcsetattr(fileno(fh), TCSAFLUSH, &t) < 0) {\n-\t\t\tterm_fd = -1;\n-\t\t\tfclose(fh);\n-\t\t\treturn NULL;\n-\t\t}\n+\tif (!echo && disable_echo()) {\n+\t\tfclose(fh);\n+\t\treturn NULL;\n \t}\n \n \tfputs(prompt, fh);\n-- \n1.8.0.4.g3c6fb4f.dirty\n\n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n"},{"id":"204481","messageId":"1354608642-5316-5-git-send-email-kusmabite@gmail.com","threadId":"32266","inReplyTo":"1354608642-5316-1-git-send-email-kusmabite@gmail.com","subject":"[PATCH v2 4/6] compat/terminal: separate input and output handles","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2012-12-04T08:10:40Z","receivedAt":"2012-12-04T08:10:40Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"On Windows, the terminal cannot be opened in read-write mode, so\nwe need distinct pairs for reading and writing. Since this works\nfine on other platforms as well, always open them in pairs.\n\nSigned-off-by: Erik Faye-Lund <kusmabite@gmail.com>\n---\n compat/terminal.c | 29 ++++++++++++++++++-----------\n 1 file changed, 18 insertions(+), 11 deletions(-)\n\ndiff --git a/compat/terminal.c b/compat/terminal.c\nindex a6212ca..9aecad6 100644\n--- a/compat/terminal.c\n+++ b/compat/terminal.c\n@@ -50,29 +50,36 @@ char *git_terminal_prompt(const char *prompt, int echo)\n {\n \tstatic struct strbuf buf = STRBUF_INIT;\n \tint r;\n-\tFILE *fh;\n+\tFILE *input_fh, *output_fh;\n \n-\tfh = fopen(\"/dev/tty\", \"w+\");\n-\tif (!fh)\n+\tinput_fh = fopen(\"/dev/tty\", \"r\");\n+\tif (!input_fh)\n \t\treturn NULL;\n \n+\toutput_fh = fopen(\"/dev/tty\", \"w\");\n+\tif (!output_fh) {\n+\t\tfclose(input_fh);\n+\t\treturn NULL;\n+\t}\n+\n \tif (!echo && disable_echo()) {\n-\t\tfclose(fh);\n+\t\tfclose(input_fh);\n+\t\tfclose(output_fh);\n \t\treturn NULL;\n \t}\n \n-\tfputs(prompt, fh);\n-\tfflush(fh);\n+\tfputs(prompt, output_fh);\n+\tfflush(output_fh);\n \n-\tr = strbuf_getline(&buf, fh, '\\n');\n+\tr = strbuf_getline(&buf, input_fh, '\\n');\n \tif (!echo) {\n-\t\tfseek(fh, SEEK_CUR, 0);\n-\t\tputc('\\n', fh);\n-\t\tfflush(fh);\n+\t\tputc('\\n', output_fh);\n+\t\tfflush(output_fh);\n \t}\n \n \trestore_term();\n-\tfclose(fh);\n+\tfclose(input_fh);\n+\tfclose(output_fh);\n \n \tif (r == EOF)\n \t\treturn NULL;\n-- \n1.8.0.4.g3c6fb4f.dirty\n\n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n"},{"id":"204483","messageId":"1354608642-5316-6-git-send-email-kusmabite@gmail.com","threadId":"32266","inReplyTo":"1354608642-5316-1-git-send-email-kusmabite@gmail.com","subject":"[PATCH v2 5/6] mingw: reuse tty-version of git_terminal_prompt","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2012-12-04T08:10:41Z","receivedAt":"2012-12-04T08:10:41Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"The getpass-implementation we use on Windows isn't at all ideal;\nit works in raw-mode (as opposed to cooked mode), and as a result\ndoes not deal correcly with deletion, arrow-keys etc.\n\nInstead, use cooked mode to read a line at the time, allowing the\nC run-time to process the input properly.\n\nSince we set files to be opened in binary-mode by default on\nWindows, introduce a FORCE_TEXT macro that expands to the \"t\"\nmodifier that forces the terminal to be opened in text-mode so we\ndo not have to deal with CRLF issues.\n\nSigned-off-by: Erik Faye-Lund <kusmabite@gmail.com>\n---\n compat/terminal.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++--------\n 1 file changed, 60 insertions(+), 9 deletions(-)\n\ndiff --git a/compat/terminal.c b/compat/terminal.c\nindex 9aecad6..9b5e3d1 100644\n--- a/compat/terminal.c\n+++ b/compat/terminal.c\n@@ -3,8 +3,22 @@\n #include \"sigchain.h\"\n #include \"strbuf.h\"\n \n+#if defined(HAVE_DEV_TTY) || defined(WIN32)\n+\n+static void restore_term(void);\n+\n+static void restore_term_on_signal(int sig)\n+{\n+\trestore_term();\n+\tsigchain_pop(sig);\n+\traise(sig);\n+}\n+\n #ifdef HAVE_DEV_TTY\n \n+#define INPUT_PATH \"/dev/tty\"\n+#define OUTPUT_PATH \"/dev/tty\"\n+\n static int term_fd = -1;\n static struct termios old_term;\n \n@@ -18,13 +32,6 @@ static void restore_term(void)\n \tterm_fd = -1;\n }\n \n-static void restore_term_on_signal(int sig)\n-{\n-\trestore_term();\n-\tsigchain_pop(sig);\n-\traise(sig);\n-}\n-\n static int disable_echo(void)\n {\n \tstruct termios t;\n@@ -46,17 +53,61 @@ error:\n \treturn -1;\n }\n \n+#elif defined(WIN32)\n+\n+#define INPUT_PATH \"CONIN$\"\n+#define OUTPUT_PATH \"CONOUT$\"\n+#define FORCE_TEXT \"t\"\n+\n+static HANDLE hconin = INVALID_HANDLE_VALUE;\n+static DWORD cmode;\n+\n+static void restore_term(void)\n+{\n+\tif (hconin == INVALID_HANDLE_VALUE)\n+\t\treturn;\n+\n+\tSetConsoleMode(hconin, cmode);\n+\tCloseHandle(hconin);\n+\thconin = INVALID_HANDLE_VALUE;\n+}\n+\n+static int disable_echo(void)\n+{\n+\thconin = CreateFile(\"CONIN$\", GENERIC_READ | GENERIC_WRITE,\n+\t    FILE_SHARE_READ, NULL, OPEN_EXISTING,\n+\t    FILE_ATTRIBUTE_NORMAL, NULL);\n+\tif (hconin == INVALID_HANDLE_VALUE)\n+\t\treturn -1;\n+\n+\tGetConsoleMode(hconin, &cmode);\n+\tsigchain_push_common(restore_term_on_signal);\n+\tif (!SetConsoleMode(hconin, cmode & (~ENABLE_ECHO_INPUT))) {\n+\t\tCloseHandle(hconin);\n+\t\thconin = INVALID_HANDLE_VALUE;\n+\t\treturn -1;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+#endif\n+\n+#ifndef FORCE_TEXT\n+#define FORCE_TEXT\n+#endif\n+\n char *git_terminal_prompt(const char *prompt, int echo)\n {\n \tstatic struct strbuf buf = STRBUF_INIT;\n \tint r;\n \tFILE *input_fh, *output_fh;\n \n-\tinput_fh = fopen(\"/dev/tty\", \"r\");\n+\tinput_fh = fopen(INPUT_PATH, \"r\" FORCE_TEXT);\n \tif (!input_fh)\n \t\treturn NULL;\n \n-\toutput_fh = fopen(\"/dev/tty\", \"w\");\n+\toutput_fh = fopen(OUTPUT_PATH, \"w\" FORCE_TEXT);\n \tif (!output_fh) {\n \t\tfclose(input_fh);\n \t\treturn NULL;\n-- \n1.8.0.4.g3c6fb4f.dirty\n\n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n"},{"id":"204482","messageId":"1354608642-5316-7-git-send-email-kusmabite@gmail.com","threadId":"32266","inReplyTo":"1354608642-5316-1-git-send-email-kusmabite@gmail.com","subject":"[PATCH v2 6/6] mingw: get rid of getpass implementation","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2012-12-04T08:10:42Z","receivedAt":"2012-12-04T08:10:42Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"There's no remaining call-sites, and as pointed out in the\nprevious commit message, it's not quite ideal. So let's just\nlose it.\n\nSigned-off-by: Erik Faye-Lund <kusmabite@gmail.com>\n---\n compat/mingw.c | 15 ---------------\n compat/mingw.h |  2 --\n 2 files changed, 17 deletions(-)\n\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex 33ddfdf..5fc14b7 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -1758,21 +1758,6 @@ int link(const char *oldpath, const char *newpath)\n \treturn 0;\n }\n \n-char *getpass(const char *prompt)\n-{\n-\tstruct strbuf buf = STRBUF_INIT;\n-\n-\tfputs(prompt, stderr);\n-\tfor (;;) {\n-\t\tchar c = _getch();\n-\t\tif (c == '\\r' || c == '\\n')\n-\t\t\tbreak;\n-\t\tstrbuf_addch(&buf, c);\n-\t}\n-\tfputs(\"\\n\", stderr);\n-\treturn strbuf_detach(&buf, NULL);\n-}\n-\n pid_t waitpid(pid_t pid, int *status, int options)\n {\n \tHANDLE h = OpenProcess(SYNCHRONIZE | PROCESS_QUERY_INFORMATION,\ndiff --git a/compat/mingw.h b/compat/mingw.h\nindex 6b9e69a..f494ecb 100644\n--- a/compat/mingw.h\n+++ b/compat/mingw.h\n@@ -55,8 +55,6 @@ struct passwd {\n \tchar *pw_dir;\n };\n \n-extern char *getpass(const char *prompt);\n-\n typedef void (__cdecl *sig_handler_t)(int);\n struct sigaction {\n \tsig_handler_t sa_handler;\n-- \n1.8.0.4.g3c6fb4f.dirty\n\n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n"}]}