[Haskell-cafe] Disable echo in POSIX terminal

Alfonso Acosta alfonso.acosta at gmail.com
Fri Nov 9 11:18:36 EST 2007


I never used System.POSIX.Terminal  myself but from what I read in the
haddock documentation I think this function can help you.

import System.Posix.Types (Fd)
import System.Posix.Terminal

disableEcho :: Fd -> IO ()
disableEcho fd =  do
   attribs <- getTerminalAttributes fd
   setTerminalAttributes fd (withoutMode attribs EnableEcho)  Immediately



On Nov 9, 2007 4:59 PM, Taylor Venable <taylor at metasyntax.net> wrote:
> Hello all,
>
> I've written a little Haskell program to get information from a MySQL
> database (great thanks to anybody reading this who works on HSQL, by
> the way) but I want to keep the user's password concealed, obviously.
> Currently I prompt for it from the terminal, but the problem is that
> it's echoed just like all other input.  I would like to disable input
> echo when asking for the password, but I'm not sure how.  I notice
> there's a System.POSIX.Terminal module, but I have no idea how to use
> it, or whether it will do what I want.  Any ideas would be greatly
> appreciated.
>
> Best regards.
>
> --
> Taylor Venable
> taylor at metasyntax.net
> http://real.metasyntax.net:2357/
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>


More information about the Haskell-Cafe mailing list