Mercurial > emacs
annotate lisp/url/url-nfs.el @ 76705:e61171cf2862
(testcover-start, testcover-end, testcover-mark-all, testcover-unmark-all): Add
prompts to interactive specs.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sat, 24 Mar 2007 15:53:07 +0000 |
parents | e3694f1cb928 |
children | 8932997d0b62 b8d9a391daf3 |
rev | line source |
---|---|
54695 | 1 ;;; url-nfs.el --- NFS URL interface |
54934
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
2 |
64748
875dcc490074
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64084
diff
changeset
|
3 ;; Copyright (C) 1996, 1997, 1998, 1999, 2004, |
75347 | 4 ;; 2005, 2006, 2007 Free Software Foundation, Inc. |
54934
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
5 |
54695 | 6 ;; Keywords: comm, data, processes |
7 | |
54934
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
8 ;; This file is part of GNU Emacs. |
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
9 ;; |
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
10 ;; GNU Emacs is free software; you can redistribute it and/or modify |
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
11 ;; it under the terms of the GNU General Public License as published by |
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
12 ;; the Free Software Foundation; either version 2, or (at your option) |
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
13 ;; any later version. |
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
14 ;; |
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
15 ;; GNU Emacs is distributed in the hope that it will be useful, |
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
18 ;; GNU General Public License for more details. |
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
19 ;; |
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
20 ;; You should have received a copy of the GNU General Public License |
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
64084 | 22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
23 ;; Boston, MA 02110-1301, USA. | |
54934
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
24 |
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
25 ;;; Commentary: |
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
26 |
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
27 ;;; Code: |
54695 | 28 |
29 (eval-when-compile (require 'cl)) | |
30 (require 'url-parse) | |
31 (require 'url-file) | |
32 | |
33 (defvar url-nfs-automounter-directory-spec | |
34 "file:/net/%h%f" | |
35 "*How to invoke the NFS automounter. Certain % sequences are recognized. | |
36 | |
37 %h -- the hostname of the NFS server | |
38 %n -- the port # of the NFS server | |
39 %u -- the username to use to authenticate | |
40 %p -- the password to use to authenticate | |
41 %f -- the filename on the remote server | |
42 %% -- a literal % | |
43 | |
44 Each can be used any number of times.") | |
45 | |
46 (defun url-nfs-unescape (format host port user pass file) | |
47 (save-excursion | |
48 (set-buffer (get-buffer-create " *nfs-parse*")) | |
49 (erase-buffer) | |
50 (insert format) | |
51 (goto-char (point-min)) | |
52 (while (re-search-forward "%\\(.\\)" nil t) | |
53 (let ((escape (aref (match-string 1) 0))) | |
54 (replace-match "" t t) | |
55 (case escape | |
56 (?% (insert "%")) | |
57 (?h (insert host)) | |
58 (?n (insert (or port ""))) | |
59 (?u (insert (or user ""))) | |
60 (?p (insert (or pass ""))) | |
61 (?f (insert (or file "/")))))) | |
62 (buffer-string))) | |
63 | |
64 (defun url-nfs-build-filename (url) | |
65 (let* ((host (url-host url)) | |
57886
60d07d8a52e1
* url-imap.el (url-imap-open-host): Don't use
Masatake YAMATO <jet@gyve.org>
parents:
57427
diff
changeset
|
66 (port (url-port url)) |
54695 | 67 (pass (url-password url)) |
68 (user (url-user url)) | |
69 (file (url-filename url))) | |
70 (url-generic-parse-url | |
71 (url-nfs-unescape url-nfs-automounter-directory-spec | |
72 host port user pass file)))) | |
73 | |
74 (defun url-nfs (url callback cbargs) | |
75 (url-file (url-nfs-build-filename url) callback cbargs)) | |
76 | |
77 (defmacro url-nfs-create-wrapper (method args) | |
54934
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
78 `(defun ,(intern (format "url-nfs-%s" method)) ,args |
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
79 ,(format "NFS URL wrapper around `%s' call." method) |
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
80 (setq url (url-nfs-build-filename url)) |
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
81 (and url (,(intern (format "url-file-%s" method)) |
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
82 ,@(remove '&rest (remove '&optional args)))))) |
54695 | 83 |
84 (url-nfs-create-wrapper file-exists-p (url)) | |
54934
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
85 (url-nfs-create-wrapper file-attributes (url &optional id-format)) |
54695 | 86 (url-nfs-create-wrapper file-symlink-p (url)) |
87 (url-nfs-create-wrapper file-readable-p (url)) | |
88 (url-nfs-create-wrapper file-writable-p (url)) | |
89 (url-nfs-create-wrapper file-executable-p (url)) | |
66225 | 90 (url-nfs-create-wrapper directory-files (url &optional full match nosort)) |
91 (url-nfs-create-wrapper file-truename (url &optional counter prev-dirs)) | |
54695 | 92 |
93 (provide 'url-nfs) | |
54699 | 94 |
54934
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
95 ;; arch-tag: cdf9c9ba-b7d2-4c29-8b48-7ae9bbc0d437 |
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
96 ;;; url-nfs.el ends here |