From: Junio C Hamano <gitster@pobox.com>
To: kusmabite@gmail.com
Cc: Rafael Gieschke <rafael@gieschke.de>, git@vger.kernel.org
Subject: Re: [PATCH] compat: add a getpass() compatibility function
Date: Thu, 19 May 2011 10:27:39 -0700 [thread overview]
Message-ID: <7v62p68ut0.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <EC81F772-7149-40A0-891A-973C886AB052@gieschke.de> (Rafael Gieschke's message of "Thu, 19 May 2011 19:01:35 +0200")
Rafael Gieschke <rafael@gieschke.de> writes:
>> Windows doesn't have /dev/tty, but the logic in this version handles
>> that by using stdin/stderr instead. The signal-stuff has a comment
>> that indicates it might not even be correct. tcgetattr/tcsetattr isn't
>> supported on Windows, but it's not needed if we use getch (as the
>> version in compat/mingw.c does). POSIX/curses getch respects the
>> echo-setting, while Windows getch never echo.
Probably a properly abstracted common version would look like a function
that calls four platform-dependent helper funcions in this order:
0. prompt
1. start "noecho" mode
2. get whole line
3. exit "noecho" mode
where Windows may use stderr for 0, have noop() implementation for 1 and
3, use _getch() that does not echo for 2, while POSIX may write to
/dev/tty for 0, use tc[gs]etattr() with perhaps some signal settings
sprinkled in for 1 and 3.
So I don't see a need for Windows to emulate tc[g]setattr nor curses in
order to get a generic getpass() abstraction between two platforms.
next prev parent reply other threads:[~2011-05-19 17:27 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-19 11:37 [PATCH] compat: add a getpass() compatibility function Rafael Gieschke
2011-05-19 12:17 ` Erik Faye-Lund
2011-05-19 16:30 ` Junio C Hamano
2011-05-19 17:01 ` Rafael Gieschke
2011-05-19 17:27 ` Junio C Hamano [this message]
2011-05-19 18:07 ` Erik Faye-Lund
2011-05-19 19:16 ` Rafael Gieschke
2011-05-19 19:19 ` Erik Faye-Lund
2011-05-19 19:42 ` Rafael Gieschke
2011-05-19 20:12 ` Erik Faye-Lund
2011-05-19 21:16 ` Erik Faye-Lund
2011-05-20 10:06 ` Rafael Gieschke
2011-05-20 10:48 ` Erik Faye-Lund
2011-05-20 17:18 ` Junio C Hamano
2011-05-20 17:26 ` Erik Faye-Lund
2011-05-19 12:21 ` Erik Faye-Lund
2011-05-19 15:14 ` Jonathan Nieder
2011-05-19 15:29 ` Erik Faye-Lund
2011-05-19 17:17 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7v62p68ut0.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=kusmabite@gmail.com \
--cc=rafael@gieschke.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.