Re: [PATCH] compat: add a getpass() compatibility function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rafael Gieschke <rafael@xxxxxxxxxxx> 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.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]