comparison lisp/net/netrc.el @ 91204:53108e6cea98

Merge from emacs--devo--0 Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-294
author Miles Bader <miles@gnu.org>
date Thu, 06 Dec 2007 09:51:45 +0000
parents 880960b70474 d549ccffa35b
children 56a72e2bd635
comparison
equal deleted inserted replaced
91203:db40129142b2 91204:53108e6cea98
37 37
38 (defalias 'netrc-point-at-eol 38 (defalias 'netrc-point-at-eol
39 (if (fboundp 'point-at-eol) 39 (if (fboundp 'point-at-eol)
40 'point-at-eol 40 'point-at-eol
41 'line-end-position)) 41 'line-end-position))
42 ;; autoload encrypt
43
44 (eval-and-compile
45 (autoload 'encrypt-find-model "encrypt")
46 (autoload 'encrypt-insert-file-contents "encrypt"))
47 42
48 (defgroup netrc nil 43 (defgroup netrc nil
49 "Netrc configuration." 44 "Netrc configuration."
50 :group 'comm) 45 :group 'comm)
51 46
58 (when (file-exists-p file) 53 (when (file-exists-p file)
59 (with-temp-buffer 54 (with-temp-buffer
60 (let ((tokens '("machine" "default" "login" 55 (let ((tokens '("machine" "default" "login"
61 "password" "account" "macdef" "force" 56 "password" "account" "macdef" "force"
62 "port")) 57 "port"))
63 (encryption-model (encrypt-find-model file))
64 alist elem result pair) 58 alist elem result pair)
65 59 (insert-file-contents file)
66 (if encryption-model
67 (encrypt-insert-file-contents file encryption-model)
68 (insert-file-contents file))
69
70 (goto-char (point-min)) 60 (goto-char (point-min))
71 ;; Go through the file, line by line. 61 ;; Go through the file, line by line.
72 (while (not (eobp)) 62 (while (not (eobp))
73 (narrow-to-region (point) (point-at-eol)) 63 (narrow-to-region (point) (point-at-eol))
74 ;; For each line, get the tokens and values. 64 ;; For each line, get the tokens and values.
188 (let ((services (netrc-parse-services)) 178 (let ((services (netrc-parse-services))
189 service) 179 service)
190 (setq type (or type 'tcp)) 180 (setq type (or type 'tcp))
191 (while (and (setq service (pop services)) 181 (while (and (setq service (pop services))
192 (not (and (= number (cadr service)) 182 (not (and (= number (cadr service))
193 (eq type (caddr service))))) 183 (eq type (car (cddr service)))))))
194 )
195 (car service))) 184 (car service)))
196 185
197 (defun netrc-find-service-number (name &optional type) 186 (defun netrc-find-service-number (name &optional type)
198 (let ((services (netrc-parse-services)) 187 (let ((services (netrc-parse-services))
199 service) 188 service)
200 (setq type (or type 'tcp)) 189 (setq type (or type 'tcp))
201 (while (and (setq service (pop services)) 190 (while (and (setq service (pop services))
202 (not (and (string= name (car service)) 191 (not (and (string= name (car service))
203 (eq type (caddr service))))) 192 (eq type (car (cddr service)))))))
204 )
205 (cadr service))) 193 (cadr service)))
206 194
207 (provide 'netrc) 195 (provide 'netrc)
208 196
209 ;;; arch-tag: af9929cc-2d12-482f-936e-eb4366f9fa55 197 ;;; arch-tag: af9929cc-2d12-482f-936e-eb4366f9fa55