check for EOF in parse-status-line,

use inlined #rx.

original commit: 31a30053bc491bc6a2582ee98792857fa580de89
This commit is contained in:
Eli Barzilay 2004-05-10 08:52:50 +00:00
parent 7a0c5c5b48
commit c6446eecf2

View File

@ -121,9 +121,11 @@
;; string -> number x string ;; string -> number x string
(define parse-status-line (define parse-status-line
(let ((pattern (regexp "([0-9]+) (.*)")))
(lambda (line) (lambda (line)
(let ((match (cdr (or (regexp-match pattern line) (if (eof-object? line)
((signal-error make-bad-status-line "eof instead of a status line")
line)
(let ((match (cdr (or (regexp-match #rx"([0-9]+) (.*)" line)
((signal-error make-bad-status-line ((signal-error make-bad-status-line
"malformed status line: ~s" line) "malformed status line: ~s" line)
line))))) line)))))
@ -187,7 +189,6 @@
;; article number, and the last article number for that group. ;; article number, and the last article number for that group.
(define open-news-group (define open-news-group
(let ((pattern (regexp "([0-9]+) ([0-9]+) ([0-9]+)")))
(lambda (communicator group-name) (lambda (communicator group-name)
(send-to-server communicator "GROUP ~a" group-name) (send-to-server communicator "GROUP ~a" group-name)
(let-values (((code rest-of-line) (let-values (((code rest-of-line)
@ -196,7 +197,7 @@
((211) ((211)
(let ((match (map string->number (let ((match (map string->number
(cdr (cdr
(or (regexp-match pattern rest-of-line) (or (regexp-match #rx"([0-9]+) ([0-9]+) ([0-9]+)" rest-of-line)
((signal-error make-bad-newsgroup-line ((signal-error make-bad-newsgroup-line
"malformed newsgroup open response: ~s" "malformed newsgroup open response: ~s"
rest-of-line) rest-of-line)
@ -215,7 +216,7 @@
(else (else
((signal-error make-unexpected-response ((signal-error make-unexpected-response
"unexpected group opening response: ~s" code) "unexpected group opening response: ~s" code)
code rest-of-line))))))) code rest-of-line))))))
;; generic-message-command : ;; generic-message-command :
;; string x number -> communicator x (number U string) -> list (string) ;; string x number -> communicator x (number U string) -> list (string)