- "Y-OR-N-P prints the message, if any, and reads characters from *QUERY-IO*
- until the user enters y or Y as an affirmative, or either n or N as a
- negative answer. It ignores preceding whitespace and asks again if you
- enter any other characters."
- (when format-string
- (fresh-line *query-io*)
- (apply #'format *query-io* format-string arguments))
- (loop
- (let* ((line (query-readline))
- (ans (if (string= line "")
- #\? ;Force CASE below to issue instruction.
- (schar line 0))))
- (unless (sb!impl::whitespacep ans)
- (case ans
- ((#\y #\Y) (return t))
- ((#\n #\N) (return nil))
- (t
- (write-line "Please type \"y\" for yes or \"n\" for no. "
- *query-io*)
- (when format-string
- (apply #'format *query-io* format-string arguments))
- (force-output *query-io*)))))))
-
-;;; This is similar to Y-OR-N-P, but it clears the input buffer, beeps, and
-;;; uses READ-LINE to get "YES" or "NO".
+ "Y-OR-N-P prints the message, if any, and reads characters from
+ *QUERY-IO* until the user enters y or Y as an affirmative, or either
+ n or N as a negative answer. It asks again if you enter any other
+ characters."
+ (flet ((print-query ()
+ (apply #'maybe-print-query "(y or n)" format-string arguments)))
+ (loop (print-query)
+ (case (query-read-char)
+ ((#\y #\Y) (return t))
+ ((#\n #\N) (return nil))
+ (t (clarify-legal-query-input "y" "n"))))))
+