Added support for .KY files.
authorBrian A. LaMacchia <edu/mit/csail/zurich/bal>
Mon, 6 Apr 1992 20:14:08 +0000 (20:14 +0000)
committerBrian A. LaMacchia <edu/mit/csail/zurich/bal>
Mon, 6 Apr 1992 20:14:08 +0000 (20:14 +0000)
v7/src/edwin/edwin.pkg
v7/src/edwin/prompt.scm

index 41db2686aa97b1e34aab582a5728d80b67a8efbc..ca009da6749368acf53e168a22fd378778a8005c 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/edwin.pkg,v 1.83 1992/04/04 13:07:07 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/edwin.pkg,v 1.84 1992/04/06 20:13:54 bal Exp $
 
 Copyright (c) 1989-92 Massachusetts Institute of Technology
 
@@ -535,8 +535,10 @@ MIT in each case. |#
          prompt-for-command
          prompt-for-completed-string
          prompt-for-confirmation?
+         prompt-for-confirmed-password
          prompt-for-key
          prompt-for-number
+         prompt-for-password
          prompt-for-string
          prompt-for-string-table-name
          prompt-for-string-table-value
index 7e2467f3c5bc44dc7fae64f8a754c2fda97ed62d..bdc348f7719b5c044f47055697ecd09b9f0ff44f 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/prompt.scm,v 1.153 1992/02/17 22:09:37 cph Exp $
+;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/prompt.scm,v 1.154 1992/04/06 20:14:08 bal Exp $
 ;;;
 ;;;    Copyright (c) 1986, 1989-92 Massachusetts Institute of Technology
 ;;;
@@ -771,4 +771,42 @@ Whilst editing the command, the following commands are available:
   "Inserts the next element of `command-history' into the minibuffer."
   "p"
   (lambda (argument)
-    ((ref-command next-complex-command) (- argument))))
\ No newline at end of file
+    ((ref-command next-complex-command) (- argument))))
+\f
+;;; Password Prompts
+
+;;; These procedures are used by the encrypt/decrypt-file routines 
+;;; in unix.scm which deal with .KY files.
+
+(define (prompt-for-password prompt)
+  (prompt-for-typein 
+   prompt false
+   (lambda ()
+     (let loop ((ts ""))
+       (let ((input (keyboard-read)))
+        (if (and (char? input) (char-ascii? input))
+            (cond ((char=? input #\Return)
+                   ts)
+                  ((char=? input #\C-g)
+                   (abort-current-command))
+                  ((char=? input #\Rubout)
+                   (let ((new-string (string-head ts (-1+ (string-length ts)))))
+                     (set-typein-string!
+                      (make-string (string-length new-string) #\.) true)
+                     (loop new-string)))
+                  (else
+                   (set-typein-string!
+                    (make-string (1+ (string-length ts)) #\.) true)
+                   (loop (string-append ts (char->string input)))))
+            (loop ts)))))))
+
+(define (prompt-for-confirmed-password)
+  (let ((password1 (prompt-for-password "Password: ")))
+    (let ((password2 (prompt-for-password "Verify: ")))
+      (if (string=? password1 password2)
+         password1
+         (begin
+           (editor-beep)
+           (message "Passwords do not match!")
+           (abort-current-command))))))
+