From 3dc0ce960272311cf5153573ee06acc44ddbbb3b Mon Sep 17 00:00:00 2001
From: "Brian A. LaMacchia" <edu/mit/csail/zurich/bal>
Date: Mon, 6 Apr 1992 20:14:08 +0000
Subject: [PATCH] Added support for .KY files.

---
 v7/src/edwin/edwin.pkg  |  4 +++-
 v7/src/edwin/prompt.scm | 42 +++++++++++++++++++++++++++++++++++++++--
 2 files changed, 43 insertions(+), 3 deletions(-)

diff --git a/v7/src/edwin/edwin.pkg b/v7/src/edwin/edwin.pkg
index 41db2686a..ca009da67 100644
--- a/v7/src/edwin/edwin.pkg
+++ b/v7/src/edwin/edwin.pkg
@@ -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
diff --git a/v7/src/edwin/prompt.scm b/v7/src/edwin/prompt.scm
index 7e2467f3c..bdc348f77 100644
--- a/v7/src/edwin/prompt.scm
+++ b/v7/src/edwin/prompt.scm
@@ -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))))
+
+;;; 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))))))
+
-- 
2.25.1