Mercurial > emacs
annotate lisp/url/url-nfs.el @ 59475:279e43932b6f
(Multi-line Indent): Fix previous change.
(Fortran Autofill): Simplify description of fortran-auto-fill-mode.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 11 Jan 2005 22:41:57 +0000 |
parents | 60d07d8a52e1 |
children | a8fa7c632ee4 7a0245dd1848 |
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 |
57427 | 3 ;; Copyright (c) 1996,1997,1998,1999,2004 Free Software Foundation, Inc. |
54934
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
4 |
54695 | 5 ;; Keywords: comm, data, processes |
6 | |
54934
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
7 ;; 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
|
8 ;; |
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
9 ;; 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
|
10 ;; 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
|
11 ;; 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
|
12 ;; any later version. |
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
13 ;; |
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
14 ;; 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
|
15 ;; 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
|
16 ;; 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
|
17 ;; 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
|
18 ;; |
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
19 ;; 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
|
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
22 ;; Boston, MA 02111-1307, USA. |
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
23 |
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
24 ;;; Commentary: |
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
25 |
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
26 ;;; Code: |
54695 | 27 |
28 (eval-when-compile (require 'cl)) | |
29 (require 'url-parse) | |
30 (require 'url-file) | |
31 | |
32 (defvar url-nfs-automounter-directory-spec | |
33 "file:/net/%h%f" | |
34 "*How to invoke the NFS automounter. Certain % sequences are recognized. | |
35 | |
36 %h -- the hostname of the NFS server | |
37 %n -- the port # of the NFS server | |
38 %u -- the username to use to authenticate | |
39 %p -- the password to use to authenticate | |
40 %f -- the filename on the remote server | |
41 %% -- a literal % | |
42 | |
43 Each can be used any number of times.") | |
44 | |
45 (defun url-nfs-unescape (format host port user pass file) | |
46 (save-excursion | |
47 (set-buffer (get-buffer-create " *nfs-parse*")) | |
48 (erase-buffer) | |
49 (insert format) | |
50 (goto-char (point-min)) | |
51 (while (re-search-forward "%\\(.\\)" nil t) | |
52 (let ((escape (aref (match-string 1) 0))) | |
53 (replace-match "" t t) | |
54 (case escape | |
55 (?% (insert "%")) | |
56 (?h (insert host)) | |
57 (?n (insert (or port ""))) | |
58 (?u (insert (or user ""))) | |
59 (?p (insert (or pass ""))) | |
60 (?f (insert (or file "/")))))) | |
61 (buffer-string))) | |
62 | |
63 (defun url-nfs-build-filename (url) | |
64 (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
|
65 (port (url-port url)) |
54695 | 66 (pass (url-password url)) |
67 (user (url-user url)) | |
68 (file (url-filename url))) | |
69 (url-generic-parse-url | |
70 (url-nfs-unescape url-nfs-automounter-directory-spec | |
71 host port user pass file)))) | |
72 | |
73 (defun url-nfs (url callback cbargs) | |
74 (url-file (url-nfs-build-filename url) callback cbargs)) | |
75 | |
76 (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
|
77 `(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
|
78 ,(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
|
79 (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
|
80 (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
|
81 ,@(remove '&rest (remove '&optional args)))))) |
54695 | 82 |
83 (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
|
84 (url-nfs-create-wrapper file-attributes (url &optional id-format)) |
54695 | 85 (url-nfs-create-wrapper file-symlink-p (url)) |
86 (url-nfs-create-wrapper file-readable-p (url)) | |
87 (url-nfs-create-wrapper file-writable-p (url)) | |
88 (url-nfs-create-wrapper file-executable-p (url)) | |
89 (if (featurep 'xemacs) | |
90 (progn | |
91 (url-nfs-create-wrapper directory-files (url &optional full match nosort files-only)) | |
92 (url-nfs-create-wrapper file-truename (url &optional default))) | |
93 (url-nfs-create-wrapper directory-files (url &optional full match nosort)) | |
94 (url-nfs-create-wrapper file-truename (url &optional counter prev-dirs))) | |
95 | |
96 (provide 'url-nfs) | |
54699 | 97 |
54934
2fc584798d79
(url-nfs-file-attributes): Add id-format parameter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54770
diff
changeset
|
98 ;; 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
|
99 ;;; url-nfs.el ends here |