#+sbcl
(require :sb-posix)
#+sbcl
(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)))
#+sbcl
(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)))
#+sbcl
(defun prompt-for-value (prompt)
(format t "~&~a " prompt)
(force-output)
(read-line))
#+sbcl
(defun prompt-for-value/no-echo (prompt)
(format t "~&~a " prompt)
(force-output)
(echo-off)
(unwind-protect
(read-line)
(echo-on)))
#+capi
(defun prompt-for-value (prompt)
(capi:prompt-for-string prompt))
#+capi
(defun prompt-for-value/no-echo (prompt)
(capi:prompt-for-string prompt :pane-class 'capi:password-pane))
(defun get-passphrase-from-user ()
(prompt-for-value/no-echo "Passphrase?"))