From: Brian Jiang
Subject: How to get the password input from user without echo it?
Date: 
Message-ID: <614c3967-81ed-4ad7-afda-2472c60dc7d8@w4g2000prd.googlegroups.com>
I am writing a script in common lisp now. It needs to ask the user to
input the password. I can use (read-line) to do that, but it will echo
user's password in the screen. How can I suppress the password echo?
How can I suppress echo in GNU CLISP?

From: mac
Subject: Re: How to get the password input from user without echo it?
Date: 
Message-ID: <60d359c4-cef9-4ce6-8782-8070901cdf75@1g2000prg.googlegroups.com>
On May 15, 10:09 am, Brian Jiang <········@gmail.com> wrote:
> I am writing a script in common lisp now. It needs to ask the user to
> input the password. I can use (read-line) to do that, but it will echo
> user's password in the screen. How can I suppress the password echo?
> How can I suppress echo in GNU CLISP?


you can write a ffi wrapper to

char *getpass(const char *prompt)   //#include <unistd.h>

using clisp's ffi or cffi/uffi.

hth,
mac
From: Zach Beane
Subject: Re: How to get the password input from user without echo it?
Date: 
Message-ID: <m363tf5plf.fsf@unnamed.xach.com>
Brian Jiang <········@gmail.com> writes:

> I am writing a script in common lisp now. It needs to ask the user to
> input the password. I can use (read-line) to do that, but it will echo
> user's password in the screen. How can I suppress the password echo?
> How can I suppress echo in GNU CLISP?

Using EXT:WITH-KEYBOARD might help. It's documented here:

  http://clisp.cons.org/impnotes.html#with-kbd

Zach
From: Brian Jiang
Subject: Re: How to get the password input from user without echo it?
Date: 
Message-ID: <3129896d-5bc8-497c-bd76-08917265ec11@z24g2000prf.googlegroups.com>
On May 16, 3:34 am, Zach Beane <····@xach.com> wrote:
> Brian Jiang <········@gmail.com> writes:
> > I am writing a script in common lisp now. It needs to ask the user to
> > input the password. I can use (read-line) to do that, but it will echo
> > user's password in the screen. How can I suppress the password echo?
> > How can I suppress echo in GNU CLISP?
>
> Using EXT:WITH-KEYBOARD might help. It's documented here:
>
>  http://clisp.cons.org/impnotes.html#with-kbd
>
> Zach

Excellent!!! Thank you very much.
I can implement the function now as follows:

(ext:with-keyboard
 (loop
    :with str = (make-array 20 :element-type 'character :fill-pointer
0)
    :with key
    :for char = (read-char ext:*keyboard-input*)
    :do
    (cond ((ext:char-key char))
          ((setq key (character char))
           (cond ((eql key #\Return)
                  (return str)
                  )
                 (t
                  (vector-push key str))
                 )))
    ))
From: Brian Jiang
Subject: Re: How to get the password input from user without echo it?
Date: 
Message-ID: <6982218d-8164-4691-b859-2e44c27d67ee@x19g2000prg.googlegroups.com>
On May 16, 10:59 am, Brian Jiang <········@gmail.com> wrote:
> On May 16, 3:34 am, Zach Beane <····@xach.com> wrote:
>
> > Brian Jiang <········@gmail.com> writes:
> > > I am writing a script in common lisp now. It needs to ask the user to
> > > input the password. I can use (read-line) to do that, but it will echo
> > > user's password in the screen. How can I suppress the password echo?
> > > How can I suppress echo in GNU CLISP?
>
> > Using EXT:WITH-KEYBOARD might help. It's documented here:
>
> >  http://clisp.cons.org/impnotes.html#with-kbd
>
> > Zach
>
> Excellent!!! Thank you very much.
> I can implement the function now as follows:
>
> (ext:with-keyboard
>  (loop
>     :with str = (make-array 20 :element-type 'character :fill-pointer
> 0)
>     :with key
>     :for char = (read-char ext:*keyboard-input*)
>     :do
>     (cond ((ext:char-key char))
>           ((setq key (character char))
>            (cond ((eql key #\Return)
>                   (return str)
>                   )
>                  (t
>                   (vector-push key str))
>                  )))
>     ))

Changed a little, to support Backspace.

(ext:with-keyboard
 (loop
    :with str = (make-array 20 :element-type 'character :fill-pointer
0)
    :with key
    :for char = (read-char ext:*keyboard-input*)
    :do
    (cond ((ext:char-key char))
          ((setq key (character char))
           (cond ((eql key #\Return)
                  (return str)
                  )
                 ((eql key #\Backspace)
                  (when (> (length str) 0)
                    (vector-pop str))
                  )
                 (t
                  (vector-push key str))
                 )))
    ))
From: Pascal J. Bourguignon
Subject: Re: How to get the password input from user without echo it?
Date: 
Message-ID: <7c4p8yzoe9.fsf@pbourguignon.anevia.com>
Brian Jiang <········@gmail.com> writes:

> On May 16, 10:59 am, Brian Jiang <········@gmail.com> wrote:
>> On May 16, 3:34 am, Zach Beane <····@xach.com> wrote:
>>
>> > Brian Jiang <········@gmail.com> writes:
>> > > I am writing a script in common lisp now. It needs to ask the user to
>> > > input the password. I can use (read-line) to do that, but it will echo
>> > > user's password in the screen. How can I suppress the password echo?
>> > > How can I suppress echo in GNU CLISP?
>>
>> > Using EXT:WITH-KEYBOARD might help. It's documented here:
>>
>> >  http://clisp.cons.org/impnotes.html#with-kbd
>>
>> > Zach
>>
>> Excellent!!! Thank you very much.
>> I can implement the function now as follows:
>>
> Changed a little, to support Backspace.

Notice that most unix password reader just don't support backspace,
which allows you to include backspaces or delete codes in your
passwords, as well as most other control codes.

-- 
__Pascal Bourguignon__
From: ·······@eurogaran.com
Subject: Re: How to get the password input from user without echo it?
Date: 
Message-ID: <8c5cdb15-8a83-45de-8a83-12b63f168e45@d77g2000hsb.googlegroups.com>
> Notice that most unix password reader just don't support backspace,
> which allows you to include backspaces or delete codes in your
> passwords, as well as most other control codes.

This has pros and cons: Linux login allows for backspace to correct
mistakes done while entering the password. I find this to be very
convenient. Your choice.
From: Mark Wooding
Subject: Re: How to get the password input from user without echo it?
Date: 
Message-ID: <slrng37rqv.ihm.mdw@metalzone.distorted.org.uk>
Pascal J. Bourguignon <···@informatimago.com> wrote:

> Notice that most unix password reader just don't support backspace,
> which allows you to include backspaces or delete codes in your
> passwords, as well as most other control codes.

I've just tried this on Linux, OpenBSD, Solaris, AIX and HPUX (the
architectures available to be right here); only HPUX had this
brokenness.  So I'd hardly call it `most'.

-- [mdw]
From: Frank Goenninger DG1SBG
Subject: [OT] Re: How to get the password input from user without echo it?
Date: 
Message-ID: <lzve15xro0.fsf_-_@goenninger.net>
Mark Wooding <···@distorted.org.uk> writes:

> Pascal J. Bourguignon <···@informatimago.com> wrote:
>
>> Notice that most unix password reader just don't support backspace,
>> which allows you to include backspaces or delete codes in your
>> passwords, as well as most other control codes.
>
> I've just tried this on Linux, OpenBSD, Solaris, AIX and HPUX (the
> architectures available to be right here); only HPUX had this
> brokenness.

The brokenness is on your side, not on HP-UX side. How did you test
this? With which terminal settings? hpterm or xterm? ... And where did
you read that supporting Backspace or Delete as editing controls is
required for password input?

[Using HP-UX here for production environments]

Best,
  Frank
-- 

  Frank Goenninger

  frgo(at)mac(dot)com

  "Don't ask me! I haven't been reading comp.lang.lisp long enough to 
  really know ..."