Skip to content
Snippets Groups Projects
Commit 7e8c7c03 authored by ram's avatar ram
Browse files

.../systems-work/code/query.lisp, 14-Jun-90 21:46:58, Edit by Chiles.

  Fixed a bug in Y-OR-N-P.  It was calling WHITESPACEP on a symbol.

.../systems-work/code/query.lisp, 03-May-90 14:49:56, Edit by Chiles.
  Fixed doc-string on Y-OR-N-P.
parent f5ff3bf4
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,7 @@
;;; Scott Fahlman or slisp-group@cs.cmu.edu.
;;;
(ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/query.lisp,v 1.2 1991/02/08 13:35:02 ram Exp $")
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/query.lisp,v 1.3 1991/02/14 19:03:24 ram Exp $")
;;;
;;; **********************************************************************
;;;
......@@ -31,24 +31,20 @@
;;; Y-OR-N-P -- Public.
;;;
;;; This prints the message, if any, and reads characters from *QUERY-IO* until
;;; any of "y", "Y", or <newline> are seen as an affirmative, or either "n" or
;;; "N" is seen as a negative answer. It ignores preceding whitespace and asks
;;; again if other characters are seen.
;;;
(defun y-or-n-p (&optional format-string &rest arguments)
"Y-OR-N-P prints the message, if any, and reads characters from
*QUERY-IO* until any of y, Y, or <newline> are seen as an
affirmative, or either n or N is seen as a negative answer.
It ignores preceding whitespace and asks again if other characters
are seen."
"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)
(force-output *query-io*))
(loop
(let* ((line (query-readline))
(ans (if (string= line "") :ignore-and-warn (schar line 0))))
(ans (if (string= line "")
#\? ;Force CASE below to issue instruction.
(schar line 0))))
(unless (whitespacep ans)
(case ans
((#\y #\Y) (return t))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment