comparison lisp/ange-ftp.el @ 15798:a745f54990f5

(ange-ftp-read-passwd): Let first input override default, and let RET use the default value. (ange-ftp-get-passwd): Make prompt clearer.
author Richard M. Stallman <rms@gnu.org>
date Mon, 29 Jul 1996 16:27:49 +0000
parents 8e6b770317a5
children 4bc8e9119883
comparison
equal deleted inserted replaced
15797:24c31fcbcf97 15798:a745f54990f5
1006 1006
1007 (defun ange-ftp-read-passwd (prompt &optional default) 1007 (defun ange-ftp-read-passwd (prompt &optional default)
1008 "Read a password, echoing `.' for each character typed. 1008 "Read a password, echoing `.' for each character typed.
1009 End with RET, LFD, or ESC. DEL or C-h rubs out. C-u kills line. 1009 End with RET, LFD, or ESC. DEL or C-h rubs out. C-u kills line.
1010 Optional DEFAULT is password to start with." 1010 Optional DEFAULT is password to start with."
1011 (let ((pass (if default default "")) 1011 (let ((pass nil)
1012 (c 0) 1012 (c 0)
1013 (echo-keystrokes 0) 1013 (echo-keystrokes 0)
1014 (cursor-in-echo-area t)) 1014 (cursor-in-echo-area t))
1015 (while (progn (message "%s%s" 1015 (while (progn (message "%s%s"
1016 prompt 1016 prompt
1023 (setq pass (concat pass (char-to-string c))) 1023 (setq pass (concat pass (char-to-string c)))
1024 (if (> (length pass) 0) 1024 (if (> (length pass) 0)
1025 (setq pass (substring pass 0 -1)))))) 1025 (setq pass (substring pass 0 -1))))))
1026 (message "") 1026 (message "")
1027 (ange-ftp-repaint-minibuffer) 1027 (ange-ftp-repaint-minibuffer)
1028 pass)) 1028 (or pass default "")))
1029 1029
1030 (defmacro ange-ftp-generate-passwd-key (host user) 1030 (defmacro ange-ftp-generate-passwd-key (host user)
1031 (` (concat (, host) "/" (, user)))) 1031 (` (concat (, host) "/" (, user))))
1032 1032
1033 (defmacro ange-ftp-lookup-passwd (host user) 1033 (defmacro ange-ftp-lookup-passwd (host user)
1100 (passwd (if other 1100 (passwd (if other
1101 1101
1102 ;; found another machine with the same user. 1102 ;; found another machine with the same user.
1103 ;; Try that account. 1103 ;; Try that account.
1104 (ange-ftp-read-passwd 1104 (ange-ftp-read-passwd
1105 (format "passwd for %s@%s (same as %s@%s): " 1105 (format "passwd for %s@%s (default same as %s@%s): "
1106 user host user other) 1106 user host user other)
1107 (ange-ftp-lookup-passwd other user)) 1107 (ange-ftp-lookup-passwd other user))
1108 1108
1109 ;; I give up. Ask the user for the password. 1109 ;; I give up. Ask the user for the password.
1110 (ange-ftp-read-passwd 1110 (ange-ftp-read-passwd