Re: [fpc-pascal] Readln a password

2017-01-03 Thread Bart
On 1/3/17, Tony Whyman wrote: > Today, I also came up against the problem of how to read a password from > the console without echo. With a bit of googling and code bashing, I > have created the following cross-platform code from a "getpassword" > function. > >repeat > read(c); >

Re: [fpc-pascal] Readln a password

2017-01-03 Thread Tony Whyman
On 27/11/16 17:07, Michael Van Canneyt wrote: If you mean in a cross-platform way, I think we would welcome patches :) Michael. Today, I also came up against the problem of how to read a password from the console without echo. With a bit of googling and code bashing, I have created the follo

Re: [fpc-pascal] Readln a password

2016-11-27 Thread geneb
On Sun, 27 Nov 2016, Adriaan van Os wrote: I wonder what the recommended way is to readln a password from console, as a standard Readln echoes the password. Readln is wholly unsuited to the task. You're better off writing a routine that gets input one character at a time. g. -- Proud owne

Re: [fpc-pascal] Readln a password

2016-11-27 Thread Jonas Maebe
On 27/11/16 18:54, James Richters wrote: Shouldn't an extremely basic function like readkey be cross-platform? It is, but the crt unit only works with (almost) fully functional terminal windows, and not with redirected or piped input/output (as used by Xcode). Jonas __

Re: [fpc-pascal] Readln a password

2016-11-27 Thread James Richters
users discussions Subject: Re: [fpc-pascal] Readln a password On Sun, 27 Nov 2016, Adriaan van Os wrote: >> Dmitry Boyarintsev wrote: >> >>> I'd think you want something simlar on unix. >>> Take a look at man 4 termios >>> specifically at local flag named &qu

Re: [fpc-pascal] Readln a password

2016-11-27 Thread Michael Van Canneyt
On Sun, 27 Nov 2016, Adriaan van Os wrote: Dmitry Boyarintsev wrote: I'd think you want something simlar on unix. Take a look at man 4 termios specifically at local flag named "ECHO". you want to disable it via tcsetattr() Â (TermIO unit) Thanks for the hint. I haven't yet tried it, but I

Re: [fpc-pascal] Readln a password

2016-11-27 Thread Adriaan van Os
Dmitry Boyarintsev wrote: I'd think you want something simlar on unix. Take a look at man 4 termios specifically at local flag named "ECHO". you want to disable it via tcsetattr() Â (TermIO unit) Thanks for the hint. I haven't yet tried it, but I would expect it to fail,as stty (see stty.c in

Re: [fpc-pascal] Readln a password

2016-11-27 Thread Adriaan van Os
Tomas Hajny wrote: Does the same limitation / issue apply for Keyboard.GetKeyEvent/PollKeyEvent on Mac OS X? To a lesser extent. It doesn't write "funny characters" to the Xcode Console window as "uses CRT" does, but still echoes typed characters. Like with "uses CRT", the problem doesn't occu

Re: [fpc-pascal] Readln a password

2016-11-27 Thread Adriaan van Os
Dmitry Boyarintsev wrote: I'd think you want something simlar on unix. Take a look at man 4 termios specifically at local flag named "ECHO". you want to disable it via tcsetattr() Â (TermIO unit) Thanks for the hint. I haven't yet tried it, but I would expect it to fail, as stty (see stty.c in

Re: [fpc-pascal] Readln a password

2016-11-27 Thread Tomas Hajny
On Sun, November 27, 2016 15:49, Adriaan van Os wrote: > James Richters wrote: >> Here is how I read passwords... it generates a random character and >> displays >> that so someone looking over your shoulder things those characters are >> the >> password >> It uses readkey which does not display on

Re: [fpc-pascal] Readln a password

2016-11-27 Thread Dmitry Boyarintsev
On Sun, Nov 27, 2016 at 8:24 AM, Adriaan van Os wrote: > I wonder what the recommended way is to readln a password from console, as > a standard Readln echoes the password. > > 1. SetConsoleMode seems to be Windows-specific > I'd think you want something simlar on unix. Take a look at man 4 term

Re: [fpc-pascal] Readln a password

2016-11-27 Thread Adriaan van Os
James Richters wrote: Here is how I read passwords... it generates a random character and displays that so someone looking over your shoulder things those characters are the password It uses readkey which does not display on the screen, one character at a time Thanks for your reply, but please

Re: [fpc-pascal] Readln a password

2016-11-27 Thread James Richters
2016 8:24 AM To: FPC-Pascal users discussions Subject: [fpc-pascal] Readln a password I wonder what the recommended way is to readln a password from console, as a standard Readln echoes the password. 1. SetConsoleMode seems to be Windows-specific 2. On Mac OS X, a loop with a Crt.ReadKey un

Re: [fpc-pascal] Readln a password

2016-11-27 Thread James Richters
e- From: fpc-pascal-boun...@lists.freepascal.org [mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of Adriaan van Os Sent: Sunday, November 27, 2016 8:24 AM To: FPC-Pascal users discussions Subject: [fpc-pascal] Readln a password I wonder what the recommended way is to readln a password

[fpc-pascal] Readln a password

2016-11-27 Thread Adriaan van Os
I wonder what the recommended way is to readln a password from console, as a standard Readln echoes the password. 1. SetConsoleMode seems to be Windows-specific 2. On Mac OS X, a loop with a Crt.ReadKey until char(13) works in Terminal.app, but behaves strange in the Xcode Console window (more