From: Richard M K. <kr...@pr...> - 2007-04-19 01:11:33
|
"P. García" <gu...@us...> writes: > Hello, > > I need to program a function in sbcl unix to read a password, but I > don't know how to make the keyboard echo disabled and enable (echo > off and on). > > > At news groups I found a Fred Gilham code to do this with CMUCL: > http://groups.google.com/group/comp.lang.lisp/msg/af274400a851d58a > > > I think using sb-posix package may be usefull to do that. Any help? I've used something like the following in the past. Dunno if it's the recommended way to do things, but it seems to work. (require :sb-posix) (defun echo-off () (let ((tm (sb-posix:tcgetattr sb-sys:*tty*))) (setf (sb-posix:termios-lflag tm) (logandc2 (sb-posix:termios-lflag tm) sb-posix:echo)) (sb-posix:tcsetattr sb-sys:*tty* sb-posix:tcsanow tm))) (defun echo-on () (let ((tm (sb-posix:tcgetattr sb-sys:*tty*))) (setf (sb-posix:termios-lflag tm) (logior (sb-posix:termios-lflag tm) sb-posix:echo)) (sb-posix:tcsetattr sb-sys:*tty* sb-posix:tcsanow tm))) -- RmK |