;;; -*- Mode:Lisp; Readtable:CL; Package:USER; Base:10; Patch-File:T -*-
;;; Patch file for System version 123.83
;;; Reason:
;;;  User FTP opens a data connection, sends a LIST command to the remote host,
;;;  expecting to get a "150 data connection open", reads all the data from the
;;;  connection, and then expects to get a "226 data transfer complete".  If the
;;;  first packet is lost, and when the remote TCP retransmits it the transfer
;;;  is complete so that both replies are in one buffer, our user FTP loses
;;;  the second reply because it foolishly did a :clear-input after the first reply.
;;; Written 28-Oct-87 20:18:40 by pld at site LMI Cambridge
;;; while running on Jack Flanders from band 2
;;; with Experimental System 123.81, Experimental Local-File 73.0, Experimental FILE-Server 22.0, Experimental Unix-Interface 11.0, Experimental Tape 18.0, Experimental KERMIT 34.0, Experimental ZMail 71.0, Experimental Lambda-Diag 15.0, microcode 1754, SDU Boot Tape 3.12, SDU ROM 8.



; From modified file DJ: L.NETWORK.IP-TCP.USER; FTP.LISP#35 at 28-Oct-87 20:18:41
#10R FTP#: 
(COMPILER-LET ((*PACKAGE* (GLOBAL:PKG-FIND-PACKAGE "FTP")))
  (COMPILER::PATCH-SOURCE-FILE "SYS: NETWORK; IP-TCP; USER; FTP  "

(defun command-1 (command-string)
  (if *debug* (format t "~&---> ~A~%" command-string))
  (unless *control*
    (and *debug* (format *error-output* "~&No control connection for command~%"))
    (return-from command-1 0))
  (push (string-append "" command-string) *history*)
  (do ((j 0 (1+ j))
       (n (length command-string)))
      ((= j n))
    (send *control* :tyo (aref command-string j)))
  
  (send *control* :tyo (sym cr))
  (send *control* :tyo (sym lf))
  (send *control* :force-output)
  (getreply (if (string-equal command-string "QUIT")
		(if *ignore-reply-from-quit*
		    (return-from command-1 nil)
		  t)))
  )

))
