;;; -*- Mode: Common-Lisp; Package: SYSTEM; Base: 10.; Patch-File: T -*-

;;; Reason: Modified prompt-and-read-internal to handle the case where *query-io* support :prompt-and-read and the function returns nil. It was reprompting the user. [10793] DAB

;;;                           RESTRICTED RIGHTS LEGEND
;;;
;;; Use, duplication, or disclosure by the Government is subject to
;;; restrictions as set forth in subdivision (c)(1)(ii) of the Rights in
;;; Technical Data and Computer Software clause at 52.227-7013.
;;;
;;;   TEXAS INSTRUMENTS INCORPORATED      
;;;   P.O. BOX 2909, M/S 2151             
;;;   AUSTIN, TEXAS 78769                 
;;;
;;; Copyright (C) 1989 Texas Instruments Incorporated.
;;; All rights reserved.

;;; Patch file for SYSTEM version 6.24
;;; Written 11/21/89 12:14:14 by BERGER,
;;; while running on ARIES from band LODX
;;; With SYSTEM 6.23, VIRTUAL-MEMORY 6.2, EH 6.5, MAKE-SYSTEM 6.2, MICRONET 6.0, LOCAL-FILE 6.1,
;;;  BASIC-PATHNAME 6.2, NETWORK-SUPPORT-COLD 6.2, BASIC-NAMESPACE 6.6, NETWORK-NAMESPACE 6.0,
;;;  DISK-IO 6.1, DISK-LABEL 6.0, BASIC-FILE 6.6, MAC-PATHNAME 6.0, NETWORK-PATHNAME 6.0,
;;;  COMPILER 6.14, TV 6.19, DATALINK 6.0, CHAOSNET 6.5, GC 6.3, MEMORY-AUX 6.0, NVRAM 6.2,
;;;  SYSLOG 6.2, STREAMER-TAPE 6.4, UCL 6.0, INPUT-EDITOR 6.0, METER 6.1, ZWEI 6.8,
;;;  DEBUG-TOOLS 6.3, NETWORK-SUPPORT 6.0, NETWORK-SERVICE 6.2, DATALINK-DISPLAYS 6.0,
;;;  FONT-EDITOR 6.1, SERIAL 6.0, PRINTER 6.3, MAC-PRINTER-TYPES 6.1, PRINTER-TYPES 6.2,
;;;  IMAGEN 6.1, SUGGESTIONS 6.1, MAIL-DAEMON 6.3, MAIL-READER 6.6, TELNET 6.0, VT100 6.0,
;;;  NAMESPACE-EDITOR 6.4, PROFILE 6.2, VISIDOC 6.5, TI-CLOS 6.26, CLEH 6.5, IP 3.56,
;;;  Experimental CLX 6.7, CLUE 6.32, X11M 6.16, Experimental BUG 11.17,  microcode 429,
;;;  Band Name: rel6.0 10/23

#!C
; From file STREAMS.LISP#> KERNEL; SYS:
#10R SYSTEM#:
(COMPILER-LET ((*PACKAGE* (FIND-PACKAGE "SYSTEM"))
                          (SI:*LISP-MODE* :COMMON-LISP)
                          (*READTABLE* COMMON-LISP-READTABLE)
                          (SI:*READER-SYMBOL-SUBSTITUTIONS* *COMMON-LISP-SYMBOL-SUBSTITUTIONS*))
  (COMPILER#:PATCH-SOURCE-FILE "SYS: KERNEL; STREAMS.#"


(defun prompt-and-read-internal (option rubout-handler-options format-string &optional format-args)
  ;; 11/20/87 CLM - Fix to use ZLC:MEMQ instead of MEMQ.  The function was looking for MEMQ in the
  ;;                SYS package, which used to work.  At some time MEMQ must have been exported to
  ;;                SYS, but this is no longer the case.
  (if (send *query-io* :operation-handled-p :prompt-and-read)
      ;; DAB 11-21-89 Changed  OR to IF. User may return NIL from function,
      ;; which is different from not support :prompt-and-read
      (lexpr-send *query-io* :send-if-handles :prompt-and-read option format-string format-args)
      (let* ((option-type (if (consp option)
			      (car option)
			      option))
	     (function (get option-type 'prompt-and-read-function))
	     (prompt-and-read-format-string format-string)
	     (prompt-and-read-format-args format-args))
	(cond
	  ((get option-type 'prompt-and-read-no-rubout-function)
	   (send (get option-type 'prompt-and-read-no-rubout-function) option *query-io*))
	  ((null function)
	   (ferror () "~S is not a known PROMPT-AND-READ option keyword." option-type))
	  ((send *query-io* :operation-handled-p :rubout-handler)
	   (let ((rh-options (get option-type 'prompt-and-read-rubout-options
				  '((:prompt prompt-and-read-prompt-function)
				    (:activation zlc:memq (#\END #\NEWLINE))))))
	     (if rubout-handler-options
		 (setf rh-options (cons rubout-handler-options rh-options)))
	     (send *query-io* :rubout-handler rh-options function option *query-io*)))
	  (t (funcall function option *query-io*))))))
))
