Re: [Haskell-cafe] Disable echo in POSIX terminal

2007-11-10 Thread Henning Thielemann
On Fri, 9 Nov 2007, Derek Elkins wrote: > Pointless frobbing but is there any issue with setting the echo to False > when it is already False? Otherwise not checking seems to both simpler > and quicker (not that performance matters), i.e. > getpasswd h = do > wasEnabled <- hGetEcho h > h

Re: [Haskell-cafe] Disable echo in POSIX terminal

2007-11-09 Thread Derek Elkins
On Fri, 2007-11-09 at 17:41 +0100, Alfonso Acosta wrote: > I this there's no need for a binding > > How about this? > > import Control.Monad (when) > import System.IO > > getpasswd :: Handle -> IO String > getpasswd h = do wasEnabled <- hGetEcho h > when wasEnab

Re: [Haskell-cafe] Disable echo in POSIX terminal

2007-11-09 Thread Alfonso Acosta
I this there's no need for a binding How about this? import Control.Monad (when) import System.IO getpasswd :: Handle -> IO String getpasswd h = do wasEnabled <- hGetEcho h when wasEnabled (hSetEcho h False) str <- hGetLine h

Re: [Haskell-cafe] Disable echo in POSIX terminal

2007-11-09 Thread Taylor Venable
On Fri, 9 Nov 2007 16:09:57 + "Neil Mitchell" <[EMAIL PROTECTED]> wrote: > Hi > > > 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, > >

Re: [Haskell-cafe] Disable echo in POSIX terminal

2007-11-09 Thread Alfonso Acosta
On Nov 9, 2007 5:09 PM, Neil Mitchell <[EMAIL PROTECTED]> wrote: > A quick Hoogle search for echo suggests hSetEcho, so perhaps hSetEcho > stdin False would work. Ops, Neil sent while I was still writing, I didn't know the existance of this function. ___

Re: [Haskell-cafe] Disable echo in POSIX terminal

2007-11-09 Thread Thomas Schilling
On Fri, 2007-11-09 at 10:59 -0500, Taylor Venable 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

Re: [Haskell-cafe] Disable echo in POSIX terminal

2007-11-09 Thread Alfonso Acosta
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 setTerminalAttribu

Re: [Haskell-cafe] Disable echo in POSIX terminal

2007-11-09 Thread Neil Mitchell
Hi > 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 ec

[Haskell-cafe] Disable echo in POSIX terminal

2007-11-09 Thread Taylor Venable
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 echo