From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id QAA19269; Sat, 7 Feb 2004 16:12:05 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id QAA18575 for ; Sat, 7 Feb 2004 16:12:04 +0100 (MET) Received: from mwinf0902.wanadoo.fr (smtp9.wanadoo.fr [193.252.22.22]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id i17FC3v28982 for ; Sat, 7 Feb 2004 16:12:03 +0100 (MET) Received: from morgana (ARennes-303-1-17-244.w81-51.abo.wanadoo.fr [81.51.43.244]) by mwinf0902.wanadoo.fr (SMTP Server) with ESMTP id 9C96918000B6; Sat, 7 Feb 2004 16:12:03 +0100 (CET) Received: from david by morgana with local (Exim 4.30) id 1ApU7l-00017u-Id; Sat, 07 Feb 2004 16:12:01 +0100 To: Alain.Frisch@ens.fr Cc: caml-list@inria.fr Subject: Re: [Caml-list] How to read a password without displaying it? References: From: David MENTRE Organization: none Date: Sat, 07 Feb 2004 16:12:01 +0100 In-Reply-To: (Alain Frisch's message of "Sat, 7 Feb 2004 15:50:08 +0100 (MET)") Message-ID: <874qu2sz3y.fsf@linux-france.org> User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 dmentre:01 alain:01 alain:01 frisch:01 tcgetattr:01 stdin:01 tcsetattr:01 stdin:01 tcsetattr:01 tcsaflush:01 dmentre:01 writes:01 mentre:01 mentre:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hello Alain, Alain.Frisch@ens.fr writes: > The field c_echo in the record type Unix.terminal_io might be the > solution. Thanks a lot Alain, you found the right solution. Here is the working code: open Unix [...] let read_password () = let term_init = tcgetattr stdin in let term_no_echo = { term_init with c_echo = false; } in tcsetattr stdin TCSANOW term_no_echo; let password = read_line () in tcsetattr stdin TCSAFLUSH term_init; password Many thanks, d. -- David Mentré ------------------- 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