[plt-scheme] read-line no echo

From: john m (jptm70 at whoever.com)
Date: Sun Feb 13 13:43:58 EST 2005

Great! This is a far better solution than the one I attempted. Did not think to check out stty!

Thanks alot.

----- Original Message -----
From: "Eli Barzilay" <eli at barzilay.org>
To: "john m" <jptm70 at whoever.com>
Subject: Re: [plt-scheme] read-line no echo
Date: Sun, 13 Feb 2005 13:00:25 -0500

> 
> On Feb 13, john m wrote:
> > I am trying to implement a password prompt where characters are not
> > echoed. I have searched around but not found a solution. I have
> > managed to kludge a solution by using (system ...) and accessing the
> > bash command 'read -s'. Is there a scheme solution or does this need
> > an extension written in C? I only need to support OS X and Linux.
> 
> You can use stty:
> 
>    (require 'process)
>    (define (get-passwd)
>      (dynamic-wind
>        (lambda ()
>          (printf "password: ") (system* "/bin/stty" "-echo" "echonl"))
>        read-line
>        (lambda () (system* "/bin/stty" "echo"))))
>    (get-passwd)
> 
> but I don't think there's an obvious way to avoid a system command
> (unless you're willing to write C).  Otherwise, mred would be more
> convenient and portable.
> 
> --
>            ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
>                    http://www.barzilay.org/                 Maze is Life!

-- 
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm



Posted on the users mailing list.