Function: eudc-ph-read-response

eudc-ph-read-response is a byte-compiled function defined in eudcb-ph.el.gz.

Signature

(eudc-ph-read-response PROCESS &optional RETURN-RESPONSE)

Documentation

Read a response from the PH/QI query process PROCESS.

Returns nil if response starts with an error code. If the response is successful the return code or the response itself is returned depending on RETURN-RESPONSE.

Source Code

;; Defined in /usr/src/emacs/lisp/obsolete/eudcb-ph.el.gz
(defun eudc-ph-read-response (process &optional return-response)
  "Read a response from the PH/QI query process PROCESS.
Returns nil if response starts with an error code.  If the
response is successful the return code or the response itself is returned
depending on RETURN-RESPONSE."
  (let ((case-fold-search nil)
	return-code
	match-end)
    (goto-char eudc-ph-read-point)
    ;; CCSO protocol : response complete if status >= 200
    (while (not (re-search-forward "^\\(^[2-5].*\\):.*\n" nil t))
      (accept-process-output process)
      (goto-char eudc-ph-read-point))
    (setq match-end (point))
    (goto-char eudc-ph-read-point)
    (if (and (setq return-code (match-string 1))
	     (setq return-code (string-to-number return-code))
	     (>= (abs return-code) 300))
	(progn (setq eudc-ph-read-point match-end) nil)
      (setq eudc-ph-read-point match-end)
      (if return-response
	  (buffer-substring (point) match-end)
	return-code))))