caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Remi Vanicat <remi.vanicat@laposte.net>
To: caml-list@inria.fr
Subject: Re: [Caml-list] How to read a password without displaying it?
Date: Sat, 07 Feb 2004 15:59:45 +0100	[thread overview]
Message-ID: <87ad3vvsta.dlv@vanicat.homelinux.org> (raw)
In-Reply-To: <87d68rrlrc.fsf@linux-france.org> (David MENTRE's message of "Sat, 07 Feb 2004 15:45:43 +0100")

David MENTRE <dmentre@linux-france.org> writes:

> Thank you Basile and Maxence for your replies,
>
> In fact, I wanted to do that in caml only, to be portable on Windows
> and I'm relunctant to bind to C code. However, from what you said,
> it seems impossible.

Well, I would try to use the Terminal interface of the Unix library :

open Unix

let read_pass () =
  let attr = tcgetattr stdin in
  tcsetattr stdin TCSAFLUSH { attr with c_echo = false };
  let line = read_line () in
  tcsetattr stdin TCSAFLUSH attr;
  line

It work. Of course you could do something to print * when the user
type something, but this is a first solution. By the way i don't know
if this work on windows.

-- 
Rémi Vanicat

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  parent reply	other threads:[~2004-02-07 14:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-07 12:53 David MENTRE
2004-02-07 13:17 ` Basile STARYNKEVITCH
2004-02-07 13:42   ` Maxence Guesdon
2004-02-07 14:45   ` David MENTRE
2004-02-07 14:54     ` David MENTRE
2004-02-07 14:59     ` Remi Vanicat [this message]
2004-02-07 14:50 ` Alain.Frisch
2004-02-07 15:12   ` David MENTRE
2004-02-07 16:31     ` David Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ad3vvsta.dlv@vanicat.homelinux.org \
    --to=remi.vanicat@laposte.net \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).