comparison lisp/url/url-gw.el @ 70241:07c1b5999e53

(url-open-stream): Don't hide errors. (url-gateway-nslookup-host, url-open-telnet): Use with-current-buffer.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 26 Apr 2006 20:40:18 +0000
parents e8a3fb527b77
children 437fb645afb4 966a40e7fb54
comparison
equal deleted inserted replaced
70240:00c538418054 70241:07c1b5999e53
116 (if url-gateway-nslookup-program 116 (if url-gateway-nslookup-program
117 (let ((proc (start-process " *nslookup*" " *nslookup*" 117 (let ((proc (start-process " *nslookup*" " *nslookup*"
118 url-gateway-nslookup-program host)) 118 url-gateway-nslookup-program host))
119 (res host)) 119 (res host))
120 (set-process-query-on-exit-flag proc nil) 120 (set-process-query-on-exit-flag proc nil)
121 (save-excursion 121 (with-current-buffer (process-buffer proc)
122 (set-buffer (process-buffer proc))
123 (while (memq (process-status proc) '(run open)) 122 (while (memq (process-status proc) '(run open))
124 (accept-process-output proc)) 123 (accept-process-output proc))
125 (goto-char (point-min)) 124 (goto-char (point-min))
126 (if (re-search-forward "Name:.*\nAddress: *\\(.*\\)$" nil t) 125 (if (re-search-forward "Name:.*\nAddress: *\\(.*\\)$" nil t)
127 (setq res (buffer-substring (match-beginning 1) 126 (setq res (buffer-substring (match-beginning 1)
166 165
167 ;; Stolen from red gnus nntp.el 166 ;; Stolen from red gnus nntp.el
168 (defun url-open-telnet (name buffer host service) 167 (defun url-open-telnet (name buffer host service)
169 (if (not (stringp service)) 168 (if (not (stringp service))
170 (setq service (int-to-string service))) 169 (setq service (int-to-string service)))
171 (save-excursion 170 (with-current-buffer (get-buffer-create buffer)
172 (set-buffer (get-buffer-create buffer))
173 (erase-buffer) 171 (erase-buffer)
174 (let ((proc (start-process name buffer "telnet" "-8")) 172 (let ((proc (start-process name buffer "telnet" "-8"))
175 (case-fold-search t)) 173 (case-fold-search t))
176 (when (memq (process-status proc) '(open run)) 174 (when (memq (process-status proc) '(open run))
177 (process-send-string proc "set escape \^X\n") 175 (process-send-string proc "set escape \^X\n")
259 (rlogin 257 (rlogin
260 (url-open-rlogin name buffer host service)) 258 (url-open-rlogin name buffer host service))
261 (otherwise 259 (otherwise
262 (error "Bad setting of url-gateway-method: %s" 260 (error "Bad setting of url-gateway-method: %s"
263 url-gateway-method))))) 261 url-gateway-method)))))
264 (error 262 ;; Ignoring errors here seems wrong. E.g. it'll throw away the
265 (setq conn nil))) 263 ;; error signalled two lines above. It was also found inconvenient
264 ;; during debugging.
265 ;; (error
266 ;; (setq conn nil))
267 )
266 conn))) 268 conn)))
267 269
268 (provide 'url-gw) 270 (provide 'url-gw)
269 271
270 ;;; arch-tag: 1c4c0317-6d03-45b8-b3f3-838bd8f9d838 272 ;; arch-tag: 1c4c0317-6d03-45b8-b3f3-838bd8f9d838
271 ;;; url-gw.el ends here 273 ;;; url-gw.el ends here