[fpc-pascal] Readln a password
James Richters
james at productionautomation.net
Sun Nov 27 18:54:32 CET 2016
Shouldn't an extremely basic function like readkey be cross-platform?
-----Original Message-----
From: fpc-pascal-bounces at lists.freepascal.org
[mailto:fpc-pascal-bounces at lists.freepascal.org] On Behalf Of Michael Van
Canneyt
Sent: Sunday, November 27, 2016 12:07 PM
To: FPC-Pascal users discussions <fpc-pascal at lists.freepascal.org>
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 "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 GNU coreutils) calls tcsetattr and stty
>> fails reporting 'stty: stdin isn't a terminal' .
>
> No, it was my own fault. I were executing '/bin/stty -echo' with
> AssignStreams and then StdIn is indeed not a terminal, but a pipe.
> When I execute it normally, then stty does work, so I expect tcsetattr to
work too.
>
> So, we can now use Readln without echoing in Terminal.app. There is
> still echoing to the Xcode Console window, but let's assume that is a
> bug or limitation of Xcode.
>
> Maybe something to add to the fpc runtime libs ?
If you mean in a cross-platform way, I think we would welcome patches :)
Michael.
More information about the fpc-pascal
mailing list