]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
improve treatment of multi-line replies, ignore empty lines
authorGuido van Rossum <guido@python.org>
Thu, 12 Jan 1995 12:42:09 +0000 (12:42 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 12 Jan 1995 12:42:09 +0000 (12:42 +0000)
Demo/sockets/ftp.py

index 1b672d3fc906c3aff05e9bfb613f3bd76d1ebdd4..2d492398c7260741cd2a0a6b178f76de0193fec7 100755 (executable)
@@ -114,7 +114,7 @@ def getreply(f):
                        line = f.readline()
                        if not line: break # Really an error
                        print line,
-                       if line[:3] == code: break
+                       if line[:3] == code and line[3:4] != '-': break
        return code
 
 
@@ -134,7 +134,9 @@ def getdata(r):
 #
 def getcommand():
        try:
-               return raw_input('ftp.py> ')
+               while 1:
+                       line = raw_input('ftp.py> ')
+                       if line: return line
        except EOFError:
                return ''